Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp2962028rwb; Mon, 7 Aug 2023 06:20:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF9QCmoK13NXXtU9TNREWyGqRsqtWjErLnMp8UY0Msfk6HMRXznZRL15RsKUmP+AlkxnPGT X-Received: by 2002:a05:6a20:748d:b0:11f:6dc:4f38 with SMTP id p13-20020a056a20748d00b0011f06dc4f38mr10904883pzd.55.1691414408031; Mon, 07 Aug 2023 06:20:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691414408; cv=none; d=google.com; s=arc-20160816; b=MeEdfAseYV2aq5eA4TcXasYJjmGz0NBllLsIv+DFRIIffGxWU1OGr8GWhIG+EojSa7 pg9W6A1J4v/sMwJRpkw2zjDlFoPcFeCA4pfKDqzEdGmeC/4kMRvziAxSMjPdnppUzFSX 1BA+TlvzppxB3olBRIggZxQnGL11Ntkxr9hdxpWrEqIs5++JX+qBuq2HRGp7CBzvqgOV jovYLsaHhqSBY+rzapir/BIF84Z+bx8wGaBW4VKyt/YZ97clI4/NirLpZ6XH/4A0cPJA ZHyxiawRwbSMLGtnKkE84s9Ebtv/bOXoZNbTZ1sFHPB8MV5sPf+ufnG3CL7kmbdOgzox jcNg== 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=5sQmHR+cd4KCALmk2NFamhtulCAFoYw71Vmcb9fEMq0=; b=0d4pT/uTClTrGkULoRzpWc8TKamcfh0snKDsf3/+Z1YAE/IS6rSnW0i4AHYkEOqOiO mH1br9jd1kaBxb3ZLSNvA1LLpuZZDlMFdKcHUfcnchq/hEFAEcc9DQEg6fLU/lNBQXyB UFytWb5U301MCEjGJA84L+FGyLB2GVGPNzFvGZKgC7QarTa3K7K+sivuh9vezPr3lwlI GRTHr9eafW50iMdnbR18cx9O6opi+o8VkZ37DbQZxEy9VWyImjKUPjGJ01GOAVl4AlyL EfMd/z+H4a54akoxs2ZkxrA46Ugu3gYimvQ4Q/nOdTBEMTD7gdMUhLqs4rZGh2VCi7sR omcg== 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 bg26-20020a056a02011a00b00564ac1d277asi4937191pgb.234.2023.08.07.06.19.55; Mon, 07 Aug 2023 06:20:08 -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 S233181AbjHGMCR (ORCPT + 99 others); Mon, 7 Aug 2023 08:02:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233168AbjHGMCJ (ORCPT ); Mon, 7 Aug 2023 08:02:09 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1A01185; Mon, 7 Aug 2023 05:01:32 -0700 (PDT) Received: from kwepemm600007.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RKDpg4kvjzfbnJ; Mon, 7 Aug 2023 19:38:19 +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; Mon, 7 Aug 2023 19:39:28 +0800 From: Jijie Shao To: , , , , , CC: , , , , , , Subject: [PATCH V2 net 1/4] net: hns3: restore user pause configure when disable autoneg Date: Mon, 7 Aug 2023 19:34:49 +0800 Message-ID: <20230807113452.474224-2-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230807113452.474224-1-shaojijie@huawei.com> References: <20230807113452.474224-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: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600007.china.huawei.com (7.193.23.208) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS 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