defines.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright(c) 1999 - 2018 Intel Corporation. */
  3. #ifndef _E1000_DEFINES_H_
  4. #define _E1000_DEFINES_H_
  5. /* Number of Transmit and Receive Descriptors must be a multiple of 8 */
  6. #define REQ_TX_DESCRIPTOR_MULTIPLE 8
  7. #define REQ_RX_DESCRIPTOR_MULTIPLE 8
  8. /* IVAR valid bit */
  9. #define E1000_IVAR_VALID 0x80
  10. /* Receive Descriptor bit definitions */
  11. #define E1000_RXD_STAT_DD 0x01 /* Descriptor Done */
  12. #define E1000_RXD_STAT_EOP 0x02 /* End of Packet */
  13. #define E1000_RXD_STAT_IXSM 0x04 /* Ignore checksum */
  14. #define E1000_RXD_STAT_VP 0x08 /* IEEE VLAN Packet */
  15. #define E1000_RXD_STAT_UDPCS 0x10 /* UDP xsum calculated */
  16. #define E1000_RXD_STAT_TCPCS 0x20 /* TCP xsum calculated */
  17. #define E1000_RXD_STAT_IPCS 0x40 /* IP xsum calculated */
  18. #define E1000_RXD_ERR_SE 0x02 /* Symbol Error */
  19. #define E1000_RXD_SPC_VLAN_MASK 0x0FFF /* VLAN ID is in lower 12 bits */
  20. #define E1000_RXDEXT_STATERR_LB 0x00040000
  21. #define E1000_RXDEXT_STATERR_CE 0x01000000
  22. #define E1000_RXDEXT_STATERR_SE 0x02000000
  23. #define E1000_RXDEXT_STATERR_SEQ 0x04000000
  24. #define E1000_RXDEXT_STATERR_CXE 0x10000000
  25. #define E1000_RXDEXT_STATERR_TCPE 0x20000000
  26. #define E1000_RXDEXT_STATERR_IPE 0x40000000
  27. #define E1000_RXDEXT_STATERR_RXE 0x80000000
  28. /* Same mask, but for extended and packet split descriptors */
  29. #define E1000_RXDEXT_ERR_FRAME_ERR_MASK ( \
  30. E1000_RXDEXT_STATERR_CE | \
  31. E1000_RXDEXT_STATERR_SE | \
  32. E1000_RXDEXT_STATERR_SEQ | \
  33. E1000_RXDEXT_STATERR_CXE | \
  34. E1000_RXDEXT_STATERR_RXE)
  35. /* Device Control */
  36. #define E1000_CTRL_RST 0x04000000 /* Global reset */
  37. /* Device Status */
  38. #define E1000_STATUS_FD 0x00000001 /* Full duplex.0=half,1=full */
  39. #define E1000_STATUS_LU 0x00000002 /* Link up.0=no,1=link */
  40. #define E1000_STATUS_TXOFF 0x00000010 /* transmission paused */
  41. #define E1000_STATUS_SPEED_10 0x00000000 /* Speed 10Mb/s */
  42. #define E1000_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */
  43. #define E1000_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */
  44. #define SPEED_10 10
  45. #define SPEED_100 100
  46. #define SPEED_1000 1000
  47. #define HALF_DUPLEX 1
  48. #define FULL_DUPLEX 2
  49. /* Transmit Descriptor bit definitions */
  50. #define E1000_TXD_POPTS_IXSM 0x01 /* Insert IP checksum */
  51. #define E1000_TXD_POPTS_TXSM 0x02 /* Insert TCP/UDP checksum */
  52. #define E1000_TXD_CMD_DEXT 0x20000000 /* Desc extension (0 = legacy) */
  53. #define E1000_TXD_STAT_DD 0x00000001 /* Desc Done */
  54. #define MAX_JUMBO_FRAME_SIZE 0x3F00
  55. #define MAX_STD_JUMBO_FRAME_SIZE 9216
  56. /* 802.1q VLAN Packet Size */
  57. #define VLAN_TAG_SIZE 4 /* 802.3ac tag (not DMA'd) */
  58. /* Error Codes */
  59. #define E1000_SUCCESS 0
  60. #define E1000_ERR_CONFIG 3
  61. #define E1000_ERR_MAC_INIT 5
  62. #define E1000_ERR_MBX 15
  63. /* SRRCTL bit definitions */
  64. #define E1000_SRRCTL_BSIZEPKT_SHIFT 10 /* Shift _right_ */
  65. #define E1000_SRRCTL_BSIZEHDRSIZE_MASK 0x00000F00
  66. #define E1000_SRRCTL_BSIZEHDRSIZE_SHIFT 2 /* Shift _left_ */
  67. #define E1000_SRRCTL_DESCTYPE_ADV_ONEBUF 0x02000000
  68. #define E1000_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS 0x0A000000
  69. #define E1000_SRRCTL_DESCTYPE_MASK 0x0E000000
  70. #define E1000_SRRCTL_DROP_EN 0x80000000
  71. #define E1000_SRRCTL_BSIZEPKT_MASK 0x0000007F
  72. #define E1000_SRRCTL_BSIZEHDR_MASK 0x00003F00
  73. /* Additional Descriptor Control definitions */
  74. #define E1000_TXDCTL_QUEUE_ENABLE 0x02000000 /* Enable specific Tx Que */
  75. #define E1000_RXDCTL_QUEUE_ENABLE 0x02000000 /* Enable specific Rx Que */
  76. /* Direct Cache Access (DCA) definitions */
  77. #define E1000_DCA_TXCTRL_TX_WB_RO_EN BIT(11) /* Tx Desc writeback RO bit */
  78. #define E1000_VF_INIT_TIMEOUT 200 /* Number of retries to clear RSTI */
  79. #endif /* _E1000_DEFINES_H_ */