Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2222903ybi; Thu, 4 Jul 2019 07:08:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqyd7cHfCPW9P51YPl7YtoVr33djptvl7vfQ/PaZYRKPoipQ6q/1mOsVk3+V/FL72AtwRG88 X-Received: by 2002:a63:7e42:: with SMTP id o2mr6434724pgn.162.1562249279962; Thu, 04 Jul 2019 07:07:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562249279; cv=none; d=google.com; s=arc-20160816; b=uCW+1icqbDUcix4brTjWTVe+cFMkdpXMyle8rjJ4YsfSEBIvCfOkfHVLDuy/meX+yc /Z6/7OJyLDpS5PK4KGBIOOiw9H4I436LCYvMR3ltr7QiDHdnOjZuP0/8RXWXH6dSjYdF IqsWpCjqqM/B/iAA1Iq8TyRZiL9JEHbcp9GpKO+Bj8U8Jj4H7Kt69Bgsc9Y/7VWLIEO3 kS/ZZUTbIo8gVOJ87bSPcq2LxL2xZdT1B64ESdIG4z32EVcyaUq/c/PJuChqJT9HjSo3 wryRoidERVSiH0xXL3ms6KsFrS2dDPbAAKxXlPVc9n5P/v52tOXwAINnH6yEZ7Muh5c6 10OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=Y4qQR70wMm/Y2XHQe1ucsQvjTzkF1I3L9Pa2tdLnSIA=; b=UqK5u6GEJ6K2LjKIeLr0vBr7FaL2CAAU2XGZ3vi/Tc/fppcXclKxONwTK1W9tk3xWm fBKLD5VnRdtX1hrwGvDGIfxxydkxCB2MUOD1l2P5SjfJbPUnO9cJ79HZKB6tm5ECcTfW OUM+htyuaE1qoUNKwUA+qC8r/5ieZ42lxTLUOjy7+5CIBXoF7cvtt2cZx0o3miiQHfLE FHgqT2+pRqEuuGQEnXPqtRIBuRM/Ic12Aalvuc7ztiq6pqav23XzOBLDirwjhWfWkDyJ PUzXnzSgHdhUodb27OI5b1hIREs6xsjIfYn1Ap48gmIUm/yG56unbStknkD5JXx37/Ld +lnw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l9si5257353plb.317.2019.07.04.07.07.45; Thu, 04 Jul 2019 07:07:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727414AbfGDOGb (ORCPT + 99 others); Thu, 4 Jul 2019 10:06:31 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:47474 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727207AbfGDOG3 (ORCPT ); Thu, 4 Jul 2019 10:06:29 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id D8497951752DBEBBD4F7; Thu, 4 Jul 2019 22:06:21 +0800 (CST) Received: from localhost.localdomain (10.67.212.132) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.439.0; Thu, 4 Jul 2019 22:06:15 +0800 From: Huazhong Tan To: CC: , , , , , Jian Shen , Peng Li , "Huazhong Tan" Subject: [PATCH net-next 2/9] net: hns3: fix flow control configure issue for fibre port Date: Thu, 4 Jul 2019 22:04:21 +0800 Message-ID: <1562249068-40176-3-git-send-email-tanhuazhong@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1562249068-40176-1-git-send-email-tanhuazhong@huawei.com> References: <1562249068-40176-1-git-send-email-tanhuazhong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.212.132] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jian Shen Flow control autoneg is unsupported for fibre port. It takes no effect for flow control when restart autoneg. This patch fixes it, return -EOPNOTSUPP when user tries to enable flow control autoneg. Signed-off-by: Jian Shen Signed-off-by: Peng Li Signed-off-by: Huazhong Tan --- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 62c6263..2ecc10a 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -8179,8 +8179,9 @@ static void hclge_get_pauseparam(struct hnae3_handle *handle, u32 *auto_neg, { struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_dev *hdev = vport->back; + struct phy_device *phydev = hdev->hw.mac.phydev; - *auto_neg = hclge_get_autoneg(handle); + *auto_neg = phydev ? hclge_get_autoneg(handle) : 0; if (hdev->tm_info.fc_mode == HCLGE_FC_PFC) { *rx_en = 0; @@ -8211,11 +8212,13 @@ static int hclge_set_pauseparam(struct hnae3_handle *handle, u32 auto_neg, struct phy_device *phydev = hdev->hw.mac.phydev; u32 fc_autoneg; - fc_autoneg = hclge_get_autoneg(handle); - if (auto_neg != fc_autoneg) { - dev_info(&hdev->pdev->dev, - "To change autoneg please use: ethtool -s autoneg \n"); - return -EOPNOTSUPP; + if (phydev) { + fc_autoneg = hclge_get_autoneg(handle); + if (auto_neg != fc_autoneg) { + dev_info(&hdev->pdev->dev, + "To change autoneg please use: ethtool -s autoneg \n"); + return -EOPNOTSUPP; + } } if (hdev->tm_info.fc_mode == HCLGE_FC_PFC) { @@ -8226,16 +8229,13 @@ static int hclge_set_pauseparam(struct hnae3_handle *handle, u32 auto_neg, hclge_set_flowctrl_adv(hdev, rx_en, tx_en); - if (!fc_autoneg) + if (!auto_neg) return hclge_cfg_pauseparam(hdev, rx_en, tx_en); if (phydev) return phy_start_aneg(phydev); - if (hdev->pdev->revision == 0x20) - return -EOPNOTSUPP; - - return hclge_restart_autoneg(handle); + return -EOPNOTSUPP; } static void hclge_get_ksettings_an_result(struct hnae3_handle *handle, -- 2.7.4