You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vxge_traffic.h 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. /*
  2. * vxge-traffic.h: iPXE driver for Neterion Inc's X3100 Series 10GbE
  3. * PCIe I/O Virtualized Server Adapter.
  4. *
  5. * Copyright(c) 2002-2010 Neterion Inc.
  6. *
  7. * This software may be used and distributed according to the terms of
  8. * the GNU General Public License (GPL), incorporated herein by
  9. * reference. Drivers based on or derived from this code fall under
  10. * the GPL and must retain the authorship, copyright and license
  11. * notice.
  12. *
  13. */
  14. FILE_LICENCE(GPL2_ONLY);
  15. #ifndef VXGE_TRAFFIC_H
  16. #define VXGE_TRAFFIC_H
  17. #include <stdint.h>
  18. #include <ipxe/if_ether.h>
  19. #include <ipxe/iobuf.h>
  20. #include "vxge_reg.h"
  21. #include "vxge_version.h"
  22. #define VXGE_HW_DTR_MAX_T_CODE 16
  23. #define VXGE_HW_ALL_FOXES 0xFFFFFFFFFFFFFFFFULL
  24. #define VXGE_HW_INTR_MASK_ALL 0xFFFFFFFFFFFFFFFFULL
  25. #define VXGE_HW_MAX_VIRTUAL_PATHS 17
  26. #define VXGE_HW_MAX_VIRTUAL_FUNCTIONS 8
  27. #define VXGE_HW_MAC_MAX_MAC_PORT_ID 3
  28. #define VXGE_HW_DEFAULT_32 0xffffffff
  29. /* frames sizes */
  30. #define VXGE_HW_HEADER_802_2_SIZE 3
  31. #define VXGE_HW_HEADER_SNAP_SIZE 5
  32. #define VXGE_HW_HEADER_VLAN_SIZE 4
  33. #define VXGE_HW_MAC_HEADER_MAX_SIZE \
  34. (ETH_HLEN + \
  35. VXGE_HW_HEADER_802_2_SIZE + \
  36. VXGE_HW_HEADER_VLAN_SIZE + \
  37. VXGE_HW_HEADER_SNAP_SIZE)
  38. /* 32bit alignments */
  39. /* A receive data corruption can occur resulting in either a single-bit or
  40. double-bit ECC error being flagged in the ASIC if the starting offset of a
  41. buffer in single buffer mode is 0x2 to 0xa. The single bit ECC error will not
  42. lock up the card but can hide the data corruption while the double-bit ECC
  43. error will lock up the card. Limiting the starting offset of the buffers to
  44. 0x0, 0x1 or to a value greater than 0xF will workaround this issue.
  45. VXGE_HW_HEADER_ETHERNET_II_802_3_ALIGN of 2 causes the starting offset of
  46. buffer to be 0x2, 0x12 and so on, to have the start of the ip header dword
  47. aligned. The start of buffer of 0x2 will cause this problem to occur. To
  48. avoid this problem in all cases, add 0x10 to 0x2, to ensure that the start of
  49. buffer is outside of the problem causing offsets.
  50. */
  51. #define VXGE_HW_HEADER_ETHERNET_II_802_3_ALIGN 0x12
  52. #define VXGE_HW_HEADER_802_2_SNAP_ALIGN 2
  53. #define VXGE_HW_HEADER_802_2_ALIGN 3
  54. #define VXGE_HW_HEADER_SNAP_ALIGN 1
  55. #define VXGE_HW_L3_CKSUM_OK 0xFFFF
  56. #define VXGE_HW_L4_CKSUM_OK 0xFFFF
  57. /* Forward declarations */
  58. struct __vxge_hw_device;
  59. struct __vxge_hw_virtualpath;
  60. struct __vxge_hw_fifo;
  61. struct __vxge_hw_ring;
  62. struct vxge_hw_ring_rxd_1;
  63. struct vxge_hw_fifo_txd;
  64. #ifndef TRUE
  65. #define TRUE 1
  66. #endif
  67. #ifndef FALSE
  68. #define FALSE 0
  69. #endif
  70. /*VXGE_HW_STATUS_H*/
  71. #define VXGE_HW_EVENT_BASE 0
  72. #define VXGE_LL_EVENT_BASE 100
  73. /**
  74. * enum vxge_hw_event- Enumerates slow-path HW events.
  75. * @VXGE_HW_EVENT_UNKNOWN: Unknown (and invalid) event.
  76. * @VXGE_HW_EVENT_SERR: Serious vpath hardware error event.
  77. * @VXGE_HW_EVENT_ECCERR: vpath ECC error event.
  78. * @VXGE_HW_EVENT_VPATH_ERR: Error local to the respective vpath
  79. * @VXGE_HW_EVENT_FIFO_ERR: FIFO Doorbell fifo error.
  80. * @VXGE_HW_EVENT_SRPCIM_SERR: srpcim hardware error event.
  81. * @VXGE_HW_EVENT_MRPCIM_SERR: mrpcim hardware error event.
  82. * @VXGE_HW_EVENT_MRPCIM_ECCERR: mrpcim ecc error event.
  83. * @VXGE_HW_EVENT_RESET_START: Privileged entity is starting device reset
  84. * @VXGE_HW_EVENT_RESET_COMPLETE: Device reset has been completed
  85. * @VXGE_HW_EVENT_SLOT_FREEZE: Slot-freeze event. Driver tries to distinguish
  86. * slot-freeze from the rest critical events (e.g. ECC) when it is
  87. * impossible to PIO read "through" the bus, i.e. when getting all-foxes.
  88. *
  89. * enum vxge_hw_event enumerates slow-path HW eventis.
  90. *
  91. * See also: struct vxge_hw_uld_cbs{}, vxge_uld_link_up_f{},
  92. * vxge_uld_link_down_f{}.
  93. */
  94. enum vxge_hw_event {
  95. VXGE_HW_EVENT_UNKNOWN = 0,
  96. /* HW events */
  97. VXGE_HW_EVENT_RESET_START = VXGE_HW_EVENT_BASE + 1,
  98. VXGE_HW_EVENT_RESET_COMPLETE = VXGE_HW_EVENT_BASE + 2,
  99. VXGE_HW_EVENT_LINK_DOWN = VXGE_HW_EVENT_BASE + 3,
  100. VXGE_HW_EVENT_LINK_UP = VXGE_HW_EVENT_BASE + 4,
  101. VXGE_HW_EVENT_ALARM_CLEARED = VXGE_HW_EVENT_BASE + 5,
  102. VXGE_HW_EVENT_ECCERR = VXGE_HW_EVENT_BASE + 6,
  103. VXGE_HW_EVENT_MRPCIM_ECCERR = VXGE_HW_EVENT_BASE + 7,
  104. VXGE_HW_EVENT_FIFO_ERR = VXGE_HW_EVENT_BASE + 8,
  105. VXGE_HW_EVENT_VPATH_ERR = VXGE_HW_EVENT_BASE + 9,
  106. VXGE_HW_EVENT_CRITICAL_ERR = VXGE_HW_EVENT_BASE + 10,
  107. VXGE_HW_EVENT_SERR = VXGE_HW_EVENT_BASE + 11,
  108. VXGE_HW_EVENT_SRPCIM_SERR = VXGE_HW_EVENT_BASE + 12,
  109. VXGE_HW_EVENT_MRPCIM_SERR = VXGE_HW_EVENT_BASE + 13,
  110. VXGE_HW_EVENT_SLOT_FREEZE = VXGE_HW_EVENT_BASE + 14,
  111. };
  112. #define VXGE_HW_MAX_INTR_PER_VP 4
  113. #define VXGE_HW_VPATH_INTR_TX 0
  114. #define VXGE_HW_VPATH_INTR_RX 1
  115. #define VXGE_HW_VPATH_INTR_EINTA 2
  116. #define VXGE_HW_VPATH_INTR_BMAP 3
  117. #define VXGE_HW_BLOCK_SIZE 4096
  118. #define VXGE_HW_TIM_UTIL_SEL_LEGACY_TX_NET_UTIL 17
  119. #define VXGE_HW_TIM_UTIL_SEL_LEGACY_RX_NET_UTIL 18
  120. #define VXGE_HW_TIM_UTIL_SEL_LEGACY_TX_RX_AVE_NET_UTIL 19
  121. #define VXGE_HW_TIM_UTIL_SEL_PER_VPATH 63
  122. /**
  123. * enum vxge_hw_ring_tcode - Transfer codes returned by adapter
  124. * @VXGE_HW_RING_T_CODE_OK: Transfer ok.
  125. * @VXGE_HW_RING_T_CODE_L3_CKSUM_MISMATCH: Layer 3 checksum presentation
  126. * configuration mismatch.
  127. * @VXGE_HW_RING_T_CODE_L4_CKSUM_MISMATCH: Layer 4 checksum presentation
  128. * configuration mismatch.
  129. * @VXGE_HW_RING_T_CODE_L3_L4_CKSUM_MISMATCH: Layer 3 and Layer 4 checksum
  130. * presentation configuration mismatch.
  131. * @VXGE_HW_RING_T_CODE_L3_PKT_ERR: Layer 3 error unparseable packet,
  132. * such as unknown IPv6 header.
  133. * @VXGE_HW_RING_T_CODE_L2_FRM_ERR: Layer 2 error frame integrity
  134. * error, such as FCS or ECC).
  135. * @VXGE_HW_RING_T_CODE_BUF_SIZE_ERR: Buffer size error the RxD buffer(
  136. * s) were not appropriately sized and data loss occurred.
  137. * @VXGE_HW_RING_T_CODE_INT_ECC_ERR: Internal ECC error RxD corrupted.
  138. * @VXGE_HW_RING_T_CODE_BENIGN_OVFLOW: Benign overflow the contents of
  139. * Segment1 exceeded the capacity of Buffer1 and the remainder
  140. * was placed in Buffer2. Segment2 now starts in Buffer3.
  141. * No data loss or errors occurred.
  142. * @VXGE_HW_RING_T_CODE_ZERO_LEN_BUFF: Buffer size 0 one of the RxDs
  143. * assigned buffers has a size of 0 bytes.
  144. * @VXGE_HW_RING_T_CODE_FRM_DROP: Frame dropped either due to
  145. * VPath Reset or because of a VPIN mismatch.
  146. * @VXGE_HW_RING_T_CODE_UNUSED: Unused
  147. * @VXGE_HW_RING_T_CODE_MULTI_ERR: Multiple errors more than one
  148. * transfer code condition occurred.
  149. *
  150. * Transfer codes returned by adapter.
  151. */
  152. enum vxge_hw_ring_tcode {
  153. VXGE_HW_RING_T_CODE_OK = 0x0,
  154. VXGE_HW_RING_T_CODE_L3_CKSUM_MISMATCH = 0x1,
  155. VXGE_HW_RING_T_CODE_L4_CKSUM_MISMATCH = 0x2,
  156. VXGE_HW_RING_T_CODE_L3_L4_CKSUM_MISMATCH = 0x3,
  157. VXGE_HW_RING_T_CODE_L3_PKT_ERR = 0x5,
  158. VXGE_HW_RING_T_CODE_L2_FRM_ERR = 0x6,
  159. VXGE_HW_RING_T_CODE_BUF_SIZE_ERR = 0x7,
  160. VXGE_HW_RING_T_CODE_INT_ECC_ERR = 0x8,
  161. VXGE_HW_RING_T_CODE_BENIGN_OVFLOW = 0x9,
  162. VXGE_HW_RING_T_CODE_ZERO_LEN_BUFF = 0xA,
  163. VXGE_HW_RING_T_CODE_FRM_DROP = 0xC,
  164. VXGE_HW_RING_T_CODE_UNUSED = 0xE,
  165. VXGE_HW_RING_T_CODE_MULTI_ERR = 0xF
  166. };
  167. /**
  168. * enum enum vxge_hw_fifo_gather_code - Gather codes used in fifo TxD
  169. * @VXGE_HW_FIFO_GATHER_CODE_FIRST: First TxDL
  170. * @VXGE_HW_FIFO_GATHER_CODE_MIDDLE: Middle TxDL
  171. * @VXGE_HW_FIFO_GATHER_CODE_LAST: Last TxDL
  172. * @VXGE_HW_FIFO_GATHER_CODE_FIRST_LAST: First and Last TxDL.
  173. *
  174. * These gather codes are used to indicate the position of a TxD in a TxD list
  175. */
  176. enum vxge_hw_fifo_gather_code {
  177. VXGE_HW_FIFO_GATHER_CODE_FIRST = 0x2,
  178. VXGE_HW_FIFO_GATHER_CODE_MIDDLE = 0x0,
  179. VXGE_HW_FIFO_GATHER_CODE_LAST = 0x1,
  180. VXGE_HW_FIFO_GATHER_CODE_FIRST_LAST = 0x3
  181. };
  182. /**
  183. * enum enum vxge_hw_fifo_tcode - tcodes used in fifo
  184. * @VXGE_HW_FIFO_T_CODE_OK: Transfer OK
  185. * @VXGE_HW_FIFO_T_CODE_PCI_READ_CORRUPT: PCI read transaction (either TxD or
  186. * frame data) returned with corrupt data.
  187. * @VXGE_HW_FIFO_T_CODE_PCI_READ_FAIL:PCI read transaction was returned
  188. * with no data.
  189. * @VXGE_HW_FIFO_T_CODE_INVALID_MSS: The host attempted to send either a
  190. * frame or LSO MSS that was too long (>9800B).
  191. * @VXGE_HW_FIFO_T_CODE_LSO_ERROR: Error detected during TCP/UDP Large Send
  192. * Offload operation, due to improper header template,
  193. * unsupported protocol, etc.
  194. * @VXGE_HW_FIFO_T_CODE_UNUSED: Unused
  195. * @VXGE_HW_FIFO_T_CODE_MULTI_ERROR: Set to 1 by the adapter if multiple
  196. * data buffer transfer errors are encountered (see below).
  197. * Otherwise it is set to 0.
  198. *
  199. * These tcodes are returned in various API for TxD status
  200. */
  201. enum vxge_hw_fifo_tcode {
  202. VXGE_HW_FIFO_T_CODE_OK = 0x0,
  203. VXGE_HW_FIFO_T_CODE_PCI_READ_CORRUPT = 0x1,
  204. VXGE_HW_FIFO_T_CODE_PCI_READ_FAIL = 0x2,
  205. VXGE_HW_FIFO_T_CODE_INVALID_MSS = 0x3,
  206. VXGE_HW_FIFO_T_CODE_LSO_ERROR = 0x4,
  207. VXGE_HW_FIFO_T_CODE_UNUSED = 0x7,
  208. VXGE_HW_FIFO_T_CODE_MULTI_ERROR = 0x8
  209. };
  210. enum vxge_hw_status
  211. vxge_hw_ring_replenish(struct __vxge_hw_ring *ring);
  212. void vxge_hw_ring_rxd_post(struct __vxge_hw_ring *ring_handle,
  213. struct vxge_hw_ring_rxd_1 *rxdp);
  214. void vxge_hw_fifo_txdl_buffer_set(struct __vxge_hw_fifo *fifo,
  215. struct vxge_hw_fifo_txd *txdp,
  216. struct io_buffer *iob);
  217. void vxge_hw_fifo_txdl_post(struct __vxge_hw_fifo *fifo,
  218. struct vxge_hw_fifo_txd *txdp);
  219. enum vxge_hw_status __vxge_hw_ring_create(
  220. struct __vxge_hw_virtualpath *vpath,
  221. struct __vxge_hw_ring *ring);
  222. enum vxge_hw_status __vxge_hw_ring_delete(
  223. struct __vxge_hw_ring *ringh);
  224. enum vxge_hw_status __vxge_hw_fifo_create(
  225. struct __vxge_hw_virtualpath *vpath,
  226. struct __vxge_hw_fifo *fifo);
  227. enum vxge_hw_status
  228. __vxge_hw_fifo_delete(struct __vxge_hw_fifo *fifo);
  229. enum vxge_hw_status __vxge_hw_vpath_reset(
  230. struct __vxge_hw_device *devh, u32 vp_id);
  231. enum vxge_hw_status
  232. __vxge_hw_vpath_enable(struct __vxge_hw_device *devh, u32 vp_id);
  233. void
  234. __vxge_hw_vpath_prc_configure(struct __vxge_hw_device *hldev);
  235. enum vxge_hw_status
  236. __vxge_hw_vpath_kdfc_configure(struct __vxge_hw_device *devh, u32 vp_id);
  237. enum vxge_hw_status
  238. __vxge_hw_vpath_mac_configure(struct __vxge_hw_device *devh);
  239. enum vxge_hw_status
  240. __vxge_hw_vpath_tim_configure(struct __vxge_hw_device *devh, u32 vp_id);
  241. enum vxge_hw_status
  242. __vxge_hw_vpath_initialize(struct __vxge_hw_device *devh, u32 vp_id);
  243. enum vxge_hw_status __vxge_hw_vp_initialize(
  244. struct __vxge_hw_device *hldev, u32 vp_id,
  245. struct __vxge_hw_virtualpath *vpath);
  246. void __vxge_hw_vp_terminate(struct __vxge_hw_device *hldev,
  247. struct __vxge_hw_virtualpath *vpath);
  248. enum vxge_hw_status
  249. vxge_hw_device_begin_irq(struct __vxge_hw_device *hldev);
  250. void vxge_hw_device_intr_enable(struct __vxge_hw_device *hldev);
  251. void vxge_hw_device_intr_disable(struct __vxge_hw_device *hldev);
  252. void vxge_hw_device_mask_all(struct __vxge_hw_device *hldev);
  253. void vxge_hw_device_unmask_all(struct __vxge_hw_device *hldev);
  254. void vxge_hw_vpath_doorbell_rx(struct __vxge_hw_ring *ringh);
  255. enum vxge_hw_status vxge_hw_vpath_poll_rx(struct __vxge_hw_ring *ringh);
  256. enum vxge_hw_status vxge_hw_vpath_poll_tx(struct __vxge_hw_fifo *fifo);
  257. struct vxge_hw_fifo_txd *
  258. vxge_hw_fifo_free_txdl_get(struct __vxge_hw_fifo *fifo);
  259. #endif