1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _SYS_IB_MGT_IBMF_IBMF_MSG_H 28 #define _SYS_IB_MGT_IBMF_IBMF_MSG_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 #define IBMF_MAD_SIZE 0x100 35 36 /* 37 * ibmf_addr definition 38 * This is local address information. 39 * 40 * When used in ibmf_msg_transport, local_lid refers to the (local) sender 41 * and remote_lid/remote_qno refer to the destination (ie., receiver). 42 * When used in async message callback, local_lid is the (local) receiver 43 * and remote_lid/remote_qno refer to the (remote) source; ibmf fills 44 * all fields of the addr_info_t when generating the receive callback. 45 * 46 * Note that the sender and receiver may be on the same node/port. 47 */ 48 typedef struct _ibmf_addr_info { 49 ib_lid_t ia_local_lid; 50 ib_lid_t ia_remote_lid; 51 ib_qpn_t ia_remote_qno; 52 ib_pkey_t ia_p_key; 53 ib_qkey_t ia_q_key; 54 uint8_t ia_service_level:4; 55 } ibmf_addr_info_t; 56 57 /* 58 * ibmf_global_addr_info_t 59 * This has the global address information. This is filled in by the 60 * client when sending the message and will be filled in by IBMF when 61 * a message is received. ip_global_addr_valid is B_TRUE if global 62 * address component of the message is valid (ip_global_addr_valid is 63 * set by the client when sending packets and set by IBMF when packets 64 * are received). 65 */ 66 typedef struct _ibmf_global_addr_info { 67 ib_gid_t ig_sender_gid; /* gid of the sender */ 68 ib_gid_t ig_recver_gid; /* gid of the receiver */ 69 uint32_t ig_flow_label; /* pkt grouping */ 70 uint8_t ig_tclass; /* end-to-end service level */ 71 uint8_t ig_hop_limit; /* inter subnet hops */ 72 } ibmf_global_addr_info_t; 73 74 /* 75 * ibmf_msg_bufs_t 76 * From the client's perspective, the message will consist of three 77 * sections, the MAD header, the Management Class header, and the 78 * data payload. IBMF will either assemble these sections into 79 * a message or disassemble the incoming message into these sections. 80 * 81 * The MAD header buffer is always 24 bytes in length. 82 * It may be set to NULL only when the QP is configured for raw 83 * UD traffic through the flags specified in ibmf_alloc_qp(). 84 * 85 * The class header buffer pointer may point to a buffer containing 86 * the class specific header as defined by the IB Architecture 87 * Specification, rev1.1. Note that the RMPP header should not be 88 * included in the class header for classes that support RMPP. 89 * For example, for the Subnet Administration (SA) class, the class 90 * header starts at byte offset 36 in the MAD and is of length 20 bytes. 91 * 92 * The data is provided in a buffer pointed to by im_bufs_cl_data, 93 * with the data length provided in im_bufs_cl_data_len. 94 * 95 * When sending a MAD message, the client may choose to not provide 96 * a class header buffer in im_msgbufs_send.im_bufs_cl_hdr. 97 * In this case, the im_msgbufs_send.im_bufs_cl_hdr must be NULL, 98 * and IBMF will interpret this to imply that the class header 99 * and data buffer are grouped together in the 100 * im_msgbufs_send.im_bufs_cl_data buffer. 101 * 102 * When sending a RAW UD packet over a non-special QP (i.e. not 103 * IBMF_QP_HANDLE_DEFAULT), the entire packet must be provided 104 * in a buffer pointed to by im_msgbufs_send.im_bufs_cl_data. 105 * The im_msgbufs_send.im_bufs_mad_hdr and 106 * im_msgbufs_send.im_bufs_cl_hdr pointers should be NULL. 107 * 108 * The data contained in these buffers, MAD header, Management Class 109 * header, and data payload buffers, must be in wire format which 110 * is the big-endian format. 111 */ 112 typedef struct _ibmf_msg_bufs { 113 ib_mad_hdr_t *im_bufs_mad_hdr; /* mad hdr (24 bytes) */ 114 void *im_bufs_cl_hdr; /* class hdr buffer ptr */ 115 size_t im_bufs_cl_hdr_len; /* class hdr buffer len ptr */ 116 void *im_bufs_cl_data; /* mad class data buf ptr */ 117 size_t im_bufs_cl_data_len; /* mad class data len ptr */ 118 } ibmf_msg_bufs_t; 119 120 /* 121 * ibmf_msg definition 122 * The IBMF client initializes various members of the msg while sending 123 * the message. IBMF fills in the various members of the msg when a message 124 * is received. 125 * The im_msgbufs_send buffers must always be allocated and freed 126 * by the client of ibmf. Message content passed from client to ibmf 127 * must be through the im_msgbufs_send buffers. 128 * The im_msgbufs_recv buffers must always be allocated and freed 129 * by ibmf. Message content passed from ibmf to client 130 * will always be through the im_msgbufs_recv buffers. 131 * 132 * im_msg_status: contains the IBMF status (defined in ibmf.h) of 133 * the transaction. This is the same as the return value of the 134 * ibmf_msg_transport() call for a blocking transaction. 135 * 136 * im_msg_flags: must be set to IBMF_MSG_FLAGS_GLOBAL_ADDRESS by 137 * the IBMF client if the send buffer contains a valid GRH, and by 138 * IBMF if the receive buffer contains a valid GRH 139 * 140 * Note on Host versus IB Wire format: 141 * Any MAD data passed in the buffers pointed to by im_bufs_mad_hdr, 142 * im_bufs_cl_hdr, and im_bufs_cl_data in im_msgbufs_send and 143 * im_msgbufs_recv should be in IB wire format. 144 * All other data in the ibmf_msg_t structure should be in host format, 145 * including the data in im_local_addr and im_global_addr. 146 */ 147 typedef struct _ibmf_msg { 148 ibmf_addr_info_t im_local_addr; /* local addressing info */ 149 ibmf_global_addr_info_t im_global_addr; /* global addressing info */ 150 int32_t im_msg_status; /* completion status */ 151 uint32_t im_msg_flags; /* flags */ 152 size_t im_msg_sz_limit; /* max. message size */ 153 ibmf_msg_bufs_t im_msgbufs_send; /* input data to ibmf */ 154 ibmf_msg_bufs_t im_msgbufs_recv; /* output data from ibmf */ 155 } ibmf_msg_t; 156 157 #ifdef __cplusplus 158 } 159 #endif 160 161 #endif /* _SYS_IB_MGT_IBMF_IBMF_MSG_H */ 162