netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Alexander Lobakin <aleksander.lobakin@intel.com>
Cc: <intel-wired-lan@lists.osuosl.org>, <larysa.zaremba@intel.com>,
	<netdev@vger.kernel.org>, <michal.kubiak@intel.com>,
	<anthony.l.nguyen@intel.com>, <jacob.e.keller@intel.com>,
	Chandan Kumar Rout <chandanx.rout@intel.com>,
	<magnus.karlsson@intel.com>,
	Shannon Nelson <shannon.nelson@amd.com>
Subject: Re: [Intel-wired-lan] [PATCH v3 iwl-net 1/8] ice: respect netif readiness in AF_XDP ZC related ndo's
Date: Thu, 13 Jun 2024 18:07:53 +0200	[thread overview]
Message-ID: <ZmsZWfn1ev6KWo3r@boxer> (raw)
In-Reply-To: <ZmsVfbDTyZty2/Xh@boxer>

On Thu, Jun 13, 2024 at 05:51:25PM +0200, Maciej Fijalkowski wrote:
> On Wed, Jun 12, 2024 at 11:15:31AM +0200, Alexander Lobakin wrote:
> > From: Alexander Lobakin <aleksander.lobakin@intel.com>
> > Date: Wed, 12 Jun 2024 11:09:10 +0200
> > 
> > > From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> > > Date: Tue, 11 Jun 2024 16:21:27 +0200
> > 
> > [...]
> > 
> > >>>> diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c
> > >>>> index 2015f66b0cf9..1bd4b054dd80 100644
> > >>>> --- a/drivers/net/ethernet/intel/ice/ice_xsk.c
> > >>>> +++ b/drivers/net/ethernet/intel/ice/ice_xsk.c
> > >>>> @@ -1048,6 +1048,10 @@ bool ice_xmit_zc(struct ice_tx_ring *xdp_ring)
> > >>>>  
> > >>>>  	ice_clean_xdp_irq_zc(xdp_ring);
> > >>>>  
> > >>>> +	if (!netif_carrier_ok(xdp_ring->vsi->netdev) ||
> > >>>> +	    !netif_running(xdp_ring->vsi->netdev))
> > 
> > Oh BTW, I noticed some time ago that netif_running() is less precise
> > than checking for %IFF_UP.
> > For example, in this piece (main netdev ifup function)[0],
> > netif_running() will start returning true *before* driver's .ndo_open()
> > is called, but %IFF_UP will be set only after .ndo_open() is done (with
> > no issues).
> 
> I see, thanks for bringing this up! I'd like to try this out. Tony sorry
> for the noise, but it seems I'll go with v4 and will decorate the
> mentioned statements with unlikely().
> 
> > That means, I'd check for %IFF_UP honestly (maybe even before checking
> > the carrier).
> 
> I wonder whether it is the ultimate check and two existing ones (that we
> are adding in this patch) could be dropped?

In netdev closing path [1], __LINK_STATE_START is cleared before IFF_UP.
What we were initially experiencing when netif_running() check wasn't in
place was that xsk was producing a bunch of Tx descs when device was being
brought down. So let me keep what we have here and add IFF_UP check on
top. Better be safe than sorry as the bug we were dealing with was pretty
nasty.

> 
> > 
> > [0] https://elixir.bootlin.com/linux/v6.10-rc3/source/net/core/dev.c#L1466

[1]: https://elixir.bootlin.com/linux/v6.10-rc3/source/net/core/dev.c#L1532

> > 
> > Thanks,
> > Olek

  reply	other threads:[~2024-06-13 16:09 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-04 13:21 [PATCH v3 iwl-net 0/8] ice: fix AF_XDP ZC timeout and concurrency issues Maciej Fijalkowski
2024-06-04 13:21 ` [PATCH v3 iwl-net 1/8] ice: respect netif readiness in AF_XDP ZC related ndo's Maciej Fijalkowski
2024-06-11 11:59   ` [Intel-wired-lan] " Alexander Lobakin
2024-06-11 14:21     ` Maciej Fijalkowski
2024-06-11 20:13       ` Tony Nguyen
2024-06-12  9:09       ` Alexander Lobakin
2024-06-12  9:15         ` Alexander Lobakin
2024-06-13 15:51           ` Maciej Fijalkowski
2024-06-13 16:07             ` Maciej Fijalkowski [this message]
2024-06-14  9:34               ` Alexander Lobakin
2024-06-04 13:21 ` [PATCH v3 iwl-net 2/8] ice: don't busy wait for Rx queue disable in ice_qp_dis() Maciej Fijalkowski
2024-06-04 13:21 ` [PATCH v3 iwl-net 3/8] ice: replace synchronize_rcu with synchronize_net Maciej Fijalkowski
2024-06-04 13:21 ` [PATCH v3 iwl-net 4/8] ice: modify error handling when setting XSK pool in ndo_bpf Maciej Fijalkowski
2024-06-04 13:21 ` [PATCH v3 iwl-net 5/8] ice: toggle netif_carrier when setting up XSK pool Maciej Fijalkowski
2024-06-26 12:21   ` Michal Kubiak
2024-06-26 13:52     ` Maciej Fijalkowski
2024-06-04 13:21 ` [PATCH v3 iwl-net 6/8] ice: improve updating ice_{t,r}x_ring::xsk_pool Maciej Fijalkowski
2024-06-04 13:21 ` [PATCH v3 iwl-net 7/8] ice: add missing WRITE_ONCE when clearing ice_rx_ring::xdp_prog Maciej Fijalkowski
2024-06-04 13:21 ` [PATCH v3 iwl-net 8/8] ice: xsk: fix txq interrupt mapping Maciej Fijalkowski

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=ZmsZWfn1ev6KWo3r@boxer \
    --to=maciej.fijalkowski@intel.com \
    --cc=aleksander.lobakin@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=chandanx.rout@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jacob.e.keller@intel.com \
    --cc=larysa.zaremba@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=michal.kubiak@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=shannon.nelson@amd.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).