Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-ncsi.c
blob7d382ac6cdb81de27ff773cb1d1fc78cfeb2c9cf
1 /* packet-ncsi.c
3 * Extends NCSI dissection based on DMTF Document Identifier: DSP0222 Version: 1.2.0_2b
4 * Copyright 2019-2021, Caleb Chiu <caleb.chiu@macnica.com>
6 * Routines for NCSI dissection
7 * Copyright 2017-2019, Jeremy Kerr <jk@ozlabs.org>
9 * Wireshark - Network traffic analyzer
10 * By Gerald Combs <gerald@wireshark.org>
11 * Copyright 1998 Gerald Combs
13 * SPDX-License-Identifier: GPL-2.0-or-later
17 * Network Controller Sideband Interface (NCSI) protocol support.
18 * Specs at http://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.0.1.pdf
22 #include <config.h>
24 #include <epan/packet.h>
25 #include <epan/etypes.h>
26 #include <epan/tfs.h>
27 #include <wsutil/array.h>
28 #include <epan/addr_resolv.h>
29 #include <epan/pci-ids.h>
30 #include <epan/charsets.h>
31 #include "packet-mctp.h"
33 void proto_reg_handoff_ncsi(void);
34 void proto_register_ncsi(void);
36 static int proto_ncsi;
37 static dissector_handle_t ncsi_handle;
39 /* Common header fields */
40 static int hf_ncsi_mc_id;
41 static int hf_ncsi_revision;
42 static int hf_ncsi_iid;
43 static int hf_ncsi_type;
44 static int hf_ncsi_type_code;
45 static int hf_ncsi_type_code_masked;
46 static int hf_ncsi_type_resp;
47 static int hf_ncsi_chan;
48 static int hf_ncsi_plen;
50 /* Decode the Package# and internal channel# */
51 static int hf_ncsi_pkg;
52 static int hf_ncsi_ichan;
54 /* Response generics */
55 static int hf_ncsi_resp;
56 static int hf_ncsi_reason;
58 /* Select package */
59 static int hf_ncsi_sp_hwarb;
61 /* Disable channel */
62 static int hf_ncsi_dc_ald;
64 /* AEN enable */
65 static int hf_ncsi_aene_mc;
67 /* Set MAC Address */
68 static int hf_ncsi_sm_mac;
69 static int hf_ncsi_sm_macno;
70 static int hf_ncsi_sm_at;
71 static int hf_ncsi_sm_e;
73 /* Broadcast filter */
74 static int hf_ncsi_bf;
75 static int hf_ncsi_bf_arp;
76 static int hf_ncsi_bf_dhcpc;
77 static int hf_ncsi_bf_dhcps;
78 static int hf_ncsi_bf_netbios;
80 /* AEN payload fields */
81 static int hf_ncsi_aen_type;
82 static int hf_ncsi_aen_lsc_oemstat;
83 static int hf_ncsi_aen_hcds;
84 static int hf_ncsi_aen_drr_orig_type;
85 static int hf_ncsi_aen_drr_orig_iid;
87 /* generic link status */
88 static int hf_ncsi_lstat;
89 static int hf_ncsi_lstat_flag;
90 static int hf_ncsi_lstat_speed_duplex;
91 static int hf_ncsi_lstat_autoneg;
92 static int hf_ncsi_lstat_autoneg_complete;
93 static int hf_ncsi_lstat_parallel_detection;
94 static int hf_ncsi_lstat_1000TFD;
95 static int hf_ncsi_lstat_1000THD;
96 static int hf_ncsi_lstat_100T4;
97 static int hf_ncsi_lstat_100TXFD;
98 static int hf_ncsi_lstat_100TXHD;
99 static int hf_ncsi_lstat_10TFD;
100 static int hf_ncsi_lstat_10THD;
101 static int hf_ncsi_lstat_tx_flow;
102 static int hf_ncsi_lstat_rx_flow;
103 static int hf_ncsi_lstat_partner_flow;
104 static int hf_ncsi_lstat_serdes;
105 static int hf_ncsi_lstat_oem_speed_valid;
107 /* Set Link command (0x09) */
108 static int hf_ncsi_ls;
109 static int hf_ncsi_ls_an;
110 static int hf_ncsi_ls_10m;
111 static int hf_ncsi_ls_100m;
112 static int hf_ncsi_ls_1g;
113 static int hf_ncsi_ls_10g;
114 static int hf_ncsi_ls_20g;
115 static int hf_ncsi_ls_25g;
116 static int hf_ncsi_ls_40g;
117 static int hf_ncsi_ls_hd;
118 static int hf_ncsi_ls_fd;
119 static int hf_ncsi_ls_pc;
120 static int hf_ncsi_ls_apc;
121 static int hf_ncsi_ls_50g;
122 static int hf_ncsi_ls_100g;
123 static int hf_ncsi_ls_2_5g;
124 static int hf_ncsi_ls_5g;
125 static int hf_ncsi_ls_rsv;
126 static int hf_ncsi_ls_oemls;
128 /*Get Capabilities*/
129 static int hf_ncsi_cap_flag; /* Offset 20..23 Capabilities Flags */
130 static int hf_ncsi_cap_flag_ha; /* bit 0 Hardware Arbitration */
131 static int hf_ncsi_cap_flag_op; /* bit 1 OS Presence */
132 static int hf_ncsi_cap_flag_n2mfc; /* bit 2 Network Controller to Management Controller Flow Control Support */
133 static int hf_ncsi_cap_flag_m2nfc; /* bit 3 Management Controller to Network Controller Flow Control Support */
134 static int hf_ncsi_cap_flag_ama; /* bit 4 All multicast addresses support */
136 static int hf_ncsi_cap_bf; /* Offset 24..27 Broadcast Packet Filter Capabilities, the variable names are align with Broadcast filter above */
137 static int hf_ncsi_cap_bf_arp;
138 static int hf_ncsi_cap_bf_dhcpc;
139 static int hf_ncsi_cap_bf_dhcps;
140 static int hf_ncsi_cap_bf_netbios;
142 static int hf_ncsi_cap_mf; /* Offset 28..31 Multicast Packet Filter Capabilities */
143 static int hf_ncsi_cap_mf_v6na;
144 static int hf_ncsi_cap_mf_v6ra;
145 static int hf_ncsi_cap_mf_dhcpv6;
147 static int hf_ncsi_cap_buf; /* Offset 32..35 Buffering Capability */
149 static int hf_ncsi_cap_aen; /* Offset 36..39 AEN Control Support */
150 static int hf_ncsi_cap_aen_lstat; /* bit 0 Link Status Change AEN control */
151 static int hf_ncsi_cap_aen_cfg; /* bit 1 Configuration Required AEN control */
152 static int hf_ncsi_cap_aen_drv; /* bit 2 Host NC Driver Status Change AEN control */
153 static int hf_ncsi_cap_aen_resv; /* bit 3..15 Reserved Reserved */
154 static int hf_ncsi_cap_aen_oem; /* bit 16..31 OEM-specific AEN control OEM */
156 static int hf_ncsi_cap_vcnt; /* VLAN Filter Count */
157 static int hf_ncsi_cap_mixcnt; /* Mixed Filter Count */
158 static int hf_ncsi_cap_mccnt; /* Multicast Filter Count */
159 static int hf_ncsi_cap_uccnt; /* Unicast Filter Count */
161 static int hf_ncsi_cap_vmode; /* VLAN Mode Support */
162 static int hf_ncsi_cap_vmode_vo; /* bit 0 VLAN only */
163 static int hf_ncsi_cap_vmode_both; /* bit 1 VLAN + non-VLAN */
164 static int hf_ncsi_cap_vmode_any; /* bit 2 Any VLAN + non-VLAN */
165 static int hf_ncsi_cap_chcnt; /* Channel Count */
167 /*Get Version ID*/
168 static int hf_ncsi_ver;
169 static int hf_ncsi_fw_name;
170 static int hf_ncsi_fw_ver;
171 static int hf_ncsi_pci_did;
172 static int hf_ncsi_pci_vid;
173 static int hf_ncsi_pci_ssid;
174 static int hf_ncsi_iana;
176 /* OEM ID */
177 static int hf_ncsi_oem_id;
178 /* OEM Mellanox Command, Parameter, Host number */
179 static int hf_ncsi_mlnx_cmd;
180 static int hf_ncsi_mlnx_parm;
181 static int hf_ncsi_mlnx_host;
182 /* OEM Mellanox Set MC Affinity (Command = 0x1, parameter 0x7) */
183 static int hf_ncsi_mlnx_rbt; /* MC RBT address */
184 static int hf_ncsi_mlnx_sms; /* Supported Medias Status */
185 static int hf_ncsi_mlnx_sms_rbt;
186 static int hf_ncsi_mlnx_sms_smbus;
187 static int hf_ncsi_mlnx_sms_pcie;
188 static int hf_ncsi_mlnx_sms_rbts;
189 static int hf_ncsi_mlnx_sms_smbuss;
190 static int hf_ncsi_mlnx_sms_pcies;
192 static int hf_ncsi_mlnx_beid; /* MC SMBus EID */
193 static int hf_ncsi_mlnx_bidx; /* SMBus INDX */
194 static int hf_ncsi_mlnx_baddr; /* MC SMBus Address */
195 static int hf_ncsi_mlnx_peid; /* MC PCIe EID */
196 static int hf_ncsi_mlnx_pidx; /* PCIe INDX */
197 static int hf_ncsi_mlnx_paddr; /* MC PCIe Address */
198 static int hf_ncsi_mlnx_ifm; /* IP Filter Mode */
199 static int hf_ncsi_mlnx_ifm_byip; /* Bits 1-0 - Filter by IP Address */
200 static int hf_ncsi_mlnx_ifm_v4en; /* Bit 2 - IPv4 Enable */
201 static int hf_ncsi_mlnx_ifm_v6len; /* Bit 3 - IPv6 Link Local Address Enable */
202 static int hf_ncsi_mlnx_ifm_v6gen; /* Bit 4 - IPv6 Global Address Enable */
203 static int hf_ncsi_mlnx_v4addr; /* MC IPv4 Address */
204 static int hf_ncsi_mlnx_v6local; /* MC IPv6 Link Local Address */
205 static int hf_ncsi_mlnx_v6gbl; /* MC IPv6 Global Address */
207 /* Get Allocated Management Address (Command = 0x0, Parameter 0x1B) */
208 static int hf_ncsi_mlnx_gama_st; /*Get Allocated Management Address Status */
209 static int hf_ncsi_mlnx_gama_mac; /*Allocated MC MAC address */
211 /* Get Temperature (Command = 0x13, Parameter = 0x2) */
212 static int hf_ncsi_mlnx_gtemp_index; /*Sensor index */
213 static int hf_ncsi_mlnx_gtemp_sp; /*ST */
214 static int hf_ncsi_mlnx_gtemp_sindex; /*Sensor index */
215 static int hf_ncsi_mlnx_gtemp_pad_mms;
216 static int hf_ncsi_mlnx_gtemp_pad;
217 static int hf_ncsi_mlnx_gtemp_mms;
218 static int hf_ncsi_mlnx_temp1;
219 static int hf_ncsi_mlnx_temp2;
220 static int hf_ncsi_mlnx_temp3;
223 static int ett_ncsi;
224 static int ett_ncsi_type;
225 static int ett_ncsi_chan;
226 static int ett_ncsi_payload;
227 static int ett_ncsi_lstat;
228 static int ett_ncsi_cap_flag;
229 static int ett_ncsi_cap_bf;
230 static int ett_ncsi_cap_mf;
231 static int ett_ncsi_cap_aen;
232 static int ett_ncsi_cap_vmode;
233 static int ett_ncsi_ls;
234 static int ett_ncsi_mlnx;
235 static int ett_ncsi_mlnx_sms;
236 static int ett_ncsi_mlnx_ifm;
237 static int ett_ncsi_mlnx_gtemp;
239 #define NCSI_MIN_LENGTH 8
241 /* DMTF Document Identifier: DSP0222 Version: 1.2.0_2b */
242 enum ncsi_type {
243 NCSI_TYPE_CLS = 0x00, /* Clear Initial State */
244 NCSI_TYPE_SEL = 0x01, /* Select Package */
245 NCSI_TYPE_DSL = 0x02, /* Deselect Package */
246 NCSI_TYPE_ECH = 0x03, /* Enable Channel */
247 NCSI_TYPE_DCH = 0x04, /* Disable Channel */
248 NCSI_TYPE_RCH = 0x05, /* Reset Channel */
249 NCSI_TYPE_ETX = 0x06, /* Enable Channel Network TX */
250 NCSI_TYPE_DTX = 0x07, /* Disable Channel Network TX */
251 NCSI_TYPE_ANE = 0x08, /* AEN Enable */
252 NCSI_TYPE_SLK = 0x09, /* Set Link */
253 NCSI_TYPE_GLS = 0x0a, /* Get Link Status */
254 NCSI_TYPE_SVF = 0x0b, /* Set VLAN Filter */
255 NCSI_TYPE_EVL = 0x0c, /* Enable VLAN */
256 NCSI_TYPE_DVL = 0x0d, /* Disable VLAN */
257 NCSI_TYPE_MAC = 0x0e, /* Set MAC Address */
258 NCSI_TYPE_EBF = 0x10, /* Enable Broadcast Filter */
259 NCSI_TYPE_DBF = 0x11, /* Disable Broadcast Filter */
260 NCSI_TYPE_EMF = 0x12, /* Enable Global Multicast Filter */
261 NCSI_TYPE_DMF = 0x13, /* Disable Global Multicast Filter */
262 NCSI_TYPE_SFC = 0x14, /* Set NC-SI Flow Control */
263 NCSI_TYPE_VER = 0x15, /* Get Version ID */
264 NCSI_TYPE_CAP = 0x16, /* Get Capabilities */
265 NCSI_TYPE_PAR = 0x17, /* Get Parameters */
266 NCSI_TYPE_CPS = 0x18, /* Get Controller Packet Statistics */
267 NCSI_TYPE_GST = 0x19, /* Get NC-SI Statistics */
268 NCSI_TYPE_PST = 0x1a, /* Get NC-SI Pass- through Statistics */
269 NCSI_TYPE_GPS = 0x1b, /* Get Package Status */
270 NCSI_TYPE_GPA = 0x1c, /* Get PF Assignment */
271 NCSI_TYPE_SPA = 0x1d, /* Set PF Assignment */
272 NCSI_TYPE_GBC = 0x1e, /* Get Boot Config */
273 NCSI_TYPE_SBC = 0x1f, /* Set Boot Config */
274 NCSI_TYPE_IOS = 0x20, /* Get iSCSI Offload Statistics */
275 NCSI_TYPE_GPB = 0x21, /* Get Partition TX Bandwidth */
276 NCSI_TYPE_SPB = 0x22, /* Set Partition TX Bandwidth */
277 NCSI_TYPE_GIT = 0x23, /* Get ASIC Temperature */
278 NCSI_TYPE_GAT = 0x24, /* Get Ambient Temperature */
279 NCSI_TYPE_GMT = 0x25, /* Get SFF Module Temp */
280 NCSI_TYPE_OEM = 0x50, /* OEM Command */
281 NCSI_TYPE_PLDM = 0x51, /* PLDM */
282 NCSI_TYPE_UUID = 0x52, /* Get Package UUID */
283 NCSI_TYPE_AEN = 0xff,
287 enum ncsi_oem_id {
288 NCSI_OEM_MLX = 0x8119,
289 NCSI_OEM_BCM = 0x113d,
292 static const value_string ncsi_resp_code_vals[] = {
293 { 0x0000, "Command Completed" },
294 { 0x0001, "Command Failed" },
295 { 0x0002, "Command Unavailable" },
296 { 0x0003, "Command Unsupported" },
297 { 0x0004, "Delayed" },
298 { 0, NULL },
301 static const value_string ncsi_resp_reason_vals[] = {
302 { 0x0000, "No Error/No Reason Code" },
303 { 0x0001, "Interface Initialization Required" },
304 { 0x0002, "Parameter Is Invalid, Unsupported, or Out-of-Range" },
305 { 0x0003, "Channel Not Ready" },
306 { 0x0004, "Package Not Ready" },
307 { 0x0005, "Invalid payload length" },
308 { 0x0006, "Information not available" },
309 { 0x0901, "Set Link Host OS/ Driver Conflict" },
310 { 0x0902, "Set Link Media Conflict" },
311 { 0x0903, "Set Link Parameter Conflict" },
312 { 0x0904, "Set Link Power Mode Conflict" },
313 { 0x0905, "Set Link Speed Conflict" },
314 { 0x0906, "Link Command Failed-Hardware Access Error" },
315 { 0x0a06, "Link Command Failed-Hardware Access Error" },
316 { 0x0b07, "VLAN Tag Is Invalid"},
317 { 0x0e08, "MAC Address Is Zero"},
318 { 0x1409, "Independent transmit and receive enable/disable control is not supported"},
319 { 0x800c, "Link Command Failed-Hardware Access Error"},
320 { 0, NULL },
325 static const value_string ncsi_type_vals[] = {
326 { NCSI_TYPE_CLS, "Clear Initial State" },
327 { NCSI_TYPE_SEL, "Select Package" },
328 { NCSI_TYPE_DSL, "Deselect Package" },
329 { NCSI_TYPE_ECH, "Enable Channel" },
330 { NCSI_TYPE_DCH, "Disable Channel" },
331 { NCSI_TYPE_RCH, "Reset Channel" },
332 { NCSI_TYPE_ETX, "Enable Channel Network TX" },
333 { NCSI_TYPE_DTX, "Disable Channel Network TX" },
334 { NCSI_TYPE_ANE, "AEN Enable" },
335 { NCSI_TYPE_SLK, "Set Link" },
336 { NCSI_TYPE_GLS, "Get Link Status" },
337 { NCSI_TYPE_SVF, "Set VLAN Filter" },
338 { NCSI_TYPE_EVL, "Enable VLAN" },
339 { NCSI_TYPE_DVL, "Disable VLAN" },
340 { NCSI_TYPE_MAC, "Set MAC Address" },
341 { NCSI_TYPE_EBF, "Enable Broadcast Filter" },
342 { NCSI_TYPE_DBF, "Disable Broadcast Filter" },
343 { NCSI_TYPE_EMF, "Enable Global Multicast Filter" },
344 { NCSI_TYPE_DMF, "Disable Global Multicast Filter" },
345 { NCSI_TYPE_SFC, "Set NC-SI Flow Control" },
346 { NCSI_TYPE_VER, "Get Version ID" },
347 { NCSI_TYPE_CAP, "Get Capabilities" },
348 { NCSI_TYPE_PAR, "Get Parameters" },
349 { NCSI_TYPE_CPS, "Get Controller Packet Statistics" },
350 { NCSI_TYPE_GST, "Get NC-SI Statistics" },
351 { NCSI_TYPE_PST, "Get NC-SI Pass- through Statistics" },
352 { NCSI_TYPE_GPS, "Get Package Status" },
353 { NCSI_TYPE_GPA, "Get PF Assignment" },
354 { NCSI_TYPE_SPA, "Set PF Assignment" },
355 { NCSI_TYPE_GBC, "Get Boot Config" },
356 { NCSI_TYPE_SBC, "Set Boot Config" },
357 { NCSI_TYPE_IOS, "Get iSCSI Offload Statistics" },
358 { NCSI_TYPE_GPB, "Get Partition TX Bandwidth" },
359 { NCSI_TYPE_SPB, "Set Partition TX Bandwidth" },
360 { NCSI_TYPE_GIT, "Get ASIC Temperature" },
361 { NCSI_TYPE_GAT, "Get Ambient Temperature" },
362 { NCSI_TYPE_GMT, "Get SFF Module Temp" },
363 { NCSI_TYPE_OEM, "OEM Command" },
364 { NCSI_TYPE_PLDM, "PLDM" },
365 { NCSI_TYPE_UUID, "Get Package UUID" },
366 { NCSI_TYPE_AEN, "Async Event Notification" },
367 { 0, NULL },
370 static const value_string ncsi_oem_id_vals[] = {
371 { NCSI_OEM_MLX, "Mellanox" },
372 { NCSI_OEM_BCM, "Broadcom" },
373 { 0, NULL },
376 static const value_string ncsi_type_resp_vals[] = {
377 { 0x00, "request" },
378 { 0x01, "response" },
379 { 0, NULL },
382 static const value_string ncsi_aen_type_vals[] = {
383 { 0x00, "Link status change" },
384 { 0x01, "Configuration required" },
385 { 0x02, "Host NC driver status change" },
386 { 0x03, "Delayed Response Ready" },
387 { 0, NULL },
390 static const true_false_string tfs_linkup_linkdown = { "Link up", "Link down" };
392 static const value_string ncsi_lstat_speed_duplex_vals[] = {
393 { 0x00, "Auto-negotiate not complete" },
394 { 0x01, "10BaseT half duplex" },
395 { 0x02, "10BaseT full duplex" },
396 { 0x03, "100BaseT half duplex" },
397 { 0x04, "100BaseT4" },
398 { 0x05, "100BaseTX full duplex" },
399 { 0x06, "1000BaseT half duplex" },
400 { 0x07, "1000BaseT full duplex" },
401 { 0x08, "10GBaseT support" },
402 { 0, NULL },
405 /* Mellanox MC IP Filter Mode */
406 static const value_string ncsi_mlnx_ifm_byip_vals[] = {
407 { 0x00, "MAC address is used and IP address is ignored on pass-through" },
408 { 0x01, "MAC address is used and IP address is used on pass-through" },
409 { 0x02, "MAC address is ignored and IP address is used on pass-through" },
410 { 0x03, "Reserved" },
411 { 0, NULL },
414 static const true_false_string tfs_complete_disable_inprog = { "Complete", "Disabled/In-progress" };
416 static const value_string ncsi_partner_flow_vals[] = {
417 { 0x00, "Not pause capable" },
418 { 0x01, "Symmetric pause" },
419 { 0x02, "Asymmetric pause" },
420 { 0x03, "Symmetric & Asymmetric pause" },
421 { 0, NULL },
425 static const value_string ncsi_mlnx_gama_st_vals[] = {
426 { 0x00, "No MAC address was allocated for the requested BMC channel" },
427 { 0x01, "An address was allocated for the requested BMC channel" },
428 { 0, NULL },
431 static const true_false_string tfs_running_not_running = { "Running", "Not running" };
433 static const value_string ncsi_sm_at_vals[] = {
434 { 0x00, "unicast" },
435 { 0x01, "multicast" },
436 { 0, NULL },
439 static const value_string ncsi_bf_filter_vals[] = {
440 { 0x00, "drop" },
441 { 0x01, "forward" },
442 { 0, NULL },
445 static const value_string ncsi_mlnx_gtemp_sp_vals[] = {
446 { 0x00, "Select system and on-chip sensor" },
447 { 0x01, "Select Port sensor" },
448 { 0, NULL },
452 static void
453 ncsi_proto_tree_add_lstat(tvbuff_t *tvb, proto_tree *tree, int offset)
455 static int * const lstat_fields[] = {
456 &hf_ncsi_lstat_flag,
457 &hf_ncsi_lstat_speed_duplex,
458 &hf_ncsi_lstat_autoneg,
459 &hf_ncsi_lstat_autoneg_complete,
460 &hf_ncsi_lstat_parallel_detection,
461 &hf_ncsi_lstat_1000TFD,
462 &hf_ncsi_lstat_1000THD,
463 &hf_ncsi_lstat_100T4,
464 &hf_ncsi_lstat_100TXFD,
465 &hf_ncsi_lstat_100TXHD,
466 &hf_ncsi_lstat_10TFD,
467 &hf_ncsi_lstat_10THD,
468 &hf_ncsi_lstat_tx_flow,
469 &hf_ncsi_lstat_rx_flow,
470 &hf_ncsi_lstat_partner_flow,
471 &hf_ncsi_lstat_serdes,
472 &hf_ncsi_lstat_oem_speed_valid,
473 NULL,
476 proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_ncsi_lstat,
477 ett_ncsi_lstat, lstat_fields, ENC_BIG_ENDIAN, BMT_NO_APPEND);
480 static void
481 dissect_ncsi_aen(tvbuff_t *tvb, proto_tree *tree)
483 uint8_t type = tvb_get_uint8(tvb, 19);
484 proto_item *pi;
486 pi = proto_tree_add_item(tree, hf_ncsi_aen_type, tvb, 19, 1, ENC_NA);
488 if(type >= 0x4 && type <= 0x6f)
490 proto_item_set_text(pi, "Reserved (0x%02x)", type);
492 else
493 if(type >= 0x70 && type <= 0x7f)
495 proto_item_set_text(pi, "Transport-specific AENs (0x%02x)", type);
497 else
498 if(type >= 0x80)
500 proto_item_set_text(pi, "OEM-specific AENs (0x%02x)", type);
503 switch (type) {
504 case 0x00: //Link Status Change
505 ncsi_proto_tree_add_lstat(tvb, tree, 20);
506 proto_tree_add_item(tree, hf_ncsi_aen_lsc_oemstat, tvb, 24, 4, ENC_NA);
507 break;
508 case 0x02: //Host Network Controller Driver Status
509 proto_tree_add_item(tree, hf_ncsi_aen_hcds, tvb, 20, 4, ENC_NA);
510 break;
511 case 0x03: //Delayed Response Ready
512 proto_tree_add_item(tree, hf_ncsi_aen_drr_orig_type, tvb, 20, 1, ENC_NA);
513 proto_tree_add_item(tree, hf_ncsi_aen_drr_orig_iid, tvb, 21, 1, ENC_NA);
515 break;
521 /* NC-SI Version encoding
523 * EXAMPLE: Version 3.7.10a ï‚® 0xF3F7104100
524 * Version 10.01.7 ï‚® 0x1001F70000
525 * Version 3.1 ï‚® 0xF3F1FF0000
526 * Version 1.0a ï‚® 0xF1F0FF4100
527 * Version 1.0ab ï‚® 0xF1F0FF4142 (Alpha1 = 0x41, Alpha2 = 0x42)
530 #define HEXSTR(x) (((x) < 10)? '0' + (x): 'A' + ((x) - 10))
532 static const char *
533 ncsi_bcd_dig_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, const int offset)
535 uint8_t octet;
536 int i;
537 char digit_str[16]; /* MM.mm.uu.aa.bb */
538 int str_offset = 0;
540 for (i = 0 ; i < 3; i++) {
541 octet = tvb_get_uint8(tvb, offset + i);
543 if (octet == 0xff) {
544 break;
547 if (i != 0) {
548 digit_str[str_offset++] = '.';
551 digit_str[str_offset++] = HEXSTR((octet >> 4) & 0x0f);
552 digit_str[str_offset++] = HEXSTR(octet & 0x0f);
556 octet = tvb_get_uint8(tvb, offset + 3);
557 if (octet) {
558 digit_str[str_offset++] = '.';
559 digit_str[str_offset++] = octet;
561 octet = tvb_get_uint8(tvb, offset + 7);
562 if (octet) {
563 digit_str[str_offset++] = '.';
564 digit_str[str_offset++] = octet;
569 digit_str[str_offset] = '\0';
570 return get_utf_8_string(scope, digit_str, (int)strlen(digit_str));
575 static const char *
576 ncsi_fw_version(wmem_allocator_t *scope, tvbuff_t *tvb, const int offset)
578 int length = 16; /* hh.hh.hh.hh */
579 uint8_t octet;
580 int i;
581 char *ver_str;
582 int str_offset = 0;
585 ver_str = (char *)wmem_alloc(scope, length);
587 for (i = 0 ; i < 4; i++) {
588 octet = tvb_get_uint8(tvb, offset + i);
590 if (i != 0) {
591 ver_str[str_offset++] = '.';
594 ver_str[str_offset++] = HEXSTR((octet >> 4) & 0x0f);
595 ver_str[str_offset++] = HEXSTR(octet & 0x0f);
598 ver_str[str_offset++] = 0;
599 return ver_str;
603 static void
604 ncsi_proto_tree_add_cap(tvbuff_t *tvb, proto_tree *tree, int offset)
606 static int * const cap_fields[] = {
607 &hf_ncsi_cap_flag_ha,
608 &hf_ncsi_cap_flag_op,
609 &hf_ncsi_cap_flag_n2mfc,
610 &hf_ncsi_cap_flag_m2nfc,
611 &hf_ncsi_cap_flag_ama,
612 NULL,
615 static int * const cap_bf_fields[] = {
616 &hf_ncsi_cap_bf_arp,
617 &hf_ncsi_cap_bf_dhcpc,
618 &hf_ncsi_cap_bf_dhcps,
619 &hf_ncsi_cap_bf_netbios,
620 NULL,
623 static int * const cap_mf_fields[] = {
624 &hf_ncsi_cap_mf_v6na,
625 &hf_ncsi_cap_mf_v6ra,
626 &hf_ncsi_cap_mf_dhcpv6,
627 NULL,
630 static int * const cap_aen_fields[] = {
631 &hf_ncsi_cap_aen_lstat,
632 &hf_ncsi_cap_aen_cfg,
633 &hf_ncsi_cap_aen_drv,
634 &hf_ncsi_cap_aen_resv,
635 &hf_ncsi_cap_aen_oem,
636 NULL,
639 static int * const cap_vmode_fields[] = {
640 &hf_ncsi_cap_vmode_vo,
641 &hf_ncsi_cap_vmode_both,
642 &hf_ncsi_cap_vmode_any,
643 NULL,
646 proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_ncsi_cap_flag,
647 ett_ncsi_cap_flag, cap_fields, ENC_BIG_ENDIAN, BMT_NO_APPEND);
649 proto_tree_add_bitmask_with_flags(tree, tvb, offset += 4, hf_ncsi_cap_bf,
650 ett_ncsi_cap_bf, cap_bf_fields, ENC_BIG_ENDIAN, BMT_NO_APPEND);
652 proto_tree_add_bitmask_with_flags(tree, tvb, offset += 4, hf_ncsi_cap_mf,
653 ett_ncsi_cap_mf, cap_mf_fields, ENC_BIG_ENDIAN, BMT_NO_APPEND);
655 proto_tree_add_item(tree, hf_ncsi_cap_buf, tvb, offset += 4, 4, ENC_NA);
657 proto_tree_add_bitmask_with_flags(tree, tvb, offset += 4, hf_ncsi_cap_aen,
658 ett_ncsi_cap_aen, cap_aen_fields, ENC_BIG_ENDIAN, BMT_NO_APPEND);
660 proto_tree_add_item(tree, hf_ncsi_cap_vcnt, tvb, offset += 4, 1, ENC_NA);
661 proto_tree_add_item(tree, hf_ncsi_cap_mixcnt, tvb, offset += 1, 1, ENC_NA);
662 proto_tree_add_item(tree, hf_ncsi_cap_mccnt, tvb, offset += 1, 1, ENC_NA);
663 proto_tree_add_item(tree, hf_ncsi_cap_uccnt, tvb, offset += 1, 1, ENC_NA);
664 proto_tree_add_bitmask_with_flags(tree, tvb, offset += 3, hf_ncsi_cap_vmode,
665 ett_ncsi_cap_vmode, cap_vmode_fields, ENC_BIG_ENDIAN, BMT_NO_APPEND);
666 proto_tree_add_item(tree, hf_ncsi_cap_chcnt, tvb, offset, 1, ENC_NA);
671 static void
672 ncsi_proto_tree_add_setlink(tvbuff_t *tvb, proto_tree *tree, int offset)
675 static int * const ls_fields[] = {
676 &hf_ncsi_ls_an,
677 &hf_ncsi_ls_10m,
678 &hf_ncsi_ls_100m,
679 &hf_ncsi_ls_1g,
680 &hf_ncsi_ls_10g,
681 &hf_ncsi_ls_20g,
682 &hf_ncsi_ls_25g,
683 &hf_ncsi_ls_40g,
684 &hf_ncsi_ls_hd,
685 &hf_ncsi_ls_fd,
686 &hf_ncsi_ls_pc,
687 &hf_ncsi_ls_apc,
688 &hf_ncsi_ls_50g,
689 &hf_ncsi_ls_100g,
690 &hf_ncsi_ls_2_5g,
691 &hf_ncsi_ls_5g,
692 &hf_ncsi_ls_rsv,
693 NULL,
698 proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_ncsi_ls,
699 ett_ncsi_ls, ls_fields, ENC_BIG_ENDIAN, BMT_NO_APPEND);
701 proto_tree_add_item(tree, hf_ncsi_ls_oemls, tvb, offset + 4, 4, ENC_NA);
706 /* Code to actually dissect the packets */
707 static int
708 dissect_ncsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
709 void *data _U_)
711 proto_tree *ncsi_tree, *ncsi_payload_tree;
712 proto_item *ti, *pti;
713 uint8_t type, plen, poffset;
714 uint32_t resp_code, reason_code;
716 static int * const type_masked_fields[] = {
717 &hf_ncsi_type_code_masked,
718 &hf_ncsi_type_resp,
719 NULL,
722 static int * const chan_fields[] = {
723 &hf_ncsi_pkg,
724 &hf_ncsi_ichan,
725 NULL,
728 /* Check that the packet is long enough for it to belong to us. */
729 if (tvb_reported_length(tvb) < NCSI_MIN_LENGTH)
730 return 0;
733 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NCSI");
735 type = tvb_get_uint8(tvb, 4);
736 plen = tvb_get_uint8(tvb, 7);
738 col_clear(pinfo->cinfo, COL_INFO);
739 if (type == 0xff) {
740 col_add_fstr(pinfo->cinfo, COL_INFO,
741 "Async Event Notification, chan 0x%02x",
742 tvb_get_uint8(tvb, 5));
743 } else {
744 col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s, id 0x%02x, chan 0x%02x",
745 val_to_str(type & 0x7f, ncsi_type_vals, "Unknown type 0x%02x"),
746 type & 0x80 ? "response" : "request ",
747 tvb_get_uint8(tvb, 3),
748 tvb_get_uint8(tvb, 5));
752 /* Top-level NCSI protocol item & tree */
753 ti = proto_tree_add_item(tree, proto_ncsi, tvb, 0, -1, ENC_NA);
754 ncsi_tree = proto_item_add_subtree(ti, ett_ncsi);
755 /* Standard header fields */
756 proto_tree_add_item(ncsi_tree, hf_ncsi_mc_id, tvb, 0, 1, ENC_NA);
757 proto_tree_add_item(ncsi_tree, hf_ncsi_revision, tvb, 1, 1, ENC_NA);
758 proto_tree_add_item(ncsi_tree, hf_ncsi_iid, tvb, 3, 1, ENC_NA);
759 if (type == NCSI_TYPE_AEN)
760 proto_tree_add_uint(ncsi_tree, hf_ncsi_type_code, tvb, 4, 1, type);
761 else
762 proto_tree_add_bitmask(ncsi_tree, tvb, 4, hf_ncsi_type,
763 ett_ncsi_type, type_masked_fields, ENC_NA);
764 /* Package# and internal channel id */
765 proto_tree_add_bitmask(ncsi_tree, tvb, 5, hf_ncsi_chan,
766 ett_ncsi_chan, chan_fields, ENC_NA);
767 proto_tree_add_item(ncsi_tree, hf_ncsi_plen, tvb, 7, 1, ENC_NA);
768 if (!plen)
769 return 16;
771 /* Payload tree */
772 ncsi_payload_tree = proto_tree_add_subtree(ncsi_tree, tvb, 16,
773 plen, ett_ncsi_payload, &pti, "Payload");
775 /* All responses start with response code & reason data */
776 resp_code = 0;
777 reason_code = 0;
778 if (type != 0xff && type & 0x80) {
779 proto_tree_add_item_ret_uint(ncsi_payload_tree, hf_ncsi_resp, tvb,
780 16, 2, ENC_NA, &resp_code);
781 proto_tree_add_item_ret_uint(ncsi_payload_tree, hf_ncsi_reason, tvb,
782 18, 2, ENC_NA, &reason_code);
785 if (type == NCSI_TYPE_AEN) {
786 proto_item_set_text(pti, "Async Event Notification");
787 } else {
788 proto_item_set_text(pti,"%s", val_to_str((type & 0x7f), ncsi_type_vals, "Unknown type 0x%02x"));
789 proto_item_append_text(pti, type & 0x80 ? " response" : " request");
792 switch (type) {
793 case 0x01:
794 proto_tree_add_item(ncsi_payload_tree, hf_ncsi_sp_hwarb, tvb,
795 19, 1, ENC_NA);
796 break;
797 case 0x04:
798 proto_tree_add_item(ncsi_payload_tree, hf_ncsi_dc_ald, tvb,
799 19, 1, ENC_NA);
800 break;
801 case 0x08:
802 proto_tree_add_item(ncsi_payload_tree, hf_ncsi_aene_mc, tvb,
803 19, 1, ENC_NA);
804 break;
806 case 0x09:
807 ncsi_proto_tree_add_setlink(tvb, ncsi_payload_tree, 16);
808 break;
810 case 0x0e:
811 proto_tree_add_item(ncsi_payload_tree, hf_ncsi_sm_mac, tvb,
812 16, 6, ENC_NA);
813 proto_tree_add_item(ncsi_payload_tree, hf_ncsi_sm_macno, tvb,
814 22, 1, ENC_NA);
815 proto_tree_add_item(ncsi_payload_tree, hf_ncsi_sm_at, tvb,
816 23, 1, ENC_NA);
817 proto_tree_add_item(ncsi_payload_tree, hf_ncsi_sm_e, tvb,
818 23, 1, ENC_NA);
819 break;
820 case 0x10:
821 proto_tree_add_item(ncsi_payload_tree, hf_ncsi_bf, tvb,
822 16, 4, ENC_NA);
823 proto_tree_add_item(ncsi_payload_tree, hf_ncsi_bf_arp, tvb,
824 16, 4, ENC_NA);
825 proto_tree_add_item(ncsi_payload_tree, hf_ncsi_bf_dhcpc, tvb,
826 16, 4, ENC_NA);
827 proto_tree_add_item(ncsi_payload_tree, hf_ncsi_bf_dhcps, tvb,
828 16, 4, ENC_NA);
829 proto_tree_add_item(ncsi_payload_tree, hf_ncsi_bf_netbios, tvb,
830 16, 4, ENC_NA);
831 break;
832 case NCSI_TYPE_OEM:
833 case NCSI_TYPE_OEM | 0x80:
834 poffset = 0;
835 if (type == (NCSI_TYPE_OEM | 0x80)) {
836 poffset = 4;
839 proto_tree_add_item(ncsi_payload_tree, hf_ncsi_oem_id, tvb,
840 16 + poffset, 4, ENC_NA);
842 if (tvb_get_uint32(tvb, 16 + poffset, ENC_BIG_ENDIAN) == NCSI_OEM_MLX) {
843 proto_item *opti;
844 proto_tree *oem_payload_tree;
845 unsigned mlnx_cmd, mlnx_param;
847 /* Mellanox OEM command */
848 static int * const mlx_gtemp_fields[] = {
849 &hf_ncsi_mlnx_gtemp_sp,
850 &hf_ncsi_mlnx_gtemp_sindex,
851 NULL,
854 mlnx_cmd = tvb_get_uint8(tvb, 16 + poffset + 5);
855 mlnx_param = tvb_get_uint8(tvb, 16 + poffset + 6);
856 /* OEM payload tree */
857 oem_payload_tree = proto_tree_add_subtree(ncsi_payload_tree, tvb, 16 + poffset + 4, plen - poffset - 4, ett_ncsi_mlnx, &opti, "Mellanox OEM");
859 proto_tree_add_item(oem_payload_tree, hf_ncsi_mlnx_cmd, tvb, 16 + poffset + 5, 1, ENC_NA);
860 proto_tree_add_item(oem_payload_tree, hf_ncsi_mlnx_parm, tvb, 16 + poffset + 6, 1, ENC_NA);
863 if (type == (NCSI_TYPE_OEM | 0x80)) { /* Reply */
865 static int * const mlx_gtemp_pad_fields[] = {
866 &hf_ncsi_mlnx_gtemp_pad,
867 &hf_ncsi_mlnx_gtemp_mms,
868 NULL,
871 if (mlnx_cmd == 0x0 && mlnx_param == 0x1b) { /* Get Allocated Management Address (Command = 0x0, Parameter 0x1B) */
872 proto_tree_add_item(oem_payload_tree, hf_ncsi_mlnx_host, tvb, 16 + poffset + 7, 1, ENC_NA);
873 proto_item_set_text(opti, "Get Allocated Management Address reply");
874 proto_tree_add_item(oem_payload_tree, hf_ncsi_mlnx_gama_st, tvb, 28, 1, ENC_NA);
875 proto_tree_add_item(oem_payload_tree, hf_ncsi_mlnx_gama_mac, tvb, 32, 6, ENC_NA);
876 } else if (mlnx_cmd == 0x1 && mlnx_param == 0x7) { /* Set MC Affinity (Command = 0x1, parameter 0x7) */
877 proto_item_set_text(opti, "Set MC Affinity reply");
878 } else if (mlnx_cmd == 0x13 && mlnx_param == 0x2){ /* Get Temperature (Command = 0x13, parameter 0x2) */
879 proto_item_set_text(opti, "Get Temperature reply");
880 proto_tree_add_bitmask(oem_payload_tree, tvb, 16 + poffset + 7, hf_ncsi_mlnx_gtemp_index, ett_ncsi_mlnx, mlx_gtemp_fields, ENC_NA);
881 proto_tree_add_bitmask(oem_payload_tree, tvb, 16 + poffset + 8, hf_ncsi_mlnx_gtemp_pad_mms, ett_ncsi_mlnx, mlx_gtemp_pad_fields, ENC_NA);
882 if(resp_code ==0 && reason_code == 0) {
883 proto_tree_add_item(oem_payload_tree, hf_ncsi_mlnx_temp1, tvb, 16 + poffset + 9, 1, ENC_NA);
884 proto_tree_add_item(oem_payload_tree, hf_ncsi_mlnx_temp2, tvb, 16 + poffset + 10, 1, ENC_NA);
885 proto_tree_add_item(oem_payload_tree, hf_ncsi_mlnx_temp3, tvb, 16 + poffset + 11, 1, ENC_NA);
887 } else {
888 proto_item_set_text(opti, "Unknown OEM reply");
890 break;
893 /* Request */
895 if (mlnx_cmd == 0x0 && mlnx_param == 0x1b) { /* Get Allocated Management Address (Command = 0x0, Parameter 0x1B) */
896 proto_item_set_text(opti, "Get Allocated Management Address request");
897 } else if (mlnx_cmd == 0x1 && mlnx_param == 0x7) { /* Set MC Affinity (Command = 0x1, parameter 0x7) */
898 static int * const mlnx_sms_fields[] = {
899 &hf_ncsi_mlnx_sms_rbt,
900 &hf_ncsi_mlnx_sms_smbus,
901 &hf_ncsi_mlnx_sms_pcie,
902 &hf_ncsi_mlnx_sms_rbts,
903 &hf_ncsi_mlnx_sms_smbuss,
904 &hf_ncsi_mlnx_sms_pcies,
905 NULL,
908 static int * const mlnx_ifm_fields[] = {
909 &hf_ncsi_mlnx_ifm_byip,
910 &hf_ncsi_mlnx_ifm_v4en,
911 &hf_ncsi_mlnx_ifm_v6len,
912 &hf_ncsi_mlnx_ifm_v6gen,
913 NULL,
916 proto_item_set_text(opti, "Set MC Affinity request");
917 proto_tree_add_item(oem_payload_tree, hf_ncsi_mlnx_rbt, tvb, 24, 6, ENC_NA);
918 proto_tree_add_bitmask_with_flags(oem_payload_tree, tvb, 30, hf_ncsi_mlnx_sms, ett_ncsi_mlnx_sms, mlnx_sms_fields, ENC_BIG_ENDIAN, BMT_NO_APPEND);
919 proto_tree_add_item(oem_payload_tree, hf_ncsi_mlnx_beid, tvb, 31, 1, ENC_NA);
920 proto_tree_add_item(oem_payload_tree, hf_ncsi_mlnx_bidx, tvb, 32, 1, ENC_NA);
921 proto_tree_add_item(oem_payload_tree, hf_ncsi_mlnx_baddr, tvb, 33, 1, ENC_NA);
922 proto_tree_add_item(oem_payload_tree, hf_ncsi_mlnx_peid, tvb, 34, 1, ENC_NA);
923 proto_tree_add_item(oem_payload_tree, hf_ncsi_mlnx_pidx, tvb, 35, 1, ENC_NA);
924 proto_tree_add_item(oem_payload_tree, hf_ncsi_mlnx_paddr, tvb, 36, 2, ENC_NA);
926 proto_tree_add_bitmask_with_flags(oem_payload_tree, tvb, 30, hf_ncsi_mlnx_ifm, ett_ncsi_mlnx_ifm, mlnx_ifm_fields, ENC_BIG_ENDIAN, BMT_NO_APPEND);
928 /* IP Filter Mode */
930 proto_tree_add_item(oem_payload_tree, hf_ncsi_mlnx_v4addr, tvb, 40, 4, ENC_NA);
931 proto_tree_add_item(oem_payload_tree, hf_ncsi_mlnx_v6local, tvb, 44, 16, ENC_NA);
932 proto_tree_add_item(oem_payload_tree, hf_ncsi_mlnx_v6gbl, tvb, 60, 16, ENC_NA);
933 } else if (mlnx_cmd == 0x13 && mlnx_param == 0x2) { /* Get Temperature (Command = 0x13, parameter 0x2) */
934 proto_item_set_text(opti, "Get Temperature");
935 proto_tree_add_bitmask(oem_payload_tree, tvb, 16 + poffset + 7, hf_ncsi_mlnx_gtemp_index, ett_ncsi_mlnx, mlx_gtemp_fields, ENC_NA);
937 else {
938 proto_item_set_text(opti, "Unknown OEM request");
941 } /* NCSI_OEM_MLX */
943 break;
944 case NCSI_TYPE_GLS | 0x80:
945 ncsi_proto_tree_add_lstat(tvb, ncsi_payload_tree, 20);
946 break;
947 case NCSI_TYPE_AEN:
948 dissect_ncsi_aen(tvb, ncsi_payload_tree);
949 break;
950 case NCSI_TYPE_VER | 0x80:
951 if (plen >= 40) { /* We got complete payload*/
952 const char *ver_str;
953 proto_tree *ncsi_ver_tree;
954 char *fw_name;
955 uint16_t vid, did, svid, ssid;
957 ncsi_ver_tree = proto_tree_add_subtree(ncsi_payload_tree, tvb, 20,
958 plen - 4, ett_ncsi_payload, NULL, "Version ID");
959 ver_str = ncsi_bcd_dig_to_str(pinfo->pool, tvb, 20);
960 proto_tree_add_string(ncsi_ver_tree, hf_ncsi_ver, tvb, 20, 8, ver_str);
962 fw_name = tvb_get_string_enc(pinfo->pool, tvb, 28, 12, ENC_ASCII);
963 proto_tree_add_string(ncsi_ver_tree, hf_ncsi_fw_name, tvb, 28, 12, fw_name);
964 proto_tree_add_string(ncsi_ver_tree, hf_ncsi_fw_ver, tvb, 40, 4, ncsi_fw_version(pinfo->pool, tvb, 40));
966 vid = tvb_get_uint16(tvb, 46, ENC_BIG_ENDIAN);
967 did = tvb_get_uint16(tvb, 44, ENC_BIG_ENDIAN);
968 svid = tvb_get_uint16(tvb, 50, ENC_BIG_ENDIAN);
969 ssid = tvb_get_uint16(tvb, 48, ENC_BIG_ENDIAN);
971 proto_tree_add_string(ncsi_ver_tree, hf_ncsi_pci_vid, tvb, 46, 2, pci_id_str(vid, 0xffff, 0xffff, 0xffff));
972 proto_tree_add_string(ncsi_ver_tree, hf_ncsi_pci_did, tvb, 44, 2, pci_id_str(vid, did, 0xffff, 0xffff));
973 proto_tree_add_string(ncsi_ver_tree, hf_ncsi_pci_ssid, tvb, 48, 4, pci_id_str(vid, did, svid, ssid));
974 proto_tree_add_item(ncsi_ver_tree, hf_ncsi_iana, tvb, 52, 4, ENC_BIG_ENDIAN);
976 break;
977 case NCSI_TYPE_CAP | 0x80:
978 if (plen >= 32) { /* We got complete payload */
979 ncsi_proto_tree_add_cap(tvb, ncsi_payload_tree, 20);
981 break;
984 return tvb_captured_length(tvb);
987 void
988 proto_register_ncsi(void)
990 /* *INDENT-OFF* */
991 /* Field definitions */
992 static hf_register_info hf[] = {
993 { &hf_ncsi_mc_id,
994 { "MC ID", "ncsi.mc_id",
995 FT_UINT8, BASE_HEX, NULL, 0x0,
996 "Management controller ID", HFILL },
998 { &hf_ncsi_revision,
999 { "Revision", "ncsi.revision",
1000 FT_UINT8, BASE_HEX, NULL, 0x0,
1001 "Header revision", HFILL },
1003 { &hf_ncsi_iid,
1004 { "IID", "ncsi.iid",
1005 FT_UINT8, BASE_HEX, NULL, 0x0,
1006 "Instance ID", HFILL },
1008 { &hf_ncsi_type,
1009 { "Type", "ncsi.type",
1010 FT_UINT8, BASE_HEX, NULL, 0x0,
1011 "Packet type", HFILL },
1013 { &hf_ncsi_type_code,
1014 { "Type code", "ncsi.type.code",
1015 FT_UINT8, BASE_HEX, VALS(ncsi_type_vals), 0,
1016 "Packet type code", HFILL },
1018 { &hf_ncsi_type_code_masked,
1019 { "Type code", "ncsi.type.code_masked",
1020 FT_UINT8, BASE_HEX, VALS(ncsi_type_vals), 0x7f,
1021 "Packet type code (masked)", HFILL },
1023 { &hf_ncsi_type_resp,
1024 { "Type req/resp", "ncsi.type.resp",
1025 FT_UINT8, BASE_HEX, VALS(ncsi_type_resp_vals), 0x80,
1026 "Packet type request/response", HFILL },
1029 { &hf_ncsi_chan,
1030 { "Channel", "ncsi.chan",
1031 FT_UINT8, BASE_HEX, NULL, 0x0,
1032 "NCSI Channel", HFILL },
1034 { &hf_ncsi_pkg,
1035 { "Package ID", "ncsi.pkg",
1036 FT_UINT8, BASE_HEX, NULL, 0xe0, /* bits 7..5 */
1037 "NCSI Internal Channel", HFILL },
1039 { &hf_ncsi_ichan,
1040 { "Internal Channel ID", "ncsi.ichan", /* bits 4..0 */
1041 FT_UINT8, BASE_HEX, NULL, 0x1f,
1042 "NCSI Internal Channel", HFILL },
1044 { &hf_ncsi_plen,
1045 { "Payload Length", "ncsi.plen",
1046 FT_UINT8, BASE_HEX, NULL, 0x0,
1047 NULL, HFILL },
1049 { &hf_ncsi_resp,
1050 { "Response", "ncsi.resp",
1051 FT_UINT16, BASE_HEX, VALS(ncsi_resp_code_vals), 0x0,
1052 "Response code", HFILL },
1054 { &hf_ncsi_reason,
1055 { "Reason", "ncsi.reason",
1056 FT_UINT16, BASE_HEX, VALS(ncsi_resp_reason_vals), 0x0,
1057 "Reason code", HFILL },
1059 { &hf_ncsi_sp_hwarb,
1060 { "Hardware arbitration disable", "ncsi.sp.hwarb",
1061 FT_UINT8, BASE_HEX, NULL, 0x0,
1062 NULL, HFILL },
1064 { &hf_ncsi_dc_ald,
1065 { "Allow link down", "ncsi.dc.ald",
1066 FT_UINT8, BASE_HEX, NULL, 0x1,
1067 NULL, HFILL },
1069 { &hf_ncsi_aene_mc,
1070 { "Management controller ID", "ncsi.aene.mc",
1071 FT_UINT8, BASE_HEX, NULL, 0x1,
1072 NULL, HFILL },
1074 { &hf_ncsi_sm_mac,
1075 { "MAC address", "ncsi.sm.mac",
1076 FT_ETHER, BASE_NONE, NULL, 0,
1077 NULL, HFILL },
1079 { &hf_ncsi_sm_macno,
1080 { "MAC address number", "ncsi.sm.macno",
1081 FT_UINT8, BASE_HEX, NULL, 0,
1082 NULL, HFILL },
1084 { &hf_ncsi_sm_at,
1085 { "Address type", "ncsi.sm.at",
1086 FT_UINT8, BASE_HEX, VALS(ncsi_sm_at_vals), 0xe0,
1087 NULL, HFILL },
1089 { &hf_ncsi_sm_e,
1090 { "Enabled", "ncsi.sm.e",
1091 FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x1,
1092 NULL, HFILL },
1094 { &hf_ncsi_aen_type,
1095 { "AEN type", "ncsi.aen_type",
1096 FT_UINT8, BASE_HEX, VALS(ncsi_aen_type_vals), 0,
1097 NULL, HFILL },
1099 { &hf_ncsi_aen_lsc_oemstat,
1100 { "AEN link OEM status", "ncsi.aen_lsc_oemstat",
1101 FT_UINT32, BASE_HEX, NULL, 0x0,
1102 NULL, HFILL },
1104 { &hf_ncsi_aen_hcds,
1105 { "AEN Host Network Controller Driver Status", "ncsi.aen_hcds",
1106 FT_BOOLEAN, 32, TFS(&tfs_running_not_running), 1 << 0,
1107 NULL, HFILL },
1109 { &hf_ncsi_aen_drr_orig_type,
1110 { "Original Command Type", "ncsi.aen_drr.otype",
1111 FT_UINT8, BASE_HEX, NULL, 0x0,
1112 NULL, HFILL },
1114 { &hf_ncsi_aen_drr_orig_iid,
1115 { "Original Command IID", "ncsi.aen_drr.oiid",
1116 FT_UINT8, BASE_HEX, NULL, 0x0,
1117 NULL, HFILL },
1119 /* Broadcast filter */
1120 { &hf_ncsi_bf,
1121 { "Broadcast filter settings", "ncsi.bf.settings",
1122 FT_UINT32, BASE_HEX, NULL, 0x0,
1123 NULL, HFILL },
1125 { &hf_ncsi_bf_arp,
1126 { "ARP", "ncsi.bf.settings.arp",
1127 FT_UINT32, BASE_HEX, VALS(ncsi_bf_filter_vals), 1 << 0,
1128 NULL, HFILL },
1130 { &hf_ncsi_bf_dhcpc,
1131 { "DHCP Client", "ncsi.bf.settings.dhcpc",
1132 FT_UINT32, BASE_HEX, VALS(ncsi_bf_filter_vals), 1 << 1,
1133 NULL, HFILL },
1135 { &hf_ncsi_bf_dhcps,
1136 { "DHCP Server", "ncsi.bf.settings.dhcps",
1137 FT_UINT32, BASE_HEX, VALS(ncsi_bf_filter_vals), 1 << 2,
1138 NULL, HFILL },
1140 { &hf_ncsi_bf_netbios,
1141 { "NetBIOS", "ncsi.bf.settings.netbios",
1142 FT_UINT32, BASE_HEX, VALS(ncsi_bf_filter_vals), 1 << 3,
1143 NULL, HFILL },
1145 /* Link settings */
1146 { &hf_ncsi_ls,
1147 { "Link Settings", "ncsi.ls",
1148 FT_UINT32, BASE_HEX, NULL, 0x0,
1149 NULL, HFILL },
1151 { &hf_ncsi_ls_an,
1152 { "Auto Negotiation", "ncsi.ls.an",
1153 FT_BOOLEAN, 32, TFS(&tfs_enabled_disabled), 1 << 0,
1154 NULL, HFILL },
1156 { &hf_ncsi_ls_10m,
1157 { "enable 10 Mbps", "ncsi.ls.10m",
1158 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 1 << 1,
1159 NULL, HFILL },
1161 { &hf_ncsi_ls_100m,
1162 { "enable 100 Mbps", "ncsi.ls.100m",
1163 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 1 << 2,
1164 NULL, HFILL },
1166 { &hf_ncsi_ls_1g,
1167 { "enable 1000 Mbps (1 Gbps)", "ncsi.ls.1g",
1168 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 1 << 3,
1169 NULL, HFILL },
1171 { &hf_ncsi_ls_10g,
1172 { "enable 10 Gbps", "ncsi.ls.10g",
1173 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 1 << 4,
1174 NULL, HFILL },
1176 { &hf_ncsi_ls_20g,
1177 { "enable 20 Gbps", "ncsi.ls.20g",
1178 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 1 << 5,
1179 NULL, HFILL },
1181 { &hf_ncsi_ls_25g,
1182 { "enable 25 Gbps", "ncsi.ls.25g",
1183 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 1 << 6,
1184 NULL, HFILL },
1186 { &hf_ncsi_ls_40g,
1187 { "enable 40 Gbps", "ncsi.ls.40g",
1188 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 1 << 7,
1189 NULL, HFILL },
1191 { &hf_ncsi_ls_hd,
1192 { "enable half-duplex", "ncsi.ls.hd",
1193 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 1 << 8,
1194 NULL, HFILL },
1196 { &hf_ncsi_ls_fd,
1197 { "enable full-duplex", "ncsi.ls.fd",
1198 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 1 << 9,
1199 NULL, HFILL },
1201 { &hf_ncsi_ls_pc,
1202 { "Pause Capability", "ncsi.ls.pc",
1203 FT_BOOLEAN, 32, TFS(&tfs_enabled_disabled), 1 << 10,
1204 NULL, HFILL },
1206 { &hf_ncsi_ls_apc,
1207 { "Asymmetric Pause Capability", "ncsi.ls.apc",
1208 FT_BOOLEAN, 32, TFS(&tfs_enabled_disabled), 1 << 11,
1209 NULL, HFILL },
1211 { &hf_ncsi_ls_50g,
1212 { "enable 50 Gbps", "ncsi.ls.50g",
1213 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 1 << 13,
1214 NULL, HFILL },
1216 { &hf_ncsi_ls_100g,
1217 { "enable 100 Gbps", "ncsi.ls.100g",
1218 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 1 << 14,
1219 NULL, HFILL },
1221 { &hf_ncsi_ls_2_5g,
1222 { "enable 2.5 Gbps", "ncsi.ls.2_5g",
1223 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 1 << 15,
1224 NULL, HFILL },
1226 { &hf_ncsi_ls_5g,
1227 { "enable 2.5 Gbps", "ncsi.ls.5g",
1228 FT_BOOLEAN, 32, TFS(&tfs_set_notset), 1 << 16,
1229 NULL, HFILL },
1231 { &hf_ncsi_ls_rsv,
1232 { "Reserved", "ncsi.ls.rsv",
1233 FT_UINT32, BASE_HEX, NULL, 0xfffe0000, /* bits 17..31 */
1234 NULL, HFILL },
1236 { &hf_ncsi_ls_oemls,
1237 { "OEM Link Settings", "ncsi.ls.oemls",
1238 FT_UINT32, BASE_HEX, NULL, 0x0 ,
1239 NULL, HFILL },
1242 /* generic link status */
1243 { &hf_ncsi_lstat,
1244 { "Link status", "ncsi.lstat",
1245 FT_UINT32, BASE_HEX, NULL, 0x0,
1246 NULL, HFILL },
1248 { &hf_ncsi_lstat_flag,
1249 { "Link flag", "ncsi.lstat.flag",
1250 FT_BOOLEAN, 32, TFS(&tfs_linkup_linkdown), 0x1,
1251 NULL, HFILL },
1253 { &hf_ncsi_lstat_speed_duplex,
1254 { "Speed & duplex", "ncsi.lstat.speed_duplex",
1255 FT_UINT32, BASE_HEX, VALS(ncsi_lstat_speed_duplex_vals), 0x1e,
1256 NULL, HFILL },
1258 { &hf_ncsi_lstat_autoneg,
1259 { "Autonegotiation", "ncsi.lstat.autoneg",
1260 FT_BOOLEAN, 32, TFS(&tfs_enabled_disabled), 1 << 5,
1261 NULL, HFILL },
1263 { &hf_ncsi_lstat_autoneg_complete,
1264 { "Autonegotiation complete", "ncsi.lstat.autoneg_complete",
1265 FT_BOOLEAN, 32, TFS(&tfs_complete_disable_inprog), 1 << 6,
1266 NULL, HFILL },
1268 { &hf_ncsi_lstat_parallel_detection,
1269 { "Parallel detection", "ncsi.lstat.parallel_detection",
1270 FT_BOOLEAN, 32, TFS(&tfs_used_notused), 1 << 7,
1271 NULL, HFILL },
1273 { &hf_ncsi_lstat_1000TFD,
1274 { "1000TFD", "ncsi.lstat.1000tfd",
1275 FT_BOOLEAN, 32, TFS(&tfs_capable_not_capable), 1 << 9,
1276 "Partner advertised 1000TFD", HFILL },
1278 { &hf_ncsi_lstat_1000THD,
1279 { "1000THD", "ncsi.lstat.1000thd",
1280 FT_BOOLEAN, 32, TFS(&tfs_capable_not_capable), 1 << 10,
1281 "Partner advertised 1000THD", HFILL },
1283 { &hf_ncsi_lstat_100T4,
1284 { "100T4", "ncsi.lstat.100t4",
1285 FT_BOOLEAN, 32, TFS(&tfs_capable_not_capable), 1 << 11,
1286 "Partner advertised 100T4", HFILL },
1288 { &hf_ncsi_lstat_100TXFD,
1289 { "100TXFD", "ncsi.lstat.100txfd",
1290 FT_BOOLEAN, 32, TFS(&tfs_capable_not_capable), 1 << 12,
1291 "Partner advertised 100TXFD", HFILL },
1293 { &hf_ncsi_lstat_100TXHD,
1294 { "100TXHD", "ncsi.lstat.100txhd",
1295 FT_BOOLEAN, 32, TFS(&tfs_capable_not_capable), 1 << 13,
1296 "Partner advertised 100TXHD", HFILL },
1298 { &hf_ncsi_lstat_10TFD,
1299 { "10TFD", "ncsi.lstat.10tfd",
1300 FT_BOOLEAN, 32, TFS(&tfs_capable_not_capable), 1 << 14,
1301 "Partner advertised 10TFD", HFILL },
1303 { &hf_ncsi_lstat_10THD,
1304 { "10THD", "ncsi.lstat.10thd",
1305 FT_BOOLEAN, 32, TFS(&tfs_capable_not_capable), 1 << 15,
1306 "Partner advertised 10THD", HFILL },
1308 { &hf_ncsi_lstat_tx_flow,
1309 { "TX flow", "ncsi.lstat.tx_flow",
1310 FT_BOOLEAN, 32, TFS(&tfs_enabled_disabled), 1 << 16,
1311 "TX flow control", HFILL },
1313 { &hf_ncsi_lstat_rx_flow,
1314 { "RX flow", "ncsi.lstat.rx_flow",
1315 FT_BOOLEAN, 32, TFS(&tfs_enabled_disabled), 1 << 17,
1316 "RX flow control", HFILL },
1318 { &hf_ncsi_lstat_partner_flow,
1319 { "Partner flow", "ncsi.lstat.partner_flow",
1320 FT_UINT32, BASE_HEX, VALS(ncsi_partner_flow_vals), 3<<18,
1321 "Partner-advertised flow control", HFILL },
1323 { &hf_ncsi_lstat_serdes,
1324 { "SerDes", "ncsi.lstat.serdes",
1325 FT_BOOLEAN, 32, TFS(&tfs_used_notused), 1 << 20,
1326 NULL, HFILL },
1328 { &hf_ncsi_lstat_oem_speed_valid,
1329 { "OEM Speed", "ncsi.lstat.oem_speed_valid",
1330 FT_BOOLEAN, 32, TFS(&tfs_valid_invalid), 1 << 21,
1331 NULL, HFILL },
1334 /* Get Version ID */
1335 { &hf_ncsi_ver,
1336 { "NC-SI version", "ncsi.ver",
1337 FT_STRING, BASE_NONE, NULL, 0,
1338 NULL, HFILL },
1341 { &hf_ncsi_fw_name,
1342 { "Firmware name", "ncsi.fw.name",
1343 FT_STRING, BASE_NONE, NULL, 0,
1344 NULL, HFILL },
1346 { &hf_ncsi_fw_ver,
1347 { "Firmware version", "ncsi.fw.ver",
1348 FT_STRING, BASE_NONE, NULL, 0,
1349 NULL, HFILL },
1351 { &hf_ncsi_pci_did,
1352 { "PCI DID", "ncsi.pci.did",
1353 FT_STRING, BASE_NONE, NULL, 0,
1354 NULL, HFILL },
1356 { &hf_ncsi_pci_vid,
1357 { "PCI VID", "ncsi.pci.vid",
1358 FT_STRING, BASE_NONE, NULL, 0,
1359 NULL, HFILL },
1361 { &hf_ncsi_pci_ssid,
1362 { "PCI SVID-SSID", "ncsi.pci.ssid",
1363 FT_STRING, BASE_NONE, NULL, 0,
1364 NULL, HFILL },
1366 { &hf_ncsi_iana,
1367 { "IANA Enterprise Number", "ncsi.iana",
1368 FT_UINT32, BASE_ENTERPRISES, STRINGS_ENTERPRISES, 0,
1369 NULL, HFILL },
1372 /* Get Capabilities */
1373 { &hf_ncsi_cap_flag,
1374 { "Capabilities Flags", "ncsi.cap",
1375 FT_UINT32, BASE_HEX, NULL, 0x0,
1376 NULL, HFILL },
1378 { &hf_ncsi_cap_flag_ha,
1379 { "Hardware Arbitration", "ncsi.cap.ha",
1380 FT_BOOLEAN, 32, TFS(&tfs_capable_not_capable), 1 << 0,
1381 NULL, HFILL },
1383 { &hf_ncsi_cap_flag_op,
1384 { "OS Presence", "ncsi.cap.op",
1385 FT_BOOLEAN, 32, TFS(&tfs_capable_not_capable), 1 << 1,
1386 NULL, HFILL },
1388 { &hf_ncsi_cap_flag_n2mfc,
1389 { "Network Controller to Management Controller Flow Control Support", "ncsi.cap.n2mfc",
1390 FT_BOOLEAN, 32, TFS(&tfs_capable_not_capable), 1 << 2,
1391 NULL, HFILL },
1393 { &hf_ncsi_cap_flag_m2nfc,
1394 { "Management Controller to Network Controller Flow Control Support", "ncsi.cap.m2nfc",
1395 FT_BOOLEAN, 32, TFS(&tfs_capable_not_capable), 1 << 3,
1396 NULL, HFILL },
1398 { &hf_ncsi_cap_flag_ama,
1399 { "All multicast addresses support", "ncsi.cap.ama",
1400 FT_BOOLEAN, 32, TFS(&tfs_capable_not_capable), 1 << 4,
1401 NULL, HFILL },
1403 /* Broadcast Packet Filter Capabilities*/
1404 { &hf_ncsi_cap_bf,
1405 { "Broadcast Packet Filter Capabilities", "ncsi.cap.bf",
1406 FT_UINT32, BASE_HEX, NULL, 0x0,
1407 NULL, HFILL },
1409 { &hf_ncsi_cap_bf_arp,
1410 { "ARP", "ncsi.cap.bf.arp",
1411 FT_BOOLEAN, 32, TFS(&tfs_capable_not_capable), 1 << 0,
1412 NULL, HFILL },
1414 { &hf_ncsi_cap_bf_dhcpc,
1415 { "DHCP Client", "ncsi.cap.bf.dhcpc",
1416 FT_BOOLEAN, 32, TFS(&tfs_capable_not_capable), 1 << 1,
1417 NULL, HFILL },
1419 { &hf_ncsi_cap_bf_dhcps,
1420 { "DHCP Server", "ncsi.cap.bf.dhcps",
1421 FT_BOOLEAN, 32, TFS(&tfs_capable_not_capable), 1 << 2,
1422 NULL, HFILL },
1424 { &hf_ncsi_cap_bf_netbios,
1425 { "NetBIOS", "ncsi.cap.bf.netbios",
1426 FT_BOOLEAN, 32, TFS(&tfs_capable_not_capable), 1 << 3,
1427 NULL, HFILL },
1429 /*Multicast Packet Filter Capabilities*/
1430 { &hf_ncsi_cap_mf,
1431 { "Multicast Packet Filter Capabilities", "ncsi.cap.mf",
1432 FT_UINT32, BASE_HEX, NULL, 0x0,
1433 NULL, HFILL },
1435 { &hf_ncsi_cap_mf_v6na,
1436 { "IPv6 Neighbor Advertisement", "ncsi.cap.mf.v6na",
1437 FT_BOOLEAN, 32, TFS(&tfs_capable_not_capable), 1 << 0,
1438 NULL, HFILL },
1440 { &hf_ncsi_cap_mf_v6ra,
1441 { "IPv6 Router Advertisement", "ncsi.cap.mf.v6ra",
1442 FT_BOOLEAN, 32, TFS(&tfs_capable_not_capable), 1 << 1,
1443 NULL, HFILL },
1445 { &hf_ncsi_cap_mf_dhcpv6,
1446 { "DHCPv6 relay and server multicast", "ncsi.cap.mf.v6dhcp",
1447 FT_BOOLEAN, 32, TFS(&tfs_capable_not_capable), 1 << 2,
1448 NULL, HFILL },
1450 /*Buffering Capability*/
1451 { &hf_ncsi_cap_buf,
1452 { "Buffering Capability (bytes)", "ncsi.cap.buf",
1453 FT_UINT32, BASE_HEX, NULL, 0x0,
1454 NULL, HFILL },
1456 /*AEN Control Support*/
1457 { &hf_ncsi_cap_aen,
1458 { "AEN Control Support", "ncsi.cap.aen",
1459 FT_UINT32, BASE_HEX, NULL, 0x0,
1460 NULL, HFILL },
1462 { &hf_ncsi_cap_aen_lstat,
1463 { "Link Status Change AEN control", "ncsi.cap.aen.lstat",
1464 FT_BOOLEAN, 32, TFS(&tfs_capable_not_capable), 1 << 0,
1465 NULL, HFILL },
1467 { &hf_ncsi_cap_aen_cfg,
1468 { "Configuration Required AEN control", "ncsi.cap.aen.cfg",
1469 FT_BOOLEAN, 32, TFS(&tfs_capable_not_capable), 1 << 1,
1470 NULL, HFILL },
1472 { &hf_ncsi_cap_aen_drv,
1473 { "Host NC Driver Status Change AEN control", "ncsi.cap.mf.drv",
1474 FT_BOOLEAN, 32, TFS(&tfs_capable_not_capable), 1 << 2,
1475 NULL, HFILL },
1477 { &hf_ncsi_cap_aen_resv, /* bit 3..15 Reserved Reserved */
1478 { "Reserved", "ncsi.cap.mf.resv",
1479 FT_UINT32, BASE_HEX, NULL, 0xfff8,
1480 NULL, HFILL },
1482 { &hf_ncsi_cap_aen_oem,
1483 { "OEM-specific AEN control", "ncsi.cap.mf.oem",
1484 FT_UINT32, BASE_HEX, NULL, 0xffff0000,
1485 NULL, HFILL },
1488 { &hf_ncsi_cap_vcnt,
1489 { "VLAN Filter Count", "ncsi.cap.vcnt",
1490 FT_UINT8, BASE_HEX, NULL, 0x0,
1491 NULL, HFILL },
1493 { &hf_ncsi_cap_mixcnt,
1494 { "Mixed Filter Count", "ncsi.cap.mixcnt",
1495 FT_UINT8, BASE_HEX, NULL, 0x0,
1496 NULL, HFILL },
1498 { &hf_ncsi_cap_mccnt,
1499 { "Multicast Filter Count", "ncsi.cap.mccnt",
1500 FT_UINT8, BASE_HEX, NULL, 0x0,
1501 NULL, HFILL },
1503 { &hf_ncsi_cap_uccnt,
1504 { "Unicast Filter Count", "ncsi.cap.uccnt",
1505 FT_UINT8, BASE_HEX, NULL, 0x0,
1506 NULL, HFILL },
1508 /*VLAN mode*/
1509 { &hf_ncsi_cap_vmode,
1510 { "VLAN Mode Support", "ncsi.cap.vmode",
1511 FT_UINT8, BASE_HEX, NULL, 0x0,
1512 NULL, HFILL },
1514 { &hf_ncsi_cap_vmode_vo,
1515 { "VLAN only", "ncsi.cap.aen.vmode.vo",
1516 FT_BOOLEAN, 8, TFS(&tfs_capable_not_capable), 1 << 0,
1517 NULL, HFILL },
1519 { &hf_ncsi_cap_vmode_both,
1520 { "VLAN + non-VLAN", "ncsi.cap.aen.vmode.both",
1521 FT_BOOLEAN, 8, TFS(&tfs_capable_not_capable), 1 << 1,
1522 NULL, HFILL },
1524 { &hf_ncsi_cap_vmode_any,
1525 { "Any VLAN + non-VLAN", "ncsi.cap.aen.vmode.any",
1526 FT_BOOLEAN, 8, TFS(&tfs_capable_not_capable), 1 << 2,
1527 NULL, HFILL },
1529 { &hf_ncsi_cap_chcnt,
1530 { "Channel Count", "ncsi.cap.chcnt",
1531 FT_UINT8, BASE_HEX, NULL, 0x0,
1532 NULL, HFILL },
1534 /* OEM command */
1535 { &hf_ncsi_oem_id,
1536 { "OEM ID", "ncsi.oem.id",
1537 FT_UINT32, BASE_HEX, VALS(ncsi_oem_id_vals), 0x0,
1538 "Manufacturer ID (IANA)", HFILL },
1540 /* OEM Mellanox Command, Parameter, Host number */
1541 { &hf_ncsi_mlnx_cmd,
1542 { "Command ID", "ncsi.mlnx.cmd",
1543 FT_UINT8, BASE_HEX, NULL, 0x0,
1544 "Mellanox command id", HFILL },
1546 { &hf_ncsi_mlnx_parm,
1547 { "Parameter", "ncsi.mlnx.parm",
1548 FT_UINT8, BASE_HEX, NULL, 0x0,
1549 "Mellanox parameter", HFILL },
1551 { &hf_ncsi_mlnx_host,
1552 { "Host number", "ncsi.mlnx.host",
1553 FT_UINT8, BASE_HEX, NULL, 0x0,
1554 "Mellanox host number", HFILL },
1556 /* OEM Mellanox Set MC Affinity (Command = 0x1, parameter 0x7) */
1557 { &hf_ncsi_mlnx_rbt,
1558 { "MC RBT address", "ncsi.mlnx.rbt",
1559 FT_ETHER, BASE_NONE, NULL, 0x0,
1560 NULL, HFILL },
1563 { &hf_ncsi_mlnx_sms,
1564 { "Supported Medias Status", "ncsi.mlx.sms",
1565 FT_UINT8, BASE_HEX, NULL, 0x0,
1566 NULL, HFILL },
1568 { &hf_ncsi_mlnx_sms_rbt,
1569 { "RBT", "ncsi.mlx.sms.rbt",
1570 FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 1 << 0,
1571 "When set the MC supports RBT", HFILL },
1573 { &hf_ncsi_mlnx_sms_smbus,
1574 { "SMBus", "ncsi.mlx.sms.smbus",
1575 FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 1 << 1,
1576 "When set, the MC supports MCTP over SMBus", HFILL },
1578 { &hf_ncsi_mlnx_sms_pcie,
1579 { "PCIe", "ncsi.mlx.sms.pcie",
1580 FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 1 << 2,
1581 "When set, the MC supports MCTP over PCIe", HFILL },
1583 { &hf_ncsi_mlnx_sms_rbts,
1584 { "RBT medium status", "ncsi.mlx.sms.rbts",
1585 FT_BOOLEAN, 8, TFS(&tfs_available_not_available), 1 << 3,
1586 NULL, HFILL },
1588 { &hf_ncsi_mlnx_sms_smbuss,
1589 { "SMBus medium status", "ncsi.mlx.sms.smbuss",
1590 FT_BOOLEAN, 8, TFS(&tfs_available_not_available), 1 << 4,
1591 NULL, HFILL },
1593 { &hf_ncsi_mlnx_sms_pcies,
1594 { "PCIe medium status", "ncsi.mlx.sms.pcies",
1595 FT_BOOLEAN, 8, TFS(&tfs_available_not_available), 1 << 5,
1596 NULL, HFILL },
1598 { &hf_ncsi_mlnx_beid,
1599 { "MC SMBus EID", "ncsi.mlx.beid",
1600 FT_UINT8, BASE_HEX, NULL, 0x0,
1601 NULL, HFILL },
1603 { &hf_ncsi_mlnx_bidx,
1604 { "SMBus index", "ncsi.mlx.bidx",
1605 FT_UINT8, BASE_HEX, NULL, 0x0,
1606 NULL, HFILL },
1608 { &hf_ncsi_mlnx_baddr,
1609 { "MC SMBus address", "ncsi.mlx.baddr",
1610 FT_UINT8, BASE_HEX, NULL, 0x0,
1611 NULL, HFILL },
1613 { &hf_ncsi_mlnx_peid,
1614 { "MC PCIe EID", "ncsi.mlx.peid",
1615 FT_UINT8, BASE_HEX, NULL, 0x0,
1616 NULL, HFILL },
1618 { &hf_ncsi_mlnx_pidx,
1619 { "PCIe index", "ncsi.mlx.pidx",
1620 FT_UINT8, BASE_HEX, NULL, 0x0,
1621 NULL, HFILL },
1623 { &hf_ncsi_mlnx_paddr,
1624 { "MC PCIe Address", "ncsi.mlx.paddr",
1625 FT_UINT16, BASE_HEX, NULL, 0x0,
1626 NULL, HFILL },
1628 { &hf_ncsi_mlnx_ifm,
1629 { "MC IP Filter Mode", "ncsi.mlx.ifm",
1630 FT_UINT8, BASE_HEX, NULL, 0x0,
1631 NULL, HFILL },
1633 { &hf_ncsi_mlnx_ifm_byip,
1634 { "Filter by IP Address", "ncsi.mlx.ifm.byip",
1635 FT_UINT8, BASE_HEX, VALS(ncsi_mlnx_ifm_byip_vals), 0x3,
1636 NULL, HFILL },
1638 { &hf_ncsi_mlnx_ifm_v4en,
1639 { "IPv4", "ncsi.mlx.ifm.v4en",
1640 FT_BOOLEAN, 8, TFS(&tfs_used_notused), 1 << 2,
1641 NULL, HFILL },
1643 { &hf_ncsi_mlnx_ifm_v6len,
1644 { "IPv6 Link Local Address", "ncsi.mlx.ifm.v6len",
1645 FT_BOOLEAN, 8, TFS(&tfs_used_notused), 1 << 3,
1646 NULL, HFILL },
1648 { &hf_ncsi_mlnx_ifm_v6gen,
1649 { "IPv6 Global Address", "ncsi.mlx.ifm.v6gen",
1650 FT_BOOLEAN, 8, TFS(&tfs_used_notused), 1 << 4,
1651 NULL, HFILL },
1653 { &hf_ncsi_mlnx_v4addr,
1654 { "MC IPv4 Address", "ncsi.mlnx.v4addr",
1655 FT_IPv4, BASE_NONE, NULL, 0x0,
1656 NULL, HFILL },
1658 { &hf_ncsi_mlnx_v6local,
1659 { "MC IPv6 Link Local Address", "ncsi.mlnx.v6local",
1660 FT_IPv6, BASE_NONE, NULL, 0x0,
1661 NULL, HFILL },
1663 { &hf_ncsi_mlnx_v6gbl,
1664 { "MC IPv6 Global Address", "ncsi.mlnx.v6gbl",
1665 FT_IPv6, BASE_NONE, NULL, 0x0,
1666 NULL, HFILL },
1668 /* Get Allocated Management Address (Command = 0x0, Parameter 0x1B) */
1669 { &hf_ncsi_mlnx_gama_st,
1670 { "Status", "ncsi.mlx.gama.st",
1671 FT_UINT8, BASE_HEX, VALS(ncsi_mlnx_gama_st_vals), 0x0,
1672 NULL, HFILL },
1674 { &hf_ncsi_mlnx_gama_mac,
1675 { "Allocated MC MAC address", "ncsi.mlx.gama.mac",
1676 FT_ETHER, BASE_NONE, NULL, 0x0,
1677 NULL, HFILL },
1679 /* Get Temperature (Command = 0x13, Parameter = 0x2) */
1680 { &hf_ncsi_mlnx_gtemp_index,
1681 { "Get sensor index", "ncsi.mlx.temp.index",
1682 FT_UINT8, BASE_HEX, NULL, 0x0,
1683 NULL, HFILL },
1685 { &hf_ncsi_mlnx_gtemp_sp,
1686 { "SP", "ncsi.mlx.temp.sp",
1687 FT_UINT8, BASE_HEX, VALS(ncsi_mlnx_gtemp_sp_vals), 0x80, /* bits 7 */
1688 NULL, HFILL },
1690 { &hf_ncsi_mlnx_gtemp_sindex,
1691 { "Sensor index", "ncsi.mlx.temp.sindex",
1692 FT_UINT8, BASE_HEX, NULL, 0x7f, /* bits 6..0 */
1693 NULL, HFILL },
1696 { &hf_ncsi_mlnx_gtemp_pad_mms,
1697 { "PAD_MMS", "ncsi.mlx.temp.pad_mms",
1698 FT_UINT8, BASE_HEX, NULL, 0x0,
1699 "PAD and MMS", HFILL },
1701 { &hf_ncsi_mlnx_gtemp_pad,
1702 { "PAD", "ncsi.mlx.temp.pad",
1703 FT_UINT8, BASE_HEX, NULL, 0xfe, /* bits 7..1 */
1704 NULL, HFILL },
1706 { &hf_ncsi_mlnx_gtemp_mms,
1707 { "MMS", "ncsi.mlx.temp.mms",
1708 FT_UINT8, BASE_HEX, NULL, 0x1, /* bits 0 */
1709 NULL, HFILL },
1711 { &hf_ncsi_mlnx_temp1,
1712 { "Max Meas Temperature", "ncsi.mlx.maxmeas_temp",
1713 FT_UINT8, BASE_DEC, NULL, 0x0,
1714 NULL, HFILL },
1716 { &hf_ncsi_mlnx_temp2,
1717 { "Max Op Temperature", "ncsi.mlx.maxop_temp",
1718 FT_UINT8, BASE_DEC, NULL, 0x0,
1719 NULL, HFILL },
1721 { &hf_ncsi_mlnx_temp3,
1722 { "Current Temperature", "ncsi.mlx.current_temp",
1723 FT_UINT8, BASE_DEC, NULL, 0x0,
1724 NULL, HFILL },
1729 /* *INDENT-ON* */
1731 /* Setup protocol subtree array */
1732 static int *ett[] = {
1733 &ett_ncsi,
1734 &ett_ncsi_type,
1735 &ett_ncsi_chan,
1736 &ett_ncsi_payload,
1737 &ett_ncsi_lstat,
1738 &ett_ncsi_cap_flag,
1739 &ett_ncsi_cap_bf,
1740 &ett_ncsi_cap_mf,
1741 &ett_ncsi_cap_aen,
1742 &ett_ncsi_cap_vmode,
1743 &ett_ncsi_ls,
1744 &ett_ncsi_mlnx,
1745 &ett_ncsi_mlnx_sms,
1746 &ett_ncsi_mlnx_ifm,
1747 &ett_ncsi_mlnx_gtemp,
1750 /* Register the protocol name and description */
1751 proto_ncsi = proto_register_protocol("NCSI", "NCSI", "ncsi");
1752 ncsi_handle = register_dissector("ncsi", dissect_ncsi, proto_ncsi);
1754 /* Required function calls to register the header fields and subtrees */
1755 proto_register_field_array(proto_ncsi, hf, array_length(hf));
1756 proto_register_subtree_array(ett, array_length(ett));
1759 void
1760 proto_reg_handoff_ncsi(void)
1762 dissector_add_uint("ethertype", ETHERTYPE_NCSI, ncsi_handle);
1763 dissector_add_uint("mctp.encap-type", MCTP_TYPE_NCSI, ncsi_handle);
1767 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1769 * Local variables:
1770 * c-basic-offset: 4
1771 * tab-width: 8
1772 * indent-tabs-mode: nil
1773 * End:
1775 * vi: set shiftwidth=4 tabstop=8 expandtab:
1776 * :indentSize=4:tabSize=8:noTabs=true:
1780 * Formatted by AStyle (3.1) -A10YcHjk3pUxUxBxt2 if under Windows