History

net/mlx5e: CT: Use own workqueue instead of mlx5e priv

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.

Roi Dayan committed 4 years ago

Commit 6c4e8fa1 parent 1afbd1e1 file · +12 −8Browse files

Unified · Split

drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c+12−8
@@ -76,6 +76,7 @@ struct mlx5_tc_ct_priv { · 75 unmodified lines
7676 struct mlx5_ct_fs *fs;
7777 struct mlx5_ct_fs_ops *fs_ops;
7878 spinlock_t ht_lock; /* protects ft entries */
79+ struct workqueue_struct *wq;
7980
8081 struct mlx5_tc_ct_debugfs debugfs;
8182 };
@@ -941,14 +942,11 @@ static void mlx5_tc_ct_entry_del_work(struct work_struct *work) · 859 unmodified lines
941942 static void
942943 __mlx5_tc_ct_entry_put(struct mlx5_ct_entry *entry)
943944 {
944− struct mlx5e_priv *priv;
945−
946945 if (!refcount_dec_and_test(&entry->refcnt))
947946 return;
948947
949− priv = netdev_priv(entry->ct_priv->netdev);
950948 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);
952950 }
953951
954952 static struct mlx5_ct_counter *
@@ -1759,19 +1757,16 @@ mlx5_tc_ct_flush_ft_entry(void *ptr, void *arg) · 804 unmodified lines
17591757 static void
17601758 mlx5_tc_ct_del_ft_cb(struct mlx5_tc_ct_priv *ct_priv, struct mlx5_ct_ft *ft)
17611759 {
1762− struct mlx5e_priv *priv;
1763−
17641760 if (!refcount_dec_and_test(&ft->refcount))
17651761 return;
17661762
1763+ flush_workqueue(ct_priv->wq);
17671764 nf_flow_table_offload_del_cb(ft->nf_ft,
17681765 mlx5_tc_ct_block_flow_offload, ft);
17691766 rhashtable_remove_fast(&ct_priv->zone_ht, &ft->node, zone_params);
17701767 rhashtable_free_and_destroy(&ft->ct_entries_ht,
17711768 mlx5_tc_ct_flush_ft_entry,
17721769 ct_priv);
1773− priv = netdev_priv(ct_priv->netdev);
1774− flush_workqueue(priv->wq);
17751770 mlx5_tc_ct_free_pre_ct_tables(ft);
17761771 mapping_remove(ct_priv->zone_mapping, ft->zone_restore_id);
17771772 kfree(ft);
@@ -2176,6 +2171,12 @@ mlx5_tc_ct_init(struct mlx5e_priv *priv, struct mlx5_fs_chains *chains, · 398 unmodified lines
21762171 if (rhashtable_init(&ct_priv->ct_tuples_nat_ht, &tuples_nat_ht_params))
21772172 goto err_ct_tuples_nat_ht;
21782173
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+
21792180 err = mlx5_tc_ct_fs_init(ct_priv);
21802181 if (err)
21812182 goto err_init_fs;
@@ -2184,6 +2185,8 @@ mlx5_tc_ct_init(struct mlx5e_priv *priv, struct mlx5_fs_chains *chains, · 2 unmodified lines
21842185 return ct_priv;
21852186
21862187 err_init_fs:
2188+ destroy_workqueue(ct_priv->wq);
2189+err_wq:
21872190 rhashtable_destroy(&ct_priv->ct_tuples_nat_ht);
21882191 err_ct_tuples_nat_ht:
21892192 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
22132216 if (!ct_priv)
22142217 return;
22152218
2219+ destroy_workqueue(ct_priv->wq);
22162220 mlx5_ct_tc_remove_dbgfs(ct_priv);
22172221 chains = ct_priv->chains;
22182222