hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/include/linux/mlx5/fs.h
....@@ -42,10 +42,14 @@
4242 MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_PRIO = 1 << 16,
4343 MLX5_FLOW_CONTEXT_ACTION_ENCRYPT = 1 << 17,
4444 MLX5_FLOW_CONTEXT_ACTION_DECRYPT = 1 << 18,
45
+ MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_NS = 1 << 19,
4546 };
4647
4748 enum {
48
- MLX5_FLOW_TABLE_TUNNEL_EN = BIT(0),
49
+ MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT = BIT(0),
50
+ MLX5_FLOW_TABLE_TUNNEL_EN_DECAP = BIT(1),
51
+ MLX5_FLOW_TABLE_TERMINATION = BIT(2),
52
+ MLX5_FLOW_TABLE_UNMANAGED = BIT(3),
4953 };
5054
5155 #define LEFTOVERS_RULE_NUM 2
....@@ -72,17 +76,47 @@
7276 MLX5_FLOW_NAMESPACE_SNIFFER_RX,
7377 MLX5_FLOW_NAMESPACE_SNIFFER_TX,
7478 MLX5_FLOW_NAMESPACE_EGRESS,
79
+ MLX5_FLOW_NAMESPACE_EGRESS_KERNEL,
80
+ MLX5_FLOW_NAMESPACE_RDMA_RX,
81
+ MLX5_FLOW_NAMESPACE_RDMA_RX_KERNEL,
82
+ MLX5_FLOW_NAMESPACE_RDMA_TX,
7583 };
7684
85
+enum {
86
+ FDB_BYPASS_PATH,
87
+ FDB_TC_OFFLOAD,
88
+ FDB_FT_OFFLOAD,
89
+ FDB_SLOW_PATH,
90
+ FDB_PER_VPORT,
91
+};
92
+
93
+struct mlx5_pkt_reformat;
94
+struct mlx5_modify_hdr;
7795 struct mlx5_flow_table;
7896 struct mlx5_flow_group;
7997 struct mlx5_flow_namespace;
8098 struct mlx5_flow_handle;
8199
100
+enum {
101
+ FLOW_CONTEXT_HAS_TAG = BIT(0),
102
+};
103
+
104
+struct mlx5_flow_context {
105
+ u32 flags;
106
+ u32 flow_tag;
107
+ u32 flow_source;
108
+};
109
+
82110 struct mlx5_flow_spec {
83111 u8 match_criteria_enable;
84112 u32 match_criteria[MLX5_ST_SZ_DW(fte_match_param)];
85113 u32 match_value[MLX5_ST_SZ_DW(fte_match_param)];
114
+ struct mlx5_flow_context flow_context;
115
+};
116
+
117
+enum {
118
+ MLX5_FLOW_DEST_VPORT_VHCA_ID = BIT(0),
119
+ MLX5_FLOW_DEST_VPORT_REFORMAT_ID = BIT(1),
86120 };
87121
88122 struct mlx5_flow_destination {
....@@ -91,15 +125,23 @@
91125 u32 tir_num;
92126 u32 ft_num;
93127 struct mlx5_flow_table *ft;
94
- struct mlx5_fc *counter;
128
+ u32 counter_id;
95129 struct {
96130 u16 num;
97131 u16 vhca_id;
98
- bool vhca_id_valid;
132
+ struct mlx5_pkt_reformat *pkt_reformat;
133
+ u8 flags;
99134 } vport;
100135 };
101136 };
102137
138
+struct mod_hdr_tbl {
139
+ struct mutex lock; /* protects hlist */
140
+ DECLARE_HASHTABLE(hlist, 8);
141
+};
142
+
143
+struct mlx5_flow_namespace *
144
+mlx5_get_fdb_sub_ns(struct mlx5_core_dev *dev, int n);
103145 struct mlx5_flow_namespace *
104146 mlx5_get_flow_namespace(struct mlx5_core_dev *dev,
105147 enum mlx5_flow_namespace_type type);
....@@ -108,24 +150,26 @@
108150 enum mlx5_flow_namespace_type type,
109151 int vport);
110152
111
-struct mlx5_flow_table *
112
-mlx5_create_auto_grouped_flow_table(struct mlx5_flow_namespace *ns,
113
- int prio,
114
- int num_flow_table_entries,
115
- int max_num_groups,
116
- u32 level,
117
- u32 flags);
118
-
119153 struct mlx5_flow_table_attr {
120154 int prio;
121155 int max_fte;
122156 u32 level;
123157 u32 flags;
158
+ struct mlx5_flow_table *next_ft;
159
+
160
+ struct {
161
+ int max_num_groups;
162
+ int num_reserved_entries;
163
+ } autogroup;
124164 };
125165
126166 struct mlx5_flow_table *
127167 mlx5_create_flow_table(struct mlx5_flow_namespace *ns,
128168 struct mlx5_flow_table_attr *ft_attr);
169
+
170
+struct mlx5_flow_table *
171
+mlx5_create_auto_grouped_flow_table(struct mlx5_flow_namespace *ns,
172
+ struct mlx5_flow_table_attr *ft_attr);
129173
130174 struct mlx5_flow_table *
131175 mlx5_create_vport_flow_table(struct mlx5_flow_namespace *ns,
....@@ -155,27 +199,34 @@
155199
156200 #define MLX5_FS_VLAN_DEPTH 2
157201
202
+enum {
203
+ FLOW_ACT_NO_APPEND = BIT(0),
204
+ FLOW_ACT_IGNORE_FLOW_LEVEL = BIT(1),
205
+};
206
+
158207 struct mlx5_flow_act {
159208 u32 action;
160
- bool has_flow_tag;
161
- u32 flow_tag;
162
- u32 encap_id;
163
- u32 modify_id;
164
- uintptr_t esp_id;
209
+ struct mlx5_modify_hdr *modify_hdr;
210
+ struct mlx5_pkt_reformat *pkt_reformat;
211
+ union {
212
+ u32 ipsec_obj_id;
213
+ uintptr_t esp_id;
214
+ };
215
+ u32 flags;
165216 struct mlx5_fs_vlan vlan[MLX5_FS_VLAN_DEPTH];
166217 struct ib_counters *counters;
167218 };
168219
169220 #define MLX5_DECLARE_FLOW_ACT(name) \
170
- struct mlx5_flow_act name = {MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,\
171
- MLX5_FS_DEFAULT_FLOW_TAG, 0, 0}
221
+ struct mlx5_flow_act name = { .action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,\
222
+ .flags = 0, }
172223
173224 /* Single destination per rule.
174225 * Group ID is implied by the match criteria.
175226 */
176227 struct mlx5_flow_handle *
177228 mlx5_add_flow_rules(struct mlx5_flow_table *ft,
178
- struct mlx5_flow_spec *spec,
229
+ const struct mlx5_flow_spec *spec,
179230 struct mlx5_flow_act *flow_act,
180231 struct mlx5_flow_destination *dest,
181232 int num_dest);
....@@ -185,7 +236,6 @@
185236 struct mlx5_flow_destination *new_dest,
186237 struct mlx5_flow_destination *old_dest);
187238
188
-struct mlx5_fc *mlx5_flow_rule_counter(struct mlx5_flow_handle *handler);
189239 struct mlx5_fc *mlx5_fc_create(struct mlx5_core_dev *dev, bool aging);
190240 void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter);
191241 u64 mlx5_fc_query_lastuse(struct mlx5_fc *counter);
....@@ -193,8 +243,23 @@
193243 u64 *bytes, u64 *packets, u64 *lastuse);
194244 int mlx5_fc_query(struct mlx5_core_dev *dev, struct mlx5_fc *counter,
195245 u64 *packets, u64 *bytes);
246
+u32 mlx5_fc_id(struct mlx5_fc *counter);
196247
197248 int mlx5_fs_add_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn);
198249 int mlx5_fs_remove_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn);
199250
251
+struct mlx5_modify_hdr *mlx5_modify_header_alloc(struct mlx5_core_dev *dev,
252
+ u8 ns_type, u8 num_actions,
253
+ void *modify_actions);
254
+void mlx5_modify_header_dealloc(struct mlx5_core_dev *dev,
255
+ struct mlx5_modify_hdr *modify_hdr);
256
+
257
+struct mlx5_pkt_reformat *mlx5_packet_reformat_alloc(struct mlx5_core_dev *dev,
258
+ int reformat_type,
259
+ size_t size,
260
+ void *reformat_data,
261
+ enum mlx5_flow_namespace_type ns_type);
262
+void mlx5_packet_reformat_dealloc(struct mlx5_core_dev *dev,
263
+ struct mlx5_pkt_reformat *reformat);
264
+
200265 #endif