Received: by 10.223.185.116 with SMTP id b49csp5787830wrg; Wed, 7 Mar 2018 18:41:26 -0800 (PST) X-Google-Smtp-Source: AG47ELubVA4RAZtmfShlGfQ3ieUADJHC9BuUYvi94GD/Twy0RD6zHFdChJuo5xNKgNLYGaVhOwta X-Received: by 10.99.108.66 with SMTP id h63mr19428223pgc.177.1520476886809; Wed, 07 Mar 2018 18:41:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520476886; cv=none; d=google.com; s=arc-20160816; b=D1d2INCNXB1GoP+Sy3Pyb+onIgIeVEGgQFqZXqONsh8bFBBKrRHosUWCyS1XMkoWrz Lex3JhaofDrsMarM5mlxQjGuiooPDE/UR+DtO8X7NAdpQ+PXx05IduBmHVpaHfVEmh2S +O7q+NO/MPLMjxZV+d66n3iu+CwySwJ/iXdp56iPj0KfQXYUsGvQwekTiEaBaS3SXiKM 2WLfxRClm6CKgfvRuW/4rzQlwGGjV/1XvYlqfQGcmk/4v5VdzMd9sv0DlsJh/ugqB2ZU NpCpuKBH8FWTmXZgHN0a36Y1pzVHTWV5+3a6i6Ga6ctHuBjKRsDw6LSMUL3b9+Yq09+H rA+w== 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:arc-authentication-results; bh=XHH+4MOWHyYDo7blOAaAZ6P4c2MS5tUEdo9TKFi662E=; b=Yl6rXb0F01WtLYlOtMFJ3nvzSpmCdRFaX7C6zHz/zB0XXYupa3yuzgmP7EWt/0X7Sn QyBab94Xfess8LYNIaFSs5dEe3Y2BhJqfZmVRscdC+TGSg+doAClAXI1GY8+1M4QDkwB wEfw+YfjQdjlcYVgqGp+cP5U29PzsZlZilhuYz0IMR6/nqzF4nDxcrwQG/jwpj4eJIAN 4KnAFIQ3fFbLbbh222UlavWMG8DWbeN7Ch7+zTcV3DkKRUiU4qLQUOPICgeg1uPxiXHx u7A8WaBorrcrn2ugaKtqaPQAFng1y3pZ9lv1iRn7iQUtuYY2kRDAkQnphz1JdnEF9JHs 64UA== 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 e18si14794692pfi.130.2018.03.07.18.41.12; Wed, 07 Mar 2018 18:41:26 -0800 (PST) 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 S964920AbeCHCip (ORCPT + 99 others); Wed, 7 Mar 2018 21:38:45 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:5756 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934848AbeCHCfA (ORCPT ); Wed, 7 Mar 2018 21:35:00 -0500 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 34505D1226881; Thu, 8 Mar 2018 10:34:44 +0800 (CST) Received: from linux-ioko.site (10.71.200.31) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.361.1; Thu, 8 Mar 2018 10:34:37 +0800 From: Peng Li To: CC: , , , , Subject: [PATCH net-next 07/23] {topost} net: hns3: unify the pause params setup function Date: Thu, 8 Mar 2018 11:06:32 +0800 Message-ID: <1520478408-116992-8-git-send-email-lipeng321@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1520478408-116992-1-git-send-email-lipeng321@huawei.com> References: <1520478408-116992-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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fuyun Liang Since the firmware cmd to setup mac pause params is the same as the firmware cmd to pfc pause params, this patch unifies the pause params setup function. Signed-off-by: Fuyun Liang Signed-off-by: Peng Li --- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 2 +- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 23 +++++++++++----------- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 83be4d5..cc72ed8 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -4431,7 +4431,7 @@ static int hclge_set_mac_addr(struct hnae3_handle *handle, void *p, return -EIO; } - ret = hclge_mac_pause_addr_cfg(hdev, new_addr); + ret = hclge_pause_addr_cfg(hdev, new_addr); if (ret) { dev_err(&hdev->pdev->dev, "configure mac pause address fail, ret =%d.\n", diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c index 36bd79a..4134a82 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c @@ -138,8 +138,8 @@ static int hclge_pfc_pause_en_cfg(struct hclge_dev *hdev, u8 tx_rx_bitmap, return hclge_cmd_send(&hdev->hw, &desc, 1); } -static int hclge_mac_pause_param_cfg(struct hclge_dev *hdev, const u8 *addr, - u8 pause_trans_gap, u16 pause_trans_time) +static int hclge_pause_param_cfg(struct hclge_dev *hdev, const u8 *addr, + u8 pause_trans_gap, u16 pause_trans_time) { struct hclge_cfg_pause_param_cmd *pause_param; struct hclge_desc desc; @@ -155,7 +155,7 @@ static int hclge_mac_pause_param_cfg(struct hclge_dev *hdev, const u8 *addr, return hclge_cmd_send(&hdev->hw, &desc, 1); } -int hclge_mac_pause_addr_cfg(struct hclge_dev *hdev, const u8 *mac_addr) +int hclge_pause_addr_cfg(struct hclge_dev *hdev, const u8 *mac_addr) { struct hclge_cfg_pause_param_cmd *pause_param; struct hclge_desc desc; @@ -174,7 +174,7 @@ int hclge_mac_pause_addr_cfg(struct hclge_dev *hdev, const u8 *mac_addr) trans_gap = pause_param->pause_trans_gap; trans_time = le16_to_cpu(pause_param->pause_trans_time); - return hclge_mac_pause_param_cfg(hdev, mac_addr, trans_gap, + return hclge_pause_param_cfg(hdev, mac_addr, trans_gap, trans_time); } @@ -1096,11 +1096,11 @@ static int hclge_tm_schd_setup_hw(struct hclge_dev *hdev) return hclge_tm_schd_mode_hw(hdev); } -static int hclge_mac_pause_param_setup_hw(struct hclge_dev *hdev) +static int hclge_pause_param_setup_hw(struct hclge_dev *hdev) { struct hclge_mac *mac = &hdev->hw.mac; - return hclge_mac_pause_param_cfg(hdev, mac->mac_addr, + return hclge_pause_param_cfg(hdev, mac->mac_addr, HCLGE_DEFAULT_PAUSE_TRANS_GAP, HCLGE_DEFAULT_PAUSE_TRANS_TIME); } @@ -1151,13 +1151,12 @@ int hclge_pause_setup_hw(struct hclge_dev *hdev) int ret; u8 i; - if (hdev->tm_info.fc_mode != HCLGE_FC_PFC) { - ret = hclge_mac_pause_setup_hw(hdev); - if (ret) - return ret; + ret = hclge_pause_param_setup_hw(hdev); + if (ret) + return ret; - return hclge_mac_pause_param_setup_hw(hdev); - } + if (hdev->tm_info.fc_mode != HCLGE_FC_PFC) + return hclge_mac_pause_setup_hw(hdev); /* Only DCB-supported dev supports qset back pressure and pfc cmd */ if (!hnae3_dev_dcb_supported(hdev)) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h index 5401e75..c30c85b 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h @@ -129,5 +129,5 @@ int hclge_tm_dwrr_cfg(struct hclge_dev *hdev); int hclge_tm_map_cfg(struct hclge_dev *hdev); int hclge_tm_init_hw(struct hclge_dev *hdev); int hclge_mac_pause_en_cfg(struct hclge_dev *hdev, bool tx, bool rx); -int hclge_mac_pause_addr_cfg(struct hclge_dev *hdev, const u8 *mac_addr); +int hclge_pause_addr_cfg(struct hclge_dev *hdev, const u8 *mac_addr); #endif -- 2.9.3