49 { .
name =
"vmxnet3.vm_command" };
53 { .
name =
"vmxnet3.vm_tx" };
57 { .
name =
"vmxnet3.vm_refill" };
61 { .
name =
"vmxnet3.vm_event" };
96 unsigned int desc_idx;
97 unsigned int generation;
102 DBGC ( vmxnet,
"VMXNET3 %p out of transmit descriptors\n",
145 unsigned int comp_idx;
146 unsigned int desc_idx;
147 unsigned int generation;
156 if ( generation != ( tx_comp->
flags &
169 DBGC ( vmxnet,
"VMXNET3 %p completed on empty transmit " 170 "buffer %#x/%#x\n", vmxnet, comp_idx, desc_idx );
179 DBGC2 ( vmxnet,
"VMXNET3 %p completed TX %#x/%#x (len %#zx)\n",
180 vmxnet, comp_idx, desc_idx,
iob_len ( iobuf ) );
213 unsigned int desc_idx;
214 unsigned int generation;
267 unsigned int comp_idx;
268 unsigned int desc_idx;
269 unsigned int generation;
279 if ( generation != ( rx_comp->
flags &
292 DBGC ( vmxnet,
"VMXNET3 %p completed on empty receive " 293 "buffer %#x/%#x\n", vmxnet, comp_idx, desc_idx );
305 DBGC2 ( vmxnet,
"VMXNET3 %p completed RX %#x/%#x (len %#zx)\n",
306 vmxnet, comp_idx, desc_idx,
len );
339 unsigned int link_speed;
343 link_up = (
state & 1 );
344 link_speed = (
state >> 16 );
348 DBGC ( vmxnet,
"VMXNET3 %p link is up at %d Mbps\n",
349 vmxnet, link_speed );
352 DBGC ( vmxnet,
"VMXNET3 %p link is down\n", vmxnet );
386 DBGC ( vmxnet,
"VMXNET3 %p queue error status (TX %08x, RX " 400 DBGC ( vmxnet,
"VMXNET3 %p unknown events %08x\n",
429 DBGC ( vmxnet,
"VMXNET3 %p %s IRQ not implemented\n",
430 vmxnet, ( enable ?
"enable" :
"disable" ) );
440 const void *ll_addr ) {
470 if ( ! vmxnet->
dma ) {
471 DBGC ( vmxnet,
"VMXNET3 %p could not allocate DMA area\n",
493 DBGC ( vmxnet,
"VMXNET3 %p queue descriptors at %08llx+%zx\n",
494 vmxnet, queues_bus,
sizeof ( *queues ) );
514 DBGC ( vmxnet,
"VMXNET3 %p shared area at %08llx+%zx\n",
515 vmxnet, shared_bus,
sizeof ( *shared ) );
530 DBGC ( vmxnet,
"VMXNET3 %p could not activate (status %#x)\n",
588 DBGC ( vmxnet,
"VMXNET3 %p is version %d (UPT version %d)\n",
589 vmxnet,
version, upt_version );
633 goto err_alloc_etherdev;
639 memset ( vmxnet, 0,
sizeof ( *vmxnet ) );
647 if ( ! vmxnet->
pt ) {
653 if ( ! vmxnet->
vd ) {
660 goto err_check_version;
671 DBGC ( vmxnet,
"VMXNET3 %p could not register net device: " 673 goto err_register_netdev;
713 PCI_ROM ( 0x15ad, 0x07b0,
"vmxnet3",
"vmxnet3 virtual NIC", 0 ),
static int vmxnet3_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet.
#define VMXNET3_RX_FILL
Receive ring maximum fill level.
struct vmxnet3_tx_queue_config cfg
struct vmxnet3_rx_queue_config cfg
#define VMXNET3_DMA_ALIGN
DMA area alignment.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
struct arbelprm_rc_send_wqe rc
static uint32_t vmxnet3_command(struct vmxnet3_nic *vmxnet, uint32_t command)
Issue command.
static void netdev_tx_complete(struct net_device *netdev, struct io_buffer *iobuf)
Complete network transmission.
uint32_t low
Low 16 bits of address.
#define VMXNET3_VD_DSAH
Driver Shared Address High.
#define iob_put(iobuf, len)
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
void * vd
"VD" register base address
uint32_t version_support
Version supported.
#define le32_to_cpu(value)
int(* open)(struct net_device *netdev)
Open network device.
static void vmxnet3_poll_events(struct net_device *netdev)
Poll for events.
void netdev_tx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard transmitted packet.
uint64_t desc_address
Descriptor ring address.
#define VMXNET3_PT_BAR
"PT" PCI BAR address
#define VMXNET3_VD_VRRS
vmxnet3 Revision Report Selection
struct pci_device_id * ids
PCI ID table.
struct vmxnet3_rx_comp rx_comp[VMXNET3_NUM_RX_COMP]
RX completion ring.
#define VMXNET3_PT_LEN
"PT" PCI BAR size
#define EPIPE
Broken pipe.
#define VMXNET3_MTU
MTU size.
uint32_t readl(volatile uint32_t *io_addr)
Read 32-bit dword from memory-mapped device.
uint8_t num_rx_queues
Number of RX queues.
struct vmxnet3_interrupt_config interrupt
Interrupt configuration.
unsigned int rx_fill
Receive fill level.
#define VMXNET3_TX_FILL
Transmit ring maximum fill level.
#define VMXNET3_NUM_TX_DESC
Number of TX descriptors.
static int vmxnet3_check_version(struct vmxnet3_nic *vmxnet)
Check version.
unsigned int tx_prod
Transmit producer counter.
unsigned long long uint64_t
static void *__malloc malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
static void vmxnet3_poll_rx(struct net_device *netdev)
Poll for received packets.
#define cpu_to_le64(value)
struct vmxnet3_dma * dma
DMA area.
void netdev_link_down(struct net_device *netdev)
Mark network device as having link down.
uint8_t mac[ETH_ALEN]
MAC address.
A data structure for storing profiling information.
#define VMXNET3_RXCF_GEN
Receive completion generation flag.
static void profile_stop(struct profiler *profiler)
Stop profiling.
#define VMXNET3_VERSION_SELECT
vmxnet3 version that we support
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
static void vmxnet3_flush_rx(struct net_device *netdev)
Flush any uncompleted receive buffers.
struct device dev
Generic device.
uint32_t num_desc
Number of descriptors.
#define ECANCELED
Operation canceled.
static void vmxnet3_poll_tx(struct net_device *netdev)
Poll for completed transmissions.
uint32_t index
Index of the end-of-packet descriptor.
Dynamic memory allocation.
#define VMXNET3_PT_RXPROD
Rx producer index for ring 1.
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
static struct pci_device_id vmxnet3_nics[]
vmxnet3 PCI IDs
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
#define ENOMEM
Not enough space.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
u32 version
Driver version.
static void vmxnet3_poll(struct net_device *netdev)
Poll network device.
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
uint32_t upt_version_support
UPT version supported.
uint32_t mtu
Maximum transmission unit.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
#define VMXNET3_NUM_TX_COMP
Number of TX completion descriptors.
static int vmxnet3_open(struct net_device *netdev)
Open NIC.
void * priv
Driver private data.
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
void writel(uint32_t data, volatile uint32_t *io_addr)
Write 32-bit dword to memory-mapped device.
static void vmxnet3_get_hw_addr(struct vmxnet3_nic *vmxnet, void *hw_addr)
Get permanent MAC address.
uint64_t queue_desc_address
Queue descriptors data address.
uint32_t queue_desc_len
Queue descriptors data length.
static struct net_device * netdev
struct pci_driver vmxnet3_driver __pci_driver
vmxnet3 PCI driver
struct io_buffer * tx_iobuf[VMXNET3_NUM_TX_DESC]
Transmit I/O buffers.
unsigned long pci_bar_start(struct pci_device *pci, unsigned int reg)
Find the start of a PCI BAR.
#define VMXNET3_UPT_VERSION_SELECT
UPT version that we support.
static void profile_start(struct profiler *profiler)
Start profiling.
#define VMXNET3_VD_MACL
MAC Address Low.
struct vmxnet3_queues queues
Queue descriptors.
#define VMXNET3_VD_UVRS
UPT Version Report Selection.
void unregister_netdev(struct net_device *netdev)
Unregister network device.
uint32_t num_desc[2]
Number of descriptors.
uint32_t mode
Receive filter mode.
#define cpu_to_le32(value)
static void vmxnet3_flush_tx(struct net_device *netdev)
Flush any uncompleted transmit buffers.
#define VMXNET3_MAX_PACKET_LEN
Maximum packet size.
struct vmxnet3_queue_status status
uint32_t high
High 32 bits of address.
struct vmxnet3_rx_filter_config rx_filter
Receive filter configuration.
#define VMXNET3_VERSION_MAGIC
Driver version magic.
char * strerror(int errno)
Retrieve string representation of error number.
#define VMXNET3_TXF_CQ
Transmit completion request flag.
#define VMXNET3_TXF_GEN
Transmit generation flag.
#define VMXNET3_IC_DISABLE_ALL
Interrupt control - disable all interrupts.
int register_netdev(struct net_device *netdev)
Register network device.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
#define VMXNET3_VD_LEN
"VD" PCI BAR size
#define ENODEV
No such device.
struct vmxnet3_queue_status status
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
uint32_t num_comp
Number of completion descriptors.
static int vmxnet3_probe(struct pci_device *pci)
Probe PCI device.
static void vmxnet3_refill_rx(struct net_device *netdev)
Refill receive ring.
A PCI device ID list entry.
static void vmxnet3_check_link(struct net_device *netdev)
Check link state.
uint64_t comp_address
Completion ring address.
#define VMXNET3_NUM_RX_COMP
Number of RX completion descriptors.
static struct xen_remove_from_physmap * remove
static void vmxnet3_irq(struct net_device *netdev, int enable)
Enable/disable interrupts.
struct vmxnet3_rx_queue rx
Receive queue descriptor(s)
Network device operations.
uint64_t desc_address[2]
Descriptor ring addresses.
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
struct device * dev
Underlying hardware device.
#define VMXNET3_RXF_GEN
Receive generation flag.
static struct profiler vmxnet3_vm_command_profiler __profiler
VM command profiler.
#define VMXNET3_VD_ECR
Event Cause Register.
unsigned int rx_cons
Receive consumer counter.
void * pt
"PT" register base address
Network device management.
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
static struct net_device_operations vmxnet3_operations
vmxnet3 net device operations
struct io_buffer * rx_iobuf[VMXNET3_NUM_RX_DESC]
Receive I/O buffers.
#define iob_reserve(iobuf, len)
struct vmxnet3_rx_desc rx_desc[VMXNET3_NUM_RX_DESC]
RX descriptor ring.
unsigned int rx_prod
Receive producer counter.
#define VMXNET3_TXCF_GEN
Transmit completion generation flag.
void netdev_tx_complete_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Complete network transmission.
struct vmxnet3_tx_queue tx
Transmit queue descriptor(s)
struct vmxnet3_misc_config misc
Miscellaneous configuration.
#define ENOBUFS
No buffer space available.
#define ENOTTY
Inappropriate I/O control operation.
static void vmxnet3_close(struct net_device *netdev)
Close NIC.
int(* probe)(struct pci_device *pci)
Probe device.
#define VMXNET3_TXF_EOP
Transmit end-of-packet flag.
uint32_t index
Descriptor index.
void * data
Start of data.
#define EIO
Input/output error.
#define VMXNET3_VD_MACH
MAC Address High.
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
#define VMXNET3_SHARED_MAGIC
Driver shared area magic.
uint8_t num_tx_queues
Number of TX queues.
unsigned int tx_cons
Transmit completion consumer counter.
void iounmap(volatile const void *io_addr)
Unmap I/O address.
VMware vmxnet3 virtual NIC driver.
struct vmxnet3_tx_comp tx_comp[VMXNET3_NUM_TX_COMP]
TX completion ring.
uint32_t magic
Magic signature.
static void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
static void vmxnet3_set_ll_addr(struct vmxnet3_nic *vmxnet, const void *ll_addr)
Set MAC address.
#define VMXNET3_VD_DSAL
Driver Shared Address Low.
static void profile_exclude(struct profiler *profiler)
Exclude time from other ongoing profiling results.
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
Transmit completion descriptor.
struct vmxnet3_tx_desc tx_desc[VMXNET3_NUM_TX_DESC]
TX descriptor ring.
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
struct vmxnet3_counters count
Producer and consumer counters.
#define VMXNET3_NUM_RX_DESC
Number of RX descriptors.
struct vmxnet3_shared shared
Shared area.
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
#define VMXNET3_PT_TXPROD
Transmit producer index.
#define NULL
NULL pointer (VOID *)
#define PCI_ROM(_vendor, _device, _name, _description, _data)
uint32_t ecr
Event notifications.
static void vmxnet3_remove(struct pci_device *pci)
Remove PCI device.
Receive completion descriptor.
uint32_t num_comp
Number of completion descriptors.
#define VMXNET3_VD_CMD
Command.
void * memset(void *dest, int character, size_t len) __nonnull
uint32_t version
Driver version.
uint64_t comp_address
Completion ring address.
#define VMXNET3_VD_BAR
"VD" PCI BAR address