From patchwork Tue Apr 13 22:44:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 420247 Delivered-To: patch@linaro.org Received: by 2002:a02:c4d2:0:0:0:0:0 with SMTP id h18csp3025771jaj; Tue, 13 Apr 2021 15:45:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUOgwtgtiXV6Y9Yh2FUW0gd2kxkh0rpB+0wYYmp5KstAOx8+aeNZ+NPpuWfWaIyuRVwI+D X-Received: by 2002:a17:906:7118:: with SMTP id x24mr10064221ejj.127.1618353914890; Tue, 13 Apr 2021 15:45:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618353914; cv=none; d=google.com; s=arc-20160816; b=wJb8K3BNo8pCqNhMKVNIROud3xSoXxu8/efp4BohHk1iCH8rwxSOng39N4f3nEa6lZ w+A5Pi2zfMBLguyIaDGgwtDMtSty65gpP0Cr0Lxr85vPyz/rR/QscGtY7pFjoMYTUxGT vCtJEkXyir7998qtL5mK/a93sOkSNEM2yGO1g9aJjI3vVXCezR/XW/N98Jj8lwnxUEZs 7Naj25uSV8w6K6YOkmBrdRZGq1sGVaGJfzHsEPMIUFCvsngtppp9HAanvObgLfBU8UOy SWfBlAnD8xtgzrnuu73l+yErE2iEx7U0FDY2dJQdryngN02QpBpUVKeqAMCPSF59NMZP okRA== 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=dqWd6+2iS74VBWRZOM7Y2tJkm6zB2V7j1ZpmP6vGcKt81tG072malQHQvZReBUZqBp w9A++TtIAjoycqEigc9IWm9ofWGQ0mFFHDj3NniySfbz1GVY49x6dt8OS0wq9SFeTNS7 0+gyg7g5Iaq2j68tcCORuW1a6Jgnz4G/Adlc8JYrsfgZwxFAFOmftC+cY7X6UaHXgSvx bWMINvm9/9GT8YBZ/TH0MUdPEn/dsD4X+snxfsSFlKLvGSz0QWAnogT0dgDTGloAJ5eG ShH6VuC6J0pKFEUdSMPY6zLazK6AJn6ORUrHOKw/N0Z1SiI6AYfvsDAHPnfOgR5+25pR Si4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 y2si11442708edu.245.2021.04.13.15.45.14; Tue, 13 Apr 2021 15:45:14 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-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 netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 S1348663AbhDMWpd (ORCPT + 8 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 X-Originating-IP: [10.47.70.201] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: netdev@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(-) -- 2.17.1 Tested-by: Tony Brelinski (A Contingent Worker at Intel) 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()); } }