36 #include <sys/mount.h> 43 #define ETHER_MAX_LEN 1518 48 #define LINK_STATE_ELOGS 0 56 if (dev_info->speed_capa & ETH_LINK_SPEED_100G)
58 else if (dev_info->speed_capa & ETH_LINK_SPEED_56G)
60 else if (dev_info->speed_capa & ETH_LINK_SPEED_50G)
62 else if (dev_info->speed_capa & ETH_LINK_SPEED_40G)
64 else if (dev_info->speed_capa & ETH_LINK_SPEED_25G)
66 else if (dev_info->speed_capa & ETH_LINK_SPEED_20G)
68 else if (dev_info->speed_capa & ETH_LINK_SPEED_10G)
70 else if (dev_info->speed_capa & ETH_LINK_SPEED_5G)
72 else if (dev_info->speed_capa & ETH_LINK_SPEED_2_5G)
74 else if (dev_info->speed_capa & ETH_LINK_SPEED_1G)
85 case ETH_SPEED_NUM_1G:
87 case ETH_SPEED_NUM_2_5G:
89 case ETH_SPEED_NUM_5G:
91 case ETH_SPEED_NUM_10G:
93 case ETH_SPEED_NUM_20G:
95 case ETH_SPEED_NUM_25G:
97 case ETH_SPEED_NUM_40G:
99 case ETH_SPEED_NUM_50G:
101 case ETH_SPEED_NUM_56G:
103 case ETH_SPEED_NUM_100G:
119 old = (xd->
flags & DPDK_DEVICE_FLAG_PROMISC) != 0;
122 xd->
flags |= DPDK_DEVICE_FLAG_PROMISC;
124 xd->
flags &= ~DPDK_DEVICE_FLAG_PROMISC;
126 if (xd->
flags & DPDK_DEVICE_FLAG_ADMIN_UP)
128 if (xd->
flags & DPDK_DEVICE_FLAG_PROMISC)
129 rte_eth_promiscuous_enable (xd->
port_id);
131 rte_eth_promiscuous_disable (xd->
port_id);
158 return !(xd->
port_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC);
171 const char *sys_cache_dir =
"/sys/devices/system/cpu/cpu0/cache";
172 DIR *dir_cache = opendir (sys_cache_dir);
174 if (dir_cache ==
NULL)
177 while ((dp = readdir (dir_cache)) !=
NULL)
179 if (dp->d_type == DT_DIR)
182 int level_cache = -1;
184 p =
format (p,
"%s/%s/%s%c", sys_cache_dir, dp->d_name,
"level", 0);
188 if (level_cache == 3)
190 closedir (dir_cache);
196 if (dir_cache !=
NULL)
197 closedir (dir_cache);
205 xd->
port_conf.txmode.offloads |= DEV_TX_OFFLOAD_TCP_CKSUM;
206 xd->
port_conf.txmode.offloads |= DEV_TX_OFFLOAD_UDP_CKSUM;
207 xd->
flags |= DPDK_DEVICE_FLAG_TX_OFFLOAD |
208 DPDK_DEVICE_FLAG_INTEL_PHDR_CKSUM;
215 u32 mtu, max_rx_frame;
224 vlib_pci_addr_t last_pci_addr;
225 u32 last_pci_addr_port = 0;
229 u32 next_hqos_cpu = 0;
230 u8 af_packet_instance_num = 0;
231 last_pci_addr.as_u32 = ~0;
240 if (tr_hqos && tr_hqos->
count > 0)
249 nports = rte_eth_dev_count_avail ();
261 | VNET_BUFFER_F_L4_CHECKSUM_COMPUTED);
275 RTE_ETH_FOREACH_DEV(i)
279 struct rte_eth_dev_info dev_info;
280 struct rte_pci_device *pci_dev;
281 struct rte_eth_link l;
284 vlib_pci_addr_t pci_addr;
287 if (!rte_eth_dev_is_valid_port(i))
290 rte_eth_link_get_nowait (i, &l);
291 rte_eth_dev_info_get (i, &dev_info);
293 if (dev_info.device == 0)
296 dev_info.driver_name);
304 pci_addr.domain = pci_dev->addr.domain;
305 pci_addr.bus = pci_dev->addr.bus;
306 pci_addr.slot = pci_dev->addr.devid;
307 pci_addr.function = pci_dev->addr.function;
329 ((next_port_id = rte_eth_find_next (i + 1)) != RTE_MAX_ETHPORTS))
331 struct rte_eth_dev_info di = { 0 };
332 struct rte_pci_device *next_pci_dev;
333 rte_eth_dev_info_get (next_port_id, &di);
334 next_pci_dev = di.device ? RTE_DEV_TO_PCI (di.device) : 0;
336 pci_addr.as_u32 != last_pci_addr.as_u32 &&
337 memcmp (&pci_dev->addr, &next_pci_dev->addr,
338 sizeof (
struct rte_pci_addr)) == 0)
341 last_pci_addr.as_u32 = pci_addr.as_u32;
342 last_pci_addr_port =
i;
344 else if (pci_addr.as_u32 == last_pci_addr.as_u32)
347 format (0,
"%u", i - last_pci_addr_port);
351 last_pci_addr.as_u32 = ~0;
355 last_pci_addr.as_u32 = ~0;
358 sizeof (
struct rte_eth_txconf));
360 if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_IPV4_CKSUM)
362 xd->
port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_IPV4_CKSUM;
363 xd->
flags |= DPDK_DEVICE_FLAG_RX_IP4_CKSUM;
368 xd->
port_conf.txmode.offloads &= ~DEV_TX_OFFLOAD_MULTI_SEGS;
369 xd->
port_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
370 xd->
port_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_SCATTER;
374 xd->
port_conf.txmode.offloads |= DEV_TX_OFFLOAD_MULTI_SEGS;
375 xd->
port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
376 xd->
port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_SCATTER;
377 xd->
flags |= DPDK_DEVICE_FLAG_MAYBE_MULTISEG;
382 if (devconf->num_tx_queues > 0
383 && devconf->num_tx_queues < xd->
tx_q_used)
386 if (devconf->num_rx_queues > 1
387 && dev_info.max_rx_queues >= devconf->num_rx_queues)
390 xd->
port_conf.rxmode.mq_mode = ETH_MQ_RX_RSS;
391 if (devconf->rss_fn == 0)
392 xd->
port_conf.rx_adv_conf.rss_conf.rss_hf =
393 ETH_RSS_IP | ETH_RSS_UDP | ETH_RSS_TCP;
396 u64 unsupported_bits;
397 xd->
port_conf.rx_adv_conf.rss_conf.rss_hf = devconf->rss_fn;
398 unsupported_bits = xd->
port_conf.rx_adv_conf.rss_conf.rss_hf;
399 unsupported_bits &= ~dev_info.flow_type_rss_offloads;
400 if (unsupported_bits)
404 xd->
port_conf.rx_adv_conf.rss_conf.rss_hf &=
405 dev_info.flow_type_rss_offloads;
410 xd->
flags |= DPDK_DEVICE_FLAG_PMD;
413 if ((!dev_info.driver_name) && (pci_dev))
414 dev_info.driver_name = pci_dev->driver->driver.name;
416 ASSERT (dev_info.driver_name);
422 #define _(s,f) else if (dev_info.driver_name && \ 423 !strcmp(dev_info.driver_name, s)) \ 424 xd->pmd = VNET_DPDK_PMD_##f; 439 case VNET_DPDK_PMD_E1000EM:
440 case VNET_DPDK_PMD_IGB:
441 case VNET_DPDK_PMD_IXGBE:
442 case VNET_DPDK_PMD_I40E:
443 case VNET_DPDK_PMD_ICE:
446 VNET_FLOW_ACTION_REDIRECT_TO_NODE |
447 VNET_FLOW_ACTION_REDIRECT_TO_QUEUE |
448 VNET_FLOW_ACTION_BUFFER_ADVANCE |
449 VNET_FLOW_ACTION_COUNT | VNET_FLOW_ACTION_DROP;
453 xd->
port_conf.txmode.offloads |= DEV_TX_OFFLOAD_TCP_CKSUM;
454 xd->
port_conf.txmode.offloads |= DEV_TX_OFFLOAD_UDP_CKSUM;
456 DPDK_DEVICE_FLAG_TX_OFFLOAD |
457 DPDK_DEVICE_FLAG_INTEL_PHDR_CKSUM;
462 case VNET_DPDK_PMD_CXGBE:
463 case VNET_DPDK_PMD_MLX4:
464 case VNET_DPDK_PMD_MLX5:
465 case VNET_DPDK_PMD_QEDE:
466 case VNET_DPDK_PMD_BNXT:
471 case VNET_DPDK_PMD_IGBVF:
472 case VNET_DPDK_PMD_IXGBEVF:
473 case VNET_DPDK_PMD_I40EVF:
477 xd->
port_conf.txmode.offloads |= DEV_TX_OFFLOAD_TCP_CKSUM;
478 xd->
port_conf.txmode.offloads |= DEV_TX_OFFLOAD_UDP_CKSUM;
480 DPDK_DEVICE_FLAG_TX_OFFLOAD |
481 DPDK_DEVICE_FLAG_INTEL_PHDR_CKSUM;
485 case VNET_DPDK_PMD_THUNDERX:
490 xd->
port_conf.txmode.offloads |= DEV_TX_OFFLOAD_TCP_CKSUM;
491 xd->
port_conf.txmode.offloads |= DEV_TX_OFFLOAD_UDP_CKSUM;
492 xd->
flags |= DPDK_DEVICE_FLAG_TX_OFFLOAD;
496 case VNET_DPDK_PMD_ENA:
498 xd->
port_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_SCATTER;
501 case VNET_DPDK_PMD_DPAA2:
506 case VNET_DPDK_PMD_ENIC:
513 case VNET_DPDK_PMD_FM10K:
518 case VNET_DPDK_PMD_VIRTIO:
525 case VNET_DPDK_PMD_VMXNET3:
527 xd->
port_conf.txmode.offloads |= DEV_TX_OFFLOAD_MULTI_SEGS;
530 case VNET_DPDK_PMD_AF_PACKET:
535 case VNET_DPDK_PMD_VIRTIO_USER:
539 case VNET_DPDK_PMD_VHOST_ETHER:
543 case VNET_DPDK_PMD_LIOVF_ETHER:
547 case VNET_DPDK_PMD_FAILSAFE:
552 case VNET_DPDK_PMD_NETVSC:
560 if (devconf->num_rx_desc)
573 if (devconf->num_tx_desc)
587 if (xd->
pmd == VNET_DPDK_PMD_AF_PACKET)
591 rnd = (
u32) (now * 1e6);
598 rte_eth_macaddr_get (i, (
void *) addr);
612 xd->
flags |= DPDK_DEVICE_FLAG_HQOS;
662 max_rx_frame = dev_info.max_rx_pktlen;
703 if (xd->
pmd == VNET_DPDK_PMD_FAILSAFE)
710 if (!rte_eth_dev_get_mtu (i, &dev_mtu))
723 xd->
port_conf.rxmode.max_rx_pkt_len = max_rx_frame;
735 vnet_hw_interface_assign_rx_thread (dm->vnet_main, xd->hw_if_index, q++,
736 vdm->first_worker_thread_index + i);
759 if (xd->
flags & DPDK_DEVICE_FLAG_TX_OFFLOAD && hi !=
NULL)
769 xd->
port_conf.txmode.offloads |= DEV_TX_OFFLOAD_TCP_TSO |
770 DEV_TX_OFFLOAD_UDP_TSO;
773 clib_warning (
"%s: TCP/UDP checksum offload must be enabled",
780 dpdk_log_err (
"setup failed for device %U. Errors:\n %U",
817 vlan_off = rte_eth_dev_get_vlan_offload (xd->
port_id);
820 vlan_off |= ETH_VLAN_STRIP_OFFLOAD;
821 if (rte_eth_dev_set_vlan_offload (xd->
port_id, vlan_off) >= 0)
824 dpdk_log_warn (
"VLAN strip cannot be supported by interface\n");
825 xd->
port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_STRIP;
829 if (vlan_off & ETH_VLAN_STRIP_OFFLOAD)
831 vlan_off &= ~ETH_VLAN_STRIP_OFFLOAD;
832 if (rte_eth_dev_set_vlan_offload (xd->
port_id, vlan_off) >= 0)
835 xd->
port_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP;
847 rte_eth_dev_set_mtu (xd->
port_id, mtu);
862 vlib_pci_addr_t *
addr = 0, *addrs;
918 devconf->
pci_addr.as_u32 = addr->as_u32;
944 devconf->
pci_addr.as_u32 = addr->as_u32;
1012 devconf->
pci_addr.as_u32 = addr->as_u32;
1069 "duplicate configuration for PCI address %U",
1073 devconf->
pci_addr.as_u32 = pci_addr.as_u32;
1086 if (
unformat (input,
"num-rx-queues %u", &devconf->num_rx_queues))
1088 else if (
unformat (input,
"num-tx-queues %u", &devconf->num_tx_queues))
1090 else if (
unformat (input,
"num-rx-desc %u", &devconf->num_rx_desc))
1092 else if (
unformat (input,
"num-tx-desc %u", &devconf->num_tx_desc))
1096 else if (
unformat (input,
"workers %U", unformat_bitmap_list,
1107 else if (
unformat (input,
"vlan-strip-offload off"))
1109 else if (
unformat (input,
"vlan-strip-offload on"))
1124 else if (
unformat (input,
"tso on"))
1128 else if (
unformat (input,
"tso off"))
1145 if (devconf->
workers && devconf->num_rx_queues == 0)
1149 devconf->num_rx_queues)
1152 "%U: number of worker threads must be " 1173 if (n < 0 && errno != EAGAIN)
1175 _vec_len (s) = len + (n < 0 ? 0 : n);
1197 vlib_pci_addr_t pci_addr;
1199 uword default_hugepage_sz, x;
1202 int num_whitelisted = 0;
1207 u8 *huge_dir_path = 0;
1218 if (
unformat (input,
"no-hugetlb"))
1223 else if (
unformat (input,
"enable-tcp-udp-checksum"))
1226 else if (
unformat (input,
"no-tx-checksum-offload"))
1229 else if (
unformat (input,
"decimal-interface-names"))
1232 else if (
unformat (input,
"no-multi-seg"))
1268 else if (
unformat (input,
"num-crypto-mbufs %d",
1273 else if (
unformat (input,
"socket-mem %s", &socket_mem))
1275 else if (
unformat (input,
"no-pci"))
1278 tmp =
format (0,
"--no-pci%c", 0);
1281 else if (
unformat (input,
"blacklist %x:%x", &vendor, &device))
1283 u32 blacklist_entry;
1284 if (vendor > 0xFFFF)
1286 if (device > 0xFFFF)
1288 blacklist_entry = (vendor << 16) | (device & 0xffff);
1292 else if (
unformat (input,
"no-vmbus"))
1295 tmp =
format (0,
"--no-vmbus%c", 0);
1300 else if (unformat(input, #a)) \ 1302 tmp = format (0, "--%s%c", #a, 0); \ 1303 vec_add1 (conf->eal_init_args, tmp); \ 1308 else if (unformat(input, #a " %s", &s)) \ 1310 if (!strncmp(#a, "file-prefix", 11)) \ 1312 tmp = format (0, "--%s%c", #a, 0); \ 1313 vec_add1 (conf->eal_init_args, tmp); \ 1315 if (!strncmp(#a, "vdev", 4)) \ 1316 if (strstr((char*)s, "af_packet")) \ 1317 clib_warning ("af_packet obsoleted. Use CLI 'create host-interface'."); \ 1318 vec_add1 (conf->eal_init_args, s); \ 1323 else if (unformat(input, #a " %s", &s)) \ 1325 tmp = format (0, "-%s%c", #b, 0); \ 1326 vec_add1 (conf->eal_init_args, tmp); \ 1328 vec_add1 (conf->eal_init_args, s); \ 1333 else if (unformat(input, #a " %s", &s)) \ 1335 tmp = format (0, "-%s%c", #b, 0); \ 1336 vec_add1 (conf->eal_init_args, tmp); \ 1338 vec_add1 (conf->eal_init_args, s); \ 1339 conf->a##_set_manually = 1; \ 1343 else if (
unformat (input,
"default"))
1368 n_pages = round_pow2 ((uword) 16 << 20, default_hugepage_sz);
1369 n_pages /= default_hugepage_sz;
1371 if ((e = clib_sysfs_prealloc_hugepages(x, 0, n_pages)))
1372 clib_error_report (e);
1378 tmp =
format (0,
"--file-prefix%c", 0);
1380 tmp =
format (0,
"vpp%c", 0);
1391 uword *coremask = 0;
1405 tmp =
format (0,
"%U%c", format_bitmap_hex, coremask, 0);
1419 if (no_pci == 0 && geteuid () == 0)
1422 if (no_vmbus == 0 && geteuid () == 0)
1426 if (devconf->x == 0 && conf->default_devconf.x > 0) \ 1427 devconf->x = conf->default_devconf.x ; 1433 foreach_dpdk_device_config_item
1436 if (devconf->vlan_strip_offload == 0 &&
1437 conf->default_devconf.vlan_strip_offload > 0)
1438 devconf->vlan_strip_offload =
1439 conf->default_devconf.vlan_strip_offload;
1448 if (num_whitelisted > 0 && devconf->is_blacklisted == 0)
1450 tmp = format (0,
"-w%c", 0);
1451 vec_add1 (conf->eal_init_args, tmp);
1452 if (devconf->devargs)
1454 tmp = format (0,
"%U,%s", format_vlib_pci_addr, &devconf->pci_addr, devconf->devargs, 0);
1458 tmp = format (0,
"%U%c", format_vlib_pci_addr, &devconf->pci_addr, 0);
1460 vec_add1 (conf->eal_init_args, tmp);
1464 tmp = format (0,
"-b%c", 0);
1465 vec_add1 (conf->eal_init_args, tmp);
1466 tmp = format (0,
"%U%c", format_vlib_pci_addr, &devconf->pci_addr, 0);
1467 vec_add1 (conf->eal_init_args, tmp);
1475 tmp =
format (0,
"--master-lcore%c", 0);
1476 vec_add1 (conf->eal_init_args, tmp);
1477 tmp =
format (0,
"%u%c", tm->main_lcore, 0);
1478 vec_add1 (conf->eal_init_args, tmp);
1486 _vec_len (conf->eal_init_args) -= 1;
1490 int log_fds[2] = { 0 };
1491 if (pipe (log_fds) == 0)
1493 if (fcntl (log_fds[1], F_SETFL, O_NONBLOCK) == 0)
1495 FILE *f = fdopen (log_fds[1],
"a");
1496 if (f && rte_openlog_stream (f) == 0)
1515 for (
i = 1;
i <
vec_len (conf->eal_init_args);
i++)
1516 conf->eal_init_args_str =
format (conf->eal_init_args_str,
"%s ",
1517 conf->eal_init_args[
i]);
1521 dpdk_log_warn (
"EAL init args: %s", conf->eal_init_args_str);
1522 ret = rte_eal_init (
vec_len (conf->eal_init_args),
1523 (
char **) conf->eal_init_args);
1526 umount2 ((
char *) huge_dir_path, MNT_DETACH);
1527 rmdir ((
char *) huge_dir_path);
1547 struct rte_eth_link prev_link = xd->
link;
1549 u8 hw_flags_chg = 0;
1552 if ((xd->
flags & DPDK_DEVICE_FLAG_PMD) == 0)
1565 "update-link-state: sw_if_index %d, admin_up %d," 1566 "old link_state %d new link_state %d",.format_args =
"i4i1i1i1",};
1577 ed->admin_up = (xd->
flags & DPDK_DEVICE_FLAG_ADMIN_UP) != 0;
1578 ed->old_link_state = (
u8)
1580 ed->new_link_state = (
u8) xd->
link.link_status;
1583 if ((xd->
link.link_duplex != prev_link.link_duplex))
1586 switch (xd->
link.link_duplex)
1588 case ETH_LINK_HALF_DUPLEX:
1591 case ETH_LINK_FULL_DUPLEX:
1598 if (xd->
link.link_speed != prev_link.link_speed)
1600 xd->
link.link_speed * 1000);
1602 if (xd->
link.link_status != prev_link.link_status)
1606 if (xd->
link.link_status)
1619 "update-link-state: sw_if_index %d, new flags %d",.format_args
1629 ed->flags = hw_flags;
1688 .name =
"dpdk-process",
1689 .process_log2_n_stack_bytes = 17,
1701 "Cache line marker must be 1st element in dpdk_device_t");
1704 "Data in cache line 0 is bigger than cache line size");
1706 "Cache line marker must be 1st element in frame_queue_trace_t");
1708 "DPDK RTE CACHE LINE SIZE does not match with 1<<CLIB_LOG2_CACHE_LINE_BYTES");
1722 VLIB_BUFFER_EXT_HDR_VALID |
1723 VNET_BUFFER_F_L4_CHECKSUM_COMPUTED |
1724 VNET_BUFFER_F_L4_CHECKSUM_CORRECT);
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
static void dpdk_bind_devices_to_uio(dpdk_config_main_t *conf)
f64 time_last_link_update
#define hash_set(h, key, value)
#define VIRTIO_PCI_MODERN_DEVICEID_NET
static void dpdk_enable_l4_csum_offload(dpdk_device_t *xd)
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...
u8 interface_name_format_decimal
clib_error_t * vlib_vmbus_bind_to_uio(vlib_vmbus_addr_t *addr)
vnet_main_t * vnet_get_main(void)
Optimized string handling code, including c11-compliant "safe C library" variants.
vnet_device_class_t dpdk_device_class
#define DPDK_DEVICE_VLAN_STRIP_OFF
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static f64 vlib_time_now(vlib_main_t *vm)
#define vec_add2_aligned(V, P, N, A)
Add N elements to end of vector V, return pointer to new elements in P.
static uword * clib_bitmap_or(uword *ai, uword *bi)
Logical operator across two bitmaps.
static u32 dpdk_flag_change(vnet_main_t *vnm, vnet_hw_interface_t *hi, u32 flags)
struct rte_pci_device * dpdk_get_pci_device(const struct rte_eth_dev_info *info)
void dpdk_update_link_state(dpdk_device_t *xd, f64 now)
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
#define CLIB_LOG2_CACHE_LINE_BYTES
#define vec_terminate_c_string(V)
(If necessary) NULL terminate a vector containing a c-string.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
dpdk_device_and_queue_t ** devices_by_hqos_cpu
static void vlib_pci_free_device_info(vlib_pci_device_info_t *di)
#define DPDK_NB_RX_DESC_VIRTIO
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
u32 per_interface_next_index
u8 enable_tcp_udp_checksum
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. ...
#define DPDK_DEVICE_VLAN_STRIP_ON
#define DPDK_NB_TX_DESC_DEFAULT
u32 supported_flow_actions
#define foreach_eal_double_hyphen_predicate_arg
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
dpdk_device_config_hqos_t hqos
#define DPDK_DEVICE_TSO_OFF
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
u32 * blacklist_by_pci_vendor_and_device
dpdk_config_main_t dpdk_config_main
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
clib_file_function_t * read_function
#define ETHER_MAX_LEN
Maximum frame len, including CRC.
static vnet_sw_interface_t * vnet_get_hw_sw_interface(vnet_main_t *vnm, u32 hw_if_index)
#define clib_memcpy(d, s, n)
foreach_dpdk_device_config_item clib_bitmap_t * workers
#define dpdk_log_warn(...)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
vl_api_interface_index_t sw_if_index
static clib_error_t * dpdk_log_read_ready(clib_file_t *uf)
#define VLIB_INIT_FUNCTION(x)
vlib_node_registration_t dpdk_input_node
(constructor) VLIB_REGISTER_NODE (dpdk_input_node)
dpdk_device_config_t default_devconf
static char * vlib_unix_get_runtime_dir(void)
static dpdk_port_type_t port_type_from_speed_capa(struct rte_eth_dev_info *dev_info)
vnet_hw_interface_flags_t flags
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define clib_error_return(e, args...)
vlib_pci_addr_t * vlib_pci_get_all_dev_addrs()
clib_file_main_t file_main
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V...
void dpdk_device_setup(dpdk_device_t *xd)
clib_error_t * unformat_rss_fn(unformat_input_t *input, uword *rss_fn)
#define DPDK_NB_TX_DESC_VIRTIO
struct rte_eth_conf port_conf
static clib_error_t * dpdk_init(vlib_main_t *vm)
u32 max_supported_packet_bytes
f64 time_last_stats_update
vlib_pci_device_info_t * vlib_pci_get_device_info(vlib_main_t *vm, vlib_pci_addr_t *addr, clib_error_t **error)
void dpdk_cli_reference(void)
struct rte_eth_txconf tx_conf
#define clib_bitmap_foreach(i, ai, body)
Macro to iterate across set bits in a bitmap.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
#define vec_insert(V, N, M)
Insert N vector elements starting at element M, initialize new elements to zero (no header...
static clib_error_t * dpdk_config(vlib_main_t *vm, unformat_input_t *input)
#define foreach_eal_double_hyphen_arg
#define ETHERNET_INTERFACE_FLAG_CONFIG_MTU(flags)
dpdk_per_thread_data_t * per_thread_data
clib_error_t * vlib_pci_bind_to_uio(vlib_main_t *vm, vlib_pci_addr_t *addr, char *uio_drv_name)
#define foreach_eal_single_hyphen_mandatory_arg
static dpdk_port_type_t port_type_from_link_speed(u32 link_speed)
#define clib_error_return_unix(e, args...)
vlib_buffer_t buffer_template
unformat_function_t unformat_vlib_pci_addr
#define VIRTIO_PCI_LEGACY_DEVICEID_NET
dpdk_port_type_t port_type
#define VLIB_CONFIG_FUNCTION(x, n,...)
#define dpdk_log_info(...)
clib_error_t * clib_sysfs_read(char *file_name, char *fmt,...)
u16 af_packet_instance_num
#define foreach_eal_single_hyphen_arg
#define VLIB_REGISTER_NODE(x,...)
#define DPDK_NB_RX_DESC_DEFAULT
static int check_l3cache()
static clib_error_t * dpdk_device_config(dpdk_config_main_t *conf, vlib_pci_addr_t pci_addr, unformat_input_t *input, u8 is_default)
static void dpdk_update_counters(dpdk_device_t *xd, f64 now)
u8 nchannels_set_manually
#define vec_free(V)
Free vector's memory (no header).
#define dpdk_log_err(...)
dpdk_device_config_t * dev_confs
#define clib_warning(format, args...)
format_function_t format_dpdk_device_errors
#define ETHERNET_INTERFACE_FLAG_ACCEPT_ALL
#define ELOG_TYPE_DECLARE(f)
static void dpdk_device_lock_init(dpdk_device_t *xd)
format_function_t format_dpdk_rss_hf_name
static void dpdk_bind_vmbus_devices_to_uio(dpdk_config_main_t *conf)
u8 * interface_name_suffix
#define hash_create(elts, value_bytes)
format_function_t format_dpdk_device_name
void vnet_hw_interface_assign_rx_thread(vnet_main_t *vnm, u32 hw_if_index, u16 queue_id, uword thread_index)
clib_error_t * dpdk_port_setup_hqos(dpdk_device_t *xd, dpdk_device_config_hqos_t *hqos)
static uword clib_file_add(clib_file_main_t *um, clib_file_t *template)
vlib_log_class_t log_default
static uword dpdk_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
Bitmaps built as vectors of machine words.
#define clib_error_report(e)
#define clib_bitmap_free(v)
Free a bitmap.
uword clib_mem_get_default_hugepage_size(void)
#define DPDK_LINK_POLL_INTERVAL
uword * thread_registrations_by_name
dpdk_portid_t device_index
static vlib_main_t * vlib_get_main(void)
static int dpdk_port_crc_strip_enabled(dpdk_device_t *xd)
static uword clib_bitmap_count_set_bits(uword *ai)
Return the number of set bits in a bitmap.
void dpdk_device_config_hqos_default(dpdk_device_config_hqos_t *hqos)
#define DPDK_STATS_POLL_INTERVAL
vlib_vmbus_addr_t * vlib_vmbus_get_all_dev_addrs()
static vlib_node_registration_t dpdk_process_node
(constructor) VLIB_REGISTER_NODE (dpdk_process_node)
clib_error_t * dpdk_buffer_pools_create(vlib_main_t *vm)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
uword unformat_vlib_cli_sub_input(unformat_input_t *i, va_list *args)
u8 admin_up_down_in_progress
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)
#define STATIC_ASSERT(truth,...)
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
u8 no_tx_checksum_offload
VLIB buffer representation.
static clib_error_t * dpdk_lib_init(dpdk_main_t *dm)
#define clib_error_free(e)
#define hash_get_mem(h, key)
#define DPDK_DEVICE_TSO_ON
u32 buffer_flags_template
static void * clib_mem_alloc_aligned(uword size, uword align)
static u32 random_u32(u32 *seed)
32-bit random number generator
static vlib_thread_main_t * vlib_get_thread_main()
#define ETHERNET_MAX_PACKET_BYTES
#define vec_foreach(var, vec)
Vector iterator.
#define DPDK_DEVICE_TSO_DEFAULT
#define ETHERNET_INTERFACE_FLAG_CONFIG_PROMISC(flags)
uword * cpu_socket_bitmap
vlib_thread_registration_t ** registrations
#define CLIB_CACHE_LINE_BYTES
clib_error_t * unformat_hqos(unformat_input_t *input, dpdk_device_config_hqos_t *hqos)
uword * device_config_index_by_pci_addr
static uword vnet_hw_interface_is_link_up(vnet_main_t *vnm, u32 hw_if_index)
volatile u32 worker_thread_release
#define dpdk_log_notice(...)
static void vnet_hw_interface_set_link_speed(vnet_main_t *vnm, u32 hw_if_index, u32 link_speed)
static void vnet_hw_interface_set_input_node(vnet_main_t *vnm, u32 hw_if_index, u32 node_index)
vnet_device_main_t vnet_device_main
format_function_t format_vlib_pci_addr
f64 link_state_poll_interval
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".
dpdk_config_main_t * conf