Netdev List
 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,
	willemb@google.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, sebaddel@cisco.com,
	aradhana@cisco.com, rfaucett@cisco.com, sdf@fomichev.me
Subject: Re: [PATCH net-next v6 7/7] enic: configure V2 VF receive mode over mailbox
Date: Sat, 05 Dec 2026 16:28:19 +0000	[thread overview]
Message-ID: <179648809991.3146.3389639661633696532@kernel.org> (raw)
In-Reply-To: <20261204-b4-enic-sriov-v2-vf-receive-control-v6-7-ca38950bbe07@cisco.com>

Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] On V2 VFs, a group-bit (link-local) address in dev->uc is
  never programmed and nothing falls back to cover it.
- [Medium] An address the PF permanently rejects on ADD keeps taking a
  projected exact-filter slot on every later callback, so a valid…
- [Low] enic_set_vf_rx_mode() reports the same packet-filter denial more
  than once per callback.

--

enic: configure V2 VF receive mode over mailbox

This patch adds an asynchronous receive-mode callback for V2 VFs. The
callback sends unicast and multicast exact-filter changes, plus
packet-filter settings, to the PF over the mailbox. It orders broad-mode
transitions around exact-filter updates, reserves 31 unicast and 32
multicast slots, and skips three kinds of address: the station address,
all-zero MACs, and addresses whose group bit does not match their list.

> diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
> index 0ee2ea5b24682..116666be60340 100644
> --- a/drivers/net/ethernet/cisco/enic/enic_main.c
> +++ b/drivers/net/ethernet/cisco/enic/enic_main.c

[ ... ]

> @@ -1664,17 +1666,425 @@ static int enic_set_mac_address(struct net_device *netdev, void *p)

[ ... ]

> +static bool
> +enic_vf_secondary_addr_valid(const struct enic *enic,
> +			     const struct netdev_hw_addr *ha)
> +{
> +	u8 type = is_multicast_ether_addr(ha->addr) ?
> +		  NETDEV_HW_ADDR_T_MULTICAST : NETDEV_HW_ADDR_T_UNICAST;
> +
> +	/* The PF stores one exact filter per MAC. Admit it from the list
> +	 * matching its Ethernet address class, and leave the station separate.
> +	 */
> +	return ha->type == type && !is_zero_ether_addr(ha->addr) &&
> +	       !(enic->vf_station_addr_valid &&
> +		 ether_addr_equal(ha->addr, enic->vf_station_addr));
> +}

[Severity: Medium]
Can a link-local group address in dev->uc be silently dropped here?

The core puts these addresses into the uc list itself.
enic_netdev_vf_v2_ops has no ndo_fdb_add, so the fdb add path goes
through ndo_dflt_fdb_add():

net/core/rtnetlink.c:ndo_dflt_fdb_add() {
    ...
	if (is_unicast_ether_addr(addr) || is_link_local_ether_addr(addr))
		err = dev_uc_add_excl(dev, addr);
    ...
}

dev_uc_add_excl() stores the entry as NETDEV_HW_ADDR_T_UNICAST, and the
snapshot passed to ndo_set_rx_mode_async keeps ha->type. So a command
like "bridge fdb add 01:80:c2:00:00:0e dev <vf> self permanent"
succeeds. enic_vf_secondary_addr_valid() then rejects the entry, because
is_multicast_ether_addr() is true while ha->type is T_UNICAST.

The same predicate gates enic_vf_addr_list_count() and
enic_vf_collect_mac_ops(). As a result, no add operation is issued for
the address, and it does not count toward CMD_PFILTER_PROMISCUOUS or
CMD_PFILTER_ALL_MULTICAST. IFF_UNICAST_FLT is set, so the core does not
fall back to uc_promisc either.

enic_set_vf_rx_mode() returns 0 and the core treats the update as
converged. The LLDP/STP style frames that were requested are then never
received. An upper device that syncs its uc list down to the VF could
reach the same state.

The commit message gives this reason for the class check:

    Counting the same MAC in both lists can
    reserve capacity twice and removing one reference can delete the filter
    while the other list still considers it synchronized.

Could that be handled by classifying entries by their address bit and
deduplicating across the two lists, instead of dropping cross-class
entries entirely?

[ ... ]

