Linux 3.4.102
[linux/fpc-iii.git] / drivers / net / ethernet / brocade / bna / bfi_enet.h
bloba90f1cf46b41771025deb0f4c3899c6febcb7c7e
1 /*
2 * Linux network driver for Brocade Converged Network Adapter.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License (GPL) Version 2 as
6 * published by the Free Software Foundation
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
14 * Copyright (c) 2005-2011 Brocade Communications Systems, Inc.
15 * All rights reserved
16 * www.brocade.com
19 /**
20 * @file bfi_enet.h BNA Hardware and Firmware Interface
23 /**
24 * Skipping statistics collection to avoid clutter.
25 * Command is no longer needed:
26 * MTU
27 * TxQ Stop
28 * RxQ Stop
29 * RxF Enable/Disable
31 * HDS-off request is dynamic
32 * keep structures as multiple of 32-bit fields for alignment.
33 * All values must be written in big-endian.
35 #ifndef __BFI_ENET_H__
36 #define __BFI_ENET_H__
38 #include "bfa_defs.h"
39 #include "bfi.h"
41 #pragma pack(1)
43 #define BFI_ENET_CFG_MAX 32 /* Max resources per PF */
45 #define BFI_ENET_TXQ_PRIO_MAX 8
46 #define BFI_ENET_RX_QSET_MAX 16
47 #define BFI_ENET_TXQ_WI_VECT_MAX 4
49 #define BFI_ENET_VLAN_ID_MAX 4096
50 #define BFI_ENET_VLAN_BLOCK_SIZE 512 /* in bits */
51 #define BFI_ENET_VLAN_BLOCKS_MAX \
52 (BFI_ENET_VLAN_ID_MAX / BFI_ENET_VLAN_BLOCK_SIZE)
53 #define BFI_ENET_VLAN_WORD_SIZE 32 /* in bits */
54 #define BFI_ENET_VLAN_WORDS_MAX \
55 (BFI_ENET_VLAN_BLOCK_SIZE / BFI_ENET_VLAN_WORD_SIZE)
57 #define BFI_ENET_RSS_RIT_MAX 64 /* entries */
58 #define BFI_ENET_RSS_KEY_LEN 10 /* 32-bit words */
60 union bfi_addr_be_u {
61 struct {
62 u32 addr_hi; /* Most Significant 32-bits */
63 u32 addr_lo; /* Least Significant 32-Bits */
64 } a32;
67 /**
68 * T X Q U E U E D E F I N E S
70 /* TxQ Vector (a.k.a. Tx-Buffer Descriptor) */
71 /* TxQ Entry Opcodes */
72 #define BFI_ENET_TXQ_WI_SEND (0x402) /* Single Frame Transmission */
73 #define BFI_ENET_TXQ_WI_SEND_LSO (0x403) /* Multi-Frame Transmission */
74 #define BFI_ENET_TXQ_WI_EXTENSION (0x104) /* Extension WI */
76 /* TxQ Entry Control Flags */
77 #define BFI_ENET_TXQ_WI_CF_FCOE_CRC (1 << 8)
78 #define BFI_ENET_TXQ_WI_CF_IPID_MODE (1 << 5)
79 #define BFI_ENET_TXQ_WI_CF_INS_PRIO (1 << 4)
80 #define BFI_ENET_TXQ_WI_CF_INS_VLAN (1 << 3)
81 #define BFI_ENET_TXQ_WI_CF_UDP_CKSUM (1 << 2)
82 #define BFI_ENET_TXQ_WI_CF_TCP_CKSUM (1 << 1)
83 #define BFI_ENET_TXQ_WI_CF_IP_CKSUM (1 << 0)
85 struct bfi_enet_txq_wi_base {
86 u8 reserved;
87 u8 num_vectors; /* number of vectors present */
88 u16 opcode;
89 /* BFI_ENET_TXQ_WI_SEND or BFI_ENET_TXQ_WI_SEND_LSO */
90 u16 flags; /* OR of all the flags */
91 u16 l4_hdr_size_n_offset;
92 u16 vlan_tag;
93 u16 lso_mss; /* Only 14 LSB are valid */
94 u32 frame_length; /* Only 24 LSB are valid */
97 struct bfi_enet_txq_wi_ext {
98 u16 reserved;
99 u16 opcode; /* BFI_ENET_TXQ_WI_EXTENSION */
100 u32 reserved2[3];
103 struct bfi_enet_txq_wi_vector { /* Tx Buffer Descriptor */
104 u16 reserved;
105 u16 length; /* Only 14 LSB are valid */
106 union bfi_addr_be_u addr;
110 * TxQ Entry Structure
113 struct bfi_enet_txq_entry {
114 union {
115 struct bfi_enet_txq_wi_base base;
116 struct bfi_enet_txq_wi_ext ext;
117 } wi;
118 struct bfi_enet_txq_wi_vector vector[BFI_ENET_TXQ_WI_VECT_MAX];
121 #define wi_hdr wi.base
122 #define wi_ext_hdr wi.ext
124 #define BFI_ENET_TXQ_WI_L4_HDR_N_OFFSET(_hdr_size, _offset) \
125 (((_hdr_size) << 10) | ((_offset) & 0x3FF))
128 * R X Q U E U E D E F I N E S
130 struct bfi_enet_rxq_entry {
131 union bfi_addr_be_u rx_buffer;
135 * R X C O M P L E T I O N Q U E U E D E F I N E S
137 /* CQ Entry Flags */
138 #define BFI_ENET_CQ_EF_MAC_ERROR (1 << 0)
139 #define BFI_ENET_CQ_EF_FCS_ERROR (1 << 1)
140 #define BFI_ENET_CQ_EF_TOO_LONG (1 << 2)
141 #define BFI_ENET_CQ_EF_FC_CRC_OK (1 << 3)
143 #define BFI_ENET_CQ_EF_RSVD1 (1 << 4)
144 #define BFI_ENET_CQ_EF_L4_CKSUM_OK (1 << 5)
145 #define BFI_ENET_CQ_EF_L3_CKSUM_OK (1 << 6)
146 #define BFI_ENET_CQ_EF_HDS_HEADER (1 << 7)
148 #define BFI_ENET_CQ_EF_UDP (1 << 8)
149 #define BFI_ENET_CQ_EF_TCP (1 << 9)
150 #define BFI_ENET_CQ_EF_IP_OPTIONS (1 << 10)
151 #define BFI_ENET_CQ_EF_IPV6 (1 << 11)
153 #define BFI_ENET_CQ_EF_IPV4 (1 << 12)
154 #define BFI_ENET_CQ_EF_VLAN (1 << 13)
155 #define BFI_ENET_CQ_EF_RSS (1 << 14)
156 #define BFI_ENET_CQ_EF_RSVD2 (1 << 15)
158 #define BFI_ENET_CQ_EF_MCAST_MATCH (1 << 16)
159 #define BFI_ENET_CQ_EF_MCAST (1 << 17)
160 #define BFI_ENET_CQ_EF_BCAST (1 << 18)
161 #define BFI_ENET_CQ_EF_REMOTE (1 << 19)
163 #define BFI_ENET_CQ_EF_LOCAL (1 << 20)
165 /* CQ Entry Structure */
166 struct bfi_enet_cq_entry {
167 u32 flags;
168 u16 vlan_tag;
169 u16 length;
170 u32 rss_hash;
171 u8 valid;
172 u8 reserved1;
173 u8 reserved2;
174 u8 rxq_id;
178 * E N E T C O N T R O L P A T H C O M M A N D S
180 struct bfi_enet_q {
181 union bfi_addr_u pg_tbl;
182 union bfi_addr_u first_entry;
183 u16 pages; /* # of pages */
184 u16 page_sz;
187 struct bfi_enet_txq {
188 struct bfi_enet_q q;
189 u8 priority;
190 u8 rsvd[3];
193 struct bfi_enet_rxq {
194 struct bfi_enet_q q;
195 u16 rx_buffer_size;
196 u16 rsvd;
199 struct bfi_enet_cq {
200 struct bfi_enet_q q;
203 struct bfi_enet_ib_cfg {
204 u8 int_pkt_dma;
205 u8 int_enabled;
206 u8 int_pkt_enabled;
207 u8 continuous_coalescing;
208 u8 msix;
209 u8 rsvd[3];
210 u32 coalescing_timeout;
211 u32 inter_pkt_timeout;
212 u8 inter_pkt_count;
213 u8 rsvd1[3];
216 struct bfi_enet_ib {
217 union bfi_addr_u index_addr;
218 union {
219 u16 msix_index;
220 u16 intx_bitmask;
221 } intr;
222 u16 rsvd;
226 * ENET command messages
228 enum bfi_enet_h2i_msgs {
229 /* Rx Commands */
230 BFI_ENET_H2I_RX_CFG_SET_REQ = 1,
231 BFI_ENET_H2I_RX_CFG_CLR_REQ = 2,
233 BFI_ENET_H2I_RIT_CFG_REQ = 3,
234 BFI_ENET_H2I_RSS_CFG_REQ = 4,
235 BFI_ENET_H2I_RSS_ENABLE_REQ = 5,
236 BFI_ENET_H2I_RX_PROMISCUOUS_REQ = 6,
237 BFI_ENET_H2I_RX_DEFAULT_REQ = 7,
239 BFI_ENET_H2I_MAC_UCAST_SET_REQ = 8,
240 BFI_ENET_H2I_MAC_UCAST_CLR_REQ = 9,
241 BFI_ENET_H2I_MAC_UCAST_ADD_REQ = 10,
242 BFI_ENET_H2I_MAC_UCAST_DEL_REQ = 11,
244 BFI_ENET_H2I_MAC_MCAST_ADD_REQ = 12,
245 BFI_ENET_H2I_MAC_MCAST_DEL_REQ = 13,
246 BFI_ENET_H2I_MAC_MCAST_FILTER_REQ = 14,
248 BFI_ENET_H2I_RX_VLAN_SET_REQ = 15,
249 BFI_ENET_H2I_RX_VLAN_STRIP_ENABLE_REQ = 16,
251 /* Tx Commands */
252 BFI_ENET_H2I_TX_CFG_SET_REQ = 17,
253 BFI_ENET_H2I_TX_CFG_CLR_REQ = 18,
255 /* Port Commands */
256 BFI_ENET_H2I_PORT_ADMIN_UP_REQ = 19,
257 BFI_ENET_H2I_SET_PAUSE_REQ = 20,
258 BFI_ENET_H2I_DIAG_LOOPBACK_REQ = 21,
260 /* Get Attributes Command */
261 BFI_ENET_H2I_GET_ATTR_REQ = 22,
263 /* Statistics Commands */
264 BFI_ENET_H2I_STATS_GET_REQ = 23,
265 BFI_ENET_H2I_STATS_CLR_REQ = 24,
267 BFI_ENET_H2I_WOL_MAGIC_REQ = 25,
268 BFI_ENET_H2I_WOL_FRAME_REQ = 26,
270 BFI_ENET_H2I_MAX = 27,
273 enum bfi_enet_i2h_msgs {
274 /* Rx Responses */
275 BFI_ENET_I2H_RX_CFG_SET_RSP =
276 BFA_I2HM(BFI_ENET_H2I_RX_CFG_SET_REQ),
277 BFI_ENET_I2H_RX_CFG_CLR_RSP =
278 BFA_I2HM(BFI_ENET_H2I_RX_CFG_CLR_REQ),
280 BFI_ENET_I2H_RIT_CFG_RSP =
281 BFA_I2HM(BFI_ENET_H2I_RIT_CFG_REQ),
282 BFI_ENET_I2H_RSS_CFG_RSP =
283 BFA_I2HM(BFI_ENET_H2I_RSS_CFG_REQ),
284 BFI_ENET_I2H_RSS_ENABLE_RSP =
285 BFA_I2HM(BFI_ENET_H2I_RSS_ENABLE_REQ),
286 BFI_ENET_I2H_RX_PROMISCUOUS_RSP =
287 BFA_I2HM(BFI_ENET_H2I_RX_PROMISCUOUS_REQ),
288 BFI_ENET_I2H_RX_DEFAULT_RSP =
289 BFA_I2HM(BFI_ENET_H2I_RX_DEFAULT_REQ),
291 BFI_ENET_I2H_MAC_UCAST_SET_RSP =
292 BFA_I2HM(BFI_ENET_H2I_MAC_UCAST_SET_REQ),
293 BFI_ENET_I2H_MAC_UCAST_CLR_RSP =
294 BFA_I2HM(BFI_ENET_H2I_MAC_UCAST_CLR_REQ),
295 BFI_ENET_I2H_MAC_UCAST_ADD_RSP =
296 BFA_I2HM(BFI_ENET_H2I_MAC_UCAST_ADD_REQ),
297 BFI_ENET_I2H_MAC_UCAST_DEL_RSP =
298 BFA_I2HM(BFI_ENET_H2I_MAC_UCAST_DEL_REQ),
300 BFI_ENET_I2H_MAC_MCAST_ADD_RSP =
301 BFA_I2HM(BFI_ENET_H2I_MAC_MCAST_ADD_REQ),
302 BFI_ENET_I2H_MAC_MCAST_DEL_RSP =
303 BFA_I2HM(BFI_ENET_H2I_MAC_MCAST_DEL_REQ),
304 BFI_ENET_I2H_MAC_MCAST_FILTER_RSP =
305 BFA_I2HM(BFI_ENET_H2I_MAC_MCAST_FILTER_REQ),
307 BFI_ENET_I2H_RX_VLAN_SET_RSP =
308 BFA_I2HM(BFI_ENET_H2I_RX_VLAN_SET_REQ),
310 BFI_ENET_I2H_RX_VLAN_STRIP_ENABLE_RSP =
311 BFA_I2HM(BFI_ENET_H2I_RX_VLAN_STRIP_ENABLE_REQ),
313 /* Tx Responses */
314 BFI_ENET_I2H_TX_CFG_SET_RSP =
315 BFA_I2HM(BFI_ENET_H2I_TX_CFG_SET_REQ),
316 BFI_ENET_I2H_TX_CFG_CLR_RSP =
317 BFA_I2HM(BFI_ENET_H2I_TX_CFG_CLR_REQ),
319 /* Port Responses */
320 BFI_ENET_I2H_PORT_ADMIN_RSP =
321 BFA_I2HM(BFI_ENET_H2I_PORT_ADMIN_UP_REQ),
323 BFI_ENET_I2H_SET_PAUSE_RSP =
324 BFA_I2HM(BFI_ENET_H2I_SET_PAUSE_REQ),
325 BFI_ENET_I2H_DIAG_LOOPBACK_RSP =
326 BFA_I2HM(BFI_ENET_H2I_DIAG_LOOPBACK_REQ),
328 /* Attributes Response */
329 BFI_ENET_I2H_GET_ATTR_RSP =
330 BFA_I2HM(BFI_ENET_H2I_GET_ATTR_REQ),
332 /* Statistics Responses */
333 BFI_ENET_I2H_STATS_GET_RSP =
334 BFA_I2HM(BFI_ENET_H2I_STATS_GET_REQ),
335 BFI_ENET_I2H_STATS_CLR_RSP =
336 BFA_I2HM(BFI_ENET_H2I_STATS_CLR_REQ),
338 BFI_ENET_I2H_WOL_MAGIC_RSP =
339 BFA_I2HM(BFI_ENET_H2I_WOL_MAGIC_REQ),
340 BFI_ENET_I2H_WOL_FRAME_RSP =
341 BFA_I2HM(BFI_ENET_H2I_WOL_FRAME_REQ),
343 /* AENs */
344 BFI_ENET_I2H_LINK_DOWN_AEN = BFA_I2HM(BFI_ENET_H2I_MAX),
345 BFI_ENET_I2H_LINK_UP_AEN = BFA_I2HM(BFI_ENET_H2I_MAX + 1),
347 BFI_ENET_I2H_PORT_ENABLE_AEN = BFA_I2HM(BFI_ENET_H2I_MAX + 2),
348 BFI_ENET_I2H_PORT_DISABLE_AEN = BFA_I2HM(BFI_ENET_H2I_MAX + 3),
350 BFI_ENET_I2H_BW_UPDATE_AEN = BFA_I2HM(BFI_ENET_H2I_MAX + 4),
354 * The following error codes can be returned by the enet commands
356 enum bfi_enet_err {
357 BFI_ENET_CMD_OK = 0,
358 BFI_ENET_CMD_FAIL = 1,
359 BFI_ENET_CMD_DUP_ENTRY = 2, /* !< Duplicate entry in CAM */
360 BFI_ENET_CMD_CAM_FULL = 3, /* !< CAM is full */
361 BFI_ENET_CMD_NOT_OWNER = 4, /* !< Not permitted, b'cos not owner */
362 BFI_ENET_CMD_NOT_EXEC = 5, /* !< Was not sent to f/w at all */
363 BFI_ENET_CMD_WAITING = 6, /* !< Waiting for completion */
364 BFI_ENET_CMD_PORT_DISABLED = 7, /* !< port in disabled state */
368 * Generic Request
370 * bfi_enet_req is used by:
371 * BFI_ENET_H2I_RX_CFG_CLR_REQ
372 * BFI_ENET_H2I_TX_CFG_CLR_REQ
374 struct bfi_enet_req {
375 struct bfi_msgq_mhdr mh;
379 * Enable/Disable Request
381 * bfi_enet_enable_req is used by:
382 * BFI_ENET_H2I_RSS_ENABLE_REQ (enet_id must be zero)
383 * BFI_ENET_H2I_RX_PROMISCUOUS_REQ (enet_id must be zero)
384 * BFI_ENET_H2I_RX_DEFAULT_REQ (enet_id must be zero)
385 * BFI_ENET_H2I_RX_MAC_MCAST_FILTER_REQ
386 * BFI_ENET_H2I_PORT_ADMIN_UP_REQ (enet_id must be zero)
388 struct bfi_enet_enable_req {
389 struct bfi_msgq_mhdr mh;
390 u8 enable; /* 1 = enable; 0 = disable */
391 u8 rsvd[3];
395 * Generic Response
397 struct bfi_enet_rsp {
398 struct bfi_msgq_mhdr mh;
399 u8 error; /*!< if error see cmd_offset */
400 u8 rsvd;
401 u16 cmd_offset; /*!< offset to invalid parameter */
405 * GLOBAL CONFIGURATION
409 * bfi_enet_attr_req is used by:
410 * BFI_ENET_H2I_GET_ATTR_REQ
412 struct bfi_enet_attr_req {
413 struct bfi_msgq_mhdr mh;
417 * bfi_enet_attr_rsp is used by:
418 * BFI_ENET_I2H_GET_ATTR_RSP
420 struct bfi_enet_attr_rsp {
421 struct bfi_msgq_mhdr mh;
422 u8 error; /*!< if error see cmd_offset */
423 u8 rsvd;
424 u16 cmd_offset; /*!< offset to invalid parameter */
425 u32 max_cfg;
426 u32 max_ucmac;
427 u32 rit_size;
431 * Tx Configuration
433 * bfi_enet_tx_cfg is used by:
434 * BFI_ENET_H2I_TX_CFG_SET_REQ
436 enum bfi_enet_tx_vlan_mode {
437 BFI_ENET_TX_VLAN_NOP = 0,
438 BFI_ENET_TX_VLAN_INS = 1,
439 BFI_ENET_TX_VLAN_WI = 2,
442 struct bfi_enet_tx_cfg {
443 u8 vlan_mode; /*!< processing mode */
444 u8 rsvd;
445 u16 vlan_id;
446 u8 admit_tagged_frame;
447 u8 apply_vlan_filter;
448 u8 add_to_vswitch;
449 u8 rsvd1[1];
452 struct bfi_enet_tx_cfg_req {
453 struct bfi_msgq_mhdr mh;
454 u8 num_queues; /* # of Tx Queues */
455 u8 rsvd[3];
457 struct {
458 struct bfi_enet_txq q;
459 struct bfi_enet_ib ib;
460 } q_cfg[BFI_ENET_TXQ_PRIO_MAX];
462 struct bfi_enet_ib_cfg ib_cfg;
464 struct bfi_enet_tx_cfg tx_cfg;
467 struct bfi_enet_tx_cfg_rsp {
468 struct bfi_msgq_mhdr mh;
469 u8 error;
470 u8 hw_id; /* For debugging */
471 u8 rsvd[2];
472 struct {
473 u32 q_dbell; /* PCI base address offset */
474 u32 i_dbell; /* PCI base address offset */
475 u8 hw_qid; /* For debugging */
476 u8 rsvd[3];
477 } q_handles[BFI_ENET_TXQ_PRIO_MAX];
481 * Rx Configuration
483 * bfi_enet_rx_cfg is used by:
484 * BFI_ENET_H2I_RX_CFG_SET_REQ
486 enum bfi_enet_rxq_type {
487 BFI_ENET_RXQ_SINGLE = 1,
488 BFI_ENET_RXQ_LARGE_SMALL = 2,
489 BFI_ENET_RXQ_HDS = 3,
490 BFI_ENET_RXQ_HDS_OPT_BASED = 4,
493 enum bfi_enet_hds_type {
494 BFI_ENET_HDS_FORCED = 0x01,
495 BFI_ENET_HDS_IPV6_UDP = 0x02,
496 BFI_ENET_HDS_IPV6_TCP = 0x04,
497 BFI_ENET_HDS_IPV4_TCP = 0x08,
498 BFI_ENET_HDS_IPV4_UDP = 0x10,
501 struct bfi_enet_rx_cfg {
502 u8 rxq_type;
503 u8 rsvd[3];
505 struct {
506 u8 max_header_size;
507 u8 force_offset;
508 u8 type;
509 u8 rsvd1;
510 } hds;
512 u8 multi_buffer;
513 u8 strip_vlan;
514 u8 drop_untagged;
515 u8 rsvd2;
519 * Multicast frames are received on the ql of q-set index zero.
520 * On the completion queue. RxQ ID = even is for large/data buffer queues
521 * and RxQ ID = odd is for small/header buffer queues.
523 struct bfi_enet_rx_cfg_req {
524 struct bfi_msgq_mhdr mh;
525 u8 num_queue_sets; /* # of Rx Queue Sets */
526 u8 rsvd[3];
528 struct {
529 struct bfi_enet_rxq ql; /* large/data/single buffers */
530 struct bfi_enet_rxq qs; /* small/header buffers */
531 struct bfi_enet_cq cq;
532 struct bfi_enet_ib ib;
533 } q_cfg[BFI_ENET_RX_QSET_MAX];
535 struct bfi_enet_ib_cfg ib_cfg;
537 struct bfi_enet_rx_cfg rx_cfg;
540 struct bfi_enet_rx_cfg_rsp {
541 struct bfi_msgq_mhdr mh;
542 u8 error;
543 u8 hw_id; /* For debugging */
544 u8 rsvd[2];
545 struct {
546 u32 ql_dbell; /* PCI base address offset */
547 u32 qs_dbell; /* PCI base address offset */
548 u32 i_dbell; /* PCI base address offset */
549 u8 hw_lqid; /* For debugging */
550 u8 hw_sqid; /* For debugging */
551 u8 hw_cqid; /* For debugging */
552 u8 rsvd;
553 } q_handles[BFI_ENET_RX_QSET_MAX];
557 * RIT
559 * bfi_enet_rit_req is used by:
560 * BFI_ENET_H2I_RIT_CFG_REQ
562 struct bfi_enet_rit_req {
563 struct bfi_msgq_mhdr mh;
564 u16 size; /* number of table-entries used */
565 u8 rsvd[2];
566 u8 table[BFI_ENET_RSS_RIT_MAX];
570 * RSS
572 * bfi_enet_rss_cfg_req is used by:
573 * BFI_ENET_H2I_RSS_CFG_REQ
575 enum bfi_enet_rss_type {
576 BFI_ENET_RSS_IPV6 = 0x01,
577 BFI_ENET_RSS_IPV6_TCP = 0x02,
578 BFI_ENET_RSS_IPV4 = 0x04,
579 BFI_ENET_RSS_IPV4_TCP = 0x08
582 struct bfi_enet_rss_cfg {
583 u8 type;
584 u8 mask;
585 u8 rsvd[2];
586 u32 key[BFI_ENET_RSS_KEY_LEN];
589 struct bfi_enet_rss_cfg_req {
590 struct bfi_msgq_mhdr mh;
591 struct bfi_enet_rss_cfg cfg;
595 * MAC Unicast
597 * bfi_enet_rx_vlan_req is used by:
598 * BFI_ENET_H2I_MAC_UCAST_SET_REQ
599 * BFI_ENET_H2I_MAC_UCAST_CLR_REQ
600 * BFI_ENET_H2I_MAC_UCAST_ADD_REQ
601 * BFI_ENET_H2I_MAC_UCAST_DEL_REQ
603 struct bfi_enet_ucast_req {
604 struct bfi_msgq_mhdr mh;
605 mac_t mac_addr;
606 u8 rsvd[2];
610 * MAC Unicast + VLAN
612 struct bfi_enet_mac_n_vlan_req {
613 struct bfi_msgq_mhdr mh;
614 u16 vlan_id;
615 mac_t mac_addr;
619 * MAC Multicast
621 * bfi_enet_mac_mfilter_add_req is used by:
622 * BFI_ENET_H2I_MAC_MCAST_ADD_REQ
624 struct bfi_enet_mcast_add_req {
625 struct bfi_msgq_mhdr mh;
626 mac_t mac_addr;
627 u8 rsvd[2];
631 * bfi_enet_mac_mfilter_add_rsp is used by:
632 * BFI_ENET_I2H_MAC_MCAST_ADD_RSP
634 struct bfi_enet_mcast_add_rsp {
635 struct bfi_msgq_mhdr mh;
636 u8 error;
637 u8 rsvd;
638 u16 cmd_offset;
639 u16 handle;
640 u8 rsvd1[2];
644 * bfi_enet_mac_mfilter_del_req is used by:
645 * BFI_ENET_H2I_MAC_MCAST_DEL_REQ
647 struct bfi_enet_mcast_del_req {
648 struct bfi_msgq_mhdr mh;
649 u16 handle;
650 u8 rsvd[2];
654 * VLAN
656 * bfi_enet_rx_vlan_req is used by:
657 * BFI_ENET_H2I_RX_VLAN_SET_REQ
659 struct bfi_enet_rx_vlan_req {
660 struct bfi_msgq_mhdr mh;
661 u8 block_idx;
662 u8 rsvd[3];
663 u32 bit_mask[BFI_ENET_VLAN_WORDS_MAX];
667 * PAUSE
669 * bfi_enet_set_pause_req is used by:
670 * BFI_ENET_H2I_SET_PAUSE_REQ
672 struct bfi_enet_set_pause_req {
673 struct bfi_msgq_mhdr mh;
674 u8 rsvd[2];
675 u8 tx_pause; /* 1 = enable; 0 = disable */
676 u8 rx_pause; /* 1 = enable; 0 = disable */
680 * DIAGNOSTICS
682 * bfi_enet_diag_lb_req is used by:
683 * BFI_ENET_H2I_DIAG_LOOPBACK
685 struct bfi_enet_diag_lb_req {
686 struct bfi_msgq_mhdr mh;
687 u8 rsvd[2];
688 u8 mode; /* cable or Serdes */
689 u8 enable; /* 1 = enable; 0 = disable */
693 * enum for Loopback opmodes
695 enum {
696 BFI_ENET_DIAG_LB_OPMODE_EXT = 0,
697 BFI_ENET_DIAG_LB_OPMODE_CBL = 1,
701 * STATISTICS
703 * bfi_enet_stats_req is used by:
704 * BFI_ENET_H2I_STATS_GET_REQ
705 * BFI_ENET_I2H_STATS_CLR_REQ
707 struct bfi_enet_stats_req {
708 struct bfi_msgq_mhdr mh;
709 u16 stats_mask;
710 u8 rsvd[2];
711 u32 rx_enet_mask;
712 u32 tx_enet_mask;
713 union bfi_addr_u host_buffer;
717 * defines for "stats_mask" above.
719 #define BFI_ENET_STATS_MAC (1 << 0) /* !< MAC Statistics */
720 #define BFI_ENET_STATS_BPC (1 << 1) /* !< Pause Stats from BPC */
721 #define BFI_ENET_STATS_RAD (1 << 2) /* !< Rx Admission Statistics */
722 #define BFI_ENET_STATS_RX_FC (1 << 3) /* !< Rx FC Stats from RxA */
723 #define BFI_ENET_STATS_TX_FC (1 << 4) /* !< Tx FC Stats from TxA */
725 #define BFI_ENET_STATS_ALL 0x1f
727 /* TxF Frame Statistics */
728 struct bfi_enet_stats_txf {
729 u64 ucast_octets;
730 u64 ucast;
731 u64 ucast_vlan;
733 u64 mcast_octets;
734 u64 mcast;
735 u64 mcast_vlan;
737 u64 bcast_octets;
738 u64 bcast;
739 u64 bcast_vlan;
741 u64 errors;
742 u64 filter_vlan; /* frames filtered due to VLAN */
743 u64 filter_mac_sa; /* frames filtered due to SA check */
746 /* RxF Frame Statistics */
747 struct bfi_enet_stats_rxf {
748 u64 ucast_octets;
749 u64 ucast;
750 u64 ucast_vlan;
752 u64 mcast_octets;
753 u64 mcast;
754 u64 mcast_vlan;
756 u64 bcast_octets;
757 u64 bcast;
758 u64 bcast_vlan;
759 u64 frame_drops;
762 /* FC Tx Frame Statistics */
763 struct bfi_enet_stats_fc_tx {
764 u64 txf_ucast_octets;
765 u64 txf_ucast;
766 u64 txf_ucast_vlan;
768 u64 txf_mcast_octets;
769 u64 txf_mcast;
770 u64 txf_mcast_vlan;
772 u64 txf_bcast_octets;
773 u64 txf_bcast;
774 u64 txf_bcast_vlan;
776 u64 txf_parity_errors;
777 u64 txf_timeout;
778 u64 txf_fid_parity_errors;
781 /* FC Rx Frame Statistics */
782 struct bfi_enet_stats_fc_rx {
783 u64 rxf_ucast_octets;
784 u64 rxf_ucast;
785 u64 rxf_ucast_vlan;
787 u64 rxf_mcast_octets;
788 u64 rxf_mcast;
789 u64 rxf_mcast_vlan;
791 u64 rxf_bcast_octets;
792 u64 rxf_bcast;
793 u64 rxf_bcast_vlan;
796 /* RAD Frame Statistics */
797 struct bfi_enet_stats_rad {
798 u64 rx_frames;
799 u64 rx_octets;
800 u64 rx_vlan_frames;
802 u64 rx_ucast;
803 u64 rx_ucast_octets;
804 u64 rx_ucast_vlan;
806 u64 rx_mcast;
807 u64 rx_mcast_octets;
808 u64 rx_mcast_vlan;
810 u64 rx_bcast;
811 u64 rx_bcast_octets;
812 u64 rx_bcast_vlan;
814 u64 rx_drops;
817 /* BPC Tx Registers */
818 struct bfi_enet_stats_bpc {
819 /* transmit stats */
820 u64 tx_pause[8];
821 u64 tx_zero_pause[8]; /*!< Pause cancellation */
822 /*!<Pause initiation rather than retention */
823 u64 tx_first_pause[8];
825 /* receive stats */
826 u64 rx_pause[8];
827 u64 rx_zero_pause[8]; /*!< Pause cancellation */
828 /*!<Pause initiation rather than retention */
829 u64 rx_first_pause[8];
832 /* MAC Rx Statistics */
833 struct bfi_enet_stats_mac {
834 u64 frame_64; /* both rx and tx counter */
835 u64 frame_65_127; /* both rx and tx counter */
836 u64 frame_128_255; /* both rx and tx counter */
837 u64 frame_256_511; /* both rx and tx counter */
838 u64 frame_512_1023; /* both rx and tx counter */
839 u64 frame_1024_1518; /* both rx and tx counter */
840 u64 frame_1519_1522; /* both rx and tx counter */
842 /* receive stats */
843 u64 rx_bytes;
844 u64 rx_packets;
845 u64 rx_fcs_error;
846 u64 rx_multicast;
847 u64 rx_broadcast;
848 u64 rx_control_frames;
849 u64 rx_pause;
850 u64 rx_unknown_opcode;
851 u64 rx_alignment_error;
852 u64 rx_frame_length_error;
853 u64 rx_code_error;
854 u64 rx_carrier_sense_error;
855 u64 rx_undersize;
856 u64 rx_oversize;
857 u64 rx_fragments;
858 u64 rx_jabber;
859 u64 rx_drop;
861 /* transmit stats */
862 u64 tx_bytes;
863 u64 tx_packets;
864 u64 tx_multicast;
865 u64 tx_broadcast;
866 u64 tx_pause;
867 u64 tx_deferral;
868 u64 tx_excessive_deferral;
869 u64 tx_single_collision;
870 u64 tx_muliple_collision;
871 u64 tx_late_collision;
872 u64 tx_excessive_collision;
873 u64 tx_total_collision;
874 u64 tx_pause_honored;
875 u64 tx_drop;
876 u64 tx_jabber;
877 u64 tx_fcs_error;
878 u64 tx_control_frame;
879 u64 tx_oversize;
880 u64 tx_undersize;
881 u64 tx_fragments;
885 * Complete statistics, DMAed from fw to host followed by
886 * BFI_ENET_I2H_STATS_GET_RSP
888 struct bfi_enet_stats {
889 struct bfi_enet_stats_mac mac_stats;
890 struct bfi_enet_stats_bpc bpc_stats;
891 struct bfi_enet_stats_rad rad_stats;
892 struct bfi_enet_stats_rad rlb_stats;
893 struct bfi_enet_stats_fc_rx fc_rx_stats;
894 struct bfi_enet_stats_fc_tx fc_tx_stats;
895 struct bfi_enet_stats_rxf rxf_stats[BFI_ENET_CFG_MAX];
896 struct bfi_enet_stats_txf txf_stats[BFI_ENET_CFG_MAX];
899 #pragma pack()
901 #endif /* __BFI_ENET_H__ */