Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: przemyslaw.kitszel@intel.com
Cc: netdev@vger.kernel.org, kuba@kernel.org, jiri@resnulli.us,
	anthony.l.nguyen@intel.com, aleksandr.loktionov@intel.com,
	mschmidt@redhat.com, edumazet@kernel.org, horms@kernel.org,
	pabeni@redhat.com, davem@davemloft.net, corbet@lwn.net,
	skhan@linuxfoundation.org, rdunlap@infradead.org,
	andrew+netdev@lunn.ch, saeedm@nvidia.com, tariqt@nvidia.com,
	leon@kernel.org, mbloch@nvidia.com, jacob.e.keller@intel.com,
	jedrzej.jagielski@intel.com, anzaki@gmail.com,
	brett.creeley@amd.com, ohartoov@nvidia.com, poros@redhat.com,
	donald.hunter@gmail.com
Subject: Re: [PATCH net-next v7 10/15] iavf: use new opcodes to request more than 16 queues
Date: Tue, 24 Nov 2026 21:57:36 +0000	[thread overview]
Message-ID: <179555745695.3135.2186928648847971137@kernel.org> (raw)
In-Reply-To: <20261121230123.316391-11-przemyslaw.kitszel@intel.com>

Thank you for your contribution! Sashiko AI review found 7 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · Low: 5

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] In LARGE mode, iavf_get_channels() can report combined_count >
  max_combined in the same reply.
- [Medium] After a queue request is sent and the PF grants it, a later
  'ethtool -L combined <current active count>' can return success while…
- [Low] In iavf_reset_step()
  (drivers/net/ethernet/intel/iavf/iavf_main.c), the patch moves the…
- [Low] iavf_send_max_rss_qregion()
  (drivers/net/ethernet/intel/iavf/iavf_virtchnl.c) calls…
- [Low] In the VIRTCHNL_OP_GET_MAX_RSS_QREGION case of
  iavf_virtchnl_completion(), a change in qregion_width makes the code…
- [Low] iavf_get_req_queues_reply() returns `err ?:
  msg.vfres.num_queue_pairs` without checking event.msg_len >=…
- [Low] iavf_set_channels() checks num_req against iavf_max_channels(),
  which depends on LARGE_NUM_QPAIRS, REQ_QUEUES and BIT(qregion_width),…

--

iavf: use new opcodes to request more than 16 queues

This adds the VIRTCHNL_VF_LARGE_NUM_QPAIRS capability. It also adds the
new ENABLE_QUEUES_V2, DISABLE_QUEUES_V2, MAP_QUEUE_VECTOR and
GET_MAX_RSS_QREGION virtchnl opcodes, so iavf can use more than 16 queue
pairs. At init iavf asks for one queue pair per CPU, and ethtool -L goes
through an asynchronous REQUEST_QUEUES sent by the watchdog.

> diff --git a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
> index b76622fa9661d..a0d4b7bfb607d 100644
> --- a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
> +++ b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c

[ ... ]

> @@ -1683,6 +1688,19 @@ static int iavf_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
>  
>  	return ret;
>  }
> +
> +/* in LARGE mode PF gives us up to its RSS region once it has told us that */
> +static u32 iavf_max_channels(struct iavf_adapter *adapter)
> +{
> +	u16 width = adapter->max_rss_qregion.qregion_width;
> +
> +	if (LARGE_NUM_QPAIRS_SUPPORT(adapter) && width &&
> +	    adapter->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_REQ_QUEUES)
> +		return BIT(width);
> +
> +	return adapter->vsi_res->num_queue_pairs;
> +}
> +

[ ... ]

