[PATCH net-next 01/14] net: hns3: modify macro hnae3_dev_fec_supported

Guangbin Huang
2022-09-24T02:33:24Z

The macro hnae3_dev_fec_supported(hdev) just can be used in hclge layer,
so redefine it to hnae3_ae_dev_fec_supported(ae_dev), then it can be used
in both hclge and hns3_enet layer.

Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
drivers/net/ethernet/hisilicon/hns3/hnae3.h | 4 ++--
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 4 ++--
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 6 +++---
3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
index 0179fc288f5f..21308c5e280b 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
@@ -107,8 +107,8 @@ enum HNAE3_DEV_CAP_BITS {
#define hnae3_ae_dev_gro_supported(ae_dev) \
test_bit(HNAE3_DEV_SUPPORT_GRO_B, (ae_dev)->caps)

-#define hnae3_dev_fec_supported(hdev) \
- test_bit(HNAE3_DEV_SUPPORT_FEC_B, (hdev)->ae_dev->caps)
+#define hnae3_ae_dev_fec_supported(ae_dev) \
+ test_bit(HNAE3_DEV_SUPPORT_FEC_B, (ae_dev)->caps)

#define hnae3_dev_udp_gso_supported(hdev) \
test_bit(HNAE3_DEV_SUPPORT_UDP_GSO_B, (hdev)->ae_dev->caps)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index cdf76fb58d45..f866b6676318 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -1705,7 +1705,7 @@ static int hns3_get_fecparam(struct net_device *netdev,
u8 fec_ability;
u8 fec_mode;

- if (!test_bit(HNAE3_DEV_SUPPORT_FEC_B, ae_dev->caps))
+ if (!hnae3_ae_dev_fec_supported(ae_dev))
return -EOPNOTSUPP;

if (!ops->get_fec)
@@ -1729,7 +1729,7 @@ static int hns3_set_fecparam(struct net_device *netdev,
const struct hnae3_ae_ops *ops = handle->ae_algo->ops;
u32 fec_mode;

- if (!test_bit(HNAE3_DEV_SUPPORT_FEC_B, ae_dev->caps))
+ if (!hnae3_ae_dev_fec_supported(ae_dev))
return -EOPNOTSUPP;

if (!ops->set_fec)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 7b25d8f89427..0134bc8f7865 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -1179,7 +1179,7 @@ static void hclge_parse_fiber_link_mode(struct hclge_dev *hdev,
hclge_convert_setting_sr(speed_ability, mac->supported);
hclge_convert_setting_lr(speed_ability, mac->supported);
hclge_convert_setting_cr(speed_ability, mac->supported);
- if (hnae3_dev_fec_supported(hdev))
+ if (hnae3_ae_dev_fec_supported(hdev->ae_dev))
hclge_convert_setting_fec(mac);

if (hnae3_dev_pause_supported(hdev))
@@ -1195,7 +1195,7 @@ static void hclge_parse_backplane_link_mode(struct hclge_dev *hdev,
struct hclge_mac *mac = &hdev->hw.mac;

hclge_convert_setting_kr(speed_ability, mac->supported);
- if (hnae3_dev_fec_supported(hdev))
+ if (hnae3_ae_dev_fec_supported(hdev->ae_dev))
hclge_convert_setting_fec(mac);

if (hnae3_dev_pause_supported(hdev))
@@ -3232,7 +3232,7 @@ static void hclge_update_advertising(struct hclge_dev *hdev)
static void hclge_update_port_capability(struct hclge_dev *hdev,
struct hclge_mac *mac)
{
- if (hnae3_dev_fec_supported(hdev))
+ if (hnae3_ae_dev_fec_supported(hdev->ae_dev))
hclge_convert_setting_fec(mac);

/* firmware can not identify back plane type, the media type
--
2.33.0