File Index
Files and directories
Sign in
FILE

cmd.h

File preview with syntax highlighting.

linux-6.19.14/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/cmd.h C
  1/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
  2/* Copyright (c) 2024 NVIDIA Corporation & Affiliates */
  3
  4#ifndef HWS_CMD_H_
  5#define HWS_CMD_H_
  6
  7#define WIRE_PORT 0xFFFF
  8
  9#define ACCESS_KEY_LEN	32
 10
 11enum mlx5hws_cmd_ext_dest_flags {
 12	MLX5HWS_CMD_EXT_DEST_REFORMAT = 1 << 0,
 13	MLX5HWS_CMD_EXT_DEST_ESW_OWNER_VHCA_ID = 1 << 1,
 14};
 15
 16struct mlx5hws_cmd_set_fte_dest {
 17	u8 destination_type;
 18	u32 destination_id;
 19	enum mlx5hws_cmd_ext_dest_flags ext_flags;
 20	u32 ext_reformat_id;
 21	u16 esw_owner_vhca_id;
 22};
 23
 24struct mlx5hws_cmd_set_fte_attr {
 25	u32 action_flags;
 26	bool ignore_flow_level;
 27	u8 flow_source;
 28	u8 extended_dest;
 29	u8 encrypt_decrypt_type;
 30	u32 encrypt_decrypt_obj_id;
 31	u32 packet_reformat_id;
 32	u32 dests_num;
 33	struct mlx5hws_cmd_set_fte_dest *dests;
 34};
 35
 36struct mlx5hws_cmd_ft_create_attr {
 37	u8 type;
 38	u8 level;
 39	u16 uid;
 40	bool rtc_valid;
 41	bool decap_en;
 42	bool reformat_en;
 43};
 44
 45struct mlx5hws_cmd_ft_modify_attr {
 46	u8 type;
 47	u32 rtc_id_0;
 48	u32 rtc_id_1;
 49	u32 table_miss_id;
 50	u8 table_miss_action;
 51	u64 modify_fs;
 52};
 53
 54struct mlx5hws_cmd_ft_query_attr {
 55	u8 type;
 56};
 57
 58struct mlx5hws_cmd_fg_attr {
 59	u32 table_id;
 60	u32 table_type;
 61};
 62
 63struct mlx5hws_cmd_forward_tbl {
 64	u8 type;
 65	u32 ft_id;
 66	u32 fg_id;
 67	u32 refcount; /* protected by context ctrl lock */
 68};
 69
 70struct mlx5hws_cmd_rtc_create_attr {
 71	u32 pd;
 72	u32 stc_base;
 73	u32 ste_base;
 74	u32 miss_ft_id;
 75	bool fw_gen_wqe;
 76	u8 update_index_mode;
 77	u8 access_index_mode;
 78	u8 num_hash_definer;
 79	u8 log_depth;
 80	u8 log_size;
 81	u8 table_type;
 82	u8 match_definer_0;
 83	u8 match_definer_1;
 84	u8 reparse_mode;
 85	bool is_frst_jumbo;
 86	bool is_scnd_range;
 87};
 88
 89struct mlx5hws_cmd_alias_obj_create_attr {
 90	u32 obj_id;
 91	u16 vhca_id;
 92	u16 obj_type;
 93	u8 access_key[ACCESS_KEY_LEN];
 94};
 95
 96struct mlx5hws_cmd_stc_create_attr {
 97	u8 log_obj_range;
 98	u8 table_type;
 99};
