您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

intelvf.h 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. /** Control ("ping") mailbox message */
  31. #define INTELVF_MSG_TYPE_CONTROL 0x00000100UL
  32. /** Message type mask */
  33. #define INTELVF_MSG_TYPE_MASK 0x0000ffffUL
  34. /** Message NACK flag */
  35. #define INTELVF_MSG_NACK 0x40000000UL
  36. /** Message ACK flag */
  37. #define INTELVF_MSG_ACK 0x80000000UL
  38. /** Message is a response */
  39. #define INTELVF_MSG_RESPONSE ( INTELVF_MSG_ACK | INTELVF_MSG_NACK )
  40. /** MAC address mailbox message */
  41. struct intelvf_msg_mac {
  42. /** Message header */
  43. uint32_t hdr;
  44. /** MAC address */
  45. uint8_t mac[ETH_ALEN];
  46. /** Alignment padding */
  47. uint8_t reserved[ (-ETH_ALEN) & 0x3 ];
  48. } __attribute__ (( packed ));
  49. /** Version number mailbox message */
  50. struct intelvf_msg_version {
  51. /** Message header */
  52. uint32_t hdr;
  53. /** API version */
  54. uint32_t version;
  55. } __attribute__ (( packed ));
  56. /** MTU mailbox message */
  57. struct intelvf_msg_mtu {
  58. /** Message header */
  59. uint32_t hdr;
  60. /** Maximum packet size */
  61. uint32_t mtu;
  62. } __attribute__ (( packed ));
  63. /** Mailbox message */
  64. union intelvf_msg {
  65. /** Message header */
  66. uint32_t hdr;
  67. /** MAC address message */
  68. struct intelvf_msg_mac mac;
  69. /** Version number message */
  70. struct intelvf_msg_version version;
  71. /** MTU message */
  72. struct intelvf_msg_mtu mtu;
  73. /** Raw dwords */
  74. uint32_t dword[0];
  75. };
  76. /** Maximum time to wait for mailbox message
  77. *
  78. * This is a policy decision.
  79. */
  80. #define INTELVF_MBOX_MAX_WAIT_MS 500
  81. extern int intelvf_mbox_msg ( struct intel_nic *intel, union intelvf_msg *msg );
  82. extern int intelvf_mbox_poll ( struct intel_nic *intel );
  83. extern int intelvf_mbox_wait ( struct intel_nic *intel );
  84. extern int intelvf_mbox_reset ( struct intel_nic *intel, uint8_t *hw_addr );
  85. extern int intelvf_mbox_set_mac ( struct intel_nic *intel,
  86. const uint8_t *ll_addr );
  87. extern int intelvf_mbox_set_mtu ( struct intel_nic *intel, size_t mtu );
  88. #endif /* _INTELVF_H */