summaryrefslogtreecommitdiffstats
path: root/drivers/net/bna/bfi_ll.h
blob: bee4d054066a91a4afc60cc04205176eaf7cf237 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
/*
 * Linux network driver for Brocade Converged Network Adapter.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License (GPL) Version 2 as
 * published by the Free Software Foundation
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 */
/*
 * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
 * All rights reserved
 * www.brocade.com
 */
#ifndef __BFI_LL_H__
#define __BFI_LL_H__

#include "bfi.h"

#pragma pack(1)

/**
 * @brief
 *	"enums" for all LL mailbox messages other than IOC
 */
enum {
	BFI_LL_H2I_MAC_UCAST_SET_REQ = 1,
	BFI_LL_H2I_MAC_UCAST_ADD_REQ = 2,
	BFI_LL_H2I_MAC_UCAST_DEL_REQ = 3,

	BFI_LL_H2I_MAC_MCAST_ADD_REQ = 4,
	BFI_LL_H2I_MAC_MCAST_DEL_REQ = 5,
	BFI_LL_H2I_MAC_MCAST_FILTER_REQ = 6,
	BFI_LL_H2I_MAC_MCAST_DEL_ALL_REQ = 7,

	BFI_LL_H2I_PORT_ADMIN_REQ = 8,
	BFI_LL_H2I_STATS_GET_REQ = 9,
	BFI_LL_H2I_STATS_CLEAR_REQ = 10,

	BFI_LL_H2I_RXF_PROMISCUOUS_SET_REQ = 11,
	BFI_LL_H2I_RXF_DEFAULT_SET_REQ = 12,

	BFI_LL_H2I_TXQ_STOP_REQ = 13,
	BFI_LL_H2I_RXQ_STOP_REQ = 14,

	BFI_LL_H2I_DIAG_LOOPBACK_REQ = 15,

	BFI_LL_H2I_SET_PAUSE_REQ = 16,
	BFI_LL_H2I_MTU_INFO_REQ = 17,

	BFI_LL_H2I_RX_REQ = 18,
} ;

enum {
	BFI_LL_I2H_MAC_UCAST_SET_RSP = BFA_I2HM(1),
	BFI_LL_I2H_MAC_UCAST_ADD_RSP = BFA_I2HM(2),
	BFI_LL_I2H_MAC_UCAST_DEL_RSP = BFA_I2HM(3),

	BFI_LL_I2H_MAC_MCAST_ADD_RSP = BFA_I2HM(4),
	BFI_LL_I2H_MAC_MCAST_DEL_RSP = BFA_I2HM(5),
	BFI_LL_I2H_MAC_MCAST_FILTER_RSP = BFA_I2HM(6),
	BFI_LL_I2H_MAC_MCAST_DEL_ALL_RSP = BFA_I2HM(7),

	BFI_LL_I2H_PORT_ADMIN_RSP = BFA_I2HM(8),
	BFI_LL_I2H_STATS_GET_RSP = BFA_I2HM(9),
	BFI_LL_I2H_STATS_CLEAR_RSP = BFA_I2HM(10),

	BFI_LL_I2H_RXF_PROMISCUOUS_SET_RSP = BFA_I2HM(11),
	BFI_LL_I2H_RXF_DEFAULT_SET_RSP = BFA_I2HM(12),

	BFI_LL_I2H_TXQ_STOP_RSP = BFA_I2HM(13),
	BFI_LL_I2H_RXQ_STOP_RSP = BFA_I2HM(14),

	BFI_LL_I2H_DIAG_LOOPBACK_RSP = BFA_I2HM(15),

	BFI_LL_I2H_SET_PAUSE_RSP = BFA_I2HM(16),

	BFI_LL_I2H_MTU_INFO_RSP = BFA_I2HM(17),
	BFI_LL_I2H_RX_RSP = BFA_I2HM(18),

	BFI_LL_I2H_LINK_DOWN_AEN = BFA_I2HM(19),
	BFI_LL_I2H_LINK_UP_AEN = BFA_I2HM(20),

