代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/dpdk 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 0e4f6eceec1c0cd0cae67504b90eb6a4f0451307 Mon Sep 17 00:00:00 2001
From: Chengwen Feng <fengchengwen@huawei.com>
Date: Fri, 21 Oct 2022 15:36:02 +0800
Subject: [PATCH 126/189] net/hns3: support backplane media type
The 802.11 physical PMA sub-layer defines three media: copper, fiber and
backplane. For PMD, the backplane is similar to the fiber, the main
differences are that backplane doesn't have optical module.
Because the interface of firmware fiber is also applicable to the
backplane, this patch supports the backplane only through simple
extension.
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
drivers/net/hns3/hns3_ethdev.c | 54 +++++++++++++++++++---------------
1 file changed, 30 insertions(+), 24 deletions(-)
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 8a8f3f1950..5632b82078 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2788,11 +2788,8 @@ hns3_check_media_type(struct hns3_hw *hw, uint8_t media_type)
}
break;
case HNS3_MEDIA_TYPE_FIBER:
- ret = 0;
- break;
case HNS3_MEDIA_TYPE_BACKPLANE:
- PMD_INIT_LOG(ERR, "Media type is Backplane, not supported.");
- ret = -EOPNOTSUPP;
+ ret = 0;
break;
default:
PMD_INIT_LOG(ERR, "Unknown media type = %u!", media_type);
@@ -4245,14 +4242,11 @@ hns3_update_link_info(struct rte_eth_dev *eth_dev)
{
struct hns3_adapter *hns = eth_dev->data->dev_private;
struct hns3_hw *hw = &hns->hw;
- int ret = 0;
if (hw->mac.media_type == HNS3_MEDIA_TYPE_COPPER)
- ret = hns3_update_copper_link_info(hw);
- else if (hw->mac.media_type == HNS3_MEDIA_TYPE_FIBER)
- ret = hns3_update_fiber_link_info(hw);
+ return hns3_update_copper_link_info(hw);
- return ret;
+ return hns3_update_fiber_link_info(hw);
}
static int
@@ -4545,11 +4539,13 @@ hns3_get_port_supported_speed(struct rte_eth_dev *eth_dev)
if (ret)
return ret;
- if (mac->media_type == HNS3_MEDIA_TYPE_FIBER) {
+ if (mac->media_type == HNS3_MEDIA_TYPE_FIBER ||
+ mac->media_type == HNS3_MEDIA_TYPE_BACKPLANE) {
/*
* Some firmware does not support the report of supported_speed,
- * and only report the effective speed of SFP. In this case, it
- * is necessary to use the SFP's speed as the supported_speed.
+ * and only report the effective speed of SFP/backplane. In this
+ * case, it is necessary to use the SFP/backplane's speed as the
+ * supported_speed.
*/
if (mac->supported_speed == 0)
mac->supported_speed =
@@ -4811,7 +4807,7 @@ hns3_check_port_speed(struct hns3_hw *hw, uint32_t link_speeds)
if (mac->media_type == HNS3_MEDIA_TYPE_COPPER)
speed_bit = hns3_convert_link_speeds2bitmap_copper(link_speeds);
- else if (mac->media_type == HNS3_MEDIA_TYPE_FIBER)
+ else
speed_bit = hns3_convert_link_speeds2bitmap_fiber(link_speeds);
if (!(speed_bit & supported_speed)) {
@@ -4955,6 +4951,19 @@ hns3_set_fiber_port_link_speed(struct hns3_hw *hw,
return hns3_cfg_mac_speed_dup(hw, cfg->speed, cfg->duplex);
}
+static const char *
+hns3_get_media_type_name(uint8_t media_type)
+{
+ if (media_type == HNS3_MEDIA_TYPE_FIBER)
+ return "fiber";
+ else if (media_type == HNS3_MEDIA_TYPE_COPPER)
+ return "copper";
+ else if (media_type == HNS3_MEDIA_TYPE_BACKPLANE)
+ return "backplane";
+ else
+ return "unknown";
+}
+
static int
hns3_set_port_link_speed(struct hns3_hw *hw,
struct hns3_set_link_speed_cfg *cfg)
@@ -4969,18 +4978,15 @@ hns3_set_port_link_speed(struct hns3_hw *hw,
#endif
ret = hns3_set_copper_port_link_speed(hw, cfg);
- if (ret) {
- hns3_err(hw, "failed to set copper port link speed,"
- "ret = %d.", ret);
- return ret;
- }
- } else if (hw->mac.media_type == HNS3_MEDIA_TYPE_FIBER) {
+ } else {
ret = hns3_set_fiber_port_link_speed(hw, cfg);
- if (ret) {
- hns3_err(hw, "failed to set fiber port link speed,"
- "ret = %d.", ret);
- return ret;
- }
+ }
+
+ if (ret) {
+ hns3_err(hw, "failed to set %s port link speed, ret = %d.",
+ hns3_get_media_type_name(hw->mac.media_type),
+ ret);
+ return ret;
}
return 0;
--
2.23.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。