|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
21 #include <vpp/app/version.h>
26 #define PCI_VENDOR_ID_VMWARE 0x15ad
27 #define PCI_DEVICE_ID_VMWARE_VMXNET3 0x07b0
47 if (vd->
flags & VMXNET3_DEVICE_F_ERROR)
54 vd->
flags |= VMXNET3_DEVICE_F_ADMIN_UP;
59 vd->
flags &= ~VMXNET3_DEVICE_F_ADMIN_UP;
151 .name =
"VMXNET3 interface",
185 vmxnet3_shared *shared;
205 tx->cfg.num_desc = txq->
size;
206 tx->cfg.num_comp = txq->
size;
218 rx->cfg.num_desc[rid] = rxq->
size;
221 rx->cfg.num_comp = rxq->
size;
222 rx->cfg.intr_index = qid;
229 if (
sizeof (
void *) == 4)
235 shared->misc.upt_features = VMXNET3_F_RXCSUM;
237 shared->misc.upt_features |= VMXNET3_F_LRO;
240 shared->misc.upt_features |= VMXNET3_F_RSS;
241 shared->rss.version = 1;
243 shared->rss.length =
sizeof (*vd->
rss);
245 shared->misc.max_num_rx_sg = 0;
248 shared->misc.queue_desc_len =
sizeof (*tx) * vd->
num_tx_queues +
253 shared->interrupt.num_intrs = vd->
num_intrs;
256 shared->rx_filter.mode = VMXNET3_RXMODE_UCAST | VMXNET3_RXMODE_BCAST |
257 VMXNET3_RXMODE_ALL_MULTI | VMXNET3_RXMODE_PROMISC;
292 vmxnet3_rx_stats *rxs;
339 vmxnet3_tx_stats *txs;
377 0x3b, 0x56, 0xd1, 0x56, 0x13, 0x4a, 0xe7, 0xac,
378 0xe8, 0x79, 0x09, 0x75, 0xe8, 0x65, 0x79, 0x28,
379 0x35, 0x12, 0xb9, 0x56, 0x7c, 0x76, 0x4b, 0x70,
380 0xd8, 0x56, 0xa3, 0x18, 0x9b, 0x0a, 0xee, 0xf3,
381 0x96, 0xa6, 0x9f, 0x8f, 0x9e, 0x8c, 0x90, 0xc9,
387 vmxnet3_rss_shared *rss;
388 size_t size =
sizeof (*rss);
398 VMXNET3_RSS_HASH_TYPE_IPV4 | VMXNET3_RSS_HASH_TYPE_TCP_IPV4 |
399 VMXNET3_RSS_HASH_TYPE_IPV6 | VMXNET3_RSS_HASH_TYPE_TCP_IPV6;
404 for (
i = 0;
i < rss->ind_table_sz;
i++)
468 "GSO is not supported because hardware version"
469 " is %u. It must be >= 3", vd->
version);
478 vd->
flags |= VMXNET3_DEVICE_F_LINK_UP;
482 vd->
flags &= ~VMXNET3_DEVICE_F_LINK_UP;
573 vd->
flags |= VMXNET3_DEVICE_F_LINK_UP;
582 vd->
flags &= ~VMXNET3_DEVICE_F_LINK_UP;
590 if (qsz < 64 || qsz > 4096)
632 args->
rv = VNET_API_ERROR_INVALID_VALUE;
644 args->
rv = VNET_API_ERROR_INVALID_VALUE;
647 "number of tx queues must be <= %u and <= number of "
651 "number of tx queues must be <= %u and <= number of "
663 args->
rv = VNET_API_ERROR_INVALID_VALUE;
666 "queue size must be <= 4096, >= 64, "
667 "and multiples of 64");
670 "queue size must be <= 4096, >= 64, and multiples of 64");
678 args->
rv = VNET_API_ERROR_ADDRESS_IN_USE;
681 &args->
addr,
"pci address in use");
694 args->
rv = VNET_API_ERROR_INVALID_INTERFACE;
698 "error encountered on binding pci device");
701 "error encountered on binding pci devicee");
709 args->
rv = VNET_API_ERROR_INVALID_INTERFACE;
713 "error encountered on pci device open");
716 "error encountered on pci device open");
732 vd->
flags |= VMXNET3_DEVICE_F_ELOG;
759 if (num_intr < vd->num_rx_queues + 1)
762 "No sufficient interrupt lines (%u) for rx queues",
766 "No sufficient interrupt lines (%u) for rx queues",
774 "error encountered on pci register msix handler 0");
782 "error encountered on pci register msix handler 1");
812 "error encountered on ethernet register interface");
869 vd->
flags |= VMXNET3_DEVICE_F_INITIALIZED;
874 if (vd->
flags & VMXNET3_DEVICE_F_LINK_UP)
883 args->
rv = VNET_API_ERROR_INVALID_INTERFACE;
949 while (desc_idx != end_idx)
vmxnet3_main_t vmxnet3_main
static void clib_spinlock_init(clib_spinlock_t *p)
void vlib_pci_set_private_data(vlib_main_t *vm, vlib_pci_dev_handle_t h, uword private_data)
#define VNET_HW_IF_RXQ_THREAD_ANY
#define foreach_vmxnet3_tx_func_error
#define VMXNET3_GOS_BITS_32
static_always_inline clib_error_t * vmxnet3_rxq_refill_ring1(vlib_main_t *vm, vmxnet3_device_t *vd, vmxnet3_rxq_t *rxq)
format_function_t format_vmxnet3_device_name
void vmxnet3_create_if(vlib_main_t *vm, vmxnet3_create_if_args_t *args)
static_always_inline uword vmxnet3_dma_addr(vlib_main_t *vm, vmxnet3_device_t *vd, void *p)
#define VMXNET3_NUM_TX_DESC
static clib_error_t * vmxnet3_interface_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
vnet_hw_interface_capabilities_t caps
vlib_pci_dev_handle_t pci_dev_handle
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
#define clib_memcpy(d, s, n)
static_always_inline clib_error_t * vmxnet3_rxq_refill_ring0(vlib_main_t *vm, vmxnet3_device_t *vd, vmxnet3_rxq_t *rxq)
static_always_inline u32 vmxnet3_reg_read(vmxnet3_device_t *vd, u8 bar, u32 addr)
static_always_inline u8 vnet_hw_if_get_rx_queue_numa_node(vnet_main_t *vnm, u32 queue_index)
u32 vlib_pci_get_numa_node(vlib_main_t *vm, vlib_pci_dev_handle_t h)
vmxnet3_tx_comp * tx_comp
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
#define VMXNET3_REG_TXPROD
static void vmxnet3_event_irq_handler(vlib_main_t *vm, vlib_pci_dev_handle_t h, u16 line)
#define count_leading_zeros(x)
vmxnet3_tx_stats * tx_stats
static clib_error_t * vmxnet3_rss_init(vlib_main_t *vm, vmxnet3_device_t *vd)
#define clib_error_return(e, args...)
u32 vlib_pci_dev_handle_t
clib_error_t * vlib_pci_enable_msix_irq(vlib_main_t *vm, vlib_pci_dev_handle_t h, u16 start, u16 count)
static_always_inline void vmxnet3_reg_write(vmxnet3_device_t *vd, u8 bar, u32 addr, u32 val)
void vnet_hw_if_tx_queue_assign_thread(vnet_main_t *vnm, u32 queue_index, u32 thread_index)
#define VMXNET3_RSS_MAX_KEY_SZ
vl_api_tunnel_mode_t mode
static void vlib_physmem_free(vlib_main_t *vm, void *p)
@ VNET_SW_INTERFACE_FLAG_ADMIN_UP
#define pool_put(P, E)
Free an object E in pool P.
@ VNET_HW_IF_RX_MODE_POLLING
static clib_error_t * vmxnet3_interface_rx_mode_change(vnet_main_t *vnm, u32 hw_if_index, u32 qid, vnet_hw_if_rx_mode mode)
static pci_device_id_t vmxnet3_pci_device_ids[]
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
#define VMXNET3_RX_START(vd)
@ VNET_HW_INTERFACE_FLAG_LINK_UP
clib_error_t * vlib_pci_register_msix_handler(vlib_main_t *vm, vlib_pci_dev_handle_t h, u32 start, u32 count, pci_msix_handler_function_t *msix_handler)
clib_error_t * vlib_pci_bind_to_uio(vlib_main_t *vm, vlib_pci_addr_t *addr, char *uio_drv_name)
static void vnet_hw_interface_set_link_speed(vnet_main_t *vnm, u32 hw_if_index, u32 link_speed)
static clib_error_t * vmxnet3_rxq_init(vlib_main_t *vm, vmxnet3_device_t *vd, u16 qid, u16 qsz)
clib_error_t * vlib_pci_map_region(vlib_main_t *vm, vlib_pci_dev_handle_t h, u32 resource, void **result)
static void vmxnet3_set_interface_next_node(vnet_main_t *vnm, u32 hw_if_index, u32 node_index)
static clib_error_t * vlib_pci_intr_enable(vlib_main_t *vm, vlib_pci_dev_handle_t h)
@ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM
static clib_error_t * vlib_pci_bus_master_enable(vlib_main_t *vm, vlib_pci_dev_handle_t h)
static void vlib_buffer_free_from_ring(vlib_main_t *vm, u32 *ring, u32 start, u32 ring_size, u32 n_buffers)
Free buffers from ring.
#define pool_foreach(VAR, POOL)
Iterate through pool.
uword vlib_pci_get_private_data(vlib_main_t *vm, vlib_pci_dev_handle_t h)
static void vmxnet3_rxq_irq_handler(vlib_main_t *vm, vlib_pci_dev_handle_t h, u16 line)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
format_function_t format_vnet_hw_if_rx_mode
static void vmxnet3_write_mac(vmxnet3_device_t *vd)
#define VMXNET3_GOS_BITS_64
#define VMXNET3_IC_DISABLE_ALL
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
vnet_main_t * vnet_get_main(void)
static void vmxnet3_clear_hw_interface_counters(u32 instance)
@ VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO
#define VMXNET3_UPT_VERSION_SELECT
static const u8 vmxnet3_rss_key[VMXNET3_RSS_MAX_KEY_SZ]
#define VMXNET3_VERSION_SELECT
vlib_log_class_t log_default
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
vmxnet3_tx_comp_ring tx_comp_ring
#define vec_foreach_index(var, v)
Iterate over vector indices.
void vnet_hw_if_update_runtime_data(vnet_main_t *vnm, u32 hw_if_index)
vmxnet3_rx_comp_ring rx_comp_ring
vmxnet3_shared * driver_shared
static clib_error_t * vmxnet3_device_init(vlib_main_t *vm, vmxnet3_device_t *vd, vmxnet3_create_if_args_t *args)
@ VNET_HW_IF_RX_MODE_INTERRUPT
vmxnet3_per_thread_data_t * per_thread_data
static u8 vmxnet3_queue_size_valid(u16 qsz)
#define VMXNET3_GOS_TYPE_LINUX
static void clib_spinlock_free(clib_spinlock_t *p)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
static_always_inline void vnet_hw_if_rx_queue_set_int_pending(vnet_main_t *vnm, u32 queue_index)
#define VMXNET3_RSS_HASH_FUNC_TOEPLITZ
#define CLIB_CACHE_LINE_BYTES
u32 vlib_pci_get_num_msix_interrupts(vlib_main_t *vm, vlib_pci_dev_handle_t h)
void vnet_hw_if_set_rx_queue_file_index(vnet_main_t *vnm, u32 queue_index, u32 file_index)
vmxnet3_rx_comp * rx_comp
static void vmxnet3_disable_interrupt(vmxnet3_device_t *vd)
static clib_error_t * vmxnet3_provision_driver_shared(vlib_main_t *vm, vmxnet3_device_t *vd)
format_function_t format_vmxnet3_device
static void vmxnet3_enable_interrupt(vmxnet3_device_t *vd)
#define VMXNET3_RX_RING_SIZE
#define VMXNET3_SHARED_MAGIC
#define vec_free(V)
Free vector's memory (no header).
VNET_DEVICE_CLASS(vmxnet3_device_class,)
u32 per_interface_next_index
format_function_t format_vlib_pci_addr
#define VMXNET3_RSS_MAX_IND_TABLE_SZ
static vnet_sw_interface_t * vnet_get_hw_sw_interface(vnet_main_t *vnm, u32 hw_if_index)
void ethernet_delete_interface(vnet_main_t *vnm, u32 hw_if_index)
#define VMXNET3_VERSION_MAGIC
static void vlib_buffer_free_no_next(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Free buffers, does not free the buffer chain for each buffer.
static u8 vmxnet3_rx_queue_num_valid(u16 num)
static u8 vmxnet3_tx_queue_num_valid(u16 num)
vmxnet3_rx_ring rx_ring[VMXNET3_RX_RING_SIZE]
#define VMXNET3_NUM_RX_DESC
vmxnet3_rx_stats * rx_stats
static u32 vmxnet3_flag_change(vnet_main_t *vnm, vnet_hw_interface_t *hw, u32 flags)
#define PCI_DEVICE_ID_VMWARE_VMXNET3
#define vmxnet3_log_error(dev, f,...)
void vlib_log(vlib_log_level_t level, vlib_log_class_t class, char *fmt,...)
#define PCI_VENDOR_ID_VMWARE
static clib_error_t * vlib_physmem_last_error(struct vlib_main_t *vm)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static u32 vlib_get_n_threads()
u32 vnet_hw_if_register_rx_queue(vnet_main_t *vnm, u32 hw_if_index, u32 queue_id, u32 thread_index)
static vlib_main_t * vlib_get_main(void)
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
uword vlib_pci_get_msix_file_index(vlib_main_t *vm, vlib_pci_dev_handle_t h, u16 index)
@ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM
static void * vlib_physmem_alloc_aligned_on_numa(vlib_main_t *vm, uword n_bytes, uword alignment, u32 numa_node)
vmxnet3_tx_desc * tx_desc
clib_error_t * vlib_pci_device_open(vlib_main_t *vm, vlib_pci_addr_t *addr, pci_device_id_t ids[], vlib_pci_dev_handle_t *handle)
@ VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE
#define clib_error_free(e)
void vmxnet3_delete_if(vlib_main_t *vm, vmxnet3_device_t *vd)
static char * vmxnet3_tx_func_error_strings[]
void vlib_pci_device_close(vlib_main_t *vm, vlib_pci_dev_handle_t h)
static clib_error_t * vmxnet3_txq_init(vlib_main_t *vm, vmxnet3_device_t *vd, u16 qid, u16 qsz)
static_always_inline u32 vnet_hw_if_get_rx_queue_thread_index(vnet_main_t *vnm, u32 queue_index)
u32 vnet_hw_if_register_tx_queue(vnet_main_t *vnm, u32 hw_if_index, u32 queue_id)
static vlib_thread_main_t * vlib_get_thread_main()
vmxnet3_device_t * devices
clib_error_t * ethernet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, const u8 *address, u32 *hw_if_index_return, ethernet_flag_change_function_t flag_change)
void vnet_hw_if_set_input_node(vnet_main_t *vnm, u32 hw_if_index, u32 node_index)
#define VMXNET3_TX_START(vd)
vmxnet3_rx_desc * rx_desc[VMXNET3_RX_RING_SIZE]
vnet_device_class_t vmxnet3_device_class
vl_api_wireguard_peer_flags_t flags