From patchwork Wed Oct 10 19:05:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 148578 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1228121lji; Wed, 10 Oct 2018 12:06:23 -0700 (PDT) X-Google-Smtp-Source: ACcGV63TzvgwVHihsCVrj8LkTK3WsA+1xTe1XFtjI2ayoRdxzzM+B56zKqdHB317pEOjxBmWJpmK X-Received: by 2002:a17:902:9a0c:: with SMTP id v12-v6mr34248293plp.159.1539198382943; Wed, 10 Oct 2018 12:06:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539198382; cv=none; d=google.com; s=arc-20160816; b=dqRStcA+aZSCWgw+5WwUAM/YOoYY8/fs9M8+XqgVhzwFR5JGaj6Ftt6ag9UdTpMQgk FmSUQp+7YNdkecNOuIsrd6OEIGV6YIIHYc8yOhFkMLk0FXqP3OpDwxG0PRnBQQ9eRgfw Aj1esM7DBP7ZJgmNH4c2Sx0Xkrh+QLccaU1jceiX14IMsR/I42bpGC9G+g8bxU1bx8zW Pkpcmt2+MY6RmPFyKOd1TkH/I7Pl4zdXQpJ9PyW6AZWAPvJ1XGMOUBwBzamKxePIqTh8 EZflJRY73frevU2frrsFtrxQGrLVbOAkcEqEXL9ROP+GciE6rPhUlWrzwK9bf4uPXl8l MXhg== 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=x4pbnoXcmRvLnjDywO6Pmy0aTLlN7qMw8nixVp8l79AWDZNr/fOqSVTYkwgsDxshCX NT93tXUw3/lVKnZzzUWVtYMeGrGLZjldDRenmU4eICfWlWX8NRKyp+fA5YlbZ4w6dLdX zkMAiUbnBMxJ0mYDcxe28TLzmUGdbd+r8FzPIZFUFEqdMwiWD2MApPlYpzRaIDkaAGOR D2fRID/7hBuraweTxWqkY2DOJ95354xW88geDeVwoOrGnV9Q5jqxBpaE3ORlnE+ReVjM V5IUlofl1s7c8YPob3OL0HwSmC7Pk4QlO3O1x5YTg15f2UTfIlDfBM5uwz5mod0kT1Zh Po/g== 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 h17-v6si19468112pfi.84.2018.10.10.12.06.22; Wed, 10 Oct 2018 12:06:22 -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 S1727484AbeJKC3u (ORCPT + 10 others); Wed, 10 Oct 2018 22:29:50 -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 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: 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(-) -- 2.7.4 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;