hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h
....@@ -4,20 +4,31 @@
44 #ifndef __MLX5E_FLOW_STEER_H__
55 #define __MLX5E_FLOW_STEER_H__
66
7
+#include "mod_hdr.h"
8
+
79 enum {
810 MLX5E_TC_FT_LEVEL = 0,
911 MLX5E_TC_TTC_FT_LEVEL,
1012 };
1113
1214 struct mlx5e_tc_table {
15
+ /* Protects the dynamic assignment of the t parameter
16
+ * which is the nic tc root table.
17
+ */
18
+ struct mutex t_lock;
1319 struct mlx5_flow_table *t;
20
+ struct mlx5_fs_chains *chains;
1421
1522 struct rhashtable ht;
1623
17
- DECLARE_HASHTABLE(mod_hdr_tbl, 8);
24
+ struct mod_hdr_tbl mod_hdr;
25
+ struct mutex hairpin_tbl_lock; /* protects hairpin_tbl */
1826 DECLARE_HASHTABLE(hairpin_tbl, 8);
1927
2028 struct notifier_block netdevice_nb;
29
+ struct netdev_net_notifier netdevice_nn;
30
+
31
+ struct mlx5_tc_ct_priv *ct;
2132 };
2233
2334 struct mlx5e_flow_table {
....@@ -73,17 +84,44 @@
7384 MLX5E_NUM_INDIR_TIRS = MLX5E_TT_ANY,
7485 };
7586
87
+struct mlx5e_tirc_config {
88
+ u8 l3_prot_type;
89
+ u8 l4_prot_type;
90
+ u32 rx_hash_fields;
91
+};
92
+
93
+#define MLX5_HASH_IP (MLX5_HASH_FIELD_SEL_SRC_IP |\
94
+ MLX5_HASH_FIELD_SEL_DST_IP)
95
+#define MLX5_HASH_IP_L4PORTS (MLX5_HASH_FIELD_SEL_SRC_IP |\
96
+ MLX5_HASH_FIELD_SEL_DST_IP |\
97
+ MLX5_HASH_FIELD_SEL_L4_SPORT |\
98
+ MLX5_HASH_FIELD_SEL_L4_DPORT)
99
+#define MLX5_HASH_IP_IPSEC_SPI (MLX5_HASH_FIELD_SEL_SRC_IP |\
100
+ MLX5_HASH_FIELD_SEL_DST_IP |\
101
+ MLX5_HASH_FIELD_SEL_IPSEC_SPI)
102
+
76103 enum mlx5e_tunnel_types {
77104 MLX5E_TT_IPV4_GRE,
78105 MLX5E_TT_IPV6_GRE,
106
+ MLX5E_TT_IPV4_IPIP,
107
+ MLX5E_TT_IPV6_IPIP,
108
+ MLX5E_TT_IPV4_IPV6,
109
+ MLX5E_TT_IPV6_IPV6,
79110 MLX5E_NUM_TUNNEL_TT,
111
+};
112
+
113
+bool mlx5e_tunnel_inner_ft_supported(struct mlx5_core_dev *mdev);
114
+
115
+struct mlx5e_ttc_rule {
116
+ struct mlx5_flow_handle *rule;
117
+ struct mlx5_flow_destination default_dest;
80118 };
81119
82120 /* L3/L4 traffic type classifier */
83121 struct mlx5e_ttc_table {
84
- struct mlx5e_flow_table ft;
85
- struct mlx5_flow_handle *rules[MLX5E_NUM_TT];
86
- struct mlx5_flow_handle *tunnel_rules[MLX5E_NUM_TUNNEL_TT];
122
+ struct mlx5e_flow_table ft;
123
+ struct mlx5e_ttc_rule rules[MLX5E_NUM_TT];
124
+ struct mlx5_flow_handle *tunnel_rules[MLX5E_NUM_TUNNEL_TT];
87125 };
88126
89127 /* NIC prio FTS */
....@@ -92,10 +130,33 @@
92130 MLX5E_L2_FT_LEVEL,
93131 MLX5E_TTC_FT_LEVEL,
94132 MLX5E_INNER_TTC_FT_LEVEL,
133
+#ifdef CONFIG_MLX5_EN_TLS
134
+ MLX5E_ACCEL_FS_TCP_FT_LEVEL,
135
+#endif
95136 #ifdef CONFIG_MLX5_EN_ARFS
96
- MLX5E_ARFS_FT_LEVEL
137
+ MLX5E_ARFS_FT_LEVEL,
138
+#endif
139
+#ifdef CONFIG_MLX5_EN_IPSEC
140
+ MLX5E_ACCEL_FS_ESP_FT_LEVEL = MLX5E_INNER_TTC_FT_LEVEL + 1,
141
+ MLX5E_ACCEL_FS_ESP_FT_ERR_LEVEL,
97142 #endif
98143 };
144
+
145
+#define MLX5E_TTC_NUM_GROUPS 3
146
+#define MLX5E_TTC_GROUP1_SIZE (BIT(3) + MLX5E_NUM_TUNNEL_TT)
147
+#define MLX5E_TTC_GROUP2_SIZE BIT(1)
148
+#define MLX5E_TTC_GROUP3_SIZE BIT(0)
149
+#define MLX5E_TTC_TABLE_SIZE (MLX5E_TTC_GROUP1_SIZE +\
150
+ MLX5E_TTC_GROUP2_SIZE +\
151
+ MLX5E_TTC_GROUP3_SIZE)
152
+
153
+#define MLX5E_INNER_TTC_NUM_GROUPS 3
154
+#define MLX5E_INNER_TTC_GROUP1_SIZE BIT(3)
155
+#define MLX5E_INNER_TTC_GROUP2_SIZE BIT(1)
156
+#define MLX5E_INNER_TTC_GROUP3_SIZE BIT(0)
157
+#define MLX5E_INNER_TTC_TABLE_SIZE (MLX5E_INNER_TTC_GROUP1_SIZE +\
158
+ MLX5E_INNER_TTC_GROUP2_SIZE +\
159
+ MLX5E_INNER_TTC_GROUP3_SIZE)
99160
100161 #ifdef CONFIG_MLX5_EN_RXNFC
101162
....@@ -116,12 +177,17 @@
116177
117178 void mlx5e_ethtool_init_steering(struct mlx5e_priv *priv);
118179 void mlx5e_ethtool_cleanup_steering(struct mlx5e_priv *priv);
119
-int mlx5e_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd);
120
-int mlx5e_get_rxnfc(struct net_device *dev,
121
- struct ethtool_rxnfc *info, u32 *rule_locs);
180
+int mlx5e_ethtool_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd);
181
+int mlx5e_ethtool_get_rxnfc(struct net_device *dev,
182
+ struct ethtool_rxnfc *info, u32 *rule_locs);
122183 #else
123184 static inline void mlx5e_ethtool_init_steering(struct mlx5e_priv *priv) { }
124185 static inline void mlx5e_ethtool_cleanup_steering(struct mlx5e_priv *priv) { }
186
+static inline int mlx5e_ethtool_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
187
+{ return -EOPNOTSUPP; }
188
+static inline int mlx5e_ethtool_get_rxnfc(struct net_device *dev,
189
+ struct ethtool_rxnfc *info, u32 *rule_locs)
190
+{ return -EOPNOTSUPP; }
125191 #endif /* CONFIG_MLX5_EN_RXNFC */
126192
127193 #ifdef CONFIG_MLX5_EN_ARFS
....@@ -164,8 +230,13 @@
164230 static inline int mlx5e_arfs_disable(struct mlx5e_priv *priv) { return -EOPNOTSUPP; }
165231 #endif
166232
233
+#ifdef CONFIG_MLX5_EN_TLS
234
+struct mlx5e_accel_fs_tcp;
235
+#endif
236
+
167237 struct mlx5e_flow_steering {
168238 struct mlx5_flow_namespace *ns;
239
+ struct mlx5_flow_namespace *egress_ns;
169240 #ifdef CONFIG_MLX5_EN_RXNFC
170241 struct mlx5e_ethtool_steering ethtool;
171242 #endif
....@@ -176,6 +247,9 @@
176247 struct mlx5e_ttc_table inner_ttc;
177248 #ifdef CONFIG_MLX5_EN_ARFS
178249 struct mlx5e_arfs_tables arfs;
250
+#endif
251
+#ifdef CONFIG_MLX5_EN_TLS
252
+ struct mlx5e_accel_fs_tcp *accel_tcp;
179253 #endif
180254 };
181255
....@@ -188,19 +262,18 @@
188262
189263 void mlx5e_set_ttc_basic_params(struct mlx5e_priv *priv, struct ttc_params *ttc_params);
190264 void mlx5e_set_ttc_ft_params(struct ttc_params *ttc_params);
191
-void mlx5e_set_inner_ttc_ft_params(struct ttc_params *ttc_params);
192265
193266 int mlx5e_create_ttc_table(struct mlx5e_priv *priv, struct ttc_params *params,
194267 struct mlx5e_ttc_table *ttc);
195268 void mlx5e_destroy_ttc_table(struct mlx5e_priv *priv,
196269 struct mlx5e_ttc_table *ttc);
197270
198
-int mlx5e_create_inner_ttc_table(struct mlx5e_priv *priv, struct ttc_params *params,
199
- struct mlx5e_ttc_table *ttc);
200
-void mlx5e_destroy_inner_ttc_table(struct mlx5e_priv *priv,
201
- struct mlx5e_ttc_table *ttc);
202
-
203271 void mlx5e_destroy_flow_table(struct mlx5e_flow_table *ft);
272
+int mlx5e_ttc_fwd_dest(struct mlx5e_priv *priv, enum mlx5e_traffic_types type,
273
+ struct mlx5_flow_destination *new_dest);
274
+struct mlx5_flow_destination
275
+mlx5e_ttc_get_default_dest(struct mlx5e_priv *priv, enum mlx5e_traffic_types type);
276
+int mlx5e_ttc_fwd_default_dest(struct mlx5e_priv *priv, enum mlx5e_traffic_types type);
204277
205278 void mlx5e_enable_cvlan_filter(struct mlx5e_priv *priv);
206279 void mlx5e_disable_cvlan_filter(struct mlx5e_priv *priv);
....@@ -208,5 +281,8 @@
208281 int mlx5e_create_flow_steering(struct mlx5e_priv *priv);
209282 void mlx5e_destroy_flow_steering(struct mlx5e_priv *priv);
210283
284
+bool mlx5e_tunnel_proto_supported(struct mlx5_core_dev *mdev, u8 proto_type);
285
+bool mlx5e_any_tunnel_proto_supported(struct mlx5_core_dev *mdev);
286
+
211287 #endif /* __MLX5E_FLOW_STEER_H__ */
212288