Commit 433ccce8 authored by Yufeng Mo's avatar Yufeng Mo Committed by David S. Miller

net: hns3: use FEC capability queried from firmware

For maintainability and compatibility, add support to use FEC
capability queried from firmware.
Signed-off-by: default avatarYufeng Mo <moyufeng@huawei.com>
Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c53d21af
...@@ -353,7 +353,9 @@ static void hclge_set_default_capability(struct hclge_dev *hdev) ...@@ -353,7 +353,9 @@ static void hclge_set_default_capability(struct hclge_dev *hdev)
set_bit(HNAE3_DEV_SUPPORT_FD_B, ae_dev->caps); set_bit(HNAE3_DEV_SUPPORT_FD_B, ae_dev->caps);
set_bit(HNAE3_DEV_SUPPORT_GRO_B, ae_dev->caps); set_bit(HNAE3_DEV_SUPPORT_GRO_B, ae_dev->caps);
if (hdev->ae_dev->dev_version == HNAE3_DEVICE_VERSION_V2) {
set_bit(HNAE3_DEV_SUPPORT_FEC_B, ae_dev->caps); set_bit(HNAE3_DEV_SUPPORT_FEC_B, ae_dev->caps);
}
} }
static void hclge_parse_capability(struct hclge_dev *hdev, static void hclge_parse_capability(struct hclge_dev *hdev,
...@@ -378,6 +380,8 @@ static void hclge_parse_capability(struct hclge_dev *hdev, ...@@ -378,6 +380,8 @@ static void hclge_parse_capability(struct hclge_dev *hdev,
set_bit(HNAE3_DEV_SUPPORT_UDP_TUNNEL_CSUM_B, ae_dev->caps); set_bit(HNAE3_DEV_SUPPORT_UDP_TUNNEL_CSUM_B, ae_dev->caps);
if (hnae3_get_bit(caps, HCLGE_CAP_FD_FORWARD_TC_B)) if (hnae3_get_bit(caps, HCLGE_CAP_FD_FORWARD_TC_B))
set_bit(HNAE3_DEV_SUPPORT_FD_FORWARD_TC_B, ae_dev->caps); set_bit(HNAE3_DEV_SUPPORT_FD_FORWARD_TC_B, ae_dev->caps);
if (hnae3_get_bit(caps, HCLGE_CAP_FEC_B))
set_bit(HNAE3_DEV_SUPPORT_FEC_B, ae_dev->caps);
} }
static __le32 hclge_build_api_caps(void) static __le32 hclge_build_api_caps(void)
......
...@@ -384,6 +384,7 @@ enum HCLGE_CAP_BITS { ...@@ -384,6 +384,7 @@ enum HCLGE_CAP_BITS {
HCLGE_CAP_HW_PAD_B, HCLGE_CAP_HW_PAD_B,
HCLGE_CAP_STASH_B, HCLGE_CAP_STASH_B,
HCLGE_CAP_UDP_TUNNEL_CSUM_B, HCLGE_CAP_UDP_TUNNEL_CSUM_B,
HCLGE_CAP_FEC_B = 13,
}; };
enum HCLGE_API_CAP_BITS { enum HCLGE_API_CAP_BITS {
......
...@@ -2889,8 +2889,10 @@ static void hclge_update_link_status(struct hclge_dev *hdev) ...@@ -2889,8 +2889,10 @@ static void hclge_update_link_status(struct hclge_dev *hdev)
clear_bit(HCLGE_STATE_LINK_UPDATING, &hdev->state); clear_bit(HCLGE_STATE_LINK_UPDATING, &hdev->state);
} }
static void hclge_update_port_capability(struct hclge_mac *mac) static void hclge_update_port_capability(struct hclge_dev *hdev,
struct hclge_mac *mac)
{ {
if (hnae3_dev_fec_supported(hdev))
/* update fec ability by speed */ /* update fec ability by speed */
hclge_convert_setting_fec(mac); hclge_convert_setting_fec(mac);
...@@ -3012,7 +3014,7 @@ static int hclge_update_port_info(struct hclge_dev *hdev) ...@@ -3012,7 +3014,7 @@ static int hclge_update_port_info(struct hclge_dev *hdev)
if (hdev->ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2) { if (hdev->ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2) {
if (mac->speed_type == QUERY_ACTIVE_SPEED) { if (mac->speed_type == QUERY_ACTIVE_SPEED) {
hclge_update_port_capability(mac); hclge_update_port_capability(hdev, mac);
return 0; return 0;
} }
return hclge_cfg_mac_speed_dup(hdev, mac->speed, return hclge_cfg_mac_speed_dup(hdev, mac->speed,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment