From: Alexander Lobakin <alexandr.lobakin@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH 1/2] Fix race in igc_xdp_xmit_zc
Date: Wed, 20 Apr 2022 12:37:08 +0200 [thread overview]
Message-ID: <20220420103708.1841070-1-alexandr.lobakin@intel.com> (raw)
In-Reply-To: <20220415210421.11217-1-jeff.evanson@qsc.com>
From: Jeff Evanson <jeff.evanson@gmail.com>
Date: Fri, 15 Apr 2022 15:04:21 -0600
> 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
>
> Signed-off-by: Jeff Evanson <jeff.evanson@qsc.com>
> ---
> 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;
Please don't break the RCT (reverse christmas tree) style here. You
should move it to the bottom of the declaration block, ideally
combine it with the declaration of @budget as they're both u16s.
> 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;
> +
There's no need for this empty newline I believe.
> budget = igc_desc_unused(ring);
>
> while (xsk_tx_peek_desc(pool, &xdp_desc) && budget--) {
> --
> 2.17.1
Thanks,
Al
prev parent reply other threads:[~2022-04-20 10:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-15 21:04 [Intel-wired-lan] [PATCH 1/2] Fix race in igc_xdp_xmit_zc Jeff Evanson
2022-04-18 17:39 ` Vinicius Costa Gomes
2022-04-20 10:37 ` Alexander Lobakin [this message]
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=20220420103708.1841070-1-alexandr.lobakin@intel.com \
--to=alexandr.lobakin@intel.com \
--cc=intel-wired-lan@osuosl.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