	BFI_LL_I2H_PORT_ENABLE_AEN = BFA_I2HM(21),
	BFI_LL_I2H_PORT_DISABLE_AEN = BFA_I2HM(22),
} ;

/**
 * @brief bfi_ll_mac_addr_req is used by:
 *        BFI_LL_H2I_MAC_UCAST_SET_REQ
 *        BFI_LL_H2I_MAC_UCAST_ADD_REQ
 *        BFI_LL_H2I_MAC_UCAST_DEL_REQ
 *        BFI_LL_H2I_MAC_MCAST_ADD_REQ
 *        BFI_LL_H2I_MAC_MCAST_DEL_REQ
 */
struct bfi_ll_mac_addr_req {
	struct bfi_mhdr mh;		/*!< common msg header */
	u8		rxf_id;
	u8		rsvd1[3];
	mac_t		mac_addr;
	u8		rsvd2[2];
};

/**
 * @brief bfi_ll_mcast_filter_req is used by:
 *	  BFI_LL_H2I_MAC_MCAST_FILTER_REQ
 */
struct bfi_ll_mcast_filter_req {
	struct bfi_mhdr mh;		/*!< common msg header */
	u8		rxf_id;
	u8		enable;
	u8		rsvd[2];
};

/**
 * @brief bfi_ll_mcast_del_all is used by:
 *	  BFI_LL_H2I_MAC_MCAST_DEL_ALL_REQ
 */
struct bfi_ll_mcast_del_all_req {
	struct bfi_mhdr mh;		/*!< common msg header */
	u8		   rxf_id;
	u8		   rsvd[3];
};

/**
 * @brief bfi_ll_q_stop_req is used by:
 *	BFI_LL_H2I_TXQ_STOP_REQ
 *	BFI_LL_H2I_RXQ_STOP_REQ
 */
struct bfi_ll_q_stop_req {
	struct bfi_mhdr mh;		/*!< common msg header */
	u32	q_id_mask[2];	/* !< bit-mask for queue ids */
};

/**
 * @brief bfi_ll_stats_req is used by:
 *    BFI_LL_I2H_STATS_GET_REQ
 *    BFI_LL_I2H_STATS_CLEAR_REQ
 */
struct bfi_ll_stats_req {
	struct bfi_mhdr mh;	/*!< common msg header */
	u16 stats_mask;	/* !< bit-mask for non-function statistics */
	u8	rsvd[2];
	u32 rxf_id_mask[2];	/* !< bit-mask for RxF Statistics */
	u32 txf_id_mask[2];	/* !< bit-mask for TxF Statistics */
	union bfi_addr_u  host_buffer;	/* !< where statistics are returned */
};

/**
 * @brief defines for "stats_mask" above.
 */
#define BFI_LL_STATS_MAC	(1 << 0)	/* !< MAC Statistics */
#define BFI_LL_STATS_BPC	(1 << 1)	/* !< Pause Stats from BPC */
#define BFI_LL_STATS_RAD	(1 << 2)	/* !< Rx Admission Statistics */
#define BFI_LL_STATS_RX_FC	(1 << 3)	/* !< Rx FC Stats from RxA */
#define BFI_LL_STATS_TX_FC	(1 << 4)	/* !< Tx FC Stats from TxA */

#define BFI_LL_STATS_ALL	0x1f

/**
 * @brief bfi_ll_port_admin_req
 */
struct bfi_ll_port_admin_req {
	struct bfi_mhdr mh;		/*!< common msg header */
	u8		 up;
	u8		 rsvd[3];
};

/**
 * @brief bfi_ll_rxf_req is used by:
 *      BFI_LL_H2I_RXF_PROMISCUOUS_SET_REQ
 *      BFI_LL_H2I_RXF_DEFAULT_SET_REQ
 */
struct bfi_ll_rxf_req {
	struct bfi_mhdr mh;		/*!< common msg header */
	u8		rxf_id;
	u8		enable;
	u8		rsvd[2];
};

/**
 * @brief bfi_ll_rxf_multi_req is used by:
 *	BFI_LL_H2I_RX_REQ
 */
