From nobody Thu Sep 26 03:29:54 2024 X-Original-To: dev-commits-src-branches@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 4XDfH663JVz5Y6mZ; Thu, 26 Sep 2024 03:29:54 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XDfH63yPRz4WBt; Thu, 26 Sep 2024 03:29:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727321394; 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=lwbaDDnjTlnhIvjAAwMotT7plUtEKZ+5nK5yclxV72Q=; b=qTYrTfm4vt/LDShECbKaSDARr6C5jKd1t5wXYbdGaKK0GBAZ+SG3LZQLErM1sEdsBpiSmh wfGrqNdkzXX1g9kp+1FOAA2WyVd350LJ2SR+Qe2ce39HJi3aMSrnwmDqE15jPcURRj+Xap VpgGezdeQuIiMdcIivbH13eUYs2hGp18l+ARMo73I2X8usLjb+pmOFcLJrmmE2UBE+GKX+ HwoDx16AWQ4jOalj7fdqH0SScBNlDnYeYwsLj92O8H6fmPRyafFWOxUJS2V8jZFsOgFkcv IMe4awzEhtuYTZJMmdERUgwhW/B0qU4Kkag6TqumAi36N8ML2PcH5OLXwSZzcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727321394; 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=lwbaDDnjTlnhIvjAAwMotT7plUtEKZ+5nK5yclxV72Q=; b=HtiQp34Wz+jpibmd8BAUH/eFXNPKuTxSj6Fp/8G9MA5fOPcVyyCZUmLNsjRAFhGNwkvu+q 8Jt1cLr2ZBLcDERWWxq//QD1JdJgVM37dKoqviEQWT+OoDUqeZl/aLW8iYJ8vuBce67+UE DCbSD8jH9DP25hElTtUGpVjVH6+Xw16YkiyiMsP/ZhXM5Auf0rNd8JkICQyOvuOcozFGKB 4NRUxp4AymjsrnTCGpn4UrPlEEX+/C2Yk3jyEiTDjare6OrM0MkBzuD8oQUPtJKF407DhJ uwvn+4Epfr0fjCR4jvqg8dY/0O/tAQlBfM92yMGO/uB2nq2Rx4mjQaoYKuOm3Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727321394; a=rsa-sha256; cv=none; b=hqjtVEXkFr5pZJvDTeBoilSqwUBZVyyun84XJINlqfLx2MARVeyhPnlDU6j+FVSUAQcKZz OCIS+gt94D4rcV/AMipoGeyy0Mu3tArM4X1WqqTyDUkX0zSAvPt5OtCpXZai+eSgo39fu9 prD3td8q3c6A1tCT+ag0RDCmiREH5xUDrsRnaI3JkW07wSaFfEIpw98XvrVWVk5UdSvMjo C4jDOgrqt4T120RNnDyMk+fdRfbSqZZTH+s6dqBHXPgt2P3RU4DUT4krSh+kNStzzbqMr0 Vt6L/w5ORhCXZRN28zWKrZYFSLSXyc2SHcJVa0JQEJ+o/LVpNQirN6MaVjSVWg== 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 4XDfH635HSzg3l; Thu, 26 Sep 2024 03:29:54 +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 48Q3TsNv082852; Thu, 26 Sep 2024 03:29:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48Q3Ts4s082849; Thu, 26 Sep 2024 03:29:54 GMT (envelope-from git) Date: Thu, 26 Sep 2024 03:29:54 GMT Message-Id: <202409260329.48Q3Ts4s082849@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: 89011d8c4ddf - stable/14 - ixgbe: correct register names to match datasheet List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: 89011d8c4ddf9ad7a4d7c3fc970be2d9029caa1e Auto-Submitted: auto-generated The branch stable/14 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=89011d8c4ddf9ad7a4d7c3fc970be2d9029caa1e commit 89011d8c4ddf9ad7a4d7c3fc970be2d9029caa1e Author: Jakub Chylkowski AuthorDate: 2024-09-19 23:25:09 +0000 Commit: Kevin Bowling CommitDate: 2024-09-26 03:29:18 +0000 ixgbe: correct register names to match datasheet DPDK commit message net/ixgbe/base: correct registers names to match datasheet Some of mailbox-related registers have different names than it is specified in datasheet. Correct these names to correspond to their datasheet counterparts. Additionally, several calculations are changed to no longer use magic numbers but dedicated macros instead. Signed-off-by: Jakub Chylkowski Reviewed-by: Marek Zalfresso-jundzillo Reviewed-by: Alice Michael Reviewed-by: Piotr Skajewski Reviewed-by: Slawomir Mrozowicz Tested-by: Piotr Skajewski Tested-by: Alice Michael Obtained from: DPDK (10fd55e) (cherry picked from commit b3c7fde6fe9113f849232604523878b4b68df0cc) --- sys/dev/ixgbe/ixgbe_mbx.c | 30 +++++++++++++++--------------- sys/dev/ixgbe/ixgbe_mbx.h | 8 ++++---- sys/dev/ixgbe/ixgbe_type.h | 11 ++++++----- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/sys/dev/ixgbe/ixgbe_mbx.c b/sys/dev/ixgbe/ixgbe_mbx.c index d12aadea7097..c8f839fce85a 100644 --- a/sys/dev/ixgbe/ixgbe_mbx.c +++ b/sys/dev/ixgbe/ixgbe_mbx.c @@ -527,12 +527,12 @@ void ixgbe_init_mbx_params_vf(struct ixgbe_hw *hw) static s32 ixgbe_check_for_bit_pf(struct ixgbe_hw *hw, u32 mask, s32 index) { - u32 mbvficr = IXGBE_READ_REG(hw, IXGBE_MBVFICR(index)); + u32 pfmbicr = IXGBE_READ_REG(hw, IXGBE_PFMBICR(index)); s32 ret_val = IXGBE_ERR_MBX; - if (mbvficr & mask) { + if (pfmbicr & mask) { ret_val = IXGBE_SUCCESS; - IXGBE_WRITE_REG(hw, IXGBE_MBVFICR(index), mask); + IXGBE_WRITE_REG(hw, IXGBE_PFMBICR(index), mask); } return ret_val; @@ -547,13 +547,13 @@ static s32 ixgbe_check_for_bit_pf(struct ixgbe_hw *hw, u32 mask, s32 index) **/ static s32 ixgbe_check_for_msg_pf(struct ixgbe_hw *hw, u16 vf_number) { + u32 vf_shift = IXGBE_PFMBICR_SHIFT(vf_number); + s32 index = IXGBE_PFMBICR_INDEX(vf_number); s32 ret_val = IXGBE_ERR_MBX; - s32 index = IXGBE_MBVFICR_INDEX(vf_number); - u32 vf_bit = vf_number % 16; DEBUGFUNC("ixgbe_check_for_msg_pf"); - if (!ixgbe_check_for_bit_pf(hw, IXGBE_MBVFICR_VFREQ_VF1 << vf_bit, + if (!ixgbe_check_for_bit_pf(hw, IXGBE_PFMBICR_VFREQ_VF1 << vf_shift, index)) { ret_val = IXGBE_SUCCESS; hw->mbx.stats.reqs++; @@ -571,13 +571,13 @@ static s32 ixgbe_check_for_msg_pf(struct ixgbe_hw *hw, u16 vf_number) **/ static s32 ixgbe_check_for_ack_pf(struct ixgbe_hw *hw, u16 vf_number) { + u32 vf_shift = IXGBE_PFMBICR_SHIFT(vf_number); + s32 index = IXGBE_PFMBICR_INDEX(vf_number); s32 ret_val = IXGBE_ERR_MBX; - s32 index = IXGBE_MBVFICR_INDEX(vf_number); - u32 vf_bit = vf_number % 16; DEBUGFUNC("ixgbe_check_for_ack_pf"); - if (!ixgbe_check_for_bit_pf(hw, IXGBE_MBVFICR_VFACK_VF1 << vf_bit, + if (!ixgbe_check_for_bit_pf(hw, IXGBE_PFMBICR_VFACK_VF1 << vf_shift, index)) { ret_val = IXGBE_SUCCESS; hw->mbx.stats.acks++; @@ -595,22 +595,22 @@ static s32 ixgbe_check_for_ack_pf(struct ixgbe_hw *hw, u16 vf_number) **/ static s32 ixgbe_check_for_rst_pf(struct ixgbe_hw *hw, u16 vf_number) { - u32 reg_offset = (vf_number < 32) ? 0 : 1; - u32 vf_shift = vf_number % 32; - u32 vflre = 0; + u32 vf_shift = IXGBE_PFVFLRE_SHIFT(vf_number); + u32 index = IXGBE_PFVFLRE_INDEX(vf_number); s32 ret_val = IXGBE_ERR_MBX; + u32 vflre = 0; DEBUGFUNC("ixgbe_check_for_rst_pf"); switch (hw->mac.type) { case ixgbe_mac_82599EB: - vflre = IXGBE_READ_REG(hw, IXGBE_VFLRE(reg_offset)); + vflre = IXGBE_READ_REG(hw, IXGBE_PFVFLRE(index)); break; case ixgbe_mac_X550: case ixgbe_mac_X550EM_x: case ixgbe_mac_X550EM_a: case ixgbe_mac_X540: - vflre = IXGBE_READ_REG(hw, IXGBE_VFLREC(reg_offset)); + vflre = IXGBE_READ_REG(hw, IXGBE_PFVFLREC(index)); break; default: break; @@ -618,7 +618,7 @@ static s32 ixgbe_check_for_rst_pf(struct ixgbe_hw *hw, u16 vf_number) if (vflre & (1 << vf_shift)) { ret_val = IXGBE_SUCCESS; - IXGBE_WRITE_REG(hw, IXGBE_VFLREC(reg_offset), (1 << vf_shift)); + IXGBE_WRITE_REG(hw, IXGBE_PFVFLREC(index), (1 << vf_shift)); hw->mbx.stats.rsts++; } diff --git a/sys/dev/ixgbe/ixgbe_mbx.h b/sys/dev/ixgbe/ixgbe_mbx.h index fa407c4969d1..fc4d58e1c0db 100644 --- a/sys/dev/ixgbe/ixgbe_mbx.h +++ b/sys/dev/ixgbe/ixgbe_mbx.h @@ -60,10 +60,10 @@ #define IXGBE_PFMAILBOX_PFU 0x00000008 /* PF owns the mailbox buffer */ #define IXGBE_PFMAILBOX_RVFU 0x00000010 /* Reset VFU - used when VF stuck */ -#define IXGBE_MBVFICR_VFREQ_MASK 0x0000FFFF /* bits for VF messages */ -#define IXGBE_MBVFICR_VFREQ_VF1 0x00000001 /* bit for VF 1 message */ -#define IXGBE_MBVFICR_VFACK_MASK 0xFFFF0000 /* bits for VF acks */ -#define IXGBE_MBVFICR_VFACK_VF1 0x00010000 /* bit for VF 1 ack */ +#define IXGBE_PFMBICR_VFREQ_MASK 0x0000FFFF /* bits for VF messages */ +#define IXGBE_PFMBICR_VFREQ_VF1 0x00000001 /* bit for VF 1 message */ +#define IXGBE_PFMBICR_VFACK_MASK 0xFFFF0000 /* bits for VF acks */ +#define IXGBE_PFMBICR_VFACK_VF1 0x00010000 /* bit for VF 1 ack */ /* If it's a IXGBE_VF_* msg then it originates in the VF and is sent to the diff --git a/sys/dev/ixgbe/ixgbe_type.h b/sys/dev/ixgbe/ixgbe_type.h index 1b447f42f17a..2fc500c9329c 100644 --- a/sys/dev/ixgbe/ixgbe_type.h +++ b/sys/dev/ixgbe/ixgbe_type.h @@ -483,8 +483,14 @@ struct ixgbe_nvm_version { #define IXGBE_PFMAILBOX(_i) (0x04B00 + (4 * (_i))) /* 64 total */ /* 64 Mailboxes, 16 DW each */ #define IXGBE_PFMBMEM(_i) (0x13000 + (64 * (_i))) +#define IXGBE_PFMBICR_INDEX(_i) ((_i) >> 4) +#define IXGBE_PFMBICR_SHIFT(_i) ((_i) % 16) #define IXGBE_PFMBICR(_i) (0x00710 + (4 * (_i))) /* 4 total */ #define IXGBE_PFMBIMR(_i) (0x00720 + (4 * (_i))) /* 4 total */ +#define IXGBE_PFVFLRE(_i) ((((_i) & 1) ? 0x001C0 : 0x00600)) +#define IXGBE_PFVFLREC(_i) (0x00700 + ((_i) * 4)) +#define IXGBE_PFVFLRE_INDEX(_i) ((_i) >> 5) +#define IXGBE_PFVFLRE_SHIFT(_i) ((_i) % 32) #define IXGBE_VFRE(_i) (0x051E0 + ((_i) * 4)) #define IXGBE_VFTE(_i) (0x08110 + ((_i) * 4)) #define IXGBE_VMECM(_i) (0x08790 + ((_i) * 4)) @@ -2899,11 +2905,6 @@ enum { #define IXGBE_RX_DESC_SPECIAL_PRI_SHIFT 0x000D /* Priority in upper 3 of 16 */ #define IXGBE_TX_DESC_SPECIAL_PRI_SHIFT IXGBE_RX_DESC_SPECIAL_PRI_SHIFT -/* SR-IOV specific macros */ -#define IXGBE_MBVFICR_INDEX(vf_number) (vf_number >> 4) -#define IXGBE_MBVFICR(_i) (0x00710 + ((_i) * 4)) -#define IXGBE_VFLRE(_i) (((_i & 1) ? 0x001C0 : 0x00600)) -#define IXGBE_VFLREC(_i) (0x00700 + ((_i) * 4)) /* Translated register #defines */ #define IXGBE_PVFCTRL(P) (0x00300 + (4 * (P))) #define IXGBE_PVFSTATUS(P) (0x00008 + (0 * (P)))