be_cmds.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930
  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 CMD_SUBSYSTEM_LOWLEVEL 0xb
  104. #define OPCODE_COMMON_NTWK_MAC_QUERY 1
  105. #define OPCODE_COMMON_NTWK_MAC_SET 2
  106. #define OPCODE_COMMON_NTWK_MULTICAST_SET 3
  107. #define OPCODE_COMMON_NTWK_VLAN_CONFIG 4
  108. #define OPCODE_COMMON_NTWK_LINK_STATUS_QUERY 5
  109. #define OPCODE_COMMON_READ_FLASHROM 6
  110. #define OPCODE_COMMON_WRITE_FLASHROM 7
  111. #define OPCODE_COMMON_CQ_CREATE 12
  112. #define OPCODE_COMMON_EQ_CREATE 13
  113. #define OPCODE_COMMON_MCC_CREATE 21
  114. #define OPCODE_COMMON_NTWK_RX_FILTER 34
  115. #define OPCODE_COMMON_GET_FW_VERSION 35
  116. #define OPCODE_COMMON_SET_FLOW_CONTROL 36
  117. #define OPCODE_COMMON_GET_FLOW_CONTROL 37
  118. #define OPCODE_COMMON_SET_FRAME_SIZE 39
  119. #define OPCODE_COMMON_MODIFY_EQ_DELAY 41
  120. #define OPCODE_COMMON_FIRMWARE_CONFIG 42
  121. #define OPCODE_COMMON_NTWK_INTERFACE_CREATE 50
  122. #define OPCODE_COMMON_NTWK_INTERFACE_DESTROY 51
  123. #define OPCODE_COMMON_MCC_DESTROY 53
  124. #define OPCODE_COMMON_CQ_DESTROY 54
  125. #define OPCODE_COMMON_EQ_DESTROY 55
  126. #define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG 58
  127. #define OPCODE_COMMON_NTWK_PMAC_ADD 59
  128. #define OPCODE_COMMON_NTWK_PMAC_DEL 60
  129. #define OPCODE_COMMON_FUNCTION_RESET 61
  130. #define OPCODE_COMMON_ENABLE_DISABLE_BEACON 69
  131. #define OPCODE_COMMON_GET_BEACON_STATE 70
  132. #define OPCODE_COMMON_READ_TRANSRECV_DATA 73
  133. #define OPCODE_ETH_ACPI_CONFIG 2
  134. #define OPCODE_ETH_PROMISCUOUS 3
  135. #define OPCODE_ETH_GET_STATISTICS 4
  136. #define OPCODE_ETH_TX_CREATE 7
  137. #define OPCODE_ETH_RX_CREATE 8
  138. #define OPCODE_ETH_TX_DESTROY 9
  139. #define OPCODE_ETH_RX_DESTROY 10
  140. #define OPCODE_ETH_ACPI_WOL_MAGIC_CONFIG 12
  141. #define OPCODE_LOWLEVEL_HOST_DDR_DMA 17
  142. #define OPCODE_LOWLEVEL_LOOPBACK_TEST 18
  143. #define OPCODE_LOWLEVEL_SET_LOOPBACK_MODE 19
  144. struct be_cmd_req_hdr {
  145. u8 opcode; /* dword 0 */
  146. u8 subsystem; /* dword 0 */
  147. u8 port_number; /* dword 0 */
  148. u8 domain; /* dword 0 */
  149. u32 timeout; /* dword 1 */
  150. u32 request_length; /* dword 2 */
  151. u32 rsvd; /* dword 3 */
  152. };
  153. #define RESP_HDR_INFO_OPCODE_SHIFT 0 /* bits 0 - 7 */
  154. #define RESP_HDR_INFO_SUBSYS_SHIFT 8 /* bits 8 - 15 */
  155. struct be_cmd_resp_hdr {
  156. u32 info; /* dword 0 */
  157. u32 status; /* dword 1 */
  158. u32 response_length; /* dword 2 */
  159. u32 actual_resp_len; /* dword 3 */
  160. };
  161. struct phys_addr {
  162. u32 lo;
  163. u32 hi;
  164. };
  165. /**************************
  166. * BE Command definitions *
  167. **************************/
  168. /* Pseudo amap definition in which each bit of the actual structure is defined
  169. * as a byte: used to calculate offset/shift/mask of each field */
  170. struct amap_eq_context {
  171. u8 cidx[13]; /* dword 0*/
  172. u8 rsvd0[3]; /* dword 0*/
  173. u8 epidx[13]; /* dword 0*/
  174. u8 valid; /* dword 0*/
  175. u8 rsvd1; /* dword 0*/
  176. u8 size; /* dword 0*/
  177. u8 pidx[13]; /* dword 1*/
  178. u8 rsvd2[3]; /* dword 1*/
  179. u8 pd[10]; /* dword 1*/
  180. u8 count[3]; /* dword 1*/
  181. u8 solevent; /* dword 1*/
  182. u8 stalled; /* dword 1*/
  183. u8 armed; /* dword 1*/
  184. u8 rsvd3[4]; /* dword 2*/
  185. u8 func[8]; /* dword 2*/
  186. u8 rsvd4; /* dword 2*/
  187. u8 delaymult[10]; /* dword 2*/
  188. u8 rsvd5[2]; /* dword 2*/
  189. u8 phase[2]; /* dword 2*/
  190. u8 nodelay; /* dword 2*/
  191. u8 rsvd6[4]; /* dword 2*/
  192. u8 rsvd7[32]; /* dword 3*/
  193. } __packed;
  194. struct be_cmd_req_eq_create {
  195. struct be_cmd_req_hdr hdr;
  196. u16 num_pages; /* sword */
  197. u16 rsvd0; /* sword */
  198. u8 context[sizeof(struct amap_eq_context) / 8];
  199. struct phys_addr pages[8];
  200. } __packed;
  201. struct be_cmd_resp_eq_create {
  202. struct be_cmd_resp_hdr resp_hdr;
  203. u16 eq_id; /* sword */
  204. u16 rsvd0; /* sword */
  205. } __packed;
  206. /******************** Mac query ***************************/
  207. enum {
  208. MAC_ADDRESS_TYPE_STORAGE = 0x0,
  209. MAC_ADDRESS_TYPE_NETWORK = 0x1,
  210. MAC_ADDRESS_TYPE_PD = 0x2,
  211. MAC_ADDRESS_TYPE_MANAGEMENT = 0x3
  212. };
  213. struct mac_addr {
  214. u16 size_of_struct;
  215. u8 addr[ETH_ALEN];
  216. } __packed;
  217. struct be_cmd_req_mac_query {
  218. struct be_cmd_req_hdr hdr;
  219. u8 type;
  220. u8 permanent;
  221. u16 if_id;
  222. } __packed;
  223. struct be_cmd_resp_mac_query {
  224. struct be_cmd_resp_hdr hdr;
  225. struct mac_addr mac;
  226. };
  227. /******************** PMac Add ***************************/
  228. struct be_cmd_req_pmac_add {
  229. struct be_cmd_req_hdr hdr;
  230. u32 if_id;
  231. u8 mac_address[ETH_ALEN];
  232. u8 rsvd0[2];
  233. } __packed;
  234. struct be_cmd_resp_pmac_add {
  235. struct be_cmd_resp_hdr hdr;
  236. u32 pmac_id;
  237. };
  238. /******************** PMac Del ***************************/
  239. struct be_cmd_req_pmac_del {
  240. struct be_cmd_req_hdr hdr;
  241. u32 if_id;
  242. u32 pmac_id;
  243. };
  244. /******************** Create CQ ***************************/
  245. /* Pseudo amap definition in which each bit of the actual structure is defined
  246. * as a byte: used to calculate offset/shift/mask of each field */
  247. struct amap_cq_context {
  248. u8 cidx[11]; /* dword 0*/
  249. u8 rsvd0; /* dword 0*/
  250. u8 coalescwm[2]; /* dword 0*/
  251. u8 nodelay; /* dword 0*/
  252. u8 epidx[11]; /* dword 0*/
  253. u8 rsvd1; /* dword 0*/
  254. u8 count[2]; /* dword 0*/
  255. u8 valid; /* dword 0*/
  256. u8 solevent; /* dword 0*/
  257. u8 eventable; /* dword 0*/
  258. u8 pidx[11]; /* dword 1*/
  259. u8 rsvd2; /* dword 1*/
  260. u8 pd[10]; /* dword 1*/
  261. u8 eqid[8]; /* dword 1*/
  262. u8 stalled; /* dword 1*/
  263. u8 armed; /* dword 1*/
  264. u8 rsvd3[4]; /* dword 2*/
  265. u8 func[8]; /* dword 2*/
  266. u8 rsvd4[20]; /* dword 2*/
  267. u8 rsvd5[32]; /* dword 3*/
  268. } __packed;
  269. struct be_cmd_req_cq_create {
  270. struct be_cmd_req_hdr hdr;
  271. u16 num_pages;
  272. u16 rsvd0;
  273. u8 context[sizeof(struct amap_cq_context) / 8];
  274. struct phys_addr pages[8];
  275. } __packed;
  276. struct be_cmd_resp_cq_create {
  277. struct be_cmd_resp_hdr hdr;
  278. u16 cq_id;
  279. u16 rsvd0;
  280. } __packed;
  281. /******************** Create MCCQ ***************************/
  282. /* Pseudo amap definition in which each bit of the actual structure is defined
  283. * as a byte: used to calculate offset/shift/mask of each field */
  284. struct amap_mcc_context {
  285. u8 con_index[14];
  286. u8 rsvd0[2];
  287. u8 ring_size[4];
  288. u8 fetch_wrb;
  289. u8 fetch_r2t;
  290. u8 cq_id[10];
  291. u8 prod_index[14];
  292. u8 fid[8];
  293. u8 pdid[9];
  294. u8 valid;
  295. u8 rsvd1[32];
  296. u8 rsvd2[32];
  297. } __packed;
  298. struct be_cmd_req_mcc_create {
  299. struct be_cmd_req_hdr hdr;
  300. u16 num_pages;
  301. u16 rsvd0;
  302. u8 context[sizeof(struct amap_mcc_context) / 8];
  303. struct phys_addr pages[8];
  304. } __packed;
  305. struct be_cmd_resp_mcc_create {
  306. struct be_cmd_resp_hdr hdr;
  307. u16 id;
  308. u16 rsvd0;
  309. } __packed;
  310. /******************** Create TxQ ***************************/
  311. #define BE_ETH_TX_RING_TYPE_STANDARD 2
  312. #define BE_ULP1_NUM 1
  313. /* Pseudo amap definition in which each bit of the actual structure is defined
  314. * as a byte: used to calculate offset/shift/mask of each field */
  315. struct amap_tx_context {
  316. u8 rsvd0[16]; /* dword 0 */
  317. u8 tx_ring_size[4]; /* dword 0 */
  318. u8 rsvd1[26]; /* dword 0 */
  319. u8 pci_func_id[8]; /* dword 1 */
  320. u8 rsvd2[9]; /* dword 1 */
  321. u8 ctx_valid; /* dword 1 */
  322. u8 cq_id_send[16]; /* dword 2 */
  323. u8 rsvd3[16]; /* dword 2 */
  324. u8 rsvd4[32]; /* dword 3 */
  325. u8 rsvd5[32]; /* dword 4 */
  326. u8 rsvd6[32]; /* dword 5 */
  327. u8 rsvd7[32]; /* dword 6 */
  328. u8 rsvd8[32]; /* dword 7 */
  329. u8 rsvd9[32]; /* dword 8 */
  330. u8 rsvd10[32]; /* dword 9 */
  331. u8 rsvd11[32]; /* dword 10 */
  332. u8 rsvd12[32]; /* dword 11 */
  333. u8 rsvd13[32]; /* dword 12 */
  334. u8 rsvd14[32]; /* dword 13 */
  335. u8 rsvd15[32]; /* dword 14 */
  336. u8 rsvd16[32]; /* dword 15 */
  337. } __packed;
  338. struct be_cmd_req_eth_tx_create {
  339. struct be_cmd_req_hdr hdr;
  340. u8 num_pages;
  341. u8 ulp_num;
  342. u8 type;
  343. u8 bound_port;
  344. u8 context[sizeof(struct amap_tx_context) / 8];
  345. struct phys_addr pages[8];
  346. } __packed;
  347. struct be_cmd_resp_eth_tx_create {
  348. struct be_cmd_resp_hdr hdr;
  349. u16 cid;
  350. u16 rsvd0;
  351. } __packed;
  352. /******************** Create RxQ ***************************/
  353. struct be_cmd_req_eth_rx_create {
  354. struct be_cmd_req_hdr hdr;
  355. u16 cq_id;
  356. u8 frag_size;
  357. u8 num_pages;
  358. struct phys_addr pages[2];
  359. u32 interface_id;
  360. u16 max_frame_size;
  361. u16 rsvd0;
  362. u32 rss_queue;
  363. } __packed;
  364. struct be_cmd_resp_eth_rx_create {
  365. struct be_cmd_resp_hdr hdr;
  366. u16 id;
  367. u8 cpu_id;
  368. u8 rsvd0;
  369. } __packed;
  370. /******************** Q Destroy ***************************/
  371. /* Type of Queue to be destroyed */
  372. enum {
  373. QTYPE_EQ = 1,
  374. QTYPE_CQ,
  375. QTYPE_TXQ,
  376. QTYPE_RXQ,
  377. QTYPE_MCCQ
  378. };
  379. struct be_cmd_req_q_destroy {
  380. struct be_cmd_req_hdr hdr;
  381. u16 id;
  382. u16 bypass_flush; /* valid only for rx q destroy */
  383. } __packed;
  384. /************ I/f Create (it's actually I/f Config Create)**********/
  385. /* Capability flags for the i/f */
  386. enum be_if_flags {
  387. BE_IF_FLAGS_RSS = 0x4,
  388. BE_IF_FLAGS_PROMISCUOUS = 0x8,
  389. BE_IF_FLAGS_BROADCAST = 0x10,
  390. BE_IF_FLAGS_UNTAGGED = 0x20,
  391. BE_IF_FLAGS_ULP = 0x40,
  392. BE_IF_FLAGS_VLAN_PROMISCUOUS = 0x80,
  393. BE_IF_FLAGS_VLAN = 0x100,
  394. BE_IF_FLAGS_MCAST_PROMISCUOUS = 0x200,
  395. BE_IF_FLAGS_PASS_L2_ERRORS = 0x400,
  396. BE_IF_FLAGS_PASS_L3L4_ERRORS = 0x800
  397. };
  398. /* An RX interface is an object with one or more MAC addresses and
  399. * filtering capabilities. */
  400. struct be_cmd_req_if_create {
  401. struct be_cmd_req_hdr hdr;
  402. u32 version; /* ignore currently */
  403. u32 capability_flags;
  404. u32 enable_flags;
  405. u8 mac_addr[ETH_ALEN];
  406. u8 rsvd0;
  407. u8 pmac_invalid; /* if set, don't attach the mac addr to the i/f */
  408. u32 vlan_tag; /* not used currently */
  409. } __packed;
  410. struct be_cmd_resp_if_create {
  411. struct be_cmd_resp_hdr hdr;
  412. u32 interface_id;
  413. u32 pmac_id;
  414. };
  415. /****** I/f Destroy(it's actually I/f Config Destroy )**********/
  416. struct be_cmd_req_if_destroy {
  417. struct be_cmd_req_hdr hdr;
  418. u32 interface_id;
  419. };
  420. /*************** HW Stats Get **********************************/
  421. struct be_port_rxf_stats {
  422. u32 rx_bytes_lsd; /* dword 0*/
  423. u32 rx_bytes_msd; /* dword 1*/
  424. u32 rx_total_frames; /* dword 2*/
  425. u32 rx_unicast_frames; /* dword 3*/
  426. u32 rx_multicast_frames; /* dword 4*/
  427. u32 rx_broadcast_frames; /* dword 5*/
  428. u32 rx_crc_errors; /* dword 6*/
  429. u32 rx_alignment_symbol_errors; /* dword 7*/
  430. u32 rx_pause_frames; /* dword 8*/
  431. u32 rx_control_frames; /* dword 9*/
  432. u32 rx_in_range_errors; /* dword 10*/
  433. u32 rx_out_range_errors; /* dword 11*/
  434. u32 rx_frame_too_long; /* dword 12*/
  435. u32 rx_address_match_errors; /* dword 13*/
  436. u32 rx_vlan_mismatch; /* dword 14*/
  437. u32 rx_dropped_too_small; /* dword 15*/
  438. u32 rx_dropped_too_short; /* dword 16*/
  439. u32 rx_dropped_header_too_small; /* dword 17*/
  440. u32 rx_dropped_tcp_length; /* dword 18*/
  441. u32 rx_dropped_runt; /* dword 19*/
  442. u32 rx_64_byte_packets; /* dword 20*/
  443. u32 rx_65_127_byte_packets; /* dword 21*/
  444. u32 rx_128_256_byte_packets; /* dword 22*/
  445. u32 rx_256_511_byte_packets; /* dword 23*/
  446. u32 rx_512_1023_byte_packets; /* dword 24*/
  447. u32 rx_1024_1518_byte_packets; /* dword 25*/
  448. u32 rx_1519_2047_byte_packets; /* dword 26*/
  449. u32 rx_2048_4095_byte_packets; /* dword 27*/
  450. u32 rx_4096_8191_byte_packets; /* dword 28*/
  451. u32 rx_8192_9216_byte_packets; /* dword 29*/
  452. u32 rx_ip_checksum_errs; /* dword 30*/
  453. u32 rx_tcp_checksum_errs; /* dword 31*/
  454. u32 rx_udp_checksum_errs; /* dword 32*/
  455. u32 rx_non_rss_packets; /* dword 33*/
  456. u32 rx_ipv4_packets; /* dword 34*/
  457. u32 rx_ipv6_packets; /* dword 35*/
  458. u32 rx_ipv4_bytes_lsd; /* dword 36*/
  459. u32 rx_ipv4_bytes_msd; /* dword 37*/
  460. u32 rx_ipv6_bytes_lsd; /* dword 38*/
  461. u32 rx_ipv6_bytes_msd; /* dword 39*/
  462. u32 rx_chute1_packets; /* dword 40*/
  463. u32 rx_chute2_packets; /* dword 41*/
  464. u32 rx_chute3_packets; /* dword 42*/
  465. u32 rx_management_packets; /* dword 43*/
  466. u32 rx_switched_unicast_packets; /* dword 44*/
  467. u32 rx_switched_multicast_packets; /* dword 45*/
  468. u32 rx_switched_broadcast_packets; /* dword 46*/
  469. u32 tx_bytes_lsd; /* dword 47*/
  470. u32 tx_bytes_msd; /* dword 48*/
  471. u32 tx_unicastframes; /* dword 49*/
  472. u32 tx_multicastframes; /* dword 50*/
  473. u32 tx_broadcastframes; /* dword 51*/
  474. u32 tx_pauseframes; /* dword 52*/
  475. u32 tx_controlframes; /* dword 53*/
  476. u32 tx_64_byte_packets; /* dword 54*/
  477. u32 tx_65_127_byte_packets; /* dword 55*/
  478. u32 tx_128_256_byte_packets; /* dword 56*/
  479. u32 tx_256_511_byte_packets; /* dword 57*/
  480. u32 tx_512_1023_byte_packets; /* dword 58*/
  481. u32 tx_1024_1518_byte_packets; /* dword 59*/
  482. u32 tx_1519_2047_byte_packets; /* dword 60*/
  483. u32 tx_2048_4095_byte_packets; /* dword 61*/
  484. u32 tx_4096_8191_byte_packets; /* dword 62*/
  485. u32 tx_8192_9216_byte_packets; /* dword 63*/
  486. u32 rx_fifo_overflow; /* dword 64*/
  487. u32 rx_input_fifo_overflow; /* dword 65*/
  488. };
  489. struct be_rxf_stats {
  490. struct be_port_rxf_stats port[2];
  491. u32 rx_drops_no_pbuf; /* dword 132*/
  492. u32 rx_drops_no_txpb; /* dword 133*/
  493. u32 rx_drops_no_erx_descr; /* dword 134*/
  494. u32 rx_drops_no_tpre_descr; /* dword 135*/
  495. u32 management_rx_port_packets; /* dword 136*/
  496. u32 management_rx_port_bytes; /* dword 137*/
  497. u32 management_rx_port_pause_frames; /* dword 138*/
  498. u32 management_rx_port_errors; /* dword 139*/
  499. u32 management_tx_port_packets; /* dword 140*/
  500. u32 management_tx_port_bytes; /* dword 141*/
  501. u32 management_tx_port_pause; /* dword 142*/
  502. u32 management_rx_port_rxfifo_overflow; /* dword 143*/
  503. u32 rx_drops_too_many_frags; /* dword 144*/
  504. u32 rx_drops_invalid_ring; /* dword 145*/
  505. u32 forwarded_packets; /* dword 146*/
  506. u32 rx_drops_mtu; /* dword 147*/
  507. u32 rsvd0[15];
  508. };
  509. struct be_erx_stats {
  510. u32 rx_drops_no_fragments[44]; /* dwordS 0 to 43*/
  511. u32 debug_wdma_sent_hold; /* dword 44*/
  512. u32 debug_wdma_pbfree_sent_hold; /* dword 45*/
  513. u32 debug_wdma_zerobyte_pbfree_sent_hold; /* dword 46*/
  514. u32 debug_pmem_pbuf_dealloc; /* dword 47*/
  515. };
  516. struct be_hw_stats {
  517. struct be_rxf_stats rxf;
  518. u32 rsvd[48];
  519. struct be_erx_stats erx;
  520. };
  521. struct be_cmd_req_get_stats {
  522. struct be_cmd_req_hdr hdr;
  523. u8 rsvd[sizeof(struct be_hw_stats)];
  524. };
  525. struct be_cmd_resp_get_stats {
  526. struct be_cmd_resp_hdr hdr;
  527. struct be_hw_stats hw_stats;
  528. };
  529. struct be_cmd_req_vlan_config {
  530. struct be_cmd_req_hdr hdr;
  531. u8 interface_id;
  532. u8 promiscuous;
  533. u8 untagged;
  534. u8 num_vlan;
  535. u16 normal_vlan[64];
  536. } __packed;
  537. struct be_cmd_req_promiscuous_config {
  538. struct be_cmd_req_hdr hdr;
  539. u8 port0_promiscuous;
  540. u8 port1_promiscuous;
  541. u16 rsvd0;
  542. } __packed;
  543. /******************** Multicast MAC Config *******************/
  544. #define BE_MAX_MC 64 /* set mcast promisc if > 64 */
  545. struct macaddr {
  546. u8 byte[ETH_ALEN];
  547. };
  548. struct be_cmd_req_mcast_mac_config {
  549. struct be_cmd_req_hdr hdr;
  550. u16 num_mac;
  551. u8 promiscuous;
  552. u8 interface_id;
  553. struct macaddr mac[BE_MAX_MC];
  554. } __packed;
  555. static inline struct be_hw_stats *
  556. hw_stats_from_cmd(struct be_cmd_resp_get_stats *cmd)
  557. {
  558. return &cmd->hw_stats;
  559. }
  560. /******************** Link Status Query *******************/
  561. struct be_cmd_req_link_status {
  562. struct be_cmd_req_hdr hdr;
  563. u32 rsvd;
  564. };
  565. enum {
  566. PHY_LINK_DUPLEX_NONE = 0x0,
  567. PHY_LINK_DUPLEX_HALF = 0x1,
  568. PHY_LINK_DUPLEX_FULL = 0x2
  569. };
  570. enum {
  571. PHY_LINK_SPEED_ZERO = 0x0, /* => No link */
  572. PHY_LINK_SPEED_10MBPS = 0x1,
  573. PHY_LINK_SPEED_100MBPS = 0x2,
  574. PHY_LINK_SPEED_1GBPS = 0x3,
  575. PHY_LINK_SPEED_10GBPS = 0x4
  576. };
  577. struct be_cmd_resp_link_status {
  578. struct be_cmd_resp_hdr hdr;
  579. u8 physical_port;
  580. u8 mac_duplex;
  581. u8 mac_speed;
  582. u8 mac_fault;
  583. u8 mgmt_mac_duplex;
  584. u8 mgmt_mac_speed;
  585. u16 link_speed;
  586. u32 rsvd0;
  587. } __packed;
  588. /******************** Port Identification ***************************/
  589. /* Identifies the type of port attached to NIC */
  590. struct be_cmd_req_port_type {
  591. struct be_cmd_req_hdr hdr;
  592. u32 page_num;
  593. u32 port;
  594. };
  595. enum {
  596. TR_PAGE_A0 = 0xa0,
  597. TR_PAGE_A2 = 0xa2
  598. };
  599. struct be_cmd_resp_port_type {
  600. struct be_cmd_resp_hdr hdr;
  601. u32 page_num;
  602. u32 port;
  603. struct data {
  604. u8 identifier;
  605. u8 identifier_ext;
  606. u8 connector;
  607. u8 transceiver[8];
  608. u8 rsvd0[3];
  609. u8 length_km;
  610. u8 length_hm;
  611. u8 length_om1;
  612. u8 length_om2;
  613. u8 length_cu;
  614. u8 length_cu_m;
  615. u8 vendor_name[16];
  616. u8 rsvd;
  617. u8 vendor_oui[3];
  618. u8 vendor_pn[16];
  619. u8 vendor_rev[4];
  620. } data;
  621. };
  622. /******************** Get FW Version *******************/
  623. struct be_cmd_req_get_fw_version {
  624. struct be_cmd_req_hdr hdr;
  625. u8 rsvd0[FW_VER_LEN];
  626. u8 rsvd1[FW_VER_LEN];
  627. } __packed;
  628. struct be_cmd_resp_get_fw_version {
  629. struct be_cmd_resp_hdr hdr;
  630. u8 firmware_version_string[FW_VER_LEN];
  631. u8 fw_on_flash_version_string[FW_VER_LEN];
  632. } __packed;
  633. /******************** Set Flow Contrl *******************/
  634. struct be_cmd_req_set_flow_control {
  635. struct be_cmd_req_hdr hdr;
  636. u16 tx_flow_control;
  637. u16 rx_flow_control;
  638. } __packed;
  639. /******************** Get Flow Contrl *******************/
  640. struct be_cmd_req_get_flow_control {
  641. struct be_cmd_req_hdr hdr;
  642. u32 rsvd;
  643. };
  644. struct be_cmd_resp_get_flow_control {
  645. struct be_cmd_resp_hdr hdr;
  646. u16 tx_flow_control;
  647. u16 rx_flow_control;
  648. } __packed;
  649. /******************** Modify EQ Delay *******************/
  650. struct be_cmd_req_modify_eq_delay {
  651. struct be_cmd_req_hdr hdr;
  652. u32 num_eq;
  653. struct {
  654. u32 eq_id;
  655. u32 phase;
  656. u32 delay_multiplier;
  657. } delay[8];
  658. } __packed;
  659. struct be_cmd_resp_modify_eq_delay {
  660. struct be_cmd_resp_hdr hdr;
  661. u32 rsvd0;
  662. } __packed;
  663. /******************** Get FW Config *******************/
  664. struct be_cmd_req_query_fw_cfg {
  665. struct be_cmd_req_hdr hdr;
  666. u32 rsvd[30];
  667. };
  668. struct be_cmd_resp_query_fw_cfg {
  669. struct be_cmd_resp_hdr hdr;
  670. u32 be_config_number;
  671. u32 asic_revision;
  672. u32 phys_port;
  673. u32 function_cap;
  674. u32 rsvd[26];
  675. };
  676. /******************** Port Beacon ***************************/
  677. #define BEACON_STATE_ENABLED 0x1
  678. #define BEACON_STATE_DISABLED 0x0
  679. struct be_cmd_req_enable_disable_beacon {
  680. struct be_cmd_req_hdr hdr;
  681. u8 port_num;
  682. u8 beacon_state;
  683. u8 beacon_duration;
  684. u8 status_duration;
  685. } __packed;
  686. struct be_cmd_resp_enable_disable_beacon {
  687. struct be_cmd_resp_hdr resp_hdr;
  688. u32 rsvd0;
  689. } __packed;
  690. struct be_cmd_req_get_beacon_state {
  691. struct be_cmd_req_hdr hdr;
  692. u8 port_num;
  693. u8 rsvd0;
  694. u16 rsvd1;
  695. } __packed;
  696. struct be_cmd_resp_get_beacon_state {
  697. struct be_cmd_resp_hdr resp_hdr;
  698. u8 beacon_state;
  699. u8 rsvd0[3];
  700. } __packed;
  701. /****************** Firmware Flash ******************/
  702. struct flashrom_params {
  703. u32 op_code;
  704. u32 op_type;
  705. u32 data_buf_size;
  706. u32 offset;
  707. u8 data_buf[4];
  708. };
  709. struct be_cmd_write_flashrom {
  710. struct be_cmd_req_hdr hdr;
  711. struct flashrom_params params;
  712. };
  713. /************************ WOL *******************************/
  714. struct be_cmd_req_acpi_wol_magic_config{
  715. struct be_cmd_req_hdr hdr;
  716. u32 rsvd0[145];
  717. u8 magic_mac[6];
  718. u8 rsvd2[2];
  719. } __packed;
  720. /********************** LoopBack test *********************/
  721. struct be_cmd_req_loopback_test {
  722. struct be_cmd_req_hdr hdr;
  723. u32 loopback_type;
  724. u32 num_pkts;
  725. u64 pattern;
  726. u32 src_port;
  727. u32 dest_port;
  728. u32 pkt_size;
  729. };
  730. struct be_cmd_resp_loopback_test {
  731. struct be_cmd_resp_hdr resp_hdr;
  732. u32 status;
  733. u32 num_txfer;
  734. u32 num_rx;
  735. u32 miscomp_off;
  736. u32 ticks_compl;
  737. };
  738. struct be_cmd_req_set_lmode {
  739. struct be_cmd_req_hdr hdr;
  740. u8 src_port;
  741. u8 dest_port;
  742. u8 loopback_type;
  743. u8 loopback_state;
  744. };
  745. struct be_cmd_resp_set_lmode {
  746. struct be_cmd_resp_hdr resp_hdr;
  747. u8 rsvd0[4];
  748. };
  749. /********************** DDR DMA test *********************/
  750. struct be_cmd_req_ddrdma_test {
  751. struct be_cmd_req_hdr hdr;
  752. u64 pattern;
  753. u32 byte_count;
  754. u32 rsvd0;
  755. u8 snd_buff[4096];
  756. u8 rsvd1[4096];
  757. };
  758. struct be_cmd_resp_ddrdma_test {
  759. struct be_cmd_resp_hdr hdr;
  760. u64 pattern;
  761. u32 byte_cnt;
  762. u32 snd_err;
  763. u8 rsvd0[4096];
  764. u8 rcv_buff[4096];
  765. };
  766. extern int be_pci_fnum_get(struct be_adapter *adapter);
  767. extern int be_cmd_POST(struct be_adapter *adapter);
  768. extern int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr,
  769. u8 type, bool permanent, u32 if_handle);
  770. extern int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr,
  771. u32 if_id, u32 *pmac_id);
  772. extern int be_cmd_pmac_del(struct be_adapter *adapter, u32 if_id, u32 pmac_id);
  773. extern int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags,
  774. u32 en_flags, u8 *mac, bool pmac_invalid,
  775. u32 *if_handle, u32 *pmac_id);
  776. extern int be_cmd_if_destroy(struct be_adapter *adapter, u32 if_handle);
  777. extern int be_cmd_eq_create(struct be_adapter *adapter,
  778. struct be_queue_info *eq, int eq_delay);
  779. extern int be_cmd_cq_create(struct be_adapter *adapter,
  780. struct be_queue_info *cq, struct be_queue_info *eq,
  781. bool sol_evts, bool no_delay,
  782. int num_cqe_dma_coalesce);
  783. extern int be_cmd_mccq_create(struct be_adapter *adapter,
  784. struct be_queue_info *mccq,
  785. struct be_queue_info *cq);
  786. extern int be_cmd_txq_create(struct be_adapter *adapter,
  787. struct be_queue_info *txq,
  788. struct be_queue_info *cq);
  789. extern int be_cmd_rxq_create(struct be_adapter *adapter,
  790. struct be_queue_info *rxq, u16 cq_id,
  791. u16 frag_size, u16 max_frame_size, u32 if_id,
  792. u32 rss);
  793. extern int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q,
  794. int type);
  795. extern int be_cmd_link_status_query(struct be_adapter *adapter,
  796. bool *link_up, u8 *mac_speed, u16 *link_speed);
  797. extern int be_cmd_reset(struct be_adapter *adapter);
  798. extern int be_cmd_get_stats(struct be_adapter *adapter,
  799. struct be_dma_mem *nonemb_cmd);
  800. extern int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver);
  801. extern int be_cmd_modify_eqd(struct be_adapter *adapter, u32 eq_id, u32 eqd);
  802. extern int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id,
  803. u16 *vtag_array, u32 num, bool untagged,
  804. bool promiscuous);
  805. extern int be_cmd_promiscuous_config(struct be_adapter *adapter,
  806. u8 port_num, bool en);
  807. extern int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id,
  808. struct dev_mc_list *mc_list, u32 mc_count,
  809. struct be_dma_mem *mem);
  810. extern int be_cmd_set_flow_control(struct be_adapter *adapter,
  811. u32 tx_fc, u32 rx_fc);
  812. extern int be_cmd_get_flow_control(struct be_adapter *adapter,
  813. u32 *tx_fc, u32 *rx_fc);
  814. extern int be_cmd_query_fw_cfg(struct be_adapter *adapter,
  815. u32 *port_num, u32 *cap);
  816. extern int be_cmd_reset_function(struct be_adapter *adapter);
  817. extern int be_process_mcc(struct be_adapter *adapter);
  818. extern int be_cmd_set_beacon_state(struct be_adapter *adapter,
  819. u8 port_num, u8 beacon, u8 status, u8 state);
  820. extern int be_cmd_get_beacon_state(struct be_adapter *adapter,
  821. u8 port_num, u32 *state);
  822. extern int be_cmd_read_port_type(struct be_adapter *adapter, u32 port,
  823. u8 *connector);
  824. extern int be_cmd_write_flashrom(struct be_adapter *adapter,
  825. struct be_dma_mem *cmd, u32 flash_oper,
  826. u32 flash_opcode, u32 buf_size);
  827. extern int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc);
  828. extern int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac,
  829. struct be_dma_mem *nonemb_cmd);
  830. extern int be_cmd_fw_init(struct be_adapter *adapter);
  831. extern int be_cmd_fw_clean(struct be_adapter *adapter);
  832. extern int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num,
  833. u32 loopback_type, u32 pkt_size,
  834. u32 num_pkts, u64 pattern);
  835. extern int be_cmd_ddr_dma_test(struct be_adapter *adapter, u64 pattern,
  836. u32 byte_cnt, struct be_dma_mem *cmd);
  837. extern int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num,
  838. u8 loopback_type, u8 enable);