net/ice: fix initialization of RSS look-up table

Message ID 20210108072910.11184-1-alvinx.zhang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series net/ice: fix initialization of RSS look-up table |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS

Commit Message

Alvin Zhang Jan. 8, 2021, 7:29 a.m. UTC
  From: Alvin Zhang <alvinx.zhang@intel.com>

RSS look-up table initialization is done incorrectly due to divide-by-zero
error.
Add a check to rx-queue count.

Fixes: 50370662b727 ("net/ice: support device and queue ops")
Cc: stable@dpdk.org

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
  

Comments

Xie, WeiX Jan. 12, 2021, 2:25 a.m. UTC | #1
Tested-by:  Xie,WeiX < weix.xie@intel.com>

Regards,
Xie Wei


> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Zhang,Alvin
> Sent: Friday, January 8, 2021 3:29 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>;
> stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/ice: fix initialization of RSS look-up table
> 
> From: Alvin Zhang <alvinx.zhang@intel.com>
> 
> RSS look-up table initialization is done incorrectly due to divide-by-zero error.
> Add a check to rx-queue count.
> 
> Fixes: 50370662b727 ("net/ice: support device and queue ops")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
> ---
>  drivers/net/ice/ice_ethdev.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
> index 9a5d6a5..9cef73e 100644
> --- a/drivers/net/ice/ice_ethdev.c
> +++ b/drivers/net/ice/ice_ethdev.c
> @@ -3268,10 +3268,12 @@ static int ice_init_rss(struct ice_pf *pf)
>  	if (dev->data->dev_conf.rxmode.mq_mode &
> ETH_MQ_RX_RSS_FLAG)
>  		dev->data->dev_conf.rxmode.offloads |=
> DEV_RX_OFFLOAD_RSS_HASH;
> 
> -	ret = ice_init_rss(pf);
> -	if (ret) {
> -		PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
> -		return ret;
> +	if (dev->data->nb_rx_queues) {
> +		ret = ice_init_rss(pf);
> +		if (ret) {
> +			PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
> +			return ret;
> +		}
>  	}
> 
>  	return 0;
> --
> 1.8.3.1
  
Qi Zhang Jan. 12, 2021, 4:56 a.m. UTC | #2
> -----Original Message-----
> From: Xie, WeiX <weix.xie@intel.com>
> Sent: Tuesday, January 12, 2021 10:25 AM
> To: Zhang, AlvinX <alvinx.zhang@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>; stable@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH] net/ice: fix initialization of RSS look-up table
> 
> Tested-by:  Xie,WeiX < weix.xie@intel.com>
> 
> Regards,
> Xie Wei
> 
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Zhang,Alvin
> > Sent: Friday, January 8, 2021 3:29 PM
> > To: Zhang, Qi Z <qi.z.zhang@intel.com>
> > Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>;
> > stable@dpdk.org
> > Subject: [dpdk-dev] [PATCH] net/ice: fix initialization of RSS look-up
> > table
> >
> > From: Alvin Zhang <alvinx.zhang@intel.com>
> >
> > RSS look-up table initialization is done incorrectly due to divide-by-zero error.
> > Add a check to rx-queue count.
> >
> > Fixes: 50370662b727 ("net/ice: support device and queue ops")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
  

Patch

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 9a5d6a5..9cef73e 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -3268,10 +3268,12 @@  static int ice_init_rss(struct ice_pf *pf)
 	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
 		dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
 
-	ret = ice_init_rss(pf);
-	if (ret) {
-		PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
-		return ret;
+	if (dev->data->nb_rx_queues) {
+		ret = ice_init_rss(pf);
+		if (ret) {
+			PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
+			return ret;
+		}
 	}
 
 	return 0;