Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3250396pxb; Wed, 14 Apr 2021 00:25:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyA3SuoSB6ycksWdIYqSXFpqWfp8JrE0xwxJLbU5W2OI8t8NDpJHg52n7kkqrC1JxqkTnId X-Received: by 2002:a63:d61:: with SMTP id 33mr36791583pgn.201.1618385126674; Wed, 14 Apr 2021 00:25:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618385126; cv=none; d=google.com; s=arc-20160816; b=GR2dquqG6Hc97fAeP+6hkrx9nUfrplUDnhr2bhsnlq61SGb9bIWtB9wODdPu8kDalV m0RW4+SYQY3ytv70H5isBHAktNyknFDsn5L8IlOAWdLRfYcaRP/BDmLrGP1O8P7dYQ2w FjoEbrFAiAkeGfjkMmJcYTXirajEi5KDlz9dthU/vPCmVZAFPizuUZ5/LbDBHRLN76oO 8sL7KjxavqM8lLCoh1JBDBYQCgHa2M2fSPZHlcEiKrh6GDW+LnhTZVxuBT77+CFSU2DR Fj8O8vFtaOHlvdH66bywspAIfM3E9QJfexzlgqe503FKfpWyh2taVz3f5WB0qx7L8q6J mGGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=xGV13BrryN3JK/EqogzQj1haxFRbcoqPBgs/HzNgIQU=; b=p+0Mm7ng8BiQAC2K/i+fLXhbO/d057Bk8kTHNA43NxBUYoJ9A67Lb8WVsGS/maEdE3 +2zOxN7QoF66RW5KN+6X5uM2f6/3/GcccQLHNbiazIfi2TpGl/gllqAvRMjTfBk3fd0X xCo6G5aq+Oub+7rTvH2sJhaVHmu2sC9muWiz5nZ7jK7O6cwBbSmaTnSI/JwZMNAYTBei /2MT9DiAwTKeblPR33KtSXfy1q38gO0/ilKc6+BytcF1FJb47azMJn1Gngp8c5Ji98N2 r8l1SIIsxByjkyve12Yc+XMI+Wna//RYTFoV4scIfQ09CiCrFBqHtb6o4WrL9VKc85Yr wSUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m6si19703685pfd.292.2021.04.14.00.25.13; Wed, 14 Apr 2021 00:25:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348660AbhDMWpd (ORCPT + 99 others); Tue, 13 Apr 2021 18:45:33 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:16583 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348641AbhDMWpc (ORCPT ); Tue, 13 Apr 2021 18:45:32 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4FKgbx4fTMz18JCT; Wed, 14 Apr 2021 06:42:53 +0800 (CST) Received: from A190218597.china.huawei.com (10.47.70.201) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.498.0; Wed, 14 Apr 2021 06:45:03 +0800 From: Salil Mehta To: , CC: , , , , , , , , , Jeff Kirsher Subject: [PATCH V2 net] ice: Re-organizes reqstd/avail {R,T}XQ check/code for efficiency+readability Date: Tue, 13 Apr 2021 23:44:46 +0100 Message-ID: <20210413224446.16612-1-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.47.70.201] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If user has explicitly requested the number of {R,T}XQs, then it is unnecessary to get the count of already available {R,T}XQs from the PF avail_{r,t}xqs bitmap. This value will get overridden by user specified value in any case. This patch does minor re-organization of the code for improving the flow and readabiltiy. This scope of improvement was found during the review of the ICE driver code. FYI, I could not test this change due to unavailability of the hardware. It would be helpful if somebody can test this patch and provide Tested-by Tag. Many thanks! Fixes: 87324e747fde ("ice: Implement ethtool ops for channels") Cc: intel-wired-lan@lists.osuosl.org Cc: Jeff Kirsher Signed-off-by: Salil Mehta -- Change V1->V2 (*) Fixed the comments from Anthony Nguyen(Intel) Link: https://lkml.org/lkml/2021/4/12/1997 --- drivers/net/ethernet/intel/ice/ice_lib.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c index d13c7fc8fb0a..d77133d6baa7 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_lib.c @@ -161,12 +161,13 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi, u16 vf_id) switch (vsi->type) { case ICE_VSI_PF: - vsi->alloc_txq = min3(pf->num_lan_msix, - ice_get_avail_txq_count(pf), - (u16)num_online_cpus()); if (vsi->req_txq) { vsi->alloc_txq = vsi->req_txq; vsi->num_txq = vsi->req_txq; + } else { + vsi->alloc_txq = min3(pf->num_lan_msix, + ice_get_avail_txq_count(pf), + (u16)num_online_cpus()); } pf->num_lan_tx = vsi->alloc_txq; @@ -175,12 +176,13 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi, u16 vf_id) if (!test_bit(ICE_FLAG_RSS_ENA, pf->flags)) { vsi->alloc_rxq = 1; } else { - vsi->alloc_rxq = min3(pf->num_lan_msix, - ice_get_avail_rxq_count(pf), - (u16)num_online_cpus()); if (vsi->req_rxq) { vsi->alloc_rxq = vsi->req_rxq; vsi->num_rxq = vsi->req_rxq; + } else { + vsi->alloc_rxq = min3(pf->num_lan_msix, + ice_get_avail_rxq_count(pf), + (u16)num_online_cpus()); } } -- 2.17.1