From patchwork Sun Apr 11 01:45:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 419299 Delivered-To: patch@linaro.org Received: by 2002:a02:c4d2:0:0:0:0:0 with SMTP id h18csp672170jaj; Sat, 10 Apr 2021 18:47:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzNQtZqU+BepgvkEHckq9LLORCGCe9Ce/6NR1UfVPrgG7qTtSmeUg2lJbCfEFLzRwQwa6L X-Received: by 2002:a17:90a:d582:: with SMTP id v2mr1858680pju.88.1618105640836; Sat, 10 Apr 2021 18:47:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618105640; cv=none; d=google.com; s=arc-20160816; b=yY30iFIJrP13epVJs8+q/RCW85syMfGQ+88iUONtGjks3HHbHZ0/99GWqszjZ5NLR3 fglMS8Y0LzPxH7SktVpcvzn/wutlPqKPtEeovegrgF7LnEyI0q/Az37SBLGLKcGCJlHY nqRAfM4y6BROTo8NyJ8aPY/Y900qOzjUWGX7LGZdYMeU4KYqL/+NhGixma68OswNMbcW 2ajPCtr3FOnypL/kBTK4L1CT7MAgPmROhYRHqcamvCgUWNjKpNNmKjJdFdkx30XtRG+R 8VhUsIMF0DRx1DDwtUzgewluIbgSoj4Lf9GKmTrEJNBjH+xfgz9BMHE34Wg44fhuNVLi 0Q6A== 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=diSJFFF5lv5xMUmpRpEV0dWE+OGUHxIVxeVv9OG+S7PC1NVBzCFV3D6WHtW44TKeq1 R5mYhcSdU0X1db5iCaEFb1IAEF9wTQD64NsuwWnjcXhqNnrx9psR5+aGwJiiaBy2pxOt +gOgLOqWRkcM4ffWAoQam8FghohSa7sjQUuhZjPrdcNTdn1Z2R5UJtIMoY0MWf/a9zhW Nbhut8IiLiIbn02L84YxZQuE+HL6p48A31kFimsn7nfbS2JS6zTKnLLoAoAyjh17xz2n zepRIaJMjmXpEP56A5you8A9ed3dT6E2qFjaYJQJXWojtBZcp/cYQKcKeTZgmZpEdgGV 7j6A== 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 z8si8707682plo.315.2021.04.10.18.47.20; Sat, 10 Apr 2021 18:47:20 -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 S235036AbhDKBra (ORCPT + 8 others); Sat, 10 Apr 2021 21:47:30 -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 X-Originating-IP: [10.47.74.167] 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 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(-) -- 2.17.1 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()); } }