Skip to content

Commit 35392da

Browse files
Guangbin Huangkuba-moo
authored andcommitted
Revert "net: hns3: fix pause config problem after autoneg disabled"
This reverts commit 3bda2e5. According to discussion with Andrew as follow: https://lore.kernel.org/netdev/[email protected]/ HNS3 driver needs to separate pause autoneg from general autoneg, so revert this incorrect patch. Signed-off-by: Guangbin Huang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent f7cc889 commit 35392da

File tree

5 files changed

+10
-57
lines changed

5 files changed

+10
-57
lines changed

drivers/net/ethernet/hisilicon/hns3/hnae3.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,6 @@ struct hnae3_ae_ops {
568568
u32 *auto_neg, u32 *rx_en, u32 *tx_en);
569569
int (*set_pauseparam)(struct hnae3_handle *handle,
570570
u32 auto_neg, u32 rx_en, u32 tx_en);
571-
int (*restore_pauseparam)(struct hnae3_handle *handle);
572571

573572
int (*set_autoneg)(struct hnae3_handle *handle, bool enable);
574573
int (*get_autoneg)(struct hnae3_handle *handle);

drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -824,26 +824,6 @@ static int hns3_check_ksettings_param(const struct net_device *netdev,
824824
return 0;
825825
}
826826

827-
static int hns3_set_phy_link_ksettings(struct net_device *netdev,
828-
const struct ethtool_link_ksettings *cmd)
829-
{
830-
struct hnae3_handle *handle = hns3_get_handle(netdev);
831-
const struct hnae3_ae_ops *ops = handle->ae_algo->ops;
832-
int ret;
833-
834-
if (cmd->base.speed == SPEED_1000 &&
835-
cmd->base.autoneg == AUTONEG_DISABLE)
836-
return -EINVAL;
837-
838-
if (cmd->base.autoneg == AUTONEG_DISABLE && ops->restore_pauseparam) {
839-
ret = ops->restore_pauseparam(handle);
840-
if (ret)
841-
return ret;
842-
}
843-
844-
return phy_ethtool_ksettings_set(netdev->phydev, cmd);
845-
}
846-
847827
static int hns3_set_link_ksettings(struct net_device *netdev,
848828
const struct ethtool_link_ksettings *cmd)
849829
{
@@ -862,11 +842,16 @@ static int hns3_set_link_ksettings(struct net_device *netdev,
862842
cmd->base.autoneg, cmd->base.speed, cmd->base.duplex);
863843

864844
/* Only support ksettings_set for netdev with phy attached for now */
865-
if (netdev->phydev)
866-
return hns3_set_phy_link_ksettings(netdev, cmd);
867-
else if (test_bit(HNAE3_DEV_SUPPORT_PHY_IMP_B, ae_dev->caps) &&
868-
ops->set_phy_link_ksettings)
845+
if (netdev->phydev) {
846+
if (cmd->base.speed == SPEED_1000 &&
847+
cmd->base.autoneg == AUTONEG_DISABLE)
848+
return -EINVAL;
849+
850+
return phy_ethtool_ksettings_set(netdev->phydev, cmd);
851+
} else if (test_bit(HNAE3_DEV_SUPPORT_PHY_IMP_B, ae_dev->caps) &&
852+
ops->set_phy_link_ksettings) {
869853
return ops->set_phy_link_ksettings(handle, cmd);
854+
}
870855

871856
if (ae_dev->dev_version < HNAE3_DEVICE_VERSION_V2)
872857
return -EOPNOTSUPP;

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10998,35 +10998,6 @@ static int hclge_set_pauseparam(struct hnae3_handle *handle, u32 auto_neg,
1099810998
return -EOPNOTSUPP;
1099910999
}
1100011000

11001-
static int hclge_restore_pauseparam(struct hnae3_handle *handle)
11002-
{
11003-
struct hclge_vport *vport = hclge_get_vport(handle);
11004-
struct hclge_dev *hdev = vport->back;
11005-
u32 auto_neg, rx_pause, tx_pause;
11006-
int ret;
11007-
11008-
hclge_get_pauseparam(handle, &auto_neg, &rx_pause, &tx_pause);
11009-
/* when autoneg is disabled, the pause setting of phy has no effect
11010-
* unless the link goes down.
11011-
*/
11012-
ret = phy_suspend(hdev->hw.mac.phydev);
11013-
if (ret)
11014-
return ret;
11015-
11016-
phy_set_asym_pause(hdev->hw.mac.phydev, rx_pause, tx_pause);
11017-
11018-
ret = phy_resume(hdev->hw.mac.phydev);
11019-
if (ret)
11020-
return ret;
11021-
11022-
ret = hclge_mac_pause_setup_hw(hdev);
11023-
if (ret)
11024-
dev_err(&hdev->pdev->dev,
11025-
"restore pauseparam error, ret = %d.\n", ret);
11026-
11027-
return ret;
11028-
}
11029-
1103011001
static void hclge_get_ksettings_an_result(struct hnae3_handle *handle,
1103111002
u8 *auto_neg, u32 *speed, u8 *duplex)
1103211003
{
@@ -12990,7 +12961,6 @@ static const struct hnae3_ae_ops hclge_ops = {
1299012961
.halt_autoneg = hclge_halt_autoneg,
1299112962
.get_pauseparam = hclge_get_pauseparam,
1299212963
.set_pauseparam = hclge_set_pauseparam,
12993-
.restore_pauseparam = hclge_restore_pauseparam,
1299412964
.set_mtu = hclge_set_mtu,
1299512965
.reset_queue = hclge_reset_tqp,
1299612966
.get_stats = hclge_get_stats,

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,7 @@ static int hclge_bp_setup_hw(struct hclge_dev *hdev, u8 tc)
14351435
return 0;
14361436
}
14371437

1438-
int hclge_mac_pause_setup_hw(struct hclge_dev *hdev)
1438+
static int hclge_mac_pause_setup_hw(struct hclge_dev *hdev)
14391439
{
14401440
bool tx_en, rx_en;
14411441

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ int hclge_tm_get_pri_weight(struct hclge_dev *hdev, u8 pri_id, u8 *weight);
244244
int hclge_tm_get_pri_shaper(struct hclge_dev *hdev, u8 pri_id,
245245
enum hclge_opcode_type cmd,
246246
struct hclge_tm_shaper_para *para);
247-
int hclge_mac_pause_setup_hw(struct hclge_dev *hdev);
248247
int hclge_tm_get_q_to_qs_map(struct hclge_dev *hdev, u16 q_id, u16 *qset_id);
249248
int hclge_tm_get_q_to_tc(struct hclge_dev *hdev, u16 q_id, u8 *tc_id);
250249
int hclge_tm_get_pg_to_pri_map(struct hclge_dev *hdev, u8 pg_id,

0 commit comments

Comments
 (0)