100
101struct mlx5hws_cmd_stc_modify_attr {
102	u32 stc_offset;
103	u8 action_offset;
104	u8 reparse_mode;
105	enum mlx5_ifc_stc_action_type action_type;
106	union {
107		u32 id; /* TIRN, TAG, FT ID, STE ID, CRYPTO */
108		struct {
109			u8 decap;
110			u16 start_anchor;
111			u16 end_anchor;
112		} remove_header;
113		struct {
114			u32 arg_id;
115			u32 pattern_id;
116		} modify_header;
117		struct {
118			__be64 data;
119		} modify_action;
120		struct {
121			u32 arg_id;
122			u32 header_size;
123			u8 is_inline;
124			u8 encap;
125			u16 insert_anchor;
126			u16 insert_offset;
127		} insert_header;
128		struct {
129			u8 aso_type;
130			u32 devx_obj_id;
131			u8 return_reg_id;
132		} aso;
133		struct {
134			u16 vport_num;
135			u16 esw_owner_vhca_id;
136			u8 eswitch_owner_vhca_id_valid;
137		} vport;
138		struct {
139			struct mlx5hws_pool_chunk ste;
140			struct mlx5hws_pool *ste_pool;
141			u32 ste_obj_id; /* Internal */
142			u32 match_definer_id;
143			u8 log_hash_size;
144			bool ignore_tx;
145		} ste_table;
146		struct {
147			u16 start_anchor;
148			u16 num_of_words;
149		} remove_words;
150		struct {
151			u8 type;
152			u8 op;
153			u8 size;
154		} reformat_trailer;
155
156		u32 dest_table_id;
157		u32 dest_tir_num;
158	};
159};
160
161struct mlx5hws_cmd_ste_create_attr {
162	u8 log_obj_range;
163	u8 table_type;
164};
165
166struct mlx5hws_cmd_definer_create_attr {
167	u8 *dw_selector;
168	u8 *byte_selector;
169	u8 *match_mask;
170};
171
172struct mlx5hws_cmd_allow_other_vhca_access_attr {
173	u16 obj_type;
174	u32 obj_id;
175	u8 access_key[ACCESS_KEY_LEN];
176};
177
178struct mlx5hws_cmd_packet_reformat_create_attr {
179	u8 type;
180	size_t data_sz;
181	void *data;
182	u8 reformat_param_0;
183};
184
185struct mlx5hws_cmd_query_ft_caps {
186	u8 max_level;
187	u8 reparse;
188	u8 ignore_flow_level_rtc_valid;
189};
190
191struct mlx5hws_cmd_generate_wqe_attr {
192	u8 *wqe_ctrl;
193	u8 *gta_ctrl;
194	u8 *gta_data_0;
195	u8 *gta_data_1;
196	u32 pdn;
197};
198
199struct mlx5hws_cmd_query_caps {
200	u32 flex_protocols;
201	u8 wqe_based_update;
202	u8 rtc_reparse_mode;
203	u16 ste_format;
204	u8 rtc_index_mode;
205	u8 ste_alloc_log_max;
206	u8 ste_alloc_log_gran;
207	u8 stc_alloc_log_max;
208	u8 stc_alloc_log_gran;
209	u8 rtc_log_depth_max;
210	u8 format_select_gtpu_dw_0;
211	u8 format_select_gtpu_dw_1;
212	u8 flow_table_hash_type;
213	u8 format_select_gtpu_dw_2;
214	u8 format_select_gtpu_ext_dw_0;
215	u8 access_index_mode;
216	u32 linear_match_definer;
217	bool full_dw_jumbo_support;
218	bool rtc_hash_split_table;
219	bool rtc_linear_lookup_table;
220	u32 supp_type_gen_wqe;
221	u8 rtc_max_hash_def_gen_wqe;
222	u16 supp_ste_format_gen_wqe;
223	struct mlx5hws_cmd_query_ft_caps nic_ft;
224	struct mlx5hws_cmd_query_ft_caps fdb_ft;
225	bool eswitch_manager;
226	bool merged_eswitch;
227	u32 eswitch_manager_vport_number;
228	u8 log_header_modify_argument_granularity;
229	u8 log_header_modify_argument_max_alloc;
230	u8 sq_ts_format;
231	u8 fdb_tir_stc;
232	u64 definer_format_sup;
233	u32 trivial_match_definer;
234	u32 vhca_id;
235	u32 shared_vhca_id;
236	char fw_ver[64];
237	bool ipsec_offload;
238	bool is_ecpf;
239	u8 flex_parser_ok_bits_supp;
240	u8 flex_parser_id_geneve_tlv_option_0;
241	u8 flex_parser_id_mpls_over_gre;
242	u8 flex_parser_id_mpls_over_udp;
243};
244
245int mlx5hws_cmd_flow_table_create(struct mlx5_core_dev *mdev,
246				  struct mlx5hws_cmd_ft_create_attr *ft_attr,
247				  u32 *table_id);
248
249int mlx5hws_cmd_flow_table_modify(struct mlx5_core_dev *mdev,
250				  struct mlx5hws_cmd_ft_modify_attr *ft_attr,
251				  u32 table_id);
252
253int mlx5hws_cmd_flow_table_query(struct mlx5_core_dev *mdev,
254				 u32 obj_id,
255				 struct mlx5hws_cmd_ft_query_attr *ft_attr,
256				 u64 *icm_addr_0, u64 *icm_addr_1);
257
258int mlx5hws_cmd_flow_table_destroy(struct mlx5_core_dev *mdev,
259				   u8 fw_ft_type, u32 table_id);
260
261int mlx5hws_cmd_rtc_create(struct mlx5_core_dev *mdev,
262			   struct mlx5hws_cmd_rtc_create_attr *rtc_attr,
263			   u32 *rtc_id);
264
265void mlx5hws_cmd_rtc_destroy(struct mlx5_core_dev *mdev, u32 rtc_id);
266
267int mlx5hws_cmd_stc_create(struct mlx5_core_dev *mdev,
268			   struct mlx5hws_cmd_stc_create_attr *stc_attr,
269			   u32 *stc_id);
270
271int mlx5hws_cmd_stc_modify(struct mlx5_core_dev *mdev,
272			   u32 stc_id,
273			   struct mlx5hws_cmd_stc_modify_attr *stc_attr);
274
275void mlx5hws_cmd_stc_destroy(struct mlx5_core_dev *mdev, u32 stc_id);
276
277int mlx5hws_cmd_generate_wqe(struct mlx5_core_dev *mdev,
278			     struct mlx5hws_cmd_generate_wqe_attr *attr,
279			     struct mlx5_cqe64 *ret_cqe);
280
281int mlx5hws_cmd_ste_create(struct mlx5_core_dev *mdev,
282			   struct mlx5hws_cmd_ste_create_attr *ste_attr,
283			   u32 *ste_id);
284
285void mlx5hws_cmd_ste_destroy(struct mlx5_core_dev *mdev, u32 ste_id);
286
287int mlx5hws_cmd_definer_create(struct mlx5_core_dev *mdev,
288			       struct mlx5hws_cmd_definer_create_attr *def_attr,
289			       u32 *definer_id);
290
291void mlx5hws_cmd_definer_destroy(struct mlx5_core_dev *mdev,
292				 u32 definer_id);
293
294int mlx5hws_cmd_arg_create(struct mlx5_core_dev *mdev,
295			   u16 log_obj_range,
296			   u32 pd,
297			   u32 *arg_id);
298
299void mlx5hws_cmd_arg_destroy(struct mlx5_core_dev *mdev,
300			     u32 arg_id);
301
302int mlx5hws_cmd_header_modify_pattern_create(struct mlx5_core_dev *mdev,
303					     u32 pattern_length,
304					     u8 *actions,
305					     u32 *ptrn_id);
306
307void mlx5hws_cmd_header_modify_pattern_destroy(struct mlx5_core_dev *mdev,
308					       u32 ptrn_id);
309
310int mlx5hws_cmd_packet_reformat_create(struct mlx5_core_dev *mdev,
311				       struct mlx5hws_cmd_packet_reformat_create_attr *attr,
312				       u32 *reformat_id);
313
314int mlx5hws_cmd_packet_reformat_destroy(struct mlx5_core_dev *mdev,
315					u32 reformat_id);
316
317int mlx5hws_cmd_set_fte(struct mlx5_core_dev *mdev,
318			u32 table_type,
319			u32 table_id,
320			u32 group_id,
321			struct mlx5hws_cmd_set_fte_attr *fte_attr);
322
323int mlx5hws_cmd_delete_fte(struct mlx5_core_dev *mdev,
324			   u32 table_type, u32 table_id);
325
326struct mlx5hws_cmd_forward_tbl *
327mlx5hws_cmd_forward_tbl_create(struct mlx5_core_dev *mdev,
328			       struct mlx5hws_cmd_ft_create_attr *ft_attr,
329			       struct mlx5hws_cmd_set_fte_attr *fte_attr);
330
331void mlx5hws_cmd_forward_tbl_destroy(struct mlx5_core_dev *mdev,
332				     struct mlx5hws_cmd_forward_tbl *tbl);
333
334int mlx5hws_cmd_sq_modify_rdy(struct mlx5_core_dev *mdev, u32 sqn);
335
336int mlx5hws_cmd_query_caps(struct mlx5_core_dev *mdev,
337			   struct mlx5hws_cmd_query_caps *caps);
338
339void mlx5hws_cmd_set_attr_connect_miss_tbl(struct mlx5hws_context *ctx,
340					   u32 fw_ft_type,
341					   enum mlx5hws_table_type type,
342					   struct mlx5hws_cmd_ft_modify_attr *ft_attr);
343
344int mlx5hws_cmd_query_gvmi(struct mlx5_core_dev *mdev, bool other_function,
345			   u16 vport_number, u16 *gvmi);
346
347#endif /* HWS_CMD_H_ */
~/ Read-only file preview.