xref: /freebsd/contrib/ofed/libirdma/irdma.h (revision 5b5f7d0e77a9eee73eb5d596f43aef4e1a3674d8)
1cdcd52d4SBartosz Sobczak /*-
2cdcd52d4SBartosz Sobczak  * SPDX-License-Identifier: GPL-2.0 or Linux-OpenIB
3cdcd52d4SBartosz Sobczak  *
4*777e472cSBartosz Sobczak  * Copyright (c) 2017 - 2022 Intel Corporation
5cdcd52d4SBartosz Sobczak  *
6cdcd52d4SBartosz Sobczak  * This software is available to you under a choice of one of two
7cdcd52d4SBartosz Sobczak  * licenses.  You may choose to be licensed under the terms of the GNU
8cdcd52d4SBartosz Sobczak  * General Public License (GPL) Version 2, available from the file
9cdcd52d4SBartosz Sobczak  * COPYING in the main directory of this source tree, or the
10cdcd52d4SBartosz Sobczak  * OpenFabrics.org BSD license below:
11cdcd52d4SBartosz Sobczak  *
12cdcd52d4SBartosz Sobczak  *   Redistribution and use in source and binary forms, with or
13cdcd52d4SBartosz Sobczak  *   without modification, are permitted provided that the following
14cdcd52d4SBartosz Sobczak  *   conditions are met:
15cdcd52d4SBartosz Sobczak  *
16cdcd52d4SBartosz Sobczak  *    - Redistributions of source code must retain the above
17cdcd52d4SBartosz Sobczak  *	copyright notice, this list of conditions and the following
18cdcd52d4SBartosz Sobczak  *	disclaimer.
19cdcd52d4SBartosz Sobczak  *
20cdcd52d4SBartosz Sobczak  *    - Redistributions in binary form must reproduce the above
21cdcd52d4SBartosz Sobczak  *	copyright notice, this list of conditions and the following
22cdcd52d4SBartosz Sobczak  *	disclaimer in the documentation and/or other materials
23cdcd52d4SBartosz Sobczak  *	provided with the distribution.
24cdcd52d4SBartosz Sobczak  *
25cdcd52d4SBartosz Sobczak  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26cdcd52d4SBartosz Sobczak  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27cdcd52d4SBartosz Sobczak  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28cdcd52d4SBartosz Sobczak  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29cdcd52d4SBartosz Sobczak  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30cdcd52d4SBartosz Sobczak  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31cdcd52d4SBartosz Sobczak  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32cdcd52d4SBartosz Sobczak  * SOFTWARE.
33cdcd52d4SBartosz Sobczak  */
34cdcd52d4SBartosz Sobczak 
35cdcd52d4SBartosz Sobczak #ifndef IRDMA_H
36cdcd52d4SBartosz Sobczak #define IRDMA_H
37cdcd52d4SBartosz Sobczak 
38cdcd52d4SBartosz Sobczak #define RDMA_BIT2(type, a) ((u##type) 1UL << a)
39cdcd52d4SBartosz Sobczak #define RDMA_MASK3(type, mask, shift)	((u##type) mask << shift)
40cdcd52d4SBartosz Sobczak #define MAKEMASK(m, s) ((m) << (s))
41*777e472cSBartosz Sobczak 
42cdcd52d4SBartosz Sobczak #define IRDMA_WQEALLOC_WQE_DESC_INDEX_S 20
43*777e472cSBartosz Sobczak #define IRDMA_WQEALLOC_WQE_DESC_INDEX GENMASK(31, 20)
44cdcd52d4SBartosz Sobczak 
45cdcd52d4SBartosz Sobczak enum irdma_vers {
46*777e472cSBartosz Sobczak 	IRDMA_GEN_RSVD = 0,
47*777e472cSBartosz Sobczak 	IRDMA_GEN_1 = 1,
48*777e472cSBartosz Sobczak 	IRDMA_GEN_2 = 2,
49cdcd52d4SBartosz Sobczak };
50cdcd52d4SBartosz Sobczak 
51cdcd52d4SBartosz Sobczak struct irdma_uk_attrs {
52cdcd52d4SBartosz Sobczak 	u64 feature_flags;
53cdcd52d4SBartosz Sobczak 	u32 max_hw_wq_frags;
54cdcd52d4SBartosz Sobczak 	u32 max_hw_read_sges;
55cdcd52d4SBartosz Sobczak 	u32 max_hw_inline;
56cdcd52d4SBartosz Sobczak 	u32 max_hw_rq_quanta;
57cdcd52d4SBartosz Sobczak 	u32 max_hw_wq_quanta;
58cdcd52d4SBartosz Sobczak 	u32 min_hw_cq_size;
59cdcd52d4SBartosz Sobczak 	u32 max_hw_cq_size;
60cdcd52d4SBartosz Sobczak 	u16 max_hw_sq_chunk;
61*777e472cSBartosz Sobczak 	u16 min_hw_wq_size;
62cdcd52d4SBartosz Sobczak 	u8 hw_rev;
63cdcd52d4SBartosz Sobczak };
64cdcd52d4SBartosz Sobczak 
65cdcd52d4SBartosz Sobczak struct irdma_hw_attrs {
66cdcd52d4SBartosz Sobczak 	struct irdma_uk_attrs uk_attrs;
67cdcd52d4SBartosz Sobczak 	u64 max_hw_outbound_msg_size;
68cdcd52d4SBartosz Sobczak 	u64 max_hw_inbound_msg_size;
69cdcd52d4SBartosz Sobczak 	u64 max_mr_size;
70*777e472cSBartosz Sobczak 	u64 page_size_cap;
71cdcd52d4SBartosz Sobczak 	u32 min_hw_qp_id;
72cdcd52d4SBartosz Sobczak 	u32 min_hw_aeq_size;
73cdcd52d4SBartosz Sobczak 	u32 max_hw_aeq_size;
74cdcd52d4SBartosz Sobczak 	u32 min_hw_ceq_size;
75cdcd52d4SBartosz Sobczak 	u32 max_hw_ceq_size;
76cdcd52d4SBartosz Sobczak 	u32 max_hw_device_pages;
77cdcd52d4SBartosz Sobczak 	u32 max_hw_vf_fpm_id;
78cdcd52d4SBartosz Sobczak 	u32 first_hw_vf_fpm_id;
79cdcd52d4SBartosz Sobczak 	u32 max_hw_ird;
80cdcd52d4SBartosz Sobczak 	u32 max_hw_ord;
81cdcd52d4SBartosz Sobczak 	u32 max_hw_wqes;
82cdcd52d4SBartosz Sobczak 	u32 max_hw_pds;
83cdcd52d4SBartosz Sobczak 	u32 max_hw_ena_vf_count;
84cdcd52d4SBartosz Sobczak 	u32 max_qp_wr;
85cdcd52d4SBartosz Sobczak 	u32 max_pe_ready_count;
86cdcd52d4SBartosz Sobczak 	u32 max_done_count;
87cdcd52d4SBartosz Sobczak 	u32 max_sleep_count;
88cdcd52d4SBartosz Sobczak 	u32 max_cqp_compl_wait_time_ms;
89cdcd52d4SBartosz Sobczak 	u16 max_stat_inst;
90cdcd52d4SBartosz Sobczak 	u16 max_stat_idx;
91cdcd52d4SBartosz Sobczak };
92cdcd52d4SBartosz Sobczak 
93cdcd52d4SBartosz Sobczak #endif /* IRDMA_H*/
94