Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp348819ybb; Sat, 28 Mar 2020 00:12:06 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvdoivLdIe8lx+KaQtZMHlPMIz1lrr9uO5egy3zqeInvIHbT+yReUOWQXNghWBmW50wudC3 X-Received: by 2002:a9d:64d4:: with SMTP id n20mr1745795otl.193.1585379526017; Sat, 28 Mar 2020 00:12:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585379526; cv=none; d=google.com; s=arc-20160816; b=VBpZlq59YH/l6KQqtMzA4D8MdmD4U+XTCYThyEyyRGJlWvV7m6PjFZRzVqxEYfB5BL kQXIsnqQABmKP8tQtsWBiLYajvIstWOTyCsYIY+aEdraD6gocB4dsnrRofXTIy2JtqwX pxEMrW44f5UCtwm5TGQmQiPOqSJT5Jo5M5TFFrc3sBy+8RYdvDAutDZq2urozgGtdH7P QMzqX2w7e1HByITPH5YTT3qE9r0cCzJDtvm+QVbGEYgCvzMaGtcIQtQg5s1he3OWFqIO 89+dk47DB2DnhS9ZD27X/lMhYuoeFG1XPOfQXVVtPbgxLf4eQw3laou77LhN6YO1idmT 7O0g== 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; bh=l1F06NB6qo+taCyrznjWCTG+VuF6oLSepLfNUIwvdfE=; b=yWxoja44+V0hVq+H2WT9DjJiNoQlUNXwvKdSfku8PyE152eAWIumtaO9hDY+zK5wRN i1RreZljqv/M+7yY2V8aj1g8Q9zH8uplOHFJKy81kK5Hh49pKB+2a+r1hTJ6adaRSZEH pOyvFv7LznOk7C6g7HtG0ac398lRqls9C2oKyd2PYicLq/62UQHGdb+Z8ydeZJZmjYA5 3IiAB4DcvtBQnqYLhGNBUvIXe/Oza1dmQht4vVUovQ+4+HlerCemBszrtf5nkCBThwBO pMc3yf3csKM5kLzfZ3HOel3qHFNRCHaQposnqk/VrA2wIXsf/ZKhr/odKf3P4udMm+9c yzOg== 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 w73si3134333oiw.206.2020.03.28.00.11.41; Sat, 28 Mar 2020 00:12:06 -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 S1726271AbgC1HK7 (ORCPT + 99 others); Sat, 28 Mar 2020 03:10:59 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:35080 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725810AbgC1HK6 (ORCPT ); Sat, 28 Mar 2020 03:10:58 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 80EF058DE3AC0FEF6455; Sat, 28 Mar 2020 15:10:52 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Sat, 28 Mar 2020 15:10:44 +0800 From: Huazhong Tan To: CC: , , , , , , Guojia Liao , Huazhong Tan Subject: [PATCH net 3/4] net: hns3: fix RSS config lost after VF reset. Date: Sat, 28 Mar 2020 15:09:57 +0800 Message-ID: <1585379398-36224-4-git-send-email-tanhuazhong@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1585379398-36224-1-git-send-email-tanhuazhong@huawei.com> References: <1585379398-36224-1-git-send-email-tanhuazhong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Guojia Liao Currently, VF's RSS configuration would be set to default after VF reset, the the user's one will loss. To fix it, this patch separates hclgevf_rss_init_hw() into two parts, one sets up the default RSS configuration and just be called when driver loading, one configures the hardware and be called by driver loading or reset. Fixes: d97b30721301 ("net: hns3: Add RSS tuples support for VF") Signed-off-by: Guojia Liao Signed-off-by: Huazhong Tan --- .../ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 52 ++++++++++++---------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index 3c58f0b..768240f 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -2124,50 +2124,51 @@ static int hclgevf_config_gro(struct hclgevf_dev *hdev, bool en) return ret; } -static int hclgevf_rss_init_hw(struct hclgevf_dev *hdev) +static void hclgevf_rss_init_cfg(struct hclgevf_dev *hdev) { struct hclgevf_rss_cfg *rss_cfg = &hdev->rss_cfg; - int ret; + struct hclgevf_rss_tuple_cfg *tuple_sets; u32 i; + rss_cfg->hash_algo = HCLGEVF_RSS_HASH_ALGO_TOEPLITZ; rss_cfg->rss_size = hdev->nic.kinfo.rss_size; - + tuple_sets = &rss_cfg->rss_tuple_sets; if (hdev->pdev->revision >= 0x21) { rss_cfg->hash_algo = HCLGEVF_RSS_HASH_ALGO_SIMPLE; memcpy(rss_cfg->rss_hash_key, hclgevf_hash_key, HCLGEVF_RSS_KEY_SIZE); + tuple_sets->ipv4_tcp_en = HCLGEVF_RSS_INPUT_TUPLE_OTHER; + tuple_sets->ipv4_udp_en = HCLGEVF_RSS_INPUT_TUPLE_OTHER; + tuple_sets->ipv4_sctp_en = HCLGEVF_RSS_INPUT_TUPLE_SCTP; + tuple_sets->ipv4_fragment_en = HCLGEVF_RSS_INPUT_TUPLE_OTHER; + tuple_sets->ipv6_tcp_en = HCLGEVF_RSS_INPUT_TUPLE_OTHER; + tuple_sets->ipv6_udp_en = HCLGEVF_RSS_INPUT_TUPLE_OTHER; + tuple_sets->ipv6_sctp_en = HCLGEVF_RSS_INPUT_TUPLE_SCTP; + tuple_sets->ipv6_fragment_en = HCLGEVF_RSS_INPUT_TUPLE_OTHER; + } + + /* Initialize RSS indirect table */ + for (i = 0; i < HCLGEVF_RSS_IND_TBL_SIZE; i++) + rss_cfg->rss_indirection_tbl[i] = i % rss_cfg->rss_size; +} + +static int hclgevf_rss_init_hw(struct hclgevf_dev *hdev) +{ + struct hclgevf_rss_cfg *rss_cfg = &hdev->rss_cfg; + int ret; + + if (hdev->pdev->revision >= 0x21) { ret = hclgevf_set_rss_algo_key(hdev, rss_cfg->hash_algo, rss_cfg->rss_hash_key); if (ret) return ret; - rss_cfg->rss_tuple_sets.ipv4_tcp_en = - HCLGEVF_RSS_INPUT_TUPLE_OTHER; - rss_cfg->rss_tuple_sets.ipv4_udp_en = - HCLGEVF_RSS_INPUT_TUPLE_OTHER; - rss_cfg->rss_tuple_sets.ipv4_sctp_en = - HCLGEVF_RSS_INPUT_TUPLE_SCTP; - rss_cfg->rss_tuple_sets.ipv4_fragment_en = - HCLGEVF_RSS_INPUT_TUPLE_OTHER; - rss_cfg->rss_tuple_sets.ipv6_tcp_en = - HCLGEVF_RSS_INPUT_TUPLE_OTHER; - rss_cfg->rss_tuple_sets.ipv6_udp_en = - HCLGEVF_RSS_INPUT_TUPLE_OTHER; - rss_cfg->rss_tuple_sets.ipv6_sctp_en = - HCLGEVF_RSS_INPUT_TUPLE_SCTP; - rss_cfg->rss_tuple_sets.ipv6_fragment_en = - HCLGEVF_RSS_INPUT_TUPLE_OTHER; - ret = hclgevf_set_rss_input_tuple(hdev, rss_cfg); if (ret) return ret; } - /* Initialize RSS indirect table */ - for (i = 0; i < HCLGEVF_RSS_IND_TBL_SIZE; i++) - rss_cfg->rss_indirection_tbl[i] = i % rss_cfg->rss_size; - ret = hclgevf_set_rss_indir_table(hdev); if (ret) return ret; @@ -2764,6 +2765,7 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev) goto err_config; /* Initialize RSS for this VF */ + hclgevf_rss_init_cfg(hdev); ret = hclgevf_rss_init_hw(hdev); if (ret) { dev_err(&hdev->pdev->dev, @@ -2936,6 +2938,8 @@ static int hclgevf_set_channels(struct hnae3_handle *handle, u32 new_tqps_num, for (i = 0; i < HCLGEVF_RSS_IND_TBL_SIZE; i++) rss_indir[i] = i % kinfo->rss_size; + hdev->rss_cfg.rss_size = kinfo->rss_size; + ret = hclgevf_set_rss(handle, rss_indir, NULL, 0); if (ret) dev_err(&hdev->pdev->dev, "set rss indir table fail, ret=%d\n", -- 2.7.4