1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright Gavin Shan, IBM Corporation 2016.
10 unsigned char mc_id
; /* Management controller ID */
11 unsigned char revision
; /* NCSI version - 0x01 */
12 unsigned char reserved
; /* Reserved */
13 unsigned char id
; /* Packet sequence number */
14 unsigned char type
; /* Packet type */
15 unsigned char channel
; /* Network controller ID */
16 __be16 length
; /* Payload length */
17 __be32 reserved1
[2]; /* Reserved */
20 struct ncsi_cmd_pkt_hdr
{
21 struct ncsi_pkt_hdr common
; /* Common NCSI packet header */
24 struct ncsi_rsp_pkt_hdr
{
25 struct ncsi_pkt_hdr common
; /* Common NCSI packet header */
26 __be16 code
; /* Response code */
27 __be16 reason
; /* Response reason */
30 struct ncsi_aen_pkt_hdr
{
31 struct ncsi_pkt_hdr common
; /* Common NCSI packet header */
32 unsigned char reserved2
[3]; /* Reserved */
33 unsigned char type
; /* AEN packet type */
36 /* NCSI common command packet */
38 struct ncsi_cmd_pkt_hdr cmd
; /* Command header */
39 __be32 checksum
; /* Checksum */
40 unsigned char pad
[26];
44 struct ncsi_rsp_pkt_hdr rsp
; /* Response header */
45 __be32 checksum
; /* Checksum */
46 unsigned char pad
[22];
50 struct ncsi_cmd_sp_pkt
{
51 struct ncsi_cmd_pkt_hdr cmd
; /* Command header */
52 unsigned char reserved
[3]; /* Reserved */
53 unsigned char hw_arbitration
; /* HW arbitration */
54 __be32 checksum
; /* Checksum */
55 unsigned char pad
[22];
59 struct ncsi_cmd_dc_pkt
{
60 struct ncsi_cmd_pkt_hdr cmd
; /* Command header */
61 unsigned char reserved
[3]; /* Reserved */
62 unsigned char ald
; /* Allow link down */
63 __be32 checksum
; /* Checksum */
64 unsigned char pad
[22];
68 struct ncsi_cmd_rc_pkt
{
69 struct ncsi_cmd_pkt_hdr cmd
; /* Command header */
70 __be32 reserved
; /* Reserved */
71 __be32 checksum
; /* Checksum */
72 unsigned char pad
[22];
76 struct ncsi_cmd_ae_pkt
{
77 struct ncsi_cmd_pkt_hdr cmd
; /* Command header */
78 unsigned char reserved
[3]; /* Reserved */
79 unsigned char mc_id
; /* MC ID */
80 __be32 mode
; /* AEN working mode */
81 __be32 checksum
; /* Checksum */
82 unsigned char pad
[18];
86 struct ncsi_cmd_sl_pkt
{
87 struct ncsi_cmd_pkt_hdr cmd
; /* Command header */
88 __be32 mode
; /* Link working mode */
89 __be32 oem_mode
; /* OEM link mode */
90 __be32 checksum
; /* Checksum */
91 unsigned char pad
[18];
95 struct ncsi_cmd_svf_pkt
{
96 struct ncsi_cmd_pkt_hdr cmd
; /* Command header */
97 __be16 reserved
; /* Reserved */
98 __be16 vlan
; /* VLAN ID */
99 __be16 reserved1
; /* Reserved */
100 unsigned char index
; /* VLAN table index */
101 unsigned char enable
; /* Enable or disable */
102 __be32 checksum
; /* Checksum */
103 unsigned char pad
[18];
107 struct ncsi_cmd_ev_pkt
{
108 struct ncsi_cmd_pkt_hdr cmd
; /* Command header */
109 unsigned char reserved
[3]; /* Reserved */
110 unsigned char mode
; /* VLAN filter mode */
111 __be32 checksum
; /* Checksum */
112 unsigned char pad
[22];
115 /* Set MAC Address */
116 struct ncsi_cmd_sma_pkt
{
117 struct ncsi_cmd_pkt_hdr cmd
; /* Command header */
118 unsigned char mac
[6]; /* MAC address */
119 unsigned char index
; /* MAC table index */
120 unsigned char at_e
; /* Addr type and operation */
121 __be32 checksum
; /* Checksum */
122 unsigned char pad
[18];
125 /* Enable Broadcast Filter */
126 struct ncsi_cmd_ebf_pkt
{
127 struct ncsi_cmd_pkt_hdr cmd
; /* Command header */
128 __be32 mode
; /* Filter mode */
129 __be32 checksum
; /* Checksum */
130 unsigned char pad
[22];
133 /* Enable Global Multicast Filter */
134 struct ncsi_cmd_egmf_pkt
{
135 struct ncsi_cmd_pkt_hdr cmd
; /* Command header */
136 __be32 mode
; /* Global MC mode */
137 __be32 checksum
; /* Checksum */
138 unsigned char pad
[22];
141 /* Set NCSI Flow Control */
142 struct ncsi_cmd_snfc_pkt
{
143 struct ncsi_cmd_pkt_hdr cmd
; /* Command header */
144 unsigned char reserved
[3]; /* Reserved */
145 unsigned char mode
; /* Flow control mode */
146 __be32 checksum
; /* Checksum */
147 unsigned char pad
[22];
150 /* OEM Request Command as per NCSI Specification */
151 struct ncsi_cmd_oem_pkt
{
152 struct ncsi_cmd_pkt_hdr cmd
; /* Command header */
153 __be32 mfr_id
; /* Manufacture ID */
154 unsigned char data
[]; /* OEM Payload Data */
157 /* OEM Response Packet as per NCSI Specification */
158 struct ncsi_rsp_oem_pkt
{
159 struct ncsi_rsp_pkt_hdr rsp
; /* Command header */
160 __be32 mfr_id
; /* Manufacture ID */
161 unsigned char data
[]; /* Payload data */
164 /* Mellanox Response Data */
165 struct ncsi_rsp_oem_mlx_pkt
{
166 unsigned char cmd_rev
; /* Command Revision */
167 unsigned char cmd
; /* Command ID */
168 unsigned char param
; /* Parameter */
169 unsigned char optional
; /* Optional data */
170 unsigned char data
[]; /* Data */
173 /* Broadcom Response Data */
174 struct ncsi_rsp_oem_bcm_pkt
{
175 unsigned char ver
; /* Payload Version */
176 unsigned char type
; /* OEM Command type */
177 __be16 len
; /* Payload Length */
178 unsigned char data
[]; /* Cmd specific Data */
181 /* Intel Response Data */
182 struct ncsi_rsp_oem_intel_pkt
{
183 unsigned char cmd
; /* OEM Command ID */
184 unsigned char data
[]; /* Cmd specific Data */
187 /* Get Link Status */
188 struct ncsi_rsp_gls_pkt
{
189 struct ncsi_rsp_pkt_hdr rsp
; /* Response header */
190 __be32 status
; /* Link status */
191 __be32 other
; /* Other indications */
192 __be32 oem_status
; /* OEM link status */
194 unsigned char pad
[10];
198 struct ncsi_rsp_gvi_pkt
{
199 struct ncsi_rsp_pkt_hdr rsp
; /* Response header */
200 unsigned char major
; /* NCSI version major */
201 unsigned char minor
; /* NCSI version minor */
202 unsigned char update
; /* NCSI version update */
203 unsigned char alpha1
; /* NCSI version alpha1 */
204 unsigned char reserved
[3]; /* Reserved */
205 unsigned char alpha2
; /* NCSI version alpha2 */
206 unsigned char fw_name
[12]; /* f/w name string */
207 __be32 fw_version
; /* f/w version */
208 __be16 pci_ids
[4]; /* PCI IDs */
209 __be32 mf_id
; /* Manufacture ID */
213 /* Get Capabilities */
214 struct ncsi_rsp_gc_pkt
{
215 struct ncsi_rsp_pkt_hdr rsp
; /* Response header */
216 __be32 cap
; /* Capabilities */
217 __be32 bc_cap
; /* Broadcast cap */
218 __be32 mc_cap
; /* Multicast cap */
219 __be32 buf_cap
; /* Buffering cap */
220 __be32 aen_cap
; /* AEN cap */
221 unsigned char vlan_cnt
; /* VLAN filter count */
222 unsigned char mixed_cnt
; /* Mix filter count */
223 unsigned char mc_cnt
; /* MC filter count */
224 unsigned char uc_cnt
; /* UC filter count */
225 unsigned char reserved
[2]; /* Reserved */
226 unsigned char vlan_mode
; /* VLAN mode */
227 unsigned char channel_cnt
; /* Channel count */
228 __be32 checksum
; /* Checksum */
232 struct ncsi_rsp_gp_pkt
{
233 struct ncsi_rsp_pkt_hdr rsp
; /* Response header */
234 unsigned char mac_cnt
; /* Number of MAC addr */
235 unsigned char reserved
[2]; /* Reserved */
236 unsigned char mac_enable
; /* MAC addr enable flags */
237 unsigned char vlan_cnt
; /* VLAN tag count */
238 unsigned char reserved1
; /* Reserved */
239 __be16 vlan_enable
; /* VLAN tag enable flags */
240 __be32 link_mode
; /* Link setting */
241 __be32 bc_mode
; /* BC filter mode */
242 __be32 valid_modes
; /* Valid mode parameters */
243 unsigned char vlan_mode
; /* VLAN mode */
244 unsigned char fc_mode
; /* Flow control mode */
245 unsigned char reserved2
[2]; /* Reserved */
246 __be32 aen_mode
; /* AEN mode */
247 unsigned char mac
[6]; /* Supported MAC addr */
248 __be16 vlan
; /* Supported VLAN tags */
249 __be32 checksum
; /* Checksum */
252 /* Get Controller Packet Statistics */
253 struct ncsi_rsp_gcps_pkt
{
254 struct ncsi_rsp_pkt_hdr rsp
; /* Response header */
255 __be32 cnt_hi
; /* Counter cleared */
256 __be32 cnt_lo
; /* Counter cleared */
257 __be32 rx_bytes
; /* Rx bytes */
258 __be32 tx_bytes
; /* Tx bytes */
259 __be32 rx_uc_pkts
; /* Rx UC packets */
260 __be32 rx_mc_pkts
; /* Rx MC packets */
261 __be32 rx_bc_pkts
; /* Rx BC packets */
262 __be32 tx_uc_pkts
; /* Tx UC packets */
263 __be32 tx_mc_pkts
; /* Tx MC packets */
264 __be32 tx_bc_pkts
; /* Tx BC packets */
265 __be32 fcs_err
; /* FCS errors */
266 __be32 align_err
; /* Alignment errors */
267 __be32 false_carrier
; /* False carrier detection */
268 __be32 runt_pkts
; /* Rx runt packets */
269 __be32 jabber_pkts
; /* Rx jabber packets */
270 __be32 rx_pause_xon
; /* Rx pause XON frames */
271 __be32 rx_pause_xoff
; /* Rx XOFF frames */
272 __be32 tx_pause_xon
; /* Tx XON frames */
273 __be32 tx_pause_xoff
; /* Tx XOFF frames */
274 __be32 tx_s_collision
; /* Single collision frames */
275 __be32 tx_m_collision
; /* Multiple collision frames */
276 __be32 l_collision
; /* Late collision frames */
277 __be32 e_collision
; /* Excessive collision frames */
278 __be32 rx_ctl_frames
; /* Rx control frames */
279 __be32 rx_64_frames
; /* Rx 64-bytes frames */
280 __be32 rx_127_frames
; /* Rx 65-127 bytes frames */
281 __be32 rx_255_frames
; /* Rx 128-255 bytes frames */
282 __be32 rx_511_frames
; /* Rx 256-511 bytes frames */
283 __be32 rx_1023_frames
; /* Rx 512-1023 bytes frames */
284 __be32 rx_1522_frames
; /* Rx 1024-1522 bytes frames */
285 __be32 rx_9022_frames
; /* Rx 1523-9022 bytes frames */
286 __be32 tx_64_frames
; /* Tx 64-bytes frames */
287 __be32 tx_127_frames
; /* Tx 65-127 bytes frames */
288 __be32 tx_255_frames
; /* Tx 128-255 bytes frames */
289 __be32 tx_511_frames
; /* Tx 256-511 bytes frames */
290 __be32 tx_1023_frames
; /* Tx 512-1023 bytes frames */
291 __be32 tx_1522_frames
; /* Tx 1024-1522 bytes frames */
292 __be32 tx_9022_frames
; /* Tx 1523-9022 bytes frames */
293 __be32 rx_valid_bytes
; /* Rx valid bytes */
294 __be32 rx_runt_pkts
; /* Rx error runt packets */
295 __be32 rx_jabber_pkts
; /* Rx error jabber packets */
296 __be32 checksum
; /* Checksum */
299 /* Get NCSI Statistics */
300 struct ncsi_rsp_gns_pkt
{
301 struct ncsi_rsp_pkt_hdr rsp
; /* Response header */
302 __be32 rx_cmds
; /* Rx NCSI commands */
303 __be32 dropped_cmds
; /* Dropped commands */
304 __be32 cmd_type_errs
; /* Command type errors */
305 __be32 cmd_csum_errs
; /* Command checksum errors */
306 __be32 rx_pkts
; /* Rx NCSI packets */
307 __be32 tx_pkts
; /* Tx NCSI packets */
308 __be32 tx_aen_pkts
; /* Tx AEN packets */
309 __be32 checksum
; /* Checksum */
312 /* Get NCSI Pass-through Statistics */
313 struct ncsi_rsp_gnpts_pkt
{
314 struct ncsi_rsp_pkt_hdr rsp
; /* Response header */
315 __be32 tx_pkts
; /* Tx packets */
316 __be32 tx_dropped
; /* Tx dropped packets */
317 __be32 tx_channel_err
; /* Tx channel errors */
318 __be32 tx_us_err
; /* Tx undersize errors */
319 __be32 rx_pkts
; /* Rx packets */
320 __be32 rx_dropped
; /* Rx dropped packets */
321 __be32 rx_channel_err
; /* Rx channel errors */
322 __be32 rx_us_err
; /* Rx undersize errors */
323 __be32 rx_os_err
; /* Rx oversize errors */
324 __be32 checksum
; /* Checksum */
327 /* Get package status */
328 struct ncsi_rsp_gps_pkt
{
329 struct ncsi_rsp_pkt_hdr rsp
; /* Response header */
330 __be32 status
; /* Hardware arbitration status */
334 /* Get package UUID */
335 struct ncsi_rsp_gpuuid_pkt
{
336 struct ncsi_rsp_pkt_hdr rsp
; /* Response header */
337 unsigned char uuid
[16]; /* UUID */
341 /* Get MC MAC Address */
342 struct ncsi_rsp_gmcma_pkt
{
343 struct ncsi_rsp_pkt_hdr rsp
;
344 unsigned char address_count
;
345 unsigned char reserved
[3];
346 unsigned char addresses
[][ETH_ALEN
];
349 /* AEN: Link State Change */
350 struct ncsi_aen_lsc_pkt
{
351 struct ncsi_aen_pkt_hdr aen
; /* AEN header */
352 __be32 status
; /* Link status */
353 __be32 oem_status
; /* OEM link status */
354 __be32 checksum
; /* Checksum */
355 unsigned char pad
[14];
358 /* AEN: Configuration Required */
359 struct ncsi_aen_cr_pkt
{
360 struct ncsi_aen_pkt_hdr aen
; /* AEN header */
361 __be32 checksum
; /* Checksum */
362 unsigned char pad
[22];
365 /* AEN: Host Network Controller Driver Status Change */
366 struct ncsi_aen_hncdsc_pkt
{
367 struct ncsi_aen_pkt_hdr aen
; /* AEN header */
368 __be32 status
; /* Status */
369 __be32 checksum
; /* Checksum */
370 unsigned char pad
[18];
373 /* NCSI packet revision */
374 #define NCSI_PKT_REVISION 0x01
376 /* NCSI packet commands */
377 #define NCSI_PKT_CMD_CIS 0x00 /* Clear Initial State */
378 #define NCSI_PKT_CMD_SP 0x01 /* Select Package */
379 #define NCSI_PKT_CMD_DP 0x02 /* Deselect Package */
380 #define NCSI_PKT_CMD_EC 0x03 /* Enable Channel */
381 #define NCSI_PKT_CMD_DC 0x04 /* Disable Channel */
382 #define NCSI_PKT_CMD_RC 0x05 /* Reset Channel */
383 #define NCSI_PKT_CMD_ECNT 0x06 /* Enable Channel Network Tx */
384 #define NCSI_PKT_CMD_DCNT 0x07 /* Disable Channel Network Tx */
385 #define NCSI_PKT_CMD_AE 0x08 /* AEN Enable */
386 #define NCSI_PKT_CMD_SL 0x09 /* Set Link */
387 #define NCSI_PKT_CMD_GLS 0x0a /* Get Link */
388 #define NCSI_PKT_CMD_SVF 0x0b /* Set VLAN Filter */
389 #define NCSI_PKT_CMD_EV 0x0c /* Enable VLAN */
390 #define NCSI_PKT_CMD_DV 0x0d /* Disable VLAN */
391 #define NCSI_PKT_CMD_SMA 0x0e /* Set MAC address */
392 #define NCSI_PKT_CMD_EBF 0x10 /* Enable Broadcast Filter */
393 #define NCSI_PKT_CMD_DBF 0x11 /* Disable Broadcast Filter */
394 #define NCSI_PKT_CMD_EGMF 0x12 /* Enable Global Multicast Filter */
395 #define NCSI_PKT_CMD_DGMF 0x13 /* Disable Global Multicast Filter */
396 #define NCSI_PKT_CMD_SNFC 0x14 /* Set NCSI Flow Control */
397 #define NCSI_PKT_CMD_GVI 0x15 /* Get Version ID */
398 #define NCSI_PKT_CMD_GC 0x16 /* Get Capabilities */
399 #define NCSI_PKT_CMD_GP 0x17 /* Get Parameters */
400 #define NCSI_PKT_CMD_GCPS 0x18 /* Get Controller Packet Statistics */
401 #define NCSI_PKT_CMD_GNS 0x19 /* Get NCSI Statistics */
402 #define NCSI_PKT_CMD_GNPTS 0x1a /* Get NCSI Pass-throu Statistics */
403 #define NCSI_PKT_CMD_GPS 0x1b /* Get package status */
404 #define NCSI_PKT_CMD_OEM 0x50 /* OEM */
405 #define NCSI_PKT_CMD_PLDM 0x51 /* PLDM request over NCSI over RBT */
406 #define NCSI_PKT_CMD_GPUUID 0x52 /* Get package UUID */
407 #define NCSI_PKT_CMD_QPNPR 0x56 /* Query Pending NC PLDM request */
408 #define NCSI_PKT_CMD_SNPR 0x57 /* Send NC PLDM Reply */
409 #define NCSI_PKT_CMD_GMCMA 0x58 /* Get MC MAC Address */
412 /* NCSI packet responses */
413 #define NCSI_PKT_RSP_CIS (NCSI_PKT_CMD_CIS + 0x80)
414 #define NCSI_PKT_RSP_SP (NCSI_PKT_CMD_SP + 0x80)
415 #define NCSI_PKT_RSP_DP (NCSI_PKT_CMD_DP + 0x80)
416 #define NCSI_PKT_RSP_EC (NCSI_PKT_CMD_EC + 0x80)
417 #define NCSI_PKT_RSP_DC (NCSI_PKT_CMD_DC + 0x80)
418 #define NCSI_PKT_RSP_RC (NCSI_PKT_CMD_RC + 0x80)
419 #define NCSI_PKT_RSP_ECNT (NCSI_PKT_CMD_ECNT + 0x80)
420 #define NCSI_PKT_RSP_DCNT (NCSI_PKT_CMD_DCNT + 0x80)
421 #define NCSI_PKT_RSP_AE (NCSI_PKT_CMD_AE + 0x80)
422 #define NCSI_PKT_RSP_SL (NCSI_PKT_CMD_SL + 0x80)
423 #define NCSI_PKT_RSP_GLS (NCSI_PKT_CMD_GLS + 0x80)
424 #define NCSI_PKT_RSP_SVF (NCSI_PKT_CMD_SVF + 0x80)
425 #define NCSI_PKT_RSP_EV (NCSI_PKT_CMD_EV + 0x80)
426 #define NCSI_PKT_RSP_DV (NCSI_PKT_CMD_DV + 0x80)
427 #define NCSI_PKT_RSP_SMA (NCSI_PKT_CMD_SMA + 0x80)
428 #define NCSI_PKT_RSP_EBF (NCSI_PKT_CMD_EBF + 0x80)
429 #define NCSI_PKT_RSP_DBF (NCSI_PKT_CMD_DBF + 0x80)
430 #define NCSI_PKT_RSP_EGMF (NCSI_PKT_CMD_EGMF + 0x80)
431 #define NCSI_PKT_RSP_DGMF (NCSI_PKT_CMD_DGMF + 0x80)
432 #define NCSI_PKT_RSP_SNFC (NCSI_PKT_CMD_SNFC + 0x80)
433 #define NCSI_PKT_RSP_GVI (NCSI_PKT_CMD_GVI + 0x80)
434 #define NCSI_PKT_RSP_GC (NCSI_PKT_CMD_GC + 0x80)
435 #define NCSI_PKT_RSP_GP (NCSI_PKT_CMD_GP + 0x80)
436 #define NCSI_PKT_RSP_GCPS (NCSI_PKT_CMD_GCPS + 0x80)
437 #define NCSI_PKT_RSP_GNS (NCSI_PKT_CMD_GNS + 0x80)
438 #define NCSI_PKT_RSP_GNPTS (NCSI_PKT_CMD_GNPTS + 0x80)
439 #define NCSI_PKT_RSP_GPS (NCSI_PKT_CMD_GPS + 0x80)
440 #define NCSI_PKT_RSP_OEM (NCSI_PKT_CMD_OEM + 0x80)
441 #define NCSI_PKT_RSP_PLDM (NCSI_PKT_CMD_PLDM + 0x80)
442 #define NCSI_PKT_RSP_GPUUID (NCSI_PKT_CMD_GPUUID + 0x80)
443 #define NCSI_PKT_RSP_QPNPR (NCSI_PKT_CMD_QPNPR + 0x80)
444 #define NCSI_PKT_RSP_SNPR (NCSI_PKT_CMD_SNPR + 0x80)
445 #define NCSI_PKT_RSP_GMCMA (NCSI_PKT_CMD_GMCMA + 0x80)
447 /* NCSI response code/reason */
448 #define NCSI_PKT_RSP_C_COMPLETED 0x0000 /* Command Completed */
449 #define NCSI_PKT_RSP_C_FAILED 0x0001 /* Command Failed */
450 #define NCSI_PKT_RSP_C_UNAVAILABLE 0x0002 /* Command Unavailable */
451 #define NCSI_PKT_RSP_C_UNSUPPORTED 0x0003 /* Command Unsupported */
452 #define NCSI_PKT_RSP_R_NO_ERROR 0x0000 /* No Error */
453 #define NCSI_PKT_RSP_R_INTERFACE 0x0001 /* Interface not ready */
454 #define NCSI_PKT_RSP_R_PARAM 0x0002 /* Invalid Parameter */
455 #define NCSI_PKT_RSP_R_CHANNEL 0x0003 /* Channel not Ready */
456 #define NCSI_PKT_RSP_R_PACKAGE 0x0004 /* Package not Ready */
457 #define NCSI_PKT_RSP_R_LENGTH 0x0005 /* Invalid payload length */
458 #define NCSI_PKT_RSP_R_UNKNOWN 0x7fff /* Command type unsupported */
460 /* NCSI AEN packet type */
461 #define NCSI_PKT_AEN 0xFF /* AEN Packet */
462 #define NCSI_PKT_AEN_LSC 0x00 /* Link status change */
463 #define NCSI_PKT_AEN_CR 0x01 /* Configuration required */
464 #define NCSI_PKT_AEN_HNCDSC 0x02 /* HNC driver status change */
466 #endif /* __NCSI_PKT_H__ */