xref: /freebsd/sys/dev/qlnx/qlnxe/rdma_common.h (revision 5477372324b92240a96310ef2d45fa44ce8d0a93)
1 /*
2  * Copyright (c) 2017-2018 Cavium, Inc.
3  * All rights reserved.
4  *
5  *  Redistribution and use in source and binary forms, with or without
6  *  modification, are permitted provided that the following conditions
7  *  are met:
8  *
9  *  1. Redistributions of source code must retain the above copyright
10  *     notice, this list of conditions and the following disclaimer.
11  *  2. Redistributions in binary form must reproduce the above copyright
12  *     notice, this list of conditions and the following disclaimer in the
13  *     documentation and/or other materials provided with the distribution.
14  *
15  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25  *  POSSIBILITY OF SUCH DAMAGE.
26  *
27  * $FreeBSD$
28  *
29  */
30 
31 
32 #ifndef __RDMA_COMMON__
33 #define __RDMA_COMMON__
34 /************************/
35 /* RDMA FW CONSTANTS */
36 /************************/
37 
38 #define RDMA_RESERVED_LKEY			(0)			//Reserved lkey
39 #define RDMA_RING_PAGE_SIZE			(0x1000)	//4KB pages
40 
41 #define	RDMA_MAX_SGE_PER_SQ_WQE		(4)		//max number of SGEs in a single request
42 #define	RDMA_MAX_SGE_PER_RQ_WQE		(4)		//max number of SGEs in a single request
43 
44 #define RDMA_MAX_DATA_SIZE_IN_WQE	(0x80000000)	//max size of data in single request
45 
46 #define RDMA_REQ_RD_ATOMIC_ELM_SIZE		(0x50)
47 #define RDMA_RESP_RD_ATOMIC_ELM_SIZE	(0x20)
48 
49 #define RDMA_MAX_CQS				(64*1024)
50 #define RDMA_MAX_TIDS				(128*1024-1)
51 #define RDMA_MAX_PDS				(64*1024)
52 
53 #define RDMA_NUM_STATISTIC_COUNTERS			MAX_NUM_VPORTS
54 #define RDMA_NUM_STATISTIC_COUNTERS_K2			MAX_NUM_VPORTS_K2
55 #define RDMA_NUM_STATISTIC_COUNTERS_BB			MAX_NUM_VPORTS_BB
56 
57 #define RDMA_TASK_TYPE (PROTOCOLID_ROCE)
58 
59 
60 struct rdma_srq_id
61 {
62 	__le16 srq_idx /* SRQ index */;
63 	__le16 opaque_fid;
64 };
65 
66 
67 struct rdma_srq_producers
68 {
69 	__le32 sge_prod /* Current produced sge in SRQ */;
70 	__le32 wqe_prod /* Current produced WQE to SRQ */;
71 };
72 
73 #endif /* __RDMA_COMMON__ */
74