DPDK patches and discussions
 help / color / mirror / Atom feed
From: Zaiyu Wang <zaiyuwang@trustnetic.com>
To: dev@dpdk.org
Cc: Zaiyu Wang <zaiyuwang@trustnetic.com>,
	Jiawen Wu <jiawenwu@trustnetic.com>,
	Jian Wang <jianwang@trustnetic.com>
Subject: [PATCH 5/6] net/txgbe: add check link for Amber-Lite VF
Date: Thu, 23 Oct 2025 20:13:54 +0800	[thread overview]
Message-ID: <20251023121356.21944-6-zaiyuwang@trustnetic.com> (raw)
In-Reply-To: <20251023121356.21944-1-zaiyuwang@trustnetic.com>

Enhanced the VF's check mac link implementation to provide accurate
link rate information for newly supported Amber-Lite NICs VF.

Signed-off-by: Zaiyu Wang <zaiyuwang@trustnetic.com>
---
 drivers/net/txgbe/base/txgbe_regs.h |  5 +++
 drivers/net/txgbe/base/txgbe_vf.c   | 48 +++++++++++++++++++++--------
 2 files changed, 40 insertions(+), 13 deletions(-)

diff --git a/drivers/net/txgbe/base/txgbe_regs.h b/drivers/net/txgbe/base/txgbe_regs.h
index 638404bdff..95c585a025 100644
--- a/drivers/net/txgbe/base/txgbe_regs.h
+++ b/drivers/net/txgbe/base/txgbe_regs.h
@@ -1305,6 +1305,11 @@ enum txgbe_5tuple_protocol {
 #define     TXGBE_VFSTATUS_BW_10G       LS(0x1, 1, 0x7)
 #define     TXGBE_VFSTATUS_BW_1G        LS(0x2, 1, 0x7)
 #define     TXGBE_VFSTATUS_BW_100M      LS(0x4, 1, 0x7)
+#define   TXGBE_VFSTATUS_BW_MASK_AML    MS(1, 0xF)
+#define     TXGBE_VFSTATUS_BW_AML_50G   LS(0x1, 1, 0xF)
+#define     TXGBE_VFSTATUS_BW_AML_40G   LS(0x2, 1, 0xF)
+#define     TXGBE_VFSTATUS_BW_AML_25G   LS(0x4, 1, 0xF)
+#define     TXGBE_VFSTATUS_BW_AML_10G   LS(0x8, 1, 0xF)
 #define   TXGBE_VFSTATUS_BUSY           MS(4, 0x1)
 #define   TXGBE_VFSTATUS_LANID          MS(8, 0x1)
 #define TXGBE_VFRST                     0x000008
diff --git a/drivers/net/txgbe/base/txgbe_vf.c b/drivers/net/txgbe/base/txgbe_vf.c
index efa32ca10a..bfaac3bfa4 100644
--- a/drivers/net/txgbe/base/txgbe_vf.c
+++ b/drivers/net/txgbe/base/txgbe_vf.c
@@ -492,24 +492,46 @@ s32 txgbe_check_mac_link_vf(struct txgbe_hw *hw, u32 *speed,
 	/* for SFP+ modules and DA cables it can take up to 500usecs
 	 * before the link status is correct
 	 */
-	if (mac->type == txgbe_mac_sp_vf && wait_to_complete) {
+	if ((mac->type == txgbe_mac_sp_vf ||
+	     mac->type == txgbe_mac_aml_vf) && wait_to_complete) {
 		if (po32m(hw, TXGBE_VFSTATUS, TXGBE_VFSTATUS_UP,
 			0, NULL, 5, 100))
 			goto out;
 	}
 
-	switch (links_reg & TXGBE_VFSTATUS_BW_MASK) {
-	case TXGBE_VFSTATUS_BW_10G:
-		*speed = TXGBE_LINK_SPEED_10GB_FULL;
-		break;
-	case TXGBE_VFSTATUS_BW_1G:
-		*speed = TXGBE_LINK_SPEED_1GB_FULL;
-		break;
-	case TXGBE_VFSTATUS_BW_100M:
-		*speed = TXGBE_LINK_SPEED_100M_FULL;
-		break;
-	default:
-		*speed = TXGBE_LINK_SPEED_UNKNOWN;
+	if (hw->mac.type == txgbe_mac_sp_vf) {
+		if (hw->device_id == TXGBE_DEV_ID_SP1000_VF ||
+		    hw->device_id == TXGBE_DEV_ID_WX1820_VF)
+			switch (links_reg & TXGBE_VFSTATUS_BW_MASK) {
+			case TXGBE_VFSTATUS_BW_10G:
+				*speed = TXGBE_LINK_SPEED_10GB_FULL;
+				break;
+			case TXGBE_VFSTATUS_BW_1G:
+				*speed = TXGBE_LINK_SPEED_1GB_FULL;
+				break;
+			case TXGBE_VFSTATUS_BW_100M:
+				*speed = TXGBE_LINK_SPEED_100M_FULL;
+				break;
+			default:
+				*speed = TXGBE_LINK_SPEED_UNKNOWN;
+			}
+	} else {
+		switch (links_reg & TXGBE_VFSTATUS_BW_MASK_AML) {
+		case TXGBE_VFSTATUS_BW_AML_10G:
+			*speed = TXGBE_LINK_SPEED_10GB_FULL;
+			break;
+		case TXGBE_VFSTATUS_BW_AML_25G:
+			*speed = TXGBE_LINK_SPEED_25GB_FULL;
+			break;
+		case TXGBE_VFSTATUS_BW_AML_40G:
+			*speed = TXGBE_LINK_SPEED_40GB_FULL;
+			break;
+		case TXGBE_VFSTATUS_BW_AML_50G:
+			*speed = TXGBE_LINK_SPEED_50GB_FULL;
+			break;
+		default:
+			*speed = TXGBE_LINK_SPEED_UNKNOWN;
+		}
 	}
 
 	if (no_pflink_check) {
-- 
2.21.0.windows.1


  parent reply	other threads:[~2025-10-23 12:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-23 12:13 [PATCH 0/6] net/txgbe: fill in functionality gaps for Amber-Lite NICs Zaiyu Wang
2025-10-23 12:13 ` [PATCH 1/6] net/txgbe: add Amber-Lite 25G VF IDs to PCI ID map Zaiyu Wang
2025-10-23 12:13 ` [PATCH 2/6] net/txgbe: add flush operation for Amber-Lite NICs Zaiyu Wang
2025-10-23 12:13 ` [PATCH 3/6] net/txgbe: add RSS register selection for Amber-Lite 25G VF Zaiyu Wang
2025-10-23 12:13 ` [PATCH 4/6] net/txgbe: add BME reset " Zaiyu Wang
2025-10-23 12:13 ` Zaiyu Wang [this message]
2025-10-23 12:13 ` [PATCH 6/6] net/txgbe: add PF-triggered VF link status change handling Zaiyu Wang
2025-10-24 22:49 ` [PATCH 0/6] net/txgbe: fill in functionality gaps for Amber-Lite NICs Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251023121356.21944-6-zaiyuwang@trustnetic.com \
    --to=zaiyuwang@trustnetic.com \
    --cc=dev@dpdk.org \
    --cc=jianwang@trustnetic.com \
    --cc=jiawenwu@trustnetic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).