mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chuck Ebbert <76306.1226@compuserve.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] Trivial loopback optimization for 2.6.7
Date: Wed, 23 Jun 2004 18:00:46 -0400	[thread overview]
Message-ID: <200406231803_MC3-1-854F-EC5E@compuserve.com> (raw)

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);


                 reply	other threads:[~2004-06-23 22:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200406231803_MC3-1-854F-EC5E@compuserve.com \
    --to=76306.1226@compuserve.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®