51 { .name =
"vmxnet3.vm_command" };
55 { .name =
"vmxnet3.vm_tx" };
59 { .name =
"vmxnet3.vm_refill" };
63 { .name =
"vmxnet3.vm_event" };
98 unsigned int desc_idx;
99 unsigned int generation;
104 DBGC ( vmxnet,
"VMXNET3 %p out of transmit descriptors\n",
147 unsigned int comp_idx;
148 unsigned int desc_idx;
149 unsigned int generation;
158 if ( generation != ( tx_comp->
flags &
171 DBGC ( vmxnet,
"VMXNET3 %p completed on empty transmit "
172 "buffer %#x/%#x\n", vmxnet, comp_idx, desc_idx );
181 DBGC2 ( vmxnet,
"VMXNET3 %p completed TX %#x/%#x (len %#zx)\n",
182 vmxnet, comp_idx, desc_idx,
iob_len ( iobuf ) );
215 unsigned int desc_idx;
216 unsigned int generation;
269 unsigned int comp_idx;
270 unsigned int desc_idx;
271 unsigned int generation;
281 if ( generation != ( rx_comp->
flags &
294 DBGC ( vmxnet,
"VMXNET3 %p completed on empty receive "
295 "buffer %#x/%#x\n", vmxnet, comp_idx, desc_idx );
307 DBGC2 ( vmxnet,
"VMXNET3 %p completed RX %#x/%#x (len %#zx)\n",
308 vmxnet, comp_idx, desc_idx,
len );
341 unsigned int link_speed;
345 link_up = (
state & 1 );
346 link_speed = (
state >> 16 );
350 DBGC ( vmxnet,
"VMXNET3 %p link is up at %d Mbps\n",
351 vmxnet, link_speed );
354 DBGC ( vmxnet,
"VMXNET3 %p link is down\n", vmxnet );
388 DBGC ( vmxnet,
"VMXNET3 %p queue error status (TX %08x, RX "
402 DBGC ( vmxnet,
"VMXNET3 %p unknown events %08x\n",
431 DBGC ( vmxnet,
"VMXNET3 %p %s IRQ not implemented\n",
432 vmxnet, ( enable ?
"enable" :
"disable" ) );
442 const void *ll_addr ) {
472 if ( ! vmxnet->
dma ) {
473 DBGC ( vmxnet,
"VMXNET3 %p could not allocate DMA area\n",
482 queues->tx.cfg.desc_address =
484 queues->tx.cfg.comp_address =
488 queues->rx.cfg.desc_address[0] =
490 queues->rx.cfg.comp_address =
495 DBGC ( vmxnet,
"VMXNET3 %p queue descriptors at %08llx+%zx\n",
496 vmxnet, queues_bus,
sizeof ( *
queues ) );
516 DBGC ( vmxnet,
"VMXNET3 %p shared area at %08llx+%zx\n",
517 vmxnet, shared_bus,
sizeof ( *shared ) );
532 DBGC ( vmxnet,
"VMXNET3 %p could not activate (status %#x)\n",
590 DBGC ( vmxnet,
"VMXNET3 %p is version %d (UPT version %d)\n",
591 vmxnet,
version, upt_version );
635 goto err_alloc_etherdev;
641 memset ( vmxnet, 0,
sizeof ( *vmxnet ) );
649 if ( ! vmxnet->
pt ) {
655 if ( ! vmxnet->
vd ) {
662 goto err_check_version;
673 DBGC ( vmxnet,
"VMXNET3 %p could not register net device: "
675 goto err_register_netdev;
715 PCI_ROM ( 0x15ad, 0x07b0,
"vmxnet3",
"vmxnet3 virtual NIC", 0 ),
#define NULL
NULL pointer (VOID *)
struct arbelprm_rc_send_wqe rc
unsigned long long uint64_t
#define assert(condition)
Assert a condition at run-time.
u32 version
Driver version.
uint32_t queues
Maximum number of low latency queues.
uint8_t mac[ETH_ALEN]
MAC address.
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
static struct net_device * netdev
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define EPIPE
Broken pipe.
#define ENOMEM
Not enough space.
#define EIO
Input/output error.
#define ECANCELED
Operation canceled.
#define ENOBUFS
No buffer space available.
#define ENODEV
No such device.
#define ENOTTY
Inappropriate I/O control operation.
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
#define cpu_to_le64(value)
#define le32_to_cpu(value)
#define cpu_to_le32(value)
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
void iounmap(volatile const void *io_addr)
Unmap I/O address.
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
#define __profiler
Declare a profiler.
static void profile_stop(struct profiler *profiler)
Stop profiling.
static void profile_start(struct profiler *profiler)
Start profiling.
static void profile_exclude(struct profiler *profiler)
Exclude time from other ongoing profiling results.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
void * memset(void *dest, int character, size_t len) __nonnull
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
#define iob_put(iobuf, len)
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
#define iob_reserve(iobuf, len)
void * malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
Dynamic memory allocation.
uint32_t high
High 32 bits of address.
uint32_t low
Low 16 bits of address.
void netdev_link_down(struct net_device *netdev)
Mark network device as having link down.
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
void netdev_tx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard transmitted packet.
void unregister_netdev(struct net_device *netdev)
Unregister network device.
void netdev_tx_complete_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Complete network transmission.
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
int register_netdev(struct net_device *netdev)
Register network device.
Network device management.
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
static void netdev_tx_complete(struct net_device *netdev, struct io_buffer *iobuf)
Complete network transmission.
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
unsigned long pci_bar_start(struct pci_device *pci, unsigned int reg)
Find the start of a PCI BAR.
#define __pci_driver
Declare a PCI driver.
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
#define PCI_ROM(_vendor, _device, _name, _description, _data)
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
char * strerror(int errno)
Retrieve string representation of error number.
void * data
Start of data.
Network device operations.
A PCI device ID list entry.
struct device dev
Generic device.
int(* probe)(struct pci_device *pci)
Probe device.
A data structure for storing profiling information.
unsigned int tx_prod
Transmit producer counter.
unsigned int tx_cons
Transmit completion consumer counter.
unsigned int rx_cons
Receive consumer counter.
unsigned int rx_fill
Receive fill level.
unsigned int rx_prod
Receive producer counter.
struct vmxnet3_queues queues
Queue descriptors.
struct vmxnet3_rx_desc rx_desc[VMXNET3_NUM_RX_DESC]
RX descriptor ring.
struct vmxnet3_tx_comp tx_comp[VMXNET3_NUM_TX_COMP]
TX completion ring.
struct vmxnet3_shared shared
Shared area.
struct vmxnet3_tx_desc tx_desc[VMXNET3_NUM_TX_DESC]
TX descriptor ring.
struct vmxnet3_rx_comp rx_comp[VMXNET3_NUM_RX_COMP]
RX completion ring.
uint8_t num_rx_queues
Number of RX queues.
uint32_t mtu
Maximum transmission unit.
uint32_t version
Driver version.
uint32_t queue_desc_len
Queue descriptors data length.
uint32_t version_support
Version supported.
uint8_t num_tx_queues
Number of TX queues.
uint64_t queue_desc_address
Queue descriptors data address.
uint32_t upt_version_support
UPT version supported.
void * pt
"PT" register base address
struct vmxnet3_counters count
Producer and consumer counters.
struct vmxnet3_dma * dma
DMA area.
void * vd
"VD" register base address
struct io_buffer * rx_iobuf[VMXNET3_NUM_RX_DESC]
Receive I/O buffers.
struct io_buffer * tx_iobuf[VMXNET3_NUM_TX_DESC]
Transmit I/O buffers.
struct vmxnet3_rx_queue rx
Receive queue descriptor(s)
struct vmxnet3_tx_queue tx
Transmit queue descriptor(s)
Receive completion descriptor.
uint32_t index
Descriptor index.
uint32_t mode
Receive filter mode.
struct vmxnet3_queue_status status
struct vmxnet3_rx_filter_config rx_filter
Receive filter configuration.
uint32_t magic
Magic signature.
struct vmxnet3_interrupt_config interrupt
Interrupt configuration.
uint32_t ecr
Event notifications.
struct vmxnet3_misc_config misc
Miscellaneous configuration.
Transmit completion descriptor.
uint32_t index
Index of the end-of-packet descriptor.
struct vmxnet3_queue_status status
static struct net_device_operations vmxnet3_operations
vmxnet3 net device operations
static void vmxnet3_flush_rx(struct net_device *netdev)
Flush any uncompleted receive buffers.
static struct pci_device_id vmxnet3_nics[]
vmxnet3 PCI IDs
static void vmxnet3_get_hw_addr(struct vmxnet3_nic *vmxnet, void *hw_addr)
Get permanent MAC address.
static int vmxnet3_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet.
static int vmxnet3_check_version(struct vmxnet3_nic *vmxnet)
Check version.
static void vmxnet3_remove(struct pci_device *pci)
Remove PCI device.
static void vmxnet3_close(struct net_device *netdev)
Close NIC.
static void vmxnet3_check_link(struct net_device *netdev)
Check link state.
static void vmxnet3_poll_rx(struct net_device *netdev)
Poll for received packets.
static void vmxnet3_irq(struct net_device *netdev, int enable)
Enable/disable interrupts.
static void vmxnet3_set_ll_addr(struct vmxnet3_nic *vmxnet, const void *ll_addr)
Set MAC address.
static void vmxnet3_refill_rx(struct net_device *netdev)
Refill receive ring.
static void vmxnet3_poll(struct net_device *netdev)
Poll network device.
static int vmxnet3_open(struct net_device *netdev)
Open NIC.
static void vmxnet3_poll_tx(struct net_device *netdev)
Poll for completed transmissions.
static void vmxnet3_poll_events(struct net_device *netdev)
Poll for events.
static int vmxnet3_probe(struct pci_device *pci)
Probe PCI device.
static void vmxnet3_flush_tx(struct net_device *netdev)
Flush any uncompleted transmit buffers.
VMware vmxnet3 virtual NIC driver.
#define VMXNET3_NUM_TX_DESC
Number of TX descriptors.
#define VMXNET3_VD_MACH
MAC Address High.
#define VMXNET3_MTU
MTU size.
#define VMXNET3_PT_RXPROD
Rx producer index for ring 1.
#define VMXNET3_VERSION_MAGIC
Driver version magic.
#define VMXNET3_UPT_VERSION_SELECT
UPT version that we support.
#define VMXNET3_VD_LEN
"VD" PCI BAR size
#define VMXNET3_VD_CMD
Command.
#define VMXNET3_NUM_TX_COMP
Number of TX completion descriptors.
#define VMXNET3_NUM_RX_COMP
Number of RX completion descriptors.
#define VMXNET3_TXF_EOP
Transmit end-of-packet flag.
#define VMXNET3_VD_MACL
MAC Address Low.
#define VMXNET3_PT_LEN
"PT" PCI BAR size
#define VMXNET3_VD_BAR
"VD" PCI BAR address
#define VMXNET3_SHARED_MAGIC
Driver shared area magic.
#define VMXNET3_PT_TXPROD
Transmit producer index.
#define VMXNET3_TX_FILL
Transmit ring maximum fill level.
#define VMXNET3_NUM_RX_DESC
Number of RX descriptors.
@ VMXNET3_CMD_GET_QUEUE_STATUS
@ VMXNET3_CMD_GET_PERM_MAC_HI
@ VMXNET3_CMD_ACTIVATE_DEV
@ VMXNET3_CMD_GET_PERM_MAC_LO
@ VMXNET3_CMD_QUIESCE_DEV
#define VMXNET3_RXCF_GEN
Receive completion generation flag.
#define VMXNET3_VD_UVRS
UPT Version Report Selection.
@ VMXNET3_RXM_UCAST
Unicast only.
@ VMXNET3_RXM_ALL_MULTI
All multicast.
@ VMXNET3_RXM_BCAST
Broadcast only.
#define VMXNET3_VERSION_SELECT
vmxnet3 version that we support
#define VMXNET3_DMA_ALIGN
DMA area alignment.
#define VMXNET3_TXF_GEN
Transmit generation flag.
#define VMXNET3_TXF_CQ
Transmit completion request flag.
#define VMXNET3_MAX_PACKET_LEN
Maximum packet size.
#define VMXNET3_VD_VRRS
vmxnet3 Revision Report Selection
#define VMXNET3_TXCF_GEN
Transmit completion generation flag.
#define VMXNET3_IC_DISABLE_ALL
Interrupt control - disable all interrupts.
#define VMXNET3_PT_BAR
"PT" PCI BAR address
#define VMXNET3_RXF_GEN
Receive generation flag.
#define VMXNET3_RX_FILL
Receive ring maximum fill level.
#define VMXNET3_VD_DSAL
Driver Shared Address Low.
#define VMXNET3_VD_ECR
Event Cause Register.
#define VMXNET3_VD_DSAH
Driver Shared Address High.
static struct xen_remove_from_physmap * remove