Re: [PATCH net-next v4 4/6] enic: validate V2 VF configuration replies

From: netdev-bot+sashiko

Date: Tue Dec 01 2026 - 09:05:26 EST


Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The warning in enic_mbox_vf_capability_check()
(drivers/net/ethernet/cisco/enic/enic_mbox.c) still says 'MBOX: PF…

--

enic: validate V2 VF configuration replies

This patch adds VF-side V2 mailbox operations for MAC filters and
packet-filter settings, plus the administrative-MAC protocol definitions.
It validates reply framing, echoed operations, result counts and applied
filter flags. Malformed replies and registration loss now force a VF
reconnect, and the patch adds a per-request mbox_reply_status that the
existing capability, register and unregister callers now check.

> diff --git a/drivers/net/ethernet/cisco/enic/enic_mbox.c b/drivers/net/ethernet/cisco/enic/enic_mbox.c
> index 3579d2980a246..5afb45033772b 100644
> --- a/drivers/net/ethernet/cisco/enic/enic_mbox.c
> +++ b/drivers/net/ethernet/cisco/enic/enic_mbox.c

[ ... ]

> @@ -572,23 +649,21 @@ static void enic_mbox_vf_handle_reply(struct enic *enic, u8 reply_type,
> void *payload, u64 msg_num)
> {
> struct enic_mbox_generic_reply *reply = payload;
> + enum enic_mbox_vf_reply_recovery recovery;
> u16 ret_major = le16_to_cpu(reply->ret_major);
> - u64 expected_msg_num;
> - u8 expected_type;
> + u8 expected;
> + int status;
>
> - spin_lock_bh(&enic->mbox_state_lock);
> - expected_type = enic->mbox_expected_reply;
> - expected_msg_num = enic->mbox_expected_msg_num;
> - if (expected_type != reply_type || expected_msg_num != msg_num) {
> - spin_unlock_bh(&enic->mbox_state_lock);
> + status = enic_mbox_vf_classify_reply(false, ret_major, &recovery);

[ ... ]

> - if (!ret_major) {
> + if (!status) {
> switch (reply_type) {
> case ENIC_MBOX_VF_CAPABILITY_REPLY: {
> struct enic_mbox_vf_capability_reply_msg *cap = payload;

[ ... ]

> @@ -829,12 +1104,15 @@ int enic_mbox_vf_capability_check(struct enic *enic)
>
> err = enic_mbox_wait_reply(enic, 3000);
> version = READ_ONCE(enic->pf_cap_version);
> + status = READ_ONCE(enic->mbox_reply_status);
> enic_mbox_vf_request_finish(enic);
> if (err) {
> netdev_warn(enic->netdev,
> "MBOX: no capability reply from PF\n");
> return err;
> }
> + if (status)
> + return status;
>
> if (version < ENIC_MBOX_CAP_VERSION_1) {
> netdev_warn(enic->netdev,

[Severity: Low]
Is the warning text that follows this check still accurate?

It currently reads:

netdev_warn(enic->netdev,
"MBOX: PF rejected capability request or reported unsupported version %u\n",
version);

Before this patch, a PF rejection (nonzero ret_major) left pf_cap_version
at 0. That case reached this warning and returned -EOPNOTSUPP.

Now enic_mbox_vf_handle_reply() passes ret_major through
enic_mbox_vf_classify_reply(). It stores the result in mbox_reply_status
and skips the pf_cap_version write. The new "if (status) return status;"
then returns -EIO, -ENODEV or -EOPNOTSUPP before the version check, and
nothing is printed at this site.

This means the warning only fires when the PF accepted the request but
reported a version below ENIC_MBOX_CAP_VERSION_1. The "PF rejected
capability request" part can no longer happen. Rejections are still
logged by the "PF rejected reply type %u" warning in
enic_mbox_vf_handle_reply().

Should this message be reduced to just the unsupported version case? As
far as I can tell, the same wording is still there at the end of the
series.

--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-b4-enic-sriov-v2-vf-receive-control-v4-0-5858d5a9ecb1%40cisco.com