Coverage Report

Created: 2026-11-12 07:01

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-smc.c
Line
Count
Source
1
/* packet-smc.c
2
 * SMC dissector for wireshark
3
 * By Joe Fowler <fowlerja@us.ibm.com>
4
 * By Guvenc Gulce <guvenc@linux.ibm.com>
5
 * By Karsten Graul <kgraul@linux.ibm.com>
6
 * (c) Copyright IBM Corporation 2014,2022
7
 * LICENSE: GNU General Public License, version 2, or (at your option) any
8
 * version. http://opensource.org/licenses/gpl-2.0.php
9
 *
10
 * Wireshark - Network traffic analyzer
11
 * By Gerald Combs <gerald@wireshark.org>
12
 * Copyright 1998 Gerald Combs
13
 *
14
 * SPDX-License-Identifier: GPL-2.0-or-later
15
 *
16
 * Please refer to the following specs for protocol:
17
 * - ietf - draft-fox-tcpm-shared-memory-rdma-05
18
 * - https://www.ibm.com/support/pages/node/6326337
19
 */
20
21
#include "config.h"
22
23
#include <epan/packet.h>
24
25
#include "packet-tcp.h"
26
27
0
#define SMC_TCP_MIN_HEADER_LENGTH 7
28
0
#define CLC_MSG_START_OFFSET 5
29
0
#define LLC_MSG_START_OFFSET 3
30
0
#define RMBE_CTRL_START_OFFSET 2
31
0
#define MAC_ADDR_LEN 6
32
0
#define SMC_V2 2
33
0
#define GID_LEN 16
34
0
#define PEERID_LEN 8
35
0
#define DIAG_INFO_LEN 4
36
0
#define EID_LEN 32
37
0
#define ISM_GID_LEN 8
38
0
#define ISM_CHID_LEN 2
39
0
#define IPV4_SUBNET_MASK_LEN 4
40
0
#define IPV6_PREFIX_LEN 16
41
0
#define ONE_BYTE_RESERVED 1
42
0
#define TWO_BYTE_RESERVED 2
43
0
#define QP_LEN 3
44
0
#define RKEY_LEN 4
45
0
#define VIRTUAL_ADDR_LEN 8
46
0
#define FLAG_BYTE_LEN 1
47
0
#define LENGTH_BYTE_LEN 2
48
0
#define SEQNO_LEN 2
49
0
#define CURSOR_LEN 4
50
0
#define ALERT_TOKEN_LEN 4
51
0
#define DMB_TOKEN_LEN 8
52
0
#define PSN_LEN 3
53
0
#define CONN_INDEX_LEN 1
54
176
#define SMCR_MSG_BYTE_0 0
55
4.04k
#define CLC_MSG_BYTE_0 0
56
164
#define CLC_MSG_BYTE_1 1
57
#define CLC_MSG_BYTE_2 2
58
#define CLC_MSG_BYTE_3 3
59
0
#define CLC_MSG_LEN_OFFSET 5
60
24
#define LLC_CMD_OFFSET 0
61
24
#define LLC_LEN_OFFSET 1
62
0
#define LLC_CMD_RSP_OFFSET 3
63
0
#define ACCEPT_CONFIRM_QP_OFFSET 38
64
1.93k
#define SMCR_CLC_ID 0xe2d4c3d9 /*EBCDIC 'SMCR' */
65
1.93k
#define SMCD_CLC_ID 0xe2d4c3c4 /*EBCDIC 'SMCD' */
66
#define SMC_CLC_V1    0x10
67
#define SMC_CLC_SMC_R 0x01
68
0
#define SMC_MAX_QP_NUM    6
69
0
#define SMCD_MAX_BUFSIZE_NUM  6
70
0
#define SMCR_MAX_BUFSIZE_NUM  5
71
72
0
#define LLC_FLAG_RESP 0x80
73
0
#define RMBE_CTRL 0xfe
74
164
#define LLC_MSG_LENGTH 0x2c
75
76
typedef enum {
77
  SMC_CLC_PROPOSAL = 1,
78
  SMC_CLC_ACCEPT = 2,
79
  SMC_CLC_CONFIRMATION = 3,
80
  SMC_CLC_DECLINE = 4
81
} clc_message;
82
83
typedef enum {
84
  SMC_CLC_SMCR = 0,
85
  SMC_CLC_SMCD = 1,
86
  SMC_CLC_NONE = 2,
87
  SMC_CLC_BOTH = 3,
88
} clc_type_message;
89
90
typedef enum {
91
  SMC_CLC_OS_ZOS = 1,
92
  SMC_CLC_OS_LINUX = 2,
93
  SMC_CLC_OS_AIX = 3,
94
  SMC_CLC_OS_UNKNOWN = 15,
95
} clc_os_message;
96
97
typedef enum {
98
  SMC_CLC_LG_INDIRECT = 0,
99
  SMC_CLC_LG_DIRECT = 1,
100
} clc_v2_lg_message;
101
102
static const value_string smc_clc_os_message_txt[] = {
103
  { SMC_CLC_OS_ZOS,      "z/OS" },
104
  { SMC_CLC_OS_LINUX,    "Linux" },
105
  { SMC_CLC_OS_AIX,      "AIX" },
106
  { SMC_CLC_OS_UNKNOWN,  "Unknown" },
107
  { 0, NULL }
108
};
109
110
static const value_string smc_clc_v2_lg_message_txt[] = {
111
  { SMC_CLC_LG_INDIRECT,      "V2_INDIRECT" },
112
  { SMC_CLC_LG_DIRECT,        "V2_DIRECT" },
113
  { 0, NULL }
114
};
115
116
static const value_string smc_clc_type_message_txt[] = {
117
  { SMC_CLC_SMCR,     "SMC-R" },
118
  { SMC_CLC_SMCD,     "SMC-D"   },
119
  { SMC_CLC_NONE,     "NONE"  },
120
  { SMC_CLC_BOTH,     "SMC-R/SMC-D"  },
121
  { 0, NULL }
122
};
123
124
125
static const value_string smcv2_clc_col_info_message_txt[] = {
126
  { SMC_CLC_SMCR,     "[SMC-Rv2-Proposal]" },
127
  { SMC_CLC_SMCD,     "[SMC-Dv2-Proposal]"   },
128
  { SMC_CLC_NONE,     "[NONE]"  },
129
  { SMC_CLC_BOTH,     "[SMC-Dv2/SMC-Rv2-Proposal]"  },
130
  { 0, NULL }
131
};
132
133
static const value_string smc_clc_col_info_message_txt[] = {
134
  { SMC_CLC_SMCR,     "[SMC-R-Proposal]" },
135
  { SMC_CLC_SMCD,     "[SMC-D-Proposal]"   },
136
  { SMC_CLC_NONE,     "[NONE]"  },
137
  { SMC_CLC_BOTH,     "[SMC-D/SMC-R-Proposal]"  },
138
  { 0, NULL }
139
};
140
141
static const value_string smcr_clc_message_txt[] = {
142
  { SMC_CLC_PROPOSAL,     "Proposal" },
143
  { SMC_CLC_ACCEPT,       "Accept"   },
144
  { SMC_CLC_CONFIRMATION, "Confirm"  },
145
  { SMC_CLC_DECLINE,      "Decline"  },
146
  { 0, NULL }
147
};
148
149
typedef enum {
150
  LLC_CONFIRM_LINK                = 0x01,
151
  LLC_ADD_LINK                    = 0x02,
152
  LLC_ADD_LINK_CONT               = 0x03,
153
  LLC_DEL_LINK                    = 0x04,
154
  LLC_CONFIRM_RKEY                = 0x06,
155
  LLC_CONFIRM_RKEY_CONT           = 0x08,
156
  LLC_DELETE_RKEY                 = 0x09,
157
  LLC_TEST_LINK                   = 0x07,
158
  /* SMC-Rv2 LLC message types */
159
  LLC_CONFIRM_LINK_V2             = 0x21,
160
  LLC_ADD_LINK_V2                 = 0x22,
161
  LLC_DEL_LINK_V2                 = 0x24,
162
  LLC_REQUEST_ADD_LINK_V2         = 0x25,
163
  LLC_CONFIRM_RKEY_V2             = 0x26,
164
  LLC_TEST_LINK_V2                = 0x27,
165
  LLC_DELETE_RKEY_V2              = 0x29,
166
  /* Common message types */
167
  LLC_OPT_MSG_CTRL                = 0x80,
168
  LLC_NWM_DATA                    = 0x8A,
169
  LLC_RMBE_CTRL                   = 0xFE
170
} llc_message;
171
172
static const value_string smcr_llc_message_txt[] = {
173
  { LLC_CONFIRM_LINK,            "Confirm Link" },
174
  { LLC_ADD_LINK,                "Add Link"   },
175
  { LLC_ADD_LINK_CONT,           "Add Link Continuous"  },
176
  { LLC_DEL_LINK,                "Delete Link"  },
177
  { LLC_CONFIRM_RKEY,            "Confirm Rkey" },
178
  { LLC_CONFIRM_RKEY_CONT,       "Confirm Rkey Continuous"   },
179
  { LLC_DELETE_RKEY,             "Delete Rkey"  },
180
  { LLC_TEST_LINK,               "Test Link"  },
181
  /* SMC-Rv2 LLC message types */
182
  { LLC_CONFIRM_LINK_V2,         "Confirm Link (v2)" },
183
  { LLC_ADD_LINK_V2,             "Add Link (v2)" },
184
  { LLC_DEL_LINK_V2,             "Delete Link (v2)" },
185
  { LLC_REQUEST_ADD_LINK_V2,     "Request Add Link (v2)" },
186
  { LLC_CONFIRM_RKEY_V2,         "Confirm Rkey (v2)" },
187
  { LLC_TEST_LINK_V2,            "Test Link (v2)" },
188
  { LLC_DELETE_RKEY_V2,          "Delete Rkey (v2)" },
189
  /* Common message types */
190
  { LLC_OPT_MSG_CTRL,            "OPT Message Control"   },
191
  { LLC_NWM_DATA,                "NWM Data"  },
192
  { RMBE_CTRL,                   "CDC Message"  },
193
  { 0, NULL }
194
};
195
196
static int proto_smc;
197
static int ett_smcr;
198
static int hf_smcr_clc_msg;
199
static int hf_smcr_llc_msg;
200
201
/* SMC Proposal for both SMC-D and SMC-R */
202
static int ett_proposal_flag;
203
static int ett_proposal_ext_flag2;
204
static int hf_proposal_smc_version_release_number;
205
static int hf_proposal_smc_version_seid;
206
static int hf_proposal_smc_version;
207
static int hf_proposal_smc_type;
208
static int hf_proposal_smc_v2_type;
209
static int hf_smc_length;
210
static int hf_smc_proposal_smc_chid;
211
static int hf_smc_proposal_flags;
212
static int hf_smc_proposal_eid;
213
static int hf_smc_proposal_eid_count;
214
static int hf_smc_proposal_system_eid;
215
static int hf_smc_proposal_ext_flags;
216
static int hf_smc_proposal_client_peer_id;
217
static int hf_smc_proposal_ism_gid_count;
218
static int hf_smc_proposal_ism_gid;
219
static int hf_smc_proposal_client_preferred_gid;
220
static int hf_smc_proposal_client_preferred_mac;
221
static int hf_smc_proposal_smcv1_subnet_ext_offset;
222
static int hf_smc_proposal_smcv2_ext_offset;
223
static int hf_smc_proposal_outgoing_interface_subnet_mask;
224
static int hf_smc_proposal_smcdv2_ext_offset;
225
static int hf_smc_proposal_rocev2_gid_ipv4_addr;
226
static int hf_smc_proposal_rocev2_gid_ipv6_addr;
227
static int hf_smc_proposal_outgoing_subnet_mask_signifcant_bits;
228
static int hf_smc_proposal_ipv6_prefix_count;
229
static int hf_smc_proposal_ipv6_prefix;
230
static int hf_smc_proposal_ipv6_prefix_length;
231
232
static int hf_smc_reserved;
233
234
/* SMC-R Accept */
235
static int ett_accept_flag;
236
static int ett_accept_flag2;
237
static int ett_smcr_accept_fce_flag1;
238
static int hf_accept_v2_lg_type;
239
static int hf_accept_smc_version;
240
static int hf_accept_first_contact;
241
static int hf_accept_rmb_buffer_size;
242
static int hf_accept_qp_mtu_value;
243
static int hf_smcr_accept_flags;
244
static int hf_smcr_accept_flags2;
245
static int hf_smcr_accept_fce_flags;
246
static int hf_smcr_accept_server_peer_id;
247
static int hf_smcr_accept_server_preferred_gid;
248
static int hf_smcr_accept_server_preferred_mac;
249
static int hf_smcr_accept_server_qp_number;
250
static int hf_smcr_accept_server_rmb_rkey;
251
static int hf_smcr_accept_server_tcp_conn_index;
252
static int hf_smcr_accept_server_rmb_element_alert_token;
253
static int hf_smcr_accept_server_rmb_virtual_address;
254
static int hf_smcr_accept_initial_psn;
255
256
/* SMC-R Confirm */
257
static int ett_confirm_flag;
258
static int ett_confirm_flag2;
259
static int hf_smcr_confirm_flags;
260
static int hf_smcr_confirm_client_peer_id;
261
static int hf_smcr_confirm_client_gid;
262
static int hf_smcr_confirm_client_mac;
263
static int hf_smcr_confirm_client_qp_number;
264
static int hf_smcr_confirm_client_rmb_rkey;
265
static int hf_smcr_confirm_client_tcp_conn_index;
266
static int hf_smcr_confirm_client_rmb_element_alert_token;
267
static int hf_smcr_confirm_flags2;
268
static int hf_smcr_confirm_client_rmb_virtual_address;
269
static int hf_smcr_confirm_initial_psn;
270
static int hf_confirm_smc_version;
271
static int hf_confirm_rmb_buffer_size;
272
static int hf_confirm_qp_mtu_value;
273
274
/* SMC-D Accept */
275
static int hf_accept_smc_type;
276
static int ett_smcd_accept_flag;
277
static int ett_smc_accept_fce_flag;
278
static int ett_smcd_accept_flag2;
279
static int hf_smcd_accept_smc_version;
280
static int hf_accept_os_type;
281
static int hf_accept_smc_version_release_number;
282
static int hf_smcd_accept_first_contact;
283
static int hf_accept_dmb_buffer_size;
284
static int hf_smcd_accept_flags;
285
static int hf_smc_accept_fce_flags;
286
static int hf_smcd_accept_flags2;
287
static int hf_smcd_accept_server_peer_id;
288
static int hf_smcd_accept_dmbe_conn_index;
289
static int hf_smcd_accept_dmb_token;
290
static int hf_smcd_accept_server_link_id;
291
static int hf_smcd_accept_smc_chid;
292
static int hf_smc_accept_eid;
293
static int hf_smc_accept_peer_name;
294
295
/* SMC-D Confirm */
296
static int hf_confirm_smc_type;
297
static int ett_smcd_confirm_flag;
298
static int ett_smc_confirm_fce_flag;
299
static int ett_smcd_confirm_flag2;
300
static int hf_smcd_confirm_smc_version;
301
static int hf_confirm_os_type;
302
static int hf_smcd_confirm_flags;
303
static int hf_smcd_confirm_flags2;
304
static int hf_smc_confirm_first_contact;
305
static int hf_smcd_confirm_client_peer_id;
306
static int hf_smcd_confirm_dmb_token;
307
static int hf_smcd_confirm_dmbe_conn_index;
308
static int hf_smcd_confirm_client_link_id;
309
static int hf_confirm_smc_version_release_number;
310
static int hf_smcd_confirm_dmb_buffer_size;
311
static int hf_smcd_confirm_smc_chid;
312
static int hf_smc_confirm_eid;
313
static int hf_smc_confirm_peer_name;
314
static int hf_smc_confirm_gid_lst_len;
315
static int hf_smc_confirm_gid_list_entry;
316
317
/* SMC-R Decline */
318
static int ett_decline_flag;
319
static int ett_decline_flag2;
320
static int hf_smc_decline_flags;
321
static int hf_smc_decline_flags2;
322
static int hf_smc_decline_peer_id;
323
static int hf_smc_decline_diag_info;
324
static int hf_decline_os_type;
325
static int hf_decline_smc_version;
326
static int hf_decline_out_of_sync;
327
328
/* SMC-R Confirm Link*/
329
static int ett_confirm_link_flag;
330
static int hf_smcr_confirm_link_flags;
331
static int hf_smcr_confirm_link_mac;
332
static int hf_smcr_confirm_link_gid;
333
static int hf_smcr_confirm_link_qp_number;
334
static int hf_smcr_confirm_link_number;
335
static int hf_smcr_confirm_link_userid;
336
static int hf_smcr_confirm_link_max_links;
337
static int hf_smcr_confirm_link_response;
338
339
/* SMC-R Add Link */
340
static int ett_add_link_flag;
341
static int ett_add_link_flag2;
342
static int ett_add_link_flag3;
343
static int hf_smcr_add_link_flags;
344
static int hf_smcr_add_link_response;
345
static int hf_smcr_add_link_response_rejected;
346
static int hf_smcr_add_link_reject_reason;
347
static int hf_smcr_add_link_mac;
348
static int hf_smcr_add_link_gid;
349
static int hf_smcr_add_link_qp_number;
350
static int hf_smcr_add_link_number;
351
static int hf_smcr_add_link_initial_psn;
352
static int hf_smcr_add_link_flags2;
353
static int hf_smcr_add_link_qp_mtu_value;
354
static int hf_smcr_add_link_client_target_gid;
355
static int hf_smcr_add_link_rkey_count;
356
static int hf_smcr_add_link_rkey;
357
static int hf_smcr_add_link_rkey2;
358
static int hf_smcr_add_link_virt_addr;
359
static int hf_smcr_add_link_flags3;
360
static int hf_smcr_add_link_flag3_direct_link;
361
362
/* SMC-R Add Link Continue*/
363
static int ett_add_link_cont_flag;
364
static int hf_smcr_add_link_cont_flags;
365
static int hf_smcr_add_link_cont_response;
366
static int hf_smcr_add_link_cont_link_number;
367
static int hf_smcr_add_link_cont_number_of_rkeys;
368
static int hf_smcr_add_link_cont_p1_rkey;
369
static int hf_smcr_add_link_cont_p1_rkey2;
370
static int hf_smcr_add_link_cont_p1_virt_addr;
371
static int hf_smcr_add_link_cont_p2_rkey;
372
static int hf_smcr_add_link_cont_p2_rkey2;
373
static int hf_smcr_add_link_cont_p2_virt_addr;
374
375
/* SMC-Rv2 Request Add Link */
376
static int ett_request_add_link_flag;
377
static int hf_smcr_request_add_link_flags;
378
static int hf_smcr_request_add_link_response;
379
static int hf_smcr_request_add_link_response_rejected;
380
static int hf_smcr_request_add_link_reject_reason;
381
static int hf_smc_request_add_link_gid_lst_len;
382
static int hf_smc_request_add_link_gid_list_entry;
383
384
/* SMC-R Delete Link */
385
static int ett_delete_link_flag;
386
static int hf_smcr_delete_link_flags;
387
static int hf_smcr_delete_link_response;
388
static int hf_smcr_delete_link_all;
389
static int hf_smcr_delete_link_orderly;
390
static int hf_smcr_delete_link_number;
391
static int hf_smcr_delete_link_reason_code;
392
393
/* SMC-R Confirm Rkey */
394
static int ett_confirm_rkey_flag;
395
static int hf_smcr_confirm_rkey_response;
396
static int hf_smcr_confirm_rkey_flags;
397
static int hf_smcr_confirm_rkey_negative_response;
398
static int hf_smcr_confirm_rkey_retry_rkey_set;
399
static int hf_smcr_confirm_rkey_number;
400
static int hf_smcr_confirm_rkey_new_rkey;
401
static int hf_smcr_confirm_rkey_virtual_address;
402
static int hf_smcr_confirm_rkey_link_number;
403
404
/* SMC-R Delete Rkey */
405
static int ett_delete_rkey_flag;
406
static int hf_smcr_delete_rkey_flags;
407
static int hf_smcr_delete_rkey_response;
408
static int hf_smcr_delete_rkey_negative_response;
409
static int hf_smcr_delete_rkey_mask;
410
static int hf_smcr_delete_rkey_deleted;
411
static int hf_smcr_delete_rkey_count;
412
static int hf_smcr_delete_rkey_invalid_count;
413
414
/* SMC-R Test Link */
415
static int ett_test_link_flag;
416
static int hf_smcr_test_link_flags;
417
static int hf_smcr_test_link_response;
418
419
/* SMC-R RMBE Control */
420
static int ett_rmbe_ctrl_rw_status_flag;
421
static int ett_rmbe_ctrl_peer_conn_state_flag;
422
static int hf_smcr_rmbe_ctrl_seqno;
423
static int hf_smcr_rmbe_ctrl_alert_token;
424
static int hf_smcr_rmbe_ctrl_prod_wrap_seqno;
425
static int hf_smcr_rmbe_ctrl_peer_prod_curs;
426
static int hf_smcr_rmbe_ctrl_cons_wrap_seqno;
427
static int hf_smcr_rmbe_ctrl_peer_cons_curs;
428
static int hf_smcr_rmbe_ctrl_conn_rw_status_flags;
429
static int hf_smcr_rmbe_ctrl_write_blocked;
430
static int hf_smcr_rmbe_ctrl_urgent_pending;
431
static int hf_smcr_rmbe_ctrl_urgent_present;
432
static int hf_smcr_rmbe_ctrl_cons_update_requested;
433
static int hf_smcr_rmbe_ctrl_failover_validation;
434
static int hf_smcr_rmbe_ctrl_peer_conn_state_flags;
435
static int hf_smcr_rmbe_ctrl_peer_sending_done;
436
static int hf_smcr_rmbe_ctrl_peer_closed_conn;
437
static int hf_smcr_rmbe_ctrl_peer_abnormal_close;
438
439
void proto_register_smcr(void);
440
void proto_reg_handoff_smcr(void);
441
static dissector_handle_t smc_tcp_handle;
442
static dissector_handle_t smc_infiniband_handle;
443
444
static void
445
dissect_smc_uncompress_size(proto_item* ti, unsigned size, unsigned max_valid)
446
0
{
447
0
  if (size <= max_valid) {
448
0
    proto_item_append_text(ti, " (Size: %dk)", 1 << (size + 4)); /* uncompressed size */
449
0
  } else {
450
0
    proto_item_append_text(ti, " (Size: invalid)");
451
0
  }
452
0
}
453
454
static void
455
dissect_smcr_translate_qp_mtu(proto_item* ti, unsigned qp_num)
456
0
{
457
0
  if (qp_num > 0 && qp_num < SMC_MAX_QP_NUM) {
458
0
    proto_item_append_text(ti, " (MTU: %d)", 1 << (7 + qp_num)); /* translated MTU size (1-5) */
459
0
  } else {
460
0
    proto_item_append_text(ti, " (MTU: invalid)");
461
0
  }
462
0
}
463
464
static void
465
dissect_smc_proposal(tvbuff_t *tvb, proto_tree *tree, bool is_ipv6)
466
0
{
467
0
  unsigned offset;
468
0
  uint16_t ip_subnet_ext_offset = 0, v2_ext_offset;
469
0
  uint16_t v2_ext_pos = 0, smcd_v2_ext_offset = 0;
470
0
  uint16_t smcd_v2_ext_pos = 0;
471
0
  uint8_t ipv6_prefix_count, smc_version;
472
0
  uint8_t smc_type, num_of_gids = 0, num_of_eids = 0;
473
0
  uint8_t smc_type_v1 = 0, smc_type_v2 = 0;
474
0
  bool is_smc_v2, is_smcdv1, is_smcdv2 = false, is_smcrv1, is_smcrv2 = false;
475
0
  proto_item *proposal_flag_item;
476
0
  proto_tree *proposal_flag_tree;
477
478
0
  offset = CLC_MSG_START_OFFSET;
479
0
  proto_tree_add_item(tree, hf_smc_length, tvb, offset, LENGTH_BYTE_LEN, ENC_BIG_ENDIAN);
480
0
  offset += LENGTH_BYTE_LEN;
481
0
  proposal_flag_item = proto_tree_add_item(tree, hf_smc_proposal_flags, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
482
0
  proposal_flag_tree = proto_item_add_subtree(proposal_flag_item, ett_proposal_flag);
483
0
  proto_tree_add_item_ret_uint8(proposal_flag_tree, hf_proposal_smc_version, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN, &smc_version);
484
0
  smc_type = tvb_get_uint8(tvb, offset);
485
0
  is_smc_v2 = (smc_version >= SMC_V2);
486
0
  smc_type_v2 = ((smc_type >> 2) & 0x03);
487
0
  smc_type_v1 = (smc_type & 0x03);
488
0
  is_smcdv1 = ((smc_type_v1 == SMC_CLC_SMCD) || (smc_type_v1 == SMC_CLC_BOTH));
489
0
  is_smcrv1 = ((smc_type_v1 == SMC_CLC_SMCR) || (smc_type_v1 == SMC_CLC_BOTH));
490
0
  if (is_smc_v2) {
491
0
    is_smcdv2 = ((smc_type_v2 == SMC_CLC_SMCD) || (smc_type_v2 == SMC_CLC_BOTH));
492
0
    is_smcrv2 = ((smc_type_v2 == SMC_CLC_SMCR) || (smc_type_v2 == SMC_CLC_BOTH));
493
0
  }
494
495
0
  if (is_smc_v2) {
496
0
    proto_tree_add_item(proposal_flag_tree, hf_proposal_smc_v2_type, tvb,
497
0
      offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
498
0
  }
499
0
  proto_tree_add_item(proposal_flag_tree, hf_proposal_smc_type, tvb,
500
0
      offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
501
0
  offset += FLAG_BYTE_LEN;
502
0
  if (is_smcrv1 || is_smcrv2) {
503
0
    proto_tree_add_item(tree, hf_smc_proposal_client_peer_id, tvb, offset,
504
0
      PEERID_LEN, ENC_BIG_ENDIAN);
505
0
  } else {
506
0
    proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, PEERID_LEN, ENC_NA);
507
0
  }
508
0
  offset += PEERID_LEN;
509
0
  if (is_smcrv1) {
510
0
    proto_tree_add_item(tree, hf_smc_proposal_client_preferred_gid, tvb,
511
0
      offset, GID_LEN, ENC_NA);
512
0
    offset += GID_LEN;
513
0
    proto_tree_add_item(tree, hf_smc_proposal_client_preferred_mac, tvb,
514
0
      offset, MAC_ADDR_LEN, ENC_NA);
515
0
    offset += MAC_ADDR_LEN;
516
0
  } else {
517
0
    proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, GID_LEN + MAC_ADDR_LEN, ENC_NA);
518
0
    offset += GID_LEN + MAC_ADDR_LEN;
519
0
  }
520
0
  if (is_smcrv1 || is_smcdv1) {
521
0
    ip_subnet_ext_offset = tvb_get_ntohs(tvb, offset);
522
0
    proto_tree_add_item(tree, hf_smc_proposal_smcv1_subnet_ext_offset, tvb,
523
0
      offset, 2, ENC_BIG_ENDIAN);
524
0
    offset += 2;
525
0
  } else {
526
0
    proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, 2, ENC_NA);
527
0
    offset += 2;
528
0
  }
529
0
  if (is_smcdv1 || is_smcdv2) {
530
0
    proto_tree_add_item(tree, hf_smc_proposal_ism_gid, tvb,
531
0
      offset, ISM_GID_LEN, ENC_BIG_ENDIAN);
532
0
  }
533
0
  offset += ISM_GID_LEN;
534
0
  if (is_smcdv2) {
535
0
    proto_tree_add_item(tree, hf_smc_proposal_smc_chid, tvb, offset,
536
0
      LENGTH_BYTE_LEN, ENC_BIG_ENDIAN);
537
0
  } else {
538
0
    proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, LENGTH_BYTE_LEN, ENC_NA);
539
0
  }
