@@ -280,7 +280,7 @@ get_ct_priv(struct mlx5e_priv *priv)
280
280
return uplink_priv -> ct_priv ;
281
281
}
282
282
283
- return priv -> fs .tc . ct ;
283
+ return priv -> fs .tc -> ct ;
284
284
}
285
285
286
286
static struct mlx5e_tc_psample *
@@ -314,7 +314,7 @@ get_post_action(struct mlx5e_priv *priv)
314
314
return uplink_priv -> post_act ;
315
315
}
316
316
317
- return priv -> fs .tc . post_act ;
317
+ return priv -> fs .tc -> post_act ;
318
318
}
319
319
320
320
struct mlx5_flow_handle *
@@ -569,7 +569,7 @@ get_mod_hdr_table(struct mlx5e_priv *priv, struct mlx5e_tc_flow *flow)
569
569
570
570
return mlx5e_get_flow_namespace (flow ) == MLX5_FLOW_NAMESPACE_FDB ?
571
571
& esw -> offloads .mod_hdr :
572
- & priv -> fs .tc . mod_hdr ;
572
+ & priv -> fs .tc -> mod_hdr ;
573
573
}
574
574
575
575
static int mlx5e_attach_mod_hdr (struct mlx5e_priv * priv ,
@@ -877,7 +877,7 @@ static struct mlx5e_hairpin_entry *mlx5e_hairpin_get(struct mlx5e_priv *priv,
877
877
struct mlx5e_hairpin_entry * hpe ;
878
878
u32 hash_key = hash_hairpin_info (peer_vhca_id , prio );
879
879
880
- hash_for_each_possible (priv -> fs .tc . hairpin_tbl , hpe ,
880
+ hash_for_each_possible (priv -> fs .tc -> hairpin_tbl , hpe ,
881
881
hairpin_hlist , hash_key ) {
882
882
if (hpe -> peer_vhca_id == peer_vhca_id && hpe -> prio == prio ) {
883
883
refcount_inc (& hpe -> refcnt );
@@ -892,10 +892,10 @@ static void mlx5e_hairpin_put(struct mlx5e_priv *priv,
892
892
struct mlx5e_hairpin_entry * hpe )
893
893
{
894
894
/* no more hairpin flows for us, release the hairpin pair */
895
- if (!refcount_dec_and_mutex_lock (& hpe -> refcnt , & priv -> fs .tc . hairpin_tbl_lock ))
895
+ if (!refcount_dec_and_mutex_lock (& hpe -> refcnt , & priv -> fs .tc -> hairpin_tbl_lock ))
896
896
return ;
897
897
hash_del (& hpe -> hairpin_hlist );
898
- mutex_unlock (& priv -> fs .tc . hairpin_tbl_lock );
898
+ mutex_unlock (& priv -> fs .tc -> hairpin_tbl_lock );
899
899
900
900
if (!IS_ERR_OR_NULL (hpe -> hp )) {
901
901
netdev_dbg (priv -> netdev , "del hairpin: peer %s\n" ,
@@ -979,10 +979,10 @@ static int mlx5e_hairpin_flow_add(struct mlx5e_priv *priv,
979
979
if (err )
980
980
return err ;
981
981
982
- mutex_lock (& priv -> fs .tc . hairpin_tbl_lock );
982
+ mutex_lock (& priv -> fs .tc -> hairpin_tbl_lock );
983
983
hpe = mlx5e_hairpin_get (priv , peer_id , match_prio );
984
984
if (hpe ) {
985
- mutex_unlock (& priv -> fs .tc . hairpin_tbl_lock );
985
+ mutex_unlock (& priv -> fs .tc -> hairpin_tbl_lock );
986
986
wait_for_completion (& hpe -> res_ready );
987
987
988
988
if (IS_ERR (hpe -> hp )) {
@@ -994,7 +994,7 @@ static int mlx5e_hairpin_flow_add(struct mlx5e_priv *priv,
994
994
995
995
hpe = kzalloc (sizeof (* hpe ), GFP_KERNEL );
996
996
if (!hpe ) {
997
- mutex_unlock (& priv -> fs .tc . hairpin_tbl_lock );
997
+ mutex_unlock (& priv -> fs .tc -> hairpin_tbl_lock );
998
998
return - ENOMEM ;
999
999
}
1000
1000
@@ -1006,9 +1006,9 @@ static int mlx5e_hairpin_flow_add(struct mlx5e_priv *priv,
1006
1006
refcount_set (& hpe -> refcnt , 1 );
1007
1007
init_completion (& hpe -> res_ready );
1008
1008
1009
- hash_add (priv -> fs .tc . hairpin_tbl , & hpe -> hairpin_hlist ,
1009
+ hash_add (priv -> fs .tc -> hairpin_tbl , & hpe -> hairpin_hlist ,
1010
1010
hash_hairpin_info (peer_id , match_prio ));
1011
- mutex_unlock (& priv -> fs .tc . hairpin_tbl_lock );
1011
+ mutex_unlock (& priv -> fs .tc -> hairpin_tbl_lock );
1012
1012
1013
1013
params .log_data_size = 16 ;
1014
1014
params .log_data_size = min_t (u8 , params .log_data_size ,
@@ -1086,7 +1086,7 @@ mlx5e_add_offloaded_nic_rule(struct mlx5e_priv *priv,
1086
1086
struct mlx5_flow_context * flow_context = & spec -> flow_context ;
1087
1087
struct mlx5_fs_chains * nic_chains = mlx5e_nic_chains (priv );
1088
1088
struct mlx5_nic_flow_attr * nic_attr = attr -> nic_attr ;
1089
- struct mlx5e_tc_table * tc = & priv -> fs .tc ;
1089
+ struct mlx5e_tc_table * tc = priv -> fs .tc ;
1090
1090
struct mlx5_flow_destination dest [2 ] = {};
1091
1091
struct mlx5_flow_act flow_act = {
1092
1092
.action = attr -> action ,
@@ -1148,7 +1148,7 @@ mlx5e_add_offloaded_nic_rule(struct mlx5e_priv *priv,
1148
1148
mutex_unlock (& tc -> t_lock );
1149
1149
netdev_err (priv -> netdev ,
1150
1150
"Failed to create tc offload table\n" );
1151
- rule = ERR_CAST (priv -> fs .tc . t );
1151
+ rule = ERR_CAST (priv -> fs .tc -> t );
1152
1152
goto err_ft_get ;
1153
1153
}
1154
1154
}
@@ -1267,7 +1267,7 @@ static void mlx5e_tc_del_nic_flow(struct mlx5e_priv *priv,
1267
1267
struct mlx5e_tc_flow * flow )
1268
1268
{
1269
1269
struct mlx5_flow_attr * attr = flow -> attr ;
1270
- struct mlx5e_tc_table * tc = & priv -> fs .tc ;
1270
+ struct mlx5e_tc_table * tc = priv -> fs .tc ;
1271
1271
1272
1272
flow_flag_clear (flow , OFFLOADED );
1273
1273
@@ -1279,13 +1279,13 @@ static void mlx5e_tc_del_nic_flow(struct mlx5e_priv *priv,
1279
1279
/* Remove root table if no rules are left to avoid
1280
1280
* extra steering hops.
1281
1281
*/
1282
- mutex_lock (& priv -> fs .tc . t_lock );
1282
+ mutex_lock (& priv -> fs .tc -> t_lock );
1283
1283
if (!mlx5e_tc_num_filters (priv , MLX5_TC_FLAG (NIC_OFFLOAD )) &&
1284
1284
!IS_ERR_OR_NULL (tc -> t )) {
1285
1285
mlx5_chains_put_table (mlx5e_nic_chains (priv ), 0 , 1 , MLX5E_TC_FT_LEVEL );
1286
- priv -> fs .tc . t = NULL ;
1286
+ priv -> fs .tc -> t = NULL ;
1287
1287
}
1288
- mutex_unlock (& priv -> fs .tc . t_lock );
1288
+ mutex_unlock (& priv -> fs .tc -> t_lock );
1289
1289
1290
1290
if (attr -> action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR )
1291
1291
mlx5e_detach_mod_hdr (priv , flow );
@@ -4021,7 +4021,7 @@ static struct rhashtable *get_tc_ht(struct mlx5e_priv *priv,
4021
4021
rpriv = priv -> ppriv ;
4022
4022
return & rpriv -> tc_ht ;
4023
4023
} else /* NIC offload */
4024
- return & priv -> fs .tc . ht ;
4024
+ return & priv -> fs .tc -> ht ;
4025
4025
}
4026
4026
4027
4027
static bool is_peer_flow_needed (struct mlx5e_tc_flow * flow )
@@ -4740,11 +4740,11 @@ static void mlx5e_tc_hairpin_update_dead_peer(struct mlx5e_priv *priv,
4740
4740
4741
4741
peer_vhca_id = MLX5_CAP_GEN (peer_mdev , vhca_id );
4742
4742
4743
- mutex_lock (& priv -> fs .tc . hairpin_tbl_lock );
4744
- hash_for_each (priv -> fs .tc . hairpin_tbl , bkt , hpe , hairpin_hlist )
4743
+ mutex_lock (& priv -> fs .tc -> hairpin_tbl_lock );
4744
+ hash_for_each (priv -> fs .tc -> hairpin_tbl , bkt , hpe , hairpin_hlist )
4745
4745
if (refcount_inc_not_zero (& hpe -> refcnt ))
4746
4746
list_add (& hpe -> dead_peer_wait_list , & init_wait_list );
4747
- mutex_unlock (& priv -> fs .tc . hairpin_tbl_lock );
4747
+ mutex_unlock (& priv -> fs .tc -> hairpin_tbl_lock );
4748
4748
4749
4749
list_for_each_entry_safe (hpe , tmp , & init_wait_list , dead_peer_wait_list ) {
4750
4750
wait_for_completion (& hpe -> res_ready );
@@ -4759,7 +4759,6 @@ static int mlx5e_tc_netdev_event(struct notifier_block *this,
4759
4759
unsigned long event , void * ptr )
4760
4760
{
4761
4761
struct net_device * ndev = netdev_notifier_info_to_dev (ptr );
4762
- struct mlx5e_flow_steering * fs ;
4763
4762
struct mlx5e_priv * peer_priv ;
4764
4763
struct mlx5e_tc_table * tc ;
4765
4764
struct mlx5e_priv * priv ;
@@ -4770,8 +4769,7 @@ static int mlx5e_tc_netdev_event(struct notifier_block *this,
4770
4769
return NOTIFY_DONE ;
4771
4770
4772
4771
tc = container_of (this , struct mlx5e_tc_table , netdevice_nb );
4773
- fs = container_of (tc , struct mlx5e_flow_steering , tc );
4774
- priv = container_of (fs , struct mlx5e_priv , fs );
4772
+ priv = tc -> priv ;
4775
4773
peer_priv = netdev_priv (ndev );
4776
4774
if (priv == peer_priv ||
4777
4775
!(priv -> netdev -> features & NETIF_F_HW_TC ))
@@ -4800,7 +4798,7 @@ static int mlx5e_tc_nic_get_ft_size(struct mlx5_core_dev *dev)
4800
4798
4801
4799
static int mlx5e_tc_nic_create_miss_table (struct mlx5e_priv * priv )
4802
4800
{
4803
- struct mlx5_flow_table * * ft = & priv -> fs .tc . miss_t ;
4801
+ struct mlx5_flow_table * * ft = & priv -> fs .tc -> miss_t ;
4804
4802
struct mlx5_flow_table_attr ft_attr = {};
4805
4803
struct mlx5_flow_namespace * ns ;
4806
4804
int err = 0 ;
@@ -4822,12 +4820,12 @@ static int mlx5e_tc_nic_create_miss_table(struct mlx5e_priv *priv)
4822
4820
4823
4821
static void mlx5e_tc_nic_destroy_miss_table (struct mlx5e_priv * priv )
4824
4822
{
4825
- mlx5_destroy_flow_table (priv -> fs .tc . miss_t );
4823
+ mlx5_destroy_flow_table (priv -> fs .tc -> miss_t );
4826
4824
}
4827
4825
4828
4826
int mlx5e_tc_nic_init (struct mlx5e_priv * priv )
4829
4827
{
4830
- struct mlx5e_tc_table * tc = & priv -> fs .tc ;
4828
+ struct mlx5e_tc_table * tc = priv -> fs .tc ;
4831
4829
struct mlx5_core_dev * dev = priv -> mdev ;
4832
4830
struct mapping_ctx * chains_mapping ;
4833
4831
struct mlx5_chains_attr attr = {};
@@ -4838,6 +4836,7 @@ int mlx5e_tc_nic_init(struct mlx5e_priv *priv)
4838
4836
mutex_init (& tc -> t_lock );
4839
4837
mutex_init (& tc -> hairpin_tbl_lock );
4840
4838
hash_init (tc -> hairpin_tbl );
4839
+ tc -> priv = priv ;
4841
4840
4842
4841
err = rhashtable_init (& tc -> ht , & tc_ht_params );
4843
4842
if (err )
@@ -4867,7 +4866,7 @@ int mlx5e_tc_nic_init(struct mlx5e_priv *priv)
4867
4866
attr .ns = MLX5_FLOW_NAMESPACE_KERNEL ;
4868
4867
attr .max_ft_sz = mlx5e_tc_nic_get_ft_size (dev );
4869
4868
attr .max_grp_num = MLX5E_TC_TABLE_NUM_GROUPS ;
4870
- attr .default_ft = priv -> fs .tc . miss_t ;
4869
+ attr .default_ft = priv -> fs .tc -> miss_t ;
4871
4870
attr .mapping = chains_mapping ;
4872
4871
4873
4872
tc -> chains = mlx5_chains_create (dev , & attr );
@@ -4877,7 +4876,7 @@ int mlx5e_tc_nic_init(struct mlx5e_priv *priv)
4877
4876
}
4878
4877
4879
4878
tc -> post_act = mlx5e_tc_post_act_init (priv , tc -> chains , MLX5_FLOW_NAMESPACE_KERNEL );
4880
- tc -> ct = mlx5_tc_ct_init (priv , tc -> chains , & priv -> fs . tc . mod_hdr ,
4879
+ tc -> ct = mlx5_tc_ct_init (priv , tc -> chains , & tc -> mod_hdr ,
4881
4880
MLX5_FLOW_NAMESPACE_KERNEL , tc -> post_act );
4882
4881
4883
4882
tc -> netdevice_nb .notifier_call = mlx5e_tc_netdev_event ;
@@ -4916,7 +4915,7 @@ static void _mlx5e_tc_del_flow(void *ptr, void *arg)
4916
4915
4917
4916
void mlx5e_tc_nic_cleanup (struct mlx5e_priv * priv )
4918
4917
{
4919
- struct mlx5e_tc_table * tc = & priv -> fs .tc ;
4918
+ struct mlx5e_tc_table * tc = priv -> fs .tc ;
4920
4919
4921
4920
if (tc -> netdevice_nb .notifier_call )
4922
4921
unregister_netdevice_notifier_dev_net (priv -> netdev ,
@@ -5121,7 +5120,7 @@ bool mlx5e_tc_update_skb(struct mlx5_cqe64 *cqe,
5121
5120
#if IS_ENABLED (CONFIG_NET_TC_SKB_EXT )
5122
5121
u32 chain = 0 , chain_tag , reg_b , zone_restore_id ;
5123
5122
struct mlx5e_priv * priv = netdev_priv (skb -> dev );
5124
- struct mlx5e_tc_table * tc = & priv -> fs .tc ;
5123
+ struct mlx5e_tc_table * tc = priv -> fs .tc ;
5125
5124
struct mlx5_mapped_obj mapped_obj ;
5126
5125
struct tc_skb_ext * tc_skb_ext ;
5127
5126
int err ;
0 commit comments