162306a36Sopenharmony_ci/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
462306a36Sopenharmony_ci * Copyright (c) 2007, 2008 Mellanox Technologies. All rights reserved.
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * This software is available to you under a choice of one of two
762306a36Sopenharmony_ci * licenses.  You may choose to be licensed under the terms of the GNU
862306a36Sopenharmony_ci * General Public License (GPL) Version 2, available from the file
962306a36Sopenharmony_ci * COPYING in the main directory of this source tree, or the
1062306a36Sopenharmony_ci * OpenIB.org BSD license below:
1162306a36Sopenharmony_ci *
1262306a36Sopenharmony_ci *     Redistribution and use in source and binary forms, with or
1362306a36Sopenharmony_ci *     without modification, are permitted provided that the following
1462306a36Sopenharmony_ci *     conditions are met:
1562306a36Sopenharmony_ci *
1662306a36Sopenharmony_ci *      - Redistributions of source code must retain the above
1762306a36Sopenharmony_ci *        copyright notice, this list of conditions and the following
1862306a36Sopenharmony_ci *        disclaimer.
1962306a36Sopenharmony_ci *
2062306a36Sopenharmony_ci *      - Redistributions in binary form must reproduce the above
2162306a36Sopenharmony_ci *        copyright notice, this list of conditions and the following
2262306a36Sopenharmony_ci *        disclaimer in the documentation and/or other materials
2362306a36Sopenharmony_ci *        provided with the distribution.
2462306a36Sopenharmony_ci *
2562306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
2662306a36Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2762306a36Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
2862306a36Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
2962306a36Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
3062306a36Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
3162306a36Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3262306a36Sopenharmony_ci * SOFTWARE.
3362306a36Sopenharmony_ci */
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#ifndef MLX4_ABI_USER_H
3662306a36Sopenharmony_ci#define MLX4_ABI_USER_H
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci#include <linux/types.h>
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci/*
4162306a36Sopenharmony_ci * Increment this value if any changes that break userspace ABI
4262306a36Sopenharmony_ci * compatibility are made.
4362306a36Sopenharmony_ci */
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci#define MLX4_IB_UVERBS_NO_DEV_CAPS_ABI_VERSION	3
4662306a36Sopenharmony_ci#define MLX4_IB_UVERBS_ABI_VERSION		4
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci/*
4962306a36Sopenharmony_ci * Make sure that all structs defined in this file remain laid out so
5062306a36Sopenharmony_ci * that they pack the same way on 32-bit and 64-bit architectures (to
5162306a36Sopenharmony_ci * avoid incompatibility between 32-bit userspace and 64-bit kernels).
5262306a36Sopenharmony_ci * In particular do not use pointer types -- pass pointers in __u64
5362306a36Sopenharmony_ci * instead.
5462306a36Sopenharmony_ci */
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_cistruct mlx4_ib_alloc_ucontext_resp_v3 {
5762306a36Sopenharmony_ci	__u32	qp_tab_size;
5862306a36Sopenharmony_ci	__u16	bf_reg_size;
5962306a36Sopenharmony_ci	__u16	bf_regs_per_page;
6062306a36Sopenharmony_ci};
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_cienum {
6362306a36Sopenharmony_ci	MLX4_USER_DEV_CAP_LARGE_CQE	= 1L << 0,
6462306a36Sopenharmony_ci};
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_cistruct mlx4_ib_alloc_ucontext_resp {
6762306a36Sopenharmony_ci	__u32	dev_caps;
6862306a36Sopenharmony_ci	__u32	qp_tab_size;
6962306a36Sopenharmony_ci	__u16	bf_reg_size;
7062306a36Sopenharmony_ci	__u16	bf_regs_per_page;
7162306a36Sopenharmony_ci	__u32	cqe_size;
7262306a36Sopenharmony_ci};
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_cistruct mlx4_ib_alloc_pd_resp {
7562306a36Sopenharmony_ci	__u32	pdn;
7662306a36Sopenharmony_ci	__u32	reserved;
7762306a36Sopenharmony_ci};
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_cistruct mlx4_ib_create_cq {
8062306a36Sopenharmony_ci	__aligned_u64 buf_addr;
8162306a36Sopenharmony_ci	__aligned_u64 db_addr;
8262306a36Sopenharmony_ci};
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_cistruct mlx4_ib_create_cq_resp {
8562306a36Sopenharmony_ci	__u32	cqn;
8662306a36Sopenharmony_ci	__u32	reserved;
8762306a36Sopenharmony_ci};
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_cistruct mlx4_ib_resize_cq {
9062306a36Sopenharmony_ci	__aligned_u64 buf_addr;
9162306a36Sopenharmony_ci};
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_cistruct mlx4_ib_create_srq {
9462306a36Sopenharmony_ci	__aligned_u64 buf_addr;
9562306a36Sopenharmony_ci	__aligned_u64 db_addr;
9662306a36Sopenharmony_ci};
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_cistruct mlx4_ib_create_srq_resp {
9962306a36Sopenharmony_ci	__u32	srqn;
10062306a36Sopenharmony_ci	__u32	reserved;
10162306a36Sopenharmony_ci};
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_cistruct mlx4_ib_create_qp_rss {
10462306a36Sopenharmony_ci	__aligned_u64 rx_hash_fields_mask; /* Use  enum mlx4_ib_rx_hash_fields */
10562306a36Sopenharmony_ci	__u8    rx_hash_function; /* Use enum mlx4_ib_rx_hash_function_flags */
10662306a36Sopenharmony_ci	__u8    reserved[7];
10762306a36Sopenharmony_ci	__u8    rx_hash_key[40];
10862306a36Sopenharmony_ci	__u32   comp_mask;
10962306a36Sopenharmony_ci	__u32   reserved1;
11062306a36Sopenharmony_ci};
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_cistruct mlx4_ib_create_qp {
11362306a36Sopenharmony_ci	__aligned_u64 buf_addr;
11462306a36Sopenharmony_ci	__aligned_u64 db_addr;
11562306a36Sopenharmony_ci	__u8	log_sq_bb_count;
11662306a36Sopenharmony_ci	__u8	log_sq_stride;
11762306a36Sopenharmony_ci	__u8	sq_no_prefetch;
11862306a36Sopenharmony_ci	__u8	reserved;
11962306a36Sopenharmony_ci	__u32	inl_recv_sz;
12062306a36Sopenharmony_ci};
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_cistruct mlx4_ib_create_wq {
12362306a36Sopenharmony_ci	__aligned_u64 buf_addr;
12462306a36Sopenharmony_ci	__aligned_u64 db_addr;
12562306a36Sopenharmony_ci	__u8	log_range_size;
12662306a36Sopenharmony_ci	__u8	reserved[3];
12762306a36Sopenharmony_ci	__u32   comp_mask;
12862306a36Sopenharmony_ci};
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_cistruct mlx4_ib_modify_wq {
13162306a36Sopenharmony_ci	__u32	comp_mask;
13262306a36Sopenharmony_ci	__u32	reserved;
13362306a36Sopenharmony_ci};
13462306a36Sopenharmony_ci
13562306a36Sopenharmony_cistruct mlx4_ib_create_rwq_ind_tbl_resp {
13662306a36Sopenharmony_ci	__u32	response_length;
13762306a36Sopenharmony_ci	__u32	reserved;
13862306a36Sopenharmony_ci};
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_ci/* RX Hash function flags */
14162306a36Sopenharmony_cienum mlx4_ib_rx_hash_function_flags {
14262306a36Sopenharmony_ci	MLX4_IB_RX_HASH_FUNC_TOEPLITZ	= 1 << 0,
14362306a36Sopenharmony_ci};
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ci/*
14662306a36Sopenharmony_ci * RX Hash flags, these flags allows to set which incoming packet's field should
14762306a36Sopenharmony_ci * participates in RX Hash. Each flag represent certain packet's field,
14862306a36Sopenharmony_ci * when the flag is set the field that is represented by the flag will
14962306a36Sopenharmony_ci * participate in RX Hash calculation.
15062306a36Sopenharmony_ci */
15162306a36Sopenharmony_cienum mlx4_ib_rx_hash_fields {
15262306a36Sopenharmony_ci	MLX4_IB_RX_HASH_SRC_IPV4	= 1 << 0,
15362306a36Sopenharmony_ci	MLX4_IB_RX_HASH_DST_IPV4	= 1 << 1,
15462306a36Sopenharmony_ci	MLX4_IB_RX_HASH_SRC_IPV6	= 1 << 2,
15562306a36Sopenharmony_ci	MLX4_IB_RX_HASH_DST_IPV6	= 1 << 3,
15662306a36Sopenharmony_ci	MLX4_IB_RX_HASH_SRC_PORT_TCP	= 1 << 4,
15762306a36Sopenharmony_ci	MLX4_IB_RX_HASH_DST_PORT_TCP	= 1 << 5,
15862306a36Sopenharmony_ci	MLX4_IB_RX_HASH_SRC_PORT_UDP	= 1 << 6,
15962306a36Sopenharmony_ci	MLX4_IB_RX_HASH_DST_PORT_UDP	= 1 << 7,
16062306a36Sopenharmony_ci	MLX4_IB_RX_HASH_INNER		= 1ULL << 31,
16162306a36Sopenharmony_ci};
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_cistruct mlx4_ib_rss_caps {
16462306a36Sopenharmony_ci	__aligned_u64 rx_hash_fields_mask; /* enum mlx4_ib_rx_hash_fields */
16562306a36Sopenharmony_ci	__u8 rx_hash_function; /* enum mlx4_ib_rx_hash_function_flags */
16662306a36Sopenharmony_ci	__u8 reserved[7];
16762306a36Sopenharmony_ci};
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_cienum query_device_resp_mask {
17062306a36Sopenharmony_ci	MLX4_IB_QUERY_DEV_RESP_MASK_CORE_CLOCK_OFFSET = 1UL << 0,
17162306a36Sopenharmony_ci};
17262306a36Sopenharmony_ci
17362306a36Sopenharmony_cistruct mlx4_ib_tso_caps {
17462306a36Sopenharmony_ci	__u32 max_tso; /* Maximum tso payload size in bytes */
17562306a36Sopenharmony_ci	/* Corresponding bit will be set if qp type from
17662306a36Sopenharmony_ci	 * 'enum ib_qp_type' is supported.
17762306a36Sopenharmony_ci	 */
17862306a36Sopenharmony_ci	__u32 supported_qpts;
17962306a36Sopenharmony_ci};
18062306a36Sopenharmony_ci
18162306a36Sopenharmony_cistruct mlx4_uverbs_ex_query_device_resp {
18262306a36Sopenharmony_ci	__u32			comp_mask;
18362306a36Sopenharmony_ci	__u32			response_length;
18462306a36Sopenharmony_ci	__aligned_u64		hca_core_clock_offset;
18562306a36Sopenharmony_ci	__u32			max_inl_recv_sz;
18662306a36Sopenharmony_ci	__u32			reserved;
18762306a36Sopenharmony_ci	struct mlx4_ib_rss_caps	rss_caps;
18862306a36Sopenharmony_ci	struct mlx4_ib_tso_caps tso_caps;
18962306a36Sopenharmony_ci};
19062306a36Sopenharmony_ci
19162306a36Sopenharmony_ci#endif /* MLX4_ABI_USER_H */
192