From nobody Sat Apr 05 03:44:57 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 4ZV1ZK4Bk1z5sv8t; Sat, 05 Apr 2025 03:44:57 +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 4ZV1ZK3VFdz3Rqm; Sat, 05 Apr 2025 03:44:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1743824697; 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=J2sm8vLVlH0l5kMRzevnBi9MNWbRjL3tsoVK2v3hyvA=; b=Q+7r8Lg6t8boWU+eudb2BYQYc4x/1tzXwQZ/c5sDu7NYy1KQV3i8tooLFKFtKf55c8FWki llM7w35UpO2lb/7a37alm3SM99kuiuBeFKTt+VpotHiwA62f7T50jCN6zBvHzj2OQgdIzB L0SmPQwc/FO/1DvP+ZK8n2pLlKCZUrw8O1M48xz3I9/eLqNvMUEHyLqMyKHjnkZNXXtCgw Uzh8LpD2yXQntPVpCNDavg1FIaCe2gHcMlhoot000+UrIY/hTnE3+/O3CJk/atxB5jV/Zb s/hYsYkmtvcMCrNXuDPyNew1okKQWNIhgEYI3dgfsvZBkMQjjNieDFVJPCKx1g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1743824697; a=rsa-sha256; cv=none; b=X1wc7sVwIFA1WeDXupiyRs+kWuOSA0HBM6/DSekVx0LbV1gpYBmG9PV+mG9G22i++nD3TF rYFqbWmOslFM1Osily/hSCgfksDldsTH/SiLWfb1CWUvRpvkblD7QQB++wy7gkuXWXLMVK wxJdrH9k6L2yD7IStMX0GUMeMRxfSemf9HA27ubxPSGqtggFirX3Lywf6i+BbguVOuHI8x PLpJ9/diOEr9u6TiPETmwQvmnEGsO2pCBHJnARwpgubA++XG/X8tEthcILZtJrh2Fixo47 UlVUHNEqDRSgAbGQirk0NT0U1L/RdK5zueupzfJmdB0P5HZQwqdW2BqKbeXDdg== 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=1743824697; 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=J2sm8vLVlH0l5kMRzevnBi9MNWbRjL3tsoVK2v3hyvA=; b=haEbAFZ12ScWhmlQSG4nn0SbmT0PEY2Bz5So9vt2GuMtrjomvet+Z/mtddxAaWvJ6n61Vj 6kRer+whTcyOIeuxnacYU2qOHC9be820PlJ82jVan0a10a4bi4jPpZOMSCaoXHBBC8eFl9 NhWtVCNSCyafQUzJBmD7keD1itf1MCQBbvmtEUVOVeE5Nc5qOWd7Q7C/2MrYvh0Vet9tFT guYWYE0sJzKbUaixG7kkEgz+YfOfOgqvK8V0RgzSjcRBO2rYnvZ7QGlcalpQ3EDLpxc40u cceGFPLl+lWvsqp1Ss28dJUgkgPsV502Zd8xMJzY+yt/6KK/zpHEazbRox2Gng== 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 4ZV1ZK352gz1Dq7; Sat, 05 Apr 2025 03:44:57 +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 5353ivmq048847; Sat, 5 Apr 2025 03:44:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5353ivPm048844; Sat, 5 Apr 2025 03:44:57 GMT (envelope-from git) Date: Sat, 5 Apr 2025 03:44:57 GMT Message-Id: <202504050344.5353ivPm048844@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: a8431b47adae - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: a8431b47adae8f8b731206dc38d82b2245ad245e Auto-Submitted: auto-generated The branch stable/13 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=a8431b47adae8f8b731206dc38d82b2245ad245e commit a8431b47adae8f8b731206dc38d82b2245ad245e Author: Norbert Ciosek AuthorDate: 2025-03-29 00:02:37 +0000 Commit: Kevin Bowling CommitDate: 2025-04-05 03:44: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) (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++;