xref: /illumos-gate/usr/src/lib/udapl/udapl_tavor/tavor/dapl_tavor_wr.h (revision 9e39c5ba00a55fa05777cc94b148296af305e135)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_DAPL_TAVOR_WR_H
28 #define	_DAPL_TAVOR_WR_H
29 
30 /*
31  * dapl_tavor_wr.h
32  *	Contains the definition of all structures that are used for
33  *	doing the work request handling.
34  */
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 #include "dapl_osd.h"
41 #include "dapl_hash.h"
42 #include "dapl_tavor_ibtf.h"
43 #include "dapl_tavor_hw.h"
44 
45 typedef struct dapls_tavor_workq_hdr_s		dapls_tavor_workq_hdr_t;
46 typedef struct dapls_tavor_wrid_list_hdr_s	dapls_tavor_wrid_list_hdr_t;
47 typedef struct dapls_tavor_wrid_entry_s		dapls_tavor_wrid_entry_t;
48 typedef struct dapls_tavor_wrid_lock_s		dapls_tavor_wrid_lock_t;
49 
50 /*
51  * Defines the lock that protects the wrid list.
52  * For send queues and receive queues this is allocated with the workq header
53  * structure. For SRQs it is allocated with the wrid_list_hdr and the receive
54  * workq header points to it.
55  */
56 struct dapls_tavor_wrid_lock_s {
57 	uint32_t	wrl_on_srq; /* lock resides in the srq wridlist */
58 	DAPL_OS_LOCK	wrl_lock;
59 };
60 
61 /*
62  * Defines the workq header for each queue in the QP. This points to the
63  * dapls_tavor_wrid_list_hdr_t which has the work request id list.
64  */
65 struct dapls_tavor_workq_hdr_s {
66 	uint32_t			wq_qpn;
67 	uint32_t			wq_send_or_recv;
68 	dapls_tavor_wrid_lock_t		*wq_wrid_lock;
69 	uint32_t			wq_size;
70 	uint32_t			wq_head;
71 	uint32_t			wq_tail;
72 	uint32_t			wq_full;
73 	dapls_tavor_wrid_list_hdr_t	*wq_wrid_poll;
74 	dapls_tavor_wrid_list_hdr_t	*wq_wrid_post;
75 };
76 /* Type of the work queue */
77 #define	TAVOR_WR_SEND			0x1
78 #define	TAVOR_WR_RECV			0x0
79 
80 
81 /*
82  * Defines each work request id entry
83  */
84 struct dapls_tavor_wrid_entry_s {
85 	uint64_t		wr_wrid;
86 	uint32_t		wr_wqeaddrsz;
87 	uint32_t		wr_signaled_dbd;
88 };
89 #define	TAVOR_WRID_ENTRY_SIGNALED	(1 << 0)
90 #define	TAVOR_WRID_ENTRY_DOORBELLED	(1 << 1)
91 
92 /*
93  * Defines each work request id list which has an array of wrid entries
94  */
95 struct dapls_tavor_wrid_list_hdr_s {
96 	dapls_tavor_wrid_list_hdr_t	*wl_next;
97 	dapls_tavor_wrid_list_hdr_t	*wl_prev;
98 	dapls_tavor_wrid_list_hdr_t	*wl_reap_next;
99 	dapls_tavor_workq_hdr_t		*wl_wqhdr;
100 	dapls_tavor_wrid_entry_t	*wl_wre;
101 	dapls_tavor_wrid_entry_t	*wl_wre_old_tail;
102 	uint32_t			wl_size;
103 	uint32_t			wl_full;
104 	uint32_t			wl_head;
105 	uint32_t			wl_tail;
106 	dapls_tavor_wrid_lock_t		*wl_lock; /* valid only for SRQs */
107 
108 	/* For SRQ */
109 	uint_t				wl_srq_en;
110 	uint32_t			*wl_free_list; /* free descrptr list */
111 	uint32_t			wl_freel_head;
112 	uint32_t			wl_freel_tail;
113 	uint32_t			wl_freel_entries; /* # free entries */
114 	uint32_t			wl_srq_wqesz;
115 	uint64_t			wl_srq_desc_addr;
116 };
117 
118 extern dapls_tavor_wrid_entry_t *dapli_tavor_wrid_find_match_srq(
119 	dapls_tavor_wrid_list_hdr_t *, tavor_hw_cqe_t *);
120 
121 #ifdef __cplusplus
122 }
123 #endif
124 
125 #endif	/* _DAPL_TAVOR_WR_H */
126