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