From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63523C55185 for ; Thu, 23 Apr 2020 00:39:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3AD8C2076C for ; Thu, 23 Apr 2020 00:39:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587602385; bh=OkG6PTaBw8gw2N0RBzpFps9AGXfW9KSNJXHczq2HhYg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=dp2zyIRUt7h5qvII/VYrDkMAscntv1NSwrIbWDYY2GHUXHKWlMpiKJuDaBG4BPRfC W842XIGVWjDG8T5VocrHEN6h4doHrosTJGJ01ZG1OvIFwECeyO59EVouI5d8JRMSIR W7dg3pPHpQcOnT9Njfov03/EapAK75PVOD6cD9Bw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726472AbgDWAjo (ORCPT ); Wed, 22 Apr 2020 20:39:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:47570 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726112AbgDWAjn (ORCPT ); Wed, 22 Apr 2020 20:39:43 -0400 Received: from kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com (unknown [163.114.132.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0FCC620776; Thu, 23 Apr 2020 00:39:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587602383; bh=OkG6PTaBw8gw2N0RBzpFps9AGXfW9KSNJXHczq2HhYg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=uG5f0kOraF0CoZwloXwMygG2CnEaxrB0BRCmOM2VW4M53PIP0o+9ExFwFLuYEALuf 9l5+NHV9l7/OEiOZR7H6xaeIq2aQhmnL06+x7EGDwCINtxSX5u6OOlCpBYTuiyGrPI L9YfsK2Av7RpI40Ph26s7FZBNPKpwy0Ua5wAy3fE= Date: Wed, 22 Apr 2020 17:39:41 -0700 From: Jakub Kicinski To: Cc: , , Arthur Kiyanovski , , , , , , , , , , , , Subject: Re: [PATCH V1 net-next 02/13] net: ena: avoid unnecessary admin command when RSS function set fails Message-ID: <20200422173941.5d43c2df@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <20200422081628.8103-3-sameehj@amazon.com> References: <20200422081628.8103-1-sameehj@amazon.com> <20200422081628.8103-3-sameehj@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, 22 Apr 2020 08:16:17 +0000 sameehj@amazon.com wrote: > From: Arthur Kiyanovski > > Currently when ena_set_hash_function() fails the hash function is > restored to the previous value by calling an admin command to get > the hash function from the device. I don't see how. func argument is NULL. If I'm reading the code right if this function is restoring anything it's restoring the rss key. > In this commit we avoid the admin command, by saving the previous > hash function before calling ena_set_hash_function() and using this > previous value to restore the hash function in case of failure of > ena_set_hash_function(). > > Signed-off-by: Sameeh Jubran > Signed-off-by: Arthur Kiyanovski > --- > drivers/net/ethernet/amazon/ena/ena_com.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c > index 07b0f396d3c2..66edc86c41c9 100644 > --- a/drivers/net/ethernet/amazon/ena/ena_com.c > +++ b/drivers/net/ethernet/amazon/ena/ena_com.c > @@ -2286,6 +2286,7 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev, > struct ena_admin_get_feat_resp get_resp; > struct ena_admin_feature_rss_flow_hash_control *hash_key = > rss->hash_key; > + enum ena_admin_hash_functions old_func; > int rc; > > /* Make sure size is a mult of DWs */ > @@ -2325,12 +2326,13 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev, > return -EINVAL; > } > > + old_func = rss->hash_func; > rss->hash_func = func; > rc = ena_com_set_hash_function(ena_dev); > > /* Restore the old function */ > if (unlikely(rc)) > - ena_com_get_hash_function(ena_dev, NULL, NULL); > + rss->hash_func = old_func; Please order your commits correctly. > return rc; > }