From: Jeff Garzik <jgarzik@pobox.com>
To: netdev@oss.sgi.com
Subject: [Fwd: [E1000] NAPI re-insertion w/ changes]
Date: Fri, 21 Mar 2003 09:46:04 -0500 [thread overview]
Message-ID: <3E7B25AC.5030604@pobox.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 105 bytes --]
For review by the list... The other e100/e1000 changes are in the 2.5
nightly snapshot on kernel.org...
[-- Attachment #2: [E1000] NAPI re-insertion w/ changes --]
[-- Type: message/rfc822, Size: 6734 bytes --]
From: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
To: bk-commits-head@vger.kernel.org
Subject: [E1000] NAPI re-insertion w/ changes
Date: Fri, 21 Mar 2003 04:46:10 +0000
Message-ID: <200303210713.h2L7Dn802239@hera.kernel.org>
ChangeSet 1.1101.22.17, 2003/03/20 23:46:10-05:00, cramerj@intel.com
[E1000] NAPI re-insertion w/ changes
* Previous patch wiped NAPI support, adding it back here. But,
with a twist: this one doesn't disable/enable interrupts each
time we enter/leave polling. (It's EXPERIMENTAL).
# This patch includes the following deltas:
# ChangeSet 1.1101.22.16 -> 1.1101.22.17
# drivers/net/e1000/e1000_main.c 1.60 -> 1.61
#
e1000_main.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 69 insertions(+), 1 deletion(-)
diff -Nru a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
--- a/drivers/net/e1000/e1000_main.c Thu Mar 20 23:13:52 2003
+++ b/drivers/net/e1000/e1000_main.c Thu Mar 20 23:13:52 2003
@@ -155,8 +155,14 @@
static inline void e1000_irq_disable(struct e1000_adapter *adapter);
static inline void e1000_irq_enable(struct e1000_adapter *adapter);
static void e1000_intr(int irq, void *data, struct pt_regs *regs);
-static boolean_t e1000_clean_tx_irq(struct e1000_adapter *adapter);
+#ifdef CONFIG_E1000_NAPI
+static int e1000_clean(struct net_device *netdev, int *budget);
+static boolean_t e1000_clean_rx_irq(struct e1000_adapter *adapter,
+ int *work_done, int work_to_do);
+#else
static boolean_t e1000_clean_rx_irq(struct e1000_adapter *adapter);
+#endif
+static boolean_t e1000_clean_tx_irq(struct e1000_adapter *adapter);
static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter);
static int e1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd);
static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr,
@@ -418,6 +424,10 @@
netdev->do_ioctl = &e1000_ioctl;
netdev->tx_timeout = &e1000_tx_timeout;
netdev->watchdog_timeo = 5 * HZ;
+#ifdef CONFIG_E1000_NAPI
+ netdev->poll = &e1000_clean;
+ netdev->weight = 64;
+#endif
netdev->vlan_rx_register = e1000_vlan_rx_register;
netdev->vlan_rx_add_vid = e1000_vlan_rx_add_vid;
netdev->vlan_rx_kill_vid = e1000_vlan_rx_kill_vid;
@@ -1977,7 +1987,9 @@
struct net_device *netdev = data;
struct e1000_adapter *adapter = netdev->priv;
uint32_t icr = E1000_READ_REG(&adapter->hw, ICR);
+#ifndef CONFIG_E1000_NAPI
int i;
+#endif
if(!icr)
return; /* Not our interrupt */
@@ -1987,12 +1999,46 @@
mod_timer(&adapter->watchdog_timer, jiffies);
}
+#ifdef CONFIG_E1000_NAPI
+ /* Don't disable interrupts - rely on h/w interrupt
+ * moderation to keep interrupts low. netif_rx_schedule
+ * is NOP if already polling. */
+ netif_rx_schedule(netdev);
+#else
for(i = 0; i < E1000_MAX_INTR; i++)
if(!e1000_clean_rx_irq(adapter) &&
!e1000_clean_tx_irq(adapter))
break;
+#endif
+}
+#ifdef CONFIG_E1000_NAPI
+/**
+ * e1000_clean - NAPI Rx polling callback
+ * @adapter: board private structure
+ **/
+
+static int
+e1000_clean(struct net_device *netdev, int *budget)
+{
+ struct e1000_adapter *adapter = netdev->priv;
+ int work_to_do = min(*budget, netdev->quota);
+ int work_done = 0;
+
+ while(work_done < work_to_do)
+ if(!e1000_clean_rx_irq(adapter, &work_done, work_to_do) &&
+ !e1000_clean_tx_irq(adapter))
+ break;
+
+ *budget -= work_done;
+ netdev->quota -= work_done;
+
+ if(work_done < work_to_do)
+ netif_rx_complete(netdev);
+
+ return (work_done >= work_to_do);
}
+#endif
/**
* e1000_clean_tx_irq - Reclaim resources after transmit completes
@@ -2054,7 +2100,12 @@
**/
static boolean_t
+#ifdef CONFIG_E1000_NAPI
+e1000_clean_rx_irq(struct e1000_adapter *adapter, int *work_done,
+ int work_to_do)
+#else
e1000_clean_rx_irq(struct e1000_adapter *adapter)
+#endif
{
struct e1000_desc_ring *rx_ring = &adapter->rx_ring;
struct net_device *netdev = adapter->netdev;
@@ -2071,6 +2122,13 @@
while(rx_desc->status & E1000_RXD_STAT_DD) {
+#ifdef CONFIG_E1000_NAPI
+ if(*work_done >= work_to_do)
+ break;
+
+ (*work_done)++;
+#endif
+
cleaned = TRUE;
pci_unmap_single(pdev,
@@ -2133,12 +2191,22 @@
e1000_rx_checksum(adapter, rx_desc, skb);
skb->protocol = eth_type_trans(skb, netdev);
+#ifdef CONFIG_E1000_NAPI
+ if(adapter->vlgrp && (rx_desc->status & E1000_RXD_STAT_VP)) {
+ vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
+ (rx_desc->special & E1000_RXD_SPC_VLAN_MASK));
+ } else {
+ netif_receive_skb(skb);
+ }
+#else /* CONFIG_E1000_NAPI */
if(adapter->vlgrp && (rx_desc->status & E1000_RXD_STAT_VP)) {
vlan_hwaccel_rx(skb, adapter->vlgrp,
(rx_desc->special & E1000_RXD_SPC_VLAN_MASK));
} else {
netif_rx(skb);
}
+#endif /* CONFIG_E1000_NAPI */
+
netdev->last_rx = jiffies;
rx_desc->status = 0;
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2003-03-21 14:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-21 14:46 Jeff Garzik [this message]
2003-03-22 15:34 ` [Fwd: [E1000] NAPI re-insertion w/ changes] Robert Olsson
-- strict thread matches above, loose matches on Subject: below --
2003-03-22 18:47 Feldman, Scott
2003-03-22 20:28 ` Robert Olsson
2003-03-31 17:14 ` Robert Olsson
2003-03-27 16:54 Robert Olsson
2003-03-27 17:10 ` Jason Lunz
2003-03-28 8:27 ` Robert Olsson
2003-03-28 17:32 ` Jason Lunz
2003-03-28 18:43 ` Robert Olsson
2003-04-01 17:47 Feldman, Scott
2003-04-01 18:57 ` Robert Olsson
2003-04-01 21:16 ` Jeff Garzik
2003-04-01 19:13 Feldman, Scott
2003-04-01 19:23 ` Jason Lunz
2003-04-01 22:40 ` Jason Lunz
2003-04-01 19:44 ` Robert Olsson
2003-04-01 21:22 Feldman, Scott
2003-04-02 0:13 Feldman, Scott
2003-04-02 4:19 ` Jason Lunz
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=3E7B25AC.5030604@pobox.com \
--to=jgarzik@pobox.com \
--cc=netdev@oss.sgi.com \
/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;
as well as URLs for NNTP newsgroup(s).