From: Matteo Croce <technoboy85@gmail.com>
To: Tony Nguyen <anthony.l.nguyen@intel.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Jesper Dangaard Brouer <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Mohsin Bashir <mohsin.bashr@gmail.com>,
"Nemo D'ACREMONT" <nemo.dacremont@dacremont.xyz>
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org,
intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH net-next v5 1/6] e1000e: clean the Tx ring from NAPI in MSI-X mode
Date: Fri, 4 Dec 2026 21:43:55 +0100 [thread overview]
Message-ID: <20261204204400.87468-2-technoboy85@gmail.com> (raw)
In-Reply-To: <20261204204400.87468-1-technoboy85@gmail.com>
In MSI-X mode, which is only used by 82574, Tx completions are processed
directly in the Tx hard interrupt handler, while in MSI and legacy
interrupt modes they are processed by the NAPI poll routine.
Freeing buffers coming from a page_pool, as it will happen with XDP_TX,
is not allowed from hard interrupt context.
Make the MSI-X Tx interrupt schedule NAPI as the Rx one does, always
clean the Tx ring from the poll routine, and re-enable both the Rx and
Tx interrupt causes when polling is complete.
Signed-off-by: Matteo Croce <technoboy85@gmail.com>
---
drivers/net/ethernet/intel/e1000e/netdev.c | 32 +++++++++++-----------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 6f85dab5c55c..996bd6f5fa83 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -1934,18 +1934,17 @@ static irqreturn_t e1000_intr_msix_tx(int __always_unused irq, void *data)
{
struct net_device *netdev = data;
struct e1000_adapter *adapter = netdev_priv(netdev);
- struct e1000_hw *hw = &adapter->hw;
- struct e1000_ring *tx_ring = adapter->tx_ring;
-
- adapter->total_tx_bytes = 0;
- adapter->total_tx_packets = 0;
-
- if (!e1000_clean_tx_irq(tx_ring))
- /* Ring was not completely cleaned, so fire another interrupt */
- ew32(ICS, tx_ring->ims_val);
- if (!test_bit(__E1000_DOWN, &adapter->state))
- ew32(IMS, adapter->tx_ring->ims_val);
+ /* Tx completions are processed in NAPI context, the Tx interrupt is
+ * re-enabled when polling is done.
+ */
+ if (napi_schedule_prep(&adapter->napi)) {
+ adapter->total_tx_bytes = 0;
+ adapter->total_tx_packets = 0;
+ adapter->total_rx_bytes = 0;
+ adapter->total_rx_packets = 0;
+ __napi_schedule_irqoff(&adapter->napi);
+ }
return IRQ_HANDLED;
}
@@ -1968,6 +1967,8 @@ static irqreturn_t e1000_intr_msix_rx(int __always_unused irq, void *data)
}
if (napi_schedule_prep(&adapter->napi)) {
+ adapter->total_tx_bytes = 0;
+ adapter->total_tx_packets = 0;
adapter->total_rx_bytes = 0;
adapter->total_rx_packets = 0;
__napi_schedule_irqoff(&adapter->napi);
@@ -2683,13 +2684,11 @@ static int e1000e_poll(struct napi_struct *napi, int budget)
napi);
struct e1000_hw *hw = &adapter->hw;
struct net_device *poll_dev = adapter->netdev;
- int tx_cleaned = 1, work_done = 0;
+ int tx_cleaned, work_done = 0;
adapter = netdev_priv(poll_dev);
- if (!adapter->msix_entries ||
- (adapter->rx_ring->ims_val & adapter->tx_ring->ims_val))
- tx_cleaned = e1000_clean_tx_irq(adapter->tx_ring);
+ tx_cleaned = e1000_clean_tx_irq(adapter->tx_ring);
adapter->clean_rx(adapter->rx_ring, &work_done, budget);
@@ -2704,7 +2703,8 @@ static int e1000e_poll(struct napi_struct *napi, int budget)
e1000_set_itr(adapter);
if (!test_bit(__E1000_DOWN, &adapter->state)) {
if (adapter->msix_entries)
- ew32(IMS, adapter->rx_ring->ims_val);
+ ew32(IMS, adapter->rx_ring->ims_val |
+ adapter->tx_ring->ims_val);
else
e1000_irq_enable(adapter);
}
--
2.56.1
next prev parent reply other threads:[~2026-12-04 20:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 20:43 [PATCH net-next v5 0/6] e1000e: add XDP support Matteo Croce
2026-12-04 20:43 ` Matteo Croce [this message]
2026-12-04 20:43 ` [PATCH net-next v5 2/6] e1000e: disable NAPI when bringing the interface down Matteo Croce
2026-12-04 20:43 ` [PATCH net-next v5 3/6] e1000e: remove packet split Rx Matteo Croce
2026-12-04 20:43 ` [PATCH net-next v5 4/6] e1000e: use libeth for Rx buffer management Matteo Croce
2026-12-04 20:44 ` [PATCH net-next v5 6/6] e1000e: add .ndo_xdp_xmit support Matteo Croce
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=20261204204400.87468-2-technoboy85@gmail.com \
--to=technoboy85@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mohsin.bashr@gmail.com \
--cc=nemo.dacremont@dacremont.xyz \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.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