struct bfi_ll_rxf_multi_req {
	struct bfi_mhdr mh;		/*!< common msg header */
	u32	rxf_id_mask[2];
	u8		enable;
	u8		rsvd[3];
};

/**
 * @brief enum for Loopback opmodes
 */
enum {
	BFI_LL_DIAG_LB_OPMODE_EXT = 0,
	BFI_LL_DIAG_LB_OPMODE_CBL = 1,
};

/**
 * @brief bfi_ll_set_pause_req is used by:
 *	BFI_LL_H2I_SET_PAUSE_REQ
 */
struct bfi_ll_set_pause_req {
	struct bfi_mhdr mh;
	u8		tx_pause; /* 1 = enable, 0 =  disable */
	u8		rx_pause; /* 1 = enable, 0 =  disable */
	u8		rsvd[2];
};

/**
 * @brief bfi_ll_mtu_info_req is used by:
 *	BFI_LL_H2I_MTU_INFO_REQ
 */
struct bfi_ll_mtu_info_req {
	struct bfi_mhdr mh;
	u16	mtu;
	u8		rsvd[2];
};

/**
 * @brief
 *	  Response header format used by all responses
 *	  For both responses and asynchronous notifications
 */
struct bfi_ll_rsp {
	struct bfi_mhdr mh;		/*!< common msg header */
	u8		error;
	u8		rsvd[3];
};

/**
 * @brief bfi_ll_cee_aen is used by:
 *	BFI_LL_I2H_LINK_DOWN_AEN
 *	BFI_LL_I2H_LINK_UP_AEN
 */
struct bfi_ll_aen {
	struct bfi_mhdr mh;		/*!< common msg header */
	u32	reason;
	u8		cee_linkup;
	u8		prio_map;    /*!< LL priority bit-map */
	u8		rsvd[2];
};

/**
 * @brief
 * 	The following error codes can be returned
 *	by the mbox commands
 */
enum {
	BFI_LL_CMD_OK 		= 0,
	BFI_LL_CMD_FAIL 	= 1,
	BFI_LL_CMD_DUP_ENTRY	= 2,	/* !< Duplicate entry in CAM */
	BFI_LL_CMD_CAM_FULL	= 3,	/* !< CAM is full */
	BFI_LL_CMD_NOT_OWNER	= 4,   	/* !< Not permitted, b'cos not owner */
	BFI_LL_CMD_NOT_EXEC	= 5,   	/* !< Was not sent to f/w at all */
	BFI_LL_CMD_WAITING	= 6,	/* !< Waiting for completion (VMware) */
	BFI_LL_CMD_PORT_DISABLED	= 7,	/* !< port in disabled state */
} ;

/* Statistics */
#define BFI_LL_TXF_ID_MAX  	64
#define BFI_LL_RXF_ID_MAX  	64

/* TxF Frame Statistics */
struct bfi_ll_stats_txf {
	u64 ucast_octets;
	u64 ucast;
	u64 ucast_vlan;

	u64 mcast_octets;
	u64 mcast;
	u64 mcast_vlan;

	u64 bcast_octets;
	u64 bcast;
	u64 bcast_vlan;

	u64 errors;
	u64 filter_vlan;      /* frames filtered due to VLAN */
	u64 filter_mac_sa;    /* frames filtered due to SA check */
};

/* RxF Frame Statistics */
struct bfi_ll_stats_rxf {
	u64 ucast_octets;
	u64 ucast;
	u64 ucast_vlan;

	u64 mcast_octets;
	u64 mcast;
	u64 mcast_vlan;

	u64 bcast_octets;
	u64 bcast;
	u64 bcast_vlan;
	u64 frame_drops;
};

/* FC Tx Frame Statistics */
struct bfi_ll_stats_fc_tx {
	u64 txf_ucast_octets;
	u64 txf_ucast;
	u64 txf_ucast_vlan;

	u64 txf_mcast_octets;
	u64 txf_mcast;
	u64 txf_mcast_vlan;

	u64 txf_bcast_octets;
	u64 txf_bcast;
	u64 txf_bcast_vlan;

