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: Tue, 11 Jun 2024 16:21:27 +0200 [thread overview]
Message-ID: <ZmhdZwzIStFpghZK@boxer> (raw)
In-Reply-To: <6f616608-7a56-43d6-9dc9-ea67c2b47030@intel.com>
On Tue, Jun 11, 2024 at 01:59:37PM +0200, Alexander Lobakin wrote:
> From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> Date: Tue, 4 Jun 2024 15:21:48 +0200
>
> > From: Michal Kubiak <michal.kubiak@intel.com>
> >
> > Address a scenario in which XSK ZC Tx produces descriptors to XDP Tx
> > ring when link is either not yet fully initialized or process of
> > stopping the netdev has already started. To avoid this, add checks
> > against carrier readiness in ice_xsk_wakeup() and in ice_xmit_zc().
> > One could argue that bailing out early in ice_xsk_wakeup() would be
> > sufficient but given the fact that we produce Tx descriptors on behalf
> > of NAPI that is triggered for Rx traffic, the latter is also needed.
> >
> > Bringing link up is an asynchronous event executed within
> > ice_service_task so even though interface has been brought up there is
> > still a time frame where link is not yet ok.
> >
> > Without this patch, when AF_XDP ZC Tx is used simultaneously with stack
> > Tx, Tx timeouts occur after going through link flap (admin brings
> > interface down then up again). HW seem to be unable to transmit
> > descriptor to the wire after HW tail register bump which in turn causes
> > bit __QUEUE_STATE_STACK_XOFF to be set forever as
> > netdev_tx_completed_queue() sees no cleaned bytes on the input.
> >
> > Fixes: 126cdfe1007a ("ice: xsk: Improve AF_XDP ZC Tx and use batching API")
> > Fixes: 2d4238f55697 ("ice: Add support for AF_XDP")
> > Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
> > Tested-by: Chandan Kumar Rout <chandanx.rout@intel.com> (A Contingent Worker at Intel)
> > Signed-off-by: Michal Kubiak <michal.kubiak@intel.com>
> > Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> > ---
> > drivers/net/ethernet/intel/ice/ice_xsk.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > 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))
> > + return true;
>
> Why is it checked after clean_xdp_irq_zc()?
There's nothing wrong with cleaning descriptors that have been sent
previously. We don't touch anything HW nor netstack related there, just
bumping ntc and producing CQ descriptors, both ops are pure SW things.
> Also, unlikely()?
Thought about that as well but we played it safe first. I wouldn't like to
resubmit whole series due to this so maybe Tony/Jake could address this
when sending to netdev, or am I asking for too much?:)
>
> > +
> > budget = ICE_DESC_UNUSED(xdp_ring);
> > budget = min_t(u16, budget, ICE_RING_QUARTER(xdp_ring));
> >
> > @@ -1091,7 +1095,7 @@ ice_xsk_wakeup(struct net_device *netdev, u32 queue_id,
> > struct ice_vsi *vsi = np->vsi;
> > struct ice_tx_ring *ring;
> >
> > - if (test_bit(ICE_VSI_DOWN, vsi->state))
> > + if (test_bit(ICE_VSI_DOWN, vsi->state) || !netif_carrier_ok(netdev))
>
> Same for unlikely()?
>
> > return -ENETDOWN;
> >
> > if (!ice_is_xdp_ena_vsi(vsi))
>
> Thanks,
> Olek
next prev parent reply other threads:[~2024-06-11 14:21 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 [this message]
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
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=ZmhdZwzIStFpghZK@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).