myri10ge_mcp.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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. u32 high;
  8. u32 low;
  9. };
  10. /* 4 Bytes */
  11. struct mcp_slot {
  12. u16 checksum;
  13. u16 length;
  14. };
  15. /* 64 Bytes */
  16. struct mcp_cmd {
  17. u32 cmd;
  18. u32 data0; /* will be low portion if data > 32 bits */
  19. /* 8 */
  20. u32 data1; /* will be high portion if data > 32 bits */
  21. u32 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. u32 data;
  30. u32 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. u32 addr_high;
  66. u32 addr_low;
  67. u16 pseudo_hdr_offset;
  68. u16 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. u32 addr_high;
  77. u32 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. };
  167. enum myri10ge_mcp_cmd_status {
  168. MXGEFW_CMD_OK = 0,
  169. MXGEFW_CMD_UNKNOWN,
  170. MXGEFW_CMD_ERROR_RANGE,
  171. MXGEFW_CMD_ERROR_BUSY,
  172. MXGEFW_CMD_ERROR_EMPTY,
  173. MXGEFW_CMD_ERROR_CLOSED,
  174. MXGEFW_CMD_ERROR_HASH_ERROR,
  175. MXGEFW_CMD_ERROR_BAD_PORT,
  176. MXGEFW_CMD_ERROR_RESOURCES,
  177. MXGEFW_CMD_ERROR_MULTICAST
  178. };
  179. #define MXGEFW_OLD_IRQ_DATA_LEN 40
  180. struct mcp_irq_data {
  181. /* add new counters at the beginning */
  182. u32 future_use[5];
  183. u32 dropped_multicast_filtered;
  184. /* 40 Bytes */
  185. u32 send_done_count;
  186. u32 link_up;
  187. u32 dropped_link_overflow;
  188. u32 dropped_link_error_or_filtered;
  189. u32 dropped_runt;
  190. u32 dropped_overrun;
  191. u32 dropped_no_small_buffer;
  192. u32 dropped_no_big_buffer;
  193. u32 rdma_tags_available;
  194. u8 tx_stopped;
  195. u8 link_down;
  196. u8 stats_updated;
  197. u8 valid;
  198. };
  199. #endif /* __MYRI10GE_MCP_H__ */