net/ice: fix RSS lookup table initialization
authorAlvin Zhang <alvinx.zhang@intel.com>
Fri, 8 Jan 2021 07:29:10 +0000 (15:29 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 13 Jan 2021 17:51:58 +0000 (18:51 +0100)
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>
Tested-by: Wei Xie <weix.xie@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/ice/ice_ethdev.c

index 587f485..e2799a8 100644 (file)
@@ -3274,10 +3274,12 @@ ice_dev_configure(struct rte_eth_dev *dev)
        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;