540
0
  offset += LENGTH_BYTE_LEN;
541
0
  if (is_smc_v2) {
542
0
    v2_ext_offset = tvb_get_ntohs(tvb, offset);
543
0
    v2_ext_pos = offset + 2 + v2_ext_offset;
544
0
    proto_tree_add_item(tree, hf_smc_proposal_smcv2_ext_offset, tvb,
545
0
      offset, 2, ENC_BIG_ENDIAN);
546
0
  } else {
547
0
    proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, 2, ENC_NA);
548
0
  }
549
0
  offset += 2;
550
551
0
  proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, 28, ENC_NA);
552
0
  offset += 28; /* reserved */
553
554
0
  if (ip_subnet_ext_offset) {
555
0
    proto_tree_add_item(tree, hf_smc_proposal_outgoing_interface_subnet_mask, tvb,
556
0
      offset, IPV4_SUBNET_MASK_LEN, ENC_BIG_ENDIAN);
557
0
    offset += IPV4_SUBNET_MASK_LEN;
558
0
    proto_tree_add_item(tree, hf_smc_proposal_outgoing_subnet_mask_signifcant_bits, tvb,
559
0
      offset, 1, ENC_BIG_ENDIAN);
560
0
    offset += 1;
561
0
    proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, TWO_BYTE_RESERVED, ENC_NA);
562
0
    offset += TWO_BYTE_RESERVED; /* reserved */
563
0
    ipv6_prefix_count = tvb_get_uint8(tvb, offset);
564
0
    proto_tree_add_item(tree, hf_smc_proposal_ipv6_prefix_count, tvb,
565
0
      offset, 1, ENC_BIG_ENDIAN);
566
0
    offset += 1;
567
568
0
    while (ipv6_prefix_count != 0) {
569
0
      proto_tree_add_item(tree, hf_smc_proposal_ipv6_prefix, tvb,
570
0
        offset, IPV6_PREFIX_LEN, ENC_NA);
571
0
      offset += IPV6_PREFIX_LEN;
572
0
      proto_tree_add_item(tree, hf_smc_proposal_ipv6_prefix_length, tvb,
573
0
        offset, 1, ENC_BIG_ENDIAN);
574
0
      offset += 1;
575
0
      ipv6_prefix_count--;
576
0
    }
577
0
  }
578
579
0
  if (v2_ext_pos >= offset) {
580
0
    offset = v2_ext_pos;
581
0
    num_of_eids = tvb_get_uint8(tvb, offset);
582
0
    proto_tree_add_item(tree, hf_smc_proposal_eid_count, tvb,
583
0
      offset, 1, ENC_BIG_ENDIAN);
584
0
    offset += FLAG_BYTE_LEN;
585
0
    num_of_gids = tvb_get_uint8(tvb, offset);
586
0
    proto_tree_add_item(tree, hf_smc_proposal_ism_gid_count, tvb,
587
0
      offset, 1, ENC_BIG_ENDIAN);
588
0
    offset += FLAG_BYTE_LEN;
589
0
    proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, ONE_BYTE_RESERVED, ENC_NA);
590
0
    offset += ONE_BYTE_RESERVED; /* reserved */
591
0
    proposal_flag_item = proto_tree_add_item(tree, hf_smc_proposal_ext_flags, tvb,
592
0
              offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
593
0
    proposal_flag_tree = proto_item_add_subtree(proposal_flag_item, ett_proposal_ext_flag2);
594
0
    proto_tree_add_item(proposal_flag_tree, hf_proposal_smc_version_release_number,
595
0
        tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
596
0
    proto_tree_add_item(proposal_flag_tree, hf_proposal_smc_version_seid, tvb,
597
0
        offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
598
0
    offset += FLAG_BYTE_LEN;
599
0
    proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, TWO_BYTE_RESERVED, ENC_NA);
600
0
    offset += TWO_BYTE_RESERVED; /* reserved */
601
0
    smcd_v2_ext_offset = tvb_get_ntohs(tvb, offset);
602
0
    proto_tree_add_item(tree, hf_smc_proposal_smcdv2_ext_offset, tvb,
603
0
      offset, 2, ENC_BIG_ENDIAN);
604
0
    offset += 2;
605
0
    smcd_v2_ext_pos = offset + smcd_v2_ext_offset;
606
0
    if (is_smcrv2) {
607
0
      if (is_ipv6) {
608
0
        proto_tree_add_item(tree, hf_smc_proposal_rocev2_gid_ipv6_addr, tvb,
609
0
          offset, GID_LEN, ENC_NA);
610
0
        offset += GID_LEN;
611
0
      } else {
612
0
        proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, 12, ENC_NA);
613
0
        offset += 12; /* reserved */
614
0
        proto_tree_add_item(tree, hf_smc_proposal_rocev2_gid_ipv4_addr, tvb,
615
0
          offset, IPV4_SUBNET_MASK_LEN, ENC_BIG_ENDIAN);
616
0
        offset += IPV4_SUBNET_MASK_LEN;
617
0
      }
618
0
    } else {
619
0
      offset += GID_LEN;
620
0
    }
621
0
    proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, 16, ENC_NA);
622
0
    offset += 16; /* reserved */
623
0
    while (num_of_eids != 0) {
624
0
      proto_tree_add_item(tree, hf_smc_proposal_eid, tvb,
625
0
          offset, EID_LEN, ENC_ASCII);
626
0
      offset += EID_LEN;
627
0
      num_of_eids--;
628
0
    }
629
0
    if (smcd_v2_ext_pos >= offset) {
630
0
      offset = smcd_v2_ext_pos;
631
0
      proto_tree_add_item(tree, hf_smc_proposal_system_eid, tvb,
632
0
          offset, EID_LEN, ENC_ASCII);
633
0
      offset += EID_LEN;
634
0
      proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, 16, ENC_NA);
635
0
      offset += 16; /* reserved */
636
0
      while (num_of_gids != 0) {
637
0
        proto_tree_add_item(tree, hf_smc_proposal_ism_gid, tvb,
638
0
          offset, ISM_GID_LEN, ENC_BIG_ENDIAN);
639
0
        offset += ISM_GID_LEN;
640
0
        proto_tree_add_item(tree, hf_smc_proposal_smc_chid, tvb, offset,
641
0
            ISM_CHID_LEN, ENC_BIG_ENDIAN);
642
0
        offset += ISM_CHID_LEN;
643
0
        num_of_gids--;
644
0
      }
645
0
    }
646
0
  }
