Received: by 10.223.185.116 with SMTP id b49csp1108681wrg; Sat, 3 Mar 2018 15:49:30 -0800 (PST) X-Google-Smtp-Source: AG47ELuqTfg6zdWXvaQqo4+kFXd7mm6cOu8AbXesfZ9I3zdNnkJLXAZMBOPO2oAyox37PHsKQQ/S X-Received: by 10.99.125.92 with SMTP id m28mr8523516pgn.257.1520120970622; Sat, 03 Mar 2018 15:49:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520120970; cv=none; d=google.com; s=arc-20160816; b=WiDsEkRedPMy3U7mys81ewP4Dw3VUUOoxfUKwlKfZvD9JxG4MD5D34R0W1VKUFgYrh 5+uFz6tavAPMAVoGIqQVPT6hvQuxQIQKKgA9EnQQlGNy0e5xSnXZxarCUZ68fB9DFOmU PIESO64JCOzwPd7oFvIP/98MpPbyJfzKC8QgY3b8XGIm19aJl8G5eoHCaIz7PXksweGv XcLB9yXrYCOF21JsgMutdv/oYXz0RGxJz4Srkk5RvHKiAnBf8+7xbpmPAB0E0tPQr647 kiRbPm/q6CC90q5z+I3h8BssjkZEPMQGTJrGgQUP+K0WG1zE5R3XnNmXRFSpeX9i6sMm I7DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=aaUlEqeyEsyvzV2ppzVq0DE/HrB5TYmz1tVxBIozQEg=; b=NXdIbTJ9N4WehlEjFNCiMYg7w5GtaDHE5M+rmAb4cFgbxYQDsOxbExvactchzqZFbM q2vFFBH8rd5lrdDIvqXRpGDwCaRaVvy2/le1IZWpzx/XEi9hC7IhNFkEui8Suvto1e4Z eUV99+8n9L8NZdXvVx+GOsT7s06CRJN0uymIVRRvyB5IWFDJcpHNxedTokrYjWKg6oaL wlm/iz27E/aJ+9+Uz2y6bILiP41CVWakDvLS11MfNRVvVvjZmtp3poy4WUjwSNUa9QIJ mvRFNM5E3gQavoI8z3eTcnOVUamSvMVS5TKoy4JWfjfyvPfikcDvSIhbxZzsSdjsfB7O nmRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=o8TfSgHc; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p14si6178692pgn.333.2018.03.03.15.49.16; Sat, 03 Mar 2018 15:49:30 -0800 (PST) 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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=o8TfSgHc; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752511AbeCCXsl (ORCPT + 99 others); Sat, 3 Mar 2018 18:48:41 -0500 Received: from mail-bn3nam01on0116.outbound.protection.outlook.com ([104.47.33.116]:3173 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934085AbeCCWeA (ORCPT ); Sat, 3 Mar 2018 17:34:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=aaUlEqeyEsyvzV2ppzVq0DE/HrB5TYmz1tVxBIozQEg=; b=o8TfSgHcd5XV4xhDM8Sw0ewavhjAOBxKpSOC6Q/nVwHqrHhfnHJWCI1YDVFyFf/hh0quuPdqMA7ZukHW6RWjr0ZBXS5zbYb0uFCCuyDUZv6mvl2f9W3K3kQjbANyEfKq6tEiFG29NKE+rQ9K2A1iFsnpP7baI5GtakGEwytCkBM= Received: from MW2PR2101MB1034.namprd21.prod.outlook.com (52.132.149.10) by MW2PR2101MB1065.namprd21.prod.outlook.com (52.132.149.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.2; Sat, 3 Mar 2018 22:33:56 +0000 Received: from MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0]) by MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0%3]) with mapi id 15.20.0567.006; Sat, 3 Mar 2018 22:33:56 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: lipeng , Salil Mehta , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 101/219] net: hns: Correct HNS RSS key set function Thread-Topic: [PATCH AUTOSEL for 4.9 101/219] net: hns: Correct HNS RSS key set function Thread-Index: AQHTsz8DgrKMaYQSW0m5rJ1IjsPkuw== Date: Sat, 3 Mar 2018 22:28:54 +0000 Message-ID: <20180303222716.26640-101-alexander.levin@microsoft.com> References: <20180303222716.26640-1-alexander.levin@microsoft.com> In-Reply-To: <20180303222716.26640-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MW2PR2101MB1065;7:DJACzqrsDwsu9+OJMnYWZKCWecnPm5dy44m5EdTmr4MZ+NWrjFKoJkR0jq3ho40q+e3188aPLiKxP9XNZAJd74ZbawCq2vY0JBZJaLgeqvDMxoXhSpKoA8nl/R9zs0W/wwgn+y5f2r1WEBWpeThNkUrKqrFBgTlbQ0a8zKnwSJorjLaJ31yZo8u6hg9s4UGW1hxJyRqtwnlzTo7nCQbyKhryPOLQqUlqkR2w6+/Ys5jbuZn+xJ9wQ8buHhV/zxvW x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: cb5f0701-5c7d-4a0c-97f6-08d58156d9be x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7193020);SRVR:MW2PR2101MB1065; x-ms-traffictypediagnostic: MW2PR2101MB1065: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(50582790962513)(265634631926514); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231220)(944501244)(52105095)(6055026)(61426038)(61427038)(6041288)(20161123558120)(20161123564045)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:MW2PR2101MB1065;BCL:0;PCL:0;RULEID:;SRVR:MW2PR2101MB1065; x-forefront-prvs: 0600F93FE1 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(346002)(376002)(396003)(39380400002)(39860400002)(189003)(199004)(6506007)(22452003)(54906003)(25786009)(186003)(2950100002)(102836004)(5250100002)(2501003)(110136005)(97736004)(316002)(2900100001)(36756003)(76176011)(6436002)(59450400001)(6486002)(26005)(4326008)(99286004)(68736007)(6512007)(6116002)(10090500001)(106356001)(105586002)(478600001)(66066001)(107886003)(3660700001)(305945005)(86612001)(14454004)(81166006)(7736002)(86362001)(575784001)(1076002)(72206003)(2906002)(10290500003)(8676002)(8936002)(81156014)(3846002)(5660300001)(3280700002)(53936002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:MW2PR2101MB1065;H:MW2PR2101MB1034.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: QIpFCA3012mUrgyO21h9snNb2PzPeMp7dGlDYMsYgXA4ElpviH53ddi0cRPUX6QLHlcB5r5CAdo4VjG3azPpXo8Vl9ceoz5G2pupyHyozJ7YEnHPA58pZ45+Ysih+yv7a6+D7a+yVAaU3vsQ32w2fLhrWIJtPXzpypdRHnT2Dw0= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb5f0701-5c7d-4a0c-97f6-08d58156d9be X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2018 22:28:54.2132 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR2101MB1065 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: lipeng [ Upstream commit 64ec10dc2ab8ef5bc6e76b1d4bc8203c08a6da1e ] This patch fixes below ethtool configuration error: localhost:~ # ethtool -X eth0 hkey XX:XX:XX... Cannot set Rx flow hash configuration: Operation not supported Signed-off-by: lipeng Reviewed-by: Yisen Zhuang Signed-off-by: Salil Mehta Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c | 23 ++++++++++++++-----= ---- drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 9 ++++----- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c b/drivers/ne= t/ethernet/hisilicon/hns/hns_ae_adapt.c index 2d0cb609adc3..b7c8433a7a37 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c @@ -773,8 +773,9 @@ static int hns_ae_get_rss(struct hnae_handle *handle, u= 32 *indir, u8 *key, memcpy(key, ppe_cb->rss_key, HNS_PPEV2_RSS_KEY_SIZE); =20 /* update the current hash->queue mappings from the shadow RSS table */ - memcpy(indir, ppe_cb->rss_indir_table, - HNS_PPEV2_RSS_IND_TBL_SIZE * sizeof(*indir)); + if (indir) + memcpy(indir, ppe_cb->rss_indir_table, + HNS_PPEV2_RSS_IND_TBL_SIZE * sizeof(*indir)); =20 return 0; } @@ -785,15 +786,19 @@ static int hns_ae_set_rss(struct hnae_handle *handle,= const u32 *indir, struct hns_ppe_cb *ppe_cb =3D hns_get_ppe_cb(handle); =20 /* set the RSS Hash Key if specififed by the user */ - if (key) - hns_ppe_set_rss_key(ppe_cb, (u32 *)key); + if (key) { + memcpy(ppe_cb->rss_key, key, HNS_PPEV2_RSS_KEY_SIZE); + hns_ppe_set_rss_key(ppe_cb, ppe_cb->rss_key); + } =20 - /* update the shadow RSS table with user specified qids */ - memcpy(ppe_cb->rss_indir_table, indir, - HNS_PPEV2_RSS_IND_TBL_SIZE * sizeof(*indir)); + if (indir) { + /* update the shadow RSS table with user specified qids */ + memcpy(ppe_cb->rss_indir_table, indir, + HNS_PPEV2_RSS_IND_TBL_SIZE * sizeof(*indir)); =20 - /* now update the hardware */ - hns_ppe_set_indir_table(ppe_cb, ppe_cb->rss_indir_table); + /* now update the hardware */ + hns_ppe_set_indir_table(ppe_cb, ppe_cb->rss_indir_table); + } =20 return 0; } diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net= /ethernet/hisilicon/hns/hns_ethtool.c index 87d5c94b2810..8490cba230bd 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c @@ -1243,6 +1243,7 @@ hns_set_rss(struct net_device *netdev, const u32 *ind= ir, const u8 *key, { struct hns_nic_priv *priv =3D netdev_priv(netdev); struct hnae_ae_ops *ops; + int ret; =20 if (AE_IS_VER1(priv->enet_ver)) { netdev_err(netdev, @@ -1252,12 +1253,10 @@ hns_set_rss(struct net_device *netdev, const u32 *i= ndir, const u8 *key, =20 ops =3D priv->ae_handle->dev->ops; =20 - /* currently hfunc can only be Toeplitz hash */ - if (key || - (hfunc !=3D ETH_RSS_HASH_NO_CHANGE && hfunc !=3D ETH_RSS_HASH_TOP)) + if (hfunc !=3D ETH_RSS_HASH_NO_CHANGE && hfunc !=3D ETH_RSS_HASH_TOP) { + netdev_err(netdev, "Invalid hfunc!\n"); return -EOPNOTSUPP; - if (!indir) - return 0; + } =20 return ops->set_rss(priv->ae_handle, indir, key, hfunc); } --=20 2.14.1