dapl_tavor_wr.h revision 9517:b4839b0aa7a4
12864Swollman/*
250471Speter * CDDL HEADER START
31556Srgrimes *
438652Sgpalmer * The contents of this file are subject to the terms of the
538652Sgpalmer * Common Development and Distribution License (the "License").
638652Sgpalmer * You may not use this file except in compliance with the License.
738652Sgpalmer *
838652Sgpalmer * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
938652Sgpalmer * or http://www.opensolaris.org/os/licensing.
1038652Sgpalmer * See the License for the specific language governing permissions
1138652Sgpalmer * and limitations under the License.
1238652Sgpalmer *
1338652Sgpalmer * When distributing Covered Code, include this CDDL HEADER in each
1438652Sgpalmer * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1574466Srwatson * If applicable, add the following below this CDDL HEADER, with the
1638652Sgpalmer * fields enclosed by brackets "[]" replaced with your own identifying
1738652Sgpalmer * information: Portions Copyright [yyyy] [name of copyright owner]
1838652Sgpalmer *
1938652Sgpalmer * CDDL HEADER END
2038652Sgpalmer */
2138652Sgpalmer
2238652Sgpalmer/*
2338652Sgpalmer * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
2438652Sgpalmer * Use is subject to license terms.
2590535Smike */
2638652Sgpalmer
2738652Sgpalmer#ifndef	_DAPL_TAVOR_WR_H
2874466Srwatson#define	_DAPL_TAVOR_WR_H
2938652Sgpalmer
3038652Sgpalmer/*
3138652Sgpalmer * dapl_tavor_wr.h
3238652Sgpalmer *	Contains the definition of all structures that are used for
3338652Sgpalmer *	doing the work request handling.
341556Srgrimes */
3594297Sbmilekic
3694297Sbmilekic#ifdef __cplusplus
3794297Sbmilekicextern "C" {
3894297Sbmilekic#endif
3959337Sobrien
4059337Sobrien#include "dapl_osd.h"
4159337Sobrien#include "dapl_hash.h"
4259337Sobrien#include "dapl_tavor_ibtf.h"
43101217Smarkm#include "dapl_tavor_hw.h"
4436410Sphk
4536410Sphktypedef struct dapls_tavor_workq_hdr_s		dapls_tavor_workq_hdr_t;
4636410Sphktypedef struct dapls_tavor_wrid_list_hdr_s	dapls_tavor_wrid_list_hdr_t;
471556Srgrimestypedef struct dapls_tavor_wrid_entry_s		dapls_tavor_wrid_entry_t;
48typedef 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 */
56struct 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 */
65struct 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 */
84struct 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 */
95struct 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
118extern 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