Merge branch 'rcu/next' of git://github.com/paulmckrcu/linux into core/rcu
[pandora-kernel.git] / drivers / net / bna / bfi_ll.h
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-2010 Brocade Communications Systems, Inc.
15  * All rights reserved
16  * www.brocade.com
17  */
18 #ifndef __BFI_LL_H__
19 #define __BFI_LL_H__
20
21 #include "bfi.h"
22
23 #pragma pack(1)
24
25 /**
26  * @brief
27  *      "enums" for all LL mailbox messages other than IOC
28  */
29 enum {
30         BFI_LL_H2I_MAC_UCAST_SET_REQ = 1,
31         BFI_LL_H2I_MAC_UCAST_ADD_REQ = 2,
32         BFI_LL_H2I_MAC_UCAST_DEL_REQ = 3,
33
34         BFI_LL_H2I_MAC_MCAST_ADD_REQ = 4,
35         BFI_LL_H2I_MAC_MCAST_DEL_REQ = 5,
36         BFI_LL_H2I_MAC_MCAST_FILTER_REQ = 6,
37         BFI_LL_H2I_MAC_MCAST_DEL_ALL_REQ = 7,
38
39         BFI_LL_H2I_PORT_ADMIN_REQ = 8,
40         BFI_LL_H2I_STATS_GET_REQ = 9,
41         BFI_LL_H2I_STATS_CLEAR_REQ = 10,
42
43         BFI_LL_H2I_RXF_PROMISCUOUS_SET_REQ = 11,
44         BFI_LL_H2I_RXF_DEFAULT_SET_REQ = 12,
45
46         BFI_LL_H2I_TXQ_STOP_REQ = 13,
47         BFI_LL_H2I_RXQ_STOP_REQ = 14,
48
49         BFI_LL_H2I_DIAG_LOOPBACK_REQ = 15,
50
51         BFI_LL_H2I_SET_PAUSE_REQ = 16,
52         BFI_LL_H2I_MTU_INFO_REQ = 17,
53
54         BFI_LL_H2I_RX_REQ = 18,
55 } ;
56
57 enum {
58         BFI_LL_I2H_MAC_UCAST_SET_RSP = BFA_I2HM(1),
59         BFI_LL_I2H_MAC_UCAST_ADD_RSP = BFA_I2HM(2),
60         BFI_LL_I2H_MAC_UCAST_DEL_RSP = BFA_I2HM(3),
61
62         BFI_LL_I2H_MAC_MCAST_ADD_RSP = BFA_I2HM(4),
63         BFI_LL_I2H_MAC_MCAST_DEL_RSP = BFA_I2HM(5),
64         BFI_LL_I2H_MAC_MCAST_FILTER_RSP = BFA_I2HM(6),
65         BFI_LL_I2H_MAC_MCAST_DEL_ALL_RSP = BFA_I2HM(7),
66
67         BFI_LL_I2H_PORT_ADMIN_RSP = BFA_I2HM(8),
68         BFI_LL_I2H_STATS_GET_RSP = BFA_I2HM(9),
69         BFI_LL_I2H_STATS_CLEAR_RSP = BFA_I2HM(10),
70
71         BFI_LL_I2H_RXF_PROMISCUOUS_SET_RSP = BFA_I2HM(11),
72         BFI_LL_I2H_RXF_DEFAULT_SET_RSP = BFA_I2HM(12),
73
74         BFI_LL_I2H_TXQ_STOP_RSP = BFA_I2HM(13),
75         BFI_LL_I2H_RXQ_STOP_RSP = BFA_I2HM(14),
76
77         BFI_LL_I2H_DIAG_LOOPBACK_RSP = BFA_I2HM(15),
78
79         BFI_LL_I2H_SET_PAUSE_RSP = BFA_I2HM(16),
80
81         BFI_LL_I2H_MTU_INFO_RSP = BFA_I2HM(17),
82         BFI_LL_I2H_RX_RSP = BFA_I2HM(18),
83
84         BFI_LL_I2H_LINK_DOWN_AEN = BFA_I2HM(19),
85         BFI_LL_I2H_LINK_UP_AEN = BFA_I2HM(20),
86
87         BFI_LL_I2H_PORT_ENABLE_AEN = BFA_I2HM(21),
88         BFI_LL_I2H_PORT_DISABLE_AEN = BFA_I2HM(22),
89 } ;
90
91 /**
92  * @brief bfi_ll_mac_addr_req is used by:
93  *        BFI_LL_H2I_MAC_UCAST_SET_REQ
94  *        BFI_LL_H2I_MAC_UCAST_ADD_REQ
95  *        BFI_LL_H2I_MAC_UCAST_DEL_REQ
96  *        BFI_LL_H2I_MAC_MCAST_ADD_REQ
97  *        BFI_LL_H2I_MAC_MCAST_DEL_REQ
98  */
99 struct bfi_ll_mac_addr_req {
100         struct bfi_mhdr mh;             /*!< common msg header */
101         u8              rxf_id;
102         u8              rsvd1[3];
103         mac_t           mac_addr;
104         u8              rsvd2[2];
105 };
106
107 /**
108  * @brief bfi_ll_mcast_filter_req is used by:
109  *        BFI_LL_H2I_MAC_MCAST_FILTER_REQ
110  */
111 struct bfi_ll_mcast_filter_req {
112         struct bfi_mhdr mh;             /*!< common msg header */
113         u8              rxf_id;
114         u8              enable;
115         u8              rsvd[2];
116 };
117
118 /**
119  * @brief bfi_ll_mcast_del_all is used by:
120  *        BFI_LL_H2I_MAC_MCAST_DEL_ALL_REQ
121  */
122 struct bfi_ll_mcast_del_all_req {
123         struct bfi_mhdr mh;             /*!< common msg header */
124         u8                 rxf_id;
125         u8                 rsvd[3];
126 };
127
128 /**
129  * @brief bfi_ll_q_stop_req is used by:
130  *      BFI_LL_H2I_TXQ_STOP_REQ
131  *      BFI_LL_H2I_RXQ_STOP_REQ
132  */
133 struct bfi_ll_q_stop_req {
134         struct bfi_mhdr mh;             /*!< common msg header */
135         u32     q_id_mask[2];   /* !< bit-mask for queue ids */
136 };
137
138 /**
139  * @brief bfi_ll_stats_req is used by:
140  *    BFI_LL_I2H_STATS_GET_REQ
141  *    BFI_LL_I2H_STATS_CLEAR_REQ
142  */
143 struct bfi_ll_stats_req {
144         struct bfi_mhdr mh;     /*!< common msg header */
145         u16 stats_mask; /* !< bit-mask for non-function statistics */
146         u8      rsvd[2];
147         u32 rxf_id_mask[2];     /* !< bit-mask for RxF Statistics */
148         u32 txf_id_mask[2];     /* !< bit-mask for TxF Statistics */
149         union bfi_addr_u  host_buffer;  /* !< where statistics are returned */
150 };
151
152 /**
153  * @brief defines for "stats_mask" above.
154  */
155 #define BFI_LL_STATS_MAC        (1 << 0)        /* !< MAC Statistics */
156 #define BFI_LL_STATS_BPC        (1 << 1)        /* !< Pause Stats from BPC */
157 #define BFI_LL_STATS_RAD        (1 << 2)        /* !< Rx Admission Statistics */
158 #define BFI_LL_STATS_RX_FC      (1 << 3)        /* !< Rx FC Stats from RxA */
159 #define BFI_LL_STATS_TX_FC      (1 << 4)        /* !< Tx FC Stats from TxA */
160
161 #define BFI_LL_STATS_ALL        0x1f
162
163 /**
164  * @brief bfi_ll_port_admin_req
165  */
166 struct bfi_ll_port_admin_req {
167         struct bfi_mhdr mh;             /*!< common msg header */
168         u8               up;
169         u8               rsvd[3];
170 };
171
172 /**
173  * @brief bfi_ll_rxf_req is used by:
174  *      BFI_LL_H2I_RXF_PROMISCUOUS_SET_REQ
175  *      BFI_LL_H2I_RXF_DEFAULT_SET_REQ
176  */
177 struct bfi_ll_rxf_req {
178         struct bfi_mhdr mh;             /*!< common msg header */
179         u8              rxf_id;
180         u8              enable;
181         u8              rsvd[2];
182 };
183
184 /**
185  * @brief bfi_ll_rxf_multi_req is used by:
186  *      BFI_LL_H2I_RX_REQ
187  */
188 struct bfi_ll_rxf_multi_req {
189         struct bfi_mhdr mh;             /*!< common msg header */
190         u32     rxf_id_mask[2];
191         u8              enable;
192         u8              rsvd[3];
193 };
194
195 /**
196  * @brief enum for Loopback opmodes
197  */
198 enum {
199         BFI_LL_DIAG_LB_OPMODE_EXT = 0,
200         BFI_LL_DIAG_LB_OPMODE_CBL = 1,
201 };
202
203 /**
204  * @brief bfi_ll_set_pause_req is used by:
205  *      BFI_LL_H2I_SET_PAUSE_REQ
206  */
207 struct bfi_ll_set_pause_req {
208         struct bfi_mhdr mh;
209         u8              tx_pause; /* 1 = enable, 0 =  disable */
210         u8              rx_pause; /* 1 = enable, 0 =  disable */
211         u8              rsvd[2];
212 };
213
214 /**
215  * @brief bfi_ll_mtu_info_req is used by:
216  *      BFI_LL_H2I_MTU_INFO_REQ
217  */
218 struct bfi_ll_mtu_info_req {
219         struct bfi_mhdr mh;
220         u16     mtu;
221         u8              rsvd[2];
222 };
223
224 /**
225  * @brief
226  *        Response header format used by all responses
227  *        For both responses and asynchronous notifications
228  */
229 struct bfi_ll_rsp {
230         struct bfi_mhdr mh;             /*!< common msg header */
231         u8              error;
232         u8              rsvd[3];
233 };
234
235 /**
236  * @brief bfi_ll_cee_aen is used by:
237  *      BFI_LL_I2H_LINK_DOWN_AEN
238  *      BFI_LL_I2H_LINK_UP_AEN
239  */
240 struct bfi_ll_aen {
241         struct bfi_mhdr mh;             /*!< common msg header */
242         u32     reason;
243         u8              cee_linkup;
244         u8              prio_map;    /*!< LL priority bit-map */
245         u8              rsvd[2];
246 };
247
248 /**
249  * @brief
250  *      The following error codes can be returned
251  *      by the mbox commands
252  */
253 enum {
254         BFI_LL_CMD_OK           = 0,
255         BFI_LL_CMD_FAIL         = 1,
256         BFI_LL_CMD_DUP_ENTRY    = 2,    /* !< Duplicate entry in CAM */
257         BFI_LL_CMD_CAM_FULL     = 3,    /* !< CAM is full */
258         BFI_LL_CMD_NOT_OWNER    = 4,    /* !< Not permitted, b'cos not owner */
259         BFI_LL_CMD_NOT_EXEC     = 5,    /* !< Was not sent to f/w at all */
260         BFI_LL_CMD_WAITING      = 6,    /* !< Waiting for completion (VMware) */
261         BFI_LL_CMD_PORT_DISABLED        = 7,    /* !< port in disabled state */
262 } ;
263
264 /* Statistics */
265 #define BFI_LL_TXF_ID_MAX       64
266 #define BFI_LL_RXF_ID_MAX       64
267
268 /* TxF Frame Statistics */
269 struct bfi_ll_stats_txf {
270         u64 ucast_octets;
271         u64 ucast;
272         u64 ucast_vlan;
273
274         u64 mcast_octets;
275         u64 mcast;
276         u64 mcast_vlan;
277
278         u64 bcast_octets;
279         u64 bcast;
280         u64 bcast_vlan;
281
282         u64 errors;
283         u64 filter_vlan;      /* frames filtered due to VLAN */
284         u64 filter_mac_sa;    /* frames filtered due to SA check */
285 };
286
287 /* RxF Frame Statistics */
288 struct bfi_ll_stats_rxf {
289         u64 ucast_octets;
290         u64 ucast;
291         u64 ucast_vlan;
292
293         u64 mcast_octets;
294         u64 mcast;
295         u64 mcast_vlan;
296
297         u64 bcast_octets;
298         u64 bcast;
299         u64 bcast_vlan;
300         u64 frame_drops;
301 };
302
303 /* FC Tx Frame Statistics */
304 struct bfi_ll_stats_fc_tx {
305         u64 txf_ucast_octets;
306         u64 txf_ucast;
307         u64 txf_ucast_vlan;
308
309         u64 txf_mcast_octets;
310         u64 txf_mcast;
311         u64 txf_mcast_vlan;
312
313         u64 txf_bcast_octets;
314         u64 txf_bcast;
315         u64 txf_bcast_vlan;
316
317         u64 txf_parity_errors;
318         u64 txf_timeout;
319         u64 txf_fid_parity_errors;
320 };
321
322 /* FC Rx Frame Statistics */
323 struct bfi_ll_stats_fc_rx {
324         u64 rxf_ucast_octets;
325         u64 rxf_ucast;
326         u64 rxf_ucast_vlan;
327
328         u64 rxf_mcast_octets;
329         u64 rxf_mcast;
330         u64 rxf_mcast_vlan;
331
332         u64 rxf_bcast_octets;
333         u64 rxf_bcast;
334         u64 rxf_bcast_vlan;
335 };
336
337 /* RAD Frame Statistics */
338 struct bfi_ll_stats_rad {
339         u64 rx_frames;
340         u64 rx_octets;
341         u64 rx_vlan_frames;
342
343         u64 rx_ucast;
344         u64 rx_ucast_octets;
345         u64 rx_ucast_vlan;
346
347         u64 rx_mcast;
348         u64 rx_mcast_octets;
349         u64 rx_mcast_vlan;
350
351         u64 rx_bcast;
352         u64 rx_bcast_octets;
353         u64 rx_bcast_vlan;
354
355         u64 rx_drops;
356 };
357
358 /* BPC Tx Registers */
359 struct bfi_ll_stats_bpc {
360         /* transmit stats */
361         u64 tx_pause[8];
362         u64 tx_zero_pause[8];   /*!< Pause cancellation */
363         /*!<Pause initiation rather than retention */
364         u64 tx_first_pause[8];
365
366         /* receive stats */
367         u64 rx_pause[8];
368         u64 rx_zero_pause[8];   /*!< Pause cancellation */
369         /*!<Pause initiation rather than retention */
370         u64 rx_first_pause[8];
371 };
372
373 /* MAC Rx Statistics */
374 struct bfi_ll_stats_mac {
375         u64 frame_64;           /* both rx and tx counter */
376         u64 frame_65_127;               /* both rx and tx counter */
377         u64 frame_128_255;              /* both rx and tx counter */
378         u64 frame_256_511;              /* both rx and tx counter */
379         u64 frame_512_1023;     /* both rx and tx counter */
380         u64 frame_1024_1518;    /* both rx and tx counter */
381         u64 frame_1519_1522;    /* both rx and tx counter */
382
383         /* receive stats */
384         u64 rx_bytes;
385         u64 rx_packets;
386         u64 rx_fcs_error;
387         u64 rx_multicast;
388         u64 rx_broadcast;
389         u64 rx_control_frames;
390         u64 rx_pause;
391         u64 rx_unknown_opcode;
392         u64 rx_alignment_error;
393         u64 rx_frame_length_error;
394         u64 rx_code_error;
395         u64 rx_carrier_sense_error;
396         u64 rx_undersize;
397         u64 rx_oversize;
398         u64 rx_fragments;
399         u64 rx_jabber;
400         u64 rx_drop;
401
402         /* transmit stats */
403         u64 tx_bytes;
404         u64 tx_packets;
405         u64 tx_multicast;
406         u64 tx_broadcast;
407         u64 tx_pause;
408         u64 tx_deferral;
409         u64 tx_excessive_deferral;
410         u64 tx_single_collision;
411         u64 tx_muliple_collision;
412         u64 tx_late_collision;
413         u64 tx_excessive_collision;
414         u64 tx_total_collision;
415         u64 tx_pause_honored;
416         u64 tx_drop;
417         u64 tx_jabber;
418         u64 tx_fcs_error;
419         u64 tx_control_frame;
420         u64 tx_oversize;
421         u64 tx_undersize;
422         u64 tx_fragments;
423 };
424
425 /* Complete statistics */
426 struct bfi_ll_stats {
427         struct bfi_ll_stats_mac         mac_stats;
428         struct bfi_ll_stats_bpc         bpc_stats;
429         struct bfi_ll_stats_rad         rad_stats;
430         struct bfi_ll_stats_fc_rx       fc_rx_stats;
431         struct bfi_ll_stats_fc_tx       fc_tx_stats;
432         struct bfi_ll_stats_rxf rxf_stats[BFI_LL_RXF_ID_MAX];
433         struct bfi_ll_stats_txf txf_stats[BFI_LL_TXF_ID_MAX];
434 };
435
436 #pragma pack()
437
438 #endif  /* __BFI_LL_H__ */