647
0
}
648
649
static void
650
dissect_smcd_accept(tvbuff_t* tvb, proto_tree* tree)
651
0
{
652
0
  unsigned offset, dmbe_size;
653
0
  proto_item* accept_flag_item;
654
0
  proto_tree* accept_flag_tree;
655
0
  proto_item* accept_flag2_item;
656
0
  proto_tree* accept_flag2_tree;
657
0
  proto_item* ti;
658
0
  uint8_t smc_version, first_contact = 0;
659
660
0
  offset = CLC_MSG_START_OFFSET;
661
0
  proto_tree_add_item(tree, hf_smc_length, tvb, offset,
662
0
    LENGTH_BYTE_LEN, ENC_BIG_ENDIAN);
663
0
  offset += LENGTH_BYTE_LEN;
664
0
  accept_flag_item = proto_tree_add_item(tree, hf_smcd_accept_flags, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
665
0
  accept_flag_tree = proto_item_add_subtree(accept_flag_item, ett_smcd_accept_flag);
666
0
  proto_tree_add_item(accept_flag_tree, hf_smcd_accept_smc_version, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
667
0
  proto_tree_add_item(accept_flag_tree, hf_smcd_accept_first_contact, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
668
0
  proto_tree_add_item(accept_flag_tree, hf_accept_smc_type, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
669
0
  smc_version = tvb_get_uint8(tvb, offset);
670
0
  first_contact = tvb_get_uint8(tvb, offset);
671
0
  smc_version = ((smc_version >> 4) & 0x0F);
672
0
  first_contact = ((first_contact >> 3) & 0x01);
673
0
  offset += FLAG_BYTE_LEN;
674
0
  proto_tree_add_item(tree, hf_smcd_accept_server_peer_id, tvb, offset,
675
0
    PEERID_LEN, ENC_BIG_ENDIAN);
676
0
  offset += PEERID_LEN;
677
678
0
  proto_tree_add_item(tree, hf_smcd_accept_dmb_token, tvb,
679
0
    offset, DMB_TOKEN_LEN, ENC_BIG_ENDIAN);
680
0
  offset += DMB_TOKEN_LEN;
681
682
0
  proto_tree_add_item(tree, hf_smcd_accept_dmbe_conn_index, tvb,
683
0
    offset, CONN_INDEX_LEN, ENC_BIG_ENDIAN);
684
0
  offset += CONN_INDEX_LEN;
685
686
0
  accept_flag2_item = proto_tree_add_item(tree, hf_smcd_accept_flags2, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
687
0
  accept_flag2_tree = proto_item_add_subtree(accept_flag2_item, ett_smcd_accept_flag2);
688
0
  ti = proto_tree_add_item(accept_flag2_tree, hf_accept_dmb_buffer_size, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
689
0
  dmbe_size = tvb_get_int8(tvb, offset) >> 4;
690
0
  dissect_smc_uncompress_size(ti, dmbe_size, SMCD_MAX_BUFSIZE_NUM);
691
0
  offset += FLAG_BYTE_LEN;
692
0
  proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, TWO_BYTE_RESERVED, ENC_NA);
693
0
  offset += TWO_BYTE_RESERVED; /* reserved */
694
0
  proto_tree_add_item(tree, hf_smcd_accept_server_link_id, tvb,
695
0
    offset, ALERT_TOKEN_LEN, ENC_BIG_ENDIAN);
696
0
  offset += ALERT_TOKEN_LEN;
697
698
0
  if (smc_version >= SMC_V2) {
699
0
    proto_tree_add_item(tree, hf_smcd_accept_smc_chid, tvb, offset, LENGTH_BYTE_LEN, ENC_BIG_ENDIAN);
700
0
    offset += LENGTH_BYTE_LEN;
701
702
0
    proto_tree_add_item(tree, hf_smc_accept_eid, tvb, offset, 32, ENC_ASCII);
703
0
    offset += 32;
704
0
    proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, 8, ENC_NA);
705
0
    offset += 8; /* reserved */
706
707
0
    if (first_contact) {
708
0
      proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, ONE_BYTE_RESERVED, ENC_NA);
709
0
      offset += ONE_BYTE_RESERVED; /* reserved */
710
0
      accept_flag_item = proto_tree_add_item(tree, hf_smc_accept_fce_flags, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
711
0
      accept_flag_tree = proto_item_add_subtree(accept_flag_item, ett_smc_accept_fce_flag);
712
0
      proto_tree_add_item(accept_flag_tree, hf_accept_os_type, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
713
0
      proto_tree_add_item(accept_flag_tree, hf_accept_smc_version_release_number, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
714
0
      offset += FLAG_BYTE_LEN;
715
0
      proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, TWO_BYTE_RESERVED, ENC_NA);
716
0
      offset += TWO_BYTE_RESERVED; /* reserved */
717
0
      proto_tree_add_item(tree, hf_smc_accept_peer_name, tvb, offset, 32, ENC_ASCII);
718
0
      offset += 32;
719
0
      proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, 16, ENC_NA);
720
      /* offset += 16; */ /* reserved */
721
0
    }
722
0
  }
723
0
}
724
725
static void
726
dissect_smcd_confirm(tvbuff_t* tvb, proto_tree* tree)
727
0
{
728
0
  unsigned offset, dmbe_size;
729
0
  proto_item* confirm_flag_item;
730
0
  proto_tree* confirm_flag_tree;
731
0
  proto_item* confirm_flag2_item;
732
0
  proto_tree* confirm_flag2_tree;
733
0
  proto_item* ti;
734
0
  uint8_t smc_version, first_contact = 0;
735
736
0
  offset = CLC_MSG_START_OFFSET;
737
0
  proto_tree_add_item(tree, hf_smc_length, tvb, offset,
738
0
    LENGTH_BYTE_LEN, ENC_BIG_ENDIAN);
739
0
  offset += LENGTH_BYTE_LEN;
740
0
  confirm_flag_item = proto_tree_add_item(tree, hf_smcd_confirm_flags, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
741
0
  confirm_flag_tree = proto_item_add_subtree(confirm_flag_item, ett_smcd_confirm_flag);
742
0
  proto_tree_add_item(confirm_flag_tree, hf_smcd_confirm_smc_version, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
743
0
  proto_tree_add_item(confirm_flag_tree, hf_smc_confirm_first_contact, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
744
0
  proto_tree_add_item(confirm_flag_tree, hf_confirm_smc_type, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
745
0
  smc_version = tvb_get_uint8(tvb, offset);
746
0
  first_contact = tvb_get_uint8(tvb, offset);
747
0
  smc_version = ((smc_version >> 4) & 0x0F);
748
0
  first_contact = ((first_contact >> 3) & 0x01);
749
0
  offset += FLAG_BYTE_LEN;
750
0
  proto_tree_add_item(tree, hf_smcd_confirm_client_peer_id, tvb, offset,
751
0
    PEERID_LEN, ENC_BIG_ENDIAN);
752
0
  offset += PEERID_LEN;
753
754
0
  proto_tree_add_item(tree, hf_smcd_confirm_dmb_token, tvb,
755
0
    offset, DMB_TOKEN_LEN, ENC_BIG_ENDIAN);
756
0
  offset += DMB_TOKEN_LEN;
757
758
0
  proto_tree_add_item(tree, hf_smcd_confirm_dmbe_conn_index, tvb,
759
0
    offset, CONN_INDEX_LEN, ENC_BIG_ENDIAN);
760
0
  offset += CONN_INDEX_LEN;
761
762
0
  confirm_flag2_item = proto_tree_add_item(tree, hf_smcd_confirm_flags2, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
763
0
  confirm_flag2_tree = proto_item_add_subtree(confirm_flag2_item, ett_smcd_confirm_flag2);
764
0
  ti = proto_tree_add_item(confirm_flag2_tree, hf_smcd_confirm_dmb_buffer_size, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
765
0
  dmbe_size = tvb_get_int8(tvb, offset) >> 4;
766
0
  dissect_smc_uncompress_size(ti, dmbe_size, SMCD_MAX_BUFSIZE_NUM);
767
0
  offset += FLAG_BYTE_LEN;
768
0
  proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, TWO_BYTE_RESERVED, ENC_NA);
769
0
  offset += TWO_BYTE_RESERVED; /* reserved */
770
0
  proto_tree_add_item(tree, hf_smcd_confirm_client_link_id, tvb,
771
0
    offset, ALERT_TOKEN_LEN, ENC_BIG_ENDIAN);
772
0
  offset += ALERT_TOKEN_LEN;
773
774
0
  if (smc_version >= SMC_V2) {
775
0
    proto_tree_add_item(tree, hf_smcd_confirm_smc_chid, tvb, offset,
776
0
      LENGTH_BYTE_LEN, ENC_BIG_ENDIAN);
777
0
    offset += LENGTH_BYTE_LEN;
778
779
0
    proto_tree_add_item(tree, hf_smc_confirm_eid, tvb, offset, 32, ENC_ASCII);
780
0
    offset += 32;
781
0
    proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, 8, ENC_NA);
782
0
    offset += 8; /* reserved */
783
784
0
    if (first_contact) {
785
0
      proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, ONE_BYTE_RESERVED, ENC_NA);
786
0
      offset += ONE_BYTE_RESERVED; /* reserved */
787
0
      confirm_flag_item = proto_tree_add_item(tree, hf_smc_accept_fce_flags, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
788
0
      confirm_flag_tree = proto_item_add_subtree(confirm_flag_item, ett_smc_confirm_fce_flag);
789
0
      proto_tree_add_item(confirm_flag_tree, hf_confirm_os_type, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
790
0
      proto_tree_add_item(confirm_flag_tree, hf_confirm_smc_version_release_number, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
791
0
      offset += FLAG_BYTE_LEN;
792
0
      proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, TWO_BYTE_RESERVED, ENC_NA);
793
0
      offset += TWO_BYTE_RESERVED; /* reserved */
794
0
      proto_tree_add_item(tree, hf_smc_confirm_peer_name, tvb, offset, 32, ENC_ASCII);
795
0
    }
796
0
  }
797
0
}
798
799
static void
800
dissect_smcr_accept(tvbuff_t *tvb, proto_tree *tree)
801
0
{
802
0
  unsigned offset, qp_num, rmbe_size;
803
0
  proto_item *accept_flag_item;
804
0
  proto_tree *accept_flag_tree;
805
0
  proto_item *accept_flag2_item;
806
0
  proto_tree *accept_flag2_tree;
807
0
  proto_item *ti;
808
0
  uint8_t smc_version, first_contact = 0;
809
810
0
  offset = CLC_MSG_START_OFFSET;
811
0
  proto_tree_add_item(tree, hf_smc_length, tvb, offset,
812
0
    LENGTH_BYTE_LEN, ENC_BIG_ENDIAN);
813
0
  offset += LENGTH_BYTE_LEN;
814
0
  accept_flag_item = proto_tree_add_item(tree, hf_smcr_accept_flags, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
815
0
  accept_flag_tree = proto_item_add_subtree(accept_flag_item, ett_accept_flag);
816
0
  proto_tree_add_item(accept_flag_tree, hf_accept_smc_version, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
817
0
  proto_tree_add_item(accept_flag_tree, hf_accept_first_contact, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
818
0
  smc_version = tvb_get_uint8(tvb, offset);
819
0
  first_contact = tvb_get_uint8(tvb, offset);
820
0
  smc_version = ((smc_version >> 4) & 0x0F);
821
0
  first_contact = ((first_contact >> 3) & 0x01);
822
0
  offset += FLAG_BYTE_LEN;
823
0
  proto_tree_add_item(tree, hf_smcr_accept_server_peer_id, tvb, offset,
824
0
      PEERID_LEN, ENC_BIG_ENDIAN);
825
0
  offset += PEERID_LEN;
826
0
  proto_tree_add_item(tree, hf_smcr_accept_server_preferred_gid, tvb,
827
0
      offset, GID_LEN, ENC_NA);
828
0
  offset += GID_LEN;
829
0
  proto_tree_add_item(tree, hf_smcr_accept_server_preferred_mac, tvb,
830
0
      offset, MAC_ADDR_LEN, ENC_NA);
831
0
  offset += MAC_ADDR_LEN;
832
0
  proto_tree_add_item(tree, hf_smcr_accept_server_qp_number, tvb,
833
0
      offset, QP_LEN, ENC_BIG_ENDIAN);
834
0
  offset += QP_LEN;
835
0
  proto_tree_add_item(tree, hf_smcr_accept_server_rmb_rkey, tvb,
836
0
      offset, RKEY_LEN, ENC_BIG_ENDIAN);
837
0
  offset += RKEY_LEN;
838
0
  proto_tree_add_item(tree, hf_smcr_accept_server_tcp_conn_index, tvb,
839
0
      offset, CONN_INDEX_LEN, ENC_BIG_ENDIAN);
840
0
  offset += CONN_INDEX_LEN;
841
0
  proto_tree_add_item(tree, hf_smcr_accept_server_rmb_element_alert_token, tvb,
842
0
        offset, ALERT_TOKEN_LEN, ENC_BIG_ENDIAN);
843
0
  offset += ALERT_TOKEN_LEN;
844
0
  accept_flag2_item = proto_tree_add_item(tree, hf_smcr_accept_flags2, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
845
0
  accept_flag2_tree = proto_item_add_subtree(accept_flag2_item, ett_accept_flag2);
846
0
  ti = proto_tree_add_item(accept_flag2_tree, hf_accept_rmb_buffer_size, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
847
0
  rmbe_size = tvb_get_int8(tvb, offset) >> 4;
848
0
  dissect_smc_uncompress_size(ti, rmbe_size, SMCR_MAX_BUFSIZE_NUM);
849
0
  ti = proto_tree_add_item(accept_flag2_tree, hf_accept_qp_mtu_value, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
850
0
  qp_num = tvb_get_int8(tvb, offset) & 0x0F;
851
0
  dissect_smcr_translate_qp_mtu(ti, qp_num);
852
0
  offset += FLAG_BYTE_LEN;
853
0
  proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, ONE_BYTE_RESERVED, ENC_NA);
854
0
  offset += ONE_BYTE_RESERVED; /* reserved */
855
0
  proto_tree_add_item(tree, hf_smcr_accept_server_rmb_virtual_address, tvb,
856
0
      offset, VIRTUAL_ADDR_LEN, ENC_BIG_ENDIAN);
857
0
  offset += VIRTUAL_ADDR_LEN;
858
0
  proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, ONE_BYTE_RESERVED, ENC_NA);
859
0
  offset += ONE_BYTE_RESERVED; /* reserved */
860
0
  proto_tree_add_item(tree, hf_smcr_accept_initial_psn, tvb,
861
0
      offset, PSN_LEN, ENC_BIG_ENDIAN);
862
0
  offset += PSN_LEN;
863
864
0
  if (smc_version >= SMC_V2) {
865
0
    proto_tree_add_item(tree, hf_smc_accept_eid, tvb, offset, 32, ENC_ASCII);
866
0
    offset += 32;
867
0
    proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, 8, ENC_NA);
868
0
    offset += 8; /* reserved */
869
870
0
    if (first_contact) {
871
0
      accept_flag_item = proto_tree_add_item(tree, hf_smcr_accept_fce_flags, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
872
0
      accept_flag_tree = proto_item_add_subtree(accept_flag_item, ett_smcr_accept_fce_flag1);
873
0
      proto_tree_add_item(accept_flag_tree, hf_accept_v2_lg_type, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
874
0
      offset += FLAG_BYTE_LEN;
875
0
      accept_flag_item = proto_tree_add_item(tree, hf_smc_accept_fce_flags, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
876
0
      accept_flag_tree = proto_item_add_subtree(accept_flag_item, ett_smc_accept_fce_flag);
877
0
      proto_tree_add_item(accept_flag_tree, hf_accept_os_type, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
878
0
      proto_tree_add_item(accept_flag_tree, hf_accept_smc_version_release_number, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
879
0
      offset += FLAG_BYTE_LEN;
880
0
      proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, TWO_BYTE_RESERVED, ENC_NA);
881
0
      offset += TWO_BYTE_RESERVED; /* reserved */
882
0
      proto_tree_add_item(tree, hf_smc_accept_peer_name, tvb, offset, 32, ENC_ASCII);
883
0
      offset += 32;
884
0
      proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, 16, ENC_NA);
885
      /* offset += 16; */ /* reserved */
886
0
    }
887
0
  }
888
0
}
889
890
static void
891
dissect_smcr_confirm(tvbuff_t *tvb, proto_tree *tree)
892
0
{
893
0
  unsigned offset, qp_num, rmbe_size;
894
0
  proto_item *confirm_flag_item;
895
0
  proto_tree *confirm_flag_tree;
896
0
  proto_item *confirm_flag2_item;
897
0
  proto_tree *confirm_flag2_tree;
898
0
  proto_item *ti;
899
0
  uint8_t smc_version, first_contact = 0;
900
0
  uint8_t gid_list_len;
901
902
0
  offset = CLC_MSG_START_OFFSET;
903
0
  proto_tree_add_item(tree, hf_smc_length, tvb, offset,
904
0
    LENGTH_BYTE_LEN, ENC_BIG_ENDIAN);
905
0
  offset += LENGTH_BYTE_LEN;
906
0
  confirm_flag_item = proto_tree_add_item(tree, hf_smcr_confirm_flags, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
907
0
  confirm_flag_tree = proto_item_add_subtree(confirm_flag_item, ett_confirm_flag);
908
0
  proto_tree_add_item(confirm_flag_tree, hf_confirm_smc_version, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
909
0
  proto_tree_add_item(confirm_flag_tree, hf_smc_confirm_first_contact, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
910
0
  proto_tree_add_item(confirm_flag_tree, hf_confirm_smc_type, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
911
0
  smc_version = tvb_get_uint8(tvb, offset);
912
0
  first_contact = tvb_get_uint8(tvb, offset);
913
0
  smc_version = ((smc_version >> 4) & 0x0F);
914
0
  first_contact = ((first_contact >> 3) & 0x01);
915
0
  offset += FLAG_BYTE_LEN;
916
0
  proto_tree_add_item(tree, hf_smcr_confirm_client_peer_id, tvb, offset,
917
0
      PEERID_LEN, ENC_BIG_ENDIAN);
918
0
  offset += PEERID_LEN;
919
0
  proto_tree_add_item(tree, hf_smcr_confirm_client_gid, tvb,
920
0
      offset, GID_LEN, ENC_NA);
921
0
  offset += GID_LEN;
922
0
  proto_tree_add_item(tree, hf_smcr_confirm_client_mac, tvb,
923
0
      offset, MAC_ADDR_LEN, ENC_NA);
924
0
  offset += MAC_ADDR_LEN;
925
0
  proto_tree_add_item(tree, hf_smcr_confirm_client_qp_number, tvb,
926
0
      offset, QP_LEN, ENC_BIG_ENDIAN);
927
0
  offset += QP_LEN;
928
0
  proto_tree_add_item(tree, hf_smcr_confirm_client_rmb_rkey, tvb,
929
0
      offset, RKEY_LEN, ENC_BIG_ENDIAN);
930
0
  offset += RKEY_LEN;
931
0
  proto_tree_add_item(tree, hf_smcr_confirm_client_tcp_conn_index, tvb,
932
0
      offset, CONN_INDEX_LEN, ENC_BIG_ENDIAN);
933
0
  offset += CONN_INDEX_LEN;
934
0
  proto_tree_add_item(tree, hf_smcr_confirm_client_rmb_element_alert_token, tvb,
935
0
      offset, ALERT_TOKEN_LEN, ENC_BIG_ENDIAN);
936
0
  offset += ALERT_TOKEN_LEN;
937
0
  confirm_flag2_item = proto_tree_add_item(tree, hf_smcr_confirm_flags2, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
938
0
  confirm_flag2_tree = proto_item_add_subtree(confirm_flag2_item, ett_confirm_flag2);
939
0
  ti = proto_tree_add_item(confirm_flag2_tree, hf_confirm_rmb_buffer_size, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
940
0
  rmbe_size = tvb_get_int8(tvb, offset) >> 4;
941
0
  dissect_smc_uncompress_size(ti, rmbe_size, SMCR_MAX_BUFSIZE_NUM);
942
0
  ti = proto_tree_add_item(confirm_flag2_tree, hf_confirm_qp_mtu_value, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
943
0
  qp_num = tvb_get_int8(tvb, offset) & 0x0F;
944
0
  dissect_smcr_translate_qp_mtu(ti, qp_num);
945
0
  offset += FLAG_BYTE_LEN;
946
0
  proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, ONE_BYTE_RESERVED, ENC_NA);
947
0
  offset += ONE_BYTE_RESERVED; /* reserved */
948
0
  proto_tree_add_item(tree, hf_smcr_confirm_client_rmb_virtual_address, tvb,
949
0
      offset, VIRTUAL_ADDR_LEN, ENC_BIG_ENDIAN);
950
0
  offset += VIRTUAL_ADDR_LEN;
951
0
  proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, ONE_BYTE_RESERVED, ENC_NA);
952
0
  offset += ONE_BYTE_RESERVED; /* reserved */
953
0
  proto_tree_add_item(tree, hf_smcr_confirm_initial_psn, tvb,
954
0
      offset, PSN_LEN, ENC_BIG_ENDIAN);
955
956
0
  if (smc_version >= SMC_V2) {
957
0
    offset += PSN_LEN;
958
0
    proto_tree_add_item(tree, hf_smc_confirm_eid, tvb, offset, 32, ENC_ASCII);
959
0
    offset += 32;
960
0
    proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, 8, ENC_NA);
961
0
    offset += 8; /* reserved */
962
963
0
    if (first_contact) {
964
0
      confirm_flag_item = proto_tree_add_item(tree, hf_smcr_accept_fce_flags, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
965
0
      confirm_flag_tree = proto_item_add_subtree(confirm_flag_item, ett_smcr_accept_fce_flag1);
966
0
      proto_tree_add_item(confirm_flag_tree, hf_accept_v2_lg_type, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
967
0
      offset += FLAG_BYTE_LEN;
968
0
      confirm_flag_item = proto_tree_add_item(tree, hf_smc_accept_fce_flags, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
969
0
      confirm_flag_tree = proto_item_add_subtree(confirm_flag_item, ett_smc_confirm_fce_flag);
970
0
      proto_tree_add_item(confirm_flag_tree, hf_confirm_os_type, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
971
0
      proto_tree_add_item(confirm_flag_tree, hf_confirm_smc_version_release_number, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
972
0
      offset += FLAG_BYTE_LEN;
973
0
      proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, TWO_BYTE_RESERVED, ENC_NA);
974
0
      offset += TWO_BYTE_RESERVED; /* reserved */
975
0
      proto_tree_add_item(tree, hf_smc_confirm_peer_name, tvb, offset, 32, ENC_ASCII);
976
0
      offset += 32;
977
0
      proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, 16, ENC_NA);
978
0
      offset += 16; /* reserved */
979
0
      proto_tree_add_item_ret_uint8(tree, hf_smc_confirm_gid_lst_len, tvb, offset, 1, ENC_BIG_ENDIAN, &gid_list_len);
980
0
      offset += 1;
981
0
      proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, 3, ENC_NA);
982
0
      offset += 3; /* reserved */
983
0
      while (gid_list_len > 0) {
984
0
        proto_tree_add_item(tree, hf_smc_confirm_gid_list_entry, tvb, offset, GID_LEN, ENC_NA);
985
0
        offset += GID_LEN;
986
0
        gid_list_len--;
987
0
      }
988
0
    }
989
0
  }
990
0
}
991
992
static void
993
dissect_smc_decline(tvbuff_t *tvb, proto_tree *tree)
994
0
{
995
0
  proto_item* decline_flag_item;
996
0
  proto_tree* decline_flag_tree;
997
0
  proto_item* decline_flag2_item;
998
0
  proto_tree* decline_flag2_tree;
999
0
  unsigned offset, smc_version, smc_length, num_of_diag;
1000
1001
0
  offset = CLC_MSG_START_OFFSET;
1002
0
  proto_tree_add_item(tree, hf_smc_length, tvb, offset,
1003
0
    LENGTH_BYTE_LEN, ENC_BIG_ENDIAN);
1004
0
  smc_length = tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN);
1005
0
  offset += LENGTH_BYTE_LEN;
1006
1007
0
  decline_flag_item = proto_tree_add_item(tree, hf_smc_decline_flags, tvb, offset,
1008
0
    FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1009
0
  decline_flag_tree = proto_item_add_subtree(decline_flag_item, ett_decline_flag);
1010
0
  proto_tree_add_item(decline_flag_tree, hf_decline_smc_version, tvb, offset,
1011
0
    FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1012
0
  proto_tree_add_item(decline_flag_tree, hf_decline_out_of_sync, tvb, offset,
1013
0
      FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1014
0
  smc_version = tvb_get_uint8(tvb, offset);
1015
0
  smc_version = ((smc_version >> 4) & 0x0F);
1016
1017
0
  offset += FLAG_BYTE_LEN;
1018
0
  proto_tree_add_item(tree, hf_smc_decline_peer_id, tvb, offset,
1019
0
      PEERID_LEN, ENC_BIG_ENDIAN);
1020
0
  offset += PEERID_LEN;
1021
0
  proto_tree_add_item(tree, hf_smc_decline_diag_info, tvb, offset,
1022
0
      DIAG_INFO_LEN, ENC_BIG_ENDIAN);
1023
0
  offset += DIAG_INFO_LEN;
1024
0
  if (smc_version >= SMC_V2) {
1025
0
    decline_flag2_item = proto_tree_add_item(tree, hf_smc_decline_flags2, tvb, offset,
1026
0
      FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1027
0
    decline_flag2_tree = proto_item_add_subtree(decline_flag2_item, ett_decline_flag2);
1028
0
    proto_tree_add_item(decline_flag2_tree, hf_decline_os_type, tvb, offset,
1029
0
      FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1030
0
    offset += FLAG_BYTE_LEN;
1031
0
    offset += 3;
1032
0
    if (smc_length >= offset + 16) {
1033
0
      for (num_of_diag = 0; num_of_diag < 4; num_of_diag++) {
1034
0
        proto_tree_add_item(tree, hf_smc_decline_diag_info, tvb, offset,
1035
0
              DIAG_INFO_LEN, ENC_BIG_ENDIAN);
1036
0
        offset += DIAG_INFO_LEN;
1037
0
      }
1038
0
    }
1039
0
  }
1040
0
}
1041
1042
static void
1043
dissect_smcr_confirm_link(tvbuff_t *tvb, proto_tree *tree)
1044
0
{
1045
0
  unsigned offset;
1046
0
  proto_item *confirm_flag_item;
1047
0
  proto_tree *confirm_flag_tree;
1048
1049
0
  offset = LLC_MSG_START_OFFSET;
1050
0
  confirm_flag_item = proto_tree_add_item(tree, hf_smcr_confirm_link_flags, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1051
0
  confirm_flag_tree = proto_item_add_subtree(confirm_flag_item, ett_confirm_link_flag);
1052
0
  proto_tree_add_item(confirm_flag_tree, hf_smcr_confirm_link_response, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1053
1054
0
  offset += FLAG_BYTE_LEN;
1055
0
  proto_tree_add_item(tree, hf_smcr_confirm_link_mac, tvb,
1056
0
      offset, MAC_ADDR_LEN, ENC_NA);
1057
0
  offset += MAC_ADDR_LEN;
1058
0
  proto_tree_add_item(tree, hf_smcr_confirm_link_gid, tvb,
1059
0
      offset, GID_LEN, ENC_NA);
1060
0
  offset += GID_LEN;
1061
0
  proto_tree_add_item(tree, hf_smcr_confirm_link_qp_number, tvb,
1062
0
      offset, QP_LEN, ENC_BIG_ENDIAN);
1063
0
  offset += QP_LEN;
1064
0
  proto_tree_add_item(tree, hf_smcr_confirm_link_number, tvb,
1065
0
      offset, 1, ENC_BIG_ENDIAN);
1066
0
  offset += 1;
1067
0
  proto_tree_add_item(tree, hf_smcr_confirm_link_userid, tvb,
1068
0
      offset, 4, ENC_BIG_ENDIAN);
1069
0
  offset += 4;
1070
0
  proto_tree_add_item(tree, hf_smcr_confirm_link_max_links, tvb,
1071
0
      offset, 1, ENC_BIG_ENDIAN);
1072
0
}
1073
1074
static void
1075
dissect_smcr_add_link(tvbuff_t *tvb, proto_tree *tree, bool is_smc_v2)
1076
0
{
1077
0
  unsigned offset, rkey_count, qp_num;
1078
0
  proto_item *add_link_flag_item;
1079
0
  proto_tree *add_link_flag_tree;
1080
0
  proto_item *add_link_flag2_item;
1081
0
  proto_tree *add_link_flag2_tree;
1082
0
  proto_item *add_link_flag3_item;
1083
0
  proto_tree *add_link_flag3_tree;
1084
0
  proto_item *ti;
1085
0
  bool is_response = tvb_get_uint8(tvb, LLC_CMD_RSP_OFFSET) & LLC_FLAG_RESP;
1086
1087
0
  offset = LLC_MSG_START_OFFSET;
1088
0
  add_link_flag_item = proto_tree_add_item(tree, hf_smcr_add_link_flags, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1089
0
  add_link_flag_tree = proto_item_add_subtree(add_link_flag_item, ett_add_link_flag);
1090
0
  proto_tree_add_item(add_link_flag_tree, hf_smcr_add_link_response, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1091
0
  proto_tree_add_item(add_link_flag_tree, hf_smcr_add_link_response_rejected, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1092
0
  if (is_smc_v2 && is_response) {
1093
0
    proto_tree_add_item(add_link_flag_tree, hf_smcr_add_link_reject_reason, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1094
0
  }
1095
0
  offset += FLAG_BYTE_LEN;
1096
0
  proto_tree_add_item(tree, hf_smcr_add_link_mac, tvb,
1097
0
      offset, MAC_ADDR_LEN, ENC_NA);
1098
0
  offset += MAC_ADDR_LEN;
1099
0
  proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, TWO_BYTE_RESERVED, ENC_NA);
1100
0
  offset += TWO_BYTE_RESERVED; /* reserved */
1101
0
  proto_tree_add_item(tree, hf_smcr_add_link_gid, tvb,
1102
0
      offset, GID_LEN, ENC_NA);
1103
0
  offset += GID_LEN;
1104
0
  proto_tree_add_item(tree, hf_smcr_add_link_qp_number, tvb,
1105
0
      offset, QP_LEN, ENC_BIG_ENDIAN);
1106
0
  offset += QP_LEN;
1107
0
  proto_tree_add_item(tree, hf_smcr_add_link_number, tvb,
1108
0
      offset, 1, ENC_BIG_ENDIAN);
1109
0
  offset += 1;
1110
0
  add_link_flag2_item = proto_tree_add_item(tree, hf_smcr_add_link_flags2, tvb, offset, 1, ENC_BIG_ENDIAN);
1111
0
  add_link_flag2_tree = proto_item_add_subtree(add_link_flag2_item, ett_add_link_flag2);
1112
0
  ti = proto_tree_add_item(add_link_flag2_tree, hf_smcr_add_link_qp_mtu_value, tvb, offset, 1, ENC_BIG_ENDIAN);
1113
0
  qp_num = tvb_get_int8(tvb, offset) & 0x0F;
1114
0
  dissect_smcr_translate_qp_mtu(ti, qp_num);
1115
0
  offset += 1;
1116
0
  proto_tree_add_item(tree, hf_smcr_add_link_initial_psn, tvb,
1117
0
      offset, PSN_LEN, ENC_BIG_ENDIAN);
1118
0
  offset += PSN_LEN;
1119
0
  if (!is_smc_v2 || is_response)
1120
0
    return;
1121
1122
0
  proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, 8, ENC_NA);
1123
0
  offset += 8; /* reserved */
1124
0
  add_link_flag3_item = proto_tree_add_item(tree, hf_smcr_add_link_flags3, tvb, offset, 1, ENC_BIG_ENDIAN);
1125
0
  add_link_flag3_tree = proto_item_add_subtree(add_link_flag3_item, ett_add_link_flag3);
1126
0
  proto_tree_add_item(add_link_flag3_tree, hf_smcr_add_link_flag3_direct_link, tvb, offset, 1, ENC_BIG_ENDIAN);
1127
0
  offset += 1;
1128
0
  proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, 1, ENC_NA);
1129
0
  offset += 1; /* reserved */
1130
0
  proto_tree_add_item(tree, hf_smcr_add_link_client_target_gid, tvb, offset, GID_LEN, ENC_NA);
1131
0
  offset += GID_LEN;
1132
0
  proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, 8, ENC_NA);
1133
0
  offset += 8; /* reserved */
1134
0
  proto_tree_add_item_ret_uint(tree, hf_smcr_add_link_rkey_count, tvb, offset, 2, ENC_BIG_ENDIAN, &rkey_count);
1135
0
  offset += 2;
1136
0
  while (rkey_count > 0) {
1137
0
    proto_tree_add_item(tree, hf_smcr_add_link_rkey, tvb, offset, RKEY_LEN, ENC_BIG_ENDIAN);
1138
0
    offset += RKEY_LEN;
1139
0
    proto_tree_add_item(tree, hf_smcr_add_link_rkey2, tvb, offset, RKEY_LEN, ENC_BIG_ENDIAN);
1140
0
    offset += RKEY_LEN;
1141
0
    proto_tree_add_item(tree, hf_smcr_add_link_virt_addr, tvb, offset, VIRTUAL_ADDR_LEN, ENC_BIG_ENDIAN);
1142
0
    offset += VIRTUAL_ADDR_LEN;
1143
0
    rkey_count--;
1144
0
  }
1145
0
}
1146
1147
static void
1148
dissect_smcr_add_continuation(tvbuff_t *tvb, proto_tree *tree)
1149
0
{
1150
0
  unsigned offset;
1151
0
  uint8_t num_of_keys;
1152
0
  proto_item *add_link_flag_item;
1153
0
  proto_tree *add_link_flag_tree;
1154
1155
0
  offset = LLC_MSG_START_OFFSET;
1156
0
  add_link_flag_item = proto_tree_add_item(tree, hf_smcr_add_link_cont_flags, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1157
0
  add_link_flag_tree = proto_item_add_subtree(add_link_flag_item, ett_add_link_cont_flag);
1158
0
  proto_tree_add_item(add_link_flag_tree, hf_smcr_add_link_cont_response, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1159
0
  offset += FLAG_BYTE_LEN;
1160
0
  proto_tree_add_item(tree, hf_smcr_add_link_cont_link_number, tvb,
1161
0
      offset, 1, ENC_BIG_ENDIAN);
1162
0
  offset += 1;
1163
0
  proto_tree_add_item(tree, hf_smcr_add_link_cont_number_of_rkeys, tvb,
1164
0
      offset, 1, ENC_BIG_ENDIAN);
1165
0
  num_of_keys = tvb_get_uint8(tvb,offset);
1166
0
  offset += 1;
1167
1168
0
  if (num_of_keys >= 1) {
1169
0
    proto_tree_add_item(tree, hf_smcr_add_link_cont_p1_rkey, tvb,
1170
0
        offset, RKEY_LEN, ENC_BIG_ENDIAN);
1171
0
    offset += RKEY_LEN;
1172
0
    proto_tree_add_item(tree, hf_smcr_add_link_cont_p1_rkey2, tvb,
1173
0
      offset, RKEY_LEN, ENC_BIG_ENDIAN);
1174
0
    offset += RKEY_LEN;
1175
0
    proto_tree_add_item(tree, hf_smcr_add_link_cont_p1_virt_addr, tvb,
1176
0
        offset, VIRTUAL_ADDR_LEN, ENC_BIG_ENDIAN);
1177
1178
0
    if (num_of_keys >= 2) {
1179
0
      offset += VIRTUAL_ADDR_LEN;
1180
0
      proto_tree_add_item(tree, hf_smcr_add_link_cont_p2_rkey, tvb,
1181
0
          offset, RKEY_LEN, ENC_BIG_ENDIAN);
1182
0
      offset += RKEY_LEN;
1183
0
      proto_tree_add_item(tree, hf_smcr_add_link_cont_p2_rkey2, tvb,
1184
0
          offset, RKEY_LEN, ENC_BIG_ENDIAN);
1185
0
      offset += RKEY_LEN;
1186
0
      proto_tree_add_item(tree, hf_smcr_add_link_cont_p2_virt_addr, tvb,
1187
0
          offset, VIRTUAL_ADDR_LEN, ENC_BIG_ENDIAN);
1188
0
    }
1189
0
  }
1190
0
}
1191
1192
static void
1193
dissect_smcr_request_add_link(tvbuff_t* tvb, proto_tree* tree)
1194
0
{
1195
0
  bool is_response = tvb_get_uint8(tvb, LLC_CMD_RSP_OFFSET) & LLC_FLAG_RESP;
1196
0
  proto_item* add_link_flag_item;
1197
0
  proto_tree* add_link_flag_tree;
1198
0
  unsigned offset, gid_list_len;
1199
1200
0
  offset = LLC_MSG_START_OFFSET;
1201
0
  add_link_flag_item = proto_tree_add_item(tree, hf_smcr_request_add_link_flags, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1202
0
  add_link_flag_tree = proto_item_add_subtree(add_link_flag_item, ett_request_add_link_flag);
1203
0
  proto_tree_add_item(add_link_flag_tree, hf_smcr_request_add_link_response, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1204
0
  proto_tree_add_item(add_link_flag_tree, hf_smcr_request_add_link_response_rejected, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1205
0
  if (is_response) {
1206
0
    proto_tree_add_item(add_link_flag_tree, hf_smcr_request_add_link_reject_reason, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1207
0
  }
1208
0
  offset += FLAG_BYTE_LEN;
1209
0
  proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, 20, ENC_NA);
1210
0
  offset += 20; /* reserved */
1211
0
  proto_tree_add_item_ret_uint(tree, hf_smc_request_add_link_gid_lst_len, tvb, offset, 1, ENC_BIG_ENDIAN, &gid_list_len);
1212
0
  offset += 1;
1213
0
  proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, 3, ENC_NA);
1214
0
  offset += 3; /* reserved */
1215
0
  while (gid_list_len > 0) {
1216
0
    proto_tree_add_item(tree, hf_smc_request_add_link_gid_list_entry, tvb, offset, GID_LEN, ENC_NA);
1217
0
    offset += GID_LEN;
1218
0
    gid_list_len--;
1219
0
  }
1220
0
}
1221
1222
static void
1223
dissect_smcr_delete_link(tvbuff_t *tvb, proto_tree *tree)
1224
0
{
1225
0
  unsigned offset;
1226
0
  proto_item *delete_link_flag_item;
1227
0
  proto_tree *delete_link_flag_tree;
1228
1229
0
  offset = LLC_MSG_START_OFFSET;
1230
0
  delete_link_flag_item = proto_tree_add_item(tree, hf_smcr_delete_link_flags, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1231
0
  delete_link_flag_tree = proto_item_add_subtree(delete_link_flag_item, ett_delete_link_flag);
1232
0
  proto_tree_add_item(delete_link_flag_tree, hf_smcr_delete_link_response, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1233
0
  proto_tree_add_item(delete_link_flag_tree, hf_smcr_delete_link_all, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1234
0
  proto_tree_add_item(delete_link_flag_tree, hf_smcr_delete_link_orderly, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1235
0
  offset += FLAG_BYTE_LEN;
1236
0
  proto_tree_add_item(tree, hf_smcr_delete_link_number, tvb,
1237
0
      offset, 1, ENC_BIG_ENDIAN);
1238
0
  offset += 1;
1239
0
  proto_tree_add_item(tree, hf_smcr_delete_link_reason_code, tvb,
1240
0
      offset, 4, ENC_BIG_ENDIAN);
1241
0
}
1242
1243
static void
1244
dissect_smcr_confirm_rkey(tvbuff_t *tvb, proto_tree *tree)
1245
0
{
1246
0
  unsigned offset;
1247
0
  uint8_t num_entries;
1248
0
  proto_item *confirm_rkey_flag_item;
1249
0
  proto_tree *confirm_rkey_flag_tree;
1250
1251
0
  offset = LLC_MSG_START_OFFSET;
1252
0
  confirm_rkey_flag_item = proto_tree_add_item(tree, hf_smcr_confirm_rkey_flags, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1253
0
  confirm_rkey_flag_tree = proto_item_add_subtree(confirm_rkey_flag_item, ett_confirm_rkey_flag);
1254
0
  proto_tree_add_item(confirm_rkey_flag_tree, hf_smcr_confirm_rkey_response, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1255
0
  proto_tree_add_item(confirm_rkey_flag_tree, hf_smcr_confirm_rkey_negative_response,
1256
0
      tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1257
0
  proto_tree_add_item(confirm_rkey_flag_tree, hf_smcr_confirm_rkey_retry_rkey_set,
1258
0
      tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1259
0
  offset += FLAG_BYTE_LEN;
1260
0
  proto_tree_add_item(tree, hf_smcr_confirm_rkey_number, tvb,
1261
0
      offset, 1, ENC_BIG_ENDIAN);
1262
0
  num_entries = tvb_get_uint8(tvb,offset);
1263
1264
0
  if (num_entries > 2)
1265
0
    num_entries = 2;
1266
1267
0
  offset += 1;
1268
0
  proto_tree_add_item(tree, hf_smcr_confirm_rkey_new_rkey, tvb,
1269
0
      offset, RKEY_LEN, ENC_BIG_ENDIAN);
1270
0
  offset += RKEY_LEN;
1271
0
  proto_tree_add_item(tree, hf_smcr_confirm_rkey_virtual_address, tvb,
1272
0
      offset, VIRTUAL_ADDR_LEN, ENC_BIG_ENDIAN);
1273
1274
0
  for (; num_entries > 0; num_entries--) {
1275
0
    offset += VIRTUAL_ADDR_LEN;
1276
0
    proto_tree_add_item(tree, hf_smcr_confirm_rkey_link_number, tvb,
1277
0
      offset, 1, ENC_BIG_ENDIAN);
1278
0
    offset += 1;
1279
0
    proto_tree_add_item(tree, hf_smcr_confirm_rkey_new_rkey, tvb,
1280
0
      offset, RKEY_LEN, ENC_BIG_ENDIAN);
1281
0
    offset += RKEY_LEN;
1282
0
    proto_tree_add_item(tree, hf_smcr_confirm_rkey_virtual_address, tvb,
1283
0
      offset, VIRTUAL_ADDR_LEN, ENC_BIG_ENDIAN);
1284
0
  }
1285
0
}
1286
1287
static void
1288
dissect_smcr_confirm_rkey_cont(tvbuff_t *tvb, proto_tree *tree)
1289
0
{
1290
0
  unsigned offset;
1291
0
  proto_item *confirm_rkey_flag_item;
1292
0
  proto_tree *confirm_rkey_flag_tree;
1293
0
  uint8_t num_entries;
1294
1295
0
  offset = LLC_MSG_START_OFFSET;
1296
0
  confirm_rkey_flag_item = proto_tree_add_item(tree, hf_smcr_confirm_rkey_flags, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1297
0
  confirm_rkey_flag_tree = proto_item_add_subtree(confirm_rkey_flag_item, ett_confirm_rkey_flag);
1298
0
  proto_tree_add_item(confirm_rkey_flag_tree, hf_smcr_confirm_rkey_response, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1299
0
  proto_tree_add_item(confirm_rkey_flag_tree, hf_smcr_confirm_rkey_negative_response,
1300
0
      tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1301
0
  proto_tree_add_item(confirm_rkey_flag_tree, hf_smcr_confirm_rkey_retry_rkey_set,
1302
0
      tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1303
0
  offset += FLAG_BYTE_LEN;
1304
0
  proto_tree_add_item(tree, hf_smcr_confirm_rkey_number, tvb,
1305
0
      offset, 1, ENC_BIG_ENDIAN);
1306
0
  num_entries = tvb_get_uint8(tvb,offset);
1307
0
  if (num_entries > 3)
1308
0
      num_entries = 3;
1309
1310
0
  offset += 1;
1311
0
  for (; num_entries > 0; num_entries--) {
1312
0
    proto_tree_add_item(tree, hf_smcr_confirm_rkey_link_number, tvb,
1313
0
      offset, 1, ENC_BIG_ENDIAN);
1314
0
    offset += 1;
1315
0
    proto_tree_add_item(tree, hf_smcr_confirm_rkey_new_rkey, tvb,
1316
0
      offset, RKEY_LEN, ENC_BIG_ENDIAN);
1317
0
    offset += RKEY_LEN;
1318
0
    proto_tree_add_item(tree, hf_smcr_confirm_rkey_virtual_address, tvb,
1319
0
      offset, VIRTUAL_ADDR_LEN, ENC_BIG_ENDIAN);
1320
0
    offset += VIRTUAL_ADDR_LEN;
1321
0
  }
1322
0
}
1323
1324
static void
1325
dissect_smcr_delete_rkey(tvbuff_t *tvb, proto_tree *tree, bool is_smc_v2)
1326
0
{
1327
0
  unsigned offset;
1328
0
  uint8_t count;
1329
0
  proto_item *delete_rkey_flag_item;
1330
0
  proto_tree *delete_rkey_flag_tree;
1331
1332
0
  offset = LLC_MSG_START_OFFSET;
1333
0
  delete_rkey_flag_item = proto_tree_add_item(tree, hf_smcr_delete_rkey_flags, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1334
0
  delete_rkey_flag_tree = proto_item_add_subtree(delete_rkey_flag_item, ett_delete_rkey_flag);
1335
0
  proto_tree_add_item(delete_rkey_flag_tree, hf_smcr_delete_rkey_response, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1336
0
  proto_tree_add_item(delete_rkey_flag_tree, hf_smcr_delete_rkey_negative_response,
1337
0
        tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1338
0
  offset += FLAG_BYTE_LEN;
1339
0
  proto_tree_add_item_ret_uint8(tree, hf_smcr_delete_rkey_count, tvb, offset, 1, ENC_NA, &count);
1340
0
  offset += 1;
1341
0
  if (!is_smc_v2) {
1342
0
    proto_tree_add_item(tree, hf_smcr_delete_rkey_mask, tvb, offset, 1, ENC_BIG_ENDIAN);
1343
0
  } else {
1344
0
    bool is_response = tvb_get_uint8(tvb, LLC_CMD_RSP_OFFSET) & LLC_FLAG_RESP;
1345
0
    if (is_response) {
1346
0
      proto_tree_add_item_ret_uint8(tree, hf_smcr_delete_rkey_invalid_count, tvb, offset, 1, ENC_NA, &count);
1347
0
      if (count > 8)
1348
0
        count = 8; /* show a maximum of 8 invalid rkeys in response */
1349
0
    }
1350
0
  }
1351
0
  offset += 1;
1352
0
  proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, 2, ENC_NA);
1353
0
  offset += 2; /* reserved */
1354
0
  while (count > 0) {
1355
0
    proto_tree_add_item(tree, hf_smcr_delete_rkey_deleted, tvb,
1356
0
        offset, RKEY_LEN, ENC_BIG_ENDIAN);
1357
0
    offset += RKEY_LEN;
1358
0
    count--;
1359
0
  }
1360
0
}
1361
1362
static void
1363
dissect_smcr_test_link(tvbuff_t *tvb, proto_tree *tree)
1364
0
{
1365
0
  unsigned offset;
1366
0
  proto_item *test_link_flag_item;
1367
0
  proto_tree *test_link_flag_tree;
1368
1369
0
  offset = LLC_MSG_START_OFFSET;
1370
0
  test_link_flag_item = proto_tree_add_item(tree, hf_smcr_test_link_flags, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1371
0
  test_link_flag_tree = proto_item_add_subtree(test_link_flag_item, ett_test_link_flag);
1372
0
  proto_tree_add_item(test_link_flag_tree, hf_smcr_test_link_response, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1373
0
}
1374
1375
static void
1376
dissect_smcr_rmbe_ctrl(tvbuff_t *tvb, proto_tree *tree)
1377
0
{
1378
0
  int offset;
1379
0
  proto_item *rmbe_ctrl_rw_status_flag_item;
1380
0
  proto_tree *rmbe_ctrl_rw_status_flag_tree;
1381
0
  proto_item *rmbe_ctrl_peer_conn_state_flag_item;
1382
0
  proto_tree *rmbe_ctrl_peer_conn_state_flag_tree;
1383
1384
0
  offset = RMBE_CTRL_START_OFFSET;
1385
0
  proto_tree_add_item(tree, hf_smcr_rmbe_ctrl_seqno, tvb, offset, SEQNO_LEN, ENC_BIG_ENDIAN);
1386
0
  offset += SEQNO_LEN;
1387
0
  proto_tree_add_item(tree, hf_smcr_rmbe_ctrl_alert_token, tvb, offset, ALERT_TOKEN_LEN, ENC_BIG_ENDIAN);
1388
0
  offset += ALERT_TOKEN_LEN;
1389
0
  proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, TWO_BYTE_RESERVED, ENC_NA);
1390
0
  offset += TWO_BYTE_RESERVED; /* reserved */
1391
0
  proto_tree_add_item(tree, hf_smcr_rmbe_ctrl_prod_wrap_seqno, tvb, offset, SEQNO_LEN, ENC_BIG_ENDIAN);
1392
0
  offset += SEQNO_LEN;
1393
0
  proto_tree_add_item(tree, hf_smcr_rmbe_ctrl_peer_prod_curs, tvb, offset, CURSOR_LEN, ENC_BIG_ENDIAN);
1394
0
  offset += CURSOR_LEN;
1395
0
  proto_tree_add_item(tree, hf_smc_reserved, tvb, offset, TWO_BYTE_RESERVED, ENC_NA);
1396
0
  offset += TWO_BYTE_RESERVED; /* reserved */
1397
0
  proto_tree_add_item(tree, hf_smcr_rmbe_ctrl_cons_wrap_seqno, tvb, offset, SEQNO_LEN, ENC_BIG_ENDIAN);
1398
0
  offset += SEQNO_LEN;
1399
0
  proto_tree_add_item(tree, hf_smcr_rmbe_ctrl_peer_cons_curs, tvb, offset, CURSOR_LEN, ENC_BIG_ENDIAN);
1400
0
  offset += CURSOR_LEN;
1401
0
  rmbe_ctrl_rw_status_flag_item =
1402
0
    proto_tree_add_item(tree, hf_smcr_rmbe_ctrl_conn_rw_status_flags, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1403
0
  rmbe_ctrl_rw_status_flag_tree =
1404
0
    proto_item_add_subtree(rmbe_ctrl_rw_status_flag_item, ett_rmbe_ctrl_rw_status_flag);
1405
0
  proto_tree_add_item(rmbe_ctrl_rw_status_flag_tree, hf_smcr_rmbe_ctrl_write_blocked,
1406
0
      tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1407
0
  proto_tree_add_item(rmbe_ctrl_rw_status_flag_tree, hf_smcr_rmbe_ctrl_urgent_pending,
1408
0
      tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1409
0
  proto_tree_add_item(rmbe_ctrl_rw_status_flag_tree, hf_smcr_rmbe_ctrl_urgent_present,
1410
0
      tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1411
0
  proto_tree_add_item(rmbe_ctrl_rw_status_flag_tree, hf_smcr_rmbe_ctrl_cons_update_requested,
1412
0
      tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1413
0
  proto_tree_add_item(rmbe_ctrl_rw_status_flag_tree, hf_smcr_rmbe_ctrl_failover_validation,
1414
0
      tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1415
0
  offset += FLAG_BYTE_LEN;
1416
0
  rmbe_ctrl_peer_conn_state_flag_item =
1417
0
    proto_tree_add_item(tree, hf_smcr_rmbe_ctrl_peer_conn_state_flags, tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1418
0
  rmbe_ctrl_peer_conn_state_flag_tree =
1419
0
    proto_item_add_subtree(rmbe_ctrl_peer_conn_state_flag_item, ett_rmbe_ctrl_peer_conn_state_flag);
1420
0
  proto_tree_add_item(rmbe_ctrl_peer_conn_state_flag_tree, hf_smcr_rmbe_ctrl_peer_sending_done,
1421
0
        tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1422
0
  proto_tree_add_item(rmbe_ctrl_peer_conn_state_flag_tree, hf_smcr_rmbe_ctrl_peer_closed_conn,
1423
0
      tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1424
0
  proto_tree_add_item(rmbe_ctrl_peer_conn_state_flag_tree, hf_smcr_rmbe_ctrl_peer_abnormal_close,
1425
0
      tvb, offset, FLAG_BYTE_LEN, ENC_BIG_ENDIAN);
1426
0
}
1427
1428
static uint8_t get_mixed_type(uint8_t v1_type, uint8_t v2_type)
1429
0
{
1430
0
  if (v1_type == SMC_CLC_BOTH)
1431
0
    return v1_type;
1432
1433
0
  if (v1_type == SMC_CLC_NONE)
1434
0
    return v2_type;
1435
1436
0
  if (((v2_type == SMC_CLC_SMCD) && (v1_type == SMC_CLC_SMCR)) ||
1437
0
      ((v2_type == SMC_CLC_SMCR) && (v1_type == SMC_CLC_SMCD)))
1438
0
    return SMC_CLC_BOTH;
1439
1440
0
  return v2_type;
1441
0
}
1442
1443
static int
1444
dissect_smc_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1445
    void *data _U_)
1446
0
{
1447
0
  int offset;
1448
0
  uint16_t msg_len;
1449
0
  uint8_t smc_type, smc_v2_type = 0, smc_v1_type = 0, smc_version = 0;
1450
0
  uint8_t mixed_type;
1451
0
  clc_message clc_msgid;
1452
0
  proto_item *ti;
1453
0
  proto_tree *smc_tree;
1454
0
  bool is_ipv6, is_smc_v2, is_smcd = false;
1455
1456
0
  msg_len = tvb_get_ntohs(tvb, CLC_MSG_LEN_OFFSET);
1457
0
  offset = 4;
1458
0
  clc_msgid = (clc_message)tvb_get_uint8(tvb, offset);
1459
1460
0
  smc_version = tvb_get_uint8(tvb, offset + 3);
1461
0
  smc_version = ((smc_version >> 4) & 0x0F);
1462
0
  smc_type = tvb_get_uint8(tvb, offset + 3);
1463
0
  is_smc_v2 = (smc_version >= SMC_V2);
1464
1465
0
  if (is_smc_v2 && (clc_msgid == SMC_CLC_PROPOSAL)) {
1466
0
    smc_v1_type = (smc_type & 0x03);
1467
0
    smc_v2_type = ((smc_type >> 2) & 0x03);
1468
0
  }
1469
0
  else if (clc_msgid != SMC_CLC_DECLINE) {
1470
0
    smc_v2_type = (smc_type & 0x03);
1471
0
    smc_v1_type = (smc_type & 0x03);
1472
0
  }
1473
1474
0
  is_ipv6 = (pinfo->src.type == AT_IPv6);
1475
1476
0
  if (is_smc_v2)
1477
0
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMCv2");
1478
0
  else
1479
0
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMC");
1480
1481
0
  if (clc_msgid == SMC_CLC_PROPOSAL) {
1482
0
    if (is_smc_v2 && (smc_v2_type != SMC_CLC_NONE)) {
1483
0
      mixed_type = get_mixed_type(smc_v1_type, smc_v2_type);
1484
0
      col_prepend_fstr(pinfo->cinfo, COL_INFO, "%s,",
1485
0
          val_to_str_const((uint32_t)mixed_type,
1486
0
          smcv2_clc_col_info_message_txt, "Unknown Command"));
1487
0
    } else {
1488
0
      col_prepend_fstr(pinfo->cinfo, COL_INFO, "%s,",
1489
0
          val_to_str_const((uint32_t)smc_v1_type,
1490
0
          smc_clc_col_info_message_txt, "Unknown Command"));
1491
0
    }
1492
0
  } else if ((smc_v2_type == SMC_CLC_SMCR) && ((clc_msgid == SMC_CLC_ACCEPT) ||
1493
0
       (clc_msgid == SMC_CLC_CONFIRMATION))) {
1494
0
    if (is_smc_v2)
1495
0
      col_prepend_fstr(pinfo->cinfo, COL_INFO, "[SMC-Rv2-%s],",
1496
0
          val_to_str_const((uint32_t)clc_msgid,
1497
0
              smcr_clc_message_txt, "Unknown Command"));
1498
0
    else
1499
0
      col_prepend_fstr(pinfo->cinfo, COL_INFO, "[SMC-R-%s],",
1500
0
          val_to_str_const((uint32_t)clc_msgid,
1501
0
          smcr_clc_message_txt, "Unknown Command"));
1502
1503
0
    col_append_fstr(pinfo->cinfo, COL_INFO, " QP=0x%06x",
1504
0
        tvb_get_ntoh24(tvb, ACCEPT_CONFIRM_QP_OFFSET));
1505
0
  }
1506
0
  else if ((smc_v2_type == SMC_CLC_SMCD) && ((clc_msgid == SMC_CLC_ACCEPT) ||
1507
0
    (clc_msgid == SMC_CLC_CONFIRMATION))) {
1508
0
    is_smcd = true;
1509
0
    if (is_smc_v2)
1510
0
      col_prepend_fstr(pinfo->cinfo, COL_INFO, "[SMC-Dv2-%s],",
1511
0
          val_to_str_const((uint32_t)clc_msgid,
1512
0
          smcr_clc_message_txt, "Unknown Command"));
1513
0
    else
1514
0
      col_prepend_fstr(pinfo->cinfo, COL_INFO, "[SMC-D-%s],",
1515
0
          val_to_str_const((uint32_t)clc_msgid,
1516
0
          smcr_clc_message_txt, "Unknown Command"));
1517
0
  }
1518
0
  else {
1519
0
    if (is_smc_v2)
1520
0
      col_prepend_fstr(pinfo->cinfo, COL_INFO, "[SMCv2-%s],",
1521
0
          val_to_str_const((uint32_t)clc_msgid,
1522
0
          smcr_clc_message_txt, "Unknown Command"));
1523
0
    else
1524
0
      col_prepend_fstr(pinfo->cinfo, COL_INFO, "[SMC-%s],",
1525
0
          val_to_str_const((uint32_t)clc_msgid,
1526
0
          smcr_clc_message_txt, "Unknown Command"));
1527
0
  }
1528
1529
0
  if (!tree)
1530
0
    return tvb_reported_length(tvb);
1531
1532
0
  ti = proto_tree_add_item(tree, proto_smc, tvb, 0, msg_len, ENC_NA);
1533
0
  smc_tree = proto_item_add_subtree(ti, ett_smcr);
1534
0
  proto_tree_add_item(smc_tree, hf_smcr_clc_msg, tvb, offset, 1,
1535
0
      ENC_BIG_ENDIAN);
1536
0
  switch (clc_msgid) {
1537
0
    case SMC_CLC_PROPOSAL:
1538
0
      dissect_smc_proposal(tvb, smc_tree, is_ipv6);
1539
0
      break;
1540
0
    case SMC_CLC_ACCEPT:
1541
0
      if (is_smcd)
1542
0
        dissect_smcd_accept(tvb, smc_tree);
1543
0
      else
1544
0
        dissect_smcr_accept(tvb, smc_tree);
1545
0
      break;
1546
0
    case SMC_CLC_CONFIRMATION:
1547
0
      if (is_smcd)
1548
0
        dissect_smcd_confirm(tvb, smc_tree);
1549
0
      else
1550
0
        dissect_smcr_confirm(tvb, smc_tree);
1551
0
      break;
1552
0
    case SMC_CLC_DECLINE:
1553
0
      dissect_smc_decline(tvb, smc_tree);
1554
0
      break;
1555
0
    default:
1556
      /* Unknown Command */
1557
0
      break;
1558
0
  }
1559
0
  return tvb_reported_length(tvb);
1560
0
}
1561
1562
static int
1563
dissect_smcr_infiniband(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1564
0
{
1565
0
  uint16_t msg_len;
1566
0
  llc_message llc_msgid;
1567
0
  proto_item *ti;
1568
0
  proto_tree *smcr_tree;
1569
0
  int smc_version;
1570
0
  bool is_smc_v2;
1571
1572
0
  llc_msgid = (llc_message) tvb_get_uint8(tvb, LLC_CMD_OFFSET);
1573
0
  smc_version = ((llc_msgid >> 4) & 0x0F);
1574
0
  is_smc_v2 = (smc_version == SMC_V2);
1575
1576
0
  if (!is_smc_v2) {
1577
0
    msg_len = tvb_get_uint8(tvb, LLC_LEN_OFFSET);
1578
0
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMC-R");
1579
0
    col_append_str(pinfo->cinfo, COL_INFO, "[SMC-R] ");
1580
0
  } else {
1581
0
    msg_len = tvb_get_uint16(tvb, LLC_LEN_OFFSET, ENC_BIG_ENDIAN);
1582
0
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMC-Rv2");
1583
0
    col_append_str(pinfo->cinfo, COL_INFO, "[SMC-Rv2] ");
1584
0
  }
1585
0
  col_append_str(pinfo->cinfo, COL_INFO,
1586
0
      val_to_str_const((uint32_t)llc_msgid,
1587
0
      smcr_llc_message_txt, "Unknown Command"));
1588
1589
0
  if ((llc_msgid != RMBE_CTRL) &&
1590
0
    (tvb_get_uint8(tvb, LLC_CMD_RSP_OFFSET) & LLC_FLAG_RESP))
1591
0
      col_append_str(pinfo->cinfo, COL_INFO, "(Resp)");
1592
1593
0
  ti = proto_tree_add_item(tree, proto_smc, tvb, 0, msg_len, ENC_NA);
1594
0
  smcr_tree = proto_item_add_subtree(ti, ett_smcr);
1595
0
  ti = proto_tree_add_item(smcr_tree, hf_smcr_llc_msg, tvb, 0, 1, ENC_BIG_ENDIAN);
1596
0
  if ((llc_msgid != RMBE_CTRL) &&
1597
0
    (tvb_get_uint8(tvb, LLC_CMD_RSP_OFFSET) & LLC_FLAG_RESP))
1598
0
      proto_item_append_text(ti, " (Resp)");
1599
1600
0
  proto_tree_add_item(smcr_tree, hf_smc_length, tvb, LLC_LEN_OFFSET, (!is_smc_v2?1:2), ENC_BIG_ENDIAN);
1601
1602
0
  switch (llc_msgid) {
1603
0
    case LLC_CONFIRM_LINK:
1604
0
    case LLC_CONFIRM_LINK_V2:
1605
0
      dissect_smcr_confirm_link(tvb, smcr_tree);
1606
0
      break;
1607
1608
0
    case LLC_ADD_LINK:
1609
0
    case LLC_ADD_LINK_V2:
1610
0
      dissect_smcr_add_link(tvb, smcr_tree, is_smc_v2);
1611
0
      break;
1612
1613
0
    case LLC_ADD_LINK_CONT:
1614
0
      dissect_smcr_add_continuation(tvb, smcr_tree);
1615
0
      break;
1616
1617
0
    case LLC_DEL_LINK:
1618
0
    case LLC_DEL_LINK_V2:
1619
0
      dissect_smcr_delete_link(tvb, smcr_tree);
1620
0
      break;
1621
1622
0
    case LLC_CONFIRM_RKEY:
1623
0
    case LLC_CONFIRM_RKEY_V2:
1624
0
      dissect_smcr_confirm_rkey(tvb, smcr_tree);
1625
0
      break;
1626
1627
0
    case LLC_CONFIRM_RKEY_CONT:
1628
0
      dissect_smcr_confirm_rkey_cont(tvb, smcr_tree);
1629
0
      break;
1630
1631
0
    case LLC_DELETE_RKEY:
1632
0
    case LLC_DELETE_RKEY_V2:
1633
0
      dissect_smcr_delete_rkey(tvb, smcr_tree, is_smc_v2);
1634
0
      break;
1635
1636
0
    case LLC_TEST_LINK:
1637
0
    case LLC_TEST_LINK_V2:
1638
0
      dissect_smcr_test_link(tvb, smcr_tree);
1639
0
      break;
1640
1641
0
    case LLC_REQUEST_ADD_LINK_V2:
1642
0
      dissect_smcr_request_add_link(tvb, smcr_tree);
1643
0
      break;
1644
1645
0
    case RMBE_CTRL:
1646
0
      dissect_smcr_rmbe_ctrl(tvb, smcr_tree);
1647
0
      break;
1648
1649
0
    default:
1650
      /* Unknown Command */
1651
0
      break;
1652
0
  }
1653
1654
0
  return tvb_captured_length(tvb);
1655
0
}
1656
1657
static unsigned
1658
get_smcr_pdu_length(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
1659
0
{
1660
0
  uint32_t length;
1661
0
  length = tvb_get_ntohs(tvb, offset+CLC_MSG_LEN_OFFSET);
1662
0
  return length;
1663
0
}
1664
1665
static int
1666
dissect_smc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1667
  void *data)
1668
0
{
1669
0
  tcp_dissect_pdus(tvb, pinfo, tree, true, SMC_TCP_MIN_HEADER_LENGTH,
1670
0
       get_smcr_pdu_length, dissect_smc_tcp_pdu, data);
1671
0
  return tvb_reported_length(tvb);
1672
0
}
1673
1674
static bool
1675
dissect_smc_tcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1676
  void *data)
1677
2.05k
{
1678
2.05k
  if (tvb_captured_length(tvb) < 4) {
1679
118
    return false;
1680
118
  }
1681
1682
1.93k
  if ((tvb_get_ntohl(tvb, CLC_MSG_BYTE_0) != SMCR_CLC_ID) &&
1683
1.93k
    (tvb_get_ntohl(tvb, CLC_MSG_BYTE_0) != SMCD_CLC_ID))
1684
1.93k
    return false;
1685
1686
0
  dissect_smc_tcp(tvb, pinfo, tree, data);
1687
0
  return true;
1688
1.93k
}
1689
1690
static bool
1691
dissect_smcr_infiniband_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1692
  void *data _U_)
1693
176
{
1694
176
  uint16_t msg_len;
1695
176
  llc_message msg_byte0;
1696
176
  uint8_t msg_byte1;
1697
176
  bool v1_check = true, v2_check = true;
1698
1699
176
  if (tvb_captured_length_remaining(tvb, SMCR_MSG_BYTE_0) < 2)  /* need at least 2 bytes */
1700
12
    return false;
1701
1702
  /* Grab the first two bytes of the message, as they are needed */
1703
  /*  for validity checking of both CLC and LLC messages         */
1704
164
  msg_byte0 = (llc_message) tvb_get_uint8(tvb,CLC_MSG_BYTE_0);
1705
164
  msg_byte1 = tvb_get_uint8(tvb,CLC_MSG_BYTE_1);
1706
1707
1708
  /* Check for possible LLC Messages */
1709
1710
164
  if (!((msg_byte1 == LLC_MSG_LENGTH) &&
1711
2
    (((msg_byte0 >= LLC_CONFIRM_LINK) &&
1712
2
    (msg_byte0 <= LLC_DELETE_RKEY)) ||
1713
2
    (msg_byte0 == LLC_RMBE_CTRL))))
1714
164
    v1_check = false;
1715
164
  if (!(((msg_byte0 >= LLC_CONFIRM_LINK_V2) &&
1716
99
         (msg_byte0 <= LLC_ADD_LINK_V2)) ||
1717
162
        ((msg_byte0 >= LLC_DEL_LINK_V2) &&
1718
96
         (msg_byte0 <= LLC_TEST_LINK_V2)) ||
1719
146
        (msg_byte0 == LLC_DELETE_RKEY_V2)))
1720
140
    v2_check = false;
1721
1722
164
  if ((!v1_check && !v2_check) || (v1_check && v2_check))
1723
140
    return false;
1724
1725
24
  if (v1_check)
1726
0
    msg_len = tvb_get_uint8(tvb, LLC_LEN_OFFSET);
1727
24
  else
1728
24
    msg_len = tvb_get_uint16(tvb, LLC_LEN_OFFSET, ENC_BIG_ENDIAN);
1729
24
  if (msg_len != tvb_reported_length_remaining(tvb, LLC_CMD_OFFSET))
1730
24
    return false;
1731
1732
0
  dissect_smcr_infiniband(tvb, pinfo, tree, data);
1733
0
  return true;
1734
24
}
1735
1736
void
1737
proto_register_smcr(void)
1738
16
{
1739
  /* Setup list of header fields */
1740
16
  static hf_register_info hf[] = {
1741
16
    { &hf_smcr_clc_msg, {
1742
16
    "CLC Message", "smc.clc_msg",
1743
16
    FT_UINT8, BASE_DEC, VALS(smcr_clc_message_txt), 0x0,
1744
16
    NULL, HFILL}},
1745
1746
16
    { &hf_smcr_llc_msg, {
1747
16
    "LLC Message", "smc.llc_msg",
1748
16
    FT_UINT8, BASE_HEX, VALS(smcr_llc_message_txt), 0x0,
1749
16
    NULL, HFILL}},
1750
1751
16
    { &hf_proposal_smc_version_release_number, {
1752
16
    "SMC Version Release Number", "smc.proposal.smc.version.relnum",
1753
16
    FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL }},
1754
1755
16
    { &hf_proposal_smc_version_seid, {
1756
16
    "SEID Indicator", "smc.proposal.smc.seid",
1757
16
    FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL } },
1758
1759
16
    { &hf_proposal_smc_version, {
1760
16
    "SMC Version", "smc.proposal.smc.version",
1761
16
    FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL}},
1762
1763
16
    { &hf_proposal_smc_type, {
1764
16
    "SMC(v1) Type", "smc.proposal.smc.type",
1765
16
    FT_UINT8, BASE_DEC, VALS(smc_clc_type_message_txt),
1766
16
    0x03, NULL, HFILL}},
1767
1768
16
    { &hf_accept_smc_type, {
1769
16
    "SMC Type", "smc.accept.smc.type",
1770
16
    FT_UINT8, BASE_DEC, VALS(smc_clc_type_message_txt),
1771
16
    0x03, NULL, HFILL}},
1772
1773
16
    { &hf_confirm_smc_type, {
1774
16
    "SMC Type", "smc.confirm.smc.type",
1775
16
    FT_UINT8, BASE_DEC, VALS(smc_clc_type_message_txt),
1776
16
    0x03, NULL, HFILL}},
1777
1778
16
    { &hf_proposal_smc_v2_type, {
1779
16
    "SMC(v2) Type", "smc.proposal.smcv2.type",
1780
16
    FT_UINT8, BASE_DEC, VALS(smc_clc_type_message_txt),
1781
16
    0x0C, NULL, HFILL}},
1782
1783
16
    { &hf_smc_proposal_smc_chid, {
1784
16
    "ISMv2 CHID", "smc.proposal.smc.chid",
1785
16
    FT_UINT16, BASE_HEX, NULL, 0x00, NULL, HFILL}},
1786
1787
16
    { &hf_smc_length, {
1788
16
    "SMC Length", "smc.length",
1789
16
    FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL}},
1790
1791
16
    { &hf_accept_smc_version, {
1792
16
    "SMC Version", "smc.proposal.smc.version",
1793
16
    FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL}},
1794
1795
16
    { &hf_smcd_accept_smc_version, {
1796
16
    "SMC Version", "smc.proposal.smc.version",
1797
16
    FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL}},
1798
1799
16
    { &hf_smcd_confirm_smc_version, {
1800
16
    "SMC Version", "smc.proposal.smc.version",
1801
16
    FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL}},
1802
1803
16
    { &hf_accept_first_contact, {
1804
16
    "First Contact", "smc.proposal.first.contact",
1805
16
    FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL}},
1806
1807
16
    { &hf_confirm_smc_version, {
1808
16
    "SMC Version", "smc.proposal.smc.version",
1809
16
    FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL}},
1810
1811
16
    { &hf_accept_rmb_buffer_size, {
1812
16
    "Server RMB Buffers Size (Compressed Notation)",
1813
16
    "smc.accept.rmb.buffer.size",
1814
16
    FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL}},
1815
1816
16
    { &hf_accept_qp_mtu_value, {
1817
16
    "QP MTU Value (enumerated value)",
1818
16
    "smc.accept.qp.mtu.value",
1819
16
    FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL}},
1820
1821
16
    { &hf_confirm_rmb_buffer_size, {
1822
16
    "Client RMB Buffers Size (Compressed Notation)",
1823
16
    "smc.confirm.rmb.buffer.size",
1824
16
    FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL}},
1825
1826
16
    { &hf_confirm_qp_mtu_value, {
1827
16
    "QP MTU Value (enumerated value)",
1828
16
    "smc.confirm.qp.mtu.value",
1829
16
    FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL}},
1830
1831
16
    { &hf_smc_proposal_flags, {
1832
16
    "Flags", "smc.proposal.flags",
1833
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
1834
1835
16
    { &hf_smc_proposal_ext_flags, {
1836
16
    "Flag 2", "smc.proposal.extflags.2",
1837
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
1838
1839
16
    { &hf_smcr_accept_flags, {
1840
16
    "Flags", "smc.accept.flags",
1841
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
1842
1843
16
    { &hf_smcr_accept_flags2, {
1844
16
    "Flags 2", "smc.accept.flags.2",
1845
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
1846
1847
16
    { &hf_smcr_confirm_flags, {
1848
16
    "Flags", "smc.confirm.flags",
1849
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
1850
1851
16
    { &hf_decline_smc_version, {
1852
16
    "SMC Version", "smc.decline.smc.version",
1853
16
    FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL} },
1854
1855
16
    { &hf_decline_out_of_sync, {
1856
16
    "Out of Sync", "smc.decline.osync",
1857
16
    FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL} },
1858
1859
16
    { &hf_smc_decline_flags2, {
1860
16
    "Flags 2", "smc.decline.flags2",
1861
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
1862
1863
16
    { &hf_smc_decline_flags, {
1864
16
    "Flags", "smc.decline.flags",
1865
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL} },
1866
1867
16
    { &hf_smcr_confirm_flags2, {
1868
16
    "Flags 2", "smc.confirm.flags.2",
1869
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
1870
1871
16
    { &hf_smc_proposal_client_peer_id, {
1872
16
    "Sender (Client) Peer ID", "smc.proposal.sender.client.peer.id",
1873
16
    FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}},
1874
1875
16
    { &hf_smc_proposal_ism_gid_count, {
1876
16
    "ISMv2 GID Count", "smc.proposal.ismv2_gid_count",
1877
16
    FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL} },
1878
1879
16
    { &hf_smc_proposal_ism_gid, {
1880
16
    "ISM GID", "smc.proposal.ism.gid",
1881
16
    FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}},
1882
1883
16
    { &hf_smc_proposal_client_preferred_gid, {
1884
16
    "Client Preferred GID", "smc.proposal.client.preferred.gid",
1885
16
    FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1886
1887
16
    { &hf_smc_proposal_client_preferred_mac, {
1888
16
    "Client Preferred MAC Address",
1889
16
    "smc.proposal.client.preferred.mac",
1890
16
    FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1891
1892
16
    { &hf_smcr_accept_server_peer_id, {
1893
16
    "Sender (Server) Peer ID", "smc.accept.sender.server.peer.id",
1894
16
    FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}},
1895
1896
16
    { &hf_smcr_accept_server_preferred_gid, {
1897
16
    "Server Preferred GID", "smc.accept.server.preferred.gid",
1898
16
    FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1899
1900
16
    { &hf_smcr_accept_server_preferred_mac, {
1901
16
    "Server Preferred MAC Address",
1902
16
    "smc.accept.server.preferred.mac",
1903
16
    FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1904
1905
16
    { &hf_smc_proposal_smcv1_subnet_ext_offset, {
1906
16
    "SMCv1 IP Subnet Extension Offset","smc.proposal.smcv1_subnet_ext_offset",
1907
16
    FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL} },
1908
1909
16
    { &hf_smc_proposal_smcv2_ext_offset, {
1910
16
    "SMCv2 Extension Offset","smc.proposal.smcv2_ext_offset",
1911
16
    FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL} },
1912
1913
16
    { &hf_smc_proposal_smcdv2_ext_offset, {
1914
16
    "SMC-Dv2 Extension Offset","smc.proposal.smcdv2_ext_offset",
1915
16
    FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL} },
1916
1917
16
    { &hf_smc_proposal_rocev2_gid_ipv6_addr, {
1918
16
    "RoCEv2 GID IPv6 Address",
1919
16
    "smc.proposal.rocev2.gid.ipv6",
1920
16
    FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL} },
1921
1922
16
    { &hf_smc_proposal_rocev2_gid_ipv4_addr, {
1923
16
    "RoCEv2 GID IPv4 Address",
1924
16
    "smc.proposal.rocev2.gid.ipv4",
1925
16
    FT_IPv4, BASE_NETMASK, NULL, 0x0, NULL, HFILL}},
1926
1927
16
    { &hf_smc_proposal_outgoing_interface_subnet_mask, {
1928
16
    "Outgoing Interface Subnet Mask",
1929
16
    "smc.outgoing.interface.subnet.mask",
1930
16
    FT_IPv4, BASE_NETMASK, NULL, 0x0, NULL, HFILL}},
1931
1932
16
    { &hf_smc_proposal_outgoing_subnet_mask_signifcant_bits, {
1933
16
    "Outgoing Interface Subnet Mask Number of Significant Bits",
1934
16
    "smc.outgoing.interface.subnet.mask.number.of.significant.bits",
1935
16
    FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
1936
1937
16
    { &hf_smc_proposal_ipv6_prefix_count, {
1938
16
    "IPv6 Prefix Count","smc.proposal.ipv6.prefix.count",
1939
16
    FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL} },
1940
1941
16
    { &hf_smc_proposal_ipv6_prefix, {
1942
16
    "IPv6 Prefix Value","smc.proposal.ipv6.prefix.value",
1943
16
    FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1944
1945
16
    { &hf_smc_proposal_ipv6_prefix_length, {
1946
16
    "IPv6 Prefix Length", "smc.proposal.ipv6.prefix.length",
1947
16
    FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
1948
1949
16
    { &hf_smcr_accept_server_qp_number, {
1950
16
    "Server QP Number","smc.accept.server.qp.number",
1951
16
    FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}},
1952
1953
16
    { &hf_smcr_accept_server_rmb_rkey, {
1954
16
    "Server RMB Rkey","smc.accept.server.rmb.rkey",
1955
16
    FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}},
1956
1957
16
    { &hf_smcr_accept_server_tcp_conn_index, {
1958
16
    "Server TCP Connection Index",
1959
16
    "smc.accept.server.tcp.conn.index",
1960
16
    FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
1961
1962
16
    { &hf_smcr_accept_server_rmb_element_alert_token, {
1963
16
    "Server RMB Element Alert Token",
1964
16
    "smc.accept.server.rmb.element.alert.token",
1965
16
    FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}},
1966
1967
16
    { &hf_smcr_accept_server_rmb_virtual_address, {
1968
16
    "Server's RMB Virtual Address",
1969
16
    "smc.accept.server.rmb.virtual.address",
1970
16
    FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}},
1971
1972
16
    { &hf_smcr_accept_initial_psn, {
1973
16
    "Initial PSN","smc.accept.initial.psn",
1974
16
    FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}},
1975
1976
16
    { &hf_smcr_confirm_client_peer_id, {
1977
16
    "Sender (Client) Peer ID",
1978
16
    "smc.confirm.sender.client.peer.id",
1979
16
    FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}},
1980
1981
16
    { &hf_smcr_confirm_client_gid, {
1982
16
    "Client GID", "smc.client.gid",
1983
16
    FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1984
1985
16
    { &hf_smcr_confirm_client_mac, {
1986
16
    "Client MAC Address", "smc.confirm.client.mac",
1987
16
    FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1988
1989
16
    { &hf_smcr_confirm_client_qp_number, {
1990
16
    "Client QP Number","smc.confirm.client.qp.number",
1991
16
    FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}},
1992
1993
16
    { &hf_smcr_confirm_client_rmb_rkey, {
1994
16
    "Client RMB Rkey","smc.confirm.client.rmb.rkey",
1995
16
    FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}},
1996
1997
16
    { &hf_smcr_confirm_client_tcp_conn_index, {
1998
16
    "Client TCP Connection Index",
1999
16
    "smc.confirm.client.tcp.conn.index",
2000
16
    FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
2001
2002
16
    { &hf_smcr_confirm_client_rmb_element_alert_token, {
2003
16
    "Client RMB Element Alert Token",
2004
16
    "smc.client.rmb.element.alert.token",
2005
16
    FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2006
2007
16
    { &hf_smcr_confirm_client_rmb_virtual_address, {
2008
16
    "Client's RMB Virtual Address",
2009
16
    "smc.client.rmb.virtual.address",
2010
16
    FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2011
2012
16
    { &hf_smcr_confirm_initial_psn, {
2013
16
    "Initial PSN","smc.initial.psn",
2014
16
    FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2015
2016
16
    { &hf_smc_decline_peer_id, {
2017
16
    "Sender Peer ID", "smc.sender.peer.id",
2018
16
    FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2019
2020
16
    { &hf_smc_decline_diag_info, {
2021
16
    "Peer Diagnosis Information", "smc.peer.diag.info",
2022
16
    FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2023
2024
16
    { &hf_decline_os_type, {
2025
16
    "OS Type", "smc.decline.os.type",
2026
16
    FT_UINT8, BASE_DEC, VALS(smc_clc_os_message_txt), 0xF0, NULL, HFILL} },
2027
2028
16
    { &hf_smcr_confirm_link_gid, {
2029
16
    "Sender GID", "smc.sender.gid",
2030
16
    FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}},
2031
2032
16
    { &hf_smcr_confirm_link_mac, {
2033
16
    "Sender MAC Address", "smc.confirm.link.sender.mac",
2034
16
    FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL}},
2035
2036
16
    { &hf_smcr_confirm_link_qp_number, {
2037
16
    "Sender QP Number","smc.confirm.link.sender.qp.number",
2038
16
    FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2039
2040
16
    { &hf_smcr_confirm_link_number, {
2041
16
    "Link Number", "smc.confirm.link.number",
2042
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2043
2044
16
    { &hf_smcr_confirm_link_userid, {
2045
16
    "Sender Link User ID",
2046
16
    "smc.confirm.link.sender.link.userid",
2047
16
    FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2048
2049
16
    { &hf_smcr_confirm_link_max_links, {
2050
16
    "Max Links","smc.confirm.link.max.links",
2051
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2052
2053
16
    { &hf_smcr_confirm_link_flags, {
2054
16
    "Flags", "smc.confirm.link.flags",
2055
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2056
2057
16
    { &hf_smcr_confirm_link_response, {
2058
16
    "Response", "smc.confirm.link.response",
2059
16
    FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL}},
2060
2061
16
    { &hf_smcr_add_link_gid, {
2062
16
    "Sender GID", "smc.add.link.sender.gid",
2063
16
    FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}},
2064
2065
16
    { &hf_smcr_add_link_mac, {
2066
16
    "Sender MAC Address", "smc.add.link.sender.mac",
2067
16
    FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL}},
2068
2069
16
    { &hf_smcr_add_link_qp_number, {
2070
16
    "Sender QP Number","smc.add.link.sender.qp.number",
2071
16
    FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2072
2073
16
    { &hf_smcr_add_link_number, {
2074
16
    "Link Number", "smc.add.link.link.number",
2075
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2076
2077
16
    { &hf_smcr_add_link_initial_psn, {
2078
16
    "Initial PSN", "smc.add.link.initial.psn",
2079
16
    FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2080
2081
16
    { &hf_smcr_add_link_flags, {
2082
16
    "Flags", "smc.add.link.flags",
2083
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2084
2085
16
    { &hf_smcr_add_link_response, {
2086
16
    "Add Link Response", "smc.add.link.response",
2087
16
    FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL}},
2088
2089
16
    { &hf_smcr_add_link_response_rejected, {
2090
16
    "Add Link Rejected", "smc.add.link.response.rejected",
2091
16
    FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL}},
2092
2093
16
    { &hf_smcr_add_link_reject_reason, {
2094
16
    "Reject Reason", "smc.add.link.response.reject_reason",
2095
16
    FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL}},
2096
2097
16
    { &hf_smcr_add_link_flags2, {
2098
16
    "Flags", "smc.add.link.flags2",
2099
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2100
2101
16
    { &hf_smcr_add_link_qp_mtu_value, {
2102
16
    "QP MTU Value (enumerated value)", "smc.add.link.qp.mtu.value",
2103
16
    FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL}},
2104
2105
16
    { &hf_smcr_add_link_flags3, {
2106
16
    "V2 Flags", "smc.add.link.flags3",
2107
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2108
2109
16
    { &hf_smcr_add_link_flag3_direct_link, {
2110
16
    "Direct link attachment to peer", "smc.add.link.direct_link",
2111
16
    FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL}},
2112
2113
16
    { &hf_smcr_add_link_client_target_gid, {
2114
16
    "Client Target GID", "smc.add.link.client_target_gid",
2115
16
    FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL}},
2116
2117
16
    { &hf_smcr_add_link_rkey_count, {
2118
16
    "Number of Rkeys", "smc.add.link.rkey_count",
2119
16
    FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
2120
2121
16
    { &hf_smcr_add_link_rkey, {
2122
16
    "RMB RToken Pair - Rkey as known on this SMC Link",
2123
16
    "smc.add.link.rmb.RTok.Rkey1",
2124
16
    FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2125
2126
16
    { &hf_smcr_add_link_rkey2, {
2127
16
    "RMB RToken Pair - Equivalent Rkey for the new SMC Link",
2128
16
    "smc.add.link.rmb.RTok.Rkey2",
2129
16
    FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2130
2131
16
    { &hf_smcr_add_link_virt_addr, {
2132
16
    "RMB RToken Pair - Virtual Address for the new SMC Link",
2133
16
    "smc.add.link.rmb.RTok.virt",
2134
16
    FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2135
2136
16
    { &hf_smcr_add_link_cont_flags, {
2137
16
    "Flags", "smc.add.link.cont.flags",
2138
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2139
2140
16
    { &hf_smcr_add_link_cont_response, {
2141
16
    "Response", "smc.add.link.cont.response",
2142
16
    FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL}},
2143
2144
16
    { &hf_smcr_add_link_cont_link_number, {
2145
16
    "Link Number", "smc.add.link.cont.link.number",
2146
16
    FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL}},
2147
2148
16
    { &hf_smcr_add_link_cont_number_of_rkeys, {
2149
16
    "Number of Rkeys", "smc.add.link.cont.rkey.number",
2150
16
    FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL}},
2151
2152
16
    { &hf_smcr_add_link_cont_p1_rkey, {
2153
16
    "RMB RToken Pair 1 - Rkey as known on this SMC Link",
2154
16
    "smc.add.link.cont.rmb.RTok1.Rkey1",
2155
16
    FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2156
2157
16
    { &hf_smcr_add_link_cont_p1_rkey2, {
2158
16
    "RMB RToken Pair 1 - Equivalent Rkey for the new SMC Link",
2159
16
    "smc.add.link.cont.rmb.RTok1.Rkey2",
2160
16
    FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2161
2162
16
    { &hf_smcr_add_link_cont_p1_virt_addr, {
2163
16
    "RMB RToken Pair 1 Virtual Address for the new SMC Link",
2164
16
    "smc.add.link.cont.rmb.RTok1.virt",
2165
16
    FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2166
2167
16
    { &hf_smcr_add_link_cont_p2_rkey, {
2168
16
    "RMB RToken Pair 2 - Rkey as known on this SMC Link",
2169
16
    "smc.add.link.cont.rmb.RTok2.Rkey1",
2170
16
    FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2171
2172
16
    { &hf_smcr_add_link_cont_p2_rkey2, {
2173
16
    "RMB RToken Pair 2 - Equivalent Rkey for the new SMC Link",
2174
16
    "smc.add.link.cont.rmb.RTok2.Rkey2",
2175
16
    FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2176
2177
16
    { &hf_smcr_add_link_cont_p2_virt_addr, {
2178
16
    "RMB RToken Pair 2 Virtual Address for the new SMC Link",
2179
16
    "smc.add.link.cont.rmb.RTok2.virt",
2180
16
    FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2181
2182
16
    { &hf_smcr_request_add_link_flags, {
2183
16
    "Flags", "smc.add.link.flags",
2184
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL} },
2185
2186
16
    { &hf_smcr_request_add_link_response, {
2187
16
    "Request Add Link Response", "smc.request.add.link.response",
2188
16
    FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL} },
2189
2190
16
    { &hf_smcr_request_add_link_response_rejected, {
2191
16
    "Request Add Link Rejected", "smc.request.add.link.response.rejected",
2192
16
    FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL} },
2193
2194
16
    { &hf_smcr_request_add_link_reject_reason, {
2195
16
    "Reject Reason", "smc.request.add.link.response.reject_reason",
2196
16
    FT_UINT8, BASE_HEX, NULL, 0x0F, NULL, HFILL} },
2197
2198
16
    { &hf_smc_request_add_link_gid_lst_len, {
2199
16
    "GID List Entry Count", "smc.request.add.link.gid.list.entry_count",
2200
16
    FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL} },
2201
2202
16
    { &hf_smc_request_add_link_gid_list_entry, {
2203
16
    "RoCEv2 GID List Entry", "smc.request.add.link.gid.list.entry",
2204
16
    FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL} },
2205
2206
16
    { &hf_smcr_delete_link_flags, {
2207
16
    "Flags", "smc.delete.link.flags",
2208
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2209
2210
16
    { &hf_smcr_delete_link_response, {
2211
16
    "Response", "smc.delete.link.response",
2212
16
    FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL}},
2213
2214
16
    { &hf_smcr_delete_link_all, {
2215
16
    "Terminate All Links In The Link Group",
2216
16
    "smc.delete.link.all",
2217
16
    FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL}},
2218
2219
16
    { &hf_smcr_delete_link_orderly, {
2220
16
    "Terminate Links Orderly", "smc.delete.link.orderly",
2221
16
    FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL}},
2222
2223
16
    { &hf_smcr_delete_link_number, {
2224
16
    "Link Number For The Failed Link", "smc.delete.link.number",
2225
16
    FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL}},
2226
2227
16
    { &hf_smcr_delete_link_reason_code, {
2228
16
    "Reason Code", "smc.delete.link.reason.code",
2229
16
    FT_UINT32, BASE_HEX, NULL, 0x00, NULL, HFILL}},
2230
2231
16
    { &hf_smcr_confirm_rkey_flags, {
2232
16
    "Flags", "smc.confirm.rkey.flags",
2233
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2234
2235
16
    { &hf_smcr_confirm_rkey_response, {
2236
16
    "Response", "smc.confirm.rkey.response",
2237
16
    FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL}},
2238
2239
16
    { &hf_smcr_confirm_rkey_negative_response, {
2240
16
    "Negative Response", "smc.confirm.rkey.negative.response",
2241
16
    FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL}},
2242
2243
16
    { &hf_smcr_confirm_rkey_retry_rkey_set, {
2244
16
    "Retry Rkey Set", "smc.confirm.rkey.retry.rkey.set",
2245
16
    FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL}},
2246
2247
16
    { &hf_smcr_confirm_rkey_number, {
2248
16
    "Number of other QP", "smc.confirm.rkey.number.qp",
2249
16
    FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL}},
2250
2251
16
    { &hf_smcr_confirm_rkey_new_rkey, {
2252
16
    "New Rkey for this link","smc.confirm.rkey.new.rkey",
2253
16
    FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2254
2255
16
    { &hf_smcr_confirm_rkey_virtual_address, {
2256
16
    "New RMB virtual address for this link",
2257
16
    "smc.confirm.rkey.new.virt",
2258
16
    FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2259
2260
16
    { &hf_smcr_confirm_rkey_link_number, {
2261
16
    "Link Number", "smc.confirm.rkey.link.number",
2262
16
    FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL}},
2263
2264
16
    { &hf_smcr_delete_rkey_flags, {
2265
16
    "Flags", "smc.delete.rkey.flags",
2266
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2267
2268
16
    { &hf_smcr_delete_rkey_response, {
2269
16
    "Response", "smc.delete.rkey.response",
2270
16
    FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL}},
2271
2272
16
    { &hf_smcr_delete_rkey_negative_response, {
2273
16
    "Negative Response", "smc.delete.rkey.negative.response",
2274
16
    FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL}},
2275
2276
16
    { &hf_smcr_delete_rkey_mask, {
2277
16
    "Error Mask", "smc.delete.rkey.error.mask",
2278
16
    FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL}},
2279
2280
16
    { &hf_smcr_delete_rkey_deleted, {
2281
16
    "RMB Rkey to be deleted", "smc.delete.rkey.deleted",
2282
16
    FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2283
2284
16
    { &hf_smcr_delete_rkey_count, {
2285
16
    "Rkey Count", "smc.delete.rkey.count",
2286
16
    FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
2287
2288
16
    { &hf_smcr_delete_rkey_invalid_count, {
2289
16
    "Invalid Rkey Count", "smc.delete.rkey.count.invalid",
2290
16
    FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
2291
2292
16
    { &hf_smcr_test_link_flags, {
2293
16
    "Flags", "smc.test.link.flags",
2294
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2295
2296
16
    { &hf_smcr_test_link_response, {
2297
16
    "Response", "smc.test.link.response",
2298
16
    FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL}},
2299
2300
16
    { &hf_smcr_rmbe_ctrl_seqno, {
2301
16
    "Sequence Number", "smc.rmbe.ctrl.seqno",
2302
16
    FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2303
2304
16
    { &hf_smcr_rmbe_ctrl_alert_token, {
2305
16
    "Alert Token", "smc.rmbe.ctrl.alert.token",
2306
16
    FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2307
2308
16
    { &hf_smc_proposal_eid_count, {
2309
16
    "EID Count", "smc.proposal.eid.count",
2310
16
    FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL} },
2311
2312
16
    { &hf_smc_proposal_eid, {
2313
16
    "EID", "smc.proposal.eid",
2314
16
    FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL} },
2315
2316
16
    { &hf_smc_proposal_system_eid, {
2317
16
    "SEID", "smc.proposal.system.eid",
2318
16
    FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL} },
2319
2320
16
    { &hf_smcr_rmbe_ctrl_prod_wrap_seqno, {
2321
16
    "Producer window wrap sequence number",
2322
16
    "smc.rmbe.ctrl.prod.wrap.seq",
2323
16
    FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2324
2325
16
    { &hf_smcr_rmbe_ctrl_peer_prod_curs, {
2326
16
    "Peer Producer Cursor", "smc.rmbe.ctrl.peer.prod.curs",
2327
16
    FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2328
2329
16
    { &hf_smcr_rmbe_ctrl_cons_wrap_seqno, {
2330
16
    "Consumer window wrap sequence number",
2331
16
    "smc.rmbe.ctrl.cons.wrap.seq",
2332
16
    FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2333
2334
16
    { &hf_smcr_rmbe_ctrl_peer_cons_curs, {
2335
16
    "Peer Consumer Cursor", "smc.rmbe.ctrl.peer.cons.curs",
2336
16
    FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2337
2338
16
    { &hf_smcr_rmbe_ctrl_conn_rw_status_flags, {
2339
16
    "Connection read/write status flags",
2340
16
    "smc.rmbe.ctrl.conn.rw.status.flags",
2341
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2342
2343
16
    { &hf_smcr_rmbe_ctrl_write_blocked, {
2344
16
    "Write Blocked", "smc.rmbe.ctrl.write.blocked",
2345
16
    FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL}},
2346
2347
16
    { &hf_smcr_rmbe_ctrl_urgent_pending, {
2348
16
    "Urgent Data Pending", "smc.rmbe.ctrl.urgent.pending",
2349
16
    FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL}},
2350
2351
16
    { &hf_smcr_rmbe_ctrl_urgent_present, {
2352
16
    "Urgent Data Present", "smc.rmbe.ctrl.urgent.present",
2353
16
    FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL}},
2354
2355
16
    { &hf_smcr_rmbe_ctrl_cons_update_requested, {
2356
16
    "Consumer Cursor Update Requested",
2357
16
    "smc.rmbe.ctrl.cons.update.requested",
2358
16
    FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL}},
2359
2360
16
    { &hf_smcr_rmbe_ctrl_failover_validation, {
2361
16
    "Failover Validation Indicator",
2362
16
    "smc.rmbe.ctrl.failover.validation",
2363
16
    FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL}},
2364
2365
16
    { &hf_smcr_rmbe_ctrl_peer_conn_state_flags, {
2366
16
    "Peer Connection State Flags",
2367
16
    "smc.rmbe.ctrl.peer.conn.state.flags",
2368
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
2369
2370
16
    { &hf_smcr_rmbe_ctrl_peer_sending_done, {
2371
16
    "Peer Sending Done", "smc.rmbe.ctrl.peer.sending.done",
2372
16
    FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL}},
2373
2374
16
    { &hf_smcr_rmbe_ctrl_peer_closed_conn, {
2375
16
    "Peer Closed Connection", "smc.rmbe.ctrl.peer.closed.conn",
2376
16
    FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL}},
2377
2378
16
    { &hf_smcr_rmbe_ctrl_peer_abnormal_close, {
2379
16
    "Peer Abnormal Close", "smc.rmbe.ctrl.peer.abnormal.close",
2380
16
    FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL}},
2381
2382
16
    { &hf_smc_accept_eid, {
2383
16
    "Negotiated EID", "smc.accept.eid",
2384
16
    FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL} },
2385
2386
16
    { &hf_smc_confirm_eid, {
2387
16
    "Negotiated EID", "smc.confirm.eid",
2388
16
    FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL} },
2389
2390
16
    { &hf_smc_accept_peer_name, {
2391
16
    "Peer Host Name", "smc.accept.peer.host.name",
2392
16
    FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL} },
2393
2394
16
    { &hf_smc_confirm_peer_name, {
2395
16
    "Peer Host Name", "smc.confirm.peer.host.name",
2396
16
    FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL} },
2397
2398
16
    { &hf_smc_confirm_gid_lst_len, {
2399
16
    "GID List Entry Count", "smc.confirm.gid.list.entry_count",
2400
16
    FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL} },
2401
2402
16
    { &hf_smc_confirm_gid_list_entry, {
2403
16
    "RoCEv2 GID List Entry", "smc.confirm.gid.list.entry",
2404
16
    FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL} },
2405
2406
16
    { &hf_smcd_accept_first_contact, {
2407
16
    "First Contact", "smc.accept.first.contact",
2408
16
    FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL} },
2409
2410
16
    { &hf_smc_confirm_first_contact, {
2411
16
    "First Contact", "smc.confirm.first.contact",
2412
16
    FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL} },
2413
2414
16
    { &hf_accept_smc_version_release_number, {
2415
16
    "SMC Version Release Number", "smc.accept.smc.version.relnum",
2416
16
    FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL } },
2417
2418
16
    { &hf_confirm_smc_version_release_number, {
2419
16
    "SMC Version Release Number", "smc.confirm.smc.version.relnum",
2420
16
    FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL } },
2421
2422
16
    { &hf_accept_os_type, {
2423
16
    "OS Type", "smc.accept.os.type",
2424
16
    FT_UINT8, BASE_DEC, VALS(smc_clc_os_message_txt), 0xF0, NULL, HFILL} },
2425
2426
16
    { &hf_accept_v2_lg_type, {
2427
16
    "V2 LG Type", "smc.accept.v2_lg.type",
2428
16
    FT_UINT8, BASE_DEC, VALS(smc_clc_v2_lg_message_txt), 0x80, NULL, HFILL} },
2429
2430
16
    { &hf_confirm_os_type, {
2431
16
    "OS Type", "smc.confirm.os.type",
2432
16
    FT_UINT8, BASE_DEC, VALS(smc_clc_os_message_txt), 0xF0, NULL, HFILL} },
2433
2434
16
    { &hf_smcd_accept_dmb_token, {
2435
16
    "DMB Token", "smc.accept.dmb.token",
2436
16
    FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL} },
2437
2438
16
    { &hf_smcd_confirm_dmb_token, {
2439
16
    "DMB Token", "smc.confirm.dmb.token",
2440
16
    FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL} },
2441
2442
16
    { &hf_accept_dmb_buffer_size, {
2443
16
    "Server DMBE Buffers Size (Compressed Notation)",
2444
16
    "smc.accept.dmbe.buffer.size",
2445
16
    FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL} },
2446
2447
16
    { &hf_smcd_confirm_dmb_buffer_size, {
2448
16
    "Client DMBE Buffers Size (Compressed Notation)",
2449
16
    "smc.confirm.dmbe.buffer.size",
2450
16
    FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL} },
2451
2452
16
    { &hf_smcd_accept_smc_chid, {
2453
16
    "ISMv2 CHID", "smc.accept.smc.chid",
2454
16
    FT_UINT16, BASE_HEX, NULL, 0x00, NULL, HFILL} },
2455
2456
16
    { &hf_smcd_confirm_smc_chid, {
2457
16
    "ISMv2 CHID", "smc.confirm.smc.chid",
2458
16
    FT_UINT16, BASE_HEX, NULL, 0x00, NULL, HFILL} },
2459
2460
16
    { &hf_smcd_accept_server_peer_id, {
2461
16
    "Sender (Server) ISM GID", "smc.accept.sender.server.ism.gid",
2462
16
    FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL} },
2463
2464
16
    { &hf_smcd_confirm_client_peer_id, {
2465
16
    "Sender (Client) ISM GID", "smc.confirm.sender.client.ism.gid",
2466
16
    FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL} },
2467
2468
16
    { &hf_smcd_accept_dmbe_conn_index, {
2469
16
    "DMBE Connection Index",
2470
16
    "smc.accept.dmbe.conn.index",
2471
16
    FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL} },
2472
2473
16
    { &hf_smcd_accept_server_link_id, {
2474
16
    "Server Link ID",
2475
16
    "smc.accept.server.linkid",
2476
16
    FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL} },
2477
2478
16
    { &hf_smcd_confirm_dmbe_conn_index, {
2479
16
    "DMBE Connection Index",
2480
16
    "smc.confirm.dmbe.conn.index",
2481
16
    FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL} },
2482
2483
16
    { &hf_smcd_confirm_client_link_id, {
2484
16
    "Client Link ID",
2485
16
    "smc.confirm.client.linkid",
2486
16
    FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL} },
2487
2488
16
    { &hf_smcd_accept_flags, {
2489
16
    "Flags", "smc.accept.flags",
2490
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL} },
2491
2492
16
    { &hf_smcd_confirm_flags, {
2493
16
    "Flags", "smc.confirm.flags",
2494
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL} },
2495
2496
16
    { &hf_smcd_accept_flags2, {
2497
16
    "DMBE Size", "smc.accept.dmbe.size",
2498
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL} },
2499
2500
16
    { &hf_smcd_confirm_flags2, {
2501
16
    "DMBE Size", "smc.confirm.dmbe.size",
2502
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL} },
2503
2504
16
    { &hf_smc_accept_fce_flags, {
2505
16
    "Flags", "smc.accept.fce.flags",
2506
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL} },
2507
2508
16
    { &hf_smcr_accept_fce_flags, {
2509
16
    "Flags", "smc.accept.fce1.flags",
2510
16
    FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL} },
2511
2512
16
    { &hf_smc_reserved, {
2513
16
    "Reserved", "smc.reserved",
2514
16
    FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL} }
2515
16
  };
2516
2517
  /* Setup protocol subtree arrays */
2518
16
  static int* ett[] = {
2519
16
    &ett_smcr,
2520
16
    &ett_proposal_flag,
2521
16
    &ett_proposal_ext_flag2,
2522
16
    &ett_accept_flag,
2523
16
    &ett_accept_flag2,
2524
16
    &ett_smcr_accept_fce_flag1,
2525
16
    &ett_smcd_accept_flag,
2526
16
    &ett_smcd_accept_flag2,
2527
16
    &ett_smc_accept_fce_flag,
2528
16
    &ett_smcd_confirm_flag,
2529
16
    &ett_smc_confirm_fce_flag,
2530
16
    &ett_smcd_confirm_flag2,
2531
16
    &ett_confirm_flag,
2532
16
    &ett_confirm_flag2,
2533
16
    &ett_confirm_link_flag,
2534
16
    &ett_decline_flag,
2535
16
    &ett_decline_flag2,
2536
16
    &ett_add_link_flag,
2537
16
    &ett_add_link_flag2,
2538
16
    &ett_add_link_flag3,
2539
16
    &ett_add_link_cont_flag,
2540
16
    &ett_request_add_link_flag,
2541
16
    &ett_delete_link_flag,
2542
16
    &ett_confirm_rkey_flag,
2543
16
    &ett_delete_rkey_flag,
2544
16
    &ett_test_link_flag,
2545
16
    &ett_rmbe_ctrl_rw_status_flag,
2546
16
    &ett_rmbe_ctrl_peer_conn_state_flag
2547
16
  };
2548
2549
16
  proto_smc = proto_register_protocol("Shared Memory Communications",
2550
16
    "SMC", "smc");
2551
2552
16
  proto_register_field_array(proto_smc, hf, array_length(hf));
2553
16
  proto_register_subtree_array(ett, array_length(ett));
2554
2555
16
  smc_tcp_handle = register_dissector("smc", dissect_smc_tcp, proto_smc);
2556
16
  smc_infiniband_handle = register_dissector("smc.infiniband", dissect_smcr_infiniband, proto_smc);
2557
16
}
2558
2559
void
2560
proto_reg_handoff_smcr(void)
2561
16
{
2562
16
  heur_dissector_add("tcp", dissect_smc_tcp_heur, "Shared Memory Communications over TCP", "smc_tcp", proto_smc, HEURISTIC_ENABLE);
2563
16
  heur_dissector_add("infiniband.payload", dissect_smcr_infiniband_heur, "Shared Memory Communications Infiniband", "smcr_infiniband", proto_smc, HEURISTIC_ENABLE);
2564
16
  dissector_add_for_decode_as("infiniband", smc_infiniband_handle);
2565
16
}
2566
2567
/*
2568
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
2569
 *
2570
 * Local variables:
2571
 * c-basic-offset: 8
2572
 * tab-width: 8
2573
 * indent-tabs-mode: t
2574
 * End:
2575
 *
2576
 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
2577
 * :indentSize=8:tabSize=8:noTabs=false:
2578
 */