myri10ge_mcp.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  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 = 1,
  98. /* get the version number of the current firmware..
  99. * (may be available in the eeprom strings..? */
  100. MXGEFW_GET_MCP_VERSION = 2,
  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 = 3,
  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 = 4, /* in bytes, power of 2 */
  110. MXGEFW_CMD_SET_SMALL_BUFFER_SIZE = 5, /* 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 = 6,
  114. MXGEFW_CMD_GET_SMALL_RX_OFFSET = 7,
  115. MXGEFW_CMD_GET_BIG_RX_OFFSET = 8,
  116. /* data0 = slice number if multiple slices are used */
  117. MXGEFW_CMD_GET_IRQ_ACK_OFFSET = 9,
  118. MXGEFW_CMD_GET_IRQ_DEASSERT_OFFSET = 10,
  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 = 11, /* in bytes */
  122. MXGEFW_CMD_GET_RX_RING_SIZE = 12, /* 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 = 13, /* 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 = 14,
  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 = 15,
  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 = 16,
  144. MXGEFW_CMD_GET_INTR_COAL_DELAY_OFFSET = 17, /* in microseconds */
  145. MXGEFW_CMD_SET_STATS_INTERVAL = 18, /* in microseconds */
  146. MXGEFW_CMD_SET_STATS_DMA_OBSOLETE = 19, /* replaced by SET_STATS_DMA_V2 */
  147. MXGEFW_ENABLE_PROMISC = 20,
  148. MXGEFW_DISABLE_PROMISC = 21,
  149. MXGEFW_SET_MAC_ADDRESS = 22,
  150. MXGEFW_ENABLE_FLOW_CONTROL = 23,
  151. MXGEFW_DISABLE_FLOW_CONTROL = 24,
  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 = 25,
  158. MXGEFW_ENABLE_ALLMULTI = 26,
  159. MXGEFW_DISABLE_ALLMULTI = 27,
  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 = 28,
  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 = 29,
  169. MXGEFW_LEAVE_ALL_MULTICAST_GROUPS = 30,
  170. MXGEFW_CMD_SET_STATS_DMA_V2 = 31,
  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 = 32,
  180. /* same than DMA_TEST (same args) but abort with UNALIGNED on unaligned
  181. * chipset */
  182. MXGEFW_CMD_UNALIGNED_STATUS = 33,
  183. /* return data = boolean, true if the chipset is known to be unaligned */
  184. MXGEFW_CMD_ALWAYS_USE_N_BIG_BUFFERS = 34,
  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 = 35,
  194. MXGEFW_CMD_ENABLE_RSS_QUEUES = 36,
  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 = 37,
  209. MXGEFW_CMD_SET_RSS_SHARED_INTERRUPT_DMA = 38,
  210. /* data0, data1 = bus address lsw, msw */
  211. MXGEFW_CMD_GET_RSS_TABLE_OFFSET = 39,
  212. /* get the offset of the indirection table */
  213. MXGEFW_CMD_SET_RSS_TABLE_SIZE = 40,
  214. /* set the size of the indirection table */
  215. MXGEFW_CMD_GET_RSS_KEY_OFFSET = 41,
  216. /* get the offset of the secret key */
  217. MXGEFW_CMD_RSS_KEY_UPDATED = 42,
  218. /* tell nic that the secret key's been updated */
  219. MXGEFW_CMD_SET_RSS_ENABLE = 43,
  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 = 44,
  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 = 45,
  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 = 46,
  251. /* data0 = dev_addr (PMA/PMD or PCS ...), data1 = register/addr */
  252. MXGEFW_CMD_MDIO_WRITE = 47,
  253. /* data0 = dev_addr, data1 = register/addr, data2 = value */
  254. MXGEFW_CMD_I2C_READ = 48,
  255. /* Starts to get a fresh copy of one byte or of the module i2c table, the
  256. * obtained data is cached inside the xaui-xfi chip :
  257. * data0 : 0 => get one byte, 1=> get 256 bytes
  258. * data1 : If data0 == 0: location to refresh
  259. * bit 7:0 register location
  260. * bit 8:15 is the i2c slave addr (0 is interpreted as 0xA1)
  261. * bit 23:16 is the i2c bus number (for multi-port NICs)
  262. * If data0 == 1: unused
  263. * The operation might take ~1ms for a single byte or ~65ms when refreshing all 256 bytes
  264. * During the i2c operation, MXGEFW_CMD_I2C_READ or MXGEFW_CMD_I2C_BYTE attempts
  265. * will return MXGEFW_CMD_ERROR_BUSY
  266. */
  267. MXGEFW_CMD_I2C_BYTE = 49,
  268. /* Return the last obtained copy of a given byte in the xfp i2c table
  269. * (copy cached during the last relevant MXGEFW_CMD_I2C_READ)
  270. * data0 : index of the desired table entry
  271. * Return data = the byte stored at the requested index in the table
  272. */
  273. MXGEFW_CMD_GET_VPUMP_OFFSET = 50,
  274. /* Return data = NIC memory offset of mcp_vpump_public_global */
  275. MXGEFW_CMD_RESET_VPUMP = 51,
  276. /* Resets the VPUMP state */
  277. MXGEFW_CMD_SET_RSS_MCP_SLOT_TYPE = 52,
  278. /* data0 = mcp_slot type to use.
  279. * 0 = the default 4B mcp_slot
  280. * 1 = 8B mcp_slot_8
  281. */
  282. #define MXGEFW_RSS_MCP_SLOT_TYPE_MIN 0
  283. #define MXGEFW_RSS_MCP_SLOT_TYPE_WITH_HASH 1
  284. MXGEFW_CMD_SET_THROTTLE_FACTOR = 53,
  285. /* set the throttle factor for ethp_z8e
  286. * data0 = throttle_factor
  287. * throttle_factor = 256 * pcie-raw-speed / tx_speed
  288. * tx_speed = 256 * pcie-raw-speed / throttle_factor
  289. *
  290. * For PCI-E x8: pcie-raw-speed == 16Gb/s
  291. * For PCI-E x4: pcie-raw-speed == 8Gb/s
  292. *
  293. * ex1: throttle_factor == 0x1a0 (416), tx_speed == 1.23GB/s == 9.846 Gb/s
  294. * ex2: throttle_factor == 0x200 (512), tx_speed == 1.0GB/s == 8 Gb/s
  295. *
  296. * with tx_boundary == 2048, max-throttle-factor == 8191 => min-speed == 500Mb/s
  297. * with tx_boundary == 4096, max-throttle-factor == 4095 => min-speed == 1Gb/s
  298. */
  299. MXGEFW_CMD_VPUMP_UP = 54,
  300. /* Allocates VPump Connection, Send Request and Zero copy buffer address tables */
  301. MXGEFW_CMD_GET_VPUMP_CLK = 55,
  302. /* Get the lanai clock */
  303. MXGEFW_CMD_GET_DCA_OFFSET = 56,
  304. /* offset of dca control for WDMAs */
  305. /* VMware NetQueue commands */
  306. MXGEFW_CMD_NETQ_GET_FILTERS_PER_QUEUE = 57,
  307. MXGEFW_CMD_NETQ_ADD_FILTER = 58,
  308. /* data0 = filter_id << 16 | queue << 8 | type */
  309. /* data1 = MS4 of MAC Addr */
  310. /* data2 = LS2_MAC << 16 | VLAN_tag */
  311. MXGEFW_CMD_NETQ_DEL_FILTER = 59,
  312. /* data0 = filter_id */
  313. MXGEFW_CMD_NETQ_QUERY1 = 60,
  314. MXGEFW_CMD_NETQ_QUERY2 = 61,
  315. MXGEFW_CMD_NETQ_QUERY3 = 62,
  316. MXGEFW_CMD_NETQ_QUERY4 = 63,
  317. MXGEFW_CMD_RELAX_RXBUFFER_ALIGNMENT = 64,
  318. /* When set, small receive buffers can cross page boundaries.
  319. * Both small and big receive buffers may start at any address.
  320. * This option has performance implications, so use with caution.
  321. */
  322. };
  323. enum myri10ge_mcp_cmd_status {
  324. MXGEFW_CMD_OK = 0,
  325. MXGEFW_CMD_UNKNOWN = 1,
  326. MXGEFW_CMD_ERROR_RANGE = 2,
  327. MXGEFW_CMD_ERROR_BUSY = 3,
  328. MXGEFW_CMD_ERROR_EMPTY = 4,
  329. MXGEFW_CMD_ERROR_CLOSED = 5,
  330. MXGEFW_CMD_ERROR_HASH_ERROR = 6,
  331. MXGEFW_CMD_ERROR_BAD_PORT = 7,
  332. MXGEFW_CMD_ERROR_RESOURCES = 8,
  333. MXGEFW_CMD_ERROR_MULTICAST = 9,
  334. MXGEFW_CMD_ERROR_UNALIGNED = 10,
  335. MXGEFW_CMD_ERROR_NO_MDIO = 11,
  336. MXGEFW_CMD_ERROR_I2C_FAILURE = 12,
  337. MXGEFW_CMD_ERROR_I2C_ABSENT = 13,
  338. MXGEFW_CMD_ERROR_BAD_PCIE_LINK = 14
  339. };
  340. #define MXGEFW_OLD_IRQ_DATA_LEN 40
  341. struct mcp_irq_data {
  342. /* add new counters at the beginning */
  343. __be32 future_use[1];
  344. __be32 dropped_pause;
  345. __be32 dropped_unicast_filtered;
  346. __be32 dropped_bad_crc32;
  347. __be32 dropped_bad_phy;
  348. __be32 dropped_multicast_filtered;
  349. /* 40 Bytes */
  350. __be32 send_done_count;
  351. #define MXGEFW_LINK_DOWN 0
  352. #define MXGEFW_LINK_UP 1
  353. #define MXGEFW_LINK_MYRINET 2
  354. #define MXGEFW_LINK_UNKNOWN 3
  355. __be32 link_up;
  356. __be32 dropped_link_overflow;
  357. __be32 dropped_link_error_or_filtered;
  358. __be32 dropped_runt;
  359. __be32 dropped_overrun;
  360. __be32 dropped_no_small_buffer;
  361. __be32 dropped_no_big_buffer;
  362. __be32 rdma_tags_available;
  363. u8 tx_stopped;
  364. u8 link_down;
  365. u8 stats_updated;
  366. u8 valid;
  367. };
  368. /* definitions for NETQ filter type */
  369. #define MXGEFW_NETQ_FILTERTYPE_NONE 0
  370. #define MXGEFW_NETQ_FILTERTYPE_MACADDR 1
  371. #define MXGEFW_NETQ_FILTERTYPE_VLAN 2
  372. #define MXGEFW_NETQ_FILTERTYPE_VLANMACADDR 3
  373. #endif /* __MYRI10GE_MCP_H__ */