Commit 40173a2e authored by Fuyun Liang's avatar Fuyun Liang Committed by David S. Miller

net: hns3: fix for updating fc_mode_last_time

commit a9c782822166 ("net: hns3: add support for set_pauseparam")
adds set_pauseparam support for ethtool cmd, but forgets to update
fc_mode_last_time when PFC mode is disabled in hclge_cfg_pauseparam().
The wrong fc_mode_last_time will be used to update flow control mode
when lldpad has been running. As a result, when using the ethtool
command "-a", user will get a wrong pause parameter.

This patch adds the fc_mode_last_time update when PFC mode is disabled.

Fixes: a9c782822166 ("net: hns3: add support for set_pauseparam")
Signed-off-by: default avatarFuyun Liang <liangfuyun1@huawei.com>
Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cf72fa63
...@@ -4707,22 +4707,19 @@ static void hclge_set_flowctrl_adv(struct hclge_dev *hdev, u32 rx_en, u32 tx_en) ...@@ -4707,22 +4707,19 @@ static void hclge_set_flowctrl_adv(struct hclge_dev *hdev, u32 rx_en, u32 tx_en)
static int hclge_cfg_pauseparam(struct hclge_dev *hdev, u32 rx_en, u32 tx_en) static int hclge_cfg_pauseparam(struct hclge_dev *hdev, u32 rx_en, u32 tx_en)
{ {
enum hclge_fc_mode fc_mode;
int ret; int ret;
if (rx_en && tx_en) if (rx_en && tx_en)
fc_mode = HCLGE_FC_FULL; hdev->fc_mode_last_time = HCLGE_FC_FULL;
else if (rx_en && !tx_en) else if (rx_en && !tx_en)
fc_mode = HCLGE_FC_RX_PAUSE; hdev->fc_mode_last_time = HCLGE_FC_RX_PAUSE;
else if (!rx_en && tx_en) else if (!rx_en && tx_en)
fc_mode = HCLGE_FC_TX_PAUSE; hdev->fc_mode_last_time = HCLGE_FC_TX_PAUSE;
else else
fc_mode = HCLGE_FC_NONE; hdev->fc_mode_last_time = HCLGE_FC_NONE;
if (hdev->tm_info.fc_mode == HCLGE_FC_PFC) { if (hdev->tm_info.fc_mode == HCLGE_FC_PFC)
hdev->fc_mode_last_time = fc_mode;
return 0; return 0;
}
ret = hclge_mac_pause_en_cfg(hdev, tx_en, rx_en); ret = hclge_mac_pause_en_cfg(hdev, tx_en, rx_en);
if (ret) { if (ret) {
...@@ -4731,7 +4728,7 @@ static int hclge_cfg_pauseparam(struct hclge_dev *hdev, u32 rx_en, u32 tx_en) ...@@ -4731,7 +4728,7 @@ static int hclge_cfg_pauseparam(struct hclge_dev *hdev, u32 rx_en, u32 tx_en)
return ret; return ret;
} }
hdev->tm_info.fc_mode = fc_mode; hdev->tm_info.fc_mode = hdev->fc_mode_last_time;
return 0; return 0;
} }
......
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