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