> +	for (i = 0; i < num_ops; i++) {
> +		u16 flags = le16_to_cpu(macs[i].flags);
> +		bool add = flags & ENIC_MAC_ADDR_FLAG_ADD;
> +

[ ... ]

> +		if (flags & ENIC_MAC_ADDR_FLAG_PERMANENT_MASK) {
> +			if (add)
> +				permanent_add = true;
> +			else
> +				reconnect = true;
> +			continue;
> +		}

[Severity: Medium]
Does a permanently denied add keep taking a projected exact-filter slot
on every later callback?

After the denial, the entry keeps sync_cnt == 0, enic->uc_count and
enic->mc_count are unchanged, and enic_set_vf_rx_mode() turns the
resulting -EACCES into success:

	err = enic_vf_sync_mac_filters(enic, uc, mc);
	if (err == -EACCES) {
		...
		err = 0;
	}

On the next callback, projected_uc restarts from enic->uc_count.
enic_vf_collect_mac_ops() then collects the same unsynced entry again,
because its add branch only skips on:

	if (ha->sync_cnt || *projected_count >= max_filters)
		continue;

For example, take a uc list with PF-denied A followed by valid B1..B31:

  pass 1:  collects A and B1..B30 (limit 31), A is denied,
           uc_count becomes 30
  pass 2+: projected starts at 30, A takes slot 31, B31 is never
           collected

CMD_PFILTER_PROMISCUOUS is requested because 32 > 31. If the PF refuses
it, B31 is never received, even though 30 secondaries plus the station
leave one of the PF's 32 entries free. Each extra denied address costs
another slot. Multicast behaves the same way when ALL_MULTICAST is
denied.

The commit message already avoids this crowd-out for the all-zero MAC:

    The PF rejects that address as
    INVALID, so reserving capacity for it would crowd out a later valid
    address on every update.

Should addresses the PF has permanently denied also be left out of the
projection?

[ ... ]

> +	if (broad_enable_needed) {

[ ... ]

> +		target_filter_updated = prefilter_flags == flags;
> +		enic_vf_report_pkt_filter_denial(netdev, flags, applied_flags);
> +	}
> +
> +	if (broad_withdrawal) {

[ ... ]

> +		target_filter_updated = true;
> +		enic_vf_report_pkt_filter_denial(netdev, flags, applied_flags);
> +	}

[ ... ]

> +	if (!target_filter_updated && filter_needed) {
> +		err = enic_vf_set_pkt_filter(enic, flags, &applied_flags);
> +		if (err)
> +			return err;
> +	} else if (!target_filter_updated) {
> +		applied_flags = enic->vf_pkt_filter_applied;
> +	}
> +
> +	enic_vf_report_pkt_filter_denial(netdev, flags, applied_flags);

[Severity: Low]
Is the same denial reported more than once per callback here?

When broad_enable_needed is true and broad_withdrawal is false,
prefilter_flags == flags, so the enable branch reports the denial.
Neither of the final if/else-if branches runs, and this call reports it
again with the same arguments. A combined enable-plus-withdrawal
transition reports it three times.

A denied broad mode keeps broad_enable_needed true on every callback.
So each address-list update prints the same netdev_dbg lines two or
three times.

Would keeping only this final report be enough?

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

      reply	other threads:[~2026-12-05 16:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 15:29 [PATCH net-next v6 0/7] enic: add V2 VF receive control over MBOX Satish Kharat
2026-12-04 15:29 ` [PATCH net-next v6 1/7] net: add netif_rx_mode_schedule_update() Satish Kharat
2026-12-04 15:29 ` [PATCH net-next v6 2/7] enic: serialize V2 VF mailbox requests Satish Kharat
2026-12-04 15:29 ` [PATCH net-next v6 3/7] enic: recover V2 VF mailbox after request failure Satish Kharat
2026-12-05 16:28   ` netdev-bot+sashiko
2026-12-04 15:29 ` [PATCH net-next v6 4/7] enic: validate V2 VF configuration replies Satish Kharat
2026-12-05 16:28   ` netdev-bot+sashiko
2026-12-04 15:29 ` [PATCH net-next v6 5/7] net: add dev_addr_set_sync() for driver address updates Satish Kharat
2026-12-05 16:28   ` netdev-bot+sashiko
2026-12-04 15:29 ` [PATCH net-next v6 6/7] enic: manage V2 VF station and administrative MAC Satish Kharat
2026-12-05 16:28   ` netdev-bot+sashiko
2026-12-04 15:29 ` [PATCH net-next v6 7/7] enic: configure V2 VF receive mode over mailbox Satish Kharat
2026-12-05 16:28   ` netdev-bot+sashiko [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=179648809991.3146.3389639661633696532@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=sdf@fomichev.me \
    --cc=sebaddel@cisco.com \
    --cc=willemb@google.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