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.

intelvf.h 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. #ifndef _INTELVF_H
  2. #define _INTELVF_H
  3. /** @file
  4. *
  5. * Intel 10/100/1000 virtual function network card driver
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  9. #include "intel.h"
  10. /** Intel VF BAR size */
  11. #define INTELVF_BAR_SIZE ( 16 * 1024 )
  12. /** Mailbox Control Register */
  13. #define INTELVF_MBCTRL 0x0c40UL
  14. #define INTELVF_MBCTRL_REQ 0x00000001UL /**< Request for PF ready */
  15. #define INTELVF_MBCTRL_ACK 0x00000002UL /**< PF message received */
  16. #define INTELVF_MBCTRL_VFU 0x00000004UL /**< Buffer taken by VF */
  17. #define INTELVF_MBCTRL_PFU 0x00000008UL /**< Buffer taken to PF */
  18. #define INTELVF_MBCTRL_PFSTS 0x00000010UL /**< PF wrote a message */
  19. #define INTELVF_MBCTRL_PFACK 0x00000020UL /**< PF acknowledged message */
  20. #define INTELVF_MBCTRL_RSTI 0x00000040UL /**< PF reset in progress */
  21. #define INTELVF_MBCTRL_RSTD 0x00000080UL /**< PF reset complete */
  22. /** Mailbox Memory Register Base */
  23. #define INTELVF_MBMEM 0x0800UL
  24. /** Reset mailbox message */
  25. #define INTELVF_MSG_TYPE_RESET 0x00000001UL
  26. /** Set MAC address mailbox message */
  27. #define INTELVF_MSG_TYPE_SET_MAC 0x00000002UL
  28. /** Set MTU mailbox message */
  29. #define INTELVF_MSG_TYPE_SET_MTU 0x00000005UL
  30. /** Get queue configuration message */
  31. #define INTELVF_MSG_TYPE_GET_QUEUES 0x00000009UL
  32. /** Control ("ping") mailbox message */
  33. #define INTELVF_MSG_TYPE_CONTROL 0x00000100UL
  34. /** Message type mask */
  35. #define INTELVF_MSG_TYPE_MASK 0x0000ffffUL
  36. /** Message NACK flag */
  37. #define INTELVF_MSG_NACK 0x40000000UL
  38. /** Message ACK flag */
  39. #define INTELVF_MSG_ACK 0x80000000UL
  40. /** Message is a response */
  41. #define INTELVF_MSG_RESPONSE ( INTELVF_MSG_ACK | INTELVF_MSG_NACK )
  42. /** MAC address mailbox message */
  43. struct intelvf_msg_mac {
  44. /** Message header */
  45. uint32_t hdr;
  46. /** MAC address */
  47. uint8_t mac[ETH_ALEN];
  48. /** Alignment padding */
  49. uint8_t reserved[ (-ETH_ALEN) & 0x3 ];
  50. } __attribute__ (( packed ));
  51. /** Version number mailbox message */
  52. struct intelvf_msg_version {
  53. /** Message header */
  54. uint32_t hdr;
  55. /** API version */
  56. uint32_t version;
  57. } __attribute__ (( packed ));
  58. /** MTU mailbox message */
  59. struct intelvf_msg_mtu {
  60. /** Message header */
  61. uint32_t hdr;
  62. /** Maximum packet size */
  63. uint32_t mtu;
  64. } __attribute__ (( packed ));
  65. /** Queue configuration mailbox message (API v1.1+ only) */
  66. struct intelvf_msg_queues {
  67. /** Message header */
  68. uint32_t hdr;
  69. /** Maximum number of transmit queues */
  70. uint32_t tx;
  71. /** Maximum number of receive queues */
  72. uint32_t rx;
  73. /** VLAN hand-waving thing
  74. *
  75. * This is labelled IXGBE_VF_TRANS_VLAN in the Linux driver.
  76. *
  77. * A comment in the Linux PF driver describes it as "notify VF
  78. * of need for VLAN tag stripping, and correct queue". It
  79. * will be filled with a non-zero value if the PF is enforcing
  80. * the use of a single VLAN tag. It will also be filled with
  81. * a non-zero value if the PF is using multiple traffic
  82. * classes.
  83. *
  84. * The Linux VF driver seems to treat this field as being
  85. * simply the number of traffic classes, and gives it no
  86. * VLAN-related interpretation.
  87. *
  88. * If the PF is enforcing the use of a single VLAN tag for the
  89. * VF, then the VLAN tag will be transparently inserted in
  90. * transmitted packets (via the PFVMVIR register) but will
  91. * still be visible in received packets. The Linux VF driver
  92. * handles this unexpected VLAN tag by simply ignoring any
  93. * unrecognised VLAN tags.
  94. *
  95. * We choose to strip and ignore the VLAN tag if this field
  96. * has a non-zero value.
  97. */
  98. uint32_t vlan_thing;
  99. /** Default queue */
  100. uint32_t dflt;
  101. } __attribute__ (( packed ));
  102. /** Mailbox message */
  103. union intelvf_msg {
  104. /** Message header */
  105. uint32_t hdr;
  106. /** MAC address message */
  107. struct intelvf_msg_mac mac;
  108. /** Version number message */
  109. struct intelvf_msg_version version;
  110. /** MTU message */
  111. struct intelvf_msg_mtu mtu;
  112. /** Queue configuration message */
  113. struct intelvf_msg_queues queues;
  114. /** Raw dwords */
  115. uint32_t dword[0];
  116. };
  117. /** Maximum time to wait for mailbox message
  118. *
  119. * This is a policy decision.
  120. */
  121. #define INTELVF_MBOX_MAX_WAIT_MS 500
  122. extern int intelvf_mbox_msg ( struct intel_nic *intel, union intelvf_msg *msg );
  123. extern int intelvf_mbox_poll ( struct intel_nic *intel );
  124. extern int intelvf_mbox_wait ( struct intel_nic *intel );
  125. extern int intelvf_mbox_reset ( struct intel_nic *intel, uint8_t *hw_addr );
  126. extern int intelvf_mbox_set_mac ( struct intel_nic *intel,
  127. const uint8_t *ll_addr );
  128. extern int intelvf_mbox_set_mtu ( struct intel_nic *intel, size_t mtu );
  129. #endif /* _INTELVF_H */