From patchwork Sun Aug 12 09:47:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 143988 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1892861ljj; Sun, 12 Aug 2018 02:49:21 -0700 (PDT) X-Google-Smtp-Source: AA+uWPx3n8VJD16drPno5eAj2HH/ld7H7aNTv5qNc8p+RRSdzfY32wUx5kBn5jLCA8s+H8IrblLG X-Received: by 2002:a17:902:ac1:: with SMTP id 59-v6mr12530219plp.18.1534067361368; Sun, 12 Aug 2018 02:49:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534067361; cv=none; d=google.com; s=arc-20160816; b=S/NheT9vDhx3rIdL+Vgi33b8P4kTyTELidbmHhtB6y1iPkJeVilHAI64gpDIgkLzju 45b9s0VXIQhoQVsGHFDeUhOHsOiH93kUYBqIVapfC4UEII+cAPJS83ArX+8taE0vR+2/ xbUhATahXBk8ouCuqwbJuOgJLYQNlpGS9ovLQkM3wQCAnv6eTOLQd/Nw7DcXgjhe40fa vbNLwnQlZkbiDjhp93ve4kmUFjg1wt9zKdfiBJnh4ckap3L8LBfWGdV0nWJlT3Nv6NXU K253+gErwh/jJ0MVU0Y0LZxdS3L3XXPUVNJ1vTQbAB1a8/ubmT0bk2ZBnI8UVfWXO4W4 D/qQ== 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=4jrM8K8CnCODMMCGjhg7/FdWQgwXfZKHW4FnC+QNk3o=; b=HnL8FWhVpHl7jDagIWUoZgPOkHo+RXuMxpKRWhz2rjLqYhtCNR1pK2itVbAg+LpJp8 6x2FOQd9WuB0O95kAxyScymvLHrTel06F1eJQqeKrUXOeUN+n5nKuKvZXceyeA8tP5w/ vF/tobopXgXDO5EGiTC+4xE9BQoRCA9/cL8KprmnkOzs4aEz3Grxhv1Mly7mRSfbq3RX pT1YJzoxYiUeSgAzpxidfGeTX27UtB+mflTxXr2yesF7muASKXfTNnHhoaN+DTHtz7VB 9e4diAlbDNp/zgqFhNW8c7ORqbwcjuDNsD2sRhS75wm4xwfrB7xPzPfZx7OFzpJ5Pg5b 8Vzw== 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 c192-v6si14794389pfg.347.2018.08.12.02.49.21; Sun, 12 Aug 2018 02:49:21 -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 S1728196AbeHLM0p (ORCPT + 31 others); Sun, 12 Aug 2018 08:26:45 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:10659 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728084AbeHLM0P (ORCPT ); Sun, 12 Aug 2018 08:26:15 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 0EB28DF8384A; Sun, 12 Aug 2018 17:48:45 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.47.93.119) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.399.0; Sun, 12 Aug 2018 17:48:39 +0800 From: Salil Mehta To: CC: , , , , , , , Yunsheng Lin Subject: [PATCH net-next 6/9] net: hns3: Fix desc num set to default when setting channel Date: Sun, 12 Aug 2018 10:47:35 +0100 Message-ID: <20180812094738.14852-7-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180812094738.14852-1-salil.mehta@huawei.com> References: <20180812094738.14852-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.47.93.119] 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 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.11.0 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index c88f5e6a9b77..8510245705cc 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); @@ -5944,7 +5946,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;