|
iPXE
|
VMware vmxnet3 virtual NIC driver. More...
#include <stdint.h>#include <string.h>#include <errno.h>#include <assert.h>#include <byteswap.h>#include <ipxe/pci.h>#include <ipxe/io.h>#include <ipxe/malloc.h>#include <ipxe/profile.h>#include <ipxe/iobuf.h>#include <ipxe/netdevice.h>#include <ipxe/if_ether.h>#include <ipxe/ethernet.h>#include "vmxnet3.h"Go to the source code of this file.
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| static uint32_t | vmxnet3_command (struct vmxnet3_nic *vmxnet, uint32_t command) |
| Issue command. More... | |
| static int | vmxnet3_transmit (struct net_device *netdev, struct io_buffer *iobuf) |
| Transmit packet. More... | |
| static void | vmxnet3_poll_tx (struct net_device *netdev) |
| Poll for completed transmissions. More... | |
| static void | vmxnet3_flush_tx (struct net_device *netdev) |
| Flush any uncompleted transmit buffers. More... | |
| static void | vmxnet3_refill_rx (struct net_device *netdev) |
| Refill receive ring. More... | |
| static void | vmxnet3_poll_rx (struct net_device *netdev) |
| Poll for received packets. More... | |
| static void | vmxnet3_flush_rx (struct net_device *netdev) |
| Flush any uncompleted receive buffers. More... | |
| static void | vmxnet3_check_link (struct net_device *netdev) |
| Check link state. More... | |
| static void | vmxnet3_poll_events (struct net_device *netdev) |
| Poll for events. More... | |
| static void | vmxnet3_poll (struct net_device *netdev) |
| Poll network device. More... | |
| static void | vmxnet3_irq (struct net_device *netdev, int enable) |
| Enable/disable interrupts. More... | |
| static void | vmxnet3_set_ll_addr (struct vmxnet3_nic *vmxnet, const void *ll_addr) |
| Set MAC address. More... | |
| static int | vmxnet3_open (struct net_device *netdev) |
| Open NIC. More... | |
| static void | vmxnet3_close (struct net_device *netdev) |
| Close NIC. More... | |
| static int | vmxnet3_check_version (struct vmxnet3_nic *vmxnet) |
| Check version. More... | |
| static void | vmxnet3_get_hw_addr (struct vmxnet3_nic *vmxnet, void *hw_addr) |
| Get permanent MAC address. More... | |
| static int | vmxnet3_probe (struct pci_device *pci) |
| Probe PCI device. More... | |
| static void | vmxnet3_remove (struct pci_device *pci) |
| Remove PCI device. More... | |
Variables | |
| static struct profiler vmxnet3_vm_command_profiler | __profiler |
| VM command profiler. More... | |
| static struct net_device_operations | vmxnet3_operations |
| vmxnet3 net device operations More... | |
| static struct pci_device_id | vmxnet3_nics [] |
| vmxnet3 PCI IDs More... | |
| struct pci_driver vmxnet3_driver | __pci_driver |
| vmxnet3 PCI driver More... | |
VMware vmxnet3 virtual NIC driver.
Definition in file vmxnet3.c.
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
inlinestatic |
Issue command.
| vmxnet | vmxnet3 NIC |
| command | Command to issue |
| result | Command result |
Definition at line 71 of file vmxnet3.c.
References profile_exclude(), profile_start(), profile_stop(), readl(), result, vmxnet3_nic::vd, VMXNET3_VD_CMD, and writel().
Referenced by vmxnet3_check_link(), vmxnet3_close(), vmxnet3_open(), and vmxnet3_poll_events().
|
static |
Transmit packet.
| netdev | Network device |
| iobuf | I/O buffer |
| rc | Return status code |
Definition at line 92 of file vmxnet3.c.
References assert(), vmxnet3_nic::count, cpu_to_le32, cpu_to_le64, io_buffer::data, DBGC, vmxnet3_nic::dma, ENOBUFS, fill, iob_len(), netdev, NULL, net_device::priv, profile_exclude(), profile_start(), profile_stop(), vmxnet3_nic::pt, vmxnet3_counters::tx_cons, vmxnet3_dma::tx_desc, vmxnet3_nic::tx_iobuf, vmxnet3_counters::tx_prod, virt_to_bus(), VMXNET3_NUM_TX_DESC, VMXNET3_PT_TXPROD, VMXNET3_TX_FILL, VMXNET3_TXF_CQ, VMXNET3_TXF_EOP, VMXNET3_TXF_GEN, wmb(), and writel().
|
static |
Poll for completed transmissions.
| netdev | Network device |
Definition at line 142 of file vmxnet3.c.
References vmxnet3_nic::count, cpu_to_le32, DBGC, DBGC2, vmxnet3_nic::dma, ENOTTY, vmxnet3_tx_comp::flags, vmxnet3_tx_comp::index, iob_len(), le32_to_cpu, netdev, netdev_tx_complete(), netdev_tx_err(), NULL, net_device::priv, vmxnet3_dma::tx_comp, vmxnet3_counters::tx_cons, vmxnet3_nic::tx_iobuf, VMXNET3_NUM_TX_COMP, VMXNET3_NUM_TX_DESC, and VMXNET3_TXCF_GEN.
Referenced by vmxnet3_poll().
|
static |
Flush any uncompleted transmit buffers.
| netdev | Network device |
Definition at line 191 of file vmxnet3.c.
References ECANCELED, netdev, netdev_tx_complete_err(), NULL, net_device::priv, vmxnet3_nic::tx_iobuf, and VMXNET3_NUM_TX_DESC.
Referenced by vmxnet3_close(), and vmxnet3_open().
|
static |
Refill receive ring.
| netdev | Network device |
Definition at line 209 of file vmxnet3.c.
References alloc_iob(), assert(), vmxnet3_nic::count, cpu_to_le32, cpu_to_le64, io_buffer::data, vmxnet3_nic::dma, iob_reserve, NET_IP_ALIGN, netdev, NULL, net_device::priv, profile_exclude(), profile_start(), profile_stop(), vmxnet3_nic::pt, vmxnet3_dma::rx_desc, vmxnet3_counters::rx_fill, vmxnet3_nic::rx_iobuf, vmxnet3_counters::rx_prod, virt_to_bus(), VMXNET3_MTU, VMXNET3_NUM_RX_DESC, VMXNET3_PT_RXPROD, VMXNET3_RX_FILL, VMXNET3_RXF_GEN, wmb(), and writel().
Referenced by vmxnet3_open(), and vmxnet3_poll().
|
static |
Poll for received packets.
| netdev | Network device |
Definition at line 264 of file vmxnet3.c.
References vmxnet3_nic::count, cpu_to_le32, DBGC, DBGC2, vmxnet3_nic::dma, ENOTTY, vmxnet3_rx_comp::flags, vmxnet3_rx_comp::index, iob_put, le32_to_cpu, len, vmxnet3_rx_comp::len, netdev, netdev_rx(), netdev_rx_err(), NULL, net_device::priv, vmxnet3_dma::rx_comp, vmxnet3_counters::rx_cons, vmxnet3_counters::rx_fill, vmxnet3_nic::rx_iobuf, VMXNET3_MAX_PACKET_LEN, VMXNET3_NUM_RX_COMP, VMXNET3_NUM_RX_DESC, and VMXNET3_RXCF_GEN.
Referenced by vmxnet3_poll().
|
static |
Flush any uncompleted receive buffers.
| netdev | Network device |
Definition at line 318 of file vmxnet3.c.
References ECANCELED, netdev, netdev_rx_err(), NULL, net_device::priv, vmxnet3_nic::rx_iobuf, and VMXNET3_NUM_RX_DESC.
Referenced by vmxnet3_close(), and vmxnet3_open().
|
static |
Check link state.
| netdev | Network device |
Definition at line 336 of file vmxnet3.c.
References DBGC, netdev, netdev_link_down(), netdev_link_up(), net_device::priv, state, VMXNET3_CMD_GET_LINK, and vmxnet3_command().
Referenced by vmxnet3_poll_events(), and vmxnet3_probe().
|
static |
Poll for events.
| netdev | Network device |
Definition at line 363 of file vmxnet3.c.
References DBGC, vmxnet3_nic::dma, vmxnet3_shared::ecr, ENODEV, EPIPE, vmxnet3_queue_status::error, le32_to_cpu, netdev, netdev_rx_err(), netdev_tx_err(), NULL, net_device::priv, profile_exclude(), profile_start(), profile_stop(), vmxnet3_dma::queues, vmxnet3_queues::rx, vmxnet3_dma::shared, vmxnet3_tx_queue::status, vmxnet3_rx_queue::status, vmxnet3_queues::tx, vmxnet3_nic::vd, vmxnet3_check_link(), VMXNET3_CMD_GET_QUEUE_STATUS, vmxnet3_command(), VMXNET3_ECR_LINK, VMXNET3_ECR_RQERR, VMXNET3_ECR_TQERR, VMXNET3_VD_ECR, and writel().
Referenced by vmxnet3_poll().
|
static |
Poll network device.
| netdev | Network device |
Definition at line 413 of file vmxnet3.c.
References netdev, vmxnet3_poll_events(), vmxnet3_poll_rx(), vmxnet3_poll_tx(), and vmxnet3_refill_rx().
|
static |
Enable/disable interrupts.
| netdev | Network device |
| enable | Interrupts should be enabled |
Definition at line 427 of file vmxnet3.c.
References DBGC, netdev, and net_device::priv.
|
static |
Set MAC address.
| vmxnet | vmxnet3 NIC |
| ll_addr | Link-layer address to set |
Definition at line 440 of file vmxnet3.c.
References __attribute__, cpu_to_le32, ETH_ALEN, high, low, mac, memcpy(), memset(), vmxnet3_nic::vd, VMXNET3_VD_MACH, VMXNET3_VD_MACL, and writel().
Referenced by vmxnet3_open().
|
static |
Open NIC.
| netdev | Network device |
| rc | Return status code |
Definition at line 459 of file vmxnet3.c.
References vmxnet3_interrupt_config::control, vmxnet3_nic::count, cpu_to_le32, cpu_to_le64, DBGC, vmxnet3_nic::dma, EIO, ENOMEM, free_phys(), vmxnet3_shared::interrupt, net_device::ll_addr, vmxnet3_shared::magic, malloc_phys(), memset(), vmxnet3_shared::misc, vmxnet3_rx_filter_config::mode, vmxnet3_misc_config::mtu, netdev, vmxnet3_interrupt_config::num_intrs, vmxnet3_misc_config::num_rx_queues, vmxnet3_misc_config::num_tx_queues, net_device::priv, vmxnet3_misc_config::queue_desc_address, vmxnet3_misc_config::queue_desc_len, queues, vmxnet3_dma::queues, rc, vmxnet3_dma::rx_comp, vmxnet3_dma::rx_desc, vmxnet3_shared::rx_filter, vmxnet3_dma::shared, status, vmxnet3_dma::tx_comp, vmxnet3_dma::tx_desc, vmxnet3_misc_config::upt_version_support, vmxnet3_nic::vd, vmxnet3_misc_config::version, vmxnet3_misc_config::version_support, virt_to_bus(), VMXNET3_CMD_ACTIVATE_DEV, VMXNET3_CMD_QUIESCE_DEV, VMXNET3_CMD_RESET_DEV, vmxnet3_command(), VMXNET3_DMA_ALIGN, vmxnet3_flush_rx(), vmxnet3_flush_tx(), VMXNET3_IC_DISABLE_ALL, VMXNET3_MTU, VMXNET3_NUM_RX_COMP, VMXNET3_NUM_RX_DESC, VMXNET3_NUM_TX_COMP, VMXNET3_NUM_TX_DESC, vmxnet3_refill_rx(), VMXNET3_RXM_ALL_MULTI, VMXNET3_RXM_BCAST, VMXNET3_RXM_UCAST, vmxnet3_set_ll_addr(), VMXNET3_SHARED_MAGIC, VMXNET3_UPT_VERSION_SELECT, VMXNET3_VD_DSAH, VMXNET3_VD_DSAL, VMXNET3_VERSION_MAGIC, VMXNET3_VERSION_SELECT, and writel().
|
static |
Close NIC.
| netdev | Network device |
Definition at line 557 of file vmxnet3.c.
References vmxnet3_nic::dma, free_phys(), netdev, net_device::priv, VMXNET3_CMD_QUIESCE_DEV, VMXNET3_CMD_RESET_DEV, vmxnet3_command(), vmxnet3_flush_rx(), and vmxnet3_flush_tx().
|
static |
Check version.
| vmxnet | vmxnet3 NIC |
| rc | Return status code |
Definition at line 582 of file vmxnet3.c.
References DBGC, readl(), vmxnet3_nic::vd, version, VMXNET3_UPT_VERSION_SELECT, VMXNET3_VD_UVRS, VMXNET3_VD_VRRS, VMXNET3_VERSION_SELECT, and writel().
Referenced by vmxnet3_probe().
|
static |
Get permanent MAC address.
| vmxnet | vmxnet3 NIC |
| hw_addr | Hardware address to fill in |
Definition at line 605 of file vmxnet3.c.
References __attribute__, ETH_ALEN, high, le32_to_cpu, low, mac, memcpy(), VMXNET3_CMD_GET_PERM_MAC_HI, and VMXNET3_CMD_GET_PERM_MAC_LO.
Referenced by vmxnet3_probe().
|
static |
Probe PCI device.
| pci | PCI device |
| id | PCI ID |
| rc | Return status code |
Definition at line 625 of file vmxnet3.c.
References adjust_pci_device(), alloc_etherdev(), DBGC, pci_device::dev, net_device::dev, ENODEV, ENOMEM, net_device::hw_addr, iounmap(), memset(), netdev, netdev_init(), netdev_nullify(), netdev_put(), pci_bar_start(), pci_ioremap(), pci_set_drvdata(), net_device::priv, vmxnet3_nic::pt, rc, register_netdev(), strerror(), unregister_netdev(), vmxnet3_nic::vd, vmxnet3_check_link(), vmxnet3_check_version(), VMXNET3_CMD_RESET_DEV, vmxnet3_get_hw_addr(), vmxnet3_operations, VMXNET3_PT_BAR, VMXNET3_PT_LEN, VMXNET3_VD_BAR, and VMXNET3_VD_LEN.
|
static |
Remove PCI device.
| pci | PCI device |
Definition at line 701 of file vmxnet3.c.
References iounmap(), netdev, netdev_nullify(), netdev_put(), pci_get_drvdata(), net_device::priv, vmxnet3_nic::pt, unregister_netdev(), and vmxnet3_nic::vd.
|
static |
|
static |
vmxnet3 net device operations
Definition at line 568 of file vmxnet3.c.
Referenced by vmxnet3_probe().
|
static |
| struct pci_driver vmxnet3_driver __pci_driver |
vmxnet3 PCI driver
1.8.15