Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: satishkh@cisco.com
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, sebaddel@cisco.com
Subject: Re: [PATCH net-next v7 07/10] enic: add MBOX PF handlers for VF register and capability
Date: Mon, 18 May 2026 18:42:08 -0700	[thread overview]
Message-ID: <20260519014208.3395879-1-kuba@kernel.org> (raw)
In-Reply-To: <20260513-enic-sriov-v2-admin-channel-v2-v7-7-68b9f4141f4c@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 PF handlers for VF register and capability

This commit implements PF-side mailbox message processing for SR-IOV V2
admin channel communication. It routes messages from VFs to type-specific
handlers and tracks per-VF state.

> diff --git a/drivers/net/ethernet/cisco/enic/enic_mbox.c b/drivers/net/ethernet/cisco/enic/enic_mbox.c
> index 3f95247b8f6ba..0f7f9d2d091f7 100644
> --- a/drivers/net/ethernet/cisco/enic/enic_mbox.c
> +++ b/drivers/net/ethernet/cisco/enic/enic_mbox.c

[ ... ]

> @@ -135,10 +135,177 @@ int enic_mbox_send_msg(struct enic *enic, u8 msg_type, u16 dst_vnic_id,

[ ... ]

> +static int enic_mbox_pf_handle_register(struct enic *enic, void *msg,
> +					u16 vf_id, u64 msg_num)
> +{

[ ... ]

> +	err = enic_mbox_send_link_state(enic, vf_id,
> +					ENIC_MBOX_LINK_STATE_ENABLE);
> +	if (err)
> +		netdev_warn(enic->netdev,
> +			    "VF %u: failed to send initial link state: %d\n",
> +			    vf_id, err);

Could a malicious or misbehaving VF flood the host kernel log here?

Other VF-triggered warnings in this file use net_ratelimit() to prevent a
host-side denial-of-service condition where unbounded kernel logging degrades
system performance. Does this netdev_warn() need a net_ratelimit() check as
well?

> +	/* Registration succeeded; link state will be (re-)sent on next
> +	 * enic_link_check() event.
> +	 */
> +	return 0;
> +}

[ ... ]

> +static void enic_mbox_pf_process_msg(struct enic *enic,
> +				     struct enic_mbox_hdr *hdr, void *payload)
> +{

[ ... ]

> +	switch (hdr->msg_type) {

[ ... ]

> +	case ENIC_MBOX_PF_LINK_STATE_ACK: {
> +		struct enic_mbox_pf_link_state_ack_msg *ack = payload;
> +
> +		if (msg_len < sizeof(*hdr) + sizeof(*ack))
> +			break;
> +		if (le16_to_cpu(ack->ack.ret_major))
> +			netdev_warn(enic->netdev,
> +				    "MBOX: VF %u link state ACK error %u/%u\n",
> +				    vf_id, le16_to_cpu(ack->ack.ret_major),
> +				    le16_to_cpu(ack->ack.ret_minor));

Similarly, if a VF sends continuous ENIC_MBOX_PF_LINK_STATE_ACK messages with
a non-zero ret_major error, could it spam the host logs?

Should this netdev_warn() also be guarded by if (net_ratelimit())?

> +		break;
> +	}

[ ... ]
-- 
pw-bot: cr

  reply	other threads:[~2026-05-19  1:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13 15:15 [PATCH net-next v7 00/10] enic: SR-IOV V2 admin channel and MBOX protocol Satish Kharat
2026-05-13 15:15 ` [PATCH net-next v7 01/10] enic: verify firmware supports V2 SR-IOV at probe time Satish Kharat
2026-05-14  9:13   ` Breno Leitao
2026-05-13 15:15 ` [PATCH net-next v7 02/10] enic: add admin channel open and close for SR-IOV Satish Kharat
2026-05-13 15:15 ` [PATCH net-next v7 03/10] enic: add admin RQ buffer management Satish Kharat
2026-05-13 15:15 ` [PATCH net-next v7 04/10] enic: add admin CQ service with MSI-X interrupt and NAPI polling Satish Kharat
2026-05-19  1:36   ` Jakub Kicinski
2026-05-13 15:15 ` [PATCH net-next v7 05/10] enic: define MBOX message types and header structures Satish Kharat
2026-05-13 15:15 ` [PATCH net-next v7 06/10] enic: add MBOX core send and receive for admin channel Satish Kharat
2026-05-19  1:38   ` Jakub Kicinski
2026-05-13 15:15 ` [PATCH net-next v7 07/10] enic: add MBOX PF handlers for VF register and capability Satish Kharat
2026-05-19  1:42   ` Jakub Kicinski [this message]
2026-05-13 15:15 ` [PATCH net-next v7 08/10] enic: add MBOX VF handlers for capability, register and link state Satish Kharat
2026-05-19  1:42   ` Jakub Kicinski
2026-05-13 15:15 ` [PATCH net-next v7 09/10] enic: wire V2 SR-IOV enable with admin channel and MBOX Satish Kharat
2026-05-13 15:15 ` [PATCH net-next v7 10/10] enic: add V2 VF probe with admin channel and PF registration Satish Kharat

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=20260519014208.3395879-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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