From: Jakub Kicinski <kuba@kernel.org>
To: devnull+satishkh.cisco.com@kernel.org
Cc: Jakub Kicinski <kuba@kernel.org>,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
20260401-enic-sriov-v2-prep-v4-0-d5834b2ef1b9@cisco.com,
satishkh@cisco.com
Subject: Re: [PATCH net-next v4 08/10] enic: add MBOX VF handlers for capability, register and link state
Date: Mon, 13 Apr 2026 17:22:25 -0700 [thread overview]
Message-ID: <20260414002225.3735182-1-kuba@kernel.org> (raw)
In-Reply-To: <20260411-enic-sriov-v2-admin-channel-v2-v4-8-f052326c2a57@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: add MBOX VF handlers for capability, register and link state
This commit implements VF-side mailbox message processing for SR-IOV V2
admin channel communication, including handlers for capability checks,
registration, and link state notifications.
> diff --git a/drivers/net/ethernet/cisco/enic/enic_mbox.c b/drivers/net/ethernet/cisco/enic/enic_mbox.c
> index f5784624ebbdf..b5ed31450ee76 100644
> --- a/drivers/net/ethernet/cisco/enic/enic_mbox.c
> +++ b/drivers/net/ethernet/cisco/enic/enic_mbox.c
[ ... ]
> @@ -280,6 +291,136 @@ static void enic_mbox_pf_process_msg(struct enic *enic,
> hdr->msg_type, vf_id, err);
> }
>
> +static void enic_mbox_vf_handle_capability_reply(struct enic *enic,
> + void *payload)
> +{
> + struct enic_mbox_vf_capability_reply_msg *reply = payload;
> +
> + if (le16_to_cpu(reply->reply.ret_major) == 0)
> + enic->pf_cap_version = le32_to_cpu(reply->version);
> + complete(&enic->mbox_comp);
> +}
Does this code handle delayed replies safely?
If a capability request times out and the VF proceeds to send a register
request, could a delayed capability reply call complete() here and prematurely
wake up the register request?
Since there is only a single shared completion and no validation of the
currently expected reply type, the new request might wake up, evaluate unmatched
state, and fail incorrectly.
[ ... ]
> +static void enic_mbox_vf_handle_unregister_reply(struct enic *enic,
> + void *payload)
> +{
> + struct enic_mbox_vf_register_reply_msg *reply = payload;
This isn't a bug, but is it intentional to use the register_reply_msg structure
here for an unregister reply? While they currently have the same layout, this
could be brittle if the structures diverge in the future.
> +
> + if (le16_to_cpu(reply->reply.ret_major)) {
> + netdev_warn(enic->netdev,
> + "MBOX: VF unregister rejected by PF: %u/%u\n",
> + le16_to_cpu(reply->reply.ret_major),
> + le16_to_cpu(reply->reply.ret_minor));
> + } else {
> + enic->vf_registered = false;
> + }
> + complete(&enic->mbox_comp);
> +}
[ ... ]
> + case ENIC_MBOX_VF_UNREGISTER_REPLY: {
> + size_t exp = sizeof(struct enic_mbox_vf_register_reply_msg);
Similarly here, the register_reply_msg size is being used for the unregister
reply validation check.
> +
> + if (!enic_mbox_vf_payload_ok(enic, hdr->msg_type,
> + payload_len, exp))
> + return;
> + enic_mbox_vf_handle_unregister_reply(enic, payload);
> + break;
> + }
[ ... ]
> +int enic_mbox_vf_unregister(struct enic *enic)
> +{
> + int err;
> +
> + if (!enic->vf_registered)
> + return 0;
> +
> + reinit_completion(&enic->mbox_comp);
> +
> + err = enic_mbox_send_msg(enic, ENIC_MBOX_VF_UNREGISTER_REQUEST,
> + ENIC_MBOX_DST_PF, NULL, 0);
> + if (err)
> + return err;
> +
> + err = enic_mbox_wait_reply(enic, 3000);
> +
> + return enic->vf_registered ? -ETIMEDOUT : 0;
> }
Is the err value from enic_mbox_wait_reply() intentionally ignored here?
If the PF successfully receives the request but explicitly rejects it,
enic_mbox_wait_reply() returns 0, but enic->vf_registered remains true. This
causes a protocol-level rejection to be conflated with a channel timeout by
returning -ETIMEDOUT.
next prev parent reply other threads:[~2026-04-14 0:22 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-12 5:06 [PATCH net-next v4 00/10] enic: SR-IOV V2 admin channel and MBOX protocol Satish Kharat via B4 Relay
2026-04-12 5:06 ` [PATCH net-next v4 01/10] enic: verify firmware supports V2 SR-IOV at probe time Satish Kharat via B4 Relay
2026-04-12 5:06 ` [PATCH net-next v4 02/10] enic: add admin channel open and close for SR-IOV Satish Kharat via B4 Relay
2026-04-14 0:21 ` Jakub Kicinski
2026-04-12 5:06 ` [PATCH net-next v4 03/10] enic: add admin RQ buffer management Satish Kharat via B4 Relay
2026-04-14 0:21 ` Jakub Kicinski
2026-04-12 5:06 ` [PATCH net-next v4 04/10] enic: add admin CQ service with MSI-X interrupt and NAPI polling Satish Kharat via B4 Relay
2026-04-14 0:21 ` Jakub Kicinski
2026-04-12 5:06 ` [PATCH net-next v4 05/10] enic: define MBOX message types and header structures Satish Kharat via B4 Relay
2026-04-14 0:21 ` Jakub Kicinski
2026-04-12 5:06 ` [PATCH net-next v4 06/10] enic: add MBOX core send and receive for admin channel Satish Kharat via B4 Relay
2026-04-14 0:21 ` Jakub Kicinski
2026-04-12 5:06 ` [PATCH net-next v4 07/10] enic: add MBOX PF handlers for VF register and capability Satish Kharat via B4 Relay
2026-04-14 0:21 ` Jakub Kicinski
2026-04-12 5:06 ` [PATCH net-next v4 08/10] enic: add MBOX VF handlers for capability, register and link state Satish Kharat via B4 Relay
2026-04-14 0:22 ` Jakub Kicinski [this message]
2026-04-12 5:06 ` [PATCH net-next v4 09/10] enic: wire V2 SR-IOV enable with admin channel and MBOX Satish Kharat via B4 Relay
2026-04-14 0:22 ` Jakub Kicinski
2026-04-12 5:06 ` [PATCH net-next v4 10/10] enic: add V2 VF probe with admin channel and PF registration Satish Kharat via B4 Relay
2026-04-14 0:22 ` Jakub Kicinski
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=20260414002225.3735182-1-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=20260401-enic-sriov-v2-prep-v4-0-d5834b2ef1b9@cisco.com \
--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