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: add MAC address filtering support for VFs of ENETC v4
ENETC v4 VF hardware supports MAC address filtering, but the underlying resources (the PSIPMMR register and per-SI hash filter tables) are owned by the PF. Add VSI-to-PSI mailbox messages so a VF can request MAC filter configuration from the PF, using two new command IDs under the existing MAC filter class (0x20): 1. ENETC_MSG_SET_MAC_HASH_TABLE (cmd_id 3): program the unicast and/or multicast MAC hash filter table. Unicast filtering is only allowed for a trusted VF, since it could be used to receive traffic destined for other SIs. Multicast filtering is allowed even for an untrusted VF, but limited to ENETC_VF_MC_HASH_BITS_MAX (8) buckets, enough for basic operation such as IPv6 neighbor discovery and mDNS; a trusted VF may use all 64 buckets. 2. ENETC_MSG_SET_MAC_PROMISC_MODE (cmd_id 5): enable or disable unicast/ multicast promiscuous mode, and optionally flush the hash filter table. Enabling promiscuous mode requires a trusted VF; flushing the table alone does not. The PSIPMMR register is a shared resource accessed by both enetc4_pf_set_rx_mode() and the VF message handler via a non-atomic read-modify-write, so protect these accesses with si->gen_lock to avoid lost updates on SMP. When a VF loses trusted status via ndo_set_vf_trust(), clear its unicast hash filter and disable promiscuous mode so it cannot receive traffic beyond its allowed scope. Signed-off-by: Wei Fang <wei.fang@nxp.com> Link: https://patch.msgid.link/20260909100733.1139689-10-wei.fang@oss.nxp.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
261be51219
commit
e7ac83644e
7 changed files with 300 additions and 35 deletions
Loading…
Add table
Add a link
Reference in a new issue