public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: devnull+satishkh.cisco.com@kernel.org
Cc: Jakub Kicinski <kuba@kernel.org>,
	satishkh@cisco.com, andrew+netdev@lunn.ch, davem@davemloft.net,
	edumazet@google.com, pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 6/6] enic: detect admin channel resources for SR-IOV
Date: Sun, 29 Mar 2026 13:13:42 -0700	[thread overview]
Message-ID: <20260329201342.2798773-1-kuba@kernel.org> (raw)
In-Reply-To: <20260325-enic-sriov-v2-prep-v2-6-f72cf716ebfa@cisco.com>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
---
enic: detect admin channel resources for SR-IOV

This commit checks for the presence of admin channel BAR resources during
resource discovery and sets has_admin_channel when all four are available.
It also adds admin WQ, RQ, CQ and INTR fields to struct enic.

> diff --git a/drivers/net/ethernet/cisco/enic/enic.h b/drivers/net/ethernet/cisco/enic/enic.h
> index 67fd780b1fa1c..08472420f3a1f 100644
> --- a/drivers/net/ethernet/cisco/enic/enic.h
> +++ b/drivers/net/ethernet/cisco/enic/enic.h
> @@ -289,6 +289,13 @@ struct enic {
>  	u8 rss_key[ENIC_RSS_LEN];
>  	struct vnic_gen_stats gen_stats;
>  	enum ext_cq ext_cq;
> +
> +	/* Admin channel resources for SR-IOV MBOX */
> +	bool has_admin_channel;
> +	struct vnic_wq admin_wq;
> +	struct vnic_rq admin_rq;
> +	struct vnic_cq admin_cq[2];
> +	struct vnic_intr admin_intr;
>  };

[ ... ]

> diff --git a/drivers/net/ethernet/cisco/enic/enic_res.c b/drivers/net/ethernet/cisco/enic/enic_res.c
> index bbd3143ed73e7..5ca3e5aec7f93 100644
> --- a/drivers/net/ethernet/cisco/enic/enic_res.c
> +++ b/drivers/net/ethernet/cisco/enic/enic_res.c
> @@ -205,10 +205,17 @@ void enic_get_res_counts(struct enic *enic)
>  	enic->cq_count = enic->cq_avail;
>  	enic->intr_count = enic->intr_avail;
>  
> +	enic->has_admin_channel =
> +		vnic_dev_get_res_count(enic->vdev, RES_TYPE_ADMIN_WQ) >= 1 &&
> +		vnic_dev_get_res_count(enic->vdev, RES_TYPE_ADMIN_RQ) >= 1 &&
> +		vnic_dev_get_res_count(enic->vdev, RES_TYPE_ADMIN_CQ) >= 1 &&

Is it possible for the hardware to provide exactly 1 admin completion queue?

Because struct enic allocates two admin_cq entries:

    struct vnic_cq admin_cq[2];

If the firmware only provides one RES_TYPE_ADMIN_CQ, this check will pass,
but later initialization of admin_cq[1] might access memory past the end of
the validated memory-mapped I/O boundary.

Should this check be >= 2, or use ARRAY_SIZE(enic->admin_cq), to ensure
both queues are backed by hardware?

> +		vnic_dev_get_res_count(enic->vdev, RES_TYPE_SRIOV_INTR) >= 1;
> +

      reply	other threads:[~2026-03-29 20:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-26  5:18 [PATCH net-next v2 0/6] enic: SR-IOV V2 preparatory infrastructure Satish Kharat via B4 Relay
2026-03-26  5:18 ` [PATCH net-next v2 1/6] enic: extend resource discovery for SR-IOV admin channel Satish Kharat via B4 Relay
2026-03-26  5:19 ` [PATCH net-next v2 2/6] enic: add V2 SR-IOV VF device ID Satish Kharat via B4 Relay
2026-03-26  5:19 ` [PATCH net-next v2 3/6] enic: detect SR-IOV VF type from PCI capability Satish Kharat via B4 Relay
2026-03-26  5:19 ` [PATCH net-next v2 4/6] enic: make enic_dev_enable/disable ref-counted Satish Kharat via B4 Relay
2026-03-29 20:13   ` Jakub Kicinski
2026-03-26  5:19 ` [PATCH net-next v2 5/6] enic: add type-aware alloc for WQ, RQ, CQ and INTR resources Satish Kharat via B4 Relay
2026-03-26  5:19 ` [PATCH net-next v2 6/6] enic: detect admin channel resources for SR-IOV Satish Kharat via B4 Relay
2026-03-29 20:13   ` Jakub Kicinski [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=20260329201342.2798773-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=devnull+satishkh.cisco.com@kernel.org \
    --cc=edumazet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=satishkh@cisco.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