bfi_ll.h 9.6 KB

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