2 * Copyright (c) 2015 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
15 #include <vnet/vnet.h>
16 #include <vppinfra/vec.h>
17 #include <vppinfra/error.h>
18 #include <vppinfra/format.h>
19 #include <vppinfra/xxhash.h>
21 #include <vnet/ethernet/ethernet.h>
22 #include <vnet/devices/dpdk/dpdk.h>
23 #include <vnet/classify/vnet_classify.h>
24 #include <vnet/mpls/packet.h>
26 #include "dpdk_priv.h"
29 pcap_trace_command_fn (vlib_main_t * vm,
30 unformat_input_t * input, vlib_cli_command_t * cmd)
32 dpdk_main_t *dm = &dpdk_main;
36 clib_error_t *error = 0;
38 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
40 if (unformat (input, "on"))
42 if (dm->tx_pcap_enable == 0)
44 if (dm->pcap_filename == 0)
45 dm->pcap_filename = format (0, "/tmp/vpe.pcap%c", 0);
47 memset (&dm->pcap_main, 0, sizeof (dm->pcap_main));
48 dm->pcap_main.file_name = (char *) dm->pcap_filename;
49 dm->pcap_main.n_packets_to_capture = 100;
50 if (dm->pcap_pkts_to_capture)
51 dm->pcap_main.n_packets_to_capture = dm->pcap_pkts_to_capture;
53 dm->pcap_main.packet_type = PCAP_PACKET_TYPE_ethernet;
54 dm->tx_pcap_enable = 1;
56 vlib_cli_output (vm, "pcap tx capture on...");
60 vlib_cli_output (vm, "pcap tx capture already on...");
64 else if (unformat (input, "off"))
66 if (dm->tx_pcap_enable)
68 vlib_cli_output (vm, "captured %d pkts...",
69 dm->pcap_main.n_packets_captured + 1);
70 if (dm->pcap_main.n_packets_captured)
72 dm->pcap_main.n_packets_to_capture =
73 dm->pcap_main.n_packets_captured;
74 error = pcap_write (&dm->pcap_main);
76 clib_error_report (error);
78 vlib_cli_output (vm, "saved to %s...", dm->pcap_filename);
83 vlib_cli_output (vm, "pcap tx capture already off...");
86 dm->tx_pcap_enable = 0;
89 else if (unformat (input, "max %d", &max))
91 dm->pcap_pkts_to_capture = max;
95 else if (unformat (input, "intfc %U",
96 unformat_vnet_sw_interface, dm->vnet_main,
97 &dm->pcap_sw_if_index))
99 else if (unformat (input, "intfc any"))
101 dm->pcap_sw_if_index = 0;
104 else if (unformat (input, "file %s", &filename))
107 /* Brain-police user path input */
108 if (strstr ((char *) filename, "..")
109 || index ((char *) filename, '/'))
111 vlib_cli_output (vm, "illegal characters in filename '%s'",
116 chroot_filename = format (0, "/tmp/%s%c", filename, 0);
119 if (dm->pcap_filename)
120 vec_free (dm->pcap_filename);
121 vec_add1 (filename, 0);
122 dm->pcap_filename = chroot_filename;
125 else if (unformat (input, "status"))
127 if (dm->tx_pcap_enable == 0)
129 vlib_cli_output (vm, "pcap tx capture is off...");
133 vlib_cli_output (vm, "pcap tx capture: %d of %d pkts...",
134 dm->pcap_main.n_packets_captured,
135 dm->pcap_main.n_packets_to_capture);
144 return clib_error_return (0, "unknown input `%U'",
145 format_unformat_error, input);
151 VLIB_CLI_COMMAND (pcap_trace_command, static) = {
152 .path = "pcap tx trace",
154 "pcap tx trace on off max <nn> intfc <intfc> file <name> status",
155 .function = pcap_trace_command_fn,
160 static clib_error_t *
161 show_dpdk_buffer (vlib_main_t * vm, unformat_input_t * input,
162 vlib_cli_command_t * cmd)
164 struct rte_mempool *rmp;
167 for (i = 0; i < vec_len (vm->buffer_main->pktmbuf_pools); i++)
169 rmp = vm->buffer_main->pktmbuf_pools[i];
172 unsigned count = rte_mempool_avail_count (rmp);
173 unsigned free_count = rte_mempool_in_use_count (rmp);
176 "name=\"%s\" available = %7d allocated = %7d total = %7d\n",
177 rmp->name, (u32) count, (u32) free_count,
178 (u32) (count + free_count));
182 vlib_cli_output (vm, "rte_mempool is NULL (!)\n");
189 VLIB_CLI_COMMAND (cmd_show_dpdk_bufferr,static) = {
190 .path = "show dpdk buffer",
191 .short_help = "show dpdk buffer state",
192 .function = show_dpdk_buffer,
197 static clib_error_t *
198 test_dpdk_buffer (vlib_main_t * vm, unformat_input_t * input,
199 vlib_cli_command_t * cmd)
201 static u32 *allocated_buffers;
204 u32 first, actual_alloc;
206 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
208 if (unformat (input, "allocate %d", &n_alloc))
210 else if (unformat (input, "free %d", &n_free))
218 if (vec_len (allocated_buffers) < n_free)
219 return clib_error_return (0, "Can't free %d, only %d allocated",
220 n_free, vec_len (allocated_buffers));
222 first = vec_len (allocated_buffers) - n_free;
223 vlib_buffer_free (vm, allocated_buffers + first, n_free);
224 _vec_len (allocated_buffers) = first;
228 first = vec_len (allocated_buffers);
229 vec_validate (allocated_buffers,
230 vec_len (allocated_buffers) + n_alloc - 1);
232 actual_alloc = vlib_buffer_alloc (vm, allocated_buffers + first,
234 _vec_len (allocated_buffers) = first + actual_alloc;
236 if (actual_alloc < n_alloc)
237 vlib_cli_output (vm, "WARNING: only allocated %d buffers",
241 vlib_cli_output (vm, "Currently %d buffers allocated",
242 vec_len (allocated_buffers));
244 if (allocated_buffers && vec_len (allocated_buffers) == 0)
245 vec_free (allocated_buffers);
251 VLIB_CLI_COMMAND (cmd_test_dpdk_buffer,static) = {
252 .path = "test dpdk buffer",
253 .short_help = "test dpdk buffer [allocate <nn>][free <nn>]",
254 .function = test_dpdk_buffer,
260 show_dpdk_device_stats (vlib_main_t * vm, dpdk_device_t * xd)
264 " last_burst_sz %d\n"
266 " full_frames_cnt %u\n"
267 " consec_full_frames_cnt %u\n"
268 " congestion_cnt %d\n"
269 " last_poll_time %llu\n"
270 " max_poll_delay %llu\n"
272 " total_packet_cnt %u\n",
274 xd->efd_agent.last_burst_sz,
275 xd->efd_agent.max_burst_sz,
276 xd->efd_agent.full_frames_cnt,
277 xd->efd_agent.consec_full_frames_cnt,
278 xd->efd_agent.congestion_cnt,
279 xd->efd_agent.last_poll_time,
280 xd->efd_agent.max_poll_delay,
281 xd->efd_agent.discard_cnt, xd->efd_agent.total_packet_cnt);
283 u32 device_queue_sz = rte_eth_rx_queue_count (xd->device_index,
285 vlib_cli_output (vm, " device_queue_sz %u\n", device_queue_sz);
289 show_efd_config (vlib_main_t * vm)
291 vlib_thread_main_t *tm = vlib_get_thread_main ();
292 dpdk_main_t *dm = &dpdk_main;
295 "dpdk: (0x%04x) enabled:%d monitor:%d drop_all:%d\n"
296 " dpdk_queue_hi_thresh %d\n"
297 " consec_full_frames_hi_thresh %d\n"
299 "worker: (0x%04x) enabled:%d monitor:%d\n"
300 " worker_queue_hi_thresh %d\n",
302 ((dm->efd.enabled & DPDK_EFD_DISCARD_ENABLED) ? 1 : 0),
303 ((dm->efd.enabled & DPDK_EFD_MONITOR_ENABLED) ? 1 : 0),
304 ((dm->efd.enabled & DPDK_EFD_DROPALL_ENABLED) ? 1 : 0),
305 dm->efd.queue_hi_thresh,
306 dm->efd.consec_full_frames_hi_thresh,
308 ((tm->efd.enabled & VLIB_EFD_DISCARD_ENABLED) ? 1 : 0),
309 ((dm->efd.enabled & VLIB_EFD_MONITOR_ENABLED) ? 1 : 0),
310 tm->efd.queue_hi_thresh);
313 "ip_prec_bitmap 0x%02x\n"
314 "mpls_exp_bitmap 0x%02x\n"
315 "vlan_cos_bitmap 0x%02x\n",
316 tm->efd.ip_prec_bitmap,
317 tm->efd.mpls_exp_bitmap, tm->efd.vlan_cos_bitmap);
320 static clib_error_t *
321 show_efd (vlib_main_t * vm,
322 unformat_input_t * input, vlib_cli_command_t * cmd)
325 if (unformat (input, "config"))
327 show_efd_config (vm);
329 else if (unformat (input, "dpdk"))
331 dpdk_main_t *dm = &dpdk_main;
335 (void) unformat (input, "device %d", &device_id);
337 vec_foreach (xd, dm->devices)
339 if ((xd->device_index == device_id) || (device_id == ~0))
341 show_dpdk_device_stats(vm, xd);
346 else if (unformat (input, "worker"))
348 vlib_thread_main_t *tm = vlib_get_thread_main ();
349 vlib_thread_registration_t *tr;
351 u32 first_worker_index = 0;
354 p = hash_get_mem (tm->thread_registrations_by_name, "workers");
356 tr = (vlib_thread_registration_t *) p[0];
359 num_workers = tr->count;
360 first_worker_index = tr->first_index;
365 "first_worker_index %d\n",
366 num_workers, first_worker_index);
369 else if (unformat (input, "help"))
371 vlib_cli_output (vm, "Usage: show efd config | "
372 "dpdk [device <id>] | worker\n");
376 show_efd_config (vm);
383 VLIB_CLI_COMMAND (show_efd_command, static) = {
385 .short_help = "Show efd [device <id>] | [config]",
386 .function = show_efd,
390 static clib_error_t *
391 clear_efd (vlib_main_t * vm,
392 unformat_input_t * input, vlib_cli_command_t * cmd)
394 dpdk_main_t *dm = &dpdk_main;
398 vec_foreach (xd, dm->devices)
400 xd->efd_agent.last_burst_sz = 0;
401 xd->efd_agent.max_burst_sz = 0;
402 xd->efd_agent.full_frames_cnt = 0;
403 xd->efd_agent.consec_full_frames_cnt = 0;
404 xd->efd_agent.congestion_cnt = 0;
405 xd->efd_agent.last_poll_time = 0;
406 xd->efd_agent.max_poll_delay = 0;
407 xd->efd_agent.discard_cnt = 0;
408 xd->efd_agent.total_packet_cnt = 0;
416 VLIB_CLI_COMMAND (clear_efd_command,static) = {
418 .short_help = "Clear early-fast-discard counters",
419 .function = clear_efd,
423 static clib_error_t *
424 parse_op_and_prec (vlib_main_t * vm, unformat_input_t * input,
425 vlib_cli_command_t * cmd,
426 char *prec_type, u8 * prec_bitmap)
428 clib_error_t *error = NULL;
432 if (unformat (input, "ge"))
434 op = EFD_OPERATION_GREATER_OR_EQUAL;
436 else if (unformat (input, "lt"))
438 op = EFD_OPERATION_LESS_THAN;
440 else if (unformat (input, "help"))
442 vlib_cli_output (vm, "enter operation [ge | lt] and precedence <0-7>)");
447 return clib_error_return (0, "unknown input `%U'",
448 format_unformat_error, input);
451 if (unformat (input, "%u", &prec))
455 return clib_error_return (0, "precedence %d is out of range <0-7>",
461 return clib_error_return (0, "unknown input `%U'",
462 format_unformat_error, input);
465 set_efd_bitmap (prec_bitmap, prec, op);
468 "EFD will be set for %s precedence %s%u%s.",
470 (op == EFD_OPERATION_LESS_THAN) ? "less than " : "",
473 EFD_OPERATION_GREATER_OR_EQUAL) ? " and greater" : "");
479 static clib_error_t *
480 set_efd (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd)
482 dpdk_main_t *dm = &dpdk_main;
483 vlib_thread_main_t *tm = vlib_get_thread_main ();
484 clib_error_t *error = NULL;
485 vlib_node_runtime_t *rt = vlib_node_get_runtime (vm, dpdk_input_node.index);
487 if (unformat (input, "enable"))
489 if (unformat (input, "dpdk"))
491 dm->efd.enabled |= DPDK_EFD_DISCARD_ENABLED;
493 else if (unformat (input, "worker"))
495 tm->efd.enabled |= VLIB_EFD_DISCARD_ENABLED;
497 else if (unformat (input, "monitor"))
499 dm->efd.enabled |= DPDK_EFD_MONITOR_ENABLED;
500 tm->efd.enabled |= VLIB_EFD_MONITOR_ENABLED;
502 else if (unformat (input, "drop_all"))
504 dm->efd.enabled |= DPDK_EFD_DROPALL_ENABLED;
506 else if (unformat (input, "default"))
508 dm->efd.enabled = (DPDK_EFD_DISCARD_ENABLED |
509 DPDK_EFD_MONITOR_ENABLED);
510 tm->efd.enabled = (VLIB_EFD_DISCARD_ENABLED |
511 VLIB_EFD_MONITOR_ENABLED);
515 return clib_error_return (0, "Usage: set efd enable [dpdk | "
516 "worker | monitor | drop_all | default]");
519 else if (unformat (input, "disable"))
521 if (unformat (input, "dpdk"))
523 dm->efd.enabled &= ~DPDK_EFD_DISCARD_ENABLED;
525 else if (unformat (input, "worker"))
527 tm->efd.enabled &= ~VLIB_EFD_DISCARD_ENABLED;
529 else if (unformat (input, "monitor"))
531 dm->efd.enabled &= ~DPDK_EFD_MONITOR_ENABLED;
532 tm->efd.enabled &= ~VLIB_EFD_MONITOR_ENABLED;
534 else if (unformat (input, "drop_all"))
536 dm->efd.enabled &= ~DPDK_EFD_DROPALL_ENABLED;
538 else if (unformat (input, "all"))
545 return clib_error_return (0, "Usage: set efd disable [dpdk | "
546 "worker | monitor | drop_all | all]");
549 else if (unformat (input, "worker_queue_hi_thresh"))
552 if (unformat (input, "%u", &mark))
554 tm->efd.queue_hi_thresh = mark;
558 return clib_error_return (0, "unknown input `%U'",
559 format_unformat_error, input);
562 else if (unformat (input, "dpdk_device_hi_thresh"))
565 if (unformat (input, "%u", &thresh))
567 dm->efd.queue_hi_thresh = thresh;
571 return clib_error_return (0, "unknown input `%U'",
572 format_unformat_error, input);
575 else if (unformat (input, "consec_full_frames_hi_thresh"))
578 if (unformat (input, "%u", &thresh))
580 dm->efd.consec_full_frames_hi_thresh = thresh;
584 return clib_error_return (0, "unknown input `%U'",
585 format_unformat_error, input);
588 else if (unformat (input, "ip-prec"))
590 return (parse_op_and_prec (vm, input, cmd,
591 "ip", &tm->efd.ip_prec_bitmap));
593 else if (unformat (input, "mpls-exp"))
595 return (parse_op_and_prec (vm, input, cmd,
596 "mpls", &tm->efd.mpls_exp_bitmap));
598 else if (unformat (input, "vlan-cos"))
600 return (parse_op_and_prec (vm, input, cmd,
601 "vlan", &tm->efd.vlan_cos_bitmap));
603 else if (unformat (input, "help"))
607 " set efd enable <dpdk | worker | monitor | drop_all | default> |\n"
608 " set efd disable <dpdk | worker | monitor | drop_all | all> |\n"
609 " set efd <ip-prec | mpls-exp | vlan-cos> <ge | lt> <0-7>\n"
610 " set efd worker_queue_hi_thresh <0-32> |\n"
611 " set efd dpdk_device_hi_thresh <0-%d> |\n"
612 " set efd consec_full_frames_hi_thresh <count> |\n",
613 DPDK_NB_RX_DESC_10GE);
617 return clib_error_return (0, "unknown input `%U'",
618 format_unformat_error, input);
622 rt->function = dpdk_input_efd_multiarch_select ();
623 else if (dm->use_rss)
624 rt->function = dpdk_input_rss_multiarch_select ();
626 rt->function = dpdk_input_multiarch_select ();
632 VLIB_CLI_COMMAND (cmd_set_efd,static) = {
634 .short_help = "set early-fast-discard commands",
639 static clib_error_t *
640 set_dpdk_if_desc (vlib_main_t * vm, unformat_input_t * input,
641 vlib_cli_command_t * cmd)
643 unformat_input_t _line_input, *line_input = &_line_input;
644 dpdk_main_t *dm = &dpdk_main;
645 vnet_hw_interface_t *hw;
647 u32 hw_if_index = (u32) ~ 0;
648 u32 nb_rx_desc = (u32) ~ 0;
649 u32 nb_tx_desc = (u32) ~ 0;
652 if (!unformat_user (input, unformat_line_input, line_input))
655 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
658 (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
661 else if (unformat (line_input, "tx %d", &nb_tx_desc))
663 else if (unformat (line_input, "rx %d", &nb_rx_desc))
666 return clib_error_return (0, "parse error: '%U'",
667 format_unformat_error, line_input);
670 unformat_free (line_input);
672 if (hw_if_index == (u32) ~ 0)
673 return clib_error_return (0, "please specify valid interface name");
675 hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
676 xd = vec_elt_at_index (dm->devices, hw->dev_instance);
678 if ((xd->flags & DPDK_DEVICE_FLAG_PMD) == 0)
679 return clib_error_return (0, "number of descriptors can be set only for "
682 if ((nb_rx_desc == (u32) ~ 0 || nb_rx_desc == xd->nb_rx_desc) &&
683 (nb_tx_desc == (u32) ~ 0 || nb_tx_desc == xd->nb_tx_desc))
684 return clib_error_return (0, "nothing changed");
686 if (nb_rx_desc != (u32) ~ 0)
687 xd->nb_rx_desc = nb_rx_desc;
689 if (nb_tx_desc != (u32) ~ 0)
690 xd->nb_rx_desc = nb_rx_desc;
692 rv = dpdk_port_setup (dm, xd);
698 VLIB_CLI_COMMAND (cmd_set_dpdk_if_desc,static) = {
699 .path = "set dpdk interface descriptors",
700 .short_help = "set dpdk interface descriptors <if-name> [rx <n>] [tx <n>]",
701 .function = set_dpdk_if_desc,
705 static clib_error_t *
706 show_dpdk_if_placement (vlib_main_t * vm, unformat_input_t * input,
707 vlib_cli_command_t * cmd)
709 vlib_thread_main_t *tm = vlib_get_thread_main ();
710 dpdk_main_t *dm = &dpdk_main;
711 dpdk_device_and_queue_t *dq;
714 if (tm->n_vlib_mains == 1)
715 vlib_cli_output (vm, "All interfaces are handled by main thread");
717 for (cpu = 0; cpu < vec_len (dm->devices_by_cpu); cpu++)
719 if (vec_len (dm->devices_by_cpu[cpu]))
720 vlib_cli_output (vm, "Thread %u (%s at lcore %u):", cpu,
721 vlib_worker_threads[cpu].name,
722 vlib_worker_threads[cpu].lcore_id);
725 vec_foreach(dq, dm->devices_by_cpu[cpu])
727 u32 hw_if_index = dm->devices[dq->device].vlib_hw_if_index;
728 vnet_hw_interface_t * hi = vnet_get_hw_interface(dm->vnet_main, hw_if_index);
729 vlib_cli_output(vm, " %v queue %u", hi->name, dq->queue_id);
737 VLIB_CLI_COMMAND (cmd_show_dpdk_if_placement,static) = {
738 .path = "show dpdk interface placement",
739 .short_help = "show dpdk interface placement",
740 .function = show_dpdk_if_placement,
745 dpdk_device_queue_sort (void *a1, void *a2)
747 dpdk_device_and_queue_t *dq1 = a1;
748 dpdk_device_and_queue_t *dq2 = a2;
750 if (dq1->device > dq2->device)
752 else if (dq1->device < dq2->device)
754 else if (dq1->queue_id > dq2->queue_id)
756 else if (dq1->queue_id < dq2->queue_id)
762 static clib_error_t *
763 set_dpdk_if_placement (vlib_main_t * vm, unformat_input_t * input,
764 vlib_cli_command_t * cmd)
766 unformat_input_t _line_input, *line_input = &_line_input;
767 dpdk_main_t *dm = &dpdk_main;
768 dpdk_device_and_queue_t *dq;
769 vnet_hw_interface_t *hw;
771 u32 hw_if_index = (u32) ~ 0;
776 if (!unformat_user (input, unformat_line_input, line_input))
779 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
782 (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
785 else if (unformat (line_input, "queue %d", &queue))
787 else if (unformat (line_input, "thread %d", &cpu))
790 return clib_error_return (0, "parse error: '%U'",
791 format_unformat_error, line_input);
794 unformat_free (line_input);
796 if (hw_if_index == (u32) ~ 0)
797 return clib_error_return (0, "please specify valid interface name");
799 if (cpu < dm->input_cpu_first_index ||
800 cpu >= (dm->input_cpu_first_index + dm->input_cpu_count))
801 return clib_error_return (0, "please specify valid thread id");
803 hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
804 xd = vec_elt_at_index (dm->devices, hw->dev_instance);
806 for (i = 0; i < vec_len (dm->devices_by_cpu); i++)
809 vec_foreach(dq, dm->devices_by_cpu[i])
811 if (hw_if_index == dm->devices[dq->device].vlib_hw_if_index &&
812 queue == dq->queue_id)
814 if (cpu == i) /* nothing to do */
817 vec_del1(dm->devices_by_cpu[i], dq - dm->devices_by_cpu[i]);
818 vec_add2(dm->devices_by_cpu[cpu], dq, 1);
819 dq->queue_id = queue;
820 dq->device = xd->device_index;
821 xd->cpu_socket_id_by_queue[queue] =
822 rte_lcore_to_socket_id(vlib_worker_threads[cpu].lcore_id);
824 vec_sort_with_function(dm->devices_by_cpu[i],
825 dpdk_device_queue_sort);
827 vec_sort_with_function(dm->devices_by_cpu[cpu],
828 dpdk_device_queue_sort);
830 if (vec_len(dm->devices_by_cpu[i]) == 0)
831 vlib_node_set_state (vlib_mains[i], dpdk_input_node.index,
832 VLIB_NODE_STATE_DISABLED);
834 if (vec_len(dm->devices_by_cpu[cpu]) == 1)
835 vlib_node_set_state (vlib_mains[cpu], dpdk_input_node.index,
836 VLIB_NODE_STATE_POLLING);
844 return clib_error_return (0, "not found");
848 VLIB_CLI_COMMAND (cmd_set_dpdk_if_placement,static) = {
849 .path = "set dpdk interface placement",
850 .short_help = "set dpdk interface placement <if-name> [queue <n>] thread <n>",
851 .function = set_dpdk_if_placement,
855 static clib_error_t *
856 show_dpdk_if_hqos_placement (vlib_main_t * vm, unformat_input_t * input,
857 vlib_cli_command_t * cmd)
859 vlib_thread_main_t *tm = vlib_get_thread_main ();
860 dpdk_main_t *dm = &dpdk_main;
861 dpdk_device_and_queue_t *dq;
864 if (tm->n_vlib_mains == 1)
865 vlib_cli_output (vm, "All interfaces are handled by main thread");
867 for (cpu = 0; cpu < vec_len (dm->devices_by_hqos_cpu); cpu++)
869 if (vec_len (dm->devices_by_hqos_cpu[cpu]))
870 vlib_cli_output (vm, "Thread %u (%s at lcore %u):", cpu,
871 vlib_worker_threads[cpu].name,
872 vlib_worker_threads[cpu].lcore_id);
874 vec_foreach (dq, dm->devices_by_hqos_cpu[cpu])
876 u32 hw_if_index = dm->devices[dq->device].vlib_hw_if_index;
877 vnet_hw_interface_t *hi =
878 vnet_get_hw_interface (dm->vnet_main, hw_if_index);
879 vlib_cli_output (vm, " %v queue %u", hi->name, dq->queue_id);
886 VLIB_CLI_COMMAND (cmd_show_dpdk_if_hqos_placement, static) = {
887 .path = "show dpdk interface hqos placement",
888 .short_help = "show dpdk interface hqos placement",
889 .function = show_dpdk_if_hqos_placement,
893 static clib_error_t *
894 set_dpdk_if_hqos_placement (vlib_main_t * vm, unformat_input_t * input,
895 vlib_cli_command_t * cmd)
897 unformat_input_t _line_input, *line_input = &_line_input;
898 dpdk_main_t *dm = &dpdk_main;
899 dpdk_device_and_queue_t *dq;
900 vnet_hw_interface_t *hw;
902 u32 hw_if_index = (u32) ~ 0;
906 if (!unformat_user (input, unformat_line_input, line_input))
909 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
912 (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
915 else if (unformat (line_input, "thread %d", &cpu))
918 return clib_error_return (0, "parse error: '%U'",
919 format_unformat_error, line_input);
922 unformat_free (line_input);
924 if (hw_if_index == (u32) ~ 0)
925 return clib_error_return (0, "please specify valid interface name");
927 if (cpu < dm->hqos_cpu_first_index ||
928 cpu >= (dm->hqos_cpu_first_index + dm->hqos_cpu_count))
929 return clib_error_return (0, "please specify valid thread id");
931 hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
932 xd = vec_elt_at_index (dm->devices, hw->dev_instance);
934 for (i = 0; i < vec_len (dm->devices_by_hqos_cpu); i++)
936 vec_foreach (dq, dm->devices_by_hqos_cpu[i])
938 if (hw_if_index == dm->devices[dq->device].vlib_hw_if_index)
940 if (cpu == i) /* nothing to do */
943 vec_del1 (dm->devices_by_hqos_cpu[i],
944 dq - dm->devices_by_hqos_cpu[i]);
945 vec_add2 (dm->devices_by_hqos_cpu[cpu], dq, 1);
947 dq->device = xd->device_index;
949 vec_sort_with_function (dm->devices_by_hqos_cpu[i],
950 dpdk_device_queue_sort);
952 vec_sort_with_function (dm->devices_by_hqos_cpu[cpu],
953 dpdk_device_queue_sort);
960 return clib_error_return (0, "not found");
964 VLIB_CLI_COMMAND (cmd_set_dpdk_if_hqos_placement, static) = {
965 .path = "set dpdk interface hqos placement",
966 .short_help = "set dpdk interface hqos placement <if-name> thread <n>",
967 .function = set_dpdk_if_hqos_placement,
971 static clib_error_t *
972 set_dpdk_if_hqos_pipe (vlib_main_t * vm, unformat_input_t * input,
973 vlib_cli_command_t * cmd)
975 unformat_input_t _line_input, *line_input = &_line_input;
976 dpdk_main_t *dm = &dpdk_main;
977 vnet_hw_interface_t *hw;
979 u32 hw_if_index = (u32) ~ 0;
980 u32 subport_id = (u32) ~ 0;
981 u32 pipe_id = (u32) ~ 0;
982 u32 profile_id = (u32) ~ 0;
985 if (!unformat_user (input, unformat_line_input, line_input))
988 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
991 (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
994 else if (unformat (line_input, "subport %d", &subport_id))
996 else if (unformat (line_input, "pipe %d", &pipe_id))
998 else if (unformat (line_input, "profile %d", &profile_id))
1001 return clib_error_return (0, "parse error: '%U'",
1002 format_unformat_error, line_input);
1005 unformat_free (line_input);
1007 if (hw_if_index == (u32) ~ 0)
1008 return clib_error_return (0, "please specify valid interface name");
1010 hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
1011 xd = vec_elt_at_index (dm->devices, hw->dev_instance);
1014 rte_sched_pipe_config (xd->hqos_ht->hqos, subport_id, pipe_id,
1017 return clib_error_return (0, "pipe configuration failed");
1023 VLIB_CLI_COMMAND (cmd_set_dpdk_if_hqos_pipe, static) =
1025 .path = "set dpdk interface hqos pipe",
1026 .short_help = "set dpdk interface hqos pipe <if-name> subport <n> pipe <n> "
1028 .function = set_dpdk_if_hqos_pipe,
1032 static clib_error_t *
1033 set_dpdk_if_hqos_subport (vlib_main_t * vm, unformat_input_t * input,
1034 vlib_cli_command_t * cmd)
1036 unformat_input_t _line_input, *line_input = &_line_input;
1037 dpdk_main_t *dm = &dpdk_main;
1038 vnet_hw_interface_t *hw;
1040 u32 hw_if_index = (u32) ~ 0;
1041 u32 subport_id = (u32) ~ 0;
1042 struct rte_sched_subport_params p = {
1043 .tb_rate = 1250000000, /* 10GbE */
1045 .tc_rate = {1250000000, 1250000000, 1250000000, 1250000000},
1050 if (!unformat_user (input, unformat_line_input, line_input))
1053 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
1056 (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
1059 else if (unformat (line_input, "subport %d", &subport_id))
1061 else if (unformat (line_input, "rate %d", &p.tb_rate))
1063 p.tc_rate[0] = p.tb_rate;
1064 p.tc_rate[1] = p.tb_rate;
1065 p.tc_rate[2] = p.tb_rate;
1066 p.tc_rate[3] = p.tb_rate;
1068 else if (unformat (line_input, "bktsize %d", &p.tb_size))
1070 else if (unformat (line_input, "tc0 %d", &p.tc_rate[0]))
1072 else if (unformat (line_input, "tc1 %d", &p.tc_rate[1]))
1074 else if (unformat (line_input, "tc2 %d", &p.tc_rate[2]))
1076 else if (unformat (line_input, "tc3 %d", &p.tc_rate[3]))
1078 else if (unformat (line_input, "period %d", &p.tc_period))
1081 return clib_error_return (0, "parse error: '%U'",
1082 format_unformat_error, line_input);
1085 unformat_free (line_input);
1087 if (hw_if_index == (u32) ~ 0)
1088 return clib_error_return (0, "please specify valid interface name");
1090 hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
1091 xd = vec_elt_at_index (dm->devices, hw->dev_instance);
1093 rv = rte_sched_subport_config (xd->hqos_ht->hqos, subport_id, &p);
1095 return clib_error_return (0, "subport configuration failed");
1101 VLIB_CLI_COMMAND (cmd_set_dpdk_if_hqos_subport, static) = {
1102 .path = "set dpdk interface hqos subport",
1103 .short_help = "set dpdk interface hqos subport <if-name> subport <n> "
1104 "[rate <n>] [bktsize <n>] [tc0 <n>] [tc1 <n>] [tc2 <n>] [tc3 <n>] "
1106 .function = set_dpdk_if_hqos_subport,
1110 static clib_error_t *
1111 set_dpdk_if_hqos_tctbl (vlib_main_t * vm, unformat_input_t * input,
1112 vlib_cli_command_t * cmd)
1114 unformat_input_t _line_input, *line_input = &_line_input;
1115 vlib_thread_main_t *tm = vlib_get_thread_main ();
1116 dpdk_main_t *dm = &dpdk_main;
1117 vnet_hw_interface_t *hw;
1119 u32 hw_if_index = (u32) ~ 0;
1121 u32 queue = (u32) ~ 0;
1122 u32 entry = (u32) ~ 0;
1125 if (!unformat_user (input, unformat_line_input, line_input))
1128 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
1131 (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
1134 else if (unformat (line_input, "entry %d", &entry))
1136 else if (unformat (line_input, "tc %d", &tc))
1138 else if (unformat (line_input, "queue %d", &queue))
1141 return clib_error_return (0, "parse error: '%U'",
1142 format_unformat_error, line_input);
1145 unformat_free (line_input);
1147 if (hw_if_index == (u32) ~ 0)
1148 return clib_error_return (0, "please specify valid interface name");
1150 return clib_error_return (0, "invalid entry");
1151 if (tc >= RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE)
1152 return clib_error_return (0, "invalid traffic class");
1153 if (queue >= RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS)
1154 return clib_error_return (0, "invalid traffic class");
1156 hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
1157 xd = vec_elt_at_index (dm->devices, hw->dev_instance);
1159 /* Detect the set of worker threads */
1160 uword *p = hash_get_mem (tm->thread_registrations_by_name, "workers");
1161 /* Should never happen, shut up Coverity warning */
1163 return clib_error_return (0, "no worker registrations?");
1165 vlib_thread_registration_t *tr = (vlib_thread_registration_t *) p[0];
1166 int worker_thread_first = tr->first_index;
1167 int worker_thread_count = tr->count;
1169 val = tc * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS + queue;
1170 for (i = 0; i < worker_thread_count; i++)
1171 xd->hqos_wt[worker_thread_first + i].hqos_tc_table[entry] = val;
1177 VLIB_CLI_COMMAND (cmd_set_dpdk_if_hqos_tctbl, static) = {
1178 .path = "set dpdk interface hqos tctbl",
1179 .short_help = "set dpdk interface hqos tctbl <if-name> entry <n> tc <n> queue <n>",
1180 .function = set_dpdk_if_hqos_tctbl,
1184 static clib_error_t *
1185 set_dpdk_if_hqos_pktfield (vlib_main_t * vm, unformat_input_t * input,
1186 vlib_cli_command_t * cmd)
1188 unformat_input_t _line_input, *line_input = &_line_input;
1189 vlib_thread_main_t *tm = vlib_get_thread_main ();
1190 dpdk_main_t *dm = &dpdk_main;
1192 /* Device specific data */
1193 struct rte_eth_dev_info dev_info;
1194 dpdk_device_config_t *devconf = 0;
1195 vnet_hw_interface_t *hw;
1197 u32 hw_if_index = (u32) ~ 0;
1199 /* Detect the set of worker threads */
1200 uword *p = hash_get_mem (tm->thread_registrations_by_name, "workers");
1201 /* Should never happen, shut up Coverity warning */
1203 return clib_error_return (0, "no worker registrations?");
1205 vlib_thread_registration_t *tr = (vlib_thread_registration_t *) p[0];
1206 int worker_thread_first = tr->first_index;
1207 int worker_thread_count = tr->count;
1209 /* Packet field configuration */
1210 u64 mask = (u64) ~ 0;
1212 u32 offset = (u32) ~ 0;
1215 u32 n_subports_per_port, n_pipes_per_subport, tctbl_size;
1219 /* Parse input arguments */
1220 if (!unformat_user (input, unformat_line_input, line_input))
1223 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
1226 (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
1229 else if (unformat (line_input, "id %d", &id))
1231 else if (unformat (line_input, "offset %d", &offset))
1233 else if (unformat (line_input, "mask %llx", &mask))
1236 return clib_error_return (0, "parse error: '%U'",
1237 format_unformat_error, line_input);
1240 unformat_free (line_input);
1243 if (hw_if_index == (u32) ~ 0)
1244 return clib_error_return (0, "please specify valid interface name");
1246 hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
1247 xd = vec_elt_at_index (dm->devices, hw->dev_instance);
1249 rte_eth_dev_info_get (xd->device_index, &dev_info);
1250 if (dev_info.pci_dev)
1251 { /* bonded interface has no pci info */
1252 vlib_pci_addr_t pci_addr;
1254 pci_addr.domain = dev_info.pci_dev->addr.domain;
1255 pci_addr.bus = dev_info.pci_dev->addr.bus;
1256 pci_addr.slot = dev_info.pci_dev->addr.devid;
1257 pci_addr.function = dev_info.pci_dev->addr.function;
1260 hash_get (dm->conf->device_config_index_by_pci_addr, pci_addr.as_u32);
1264 devconf = pool_elt_at_index (dm->conf->dev_confs, p[0]);
1266 devconf = &dm->conf->default_devconf;
1268 if (devconf->hqos_enabled == 0)
1270 vlib_cli_output (vm, "HQoS disabled for this interface");
1274 n_subports_per_port = devconf->hqos.port.n_subports_per_port;
1275 n_pipes_per_subport = devconf->hqos.port.n_pipes_per_subport;
1276 tctbl_size = RTE_DIM (devconf->hqos.tc_table);
1278 /* Validate packet field configuration: id, offset and mask */
1280 return clib_error_return (0, "invalid packet field id");
1285 if (dpdk_hqos_validate_mask (mask, n_subports_per_port) != 0)
1286 return clib_error_return (0, "invalid subport ID mask "
1287 "(n_subports_per_port = %u)",
1288 n_subports_per_port);
1291 if (dpdk_hqos_validate_mask (mask, n_pipes_per_subport) != 0)
1292 return clib_error_return (0, "invalid pipe ID mask "
1293 "(n_pipes_per_subport = %u)",
1294 n_pipes_per_subport);
1298 if (dpdk_hqos_validate_mask (mask, tctbl_size) != 0)
1299 return clib_error_return (0, "invalid TC table index mask "
1300 "(TC table size = %u)", tctbl_size);
1303 /* Propagate packet field configuration to all workers */
1304 for (i = 0; i < worker_thread_count; i++)
1308 xd->hqos_wt[worker_thread_first + i].hqos_field0_slabpos = offset;
1309 xd->hqos_wt[worker_thread_first + i].hqos_field0_slabmask = mask;
1310 xd->hqos_wt[worker_thread_first + i].hqos_field0_slabshr =
1311 __builtin_ctzll (mask);
1314 xd->hqos_wt[worker_thread_first + i].hqos_field1_slabpos = offset;
1315 xd->hqos_wt[worker_thread_first + i].hqos_field1_slabmask = mask;
1316 xd->hqos_wt[worker_thread_first + i].hqos_field1_slabshr =
1317 __builtin_ctzll (mask);
1321 xd->hqos_wt[worker_thread_first + i].hqos_field2_slabpos = offset;
1322 xd->hqos_wt[worker_thread_first + i].hqos_field2_slabmask = mask;
1323 xd->hqos_wt[worker_thread_first + i].hqos_field2_slabshr =
1324 __builtin_ctzll (mask);
1331 VLIB_CLI_COMMAND (cmd_set_dpdk_if_hqos_pktfield, static) = {
1332 .path = "set dpdk interface hqos pktfield",
1333 .short_help = "set dpdk interface hqos pktfield <if-name> id <n> offset <n> "
1335 .function = set_dpdk_if_hqos_pktfield,
1339 static clib_error_t *
1340 show_dpdk_if_hqos (vlib_main_t * vm, unformat_input_t * input,
1341 vlib_cli_command_t * cmd)
1343 unformat_input_t _line_input, *line_input = &_line_input;
1344 vlib_thread_main_t *tm = vlib_get_thread_main ();
1345 dpdk_main_t *dm = &dpdk_main;
1346 vnet_hw_interface_t *hw;
1348 dpdk_device_config_hqos_t *cfg;
1349 dpdk_device_hqos_per_hqos_thread_t *ht;
1350 dpdk_device_hqos_per_worker_thread_t *wk;
1352 u32 hw_if_index = (u32) ~ 0;
1354 struct rte_eth_dev_info dev_info;
1355 dpdk_device_config_t *devconf = 0;
1356 vlib_thread_registration_t *tr;
1359 if (!unformat_user (input, unformat_line_input, line_input))
1362 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
1365 (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
1369 return clib_error_return (0, "parse error: '%U'",
1370 format_unformat_error, line_input);
1373 unformat_free (line_input);
1375 if (hw_if_index == (u32) ~ 0)
1376 return clib_error_return (0, "please specify interface name!!");
1378 hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
1379 xd = vec_elt_at_index (dm->devices, hw->dev_instance);
1381 rte_eth_dev_info_get (xd->device_index, &dev_info);
1382 if (dev_info.pci_dev)
1383 { /* bonded interface has no pci info */
1384 vlib_pci_addr_t pci_addr;
1386 pci_addr.domain = dev_info.pci_dev->addr.domain;
1387 pci_addr.bus = dev_info.pci_dev->addr.bus;
1388 pci_addr.slot = dev_info.pci_dev->addr.devid;
1389 pci_addr.function = dev_info.pci_dev->addr.function;
1392 hash_get (dm->conf->device_config_index_by_pci_addr, pci_addr.as_u32);
1396 devconf = pool_elt_at_index (dm->conf->dev_confs, p[0]);
1398 devconf = &dm->conf->default_devconf;
1400 if (devconf->hqos_enabled == 0)
1402 vlib_cli_output (vm, "HQoS disabled for this interface");
1406 /* Detect the set of worker threads */
1407 p = hash_get_mem (tm->thread_registrations_by_name, "workers");
1409 /* Should never happen, shut up Coverity warning */
1411 return clib_error_return (0, "no worker registrations?");
1413 tr = (vlib_thread_registration_t *) p[0];
1415 cfg = &devconf->hqos;
1417 wk = &xd->hqos_wt[tr->first_index];
1418 tctbl = wk->hqos_tc_table;
1420 vlib_cli_output (vm, " Thread:");
1421 vlib_cli_output (vm, " Input SWQ size = %u packets", cfg->swq_size);
1422 vlib_cli_output (vm, " Enqueue burst size = %u packets",
1423 ht->hqos_burst_enq);
1424 vlib_cli_output (vm, " Dequeue burst size = %u packets",
1425 ht->hqos_burst_deq);
1427 vlib_cli_output (vm,
1428 " Packet field 0: slab position = %4u, slab bitmask = 0x%016llx",
1429 wk->hqos_field0_slabpos, wk->hqos_field0_slabmask);
1430 vlib_cli_output (vm,
1431 " Packet field 1: slab position = %4u, slab bitmask = 0x%016llx",
1432 wk->hqos_field1_slabpos, wk->hqos_field1_slabmask);
1433 vlib_cli_output (vm,
1434 " Packet field 2: slab position = %4u, slab bitmask = 0x%016llx",
1435 wk->hqos_field2_slabpos, wk->hqos_field2_slabmask);
1436 vlib_cli_output (vm, " Packet field 2 translation table:");
1437 vlib_cli_output (vm, " [ 0 .. 15]: "
1438 "%2u %2u %2u %2u %2u %2u %2u %2u %2u %2u %2u %2u %2u %2u %2u %2u",
1439 tctbl[0], tctbl[1], tctbl[2], tctbl[3],
1440 tctbl[4], tctbl[5], tctbl[6], tctbl[7],
1441 tctbl[8], tctbl[9], tctbl[10], tctbl[11],
1442 tctbl[12], tctbl[13], tctbl[14], tctbl[15]);
1443 vlib_cli_output (vm, " [16 .. 31]: "
1444 "%2u %2u %2u %2u %2u %2u %2u %2u %2u %2u %2u %2u %2u %2u %2u %2u",
1445 tctbl[16], tctbl[17], tctbl[18], tctbl[19],
1446 tctbl[20], tctbl[21], tctbl[22], tctbl[23],
1447 tctbl[24], tctbl[25], tctbl[26], tctbl[27],
1448 tctbl[28], tctbl[29], tctbl[30], tctbl[31]);
1449 vlib_cli_output (vm, " [32 .. 47]: "
1450 "%2u %2u %2u %2u %2u %2u %2u %2u %2u %2u %2u %2u %2u %2u %2u %2u",
1451 tctbl[32], tctbl[33], tctbl[34], tctbl[35],
1452 tctbl[36], tctbl[37], tctbl[38], tctbl[39],
1453 tctbl[40], tctbl[41], tctbl[42], tctbl[43],
1454 tctbl[44], tctbl[45], tctbl[46], tctbl[47]);
1455 vlib_cli_output (vm, " [48 .. 63]: "
1456 "%2u %2u %2u %2u %2u %2u %2u %2u %2u %2u %2u %2u %2u %2u %2u %2u",
1457 tctbl[48], tctbl[49], tctbl[50], tctbl[51],
1458 tctbl[52], tctbl[53], tctbl[54], tctbl[55],
1459 tctbl[56], tctbl[57], tctbl[58], tctbl[59],
1460 tctbl[60], tctbl[61], tctbl[62], tctbl[63]);
1462 vlib_cli_output (vm, " Port:");
1463 vlib_cli_output (vm, " Rate = %u bytes/second", cfg->port.rate);
1464 vlib_cli_output (vm, " MTU = %u bytes", cfg->port.mtu);
1465 vlib_cli_output (vm, " Frame overhead = %u bytes",
1466 cfg->port.frame_overhead);
1467 vlib_cli_output (vm, " Number of subports = %u",
1468 cfg->port.n_subports_per_port);
1469 vlib_cli_output (vm, " Number of pipes per subport = %u",
1470 cfg->port.n_pipes_per_subport);
1471 vlib_cli_output (vm,
1472 " Packet queue size: TC0 = %u, TC1 = %u, TC2 = %u, TC3 = %u packets",
1473 cfg->port.qsize[0], cfg->port.qsize[1], cfg->port.qsize[2],
1474 cfg->port.qsize[3]);
1475 vlib_cli_output (vm, " Number of pipe profiles = %u",
1476 cfg->port.n_pipe_profiles);
1478 for (profile_id = 0; profile_id < vec_len (cfg->pipe); profile_id++)
1480 vlib_cli_output (vm, " Pipe profile %u:", profile_id);
1481 vlib_cli_output (vm, " Rate = %u bytes/second",
1482 cfg->pipe[profile_id].tb_rate);
1483 vlib_cli_output (vm, " Token bucket size = %u bytes",
1484 cfg->pipe[profile_id].tb_size);
1485 vlib_cli_output (vm,
1486 " Traffic class rate: TC0 = %u, TC1 = %u, TC2 = %u, TC3 = %u bytes/second",
1487 cfg->pipe[profile_id].tc_rate[0],
1488 cfg->pipe[profile_id].tc_rate[1],
1489 cfg->pipe[profile_id].tc_rate[2],
1490 cfg->pipe[profile_id].tc_rate[3]);
1491 vlib_cli_output (vm, " TC period = %u milliseconds",
1492 cfg->pipe[profile_id].tc_period);
1493 #ifdef RTE_SCHED_SUBPORT_TC_OV
1494 vlib_cli_output (vm, " TC3 oversubscription_weight = %u",
1495 cfg->pipe[profile_id].tc_ov_weight);
1498 for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++)
1500 vlib_cli_output (vm,
1501 " TC%u WRR weights: Q0 = %u, Q1 = %u, Q2 = %u, Q3 = %u",
1502 i, cfg->pipe[profile_id].wrr_weights[i * 4],
1503 cfg->pipe[profile_id].wrr_weights[i * 4 + 1],
1504 cfg->pipe[profile_id].wrr_weights[i * 4 + 2],
1505 cfg->pipe[profile_id].wrr_weights[i * 4 + 3]);
1509 #ifdef RTE_SCHED_RED
1510 vlib_cli_output (vm, " Weighted Random Early Detection (WRED):");
1511 for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++)
1513 vlib_cli_output (vm, " TC%u min: G = %u, Y = %u, R = %u", i,
1514 cfg->port.red_params[i][e_RTE_METER_GREEN].min_th,
1515 cfg->port.red_params[i][e_RTE_METER_YELLOW].min_th,
1516 cfg->port.red_params[i][e_RTE_METER_RED].min_th);
1518 vlib_cli_output (vm, " TC%u max: G = %u, Y = %u, R = %u", i,
1519 cfg->port.red_params[i][e_RTE_METER_GREEN].max_th,
1520 cfg->port.red_params[i][e_RTE_METER_YELLOW].max_th,
1521 cfg->port.red_params[i][e_RTE_METER_RED].max_th);
1523 vlib_cli_output (vm,
1524 " TC%u inverted probability: G = %u, Y = %u, R = %u",
1525 i, cfg->port.red_params[i][e_RTE_METER_GREEN].maxp_inv,
1526 cfg->port.red_params[i][e_RTE_METER_YELLOW].maxp_inv,
1527 cfg->port.red_params[i][e_RTE_METER_RED].maxp_inv);
1529 vlib_cli_output (vm, " TC%u weight: R = %u, Y = %u, R = %u", i,
1530 cfg->port.red_params[i][e_RTE_METER_GREEN].wq_log2,
1531 cfg->port.red_params[i][e_RTE_METER_YELLOW].wq_log2,
1532 cfg->port.red_params[i][e_RTE_METER_RED].wq_log2);
1540 VLIB_CLI_COMMAND (cmd_show_dpdk_if_hqos, static) = {
1541 .path = "show dpdk interface hqos",
1542 .short_help = "show dpdk interface hqos <if-name>",
1543 .function = show_dpdk_if_hqos,
1548 dpdk_cli_init (vlib_main_t * vm)
1553 VLIB_INIT_FUNCTION (dpdk_cli_init);
1556 * fd.io coding-style-patch-verification: ON
1559 * eval: (c-set-style "gnu")