Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1291154imm; Wed, 10 Oct 2018 12:07:11 -0700 (PDT) X-Google-Smtp-Source: ACcGV63sGKMIrvUbGF76DKFTNXlNaLecD3Mwbamhv5vrq4CsIEqPELHVFhTUSJTZlJFYHEwEcxBc X-Received: by 2002:a17:902:bc8c:: with SMTP id bb12-v6mr33400189plb.275.1539198431434; Wed, 10 Oct 2018 12:07:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539198431; cv=none; d=google.com; s=arc-20160816; b=gYuYs0sI5rvSvcAE8313y/RkFpioiZmzwIzApYn3pJaU8NY2XUsdbH/W9C1vd6MeLY 508zn4+0lJeGMOTym5V4pgVxxfkt1p1EwX4vURK1J1Y35r2kWGaG1TR5AJyt7/qL9nx6 4d/c9t0pWx7XtRYlyLrFszHvkbO55KkDT5CFXpz6HOrJ6S1agb81npu/qF8NQtzT50Tv FuainEnsDKL0Nmliekr89sI8CpHzpPy4fbLQjfxx6WFpZ4qyjoccIxk9FbjR1FWFVkG2 S52BbAJ3Tv8ftdYO1hEtT5mRIIg+O8oT6ffV9O611cnyF6rRDDqH6D2TFMwMo+CBBprf JYzQ== 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=W92XkiHhqDST+OVvtSNfL+7L0ZO4pCgALeovJZy+9bA=; b=lAZfSdLiQKqUS71pWHzw2hRmxUbfZXmUnayIxVr93UsZlFnRcjmEsod7RBde7XgiOe oDhKhBUxVuVn/RzaNfBTNS2ZWwg2IUE2IIubyJFNBsyQUKhlGMQOav3wLMPx7OYg9jFo yni+hq8jNPajrbcSD9jDWEvvMj/buk42CxFH45caM1rSdDsWU4GTdbBCNY+KZX15RLP6 yINH84vjnxOdi8btO+pb0V8mrNwI+h7O74oDugaooN4HwO3tSVsgwYr81VCEUTg3MxYQ A32l7AluzxZndT2suy1DcgTvVz7u31jzzm1OcmFDZnKsF1ufZqx3th4d30ATHX2imCfw nYLw== 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 q16-v6si1805337pgb.266.2018.10.10.12.06.56; Wed, 10 Oct 2018 12:07: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 S1727523AbeJKC3v (ORCPT + 99 others); Wed, 10 Oct 2018 22:29:51 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:13614 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727101AbeJKC3u (ORCPT ); Wed, 10 Oct 2018 22:29:50 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id D96307A8579DB; Thu, 11 Oct 2018 03:06:17 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.399.0; Thu, 11 Oct 2018 03:06:08 +0800 From: Salil Mehta To: CC: , , , , , , , Jian Shen Subject: [PATCH net-next 1/4] net: hns3: Add new RSS hash algorithm support for PF Date: Wed, 10 Oct 2018 20:05:34 +0100 Message-ID: <20181010190537.20972-2-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20181010190537.20972-1-salil.mehta@huawei.com> References: <20181010190537.20972-1-salil.mehta@huawei.com> MIME-Version: 1.0 Content-Type: text/plain 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 This patch adds ETH_RSS_HASH_XOR hash algorithm supports, which is supported by hw revision 0x21. Signed-off-by: Jian Shen Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 9 ++++--- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 31 +++++++++++++++++----- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index 7d79a07..cbf9a65 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -678,12 +678,13 @@ static int hns3_set_rss(struct net_device *netdev, const u32 *indir, if (!h->ae_algo || !h->ae_algo->ops || !h->ae_algo->ops->set_rss) return -EOPNOTSUPP; - /* currently we only support Toeplitz hash */ - if ((hfunc != ETH_RSS_HASH_NO_CHANGE) && (hfunc != ETH_RSS_HASH_TOP)) { - netdev_err(netdev, - "hash func not supported (only Toeplitz hash)\n"); + if ((h->pdev->revision == 0x20 && + hfunc != ETH_RSS_HASH_TOP) || (hfunc != ETH_RSS_HASH_NO_CHANGE && + hfunc != ETH_RSS_HASH_TOP && hfunc != ETH_RSS_HASH_XOR)) { + netdev_err(netdev, "hash func not supported\n"); return -EOPNOTSUPP; } + if (!indir) { netdev_err(netdev, "set rss failed for indir is empty\n"); diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index ca1a936..0c5a053 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -2806,8 +2806,19 @@ static int hclge_get_rss(struct hnae3_handle *handle, u32 *indir, int i; /* Get hash algorithm */ - if (hfunc) - *hfunc = vport->rss_algo; + if (hfunc) { + switch (vport->rss_algo) { + case HCLGE_RSS_HASH_ALGO_TOEPLITZ: + *hfunc = ETH_RSS_HASH_TOP; + break; + case HCLGE_RSS_HASH_ALGO_SIMPLE: + *hfunc = ETH_RSS_HASH_XOR; + break; + default: + *hfunc = ETH_RSS_HASH_UNKNOWN; + break; + } + } /* Get the RSS Key required by the user */ if (key) @@ -2831,12 +2842,20 @@ static int hclge_set_rss(struct hnae3_handle *handle, const u32 *indir, /* Set the RSS Hash Key if specififed by the user */ if (key) { - - if (hfunc == ETH_RSS_HASH_TOP || - hfunc == ETH_RSS_HASH_NO_CHANGE) + switch (hfunc) { + case ETH_RSS_HASH_TOP: hash_algo = HCLGE_RSS_HASH_ALGO_TOEPLITZ; - else + break; + case ETH_RSS_HASH_XOR: + hash_algo = HCLGE_RSS_HASH_ALGO_SIMPLE; + break; + case ETH_RSS_HASH_NO_CHANGE: + hash_algo = vport->rss_algo; + break; + default: return -EINVAL; + } + ret = hclge_set_rss_algo_key(hdev, hash_algo, key); if (ret) return ret; -- 2.7.4