Date: Fri, 31 Jul 2026 09:49:03 +0000 From: Kevin Bowling <kbowling@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 4b67335676b0 - main - ixgbe: isolate VF reset state Message-ID: <6a6c6f8f.33004.1ff74b17@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=4b67335676b09249c8ef5ea5508655c0b5733618 commit 4b67335676b09249c8ef5ea5508655c0b5733618 Author: Kevin Bowling <kbowling@FreeBSD.org> AuthorDate: 2026-07-28 09:21:47 +0000 Commit: Kevin Bowling <kbowling@FreeBSD.org> CommitDate: 2026-07-31 09:48:46 +0000 ixgbe: isolate VF reset state IXGBE_VF_INDEX() selects a 32-VF register bank. PFMBMEM() selects one mailbox per VF, while ixgbe_toggle_txdctl() calculates queue offsets from a VF number. Passing the bank index aliases VF1-31 to VF0 and VF32-63 to VF1. Resetting one VF can therefore clear the peer mailbox and leave its transmit queues disabled. The VF raises its reset event before posting its mailbox request. The PF checks reset events before mailbox messages. If both are pending, clearing PFMBMEM during generic reset handling can erase the request before ixgbe_read_mbx() consumes it. Clear the mailbox only from the reset-message handler after the request has been read. Use the VF number for queue toggling and document that API contract. MFC after: 1 week --- sys/dev/ixgbe/if_sriov.c | 20 ++++++-------------- sys/dev/ixgbe/ixgbe_api.c | 6 +++--- sys/dev/ixgbe/ixgbe_api.h | 2 +- sys/dev/ixgbe/ixgbe_common.c | 2 +- sys/dev/ixgbe/ixgbe_type.h | 2 +- 5 files changed, 12 insertions(+), 20 deletions(-) diff --git a/sys/dev/ixgbe/if_sriov.c b/sys/dev/ixgbe/if_sriov.c index 47f1a1279e2f..bd27796ebcf3 100644 --- a/sys/dev/ixgbe/if_sriov.c +++ b/sys/dev/ixgbe/if_sriov.c @@ -254,18 +254,6 @@ ixgbe_vf_set_default_vlan(struct ixgbe_softc *sc, struct ixgbe_vf *vf, IXGBE_WRITE_REG(hw, IXGBE_VMVIR(vf->pool), vmvir); } /* ixgbe_vf_set_default_vlan */ -static void -ixgbe_clear_vfmbmem(struct ixgbe_softc *sc, struct ixgbe_vf *vf) -{ - struct ixgbe_hw *hw = &sc->hw; - uint32_t vf_index = IXGBE_VF_INDEX(vf->pool); - uint16_t mbx_size = hw->mbx.size; - uint16_t i; - - for (i = 0; i < mbx_size; ++i) - IXGBE_WRITE_REG_ARRAY(hw, IXGBE_PFMBMEM(vf_index), i, 0x0); -} /* ixgbe_clear_vfmbmem */ - static boolean_t ixgbe_vf_frame_size_compatible(struct ixgbe_softc *sc, struct ixgbe_vf *vf) { @@ -320,8 +308,7 @@ ixgbe_process_vf_reset(struct ixgbe_softc *sc, struct ixgbe_vf *vf) // XXX clear multicast addresses ixgbe_clear_rar(&sc->hw, vf->rar_index); - ixgbe_clear_vfmbmem(sc, vf); - ixgbe_toggle_txdctl(&sc->hw, IXGBE_VF_INDEX(vf->pool)); + ixgbe_toggle_txdctl(&sc->hw, vf->pool); vf->api_ver = IXGBE_API_VER_UNKNOWN; } /* ixgbe_process_vf_reset */ @@ -370,6 +357,11 @@ ixgbe_vf_reset_msg(struct ixgbe_softc *sc, struct ixgbe_vf *vf, uint32_t *msg) hw = &sc->hw; ixgbe_process_vf_reset(sc, vf); + /* + * The reset request was consumed by ixgbe_process_vf_msg(), so it is + * now safe to clear this VF's mailbox. + */ + ixgbe_clear_mbx(hw, vf->pool); if (ixgbe_validate_mac_addr(vf->ether_addr) == 0) { ixgbe_set_rar(&sc->hw, vf->rar_index, vf->ether_addr, diff --git a/sys/dev/ixgbe/ixgbe_api.c b/sys/dev/ixgbe/ixgbe_api.c index f11f52a646e4..3794bb2676f6 100644 --- a/sys/dev/ixgbe/ixgbe_api.c +++ b/sys/dev/ixgbe/ixgbe_api.c @@ -1152,14 +1152,14 @@ s32 ixgbe_set_vlvf(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on, /** * ixgbe_toggle_txdctl - Toggle VF's queues * @hw: pointer to hardware structure - * @vind: VMDq pool index + * @vf_number: VF number * * Enable and disable each queue in VF. */ -s32 ixgbe_toggle_txdctl(struct ixgbe_hw *hw, u32 vind) +s32 ixgbe_toggle_txdctl(struct ixgbe_hw *hw, u32 vf_number) { return ixgbe_call_func(hw, hw->mac.ops.toggle_txdctl, (hw, - vind), IXGBE_NOT_IMPLEMENTED); + vf_number), IXGBE_NOT_IMPLEMENTED); } /** diff --git a/sys/dev/ixgbe/ixgbe_api.h b/sys/dev/ixgbe/ixgbe_api.h index 2b4cec8d110e..4a9d89255257 100644 --- a/sys/dev/ixgbe/ixgbe_api.h +++ b/sys/dev/ixgbe/ixgbe_api.h @@ -132,7 +132,7 @@ s32 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan, s32 ixgbe_set_vlvf(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on, u32 *vfta_delta, u32 vfta, bool vlvf_bypass); -s32 ixgbe_toggle_txdctl(struct ixgbe_hw *hw, u32 vind); +s32 ixgbe_toggle_txdctl(struct ixgbe_hw *hw, u32 vf_number); s32 ixgbe_fc_enable(struct ixgbe_hw *hw); s32 ixgbe_setup_fc(struct ixgbe_hw *hw); s32 ixgbe_set_fw_drv_ver(struct ixgbe_hw *hw, u8 maj, u8 min, u8 build, diff --git a/sys/dev/ixgbe/ixgbe_common.c b/sys/dev/ixgbe/ixgbe_common.c index 9e827d2e5473..a8676c731711 100644 --- a/sys/dev/ixgbe/ixgbe_common.c +++ b/sys/dev/ixgbe/ixgbe_common.c @@ -4153,7 +4153,7 @@ s32 ixgbe_clear_vfta_generic(struct ixgbe_hw *hw) /** * ixgbe_toggle_txdctl_generic - Toggle VF's queues * @hw: pointer to hardware structure - * @vf_number: VF index + * @vf_number: VF number * * Enable and disable each queue in VF. */ diff --git a/sys/dev/ixgbe/ixgbe_type.h b/sys/dev/ixgbe/ixgbe_type.h index 0bbe7806d41d..4e242b7189cb 100644 --- a/sys/dev/ixgbe/ixgbe_type.h +++ b/sys/dev/ixgbe/ixgbe_type.h @@ -4105,7 +4105,7 @@ struct ixgbe_mac_operations { s32 (*init_uta_tables)(struct ixgbe_hw *); void (*set_mac_anti_spoofing)(struct ixgbe_hw *, bool, int); void (*set_vlan_anti_spoofing)(struct ixgbe_hw *, bool, int); - s32 (*toggle_txdctl)(struct ixgbe_hw *hw, u32 vf_index); + s32 (*toggle_txdctl)(struct ixgbe_hw *hw, u32 vf_number); s32 (*update_xcast_mode)(struct ixgbe_hw *, int); s32 (*set_rlpml)(struct ixgbe_hw *, u16);home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a6c6f8f.33004.1ff74b17>