> @@ -1697,12 +1715,17 @@ static void iavf_get_channels(struct net_device *netdev,
>  	struct iavf_adapter *adapter = netdev_priv(netdev);
>  
>  	/* Report maximum channels */
> -	ch->max_combined = adapter->vsi_res->num_queue_pairs;
> +	ch->max_combined = iavf_max_channels(adapter);
>  
>  	ch->max_other = NONQ_VECS;
>  	ch->other_count = NONQ_VECS;
>  
>  	ch->combined_count = adapter->num_active_queues;

[Severity: Medium]
Can iavf_get_channels() report a combined_count larger than max_combined
in the same reply?

In LARGE mode iavf_max_channels() returns BIT(qregion_width). But
num_active_queues comes from iavf_alloc_queues(), which has no RSS
region cap:

	num_active_queues = min_t(int,
				  adapter->vsi_res->num_queue_pairs,
				  (int)(num_online_cpus()));

With the in-tree ice PF, ice_sriov_set_msix_vec_count() sets
vf->num_vf_qs = msix - 1 (e.g. 63) whatever the VF LUT type is.
ice_vc_get_max_rss_qregion() reports a width of 4 for a VSI LUT. The VF
then runs 63 queues while ethtool -l shows max_combined = 16.

The ethtool core rejects combined_count > max_combined, and
iavf_set_channels() also rejects num_req > iavf_max_channels(). So the
user can't set back the count the driver chose by itself, and netlink
set requests that keep the current combined count fail validation.

> +	/* the requested count, until the PF grants or denies it */
> +	if (adapter->aq_required & IAVF_FLAG_AQ_REQUEST_QUEUES)
> +		ch->combined_count = adapter->num_req_queues_next;
> +	else if (adapter->num_req_queues)
> +		ch->combined_count = adapter->num_req_queues;
>  }

[ ... ]

> @@ -1730,15 +1753,29 @@ static int iavf_set_channels(struct net_device *netdev,
>  	/* All of these should have already been checked by ethtool before this
>  	 * even gets to us, but just to be sure.
>  	 */
> -	if (num_req == 0 || num_req > adapter->vsi_res->num_queue_pairs)
> +	if (num_req == 0 || num_req > iavf_max_channels(adapter))
>  		return -EINVAL;
>  
> -	if (num_req == adapter->num_active_queues)
> -		return 0;
> -
>  	if (ch->rx_count || ch->tx_count || ch->other_count != NONQ_VECS)
>  		return -EINVAL;
>  
> +	/* PF has not answered our previous request yet */
> +	if (adapter->current_op == VIRTCHNL_OP_REQUEST_QUEUES)
> +		return -EBUSY;
> +
> +	if (num_req == adapter->num_active_queues) {
> +		adapter->aq_required &= ~IAVF_FLAG_AQ_REQUEST_QUEUES;
> +		return 0;
> +	}

[Severity: Medium]
Can a later ethtool -L return success here but be silently ignored,
after a queue request has been granted?

iavf_request_queues() sets:

    current_op = VIRTCHNL_OP_REQUEST_QUEUES
    num_req_queues = N
    flags |= IAVF_FLAG_REINIT_ITR_NEEDED

The PF grants the request by resetting the VF and sends no reply. If
iavf_watchdog_step() sees IAVF_VF_ARQLEN1 cleared first, it does:

	adapter->aq_required &= IAVF_FLAG_AQ_REQUEST_QUEUES;
	adapter->current_op = VIRTCHNL_OP_UNKNOWN;
	...
	iavf_schedule_reset(adapter, IAVF_FLAG_RESET_PENDING);

This leaves num_req_queues and IAVF_FLAG_REINIT_ITR_NEEDED set.
reset_task takes netdev_lock only after the watchdog releases it, so an
ethtool call can run in between.

In that window iavf_get_channels() reports combined_count = N. The core
then passes M = num_active_queues to iavf_set_channels(). The -EBUSY
check no longer fires, and this shortcut only clears
IAVF_FLAG_AQ_REQUEST_QUEUES and returns 0.

iavf_reset_step() then sees IAVF_FLAG_REINIT_ITR_NEEDED, and
iavf_alloc_queues() uses num_req_queues = N. The VF ends up with N
queues, although the last ethtool -L that returned success asked for M.

Should this shortcut also take a pending num_req_queues into account?

> +
> +	if (LARGE_NUM_QPAIRS_SUPPORT(adapter) &&
> +	    adapter->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_REQ_QUEUES) {
> +		/* the watchdog sends it once no other op is in flight */
> +		adapter->num_req_queues_next = num_req;
> +		iavf_schedule_aq_request(adapter, IAVF_FLAG_AQ_REQUEST_QUEUES);
> +		return 0;
> +	}
> +

[ ... ]

> diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c
> index a2aef35c0a074..66beb83acc94b 100644
> --- a/drivers/net/ethernet/intel/iavf/iavf_main.c
> +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c

[ ... ]

> @@ -2332,6 +2340,12 @@ static int iavf_process_aq_command(struct iavf_adapter *adapter)
>  		iavf_virtchnl_send_ptp_cmd(adapter);
>  		return IAVF_SUCCESS;
>  	}
> +	if (adapter->aq_required & IAVF_FLAG_AQ_REQUEST_QUEUES) {
> +		/* ethtool -L has already reported success, retry until sent */
> +		if (!iavf_request_queues(adapter, adapter->num_req_queues_next))
> +			adapter->aq_required &= ~IAVF_FLAG_AQ_REQUEST_QUEUES;
> +		return 0;
> +	}

