mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: satishkh@cisco.com
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	sebaddel@cisco.com, aradhana@cisco.com, rfaucett@cisco.com
Subject: Re: [PATCH net-next v3 4/6] enic: validate V2 VF configuration replies
Date: Mon, 23 Nov 2026 00:32:08 +0000	[thread overview]
Message-ID: <179539392844.3135.623193821226744358@kernel.org> (raw)
In-Reply-To: <20261118-b4-enic-sriov-v2-vf-receive-control-v3-4-2cb25677aa8c@cisco.com>

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 patch changes how existing, non-configuration mailbox
  messages are handled, but the commit message only describes validating…
- [Low] enic_mbox_vf_handle_set_pkt_filter_reply() forces a reconnect for
  any errno-style ret_major, meaning one with bits outside…
- [Low] In drivers/net/ethernet/cisco/enic/enic.h the patch puts the
  forward declaration `struct enic_mac_addr;` between the existing…

--

enic: validate V2 VF configuration replies

This commit adds the VF-side V2 mailbox operations for adding and deleting
MAC filters and for setting packet filters. It also adds the
administrative-MAC protocol definitions. Reply framing, per-entry MAC
results and applied filter flags are validated. A new VF registration is
forced when a reply is malformed or the PF reports that the VF is no
longer registered.

