From 6410b1d993acfcb229f5ba0df930b4e20703e4ad Mon Sep 17 00:00:00 2001 From: Simei Su Date: Thu, 7 Nov 2019 13:47:03 +0800 Subject: [PATCH] net/ice: fix crash with wrong package 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 Acked-by: Qi Zhang --- drivers/net/ice/ice_ethdev.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 3b20ea4238..7fd4bfe082 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -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); -- 2.20.1