Received: by 10.213.65.68 with SMTP id h4csp1720783imn; Mon, 19 Mar 2018 11:24:05 -0700 (PDT) X-Google-Smtp-Source: AG47ELtfkFl4JMHgY64rQwMN/C+TmQbEIHt+776tDV9b+K+umCou85XM6dYUhbh6ujSUWLGnQfFc X-Received: by 2002:a17:902:6bc1:: with SMTP id m1-v6mr13517557plt.303.1521483845160; Mon, 19 Mar 2018 11:24:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521483845; cv=none; d=google.com; s=arc-20160816; b=j4p3SbAJ0rez5GR8em401S5g26OQzUPxPhEYBSkdNtYO9sVHwKt5quAAOFw65qr+1l XzC0mcIKXczCbTvw0bQNQ0n+ev2bb5s/Z6CUalDYmVCLNHBVCftI9R4U+69zONeFpjbE ms8BREi15iCUbbL93/QKBX232hmqSP4Zjg/Jqv7bvna1J+ApxQGcJQpnA5jR7NStx2P2 Xv0KSy/50gBddM7lf7zF9yhg6sztrHUUgz4SXuOWm/oGnpxVoJ0yPi0YZaQ/9tbUF2lv NBhZLnXqMeppXrwB8SmF9qmujCW4rJMB6klHvbk3wz1sCtQwVAKwNDwiLqyAV9V5GNbF avBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Jas5Sog+5XkCobqAjXr6AC9T5w+t/+KLQ72ae0WNzms=; b=TSBCpd+wZCuNCje1D4PsI9AxYRLhrrhE8Db+b+ha2X583KAwykZ7OcRPSNeeDZLvbd IG71W+Cl7V+sOKa/JkdN9JFpcE/GDf+XZBtg4cVL9jUm+ld2GRwBp1TqwGelXQPqeoY3 8FJNGSM70WjZhpqr4CdjJRKJnHJWZ+eOA4pG62gig8k0/N8XDzZ2ZdGHeRY5bqRaIlRl i93JMqZR/AQda6cO+G2syA+67fpj37temR6eWIu/0rD877Ij6l0vGRA6SSkw/YTq0Gap gI6vIfugr/6t2eAT8vwMu5zJGF+PGp4w0pfscvlbp6o60zyhJFLe3HyMmZI1sbptnsPH 2KAg== 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 u10si304678pgr.164.2018.03.19.11.23.50; Mon, 19 Mar 2018 11:24:05 -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 S1031268AbeCSSW0 (ORCPT + 99 others); Mon, 19 Mar 2018 14:22:26 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48506 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031247AbeCSSWU (ORCPT ); Mon, 19 Mar 2018 14:22:20 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id E4D97129B; Mon, 19 Mar 2018 18:22:18 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, lipeng , Yisen Zhuang , Salil Mehta , "David S. Miller" , Sasha Levin Subject: [PATCH 4.9 098/241] net: hns: Correct HNS RSS key set function Date: Mon, 19 Mar 2018 19:06:03 +0100 Message-Id: <20180319180755.252239348@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c | 27 +++++++++++++--------- drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 9 +++---- 2 files changed, 20 insertions(+), 16 deletions(-) --- 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_ha memcpy(key, ppe_cb->rss_key, HNS_PPEV2_RSS_KEY_SIZE); /* 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)); return 0; } @@ -785,15 +786,19 @@ static int hns_ae_set_rss(struct hnae_ha struct hns_ppe_cb *ppe_cb = hns_get_ppe_cb(handle); /* set the RSS Hash Key if specififed by the user */ - if (key) - hns_ppe_set_rss_key(ppe_cb, (u32 *)key); - - /* update the shadow RSS table with user specified qids */ - memcpy(ppe_cb->rss_indir_table, indir, - HNS_PPEV2_RSS_IND_TBL_SIZE * sizeof(*indir)); - - /* now update the hardware */ - hns_ppe_set_indir_table(ppe_cb, ppe_cb->rss_indir_table); + if (key) { + memcpy(ppe_cb->rss_key, key, HNS_PPEV2_RSS_KEY_SIZE); + hns_ppe_set_rss_key(ppe_cb, ppe_cb->rss_key); + } + + 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)); + + /* now update the hardware */ + hns_ppe_set_indir_table(ppe_cb, ppe_cb->rss_indir_table); + } return 0; } --- 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, c { struct hns_nic_priv *priv = netdev_priv(netdev); struct hnae_ae_ops *ops; + int ret; if (AE_IS_VER1(priv->enet_ver)) { netdev_err(netdev, @@ -1252,12 +1253,10 @@ hns_set_rss(struct net_device *netdev, c ops = priv->ae_handle->dev->ops; - /* currently hfunc can only be Toeplitz hash */ - if (key || - (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)) + if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) { + netdev_err(netdev, "Invalid hfunc!\n"); return -EOPNOTSUPP; - if (!indir) - return 0; + } return ops->set_rss(priv->ae_handle, indir, key, hfunc); }