From nobody Sat Mar 29 00:09:10 2025 X-Original-To: dev-commits-src-main@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 4ZPd6Z3dgWz5rfNR; Sat, 29 Mar 2025 00:09:10 +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 4ZPd6Z2LdSz3JFM; Sat, 29 Mar 2025 00:09:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1743206950; 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=IFrTveogX+s/lJUHmmgn2v6UIe3kPWsU05LKMa6OZhU=; b=x4xuLL/7kI4yLYe6OzFWS5OKBJd0/8t+b3VDCtLgJyVKTHYQvXql0ajGmSTwknw7i0pdoA mVrxUVUknYvWPNmCMJjwWuo1pmkWR5lRDT4BWozQcdC0XvkMzaDdmpsemvJKHE1rZ1Xxwt S89X38nHhwII4EF47nGM1D6kGvGbZ9T20H2w+FnpvAkHlDvHWfemCXEsxN9e/fgLNOceNA 11FZYhb0OR+xfBKasKP14hRQMqC9HWE/THvkTV4KMwUo3hwYGOqHYkwQOugBUyCFnZLMVZ S4Du3tyaeSWBJUzxBXkiSoj26qfW8CSfiECVBOYRvGh4Q7PBcSDPdl3gbBX4+A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1743206950; a=rsa-sha256; cv=none; b=SMPKqKK9dtpPPDiqn2x+whBw0tVt311PeRtz825pQztwr2/uKaNlVamzySilbfllN70Rd6 zEb0Q0z3tYlyRuuuJjNDQU03lofWt2d+rmrO+sEKusXMJGlUFfYJ5fdhATf8mMK86LMZuo jKmRjBQ0v0t9Zn7QwDTCNK+8sq361adSKUI1EW0X5NfFiHZXic9ndjx874sgNIxor8J3ER 6ufovWN0CYdM7IJl+8uXcMtCz6LCWVItYkW7iQyS+fhRZgvD5a6Suu1p/jbb6ZzQ3hFM3l MlhpfMO1iAv2VjIfGT8QvPkpr4LFl66AyvomNxIAdHfjfWJ+wfXHJLmniP7UPQ== 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=1743206950; 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=IFrTveogX+s/lJUHmmgn2v6UIe3kPWsU05LKMa6OZhU=; b=R6zw0iuuUR8JoezA8SBuP0b0luSEHEDX8GKGCKZNb4d83tvpDEyXbaGdpewUTGIOCC6trQ mG1EsKcyMg0tkkBofDhMvcqUbXzxr5/esFw00UHqePynpksPUNX2hs/be5lGEelxbQ0xL9 UCeDf/ND7BFw8150ZFbogUq93hQ03B7suGrj5uUy4elrn5AQQdD4whXgcaxzBssAHsiFOS fBSWO76J0Pnt+i0GIyaIAfZNfr2oacDtQr0XocAQ1vdjpAEVzTegiFkHtphyL3n9htYiNn flIrjBOKFu4n9sH9yWiTO6i4zLPD34zOtNAwyZZn0wIAM2l3IB4YV8ftRybzww== 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 4ZPd6Z1cbqz14ky; Sat, 29 Mar 2025 00:09:10 +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 52T09AeG084572; Sat, 29 Mar 2025 00:09:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 52T09ALw084569; Sat, 29 Mar 2025 00:09:10 GMT (envelope-from git) Date: Sat, 29 Mar 2025 00:09:10 GMT Message-Id: <202503290009.52T09ALw084569@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 1580f8d9c174 - main - ixgbe: fix mailbox ack handling List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 1580f8d9c1740e0c54554e6c185573d34f2dcf76 Auto-Submitted: auto-generated The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=1580f8d9c1740e0c54554e6c185573d34f2dcf76 commit 1580f8d9c1740e0c54554e6c185573d34f2dcf76 Author: Norbert Ciosek AuthorDate: 2025-03-29 00:02:37 +0000 Commit: Kevin Bowling CommitDate: 2025-03-29 00:02:37 +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) MFC after: 1 week --- 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++;