1 /* 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. 5 * 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: 11 * 12 * Redistribution and use in source and binary forms, with or 13 * without modification, are permitted provided that the following 14 * conditions are met: 15 * 16 * - Redistributions of source code must retain the above 17 * copyright notice, this list of conditions and the following 18 * disclaimer. 19 * 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. 24 * 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 32 * SOFTWARE. 33 * 34 */ 35 36 #ifndef _OSMV_RMPP_SENDER_H_ 37 #define _OSMV_RMPP_SENDER_H_ 38 39 #include <vendor/osm_vendor_mlx.h> 40 #include <vendor/osm_vendor_mlx_txn.h> 41 #include <opensm/osm_madw.h> 42 43 #ifdef __cplusplus 44 # define BEGIN_C_DECLS extern "C" { 45 # define END_C_DECLS } 46 #else /* !__cplusplus */ 47 # define BEGIN_C_DECLS 48 # define END_C_DECLS 49 #endif /* __cplusplus */ 50 51 BEGIN_C_DECLS 52 /****d* OSM Vendor/osmv_simple_send_madw 53 * NAME 54 * osmv_simple_send_madw 55 * 56 * DESCRIPTION 57 * Send a single MAD (256 bytes). 58 * 59 * If this MAD requires a response, set the timeout event. 60 * The function call returns when the MAD's send completion is received. 61 * 62 */ 63 ib_api_status_t 64 osmv_simple_send_madw(IN osm_bind_handle_t h_bind, 65 IN osm_madw_t * const p_madw, 66 IN osmv_txn_ctx_t * p_txn, IN boolean_t is_retry); 67 68 /****d* OSM Vendor/osmv_rmpp_send_madw 69 * NAME 70 * osmv_rmpp_send_madw 71 * 72 * DESCRIPTION 73 * Send a single MAD wrapper (of arbitrary length). 74 * Follow the RMPP semantics 75 * (segmentation, send window, timeouts etc). 76 * 77 * The function call returns either when the whole MAD 78 * has been acknowledged, or upon error. 79 */ 80 ib_api_status_t 81 osmv_rmpp_send_madw(IN osm_bind_handle_t h_bind, 82 IN osm_madw_t * const p_madw, 83 IN osmv_txn_ctx_t * p_txn, IN boolean_t is_rmpp_ds); 84 85 /* 86 * NAME osmv_rmpp_send_ack 87 * 88 * DESCRIPTION 89 */ 90 91 ib_api_status_t 92 osmv_rmpp_send_ack(IN osm_bind_handle_t h_bind, 93 IN const ib_mad_t * p_req_mad, 94 IN uint32_t seg_num, 95 IN uint32_t nwl, IN const osm_mad_addr_t * p_mad_addr); 96 97 /* 98 * NAME osmv_rmpp_send_nak 99 * 100 * DESCRIPTION Send the RMPP ABORT or STOP packet 101 */ 102 103 ib_api_status_t 104 osmv_rmpp_send_nak(IN osm_bind_handle_t h_bind, 105 IN const ib_mad_t * p_req_mad, 106 IN const osm_mad_addr_t * p_mad_addr, 107 IN uint8_t nak_type, IN uint8_t status); 108 109 /* 110 * NAME osmv_rmpp_snd_error 111 * 112 * DESCRIPTION Mark an error status and signal the sender thread to handle it 113 */ 114 115 static inline void 116 osmv_rmpp_snd_error(IN osmv_rmpp_send_ctx_t * p_send_ctx, 117 IN ib_api_status_t status) 118 { 119 p_send_ctx->status = status; 120 121 /* Release the thread waiting on send() 122 * It will release the transaction's context 123 */ 124 cl_event_signal(&p_send_ctx->event); 125 } 126 127 END_C_DECLS 128 #endif /* _OSMV_RMPP_SENDER_H_ */ 129