[Severity: Low]
Is num_req_queues_next still valid when it is finally sent here?

iavf_set_channels() checks num_req against iavf_max_channels() and
num_active_queues, then defers the send. The patch keeps
IAVF_FLAG_AQ_REQUEST_QUEUES across resets, both in iavf_reset_step() and
in the watchdog's hardware reset detection:

	adapter->aq_required &= IAVF_FLAG_AQ_REQUEST_QUEUES;

Those resets re-negotiate vf_res->vf_cap_flags and max_rss_qregion, and
can change num_active_queues. None of the checks are repeated here.

Could the VF then send a REQUEST_QUEUES that is above BIT(new width),
or sent without LARGE_NUM_QPAIRS or REQ_QUEUES still negotiated? Could
it also equal the new active count and cause a needless VF reset?

[ ... ]

> @@ -3444,8 +3614,6 @@ void iavf_reset_step(struct iavf_adapter *adapter)
>  			err = iavf_request_traffic_irqs(adapter, netdev->name);
>  			if (err)
>  				goto reset_err;
> -
> -			adapter->flags &= ~IAVF_FLAG_REINIT_MSIX_NEEDED;
>  		}
>  
>  		iavf_configure(adapter);
> @@ -3463,7 +3631,8 @@ void iavf_reset_step(struct iavf_adapter *adapter)
>  		wake_up(&adapter->down_waitqueue);
>  	}
>  
> -	adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED;
> +	adapter->flags &= ~(IAVF_FLAG_REINIT_MSIX_NEEDED |
> +			    IAVF_FLAG_REINIT_ITR_NEEDED);

[Severity: Low]
This isn't a bug, but moving the IAVF_FLAG_REINIT_MSIX_NEEDED clear out
of the running branch fixes a separate issue that affects every PF, and
the commit message doesn't describe it.

iavf_parse_vf_resource_msg() can set IAVF_FLAG_REINIT_MSIX_NEEDED while
the interface is down, in the "PF gave us fewer queues" and "PF could cut
our queues on reset" paths. Before this patch the flag stayed set. A
later reset then rebuilt the interrupt scheme with num_req_queues == 0
and lost a channel count set with ethtool -L while down.

The fix is mentioned only in the v7 changelog below the --- line, which
is dropped when the patch is applied. The v7 notes also say the every-PF
changes moved to "iavf: keep RSS config across resets", but this one is
still in this patch.

Other every-PF changes are bundled the same way:

- the reordered rx/tx/other validation in iavf_set_channels()
- the REQUEST_QUEUES completion ignoring replies with a non-zero
  v_retval
- iavf_init_config_adapter() clearing num_req_queues and
  IAVF_FLAG_REINIT_ITR_NEEDED

Could these be split out, or at least described in the commit message,
possibly with a Fixes: tag?

>  
>  	return;
>  reset_err:

> diff --git a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
> index 151824102acda..e643c205884f6 100644
> --- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
> +++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c

[ ... ]

