|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
39 #include <sys/mount.h>
46 #define ETHER_MAX_LEN 1518
51 #define LINK_STATE_ELOGS 0
59 if (dev_info->speed_capa & ETH_LINK_SPEED_100G)
61 else if (dev_info->speed_capa & ETH_LINK_SPEED_56G)
63 else if (dev_info->speed_capa & ETH_LINK_SPEED_50G)
65 else if (dev_info->speed_capa & ETH_LINK_SPEED_40G)
67 else if (dev_info->speed_capa & ETH_LINK_SPEED_25G)
69 else if (dev_info->speed_capa & ETH_LINK_SPEED_20G)
71 else if (dev_info->speed_capa & ETH_LINK_SPEED_10G)
73 else if (dev_info->speed_capa & ETH_LINK_SPEED_5G)
75 else if (dev_info->speed_capa & ETH_LINK_SPEED_2_5G)
77 else if (dev_info->speed_capa & ETH_LINK_SPEED_1G)
88 case ETH_SPEED_NUM_1G:
90 case ETH_SPEED_NUM_2_5G:
92 case ETH_SPEED_NUM_5G:
94 case ETH_SPEED_NUM_10G:
96 case ETH_SPEED_NUM_20G:
98 case ETH_SPEED_NUM_25G:
100 case ETH_SPEED_NUM_40G:
102 case ETH_SPEED_NUM_50G:
104 case ETH_SPEED_NUM_56G:
106 case ETH_SPEED_NUM_100G:
118 u32 old = (xd->
flags & DPDK_DEVICE_FLAG_PROMISC) != 0;
124 xd->
flags &= ~DPDK_DEVICE_FLAG_PROMISC;
127 xd->
flags |= DPDK_DEVICE_FLAG_PROMISC;
130 xd->
port_conf.rxmode.max_rx_pkt_len =
hi->max_packet_bytes;
137 if (xd->
flags & DPDK_DEVICE_FLAG_ADMIN_UP)
139 if (xd->
flags & DPDK_DEVICE_FLAG_PROMISC)
140 rte_eth_promiscuous_enable (xd->
port_id);
142 rte_eth_promiscuous_disable (xd->
port_id);
151 return !(xd->
port_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC);
164 const char *sys_cache_dir =
"/sys/devices/system/cpu/cpu0/cache";
165 DIR *dir_cache = opendir (sys_cache_dir);
167 if (dir_cache == NULL)
170 while ((dp = readdir (dir_cache)) != NULL)
172 if (dp->d_type == DT_DIR)
175 int level_cache = -1;
177 p =
format (p,
"%s/%s/%s%c", sys_cache_dir, dp->d_name,
"level", 0);
181 if (level_cache == 3)
183 closedir (dir_cache);
189 if (dir_cache != NULL)
190 closedir (dir_cache);
198 xd->
port_conf.txmode.offloads |= DEV_TX_OFFLOAD_TCP_CKSUM;
199 xd->
port_conf.txmode.offloads |= DEV_TX_OFFLOAD_UDP_CKSUM;
200 xd->
flags |= DPDK_DEVICE_FLAG_TX_OFFLOAD |
201 DPDK_DEVICE_FLAG_INTEL_PHDR_CKSUM;
208 u32 mtu, max_rx_frame;
217 vlib_pci_addr_t last_pci_addr;
218 u32 last_pci_addr_port = 0;
219 u8 af_packet_instance_num = 0;
220 last_pci_addr.as_u32 = ~0;
222 nports = rte_eth_dev_count_avail ();
234 | VNET_BUFFER_F_L4_CHECKSUM_COMPUTED);
248 RTE_ETH_FOREACH_DEV(
i)
252 struct rte_eth_dev_info dev_info;
253 struct rte_pci_device *pci_dev;
254 struct rte_vmbus_device *vmbus_dev;
257 vlib_pci_addr_t pci_addr;
261 if (!rte_eth_dev_is_valid_port(
i))
264 rte_eth_dev_info_get (
i, &dev_info);
266 if (dev_info.device == 0)
269 dev_info.driver_name);
277 pci_addr.domain = pci_dev->addr.domain;
278 pci_addr.bus = pci_dev->addr.bus;
279 pci_addr.slot = pci_dev->addr.devid;
280 pci_addr.function = pci_dev->addr.function;
323 if (dev_info.switch_info.domain_id != RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID)
325 if (dev_info.switch_info.port_id != (uint16_t)-1)
330 ((next_port_id = rte_eth_find_next (
i + 1)) != RTE_MAX_ETHPORTS))
332 struct rte_eth_dev_info
di = { 0 };
333 struct rte_pci_device *next_pci_dev;
334 rte_eth_dev_info_get (next_port_id, &
di);
335 next_pci_dev =
di.device ? RTE_DEV_TO_PCI (
di.device) : 0;
337 pci_addr.as_u32 != last_pci_addr.as_u32 &&
338 memcmp (&pci_dev->addr, &next_pci_dev->addr,
339 sizeof (
struct rte_pci_addr)) == 0)
342 last_pci_addr.as_u32 = pci_addr.as_u32;
343 last_pci_addr_port =
i;
345 else if (pci_addr.as_u32 == last_pci_addr.as_u32)
348 format (0,
"%u",
i - last_pci_addr_port);
352 last_pci_addr.as_u32 = ~0;
356 last_pci_addr.as_u32 = ~0;
359 sizeof (
struct rte_eth_txconf));
361 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_IPV4_CKSUM)
363 xd->
port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_IPV4_CKSUM;
364 xd->
flags |= DPDK_DEVICE_FLAG_RX_IP4_CKSUM;
369 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_UDP_CKSUM)
370 xd->
port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_UDP_CKSUM;
371 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_CKSUM)
372 xd->
port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_TCP_CKSUM;
377 xd->
port_conf.txmode.offloads &= ~DEV_TX_OFFLOAD_MULTI_SEGS;
378 xd->
port_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
379 xd->
port_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_SCATTER;
383 xd->
port_conf.txmode.offloads |= DEV_TX_OFFLOAD_MULTI_SEGS;
384 xd->
port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
385 xd->
port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_SCATTER;
386 xd->
flags |= DPDK_DEVICE_FLAG_MAYBE_MULTISEG;
391 if (devconf->num_tx_queues > 0
392 && devconf->num_tx_queues < xd->
tx_q_used)
395 if (devconf->num_rx_queues > 1
396 && dev_info.max_rx_queues >= devconf->num_rx_queues)
399 xd->
port_conf.rxmode.mq_mode = ETH_MQ_RX_RSS;
400 if (devconf->rss_fn == 0)
401 xd->
port_conf.rx_adv_conf.rss_conf.rss_hf =
402 ETH_RSS_IP | ETH_RSS_UDP | ETH_RSS_TCP;
405 u64 unsupported_bits;
406 xd->
port_conf.rx_adv_conf.rss_conf.rss_hf = devconf->rss_fn;
407 unsupported_bits = xd->
port_conf.rx_adv_conf.rss_conf.rss_hf;
408 unsupported_bits &= ~dev_info.flow_type_rss_offloads;
409 if (unsupported_bits)
413 xd->
port_conf.rx_adv_conf.rss_conf.rss_hf &=
414 dev_info.flow_type_rss_offloads;
422 xd->
flags |= DPDK_DEVICE_FLAG_PMD;
425 if ((!dev_info.driver_name) && (pci_dev))
426 dev_info.driver_name = pci_dev->driver->driver.name;
428 ASSERT (dev_info.driver_name);
434 #define _(s,f) else if (dev_info.driver_name && \
435 !strcmp(dev_info.driver_name, s)) \
436 xd->pmd = VNET_DPDK_PMD_##f;
451 case VNET_DPDK_PMD_I40E:
452 xd->
flags |= DPDK_DEVICE_FLAG_INT_UNMASKABLE;
453 case VNET_DPDK_PMD_E1000EM:
454 case VNET_DPDK_PMD_IGB:
455 case VNET_DPDK_PMD_IXGBE:
456 case VNET_DPDK_PMD_ICE:
459 VNET_FLOW_ACTION_REDIRECT_TO_NODE |
460 VNET_FLOW_ACTION_REDIRECT_TO_QUEUE |
461 VNET_FLOW_ACTION_BUFFER_ADVANCE |
462 VNET_FLOW_ACTION_COUNT | VNET_FLOW_ACTION_DROP |
463 VNET_FLOW_ACTION_RSS;
467 xd->
port_conf.txmode.offloads |= DEV_TX_OFFLOAD_TCP_CKSUM;
468 xd->
port_conf.txmode.offloads |= DEV_TX_OFFLOAD_UDP_CKSUM;
470 DPDK_DEVICE_FLAG_TX_OFFLOAD |
471 DPDK_DEVICE_FLAG_INTEL_PHDR_CKSUM;
476 case VNET_DPDK_PMD_CXGBE:
477 case VNET_DPDK_PMD_MLX4:
478 case VNET_DPDK_PMD_MLX5:
479 case VNET_DPDK_PMD_QEDE:
480 case VNET_DPDK_PMD_BNXT:
485 case VNET_DPDK_PMD_I40EVF:
486 xd->
flags |= DPDK_DEVICE_FLAG_INT_UNMASKABLE;
487 case VNET_DPDK_PMD_IGBVF:
488 case VNET_DPDK_PMD_IXGBEVF:
492 xd->
port_conf.txmode.offloads |= DEV_TX_OFFLOAD_TCP_CKSUM;
493 xd->
port_conf.txmode.offloads |= DEV_TX_OFFLOAD_UDP_CKSUM;
495 DPDK_DEVICE_FLAG_TX_OFFLOAD |
496 DPDK_DEVICE_FLAG_INTEL_PHDR_CKSUM;
503 case VNET_DPDK_PMD_IAVF:
504 xd->
flags |= DPDK_DEVICE_FLAG_INT_UNMASKABLE;
507 VNET_FLOW_ACTION_MARK | VNET_FLOW_ACTION_REDIRECT_TO_NODE |
508 VNET_FLOW_ACTION_REDIRECT_TO_QUEUE |
509 VNET_FLOW_ACTION_BUFFER_ADVANCE | VNET_FLOW_ACTION_COUNT |
510 VNET_FLOW_ACTION_DROP | VNET_FLOW_ACTION_RSS;
514 xd->
port_conf.txmode.offloads |= DEV_TX_OFFLOAD_TCP_CKSUM;
515 xd->
port_conf.txmode.offloads |= DEV_TX_OFFLOAD_UDP_CKSUM;
517 DPDK_DEVICE_FLAG_TX_OFFLOAD |
518 DPDK_DEVICE_FLAG_INTEL_PHDR_CKSUM;
524 case VNET_DPDK_PMD_THUNDERX:
529 xd->
port_conf.txmode.offloads |= DEV_TX_OFFLOAD_TCP_CKSUM;
530 xd->
port_conf.txmode.offloads |= DEV_TX_OFFLOAD_UDP_CKSUM;
531 xd->
flags |= DPDK_DEVICE_FLAG_TX_OFFLOAD;
535 case VNET_DPDK_PMD_ENA:
537 xd->
port_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_SCATTER;
541 case VNET_DPDK_PMD_DPAA2:
546 case VNET_DPDK_PMD_ENIC:
548 struct rte_eth_link l;
549 rte_eth_link_get_nowait (
i, &l);
557 case VNET_DPDK_PMD_FM10K:
562 case VNET_DPDK_PMD_VIRTIO:
563 xd->
port_conf.rxmode.mq_mode = ETH_MQ_RX_NONE;
570 case VNET_DPDK_PMD_VMXNET3:
572 xd->
port_conf.txmode.offloads |= DEV_TX_OFFLOAD_MULTI_SEGS;
575 case VNET_DPDK_PMD_AF_PACKET:
580 case VNET_DPDK_PMD_VIRTIO_USER:
584 case VNET_DPDK_PMD_VHOST_ETHER:
588 case VNET_DPDK_PMD_LIOVF_ETHER:
592 case VNET_DPDK_PMD_FAILSAFE:
597 case VNET_DPDK_PMD_NETVSC:
599 struct rte_eth_link l;
600 rte_eth_link_get_nowait (
i, &l);
609 if (devconf->num_rx_desc)
622 if (devconf->num_tx_desc)
636 if (xd->
pmd == VNET_DPDK_PMD_AF_PACKET)
647 rte_eth_macaddr_get (
i, (
void *)
addr);
675 max_rx_frame = dev_info.max_rx_pktlen;
716 if (xd->
pmd == VNET_DPDK_PMD_FAILSAFE)
723 if (!rte_eth_dev_get_mtu (
i, &dev_mtu))
736 xd->
port_conf.rxmode.max_rx_pkt_len = max_rx_frame;
771 hi->max_packet_bytes = mtu;
772 hi->max_supported_packet_bytes = max_rx_frame;
783 if (xd->
flags & DPDK_DEVICE_FLAG_TX_OFFLOAD &&
hi != NULL)
798 DEV_TX_OFFLOAD_TCP_TSO | DEV_TX_OFFLOAD_UDP_TSO;
801 clib_warning (
"%s: TCP/UDP checksum offload must be enabled",
818 dpdk_log_err (
"setup failed for device %U. Errors:\n %U",
847 vlan_off = rte_eth_dev_get_vlan_offload (xd->
port_id);
850 vlan_off |= ETH_VLAN_STRIP_OFFLOAD;
851 if (rte_eth_dev_set_vlan_offload (xd->
port_id, vlan_off) >= 0)
854 dpdk_log_warn (
"VLAN strip cannot be supported by interface\n");
855 xd->
port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_STRIP;
859 if (vlan_off & ETH_VLAN_STRIP_OFFLOAD)
861 vlan_off &= ~ETH_VLAN_STRIP_OFFLOAD;
862 if (rte_eth_dev_set_vlan_offload (xd->
port_id, vlan_off) >= 0)
865 xd->
port_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP;
869 hi->max_packet_bytes = xd->
port_conf.rxmode.max_rx_pkt_len
877 rte_eth_dev_set_mtu (xd->
port_id, mtu);
893 vlib_pci_addr_t *
addr = 0, *addrs;
1035 dpdk_log_warn (
"Unsupported PCI device 0x%04x:0x%04x found "
1076 if (num_whitelisted)
1143 uword *max_simd_bitwidth = va_arg (*va,
uword *);
1147 if (!
unformat (input,
"%u", max_simd_bitwidth))
1176 ((vlib_pci_addr_t *) (
addr))->as_u32);
1182 ((vlib_pci_addr_t *) (
addr))->as_u32,
1187 "duplicate configuration for PCI address %U",
1203 0,
"duplicate configuration for VMBUS address %U",
1209 devconf->
pci_addr.as_u32 = ((vlib_pci_addr_t *) (
addr))->as_u32;
1226 if (
unformat (input,
"num-rx-queues %u", &devconf->num_rx_queues))
1228 else if (
unformat (input,
"num-tx-queues %u", &devconf->num_tx_queues))
1230 else if (
unformat (input,
"num-rx-desc %u", &devconf->num_rx_desc))
1232 else if (
unformat (input,
"num-tx-desc %u", &devconf->num_tx_desc))
1247 else if (
unformat (input,
"vlan-strip-offload off"))
1249 else if (
unformat (input,
"vlan-strip-offload on"))
1251 else if (
unformat (input,
"tso on"))
1255 else if (
unformat (input,
"tso off"))
1261 else if (
unformat (input,
"rss-queues %U",
1275 if (devconf->
workers && devconf->num_rx_queues == 0)
1279 devconf->num_rx_queues)
1281 "%U: number of worker threads must be "
1282 "equal to number of rx queues",
1302 if (n < 0 && errno != EAGAIN)
1304 _vec_len (s) =
len + (n < 0 ? 0 : n);
1326 vlib_pci_addr_t pci_addr = { 0 };
1329 uword default_hugepage_sz, x;
1332 int num_whitelisted = 0;
1333 int eal_no_hugetlb = 0;
1338 u8 *huge_dir_path = 0;
1351 if (
unformat (input,
"no-hugetlb"))
1356 else if (
unformat (input,
"telemetry"))
1359 else if (
unformat (input,
"enable-tcp-udp-checksum"))
1362 else if (
unformat (input,
"no-tx-checksum-offload"))
1365 else if (
unformat (input,
"decimal-interface-names"))
1368 else if (
unformat (input,
"no-multi-seg"))
1370 else if (
unformat (input,
"max-simd-bitwidth %U",
1429 else if (
unformat (input,
"num-crypto-mbufs %d",
1434 else if (
unformat (input,
"socket-mem %s", &socket_mem))
1436 else if (
unformat (input,
"no-pci"))
1449 (input,
"blacklist %x:%x:%x.%x", &
domain, &
bus, &device, &func))
1457 else if (
unformat (input,
"blacklist %x:%x", &vendor, &device))
1459 u32 blacklist_entry;
1460 if (vendor > 0xFFFF)
1462 if (device > 0xFFFF)
1464 blacklist_entry = (vendor << 16) | (device & 0xffff);
1468 else if (
unformat (input,
"no-vmbus"))
1476 else if (unformat(input, #a)) \
1478 tmp = format (0, "--%s%c", #a, 0); \
1479 vec_add1 (conf->eal_init_args, tmp); \
1484 else if (unformat(input, #a " %s", &s)) \
1486 if (!strncmp(#a, "file-prefix", 11)) \
1488 tmp = format (0, "--%s%c", #a, 0); \
1489 vec_add1 (conf->eal_init_args, tmp); \
1491 if (!strncmp(#a, "vdev", 4)) \
1492 if (strstr((char*)s, "af_packet")) \
1493 clib_warning ("af_packet obsoleted. Use CLI 'create host-interface'."); \
1494 vec_add1 (conf->eal_init_args, s); \
1499 else if (unformat(input, #a " %s", &s)) \
1501 tmp = format (0, "-%s%c", #b, 0); \
1502 vec_add1 (conf->eal_init_args, tmp); \
1504 vec_add1 (conf->eal_init_args, s); \
1509 else if (unformat(input, #a " %s", &s)) \
1511 tmp = format (0, "-%s%c", #b, 0); \
1512 vec_add1 (conf->eal_init_args, tmp); \
1514 vec_add1 (conf->eal_init_args, s); \
1515 conf->a##_set_manually = 1; \
1519 else if (
unformat (input,
"default"))
1535 if (eal_no_hugetlb == 0)
1549 n_pages /= default_hugepage_sz;
1578 uword *coremask = 0;
1606 if (no_pci == 0 && geteuid () == 0)
1609 if (no_vmbus == 0 && geteuid () == 0)
1613 if (devconf->x == 0 && conf->default_devconf.x > 0) \
1614 devconf->x = conf->default_devconf.x ;
1623 _ (vlan_strip_offload)
1680 int log_fds[2] = { 0 };
1681 if (pipe (log_fds) == 0)
1683 if (fcntl (log_fds[1], F_SETFL, O_NONBLOCK) == 0)
1685 FILE *
f = fdopen (log_fds[1],
"a");
1686 if (
f && rte_openlog_stream (
f) == 0)
1716 if (clib_cpu_supports_avx512_bitalg () &&
1718 rte_vect_set_max_simd_bitwidth (RTE_VECT_SIMD_512);
1726 umount2 ((
char *) huge_dir_path, MNT_DETACH);
1727 rmdir ((
char *) huge_dir_path);
1747 struct rte_eth_link prev_link = xd->
link;
1749 u8 hw_flags_chg = 0;
1752 if ((xd->
flags & DPDK_DEVICE_FLAG_PMD) == 0)
1764 "update-link-state: sw_if_index %d, admin_up %d,"
1765 "old link_state %d new link_state %d",.format_args =
"i4i1i1i1",};
1776 ed->admin_up = (xd->
flags & DPDK_DEVICE_FLAG_ADMIN_UP) != 0;
1777 ed->old_link_state = (
u8)
1779 ed->new_link_state = (
u8) xd->
link.link_status;
1782 if ((xd->
link.link_duplex != prev_link.link_duplex))
1785 switch (xd->
link.link_duplex)
1787 case ETH_LINK_HALF_DUPLEX:
1790 case ETH_LINK_FULL_DUPLEX:
1797 if (xd->
link.link_speed != prev_link.link_speed)
1799 xd->
link.link_speed * 1000);
1801 if (xd->
link.link_status != prev_link.link_status)
1805 if (xd->
link.link_status)
1816 "update-link-state: sw_if_index %d, new flags %d",.format_args
1826 ed->flags = hw_flags;
1896 .name =
"dpdk-process",
1897 .process_log2_n_stack_bytes = 17,
1909 "Cache line marker must be 1st element in dpdk_device_t");
1912 "Data in cache line 0 is bigger than cache line size");
1914 "Cache line marker must be 1st element in frame_queue_trace_t");
1916 "DPDK RTE CACHE LINE SIZE does not match with 1<<CLIB_LOG2_CACHE_LINE_BYTES");
1929 VLIB_BUFFER_EXT_HDR_VALID |
1930 VNET_BUFFER_F_L4_CHECKSUM_COMPUTED |
1931 VNET_BUFFER_F_L4_CHECKSUM_CORRECT);
u8 nchannels_set_manually
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
format_function_t format_dpdk_device_errors
@ VNET_DPDK_PORT_TYPE_VIRTIO_USER
#define ETHERNET_INTERFACE_FLAG_DEFAULT_L3
#define DPDK_MAX_SIMD_BITWIDTH_DEFAULT
static uword dpdk_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
static int check_l3cache()
vlib_pci_addr_t * vlib_pci_get_all_dev_addrs()
#define VNET_HW_IF_RXQ_THREAD_ANY
vnet_device_main_t vnet_device_main
u32 supported_flow_actions
vlib_vmbus_addr_t vmbus_addr
clib_file_main_t file_main
clib_error_t * dpdk_cryptodev_init(vlib_main_t *vm)
void dpdk_update_link_state(dpdk_device_t *xd, f64 now)
@ VNET_DPDK_PORT_TYPE_UNKNOWN
static clib_error_t * dpdk_config(vlib_main_t *vm, unformat_input_t *input)
#define DPDK_NB_RX_DESC_VIRTIO
u8 interface_name_format_decimal
u32 buffer_flags_template
#define clib_memcpy(d, s, n)
clib_error_t * vnet_hw_interface_set_rss_queues(vnet_main_t *vnm, vnet_hw_interface_t *hi, clib_bitmap_t *bitmap)
@ VNET_HW_INTERFACE_CAP_SUPPORTS_MAC_FILTER
struct rte_pci_device * dpdk_get_pci_device(const struct rte_eth_dev_info *info)
u32 ethernet_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
#define dpdk_log_notice(...)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
#define foreach_eal_double_hyphen_predicate_arg
vlib_node_registration_t dpdk_input_node
(constructor) VLIB_REGISTER_NODE (dpdk_input_node)
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
void dpdk_cli_reference(void)
#define ETHER_MAX_LEN
Maximum frame len, including CRC.
#define clib_error_return(e, args...)
clib_file_function_t * read_function
#define vlib_log_warn(...)
#define DPDK_DEVICE_TSO_DEFAULT
f64 time_last_link_update
unformat_function_t unformat_vlib_pci_addr
static uword * mhash_get(mhash_t *h, const void *key)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
clib_error_t * clib_sysfs_prealloc_hugepages(int numa_node, int log2_page_size, int nr)
static void dpdk_bind_devices_to_uio(dpdk_config_main_t *conf)
f64 time_last_stats_update
@ VNET_HW_INTERFACE_FLAG_LINK_UP
#define DPDK_MAX_SIMD_BITWIDTH_512
void dpdk_device_setup(dpdk_device_t *xd)
uword unformat_max_simd_bitwidth(unformat_input_t *input, va_list *va)
uword * cpu_socket_bitmap
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)
#define clib_error_report(e)
static clib_error_t * dpdk_lib_init(dpdk_main_t *dm)
uword * device_config_index_by_pci_addr
#define VIRTIO_PCI_LEGACY_DEVICEID_NET
__clib_export void mhash_init(mhash_t *h, uword n_value_bytes, uword n_key_bytes)
#define hash_create(elts, value_bytes)
format_function_t format_vlib_vmbus_addr
volatile u32 worker_thread_release
vnet_device_class_t dpdk_device_class
dpdk_port_type_t port_type
vlib_log_class_t log_ipsec
__clib_export u8 * format_clib_error(u8 *s, va_list *va)
#define dpdk_log_info(...)
@ VNET_DPDK_PORT_TYPE_ETH_10G
static u32 random_u32(u32 *seed)
32-bit random number generator
@ VNET_DPDK_PORT_TYPE_ETH_40G
vlib_vmbus_addr_t * blacklist_by_vmbus_addr
@ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM
#define VLIB_CONFIG_FUNCTION(x, n,...)
#define foreach_eal_single_hyphen_mandatory_arg
#define hash_set(h, key, value)
dpdk_config_main_t dpdk_config_main
static clib_error_t * dpdk_log_read_ready(clib_file_t *uf)
__clib_export clib_error_t * clib_sysfs_read(char *file_name, char *fmt,...)
static uword round_pow2(uword x, uword pow2)
#define DPDK_DEVICE_TSO_ON
#define foreach_eal_double_hyphen_arg
#define pool_foreach(VAR, POOL)
Iterate through pool.
u32 per_interface_next_index
@ VNET_HW_INTERFACE_FLAG_FULL_DUPLEX
static dpdk_port_type_t port_type_from_speed_capa(struct rte_eth_dev_info *dev_info)
@ VNET_DPDK_PORT_TYPE_ETH_1G
static int dpdk_port_crc_strip_enabled(dpdk_device_t *xd)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define ELOG_TYPE_DECLARE(f)
#define DPDK_NB_TX_DESC_VIRTIO
struct rte_vmbus_device * dpdk_get_vmbus_device(const struct rte_eth_dev_info *info)
static uword * clib_bitmap_or(uword *ai, uword *bi)
Logical operator across two bitmaps.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
@ VNET_DPDK_PORT_TYPE_ETH_5G
#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)
u8 no_tx_checksum_offload
static uword clib_bitmap_count_set_bits(uword *ai)
Return the number of set bits in a bitmap.
@ VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO
@ VNET_HW_INTERFACE_CAP_SUPPORTS_UDP_GSO
#define foreach_eal_single_hyphen_arg
struct rte_eth_conf port_conf
vlib_global_main_t vlib_global_main
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
#define dpdk_log_warn(...)
#define clib_bitmap_free(v)
Free a bitmap.
dpdk_per_thread_data_t * per_thread_data
void vnet_hw_if_update_runtime_data(vnet_main_t *vnm, u32 hw_if_index)
static char * vlib_unix_get_runtime_dir(void)
struct rte_eth_txconf tx_conf
@ VNET_DPDK_PORT_TYPE_AF_PACKET
#define foreach_dpdk_device_config_item
sll srl srl sll sra u16x4 i
#define ETHERNET_INTERFACE_FLAG_MTU
#define DPDK_DEVICE_TSO_OFF
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
@ VNET_DPDK_PORT_TYPE_ETH_25G
clib_error_t * unformat_rss_fn(unformat_input_t *input, uword *rss_fn)
vlib_pci_device_info_t * vlib_pci_get_device_info(vlib_main_t *vm, vlib_pci_addr_t *addr, clib_error_t **error)
static void dpdk_enable_l4_csum_offload(dpdk_device_t *xd)
dpdk_config_main_t * conf
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap.
static u32 dpdk_flag_change(vnet_main_t *vnm, vnet_hw_interface_t *hi, u32 flags)
#define STATIC_ASSERT(truth,...)
#define CLIB_CACHE_LINE_BYTES
@ VNET_DPDK_PORT_TYPE_ETH_50G
uword unformat_vlib_cli_sub_input(unformat_input_t *i, va_list *args)
struct _vlib_node_registration vlib_node_registration_t
#define DPDK_LINK_POLL_INTERVAL
format_function_t format_dpdk_rss_hf_name
clib_bitmap_t * rss_queues
#define vec_add2_aligned(V, P, N, A)
Add N elements to end of vector V, return pointer to new elements in P.
u16 af_packet_instance_num
static void dpdk_bind_vmbus_devices_to_uio(dpdk_config_main_t *conf)
@ VNET_DPDK_PORT_TYPE_ETH_56G
uword first_worker_thread_index
vlib_vmbus_addr_t * vlib_vmbus_get_all_dev_addrs()
#define vec_free(V)
Free vector's memory (no header).
#define dpdk_log_err(...)
vlib_thread_registration_t ** registrations
@ VNET_DPDK_PORT_TYPE_VHOST_ETHER
format_function_t format_vlib_pci_addr
static f64 vlib_process_wait_for_event_or_clock(vlib_main_t *vm, f64 dt)
Suspend a cooperative multi-tasking thread Waits for an event, or for the indicated number of seconds...
description fragment has unexpected format
vlib_log_class_t log_default
u8 admin_up_down_in_progress
static vnet_sw_interface_t * vnet_get_hw_sw_interface(vnet_main_t *vnm, u32 hw_if_index)
#define DPDK_NB_TX_DESC_DEFAULT
#define VLIB_INIT_FUNCTION(x)
dpdk_device_config_t * dev_confs
#define CLIB_LOG2_CACHE_LINE_BYTES
@ VNET_DPDK_PORT_TYPE_ETH_20G
#define DPDK_DEVICE_VLAN_STRIP_OFF
#define vec_foreach(var, vec)
Vector iterator.
u8 * interface_name_suffix
#define clib_error_return_unix(e, args...)
@ PCI_CLASS_NETWORK_ETHERNET
foreach_dpdk_device_config_item clib_bitmap_t * workers
static uword clib_file_add(clib_file_main_t *um, clib_file_t *template)
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V,...
@ VNET_DPDK_PORT_TYPE_FAILSAFE
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
f64 link_state_poll_interval
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)
mhash_t device_config_index_by_vmbus_addr
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
vnet_interface_output_runtime_t * rt
@ VNET_DPDK_PORT_TYPE_ETH_2_5G
#define VIRTIO_PCI_MODERN_DEVICEID_NET
@ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_IP4_CKSUM
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
vlib_log_class_t log_cryptodev
#define ETHERNET_INTERFACE_FLAG_ACCEPT_ALL
#define vec_terminate_c_string(V)
(If necessary) NULL terminate a vector containing a c-string.
#define ETHERNET_MAX_PACKET_BYTES
@ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM
#define DPDK_DEVICE_VLAN_STRIP_ON
@ VNET_DPDK_PORT_TYPE_ETH_100G
#define clib_warning(format, args...)
#define clib_error_free(e)
__clib_export u8 * format_bitmap_hex(u8 *s, va_list *args)
Format a bitmap as a string of hex bytes.
static dpdk_port_type_t port_type_from_link_speed(u32 link_speed)
@ VNET_DPDK_PORT_TYPE_ETH_VF
__clib_export uword clib_mem_get_default_hugepage_size(void)
dpdk_device_config_t default_devconf
#define DPDK_NB_RX_DESC_DEFAULT
dpdk_device_addr_type_t dev_addr_type
static f64 vlib_time_now(vlib_main_t *vm)
@ VNET_HW_INTERFACE_FLAG_HALF_DUPLEX
@ VNET_DPDK_PORT_TYPE_ETH_SWITCH
#define clib_bitmap_foreach(i, ai)
Macro to iterate across set bits in a bitmap.
#define DPDK_MAX_SIMD_BITWIDTH_256
#define VNET_HW_INTERFACE_CAP_SUPPORTS_TX_CKSUM
static void vlib_pci_free_device_info(vlib_pci_device_info_t *di)
static void dpdk_update_counters(dpdk_device_t *xd, f64 now)
u8 enable_tcp_udp_checksum
static vlib_thread_main_t * vlib_get_thread_main()
static uword vnet_hw_interface_is_link_up(vnet_main_t *vnm, u32 hw_if_index)
clib_error_t * vlib_vmbus_bind_to_uio(vlib_vmbus_addr_t *addr)
vl_api_interface_index_t sw_if_index
format_function_t format_dpdk_device_name
u32 * blacklist_by_pci_vendor_and_device
clib_error_t * dpdk_buffer_pools_create(vlib_main_t *vm)
__clib_export uword unformat_bitmap_list(unformat_input_t *input, va_list *va)
unformat a list of bit ranges into a bitmap (eg "0-3,5-7,11" )
#define vec_insert(V, N, M)
Insert N vector elements starting at element M, initialize new elements to zero (no header,...
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)
static vlib_node_registration_t dpdk_process_node
(constructor) VLIB_REGISTER_NODE (dpdk_process_node)
static uword mhash_set(mhash_t *h, void *key, uword new_value, uword *old_value)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
#define DPDK_STATS_POLL_INTERVAL
dpdk_rx_queue_t * rx_queues
vlib_buffer_t buffer_template
static clib_error_t * dpdk_init(vlib_main_t *vm)
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)
unformat_function_t unformat_vlib_vmbus_addr
static clib_error_t * dpdk_device_config(dpdk_config_main_t *conf, void *addr, dpdk_device_addr_type_t addr_type, unformat_input_t *input, u8 is_default)
vl_api_wireguard_peer_flags_t flags