patch-2.1.22 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

diff -u --recursive --new-file v2.1.21/linux/net/netrom/nr_out.c linux/net/netrom/nr_out.c
@@ -53,7 +53,7 @@
 	int err, frontlen, len, mtu;
 
 	mtu = sk->protinfo.nr->paclen;
-	
+
 	if (skb->len - NR_TRANSPORT_LEN > mtu) {
 		/* Save a copy of the Transport Header */
 		memcpy(transport, skb->data, NR_TRANSPORT_LEN);
@@ -82,10 +82,10 @@
 
 			if (skb->len > 0)
 				skbn->data[4] |= NR_MORE_FLAG;
-		
+
 			skb_queue_tail(&sk->write_queue, skbn); /* Throw it on the queue */
 		}
-		
+
 		kfree_skb(skb, FREE_WRITE);
 	} else {
 		skb_queue_tail(&sk->write_queue, skb);		/* Throw it on the queue */
@@ -107,7 +107,7 @@
 	skb->data[2] = sk->protinfo.nr->vs;
 	skb->data[3] = sk->protinfo.nr->vr;
 
-	if (sk->protinfo.nr->condition & OWN_RX_BUSY_CONDITION)
+	if (sk->protinfo.nr->condition & NR_COND_OWN_RX_BUSY)
 		skb->data[4] |= NR_CHOKE_FLAG;
 
 	nr_transmit_buffer(sk, skb);	
@@ -116,22 +116,22 @@
 void nr_send_nak_frame(struct sock *sk)
 {
 	struct sk_buff *skb, *skbn;
-	
+
 	if ((skb = skb_peek(&sk->protinfo.nr->ack_queue)) == NULL)
 		return;
-		
+
 	if ((skbn = skb_clone(skb, GFP_ATOMIC)) == NULL)
 		return;
 
 	skbn->data[2] = sk->protinfo.nr->va;
 	skbn->data[3] = sk->protinfo.nr->vr;
 
-	if (sk->protinfo.nr->condition & OWN_RX_BUSY_CONDITION)
+	if (sk->protinfo.nr->condition & NR_COND_OWN_RX_BUSY)
 		skbn->data[4] |= NR_CHOKE_FLAG;
 
 	nr_transmit_buffer(sk, skbn);
 
-	sk->protinfo.nr->condition &= ~ACK_PENDING_CONDITION;
+	sk->protinfo.nr->condition &= ~NR_COND_ACK_PENDING;
 	sk->protinfo.nr->vl         = sk->protinfo.nr->vr;
 	sk->protinfo.nr->t1timer    = 0;
 }
@@ -139,16 +139,15 @@
 void nr_kick(struct sock *sk)
 {
 	struct sk_buff *skb, *skbn;
-	int last = 1;
-	unsigned short start, end, next;
+	unsigned short start, end;
 
 	del_timer(&sk->timer);
 
 	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 & PEER_RX_BUSY_CONDITION) &&
-	    start != end                                  &&
+	if (!(sk->protinfo.nr->condition & NR_COND_PEER_RX_BUSY) &&
+	    start != end                                         &&
 	    skb_peek(&sk->write_queue) != NULL) {
 
 		sk->protinfo.nr->vs = start;
@@ -169,25 +168,24 @@
 				break;
 			}
 
-			next = (sk->protinfo.nr->vs + 1) % NR_MODULUS;
-			last = (next == end);
+			skb_set_owner_w(skbn, sk);
 
 			/*
 			 * Transmit the frame copy.
 			 */
 			nr_send_iframe(sk, skbn);
 
-			sk->protinfo.nr->vs = next;
+			sk->protinfo.nr->vs = (sk->protinfo.nr->vs + 1) % NR_MODULUS;
 
 			/*
 			 * Requeue the original data frame.
 			 */
 			skb_queue_tail(&sk->protinfo.nr->ack_queue, skb);
 
-		} while (!last && (skb = skb_dequeue(&sk->write_queue)) != NULL);
+		} while (sk->protinfo.nr->vs != end && (skb = skb_dequeue(&sk->write_queue)) != NULL);
 
 		sk->protinfo.nr->vl         = sk->protinfo.nr->vr;
-		sk->protinfo.nr->condition &= ~ACK_PENDING_CONDITION;
+		sk->protinfo.nr->condition &= ~NR_COND_ACK_PENDING;
 
 		if (sk->protinfo.nr->t1timer == 0) {
 			sk->protinfo.nr->t1timer = sk->protinfo.nr->t1 = nr_calculate_t1(sk);
@@ -207,15 +205,15 @@
 	dptr = skb_push(skb, NR_NETWORK_LEN);
 
 	memcpy(dptr, &sk->protinfo.nr->source_addr, AX25_ADDR_LEN);
-	dptr[6] &= ~LAPB_C;
-	dptr[6] &= ~LAPB_E;
-	dptr[6] |= SSSID_SPARE;
+	dptr[6] &= ~AX25_CBIT;
+	dptr[6] &= ~AX25_EBIT;
+	dptr[6] |= AX25_SSSID_SPARE;
 	dptr += AX25_ADDR_LEN;
 
 	memcpy(dptr, &sk->protinfo.nr->dest_addr, AX25_ADDR_LEN);
-	dptr[6] &= ~LAPB_C;
-	dptr[6] |= LAPB_E;
-	dptr[6] |= SSSID_SPARE;
+	dptr[6] &= ~AX25_CBIT;
+	dptr[6] |= AX25_EBIT;
+	dptr[6] |= AX25_SSSID_SPARE;
 	dptr += AX25_ADDR_LEN;
 
 	*dptr++ = sysctl_netrom_network_ttl_initialiser;
@@ -256,19 +254,19 @@
 void nr_enquiry_response(struct sock *sk)
 {
 	int frametype = NR_INFOACK;
-	
-	if (sk->protinfo.nr->condition & OWN_RX_BUSY_CONDITION) {
+
+	if (sk->protinfo.nr->condition & NR_COND_OWN_RX_BUSY) {
 		frametype |= NR_CHOKE_FLAG;
 	} else {
 		if (skb_peek(&sk->protinfo.nr->reseq_queue) != NULL) {
 			frametype |= NR_NAK_FLAG;
 		}
 	}
-	
+
 	nr_write_internal(sk, frametype);
 
 	sk->protinfo.nr->vl         = sk->protinfo.nr->vr;
-	sk->protinfo.nr->condition &= ~ACK_PENDING_CONDITION;
+	sk->protinfo.nr->condition &= ~NR_COND_ACK_PENDING;
 }
 
 void nr_check_iframes_acked(struct sock *sk, unsigned short nr)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov