@@ -3609,12 +3609,11 @@ static const struct rhashtable_params tc_ht_params = {
36093609static struct rhashtable * get_tc_ht (struct mlx5e_priv * priv ,
36103610 unsigned long flags )
36113611{
3612- struct mlx5_eswitch * esw = priv -> mdev -> priv .eswitch ;
3613- struct mlx5e_rep_priv * uplink_rpriv ;
3612+ struct mlx5e_rep_priv * rpriv ;
36143613
36153614 if (flags & MLX5_TC_FLAG (ESW_OFFLOAD )) {
3616- uplink_rpriv = mlx5_eswitch_get_uplink_priv ( esw , REP_ETH ) ;
3617- return & uplink_rpriv -> uplink_priv . tc_ht ;
3615+ rpriv = priv -> ppriv ;
3616+ return & rpriv -> tc_ht ;
36183617 } else /* NIC offload */
36193618 return & priv -> fs .tc .ht ;
36203619}
@@ -4447,18 +4446,34 @@ void mlx5e_tc_nic_cleanup(struct mlx5e_priv *priv)
44474446 mlx5_chains_destroy (tc -> chains );
44484447}
44494448
4450- int mlx5e_tc_esw_init (struct rhashtable * tc_ht )
4449+ int mlx5e_tc_ht_init (struct rhashtable * tc_ht )
4450+ {
4451+ int err ;
4452+
4453+ err = rhashtable_init (tc_ht , & tc_ht_params );
4454+ if (err )
4455+ return err ;
4456+
4457+ lockdep_set_class (& tc_ht -> mutex , & tc_ht_lock_key );
4458+
4459+ return 0 ;
4460+ }
4461+
4462+ void mlx5e_tc_ht_cleanup (struct rhashtable * tc_ht )
4463+ {
4464+ rhashtable_free_and_destroy (tc_ht , _mlx5e_tc_del_flow , NULL );
4465+ }
4466+
4467+ int mlx5e_tc_esw_init (struct mlx5_rep_uplink_priv * uplink_priv )
44514468{
44524469 const size_t sz_enc_opts = sizeof (struct tunnel_match_enc_opts );
4453- struct mlx5_rep_uplink_priv * uplink_priv ;
44544470 struct mlx5e_rep_priv * rpriv ;
44554471 struct mapping_ctx * mapping ;
44564472 struct mlx5_eswitch * esw ;
44574473 struct mlx5e_priv * priv ;
44584474 u64 mapping_id ;
44594475 int err = 0 ;
44604476
4461- uplink_priv = container_of (tc_ht , struct mlx5_rep_uplink_priv , tc_ht );
44624477 rpriv = container_of (uplink_priv , struct mlx5e_rep_priv , uplink_priv );
44634478 priv = netdev_priv (rpriv -> netdev );
44644479 esw = priv -> mdev -> priv .eswitch ;
@@ -4498,12 +4513,6 @@ int mlx5e_tc_esw_init(struct rhashtable *tc_ht)
44984513 }
44994514 uplink_priv -> tunnel_enc_opts_mapping = mapping ;
45004515
4501- err = rhashtable_init (tc_ht , & tc_ht_params );
4502- if (err )
4503- goto err_ht_init ;
4504-
4505- lockdep_set_class (& tc_ht -> mutex , & tc_ht_lock_key );
4506-
45074516 uplink_priv -> encap = mlx5e_tc_tun_init (priv );
45084517 if (IS_ERR (uplink_priv -> encap )) {
45094518 err = PTR_ERR (uplink_priv -> encap );
@@ -4513,8 +4522,6 @@ int mlx5e_tc_esw_init(struct rhashtable *tc_ht)
45134522 return 0 ;
45144523
45154524err_register_fib_notifier :
4516- rhashtable_destroy (tc_ht );
4517- err_ht_init :
45184525 mapping_destroy (uplink_priv -> tunnel_enc_opts_mapping );
45194526err_enc_opts_mapping :
45204527 mapping_destroy (uplink_priv -> tunnel_mapping );
@@ -4528,13 +4535,8 @@ int mlx5e_tc_esw_init(struct rhashtable *tc_ht)
45284535 return err ;
45294536}
45304537
4531- void mlx5e_tc_esw_cleanup (struct rhashtable * tc_ht )
4538+ void mlx5e_tc_esw_cleanup (struct mlx5_rep_uplink_priv * uplink_priv )
45324539{
4533- struct mlx5_rep_uplink_priv * uplink_priv ;
4534-
4535- uplink_priv = container_of (tc_ht , struct mlx5_rep_uplink_priv , tc_ht );
4536-
4537- rhashtable_free_and_destroy (tc_ht , _mlx5e_tc_del_flow , NULL );
45384540 mlx5e_tc_tun_cleanup (uplink_priv -> encap );
45394541
45404542 mapping_destroy (uplink_priv -> tunnel_enc_opts_mapping );
0 commit comments