> diff --git a/drivers/net/ethernet/cisco/enic/enic.h b/drivers/net/ethernet/cisco/enic/enic.h
> index 22a0ff71a43c6..28b24189d5bfc 100644
> --- a/drivers/net/ethernet/cisco/enic/enic.h
> +++ b/drivers/net/ethernet/cisco/enic/enic.h
> @@ -245,6 +245,8 @@ enum enic_admin_chan_state {
>  };
>  
>  /* Per-instance private data structure */
> +struct enic_mac_addr;
> +
>  struct enic {
>  	struct net_device *netdev;
>  	struct pci_dev *pdev;

[Severity: Low]
This isn't a bug, but the forward declaration now sits between the
"Per-instance private data structure" comment and struct enic. The comment
now appears to describe struct enic_mac_addr.

Could the declaration go above the comment instead?

[ ... ]

> diff --git a/drivers/net/ethernet/cisco/enic/enic_mbox.c b/drivers/net/ethernet/cisco/enic/enic_mbox.c
> index 85fed8beb347e..2326e00a4fea6 100644
> --- a/drivers/net/ethernet/cisco/enic/enic_mbox.c
> +++ b/drivers/net/ethernet/cisco/enic/enic_mbox.c

[ ... ]

> @@ -605,16 +680,166 @@ static void enic_mbox_vf_handle_reply(struct enic *enic, u8 reply_type,

[ ... ]

> +static void enic_mbox_vf_handle_set_pkt_filter_reply(struct enic *enic,
> +						     void *payload, u16 msg_len,
> +						     u64 msg_num)
> +{
> +	struct enic_mbox_vf_set_pkt_filter_reply_msg *reply = payload;
> +	enum enic_mbox_vf_reply_recovery recovery;
> +	u16 applied = 0;
> +	u16 ret_major = 0;
> +	u8 expected;
> +	int status;
> +
> +	if (msg_len < sizeof(*reply)) {
> +		status = enic_mbox_vf_classify_reply(true, 0, &recovery);
> +	} else {
> +		ret_major = le16_to_cpu(reply->reply.ret_major);
> +		status = enic_mbox_vf_classify_reply(false, ret_major,
> +						     &recovery);
> +		if (status && (ret_major & ~ENIC_MBOX_ERR_MASK))
> +			recovery = ENIC_MBOX_VF_REPLY_RECONNECT;
> +	}

[Severity: Low]
Why does an errno-style ret_major force a reconnect only for
SET_PKT_FILTER replies?

The comment in enic_mbox_vf_classify_reply() says:

    /* Some deployed peers return a negative errno in this 16-bit field.

That function treats such a value as a plain -EIO with recovery left at
ENIC_MBOX_VF_REPLY_OK. This applies to ADD_DEL_MAC replies in
enic_mbox_vf_handle_add_del_mac_reply() and to the capability, register
and unregister replies in enic_mbox_vf_handle_reply().

The commit message says reconnect is reserved for "malformed or
indeterminate replies". An errno-style rejection of SET_PKT_FILTER still
sets mbox_send_disabled and vf_rx_quarantined and schedules tx_hang_reset.
The protocol-defined MSG_NOT_SUPPORTED bit for the same rejection only
returns -EOPNOTSUPP.

Is this asymmetry intended? If so, could the code or the commit message
explain why an errno-style rejection is indeterminate here but not for a
MAC operation?

[ ... ]

> @@ -700,6 +925,34 @@ static bool enic_mbox_vf_payload_ok(struct enic *enic, u8 msg_type,
>  	return true;
>  }
>  
> +static void enic_mbox_vf_malformed_msg(struct enic *enic, u8 msg_type,
> +				       u64 msg_num)
> +{
> +	u8 expected;
> +
> +	switch (msg_type) {
> +	case ENIC_MBOX_PF_LINK_STATE_NOTIF:
> +	case ENIC_MBOX_PF_SET_ADMIN_MAC_NOTIF:
> +		enic_mbox_vf_require_reconnect(enic);
> +		return;
> +	case ENIC_MBOX_VF_CAPABILITY_REPLY:
> +	case ENIC_MBOX_VF_REGISTER_REPLY:
> +	case ENIC_MBOX_VF_UNREGISTER_REPLY:
> +	case ENIC_MBOX_VF_ADD_DEL_MAC_REPLY:
> +	case ENIC_MBOX_VF_SET_PKT_FILTER_REPLY:
> +		break;
> +	default:
> +		return;
> +	}
> +
> +	if (!enic_mbox_vf_reply_claim(enic, msg_type, msg_num, &expected))
> +		return;
> +	enic_mbox_vf_mark_reconnect_locked(enic, false);
> +	WRITE_ONCE(enic->mbox_reply_status, -EIO);
> +	enic_mbox_vf_reply_complete(enic);
> +	enic_mbox_vf_kick_recovery(enic);
> +}

[Severity: Low]
Should the commit message mention that this also changes how existing,
non-configuration messages are handled? It only says:

    If a reply is malformed or contradictory, or the PF reports that the
    VF is no longer registered, the VF can no longer trust that its state
    matches the PF.

A PF_LINK_STATE_NOTIF with a short payload used to be dropped when
enic_mbox_vf_payload_ok() failed. It is a notification, not a reply, but
it now goes through enic_mbox_vf_malformed_msg() and
enic_mbox_vf_require_reconnect(). That sets mbox_send_disabled and
vf_rx_quarantined and schedules tx_hang_reset.

Short CAPABILITY, REGISTER and UNREGISTER replies used to be dropped too,
and the waiter would time out. The same is true of any PF message whose
msg_len fails the new check in enic_mbox_recv_handler(). These are now
claimed, completed with -EIO, and a reconnect is forced.

enic_mbox_vf_handle_reply() also sends ret_major through
enic_mbox_vf_classify_reply() now. A VF_NOT_REGISTERED bit on any of the
three existing replies clears vf_registered and schedules a reset.

The return values seen by the existing callers change as well:

    enic_mbox_vf_capability_check(): -EIO instead of -EOPNOTSUPP for a
    GENERIC rejection

    enic_mbox_vf_register() / enic_mbox_vf_unregister(): -EIO,
    -EOPNOTSUPP or -ENODEV instead of -ENODEV or -EACCES

Could these behaviour changes be described in the commit message?

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118-b4-enic-sriov-v2-vf-receive-control-v3-0-2cb25677aa8c%40cisco.com

  reply	other threads:[~2026-11-23  0:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 23:32 [PATCH net-next v3 0/6] enic: add V2 VF receive control over MBOX Satish Kharat
2026-11-18 23:32 ` [PATCH net-next v3 1/6] net: add netif_rx_mode_schedule_update() Satish Kharat
2026-11-23  0:32   ` netdev-bot+sashiko
2026-11-18 23:32 ` [PATCH net-next v3 2/6] enic: serialize V2 VF mailbox requests Satish Kharat
2026-11-18 23:32 ` [PATCH net-next v3 3/6] enic: recover V2 VF mailbox after request failure Satish Kharat
2026-11-23  0:32   ` netdev-bot+sashiko
2026-11-18 23:32 ` [PATCH net-next v3 4/6] enic: validate V2 VF configuration replies Satish Kharat
2026-11-23  0:32   ` netdev-bot+sashiko [this message]
2026-11-18 23:32 ` [PATCH net-next v3 5/6] enic: manage V2 VF station and administrative MAC Satish Kharat
2026-11-23  0:32   ` netdev-bot+sashiko
2026-11-18 23:32 ` [PATCH net-next v3 6/6] enic: configure V2 VF receive mode over mailbox Satish Kharat
2026-11-23  0:32   ` netdev-bot+sashiko

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=179539392844.3135.623193821226744358@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=aradhana@cisco.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rfaucett@cisco.com \
    --cc=satishkh@cisco.com \
    --cc=sebaddel@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

all inboxes | Powered by JetHome®