From patchwork Mon Sep 3 10:21:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 145772 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp2313108ljw; Mon, 3 Sep 2018 03:23:05 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbODnwVSZqwdqvhe47mQ5mXzcIEJ4RgoGulYOymTKbXfgnbVVImE5rWbyLwVtYH76QBsHsk X-Received: by 2002:a17:902:b902:: with SMTP id bf2-v6mr28015610plb.185.1535970185116; Mon, 03 Sep 2018 03:23:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535970185; cv=none; d=google.com; s=arc-20160816; b=dPqhjRHsR4dLwS0sqHztSS3t3/vK2/cIDCGLFBZED6xmdjKFmIkg1dxAc3fGCbaohM LiRVVB6rmH4pl9ZFcFhgCSfxdpj4AIdnXbWij/CXTLn4l2vreomhtyRsB+j0VSSDB+CT uHAH+lq8p/BZgfOxcgczeyD3aFVxeFdk84NZjx7Sz8S/HQmGNCItfNB1fUjUAAtds844 afSnCDFCK9kadrDojZTWWT125OFNqiyYSMl85TQE3xGQ/WzjPGC3t1a0lwPaTsGe1biH 1fxyzFd7rCW847+0PTvZY8T1LgvytuEwu7wBb7KnkOtUigXkp4h8D1i+wMIkdw0qZW5G uYgg== 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=sESWmpEMlEN2jSml41bEQzhodjtdx0+yP1CEtObEwVY=; b=PMVMUqIVdqJE/6Q6UFEjJbf4timGWkIZBAlYw6UrlYgxsV2zrzMB4L6dQCqLtVUxp2 tSeCVvH8ukvQ+jm6xAqwIGy7apHbV7AB8ahEnVCzoHZmQn3Pa1ZLnS/7XC+M6DE6+ATV KKolpFkJu4JaP48iwVho0SH0lD6VJ8Db3HnhKJhadDY1rPPyZZdIGq/btb4+8FJXNMl9 eKRXHcVTGXHVrD8RMqsRfFOe+4FULnFL6G8XX14luR638gaAPJwRO7GxGCLR93LTrH7v aiFBoRXA8+SNTVatAO/C6BQerI4MJliiuBafhPZecKprSJQyVLO6tgPp7VSwg1EFD07z y4wg== 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 s14-v6si17021902pga.21.2018.09.03.03.23.04; Mon, 03 Sep 2018 03:23:05 -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 S1727758AbeICOmd (ORCPT + 32 others); Mon, 3 Sep 2018 10:42:33 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:11219 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727319AbeICOmc (ORCPT ); Mon, 3 Sep 2018 10:42:32 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 265961C62FDEB; Mon, 3 Sep 2018 18:22:59 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Mon, 3 Sep 2018 18:22:51 +0800 From: Salil Mehta To: CC: , , , , , , , Yunsheng Lin Subject: [PATCH net-next 01/11] net: hns3: Fix for vf vlan delete failed problem Date: Mon, 3 Sep 2018 11:21:46 +0100 Message-ID: <20180903102156.18676-2-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180903102156.18676-1-salil.mehta@huawei.com> References: <20180903102156.18676-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yunsheng Lin There are only 128 entries in vf vlan table, if user has added more than 128 vlan, fw will ignore it and disable the vf vlan table. So when user deletes the vlan entry that has not been set to vf vlan table, fw will return not found result and driver treat that as error, which will cause vlan delete failed problem. This patch fixes it by returning ok when fw returns not found result. Fixes: 6c251711b37f ("net: hns3: Disable vf vlan filter when vf vlan table is full") Signed-off-by: Yunsheng Lin Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 8577dfc..1c2ab7e 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -4686,9 +4686,17 @@ static int hclge_set_vf_vlan_common(struct hclge_dev *hdev, int vfid, "Add vf vlan filter fail, ret =%d.\n", req0->resp_code); } else { +#define HCLGE_VF_VLAN_DEL_NO_FOUND 1 if (!req0->resp_code) return 0; + if (req0->resp_code == HCLGE_VF_VLAN_DEL_NO_FOUND) { + dev_warn(&hdev->pdev->dev, + "vlan %d filter is not in vf vlan table\n", + vlan); + return 0; + } + dev_err(&hdev->pdev->dev, "Kill vf vlan filter fail, ret =%d.\n", req0->resp_code); From patchwork Mon Sep 3 10:21:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 145773 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp2313133ljw; Mon, 3 Sep 2018 03:23:07 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbw7jExdLw77c7XEjyBYZwXbHQsavB2IWSXmE6dufcq6mWyd+ldA90OM+Rb/qLtl9YJUsk6 X-Received: by 2002:a63:481:: with SMTP id 123-v6mr26165908pge.129.1535970187197; Mon, 03 Sep 2018 03:23:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535970187; cv=none; d=google.com; s=arc-20160816; b=cAty1RC1K+kWGyemDkrD7QIVQ88k+YD8fnDpS8tYcqAFYWnExQsb0PS3CQ9rW6bNAH WhEBSDNKNeKLRQbNgq6mUS9P5Hyv/N3MxeC9oONl9Vzj+LJ6oXji2p/JsCRbvXp4huwi ATSNmF91fzjO7TDXLZ8oiRb/01CIKcyNjgDUjeOU8HFKkJhvBokXYhUlWapw0NYM/fsY kgRRDs+qL2HNffs4P0BTpFhgqdGRHuzfQB6lUjgPqNGgrftJvBTAp8IieHzeLBhUGG1p gl8pOL8RyvW9Z6jORCuLJjnbyIFjyWJIBFRGZysZf0QIkIRKK8iLuz/IGSMa/qUu1jE0 IAnA== 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=QrfnqHkgxBemNfwH9dZFxNbpu0PhU2CF3Bm7U7uC7lw=; b=kmG46X0yVOgbaPQfKGCOdhtsLNT26ChTT67ldWVCGxsVhUQRhGtw1sIi0dbJjmUmLX oO8+lVDru1GHJOJEvSS8ZeFEN64gy6zGkDiANnvAcvapDeW5zEvMVKDv3IjiQelsn9CH X66grEHixgxzzfyuMrc+Hf1ZK9IOw4XEv6Ynj1yK2EI9Y8OWnjLs0Y4HqntOB7OE27ld mnmzqAx/1R/cektoOcrtDKT18ukmka1TzjQui6xHmSjwN/CwRLGtMrk57Qy4dZk+5sNR RylsXCGKvyW5TA3MN+/sLt2RtgKKuGEwRn9bX1BT9PQhJcLUzNfrmtfJg7ucQlkOcq9t mkjA== 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 o20-v6si17486475pgb.608.2018.09.03.03.23.06; Mon, 03 Sep 2018 03:23:07 -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 S1727804AbeICOme (ORCPT + 32 others); Mon, 3 Sep 2018 10:42:34 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:11220 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727284AbeICOmd (ORCPT ); Mon, 3 Sep 2018 10:42:33 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 2B3B8EDB157E6; Mon, 3 Sep 2018 18:22:59 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Mon, 3 Sep 2018 18:22:54 +0800 From: Salil Mehta To: CC: , , , , , , , Huazhong Tan Subject: [PATCH net-next 02/11] net: hns3: Fix for multicast failure Date: Mon, 3 Sep 2018 11:21:47 +0100 Message-ID: <20180903102156.18676-3-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180903102156.18676-1-salil.mehta@huawei.com> References: <20180903102156.18676-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Huazhong Tan When the lower 24 bits of the IPV6 link-local addresses at both ends are the same, the multicast MAC address for Neigbour Discovery is the same. The multicast for Neigbour Discovery will fail. This patch fixes it by including the bonding uplink port in the multicast group. Fixes: 46a3df9f9718("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support") Signed-off-by: Huazhong Tan Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 1c2ab7e..8f1339a 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -4362,7 +4362,7 @@ int hclge_add_mc_addr_common(struct hclge_vport *vport, hnae3_set_bit(req.flags, HCLGE_MAC_VLAN_BIT0_EN_B, 1); hnae3_set_bit(req.entry_type, HCLGE_MAC_VLAN_BIT0_EN_B, 0); hnae3_set_bit(req.entry_type, HCLGE_MAC_VLAN_BIT1_EN_B, 1); - hnae3_set_bit(req.mc_mac_en, HCLGE_MAC_VLAN_BIT0_EN_B, 0); + hnae3_set_bit(req.mc_mac_en, HCLGE_MAC_VLAN_BIT0_EN_B, 1); hclge_prepare_mac_addr(&req, addr); status = hclge_lookup_mac_vlan_tbl(vport, &req, desc, true); if (!status) { @@ -4429,7 +4429,7 @@ int hclge_rm_mc_addr_common(struct hclge_vport *vport, hnae3_set_bit(req.flags, HCLGE_MAC_VLAN_BIT0_EN_B, 1); hnae3_set_bit(req.entry_type, HCLGE_MAC_VLAN_BIT0_EN_B, 0); hnae3_set_bit(req.entry_type, HCLGE_MAC_VLAN_BIT1_EN_B, 1); - hnae3_set_bit(req.mc_mac_en, HCLGE_MAC_VLAN_BIT0_EN_B, 0); + hnae3_set_bit(req.mc_mac_en, HCLGE_MAC_VLAN_BIT0_EN_B, 1); hclge_prepare_mac_addr(&req, addr); status = hclge_lookup_mac_vlan_tbl(vport, &req, desc, true); if (!status) { From patchwork Mon Sep 3 10:21:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 145774 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp2313195ljw; Mon, 3 Sep 2018 03:23:11 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb+1rRVxhoDh54PHc7aEC7Lz91ZGRtTVwRFqIxN2CvrfSDWPHp3hgVwnq+rGMWRNtDRU2Gs X-Received: by 2002:a62:7590:: with SMTP id q138-v6mr21166395pfc.148.1535970191181; Mon, 03 Sep 2018 03:23:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535970191; cv=none; d=google.com; s=arc-20160816; b=frVkYLMt2nwVb6W91hv8Ih4E5DEl37+aAJwTBCkFTSqzY6EnK+MzPO2AM7ecI7Z+xK 7V4QqIn8d8P8tn2IAsSyH5Xm6umbHSUR5ZQ9rEQcmqPjCVpJk5CuRrzw66zyNP+Jj1CC mLCPljJ6dNh8kPsCuDVQAQMwzT0uSZ1895gSPhDi9am+kctLSFdtxXSYuyUKIPV2p03N JEazj6/Q0DTIgsCcEW/T2lPsTBJz5VU5z90jNboTr0azQIRN7sw1jzfdFbg+ImsODRQa trWhKJjHE/azMRIFux3XAzMydpXWi/XibVUvKDwtQFyY5clk8hxkCvF9hd2lyxgtYYy+ RrDw== 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=QURNkdS4bZT7qfBib0V2Twshc+CJsCrPF9wWB3Sr13c=; b=cv8TmNXUd2kmzkM/RrBWQsGal+j4aukwL/rgWYoVOxHpzyo/dOhKtUXkSYkPlIQGGy 1zxCh36DTjwQ3557RmsjfIO8aPus7S5emtJsPBVaxye6z/zsAUePcRVSE4awfjoGdxm/ 0req05/j/gMxn4YEGZFuD/LHsP8vPsZkcEGd4guF+oBGH85Gw6SQsjG1fdxGKah5CM2/ uOwt+ipzBHBon9MQBM5V807ocnjK2GwV45LhWYR05ehynv/QBs4Bc9bnZIga7e1YvcEq LtkIRGfce8wVdjiIh6HMb2s5ORZ54cipvKe4DjfaFbCZc8LoKfSzHqIALc0UrIDyPzGs O9fw== 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 o20-v6si17486475pgb.608.2018.09.03.03.23.10; Mon, 03 Sep 2018 03:23:11 -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 S1727823AbeICOmj (ORCPT + 32 others); Mon, 3 Sep 2018 10:42:39 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:51520 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727284AbeICOmi (ORCPT ); Mon, 3 Sep 2018 10:42:38 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id A88945D1119B7; Mon, 3 Sep 2018 18:23:04 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Mon, 3 Sep 2018 18:22:57 +0800 From: Salil Mehta To: CC: , , , , , , , Jian Shen Subject: [PATCH net-next 03/11] net: hns3: Fix error of checking used vlan id Date: Mon, 3 Sep 2018 11:21:48 +0100 Message-ID: <20180903102156.18676-4-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180903102156.18676-1-salil.mehta@huawei.com> References: <20180903102156.18676-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] 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 PF uses hdev->vlan_table to manage the port vlan table. In function hclge_set_vlan_filter_hw(), it checks whether a vlan id has been used, by foreach all the vport bits. It should use macro HCLGE_VPORT_NUM, not VLAN_N_VID as the foreach condition. Fixes: 6c251711b37f ("net: hns3: Disable vf vlan filter when vf vlan table is full") Signed-off-by: Jian Shen Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 8f1339a..3cf8b80 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -4769,7 +4769,7 @@ static int hclge_set_vlan_filter_hw(struct hclge_dev *hdev, __be16 proto, return -EINVAL; } - for_each_set_bit(vport_idx, hdev->vlan_table[vlan_id], VLAN_N_VID) + for_each_set_bit(vport_idx, hdev->vlan_table[vlan_id], HCLGE_VPORT_NUM) vport_num++; if ((is_kill && vport_num == 0) || (!is_kill && vport_num == 1)) From patchwork Mon Sep 3 10:21:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 145776 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp2313260ljw; Mon, 3 Sep 2018 03:23:16 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY8t4MX6unLOQ0/g/I8UIEfGpm6Nf0K4XV1ohI0Dj73I/Ez5iZSabN2IG+dzZMq+nSgOpUF X-Received: by 2002:a63:6183:: with SMTP id v125-v6mr26116991pgb.242.1535970196461; Mon, 03 Sep 2018 03:23:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535970196; cv=none; d=google.com; s=arc-20160816; b=P6QwAXleZa1J8oewCxht2gDAZEh5pg14FZMyLulRVQc696Tk3KsE10dm+SzrrcQNV8 4n9bjZV+O4rLFot1yRp1rq4Y3ACuodd6b3A+ZSR5zEzwmxJ9hdPH8ldUanXAYmQb6FLJ YSH6fzNZjd8LKFRvjeU4lnzaTEdos9rqGW45F7nWgIp0wfFd/x7YniwXpGKgU2h6nW79 QBop2pr0JprdJ36KDIwdEIE+LUB/v07eNAAfxM6Ycito7XBP4DS1OgMMYAk2P5ER1nbC aINk+H/MjUawkUoB/S5ipTtnBgfs83p5mOmOuR11YmzC6fI+dwkyif2WK2XF7W8VAv4i v7/A== 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=SM6YMy7JqtwjGw3rVyi1rxzmC/oddBGAh1iLnx9yn0c=; b=gDk/IHIDh7YFx7QtUOURw9QZkPNV/rantcIazDbojP2xXCeLTf/dIw2mk/yXfowgLb gDkHp+ICU1+//IQlbp1NHmBSNsUVliRxbugoK047uzavfBrIQclisjhQXz3cAi4M6q8o kO7aLDi3sX+b9A5PFlhaiTGl/Q11PQpW+q4XXE+6SVAF76jYVHB7nAmqN5DNNZPzPHYE p/7OTPTjyQcO+XbR2KSI3FbdvpY7cEHtmuBar6x3+gbs3sQK3hLOO462poJGWBXIHKYV jc0qCENebw/EIh7snc1ayl/MmEU0QZApXIHCSwVyb5baFRixFyg/WoxJIEVRwXskXqs7 L0Ag== 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 e8-v6si17472898plb.83.2018.09.03.03.23.16; Mon, 03 Sep 2018 03:23:16 -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 S1727882AbeICOmo (ORCPT + 32 others); Mon, 3 Sep 2018 10:42:44 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:51550 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727023AbeICOmn (ORCPT ); Mon, 3 Sep 2018 10:42:43 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id B9E852574C767; Mon, 3 Sep 2018 18:23:09 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Mon, 3 Sep 2018 18:23:03 +0800 From: Salil Mehta To: CC: , , , , , , , Yunsheng Lin Subject: [PATCH net-next 05/11] net: hns3: Fix for loopback selftest failed problem Date: Mon, 3 Sep 2018 11:21:50 +0100 Message-ID: <20180903102156.18676-6-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180903102156.18676-1-salil.mehta@huawei.com> References: <20180903102156.18676-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yunsheng Lin Tqp and mac need to be enabled when doing loopback selftest, ae_algo->ops->start/stop is used to do the job, there is a time window between ae_algo->ops->start/stop and loopback setup, which will cause selftest failed problem when there is frame coming in during that time window. This patch fixes it by enabling the tqp and mac during loopback setup process. Fixes: c39c4d98dc65 ("net: hns3: Add mac loopback selftest support in hns3 driver") Signed-off-by: Yunsheng Lin Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 17 +------- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 51 +++++++++++++--------- 2 files changed, 31 insertions(+), 37 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index f70ee69..14797b9 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -100,41 +100,26 @@ static int hns3_lp_up(struct net_device *ndev, enum hnae3_loop loop_mode) struct hnae3_handle *h = hns3_get_handle(ndev); int ret; - if (!h->ae_algo->ops->start) - return -EOPNOTSUPP; - ret = hns3_nic_reset_all_ring(h); if (ret) return ret; - ret = h->ae_algo->ops->start(h); - if (ret) { - netdev_err(ndev, - "hns3_lb_up ae start return error: %d\n", ret); - return ret; - } - ret = hns3_lp_setup(ndev, loop_mode, true); usleep_range(10000, 20000); - return ret; + return 0; } static int hns3_lp_down(struct net_device *ndev, enum hnae3_loop loop_mode) { - struct hnae3_handle *h = hns3_get_handle(ndev); int ret; - if (!h->ae_algo->ops->stop) - return -EOPNOTSUPP; - ret = hns3_lp_setup(ndev, loop_mode, false); if (ret) { netdev_err(ndev, "lb_setup return error: %d\n", ret); return ret; } - h->ae_algo->ops->stop(h); usleep_range(10000, 20000); return 0; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 3cf8b80..4c7442e 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -3659,6 +3659,8 @@ static int hclge_set_mac_loopback(struct hclge_dev *hdev, bool en) /* 2 Then setup the loopback flag */ loop_en = le32_to_cpu(req->txrx_pad_fcs_loop_en); hnae3_set_bit(loop_en, HCLGE_MAC_APP_LP_B, en ? 1 : 0); + hnae3_set_bit(loop_en, HCLGE_MAC_TX_EN_B, en ? 1 : 0); + hnae3_set_bit(loop_en, HCLGE_MAC_RX_EN_B, en ? 1 : 0); req->txrx_pad_fcs_loop_en = cpu_to_le32(loop_en); @@ -3719,15 +3721,36 @@ static int hclge_set_serdes_loopback(struct hclge_dev *hdev, bool en) return -EIO; } + hclge_cfg_mac_mode(hdev, en); return 0; } +static int hclge_tqp_enable(struct hclge_dev *hdev, int tqp_id, + int stream_id, bool enable) +{ + struct hclge_desc desc; + struct hclge_cfg_com_tqp_queue_cmd *req = + (struct hclge_cfg_com_tqp_queue_cmd *)desc.data; + int ret; + + hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_CFG_COM_TQP_QUEUE, false); + req->tqp_id = cpu_to_le16(tqp_id & HCLGE_RING_ID_MASK); + req->stream_id = cpu_to_le16(stream_id); + req->enable |= enable << HCLGE_TQP_ENABLE_B; + + ret = hclge_cmd_send(&hdev->hw, &desc, 1); + if (ret) + dev_err(&hdev->pdev->dev, + "Tqp enable fail, status =%d.\n", ret); + return ret; +} + static int hclge_set_loopback(struct hnae3_handle *handle, enum hnae3_loop loop_mode, bool en) { struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_dev *hdev = vport->back; - int ret; + int i, ret; switch (loop_mode) { case HNAE3_MAC_INTER_LOOP_MAC: @@ -3743,27 +3766,13 @@ static int hclge_set_loopback(struct hnae3_handle *handle, break; } - return ret; -} - -static int hclge_tqp_enable(struct hclge_dev *hdev, int tqp_id, - int stream_id, bool enable) -{ - struct hclge_desc desc; - struct hclge_cfg_com_tqp_queue_cmd *req = - (struct hclge_cfg_com_tqp_queue_cmd *)desc.data; - int ret; - - hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_CFG_COM_TQP_QUEUE, false); - req->tqp_id = cpu_to_le16(tqp_id & HCLGE_RING_ID_MASK); - req->stream_id = cpu_to_le16(stream_id); - req->enable |= enable << HCLGE_TQP_ENABLE_B; + for (i = 0; i < vport->alloc_tqps; i++) { + ret = hclge_tqp_enable(hdev, i, 0, en); + if (ret) + return ret; + } - ret = hclge_cmd_send(&hdev->hw, &desc, 1); - if (ret) - dev_err(&hdev->pdev->dev, - "Tqp enable fail, status =%d.\n", ret); - return ret; + return 0; } static void hclge_reset_tqp_stats(struct hnae3_handle *handle) From patchwork Mon Sep 3 10:21:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 145777 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp2313303ljw; Mon, 3 Sep 2018 03:23:20 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZR6DcwoU+X2woVMwiCm7E19rUFjsj76m7XbHkdpsI0KvPISDB4PVwYISHmE6tno+k1N85i X-Received: by 2002:a17:902:aa05:: with SMTP id be5-v6mr26424942plb.313.1535970200520; Mon, 03 Sep 2018 03:23:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535970200; cv=none; d=google.com; s=arc-20160816; b=kb7f+SNM6aDUsKlcdBSYnCF6nx2mZ5il34ROvjLaWHVyn8q6OJM371DK6Qiby6ZOXB b6Pj5WPsjny3TfChmdtofPO2tA4k9xhP+TGD8AkAcJuG2YeW6RasiARBh+bZGz/DSe7Q NXsrOfYs2qbD7hlthF3u9fY+UZGBoACWqD7MPcvrjrjm06+rgUJX41xh33o3N4n2oNKV HHFkllTJmI9eq3d8mDs9X4scvn6FvFATXc4g7VDDIE05FTyFwsFNJZq28NmdG0P9eJDo bmKxQt0Jfm/I1PesMwfk1WsdvvppkpVBc8ycaWGEcZIQKilb10zPOQknQgPDR0oeGTj5 EkYg== 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=NARclp6CMBZmTDrQhBg/OJWdI42gnniny4O52dyw5eA=; b=t8Z+RLWknN08iAmRohkYINEoQsQyGHRpFuDE0lq0/jFSmcmSuAM6EgjxxlPlFPzSPl oUyq3cW7AjxYAaU3IZ20xv1tYc+W75CzHp1klYwblqc7uZzkfhNWAPlonfdFfxQ3TIIa ABsxXiu80fEoq3V2BtSun7BLhVGlWawzsxTmzqWiMyQWtA1qFxkIDV3gV20/XDvGWMXf 2vWSo/l59t2L47QabK6RULH3b54VLfaL7jGVdmLN9bqtGclc8BXV+VNwED2NNI+gP0zg oVEkNO3409v7YTggHFUrTlZ05dukLMKwweyXvWOOCWj/2ctrvVicaZJHEaB0BJfMcIxU 9suw== 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 v1-v6si19009850pfc.23.2018.09.03.03.23.20; Mon, 03 Sep 2018 03:23:20 -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 S1727957AbeICOms (ORCPT + 32 others); Mon, 3 Sep 2018 10:42:48 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:51606 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726052AbeICOms (ORCPT ); Mon, 3 Sep 2018 10:42:48 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id CF47123D4876F; Mon, 3 Sep 2018 18:23:14 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Mon, 3 Sep 2018 18:23:06 +0800 From: Salil Mehta To: CC: , , , , , , , Yunsheng Lin Subject: [PATCH net-next 06/11] net: hns3: Fix ping exited problem when doing lp selftest Date: Mon, 3 Sep 2018 11:21:51 +0100 Message-ID: <20180903102156.18676-7-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180903102156.18676-1-salil.mehta@huawei.com> References: <20180903102156.18676-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yunsheng Lin When ping is runnig and user executes the loopback selftest, the ping cmd will stop and exit. This patch fixes it by using the hns3_nic_net_open/stop to offline the netdev when doing loopback selftest. Fixes: c39c4d98dc65 ("net: hns3: Add mac loopback selftest support in hns3 driver") Signed-off-by: Yunsheng Lin Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index 14797b9..7143e39 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -294,7 +294,7 @@ static void hns3_self_test(struct net_device *ndev, h->flags & HNAE3_SUPPORT_SERDES_LOOPBACK; if (if_running) - dev_close(ndev); + ndev->netdev_ops->ndo_stop(ndev); #if IS_ENABLED(CONFIG_VLAN_8021Q) /* Disable the vlan filter for selftest does not support it */ @@ -332,7 +332,7 @@ static void hns3_self_test(struct net_device *ndev, #endif if (if_running) - dev_open(ndev); + ndev->netdev_ops->ndo_open(ndev); } static int hns3_get_sset_count(struct net_device *netdev, int stringset) From patchwork Mon Sep 3 10:21:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 145778 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp2313333ljw; Mon, 3 Sep 2018 03:23:23 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaoHYCvy9OmOtnG3nNmkEavItuJcsKVTZC8nOWzvzkW1vJMC8nfVlNC/Lelag7MYDfMRiX8 X-Received: by 2002:a63:2022:: with SMTP id g34-v6mr21589188pgg.235.1535970203619; Mon, 03 Sep 2018 03:23:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535970203; cv=none; d=google.com; s=arc-20160816; b=tg1VHAqposgTwmtyMh9QCRHXGKrVVShEo1gY94SHOXvLLyVUA1ibkJ/uBQjLNSs1AA 9PjdMGTlQ7JjdlIcTLqIeaJ/gmEVapKHdC2PlXZXuJoSJ9U/HCeXJxTzZczyrxiYSJWG 7gv9oyJxtSCbWgcvo2+5QBDr1n7fHH+n/pr/REov6ZSlJO555wQf2KyZ7L0z7yvIC/Al oF7BOB7L7QAFRcFDWp4v43nqyGoR2KrvFf2Q2rCM0ikbAilnITaV+vgRSgBQOu56jD/q bsWH98edEkCogg2omGI4NmcZjrpPmPT/95zmvev8k2F6+6TJqIbiEaKc7yaW49o8dFDB jLWw== 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=U4a8LMXGfrvLaBhzkVCk2MmqSbYTnMOT1GMnbiMvG7k=; b=J+8BG4p1MLDYU4feupIkpCS6b35u+2pXaZN7XExu447a+RxsAaX71ejWqNwZxbzagq tYax1T7LlyJRIKb0MdmktlIqjd+bAECONbsxsFmI4UaCy3t2DTpcLHL/Zv2Y2JV0xLep 1E9HlSuXtNYYYjqBXcyOp1FiuDZE9D0aSwQRuBXb827qYtY8CwWjA6j9ttP6kNQidGNJ iJ12ICjRZyh1v3+THQrMzLvsuMqkpO9PId4bFKa5fBsfbvOIV+FarxkCWyUzf+o/hnmh 1TCQtuIIX4TrNE/wI3os88kRBZr4VVcqlg15yKn3l4gM/wfrmul3pH6CfDl42o1BScQb Lvcw== 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 s68-v6si18298436pgc.16.2018.09.03.03.23.23; Mon, 03 Sep 2018 03:23:23 -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 S1727989AbeICOmv (ORCPT + 32 others); Mon, 3 Sep 2018 10:42:51 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:51618 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726047AbeICOmu (ORCPT ); Mon, 3 Sep 2018 10:42:50 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id D395115F31176; Mon, 3 Sep 2018 18:23:14 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Mon, 3 Sep 2018 18:23:09 +0800 From: Salil Mehta To: CC: , , , , , , , Yunsheng Lin Subject: [PATCH net-next 07/11] net: hns3: Preserve vlan 0 in hardware table Date: Mon, 3 Sep 2018 11:21:52 +0100 Message-ID: <20180903102156.18676-8-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180903102156.18676-1-salil.mehta@huawei.com> References: <20180903102156.18676-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yunsheng Lin When netdev is down, the stack will delete the vlan from hardware including vlan0, which will cause problem when doing loopback selftest when netdev is down. This patch fixes it by always preserving vlan 0 in hardware, because vlan 0 is defalut vlan, which should always be in hardware. Fixes: c39c4d98dc65 ("net: hns3: Add mac loopback selftest support in hns3 driver") Signed-off-by: Yunsheng Lin Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 4c7442e..004bfc1 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -4749,6 +4749,9 @@ static int hclge_set_vlan_filter_hw(struct hclge_dev *hdev, __be16 proto, u16 vport_idx, vport_num = 0; int ret; + if (is_kill && !vlan_id) + return 0; + ret = hclge_set_vf_vlan_common(hdev, vport_id, is_kill, vlan_id, 0, proto); if (ret) { From patchwork Mon Sep 3 10:21:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 145781 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp2313494ljw; Mon, 3 Sep 2018 03:23:35 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb3ypf+pt9fjkPeEKzGQ8WczAb+ZVo/ZbVwhRhwbpOJChrCZDhK0/ArYJdYL4b7A4F5JlMe X-Received: by 2002:a63:4425:: with SMTP id r37-v6mr25518115pga.391.1535970214991; Mon, 03 Sep 2018 03:23:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535970214; cv=none; d=google.com; s=arc-20160816; b=Puj0L67mWzJoGilUFKhlab9JqhXIFiLSmD9QxAT/fFuoyjhpOzyxdXoNTCLwtI+mKV xCwRaKfTIA0gIYTNPcauYCEH3MVD5rsyYjupP8dIv6/9EOJu0rpAAk/KxFOqi6JS2GOT hGFq//M/77Ukmd1FT624wIx+YBBLc8KcynUKuohlg/9RbvZQOsDt/xYB7f61kdsvLuX7 f21Rt1c3tLvBNeEji34Tn6TLxFHoFEpm+PBEjG7LVB3/OmJl4B2oyuuEJCHhS2hgUBqG 4gag22RSFopZ+hW+LnX2w3Ych2f6f39aMi7sZnHOOj3+ik+eysacgKNSZwoSIskDHPQV oK/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=IhdZGAF85+8lx7Yo/O0n87VGZKi8Le8MHHvbbw6RQhY=; b=HkDKTbOyKg/rnEP1mRuskFQxXZz2hBh+0vc1mtOaJQRrPK5LjTyQXe4kI+QRxat2kj kpewML1vaZ+swkdLYcSKxIgcJdqYnqlIF+DOCICOhXXzCL1ageLd5iz9d+2B3i4y2aBa evBs2fL8hJnYFHk+uhztNOyaHZvGU8hl37GZ7BeXREVBppHHGKtigqRJFww1IatIr+71 d8XqgCKDIyl6QHNDJAqLU5o6Wyotr84PR7MSywHF2ckGxSP5x2+giy29VQlN4kxOXcjs huvNVpQHquNY3bD+BhUbupXBApGu9VrTYJbgR6Q3ZoSiBzUIM9j/P2QrNAN1uuogjNdg s+jg== 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 p14-v6si16713862pgg.67.2018.09.03.03.23.34; Mon, 03 Sep 2018 03:23:34 -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 S1728061AbeICOnC (ORCPT + 32 others); Mon, 3 Sep 2018 10:43:02 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:51689 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725949AbeICOnC (ORCPT ); Mon, 3 Sep 2018 10:43:02 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id E9F7171114CA6; Mon, 3 Sep 2018 18:23:24 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Mon, 3 Sep 2018 18:23:18 +0800 From: Salil Mehta To: CC: , , , , , , , Jian Shen Subject: [PATCH net-next 10/11] net: hns3: Remove redundant codes of query advertised flow control abilitiy Date: Mon, 3 Sep 2018 11:21:55 +0100 Message-ID: <20180903102156.18676-11-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180903102156.18676-1-salil.mehta@huawei.com> References: <20180903102156.18676-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] 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 If the advertised flow control ability has been fetched using phy_ethtool_ksettings_get() or hclge_get_link_mode() then it is unnecessary to fetch them again later using hclge_get_flowctrl_adv(). This patch removes it. Signed-off-by: Jian Shen Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 12 ------------ drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 15 --------------- 2 files changed, 27 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index dfce76e..41d817d 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -591,18 +591,6 @@ static int hns3_get_link_ksettings(struct net_device *netdev, /* 4.mdio_support */ cmd->base.mdio_support = ETH_MDIO_SUPPORTS_C22; - /* 5.get flow control setttings */ - if (h->ae_algo->ops->get_flowctrl_adv) - h->ae_algo->ops->get_flowctrl_adv(h, &flowctrl_adv); - - if (flowctrl_adv & ADVERTISED_Pause) - ethtool_link_ksettings_add_link_mode(cmd, advertising, - Pause); - - if (flowctrl_adv & ADVERTISED_Asym_Pause) - ethtool_link_ksettings_add_link_mode(cmd, advertising, - Asym_Pause); - return 0; } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 25d4fd9..c56db06 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -5221,20 +5221,6 @@ static u32 hclge_get_fw_version(struct hnae3_handle *handle) return hdev->fw_version; } -static void hclge_get_flowctrl_adv(struct hnae3_handle *handle, - u32 *flowctrl_adv) -{ - struct hclge_vport *vport = hclge_get_vport(handle); - struct hclge_dev *hdev = vport->back; - struct phy_device *phydev = hdev->hw.mac.phydev; - - if (!phydev) - return; - - *flowctrl_adv |= (phydev->advertising & ADVERTISED_Pause) | - (phydev->advertising & ADVERTISED_Asym_Pause); -} - static void hclge_set_flowctrl_adv(struct hclge_dev *hdev, u32 rx_en, u32 tx_en) { struct phy_device *phydev = hdev->hw.mac.phydev; @@ -6335,7 +6321,6 @@ static const struct hnae3_ae_ops hclge_ops = { .get_tqps_and_rss_info = hclge_get_tqps_and_rss_info, .set_channels = hclge_set_channels, .get_channels = hclge_get_channels, - .get_flowctrl_adv = hclge_get_flowctrl_adv, .get_regs_len = hclge_get_regs_len, .get_regs = hclge_get_regs, .set_led_id = hclge_set_led_id, From patchwork Mon Sep 3 10:21:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 145782 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp2313536ljw; Mon, 3 Sep 2018 03:23:37 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZGWT9KBv9pKXzbNvGIeEo5so1wca+q2XlrBP4DaTKDD9xaq/LktTDOleuNCNeuH1suJQy9 X-Received: by 2002:a63:3105:: with SMTP id x5-v6mr5338815pgx.323.1535970217250; Mon, 03 Sep 2018 03:23:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535970217; cv=none; d=google.com; s=arc-20160816; b=naNX7LGh1uhwKHUBY5FZOxGFRECV72EA4omfg1zM5lFDszMI2DPNtC/n6TYesrMYmM kvd8QXGc6+RWC9fxW78MJ9ljn8+BZKvzqlhqRFhPM9bJpXCNxSgMLRuzXFf7qglti5Gp Fxg/SE5PAs1bcUyr3lPuxz5F/3HJN+xDlKvXt/T1rSWA8mWvB50vOZ3lIIYsjFMZfSuU LVWvhgKTWtbn+rS0lVuW36efW8HrWz/EWpxy/Dhu99BUB2SC5MumgqWUrvatEIqXFRuP Flhw7x2Op1V0MMx9nibTCJJoegHvwUn1D0RPcjHgDzu52NmdNSQKnsb3mc7zpHloiNml nZ7A== 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=P6O1pLqmqt95bdWjehsDyLmk7E1kCQAU5V/Kt45vHz0=; b=ozBSTIzLcUa3KjFZ4+J2/pCXZ/LEwJpC5I4fhf2BOvkmbNw4H/uq8tLW7d2tfYEZQD iuuIGqBfgZA91SIz/1t8p0xK9ko5EVQRJY5p6Mui3At8uHyak87WlGbKs9dQSeD5pVAF St+7023pzHNBELri3T5Ksq+TekCM2mAOEMEvRxdu4DURpfnbMlUKYmOd4yyPXWtJQBTo Mm/cP6kulFcm6/deaMh2nd7bwCNUsMQZKSraeiJMjZZ1j+EkJsNivbkCqK0koFNn0tzk n1CZ88BF7n2FZ5hLWwVkCGTkmWE0/zooxvF9wuxef41JtBFdvVRigepawKjxv/ULyPPj J1PA== 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 p14-v6si16713862pgg.67.2018.09.03.03.23.36; Mon, 03 Sep 2018 03:23:37 -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 S1728089AbeICOnF (ORCPT + 32 others); Mon, 3 Sep 2018 10:43:05 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:59189 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725949AbeICOnD (ORCPT ); Mon, 3 Sep 2018 10:43:03 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 648176D79E4E2; Mon, 3 Sep 2018 18:23:30 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Mon, 3 Sep 2018 18:23:21 +0800 From: Salil Mehta To: CC: , , , , , , , Jian Shen Subject: [PATCH net-next 11/11] net: hns3: Refine hns3_get_link_ksettings() Date: Mon, 3 Sep 2018 11:21:56 +0100 Message-ID: <20180903102156.18676-12-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180903102156.18676-1-salil.mehta@huawei.com> References: <20180903102156.18676-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] 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 In the previous implement, the query operation for fibre port and copper port are mixed. This patch refines it by seperating them based on the port type. Signed-off-by: Jian Shen Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 68 +++++++++++++--------- 1 file changed, 40 insertions(+), 28 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index 41d817d..3019007 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -546,26 +546,56 @@ static int hns3_get_link_ksettings(struct net_device *netdev, struct ethtool_link_ksettings *cmd) { struct hnae3_handle *h = hns3_get_handle(netdev); - u32 flowctrl_adv = 0; + const struct hnae3_ae_ops *ops; u8 link_stat; if (!h->ae_algo || !h->ae_algo->ops) return -EOPNOTSUPP; - /* 1.auto_neg & speed & duplex from cmd */ - if (netdev->phydev) { + ops = h->ae_algo->ops; + if (ops->get_port_type) + ops->get_port_type(h, &cmd->base.port); + else + return -EOPNOTSUPP; + + switch (cmd->base.port) { + case PORT_FIBRE: + /* 1.auto_neg & speed & duplex from cmd */ + if (ops->get_ksettings_an_result) + ops->get_ksettings_an_result(h, + &cmd->base.autoneg, + &cmd->base.speed, + &cmd->base.duplex); + else + return -EOPNOTSUPP; + + /* 2.get link mode*/ + if (ops->get_link_mode) + ops->get_link_mode(h, + cmd->link_modes.supported, + cmd->link_modes.advertising); + + /* 3.mdix_ctrl&mdix get from phy reg */ + if (ops->get_mdix_mode) + ops->get_mdix_mode(h, &cmd->base.eth_tp_mdix_ctrl, + &cmd->base.eth_tp_mdix); + + break; + case PORT_TP: + if (!netdev->phydev) + return -EOPNOTSUPP; + phy_ethtool_ksettings_get(netdev->phydev, cmd); + break; + default: + netdev_warn(netdev, + "Unknown port type, neither Fibre/Copper detected"); return 0; } - if (h->ae_algo->ops->get_ksettings_an_result) - h->ae_algo->ops->get_ksettings_an_result(h, - &cmd->base.autoneg, - &cmd->base.speed, - &cmd->base.duplex); - else - return -EOPNOTSUPP; + /* mdio_support */ + cmd->base.mdio_support = ETH_MDIO_SUPPORTS_C22; link_stat = hns3_get_link(netdev); if (!link_stat) { @@ -573,24 +603,6 @@ static int hns3_get_link_ksettings(struct net_device *netdev, cmd->base.duplex = DUPLEX_UNKNOWN; } - /* 2.get link mode and port type*/ - if (h->ae_algo->ops->get_link_mode) - h->ae_algo->ops->get_link_mode(h, - cmd->link_modes.supported, - cmd->link_modes.advertising); - - cmd->base.port = PORT_NONE; - if (h->ae_algo->ops->get_port_type) - h->ae_algo->ops->get_port_type(h, - &cmd->base.port); - - /* 3.mdix_ctrl&mdix get from phy reg */ - if (h->ae_algo->ops->get_mdix_mode) - h->ae_algo->ops->get_mdix_mode(h, &cmd->base.eth_tp_mdix_ctrl, - &cmd->base.eth_tp_mdix); - /* 4.mdio_support */ - cmd->base.mdio_support = ETH_MDIO_SUPPORTS_C22; - return 0; }