[dpdk-stable] [PATCH 20/24] net/hns3: support copper media type

Wei Hu (Xavier) huwei013 at chinasoftinc.com
Mon Aug 17 11:25:28 CEST 2020


From: "Wei Hu (Xavier)" <xavier.huwei at huawei.com>

[ upstream commit 95e50325864c12682eb9872f69ec682be1a688a8 ]

The hns3 network engine is built-in multiple SoCs, such as kunpeng 920,
kunpeng 930, etc. The PCI revision id is 0x21 in kunpeng 920, and the
PCI revision id is 0x30 in kunpeng 930.

Copper media type is supported for hns3 PF device in kunpeng 930 and
later SoCs. The configuration operation for PHY is implemented by
firmware.

Signed-off-by: Wei Hu (Xavier) <xavier.huwei at huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c | 6 +++++-
 drivers/net/hns3/hns3_ethdev.h | 7 +++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index f156da843..5d50fcf21 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2824,6 +2824,9 @@ hns3_get_capability(struct hns3_hw *hw)
 	}
 	hw->revision = revision;
 
+	if (revision >= PCI_REVISION_ID_HIP09_A)
+		hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_COPPER_B, 1);
+
 	return 0;
 }
 
@@ -2841,7 +2844,8 @@ hns3_get_board_configuration(struct hns3_hw *hw)
 		return ret;
 	}
 
-	if (cfg.media_type == HNS3_MEDIA_TYPE_COPPER) {
+	if (cfg.media_type == HNS3_MEDIA_TYPE_COPPER &&
+	    !hns3_dev_copper_supported(hw)) {
 		PMD_INIT_LOG(ERR, "media type is copper, not supported.");
 		return -EOPNOTSUPP;
 	}
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index bec6d71ab..0cdf3d6ac 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -30,6 +30,9 @@
 #define HNS3_PCI_REVISION_ID			0x08
 #define HNS3_PCI_REVISION_ID_LEN		1
 
+#define PCI_REVISION_ID_HIP08_B			0x21
+#define PCI_REVISION_ID_HIP09_A			0x30
+
 #define HNS3_UC_MACADDR_NUM		128
 #define HNS3_VF_UC_MACADDR_NUM		48
 #define HNS3_MC_MACADDR_NUM		128
@@ -528,10 +531,14 @@ struct hns3_adapter {
 };
 
 #define HNS3_DEV_SUPPORT_DCB_B			0x0
+#define HNS3_DEV_SUPPORT_COPPER_B		0x1
 
 #define hns3_dev_dcb_supported(hw) \
 	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_DCB_B)
 
+#define hns3_dev_copper_supported(hw) \
+	hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_COPPER_B)
+
 #define HNS3_DEV_PRIVATE_TO_HW(adapter) \
 	(&((struct hns3_adapter *)adapter)->hw)
 #define HNS3_DEV_PRIVATE_TO_ADAPTER(adapter) \
-- 
2.27.0



More information about the stable mailing list