git: 6e510d8fbaf8 - stable/14 - ixgbe: fix mailbox ack handling
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 05 Apr 2025 03:44:11 UTC
The branch stable/14 has been updated by kbowling:
URL: https://cgit.FreeBSD.org/src/commit/?id=6e510d8fbaf8d91da235fe28250cd48124edda9f
commit 6e510d8fbaf8d91da235fe28250cd48124edda9f
Author: Norbert Ciosek <norbertx.ciosek@intel.com>
AuthorDate: 2025-03-29 00:02:37 +0000
Commit: Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2025-04-05 03:43:39 +0000
ixgbe: fix mailbox ack handling
Check if CTS bit is set in the mailbox message before waiting for ACK.
Otherwise ACK will never be received causing the function to timeout. Add
a note for ixgbe_write_mbx that it should be called while holding a lock.
Fixes: 6d243d2 ("net/ixgbe/base: introduce new mailbox API")
Cc: stable@dpdk.org
Signed-off-by: Norbert Ciosek <norbertx.ciosek@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Obtained from: DPDK (1f119e4)
(cherry picked from commit 1580f8d9c1740e0c54554e6c185573d34f2dcf76)
---
sys/dev/ixgbe/ixgbe_mbx.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/sys/dev/ixgbe/ixgbe_mbx.c b/sys/dev/ixgbe/ixgbe_mbx.c
index 0b866e7a39af..7f58a9202c9e 100644
--- a/sys/dev/ixgbe/ixgbe_mbx.c
+++ b/sys/dev/ixgbe/ixgbe_mbx.c
@@ -112,6 +112,9 @@ s32 ixgbe_poll_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id)
*
* returns SUCCESS if it successfully copied message into the buffer and
* received an ACK to that message within specified period
+ *
+ * Note that the caller to this function must lock before calling, since
+ * multiple threads can destroy each other messages.
**/
s32 ixgbe_write_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id)
{
@@ -866,6 +869,11 @@ static s32 ixgbe_obtain_mbx_lock_pf(struct ixgbe_hw *hw, u16 vf_id)
while (countdown--) {
/* 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)
+ goto retry;
+
pf_mailbox |= IXGBE_PFMAILBOX_PFU;
IXGBE_WRITE_REG(hw, IXGBE_PFMAILBOX(vf_id), pf_mailbox);
@@ -876,6 +884,7 @@ static s32 ixgbe_obtain_mbx_lock_pf(struct ixgbe_hw *hw, u16 vf_id)
break;
}
+ retry:
/* Wait a bit before trying again */
usec_delay(mbx->usec_delay);
}
@@ -978,13 +987,14 @@ static s32 ixgbe_write_mbx_pf(struct ixgbe_hw *hw, u32 *msg, u16 size,
for (i = 0; i < size; i++)
IXGBE_WRITE_REG_ARRAY(hw, IXGBE_PFMBMEM(vf_id), i, msg[i]);
- /* Interrupt VF to tell it a message has been sent */
+ /* interrupt VF to tell it a message has been sent */
pf_mailbox = IXGBE_READ_REG(hw, IXGBE_PFMAILBOX(vf_id));
pf_mailbox |= IXGBE_PFMAILBOX_STS;
IXGBE_WRITE_REG(hw, IXGBE_PFMAILBOX(vf_id), pf_mailbox);
/* if msg sent wait until we receive an ack */
- ixgbe_poll_for_ack(hw, vf_id);
+ if (msg[0] & IXGBE_VT_MSGTYPE_CTS)
+ ixgbe_poll_for_ack(hw, vf_id);
/* update stats */
hw->mbx.stats.msgs_tx++;