iPXE
intelvf.h
Go to the documentation of this file.
1 #ifndef _INTELVF_H
2 #define _INTELVF_H
3 
4 /** @file
5  *
6  * Intel 10/100/1000 virtual function network card driver
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #include "intel.h"
13 
14 /** Intel VF BAR size */
15 #define INTELVF_BAR_SIZE ( 16 * 1024 )
16 
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 */
27 
28 /** Mailbox Memory Register Base */
29 #define INTELVF_MBMEM 0x0800UL
30 
31 /** Reset mailbox message */
32 #define INTELVF_MSG_TYPE_RESET 0x00000001UL
33 
34 /** Set MAC address mailbox message */
35 #define INTELVF_MSG_TYPE_SET_MAC 0x00000002UL
36 
37 /** Set MTU mailbox message */
38 #define INTELVF_MSG_TYPE_SET_MTU 0x00000005UL
39 
40 /** Get queue configuration message */
41 #define INTELVF_MSG_TYPE_GET_QUEUES 0x00000009UL
42 
43 /** Control ("ping") mailbox message */
44 #define INTELVF_MSG_TYPE_CONTROL 0x00000100UL
45 
46 /** Message type mask */
47 #define INTELVF_MSG_TYPE_MASK 0x0000ffffUL
48 
49 /** Message NACK flag */
50 #define INTELVF_MSG_NACK 0x40000000UL
51 
52 /** Message ACK flag */
53 #define INTELVF_MSG_ACK 0x80000000UL
54 
55 /** Message is a response */
56 #define INTELVF_MSG_RESPONSE ( INTELVF_MSG_ACK | INTELVF_MSG_NACK )
57 
58 /** MAC address mailbox message */
60  /** Message header */
62  /** MAC address */
64  /** Alignment padding */
65  uint8_t reserved[ (-ETH_ALEN) & 0x3 ];
66 } __attribute__ (( packed ));
67 
68 /** Version number mailbox message */
70  /** Message header */
72  /** API version */
74 } __attribute__ (( packed ));
75 
76 /** MTU mailbox message */
78  /** Message header */
80  /** Maximum packet size */
82 } __attribute__ (( packed ));
83 
84 /** Queue configuration mailbox message (API v1.1+ only) */
86  /** Message header */
88  /** Maximum number of transmit queues */
90  /** Maximum number of receive queues */
92  /** VLAN hand-waving thing
93  *
94  * This is labelled IXGBE_VF_TRANS_VLAN in the Linux driver.
95  *
96  * A comment in the Linux PF driver describes it as "notify VF
97  * of need for VLAN tag stripping, and correct queue". It
98  * will be filled with a non-zero value if the PF is enforcing
99  * the use of a single VLAN tag. It will also be filled with
100  * a non-zero value if the PF is using multiple traffic
101  * classes.
102  *
103  * The Linux VF driver seems to treat this field as being
104  * simply the number of traffic classes, and gives it no
105  * VLAN-related interpretation.
106  *
107  * If the PF is enforcing the use of a single VLAN tag for the
108  * VF, then the VLAN tag will be transparently inserted in
109  * transmitted packets (via the PFVMVIR register) but will
110  * still be visible in received packets. The Linux VF driver
111  * handles this unexpected VLAN tag by simply ignoring any
112  * unrecognised VLAN tags.
113  *
114  * We choose to strip and ignore the VLAN tag if this field
115  * has a non-zero value.
116  */
118  /** Default queue */
120 } __attribute__ (( packed ));
121 
122 /** Mailbox message */
123 union intelvf_msg {
124  /** Message header */
126  /** MAC address message */
128  /** Version number message */
130  /** MTU message */
132  /** Queue configuration message */
134  /** Raw dwords */
136 };
137 
138 /** Maximum time to wait for mailbox message
139  *
140  * This is a policy decision.
141  */
142 #define INTELVF_MBOX_MAX_WAIT_MS 500
143 
144 extern int intelvf_mbox_msg ( struct intel_nic *intel, union intelvf_msg *msg );
145 extern int intelvf_mbox_poll ( struct intel_nic *intel );
146 extern int intelvf_mbox_wait ( struct intel_nic *intel );
147 extern int intelvf_mbox_reset ( struct intel_nic *intel, uint8_t *hw_addr );
148 extern int intelvf_mbox_set_mac ( struct intel_nic *intel,
149  const uint8_t *ll_addr );
150 extern int intelvf_mbox_set_mtu ( struct intel_nic *intel, size_t mtu );
151 
152 #endif /* _INTELVF_H */
uint32_t hdr
Message header.
Definition: intelvf.h:79
union intelvf_msg __attribute__
uint8_t reserved[(-ETH_ALEN) &0x3]
Alignment padding.
Definition: intelvf.h:65
int intelvf_mbox_wait(struct intel_nic *intel)
Wait for PF reset to complete.
Definition: intelvf.c:123
MTU mailbox message.
Definition: intelvf.h:77
int intelvf_mbox_msg(struct intel_nic *intel, union intelvf_msg *msg)
Send/receive mailbox message.
Definition: intelvf.c:149
int intelvf_mbox_set_mtu(struct intel_nic *intel, size_t mtu)
Send set MTU message.
Definition: intelvf.c:311
Mailbox message.
Definition: intelvf.h:123
uint32_t hdr
Message header.
Definition: intelvf.h:87
uint32_t mtu
Maximum packet size.
Definition: intelvf.h:14
Version number mailbox message.
Definition: intelvf.h:69
struct intelvf_msg_version version
Version number message.
Definition: intelvf.h:129
Intel 10/100/1000 network card driver.
uint32_t mtu
Maximum packet size.
Definition: intelvf.h:81
struct intelvf_msg_mtu mtu
MTU message.
Definition: intelvf.h:131
uint32_t rx
Maximum number of receive queues.
Definition: intelvf.h:91
uint8_t mac[ETH_ALEN]
MAC address.
Definition: intelvf.h:63
unsigned char uint8_t
Definition: stdint.h:10
#define ETH_ALEN
Definition: if_ether.h:8
Queue configuration mailbox message (API v1.1+ only)
Definition: intelvf.h:85
unsigned int uint32_t
Definition: stdint.h:12
uint32_t hdr
Message header.
Definition: intelvf.h:125
int intelvf_mbox_poll(struct intel_nic *intel)
Poll mailbox.
Definition: intelvf.c:96
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
uint32_t tx
Maximum number of transmit queues.
Definition: intelvf.h:89
struct intelvf_msg_mac mac
MAC address message.
Definition: intelvf.h:127
uint32_t vlan_thing
VLAN hand-waving thing.
Definition: intelvf.h:117
An Intel network card.
Definition: intel.h:278
uint32_t version
API version.
Definition: intelvf.h:73
struct intelvf_msg_queues queues
Queue configuration message.
Definition: intelvf.h:133
uint32_t hdr
Message header.
Definition: intelvf.h:71
uint32_t hdr
Message header.
Definition: intelvf.h:61
uint32_t dflt
Default queue.
Definition: intelvf.h:119
int intelvf_mbox_set_mac(struct intel_nic *intel, const uint8_t *ll_addr)
Send set MAC address message.
Definition: intelvf.c:273
unsigned long int dword
Definition: smc9000.h:40
int intelvf_mbox_reset(struct intel_nic *intel, uint8_t *hw_addr)
Send reset message and get initial MAC address.
Definition: intelvf.c:230
static void msg(unsigned int row, const char *fmt,...)
Print message centred on specified row.
Definition: settings_ui.c:285
MAC address mailbox message.
Definition: intelvf.h:59