6 * Intel 10/100/1000 virtual function network card driver
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
14 /** Intel VF BAR size */
15 #define INTELVF_BAR_SIZE ( 16 * 1024 )
17 /** Mailbox Control Register */
18 #define INTELVF_MBCTRL 0x0c40UL
19 #define INTELVF_MBCTRL_REQ 0x00000001UL /**< Request for PF ready */
20 #define INTELVF_MBCTRL_ACK 0x00000002UL /**< PF message received */
21 #define INTELVF_MBCTRL_VFU 0x00000004UL /**< Buffer taken by VF */
22 #define INTELVF_MBCTRL_PFU 0x00000008UL /**< Buffer taken to PF */
23 #define INTELVF_MBCTRL_PFSTS 0x00000010UL /**< PF wrote a message */
24 #define INTELVF_MBCTRL_PFACK 0x00000020UL /**< PF acknowledged message */
25 #define INTELVF_MBCTRL_RSTI 0x00000040UL /**< PF reset in progress */
26 #define INTELVF_MBCTRL_RSTD 0x00000080UL /**< PF reset complete */
28 /** Mailbox Memory Register Base */
29 #define INTELVF_MBMEM 0x0800UL
31 /** Reset mailbox message */
32 #define INTELVF_MSG_TYPE_RESET 0x00000001UL
34 /** Set MAC address mailbox message */
35 #define INTELVF_MSG_TYPE_SET_MAC 0x00000002UL
37 /** Set MTU mailbox message */
38 #define INTELVF_MSG_TYPE_SET_MTU 0x00000005UL
40 /** Control ("ping") mailbox message */
41 #define INTELVF_MSG_TYPE_CONTROL 0x00000100UL
43 /** Message type mask */
44 #define INTELVF_MSG_TYPE_MASK 0x0000ffffUL
46 /** Message NACK flag */
47 #define INTELVF_MSG_NACK 0x40000000UL
49 /** Message ACK flag */
50 #define INTELVF_MSG_ACK 0x80000000UL
52 /** Message is a response */
53 #define INTELVF_MSG_RESPONSE ( INTELVF_MSG_ACK | INTELVF_MSG_NACK )
55 /** MAC address mailbox message */
56 struct intelvf_msg_mac {
60 uint8_t mac[ETH_ALEN];
61 /** Alignment padding */
62 uint8_t reserved[ (-ETH_ALEN) & 0x3 ];
63 } __attribute__ (( packed ));
65 /** Version number mailbox message */
66 struct intelvf_msg_version {
71 } __attribute__ (( packed ));
73 /** MTU mailbox message */
74 struct intelvf_msg_mtu {
77 /** Maximum packet size */
79 } __attribute__ (( packed ));
81 /** Mailbox message */
85 /** MAC address message */
86 struct intelvf_msg_mac mac;
87 /** Version number message */
88 struct intelvf_msg_version version;
90 struct intelvf_msg_mtu mtu;
95 /** Maximum time to wait for mailbox message
97 * This is a policy decision.
99 #define INTELVF_MBOX_MAX_WAIT_MS 500
101 extern int intelvf_mbox_msg ( struct intel_nic *intel, union intelvf_msg *msg );
102 extern int intelvf_mbox_poll ( struct intel_nic *intel );
103 extern int intelvf_mbox_wait ( struct intel_nic *intel );
104 extern int intelvf_mbox_reset ( struct intel_nic *intel, uint8_t *hw_addr );
105 extern int intelvf_mbox_set_mac ( struct intel_nic *intel,
106 const uint8_t *ll_addr );
107 extern int intelvf_mbox_set_mtu ( struct intel_nic *intel, size_t mtu );
109 #endif /* _INTELVF_H */