net/mlx5: destroy DR domains after ASO close
PATCH 1/1 net/mlx5: destroy DR domains after ASO close
ASO age, meter and connection tracking actions are created in the shared DR domains and released only when the ASO management is closed. That close runs in mlx5_free_shared_dev_ctx(), while the domains are destroyed earlier in mlx5_os_free_shared_dr(). Freeing a domain-bound action after the domain is gone crashes on close.
The domains belong to the shared context, as the ASO managers do. Destroy them in mlx5_free_shared_dev_ctx() after the ASO managers. One port close then cannot drop them while another port still uses the shared context.
Fixes f935ed4b645a ("net/mlx5: support flow hit action for aging")
Fixes c99b4f8bc2f1 ("net/mlx5: support ASO meter action")
Fixes ce12974cce72 ("net/mlx5: fix ASO CT object release")
Suggested-by Matan Azrad <[email protected]>
Signed-off-by Bing Zhao <[email protected]>
--- drivers/net/mlx5/linux/mlx5_os.c | 51 ++++++++++++++++-------------- drivers/net/mlx5/mlx5.c | 6 ++++ drivers/net/mlx5/mlx5.h | 1 + drivers/net/mlx5/windows/mlx5_os.c | 13 ++++++++ 4 files changed, 47 insertions(+), 24 deletions(-)
drivers/net/mlx5/linux/mlx5_os.c +27 -24
@@ -689,18 +689,7 @@ mlx5_alloc_shared_dr(struct rte_eth_dev *eth_dev)return 0 ; error:/* Rollback the created objects. */ -if (sh->rx_domain) { - mlx5_glue->dr_destroy_domain (sh->rx_domain); - sh->rx_domain =NULL ; - } -if (sh->tx_domain) { - mlx5_glue->dr_destroy_domain (sh->tx_domain); - sh->tx_domain =NULL ; - } -if (sh->fdb_domain) { - mlx5_glue->dr_destroy_domain (sh->fdb_domain); - sh->fdb_domain =NULL ; - } +mlx5_os_free_shared_domains (sh);if (sh->dr_drop_action) { mlx5_glue->destroy_flow_action (sh->dr_drop_action); sh->dr_drop_action =NULL ;
@@ -774,6 +763,32 @@ mlx5_destroy_send_to_kernel_action(struct mlx5_dev_ctx_shared *sh) }#endif /* HAVE_MLX5DV_DR */ +/** +* Destroy the shared DR domains. +* +* The domains are per shared context. ASO steering actions are created in +* them, so callers must release those actions before calling this. +* +* @param[in] sh +* Pointer to the shared device context. +*/ +void +mlx5_os_free_shared_domains (struct mlx5_dev_ctx_shared *sh) +{ +if (sh->rx_domain !=NULL ) { +claim_zero (mlx5_glue->dr_destroy_domain (sh->rx_domain)); + sh->rx_domain =NULL ; + } +if (sh->tx_domain !=NULL ) { +claim_zero (mlx5_glue->dr_destroy_domain (sh->tx_domain)); + sh->tx_domain =NULL ; + } +if (sh->fdb_domain !=NULL ) { +claim_zero (mlx5_glue->dr_destroy_domain (sh->fdb_domain)); + sh->fdb_domain =NULL ; + } +} +/** * Destroy DR related data within private structure. *
@@ -801,19 +816,7 @@ mlx5_os_free_shared_dr(struct mlx5_priv *priv)MLX5_ASSERT (LIST_EMPTY (&sh->shared_rxqs)); #ifdef HAVE_MLX5DV_DR mlx5_destroy_send_to_kernel_action(sh); - if (sh->rx_domain) { - mlx5_glue->dr_destroy_domain(sh->rx_domain); - sh->rx_domain = NULL; - } - if (sh->tx_domain) { - mlx5_glue->dr_destroy_domain(sh->tx_domain); - sh->tx_domain = NULL; - } #ifdef HAVE_MLX5DV_DR_ESWITCH - if (sh->fdb_domain) { - mlx5_glue->dr_destroy_domain(sh->fdb_domain); - sh->fdb_domain = NULL; - } if (sh->dr_drop_action) { mlx5_glue->destroy_flow_action(sh->dr_drop_action); sh->dr_drop_action = NULL;
drivers/net/mlx5/mlx5.c +6 -0
@@ -2130,6 +2130,12 @@ mlx5_free_shared_dev_ctx(struct mlx5_dev_ctx_shared *sh) }if (sh->mtrmng)mlx5_aso_flow_mtrs_mng_close (sh); +/* +* DR domains belong to the shared context, as the ASO managers do. +* ASO steering actions are created in these domains, so destroy the +* domains only after those actions are released. +*/ +mlx5_os_free_shared_domains (sh);mlx5_flow_ipool_destroy (sh);mlx5_os_dev_shared_handler_uninstall (sh);mlx5_rxtx_uars_release (sh);
drivers/net/mlx5/mlx5.h +1 -0
@@ -2644,6 +2644,7 @@ uint32_t mlx5_flow_mtr_max_get(struct mlx5_priv *priv);struct rte_pci_driver ;int mlx5_os_capabilities_prepare (struct mlx5_dev_ctx_shared *sh);void mlx5_os_free_shared_dr (struct mlx5_priv *priv); +void mlx5_os_free_shared_domains (struct mlx5_dev_ctx_shared *sh);int mlx5_os_net_probe (struct mlx5_common_device *cdev,struct mlx5_kvargs_ctrl *mkvlist);void mlx5_os_dev_shared_handler_install (struct mlx5_dev_ctx_shared *sh);
drivers/net/mlx5/windows/mlx5_os.c +13 -0
@@ -310,6 +310,19 @@ mlx5_os_free_shared_dr(struct mlx5_priv *priv)mlx5_free_table_hash_list (priv); } +/** +* Destroy shared DR domains. +* Windows has no DR domains. +* +* @param[in] sh +* Pointer to the shared device context. +*/ +void +mlx5_os_free_shared_domains (struct mlx5_dev_ctx_shared *sh) +{ +RTE_SET_USED (sh); +} +/** * Set the completion channel file descriptor interrupt as non-blocking. * Currently it has no support under Windows.
Signature · 1 line
2.43.0