mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: don-linux@isis.cs3-inc.com (Don Cohen)
To: linux-kernel@vger.kernel.org, linux-net@vger.kernel.org
Subject: proposed optimization for network drivers
Date: Wed, 16 Apr 2003 23:56:45 -0700	[thread overview]
Message-ID: <200304170656.h3H6ujA28940@isis.cs3-inc.com> (raw)


I notice that netif_rx (net/core/dev.c) discards packets when it's
in throttle mode.  However, before it does this the driver has already
wasted a lot of time allocating the skb, calling eth_type_trans, etc.
That effort could be saved if the driver checked throttle first.


Sample diff:

--- /usr/src/linux-2.4.18-clean/drivers/net/8139too.c   Mon Feb 25 11:37:59 2002
+++ /usr/src/linux-2.4.18/drivers/net/8139too.c Wed Apr 16 23:30:30 2003
@@ -1908,6 +1908,11 @@
                        return;
                }

+               if (softnet_data[smp_processor_id()].throttle) {
+                 dev->last_rx = jiffies;
+                 netdev_rx_stat[smp_processor_id()].dropped++;
+               } else {
+
                /* Malloc up new buffer, compatible with net-2e. */
                /* Omit the four octet CRC from the length. */

@@ -1936,6 +1941,7 @@
                                dev->name);
                        tp->stats.rx_dropped++;
                }
+               }

                cur_rx = (cur_rx + rx_size + 4 + 3) & ~3;
                RTL_W16 (RxBufPtr, cur_rx - 16);

Hmm, now that I notice, there is one small change in semantics here.
Before every packet that was counted by netdev_rx_stat[].dropped had
also been counted in stats.rx_bytes and rx_packets and this is no
longer the case.  If that bothers you then perhaps there should just
be a separate counter for packets dropped like this.

In my limited experimentation this sort of change has significantly
increased the number of packets I could process when they were
arriving too fast. 

Please cc me on replies.

             reply	other threads:[~2003-04-17  6:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-17  6:56 Don Cohen [this message]
2003-04-18  8:36 ` David S. Miller
2003-04-18 15:37   ` Don Cohen
2003-04-18 15:59     ` David S. Miller
2003-04-18 16:22       ` Don Cohen
2003-04-18 17:18     ` Jeff Garzik

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=200304170656.h3H6ujA28940@isis.cs3-inc.com \
    --to=don-linux@isis.cs3-inc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-net@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®