The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=f5c22a92bfbcad347c66a79a456bc522eb4b1f78
commit f5c22a92bfbcad347c66a79a456bc522eb4b1f78 Author: Kevin Bowling <[email protected]> AuthorDate: 2026-12-03 21:54:11 +0000 Commit: Kevin Bowling <[email protected]> CommitDate: 2026-12-03 22:40:29 +0000 ixgbe: Restore PF multicast reception with SR-IOV The PF and VFs share the multicast table. With VMDq replication enabled, the PF pool needs ROMPE to receive frames matching that table. A VF accepting multicast can otherwise receive the PF's IPv6 Neighbor Discovery traffic while the PF misses it. Program the PF pool receive mode when the multicast list or interface flags change and when initialization restores the filters after reset. Enable ROMPE for a nonempty PF list and MPE for promiscuous mode, all-multicast mode, or a full PF address list. Build the pool mode from the PF settings so a reused pool cannot retain stale VF flags. Serialize the flag-change callback with multicast updates and SR-IOV reconfiguration before selecting the pool and writing the registers. Reported by: llm-postcr Fixes: 48056c88e19e ("Delta D2489 - Add SRIOV support to the Intel 10G driver.") MFC after: 1 week Sponsored by: BBOX.io --- sys/dev/ixgbe/if_ix.c | 76 +++++++++++++++++++++++------------------------- sys/dev/ixgbe/if_sriov.c | 7 +---- 2 files changed, 37 insertions(+), 46 deletions(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 5812e1950b13..c5624d270f3e 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -3332,37 +3332,46 @@ invalid: return (EINVAL); } /* ixgbe_if_media_change */ -/************************************************************************ - * ixgbe_set_promisc - ************************************************************************/ -static int -ixgbe_if_promisc_set(if_ctx_t ctx, int flags) +static void +ixgbe_set_rx_mode(if_ctx_t ctx, u_int mcnt) { struct ixgbe_softc *sc = iflib_get_softc(ctx); - if_t ifp = iflib_get_ifp(ctx); - u32 rctl; - int mcnt = 0; + struct ixgbe_hw *hw = &sc->hw; + u32 fctrl, vmolr; + int flags; - rctl = IXGBE_READ_REG(&sc->hw, IXGBE_FCTRL); - rctl &= (~IXGBE_FCTRL_UPE); - if (if_getflags(ifp) & IFF_ALLMULTI) - mcnt = MAX_NUM_MULTICAST_ADDRESSES; - else { - mcnt = min(if_llmaddr_count(ifp), - MAX_NUM_MULTICAST_ADDRESSES); - } - if (mcnt < MAX_NUM_MULTICAST_ADDRESSES) - rctl &= (~IXGBE_FCTRL_MPE); - IXGBE_WRITE_REG(&sc->hw, IXGBE_FCTRL, rctl); + flags = if_getflags(iflib_get_ifp(ctx)); + fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL); + fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); + if (flags & IFF_PROMISC) + fctrl |= IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE; + else if ((flags & IFF_ALLMULTI) != 0 || + mcnt >= MAX_NUM_MULTICAST_ADDRESSES) + fctrl |= IXGBE_FCTRL_MPE; - if (if_getflags(ifp) & IFF_PROMISC) { - rctl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); - IXGBE_WRITE_REG(&sc->hw, IXGBE_FCTRL, rctl); - } else if (if_getflags(ifp) & IFF_ALLMULTI) { - rctl |= IXGBE_FCTRL_MPE; - rctl &= ~IXGBE_FCTRL_UPE; - IXGBE_WRITE_REG(&sc->hw, IXGBE_FCTRL, rctl); + if (sc->feat_en & IXGBE_FEATURE_SRIOV) { + /* Each pool opts in to matches in the shared multicast table. */ + vmolr = IXGBE_VMOLR_BAM | IXGBE_VMOLR_AUPE; + if (mcnt != 0) + vmolr |= IXGBE_VMOLR_ROMPE; + if (fctrl & IXGBE_FCTRL_MPE) + vmolr |= IXGBE_VMOLR_MPE; + IXGBE_WRITE_REG(hw, IXGBE_VMOLR(sc->pool), vmolr); } + IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl); +} + +static int +ixgbe_if_promisc_set(if_ctx_t ctx, int flags __unused) +{ + struct sx *ctx_lock = iflib_ctx_lock_get(ctx); + + /* iflib drops the context lock before calling IFDI_PROMISC_SET. */ + sx_xlock(ctx_lock); + if (iflib_is_running(ctx)) + ixgbe_set_rx_mode(ctx, if_llmaddr_count(iflib_get_ifp(ctx))); + sx_xunlock(ctx_lock); + return (0); } /* ixgbe_if_promisc_set */ @@ -4804,9 +4813,7 @@ ixgbe_if_multi_set(if_ctx_t ctx) { struct ixgbe_softc *sc = iflib_get_softc(ctx); struct ixgbe_mc_addr *mta; - if_t ifp = iflib_get_ifp(ctx); u8 *update_ptr; - u32 fctrl; u_int mcnt; IOCTL_DEBUGOUT("ixgbe_if_multi_set: begin"); @@ -4830,18 +4837,7 @@ ixgbe_if_multi_set(if_ctx_t ctx) } } - fctrl = IXGBE_READ_REG(&sc->hw, IXGBE_FCTRL); - - if (if_getflags(ifp) & IFF_PROMISC) - fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); - else if (mcnt >= MAX_NUM_MULTICAST_ADDRESSES || - if_getflags(ifp) & IFF_ALLMULTI) { - fctrl |= IXGBE_FCTRL_MPE; - fctrl &= ~IXGBE_FCTRL_UPE; - } else - fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); - - IXGBE_WRITE_REG(&sc->hw, IXGBE_FCTRL, fctrl); + ixgbe_set_rx_mode(ctx, mcnt); } /* ixgbe_if_multi_set */ /************************************************************************ diff --git a/sys/dev/ixgbe/if_sriov.c b/sys/dev/ixgbe/if_sriov.c index ab1b98e3b57b..808c3fe3bd54 100644 --- a/sys/dev/ixgbe/if_sriov.c +++ b/sys/dev/ixgbe/if_sriov.c @@ -2108,7 +2108,7 @@ void ixgbe_initialize_iov(struct ixgbe_softc *sc) { struct ixgbe_hw *hw = &sc->hw; - uint32_t mrqc, mtqc, vt_ctl, vf_reg, gcr_ext, gpie, vmolr; + uint32_t mrqc, mtqc, vt_ctl, vf_reg, gcr_ext, gpie; int i; if (sc->iov_mode == IXGBE_NO_VM) @@ -2160,11 +2160,6 @@ ixgbe_initialize_iov(struct ixgbe_softc *sc) vt_ctl |= (sc->pool << IXGBE_VT_CTL_POOL_SHIFT); IXGBE_WRITE_REG(hw, IXGBE_VT_CTL, vt_ctl); - /* Accept broadcasts and untagged frames in the PF's own pool. */ - vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(sc->pool)); - vmolr |= IXGBE_VMOLR_BAM | IXGBE_VMOLR_AUPE; - IXGBE_WRITE_REG(hw, IXGBE_VMOLR(sc->pool), vmolr); - /* * Reset clears the pool selection for RAR[0]. Program the pool * and address together so the switch delivers VF unicast to the PF.
