Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751800AbeAEJz0 (ORCPT + 1 other); Fri, 5 Jan 2018 04:55:26 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:3735 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751474AbeAEJtR (ORCPT ); Fri, 5 Jan 2018 04:49:17 -0500 From: Peng Li To: CC: , , , , Subject: [PATCH net-next 14/20] net: hns3: fix for updating fc_mode_last_time Date: Fri, 5 Jan 2018 18:18:18 +0800 Message-ID: <1515147504-86802-15-git-send-email-lipeng321@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1515147504-86802-1-git-send-email-lipeng321@huawei.com> References: <1515147504-86802-1-git-send-email-lipeng321@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.71.200.31] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: From: Fuyun Liang 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: Fuyun Liang Signed-off-by: Peng Li --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 8004922..fcda9a2 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -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) { - enum hclge_fc_mode fc_mode; int ret; if (rx_en && tx_en) - fc_mode = HCLGE_FC_FULL; + hdev->fc_mode_last_time = HCLGE_FC_FULL; 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) - fc_mode = HCLGE_FC_TX_PAUSE; + hdev->fc_mode_last_time = HCLGE_FC_TX_PAUSE; else - fc_mode = HCLGE_FC_NONE; + hdev->fc_mode_last_time = HCLGE_FC_NONE; - if (hdev->tm_info.fc_mode == HCLGE_FC_PFC) { - hdev->fc_mode_last_time = fc_mode; + if (hdev->tm_info.fc_mode == HCLGE_FC_PFC) return 0; - } ret = hclge_mac_pause_en_cfg(hdev, tx_en, rx_en); if (ret) { @@ -4731,7 +4728,7 @@ static int hclge_cfg_pauseparam(struct hclge_dev *hdev, u32 rx_en, u32 tx_en) return ret; } - hdev->tm_info.fc_mode = fc_mode; + hdev->tm_info.fc_mode = hdev->fc_mode_last_time; return 0; } -- 1.9.1