1219820Sjeff/* 2219820Sjeff * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3219820Sjeff * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4219820Sjeff * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5219820Sjeff * 6219820Sjeff * This software is available to you under a choice of one of two 7219820Sjeff * licenses. You may choose to be licensed under the terms of the GNU 8219820Sjeff * General Public License (GPL) Version 2, available from the file 9219820Sjeff * COPYING in the main directory of this source tree, or the 10219820Sjeff * OpenIB.org BSD license below: 11219820Sjeff * 12219820Sjeff * Redistribution and use in source and binary forms, with or 13219820Sjeff * without modification, are permitted provided that the following 14219820Sjeff * conditions are met: 15219820Sjeff * 16219820Sjeff * - Redistributions of source code must retain the above 17219820Sjeff * copyright notice, this list of conditions and the following 18219820Sjeff * disclaimer. 19219820Sjeff * 20219820Sjeff * - Redistributions in binary form must reproduce the above 21219820Sjeff * copyright notice, this list of conditions and the following 22219820Sjeff * disclaimer in the documentation and/or other materials 23219820Sjeff * provided with the distribution. 24219820Sjeff * 25219820Sjeff * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26219820Sjeff * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27219820Sjeff * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28219820Sjeff * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29219820Sjeff * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30219820Sjeff * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31219820Sjeff * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32219820Sjeff * SOFTWARE. 33219820Sjeff * 34219820Sjeff */ 35219820Sjeff 36219820Sjeff#ifndef _OSMV_SAR_H_ 37219820Sjeff#define _OSMV_SAR_H_ 38219820Sjeff 39219820Sjeff#include <iba/ib_types.h> 40219820Sjeff#include <complib/cl_qlist.h> 41219820Sjeff 42219820Sjeff#ifdef __cplusplus 43219820Sjeff# define BEGIN_C_DECLS extern "C" { 44219820Sjeff# define END_C_DECLS } 45219820Sjeff#else /* !__cplusplus */ 46219820Sjeff# define BEGIN_C_DECLS 47219820Sjeff# define END_C_DECLS 48219820Sjeff#endif /* __cplusplus */ 49219820Sjeff 50219820SjeffBEGIN_C_DECLS 51219820Sjeff 52219820Sjefftypedef struct _osmv_rmpp_sar { 53219820Sjeff void *p_arbt_mad; 54219820Sjeff uint32_t data_len; /* total data len in all the mads */ 55219820Sjeff /* these data members contain only constants */ 56219820Sjeff uint32_t hdr_sz; 57219820Sjeff uint32_t data_sz; /*typical data sz for this kind of mad (sa or regular */ 58219820Sjeff 59219820Sjeff} osmv_rmpp_sar_t; 60219820Sjeff 61219820Sjeff/* 62219820Sjeff * NAME 63219820Sjeff * osmv_rmpp_sar_alloc 64219820Sjeff * 65219820Sjeff * DESCRIPTION 66219820Sjeff * c'tor for rmpp_sar object 67219820Sjeff * 68219820Sjeff * SEE ALSO 69219820Sjeff * 70219820Sjeff */ 71219820Sjeffib_api_status_t 72219820Sjeffosmv_rmpp_sar_init(osmv_rmpp_sar_t * p_sar, void *p_arbt_mad, 73219820Sjeff uint32_t mad_size, boolean_t is_sa_mad); 74219820Sjeff 75219820Sjeff/* 76219820Sjeff * NAME 77219820Sjeff * osmv_rmpp_sar_dealloc 78219820Sjeff * 79219820Sjeff * DESCRIPTION 80219820Sjeff * d'tor for rmpp_sar object 81219820Sjeff * 82219820Sjeff * SEE ALSO 83219820Sjeff * 84219820Sjeff */ 85219820Sjeffvoid osmv_rmpp_sar_done(osmv_rmpp_sar_t * p_sar); 86219820Sjeff 87219820Sjeff/* 88219820Sjeff * NAME 89219820Sjeff * osmv_rmpp_sar_get_mad_seg 90219820Sjeff * 91219820Sjeff * DESCRIPTION 92219820Sjeff * segments the original mad buffer . returnes a mad with the data of the i-th segment 93219820Sjeff * 94219820Sjeff * SEE ALSO 95219820Sjeff * 96219820Sjeff */ 97219820Sjeffib_api_status_t 98219820Sjeffosmv_rmpp_sar_get_mad_seg(osmv_rmpp_sar_t * p_sar, uint32_t seg_idx, 99219820Sjeff void *p_buf); 100219820Sjeff 101219820Sjeff/* 102219820Sjeff * NAME 103219820Sjeff * osmv_rmpp_sar_reassemble_arbt_mad 104219820Sjeff * 105219820Sjeff * DESCRIPTION 106219820Sjeff * gets a qlist of mads and reassmbles to one big mad buffer 107219820Sjeff * ALSO - deallocates the mad list 108219820Sjeff * 109219820Sjeff * SEE ALSO 110219820Sjeff * 111219820Sjeff */ 112219820Sjeffib_api_status_t 113219820Sjeffosmv_rmpp_sar_reassemble_arbt_mad(osmv_rmpp_sar_t * p_sar, cl_qlist_t * p_bufs); 114219820Sjeff 115219820SjeffEND_C_DECLS 116219820Sjeff#endif /* _OSMV_SAR_H_ */ 117