From: jeff.evanson@gmail.com
To: Jesse Brandeburg <jesse.brandeburg@intel.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Jesper Dangaard Brouer <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Vedang Patel <vedang.patel@intel.com>,
Andre Guedes <andre.guedes@intel.com>,
Maciej Fijalkowski <maciej.fijalkowski@intel.com>,
Jithu Joseph <jithu.joseph@intel.com>,
intel-wired-lan@lists.osuosl.org (moderated list:INTEL ETHERNET
DRIVERS), netdev@vger.kernel.org (open list:NETWORKING DRIVERS),
linux-kernel@vger.kernel.org (open list),
bpf@vger.kernel.org (open list:XDP (eXpress Data Path))
Cc: Jeff Evanson <jeff.evanson@qsc.com>
Subject: [PATCH v2 1/2] igc: Fix race in igc_xdp_xmit_zc
Date: Tue, 19 Apr 2022 19:26:34 -0600 [thread overview]
Message-ID: <20220420012635.13733-2-jeff.evanson@qsc.com> (raw)
In-Reply-To: <20220420012635.13733-1-jeff.evanson@qsc.com>
From: Jeff Evanson <jeff.evanson@qsc.com>
In igc_xdp_xmit_zc, initialize next_to_use while holding the netif_tx_lock
to prevent racing with other users of the tx ring.
Fixes: 9acf59a752d4 (igc: Enable TX via AF_XDP zero-copy)
---
drivers/net/ethernet/intel/igc/igc_main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index 1c00ee310c19..a36a18c84aeb 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -2598,7 +2598,7 @@ static void igc_xdp_xmit_zc(struct igc_ring *ring)
struct netdev_queue *nq = txring_txq(ring);
union igc_adv_tx_desc *tx_desc = NULL;
int cpu = smp_processor_id();
- u16 ntu = ring->next_to_use;
+ u16 ntu;
struct xdp_desc xdp_desc;
u16 budget;
@@ -2607,6 +2607,8 @@ static void igc_xdp_xmit_zc(struct igc_ring *ring)
__netif_tx_lock(nq, cpu);
+ ntu = ring->next_to_use;
+
budget = igc_desc_unused(ring);
while (xsk_tx_peek_desc(pool, &xdp_desc) && budget--) {
--
2.17.1
next prev parent reply other threads:[~2022-04-20 1:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-20 1:26 [PATCH v2 0/2] AF_XDP patches for zero-copy in igc driver jeff.evanson
2022-04-20 1:26 ` jeff.evanson [this message]
2022-04-20 1:26 ` [PATCH v2 2/2] igc: Trigger proper interrupts in igc_xsk_wakeup jeff.evanson
2022-04-21 20:23 ` Tony Nguyen
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=20220420012635.13733-2-jeff.evanson@qsc.com \
--to=jeff.evanson@gmail.com \
--cc=andre.guedes@intel.com \
--cc=anthony.l.nguyen@intel.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=hawk@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jeff.evanson@qsc.com \
--cc=jesse.brandeburg@intel.com \
--cc=jithu.joseph@intel.com \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=netdev@vger.kernel.org \
--cc=vedang.patel@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