Allocate a ct priv workqueue instead of using mlx5e priv one so flushing will only be of related CT entries. Also move flushing of the workqueue before rhashtable destroy otherwise entries won't be valid.
Unified · Split
| @@ -76,6 +76,7 @@ struct mlx5_tc_ct_priv { · 75 unmodified lines | ||
| 76 | 76 | struct mlx5_ct_fs *fs; |
| 77 | 77 | struct mlx5_ct_fs_ops *fs_ops; |
| 78 | 78 | spinlock_t ht_lock; /* protects ft entries */ |
| 79 | + struct workqueue_struct *wq; | |
| 79 | 80 | |
| 80 | 81 | struct mlx5_tc_ct_debugfs debugfs; |
| 81 | 82 | }; |
| @@ -941,14 +942,11 @@ static void mlx5_tc_ct_entry_del_work(struct work_struct *work) · 859 unmodified lines | ||
| 941 | 942 | static void |
| 942 | 943 | __mlx5_tc_ct_entry_put(struct mlx5_ct_entry *entry) |
| 943 | 944 | { |
| 944 | − struct mlx5e_priv *priv; | |
| 945 | − | |
| 946 | 945 | if (!refcount_dec_and_test(&entry->refcnt)) |
| 947 | 946 | return; |
| 948 | 947 | |
| 949 | − priv = netdev_priv(entry->ct_priv->netdev); | |
| 950 | 948 | INIT_WORK(&entry->work, mlx5_tc_ct_entry_del_work); |
| 951 | − queue_work(priv->wq, &entry->work); | |
| 949 | + queue_work(entry->ct_priv->wq, &entry->work); | |
| 952 | 950 | } |
| 953 | 951 | |
| 954 | 952 | static struct mlx5_ct_counter * |
| @@ -1759,19 +1757,16 @@ mlx5_tc_ct_flush_ft_entry(void *ptr, void *arg) · 804 unmodified lines | ||
| 1759 | 1757 | static void |
| 1760 | 1758 | mlx5_tc_ct_del_ft_cb(struct mlx5_tc_ct_priv *ct_priv, struct mlx5_ct_ft *ft) |
| 1761 | 1759 | { |
| 1762 | − struct mlx5e_priv *priv; | |
| 1763 | − | |
| 1764 | 1760 | if (!refcount_dec_and_test(&ft->refcount)) |
| 1765 | 1761 | return; |
| 1766 | 1762 | |
| 1763 | + flush_workqueue(ct_priv->wq); | |
| 1767 | 1764 | nf_flow_table_offload_del_cb(ft->nf_ft, |
| 1768 | 1765 | mlx5_tc_ct_block_flow_offload, ft); |
| 1769 | 1766 | rhashtable_remove_fast(&ct_priv->zone_ht, &ft->node, zone_params); |
| 1770 | 1767 | rhashtable_free_and_destroy(&ft->ct_entries_ht, |
| 1771 | 1768 | mlx5_tc_ct_flush_ft_entry, |
| 1772 | 1769 | ct_priv); |
| 1773 | − priv = netdev_priv(ct_priv->netdev); | |
| 1774 | − flush_workqueue(priv->wq); | |
| 1775 | 1770 | mlx5_tc_ct_free_pre_ct_tables(ft); |
| 1776 | 1771 | mapping_remove(ct_priv->zone_mapping, ft->zone_restore_id); |
| 1777 | 1772 | kfree(ft); |
| @@ -2176,6 +2171,12 @@ mlx5_tc_ct_init(struct mlx5e_priv *priv, struct mlx5_fs_chains *chains, · 398 unmodified lines | ||
| 2176 | 2171 | if (rhashtable_init(&ct_priv->ct_tuples_nat_ht, &tuples_nat_ht_params)) |
| 2177 | 2172 | goto err_ct_tuples_nat_ht; |
| 2178 | 2173 | |
| 2174 | + ct_priv->wq = alloc_ordered_workqueue("mlx5e_ct_priv_wq", 0); | |
| 2175 | + if (!ct_priv->wq) { | |
| 2176 | + err = -ENOMEM; | |
| 2177 | + goto err_wq; | |
| 2178 | + } | |
| 2179 | + | |
| 2179 | 2180 | err = mlx5_tc_ct_fs_init(ct_priv); |
| 2180 | 2181 | if (err) |
| 2181 | 2182 | goto err_init_fs; |
| @@ -2184,6 +2185,8 @@ mlx5_tc_ct_init(struct mlx5e_priv *priv, struct mlx5_fs_chains *chains, · 2 unmodified lines | ||
| 2184 | 2185 | return ct_priv; |
| 2185 | 2186 | |
| 2186 | 2187 | err_init_fs: |
| 2188 | + destroy_workqueue(ct_priv->wq); | |
| 2189 | +err_wq: | |
| 2187 | 2190 | rhashtable_destroy(&ct_priv->ct_tuples_nat_ht); |
| 2188 | 2191 | err_ct_tuples_nat_ht: |
| 2189 | 2192 | rhashtable_destroy(&ct_priv->ct_tuples_ht); |
| @@ -2213,6 +2216,7 @@ mlx5_tc_ct_clean(struct mlx5_tc_ct_priv *ct_priv) · 23 unmodified lines | ||
| 2213 | 2216 | if (!ct_priv) |
| 2214 | 2217 | return; |
| 2215 | 2218 | |
| 2219 | + destroy_workqueue(ct_priv->wq); | |
| 2216 | 2220 | mlx5_ct_tc_remove_dbgfs(ct_priv); |
| 2217 | 2221 | chains = ct_priv->chains; |
| 2218 | 2222 | |