xref: /linux/include/uapi/rdma/bnxt_re-abi.h (revision 3a39d672e7f48b8d6b91a09afa4b55352773b4b5)
1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */
21ac5a404SSelvin Xavier /*
31ac5a404SSelvin Xavier  * Broadcom NetXtreme-E RoCE driver.
41ac5a404SSelvin Xavier  *
51ac5a404SSelvin Xavier  * Copyright (c) 2016 - 2017, Broadcom. All rights reserved.  The term
61ac5a404SSelvin Xavier  * Broadcom refers to Broadcom Limited and/or its subsidiaries.
71ac5a404SSelvin Xavier  *
81ac5a404SSelvin Xavier  * This software is available to you under a choice of one of two
91ac5a404SSelvin Xavier  * licenses.  You may choose to be licensed under the terms of the GNU
101ac5a404SSelvin Xavier  * General Public License (GPL) Version 2, available from the file
111ac5a404SSelvin Xavier  * COPYING in the main directory of this source tree, or the
121ac5a404SSelvin Xavier  * BSD license below:
131ac5a404SSelvin Xavier  *
141ac5a404SSelvin Xavier  * Redistribution and use in source and binary forms, with or without
151ac5a404SSelvin Xavier  * modification, are permitted provided that the following conditions
161ac5a404SSelvin Xavier  * are met:
171ac5a404SSelvin Xavier  *
181ac5a404SSelvin Xavier  * 1. Redistributions of source code must retain the above copyright
191ac5a404SSelvin Xavier  *    notice, this list of conditions and the following disclaimer.
201ac5a404SSelvin Xavier  * 2. Redistributions in binary form must reproduce the above copyright
211ac5a404SSelvin Xavier  *    notice, this list of conditions and the following disclaimer in
221ac5a404SSelvin Xavier  *    the documentation and/or other materials provided with the
231ac5a404SSelvin Xavier  *    distribution.
241ac5a404SSelvin Xavier  *
251ac5a404SSelvin Xavier  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
261ac5a404SSelvin Xavier  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
271ac5a404SSelvin Xavier  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
281ac5a404SSelvin Xavier  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
291ac5a404SSelvin Xavier  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
301ac5a404SSelvin Xavier  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
311ac5a404SSelvin Xavier  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
321ac5a404SSelvin Xavier  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
331ac5a404SSelvin Xavier  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
341ac5a404SSelvin Xavier  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
351ac5a404SSelvin Xavier  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
361ac5a404SSelvin Xavier  *
371ac5a404SSelvin Xavier  * Description: Uverbs ABI header file
381ac5a404SSelvin Xavier  */
391ac5a404SSelvin Xavier 
401ac5a404SSelvin Xavier #ifndef __BNXT_RE_UVERBS_ABI_H__
411ac5a404SSelvin Xavier #define __BNXT_RE_UVERBS_ABI_H__
421ac5a404SSelvin Xavier 
439078b4eeSNicolas Dichtel #include <linux/types.h>
44360da60dSSelvin Xavier #include <rdma/ib_user_ioctl_cmds.h>
459078b4eeSNicolas Dichtel 
461ac5a404SSelvin Xavier #define BNXT_RE_ABI_VERSION	1
471ac5a404SSelvin Xavier 
4895b86d1cSDevesh Sharma #define BNXT_RE_CHIP_ID0_CHIP_NUM_SFT		0x00
4995b86d1cSDevesh Sharma #define BNXT_RE_CHIP_ID0_CHIP_REV_SFT		0x10
5095b86d1cSDevesh Sharma #define BNXT_RE_CHIP_ID0_CHIP_MET_SFT		0x18
5195b86d1cSDevesh Sharma 
5295b86d1cSDevesh Sharma enum {
5387974051SDevesh Sharma 	BNXT_RE_UCNTX_CMASK_HAVE_CCTX = 0x1ULL,
5487974051SDevesh Sharma 	BNXT_RE_UCNTX_CMASK_HAVE_MODE = 0x02ULL,
55360da60dSSelvin Xavier 	BNXT_RE_UCNTX_CMASK_WC_DPI_ENABLED = 0x04ULL,
56fa8fad92SChandramohan Akula 	BNXT_RE_UCNTX_CMASK_DBR_PACING_ENABLED = 0x08ULL,
5748f996d4SChandramohan Akula 	BNXT_RE_UCNTX_CMASK_POW2_DISABLED = 0x10ULL,
586f6bfbc5SSelvin Xavier 	BNXT_RE_UCNTX_CMASK_MSN_TABLE_ENABLED = 0x40,
5987974051SDevesh Sharma };
6087974051SDevesh Sharma 
6187974051SDevesh Sharma enum bnxt_re_wqe_mode {
6287974051SDevesh Sharma 	BNXT_QPLIB_WQE_MODE_STATIC	= 0x00,
6387974051SDevesh Sharma 	BNXT_QPLIB_WQE_MODE_VARIABLE	= 0x01,
6487974051SDevesh Sharma 	BNXT_QPLIB_WQE_MODE_INVALID	= 0x02,
6595b86d1cSDevesh Sharma };
6695b86d1cSDevesh Sharma 
6748f996d4SChandramohan Akula enum {
6848f996d4SChandramohan Akula 	BNXT_RE_COMP_MASK_REQ_UCNTX_POW2_SUPPORT = 0x01,
6910a104c0SSelvin Xavier 	BNXT_RE_COMP_MASK_REQ_UCNTX_VAR_WQE_SUPPORT = 0x02,
7048f996d4SChandramohan Akula };
7148f996d4SChandramohan Akula 
7248f996d4SChandramohan Akula struct bnxt_re_uctx_req {
7348f996d4SChandramohan Akula 	__aligned_u64 comp_mask;
7448f996d4SChandramohan Akula };
7548f996d4SChandramohan Akula 
761ac5a404SSelvin Xavier struct bnxt_re_uctx_resp {
771ac5a404SSelvin Xavier 	__u32 dev_id;
781ac5a404SSelvin Xavier 	__u32 max_qp;
791ac5a404SSelvin Xavier 	__u32 pg_size;
801ac5a404SSelvin Xavier 	__u32 cqe_sz;
811ac5a404SSelvin Xavier 	__u32 max_cqd;
821ac5a404SSelvin Xavier 	__u32 rsvd;
8395b86d1cSDevesh Sharma 	__aligned_u64 comp_mask;
8495b86d1cSDevesh Sharma 	__u32 chip_id0;
8595b86d1cSDevesh Sharma 	__u32 chip_id1;
8687974051SDevesh Sharma 	__u32 mode;
8787974051SDevesh Sharma 	__u32 rsvd1; /* padding */
881ac5a404SSelvin Xavier };
891ac5a404SSelvin Xavier 
90958d2c1bSJason Gunthorpe /*
91958d2c1bSJason Gunthorpe  * This struct is placed after the ib_uverbs_alloc_pd_resp struct, which is
92958d2c1bSJason Gunthorpe  * not 8 byted aligned. To avoid undesired padding in various cases we have to
93958d2c1bSJason Gunthorpe  * set this struct to packed.
94958d2c1bSJason Gunthorpe  */
951ac5a404SSelvin Xavier struct bnxt_re_pd_resp {
961ac5a404SSelvin Xavier 	__u32 pdid;
971ac5a404SSelvin Xavier 	__u32 dpi;
981ac5a404SSelvin Xavier 	__u64 dbr;
99958d2c1bSJason Gunthorpe } __attribute__((packed, aligned(4)));
1001ac5a404SSelvin Xavier 
1011ac5a404SSelvin Xavier struct bnxt_re_cq_req {
10226b99066SJason Gunthorpe 	__aligned_u64 cq_va;
10326b99066SJason Gunthorpe 	__aligned_u64 cq_handle;
1041ac5a404SSelvin Xavier };
1051ac5a404SSelvin Xavier 
106e275919dSSelvin Xavier enum bnxt_re_cq_mask {
107e275919dSSelvin Xavier 	BNXT_RE_CQ_TOGGLE_PAGE_SUPPORT = 0x1,
108e275919dSSelvin Xavier };
109e275919dSSelvin Xavier 
1101ac5a404SSelvin Xavier struct bnxt_re_cq_resp {
1111ac5a404SSelvin Xavier 	__u32 cqid;
1121ac5a404SSelvin Xavier 	__u32 tail;
1131ac5a404SSelvin Xavier 	__u32 phase;
1141ac5a404SSelvin Xavier 	__u32 rsvd;
115e275919dSSelvin Xavier 	__aligned_u64 comp_mask;
1161ac5a404SSelvin Xavier };
1171ac5a404SSelvin Xavier 
118d54bd5abSSelvin Xavier struct bnxt_re_resize_cq_req {
119d54bd5abSSelvin Xavier 	__aligned_u64 cq_va;
120d54bd5abSSelvin Xavier };
121d54bd5abSSelvin Xavier 
122d8ea645dSSelvin Xavier enum bnxt_re_qp_mask {
123d8ea645dSSelvin Xavier 	BNXT_RE_QP_REQ_MASK_VAR_WQE_SQ_SLOTS = 0x1,
124d8ea645dSSelvin Xavier };
125d8ea645dSSelvin Xavier 
1261ac5a404SSelvin Xavier struct bnxt_re_qp_req {
12726b99066SJason Gunthorpe 	__aligned_u64 qpsva;
12826b99066SJason Gunthorpe 	__aligned_u64 qprva;
12926b99066SJason Gunthorpe 	__aligned_u64 qp_handle;
130d8ea645dSSelvin Xavier 	__aligned_u64 comp_mask;
131d8ea645dSSelvin Xavier 	__u32 sq_slots;
1321ac5a404SSelvin Xavier };
1331ac5a404SSelvin Xavier 
1341ac5a404SSelvin Xavier struct bnxt_re_qp_resp {
1351ac5a404SSelvin Xavier 	__u32 qpid;
1361ac5a404SSelvin Xavier 	__u32 rsvd;
1371ac5a404SSelvin Xavier };
1381ac5a404SSelvin Xavier 
13937cb11acSDevesh Sharma struct bnxt_re_srq_req {
14026b99066SJason Gunthorpe 	__aligned_u64 srqva;
14126b99066SJason Gunthorpe 	__aligned_u64 srq_handle;
14237cb11acSDevesh Sharma };
14337cb11acSDevesh Sharma 
144*181028a0SChandramohan Akula enum bnxt_re_srq_mask {
145*181028a0SChandramohan Akula 	BNXT_RE_SRQ_TOGGLE_PAGE_SUPPORT = 0x1,
146*181028a0SChandramohan Akula };
147*181028a0SChandramohan Akula 
14837cb11acSDevesh Sharma struct bnxt_re_srq_resp {
14937cb11acSDevesh Sharma 	__u32 srqid;
150*181028a0SChandramohan Akula 	__u32 rsvd; /* padding */
151*181028a0SChandramohan Akula 	__aligned_u64 comp_mask;
15237cb11acSDevesh Sharma };
15337cb11acSDevesh Sharma 
1541ac5a404SSelvin Xavier enum bnxt_re_shpg_offt {
1551ac5a404SSelvin Xavier 	BNXT_RE_BEG_RESV_OFFT	= 0x00,
1561ac5a404SSelvin Xavier 	BNXT_RE_AVID_OFFT	= 0x10,
1571ac5a404SSelvin Xavier 	BNXT_RE_AVID_SIZE	= 0x04,
1581ac5a404SSelvin Xavier 	BNXT_RE_END_RESV_OFFT	= 0xFF0
1591ac5a404SSelvin Xavier };
1601ac5a404SSelvin Xavier 
161360da60dSSelvin Xavier enum bnxt_re_objects {
162360da60dSSelvin Xavier 	BNXT_RE_OBJECT_ALLOC_PAGE = (1U << UVERBS_ID_NS_SHIFT),
16361a8118fSChandramohan Akula 	BNXT_RE_OBJECT_NOTIFY_DRV,
1649b0a7a2cSSelvin Xavier 	BNXT_RE_OBJECT_GET_TOGGLE_MEM,
165360da60dSSelvin Xavier };
166360da60dSSelvin Xavier 
167360da60dSSelvin Xavier enum bnxt_re_alloc_page_type {
168360da60dSSelvin Xavier 	BNXT_RE_ALLOC_WC_PAGE = 0,
169ea222485SChandramohan Akula 	BNXT_RE_ALLOC_DBR_BAR_PAGE,
170ea222485SChandramohan Akula 	BNXT_RE_ALLOC_DBR_PAGE,
171360da60dSSelvin Xavier };
172360da60dSSelvin Xavier 
173360da60dSSelvin Xavier enum bnxt_re_var_alloc_page_attrs {
174360da60dSSelvin Xavier 	BNXT_RE_ALLOC_PAGE_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
175360da60dSSelvin Xavier 	BNXT_RE_ALLOC_PAGE_TYPE,
176360da60dSSelvin Xavier 	BNXT_RE_ALLOC_PAGE_DPI,
177360da60dSSelvin Xavier 	BNXT_RE_ALLOC_PAGE_MMAP_OFFSET,
178360da60dSSelvin Xavier 	BNXT_RE_ALLOC_PAGE_MMAP_LENGTH,
179360da60dSSelvin Xavier };
180360da60dSSelvin Xavier 
181360da60dSSelvin Xavier enum bnxt_re_alloc_page_attrs {
182360da60dSSelvin Xavier 	BNXT_RE_DESTROY_PAGE_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
183360da60dSSelvin Xavier };
184360da60dSSelvin Xavier 
185360da60dSSelvin Xavier enum bnxt_re_alloc_page_methods {
186360da60dSSelvin Xavier 	BNXT_RE_METHOD_ALLOC_PAGE = (1U << UVERBS_ID_NS_SHIFT),
187360da60dSSelvin Xavier 	BNXT_RE_METHOD_DESTROY_PAGE,
188360da60dSSelvin Xavier };
189360da60dSSelvin Xavier 
19061a8118fSChandramohan Akula enum bnxt_re_notify_drv_methods {
19161a8118fSChandramohan Akula 	BNXT_RE_METHOD_NOTIFY_DRV = (1U << UVERBS_ID_NS_SHIFT),
19261a8118fSChandramohan Akula };
1939b0a7a2cSSelvin Xavier 
1949b0a7a2cSSelvin Xavier /* Toggle mem */
1959b0a7a2cSSelvin Xavier 
1969b0a7a2cSSelvin Xavier enum bnxt_re_get_toggle_mem_type {
1979b0a7a2cSSelvin Xavier 	BNXT_RE_CQ_TOGGLE_MEM = 0,
1989b0a7a2cSSelvin Xavier 	BNXT_RE_SRQ_TOGGLE_MEM,
1999b0a7a2cSSelvin Xavier };
2009b0a7a2cSSelvin Xavier 
2019b0a7a2cSSelvin Xavier enum bnxt_re_var_toggle_mem_attrs {
2029b0a7a2cSSelvin Xavier 	BNXT_RE_TOGGLE_MEM_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
2039b0a7a2cSSelvin Xavier 	BNXT_RE_TOGGLE_MEM_TYPE,
2049b0a7a2cSSelvin Xavier 	BNXT_RE_TOGGLE_MEM_RES_ID,
2059b0a7a2cSSelvin Xavier 	BNXT_RE_TOGGLE_MEM_MMAP_PAGE,
2069b0a7a2cSSelvin Xavier 	BNXT_RE_TOGGLE_MEM_MMAP_OFFSET,
2079b0a7a2cSSelvin Xavier 	BNXT_RE_TOGGLE_MEM_MMAP_LENGTH,
2089b0a7a2cSSelvin Xavier };
2099b0a7a2cSSelvin Xavier 
2109b0a7a2cSSelvin Xavier enum bnxt_re_toggle_mem_attrs {
2119b0a7a2cSSelvin Xavier 	BNXT_RE_RELEASE_TOGGLE_MEM_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
2129b0a7a2cSSelvin Xavier };
2139b0a7a2cSSelvin Xavier 
2149b0a7a2cSSelvin Xavier enum bnxt_re_toggle_mem_methods {
2159b0a7a2cSSelvin Xavier 	BNXT_RE_METHOD_GET_TOGGLE_MEM = (1U << UVERBS_ID_NS_SHIFT),
2169b0a7a2cSSelvin Xavier 	BNXT_RE_METHOD_RELEASE_TOGGLE_MEM,
2179b0a7a2cSSelvin Xavier };
2181ac5a404SSelvin Xavier #endif /* __BNXT_RE_UVERBS_ABI_H__*/
219