> @@ -251,6 +252,18 @@ int iavf_send_vf_ptp_caps_msg(struct iavf_adapter *adapter)
>  				(u8 *)&hw_caps, sizeof(hw_caps));
>  }
>  
> +int iavf_send_max_rss_qregion(struct iavf_adapter *adapter)
> +{
> +	adapter->aq_required &= ~IAVF_FLAG_AQ_GET_MAX_RSS_QREGION;
> +
> +	if (!LARGE_NUM_QPAIRS_SUPPORT(adapter))
> +		return -EOPNOTSUPP;
> +
> +	adapter->current_op = VIRTCHNL_OP_GET_MAX_RSS_QREGION;
> +	iavf_send_pf_msg(adapter, VIRTCHNL_OP_GET_MAX_RSS_QREGION, NULL, 0);
> +	return 0;
> +}

[Severity: Low]
Should this return the result of iavf_send_pf_msg()?

iavf_send_vf_offload_vlan_v2_msg(), iavf_send_vf_ptp_caps_msg() and
iavf_send_vf_config_msg() all return it. iavf_process_aq_command() passes
this return value straight back to the watchdog.

As written, a failed ASQ send looks like success. At init,
iavf_init_recv_max_rss_qregion() then polls for a reply that was never
requested.

[ ... ]

> +int iavf_get_req_queues_reply(struct iavf_adapter *adapter)
> +{
> +	/* poll looks for the reset event in the same buffer */
> +	union {
> +		struct virtchnl_vf_res_request vfres;
> +		struct virtchnl_pf_event vpe;
> +	} msg = {};
> +	struct iavf_arq_event_info event = {
> +		.buf_len = sizeof(msg),
> +		.msg_buf = (u8 *)&msg,
> +	};
> +	int err;
> +
> +	err = iavf_poll_virtchnl_msg(&adapter->hw, &event,
> +				     VIRTCHNL_OP_REQUEST_QUEUES);
> +
> +	return err ?: msg.vfres.num_queue_pairs;
> +}

[Severity: Low]
Should event.msg_len be checked before msg.vfres.num_queue_pairs is used?

iavf_poll_virtchnl_msg() reuses this buffer for every ARQ message it
skips, such as link events. iavf_clean_arq_element() copies only
min(datalen, buf_len) bytes, and nothing at all for an empty message:

	e->msg_len = min(datalen, e->buf_len);
	if (e->msg_buf && (e->msg_len != 0))
		memcpy(e->msg_buf, hw->aq.arq.r.arq_bi[desc_idx].va,
		       e->msg_len);

A short or empty REQUEST_QUEUES reply would then return stale bytes from
an earlier message. iavf_get_max_rss_qregion() above does check
event.msg_len == len.

iavf_init_recv_req_queues() also passes the offered count on as is:

		if (num > adapter->vsi_res->num_queue_pairs &&
		    !iavf_request_queues(adapter, num))
			return;

There is no clamp to IAVF_MAX_REQ_QUEUES, so a value up to 65535 could
end up in adapter->num_req_queues. Should it be bounded?

[ ... ]

