2
* Copyright (c) 2004 Mellanox Technologies LTD. All rights reserved.
4
* This software is available to you under a choice of one of two
5
* licenses. You may choose to be licensed under the terms of the GNU
6
* General Public License (GPL) Version 2, available from the file
7
* COPYING in the main directory of this source tree, or the
8
* OpenIB.org BSD license below:
10
* Redistribution and use in source and binary forms, with or
11
* without modification, are permitted provided that the following
14
* - Redistributions of source code must retain the above
15
* copyright notice, this list of conditions and the following
18
* - Redistributions in binary form must reproduce the above
19
* copyright notice, this list of conditions and the following
20
* disclaimer in the documentation and/or other materials
21
* provided with the distribution.
23
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36
* MADS INTERFACE: Provide means for dispatching mads into the simulator
40
/* the following code will place the mad into the dispatcher */
55
static uint64_t tid = 19927;
57
/* initialize the message address vector */
59
msg.addr.pkey_index = 0;
60
msg.addr.dlid = destLid;
64
pPort = pFromNode->getIBNode()->getPort(fromPort);
67
cout << "-E- Given port:" << fromPort << " is down." << endl;
70
msg.addr.slid = pPort->base_lid;
72
/* initialize the mad header */
73
msg.header.base_ver = 1;
74
msg.header.mgmt_class = mgmt_class;
75
msg.header.class_ver = 1;
76
msg.header.method = method;
77
msg.header.status = 0;
78
msg.header.class_spec = 0;
79
msg.header.trans_id = tid++;
80
msg.header.attr_id = cl_hton16(attr);
81
msg.header.attr_mod = cl_hton32(attr_mod);
83
memcpy(msg.payload, data, size);
84
IBMSDispatcher *pDispatcher = Simulator.getDispatcher();
88
return pDispatcher->dispatchMad(pFromNode, fromPort, msg);
102
ib_sa_mad_t mad = {0}; /* includes std header and rmpp header */
104
mad.attr_offset = ib_get_attr_offset(sa_data_size);
105
mad.comp_mask = cl_hton64(comp_mask);
106
memcpy(mad.data, sa_data, sa_data_size);
117
MAD_RMPP_DATA_SIZE + 12);
123
#define madMcMemberRec ib_member_rec_t
126
struct madMcMemberRec
140
ib_net32_t sl_flow_hop;
142
// uint8_t proxy_join; hard to get as it is defined as bit field
145
%addmethods madMcMemberRec {
158
cl_ntoh16(IB_MAD_ATTR_MCMEMBER_RECORD),
161
sizeof(madMcMemberRec)
178
cl_ntoh16(IB_MAD_ATTR_MCMEMBER_RECORD),
181
sizeof(madMcMemberRec)
197
IB_MAD_METHOD_DELETE,
198
cl_ntoh16(IB_MAD_ATTR_MCMEMBER_RECORD),
201
sizeof(madMcMemberRec)
209
#define madPathRec ib_path_rec_t
216
ib_net64_t service_id;
221
ib_net32_t hop_flow_raw;
225
ib_net16_t qos_class_sl;
230
uint8_array_t resv2[6];
233
%addmethods madPathRec {
246
cl_ntoh16(IB_MAD_ATTR_PATH_RECORD),
256
#define madServiceRec ib_service_record_t
264
ib_net64_t service_id;
265
ib_gid_t service_gid;
266
ib_net16_t service_pkey;
268
ib_net32_t service_lease;
269
uint8_array_t service_key[16];
270
uint8_array_t service_name[64];
271
uint8_array_t service_data8[16];
272
uint16_array_t service_data16[8];
273
uint32_array_t service_data32[4];
274
uint64_array_t service_data64[2];
277
%addmethods madServiceRec {
290
cl_ntoh16(IB_MAD_ATTR_SERVICE_RECORD),
293
sizeof(madServiceRec)
310
cl_ntoh16(IB_MAD_ATTR_SERVICE_RECORD),
313
sizeof(madServiceRec)
329
IB_MAD_METHOD_DELETE,
330
cl_ntoh16(IB_MAD_ATTR_SERVICE_RECORD),
333
sizeof(madServiceRec)
341
#include <complib/cl_packon.h>
342
typedef struct _ib_mad_notice_attr128
344
uint8_t generic_type;
345
uint8_t prod_type_msb;
346
ib_net16_t prod_type_lsb;
348
ib_net16_t issuer_lid;
349
ib_net16_t toggle_count;
350
ib_net16_t sw_lid; // the sw lid of which link state changed - for 128 only
352
} PACK_SUFFIX ib_mad_notice_attr128_t;
353
#include <complib/cl_packoff.h>
355
#define madNotice128 ib_mad_notice_attr128_t
363
uint8_t generic_type;
364
uint8_t prod_type_msb;
365
ib_net16_t prod_type_lsb;
367
ib_net16_t issuer_lid;
368
ib_net16_t toggle_count;
369
ib_net16_t sw_lid; // the sw lid of which link state changed - for 128 only
373
%addmethods madNotice128 {
385
cl_ntoh16(IB_MAD_ATTR_NOTICE),
395
#include <complib/cl_packon.h>
396
typedef struct _ib_mad_notice_attr129
398
uint8_t generic_type;
399
uint8_t prod_type_msb;
400
ib_net16_t prod_type_lsb;
402
ib_net16_t issuer_lid;
403
ib_net16_t toggle_count;
404
ib_net16_t pad; //129
405
ib_net16_t lid; // 129 lid and port number of the violation
406
uint8_t port_num; //129
408
} PACK_SUFFIX ib_mad_notice_attr129_t;
409
#include <complib/cl_packoff.h>
411
#define madNotice129 ib_mad_notice_attr129_t
418
uint8_t generic_type;
419
uint8_t prod_type_msb;
420
ib_net16_t prod_type_lsb;
422
ib_net16_t issuer_lid;
423
ib_net16_t toggle_count;
424
ib_net16_t pad; //129
425
ib_net16_t lid; // 129 lid and port number of the violation
426
uint8_t port_num; //129
430
%addmethods madNotice129 {
442
cl_ntoh16(IB_MAD_ATTR_NOTICE),
452
#include <complib/cl_packon.h>
453
typedef struct _ib_mad_notice_attr144
455
uint8_t generic_type;
456
uint8_t prod_type_msb;
457
ib_net16_t prod_type_lsb;
459
ib_net16_t issuer_lid;
460
ib_net16_t toggle_count;
461
ib_net16_t pad1; // 144
462
ib_net16_t lid; // 144 lid where capability mask changed
463
ib_net16_t pad2; // 144
464
ib_net32_t new_cap_mask; // 144 new capability mask
466
} PACK_SUFFIX ib_mad_notice_attr144_t;
467
#include <complib/cl_packoff.h>
469
#define madNotice144 ib_mad_notice_attr144_t
477
uint8_t generic_type;
478
uint8_t prod_type_msb;
479
ib_net16_t prod_type_lsb;
481
ib_net16_t issuer_lid;
482
ib_net16_t toggle_count;
483
ib_net16_t pad1; // 144
484
ib_net16_t lid; // 144 lid where capability mask changed
485
ib_net16_t pad2; // 144
486
ib_net32_t new_cap_mask; // 144 new capability mask
490
%addmethods madNotice144 {
502
cl_ntoh16(IB_MAD_ATTR_NOTICE),
512
#include <complib/cl_packon.h>
513
typedef struct _ib_generic_inform_info
516
ib_net16_t lid_range_begin;
517
ib_net16_t lid_range_end;
518
ib_net16_t reserved1;
521
ib_net16_t trap_type;
523
ib_net32_t qpn_resp_time_val;
525
uint8_t node_type_msb;
526
ib_net16_t node_type_lsb;
527
} PACK_SUFFIX ib_generic_inform_info_t;
528
#include <complib/cl_packoff.h>
530
#define madGenericInform ib_generic_inform_info_t
533
struct madGenericInform
539
ib_net16_t lid_range_begin;
540
ib_net16_t lid_range_end;
541
ib_net16_t reserved1;
544
ib_net16_t trap_type;
546
ib_net32_t qpn_resp_time_val;
548
uint8_t node_type_msb;
549
ib_net16_t node_type_lsb;
552
#define IB_INFORM_INFO_COMP_GID 0x1
553
#define IB_INFORM_INFO_COMP_LID_BEGIN 0x2
554
#define IB_INFORM_INFO_COMP_LID_END 0x4
555
#define IB_INFORM_INFO_COMP_IS_GENERIC 0x10
556
#define IB_INFORM_INFO_COMP_TRAP_TYPE 0x40
557
#define IB_INFORM_INFO_COMP_TRAP_NUM 0x80
558
#define IB_INFORM_INFO_COMP_QPN 0x100
559
#define IB_INFORM_INFO_COMP_RESP_TIME 0x200
560
#define IB_INFORM_INFO_COMP_NODE_TYPE 0x800
562
%addmethods madGenericInform {
575
cl_ntoh16(IB_MAD_ATTR_INFORM_INFO),
578
sizeof(madGenericInform)