igc_base.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright (c) 2018 Intel Corporation */
  3. #ifndef _IGC_BASE_H_
  4. #define _IGC_BASE_H_
  5. /* forward declaration */
  6. void igc_rx_fifo_flush_base(struct igc_hw *hw);
  7. void igc_power_down_phy_copper_base(struct igc_hw *hw);
  8. bool igc_is_device_id_i225(struct igc_hw *hw);
  9. bool igc_is_device_id_i226(struct igc_hw *hw);
  10. /* Transmit Descriptor - Advanced */
  11. union igc_adv_tx_desc {
  12. struct {
  13. __le64 buffer_addr; /* Address of descriptor's data buf */
  14. __le32 cmd_type_len;
  15. __le32 olinfo_status;
  16. } read;
  17. struct {
  18. __le64 rsvd; /* Reserved */
  19. __le32 nxtseq_seed;
  20. __le32 status;
  21. } wb;
  22. };
  23. /* Context descriptors */
  24. struct igc_adv_tx_context_desc {
  25. __le32 vlan_macip_lens;
  26. __le32 launch_time;
  27. __le32 type_tucmd_mlhl;
  28. __le32 mss_l4len_idx;
  29. };
  30. /* Adv Transmit Descriptor Config Masks */
  31. #define IGC_ADVTXD_MAC_TSTAMP 0x00080000 /* IEEE1588 Timestamp packet */
  32. #define IGC_ADVTXD_TSTAMP_REG_1 0x00010000 /* Select register 1 for timestamp */
  33. #define IGC_ADVTXD_TSTAMP_REG_2 0x00020000 /* Select register 2 for timestamp */
  34. #define IGC_ADVTXD_TSTAMP_REG_3 0x00030000 /* Select register 3 for timestamp */
  35. #define IGC_ADVTXD_TSTAMP_TIMER_1 0x00010000 /* Select timer 1 for timestamp */
  36. #define IGC_ADVTXD_TSTAMP_TIMER_2 0x00020000 /* Select timer 2 for timestamp */
  37. #define IGC_ADVTXD_TSTAMP_TIMER_3 0x00030000 /* Select timer 3 for timestamp */
  38. #define IGC_ADVTXD_DTYP_CTXT 0x00200000 /* Advanced Context Descriptor */
  39. #define IGC_ADVTXD_DTYP_DATA 0x00300000 /* Advanced Data Descriptor */
  40. #define IGC_ADVTXD_DCMD_EOP 0x01000000 /* End of Packet */
  41. #define IGC_ADVTXD_DCMD_IFCS 0x02000000 /* Insert FCS (Ethernet CRC) */
  42. #define IGC_ADVTXD_DCMD_RS 0x08000000 /* Report Status */
  43. #define IGC_ADVTXD_DCMD_DEXT 0x20000000 /* Descriptor extension (1=Adv) */
  44. #define IGC_ADVTXD_DCMD_VLE 0x40000000 /* VLAN pkt enable */
  45. #define IGC_ADVTXD_DCMD_TSE 0x80000000 /* TCP Seg enable */
  46. #define IGC_ADVTXD_PAYLEN_SHIFT 14 /* Adv desc PAYLEN shift */
  47. #define IGC_RAR_ENTRIES 16
  48. /* Receive Descriptor - Advanced */
  49. union igc_adv_rx_desc {
  50. struct {
  51. __le64 pkt_addr; /* Packet buffer address */
  52. __le64 hdr_addr; /* Header buffer address */
  53. } read;
  54. struct {
  55. struct {
  56. union {
  57. __le32 data;
  58. struct {
  59. __le16 pkt_info; /*RSS type, Pkt type*/
  60. /* Split Header, header buffer len */
  61. __le16 hdr_info;
  62. } hs_rss;
  63. } lo_dword;
  64. union {
  65. __le32 rss; /* RSS Hash */
  66. struct {
  67. __le16 ip_id; /* IP id */
  68. __le16 csum; /* Packet Checksum */
  69. } csum_ip;
  70. } hi_dword;
  71. } lower;
  72. struct {
  73. __le32 status_error; /* ext status/error */
  74. __le16 length; /* Packet length */
  75. __le16 vlan; /* VLAN tag */
  76. } upper;
  77. } wb; /* writeback */
  78. };
  79. /* Additional Transmit Descriptor Control definitions */
  80. #define IGC_TXDCTL_QUEUE_ENABLE 0x02000000 /* Ena specific Tx Queue */
  81. #define IGC_TXDCTL_SWFLUSH 0x04000000 /* Transmit Software Flush */
  82. /* Additional Receive Descriptor Control definitions */
  83. #define IGC_RXDCTL_QUEUE_ENABLE 0x02000000 /* Ena specific Rx Queue */
  84. #define IGC_RXDCTL_SWFLUSH 0x04000000 /* Receive Software Flush */
  85. /* SRRCTL bit definitions */
  86. #define IGC_SRRCTL_BSIZEPKT_MASK GENMASK(6, 0)
  87. #define IGC_SRRCTL_BSIZEPKT(x) FIELD_PREP(IGC_SRRCTL_BSIZEPKT_MASK, \
  88. (x) / 1024) /* in 1 KB resolution */
  89. #define IGC_SRRCTL_BSIZEHDR_MASK GENMASK(13, 8)
  90. #define IGC_SRRCTL_BSIZEHDR(x) FIELD_PREP(IGC_SRRCTL_BSIZEHDR_MASK, \
  91. (x) / 64) /* in 64 bytes resolution */
  92. #define IGC_SRRCTL_DESCTYPE_MASK GENMASK(27, 25)
  93. #define IGC_SRRCTL_DESCTYPE_ADV_ONEBUF FIELD_PREP(IGC_SRRCTL_DESCTYPE_MASK, 1)
  94. #endif /* _IGC_BASE_H */