2 * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
3 * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
4 * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
6 * This software is available to you under a choice of one of two
7 * licenses. You may choose to be licensed under the terms of the GNU
8 * General Public License (GPL) Version 2, available from the file
9 * COPYING in the main directory of this source tree, or the
10 * OpenIB.org BSD license below:
12 * Redistribution and use in source and binary forms, with or
13 * without modification, are permitted provided that the following
16 * - Redistributions of source code must retain the above
17 * copyright notice, this list of conditions and the following
20 * - Redistributions in binary form must reproduce the above
21 * copyright notice, this list of conditions and the following
22 * disclaimer in the documentation and/or other materials
23 * provided with the distribution.
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36 #ifndef _OSMV_RMPP_CTX_H
37 #define _OSMV_RMPP_CTX_H
39 #include <complib/cl_event.h>
40 #include <opensm/osm_log.h>
41 #include <opensm/osm_madw.h>
42 #include <vendor/osm_vendor_mlx_sar.h>
45 # define BEGIN_C_DECLS extern "C" {
46 # define END_C_DECLS }
47 #else /* !__cplusplus */
48 # define BEGIN_C_DECLS
50 #endif /* __cplusplus */
54 typedef struct _osmv_rmpp_send_ctx {
58 uint32_t window_first;
66 /* Segmentation engine */
70 } osmv_rmpp_send_ctx_t;
72 typedef struct _osmv_rmpp_recv_ctx {
76 uint32_t expected_seg;
78 /* Reassembly buffer */
81 /* Reassembly engine */
85 } osmv_rmpp_recv_ctx_t;
89 * osmv_rmpp_send_ctx_init
92 * c'tor for rmpp_send_ctx obj
98 osmv_rmpp_send_ctx_init(osmv_rmpp_send_ctx_t * p_ctx, void *arbt_mad,
99 uint32_t mad_sz, osm_log_t * p_log);
103 * osmv_rmpp_send_ctx_done
106 * d'tor for rmpp_send_ctx obj
111 void osmv_rmpp_send_ctx_done(IN osmv_rmpp_send_ctx_t * ctx);
115 * osmv_rmpp_send_ctx_get_wf
118 * returns number of first segment in current window
122 static inline uint32_t
123 osmv_rmpp_send_ctx_get_wf(IN const osmv_rmpp_send_ctx_t * p_ctx)
126 return p_ctx->window_first;
131 * osmv_rmpp_send_ctx_set_wf
134 * sets number of first segment in current window
139 osmv_rmpp_send_ctx_set_wf(IN osmv_rmpp_send_ctx_t * p_ctx, IN uint32_t val)
142 p_ctx->window_first = val;
147 * osmv_rmpp_send_ctx_get_wl
150 * returns number of last segment in current window
154 static inline uint32_t
155 osmv_rmpp_send_ctx_get_wl(IN const osmv_rmpp_send_ctx_t * p_send_ctx)
157 CL_ASSERT(p_send_ctx);
158 return p_send_ctx->window_last;
163 * osmv_rmpp_send_ctx_set_wl
166 * sets number of last segment in current window
171 osmv_rmpp_send_ctx_set_wl(IN osmv_rmpp_send_ctx_t * p_ctx, IN uint32_t val)
174 p_ctx->window_last = val;
179 * osmv_rmpp_send_ctx_get_num_segs
182 * returns the total number of mad segments to send
186 uint32_t osmv_rmpp_send_ctx_get_num_segs(IN osmv_rmpp_send_ctx_t * p_send_ctx);
190 * osmv_rmpp_send_ctx_get_seg
193 * Retrieves the mad segment by seg number (including setting the mad relevant bits & hdrs)
198 osmv_rmpp_send_ctx_get_seg(IN osmv_rmpp_send_ctx_t * p_send_ctx,
199 IN uint32_t seg_idx, IN uint32_t resp_timeout,
204 * osmv_rmpp_recv_ctx_init
207 * c'tor for rmpp_recv_ctx obj
212 osmv_rmpp_recv_ctx_init(osmv_rmpp_recv_ctx_t * p_ctx, osm_log_t * p_log);
216 * osmv_rmpp_recv_ctx_done
219 * d'tor for rmpp_recv_ctx obj
223 void osmv_rmpp_recv_ctx_done(IN osmv_rmpp_recv_ctx_t * p_ctx);
227 * osmv_rmpp_recv_ctx_get_es
230 * retrunes index of expected segement in the curr window
233 static inline uint32_t
234 osmv_rmpp_recv_ctx_get_es(IN const osmv_rmpp_recv_ctx_t * p_recv_ctx)
236 CL_ASSERT(p_recv_ctx);
237 return p_recv_ctx->expected_seg;
242 * osmv_rmpp_recv_ctx_set_es
245 * sets index of expected segement in the curr window
249 osmv_rmpp_recv_ctx_set_es(IN osmv_rmpp_recv_ctx_t * p_recv_ctx, IN uint32_t val)
251 CL_ASSERT(p_recv_ctx);
252 p_recv_ctx->expected_seg = val;
257 * osmv_rmpp_recv_ctx_store_madw_seg
260 * stores rmpp mad in the list
264 osmv_rmpp_recv_ctx_store_mad_seg(IN osmv_rmpp_recv_ctx_t * p_recv_ctx,
268 osmv_rmpp_recv_ctx_get_cur_byte_num(IN osmv_rmpp_recv_ctx_t * p_recv_ctx);
271 osmv_rmpp_recv_ctx_get_byte_num_from_first(IN osmv_rmpp_recv_ctx_t *
275 osmv_rmpp_recv_ctx_get_byte_num_from_last(IN osmv_rmpp_recv_ctx_t * p_recv_ctx);
279 * osmv_rmpp_recv_ctx_reassemble_arbt_mad
282 * reassembles all rmpp buffs to one big arbitrary mad
285 osmv_rmpp_recv_ctx_reassemble_arbt_mad(IN osmv_rmpp_recv_ctx_t * p_recv_ctx,
286 IN uint32_t size, IN void *p_arbt_mad);