Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp912556rwb; Fri, 28 Jul 2023 01:32:09 -0700 (PDT) X-Google-Smtp-Source: APBJJlFPxmOsxjl0YJSZhRIjpibXwVNsFTm9waYFUoQ9A5dMVDj69ErJRbnqPIsCh2vH30Hw4PCY X-Received: by 2002:a05:6402:296:b0:51e:34d5:a23f with SMTP id l22-20020a056402029600b0051e34d5a23fmr1325220edv.23.1690533129342; Fri, 28 Jul 2023 01:32:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690533129; cv=none; d=google.com; s=arc-20160816; b=DclWK2YJitni7TzocWKwvPBJGQZ46TqY8BsWNYsNNAyX+V/sZGvdij22kPg3Cy8IW6 D33eK6RRaVwnDP52B+dSXb0aCMNBPrT6goGmsHdjoi3vnhTCJxrwO4DWjpBU6zfDZkmb 7FQa8TdMlAqsMhcyM4zTya0Uxa/YzDY/ZO7WZ9Xf7lXZ18mXYWj5Narly5VXp9Kj83wE ri2uSGB6QYBQJE7iUlF3viIlr4GdOASgKDKN5CfHSc1dDsdOQv/NT/l3AvXVWykLGH4g Gzx6TmrL4N3rLLblOPzQBH0Bj8DgjixvTdtnuyQ0MJu0dq70hHuBlMmX/HCZbC4m8tcy 5Gog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=vsjBG0i1NF3kpj6It6RA/XJh5+TWIztNGHbTgLA6MoQ=; fh=rhoMx0VN1EBFBgM+MRLh5DDELNHeiDru4nB1GuImL/0=; b=jd/EhR0fu9ONNhJzqbBZjeXv5qxmB0xFQcKiGWE+mAAaran20QQyfpaa/fMttzpWwX oMUtUvaJP7mpHayRabkf+7uQkZcFCJg5RcuDZ0YWd7g0Wuo5tQihLLSmWbhpDK2XQjUj AJ4wxpUI1ZYwAe2tnUDvfx6qJ0YWDYbt1yZCljap10XELZjdEEBTHkDeACVaWn/nPhl0 YCo2KtYDMNhXWypBAQWksgn6w5JgxU6+2glwMtNdTbDdERDuWHLiSnFSdm3Lka2mHjer WVjMTSDmYVn4Nw46hyeeYaCVrtqiJuQcpRGOVu7U7G5vfGkxi0shNOl8L/T3nZNXXxbS JXtA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r1-20020aa7cfc1000000b0051e23250f88si2202113edy.349.2023.07.28.01.31.40; Fri, 28 Jul 2023 01:32:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234637AbjG1IET (ORCPT + 99 others); Fri, 28 Jul 2023 04:04:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234045AbjG1IDq (ORCPT ); Fri, 28 Jul 2023 04:03:46 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F7623AAF; Fri, 28 Jul 2023 01:01:51 -0700 (PDT) Received: from kwepemm600007.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RC0PY5qLWzNmZ9; Fri, 28 Jul 2023 15:58:25 +0800 (CST) Received: from localhost.localdomain (10.67.165.2) by kwepemm600007.china.huawei.com (7.193.23.208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 28 Jul 2023 16:01:48 +0800 From: Jijie Shao To: , , , , , CC: , , , , , , , Subject: [PATCH net 2/6] net: hns3: restore user pause configure when disable autoneg Date: Fri, 28 Jul 2023 15:58:36 +0800 Message-ID: <20230728075840.4022760-3-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230728075840.4022760-1-shaojijie@huawei.com> References: <20230728075840.4022760-1-shaojijie@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600007.china.huawei.com (7.193.23.208) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jian Shen Restore the mac pause state to user configuration when autoneg is disabled Signed-off-by: Jian Shen Signed-off-by: Peiyang Wang Signed-off-by: Jijie Shao --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 5 ++++- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index bf675c15fbb9..5594b8dd1e1d 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -10915,9 +10915,12 @@ int hclge_cfg_flowctrl(struct hclge_dev *hdev) u32 rx_pause, tx_pause; u8 flowctl; - if (!phydev->link || !phydev->autoneg) + if (!phydev->link) return 0; + if (!phydev->autoneg) + return hclge_mac_pause_setup_hw(hdev); + local_advertising = linkmode_adv_to_lcl_adv_t(phydev->advertising); if (phydev->pause) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c index de509e5751a7..c58c31221762 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c @@ -1553,7 +1553,7 @@ static int hclge_bp_setup_hw(struct hclge_dev *hdev, u8 tc) return 0; } -static int hclge_mac_pause_setup_hw(struct hclge_dev *hdev) +int hclge_mac_pause_setup_hw(struct hclge_dev *hdev) { bool tx_en, rx_en; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h index 45dcfef3f90c..53eec6df5194 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h @@ -245,6 +245,7 @@ int hclge_pfc_pause_en_cfg(struct hclge_dev *hdev, u8 tx_rx_bitmap, u8 pfc_bitmap); int hclge_mac_pause_en_cfg(struct hclge_dev *hdev, bool tx, bool rx); int hclge_pause_addr_cfg(struct hclge_dev *hdev, const u8 *mac_addr); +int hclge_mac_pause_setup_hw(struct hclge_dev *hdev); void hclge_pfc_rx_stats_get(struct hclge_dev *hdev, u64 *stats); void hclge_pfc_tx_stats_get(struct hclge_dev *hdev, u64 *stats); int hclge_tm_qs_shaper_cfg(struct hclge_vport *vport, int max_tx_rate); -- 2.30.0