iPXE
|
Intel 40 Gigabit Ethernet virtual function network card driver. More...
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <byteswap.h>
#include <ipxe/pci.h>
#include <ipxe/netdevice.h>
#include <ipxe/ethernet.h>
#include "intelxlvf.h"
Go to the source code of this file.
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static int | intelxlvf_reset_wait_teardown (struct intelxl_nic *intelxl) |
Wait for admin event queue to be torn down. More... | |
static int | intelxlvf_reset_wait_active (struct intelxl_nic *intelxl) |
Wait for virtual function to be marked as active. More... | |
static int | intelxlvf_reset_wait (struct intelxl_nic *intelxl) |
Wait for reset to complete. More... | |
static int | intelxlvf_reset_admin (struct intelxl_nic *intelxl) |
Reset hardware via admin queue. More... | |
static int | intelxlvf_admin_command (struct net_device *netdev) |
Issue admin queue virtual function command. More... | |
static void | intelxlvf_admin_link (struct net_device *netdev, struct intelxlvf_admin_status_link *link) |
Handle link status event. More... | |
static void | intelxlvf_admin_status (struct net_device *netdev, struct intelxlvf_admin_status_buffer *stat) |
Handle status change event. More... | |
static void | intelxlvf_admin_event (struct net_device *netdev, struct intelxl_admin_descriptor *xlevt, union intelxl_admin_buffer *xlbuf) |
Handle admin event. More... | |
static int | intelxlvf_admin_version (struct net_device *netdev) |
Negotiate API version. More... | |
static int | intelxlvf_admin_get_resources (struct net_device *netdev) |
Get resources. More... | |
static int | intelxlvf_admin_stats (struct net_device *netdev) |
Get statistics (for debugging) More... | |
static int | intelxlvf_admin_request_qps (struct net_device *netdev) |
Configure number of queue pairs. More... | |
static int | intelxlvf_admin_configure (struct net_device *netdev) |
Configure queues. More... | |
static int | intelxlvf_admin_irq_map (struct net_device *netdev) |
Configure IRQ mapping. More... | |
static int | intelxlvf_admin_queues (struct net_device *netdev, int enable) |
Enable/disable queues. More... | |
static int | intelxlvf_admin_promisc (struct net_device *netdev) |
Configure promiscuous mode. More... | |
static int | intelxlvf_open (struct net_device *netdev) |
Open network device. More... | |
static void | intelxlvf_close (struct net_device *netdev) |
Close network device. More... | |
static int | intelxlvf_probe (struct pci_device *pci) |
Probe PCI device. More... | |
static void | intelxlvf_remove (struct pci_device *pci) |
Remove PCI device. More... | |
Variables | |
static const struct intelxl_admin_offsets | intelxlvf_admin_command_offsets |
Admin command queue register offsets. More... | |
static const struct intelxl_admin_offsets | intelxlvf_admin_event_offsets |
Admin event queue register offsets. More... | |
static struct net_device_operations | intelxlvf_operations |
Network device operations. More... | |
static struct pci_device_id | intelxlvf_nics [] |
PCI device IDs. More... | |
struct pci_driver intelxlvf_driver | __pci_driver |
PCI driver. More... | |
Intel 40 Gigabit Ethernet virtual function network card driver.
Definition in file intelxlvf.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Wait for admin event queue to be torn down.
intelxl | Intel device |
rc | Return status code |
Definition at line 54 of file intelxlvf.c.
References DBGC, ETIMEDOUT, INTELXL_ADMIN_LEN_ENABLE, INTELXLVF_ADMIN, INTELXLVF_ADMIN_EVT_LEN, INTELXLVF_RESET_MAX_WAIT_MS, mdelay(), readl(), and intelxl_nic::regs.
Referenced by intelxlvf_reset_wait().
|
static |
Wait for virtual function to be marked as active.
intelxl | Intel device |
rc | Return status code |
Definition at line 82 of file intelxlvf.c.
References DBGC, ETIMEDOUT, INTELXLVF_RESET_MAX_WAIT_MS, INTELXLVF_VFGEN_RSTAT, INTELXLVF_VFGEN_RSTAT_VFR_STATE, INTELXLVF_VFGEN_RSTAT_VFR_STATE_ACTIVE, mdelay(), readl(), and intelxl_nic::regs.
Referenced by intelxlvf_reset_wait().
|
static |
Wait for reset to complete.
intelxl | Intel device |
rc | Return status code |
Definition at line 111 of file intelxlvf.c.
References intelxl_reopen_admin(), INTELXLVF_RESET_DELAY_MS, intelxlvf_reset_wait_active(), intelxlvf_reset_wait_teardown(), mdelay(), and rc.
Referenced by intelxlvf_admin_request_qps(), and intelxlvf_reset_admin().
|
static |
Reset hardware via admin queue.
intelxl | Intel device |
rc | Return status code |
Definition at line 137 of file intelxlvf.c.
References cmd, cpu_to_le16, cpu_to_le32, intelxl_admin_command(), intelxlvf_admin_command_descriptor(), INTELXLVF_ADMIN_RESET, INTELXLVF_ADMIN_SEND_TO_PF, intelxlvf_reset_wait(), and rc.
Referenced by intelxlvf_probe(), and intelxlvf_remove().
|
static |
Issue admin queue virtual function command.
netdev | Network device |
rc | Return status code |
Definition at line 188 of file intelxlvf.c.
References cmd, intelxl_nic::command, container_of, cpu_to_le16, DBGC, intelxl_admin::desc, EIO, ETIMEDOUT, intelxl_admin::index, intelxl_admin_command(), INTELXL_ADMIN_NUM_DESC, intelxl_poll_admin(), INTELXLVF_ADMIN_MAX_WAIT_MS, INTELXLVF_ADMIN_SEND_TO_PF, le32_to_cpu, mdelay(), netdev, net_device::priv, rc, intelxl_nic::vopcode, and intelxlvf_admin_descriptor::xl.
Referenced by intelxlvf_admin_configure(), intelxlvf_admin_get_resources(), intelxlvf_admin_irq_map(), intelxlvf_admin_promisc(), intelxlvf_admin_queues(), intelxlvf_admin_stats(), and intelxlvf_admin_version().
|
static |
Handle link status event.
netdev | Network device |
link | Link status |
Definition at line 241 of file intelxlvf.c.
References DBGC, link, netdev, netdev_link_down(), netdev_link_up(), and net_device::priv.
Referenced by intelxlvf_admin_status().
|
static |
Handle status change event.
netdev | Network device |
stat | Status change event |
Definition at line 263 of file intelxlvf.c.
References cpu_to_le32, intelxlvf_admin_status_buffer::data, DBGC, DBGC_HDA, intelxlvf_admin_status_buffer::event, intelxlvf_admin_link(), INTELXLVF_ADMIN_STATUS_LINK, le32_to_cpu, intelxlvf_admin_status_buffer::link, netdev, and net_device::priv.
Referenced by intelxlvf_admin_event().
|
static |
Handle admin event.
netdev | Network device |
xlevt | Admin queue event descriptor |
xlbuf | Admin queue event data buffer |
Definition at line 287 of file intelxlvf.c.
References intelxl_admin::buf, intelxl_nic::command, container_of, cpu_to_le16, DBGC, DBGC_HDA, intelxl_admin::desc, index, intelxl_admin::index, INTELXL_ADMIN_NUM_DESC, INTELXLVF_ADMIN_SEND_TO_VF, INTELXLVF_ADMIN_STATUS, intelxlvf_admin_status(), le16_to_cpu, le32_to_cpu, intelxlvf_admin_descriptor::len, memcpy(), netdev, intelxlvf_admin_descriptor::opcode, net_device::priv, intelxlvf_admin_buffer::stat, virt_to_phys(), intelxlvf_admin_descriptor::vopcode, intelxl_nic::vopcode, intelxlvf_admin_descriptor::vret, intelxlvf_admin_descriptor::xl, and intelxlvf_admin_buffer::xl.
Referenced by intelxlvf_probe().
|
static |
Negotiate API version.
netdev | Network device |
rc | Return status code |
Definition at line 347 of file intelxlvf.c.
References cmd, cpu_to_le16, cpu_to_le32, DBGC, ENOTSUP, INTELXL_ADMIN_FL_BUF, INTELXL_ADMIN_FL_RD, INTELXLVF_ADMIN_API_MAJOR, INTELXLVF_ADMIN_API_MINOR, intelxlvf_admin_command(), intelxlvf_admin_command_buffer(), intelxlvf_admin_command_descriptor(), INTELXLVF_ADMIN_VERSION, le32_to_cpu, intelxlvf_admin_version_buffer::major, intelxlvf_admin_version_buffer::minor, netdev, net_device::priv, rc, and intelxlvf_admin_buffer::ver.
Referenced by intelxlvf_probe().
|
static |
Get resources.
netdev | Network device |
rc | Return status code |
Definition at line 386 of file intelxlvf.c.
References intelxlvf_admin_capabilities_buffer::caps, intelxlvf_admin_get_resources_buffer::caps, intelxlvf_admin_buffer::caps, intelxl_nic::caps, cmd, cpu_to_le16, cpu_to_le32, DBGC, ETH_ALEN, net_device::hw_addr, INTELXL_ADMIN_FL_BUF, INTELXL_ADMIN_FL_RD, INTELXLVF_ADMIN_CAP_L2, INTELXLVF_ADMIN_CAP_RQPS, intelxlvf_admin_command(), intelxlvf_admin_command_buffer(), intelxlvf_admin_command_descriptor(), INTELXLVF_ADMIN_GET_RESOURCES, le16_to_cpu, le32_to_cpu, intelxlvf_admin_get_resources_buffer::mac, memcpy(), netdev, net_device::priv, rc, intelxlvf_admin_buffer::res, intelxlvf_admin_get_resources_buffer::vsi, and intelxl_nic::vsi.
Referenced by intelxlvf_admin_request_qps(), and intelxlvf_probe().
|
static |
Get statistics (for debugging)
netdev | Network device |
rc | Return status code |
Definition at line 421 of file intelxlvf.c.
References cmd, cpu_to_le16, cpu_to_le32, DBGC, INTELXL_ADMIN_FL_BUF, INTELXL_ADMIN_FL_RD, intelxlvf_admin_command(), intelxlvf_admin_command_buffer(), intelxlvf_admin_command_descriptor(), INTELXLVF_ADMIN_GET_STATS, le64_to_cpu, netdev, net_device::priv, intelxlvf_admin_buffer::queues, rc, rx, intelxlvf_admin_stats_buffer::rx, intelxlvf_admin_buffer::stats, tx, intelxlvf_admin_stats_buffer::tx, intelxlvf_admin_queues_buffer::vsi, and intelxl_nic::vsi.
Referenced by intelxlvf_close(), and intelxlvf_open().
|
static |
Configure number of queue pairs.
netdev | Network device |
rc | Return status code |
Definition at line 472 of file intelxlvf.c.
References cmd, intelxlvf_admin_request_qps_buffer::count, cpu_to_le16, cpu_to_le32, intelxl_admin_command(), INTELXL_ADMIN_FL_BUF, INTELXL_ADMIN_FL_RD, intelxlvf_admin_command_buffer(), intelxlvf_admin_command_descriptor(), intelxlvf_admin_get_resources(), INTELXLVF_ADMIN_REQUEST_QPS, INTELXLVF_ADMIN_SEND_TO_PF, intelxlvf_reset_wait(), netdev, net_device::priv, rc, and intelxlvf_admin_buffer::rqps.
Referenced by intelxlvf_probe().
|
static |
Configure queues.
netdev | Network device |
rc | Return status code |
Definition at line 515 of file intelxlvf.c.
References intelxlvf_admin_configure_buffer::base, intelxlvf_admin_buffer::cfg, cmd, intelxlvf_admin_configure_buffer::count, cpu_to_le16, cpu_to_le32, cpu_to_le64, intelxl_ring::desc, dma(), INTELXL_ADMIN_FL_BUF, INTELXL_ADMIN_FL_RD, INTELXL_RX_NUM_DESC, INTELXL_TX_NUM_DESC, intelxlvf_admin_command(), intelxlvf_admin_command_buffer(), intelxlvf_admin_command_descriptor(), INTELXLVF_ADMIN_CONFIGURE, intelxlvf_admin_configure_buffer::len, intelxl_ring::map, intelxlvf_admin_configure_buffer::mfs, intelxl_nic::mfs, netdev, net_device::priv, intelxl_ring::raw, rc, intelxlvf_admin_configure_buffer::rx, intelxl_nic::rx, intelxlvf_admin_configure_buffer::tx, intelxl_nic::tx, intelxlvf_admin_configure_buffer::vsi, and intelxl_nic::vsi.
Referenced by intelxlvf_open().
|
static |
Configure IRQ mapping.
netdev | Network device |
rc | Return status code |
Definition at line 553 of file intelxlvf.c.
References cmd, intelxlvf_admin_irq_map_buffer::count, cpu_to_le16, cpu_to_le32, INTELXL_ADMIN_FL_BUF, INTELXL_ADMIN_FL_RD, intelxlvf_admin_command(), intelxlvf_admin_command_buffer(), intelxlvf_admin_command_descriptor(), INTELXLVF_ADMIN_IRQ_MAP, INTELXLVF_MSIX_VECTOR, intelxlvf_admin_buffer::irq, netdev, net_device::priv, rc, intelxlvf_admin_irq_map_buffer::rxmap, intelxlvf_admin_irq_map_buffer::txmap, intelxlvf_admin_irq_map_buffer::vec, intelxlvf_admin_irq_map_buffer::vsi, and intelxl_nic::vsi.
Referenced by intelxlvf_open().
|
static |
Enable/disable queues.
netdev | Network device |
enable | Enable queues |
rc | Return status code |
Definition at line 585 of file intelxlvf.c.
References cmd, cpu_to_le16, cpu_to_le32, INTELXL_ADMIN_FL_BUF, INTELXL_ADMIN_FL_RD, intelxlvf_admin_command(), intelxlvf_admin_command_buffer(), intelxlvf_admin_command_descriptor(), INTELXLVF_ADMIN_DISABLE, INTELXLVF_ADMIN_ENABLE, netdev, net_device::priv, intelxlvf_admin_buffer::queues, rc, intelxlvf_admin_queues_buffer::rx, intelxlvf_admin_queues_buffer::tx, intelxlvf_admin_queues_buffer::vsi, and intelxl_nic::vsi.
Referenced by intelxlvf_close(), and intelxlvf_open().
|
static |
Configure promiscuous mode.
netdev | Network device |
rc | Return status code |
Definition at line 615 of file intelxlvf.c.
References cmd, cpu_to_le16, cpu_to_le32, intelxlvf_admin_promisc_buffer::flags, INTELXL_ADMIN_FL_BUF, INTELXL_ADMIN_FL_RD, INTELXL_ADMIN_PROMISC_FL_MULTICAST, INTELXL_ADMIN_PROMISC_FL_UNICAST, intelxlvf_admin_command(), intelxlvf_admin_command_buffer(), intelxlvf_admin_command_descriptor(), INTELXLVF_ADMIN_PROMISC, netdev, net_device::priv, intelxlvf_admin_buffer::promisc, rc, intelxlvf_admin_promisc_buffer::vsi, and intelxl_nic::vsi.
Referenced by intelxlvf_open().
|
static |
Open network device.
netdev | Network device |
rc | Return status code |
Definition at line 644 of file intelxlvf.c.
References DBG_LOG, ETH_HLEN, INTELXL_ALIGN, intelxl_alloc_ring(), intelxl_free_ring(), intelxlvf_admin_configure(), intelxlvf_admin_irq_map(), intelxlvf_admin_promisc(), intelxlvf_admin_queues(), intelxlvf_admin_stats(), intelxl_nic::mfs, net_device::mtu, netdev, net_device::priv, rc, intelxl_nic::rx, and intelxl_nic::tx.
|
static |
Close network device.
netdev | Network device |
Definition at line 699 of file intelxlvf.c.
References DBG_LOG, intelxl_empty_rx(), intelxl_free_ring(), intelxlvf_admin_queues(), intelxlvf_admin_stats(), netdev, net_device::priv, rc, intelxl_nic::rx, and intelxl_nic::tx.
|
static |
Probe PCI device.
pci | PCI device |
rc | Return status code |
Definition at line 744 of file intelxlvf.c.
References adjust_pci_device(), alloc_etherdev(), intelxl_nic::caps, intelxl_nic::command, DBGC, intelxl_ring::desc, pci_device::dev, net_device::dev, pci_device::dma, net_device::dma, intelxl_nic::dma, dma_set_mask_64bit(), ENODEV, ENOMEM, ENXIO, intelxl_nic::event, intelxl_nic::exp, intelxl_nic::handle, intelxl_close_admin(), intelxl_init_admin(), intelxl_msix_disable(), intelxl_msix_enable(), intelxl_open_admin(), INTELXL_RX_NUM_DESC, INTELXL_TX_NUM_DESC, INTELXLVF_ADMIN, INTELXLVF_ADMIN_CAP_RQPS, intelxlvf_admin_command_offsets, intelxlvf_admin_event(), intelxlvf_admin_event_offsets, intelxlvf_admin_get_resources(), intelxlvf_admin_request_qps(), intelxlvf_admin_version(), INTELXLVF_BAR_SIZE, intelxlvf_init_ring(), INTELXLVF_MSIX_VECTOR, intelxlvf_operations, INTELXLVF_QRX_TAIL, INTELXLVF_QTX_TAIL, intelxlvf_reset_admin(), INTELXLVF_VFINT_DYN_CTLN, intelxl_nic::intr, iounmap(), pci_device::membase, memset(), netdev, netdev_init(), netdev_nullify(), netdev_put(), PCI_CAP_ID_EXP, pci_find_capability(), pci_ioremap(), pci_reset(), pci_set_drvdata(), net_device::priv, rc, register_netdev(), intelxl_nic::regs, intelxl_ring::rx, intelxl_nic::rx, intelxl_ring::tx, intelxl_nic::tx, and unregister_netdev().
|
static |
Remove PCI device.
pci | PCI device |
Definition at line 857 of file intelxlvf.c.
References intelxl_nic::exp, intelxl_close_admin(), intelxl_msix_disable(), INTELXLVF_MSIX_VECTOR, intelxlvf_reset_admin(), iounmap(), netdev, netdev_nullify(), netdev_put(), pci_get_drvdata(), pci_reset(), net_device::priv, intelxl_nic::regs, and unregister_netdev().
|
static |
Admin command queue register offsets.
Definition at line 165 of file intelxlvf.c.
Referenced by intelxlvf_probe().
|
static |
Admin event queue register offsets.
Definition at line 174 of file intelxlvf.c.
Referenced by intelxlvf_probe().
|
static |
Network device operations.
Definition at line 724 of file intelxlvf.c.
Referenced by intelxlvf_probe().
|
static |
struct pci_driver intelxlvf_driver __pci_driver |
PCI driver.
Definition at line 892 of file intelxlvf.c.