Skip to content

Commit

Permalink
net/ixgbe: check filter init failure
Browse files Browse the repository at this point in the history
[ upstream commit 8c1e5c658c24553d5f813adc8afed8910e6f5194 ]

The function ixgbe_fdir_filter_init() and ixgbe_l2_tn_filter_init()
could return errors, the return value need to be checked and returned.

Fixes: 080e3c0 ("net/ixgbe: store flow director filter")
Fixes: d0c0c41 ("net/ixgbe: store L2 tunnel filter")

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
  • Loading branch information
wyjwang authored and cpaelzer committed Feb 25, 2022
1 parent 04768ea commit 9ec546f
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions drivers/net/ixgbe/ixgbe_ethdev.c
Expand Up @@ -1277,13 +1277,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)

/* initialize PF if max_vfs not zero */
ret = ixgbe_pf_host_init(eth_dev);
if (ret) {
rte_free(eth_dev->data->mac_addrs);
eth_dev->data->mac_addrs = NULL;
rte_free(eth_dev->data->hash_mac_addrs);
eth_dev->data->hash_mac_addrs = NULL;
return ret;
}
if (ret)
goto err_pf_host_init;

ctrl_ext = IXGBE_READ_REG(hw, IXGBE_CTRL_EXT);
/* let hardware know driver is loaded */
Expand Down Expand Up @@ -1322,10 +1317,14 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)
TAILQ_INIT(&filter_info->fivetuple_list);

/* initialize flow director filter list & hash */
ixgbe_fdir_filter_init(eth_dev);
ret = ixgbe_fdir_filter_init(eth_dev);
if (ret)
goto err_fdir_filter_init;

/* initialize l2 tunnel filter list & hash */
ixgbe_l2_tn_filter_init(eth_dev);
ret = ixgbe_l2_tn_filter_init(eth_dev);
if (ret)
goto err_l2_tn_filter_init;

/* initialize flow filter lists */
ixgbe_filterlist_init();
Expand All @@ -1337,6 +1336,21 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)
ixgbe_tm_conf_init(eth_dev);

return 0;

err_l2_tn_filter_init:
ixgbe_fdir_filter_uninit(eth_dev);
err_fdir_filter_init:
ixgbe_disable_intr(hw);
rte_intr_disable(intr_handle);
rte_intr_callback_unregister(intr_handle,
ixgbe_dev_interrupt_handler, eth_dev);
ixgbe_pf_host_uninit(eth_dev);
err_pf_host_init:
rte_free(eth_dev->data->mac_addrs);
eth_dev->data->mac_addrs = NULL;
rte_free(eth_dev->data->hash_mac_addrs);
eth_dev->data->hash_mac_addrs = NULL;
return ret;
}

static int
Expand Down

0 comments on commit 9ec546f

Please sign in to comment.