[intelxl] Add driver for Intel 40 Gigabit Ethernet NIC virtual functions

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2019-04-24 17:15:49 +01:00
parent 92b46b7858
commit a95966955c
4 changed files with 989 additions and 2 deletions

View File

@@ -20,9 +20,9 @@ struct intelxl_nic;
/** Alignment
*
* No data structure requires greater than 128 byte alignment.
* No data structure requires greater than 256 byte alignment.
*/
#define INTELXL_ALIGN 128
#define INTELXL_ALIGN 256
/******************************************************************************
*
@@ -310,6 +310,166 @@ struct intelxl_admin_link_params {
/** Admin queue Send Message to VF command */
#define INTELXL_ADMIN_SEND_TO_VF 0x0802
/** Admin Queue VF Reset opcode */
#define INTELXL_ADMIN_VF_RESET 0x00000002
/** Admin Queue VF Get Resources opcode */
#define INTELXL_ADMIN_VF_GET_RESOURCES 0x00000003
/** Admin Queue VF Get Resources data buffer */
struct intelxl_admin_vf_get_resources_buffer {
/** Reserved */
uint8_t reserved_a[20];
/** VSI switching element ID */
uint16_t vsi;
/** Reserved */
uint8_t reserved_b[8];
/** MAC address */
uint8_t mac[ETH_ALEN];
} __attribute__ (( packed ));
/** Admin Queue VF Status Change Event opcode */
#define INTELXL_ADMIN_VF_STATUS 0x00000011
/** Link status change event type */
#define INTELXL_ADMIN_VF_STATUS_LINK 0x00000001
/** Link status change event data */
struct intelxl_admin_vf_status_link {
/** Link speed */
uint32_t speed;
/** Link status */
uint8_t status;
/** Reserved */
uint8_t reserved[3];
} __attribute__ (( packed ));
/** Admin Queue VF Status Change Event data buffer */
struct intelxl_admin_vf_status_buffer {
/** Event type */
uint32_t event;
/** Event data */
union {
/** Link change event data */
struct intelxl_admin_vf_status_link link;
} data;
/** Reserved */
uint8_t reserved[4];
} __attribute__ (( packed ));
/** Admin Queue VF Configure Queues opcode */
#define INTELXL_ADMIN_VF_CONFIGURE 0x00000006
/** Admin Queue VF Configure Queues data buffer */
struct intelxl_admin_vf_configure_buffer {
/** VSI switching element ID */
uint16_t vsi;
/** Number of queue pairs */
uint16_t count;
/** Reserved */
uint8_t reserved_a[4];
/** Transmit queue */
struct {
/** VSI switching element ID */
uint16_t vsi;
/** Queue ID */
uint16_t id;
/** Queue count */
uint16_t count;
/** Reserved */
uint8_t reserved_a[2];
/** Base address */
uint64_t base;
/** Reserved */
uint8_t reserved_b[8];
} __attribute__ (( packed )) tx;
/** Receive queue */
struct {
/** VSI switching element ID */
uint16_t vsi;
/** Queue ID */
uint16_t id;
/** Queue count */
uint32_t count;
/** Reserved */
uint8_t reserved_a[4];
/** Data buffer length */
uint32_t len;
/** Maximum frame size */
uint32_t mfs;
/** Reserved */
uint8_t reserved_b[4];
/** Base address */
uint64_t base;
/** Reserved */
uint8_t reserved_c[8];
} __attribute__ (( packed )) rx;
/** Reserved
*
* This field exists only due to a bug in the PF driver's
* message validation logic, which causes it to miscalculate
* the expected message length.
*/
uint8_t reserved_b[64];
} __attribute__ (( packed ));
/** Admin Queue VF IRQ Map opcode */
#define INTELXL_ADMIN_VF_IRQ_MAP 0x00000007
/** Admin Queue VF IRQ Map data buffer */
struct intelxl_admin_vf_irq_map_buffer {
/** Number of interrupt vectors */
uint16_t count;
/** VSI switching element ID */
uint16_t vsi;
/** Interrupt vector ID */
uint16_t vec;
/** Receive queue bitmap */
uint16_t rxmap;
/** Transmit queue bitmap */
uint16_t txmap;
/** Receive interrupt throttling index */
uint16_t rxitr;
/** Transmit interrupt throttling index */
uint16_t txitr;
/** Reserved
*
* This field exists only due to a bug in the PF driver's
* message validation logic, which causes it to miscalculate
* the expected message length.
*/
uint8_t reserved[12];
} __attribute__ (( packed ));
/** Admin Queue VF Enable Queues opcode */
#define INTELXL_ADMIN_VF_ENABLE 0x00000008
/** Admin Queue VF Disable Queues opcode */
#define INTELXL_ADMIN_VF_DISABLE 0x00000009
/** Admin Queue VF Enable/Disable Queues data buffer */
struct intelxl_admin_vf_queues_buffer {
/** VSI switching element ID */
uint16_t vsi;
/** Reserved */
uint8_t reserved[2];
/** Receive queue bitmask */
uint32_t rx;
/** Transmit queue bitmask */
uint32_t tx;
} __attribute__ (( packed ));
/** Admin Queue VF Configure Promiscuous Mode opcode */
#define INTELXL_ADMIN_VF_PROMISC 0x0000000e
/** Admin Queue VF Configure Promiscuous Mode data buffer */
struct intelxl_admin_vf_promisc_buffer {
/** VSI switching element ID */
uint16_t vsi;
/** Flags */
uint16_t flags;
} __attribute__ (( packed ));
/** Admin queue command parameters */
union intelxl_admin_params {
/** Additional data buffer command parameters */
@@ -342,6 +502,18 @@ union intelxl_admin_buffer {
struct intelxl_admin_switch_buffer sw;
/** Get VSI Parameters data buffer */
struct intelxl_admin_vsi_buffer vsi;
/** VF Get Resources data buffer */
struct intelxl_admin_vf_get_resources_buffer res;
/** VF Status Change Event data buffer */
struct intelxl_admin_vf_status_buffer stat;
/** VF Configure Queues data buffer */
struct intelxl_admin_vf_configure_buffer cfg;
/** VF Enable/Disable Queues data buffer */
struct intelxl_admin_vf_queues_buffer queues;
/** VF Configure Promiscuous Mode data buffer */
struct intelxl_admin_vf_promisc_buffer promisc;
/*** VF IRQ Map data buffer */
struct intelxl_admin_vf_irq_map_buffer irq;
/** Alignment padding */
uint8_t pad[INTELXL_ALIGN];
} __attribute__ (( packed ));
@@ -867,12 +1039,21 @@ struct intelxl_nic {
struct pci_msix msix;
/** MSI-X dummy interrupt target */
uint32_t msg;
/** PCI Express capability offset */
unsigned int exp;
/** Admin command queue */
struct intelxl_admin command;
/** Admin event queue */
struct intelxl_admin event;
/** Current VF opcode */
unsigned int vopcode;
/** Current VF return value */
int vret;
/** Current VF event data buffer */
union intelxl_admin_buffer vbuf;
/** Transmit descriptor ring */
struct intelxl_ring tx;
/** Receive descriptor ring */