mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Trivial loopback optimization for 2.6.7
@ 2004-06-23 22:00 Chuck Ebbert
  0 siblings, 0 replies; only message in thread
From: Chuck Ebbert @ 2004-06-23 22:00 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-kernel

This patch is for the network loopback driver:

1: Removes unnecessary include with misleading comment.

2: Optimizes device stats update in the transmit routine
(saves 2 loads, one add, one increment per packet sent.)

Why is there no stats counting in the TSO code in
emulate_large_send_offload()?


Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com>

--- 267.0/drivers/net/loopback.c        2004-06-21 16:09:45.000000000 -0400
+++ 267.1/drivers/net/loopback.c        2004-06-21 16:16:20.000000000 -0400
@@ -51,7 +51,6 @@
 #include <linux/skbuff.h>
 #include <net/sock.h>
 #include <net/checksum.h>
-#include <linux/if_ether.h>    /* For the statistics structure. */
 #include <linux/if_arp.h>      /* For ARPHRD_ETHER */
 #include <linux/ip.h>
 #include <linux/tcp.h>
@@ -143,10 +142,14 @@ static int loopback_xmit(struct sk_buff 
 
        dev->last_rx = jiffies;
        if (likely(stats)) {
-               stats->rx_bytes+=skb->len;
-               stats->tx_bytes+=skb->len;
-               stats->rx_packets++;
-               stats->tx_packets++;
+               /*
+                * Transmit/receive stats are identical;
+                * rx_packets is first in struct.
+                */
+               stats->tx_packets = ++stats->rx_packets;
+
+               stats->rx_bytes += skb->len;
+               stats->tx_bytes = stats->rx_bytes;
        }
 
        netif_rx(skb);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-06-23 22:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-23 22:00 [PATCH] Trivial loopback optimization for 2.6.7 Chuck Ebbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®