netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] ice: Re-organizes reqstd/avail {R,T}XQ check/code for efficiency+readability
@ 2021-04-11  1:45 Salil Mehta
  2021-04-12 22:40 ` Nguyen, Anthony L
  0 siblings, 1 reply; 3+ messages in thread
From: Salil Mehta @ 2021-04-11  1:45 UTC (permalink / raw)
  To: davem, kuba
  Cc: salil.mehta, jesse.brandeburg, anthony.l.nguyen, henry.w.tieman,
	netdev, linux-kernel, linuxarm, linuxarm

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] ice: Re-organizes reqstd/avail {R,T}XQ check/code for efficiency+readability
  2021-04-11  1:45 [PATCH net] ice: Re-organizes reqstd/avail {R,T}XQ check/code for efficiency+readability Salil Mehta
@ 2021-04-12 22:40 ` Nguyen, Anthony L
  2021-04-13  8:25   ` Salil Mehta
  0 siblings, 1 reply; 3+ messages in thread
From: Nguyen, Anthony L @ 2021-04-12 22:40 UTC (permalink / raw)
  To: davem, kuba, salil.mehta
  Cc: netdev, linux-kernel, Brandeburg, Jesse, linuxarm, Tieman,
	Henry W, linuxarm

On Sun, 2021-04-11 at 02:45 +0100, Salil Mehta wrote:
> 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 

s/overriden/overridden

> 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.

The changes themselves look ok, but there are some checkpatch issues.
Also, could you include intel-wired-lan@lists.osuosl.org

> 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")

This commit id doesn't exist.

> 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());

Alignment is incorrect.

>  		}
>  
>  		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(p
> f),
> -					      (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_coun
> t(pf),
> +						 (u16)num_online_cpus()

Same, alignment is incorrect.

> );
>  			}
>  		}
>  

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH net] ice: Re-organizes reqstd/avail {R,T}XQ check/code for efficiency+readability
  2021-04-12 22:40 ` Nguyen, Anthony L
@ 2021-04-13  8:25   ` Salil Mehta
  0 siblings, 0 replies; 3+ messages in thread
From: Salil Mehta @ 2021-04-13  8:25 UTC (permalink / raw)
  To: Nguyen, Anthony L, davem, kuba
  Cc: netdev, linux-kernel, Brandeburg, Jesse, linuxarm, Tieman,
	Henry W, intel-wired-lan, Linuxarm

Hi Anthony,
Thanks for reviewing!

> From: Nguyen, Anthony L [mailto:anthony.l.nguyen@intel.com]
> Sent: Monday, April 12, 2021 11:41 PM
> To: davem@davemloft.net; kuba@kernel.org; Salil Mehta <salil.mehta@huawei.com>
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Brandeburg, Jesse
> <jesse.brandeburg@intel.com>; linuxarm@openeuler.org; Tieman, Henry W
> <henry.w.tieman@intel.com>; Linuxarm <linuxarm@huawei.com>
> Subject: Re: [PATCH net] ice: Re-organizes reqstd/avail {R,T}XQ check/code for
> efficiency+readability
> 
> On Sun, 2021-04-11 at 02:45 +0100, Salil Mehta wrote:
> > 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
> 
> s/overriden/overridden

Ok.

> 
> > 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.
> 
> The changes themselves look ok, but there are some checkpatch issues.
> Also, could you include intel-wired-lan@lists.osuosl.org

Sure. will fix them.

> 
> > 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")
> 
> This commit id doesn't exist.

Will fix. Sorry about this.

> 
> > 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());
> 
> Alignment is incorrect.

Ok. Will check, perhaps the cause of the checkpatch.pl errors.

> 
> >  		}
> >
> >  		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(p
> > f),
> > -					      (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_coun
> > t(pf),
> > +						 (u16)num_online_cpus()
> 
> Same, alignment is incorrect.

Ok. Will fix.

Thanks
Salil.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-13  8:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-11  1:45 [PATCH net] ice: Re-organizes reqstd/avail {R,T}XQ check/code for efficiency+readability Salil Mehta
2021-04-12 22:40 ` Nguyen, Anthony L
2021-04-13  8:25   ` Salil Mehta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).