git: 409601911b32 - main - ixgbe: respect peer mailbox ownership
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 31 Jul 2026 10:38:01 UTC
The branch main has been updated by kbowling:
URL: https://cgit.FreeBSD.org/src/commit/?id=409601911b327426a34a6f28b31fdd5d95d1d275
commit 409601911b327426a34a6f28b31fdd5d95d1d275
Author: Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-07-28 09:27:24 +0000
Commit: Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-07-31 10:25:36 +0000
ixgbe: respect peer mailbox ownership
A VF currently treats an existing VFU bit as a successful acquisition,
while the PF checks its own PFU bit before claiming the mailbox. Check
both the local and peer ownership bits before setting local ownership.
This prevents same-side callers from sharing the mailbox and avoids an
acquisition attempt while the peer owns it.
VFLR does not clear VFMAILBOX.VFU. Clear stale VF ownership and cached
mailbox status after the reset indication settles and before sending the
reset request, so the ownership check cannot strand a reinitialized VF.
Adapt only the live ownership checks from Intel ix 3.4.39. Do not import
its upgraded-mailbox changes, which are not active in FreeBSD.
Obtained from: Intel ix 3.4.39
MFC after: 1 week
---
sys/dev/ixgbe/ixgbe_mbx.c | 10 ++++++++--
sys/dev/ixgbe/ixgbe_vf.c | 7 +++++++
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/sys/dev/ixgbe/ixgbe_mbx.c b/sys/dev/ixgbe/ixgbe_mbx.c
index 7f58a9202c9e..eef30733b7b2 100644
--- a/sys/dev/ixgbe/ixgbe_mbx.c
+++ b/sys/dev/ixgbe/ixgbe_mbx.c
@@ -436,6 +436,11 @@ static s32 ixgbe_obtain_mbx_lock_vf(struct ixgbe_hw *hw)
while (countdown--) {
/* Reserve mailbox for VF use */
vf_mailbox = ixgbe_read_mailbox_vf(hw);
+
+ /* Check if the mailbox is already owned by the VF or PF */
+ if (vf_mailbox & (IXGBE_VFMAILBOX_VFU | IXGBE_VFMAILBOX_PFU))
+ goto retry;
+
vf_mailbox |= IXGBE_VFMAILBOX_VFU;
IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, vf_mailbox);
@@ -445,6 +450,7 @@ static s32 ixgbe_obtain_mbx_lock_vf(struct ixgbe_hw *hw)
break;
}
+ retry:
/* Wait a bit before trying again */
usec_delay(mbx->usec_delay);
}
@@ -870,8 +876,8 @@ static s32 ixgbe_obtain_mbx_lock_pf(struct ixgbe_hw *hw, u16 vf_id)
/* Reserve mailbox for PF use */
pf_mailbox = IXGBE_READ_REG(hw, IXGBE_PFMAILBOX(vf_id));
- /* Check if other thread holds the PF lock already */
- if (pf_mailbox & IXGBE_PFMAILBOX_PFU)
+ /* Check if the mailbox is already owned by the PF or VF */
+ if (pf_mailbox & (IXGBE_PFMAILBOX_PFU | IXGBE_PFMAILBOX_VFU))
goto retry;
pf_mailbox |= IXGBE_PFMAILBOX_PFU;
diff --git a/sys/dev/ixgbe/ixgbe_vf.c b/sys/dev/ixgbe/ixgbe_vf.c
index 4e48f7f33c9d..89bf5929260d 100644
--- a/sys/dev/ixgbe/ixgbe_vf.c
+++ b/sys/dev/ixgbe/ixgbe_vf.c
@@ -209,6 +209,13 @@ s32 ixgbe_reset_hw_vf(struct ixgbe_hw *hw)
/* Reset VF registers to initial values */
ixgbe_virt_clr_reg(hw);
+ /*
+ * VFLR does not clear VFMAILBOX.VFU. Drop stale ownership and
+ * cached read-to-clear status.
+ */
+ IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, 0);
+ hw->mbx.vf_mailbox = 0;
+
/* mailbox timeout can now become active */
mbx->timeout = IXGBE_VF_MBX_INIT_TIMEOUT;