Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp759635pxb; Sat, 10 Apr 2021 19:00:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbS9zhbhXA0SK3f0jAg11yVaRPauavQFoEu9c9H8V8FigP+dBr5pcfeLN95qRKun7edaZO X-Received: by 2002:a17:906:860c:: with SMTP id o12mr20197196ejx.259.1618106454293; Sat, 10 Apr 2021 19:00:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618106454; cv=none; d=google.com; s=arc-20160816; b=BSWhaSf/FB8jlcMo3/GMMhZz0pTsue8N0hhN9+ynm33UwqF/wsMjw0+4vM0plWUqtv qrDpagTRYBSFgtC/MKoTFK3Q3dXMYEAyPjesTOhfCKgDnSIMoOYnqCFi+agUVjrHu/n4 QOeShrQ4LMuszAzYy/wwXqMrECeoGSGv6rHVNzyrjFdezFiKQa6S31c0EXKp/oDuEMAC ioD3YUuD6GjiNUq8kjl1tuYJh9yiGq11Srl/9kf8reLNom7K3A7oWgoH6Yz1WIkmBh3a 3lzWffuE2ZBKgmK8SiZh36E7JJnLYQ6kJPZE3ZXP2pR8TftNiv2nBy9stTN89RVKu7Nn 53Gg== 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=AY2y9L91Lv7EC5ovvFGpXgLRrERWCPJa5Z3hgioCSE4=; b=M/7CFP/S71nFQ21OC0T2WOYflLYsDnVQ2Zk6WRS8vOHIobxh+j4ynUtZUoMIHTrppw /AwUEzkSA91SziLTIO+F0WPrvn9li3ZULX/GQA9FxvjV3VkDhXK+8Y9bPHlSFMdLYE6E 0jFd6Ec6cFV4dAxHc9F1hsvUCWT4skETkBAfCD0weGDCuqv6S321+dG9+KEZB7RcpMF8 5odlf7N4Tx2DlUORbh9JoMChAomRIKtZb3Q8xLinL0VCSu1Qcq+He0AwiVNh0gauRYdG B07H5/u5TZG2LmHsREhT/gtmVHetBPbolEfBaTRhJp0vYQbm8cEmJbjV3BWpI1sMnir3 Yvzw== 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 h15si4944534edb.566.2021.04.10.19.00.01; Sat, 10 Apr 2021 19:00:54 -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 S235020AbhDKBr3 (ORCPT + 99 others); Sat, 10 Apr 2021 21:47:29 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:16519 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234983AbhDKBr2 (ORCPT ); Sat, 10 Apr 2021 21:47:28 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FHvmj0YF1zPptN; Sun, 11 Apr 2021 09:44:21 +0800 (CST) Received: from A190218597.china.huawei.com (10.47.74.167) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.498.0; Sun, 11 Apr 2021 09:47:03 +0800 From: Salil Mehta To: , CC: , , , , , , , Subject: [PATCH net] ice: Re-organizes reqstd/avail {R,T}XQ check/code for efficiency+readability Date: Sun, 11 Apr 2021 02:45:30 +0100 Message-ID: <20210411014530.25060-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.74.167] 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 overriden 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 helpful if somebody can test this and provide Tested-by Tag. Many thanks! Fixes: 11b7551e096d ("ice: Implement ethtool ops for channels") Signed-off-by: Salil Mehta --- 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..161e8dfe548c 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