be_cmds.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770
  1. /*
  2. * Copyright (C) 2005 - 2009 ServerEngines
  3. * All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License version 2
  7. * as published by the Free Software Foundation. The full GNU General
  8. * Public License is included in this distribution in the file called COPYING.
  9. *
  10. * Contact Information:
  11. * linux-drivers@serverengines.com
  12. *
  13. * ServerEngines
  14. * 209 N. Fair Oaks Ave
  15. * Sunnyvale, CA 94085
  16. */
  17. /*
  18. * The driver sends configuration and managements command requests to the
  19. * firmware in the BE. These requests are communicated to the processor
  20. * using Work Request Blocks (WRBs) submitted to the MCC-WRB ring or via one
  21. * WRB inside a MAILBOX.
  22. * The commands are serviced by the ARM processor in the BladeEngine's MPU.
  23. */
  24. struct be_sge {
  25. u32 pa_lo;
  26. u32 pa_hi;
  27. u32 len;
  28. };
  29. #define MCC_WRB_EMBEDDED_MASK 1 /* bit 0 of dword 0*/
  30. #define MCC_WRB_SGE_CNT_SHIFT 3 /* bits 3 - 7 of dword 0 */
  31. #define MCC_WRB_SGE_CNT_MASK 0x1F /* bits 3 - 7 of dword 0 */
  32. struct be_mcc_wrb {
  33. u32 embedded; /* dword 0 */
  34. u32 payload_length; /* dword 1 */
  35. u32 tag0; /* dword 2 */
  36. u32 tag1; /* dword 3 */
  37. u32 rsvd; /* dword 4 */
  38. union {
  39. u8 embedded_payload[236]; /* used by embedded cmds */
  40. struct be_sge sgl[19]; /* used by non-embedded cmds */
  41. } payload;
  42. };
  43. #define CQE_FLAGS_VALID_MASK (1 << 31)
  44. #define CQE_FLAGS_ASYNC_MASK (1 << 30)
  45. #define CQE_FLAGS_COMPLETED_MASK (1 << 28)
  46. #define CQE_FLAGS_CONSUMED_MASK (1 << 27)
  47. /* Completion Status */
  48. enum {
  49. MCC_STATUS_SUCCESS = 0x0,
  50. /* The client does not have sufficient privileges to execute the command */
  51. MCC_STATUS_INSUFFICIENT_PRIVILEGES = 0x1,
  52. /* A parameter in the command was invalid. */
  53. MCC_STATUS_INVALID_PARAMETER = 0x2,
  54. /* There are insufficient chip resources to execute the command */
  55. MCC_STATUS_INSUFFICIENT_RESOURCES = 0x3,
  56. /* The command is completing because the queue was getting flushed */
  57. MCC_STATUS_QUEUE_FLUSHING = 0x4,
  58. /* The command is completing with a DMA error */
  59. MCC_STATUS_DMA_FAILED = 0x5,
  60. MCC_STATUS_NOT_SUPPORTED = 66
  61. };
  62. #define CQE_STATUS_COMPL_MASK 0xFFFF
  63. #define CQE_STATUS_COMPL_SHIFT 0 /* bits 0 - 15 */
  64. #define CQE_STATUS_EXTD_MASK 0xFFFF
  65. #define CQE_STATUS_EXTD_SHIFT 16 /* bits 16 - 31 */
  66. struct be_mcc_compl {
  67. u32 status; /* dword 0 */
  68. u32 tag0; /* dword 1 */
  69. u32 tag1; /* dword 2 */
  70. u32 flags; /* dword 3 */
  71. };
  72. /* When the async bit of mcc_compl is set, the last 4 bytes of
  73. * mcc_compl is interpreted as follows:
  74. */
  75. #define ASYNC_TRAILER_EVENT_CODE_SHIFT 8 /* bits 8 - 15 */
  76. #define ASYNC_TRAILER_EVENT_CODE_MASK 0xFF
  77. #define ASYNC_EVENT_CODE_LINK_STATE 0x1
  78. struct be_async_event_trailer {
  79. u32 code;
  80. };
  81. enum {
  82. ASYNC_EVENT_LINK_DOWN = 0x0,
  83. ASYNC_EVENT_LINK_UP = 0x1
  84. };
  85. /* When the event code of an async trailer is link-state, the mcc_compl
  86. * must be interpreted as follows
  87. */
  88. struct be_async_event_link_state {
  89. u8 physical_port;
  90. u8 port_link_status;
  91. u8 port_duplex;
  92. u8 port_speed;
  93. u8 port_fault;
  94. u8 rsvd0[7];
  95. struct be_async_event_trailer trailer;
  96. } __packed;
  97. struct be_mcc_mailbox {
  98. struct be_mcc_wrb wrb;
  99. struct be_mcc_compl compl;
  100. };
  101. #define CMD_SUBSYSTEM_COMMON 0x1
  102. #define CMD_SUBSYSTEM_ETH 0x3
  103. #define OPCODE_COMMON_NTWK_MAC_QUERY 1
  104. #define OPCODE_COMMON_NTWK_MAC_SET 2
  105. #define OPCODE_COMMON_NTWK_MULTICAST_SET 3
  106. #define OPCODE_COMMON_NTWK_VLAN_CONFIG 4
  107. #define OPCODE_COMMON_NTWK_LINK_STATUS_QUERY 5
  108. #define OPCODE_COMMON_WRITE_FLASHROM 7
  109. #define OPCODE_COMMON_CQ_CREATE 12
  110. #define OPCODE_COMMON_EQ_CREATE 13
  111. #define OPCODE_COMMON_MCC_CREATE 21
  112. #define OPCODE_COMMON_NTWK_RX_FILTER 34
  113. #define OPCODE_COMMON_GET_FW_VERSION 35
  114. #define OPCODE_COMMON_SET_FLOW_CONTROL 36
  115. #define OPCODE_COMMON_GET_FLOW_CONTROL 37
  116. #define OPCODE_COMMON_SET_FRAME_SIZE 39
  117. #define OPCODE_COMMON_MODIFY_EQ_DELAY 41
  118. #define OPCODE_COMMON_FIRMWARE_CONFIG 42
  119. #define OPCODE_COMMON_NTWK_INTERFACE_CREATE 50
  120. #define OPCODE_COMMON_NTWK_INTERFACE_DESTROY 51
  121. #define OPCODE_COMMON_MCC_DESTROY 53
  122. #define OPCODE_COMMON_CQ_DESTROY 54
  123. #define OPCODE_COMMON_EQ_DESTROY 55
  124. #define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG 58
  125. #define OPCODE_COMMON_NTWK_PMAC_ADD 59
  126. #define OPCODE_COMMON_NTWK_PMAC_DEL 60
  127. #define OPCODE_COMMON_FUNCTION_RESET 61
  128. #define OPCODE_ETH_ACPI_CONFIG 2
  129. #define OPCODE_ETH_PROMISCUOUS 3
  130. #define OPCODE_ETH_GET_STATISTICS 4
  131. #define OPCODE_ETH_TX_CREATE 7
  132. #define OPCODE_ETH_RX_CREATE 8
  133. #define OPCODE_ETH_TX_DESTROY 9
  134. #define OPCODE_ETH_RX_DESTROY 10
  135. struct be_cmd_req_hdr {
  136. u8 opcode; /* dword 0 */
  137. u8 subsystem; /* dword 0 */
  138. u8 port_number; /* dword 0 */
  139. u8 domain; /* dword 0 */
  140. u32 timeout; /* dword 1 */
  141. u32 request_length; /* dword 2 */
  142. u32 rsvd; /* dword 3 */
  143. };
  144. #define RESP_HDR_INFO_OPCODE_SHIFT 0 /* bits 0 - 7 */
  145. #define RESP_HDR_INFO_SUBSYS_SHIFT 8 /* bits 8 - 15 */
  146. struct be_cmd_resp_hdr {
  147. u32 info; /* dword 0 */
  148. u32 status; /* dword 1 */
  149. u32 response_length; /* dword 2 */
  150. u32 actual_resp_len; /* dword 3 */
  151. };
  152. struct phys_addr {
  153. u32 lo;
  154. u32 hi;
  155. };
  156. /**************************
  157. * BE Command definitions *
  158. **************************/
  159. /* Pseudo amap definition in which each bit of the actual structure is defined
  160. * as a byte: used to calculate offset/shift/mask of each field */
  161. struct amap_eq_context {
  162. u8 cidx[13]; /* dword 0*/
  163. u8 rsvd0[3]; /* dword 0*/
  164. u8 epidx[13]; /* dword 0*/
  165. u8 valid; /* dword 0*/
  166. u8 rsvd1; /* dword 0*/
  167. u8 size; /* dword 0*/
  168. u8 pidx[13]; /* dword 1*/
  169. u8 rsvd2[3]; /* dword 1*/
  170. u8 pd[10]; /* dword 1*/
  171. u8 count[3]; /* dword 1*/
  172. u8 solevent; /* dword 1*/
  173. u8 stalled; /* dword 1*/
  174. u8 armed; /* dword 1*/
  175. u8 rsvd3[4]; /* dword 2*/
  176. u8 func[8]; /* dword 2*/
  177. u8 rsvd4; /* dword 2*/
  178. u8 delaymult[10]; /* dword 2*/
  179. u8 rsvd5[2]; /* dword 2*/
  180. u8 phase[2]; /* dword 2*/
  181. u8 nodelay; /* dword 2*/
  182. u8 rsvd6[4]; /* dword 2*/
  183. u8 rsvd7[32]; /* dword 3*/
  184. } __packed;
  185. struct be_cmd_req_eq_create {
  186. struct be_cmd_req_hdr hdr;
  187. u16 num_pages; /* sword */
  188. u16 rsvd0; /* sword */
  189. u8 context[sizeof(struct amap_eq_context) / 8];
  190. struct phys_addr pages[8];
  191. } __packed;
  192. struct be_cmd_resp_eq_create {
  193. struct be_cmd_resp_hdr resp_hdr;
  194. u16 eq_id; /* sword */
  195. u16 rsvd0; /* sword */
  196. } __packed;
  197. /******************** Mac query ***************************/
  198. enum {
  199. MAC_ADDRESS_TYPE_STORAGE = 0x0,
  200. MAC_ADDRESS_TYPE_NETWORK = 0x1,
  201. MAC_ADDRESS_TYPE_PD = 0x2,
  202. MAC_ADDRESS_TYPE_MANAGEMENT = 0x3
  203. };
  204. struct mac_addr {
  205. u16 size_of_struct;
  206. u8 addr[ETH_ALEN];
  207. } __packed;
  208. struct be_cmd_req_mac_query {
  209. struct be_cmd_req_hdr hdr;
  210. u8 type;
  211. u8 permanent;
  212. u16 if_id;
  213. } __packed;
  214. struct be_cmd_resp_mac_query {
  215. struct be_cmd_resp_hdr hdr;
  216. struct mac_addr mac;
  217. };
  218. /******************** PMac Add ***************************/
  219. struct be_cmd_req_pmac_add {
  220. struct be_cmd_req_hdr hdr;
  221. u32 if_id;
  222. u8 mac_address[ETH_ALEN];
  223. u8 rsvd0[2];
  224. } __packed;
  225. struct be_cmd_resp_pmac_add {
  226. struct be_cmd_resp_hdr hdr;
  227. u32 pmac_id;
  228. };
  229. /******************** PMac Del ***************************/
  230. struct be_cmd_req_pmac_del {
  231. struct be_cmd_req_hdr hdr;
  232. u32 if_id;
  233. u32 pmac_id;
  234. };
  235. /******************** Create CQ ***************************/
  236. /* Pseudo amap definition in which each bit of the actual structure is defined
  237. * as a byte: used to calculate offset/shift/mask of each field */
  238. struct amap_cq_context {
  239. u8 cidx[11]; /* dword 0*/
  240. u8 rsvd0; /* dword 0*/
  241. u8 coalescwm[2]; /* dword 0*/
  242. u8 nodelay; /* dword 0*/
  243. u8 epidx[11]; /* dword 0*/
  244. u8 rsvd1; /* dword 0*/
  245. u8 count[2]; /* dword 0*/
  246. u8 valid; /* dword 0*/
  247. u8 solevent; /* dword 0*/
  248. u8 eventable; /* dword 0*/
  249. u8 pidx[11]; /* dword 1*/
  250. u8 rsvd2; /* dword 1*/
  251. u8 pd[10]; /* dword 1*/
  252. u8 eqid[8]; /* dword 1*/
  253. u8 stalled; /* dword 1*/
  254. u8 armed; /* dword 1*/
  255. u8 rsvd3[4]; /* dword 2*/
  256. u8 func[8]; /* dword 2*/
  257. u8 rsvd4[20]; /* dword 2*/
  258. u8 rsvd5[32]; /* dword 3*/
  259. } __packed;
  260. struct be_cmd_req_cq_create {
  261. struct be_cmd_req_hdr hdr;
  262. u16 num_pages;
  263. u16 rsvd0;
  264. u8 context[sizeof(struct amap_cq_context) / 8];
  265. struct phys_addr pages[8];
  266. } __packed;
  267. struct be_cmd_resp_cq_create {
  268. struct be_cmd_resp_hdr hdr;
  269. u16 cq_id;
  270. u16 rsvd0;
  271. } __packed;
  272. /******************** Create MCCQ ***************************/
  273. /* Pseudo amap definition in which each bit of the actual structure is defined
  274. * as a byte: used to calculate offset/shift/mask of each field */
  275. struct amap_mcc_context {
  276. u8 con_index[14];
  277. u8 rsvd0[2];
  278. u8 ring_size[4];
  279. u8 fetch_wrb;
  280. u8 fetch_r2t;
  281. u8 cq_id[10];
  282. u8 prod_index[14];
  283. u8 fid[8];
  284. u8 pdid[9];
  285. u8 valid;
  286. u8 rsvd1[32];
  287. u8 rsvd2[32];
  288. } __packed;
  289. struct be_cmd_req_mcc_create {
  290. struct be_cmd_req_hdr hdr;
  291. u16 num_pages;
  292. u16 rsvd0;
  293. u8 context[sizeof(struct amap_mcc_context) / 8];
  294. struct phys_addr pages[8];
  295. } __packed;
  296. struct be_cmd_resp_mcc_create {
  297. struct be_cmd_resp_hdr hdr;
  298. u16 id;
  299. u16 rsvd0;
  300. } __packed;
  301. /******************** Create TxQ ***************************/
  302. #define BE_ETH_TX_RING_TYPE_STANDARD 2
  303. #define BE_ULP1_NUM 1
  304. /* Pseudo amap definition in which each bit of the actual structure is defined
  305. * as a byte: used to calculate offset/shift/mask of each field */
  306. struct amap_tx_context {
  307. u8 rsvd0[16]; /* dword 0 */
  308. u8 tx_ring_size[4]; /* dword 0 */
  309. u8 rsvd1[26]; /* dword 0 */
  310. u8 pci_func_id[8]; /* dword 1 */
  311. u8 rsvd2[9]; /* dword 1 */
  312. u8 ctx_valid; /* dword 1 */
  313. u8 cq_id_send[16]; /* dword 2 */
  314. u8 rsvd3[16]; /* dword 2 */
  315. u8 rsvd4[32]; /* dword 3 */
  316. u8 rsvd5[32]; /* dword 4 */
  317. u8 rsvd6[32]; /* dword 5 */
  318. u8 rsvd7[32]; /* dword 6 */
  319. u8 rsvd8[32]; /* dword 7 */
  320. u8 rsvd9[32]; /* dword 8 */
  321. u8 rsvd10[32]; /* dword 9 */
  322. u8 rsvd11[32]; /* dword 10 */
  323. u8 rsvd12[32]; /* dword 11 */
  324. u8 rsvd13[32]; /* dword 12 */
  325. u8 rsvd14[32]; /* dword 13 */
  326. u8 rsvd15[32]; /* dword 14 */
  327. u8 rsvd16[32]; /* dword 15 */
  328. } __packed;
  329. struct be_cmd_req_eth_tx_create {
  330. struct be_cmd_req_hdr hdr;
  331. u8 num_pages;
  332. u8 ulp_num;
  333. u8 type;
  334. u8 bound_port;
  335. u8 context[sizeof(struct amap_tx_context) / 8];
  336. struct phys_addr pages[8];
  337. } __packed;
  338. struct be_cmd_resp_eth_tx_create {
  339. struct be_cmd_resp_hdr hdr;
  340. u16 cid;
  341. u16 rsvd0;
  342. } __packed;
  343. /******************** Create RxQ ***************************/
  344. struct be_cmd_req_eth_rx_create {
  345. struct be_cmd_req_hdr hdr;
  346. u16 cq_id;
  347. u8 frag_size;
  348. u8 num_pages;
  349. struct phys_addr pages[2];
  350. u32 interface_id;
  351. u16 max_frame_size;
  352. u16 rsvd0;
  353. u32 rss_queue;
  354. } __packed;
  355. struct be_cmd_resp_eth_rx_create {
  356. struct be_cmd_resp_hdr hdr;
  357. u16 id;
  358. u8 cpu_id;
  359. u8 rsvd0;
  360. } __packed;
  361. /******************** Q Destroy ***************************/
  362. /* Type of Queue to be destroyed */
  363. enum {
  364. QTYPE_EQ = 1,
  365. QTYPE_CQ,
  366. QTYPE_TXQ,
  367. QTYPE_RXQ,
  368. QTYPE_MCCQ
  369. };
  370. struct be_cmd_req_q_destroy {
  371. struct be_cmd_req_hdr hdr;
  372. u16 id;
  373. u16 bypass_flush; /* valid only for rx q destroy */
  374. } __packed;
  375. /************ I/f Create (it's actually I/f Config Create)**********/
  376. /* Capability flags for the i/f */
  377. enum be_if_flags {
  378. BE_IF_FLAGS_RSS = 0x4,
  379. BE_IF_FLAGS_PROMISCUOUS = 0x8,
  380. BE_IF_FLAGS_BROADCAST = 0x10,
  381. BE_IF_FLAGS_UNTAGGED = 0x20,
  382. BE_IF_FLAGS_ULP = 0x40,
  383. BE_IF_FLAGS_VLAN_PROMISCUOUS = 0x80,
  384. BE_IF_FLAGS_VLAN = 0x100,
  385. BE_IF_FLAGS_MCAST_PROMISCUOUS = 0x200,
  386. BE_IF_FLAGS_PASS_L2_ERRORS = 0x400,
  387. BE_IF_FLAGS_PASS_L3L4_ERRORS = 0x800
  388. };
  389. /* An RX interface is an object with one or more MAC addresses and
  390. * filtering capabilities. */
  391. struct be_cmd_req_if_create {
  392. struct be_cmd_req_hdr hdr;
  393. u32 version; /* ignore currntly */
  394. u32 capability_flags;
  395. u32 enable_flags;
  396. u8 mac_addr[ETH_ALEN];
  397. u8 rsvd0;
  398. u8 pmac_invalid; /* if set, don't attach the mac addr to the i/f */
  399. u32 vlan_tag; /* not used currently */
  400. } __packed;
  401. struct be_cmd_resp_if_create {
  402. struct be_cmd_resp_hdr hdr;
  403. u32 interface_id;
  404. u32 pmac_id;
  405. };
  406. /****** I/f Destroy(it's actually I/f Config Destroy )**********/
  407. struct be_cmd_req_if_destroy {
  408. struct be_cmd_req_hdr hdr;
  409. u32 interface_id;
  410. };
  411. /*************** HW Stats Get **********************************/
  412. struct be_port_rxf_stats {
  413. u32 rx_bytes_lsd; /* dword 0*/
  414. u32 rx_bytes_msd; /* dword 1*/
  415. u32 rx_total_frames; /* dword 2*/
  416. u32 rx_unicast_frames; /* dword 3*/
  417. u32 rx_multicast_frames; /* dword 4*/
  418. u32 rx_broadcast_frames; /* dword 5*/
  419. u32 rx_crc_errors; /* dword 6*/
  420. u32 rx_alignment_symbol_errors; /* dword 7*/
  421. u32 rx_pause_frames; /* dword 8*/
  422. u32 rx_control_frames; /* dword 9*/
  423. u32 rx_in_range_errors; /* dword 10*/
  424. u32 rx_out_range_errors; /* dword 11*/
  425. u32 rx_frame_too_long; /* dword 12*/
  426. u32 rx_address_match_errors; /* dword 13*/
  427. u32 rx_vlan_mismatch; /* dword 14*/
  428. u32 rx_dropped_too_small; /* dword 15*/
  429. u32 rx_dropped_too_short; /* dword 16*/
  430. u32 rx_dropped_header_too_small; /* dword 17*/
  431. u32 rx_dropped_tcp_length; /* dword 18*/
  432. u32 rx_dropped_runt; /* dword 19*/
  433. u32 rx_64_byte_packets; /* dword 20*/
  434. u32 rx_65_127_byte_packets; /* dword 21*/
  435. u32 rx_128_256_byte_packets; /* dword 22*/
  436. u32 rx_256_511_byte_packets; /* dword 23*/
  437. u32 rx_512_1023_byte_packets; /* dword 24*/
  438. u32 rx_1024_1518_byte_packets; /* dword 25*/
  439. u32 rx_1519_2047_byte_packets; /* dword 26*/
  440. u32 rx_2048_4095_byte_packets; /* dword 27*/
  441. u32 rx_4096_8191_byte_packets; /* dword 28*/
  442. u32 rx_8192_9216_byte_packets; /* dword 29*/
  443. u32 rx_ip_checksum_errs; /* dword 30*/
  444. u32 rx_tcp_checksum_errs; /* dword 31*/
  445. u32 rx_udp_checksum_errs; /* dword 32*/
  446. u32 rx_non_rss_packets; /* dword 33*/
  447. u32 rx_ipv4_packets; /* dword 34*/
  448. u32 rx_ipv6_packets; /* dword 35*/
  449. u32 rx_ipv4_bytes_lsd; /* dword 36*/
  450. u32 rx_ipv4_bytes_msd; /* dword 37*/
  451. u32 rx_ipv6_bytes_lsd; /* dword 38*/
  452. u32 rx_ipv6_bytes_msd; /* dword 39*/
  453. u32 rx_chute1_packets; /* dword 40*/
  454. u32 rx_chute2_packets; /* dword 41*/
  455. u32 rx_chute3_packets; /* dword 42*/
  456. u32 rx_management_packets; /* dword 43*/
  457. u32 rx_switched_unicast_packets; /* dword 44*/
  458. u32 rx_switched_multicast_packets; /* dword 45*/
  459. u32 rx_switched_broadcast_packets; /* dword 46*/
  460. u32 tx_bytes_lsd; /* dword 47*/
  461. u32 tx_bytes_msd; /* dword 48*/
  462. u32 tx_unicastframes; /* dword 49*/
  463. u32 tx_multicastframes; /* dword 50*/
  464. u32 tx_broadcastframes; /* dword 51*/
  465. u32 tx_pauseframes; /* dword 52*/
  466. u32 tx_controlframes; /* dword 53*/
  467. u32 tx_64_byte_packets; /* dword 54*/
  468. u32 tx_65_127_byte_packets; /* dword 55*/
  469. u32 tx_128_256_byte_packets; /* dword 56*/
  470. u32 tx_256_511_byte_packets; /* dword 57*/
  471. u32 tx_512_1023_byte_packets; /* dword 58*/
  472. u32 tx_1024_1518_byte_packets; /* dword 59*/
  473. u32 tx_1519_2047_byte_packets; /* dword 60*/
  474. u32 tx_2048_4095_byte_packets; /* dword 61*/
  475. u32 tx_4096_8191_byte_packets; /* dword 62*/
  476. u32 tx_8192_9216_byte_packets; /* dword 63*/
  477. u32 rx_fifo_overflow; /* dword 64*/
  478. u32 rx_input_fifo_overflow; /* dword 65*/
  479. };
  480. struct be_rxf_stats {
  481. struct be_port_rxf_stats port[2];
  482. u32 rx_drops_no_pbuf; /* dword 132*/
  483. u32 rx_drops_no_txpb; /* dword 133*/
  484. u32 rx_drops_no_erx_descr; /* dword 134*/
  485. u32 rx_drops_no_tpre_descr; /* dword 135*/
  486. u32 management_rx_port_packets; /* dword 136*/
  487. u32 management_rx_port_bytes; /* dword 137*/
  488. u32 management_rx_port_pause_frames; /* dword 138*/
  489. u32 management_rx_port_errors; /* dword 139*/
  490. u32 management_tx_port_packets; /* dword 140*/
  491. u32 management_tx_port_bytes; /* dword 141*/
  492. u32 management_tx_port_pause; /* dword 142*/
  493. u32 management_rx_port_rxfifo_overflow; /* dword 143*/
  494. u32 rx_drops_too_many_frags; /* dword 144*/
  495. u32 rx_drops_invalid_ring; /* dword 145*/
  496. u32 forwarded_packets; /* dword 146*/
  497. u32 rx_drops_mtu; /* dword 147*/
  498. u32 rsvd0[15];
  499. };
  500. struct be_erx_stats {
  501. u32 rx_drops_no_fragments[44]; /* dwordS 0 to 43*/
  502. u32 debug_wdma_sent_hold; /* dword 44*/
  503. u32 debug_wdma_pbfree_sent_hold; /* dword 45*/
  504. u32 debug_wdma_zerobyte_pbfree_sent_hold; /* dword 46*/
  505. u32 debug_pmem_pbuf_dealloc; /* dword 47*/
  506. };
  507. struct be_hw_stats {
  508. struct be_rxf_stats rxf;
  509. u32 rsvd[48];
  510. struct be_erx_stats erx;
  511. };
  512. struct be_cmd_req_get_stats {
  513. struct be_cmd_req_hdr hdr;
  514. u8 rsvd[sizeof(struct be_hw_stats)];
  515. };
  516. struct be_cmd_resp_get_stats {
  517. struct be_cmd_resp_hdr hdr;
  518. struct be_hw_stats hw_stats;
  519. };
  520. struct be_cmd_req_vlan_config {
  521. struct be_cmd_req_hdr hdr;
  522. u8 interface_id;
  523. u8 promiscuous;
  524. u8 untagged;
  525. u8 num_vlan;
  526. u16 normal_vlan[64];
  527. } __packed;
  528. struct be_cmd_req_promiscuous_config {
  529. struct be_cmd_req_hdr hdr;
  530. u8 port0_promiscuous;
  531. u8 port1_promiscuous;
  532. u16 rsvd0;
  533. } __packed;
  534. struct macaddr {
  535. u8 byte[ETH_ALEN];
  536. };
  537. struct be_cmd_req_mcast_mac_config {
  538. struct be_cmd_req_hdr hdr;
  539. u16 num_mac;
  540. u8 promiscuous;
  541. u8 interface_id;
  542. struct macaddr mac[32];
  543. } __packed;
  544. static inline struct be_hw_stats *
  545. hw_stats_from_cmd(struct be_cmd_resp_get_stats *cmd)
  546. {
  547. return &cmd->hw_stats;
  548. }
  549. /******************** Link Status Query *******************/
  550. struct be_cmd_req_link_status {
  551. struct be_cmd_req_hdr hdr;
  552. u32 rsvd;
  553. };
  554. enum {
  555. PHY_LINK_DUPLEX_NONE = 0x0,
  556. PHY_LINK_DUPLEX_HALF = 0x1,
  557. PHY_LINK_DUPLEX_FULL = 0x2
  558. };
  559. enum {
  560. PHY_LINK_SPEED_ZERO = 0x0, /* => No link */
  561. PHY_LINK_SPEED_10MBPS = 0x1,
  562. PHY_LINK_SPEED_100MBPS = 0x2,
  563. PHY_LINK_SPEED_1GBPS = 0x3,
  564. PHY_LINK_SPEED_10GBPS = 0x4
  565. };
  566. struct be_cmd_resp_link_status {
  567. struct be_cmd_resp_hdr hdr;
  568. u8 physical_port;
  569. u8 mac_duplex;
  570. u8 mac_speed;
  571. u8 mac_fault;
  572. u8 mgmt_mac_duplex;
  573. u8 mgmt_mac_speed;
  574. u16 rsvd0;
  575. } __packed;
  576. /******************** Get FW Version *******************/
  577. struct be_cmd_req_get_fw_version {
  578. struct be_cmd_req_hdr hdr;
  579. u8 rsvd0[FW_VER_LEN];
  580. u8 rsvd1[FW_VER_LEN];
  581. } __packed;
  582. struct be_cmd_resp_get_fw_version {
  583. struct be_cmd_resp_hdr hdr;
  584. u8 firmware_version_string[FW_VER_LEN];
  585. u8 fw_on_flash_version_string[FW_VER_LEN];
  586. } __packed;
  587. /******************** Set Flow Contrl *******************/
  588. struct be_cmd_req_set_flow_control {
  589. struct be_cmd_req_hdr hdr;
  590. u16 tx_flow_control;
  591. u16 rx_flow_control;
  592. } __packed;
  593. /******************** Get Flow Contrl *******************/
  594. struct be_cmd_req_get_flow_control {
  595. struct be_cmd_req_hdr hdr;
  596. u32 rsvd;
  597. };
  598. struct be_cmd_resp_get_flow_control {
  599. struct be_cmd_resp_hdr hdr;
  600. u16 tx_flow_control;
  601. u16 rx_flow_control;
  602. } __packed;
  603. /******************** Modify EQ Delay *******************/
  604. struct be_cmd_req_modify_eq_delay {
  605. struct be_cmd_req_hdr hdr;
  606. u32 num_eq;
  607. struct {
  608. u32 eq_id;
  609. u32 phase;
  610. u32 delay_multiplier;
  611. } delay[8];
  612. } __packed;
  613. struct be_cmd_resp_modify_eq_delay {
  614. struct be_cmd_resp_hdr hdr;
  615. u32 rsvd0;
  616. } __packed;
  617. /******************** Get FW Config *******************/
  618. struct be_cmd_req_query_fw_cfg {
  619. struct be_cmd_req_hdr hdr;
  620. u32 rsvd[30];
  621. };
  622. struct be_cmd_resp_query_fw_cfg {
  623. struct be_cmd_resp_hdr hdr;
  624. u32 be_config_number;
  625. u32 asic_revision;
  626. u32 phys_port;
  627. u32 function_cap;
  628. u32 rsvd[26];
  629. };
  630. /****************** Firmware Flash ******************/
  631. struct flashrom_params {
  632. u32 op_code;
  633. u32 op_type;
  634. u32 data_buf_size;
  635. u32 offset;
  636. u8 data_buf[4];
  637. };
  638. struct be_cmd_write_flashrom {
  639. struct be_cmd_req_hdr hdr;
  640. struct flashrom_params params;
  641. };
  642. extern int be_pci_fnum_get(struct be_adapter *adapter);
  643. extern int be_cmd_POST(struct be_adapter *adapter);
  644. extern int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr,
  645. u8 type, bool permanent, u32 if_handle);
  646. extern int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr,
  647. u32 if_id, u32 *pmac_id);
  648. extern int be_cmd_pmac_del(struct be_adapter *adapter, u32 if_id, u32 pmac_id);
  649. extern int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags,
  650. u32 en_flags, u8 *mac, bool pmac_invalid,
  651. u32 *if_handle, u32 *pmac_id);
  652. extern int be_cmd_if_destroy(struct be_adapter *adapter, u32 if_handle);
  653. extern int be_cmd_eq_create(struct be_adapter *adapter,
  654. struct be_queue_info *eq, int eq_delay);
  655. extern int be_cmd_cq_create(struct be_adapter *adapter,
  656. struct be_queue_info *cq, struct be_queue_info *eq,
  657. bool sol_evts, bool no_delay,
  658. int num_cqe_dma_coalesce);
  659. extern int be_cmd_mccq_create(struct be_adapter *adapter,
  660. struct be_queue_info *mccq,
  661. struct be_queue_info *cq);
  662. extern int be_cmd_txq_create(struct be_adapter *adapter,
  663. struct be_queue_info *txq,
  664. struct be_queue_info *cq);
  665. extern int be_cmd_rxq_create(struct be_adapter *adapter,
  666. struct be_queue_info *rxq, u16 cq_id,
  667. u16 frag_size, u16 max_frame_size, u32 if_id,
  668. u32 rss);
  669. extern int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q,
  670. int type);
  671. extern int be_cmd_link_status_query(struct be_adapter *adapter,
  672. bool *link_up);
  673. extern int be_cmd_reset(struct be_adapter *adapter);
  674. extern int be_cmd_get_stats(struct be_adapter *adapter,
  675. struct be_dma_mem *nonemb_cmd);
  676. extern int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver);
  677. extern int be_cmd_modify_eqd(struct be_adapter *adapter, u32 eq_id, u32 eqd);
  678. extern int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id,
  679. u16 *vtag_array, u32 num, bool untagged,
  680. bool promiscuous);
  681. extern int be_cmd_promiscuous_config(struct be_adapter *adapter,
  682. u8 port_num, bool en);
  683. extern int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id,
  684. struct dev_mc_list *mc_list, u32 mc_count);
  685. extern int be_cmd_set_flow_control(struct be_adapter *adapter,
  686. u32 tx_fc, u32 rx_fc);
  687. extern int be_cmd_get_flow_control(struct be_adapter *adapter,
  688. u32 *tx_fc, u32 *rx_fc);
  689. extern int be_cmd_query_fw_cfg(struct be_adapter *adapter,
  690. u32 *port_num, u32 *cap);
  691. extern int be_cmd_reset_function(struct be_adapter *adapter);
  692. extern int be_process_mcc(struct be_adapter *adapter);
  693. extern int be_cmd_write_flashrom(struct be_adapter *adapter,
  694. struct be_dma_mem *cmd, u32 flash_oper,
  695. u32 flash_opcode, u32 buf_size);