> @@ -2710,6 +2934,22 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter,
>  			aq_required;
>  		}
>  		break;
> +	case VIRTCHNL_OP_GET_MAX_RSS_QREGION: {
> +		u16 width = adapter->max_rss_qregion.qregion_width;
> +
> +		if (v_retval || msglen != sizeof(adapter->max_rss_qregion))
> +			break;
> +		memcpy(&adapter->max_rss_qregion, msg, msglen);
> +		adapter->max_rss_qregion.qregion_width =
> +			min(adapter->max_rss_qregion.qregion_width,
> +			    ilog2(IAVF_MAX_REQ_QUEUES));
> +		/* LUT was filled before this reply, for the old region */
> +		if (adapter->max_rss_qregion.qregion_width != width) {
> +			iavf_fill_rss_lut(adapter);
> +			iavf_config_rss(adapter);

[Severity: Low]
Does iavf_config_rss() work from here on the RSS_AQ path?

adapter->current_op is still VIRTCHNL_OP_GET_MAX_RSS_QREGION at this
point, because it is reset only after the opcode switch. So
iavf_config_rss_aq() bails out:

	if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
		/* bail because we already have a command pending */
		dev_err(&adapter->pdev->dev, "Cannot configure RSS, command %d pending\n",

The return value is dropped, so the refilled LUT is never programmed and
nothing retries it. Only the RSS_PF and RSS_REG paths work from this
context.

> +		}
> +		break;
> +	}

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261121230123.316391-1-przemyslaw.kitszel%40intel.com

  reply	other threads:[~2026-11-24 21:57 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-21 22:55 [PATCH net-next v7 00/15] devlink, mlx5, iavf, ice: XLVF for iavf Przemek Kitszel
2026-11-21 22:55 ` [PATCH net-next v7 01/15] iavf: keep RSS config across resets Przemek Kitszel
2026-11-24 21:57   ` netdev-bot+sashiko
2026-11-21 22:55 ` [PATCH net-next v7 02/15] ice: prepare RSS LUT config for runtime LUT changes Przemek Kitszel
2026-11-24 21:57   ` netdev-bot+sashiko
2026-11-21 22:55 ` [PATCH net-next v7 03/15] ice: add VF queue ena/dis helper functions Przemek Kitszel
2026-11-21 22:55 ` [PATCH net-next v7 04/15] ice: add helpers for Global RSS LUT alloc, free, vsi_update Przemek Kitszel
2026-11-24 21:57   ` netdev-bot+sashiko
2026-11-21 22:55 ` [PATCH net-next v7 05/15] ice: rename ICE_MAX_RSS_QS_PER_VF to ICE_MAX_QS_PER_VF_VCV1 Przemek Kitszel
2026-11-21 22:55 ` [PATCH net-next v7 06/15] ice: bump to 256qs for VF Przemek Kitszel
2026-11-24 21:57   ` netdev-bot+sashiko
2026-11-21 22:55 ` [PATCH net-next v7 07/15] iavf: extend iavf_configure_queues() to support more queues Przemek Kitszel
2026-11-21 22:55 ` [PATCH net-next v7 08/15] iavf: temporary rename of IAVF_MAX_REQ_QUEUES to IAVF_MAX_REQ_QUEUES_VCV1 Przemek Kitszel
2026-11-21 22:55 ` [PATCH net-next v7 09/15] iavf: increase max number of queues to 256 Przemek Kitszel
2026-11-24 21:57   ` netdev-bot+sashiko
2026-11-21 22:55 ` [PATCH net-next v7 10/15] iavf: use new opcodes to request more than 16 queues Przemek Kitszel
2026-11-24 21:57   ` netdev-bot+sashiko [this message]
2026-11-21 22:55 ` [PATCH net-next v7 11/15] ice: introduce handling of virtchnl LARGE VF opcodes Przemek Kitszel
2026-11-24 21:57   ` netdev-bot+sashiko
2026-11-21 22:55 ` [PATCH net-next v7 12/15] devlink: add cmode to resources Przemek Kitszel
2026-11-24 21:57   ` netdev-bot+sashiko
2026-11-21 22:55 ` [PATCH net-next v7 13/15] ice: represent RSS LUTs as devlink resources Przemek Kitszel
2026-11-24 21:57   ` netdev-bot+sashiko
2026-11-21 22:55 ` [PATCH net-next v7 14/15] devlink: add devlink_alloc_drv() Przemek Kitszel
2026-11-21 22:55 ` [PATCH net-next v7 15/15] ice: support up to 256 VF queues Przemek Kitszel
2026-11-24 21:57   ` netdev-bot+sashiko
2026-11-23  8:53 ` [PATCH net-next v7 00/15] devlink, mlx5, iavf, ice: XLVF for iavf Matthieu Baerts
2026-11-23 15:03   ` Przemek Kitszel

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=179555745695.3135.2186928648847971137@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=aleksandr.loktionov@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=anzaki@gmail.com \
    --cc=brett.creeley@amd.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=jedrzej.jagielski@intel.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=mschmidt@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=ohartoov@nvidia.com \
    --cc=pabeni@redhat.com \
    --cc=poros@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=rdunlap@infradead.org \
    --cc=saeedm@nvidia.com \
    --cc=skhan@linuxfoundation.org \
    --cc=tariqt@nvidia.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