xref: /linux-6.15/include/linux/mlx5/transobj.h (revision a3e5fd93)
18d7f9ecbS[email protected] /*
28d7f9ecbS[email protected]  * Copyright (c) 2013-2015, Mellanox Technologies, Ltd.  All rights reserved.
38d7f9ecbS[email protected]  *
48d7f9ecbS[email protected]  * This software is available to you under a choice of one of two
58d7f9ecbS[email protected]  * licenses.  You may choose to be licensed under the terms of the GNU
68d7f9ecbS[email protected]  * General Public License (GPL) Version 2, available from the file
78d7f9ecbS[email protected]  * COPYING in the main directory of this source tree, or the
88d7f9ecbS[email protected]  * OpenIB.org BSD license below:
98d7f9ecbS[email protected]  *
108d7f9ecbS[email protected]  *     Redistribution and use in source and binary forms, with or
118d7f9ecbS[email protected]  *     without modification, are permitted provided that the following
128d7f9ecbS[email protected]  *     conditions are met:
138d7f9ecbS[email protected]  *
148d7f9ecbS[email protected]  *      - Redistributions of source code must retain the above
158d7f9ecbS[email protected]  *        copyright notice, this list of conditions and the following
168d7f9ecbS[email protected]  *        disclaimer.
178d7f9ecbS[email protected]  *
188d7f9ecbS[email protected]  *      - Redistributions in binary form must reproduce the above
198d7f9ecbS[email protected]  *        copyright notice, this list of conditions and the following
208d7f9ecbS[email protected]  *        disclaimer in the documentation and/or other materials
218d7f9ecbS[email protected]  *        provided with the distribution.
228d7f9ecbS[email protected]  *
238d7f9ecbS[email protected]  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
248d7f9ecbS[email protected]  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
258d7f9ecbS[email protected]  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
268d7f9ecbS[email protected]  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
278d7f9ecbS[email protected]  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
288d7f9ecbS[email protected]  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
298d7f9ecbS[email protected]  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
308d7f9ecbS[email protected]  * SOFTWARE.
318d7f9ecbS[email protected]  */
328d7f9ecbS[email protected] 
338d7f9ecbS[email protected] #ifndef __TRANSOBJ_H__
348d7f9ecbS[email protected] #define __TRANSOBJ_H__
358d7f9ecbS[email protected] 
368d7f9ecbS[email protected] #include <linux/mlx5/driver.h>
378d7f9ecbS[email protected] 
388d7f9ecbS[email protected] int mlx5_core_alloc_transport_domain(struct mlx5_core_dev *dev, u32 *tdn);
398d7f9ecbS[email protected] void mlx5_core_dealloc_transport_domain(struct mlx5_core_dev *dev, u32 tdn);
408d7f9ecbS[email protected] int mlx5_core_create_rq(struct mlx5_core_dev *dev, u32 *in, int inlen,
418d7f9ecbS[email protected] 			u32 *rqn);
42e0b4b472SLeon Romanovsky int mlx5_core_modify_rq(struct mlx5_core_dev *dev, u32 rqn, u32 *in);
438d7f9ecbS[email protected] void mlx5_core_destroy_rq(struct mlx5_core_dev *dev, u32 rqn);
446d2f89dfS[email protected] int mlx5_core_query_rq(struct mlx5_core_dev *dev, u32 rqn, u32 *out);
458d7f9ecbS[email protected] int mlx5_core_create_sq(struct mlx5_core_dev *dev, u32 *in, int inlen,
468d7f9ecbS[email protected] 			u32 *sqn);
47e0b4b472SLeon Romanovsky int mlx5_core_modify_sq(struct mlx5_core_dev *dev, u32 sqn, u32 *in);
488d7f9ecbS[email protected] void mlx5_core_destroy_sq(struct mlx5_core_dev *dev, u32 sqn);
496d2f89dfS[email protected] int mlx5_core_query_sq(struct mlx5_core_dev *dev, u32 sqn, u32 *out);
5028160771SEran Ben Elisha int mlx5_core_query_sq_state(struct mlx5_core_dev *dev, u32 sqn, u8 *state);
51e0b4b472SLeon Romanovsky int mlx5_core_create_tir(struct mlx5_core_dev *dev, u32 *in, u32 *tirn);
52e0b4b472SLeon Romanovsky int mlx5_core_modify_tir(struct mlx5_core_dev *dev, u32 tirn, u32 *in);
538d7f9ecbS[email protected] void mlx5_core_destroy_tir(struct mlx5_core_dev *dev, u32 tirn);
54e0b4b472SLeon Romanovsky int mlx5_core_create_tis(struct mlx5_core_dev *dev, u32 *in, u32 *tisn);
55e0b4b472SLeon Romanovsky int mlx5_core_modify_tis(struct mlx5_core_dev *dev, u32 tisn, u32 *in);
568d7f9ecbS[email protected] void mlx5_core_destroy_tis(struct mlx5_core_dev *dev, u32 tisn);
578d7f9ecbS[email protected] int mlx5_core_create_rqt(struct mlx5_core_dev *dev, u32 *in, int inlen,
588d7f9ecbS[email protected] 			 u32 *rqtn);
598d7f9ecbS[email protected] int mlx5_core_modify_rqt(struct mlx5_core_dev *dev, u32 rqtn, u32 *in,
608d7f9ecbS[email protected] 			 int inlen);
618d7f9ecbS[email protected] void mlx5_core_destroy_rqt(struct mlx5_core_dev *dev, u32 rqtn);
628d7f9ecbS[email protected] 
6318e568c3SOr Gerlitz struct mlx5_hairpin_params {
6418e568c3SOr Gerlitz 	u8  log_data_size;
654d533e0fSOr Gerlitz 	u8  log_num_packets;
6618e568c3SOr Gerlitz 	u16 q_counter;
67ddae74acSOr Gerlitz 	int num_channels;
6818e568c3SOr Gerlitz };
6918e568c3SOr Gerlitz 
7018e568c3SOr Gerlitz struct mlx5_hairpin {
7118e568c3SOr Gerlitz 	struct mlx5_core_dev *func_mdev;
7218e568c3SOr Gerlitz 	struct mlx5_core_dev *peer_mdev;
7318e568c3SOr Gerlitz 
74ddae74acSOr Gerlitz 	int num_channels;
75ddae74acSOr Gerlitz 
76ddae74acSOr Gerlitz 	u32 *rqn;
77ddae74acSOr Gerlitz 	u32 *sqn;
784d8fcf21SAlaa Hleihel 
794d8fcf21SAlaa Hleihel 	bool peer_gone;
8018e568c3SOr Gerlitz };
8118e568c3SOr Gerlitz 
8218e568c3SOr Gerlitz struct mlx5_hairpin *
8318e568c3SOr Gerlitz mlx5_core_hairpin_create(struct mlx5_core_dev *func_mdev,
8418e568c3SOr Gerlitz 			 struct mlx5_core_dev *peer_mdev,
8518e568c3SOr Gerlitz 			 struct mlx5_hairpin_params *params);
8618e568c3SOr Gerlitz 
8718e568c3SOr Gerlitz void mlx5_core_hairpin_destroy(struct mlx5_hairpin *pair);
88*a3e5fd93SDima Chumak void mlx5_core_hairpin_clear_dead_peer(struct mlx5_hairpin *hp);
898d7f9ecbS[email protected] #endif /* __TRANSOBJ_H__ */
90