From: Salil Mehta <salil.mehta@huawei.com>
To: <davem@davemloft.net>, <kuba@kernel.org>
Cc: <salil.mehta@huawei.com>, <jesse.brandeburg@intel.com>,
<anthony.l.nguyen@intel.com>, <henry.w.tieman@intel.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linuxarm@huawei.com>, <linuxarm@openeuler.org>
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 [thread overview]
Message-ID: <20210411014530.25060-1-salil.mehta@huawei.com> (raw)
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 <salil.mehta@huawei.com>
---
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
next reply other threads:[~2021-04-11 1:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-11 1:45 Salil Mehta [this message]
2021-04-12 22:40 ` Nguyen, Anthony L
2021-04-13 8:25 ` Salil Mehta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210411014530.25060-1-salil.mehta@huawei.com \
--to=salil.mehta@huawei.com \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=henry.w.tieman@intel.com \
--cc=jesse.brandeburg@intel.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=linuxarm@openeuler.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®