43 struct rte_eth_dev_info dev_info;
48 if (hw_if_index == (
u32) ~ 0)
63 rte_eth_dev_info_get ((*xd)->device_index, &dev_info);
66 vlib_pci_addr_t pci_addr;
68 pci_addr.domain = dev_info.pci_dev->addr.domain;
69 pci_addr.bus = dev_info.pci_dev->addr.bus;
70 pci_addr.slot = dev_info.pci_dev->addr.devid;
71 pci_addr.function = dev_info.pci_dev->addr.function;
90 #define PCAP_DEF_PKT_TO_CAPTURE (100) 95 u8 *chroot_filename = 0;
120 else if (
unformat (line_input,
"off"))
146 else if (
unformat (line_input,
"max %d", &max))
151 "can't change max value while pcap tx capture active...");
156 else if (
unformat (line_input,
"intfc %U",
161 else if (
unformat (line_input,
"intfc any"))
165 else if (
unformat (line_input,
"file %s", &filename))
170 "can't change file while pcap tx capture active...");
176 if (strstr ((
char *) filename,
"..")
177 || index ((
char *) filename,
'/'))
182 "Hint: Only filename, do not enter directory structure.");
188 chroot_filename =
format (0,
"/tmp/%s%c", filename, 0);
191 else if (
unformat (line_input,
"status"))
271 else if (chroot_filename)
333 .path =
"pcap tx trace",
335 "pcap tx trace [on|off] [max <nn>] [intfc <interface>|any] [file <name>] [status]",
345 struct rte_mempool *rmp;
353 unsigned count = rte_mempool_avail_count (rmp);
354 unsigned free_count = rte_mempool_in_use_count (rmp);
357 "name=\"%s\" available = %7d allocated = %7d total = %7d\n",
359 (
u32) (count + free_count));
380 .path =
"show dpdk buffer",
381 .short_help =
"show dpdk buffer",
391 static u32 *allocated_buffers;
398 if (
unformat (input,
"allocate %d", &n_alloc))
400 else if (
unformat (input,
"free %d", &n_free))
408 if (
vec_len (allocated_buffers) < n_free)
410 n_free,
vec_len (allocated_buffers));
412 first =
vec_len (allocated_buffers) - n_free;
414 _vec_len (allocated_buffers) =
first;
418 first =
vec_len (allocated_buffers);
420 vec_len (allocated_buffers) + n_alloc - 1);
424 _vec_len (allocated_buffers) = first + actual_alloc;
426 if (actual_alloc < n_alloc)
434 if (allocated_buffers &&
vec_len (allocated_buffers) == 0)
468 .path =
"test dpdk buffer",
469 .short_help =
"test dpdk buffer [allocate <nn>] [free <nn>]",
483 u32 hw_if_index = (
u32) ~ 0;
484 u32 nb_rx_desc = (
u32) ~ 0;
485 u32 nb_tx_desc = (
u32) ~ 0;
497 else if (
unformat (line_input,
"tx %d", &nb_tx_desc))
499 else if (
unformat (line_input,
"rx %d", &nb_rx_desc))
509 if (hw_if_index == (
u32) ~ 0)
522 "number of descriptors can be set only for " 527 if ((nb_rx_desc == (
u32) ~ 0 || nb_rx_desc == xd->
nb_rx_desc) &&
534 if (nb_rx_desc != (
u32) ~ 0)
537 if (nb_tx_desc != (
u32) ~ 0)
563 .path =
"set dpdk interface descriptors",
564 .short_help =
"set dpdk interface descriptors <interface> [rx <nn>] [tx <nn>]",
634 .path =
"show dpdk interface hqos placement",
635 .short_help =
"show dpdk interface hqos placement",
649 u32 hw_if_index = (
u32) ~ 0;
663 else if (
unformat (line_input,
"thread %d", &cpu))
673 if (hw_if_index == (
u32) ~ 0)
676 if (cpu < dm->hqos_cpu_first_index ||
739 .path =
"set dpdk interface hqos placement",
740 .short_help =
"set dpdk interface hqos placement <interface> thread <n>",
753 u32 hw_if_index = (
u32) ~ 0;
754 u32 subport_id = (
u32) ~ 0;
756 u32 profile_id = (
u32) ~ 0;
769 else if (
unformat (line_input,
"subport %d", &subport_id))
771 else if (
unformat (line_input,
"pipe %d", &pipe_id))
773 else if (
unformat (line_input,
"profile %d", &profile_id))
783 if (hw_if_index == (
u32) ~ 0)
793 rte_sched_pipe_config (xd->
hqos_ht->
hqos, subport_id, pipe_id,
826 .path =
"set dpdk interface hqos pipe",
827 .short_help =
"set dpdk interface hqos pipe <interface> subport <subport_id> pipe <pipe_id> " 828 "profile <profile_id>",
840 u32 hw_if_index = (
u32) ~ 0;
841 u32 subport_id = (
u32) ~ 0;
842 struct rte_sched_subport_params p;
847 u32 tc_rate[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE] =
849 u32 tc_period = (
u32) ~ 0;
861 else if (
unformat (line_input,
"subport %d", &subport_id))
863 else if (
unformat (line_input,
"rate %d", &tb_rate))
865 else if (
unformat (line_input,
"bktsize %d", &tb_size))
867 else if (
unformat (line_input,
"tc0 %d", &tc_rate[0]))
869 else if (
unformat (line_input,
"tc1 %d", &tc_rate[1]))
871 else if (
unformat (line_input,
"tc2 %d", &tc_rate[2]))
873 else if (
unformat (line_input,
"tc3 %d", &tc_rate[3]))
875 else if (
unformat (line_input,
"period %d", &tc_period))
885 error =
get_hqos (hw_if_index, subport_id, &xd, &devconf);
890 memcpy (&p, &devconf->
hqos.
subport[subport_id], sizeof (p));
893 if (tb_rate != (
u32) ~ 0)
896 p.tc_rate[0] = tb_rate;
897 p.tc_rate[1] = tb_rate;
898 p.tc_rate[2] = tb_rate;
899 p.tc_rate[3] = tb_rate;
901 if (tb_size != (
u32) ~ 0)
905 if (tc_rate[0] != (
u32) ~ 0)
907 p.tc_rate[0] = tc_rate[0];
909 if (tc_rate[1] != (
u32) ~ 0)
911 p.tc_rate[1] = tc_rate[1];
913 if (tc_rate[2] != (
u32) ~ 0)
915 p.tc_rate[2] = tc_rate[2];
917 if (tc_rate[3] != (
u32) ~ 0)
919 p.tc_rate[3] = tc_rate[3];
921 if (tc_period != (
u32) ~ 0)
923 p.tc_period = tc_period;
927 rv = rte_sched_subport_config (xd->
hqos_ht->
hqos, subport_id, &p);
936 memcpy (&devconf->
hqos.
subport[subport_id], &p, sizeof (p));
963 .path =
"set dpdk interface hqos subport",
964 .short_help =
"set dpdk interface hqos subport <interface> subport <subport_id> " 965 "[rate <n>] [bktsize <n>] [tc0 <n>] [tc1 <n>] [tc2 <n>] [tc3 <n>] " 980 u32 hw_if_index = (
u32) ~ 0;
996 else if (
unformat (line_input,
"entry %d", &entry))
998 else if (
unformat (line_input,
"tc %d", &tc))
1000 else if (
unformat (line_input,
"queue %d", &queue))
1010 if (hw_if_index == (
u32) ~ 0)
1020 if (tc >= RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE)
1025 if (queue >= RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS)
1045 int worker_thread_count = tr->
count;
1047 val = tc * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS + queue;
1048 for (i = 0; i < worker_thread_count; i++)
1080 .path =
"set dpdk interface hqos tctbl",
1081 .short_help =
"set dpdk interface hqos tctbl <interface> entry <map_val> tc <tc_id> queue <queue_id>",
1096 struct rte_eth_dev_info dev_info;
1100 u32 hw_if_index = (
u32) ~ 0;
1110 int worker_thread_count = tr->
count;
1118 u32 n_subports_per_port, n_pipes_per_subport, tctbl_size;
1132 else if (
unformat (line_input,
"id subport"))
1134 else if (
unformat (line_input,
"id pipe"))
1136 else if (
unformat (line_input,
"id tc"))
1138 else if (
unformat (line_input,
"id %d", &
id))
1140 else if (
unformat (line_input,
"offset %d", &offset))
1142 else if (
unformat (line_input,
"mask %llx", &mask))
1153 if (hw_if_index == (
u32) ~ 0)
1163 if (dev_info.pci_dev)
1165 vlib_pci_addr_t pci_addr;
1167 pci_addr.domain = dev_info.pci_dev->addr.domain;
1168 pci_addr.bus = dev_info.pci_dev->addr.bus;
1169 pci_addr.slot = dev_info.pci_dev->addr.devid;
1170 pci_addr.function = dev_info.pci_dev->addr.function;
1181 if (devconf->hqos_enabled == 0)
1187 n_subports_per_port = devconf->hqos.port.n_subports_per_port;
1188 n_pipes_per_subport = devconf->hqos.port.n_pipes_per_subport;
1189 tctbl_size = RTE_DIM (devconf->hqos.tc_table);
1204 "(n_subports_per_port = %u)",
1205 n_subports_per_port);
1213 "(n_pipes_per_subport = %u)",
1214 n_pipes_per_subport);
1223 "(TC table size = %u)", tctbl_size);
1229 for (i = 0; i < worker_thread_count; i++)
1236 __builtin_ctzll (mask);
1242 __builtin_ctzll (mask);
1249 __builtin_ctzll (mask);
1299 .path =
"set dpdk interface hqos pktfield",
1300 .short_help =
"set dpdk interface hqos pktfield <interface> id subport|pipe|tc offset <n> " 1319 u32 hw_if_index = (
u32) ~ 0;
1320 u32 profile_id, subport_id,
i;
1321 struct rte_eth_dev_info dev_info;
1344 if (hw_if_index == (
u32) ~ 0)
1354 if (dev_info.pci_dev)
1356 vlib_pci_addr_t pci_addr;
1358 pci_addr.domain = dev_info.pci_dev->addr.domain;
1359 pci_addr.bus = dev_info.pci_dev->addr.bus;
1360 pci_addr.slot = dev_info.pci_dev->addr.devid;
1361 pci_addr.function = dev_info.pci_dev->addr.function;
1372 if (devconf->hqos_enabled == 0)
1390 cfg = &devconf->hqos;
1403 " Packet field 0: slab position = %4u, slab bitmask = 0x%016llx (subport)",
1406 " Packet field 1: slab position = %4u, slab bitmask = 0x%016llx (pipe)",
1409 " Packet field 2: slab position = %4u, slab bitmask = 0x%016llx (tc)",
1412 " Packet field 2 tc translation table: ([Mapped Value Range]: tc/queue tc/queue ...)");
1415 "%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",
1416 tctbl[0] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1417 tctbl[0] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1418 tctbl[1] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1419 tctbl[1] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1420 tctbl[2] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1421 tctbl[2] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1422 tctbl[3] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1423 tctbl[3] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1424 tctbl[4] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1425 tctbl[4] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1426 tctbl[5] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1427 tctbl[5] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1428 tctbl[6] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1429 tctbl[6] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1430 tctbl[7] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1431 tctbl[7] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1432 tctbl[8] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1433 tctbl[8] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1434 tctbl[9] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1435 tctbl[9] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1436 tctbl[10] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1437 tctbl[10] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1438 tctbl[11] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1439 tctbl[11] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1440 tctbl[12] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1441 tctbl[12] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1442 tctbl[13] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1443 tctbl[13] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1444 tctbl[14] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1445 tctbl[14] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1446 tctbl[15] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1447 tctbl[15] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS);
1450 "%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",
1451 tctbl[16] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1452 tctbl[16] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1453 tctbl[17] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1454 tctbl[17] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1455 tctbl[18] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1456 tctbl[18] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1457 tctbl[19] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1458 tctbl[19] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1459 tctbl[20] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1460 tctbl[20] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1461 tctbl[21] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1462 tctbl[21] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1463 tctbl[22] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1464 tctbl[22] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1465 tctbl[23] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1466 tctbl[23] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1467 tctbl[24] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1468 tctbl[24] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1469 tctbl[25] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1470 tctbl[25] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1471 tctbl[26] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1472 tctbl[26] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1473 tctbl[27] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1474 tctbl[27] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1475 tctbl[28] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1476 tctbl[28] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1477 tctbl[29] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1478 tctbl[29] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1479 tctbl[30] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1480 tctbl[30] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1481 tctbl[31] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1482 tctbl[31] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS);
1485 "%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",
1486 tctbl[32] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1487 tctbl[32] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1488 tctbl[33] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1489 tctbl[33] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1490 tctbl[34] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1491 tctbl[34] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1492 tctbl[35] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1493 tctbl[35] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1494 tctbl[36] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1495 tctbl[36] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1496 tctbl[37] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1497 tctbl[37] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1498 tctbl[38] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1499 tctbl[38] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1500 tctbl[39] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1501 tctbl[39] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1502 tctbl[40] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1503 tctbl[40] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1504 tctbl[41] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1505 tctbl[41] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1506 tctbl[42] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1507 tctbl[42] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1508 tctbl[43] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1509 tctbl[43] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1510 tctbl[44] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1511 tctbl[44] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1512 tctbl[45] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1513 tctbl[45] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1514 tctbl[46] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1515 tctbl[46] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1516 tctbl[47] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1517 tctbl[47] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS);
1520 "%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",
1521 tctbl[48] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1522 tctbl[48] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1523 tctbl[49] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1524 tctbl[49] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1525 tctbl[50] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1526 tctbl[50] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1527 tctbl[51] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1528 tctbl[51] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1529 tctbl[52] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1530 tctbl[52] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1531 tctbl[53] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1532 tctbl[53] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1533 tctbl[54] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1534 tctbl[54] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1535 tctbl[55] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1536 tctbl[55] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1537 tctbl[56] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1538 tctbl[56] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1539 tctbl[57] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1540 tctbl[57] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1541 tctbl[58] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1542 tctbl[58] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1543 tctbl[59] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1544 tctbl[59] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1545 tctbl[60] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1546 tctbl[60] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1547 tctbl[61] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1548 tctbl[61] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1549 tctbl[62] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1550 tctbl[62] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1551 tctbl[63] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1552 tctbl[63] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS);
1557 cfg->
port.frame_overhead);
1559 cfg->
port.n_subports_per_port);
1561 cfg->
port.n_pipes_per_subport);
1563 " Packet queue size: TC0 = %u, TC1 = %u, TC2 = %u, TC3 = %u packets",
1564 cfg->
port.qsize[0], cfg->
port.qsize[1], cfg->
port.qsize[2],
1565 cfg->
port.qsize[3]);
1567 cfg->
port.n_pipe_profiles);
1569 for (subport_id = 0; subport_id <
vec_len (cfg->
subport); subport_id++)
1573 cfg->
subport[subport_id].tb_rate);
1575 cfg->
subport[subport_id].tb_size);
1577 " Traffic class rate: TC0 = %u, TC1 = %u, TC2 = %u, TC3 = %u bytes/second",
1578 cfg->
subport[subport_id].tc_rate[0],
1579 cfg->
subport[subport_id].tc_rate[1],
1580 cfg->
subport[subport_id].tc_rate[2],
1581 cfg->
subport[subport_id].tc_rate[3]);
1583 cfg->
subport[subport_id].tc_period);
1586 for (profile_id = 0; profile_id <
vec_len (cfg->
pipe); profile_id++)
1590 cfg->
pipe[profile_id].tb_rate);
1592 cfg->
pipe[profile_id].tb_size);
1594 " Traffic class rate: TC0 = %u, TC1 = %u, TC2 = %u, TC3 = %u bytes/second",
1595 cfg->
pipe[profile_id].tc_rate[0],
1596 cfg->
pipe[profile_id].tc_rate[1],
1597 cfg->
pipe[profile_id].tc_rate[2],
1598 cfg->
pipe[profile_id].tc_rate[3]);
1600 cfg->
pipe[profile_id].tc_period);
1601 #ifdef RTE_SCHED_SUBPORT_TC_OV 1603 cfg->
pipe[profile_id].tc_ov_weight);
1606 for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++)
1609 " TC%u WRR weights: Q0 = %u, Q1 = %u, Q2 = %u, Q3 = %u",
1610 i, cfg->
pipe[profile_id].wrr_weights[i * 4],
1611 cfg->
pipe[profile_id].wrr_weights[i * 4 + 1],
1612 cfg->
pipe[profile_id].wrr_weights[i * 4 + 2],
1613 cfg->
pipe[profile_id].wrr_weights[i * 4 + 3]);
1617 #ifdef RTE_SCHED_RED 1619 for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++)
1622 cfg->
port.red_params[i][e_RTE_METER_GREEN].min_th,
1623 cfg->
port.red_params[i][e_RTE_METER_YELLOW].min_th,
1624 cfg->
port.red_params[i][e_RTE_METER_RED].min_th);
1627 cfg->
port.red_params[i][e_RTE_METER_GREEN].max_th,
1628 cfg->
port.red_params[i][e_RTE_METER_YELLOW].max_th,
1629 cfg->
port.red_params[i][e_RTE_METER_RED].max_th);
1632 " TC%u inverted probability: G = %u, Y = %u, R = %u",
1633 i, cfg->
port.red_params[i][e_RTE_METER_GREEN].maxp_inv,
1634 cfg->
port.red_params[i][e_RTE_METER_YELLOW].maxp_inv,
1635 cfg->
port.red_params[i][e_RTE_METER_RED].maxp_inv);
1638 cfg->
port.red_params[i][e_RTE_METER_GREEN].wq_log2,
1639 cfg->
port.red_params[i][e_RTE_METER_YELLOW].wq_log2,
1640 cfg->
port.red_params[i][e_RTE_METER_RED].wq_log2);
1695 .path =
"show dpdk interface hqos",
1696 .short_help =
"show dpdk interface hqos <interface>",
1708 #ifdef RTE_SCHED_COLLECT_STATS 1710 u32 hw_if_index = (
u32) ~ 0;
1718 struct rte_eth_dev_info dev_info;
1721 struct rte_sched_queue_stats stats;
1734 else if (
unformat (line_input,
"subport %d", &subport))
1737 else if (
unformat (line_input,
"pipe %d", &pipe))
1740 else if (
unformat (line_input,
"tc %d", &tc))
1743 else if (
unformat (line_input,
"tc_q %d", &tc_q))
1754 if (hw_if_index == (
u32) ~ 0)
1764 if (dev_info.pci_dev)
1766 vlib_pci_addr_t pci_addr;
1768 pci_addr.domain = dev_info.pci_dev->addr.domain;
1769 pci_addr.bus = dev_info.pci_dev->addr.bus;
1770 pci_addr.slot = dev_info.pci_dev->addr.devid;
1771 pci_addr.function = dev_info.pci_dev->addr.function;
1782 if (devconf->hqos_enabled == 0)
1792 qindex = subport * devconf->hqos.port.n_pipes_per_subport + pipe;
1793 qindex = qindex * RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE + tc;
1794 qindex = qindex * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS + tc_q;
1796 if (rte_sched_queue_read_stats (xd->
hqos_ht->
hqos, qindex, &stats, &qlen) !=
1805 vlib_cli_output (vm,
"%=24s%=16d",
"Packets dropped", stats.n_pkts_dropped);
1806 #ifdef RTE_SCHED_RED 1808 stats.n_pkts_red_dropped);
1811 vlib_cli_output (vm,
"%=24s%=16d",
"Bytes dropped", stats.n_bytes_dropped);
1851 .path =
"show dpdk hqos queue",
1852 .short_help =
"show dpdk hqos queue <interface> subport <subport_id> pipe <pipe_id> tc <tc_id> tc_q <queue_id>",
1862 #define _(a,b,c) vlib_cli_output (vm, "%-25s " b, a ":", c); 1863 _(
"DPDK Version",
"%s", rte_version ());
1882 .path =
"show dpdk version",
1883 .short_help =
"show dpdk version",
1894 u32 n_invalid_bufs = 0, uninitialized = 0;
1895 u32 is_poison = 0, is_test = 0;
1900 else if (
unformat (input,
"trajectory"))
1910 "VLIB_BUFFER_TRACE_TRAJECTORY 1");
1915 dpdk_buffer_poison_trajectory_all ();
1919 n_invalid_bufs = dpdk_buffer_validate_trajectory_all (&uninitialized);
1920 if (!n_invalid_bufs)
1925 n_invalid_bufs, uninitialized);
1933 .path =
"test dpdk buffers",
1934 .short_help =
"test dpdk buffers [poison] [trajectory]",
1935 .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)
#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
static clib_error_t * pcap_trace_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
unformat_function_t unformat_vnet_sw_interface
dpdk_device_config_hqos_t hqos
format_function_t format_vnet_sw_if_index_name
#define DPDK_DEVICE_FLAG_PMD
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
#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...)
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 vec_del1(v, i)
Delete the element at index I.
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.
#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