myri10ge_mcp.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  1. #ifndef __MYRI10GE_MCP_H__
  2. #define __MYRI10GE_MCP_H__
  3. #define MXGEFW_VERSION_MAJOR 1
  4. #define MXGEFW_VERSION_MINOR 4
  5. /* 8 Bytes */
  6. struct mcp_dma_addr {
  7. __be32 high;
  8. __be32 low;
  9. };
  10. /* 4 Bytes */
  11. struct mcp_slot {
  12. __sum16 checksum;
  13. __be16 length;
  14. };
  15. /* 64 Bytes */
  16. struct mcp_cmd {
  17. __be32 cmd;
  18. __be32 data0; /* will be low portion if data > 32 bits */
  19. /* 8 */
  20. __be32 data1; /* will be high portion if data > 32 bits */
  21. __be32 data2; /* currently unused.. */
  22. /* 16 */
  23. struct mcp_dma_addr response_addr;
  24. /* 24 */
  25. u8 pad[40];
  26. };
  27. /* 8 Bytes */
  28. struct mcp_cmd_response {
  29. __be32 data;
  30. __be32 result;
  31. };
  32. /*
  33. * flags used in mcp_kreq_ether_send_t:
  34. *
  35. * The SMALL flag is only needed in the first segment. It is raised
  36. * for packets that are total less or equal 512 bytes.
  37. *
  38. * The CKSUM flag must be set in all segments.
  39. *
  40. * The PADDED flags is set if the packet needs to be padded, and it
  41. * must be set for all segments.
  42. *
  43. * The MXGEFW_FLAGS_ALIGN_ODD must be set if the cumulative
  44. * length of all previous segments was odd.
  45. */
  46. #define MXGEFW_FLAGS_SMALL 0x1
  47. #define MXGEFW_FLAGS_TSO_HDR 0x1
  48. #define MXGEFW_FLAGS_FIRST 0x2
  49. #define MXGEFW_FLAGS_ALIGN_ODD 0x4
  50. #define MXGEFW_FLAGS_CKSUM 0x8
  51. #define MXGEFW_FLAGS_TSO_LAST 0x8
  52. #define MXGEFW_FLAGS_NO_TSO 0x10
  53. #define MXGEFW_FLAGS_TSO_CHOP 0x10
  54. #define MXGEFW_FLAGS_TSO_PLD 0x20
  55. #define MXGEFW_SEND_SMALL_SIZE 1520
  56. #define MXGEFW_MAX_MTU 9400
  57. union mcp_pso_or_cumlen {
  58. u16 pseudo_hdr_offset;
  59. u16 cum_len;
  60. };
  61. #define MXGEFW_MAX_SEND_DESC 12
  62. #define MXGEFW_PAD 2
  63. /* 16 Bytes */
  64. struct mcp_kreq_ether_send {
  65. __be32 addr_high;
  66. __be32 addr_low;
  67. __be16 pseudo_hdr_offset;
  68. __be16 length;
  69. u8 pad;
  70. u8 rdma_count;
  71. u8 cksum_offset; /* where to start computing cksum */
  72. u8 flags; /* as defined above */
  73. };
  74. /* 8 Bytes */
  75. struct mcp_kreq_ether_recv {
  76. __be32 addr_high;
  77. __be32 addr_low;
  78. };
  79. /* Commands */
  80. #define MXGEFW_BOOT_HANDOFF 0xfc0000
  81. #define MXGEFW_BOOT_DUMMY_RDMA 0xfc01c0
  82. #define MXGEFW_ETH_CMD 0xf80000
  83. #define MXGEFW_ETH_SEND_4 0x200000
  84. #define MXGEFW_ETH_SEND_1 0x240000
  85. #define MXGEFW_ETH_SEND_2 0x280000
  86. #define MXGEFW_ETH_SEND_3 0x2c0000
  87. #define MXGEFW_ETH_RECV_SMALL 0x300000
  88. #define MXGEFW_ETH_RECV_BIG 0x340000
  89. #define MXGEFW_ETH_SEND_GO 0x380000
  90. #define MXGEFW_ETH_SEND_STOP 0x3C0000
  91. #define MXGEFW_ETH_SEND(n) (0x200000 + (((n) & 0x03) * 0x40000))
  92. #define MXGEFW_ETH_SEND_OFFSET(n) (MXGEFW_ETH_SEND(n) - MXGEFW_ETH_SEND_4)
  93. enum myri10ge_mcp_cmd_type {
  94. MXGEFW_CMD_NONE = 0,
  95. /* Reset the mcp, it is left in a safe state, waiting
  96. * for the driver to set all its parameters */
  97. MXGEFW_CMD_RESET,
  98. /* get the version number of the current firmware..
  99. * (may be available in the eeprom strings..? */
  100. MXGEFW_GET_MCP_VERSION,
  101. /* Parameters which must be set by the driver before it can
  102. * issue MXGEFW_CMD_ETHERNET_UP. They persist until the next
  103. * MXGEFW_CMD_RESET is issued */
  104. MXGEFW_CMD_SET_INTRQ_DMA,
  105. /* data0 = LSW of the host address
  106. * data1 = MSW of the host address
  107. * data2 = slice number if multiple slices are used
  108. */
  109. MXGEFW_CMD_SET_BIG_BUFFER_SIZE, /* in bytes, power of 2 */
  110. MXGEFW_CMD_SET_SMALL_BUFFER_SIZE, /* in bytes */
  111. /* Parameters which refer to lanai SRAM addresses where the
  112. * driver must issue PIO writes for various things */
  113. MXGEFW_CMD_GET_SEND_OFFSET,
  114. MXGEFW_CMD_GET_SMALL_RX_OFFSET,
  115. MXGEFW_CMD_GET_BIG_RX_OFFSET,
  116. /* data0 = slice number if multiple slices are used */
  117. MXGEFW_CMD_GET_IRQ_ACK_OFFSET,
  118. MXGEFW_CMD_GET_IRQ_DEASSERT_OFFSET,
  119. /* Parameters which refer to rings stored on the MCP,
  120. * and whose size is controlled by the mcp */
  121. MXGEFW_CMD_GET_SEND_RING_SIZE, /* in bytes */
  122. MXGEFW_CMD_GET_RX_RING_SIZE, /* in bytes */
  123. /* Parameters which refer to rings stored in the host,
  124. * and whose size is controlled by the host. Note that
  125. * all must be physically contiguous and must contain
  126. * a power of 2 number of entries. */
  127. MXGEFW_CMD_SET_INTRQ_SIZE, /* in bytes */
  128. #define MXGEFW_CMD_SET_INTRQ_SIZE_FLAG_NO_STRICT_SIZE_CHECK (1 << 31)
  129. /* command to bring ethernet interface up. Above parameters
  130. * (plus mtu & mac address) must have been exchanged prior
  131. * to issuing this command */
  132. MXGEFW_CMD_ETHERNET_UP,
  133. /* command to bring ethernet interface down. No further sends
  134. * or receives may be processed until an MXGEFW_CMD_ETHERNET_UP
  135. * is issued, and all interrupt queues must be flushed prior
  136. * to ack'ing this command */
  137. MXGEFW_CMD_ETHERNET_DOWN,
  138. /* commands the driver may issue live, without resetting
  139. * the nic. Note that increasing the mtu "live" should
  140. * only be done if the driver has already supplied buffers
  141. * sufficiently large to handle the new mtu. Decreasing
  142. * the mtu live is safe */
  143. MXGEFW_CMD_SET_MTU,
  144. MXGEFW_CMD_GET_INTR_COAL_DELAY_OFFSET, /* in microseconds */
  145. MXGEFW_CMD_SET_STATS_INTERVAL, /* in microseconds */
  146. MXGEFW_CMD_SET_STATS_DMA_OBSOLETE, /* replaced by SET_STATS_DMA_V2 */
  147. MXGEFW_ENABLE_PROMISC,
  148. MXGEFW_DISABLE_PROMISC,
  149. MXGEFW_SET_MAC_ADDRESS,
  150. MXGEFW_ENABLE_FLOW_CONTROL,
  151. MXGEFW_DISABLE_FLOW_CONTROL,
  152. /* do a DMA test
  153. * data0,data1 = DMA address
  154. * data2 = RDMA length (MSH), WDMA length (LSH)
  155. * command return data = repetitions (MSH), 0.5-ms ticks (LSH)
  156. */
  157. MXGEFW_DMA_TEST,
  158. MXGEFW_ENABLE_ALLMULTI,
  159. MXGEFW_DISABLE_ALLMULTI,
  160. /* returns MXGEFW_CMD_ERROR_MULTICAST
  161. * if there is no room in the cache
  162. * data0,MSH(data1) = multicast group address */
  163. MXGEFW_JOIN_MULTICAST_GROUP,
  164. /* returns MXGEFW_CMD_ERROR_MULTICAST
  165. * if the address is not in the cache,
  166. * or is equal to FF-FF-FF-FF-FF-FF
  167. * data0,MSH(data1) = multicast group address */
  168. MXGEFW_LEAVE_MULTICAST_GROUP,
  169. MXGEFW_LEAVE_ALL_MULTICAST_GROUPS,
  170. MXGEFW_CMD_SET_STATS_DMA_V2,
  171. /* data0, data1 = bus addr,
  172. * data2 = sizeof(struct mcp_irq_data) from driver point of view, allows
  173. * adding new stuff to mcp_irq_data without changing the ABI
  174. *
  175. * If multiple slices are used, data2 contains both the size of the
  176. * structure (in the lower 16 bits) and the slice number
  177. * (in the upper 16 bits).
  178. */
  179. MXGEFW_CMD_UNALIGNED_TEST,
  180. /* same than DMA_TEST (same args) but abort with UNALIGNED on unaligned
  181. * chipset */
  182. MXGEFW_CMD_UNALIGNED_STATUS,
  183. /* return data = boolean, true if the chipset is known to be unaligned */
  184. MXGEFW_CMD_ALWAYS_USE_N_BIG_BUFFERS,
  185. /* data0 = number of big buffers to use. It must be 0 or a power of 2.
  186. * 0 indicates that the NIC consumes as many buffers as they are required
  187. * for packet. This is the default behavior.
  188. * A power of 2 number indicates that the NIC always uses the specified
  189. * number of buffers for each big receive packet.
  190. * It is up to the driver to ensure that this value is big enough for
  191. * the NIC to be able to receive maximum-sized packets.
  192. */
  193. MXGEFW_CMD_GET_MAX_RSS_QUEUES,
  194. MXGEFW_CMD_ENABLE_RSS_QUEUES,
  195. /* data0 = number of slices n (0, 1, ..., n-1) to enable
  196. * data1 = interrupt mode | use of multiple transmit queues.
  197. * 0=share one INTx/MSI.
  198. * 1=use one MSI-X per queue.
  199. * If all queues share one interrupt, the driver must have set
  200. * RSS_SHARED_INTERRUPT_DMA before enabling queues.
  201. * 2=enable both receive and send queues.
  202. * Without this bit set, only one send queue (slice 0's send queue)
  203. * is enabled. The receive queues are always enabled.
  204. */
  205. #define MXGEFW_SLICE_INTR_MODE_SHARED 0x0
  206. #define MXGEFW_SLICE_INTR_MODE_ONE_PER_SLICE 0x1
  207. #define MXGEFW_SLICE_ENABLE_MULTIPLE_TX_QUEUES 0x2
  208. MXGEFW_CMD_GET_RSS_SHARED_INTERRUPT_MASK_OFFSET,
  209. MXGEFW_CMD_SET_RSS_SHARED_INTERRUPT_DMA,
  210. /* data0, data1 = bus address lsw, msw */
  211. MXGEFW_CMD_GET_RSS_TABLE_OFFSET,
  212. /* get the offset of the indirection table */
  213. MXGEFW_CMD_SET_RSS_TABLE_SIZE,
  214. /* set the size of the indirection table */
  215. MXGEFW_CMD_GET_RSS_KEY_OFFSET,
  216. /* get the offset of the secret key */
  217. MXGEFW_CMD_RSS_KEY_UPDATED,
  218. /* tell nic that the secret key's been updated */
  219. MXGEFW_CMD_SET_RSS_ENABLE,
  220. /* data0 = enable/disable rss
  221. * 0: disable rss. nic does not distribute receive packets.
  222. * 1: enable rss. nic distributes receive packets among queues.
  223. * data1 = hash type
  224. * 1: IPV4 (required by RSS)
  225. * 2: TCP_IPV4 (required by RSS)
  226. * 3: IPV4 | TCP_IPV4 (required by RSS)
  227. * 4: source port
  228. * 5: source port + destination port
  229. */
  230. #define MXGEFW_RSS_HASH_TYPE_IPV4 0x1
  231. #define MXGEFW_RSS_HASH_TYPE_TCP_IPV4 0x2
  232. #define MXGEFW_RSS_HASH_TYPE_SRC_PORT 0x4
  233. #define MXGEFW_RSS_HASH_TYPE_SRC_DST_PORT 0x5
  234. #define MXGEFW_RSS_HASH_TYPE_MAX 0x5
  235. MXGEFW_CMD_GET_MAX_TSO6_HDR_SIZE,
  236. /* Return data = the max. size of the entire headers of a IPv6 TSO packet.
  237. * If the header size of a IPv6 TSO packet is larger than the specified
  238. * value, then the driver must not use TSO.
  239. * This size restriction only applies to IPv6 TSO.
  240. * For IPv4 TSO, the maximum size of the headers is fixed, and the NIC
  241. * always has enough header buffer to store maximum-sized headers.
  242. */
  243. MXGEFW_CMD_SET_TSO_MODE,
  244. /* data0 = TSO mode.
  245. * 0: Linux/FreeBSD style (NIC default)
  246. * 1: NDIS/NetBSD style
  247. */
  248. #define MXGEFW_TSO_MODE_LINUX 0
  249. #define MXGEFW_TSO_MODE_NDIS 1
  250. MXGEFW_CMD_MDIO_READ,
  251. /* data0 = dev_addr (PMA/PMD or PCS ...), data1 = register/addr */
  252. MXGEFW_CMD_MDIO_WRITE,
  253. /* data0 = dev_addr, data1 = register/addr, data2 = value */
  254. MXGEFW_CMD_XFP_I2C_READ,
  255. /* Starts to get a fresh copy of one byte or of the whole xfp i2c table, the
  256. * obtained data is cached inside the xaui-xfi chip :
  257. * data0 : "all" flag : 0 => get one byte, 1=> get 256 bytes,
  258. * data1 : if (data0 == 0): index of byte to refresh [ not used otherwise ]
  259. * The operation might take ~1ms for a single byte or ~65ms when refreshing all 256 bytes
  260. * During the i2c operation, MXGEFW_CMD_XFP_I2C_READ or MXGEFW_CMD_XFP_BYTE attempts
  261. * will return MXGEFW_CMD_ERROR_BUSY
  262. */
  263. MXGEFW_CMD_XFP_BYTE,
  264. /* Return the last obtained copy of a given byte in the xfp i2c table
  265. * (copy cached during the last relevant MXGEFW_CMD_XFP_I2C_READ)
  266. * data0 : index of the desired table entry
  267. * Return data = the byte stored at the requested index in the table
  268. */
  269. MXGEFW_CMD_GET_VPUMP_OFFSET,
  270. /* Return data = NIC memory offset of mcp_vpump_public_global */
  271. MXGEFW_CMD_RESET_VPUMP,
  272. /* Resets the VPUMP state */
  273. MXGEFW_CMD_SET_RSS_MCP_SLOT_TYPE,
  274. /* data0 = mcp_slot type to use.
  275. * 0 = the default 4B mcp_slot
  276. * 1 = 8B mcp_slot_8
  277. */
  278. #define MXGEFW_RSS_MCP_SLOT_TYPE_MIN 0
  279. #define MXGEFW_RSS_MCP_SLOT_TYPE_WITH_HASH 1
  280. MXGEFW_CMD_SET_THROTTLE_FACTOR,
  281. /* set the throttle factor for ethp_z8e
  282. * data0 = throttle_factor
  283. * throttle_factor = 256 * pcie-raw-speed / tx_speed
  284. * tx_speed = 256 * pcie-raw-speed / throttle_factor
  285. *
  286. * For PCI-E x8: pcie-raw-speed == 16Gb/s
  287. * For PCI-E x4: pcie-raw-speed == 8Gb/s
  288. *
  289. * ex1: throttle_factor == 0x1a0 (416), tx_speed == 1.23GB/s == 9.846 Gb/s
  290. * ex2: throttle_factor == 0x200 (512), tx_speed == 1.0GB/s == 8 Gb/s
  291. *
  292. * with tx_boundary == 2048, max-throttle-factor == 8191 => min-speed == 500Mb/s
  293. * with tx_boundary == 4096, max-throttle-factor == 4095 => min-speed == 1Gb/s
  294. */
  295. MXGEFW_CMD_VPUMP_UP,
  296. /* Allocates VPump Connection, Send Request and Zero copy buffer address tables */
  297. MXGEFW_CMD_GET_VPUMP_CLK,
  298. /* Get the lanai clock */
  299. MXGEFW_CMD_GET_DCA_OFFSET,
  300. /* offset of dca control for WDMAs */
  301. /* VMWare NetQueue commands */
  302. MXGEFW_CMD_NETQ_GET_FILTERS_PER_QUEUE,
  303. MXGEFW_CMD_NETQ_ADD_FILTER,
  304. /* data0 = filter_id << 16 | queue << 8 | type */
  305. /* data1 = MS4 of MAC Addr */
  306. /* data2 = LS2_MAC << 16 | VLAN_tag */
  307. MXGEFW_CMD_NETQ_DEL_FILTER,
  308. /* data0 = filter_id */
  309. MXGEFW_CMD_NETQ_QUERY1,
  310. MXGEFW_CMD_NETQ_QUERY2,
  311. MXGEFW_CMD_NETQ_QUERY3,
  312. MXGEFW_CMD_NETQ_QUERY4,
  313. };
  314. enum myri10ge_mcp_cmd_status {
  315. MXGEFW_CMD_OK = 0,
  316. MXGEFW_CMD_UNKNOWN,
  317. MXGEFW_CMD_ERROR_RANGE,
  318. MXGEFW_CMD_ERROR_BUSY,
  319. MXGEFW_CMD_ERROR_EMPTY,
  320. MXGEFW_CMD_ERROR_CLOSED,
  321. MXGEFW_CMD_ERROR_HASH_ERROR,
  322. MXGEFW_CMD_ERROR_BAD_PORT,
  323. MXGEFW_CMD_ERROR_RESOURCES,
  324. MXGEFW_CMD_ERROR_MULTICAST,
  325. MXGEFW_CMD_ERROR_UNALIGNED,
  326. MXGEFW_CMD_ERROR_NO_MDIO,
  327. MXGEFW_CMD_ERROR_XFP_FAILURE,
  328. MXGEFW_CMD_ERROR_XFP_ABSENT,
  329. MXGEFW_CMD_ERROR_BAD_PCIE_LINK
  330. };
  331. #define MXGEFW_OLD_IRQ_DATA_LEN 40
  332. struct mcp_irq_data {
  333. /* add new counters at the beginning */
  334. __be32 future_use[1];
  335. __be32 dropped_pause;
  336. __be32 dropped_unicast_filtered;
  337. __be32 dropped_bad_crc32;
  338. __be32 dropped_bad_phy;
  339. __be32 dropped_multicast_filtered;
  340. /* 40 Bytes */
  341. __be32 send_done_count;
  342. #define MXGEFW_LINK_DOWN 0
  343. #define MXGEFW_LINK_UP 1
  344. #define MXGEFW_LINK_MYRINET 2
  345. #define MXGEFW_LINK_UNKNOWN 3
  346. __be32 link_up;
  347. __be32 dropped_link_overflow;
  348. __be32 dropped_link_error_or_filtered;
  349. __be32 dropped_runt;
  350. __be32 dropped_overrun;
  351. __be32 dropped_no_small_buffer;
  352. __be32 dropped_no_big_buffer;
  353. __be32 rdma_tags_available;
  354. u8 tx_stopped;
  355. u8 link_down;
  356. u8 stats_updated;
  357. u8 valid;
  358. };
  359. /* definitions for NETQ filter type */
  360. #define MXGEFW_NETQ_FILTERTYPE_NONE 0
  361. #define MXGEFW_NETQ_FILTERTYPE_MACADDR 1
  362. #define MXGEFW_NETQ_FILTERTYPE_VLAN 2
  363. #define MXGEFW_NETQ_FILTERTYPE_VLANMACADDR 3
  364. #endif /* __MYRI10GE_MCP_H__ */