patch-2.1.44 linux/net/netrom/nr_out.c
Next file: linux/net/netrom/nr_route.c
Previous file: linux/net/netrom/nr_in.c
Back to the patch index
Back to the overall index
- Lines: 184
- Date:
Mon Jul 7 08:20:00 1997
- Orig file:
v2.1.43/linux/net/netrom/nr_out.c
- Orig date:
Thu May 29 21:53:11 1997
diff -u --recursive --new-file v2.1.43/linux/net/netrom/nr_out.c linux/net/netrom/nr_out.c
@@ -1,5 +1,5 @@
/*
- * NET/ROM release 006
+ * NET/ROM release 007
*
* This code REQUIRES 2.1.15 or higher/ NET3.038
*
@@ -13,6 +13,7 @@
* NET/ROM 001 Jonathan(G4KLX) Cloned from ax25_out.c
* NET/ROM 003 Jonathan(G4KLX) Added NET/ROM fragmentation.
* Darryl(G7LED) Fixed NAK, to give out correct reponse.
+ * NET/ROM 007 Jonathan(G4KLX) New timer architecture.
*/
#include <linux/config.h>
@@ -83,8 +84,7 @@
skb_queue_tail(&sk->write_queue, skb); /* Throw it on the queue */
}
- if (sk->protinfo.nr->state == NR_STATE_3)
- nr_kick(sk);
+ nr_kick(sk);
}
/*
@@ -102,6 +102,8 @@
if (sk->protinfo.nr->condition & NR_COND_OWN_RX_BUSY)
skb->data[4] |= NR_CHOKE_FLAG;
+ nr_start_idletimer(sk);
+
nr_transmit_buffer(sk, skb);
}
@@ -125,7 +127,8 @@
sk->protinfo.nr->condition &= ~NR_COND_ACK_PENDING;
sk->protinfo.nr->vl = sk->protinfo.nr->vr;
- sk->protinfo.nr->t1timer = 0;
+
+ nr_stop_t1timer(sk);
}
void nr_kick(struct sock *sk)
@@ -133,57 +136,60 @@
struct sk_buff *skb, *skbn;
unsigned short start, end;
- del_timer(&sk->timer);
+ if (sk->protinfo.nr->state != NR_STATE_3)
+ return;
+
+ if (sk->protinfo.nr->condition & NR_COND_PEER_RX_BUSY)
+ return;
+
+ if (skb_peek(&sk->write_queue) == NULL)
+ return;
start = (skb_peek(&sk->protinfo.nr->ack_queue) == NULL) ? sk->protinfo.nr->va : sk->protinfo.nr->vs;
end = (sk->protinfo.nr->va + sk->protinfo.nr->window) % NR_MODULUS;
- if (!(sk->protinfo.nr->condition & NR_COND_PEER_RX_BUSY) &&
- start != end &&
- skb_peek(&sk->write_queue) != NULL) {
-
- sk->protinfo.nr->vs = start;
+ if (start == end)
+ return;
- /*
- * Transmit data until either we're out of data to send or
- * the window is full.
- */
+ sk->protinfo.nr->vs = start;
- /*
- * Dequeue the frame and copy it.
- */
- skb = skb_dequeue(&sk->write_queue);
+ /*
+ * Transmit data until either we're out of data to send or
+ * the window is full.
+ */
- do {
- if ((skbn = skb_clone(skb, GFP_ATOMIC)) == NULL) {
- skb_queue_head(&sk->write_queue, skb);
- break;
- }
+ /*
+ * Dequeue the frame and copy it.
+ */
+ skb = skb_dequeue(&sk->write_queue);
- skb_set_owner_w(skbn, sk);
+ do {
+ if ((skbn = skb_clone(skb, GFP_ATOMIC)) == NULL) {
+ skb_queue_head(&sk->write_queue, skb);
+ break;
+ }
- /*
- * Transmit the frame copy.
- */
- nr_send_iframe(sk, skbn);
+ skb_set_owner_w(skbn, sk);
- sk->protinfo.nr->vs = (sk->protinfo.nr->vs + 1) % NR_MODULUS;
+ /*
+ * Transmit the frame copy.
+ */
+ nr_send_iframe(sk, skbn);
- /*
- * Requeue the original data frame.
- */
- skb_queue_tail(&sk->protinfo.nr->ack_queue, skb);
+ sk->protinfo.nr->vs = (sk->protinfo.nr->vs + 1) % NR_MODULUS;
- } while (sk->protinfo.nr->vs != end && (skb = skb_dequeue(&sk->write_queue)) != NULL);
+ /*
+ * Requeue the original data frame.
+ */
+ skb_queue_tail(&sk->protinfo.nr->ack_queue, skb);
- sk->protinfo.nr->vl = sk->protinfo.nr->vr;
- sk->protinfo.nr->condition &= ~NR_COND_ACK_PENDING;
+ } while (sk->protinfo.nr->vs != end && (skb = skb_dequeue(&sk->write_queue)) != NULL);
- if (sk->protinfo.nr->t1timer == 0)
- sk->protinfo.nr->t1timer = sk->protinfo.nr->t1;
- }
+ sk->protinfo.nr->vl = sk->protinfo.nr->vr;
+ sk->protinfo.nr->condition &= ~NR_COND_ACK_PENDING;
- nr_set_timer(sk);
+ if (!nr_t1timer_running(sk))
+ nr_start_t1timer(sk);
}
void nr_transmit_buffer(struct sock *sk, struct sk_buff *skb)
@@ -211,13 +217,7 @@
if (!nr_route_frame(skb, NULL)) {
kfree_skb(skb, FREE_WRITE);
-
- sk->state = TCP_CLOSE;
- sk->err = ENETUNREACH;
- sk->shutdown |= SEND_SHUTDOWN;
- if (!sk->dead)
- sk->state_change(sk);
- sk->dead = 1;
+ nr_disconnect(sk, ENETUNREACH);
}
}
@@ -233,8 +233,10 @@
nr_write_internal(sk, NR_CONNREQ);
- sk->protinfo.nr->t2timer = 0;
- sk->protinfo.nr->t1timer = sk->protinfo.nr->t1;
+ nr_stop_t2timer(sk);
+ nr_stop_t4timer(sk);
+ nr_stop_idletimer(sk);
+ nr_start_t1timer(sk);
}
/*
@@ -261,12 +263,12 @@
{
if (sk->protinfo.nr->vs == nr) {
nr_frames_acked(sk, nr);
- sk->protinfo.nr->t1timer = 0;
+ nr_stop_t1timer(sk);
sk->protinfo.nr->n2count = 0;
} else {
if (sk->protinfo.nr->va != nr) {
nr_frames_acked(sk, nr);
- sk->protinfo.nr->t1timer = sk->protinfo.nr->t1;
+ nr_start_t1timer(sk);
}
}
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov