Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Magnus Karlsson" <magnus.karlsson@intel.com>,
	intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH iwl-net] ice: use the queue pair's XDP ring in ice_qp_{dis, ena}()
Date: Wed, 18 Nov 2026 14:35:20 +0000	[thread overview]
Message-ID: <sashiko-outbox-221222@kernel.org> (raw)
In-Reply-To: <20261118135952.1063685-1-magnus.karlsson@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] ice: XDP ring QINT_TQCTL interrupt mismatch in ice_qp_dis() and
  ice_qp_ena()
It also noticed 1 related pre-existing issue this patch does not
introduce:
- [Critical] ice: incorrect XDP queue indexing in
  ice_cfg_txq_interrupt() [1]
--

commit 16196a7c47f74a832fc91f862f75e019be2f6418
Author: Magnus Karlsson <magnus.karlsson@intel.com>

ice: use the queue pair's XDP ring in ice_qp_{dis, ena}()

This commit updates ice_qp_dis(), ice_qp_ena(), ice_qp_clean_rings(), and
ice_qp_reset_stats() to operate on vsi->rx_rings[q_idx]->xdp_ring instead
of vsi->xdp_rings[q_idx].

> diff --git a/drivers/net/ethernet/intel/ice/ice_base.c b/drivers/net/ethernet/intel/ice/ice_base.c
> index 1667f686ff751..aa0ad313a97cd 100644
> --- a/drivers/net/ethernet/intel/ice/ice_base.c
> +++ b/drivers/net/ethernet/intel/ice/ice_base.c
[ ... ]
> @@ -1460,9 +1480,7 @@ int ice_qp_dis(struct ice_vsi *vsi, u16 q_idx)
>  	err = ice_vsi_stop_tx_ring(vsi, ICE_NO_RESET, 0, tx_ring, &txq_meta);
>  	if (!fail)
>  		fail = err;
> -	if (vsi->xdp_rings) {
> -		struct ice_tx_ring *xdp_ring = vsi->xdp_rings[q_idx];
> -
> +	if (xdp_ring) {
>  		memset(&txq_meta, 0, sizeof(txq_meta));
>  		ice_fill_txq_meta(vsi, xdp_ring, &txq_meta);
>  		err = ice_vsi_stop_tx_ring(vsi, ICE_NO_RESET, 0, xdp_ring,
> @@ -1497,9 +1515,11 @@ int ice_qp_ena(struct ice_vsi *vsi, u16 q_idx)
>  		fail = err;
>  
>  	if (ice_is_xdp_ena_vsi(vsi)) {
> -		struct ice_tx_ring *xdp_ring = vsi->xdp_rings[q_idx];
> +		DEFINE_RAW_FLEX(struct ice_aqc_add_tx_qgrp, qg_buf, txqs, 1);
> +		struct ice_tx_ring *xdp_ring = ice_qp_xdp_ring(vsi, q_idx);
>  
> -		err = ice_vsi_cfg_single_txq(vsi, vsi->xdp_rings, q_idx);
> +		qg_buf->num_txqs = 1;
> +		err = ice_vsi_cfg_txq(vsi, xdp_ring, qg_buf);
>  		if (!fail)
>  			fail = err;
>  		ice_set_ring_xdp(xdp_ring);

[Severity: High]
Does ice_qp_ena() leave QINT_TQCTL_CAUSE_ENA_M cleared on xdp_ring after
ice_qp_dis() stops it?

In ice_qp_dis(), ice_vsi_stop_tx_ring() clears QINT_TQCTL_CAUSE_ENA_M in
QINT_TQCTL(xdp_ring->reg_idx).  When ice_qp_ena() re-enables the queue
pair, it configures MSI-X via ice_qvec_cfg_msix() ->
ice_cfg_txq_interrupt(), which still writes to a different queue index:

drivers/net/ethernet/intel/ice/ice_base.c:ice_cfg_txq_interrupt() {
    ...
	wr32(hw, QINT_TQCTL(vsi->txq_map[txq]), val);
	if (ice_is_xdp_ena_vsi(vsi)) {
		u32 xdp_txq = txq + vsi->num_xdp_txq;

		wr32(hw, QINT_TQCTL(vsi->txq_map[xdp_txq]),
		     val);
	}
    ...
}

When there are fewer queue vectors than CPUs, vsi->txq_map[q_idx +
vsi->num_xdp_txq] is not xdp_ring->reg_idx.  As a result, xdp_ring's Tx
interrupt remains disabled (breaking AF_XDP zero-copy Tx completions), and
another ring's QINT_TQCTL is overwritten with this queue vector's MSI-X
index.

[Severity: Critical]
This problem wasn't introduced by this patch, but ice_cfg_txq_interrupt()
and ice_vsi_release_msix() also compute the XDP queue offset in
vsi->txq_map as txq + vsi->num_xdp_txq [1], whereas
ice_prepare_xdp_rings() places XDP rings in vsi->txq_map starting at
vsi->alloc_txq.

When the allocated LAN Tx queue count differs from vsi->num_xdp_txq (for
example, after changing the channel count with ethtool), indexing
vsi->txq_map[txq + vsi->num_xdp_txq] can access past the end of
vsi->txq_map or corrupt QINT_TQCTL for the wrong hardware queues.  In
addition, ice_vsi_release_msix() only iterates up to q_vector->num_ring_tx,
which leaves the remaining XDP rings' QINT_TQCTL interrupt mappings active
when there are fewer LAN Tx queues than XDP queues.

[1] https://sashiko.dev/#/bug/linux-0b308224-7107-4d23-9bbc-9ae5c80b362b

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261118135952.1063685-1-magnus.karlsson@intel.com?part=1

      parent reply	other threads:[~2026-11-18 14:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 13:59 [PATCH iwl-net] ice: use the queue pair's XDP ring in ice_qp_{dis, ena}() Magnus Karlsson
2026-11-18 14:26 ` [PATCH iwl-net] ice: use the queue pair's XDP ring in ice_qp_{dis,ena}() Maciej Fijalkowski
2026-11-18 14:35 ` sashiko-bot [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=sashiko-outbox-221222@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=magnus.karlsson@intel.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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