patch-2.4.0-test10 linux/drivers/net/tun.c

Next file: linux/drivers/net/wan/cosa.c
Previous file: linux/drivers/net/tulip/tulip_core.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test9/linux/drivers/net/tun.c linux/drivers/net/tun.c
@@ -12,7 +12,7 @@
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  *  GNU General Public License for more details.
  *
- *  $Id: tun.c,v 1.2 2000/09/22 12:40:31 maxk Exp $
+ *  $Id: tun.c,v 1.3 2000/10/23 10:01:25 maxk Exp $
  */
 
 /*
@@ -20,7 +20,7 @@
  *    Modifications for 2.3.99-pre5 kernel.
  */
 
-#define TUN_VER "1.2"
+#define TUN_VER "1.3"
 
 #include <linux/module.h>
 
@@ -47,7 +47,6 @@
 #include <asm/system.h>
 #include <asm/uaccess.h>
 
-
 #ifdef TUN_DEBUG
 static int debug=0;
 #endif
@@ -89,12 +88,6 @@
 
 	DBG(KERN_INFO "%s: tun_net_xmit %d\n", tun->name, skb->len);
 
-
-	if (netif_queue_stopped(dev))
-		return 1;
-
-	tun->stats.tx_packets++;
-
 	/* Queue frame */
 	skb_queue_tail(&tun->txq, skb);
 	if (skb_queue_len(&tun->txq) >= TUN_TXQ_SIZE)
@@ -214,7 +207,7 @@
 	}
 
 	skb_reserve(skb, 2);
-	copy_from_user(skb_put(skb, count), ptr, len); 
+	copy_from_user(skb_put(skb, len), ptr, len); 
 
 	skb->dev = &tun->dev;
 	switch (tun->flags & TUN_TYPE_MASK) {
@@ -233,6 +226,8 @@
 	netif_rx(skb);
    
 	tun->stats.rx_packets++;
+	tun->stats.rx_bytes += len;
+
 	return count;
 } 
 
@@ -280,6 +275,9 @@
 	len = MIN(skb->len, len); 
 	copy_to_user(ptr, skb->data, len); 
 	total += len;
+
+	tun->stats.tx_packets++;
+	tun->stats.tx_bytes += len;
 
 	return total;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)