From patchwork Fri Apr 23 00:00:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 425974 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp817636jao; Thu, 22 Apr 2021 17:01:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOdhF42YJsIiQqW9gOWWNhmHVZJ6TThfcVky0fA6wiRpsly8hmpWfhQaLsvR/Q/9sXeXs5 X-Received: by 2002:a17:902:4c:b029:ec:a39a:41ad with SMTP id 70-20020a170902004cb02900eca39a41admr1335403pla.52.1619136070234; Thu, 22 Apr 2021 17:01:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619136070; cv=none; d=google.com; s=arc-20160816; b=K9xp7wt6VOF72lzWeOvqChmtt76KqttnOZbLfMo+D0wPXAbEYX8RRvxDGzRzqvWhNO YKqFT5R6Ab/bJB8UYmAyZC7NqtQFjT+xDkO6QGSy5ZD9pAW+mj3NtspAEScPH2aEg85x V9xezLbmA225K462o1kn5qO/QeeKRNj1TikNhPX4PPcGkenUYCZfLwsHUNVgiA+Y6YZf 5q8YBNjYJKTgWJRfmMOjnKtaNUCVZUfGq1mSnlrbqf8eQwF5371nnYA9rcDVWDZTmGxl aoCHLPnN7sF95wpF7GXPnTLM6UNssjQMxc+qxllLxnaUZf/hF5aS1sCzGQE96+m3R6ZT bVYQ== 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=t8dKHGBCmHD9gD0RbJEfB/SuhXgwn7Gf5zPPUk5At7o=; b=rnmM6BrZShkMym0AFK+YcQAeXz28GqovLjRjyxE8yP7NUmeuLfPJBA0H/HRtBH4c/4 mZLMGZWTfH8M4YDYRXKPqgiiY+Ey0RZBj4AkSJT8TKWffi+M9yn54llyMSP5hWotI6Um /OF3AjHFgKmrT3Op53byPIC93E+dFylqwG8sT+QKuTyhing7lqkXQ51hkA7cM6SA8i4n MWMc5sNNnhQutySRtdvEhavxI9UOROacfsGGC6Dh+zrtLjerF7WSjO5AhjlHp260226a Ti5Sx1DuUAKyzlRrOm4Z9O+SYDB9Tng4Cq0YxQBIz2mbGRjJyJE+l2Y0DDIMVBTPLdfw iGUw== 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 t17si4427321pgm.289.2021.04.22.17.01.10; Thu, 22 Apr 2021 17:01:10 -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 S239881AbhDWABo (ORCPT + 8 others); Thu, 22 Apr 2021 20:01:44 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:17391 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235569AbhDWABn (ORCPT ); Thu, 22 Apr 2021 20:01:43 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4FRDsl4mgRzlZ7c; Fri, 23 Apr 2021 07:59:07 +0800 (CST) Received: from A190218597.china.huawei.com (10.47.31.136) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.498.0; Fri, 23 Apr 2021 08:00:56 +0800 From: Salil Mehta To: , CC: , , , , , Subject: [PATCH V3 net] ice: Re-organizes reqstd/avail {R, T}XQ check/code for efficiency Date: Fri, 23 Apr 2021 01:00:18 +0100 Message-ID: <20210423000018.20244-1-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 MIME-Version: 1.0 X-Originating-IP: [10.47.31.136] 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. Re-organize this code for improving the flow, readability and efficiency. This scope of improvement was found during the review of the ICE driver code. Fixes: 87324e747fde ("ice: Implement ethtool ops for channels") Cc: intel-wired-lan@lists.osuosl.org Tested-by: Tony Brelinski Signed-off-by: Salil Mehta --- Change: V2->V3 (*) Addressed some comments from Paul Menzel Link: https://lkml.org/lkml/2021/4/21/136 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()); } }