defines.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. /*******************************************************************************
  2. Intel 82599 Virtual Function driver
  3. Copyright(c) 1999 - 2015 Intel Corporation.
  4. This program is free software; you can redistribute it and/or modify it
  5. under the terms and conditions of the GNU General Public License,
  6. version 2, as published by the Free Software Foundation.
  7. This program is distributed in the hope it will be useful, but WITHOUT
  8. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  9. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  10. more details.
  11. You should have received a copy of the GNU General Public License along with
  12. this program; if not, see <http://www.gnu.org/licenses/>.
  13. The full GNU General Public License is included in this distribution in
  14. the file called "COPYING".
  15. Contact Information:
  16. e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
  17. Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  18. *******************************************************************************/
  19. #ifndef _IXGBEVF_DEFINES_H_
  20. #define _IXGBEVF_DEFINES_H_
  21. /* Device IDs */
  22. #define IXGBE_DEV_ID_82599_VF 0x10ED
  23. #define IXGBE_DEV_ID_X540_VF 0x1515
  24. #define IXGBE_DEV_ID_X550_VF 0x1565
  25. #define IXGBE_DEV_ID_X550EM_X_VF 0x15A8
  26. #define IXGBE_DEV_ID_X550EM_A_VF 0x15C5
  27. #define IXGBE_DEV_ID_82599_VF_HV 0x152E
  28. #define IXGBE_DEV_ID_X540_VF_HV 0x1530
  29. #define IXGBE_DEV_ID_X550_VF_HV 0x1564
  30. #define IXGBE_DEV_ID_X550EM_X_VF_HV 0x15A9
  31. #define IXGBE_VF_IRQ_CLEAR_MASK 7
  32. #define IXGBE_VF_MAX_TX_QUEUES 8
  33. #define IXGBE_VF_MAX_RX_QUEUES 8
  34. /* DCB define */
  35. #define IXGBE_VF_MAX_TRAFFIC_CLASS 8
  36. /* Link speed */
  37. typedef u32 ixgbe_link_speed;
  38. #define IXGBE_LINK_SPEED_1GB_FULL 0x0020
  39. #define IXGBE_LINK_SPEED_10GB_FULL 0x0080
  40. #define IXGBE_LINK_SPEED_100_FULL 0x0008
  41. #define IXGBE_CTRL_RST 0x04000000 /* Reset (SW) */
  42. #define IXGBE_RXDCTL_ENABLE 0x02000000 /* Enable specific Rx Queue */
  43. #define IXGBE_TXDCTL_ENABLE 0x02000000 /* Enable specific Tx Queue */
  44. #define IXGBE_LINKS_UP 0x40000000
  45. #define IXGBE_LINKS_SPEED_82599 0x30000000
  46. #define IXGBE_LINKS_SPEED_10G_82599 0x30000000
  47. #define IXGBE_LINKS_SPEED_1G_82599 0x20000000
  48. #define IXGBE_LINKS_SPEED_100_82599 0x10000000
  49. /* Number of Transmit and Receive Descriptors must be a multiple of 8 */
  50. #define IXGBE_REQ_TX_DESCRIPTOR_MULTIPLE 8
  51. #define IXGBE_REQ_RX_DESCRIPTOR_MULTIPLE 8
  52. #define IXGBE_REQ_TX_BUFFER_GRANULARITY 1024
  53. /* Interrupt Vector Allocation Registers */
  54. #define IXGBE_IVAR_ALLOC_VAL 0x80 /* Interrupt Allocation valid */
  55. #define IXGBE_VF_INIT_TIMEOUT 200 /* Number of retries to clear RSTI */
  56. /* Receive Config masks */
  57. #define IXGBE_RXCTRL_RXEN 0x00000001 /* Enable Receiver */
  58. #define IXGBE_RXCTRL_DMBYPS 0x00000002 /* Descriptor Monitor Bypass */
  59. #define IXGBE_RXDCTL_ENABLE 0x02000000 /* Enable specific Rx Queue */
  60. #define IXGBE_RXDCTL_VME 0x40000000 /* VLAN mode enable */
  61. #define IXGBE_RXDCTL_RLPMLMASK 0x00003FFF /* Only supported on the X540 */
  62. #define IXGBE_RXDCTL_RLPML_EN 0x00008000
  63. /* DCA Control */
  64. #define IXGBE_DCA_TXCTRL_TX_WB_RO_EN BIT(11) /* Tx Desc writeback RO bit */
  65. /* PSRTYPE bit definitions */
  66. #define IXGBE_PSRTYPE_TCPHDR 0x00000010
  67. #define IXGBE_PSRTYPE_UDPHDR 0x00000020
  68. #define IXGBE_PSRTYPE_IPV4HDR 0x00000100
  69. #define IXGBE_PSRTYPE_IPV6HDR 0x00000200
  70. #define IXGBE_PSRTYPE_L2HDR 0x00001000
  71. /* SRRCTL bit definitions */
  72. #define IXGBE_SRRCTL_BSIZEPKT_SHIFT 10 /* so many KBs */
  73. #define IXGBE_SRRCTL_RDMTS_SHIFT 22
  74. #define IXGBE_SRRCTL_RDMTS_MASK 0x01C00000
  75. #define IXGBE_SRRCTL_DROP_EN 0x10000000
  76. #define IXGBE_SRRCTL_BSIZEPKT_MASK 0x0000007F
  77. #define IXGBE_SRRCTL_BSIZEHDR_MASK 0x00003F00
  78. #define IXGBE_SRRCTL_DESCTYPE_LEGACY 0x00000000
  79. #define IXGBE_SRRCTL_DESCTYPE_ADV_ONEBUF 0x02000000
  80. #define IXGBE_SRRCTL_DESCTYPE_HDR_SPLIT 0x04000000
  81. #define IXGBE_SRRCTL_DESCTYPE_HDR_REPLICATION_LARGE_PKT 0x08000000
  82. #define IXGBE_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS 0x0A000000
  83. #define IXGBE_SRRCTL_DESCTYPE_MASK 0x0E000000
  84. /* Receive Descriptor bit definitions */
  85. #define IXGBE_RXD_STAT_DD 0x01 /* Descriptor Done */
  86. #define IXGBE_RXD_STAT_EOP 0x02 /* End of Packet */
  87. #define IXGBE_RXD_STAT_FLM 0x04 /* FDir Match */
  88. #define IXGBE_RXD_STAT_VP 0x08 /* IEEE VLAN Packet */
  89. #define IXGBE_RXDADV_NEXTP_MASK 0x000FFFF0 /* Next Descriptor Index */
  90. #define IXGBE_RXDADV_NEXTP_SHIFT 0x00000004
  91. #define IXGBE_RXD_STAT_UDPCS 0x10 /* UDP xsum calculated */
  92. #define IXGBE_RXD_STAT_L4CS 0x20 /* L4 xsum calculated */
  93. #define IXGBE_RXD_STAT_IPCS 0x40 /* IP xsum calculated */
  94. #define IXGBE_RXD_STAT_PIF 0x80 /* passed in-exact filter */
  95. #define IXGBE_RXD_STAT_CRCV 0x100 /* Speculative CRC Valid */
  96. #define IXGBE_RXD_STAT_VEXT 0x200 /* 1st VLAN found */
  97. #define IXGBE_RXD_STAT_UDPV 0x400 /* Valid UDP checksum */
  98. #define IXGBE_RXD_STAT_DYNINT 0x800 /* Pkt caused INT via DYNINT */
  99. #define IXGBE_RXD_STAT_TS 0x10000 /* Time Stamp */
  100. #define IXGBE_RXD_STAT_SECP 0x20000 /* Security Processing */
  101. #define IXGBE_RXD_STAT_LB 0x40000 /* Loopback Status */
  102. #define IXGBE_RXD_STAT_ACK 0x8000 /* ACK Packet indication */
  103. #define IXGBE_RXD_ERR_CE 0x01 /* CRC Error */
  104. #define IXGBE_RXD_ERR_LE 0x02 /* Length Error */
  105. #define IXGBE_RXD_ERR_PE 0x08 /* Packet Error */
  106. #define IXGBE_RXD_ERR_OSE 0x10 /* Oversize Error */
  107. #define IXGBE_RXD_ERR_USE 0x20 /* Undersize Error */
  108. #define IXGBE_RXD_ERR_TCPE 0x40 /* TCP/UDP Checksum Error */
  109. #define IXGBE_RXD_ERR_IPE 0x80 /* IP Checksum Error */
  110. #define IXGBE_RXDADV_ERR_MASK 0xFFF00000 /* RDESC.ERRORS mask */
  111. #define IXGBE_RXDADV_ERR_SHIFT 20 /* RDESC.ERRORS shift */
  112. #define IXGBE_RXDADV_ERR_HBO 0x00800000 /*Header Buffer Overflow */
  113. #define IXGBE_RXDADV_ERR_CE 0x01000000 /* CRC Error */
  114. #define IXGBE_RXDADV_ERR_LE 0x02000000 /* Length Error */
  115. #define IXGBE_RXDADV_ERR_PE 0x08000000 /* Packet Error */
  116. #define IXGBE_RXDADV_ERR_OSE 0x10000000 /* Oversize Error */
  117. #define IXGBE_RXDADV_ERR_USE 0x20000000 /* Undersize Error */
  118. #define IXGBE_RXDADV_ERR_TCPE 0x40000000 /* TCP/UDP Checksum Error */
  119. #define IXGBE_RXDADV_ERR_IPE 0x80000000 /* IP Checksum Error */
  120. #define IXGBE_RXD_VLAN_ID_MASK 0x0FFF /* VLAN ID is in lower 12 bits */
  121. #define IXGBE_RXD_PRI_MASK 0xE000 /* Priority is in upper 3 bits */
  122. #define IXGBE_RXD_PRI_SHIFT 13
  123. #define IXGBE_RXD_CFI_MASK 0x1000 /* CFI is bit 12 */
  124. #define IXGBE_RXD_CFI_SHIFT 12
  125. #define IXGBE_RXDADV_STAT_DD IXGBE_RXD_STAT_DD /* Done */
  126. #define IXGBE_RXDADV_STAT_EOP IXGBE_RXD_STAT_EOP /* End of Packet */
  127. #define IXGBE_RXDADV_STAT_FLM IXGBE_RXD_STAT_FLM /* FDir Match */
  128. #define IXGBE_RXDADV_STAT_VP IXGBE_RXD_STAT_VP /* IEEE VLAN Pkt */
  129. #define IXGBE_RXDADV_STAT_MASK 0x000FFFFF /* Stat/NEXTP: bit 0-19 */
  130. #define IXGBE_RXDADV_STAT_FCEOFS 0x00000040 /* FCoE EOF/SOF Stat */
  131. #define IXGBE_RXDADV_STAT_FCSTAT 0x00000030 /* FCoE Pkt Stat */
  132. #define IXGBE_RXDADV_STAT_FCSTAT_NOMTCH 0x00000000 /* 00: No Ctxt Match */
  133. #define IXGBE_RXDADV_STAT_FCSTAT_NODDP 0x00000010 /* 01: Ctxt w/o DDP */
  134. #define IXGBE_RXDADV_STAT_FCSTAT_FCPRSP 0x00000020 /* 10: Recv. FCP_RSP */
  135. #define IXGBE_RXDADV_STAT_FCSTAT_DDP 0x00000030 /* 11: Ctxt w/ DDP */
  136. #define IXGBE_RXDADV_RSSTYPE_MASK 0x0000000F
  137. #define IXGBE_RXDADV_PKTTYPE_MASK 0x0000FFF0
  138. #define IXGBE_RXDADV_PKTTYPE_MASK_EX 0x0001FFF0
  139. #define IXGBE_RXDADV_HDRBUFLEN_MASK 0x00007FE0
  140. #define IXGBE_RXDADV_RSCCNT_MASK 0x001E0000
  141. #define IXGBE_RXDADV_RSCCNT_SHIFT 17
  142. #define IXGBE_RXDADV_HDRBUFLEN_SHIFT 5
  143. #define IXGBE_RXDADV_SPLITHEADER_EN 0x00001000
  144. #define IXGBE_RXDADV_SPH 0x8000
  145. /* RSS Hash results */
  146. #define IXGBE_RXDADV_RSSTYPE_NONE 0x00000000
  147. #define IXGBE_RXDADV_RSSTYPE_IPV4_TCP 0x00000001
  148. #define IXGBE_RXDADV_RSSTYPE_IPV4 0x00000002
  149. #define IXGBE_RXDADV_RSSTYPE_IPV6_TCP 0x00000003
  150. #define IXGBE_RXDADV_RSSTYPE_IPV6_EX 0x00000004
  151. #define IXGBE_RXDADV_RSSTYPE_IPV6 0x00000005
  152. #define IXGBE_RXDADV_RSSTYPE_IPV6_TCP_EX 0x00000006
  153. #define IXGBE_RXDADV_RSSTYPE_IPV4_UDP 0x00000007
  154. #define IXGBE_RXDADV_RSSTYPE_IPV6_UDP 0x00000008
  155. #define IXGBE_RXDADV_RSSTYPE_IPV6_UDP_EX 0x00000009
  156. #define IXGBE_RXD_ERR_FRAME_ERR_MASK ( \
  157. IXGBE_RXD_ERR_CE | \
  158. IXGBE_RXD_ERR_LE | \
  159. IXGBE_RXD_ERR_PE | \
  160. IXGBE_RXD_ERR_OSE | \
  161. IXGBE_RXD_ERR_USE)
  162. #define IXGBE_RXDADV_ERR_FRAME_ERR_MASK ( \
  163. IXGBE_RXDADV_ERR_CE | \
  164. IXGBE_RXDADV_ERR_LE | \
  165. IXGBE_RXDADV_ERR_PE | \
  166. IXGBE_RXDADV_ERR_OSE | \
  167. IXGBE_RXDADV_ERR_USE)
  168. #define IXGBE_TXD_POPTS_IXSM 0x01 /* Insert IP checksum */
  169. #define IXGBE_TXD_POPTS_TXSM 0x02 /* Insert TCP/UDP checksum */
  170. #define IXGBE_TXD_CMD_EOP 0x01000000 /* End of Packet */
  171. #define IXGBE_TXD_CMD_IFCS 0x02000000 /* Insert FCS (Ethernet CRC) */
  172. #define IXGBE_TXD_CMD_IC 0x04000000 /* Insert Checksum */
  173. #define IXGBE_TXD_CMD_RS 0x08000000 /* Report Status */
  174. #define IXGBE_TXD_CMD_DEXT 0x20000000 /* Descriptor ext (0 = legacy) */
  175. #define IXGBE_TXD_CMD_VLE 0x40000000 /* Add VLAN tag */
  176. #define IXGBE_TXD_STAT_DD 0x00000001 /* Descriptor Done */
  177. #define IXGBE_TXD_CMD (IXGBE_TXD_CMD_EOP | IXGBE_TXD_CMD_RS)
  178. /* Transmit Descriptor - Advanced */
  179. union ixgbe_adv_tx_desc {
  180. struct {
  181. __le64 buffer_addr; /* Address of descriptor's data buf */
  182. __le32 cmd_type_len;
  183. __le32 olinfo_status;
  184. } read;
  185. struct {
  186. __le64 rsvd; /* Reserved */
  187. __le32 nxtseq_seed;
  188. __le32 status;
  189. } wb;
  190. };
  191. /* Receive Descriptor - Advanced */
  192. union ixgbe_adv_rx_desc {
  193. struct {
  194. __le64 pkt_addr; /* Packet buffer address */
  195. __le64 hdr_addr; /* Header buffer address */
  196. } read;
  197. struct {
  198. struct {
  199. union {
  200. __le32 data;
  201. struct {
  202. __le16 pkt_info; /* RSS, Pkt type */
  203. __le16 hdr_info; /* Splithdr, hdrlen */
  204. } hs_rss;
  205. } lo_dword;
  206. union {
  207. __le32 rss; /* RSS Hash */
  208. struct {
  209. __le16 ip_id; /* IP id */
  210. __le16 csum; /* Packet Checksum */
  211. } csum_ip;
  212. } hi_dword;
  213. } lower;
  214. struct {
  215. __le32 status_error; /* ext status/error */
  216. __le16 length; /* Packet length */
  217. __le16 vlan; /* VLAN tag */
  218. } upper;
  219. } wb; /* writeback */
  220. };
  221. /* Context descriptors */
  222. struct ixgbe_adv_tx_context_desc {
  223. __le32 vlan_macip_lens;
  224. __le32 seqnum_seed;
  225. __le32 type_tucmd_mlhl;
  226. __le32 mss_l4len_idx;
  227. };
  228. /* Adv Transmit Descriptor Config Masks */
  229. #define IXGBE_ADVTXD_DTYP_MASK 0x00F00000 /* DTYP mask */
  230. #define IXGBE_ADVTXD_DTYP_CTXT 0x00200000 /* Advanced Context Desc */
  231. #define IXGBE_ADVTXD_DTYP_DATA 0x00300000 /* Advanced Data Descriptor */
  232. #define IXGBE_ADVTXD_DCMD_EOP IXGBE_TXD_CMD_EOP /* End of Packet */
  233. #define IXGBE_ADVTXD_DCMD_IFCS IXGBE_TXD_CMD_IFCS /* Insert FCS */
  234. #define IXGBE_ADVTXD_DCMD_RS IXGBE_TXD_CMD_RS /* Report Status */
  235. #define IXGBE_ADVTXD_DCMD_DEXT IXGBE_TXD_CMD_DEXT /* Desc ext (1=Adv) */
  236. #define IXGBE_ADVTXD_DCMD_VLE IXGBE_TXD_CMD_VLE /* VLAN pkt enable */
  237. #define IXGBE_ADVTXD_DCMD_TSE 0x80000000 /* TCP Seg enable */
  238. #define IXGBE_ADVTXD_STAT_DD IXGBE_TXD_STAT_DD /* Descriptor Done */
  239. #define IXGBE_ADVTXD_TUCMD_IPV4 0x00000400 /* IP Packet Type: 1=IPv4 */
  240. #define IXGBE_ADVTXD_TUCMD_IPV6 0x00000000 /* IP Packet Type: 0=IPv6 */
  241. #define IXGBE_ADVTXD_TUCMD_L4T_UDP 0x00000000 /* L4 Packet TYPE of UDP */
  242. #define IXGBE_ADVTXD_TUCMD_L4T_TCP 0x00000800 /* L4 Packet TYPE of TCP */
  243. #define IXGBE_ADVTXD_TUCMD_L4T_SCTP 0x00001000 /* L4 Packet TYPE of SCTP */
  244. #define IXGBE_ADVTXD_IDX_SHIFT 4 /* Adv desc Index shift */
  245. #define IXGBE_ADVTXD_CC 0x00000080 /* Check Context */
  246. #define IXGBE_ADVTXD_POPTS_SHIFT 8 /* Adv desc POPTS shift */
  247. #define IXGBE_ADVTXD_POPTS_IXSM (IXGBE_TXD_POPTS_IXSM << \
  248. IXGBE_ADVTXD_POPTS_SHIFT)
  249. #define IXGBE_ADVTXD_POPTS_TXSM (IXGBE_TXD_POPTS_TXSM << \
  250. IXGBE_ADVTXD_POPTS_SHIFT)
  251. #define IXGBE_ADVTXD_PAYLEN_SHIFT 14 /* Adv desc PAYLEN shift */
  252. #define IXGBE_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */
  253. #define IXGBE_ADVTXD_VLAN_SHIFT 16 /* Adv ctxt vlan tag shift */
  254. #define IXGBE_ADVTXD_L4LEN_SHIFT 8 /* Adv ctxt L4LEN shift */
  255. #define IXGBE_ADVTXD_MSS_SHIFT 16 /* Adv ctxt MSS shift */
  256. /* Interrupt register bitmasks */
  257. #define IXGBE_EITR_CNT_WDIS 0x80000000
  258. #define IXGBE_MAX_EITR 0x00000FF8
  259. #define IXGBE_MIN_EITR 8
  260. /* Error Codes */
  261. #define IXGBE_ERR_INVALID_MAC_ADDR -1
  262. #define IXGBE_ERR_RESET_FAILED -2
  263. #define IXGBE_ERR_INVALID_ARGUMENT -3
  264. /* Transmit Config masks */
  265. #define IXGBE_TXDCTL_ENABLE 0x02000000 /* Ena specific Tx Queue */
  266. #define IXGBE_TXDCTL_SWFLSH 0x04000000 /* Tx Desc. wr-bk flushing */
  267. #define IXGBE_TXDCTL_WTHRESH_SHIFT 16 /* shift to WTHRESH bits */
  268. #define IXGBE_DCA_RXCTRL_DESC_DCA_EN BIT(5) /* Rx Desc enable */
  269. #define IXGBE_DCA_RXCTRL_HEAD_DCA_EN BIT(6) /* Rx Desc header ena */
  270. #define IXGBE_DCA_RXCTRL_DATA_DCA_EN BIT(7) /* Rx Desc payload ena */
  271. #define IXGBE_DCA_RXCTRL_DESC_RRO_EN BIT(9) /* Rx rd Desc Relax Order */
  272. #define IXGBE_DCA_RXCTRL_DATA_WRO_EN BIT(13) /* Rx wr data Relax Order */
  273. #define IXGBE_DCA_RXCTRL_HEAD_WRO_EN BIT(15) /* Rx wr header RO */
  274. #define IXGBE_DCA_TXCTRL_DESC_DCA_EN BIT(5) /* DCA Tx Desc enable */
  275. #define IXGBE_DCA_TXCTRL_DESC_RRO_EN BIT(9) /* Tx rd Desc Relax Order */
  276. #define IXGBE_DCA_TXCTRL_DESC_WRO_EN BIT(11) /* Tx Desc writeback RO bit */
  277. #define IXGBE_DCA_TXCTRL_DATA_RRO_EN BIT(13) /* Tx rd data Relax Order */
  278. #endif /* _IXGBEVF_DEFINES_H_ */