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

From: Guangbin Huang
Date: Fri Sep 23 2022 - 22:34:22 EST


Redefine macro hnae3_dev_pause_supported(hdev) to
hnae3_ae_dev_pause_supported(ae_dev), so it can be
used in both hclge and hns3_enet layer.

Signed-off-by: Guangbin Huang <huangguangbin2@xxxxxxxxxx>
---
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 94b71701a74d..1bd695e88cca 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
@@ -143,8 +143,8 @@ enum HNAE3_DEV_CAP_BITS {
#define hnae3_ae_dev_stash_supported(ae_dev) \
test_bit(HNAE3_DEV_SUPPORT_STASH_B, (ae_dev)->caps)

-#define hnae3_dev_pause_supported(hdev) \
- test_bit(HNAE3_DEV_SUPPORT_PAUSE_B, (hdev)->ae_dev->caps)
+#define hnae3_ae_dev_pause_supported(ae_dev) \
+ test_bit(HNAE3_DEV_SUPPORT_PAUSE_B, (ae_dev)->caps)

#define hnae3_ae_dev_tqp_txrx_indep_supported(ae_dev) \
test_bit(HNAE3_DEV_SUPPORT_TQP_TXRX_INDEP_B, (ae_dev)->caps)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index e4278ec95d21..58f19006e403 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -701,7 +701,7 @@ static void hns3_get_pauseparam(struct net_device *netdev,
struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_ae_dev *ae_dev = pci_get_drvdata(h->pdev);

- if (!test_bit(HNAE3_DEV_SUPPORT_PAUSE_B, ae_dev->caps))
+ if (!hnae3_ae_dev_pause_supported(ae_dev))
return;

if (h->ae_algo->ops->get_pauseparam)
@@ -715,7 +715,7 @@ static int hns3_set_pauseparam(struct net_device *netdev,
struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_ae_dev *ae_dev = pci_get_drvdata(h->pdev);

- if (!test_bit(HNAE3_DEV_SUPPORT_PAUSE_B, ae_dev->caps))
+ if (!hnae3_ae_dev_pause_supported(ae_dev))
return -EOPNOTSUPP;

netif_dbg(h, drv, netdev,
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index cc3ba2a16f5e..e8e18bac5b50 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -1182,7 +1182,7 @@ static void hclge_parse_fiber_link_mode(struct hclge_dev *hdev,
if (hnae3_ae_dev_fec_supported(hdev->ae_dev))
hclge_convert_setting_fec(mac);

- if (hnae3_dev_pause_supported(hdev))
+ if (hnae3_ae_dev_pause_supported(hdev->ae_dev))
linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT, mac->supported);

linkmode_set_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, mac->supported);
@@ -1198,7 +1198,7 @@ static void hclge_parse_backplane_link_mode(struct hclge_dev *hdev,
if (hnae3_ae_dev_fec_supported(hdev->ae_dev))
hclge_convert_setting_fec(mac);

- if (hnae3_dev_pause_supported(hdev))
+ if (hnae3_ae_dev_pause_supported(hdev->ae_dev))
linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT, mac->supported);

linkmode_set_bit(ETHTOOL_LINK_MODE_Backplane_BIT, mac->supported);
@@ -1230,7 +1230,7 @@ static void hclge_parse_copper_link_mode(struct hclge_dev *hdev,
linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT, supported);
}

- if (hnae3_dev_pause_supported(hdev)) {
+ if (hnae3_ae_dev_pause_supported(hdev->ae_dev)) {
linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT, supported);
linkmode_set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, supported);
}
--
2.33.0