mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2026-11-10 20:48:12 +00:00
net: enetc: implement ndo_set_rx_mode_async for ENETC v4 VF
An ENETC VF sends MAC filter changes to the PF over the VSI mailbox, whose send path may sleep for up to 200ms waiting for completion. Since the legacy ndo_set_rx_mode runs in atomic context, use ndo_set_rx_mode_async instead, which runs from a workqueue under rtnl_lock and receives pre-snapshotted unicast and multicast address lists from the core. Add two helpers built on the VSI mailbox: - enetc_vf_set_mac_promisc() sends a promiscuous mode message for a given filter type (unicast, multicast or both). - enetc_vf_set_mac_hash_filter() sends the 64-bit MAC hash filter table, built from the snapshotted address lists. The callback picks the configuration from the current netdev flags: - IFF_PROMISC: enable promiscuous mode for both unicast and multicast. - IFF_ALLMULTI: enable multicast promiscuous mode, disable unicast promiscuous mode and apply a unicast hash filter. - otherwise: disable promiscuous mode and apply both unicast and multicast hash filters. These requests are subject to the PF-side ENETC_VF_FLAG_TRUSTED check. For an untrusted VF (the default) the PF denies promiscuous mode and unicast hash filtering, so only the multicast hash filter is applied, limited to ENETC_VF_MC_HASH_BITS_MAX buckets. Mark a VF trusted via 'ip link set <pf> vf N trust on' for the full behaviour. Set IFF_UNICAST_FLT for ENETC v4 VFs so the stack does not needlessly fall back to full promiscuous mode; whether a unicast hash filter is actually programmed still depends on the PF trust policy. Since a denied request always fails, map -EOPNOTSUPP, -EACCES and -EPERM to 0 so the core does not retry an operation that can never succeed. ENETC v1 (LS1028A) does not support VF-to-PF MAC filter messaging and keeps using the legacy ndev ops. On VF removal, disable promiscuous mode and clear the MAC filters, so that stale configuration does not persist if the VF is later bound to another driver. Signed-off-by: Wei Fang <wei.fang@nxp.com> Link: https://patch.msgid.link/20260909100733.1139689-14-wei.fang@oss.nxp.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
fd793705e6
commit
e05f290292
1 changed files with 213 additions and 1 deletions
Loading…
Add table
Add a link
Reference in a new issue