net/ice: fix crash with wrong package
authorSimei Su <simei.su@intel.com>
Thu, 7 Nov 2019 05:47:03 +0000 (13:47 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 20 Nov 2019 16:36:05 +0000 (17:36 +0100)
This patch fixes core dump issue when entering safe mode with a
wrong ice.pkg. In safe mode, rte_flow is not supported and it
won't initialize any flow engine.

Fixes: 7615a6895009 ("net/ice: rework for generic flow enabling")

Signed-off-by: Simei Su <simei.su@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/ice/ice_ethdev.c

index 3b20ea4..7fd4bfe 100644 (file)
@@ -2242,10 +2242,12 @@ ice_dev_init(struct rte_eth_dev *dev)
        /* get base queue pairs index  in the device */
        ice_base_queue_get(pf);
 
-       ret = ice_flow_init(ad);
-       if (ret) {
-               PMD_INIT_LOG(ERR, "Failed to initialize flow");
-               return ret;
+       if (!ad->is_safe_mode) {
+               ret = ice_flow_init(ad);
+               if (ret) {
+                       PMD_INIT_LOG(ERR, "Failed to initialize flow");
+                       return ret;
+               }
        }
 
        ret = ice_reset_fxp_resource(hw);
@@ -2392,7 +2394,8 @@ ice_dev_close(struct rte_eth_dev *dev)
 
        ice_dev_stop(dev);
 
-       ice_flow_uninit(ad);
+       if (!ad->is_safe_mode)
+               ice_flow_uninit(ad);
 
        /* release all queue resource */
        ice_free_queues(dev);