	u64 txf_parity_errors;
	u64 txf_timeout;
	u64 txf_fid_parity_errors;
};

/* FC Rx Frame Statistics */
struct bfi_ll_stats_fc_rx {
	u64 rxf_ucast_octets;
	u64 rxf_ucast;
	u64 rxf_ucast_vlan;

	u64 rxf_mcast_octets;
	u64 rxf_mcast;
	u64 rxf_mcast_vlan;

	u64 rxf_bcast_octets;
	u64 rxf_bcast;
	u64 rxf_bcast_vlan;
};

/* RAD Frame Statistics */
struct bfi_ll_stats_rad {
	u64 rx_frames;
	u64 rx_octets;
	u64 rx_vlan_frames;

	u64 rx_ucast;
	u64 rx_ucast_octets;
	u64 rx_ucast_vlan;

	u64 rx_mcast;
	u64 rx_mcast_octets;
	u64 rx_mcast_vlan;

	u64 rx_bcast;
	u64 rx_bcast_octets;
	u64 rx_bcast_vlan;

	u64 rx_drops;
};

/* BPC Tx Registers */
struct bfi_ll_stats_bpc {
	/* transmit stats */
	u64 tx_pause[8];
	u64 tx_zero_pause[8];	/*!< Pause cancellation */
	/*!<Pause initiation rather than retention */
	u64 tx_first_pause[8];

	/* receive stats */
	u64 rx_pause[8];
	u64 rx_zero_pause[8];	/*!< Pause cancellation */
	/*!<Pause initiation rather than retention */
	u64 rx_first_pause[8];
};

/* MAC Rx Statistics */
struct bfi_ll_stats_mac {
	u64 frame_64;		/* both rx and tx counter */
	u64 frame_65_127;		/* both rx and tx counter */
	u64 frame_128_255;		/* both rx and tx counter */
	u64 frame_256_511;		/* both rx and tx counter */
	u64 frame_512_1023;	/* both rx and tx counter */
	u64 frame_1024_1518;	/* both rx and tx counter */
	u64 frame_1519_1522;	/* both rx and tx counter */

	/* receive stats */
	u64 rx_bytes;
	u64 rx_packets;
	u64 rx_fcs_error;
	u64 rx_multicast;
	u64 rx_broadcast;
	u64 rx_control_frames;
	u64 rx_pause;
	u64 rx_unknown_opcode;
	u64 rx_alignment_error;
	u64 rx_frame_length_error;
	u64 rx_code_error;
	u64 rx_carrier_sense_error;
	u64 rx_undersize;
	u64 rx_oversize;
	u64 rx_fragments;
	u64 rx_jabber;
	u64 rx_drop;

	/* transmit stats */
	u64 tx_bytes;
	u64 tx_packets;
	u64 tx_multicast;
	u64 tx_broadcast;
	u64 tx_pause;
	u64 tx_deferral;
	u64 tx_excessive_deferral;
	u64 tx_single_collision;
	u64 tx_muliple_collision;
	u64 tx_late_collision;
	u64 tx_excessive_collision;
	u64 tx_total_collision;
	u64 tx_pause_honored;
	u64 tx_drop;
	u64 tx_jabber;
	u64 tx_fcs_error;
	u64 tx_control_frame;
	u64 tx_oversize;
	u64 tx_undersize;
	u64 tx_fragments;
};

/* Complete statistics */
struct bfi_ll_stats {
	struct bfi_ll_stats_mac		mac_stats;
	struct bfi_ll_stats_bpc		bpc_stats;
	struct bfi_ll_stats_rad		rad_stats;
	struct bfi_ll_stats_fc_rx	fc_rx_stats;
	struct bfi_ll_stats_fc_tx	fc_tx_stats;
	struct bfi_ll_stats_rxf	rxf_stats[BFI_LL_RXF_ID_MAX];
	struct bfi_ll_stats_txf	txf_stats[BFI_LL_TXF_ID_MAX];
};

#pragma pack()

#endif  /* __BFI_LL_H__ */