Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (c) 2013-2015, Mellanox Technologies, Ltd.  All rights reserved.
0003  *
0004  * This software is available to you under a choice of one of two
0005  * licenses.  You may choose to be licensed under the terms of the GNU
0006  * General Public License (GPL) Version 2, available from the file
0007  * COPYING in the main directory of this source tree, or the
0008  * OpenIB.org BSD license below:
0009  *
0010  *     Redistribution and use in source and binary forms, with or
0011  *     without modification, are permitted provided that the following
0012  *     conditions are met:
0013  *
0014  *      - Redistributions of source code must retain the above
0015  *        copyright notice, this list of conditions and the following
0016  *        disclaimer.
0017  *
0018  *      - Redistributions in binary form must reproduce the above
0019  *        copyright notice, this list of conditions and the following
0020  *        disclaimer in the documentation and/or other materials
0021  *        provided with the distribution.
0022  *
0023  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0024  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0025  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
0026  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
0027  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
0028  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
0029  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
0030  * SOFTWARE.
0031  */
0032 
0033 #ifndef __TRANSOBJ_H__
0034 #define __TRANSOBJ_H__
0035 
0036 #include <linux/mlx5/driver.h>
0037 
0038 int mlx5_core_alloc_transport_domain(struct mlx5_core_dev *dev, u32 *tdn);
0039 void mlx5_core_dealloc_transport_domain(struct mlx5_core_dev *dev, u32 tdn);
0040 int mlx5_core_create_rq(struct mlx5_core_dev *dev, u32 *in, int inlen,
0041             u32 *rqn);
0042 int mlx5_core_modify_rq(struct mlx5_core_dev *dev, u32 rqn, u32 *in);
0043 void mlx5_core_destroy_rq(struct mlx5_core_dev *dev, u32 rqn);
0044 int mlx5_core_query_rq(struct mlx5_core_dev *dev, u32 rqn, u32 *out);
0045 int mlx5_core_create_sq(struct mlx5_core_dev *dev, u32 *in, int inlen,
0046             u32 *sqn);
0047 int mlx5_core_modify_sq(struct mlx5_core_dev *dev, u32 sqn, u32 *in);
0048 void mlx5_core_destroy_sq(struct mlx5_core_dev *dev, u32 sqn);
0049 int mlx5_core_query_sq(struct mlx5_core_dev *dev, u32 sqn, u32 *out);
0050 int mlx5_core_query_sq_state(struct mlx5_core_dev *dev, u32 sqn, u8 *state);
0051 int mlx5_core_create_tir(struct mlx5_core_dev *dev, u32 *in, u32 *tirn);
0052 int mlx5_core_modify_tir(struct mlx5_core_dev *dev, u32 tirn, u32 *in);
0053 void mlx5_core_destroy_tir(struct mlx5_core_dev *dev, u32 tirn);
0054 int mlx5_core_create_tis(struct mlx5_core_dev *dev, u32 *in, u32 *tisn);
0055 int mlx5_core_modify_tis(struct mlx5_core_dev *dev, u32 tisn, u32 *in);
0056 void mlx5_core_destroy_tis(struct mlx5_core_dev *dev, u32 tisn);
0057 int mlx5_core_create_rqt(struct mlx5_core_dev *dev, u32 *in, int inlen,
0058              u32 *rqtn);
0059 int mlx5_core_modify_rqt(struct mlx5_core_dev *dev, u32 rqtn, u32 *in,
0060              int inlen);
0061 void mlx5_core_destroy_rqt(struct mlx5_core_dev *dev, u32 rqtn);
0062 
0063 struct mlx5_hairpin_params {
0064     u8  log_data_size;
0065     u8  log_num_packets;
0066     u16 q_counter;
0067     int num_channels;
0068 };
0069 
0070 struct mlx5_hairpin {
0071     struct mlx5_core_dev *func_mdev;
0072     struct mlx5_core_dev *peer_mdev;
0073 
0074     int num_channels;
0075 
0076     u32 *rqn;
0077     u32 *sqn;
0078 
0079     bool peer_gone;
0080 };
0081 
0082 struct mlx5_hairpin *
0083 mlx5_core_hairpin_create(struct mlx5_core_dev *func_mdev,
0084              struct mlx5_core_dev *peer_mdev,
0085              struct mlx5_hairpin_params *params);
0086 
0087 void mlx5_core_hairpin_destroy(struct mlx5_hairpin *pair);
0088 void mlx5_core_hairpin_clear_dead_peer(struct mlx5_hairpin *hp);
0089 #endif /* __TRANSOBJ_H__ */