myri10ge_mcp.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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_CMD_OFFSET 0xf80000
  81. enum myri10ge_mcp_cmd_type {
  82. MXGEFW_CMD_NONE = 0,
  83. /* Reset the mcp, it is left in a safe state, waiting
  84. * for the driver to set all its parameters */
  85. MXGEFW_CMD_RESET,
  86. /* get the version number of the current firmware..
  87. * (may be available in the eeprom strings..? */
  88. MXGEFW_GET_MCP_VERSION,
  89. /* Parameters which must be set by the driver before it can
  90. * issue MXGEFW_CMD_ETHERNET_UP. They persist until the next
  91. * MXGEFW_CMD_RESET is issued */
  92. MXGEFW_CMD_SET_INTRQ_DMA,
  93. MXGEFW_CMD_SET_BIG_BUFFER_SIZE, /* in bytes, power of 2 */
  94. MXGEFW_CMD_SET_SMALL_BUFFER_SIZE, /* in bytes */
  95. /* Parameters which refer to lanai SRAM addresses where the
  96. * driver must issue PIO writes for various things */
  97. MXGEFW_CMD_GET_SEND_OFFSET,
  98. MXGEFW_CMD_GET_SMALL_RX_OFFSET,
  99. MXGEFW_CMD_GET_BIG_RX_OFFSET,
  100. MXGEFW_CMD_GET_IRQ_ACK_OFFSET,
  101. MXGEFW_CMD_GET_IRQ_DEASSERT_OFFSET,
  102. /* Parameters which refer to rings stored on the MCP,
  103. * and whose size is controlled by the mcp */
  104. MXGEFW_CMD_GET_SEND_RING_SIZE, /* in bytes */
  105. MXGEFW_CMD_GET_RX_RING_SIZE, /* in bytes */
  106. /* Parameters which refer to rings stored in the host,
  107. * and whose size is controlled by the host. Note that
  108. * all must be physically contiguous and must contain
  109. * a power of 2 number of entries. */
  110. MXGEFW_CMD_SET_INTRQ_SIZE, /* in bytes */
  111. /* command to bring ethernet interface up. Above parameters
  112. * (plus mtu & mac address) must have been exchanged prior
  113. * to issuing this command */
  114. MXGEFW_CMD_ETHERNET_UP,
  115. /* command to bring ethernet interface down. No further sends
  116. * or receives may be processed until an MXGEFW_CMD_ETHERNET_UP
  117. * is issued, and all interrupt queues must be flushed prior
  118. * to ack'ing this command */
  119. MXGEFW_CMD_ETHERNET_DOWN,
  120. /* commands the driver may issue live, without resetting
  121. * the nic. Note that increasing the mtu "live" should
  122. * only be done if the driver has already supplied buffers
  123. * sufficiently large to handle the new mtu. Decreasing
  124. * the mtu live is safe */
  125. MXGEFW_CMD_SET_MTU,
  126. MXGEFW_CMD_GET_INTR_COAL_DELAY_OFFSET, /* in microseconds */
  127. MXGEFW_CMD_SET_STATS_INTERVAL, /* in microseconds */
  128. MXGEFW_CMD_SET_STATS_DMA,
  129. MXGEFW_ENABLE_PROMISC,
  130. MXGEFW_DISABLE_PROMISC,
  131. MXGEFW_SET_MAC_ADDRESS,
  132. MXGEFW_ENABLE_FLOW_CONTROL,
  133. MXGEFW_DISABLE_FLOW_CONTROL,
  134. /* do a DMA test
  135. * data0,data1 = DMA address
  136. * data2 = RDMA length (MSH), WDMA length (LSH)
  137. * command return data = repetitions (MSH), 0.5-ms ticks (LSH)
  138. */
  139. MXGEFW_DMA_TEST
  140. };
  141. enum myri10ge_mcp_cmd_status {
  142. MXGEFW_CMD_OK = 0,
  143. MXGEFW_CMD_UNKNOWN,
  144. MXGEFW_CMD_ERROR_RANGE,
  145. MXGEFW_CMD_ERROR_BUSY,
  146. MXGEFW_CMD_ERROR_EMPTY,
  147. MXGEFW_CMD_ERROR_CLOSED,
  148. MXGEFW_CMD_ERROR_HASH_ERROR,
  149. MXGEFW_CMD_ERROR_BAD_PORT,
  150. MXGEFW_CMD_ERROR_RESOURCES
  151. };
  152. /* 40 Bytes */
  153. struct mcp_irq_data {
  154. u32 send_done_count;
  155. u32 link_up;
  156. u32 dropped_link_overflow;
  157. u32 dropped_link_error_or_filtered;
  158. u32 dropped_runt;
  159. u32 dropped_overrun;
  160. u32 dropped_no_small_buffer;
  161. u32 dropped_no_big_buffer;
  162. u32 rdma_tags_available;
  163. u8 tx_stopped;
  164. u8 link_down;
  165. u8 stats_updated;
  166. u8 valid;
  167. };
  168. #endif /* __MYRI10GE_MCP_H__ */