xref: /freebsd/sys/dev/qlnx/qlnxe/rdma_common.h (revision f39bffc62c1395bde25d152c7f68fdf7cbaab414)
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 #ifndef __RDMA_COMMON__
32 #define __RDMA_COMMON__
33 /************************/
34 /* RDMA FW CONSTANTS */
35 /************************/
36 
37 #define RDMA_RESERVED_LKEY			(0)			//Reserved lkey
38 #define RDMA_RING_PAGE_SIZE			(0x1000)	//4KB pages
39 
40 #define	RDMA_MAX_SGE_PER_SQ_WQE		(4)		//max number of SGEs in a single request
41 #define	RDMA_MAX_SGE_PER_RQ_WQE		(4)		//max number of SGEs in a single request
42 
43 #define RDMA_MAX_DATA_SIZE_IN_WQE	(0x80000000)	//max size of data in single request
44 
45 #define RDMA_REQ_RD_ATOMIC_ELM_SIZE		(0x50)
46 #define RDMA_RESP_RD_ATOMIC_ELM_SIZE	(0x20)
47 
48 #define RDMA_MAX_CQS				(64*1024)
49 #define RDMA_MAX_TIDS				(128*1024-1)
50 #define RDMA_MAX_PDS				(64*1024)
51 
52 #define RDMA_NUM_STATISTIC_COUNTERS			MAX_NUM_VPORTS
53 #define RDMA_NUM_STATISTIC_COUNTERS_K2			MAX_NUM_VPORTS_K2
54 #define RDMA_NUM_STATISTIC_COUNTERS_BB			MAX_NUM_VPORTS_BB
55 
56 #define RDMA_TASK_TYPE (PROTOCOLID_ROCE)
57 
58 
59 struct rdma_srq_id
60 {
61 	__le16 srq_idx /* SRQ index */;
62 	__le16 opaque_fid;
63 };
64 
65 
66 struct rdma_srq_producers
67 {
68 	__le32 sge_prod /* Current produced sge in SRQ */;
69 	__le32 wqe_prod /* Current produced WQE to SRQ */;
70 };
71 
72 #endif /* __RDMA_COMMON__ */
73