Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
bfi_enet.h
Go to the documentation of this file.
1 /*
2  * Linux network driver for Brocade Converged Network Adapter.
3  *
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
7  *
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.
12  */
13 /*
14  * Copyright (c) 2005-2011 Brocade Communications Systems, Inc.
15  * All rights reserved
16  * www.brocade.com
17  */
18 
19 /* BNA Hardware and Firmware Interface */
20 
21 /* Skipping statistics collection to avoid clutter.
22  * Command is no longer needed:
23  * MTU
24  * TxQ Stop
25  * RxQ Stop
26  * RxF Enable/Disable
27  *
28  * HDS-off request is dynamic
29  * keep structures as multiple of 32-bit fields for alignment.
30  * All values must be written in big-endian.
31  */
32 #ifndef __BFI_ENET_H__
33 #define __BFI_ENET_H__
34 
35 #include "bfa_defs.h"
36 #include "bfi.h"
37 
38 #pragma pack(1)
39 
40 #define BFI_ENET_CFG_MAX 32 /* Max resources per PF */
41 
42 #define BFI_ENET_TXQ_PRIO_MAX 8
43 #define BFI_ENET_RX_QSET_MAX 16
44 #define BFI_ENET_TXQ_WI_VECT_MAX 4
45 
46 #define BFI_ENET_VLAN_ID_MAX 4096
47 #define BFI_ENET_VLAN_BLOCK_SIZE 512 /* in bits */
48 #define BFI_ENET_VLAN_BLOCKS_MAX \
49  (BFI_ENET_VLAN_ID_MAX / BFI_ENET_VLAN_BLOCK_SIZE)
50 #define BFI_ENET_VLAN_WORD_SIZE 32 /* in bits */
51 #define BFI_ENET_VLAN_WORDS_MAX \
52  (BFI_ENET_VLAN_BLOCK_SIZE / BFI_ENET_VLAN_WORD_SIZE)
53 
54 #define BFI_ENET_RSS_RIT_MAX 64 /* entries */
55 #define BFI_ENET_RSS_KEY_LEN 10 /* 32-bit words */
56 
58  struct {
59  u32 addr_hi; /* Most Significant 32-bits */
60  u32 addr_lo; /* Least Significant 32-Bits */
61  } a32;
62 };
63 
64 /* T X Q U E U E D E F I N E S */
65 /* TxQ Vector (a.k.a. Tx-Buffer Descriptor) */
66 /* TxQ Entry Opcodes */
67 #define BFI_ENET_TXQ_WI_SEND (0x402) /* Single Frame Transmission */
68 #define BFI_ENET_TXQ_WI_SEND_LSO (0x403) /* Multi-Frame Transmission */
69 #define BFI_ENET_TXQ_WI_EXTENSION (0x104) /* Extension WI */
70 
71 /* TxQ Entry Control Flags */
72 #define BFI_ENET_TXQ_WI_CF_FCOE_CRC (1 << 8)
73 #define BFI_ENET_TXQ_WI_CF_IPID_MODE (1 << 5)
74 #define BFI_ENET_TXQ_WI_CF_INS_PRIO (1 << 4)
75 #define BFI_ENET_TXQ_WI_CF_INS_VLAN (1 << 3)
76 #define BFI_ENET_TXQ_WI_CF_UDP_CKSUM (1 << 2)
77 #define BFI_ENET_TXQ_WI_CF_TCP_CKSUM (1 << 1)
78 #define BFI_ENET_TXQ_WI_CF_IP_CKSUM (1 << 0)
79 
82  u8 num_vectors; /* number of vectors present */
84  /* BFI_ENET_TXQ_WI_SEND or BFI_ENET_TXQ_WI_SEND_LSO */
85  u16 flags; /* OR of all the flags */
88  u16 lso_mss; /* Only 14 LSB are valid */
89  u32 frame_length; /* Only 24 LSB are valid */
90 };
91 
94  u16 opcode; /* BFI_ENET_TXQ_WI_EXTENSION */
96 };
97 
98 struct bfi_enet_txq_wi_vector { /* Tx Buffer Descriptor */
100  u16 length; /* Only 14 LSB are valid */
102 };
103 
104 /* TxQ Entry Structure */
106  union {
109  } wi;
111 };
112 
113 #define wi_hdr wi.base
114 #define wi_ext_hdr wi.ext
115 
116 #define BFI_ENET_TXQ_WI_L4_HDR_N_OFFSET(_hdr_size, _offset) \
117  (((_hdr_size) << 10) | ((_offset) & 0x3FF))
118 
119 /* R X Q U E U E D E F I N E S */
122 };
123 
124 /* R X C O M P L E T I O N Q U E U E D E F I N E S */
125 /* CQ Entry Flags */
126 #define BFI_ENET_CQ_EF_MAC_ERROR (1 << 0)
127 #define BFI_ENET_CQ_EF_FCS_ERROR (1 << 1)
128 #define BFI_ENET_CQ_EF_TOO_LONG (1 << 2)
129 #define BFI_ENET_CQ_EF_FC_CRC_OK (1 << 3)
130 
131 #define BFI_ENET_CQ_EF_RSVD1 (1 << 4)
132 #define BFI_ENET_CQ_EF_L4_CKSUM_OK (1 << 5)
133 #define BFI_ENET_CQ_EF_L3_CKSUM_OK (1 << 6)
134 #define BFI_ENET_CQ_EF_HDS_HEADER (1 << 7)
135 
136 #define BFI_ENET_CQ_EF_UDP (1 << 8)
137 #define BFI_ENET_CQ_EF_TCP (1 << 9)
138 #define BFI_ENET_CQ_EF_IP_OPTIONS (1 << 10)
139 #define BFI_ENET_CQ_EF_IPV6 (1 << 11)
140 
141 #define BFI_ENET_CQ_EF_IPV4 (1 << 12)
142 #define BFI_ENET_CQ_EF_VLAN (1 << 13)
143 #define BFI_ENET_CQ_EF_RSS (1 << 14)
144 #define BFI_ENET_CQ_EF_RSVD2 (1 << 15)
145 
146 #define BFI_ENET_CQ_EF_MCAST_MATCH (1 << 16)
147 #define BFI_ENET_CQ_EF_MCAST (1 << 17)
148 #define BFI_ENET_CQ_EF_BCAST (1 << 18)
149 #define BFI_ENET_CQ_EF_REMOTE (1 << 19)
150 
151 #define BFI_ENET_CQ_EF_LOCAL (1 << 20)
152 
153 /* CQ Entry Structure */
163 };
164 
165 /* E N E T C O N T R O L P A T H C O M M A N D S */
166 struct bfi_enet_q {
169  u16 pages; /* # of pages */
171 };
172 
173 struct bfi_enet_txq {
174  struct bfi_enet_q q;
176  u8 rsvd[3];
177 };
178 
179 struct bfi_enet_rxq {
180  struct bfi_enet_q q;
183 };
184 
185 struct bfi_enet_cq {
186  struct bfi_enet_q q;
187 };
188 
195  u8 rsvd[3];
199  u8 rsvd1[3];
200 };
201 
202 struct bfi_enet_ib {
204  union {
207  } intr;
209 };
210 
211 /* ENET command messages */
213  /* Rx Commands */
216 
222 
227 
231 
234 
235  /* Tx Commands */
238 
239  /* Port Commands */
243 
244  /* Get Attributes Command */
246 
247  /* Statistics Commands */
250 
253 
255 };
256 
258  /* Rx Responses */
263 
274 
283 
290 
293 
296 
297  /* Tx Responses */
302 
303  /* Port Responses */
306 
311 
312  /* Attributes Response */
315 
316  /* Statistics Responses */
321 
326 
327  /* AENs */
330 
333 
335 };
336 
337 /* The following error codes can be returned by the enet commands */
341  BFI_ENET_CMD_DUP_ENTRY = 2, /* !< Duplicate entry in CAM */
342  BFI_ENET_CMD_CAM_FULL = 3, /* !< CAM is full */
343  BFI_ENET_CMD_NOT_OWNER = 4, /* !< Not permitted, b'cos not owner */
344  BFI_ENET_CMD_NOT_EXEC = 5, /* !< Was not sent to f/w at all */
345  BFI_ENET_CMD_WAITING = 6, /* !< Waiting for completion */
346  BFI_ENET_CMD_PORT_DISABLED = 7, /* !< port in disabled state */
347 };
348 
349 /* Generic Request
350  *
351  * bfi_enet_req is used by:
352  * BFI_ENET_H2I_RX_CFG_CLR_REQ
353  * BFI_ENET_H2I_TX_CFG_CLR_REQ
354  */
355 struct bfi_enet_req {
357 };
358 
359 /* Enable/Disable Request
360  *
361  * bfi_enet_enable_req is used by:
362  * BFI_ENET_H2I_RSS_ENABLE_REQ (enet_id must be zero)
363  * BFI_ENET_H2I_RX_PROMISCUOUS_REQ (enet_id must be zero)
364  * BFI_ENET_H2I_RX_DEFAULT_REQ (enet_id must be zero)
365  * BFI_ENET_H2I_RX_MAC_MCAST_FILTER_REQ
366  * BFI_ENET_H2I_PORT_ADMIN_UP_REQ (enet_id must be zero)
367  */
370  u8 enable; /* 1 = enable; 0 = disable */
371  u8 rsvd[3];
372 };
373 
374 /* Generic Response */
375 struct bfi_enet_rsp {
380 };
381 
382 /* GLOBAL CONFIGURATION */
383 
384 /* bfi_enet_attr_req is used by:
385  * BFI_ENET_H2I_GET_ATTR_REQ
386  */
389 };
390 
391 /* bfi_enet_attr_rsp is used by:
392  * BFI_ENET_I2H_GET_ATTR_RSP
393  */
402 };
403 
404 /* Tx Configuration
405  *
406  * bfi_enet_tx_cfg is used by:
407  * BFI_ENET_H2I_TX_CFG_SET_REQ
408  */
413 };
414 
422  u8 rsvd1[1];
423 };
424 
427  u8 num_queues; /* # of Tx Queues */
428  u8 rsvd[3];
429 
430  struct {
431  struct bfi_enet_txq q;
432  struct bfi_enet_ib ib;
434 
436 
438 };
439 
443  u8 hw_id; /* For debugging */
444  u8 rsvd[2];
445  struct {
446  u32 q_dbell; /* PCI base address offset */
447  u32 i_dbell; /* PCI base address offset */
448  u8 hw_qid; /* For debugging */
449  u8 rsvd[3];
451 };
452 
453 /* Rx Configuration
454  *
455  * bfi_enet_rx_cfg is used by:
456  * BFI_ENET_H2I_RX_CFG_SET_REQ
457  */
463 };
464 
471 };
472 
475  u8 rsvd[3];
476 
477  struct {
482  } hds;
483 
488 };
489 
490 /*
491  * Multicast frames are received on the ql of q-set index zero.
492  * On the completion queue. RxQ ID = even is for large/data buffer queues
493  * and RxQ ID = odd is for small/header buffer queues.
494  */
497  u8 num_queue_sets; /* # of Rx Queue Sets */
498  u8 rsvd[3];
499 
500  struct {
501  struct bfi_enet_rxq ql; /* large/data/single buffers */
502  struct bfi_enet_rxq qs; /* small/header buffers */
503  struct bfi_enet_cq cq;
504  struct bfi_enet_ib ib;
506 
508 
510 };
511 
515  u8 hw_id; /* For debugging */
516  u8 rsvd[2];
517  struct {
518  u32 ql_dbell; /* PCI base address offset */
519  u32 qs_dbell; /* PCI base address offset */
520  u32 i_dbell; /* PCI base address offset */
521  u8 hw_lqid; /* For debugging */
522  u8 hw_sqid; /* For debugging */
523  u8 hw_cqid; /* For debugging */
524  u8 rsvd;
526 };
527 
528 /* RIT
529  *
530  * bfi_enet_rit_req is used by:
531  * BFI_ENET_H2I_RIT_CFG_REQ
532  */
535  u16 size; /* number of table-entries used */
536  u8 rsvd[2];
538 };
539 
540 /* RSS
541  *
542  * bfi_enet_rss_cfg_req is used by:
543  * BFI_ENET_H2I_RSS_CFG_REQ
544  */
550 };
551 
555  u8 rsvd[2];
557 };
558 
562 };
563 
564 /* MAC Unicast
565  *
566  * bfi_enet_rx_vlan_req is used by:
567  * BFI_ENET_H2I_MAC_UCAST_SET_REQ
568  * BFI_ENET_H2I_MAC_UCAST_CLR_REQ
569  * BFI_ENET_H2I_MAC_UCAST_ADD_REQ
570  * BFI_ENET_H2I_MAC_UCAST_DEL_REQ
571  */
575  u8 rsvd[2];
576 };
577 
578 /* MAC Unicast + VLAN */
583 };
584 
585 /* MAC Multicast
586  *
587  * bfi_enet_mac_mfilter_add_req is used by:
588  * BFI_ENET_H2I_MAC_MCAST_ADD_REQ
589  */
593  u8 rsvd[2];
594 };
595 
596 /* bfi_enet_mac_mfilter_add_rsp is used by:
597  * BFI_ENET_I2H_MAC_MCAST_ADD_RSP
598  */
605  u8 rsvd1[2];
606 };
607 
608 /* bfi_enet_mac_mfilter_del_req is used by:
609  * BFI_ENET_H2I_MAC_MCAST_DEL_REQ
610  */
614  u8 rsvd[2];
615 };
616 
617 /* VLAN
618  *
619  * bfi_enet_rx_vlan_req is used by:
620  * BFI_ENET_H2I_RX_VLAN_SET_REQ
621  */
625  u8 rsvd[3];
627 };
628 
629 /* PAUSE
630  *
631  * bfi_enet_set_pause_req is used by:
632  * BFI_ENET_H2I_SET_PAUSE_REQ
633  */
636  u8 rsvd[2];
637  u8 tx_pause; /* 1 = enable; 0 = disable */
638  u8 rx_pause; /* 1 = enable; 0 = disable */
639 };
640 
641 /* DIAGNOSTICS
642  *
643  * bfi_enet_diag_lb_req is used by:
644  * BFI_ENET_H2I_DIAG_LOOPBACK
645  */
648  u8 rsvd[2];
649  u8 mode; /* cable or Serdes */
650  u8 enable; /* 1 = enable; 0 = disable */
651 };
652 
653 /* enum for Loopback opmodes */
654 enum {
657 };
658 
659 /* STATISTICS
660  *
661  * bfi_enet_stats_req is used by:
662  * BFI_ENET_H2I_STATS_GET_REQ
663  * BFI_ENET_I2H_STATS_CLR_REQ
664  */
668  u8 rsvd[2];
672 };
673 
674 /* defines for "stats_mask" above. */
675 #define BFI_ENET_STATS_MAC (1 << 0) /* !< MAC Statistics */
676 #define BFI_ENET_STATS_BPC (1 << 1) /* !< Pause Stats from BPC */
677 #define BFI_ENET_STATS_RAD (1 << 2) /* !< Rx Admission Statistics */
678 #define BFI_ENET_STATS_RX_FC (1 << 3) /* !< Rx FC Stats from RxA */
679 #define BFI_ENET_STATS_TX_FC (1 << 4) /* !< Tx FC Stats from TxA */
680 
681 #define BFI_ENET_STATS_ALL 0x1f
682 
683 /* TxF Frame Statistics */
688 
692 
696 
698  u64 filter_vlan; /* frames filtered due to VLAN */
699  u64 filter_mac_sa; /* frames filtered due to SA check */
700 };
701 
702 /* RxF Frame Statistics */
707 
711 
716 };
717 
718 /* FC Tx Frame Statistics */
723 
727 
731 
735 };
736 
737 /* FC Rx Frame Statistics */
742 
746 
750 };
751 
752 /* RAD Frame Statistics */
757 
761 
765 
769 
771 };
772 
773 /* BPC Tx Registers */
775  /* transmit stats */
780 
781  /* receive stats */
786 };
787 
788 /* MAC Rx Statistics */
790  u64 frame_64; /* both rx and tx counter */
791  u64 frame_65_127; /* both rx and tx counter */
792  u64 frame_128_255; /* both rx and tx counter */
793  u64 frame_256_511; /* both rx and tx counter */
794  u64 frame_512_1023; /* both rx and tx counter */
795  u64 frame_1024_1518; /* both rx and tx counter */
796  u64 frame_1519_1522; /* both rx and tx counter */
797 
798  /* receive stats */
816 
817  /* transmit stats */
838 };
839 
840 /* Complete statistics, DMAed from fw to host followed by
841  * BFI_ENET_I2H_STATS_GET_RSP
842  */
852 };
853 
854 #pragma pack()
855 
856 #endif /* __BFI_ENET_H__ */