myri10ge_mcp.h 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  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. 8 Bytes for NDIS drivers. */
  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(n) (0x200000 + (((n) & 0x03) * 0x40000))
  90. #define MXGEFW_ETH_SEND_OFFSET(n) (MXGEFW_ETH_SEND(n) - MXGEFW_ETH_SEND_4)
  91. enum myri10ge_mcp_cmd_type {
  92. MXGEFW_CMD_NONE = 0,
  93. /* Reset the mcp, it is left in a safe state, waiting
  94. * for the driver to set all its parameters */
  95. MXGEFW_CMD_RESET,
  96. /* get the version number of the current firmware..
  97. * (may be available in the eeprom strings..? */
  98. MXGEFW_GET_MCP_VERSION,
  99. /* Parameters which must be set by the driver before it can
  100. * issue MXGEFW_CMD_ETHERNET_UP. They persist until the next
  101. * MXGEFW_CMD_RESET is issued */
  102. MXGEFW_CMD_SET_INTRQ_DMA,
  103. MXGEFW_CMD_SET_BIG_BUFFER_SIZE, /* in bytes, power of 2 */
  104. MXGEFW_CMD_SET_SMALL_BUFFER_SIZE, /* in bytes */
  105. /* Parameters which refer to lanai SRAM addresses where the
  106. * driver must issue PIO writes for various things */
  107. MXGEFW_CMD_GET_SEND_OFFSET,
  108. MXGEFW_CMD_GET_SMALL_RX_OFFSET,
  109. MXGEFW_CMD_GET_BIG_RX_OFFSET,
  110. MXGEFW_CMD_GET_IRQ_ACK_OFFSET,
  111. MXGEFW_CMD_GET_IRQ_DEASSERT_OFFSET,
  112. /* Parameters which refer to rings stored on the MCP,
  113. * and whose size is controlled by the mcp */
  114. MXGEFW_CMD_GET_SEND_RING_SIZE, /* in bytes */
  115. MXGEFW_CMD_GET_RX_RING_SIZE, /* in bytes */
  116. /* Parameters which refer to rings stored in the host,
  117. * and whose size is controlled by the host. Note that
  118. * all must be physically contiguous and must contain
  119. * a power of 2 number of entries. */
  120. MXGEFW_CMD_SET_INTRQ_SIZE, /* in bytes */
  121. /* command to bring ethernet interface up. Above parameters
  122. * (plus mtu & mac address) must have been exchanged prior
  123. * to issuing this command */
  124. MXGEFW_CMD_ETHERNET_UP,
  125. /* command to bring ethernet interface down. No further sends
  126. * or receives may be processed until an MXGEFW_CMD_ETHERNET_UP
  127. * is issued, and all interrupt queues must be flushed prior
  128. * to ack'ing this command */
  129. MXGEFW_CMD_ETHERNET_DOWN,
  130. /* commands the driver may issue live, without resetting
  131. * the nic. Note that increasing the mtu "live" should
  132. * only be done if the driver has already supplied buffers
  133. * sufficiently large to handle the new mtu. Decreasing
  134. * the mtu live is safe */
  135. MXGEFW_CMD_SET_MTU,
  136. MXGEFW_CMD_GET_INTR_COAL_DELAY_OFFSET, /* in microseconds */
  137. MXGEFW_CMD_SET_STATS_INTERVAL, /* in microseconds */
  138. MXGEFW_CMD_SET_STATS_DMA_OBSOLETE, /* replaced by SET_STATS_DMA_V2 */
  139. MXGEFW_ENABLE_PROMISC,
  140. MXGEFW_DISABLE_PROMISC,
  141. MXGEFW_SET_MAC_ADDRESS,
  142. MXGEFW_ENABLE_FLOW_CONTROL,
  143. MXGEFW_DISABLE_FLOW_CONTROL,
  144. /* do a DMA test
  145. * data0,data1 = DMA address
  146. * data2 = RDMA length (MSH), WDMA length (LSH)
  147. * command return data = repetitions (MSH), 0.5-ms ticks (LSH)
  148. */
  149. MXGEFW_DMA_TEST,
  150. MXGEFW_ENABLE_ALLMULTI,
  151. MXGEFW_DISABLE_ALLMULTI,
  152. /* returns MXGEFW_CMD_ERROR_MULTICAST
  153. * if there is no room in the cache
  154. * data0,MSH(data1) = multicast group address */
  155. MXGEFW_JOIN_MULTICAST_GROUP,
  156. /* returns MXGEFW_CMD_ERROR_MULTICAST
  157. * if the address is not in the cache,
  158. * or is equal to FF-FF-FF-FF-FF-FF
  159. * data0,MSH(data1) = multicast group address */
  160. MXGEFW_LEAVE_MULTICAST_GROUP,
  161. MXGEFW_LEAVE_ALL_MULTICAST_GROUPS,
  162. MXGEFW_CMD_SET_STATS_DMA_V2,
  163. /* data0, data1 = bus addr,
  164. * data2 = sizeof(struct mcp_irq_data) from driver point of view, allows
  165. * adding new stuff to mcp_irq_data without changing the ABI */
  166. MXGEFW_CMD_UNALIGNED_TEST,
  167. /* same than DMA_TEST (same args) but abort with UNALIGNED on unaligned
  168. * chipset */
  169. MXGEFW_CMD_UNALIGNED_STATUS,
  170. /* return data = boolean, true if the chipset is known to be unaligned */
  171. MXGEFW_CMD_ALWAYS_USE_N_BIG_BUFFERS,
  172. /* data0 = number of big buffers to use. It must be 0 or a power of 2.
  173. * 0 indicates that the NIC consumes as many buffers as they are required
  174. * for packet. This is the default behavior.
  175. * A power of 2 number indicates that the NIC always uses the specified
  176. * number of buffers for each big receive packet.
  177. * It is up to the driver to ensure that this value is big enough for
  178. * the NIC to be able to receive maximum-sized packets.
  179. */
  180. MXGEFW_CMD_GET_MAX_RSS_QUEUES,
  181. MXGEFW_CMD_ENABLE_RSS_QUEUES,
  182. /* data0 = number of slices n (0, 1, ..., n-1) to enable
  183. * data1 = interrupt mode. 0=share one INTx/MSI, 1=use one MSI-X per queue.
  184. * If all queues share one interrupt, the driver must have set
  185. * RSS_SHARED_INTERRUPT_DMA before enabling queues.
  186. */
  187. MXGEFW_CMD_GET_RSS_SHARED_INTERRUPT_MASK_OFFSET,
  188. MXGEFW_CMD_SET_RSS_SHARED_INTERRUPT_DMA,
  189. /* data0, data1 = bus address lsw, msw */
  190. MXGEFW_CMD_GET_RSS_TABLE_OFFSET,
  191. /* get the offset of the indirection table */
  192. MXGEFW_CMD_SET_RSS_TABLE_SIZE,
  193. /* set the size of the indirection table */
  194. MXGEFW_CMD_GET_RSS_KEY_OFFSET,
  195. /* get the offset of the secret key */
  196. MXGEFW_CMD_RSS_KEY_UPDATED,
  197. /* tell nic that the secret key's been updated */
  198. MXGEFW_CMD_SET_RSS_ENABLE,
  199. /* data0 = enable/disable rss
  200. * 0: disable rss. nic does not distribute receive packets.
  201. * 1: enable rss. nic distributes receive packets among queues.
  202. * data1 = hash type
  203. * 1: IPV4
  204. * 2: TCP_IPV4
  205. * 3: IPV4 | TCP_IPV4
  206. */
  207. MXGEFW_CMD_GET_MAX_TSO6_HDR_SIZE,
  208. /* Return data = the max. size of the entire headers of a IPv6 TSO packet.
  209. * If the header size of a IPv6 TSO packet is larger than the specified
  210. * value, then the driver must not use TSO.
  211. * This size restriction only applies to IPv6 TSO.
  212. * For IPv4 TSO, the maximum size of the headers is fixed, and the NIC
  213. * always has enough header buffer to store maximum-sized headers.
  214. */
  215. MXGEFW_CMD_SET_TSO_MODE,
  216. /* data0 = TSO mode.
  217. * 0: Linux/FreeBSD style (NIC default)
  218. * 1: NDIS/NetBSD style
  219. */
  220. MXGEFW_CMD_MDIO_READ,
  221. /* data0 = dev_addr (PMA/PMD or PCS ...), data1 = register/addr */
  222. MXGEFW_CMD_MDIO_WRITE,
  223. /* data0 = dev_addr, data1 = register/addr, data2 = value */
  224. MXGEFW_CMD_XFP_I2C_READ,
  225. /* Starts to get a fresh copy of one byte or of the whole xfp i2c table, the
  226. * obtained data is cached inside the xaui-xfi chip :
  227. * data0 : "all" flag : 0 => get one byte, 1=> get 256 bytes,
  228. * data1 : if (data0 == 0): index of byte to refresh [ not used otherwise ]
  229. * The operation might take ~1ms for a single byte or ~65ms when refreshing all 256 bytes
  230. * During the i2c operation, MXGEFW_CMD_XFP_I2C_READ or MXGEFW_CMD_XFP_BYTE attempts
  231. * will return MXGEFW_CMD_ERROR_BUSY
  232. */
  233. MXGEFW_CMD_XFP_BYTE,
  234. /* Return the last obtained copy of a given byte in the xfp i2c table
  235. * (copy cached during the last relevant MXGEFW_CMD_XFP_I2C_READ)
  236. * data0 : index of the desired table entry
  237. * Return data = the byte stored at the requested index in the table
  238. */
  239. MXGEFW_CMD_GET_VPUMP_OFFSET,
  240. /* Return data = NIC memory offset of mcp_vpump_public_global */
  241. MXGEFW_CMD_RESET_VPUMP,
  242. /* Resets the VPUMP state */
  243. };
  244. enum myri10ge_mcp_cmd_status {
  245. MXGEFW_CMD_OK = 0,
  246. MXGEFW_CMD_UNKNOWN,
  247. MXGEFW_CMD_ERROR_RANGE,
  248. MXGEFW_CMD_ERROR_BUSY,
  249. MXGEFW_CMD_ERROR_EMPTY,
  250. MXGEFW_CMD_ERROR_CLOSED,
  251. MXGEFW_CMD_ERROR_HASH_ERROR,
  252. MXGEFW_CMD_ERROR_BAD_PORT,
  253. MXGEFW_CMD_ERROR_RESOURCES,
  254. MXGEFW_CMD_ERROR_MULTICAST,
  255. MXGEFW_CMD_ERROR_UNALIGNED,
  256. MXGEFW_CMD_ERROR_NO_MDIO,
  257. MXGEFW_CMD_ERROR_XFP_FAILURE,
  258. MXGEFW_CMD_ERROR_XFP_ABSENT
  259. };
  260. #define MXGEFW_OLD_IRQ_DATA_LEN 40
  261. struct mcp_irq_data {
  262. /* add new counters at the beginning */
  263. __be32 future_use[1];
  264. __be32 dropped_pause;
  265. __be32 dropped_unicast_filtered;
  266. __be32 dropped_bad_crc32;
  267. __be32 dropped_bad_phy;
  268. __be32 dropped_multicast_filtered;
  269. /* 40 Bytes */
  270. __be32 send_done_count;
  271. #define MXGEFW_LINK_DOWN 0
  272. #define MXGEFW_LINK_UP 1
  273. #define MXGEFW_LINK_MYRINET 2
  274. #define MXGEFW_LINK_UNKNOWN 3
  275. __be32 link_up;
  276. __be32 dropped_link_overflow;
  277. __be32 dropped_link_error_or_filtered;
  278. __be32 dropped_runt;
  279. __be32 dropped_overrun;
  280. __be32 dropped_no_small_buffer;
  281. __be32 dropped_no_big_buffer;
  282. __be32 rdma_tags_available;
  283. u8 tx_stopped;
  284. u8 link_down;
  285. u8 stats_updated;
  286. u8 valid;
  287. };
  288. #endif /* __MYRI10GE_MCP_H__ */