be_cmds.h 20 KB

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