From nobody Sat Apr 5 03:44:11 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4ZV1YS2jLrz5sv75; Sat, 05 Apr 2025 03:44:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZV1YS0TdNz3RrP; Sat, 05 Apr 2025 03:44:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1743824652; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oR9sFHZqVu+qh8UrJ1ggILwrYtLSneMrhgOws3fVsXM=; b=EKeKVRWKSE+Po06u1vS3T5RXoMqrlQWsSRIKbHvv9i8ojdG3sh4TCaZx5M6JpiEAOMEq9x Mv7DEEV1GXXER0MH+Bin2qFxi9JdS/BjUNRxnAsk10E4klo4KMF4l/wqpCap+ZO/Zw0U9K 8LdG0lCagdZ7exVB2usF9dUkSkVPAyUiqTWYDG7EE7ZEgD/rGjtDfPMHqJSYmTLqpmmeol vc8zySwA3VxRmHctXyj4zwz8+t1BOkHntyRgdF5N9COmgph9wh/5FXohQYJx16skdwL1Ch WDpzt02JrqHJkFCtIupUKQMBkW6na11ftI7E3e/2Uhmu4Eb6v5Yw273t+PswEA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1743824652; a=rsa-sha256; cv=none; b=rt1ztNi/d9YB6EFpvqr4ssyW0vUkUoX07Q4JtnLRvxDweKhq+tce3j+bEEKKoyJEmS26D8 YUiNzj/xxXWUWK/OauRyMeezIup6ae3NacfBh5ggwZJIUdBPt9AL17q02G21LR/yV67e+g Ru/BJ0uW4vl00K14M4IonHav3j68T08DaDE7UaFOI+h+Kseln2pW8VNCZ5qFnaR9X84s0A uE+nw0FIvyPOYGtdS/GEigYrKV9IzNk4LSiOjsUxNoDa7Sa+fOzrhyXwsVntP+2IP0PxLa ++PPjBsmQIngdDlSPdoOIQC7ByIkblIQE4xiAklbaXJ4c2jMcr9yCDjhxx09KQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1743824652; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oR9sFHZqVu+qh8UrJ1ggILwrYtLSneMrhgOws3fVsXM=; b=CqO4dNITmU4RwPCEmCXECLdHJkre2nI/7V5fE5OCkKLQLRPPdZCCE4pUkFyXb22fSpcTOS /18QwD0mp2GdfZMSXSNjWv1MXhu0mBiwisiWUBQ1LaSbzsnH42zoqvYzw44NiMBtIzP8sq XwUr7cXIm1vX6DbYNTiEK/s20U3XYFn0gyePJtFSnaqrOygDr+nozNTIhZ+BLDhVl35od5 xSd95I66ySZ0NwgKQ+7UsgQM/BsE3Uun3w5A4P4ZZgUk4RBiHT/RnhhRp3FxvtA35vegCI NdjDJI2ah/3gDhM5ycPT43QkBcoQ1CFHpxNIYansICuiAWhn9mnHNH28bn5vRg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4ZV1YS03sPz1DJx; Sat, 05 Apr 2025 03:44:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5353iBaV048522; Sat, 5 Apr 2025 03:44:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5353iB4g048519; Sat, 5 Apr 2025 03:44:11 GMT (envelope-from git) Date: Sat, 5 Apr 2025 03:44:11 GMT Message-Id: <202504050344.5353iB4g048519@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 6e510d8fbaf8 - stable/14 - ixgbe: fix mailbox ack handling List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 6e510d8fbaf8d91da235fe28250cd48124edda9f Auto-Submitted: auto-generated The branch stable/14 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=6e510d8fbaf8d91da235fe28250cd48124edda9f commit 6e510d8fbaf8d91da235fe28250cd48124edda9f Author: Norbert Ciosek AuthorDate: 2025-03-29 00:02:37 +0000 Commit: Kevin Bowling 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 Signed-off-by: Anatoly Burakov Acked-by: Bruce Richardson 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++;