From patchwork Tue Aug 14 16:13:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 144191 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp4551112ljj; Tue, 14 Aug 2018 09:14:24 -0700 (PDT) X-Google-Smtp-Source: AA+uWPz7yv8L2ymXbwNf8fpSx5PuP/NfVvxj29w2wEHWMVkythKrdHPUWe8CkgDNIy6lDLy4LmsR X-Received: by 2002:a63:1902:: with SMTP id z2-v6mr21354945pgl.86.1534263264343; Tue, 14 Aug 2018 09:14:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534263264; cv=none; d=google.com; s=arc-20160816; b=FyfRBqr3vR8Zt2nHwJMApVwFZ0lfZ7AC20p3uIloxva0QnHec7F664ChNPgxOWferF 0iSxEzl9dexn/pN0e9IMh0urwaRTMesXx9JZ5XGDVfkdxjb6D3sQzd6wIjNt0m8Cn0Vp yVxD3RwEfUH9V5nw3xa7jXrsGm569/rxCpZnEYH/HFalvRF4BoC1vW6/pzH7yBLyGoTC rZkSTqk91FSo1JRccUnDgyY/5+s+tgaPRzObyNvfRlkfzk7B4rCbexZBCyX4VssmNCyd ttPKCbIdENp3b0JRuP7JW37Dd0IV29onAlYyVLS7d9puyx5e189gclCUKDbdlDtUOGoN Ypbg== 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=XN6y/R83Zy/haI0Xu2bOH3L3Z4rzkjMmHhAL/1fKFx8=; b=Y1LdA3DTCZpBBkcvq4FeBSmlzQsfj3PlArXCMyMqFJLeCMxnaSDqISEWS7T31aWm67 z3xTHZEkmD8VqGH4aBgJ60NhAUY+OaI/Q9RfK75yL3PGfpbsyiiGE+btf3vwvSX9k732 xdDZOBa0fgcF0FeZG+6Ai9MBM9MTWPf9dZ5IRk979TlSJYXZpXK/22+QS72EsJ7RF8Kd FatbLGbA+rzds5hyri89ZgQ5oKmb5T1Xi6vEewVhZhXyjK5UAfS8sw3iR0G2k1NSJZDQ xukpSTiFt/XV30oygnh475qsftzHjuI75dYI5UAAsSB2wjq0xIm3PP7NHgwALdxT48+V YFwA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 26-v6si21564588pgo.169.2018.08.14.09.14.24; Tue, 14 Aug 2018 09:14:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733045AbeHNTCK (ORCPT + 10 others); Tue, 14 Aug 2018 15:02:10 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:11108 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1733022AbeHNTCJ (ORCPT ); Tue, 14 Aug 2018 15:02:09 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 8FA2DB24E8362; Wed, 15 Aug 2018 00:14:16 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.399.0; Wed, 15 Aug 2018 00:14:11 +0800 From: Salil Mehta To: CC: , , , , , , , Yunsheng Lin Subject: [PATCH V2 net-next 5/8] net: hns3: Fix desc num set to default when setting channel Date: Tue, 14 Aug 2018 17:13:16 +0100 Message-ID: <20180814161319.16392-6-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180814161319.16392-1-salil.mehta@huawei.com> References: <20180814161319.16392-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Yunsheng Lin When user set the channel num using "ethtool -L ethX", the desc num of BD will set to default value, which will cause desc num set by user lost problem. This patch fixes it by restoring the desc num set by user when setting channel num. Fixes: 09f2af6405b8 ("net: hns3: add support to modify tqps number") Signed-off-by: Yunsheng Lin Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 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 2e9c8b9..8577dfc 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -1267,35 +1267,37 @@ static int hclge_map_tqps_to_func(struct hclge_dev *hdev, u16 func_id, return ret; } -static int hclge_assign_tqp(struct hclge_vport *vport, - struct hnae3_queue **tqp, u16 num_tqps) +static int hclge_assign_tqp(struct hclge_vport *vport) { + struct hnae3_knic_private_info *kinfo = &vport->nic.kinfo; struct hclge_dev *hdev = vport->back; int i, alloced; for (i = 0, alloced = 0; i < hdev->num_tqps && - alloced < num_tqps; i++) { + alloced < kinfo->num_tqps; i++) { if (!hdev->htqp[i].alloced) { hdev->htqp[i].q.handle = &vport->nic; hdev->htqp[i].q.tqp_index = alloced; - tqp[alloced] = &hdev->htqp[i].q; + hdev->htqp[i].q.desc_num = kinfo->num_desc; + kinfo->tqp[alloced] = &hdev->htqp[i].q; hdev->htqp[i].alloced = true; alloced++; } } - vport->alloc_tqps = num_tqps; + vport->alloc_tqps = kinfo->num_tqps; return 0; } -static int hclge_knic_setup(struct hclge_vport *vport, u16 num_tqps) +static int hclge_knic_setup(struct hclge_vport *vport, + u16 num_tqps, u16 num_desc) { struct hnae3_handle *nic = &vport->nic; struct hnae3_knic_private_info *kinfo = &nic->kinfo; struct hclge_dev *hdev = vport->back; int i, ret; - kinfo->num_desc = hdev->num_desc; + kinfo->num_desc = num_desc; kinfo->rx_buf_len = hdev->rx_buf_len; kinfo->num_tc = min_t(u16, num_tqps, hdev->tm_info.num_tc); kinfo->rss_size @@ -1322,7 +1324,7 @@ static int hclge_knic_setup(struct hclge_vport *vport, u16 num_tqps) if (!kinfo->tqp) return -ENOMEM; - ret = hclge_assign_tqp(vport, kinfo->tqp, kinfo->num_tqps); + ret = hclge_assign_tqp(vport); if (ret) dev_err(&hdev->pdev->dev, "fail to assign TQPs %d.\n", ret); @@ -1388,7 +1390,7 @@ static int hclge_vport_setup(struct hclge_vport *vport, u16 num_tqps) nic->numa_node_mask = hdev->numa_node_mask; if (hdev->ae_dev->dev_type == HNAE3_DEV_KNIC) { - ret = hclge_knic_setup(vport, num_tqps); + ret = hclge_knic_setup(vport, num_tqps, hdev->num_desc); if (ret) { dev_err(&hdev->pdev->dev, "knic setup failed %d\n", ret); @@ -5936,7 +5938,7 @@ static int hclge_set_channels(struct hnae3_handle *handle, u32 new_tqps_num) /* Free old tqps, and reallocate with new tqp number when nic setup */ hclge_release_tqp(vport); - ret = hclge_knic_setup(vport, new_tqps_num); + ret = hclge_knic_setup(vport, new_tqps_num, kinfo->num_desc); if (ret) { dev_err(&hdev->pdev->dev, "setup nic fail, ret =%d\n", ret); return ret; From patchwork Tue Aug 14 16:13:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 144195 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp4551313ljj; Tue, 14 Aug 2018 09:14:35 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyIrceuxlxZ0UAnZ7TvHATgg/1vKf/7WLPj9HwtA/yCZ9AUdckS7Cz67znTCYmDEmfk3A6D X-Received: by 2002:a17:902:7486:: with SMTP id h6-v6mr21579742pll.165.1534263275342; Tue, 14 Aug 2018 09:14:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534263275; cv=none; d=google.com; s=arc-20160816; b=uXRxe+A6Qn9vfShqwg52bX1fyn9KDeGE8rc0bpUJk4xhGnR0pLJmc94GZ/qOX0eRzH ccPFZQ54eE7yJPnPOhW3VaQsi0/VzSuSbE4EKTWNCGoADiKoumNyTTboJwYJp2HFn9/f ZwsFqPaJ9AikPfNumAuR7aHmoS4EoWtKtwvyv2LaZjqQCgZ0DjQb8rwBej3P9DZn+ETy 3IGWaUW1kyg6vsMRxKpQcX8J6gG1TBkdzMjF+ZFwf3RTlKgVJzHUkFCZP0EgQatHjPkO 89gXWe3e54SSb7zX0qAJ1oL8+va4ZDbcPZIvKCsgq/fhxE7xmLjoTLqFcIn9c3tYhxYE NCZg== 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=y+0qpgK5kNCeUpcAoH8BG168k5mRaZxrxSACbUTWR5A=; b=uBkYcmiSiwjvkTQjDt3w3kX7JaWK3MXNYc/UlYoWizOWtkwPjQrnI26QxcPVCXpyYf A61LFlWeamGh5IovVfO4JKeBHZKuijWySH7xqMqWfvHo+hCUlGejRSh0nuKtiaMkwvyr VtZunAqOHhGrf+T0p0SxdD/aQuU0LgSDgSxa7eAk9Y/tNOGOZovngqRE05Gfi2gOAjvm 3PZd3by0YRO1t6Ia6pIB/pUwXIfrLlRteYKjIhSILAUGlN41TP7IucSDO2PRYouFFLP3 u3+zXTRhvgbUgzggNd9xECLDbxhRTOA9t+PJxMHQj1P7iKnvaAhASarNJeCa5e2VvxEY Zv2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 p65-v6si21949244pga.401.2018.08.14.09.14.35; Tue, 14 Aug 2018 09:14:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733122AbeHNTCV (ORCPT + 10 others); Tue, 14 Aug 2018 15:02:21 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:42424 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1733047AbeHNTCU (ORCPT ); Tue, 14 Aug 2018 15:02:20 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 39B3D9FDC1C44; Wed, 15 Aug 2018 00:14:27 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.399.0; Wed, 15 Aug 2018 00:14:19 +0800 From: Salil Mehta To: CC: , , , , , , Subject: [PATCH V2 net-next 8/8] net: hns3: Add vlan filter setting by ethtool command -K Date: Tue, 14 Aug 2018 17:13:19 +0100 Message-ID: <20180814161319.16392-9-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180814161319.16392-1-salil.mehta@huawei.com> References: <20180814161319.16392-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Peng Li Revision(0x20) HW does not support enabling or disabling individual netdev's HW_VLAN_CTAG_FILTER feature, and Revision(0x21) supports enabling or disabling individual netdev's HW_VLAN_CTAG_FILTER feature. Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index b28c7e1..3554dca 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -1673,6 +1673,9 @@ static struct pci_driver hns3_driver = { /* set default feature to hns3 */ static void hns3_set_default_feature(struct net_device *netdev) { + struct hnae3_handle *h = hns3_get_handle(netdev); + struct pci_dev *pdev = h->pdev; + netdev->priv_flags |= IFF_UNICAST_FLT; netdev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | @@ -1706,6 +1709,9 @@ static void hns3_set_default_feature(struct net_device *netdev) NETIF_F_GRO | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM; + + if (pdev->revision != 0x20) + netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; } static int hns3_alloc_buffer(struct hns3_enet_ring *ring,