patch-2.0.36 linux/net/netrom/nr_loopback.c

Next file: linux/net/rose/Makefile
Previous file: linux/net/netrom/af_netrom.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.35/linux/net/netrom/nr_loopback.c linux/net/netrom/nr_loopback.c
@@ -11,6 +11,8 @@
  *
  *	History
  *	NET/ROM 006	Tomi(OH2BNS)	Created this file.
+ *					Changed the way the loopback
+ *					queue is consumed.
  *
  */
 
@@ -53,15 +55,16 @@
 {
 	struct sk_buff *skbn;
 
-	skbn = skb_copy(skb, GFP_ATOMIC);
+	skbn = skb_clone(skb, GFP_ATOMIC);
 
 	kfree_skb(skb, FREE_WRITE);
 
-	if (skbn != NULL)
+	if (skbn != NULL) {
 		skb_queue_tail(&loopback_queue, skbn);
 
-	if (!nr_loopback_running())
-		nr_set_loopback_timer();
+		if (!nr_loopback_running())
+			nr_set_loopback_timer();
+	}
 
 	return 1;
 }
@@ -85,16 +88,16 @@
 	ax25_address *nr_dest;
 	struct device *dev;
 
-	while ((skb = skb_dequeue(&loopback_queue)) != NULL) {
+	if ((skb = skb_dequeue(&loopback_queue)) != NULL) {
 		nr_dest = (ax25_address *)(skb->data + 7);
 
-		if ((dev = nr_dev_get(nr_dest)) == NULL) {
-			kfree_skb(skb, FREE_READ);
-			continue;
-		}
+		dev = nr_dev_get(nr_dest);
 
-		if (nr_rx_frame(skb, dev) == 0)
+		if (dev == NULL || nr_rx_frame(skb, dev) == 0)
 			kfree_skb(skb, FREE_READ);
+
+		if (!skb_queue_empty(&loopback_queue) && !nr_loopback_running())
+			nr_set_loopback_timer();
 	}
 }
 

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