48 struct rte_eth_dev_info dev_info;
49 struct rte_pci_device *pci_dev;
54 if (hw_if_index == (
u32) ~ 0)
69 rte_eth_dev_info_get ((*xd)->port_id, &dev_info);
71 #if RTE_VERSION < RTE_VERSION_NUM(18, 5, 0, 0) 72 pci_dev = dev_info.pci_dev;
74 pci_dev = RTE_DEV_TO_PCI (dev_info.device);
79 vlib_pci_addr_t pci_addr;
81 pci_addr.domain = pci_dev->addr.domain;
82 pci_addr.bus = pci_dev->addr.bus;
83 pci_addr.slot = pci_dev->addr.devid;
84 pci_addr.function = pci_dev->addr.function;
104 #define PCAP_DEF_PKT_TO_CAPTURE (100) 109 u8 *chroot_filename = 0;
134 else if (
unformat (line_input,
"off"))
139 (vm,
"captured %d pkts...",
162 else if (
unformat (line_input,
"max %d", &max))
168 "can't change max value while pcap tx capture active...");
174 else if (
unformat (line_input,
"intfc %U",
179 else if (
unformat (line_input,
"intfc any"))
183 else if (
unformat (line_input,
"file %s", &filename))
188 (vm,
"can't change file while pcap tx capture active...");
194 if (strstr ((
char *) filename,
"..")
195 || index ((
char *) filename,
'/'))
205 chroot_filename =
format (0,
"/tmp/%s%c", filename, 0);
208 else if (
unformat (line_input,
"status"))
213 (vm,
"max is %d for any interface to file %s",
236 (rx_tx ==
VLIB_RX) ?
"rx" :
"tx");
241 (rx_tx ==
VLIB_RX) ?
"rx" :
"tx",
295 else if (chroot_filename)
374 .path =
"pcap tx trace",
376 "pcap tx trace [on|off] [max <nn>] [intfc <interface>|any] [file <name>] [status]",
380 .path =
"pcap rx trace",
382 "pcap rx trace [on|off] [max <nn>] [intfc <interface>|any] [file <name>] [status]",
392 struct rte_mempool *rmp;
400 unsigned count = rte_mempool_avail_count (rmp);
401 unsigned free_count = rte_mempool_in_use_count (rmp);
404 "name=\"%s\" available = %7d allocated = %7d total = %7d\n",
406 (
u32) (count + free_count));
427 .path =
"show dpdk buffer",
428 .short_help =
"show dpdk buffer",
445 err =
clib_sysfs_read (
"/proc/sys/fs/pipe-max-size",
"%u", &pipe_max_size);
450 if (pipe (fds) == -1)
454 #define F_SETPIPE_SZ (1024 + 7) 463 if (fcntl (fds[0], F_SETFL, O_NONBLOCK) == -1)
469 if ((f = fdopen (fds[1],
"a")) == 0)
475 rte_dump_physmem_layout (f);
484 n = read (fds[0], s + len, n_try);
485 if (n < 0 && errno != EAGAIN)
490 _vec_len (s) = len + (n < 0 ? 0 : n);
512 .path =
"show dpdk physmem",
513 .short_help =
"show dpdk physmem",
523 static u32 *allocated_buffers;
530 if (
unformat (input,
"allocate %d", &n_alloc))
532 else if (
unformat (input,
"free %d", &n_free))
540 if (
vec_len (allocated_buffers) < n_free)
542 n_free,
vec_len (allocated_buffers));
544 first =
vec_len (allocated_buffers) - n_free;
546 _vec_len (allocated_buffers) =
first;
550 first =
vec_len (allocated_buffers);
552 vec_len (allocated_buffers) + n_alloc - 1);
556 _vec_len (allocated_buffers) = first + actual_alloc;
558 if (actual_alloc < n_alloc)
566 if (allocated_buffers &&
vec_len (allocated_buffers) == 0)
600 .path =
"test dpdk buffer",
601 .short_help =
"test dpdk buffer [allocate <nn>] [free <nn>]",
615 u32 hw_if_index = (
u32) ~ 0;
616 u32 nb_rx_desc = (
u32) ~ 0;
617 u32 nb_tx_desc = (
u32) ~ 0;
629 else if (
unformat (line_input,
"tx %d", &nb_tx_desc))
631 else if (
unformat (line_input,
"rx %d", &nb_rx_desc))
641 if (hw_if_index == (
u32) ~ 0)
650 if ((xd->
flags & DPDK_DEVICE_FLAG_PMD) == 0)
654 "number of descriptors can be set only for " 659 if ((nb_rx_desc == (
u32) ~ 0 || nb_rx_desc == xd->
nb_rx_desc) &&
666 if (nb_rx_desc != (
u32) ~ 0)
669 if (nb_tx_desc != (
u32) ~ 0)
695 .path =
"set dpdk interface descriptors",
696 .short_help =
"set dpdk interface descriptors <interface> [rx <nn>] [tx <nn>]",
766 .path =
"show dpdk interface hqos placement",
767 .short_help =
"show dpdk interface hqos placement",
781 u32 hw_if_index = (
u32) ~ 0;
795 else if (
unformat (line_input,
"thread %d", &cpu))
805 if (hw_if_index == (
u32) ~ 0)
808 if (cpu < dm->hqos_cpu_first_index ||
871 .path =
"set dpdk interface hqos placement",
872 .short_help =
"set dpdk interface hqos placement <interface> thread <n>",
885 u32 hw_if_index = (
u32) ~ 0;
886 u32 subport_id = (
u32) ~ 0;
888 u32 profile_id = (
u32) ~ 0;
901 else if (
unformat (line_input,
"subport %d", &subport_id))
903 else if (
unformat (line_input,
"pipe %d", &pipe_id))
905 else if (
unformat (line_input,
"profile %d", &profile_id))
915 if (hw_if_index == (
u32) ~ 0)
925 rte_sched_pipe_config (xd->
hqos_ht->
hqos, subport_id, pipe_id,
958 .path =
"set dpdk interface hqos pipe",
959 .short_help =
"set dpdk interface hqos pipe <interface> subport <subport_id> pipe <pipe_id> " 960 "profile <profile_id>",
972 u32 hw_if_index = (
u32) ~ 0;
973 u32 subport_id = (
u32) ~ 0;
974 struct rte_sched_subport_params p;
979 u32 tc_rate[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE] =
981 u32 tc_period = (
u32) ~ 0;
993 else if (
unformat (line_input,
"subport %d", &subport_id))
995 else if (
unformat (line_input,
"rate %d", &tb_rate))
997 else if (
unformat (line_input,
"bktsize %d", &tb_size))
999 else if (
unformat (line_input,
"tc0 %d", &tc_rate[0]))
1001 else if (
unformat (line_input,
"tc1 %d", &tc_rate[1]))
1003 else if (
unformat (line_input,
"tc2 %d", &tc_rate[2]))
1005 else if (
unformat (line_input,
"tc3 %d", &tc_rate[3]))
1007 else if (
unformat (line_input,
"period %d", &tc_period))
1017 error =
get_hqos (hw_if_index, subport_id, &xd, &devconf);
1022 memcpy (&p, &devconf->
hqos.
subport[subport_id], sizeof (p));
1025 if (tb_rate != (
u32) ~ 0)
1027 p.tb_rate = tb_rate;
1028 p.tc_rate[0] = tb_rate;
1029 p.tc_rate[1] = tb_rate;
1030 p.tc_rate[2] = tb_rate;
1031 p.tc_rate[3] = tb_rate;
1033 if (tb_size != (
u32) ~ 0)
1035 p.tb_size = tb_size;
1037 if (tc_rate[0] != (
u32) ~ 0)
1039 p.tc_rate[0] = tc_rate[0];
1041 if (tc_rate[1] != (
u32) ~ 0)
1043 p.tc_rate[1] = tc_rate[1];
1045 if (tc_rate[2] != (
u32) ~ 0)
1047 p.tc_rate[2] = tc_rate[2];
1049 if (tc_rate[3] != (
u32) ~ 0)
1051 p.tc_rate[3] = tc_rate[3];
1053 if (tc_period != (
u32) ~ 0)
1055 p.tc_period = tc_period;
1059 rv = rte_sched_subport_config (xd->
hqos_ht->
hqos, subport_id, &p);
1068 memcpy (&devconf->
hqos.
subport[subport_id], &p, sizeof (p));
1095 .path =
"set dpdk interface hqos subport",
1096 .short_help =
"set dpdk interface hqos subport <interface> subport <subport_id> " 1097 "[rate <n>] [bktsize <n>] [tc0 <n>] [tc1 <n>] [tc2 <n>] [tc3 <n>] " 1112 u32 hw_if_index = (
u32) ~ 0;
1128 else if (
unformat (line_input,
"entry %d", &entry))
1130 else if (
unformat (line_input,
"tc %d", &tc))
1132 else if (
unformat (line_input,
"queue %d", &queue))
1142 if (hw_if_index == (
u32) ~ 0)
1152 if (tc >= RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE)
1157 if (queue >= RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS)
1177 int worker_thread_count = tr->
count;
1179 val = tc * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS + queue;
1180 for (i = 0; i < worker_thread_count; i++)
1212 .path =
"set dpdk interface hqos tctbl",
1213 .short_help =
"set dpdk interface hqos tctbl <interface> entry <map_val> tc <tc_id> queue <queue_id>",
1228 struct rte_eth_dev_info dev_info;
1229 struct rte_pci_device *pci_dev;
1233 u32 hw_if_index = (
u32) ~ 0;
1243 int worker_thread_count = tr->
count;
1251 u32 n_subports_per_port, n_pipes_per_subport, tctbl_size;
1265 else if (
unformat (line_input,
"id subport"))
1267 else if (
unformat (line_input,
"id pipe"))
1269 else if (
unformat (line_input,
"id tc"))
1271 else if (
unformat (line_input,
"id %d", &
id))
1273 else if (
unformat (line_input,
"offset %d", &offset))
1275 else if (
unformat (line_input,
"mask %llx", &mask))
1286 if (hw_if_index == (
u32) ~ 0)
1295 rte_eth_dev_info_get (xd->
port_id, &dev_info);
1297 #if RTE_VERSION < RTE_VERSION_NUM(18, 5, 0, 0) 1298 pci_dev = dev_info.pci_dev;
1300 pci_dev = RTE_DEV_TO_PCI (dev_info.device);
1305 vlib_pci_addr_t pci_addr;
1307 pci_addr.domain = pci_dev->addr.domain;
1308 pci_addr.bus = pci_dev->addr.bus;
1309 pci_addr.slot = pci_dev->addr.devid;
1310 pci_addr.function = pci_dev->addr.function;
1327 n_subports_per_port = devconf->
hqos.
port.n_subports_per_port;
1328 n_pipes_per_subport = devconf->
hqos.
port.n_pipes_per_subport;
1344 "(n_subports_per_port = %u)",
1345 n_subports_per_port);
1353 "(n_pipes_per_subport = %u)",
1354 n_pipes_per_subport);
1363 "(TC table size = %u)", tctbl_size);
1369 for (i = 0; i < worker_thread_count; i++)
1439 .path =
"set dpdk interface hqos pktfield",
1440 .short_help =
"set dpdk interface hqos pktfield <interface> id subport|pipe|tc offset <n> " 1459 u32 hw_if_index = (
u32) ~ 0;
1460 u32 profile_id, subport_id,
i;
1461 struct rte_eth_dev_info dev_info;
1462 struct rte_pci_device *pci_dev;
1485 if (hw_if_index == (
u32) ~ 0)
1494 rte_eth_dev_info_get (xd->
port_id, &dev_info);
1496 #if RTE_VERSION < RTE_VERSION_NUM(18, 5, 0, 0) 1497 pci_dev = dev_info.pci_dev;
1499 pci_dev = RTE_DEV_TO_PCI (dev_info.device);
1504 vlib_pci_addr_t pci_addr;
1506 pci_addr.domain = pci_dev->addr.domain;
1507 pci_addr.bus = pci_dev->addr.bus;
1508 pci_addr.slot = pci_dev->addr.devid;
1509 pci_addr.function = pci_dev->addr.function;
1538 cfg = &devconf->
hqos;
1551 " Packet field 0: slab position = %4u, slab bitmask = 0x%016llx (subport)",
1554 " Packet field 1: slab position = %4u, slab bitmask = 0x%016llx (pipe)",
1557 " Packet field 2: slab position = %4u, slab bitmask = 0x%016llx (tc)",
1560 " Packet field 2 tc translation table: ([Mapped Value Range]: tc/queue tc/queue ...)");
1563 "%u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u",
1564 tctbl[0] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1565 tctbl[0] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1566 tctbl[1] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1567 tctbl[1] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1568 tctbl[2] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1569 tctbl[2] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1570 tctbl[3] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1571 tctbl[3] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1572 tctbl[4] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1573 tctbl[4] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1574 tctbl[5] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1575 tctbl[5] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1576 tctbl[6] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1577 tctbl[6] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1578 tctbl[7] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1579 tctbl[7] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1580 tctbl[8] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1581 tctbl[8] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1582 tctbl[9] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1583 tctbl[9] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1584 tctbl[10] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1585 tctbl[10] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1586 tctbl[11] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1587 tctbl[11] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1588 tctbl[12] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1589 tctbl[12] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1590 tctbl[13] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1591 tctbl[13] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1592 tctbl[14] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1593 tctbl[14] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1594 tctbl[15] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1595 tctbl[15] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS);
1598 "%u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u",
1599 tctbl[16] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1600 tctbl[16] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1601 tctbl[17] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1602 tctbl[17] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1603 tctbl[18] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1604 tctbl[18] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1605 tctbl[19] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1606 tctbl[19] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1607 tctbl[20] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1608 tctbl[20] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1609 tctbl[21] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1610 tctbl[21] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1611 tctbl[22] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1612 tctbl[22] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1613 tctbl[23] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1614 tctbl[23] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1615 tctbl[24] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1616 tctbl[24] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1617 tctbl[25] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1618 tctbl[25] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1619 tctbl[26] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1620 tctbl[26] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1621 tctbl[27] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1622 tctbl[27] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1623 tctbl[28] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1624 tctbl[28] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1625 tctbl[29] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1626 tctbl[29] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1627 tctbl[30] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1628 tctbl[30] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1629 tctbl[31] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1630 tctbl[31] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS);
1633 "%u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u",
1634 tctbl[32] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1635 tctbl[32] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1636 tctbl[33] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1637 tctbl[33] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1638 tctbl[34] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1639 tctbl[34] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1640 tctbl[35] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1641 tctbl[35] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1642 tctbl[36] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1643 tctbl[36] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1644 tctbl[37] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1645 tctbl[37] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1646 tctbl[38] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1647 tctbl[38] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1648 tctbl[39] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1649 tctbl[39] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1650 tctbl[40] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1651 tctbl[40] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1652 tctbl[41] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1653 tctbl[41] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1654 tctbl[42] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1655 tctbl[42] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1656 tctbl[43] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1657 tctbl[43] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1658 tctbl[44] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1659 tctbl[44] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1660 tctbl[45] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1661 tctbl[45] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1662 tctbl[46] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1663 tctbl[46] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1664 tctbl[47] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1665 tctbl[47] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS);
1668 "%u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u %u/%u",
1669 tctbl[48] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1670 tctbl[48] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1671 tctbl[49] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1672 tctbl[49] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1673 tctbl[50] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1674 tctbl[50] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1675 tctbl[51] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1676 tctbl[51] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1677 tctbl[52] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1678 tctbl[52] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1679 tctbl[53] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1680 tctbl[53] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1681 tctbl[54] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1682 tctbl[54] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1683 tctbl[55] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1684 tctbl[55] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1685 tctbl[56] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1686 tctbl[56] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1687 tctbl[57] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1688 tctbl[57] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1689 tctbl[58] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1690 tctbl[58] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1691 tctbl[59] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1692 tctbl[59] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1693 tctbl[60] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1694 tctbl[60] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1695 tctbl[61] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1696 tctbl[61] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1697 tctbl[62] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1698 tctbl[62] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1699 tctbl[63] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1700 tctbl[63] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS);
1705 cfg->
port.frame_overhead);
1707 cfg->
port.n_subports_per_port);
1709 cfg->
port.n_pipes_per_subport);
1711 " Packet queue size: TC0 = %u, TC1 = %u, TC2 = %u, TC3 = %u packets",
1712 cfg->
port.qsize[0], cfg->
port.qsize[1], cfg->
port.qsize[2],
1713 cfg->
port.qsize[3]);
1715 cfg->
port.n_pipe_profiles);
1717 for (subport_id = 0; subport_id <
vec_len (cfg->
subport); subport_id++)
1721 cfg->
subport[subport_id].tb_rate);
1723 cfg->
subport[subport_id].tb_size);
1725 " Traffic class rate: TC0 = %u, TC1 = %u, TC2 = %u, TC3 = %u bytes/second",
1726 cfg->
subport[subport_id].tc_rate[0],
1727 cfg->
subport[subport_id].tc_rate[1],
1728 cfg->
subport[subport_id].tc_rate[2],
1729 cfg->
subport[subport_id].tc_rate[3]);
1731 cfg->
subport[subport_id].tc_period);
1734 for (profile_id = 0; profile_id <
vec_len (cfg->
pipe); profile_id++)
1738 cfg->
pipe[profile_id].tb_rate);
1740 cfg->
pipe[profile_id].tb_size);
1742 " Traffic class rate: TC0 = %u, TC1 = %u, TC2 = %u, TC3 = %u bytes/second",
1743 cfg->
pipe[profile_id].tc_rate[0],
1744 cfg->
pipe[profile_id].tc_rate[1],
1745 cfg->
pipe[profile_id].tc_rate[2],
1746 cfg->
pipe[profile_id].tc_rate[3]);
1748 cfg->
pipe[profile_id].tc_period);
1749 #ifdef RTE_SCHED_SUBPORT_TC_OV 1751 cfg->
pipe[profile_id].tc_ov_weight);
1754 for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++)
1757 " TC%u WRR weights: Q0 = %u, Q1 = %u, Q2 = %u, Q3 = %u",
1758 i, cfg->
pipe[profile_id].wrr_weights[i * 4],
1759 cfg->
pipe[profile_id].wrr_weights[i * 4 + 1],
1760 cfg->
pipe[profile_id].wrr_weights[i * 4 + 2],
1761 cfg->
pipe[profile_id].wrr_weights[i * 4 + 3]);
1765 #ifdef RTE_SCHED_RED 1767 for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++)
1770 cfg->
port.red_params[i][e_RTE_METER_GREEN].min_th,
1771 cfg->
port.red_params[i][e_RTE_METER_YELLOW].min_th,
1772 cfg->
port.red_params[i][e_RTE_METER_RED].min_th);
1775 cfg->
port.red_params[i][e_RTE_METER_GREEN].max_th,
1776 cfg->
port.red_params[i][e_RTE_METER_YELLOW].max_th,
1777 cfg->
port.red_params[i][e_RTE_METER_RED].max_th);
1780 " TC%u inverted probability: G = %u, Y = %u, R = %u",
1781 i, cfg->
port.red_params[i][e_RTE_METER_GREEN].maxp_inv,
1782 cfg->
port.red_params[i][e_RTE_METER_YELLOW].maxp_inv,
1783 cfg->
port.red_params[i][e_RTE_METER_RED].maxp_inv);
1786 cfg->
port.red_params[i][e_RTE_METER_GREEN].wq_log2,
1787 cfg->
port.red_params[i][e_RTE_METER_YELLOW].wq_log2,
1788 cfg->
port.red_params[i][e_RTE_METER_RED].wq_log2);
1843 .path =
"show dpdk interface hqos",
1844 .short_help =
"show dpdk interface hqos <interface>",
1856 #ifdef RTE_SCHED_COLLECT_STATS 1858 u32 hw_if_index = (
u32) ~ 0;
1866 struct rte_eth_dev_info dev_info;
1869 struct rte_sched_queue_stats stats;
1882 else if (
unformat (line_input,
"subport %d", &subport))
1885 else if (
unformat (line_input,
"pipe %d", &pipe))
1888 else if (
unformat (line_input,
"tc %d", &tc))
1891 else if (
unformat (line_input,
"tc_q %d", &tc_q))
1902 if (hw_if_index == (
u32) ~ 0)
1911 rte_eth_dev_info_get (xd->
port_id, &dev_info);
1912 if (dev_info.pci_dev)
1914 vlib_pci_addr_t pci_addr;
1916 pci_addr.domain = dev_info.pci_dev->addr.domain;
1917 pci_addr.bus = dev_info.pci_dev->addr.bus;
1918 pci_addr.slot = dev_info.pci_dev->addr.devid;
1919 pci_addr.function = dev_info.pci_dev->addr.function;
1930 if (devconf->hqos_enabled == 0)
1940 qindex = subport * devconf->hqos.port.n_pipes_per_subport + pipe;
1941 qindex = qindex * RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE + tc;
1942 qindex = qindex * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS + tc_q;
1944 if (rte_sched_queue_read_stats (xd->
hqos_ht->
hqos, qindex, &stats, &qlen) !=
1953 vlib_cli_output (vm,
"%=24s%=16d",
"Packets dropped", stats.n_pkts_dropped);
1954 #ifdef RTE_SCHED_RED 1956 stats.n_pkts_red_dropped);
1959 vlib_cli_output (vm,
"%=24s%=16d",
"Bytes dropped", stats.n_bytes_dropped);
1999 .path =
"show dpdk hqos queue",
2000 .short_help =
"show dpdk hqos queue <interface> subport <subport_id> pipe <pipe_id> tc <tc_id> tc_q <queue_id>",
2010 #define _(a,b,c) vlib_cli_output (vm, "%-25s " b, a ":", c); 2011 _(
"DPDK Version",
"%s", rte_version ());
2030 .path =
"show dpdk version",
2031 .short_help =
"show dpdk version",
2042 u32 n_invalid_bufs = 0, uninitialized = 0;
2043 u32 is_poison = 0, is_test = 0;
2048 else if (
unformat (input,
"trajectory"))
2058 "VLIB_BUFFER_TRACE_TRAJECTORY 1");
2063 dpdk_buffer_poison_trajectory_all ();
2067 n_invalid_bufs = dpdk_buffer_validate_trajectory_all (&uninitialized);
2068 if (!n_invalid_bufs)
2073 n_invalid_bufs, uninitialized);
2081 .path =
"test dpdk buffers",
2082 .short_help =
"test dpdk buffers [poison] [trajectory]",
2083 .function = dpdk_validate_buffers_fn,
unformat_function_t unformat_vnet_hw_interface
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
char * file_name
File name of pcap output.
static clib_error_t * set_dpdk_if_hqos_placement(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static void vlib_buffer_free(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Free buffers Frees the entire buffer chain for each buffer.
u32 n_packets_to_capture
Number of packets to capture.
static clib_error_t * set_dpdk_if_desc(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
int dpdk_hqos_validate_mask(u64 mask, u32 n)
static clib_error_t * show_dpdk_if_hqos(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
static clib_error_t * get_hqos(u32 hw_if_index, u32 subport_id, dpdk_device_t **xd, dpdk_device_config_t **devconf)
static clib_error_t * pcap_rx_trace_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
dpdk_device_and_queue_t ** devices_by_hqos_cpu
static clib_error_t * set_dpdk_if_hqos_pipe(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
struct rte_sched_port_params port
static clib_error_t * show_dpdk_hqos_queue_stats(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
struct rte_sched_port * hqos
unformat_function_t unformat_vnet_sw_interface
dpdk_device_config_hqos_t hqos
static clib_error_t * pcap_trace_command_internal(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd, int rx_tx)
format_function_t format_vnet_sw_if_index_name
#define count_trailing_zeros(x)
static clib_error_t * show_dpdk_buffer(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
struct rte_sched_pipe_params * pipe
#define VLIB_INIT_FUNCTION(x)
dpdk_config_main_t dpdk_config_main
dpdk_device_config_t default_devconf
static clib_error_t * pcap_tx_trace_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#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...)
#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)
static clib_error_t * test_dpdk_buffer(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
dpdk_device_hqos_per_worker_thread_t * hqos_wt
static heap_elt_t * first(heap_header_t *h)
vlib_worker_thread_t * vlib_worker_threads
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
#define clib_error_return_unix(e, args...)
#define vec_del1(v, i)
Delete the element at index I.
clib_error_t * clib_sysfs_read(char *file_name, char *fmt,...)
static clib_error_t * show_dpdk_physmem(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static int dpdk_device_queue_sort(void *a1, void *a2)
static clib_error_t * set_dpdk_if_hqos_tctbl(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_free(V)
Free vector's memory (no header).
dpdk_device_config_t * dev_confs
#define VLIB_BUFFER_TRACE_TRAJECTORY
Compile time buffer trajectory tracing option Turn this on if you run into "bad monkey" contexts...
format_function_t format_dpdk_device_errors
clib_error_t * pcap_write(pcap_main_t *pm)
Write PCAP file.
#define VLIB_CLI_COMMAND(x,...)
struct rte_mempool ** pktmbuf_pools
dpdk_device_hqos_per_hqos_thread_t * hqos_ht
#define clib_error_report(e)
uword * thread_registrations_by_name
clib_error_t * dpdk_cli_init(vlib_main_t *vm)
dpdk_portid_t device_index
static clib_error_t * set_dpdk_if_hqos_subport(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define PCAP_DEF_PKT_TO_CAPTURE
template key/value backing page structure
pcap_packet_type_t packet_type
Packet type.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static clib_error_t * set_dpdk_if_hqos_pktfield(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
dpdk_pcap_t pcap[VLIB_N_RX_TX]
#define hash_get_mem(h, key)
struct clib_bihash_value offset
template key/value backing page structure
static vlib_thread_main_t * vlib_get_thread_main()
struct rte_sched_subport_params * subport
#define vec_foreach(var, vec)
Vector iterator.
static clib_error_t * show_dpdk_version_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
uword * device_config_index_by_pci_addr
u32 n_packets_captured
Number of packets currently captured.
static clib_error_t * show_dpdk_if_hqos_placement(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".
dpdk_config_main_t * conf