2 * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.
\r
3 * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
\r
5 * This software is available to you under the OpenIB.org BSD license
\r
8 * Redistribution and use in source and binary forms, with or
\r
9 * without modification, are permitted provided that the following
\r
10 * conditions are met:
\r
12 * - Redistributions of source code must retain the above
\r
13 * copyright notice, this list of conditions and the following
\r
16 * - Redistributions in binary form must reproduce the above
\r
17 * copyright notice, this list of conditions and the following
\r
18 * disclaimer in the documentation and/or other materials
\r
19 * provided with the distribution.
\r
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
\r
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
\r
23 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
\r
24 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
\r
25 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
\r
26 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
27 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
\r
33 #if !defined(__IB_AL_MAD_H__)
\r
34 #define __IB_AL_MAD_H__
\r
37 #include <iba/ib_al.h>
\r
39 #include <complib/cl_async_proc.h>
\r
40 #include <complib/cl_atomic.h>
\r
41 #include <complib/cl_ptr_vector.h>
\r
42 #include <complib/cl_qlist.h>
\r
43 #include <complib/cl_qpool.h>
\r
44 #include <complib/cl_spinlock.h>
\r
45 #include <complib/cl_timer.h>
\r
46 #include <complib/cl_vector.h>
\r
48 #include "al_common.h"
\r
49 #include "al_mad_pool.h"
\r
54 * The MAD dispatcher routes completed MAD work requests to the correct
\r
57 typedef struct _al_mad_disp
\r
60 ib_qp_handle_t h_qp;
\r
62 /* Client information. */
\r
63 cl_vector_t client_vector;
\r
66 * Indicates the version of supported MADs. 1 based-index. This is
\r
67 * a vector of class vectors.
\r
69 cl_vector_t version_vector;
\r
74 typedef al_mad_disp_t *al_mad_disp_handle_t;
\r
78 (*pfn_mad_svc_send_done_t)(
\r
79 IN ib_mad_svc_handle_t h_mad_svc,
\r
80 IN al_mad_wr_t *p_mad_wr,
\r
84 (*pfn_mad_svc_recv_done_t)(
\r
85 IN ib_mad_svc_handle_t h_mad_svc,
\r
86 IN ib_mad_element_t *p_mad_element );
\r
89 typedef struct _al_mad_disp_reg
\r
91 ib_mad_svc_handle_t h_mad_svc;
\r
92 al_mad_disp_handle_t h_mad_disp;
\r
96 /* Clients must specify completion routines for user-mode support. */
\r
97 pfn_mad_svc_send_done_t pfn_send_done;
\r
98 pfn_mad_svc_recv_done_t pfn_recv_done;
\r
100 /* Mgmt class supported by the client. Class 0x81 is mapped to 0x00. */
\r
101 uint8_t mgmt_class;
\r
102 uint8_t mgmt_version;
\r
103 boolean_t support_unsol;
\r
105 } al_mad_disp_reg_t;
\r
109 /* The registration handle is an index into the client_vector. */
\r
110 typedef al_mad_disp_reg_t* al_mad_reg_handle_t;
\r
116 IN al_obj_t* const p_parent_obj,
\r
117 IN const ib_qp_handle_t h_qp,
\r
118 IN al_mad_disp_handle_t* const ph_mad_disp );
\r
121 mad_disp_send_done(
\r
122 IN al_mad_disp_handle_t h_mad_disp,
\r
123 IN al_mad_wr_t *p_mad_wr,
\r
124 IN ib_wc_t *p_wc );
\r
127 mad_disp_recv_done(
\r
128 IN al_mad_disp_handle_t h_mad_disp,
\r
129 IN ib_mad_element_t *p_mad_element );
\r
135 * MAD service used to send and receive MADs. MAD services are responsible
\r
136 * for retransmissions and SAR.
\r
138 typedef struct _al_mad_svc
\r
142 ib_mad_svc_type_t svc_type;
\r
144 atomic32_t ref_cnt;
\r
146 al_mad_reg_handle_t h_mad_reg;
\r
147 ib_pfn_mad_comp_cb_t pfn_user_send_cb;
\r
148 ib_pfn_mad_comp_cb_t pfn_user_recv_cb;
\r
150 cl_qlist_t send_list;
\r
151 cl_timer_t send_timer;
\r
153 cl_qlist_t recv_list;
\r
154 cl_timer_t recv_timer;
\r
156 /* The PD and port number are used to create address vectors on sends. */
\r
157 ib_pd_handle_t h_pd;
\r
165 IN struct _al_obj *p_obj );
\r
169 * Register a MAD service with a QP.
\r
173 IN const ib_qp_handle_t h_qp,
\r
174 IN const ib_mad_svc_t* const p_mad_svc,
\r
175 OUT ib_mad_svc_handle_t* const ph_mad_svc );
\r
180 IN const ib_ca_handle_t h_ca,
\r
181 IN const uint8_t port_num,
\r
182 IN const ib_av_attr_t* p_av_attr,
\r
183 IN const void* const p_mad_in,
\r
184 IN void* p_mad_out );
\r
189 typedef union _al_tid
\r
195 ib_net32_t user_tid;
\r
203 IN const ib_net64_t tid64 );
\r
208 IN const ib_net64_t tid64 );
\r
213 IN ib_net64_t* const p_tid64,
\r
214 IN const uint32_t tid32 );
\r
220 IN ib_mad_element_t* p_mad_element,
\r
221 IN ib_wc_t* p_wc );
\r
225 get_mad_hdr_from_wr(
\r
226 IN al_mad_wr_t* const p_mad_wr );
\r
231 IN const ib_mad_svc_handle_t h_mad_svc,
\r
232 IN ib_mad_element_t* const p_mad_element,
\r
233 IN const uint32_t delay_ms );
\r
236 #endif /* __IB_AL_MAD_H__ */
\r