1 diff --git a/src/plugins/dpdk/CMakeLists.txt b/src/plugins/dpdk/CMakeLists.txt
2 index e0122d928..af8c80d8f 100644
3 --- a/src/plugins/dpdk/CMakeLists.txt
4 +++ b/src/plugins/dpdk/CMakeLists.txt
5 @@ -118,8 +118,6 @@ add_vpp_plugin(dpdk
14 @@ -127,7 +125,6 @@ add_vpp_plugin(dpdk
22 @@ -142,12 +139,6 @@ add_vpp_plugin(dpdk
35 diff --git a/src/plugins/dpdk/device/cli.c b/src/plugins/dpdk/device/cli.c
36 index 416d97360..0f771c6ba 100644
37 --- a/src/plugins/dpdk/device/cli.c
38 +++ b/src/plugins/dpdk/device/cli.c
44 -static clib_error_t *
45 -get_hqos (u32 hw_if_index, u32 subport_id, dpdk_device_t ** xd,
46 - dpdk_device_config_t ** devconf)
48 - dpdk_main_t *dm = &dpdk_main;
49 - vnet_hw_interface_t *hw;
50 - struct rte_eth_dev_info dev_info;
51 - struct rte_pci_device *pci_dev;
53 - clib_error_t *error = NULL;
56 - if (hw_if_index == (u32) ~ 0)
58 - error = clib_error_return (0, "please specify valid interface name");
62 - if (subport_id != 0)
64 - error = clib_error_return (0, "Invalid subport");
68 - hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
69 - *xd = vec_elt_at_index (dm->devices, hw->dev_instance);
71 - rte_eth_dev_info_get ((*xd)->port_id, &dev_info);
73 - pci_dev = dpdk_get_pci_device (&dev_info);
77 - vlib_pci_addr_t pci_addr;
79 - pci_addr.domain = pci_dev->addr.domain;
80 - pci_addr.bus = pci_dev->addr.bus;
81 - pci_addr.slot = pci_dev->addr.devid;
82 - pci_addr.function = pci_dev->addr.function;
85 - hash_get (dm->conf->device_config_index_by_pci_addr, pci_addr.as_u32);
89 - (*devconf) = pool_elt_at_index (dm->conf->dev_confs, p[0]);
91 - (*devconf) = &dm->conf->default_devconf;
99 show_dpdk_buffer (vlib_main_t * vm, unformat_input_t * input,
100 vlib_cli_command_t * cmd)
101 @@ -408,1308 +353,6 @@ VLIB_CLI_COMMAND (cmd_set_dpdk_if_desc,static) = {
107 -dpdk_device_queue_sort (void *a1, void *a2)
109 - dpdk_device_and_queue_t *dq1 = a1;
110 - dpdk_device_and_queue_t *dq2 = a2;
112 - if (dq1->device > dq2->device)
114 - else if (dq1->device < dq2->device)
116 - else if (dq1->queue_id > dq2->queue_id)
118 - else if (dq1->queue_id < dq2->queue_id)
125 -static clib_error_t *
126 -show_dpdk_if_hqos_placement (vlib_main_t * vm, unformat_input_t * input,
127 - vlib_cli_command_t * cmd)
129 - vlib_thread_main_t *tm = vlib_get_thread_main ();
130 - dpdk_main_t *dm = &dpdk_main;
131 - dpdk_device_and_queue_t *dq;
134 - if (tm->n_vlib_mains == 1)
135 - vlib_cli_output (vm, "All interfaces are handled by main thread");
137 - for (cpu = 0; cpu < vec_len (dm->devices_by_hqos_cpu); cpu++)
139 - if (cpu >= dm->hqos_cpu_first_index &&
140 - cpu < (dm->hqos_cpu_first_index + dm->hqos_cpu_count))
141 - vlib_cli_output (vm, "Thread %u (%s at lcore %u):", cpu,
142 - vlib_worker_threads[cpu].name,
143 - vlib_worker_threads[cpu].cpu_id);
145 - vec_foreach (dq, dm->devices_by_hqos_cpu[cpu])
147 - u32 hw_if_index = dm->devices[dq->device].hw_if_index;
148 - vnet_hw_interface_t *hi =
149 - vnet_get_hw_interface (dm->vnet_main, hw_if_index);
150 - vlib_cli_output (vm, " %v queue %u", hi->name, dq->queue_id);
157 - * This command is used to display the thread and core each
158 - * DPDK output interface and HQoS queue is assigned too.
161 - * Example of how to display the DPDK output interface and HQoS queue placement:
162 - * @cliexstart{show dpdk interface hqos placement}
163 - * Thread 1 (vpp_hqos-threads_0 at lcore 3):
164 - * GigabitEthernet0/8/0 queue 0
165 - * Thread 2 (vpp_hqos-threads_1 at lcore 4):
166 - * GigabitEthernet0/9/0 queue 0
170 -VLIB_CLI_COMMAND (cmd_show_dpdk_if_hqos_placement, static) = {
171 - .path = "show dpdk interface hqos placement",
172 - .short_help = "show dpdk interface hqos placement",
173 - .function = show_dpdk_if_hqos_placement,
177 -static clib_error_t *
178 -set_dpdk_if_hqos_placement (vlib_main_t * vm, unformat_input_t * input,
179 - vlib_cli_command_t * cmd)
181 - unformat_input_t _line_input, *line_input = &_line_input;
182 - dpdk_main_t *dm = &dpdk_main;
183 - dpdk_device_and_queue_t *dq;
184 - vnet_hw_interface_t *hw;
186 - u32 hw_if_index = (u32) ~ 0;
187 - u32 cpu = (u32) ~ 0;
189 - clib_error_t *error = NULL;
191 - if (!unformat_user (input, unformat_line_input, line_input))
194 - while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
197 - (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
200 - else if (unformat (line_input, "thread %d", &cpu))
204 - error = clib_error_return (0, "parse error: '%U'",
205 - format_unformat_error, line_input);
210 - if (hw_if_index == (u32) ~ 0)
211 - return clib_error_return (0, "please specify valid interface name");
213 - if (cpu < dm->hqos_cpu_first_index ||
214 - cpu >= (dm->hqos_cpu_first_index + dm->hqos_cpu_count))
216 - error = clib_error_return (0, "please specify valid thread id");
220 - hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
221 - xd = vec_elt_at_index (dm->devices, hw->dev_instance);
223 - for (i = 0; i < vec_len (dm->devices_by_hqos_cpu); i++)
225 - vec_foreach (dq, dm->devices_by_hqos_cpu[i])
227 - if (hw_if_index == dm->devices[dq->device].hw_if_index)
229 - if (cpu == i) /* nothing to do */
232 - vec_del1 (dm->devices_by_hqos_cpu[i],
233 - dq - dm->devices_by_hqos_cpu[i]);
234 - vec_add2 (dm->devices_by_hqos_cpu[cpu], dq, 1);
236 - dq->device = xd->device_index;
238 - vec_sort_with_function (dm->devices_by_hqos_cpu[i],
239 - dpdk_device_queue_sort);
241 - vec_sort_with_function (dm->devices_by_hqos_cpu[cpu],
242 - dpdk_device_queue_sort);
249 - error = clib_error_return (0, "not found");
252 - unformat_free (line_input);
258 - * This command is used to assign a given DPDK output interface and
259 - * HQoS queue to a different thread. This will not create a thread,
260 - * so the thread must already exist. Use '<em>/etc/vpp/startup.conf</em>'
261 - * for the initial thread creation. See @ref qos_doc for more details.
264 - * Example of how to display the DPDK output interface and HQoS queue placement:
265 - * @cliexstart{show dpdk interface hqos placement}
266 - * Thread 1 (vpp_hqos-threads_0 at lcore 3):
267 - * GigabitEthernet0/8/0 queue 0
268 - * Thread 2 (vpp_hqos-threads_1 at lcore 4):
269 - * GigabitEthernet0/9/0 queue 0
271 - * Example of how to assign a DPDK output interface and HQoS queue to a thread:
272 - * @cliexcmd{set dpdk interface hqos placement GigabitEthernet0/8/0 thread 2}
275 -VLIB_CLI_COMMAND (cmd_set_dpdk_if_hqos_placement, static) = {
276 - .path = "set dpdk interface hqos placement",
277 - .short_help = "set dpdk interface hqos placement <interface> thread <n>",
278 - .function = set_dpdk_if_hqos_placement,
282 -static clib_error_t *
283 -set_dpdk_if_hqos_pipe (vlib_main_t * vm, unformat_input_t * input,
284 - vlib_cli_command_t * cmd)
286 - unformat_input_t _line_input, *line_input = &_line_input;
287 - dpdk_main_t *dm = &dpdk_main;
288 - vnet_hw_interface_t *hw;
290 - u32 hw_if_index = (u32) ~ 0;
291 - u32 subport_id = (u32) ~ 0;
292 - u32 pipe_id = (u32) ~ 0;
293 - u32 profile_id = (u32) ~ 0;
295 - clib_error_t *error = NULL;
297 - if (!unformat_user (input, unformat_line_input, line_input))
300 - while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
303 - (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
306 - else if (unformat (line_input, "subport %d", &subport_id))
308 - else if (unformat (line_input, "pipe %d", &pipe_id))
310 - else if (unformat (line_input, "profile %d", &profile_id))
314 - error = clib_error_return (0, "parse error: '%U'",
315 - format_unformat_error, line_input);
320 - if (hw_if_index == (u32) ~ 0)
322 - error = clib_error_return (0, "please specify valid interface name");
326 - hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
327 - xd = vec_elt_at_index (dm->devices, hw->dev_instance);
330 - rte_sched_pipe_config (xd->hqos_ht->hqos, subport_id, pipe_id,
334 - error = clib_error_return (0, "pipe configuration failed");
339 - unformat_free (line_input);
345 - * This command is used to change the profile associate with a HQoS pipe. The
346 - * '<em><profile_id></em>' is zero based. Use the command
347 - * '<em>show dpdk interface hqos</em>' to display the content of each profile.
348 - * See @ref qos_doc for more details.
351 - * Currently there is not an API to create a new HQoS pipe profile. One is
352 - * created by default in the code (search for '<em>hqos_pipe_params_default</em>'').
353 - * Additional profiles can be created in code and code recompiled. Then use this
354 - * command to assign it.
357 - * Example of how to assign a new profile to a HQoS pipe:
358 - * @cliexcmd{set dpdk interface hqos pipe GigabitEthernet0/8/0 subport 0 pipe 2 profile 1}
361 -VLIB_CLI_COMMAND (cmd_set_dpdk_if_hqos_pipe, static) =
363 - .path = "set dpdk interface hqos pipe",
364 - .short_help = "set dpdk interface hqos pipe <interface> subport <subport_id> pipe <pipe_id> "
365 - "profile <profile_id>",
366 - .function = set_dpdk_if_hqos_pipe,
370 -static clib_error_t *
371 -set_dpdk_if_hqos_subport (vlib_main_t * vm, unformat_input_t * input,
372 - vlib_cli_command_t * cmd)
374 - unformat_input_t _line_input, *line_input = &_line_input;
375 - dpdk_main_t *dm = &dpdk_main;
376 - dpdk_device_t *xd = NULL;
377 - u32 hw_if_index = (u32) ~ 0;
378 - u32 subport_id = (u32) ~ 0;
379 - struct rte_sched_subport_params p;
381 - clib_error_t *error = NULL;
382 - u32 tb_rate = (u32) ~ 0;
383 - u32 tb_size = (u32) ~ 0;
384 - u32 tc_rate[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE] =
385 - { (u32) ~ 0, (u32) ~ 0, (u32) ~ 0, (u32) ~ 0 };
386 - u32 tc_period = (u32) ~ 0;
387 - dpdk_device_config_t *devconf = NULL;
389 - if (!unformat_user (input, unformat_line_input, line_input))
392 - while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
395 - (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
398 - else if (unformat (line_input, "subport %d", &subport_id))
400 - else if (unformat (line_input, "rate %d", &tb_rate))
402 - else if (unformat (line_input, "bktsize %d", &tb_size))
404 - else if (unformat (line_input, "tc0 %d", &tc_rate[0]))
406 - else if (unformat (line_input, "tc1 %d", &tc_rate[1]))
408 - else if (unformat (line_input, "tc2 %d", &tc_rate[2]))
410 - else if (unformat (line_input, "tc3 %d", &tc_rate[3]))
412 - else if (unformat (line_input, "period %d", &tc_period))
416 - error = clib_error_return (0, "parse error: '%U'",
417 - format_unformat_error, line_input);
422 - error = get_hqos (hw_if_index, subport_id, &xd, &devconf);
426 - /* Copy the current values over to local structure. */
427 - memcpy (&p, &devconf->hqos.subport[subport_id], sizeof (p));
429 - /* Update local structure with input values. */
430 - if (tb_rate != (u32) ~ 0)
432 - p.tb_rate = tb_rate;
433 - p.tc_rate[0] = tb_rate;
434 - p.tc_rate[1] = tb_rate;
435 - p.tc_rate[2] = tb_rate;
436 - p.tc_rate[3] = tb_rate;
438 - if (tb_size != (u32) ~ 0)
440 - p.tb_size = tb_size;
442 - if (tc_rate[0] != (u32) ~ 0)
444 - p.tc_rate[0] = tc_rate[0];
446 - if (tc_rate[1] != (u32) ~ 0)
448 - p.tc_rate[1] = tc_rate[1];
450 - if (tc_rate[2] != (u32) ~ 0)
452 - p.tc_rate[2] = tc_rate[2];
454 - if (tc_rate[3] != (u32) ~ 0)
456 - p.tc_rate[3] = tc_rate[3];
458 - if (tc_period != (u32) ~ 0)
460 - p.tc_period = tc_period;
463 - /* Apply changes. */
464 - rv = rte_sched_subport_config (xd->hqos_ht->hqos, subport_id, &p);
467 - error = clib_error_return (0, "subport configuration failed");
472 - /* Successfully applied, so save of the input values. */
473 - memcpy (&devconf->hqos.subport[subport_id], &p, sizeof (p));
478 - unformat_free (line_input);
484 - * This command is used to set the subport level parameters such as token
485 - * bucket rate (bytes per seconds), token bucket size (bytes), traffic class
486 - * rates (bytes per seconds) and token update period (Milliseconds).
488 - * By default, the '<em>rate</em>' is set to 1250000000 bytes/second (10GbE
489 - * rate) and each of the four traffic classes is set to 100% of the port rate.
490 - * If the '<em>rate</em>' is updated by this command, all four traffic classes
491 - * are assigned the same value. Each of the four traffic classes can be updated
495 - * Example of how modify the subport attributes for a 1GbE link:
496 - * @cliexcmd{set dpdk interface hqos subport GigabitEthernet0/8/0 subport 0 rate 125000000}
499 -VLIB_CLI_COMMAND (cmd_set_dpdk_if_hqos_subport, static) = {
500 - .path = "set dpdk interface hqos subport",
501 - .short_help = "set dpdk interface hqos subport <interface> subport <subport_id> "
502 - "[rate <n>] [bktsize <n>] [tc0 <n>] [tc1 <n>] [tc2 <n>] [tc3 <n>] "
504 - .function = set_dpdk_if_hqos_subport,
508 -static clib_error_t *
509 -set_dpdk_if_hqos_tctbl (vlib_main_t * vm, unformat_input_t * input,
510 - vlib_cli_command_t * cmd)
512 - unformat_input_t _line_input, *line_input = &_line_input;
513 - vlib_thread_main_t *tm = vlib_get_thread_main ();
514 - dpdk_main_t *dm = &dpdk_main;
515 - vnet_hw_interface_t *hw;
517 - u32 hw_if_index = (u32) ~ 0;
518 - u32 tc = (u32) ~ 0;
519 - u32 queue = (u32) ~ 0;
520 - u32 entry = (u32) ~ 0;
522 - clib_error_t *error = NULL;
524 - if (!unformat_user (input, unformat_line_input, line_input))
527 - while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
530 - (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
533 - else if (unformat (line_input, "entry %d", &entry))
535 - else if (unformat (line_input, "tc %d", &tc))
537 - else if (unformat (line_input, "queue %d", &queue))
541 - error = clib_error_return (0, "parse error: '%U'",
542 - format_unformat_error, line_input);
547 - if (hw_if_index == (u32) ~ 0)
549 - error = clib_error_return (0, "please specify valid interface name");
554 - error = clib_error_return (0, "invalid entry");
557 - if (tc >= RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE)
559 - error = clib_error_return (0, "invalid traffic class");
562 - if (queue >= RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS)
564 - error = clib_error_return (0, "invalid traffic class queue");
568 - hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
569 - xd = vec_elt_at_index (dm->devices, hw->dev_instance);
571 - /* Detect the set of worker threads */
572 - uword *p = hash_get_mem (tm->thread_registrations_by_name, "workers");
573 - /* Should never happen, shut up Coverity warning */
576 - error = clib_error_return (0, "no worker registrations?");
580 - vlib_thread_registration_t *tr = (vlib_thread_registration_t *) p[0];
581 - int worker_thread_first = tr->first_index;
582 - int worker_thread_count = tr->count;
584 - val = tc * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS + queue;
585 - for (i = 0; i < worker_thread_count; i++)
586 - xd->hqos_wt[worker_thread_first + i].hqos_tc_table[entry] = val;
589 - unformat_free (line_input);
595 - * This command is used to set the traffic class translation table. The
596 - * traffic class translation table is used to map 64 values (0-63) to one of
597 - * four traffic class and one of four HQoS input queue. Use the '<em>show
598 - * dpdk interface hqos</em>' command to display the traffic class translation
599 - * table. See @ref qos_doc for more details.
601 - * This command has the following parameters:
603 - * - <b><interface></b> - Used to specify the output interface.
605 - * - <b>entry <map_val></b> - Mapped value (0-63) to assign traffic class and queue to.
607 - * - <b>tc <tc_id></b> - Traffic class (0-3) to be used by the provided mapped value.
609 - * - <b>queue <queue_id></b> - HQoS input queue (0-3) to be used by the provided mapped value.
612 - * Example of how modify the traffic class translation table:
613 - * @cliexcmd{set dpdk interface hqos tctbl GigabitEthernet0/8/0 entry 16 tc 2 queue 2}
616 -VLIB_CLI_COMMAND (cmd_set_dpdk_if_hqos_tctbl, static) = {
617 - .path = "set dpdk interface hqos tctbl",
618 - .short_help = "set dpdk interface hqos tctbl <interface> entry <map_val> tc <tc_id> queue <queue_id>",
619 - .function = set_dpdk_if_hqos_tctbl,
623 -static clib_error_t *
624 -set_dpdk_if_hqos_pktfield (vlib_main_t * vm, unformat_input_t * input,
625 - vlib_cli_command_t * cmd)
627 - unformat_input_t _line_input, *line_input = &_line_input;
628 - vlib_thread_main_t *tm = vlib_get_thread_main ();
629 - dpdk_main_t *dm = &dpdk_main;
630 - clib_error_t *error = NULL;
632 - /* Device specific data */
633 - struct rte_eth_dev_info dev_info;
634 - struct rte_pci_device *pci_dev;
635 - dpdk_device_config_t *devconf = 0;
636 - vnet_hw_interface_t *hw;
638 - u32 hw_if_index = (u32) ~ 0;
640 - /* Detect the set of worker threads */
641 - uword *p = hash_get_mem (tm->thread_registrations_by_name, "workers");
642 - /* Should never happen, shut up Coverity warning */
644 - return clib_error_return (0, "no worker registrations?");
646 - vlib_thread_registration_t *tr = (vlib_thread_registration_t *) p[0];
647 - int worker_thread_first = tr->first_index;
648 - int worker_thread_count = tr->count;
650 - /* Packet field configuration */
651 - u64 mask = (u64) ~ 0;
652 - u32 id = (u32) ~ 0;
653 - u32 offset = (u32) ~ 0;
656 - u32 n_subports_per_port, n_pipes_per_subport, tctbl_size;
660 - /* Parse input arguments */
661 - if (!unformat_user (input, unformat_line_input, line_input))
664 - while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
667 - (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
670 - else if (unformat (line_input, "id subport"))
672 - else if (unformat (line_input, "id pipe"))
674 - else if (unformat (line_input, "id tc"))
676 - else if (unformat (line_input, "id %d", &id))
678 - else if (unformat (line_input, "offset %d", &offset))
680 - else if (unformat (line_input, "mask %llx", &mask))
684 - error = clib_error_return (0, "parse error: '%U'",
685 - format_unformat_error, line_input);
690 - /* Get interface */
691 - if (hw_if_index == (u32) ~ 0)
693 - error = clib_error_return (0, "please specify valid interface name");
697 - hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
698 - xd = vec_elt_at_index (dm->devices, hw->dev_instance);
700 - rte_eth_dev_info_get (xd->port_id, &dev_info);
702 - pci_dev = dpdk_get_pci_device (&dev_info);
706 - vlib_pci_addr_t pci_addr;
708 - pci_addr.domain = pci_dev->addr.domain;
709 - pci_addr.bus = pci_dev->addr.bus;
710 - pci_addr.slot = pci_dev->addr.devid;
711 - pci_addr.function = pci_dev->addr.function;
714 - hash_get (dm->conf->device_config_index_by_pci_addr, pci_addr.as_u32);
718 - devconf = pool_elt_at_index (dm->conf->dev_confs, p[0]);
720 - devconf = &dm->conf->default_devconf;
722 - if (devconf->hqos_enabled == 0)
724 - vlib_cli_output (vm, "HQoS disabled for this interface");
728 - n_subports_per_port = devconf->hqos.port.n_subports_per_port;
729 - n_pipes_per_subport = devconf->hqos.port.n_pipes_per_subport;
730 - tctbl_size = RTE_DIM (devconf->hqos.tc_table);
732 - /* Validate packet field configuration: id, offset and mask */
735 - error = clib_error_return (0, "invalid packet field id");
742 - if (dpdk_hqos_validate_mask (mask, n_subports_per_port) != 0)
744 - error = clib_error_return (0, "invalid subport ID mask "
745 - "(n_subports_per_port = %u)",
746 - n_subports_per_port);
751 - if (dpdk_hqos_validate_mask (mask, n_pipes_per_subport) != 0)
753 - error = clib_error_return (0, "invalid pipe ID mask "
754 - "(n_pipes_per_subport = %u)",
755 - n_pipes_per_subport);
761 - if (dpdk_hqos_validate_mask (mask, tctbl_size) != 0)
763 - error = clib_error_return (0, "invalid TC table index mask "
764 - "(TC table size = %u)", tctbl_size);
769 - /* Propagate packet field configuration to all workers */
770 - for (i = 0; i < worker_thread_count; i++)
774 - xd->hqos_wt[worker_thread_first + i].hqos_field0_slabpos = offset;
775 - xd->hqos_wt[worker_thread_first + i].hqos_field0_slabmask = mask;
776 - xd->hqos_wt[worker_thread_first + i].hqos_field0_slabshr =
777 - count_trailing_zeros (mask);
780 - xd->hqos_wt[worker_thread_first + i].hqos_field1_slabpos = offset;
781 - xd->hqos_wt[worker_thread_first + i].hqos_field1_slabmask = mask;
782 - xd->hqos_wt[worker_thread_first + i].hqos_field1_slabshr =
783 - count_trailing_zeros (mask);
787 - xd->hqos_wt[worker_thread_first + i].hqos_field2_slabpos = offset;
788 - xd->hqos_wt[worker_thread_first + i].hqos_field2_slabmask = mask;
789 - xd->hqos_wt[worker_thread_first + i].hqos_field2_slabshr =
790 - count_trailing_zeros (mask);
794 - unformat_free (line_input);
800 - * This command is used to set the packet fields required for classifying the
801 - * incoming packet. As a result of classification process, packet field
802 - * information will be mapped to 5 tuples (subport, pipe, traffic class, pipe,
803 - * color) and stored in packet mbuf.
805 - * This command has the following parameters:
807 - * - <b><interface></b> - Used to specify the output interface.
809 - * - <b>id subport|pipe|tc</b> - Classification occurs across three fields.
810 - * This parameter indicates which of the three masks are being configured. Legacy
811 - * code used 0-2 to represent these three fields, so 0-2 is still accepted.
812 - * - <b>subport|0</b> - Currently only one subport is supported, so only
813 - * an empty mask is supported for the subport classification.
814 - * - <b>pipe|1</b> - Currently, 4096 pipes per subport are supported, so a
815 - * 12-bit mask should be configure to map to the 0-4095 pipes.
816 - * - <b>tc|2</b> - The translation table (see '<em>set dpdk interface hqos
817 - * tctbl</em>' command) maps each value (0-63) into one of the 4 traffic classes
818 - * per pipe. A 6-bit mask should be configure to map this field to a traffic class.
820 - * - <b>offset <n></b> - Offset in the packet to apply the 64-bit mask for classification.
821 - * The offset should be on an 8-byte boundary (0,8,16,24..).
823 - * - <b>mask <hex-mask></b> - 64-bit mask to apply to packet at the given '<em>offset</em>'.
824 - * Bits must be contiguous and should not include '<em>0x</em>'.
826 - * The default values for the '<em>pktfield</em>' assumes Ethernet/IPv4/UDP packets with
827 - * no VLAN. Adjust based on expected packet format and desired classification field.
828 - * - '<em>subport</em>' is always empty (offset 0 mask 0000000000000000)
829 - * - By default, '<em>pipe</em>' maps to the UDP payload bits 12 .. 23 (offset 40
830 - * mask 0000000fff000000)
831 - * - By default, '<em>tc</em>' maps to the DSCP field in IP header (offset 48 mask
832 - * 00000000000000fc)
835 - * Example of how modify the '<em>pipe</em>' classification filter to match VLAN:
836 - * @cliexcmd{set dpdk interface hqos pktfield GigabitEthernet0/8/0 id pipe offset 8 mask 0000000000000FFF}
839 -VLIB_CLI_COMMAND (cmd_set_dpdk_if_hqos_pktfield, static) = {
840 - .path = "set dpdk interface hqos pktfield",
841 - .short_help = "set dpdk interface hqos pktfield <interface> id subport|pipe|tc offset <n> "
843 - .function = set_dpdk_if_hqos_pktfield,
847 -static clib_error_t *
848 -show_dpdk_if_hqos (vlib_main_t * vm, unformat_input_t * input,
849 - vlib_cli_command_t * cmd)
851 - unformat_input_t _line_input, *line_input = &_line_input;
852 - vlib_thread_main_t *tm = vlib_get_thread_main ();
853 - dpdk_main_t *dm = &dpdk_main;
854 - vnet_hw_interface_t *hw;
856 - dpdk_device_config_hqos_t *cfg;
857 - dpdk_device_hqos_per_hqos_thread_t *ht;
858 - dpdk_device_hqos_per_worker_thread_t *wk;
860 - u32 hw_if_index = (u32) ~ 0;
861 - u32 profile_id, subport_id, i;
862 - struct rte_eth_dev_info dev_info;
863 - struct rte_pci_device *pci_dev;
864 - dpdk_device_config_t *devconf = 0;
865 - vlib_thread_registration_t *tr;
867 - clib_error_t *error = NULL;
869 - if (!unformat_user (input, unformat_line_input, line_input))
872 - while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
875 - (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
880 - error = clib_error_return (0, "parse error: '%U'",
881 - format_unformat_error, line_input);
886 - if (hw_if_index == (u32) ~ 0)
888 - error = clib_error_return (0, "please specify interface name!!");
892 - hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
893 - xd = vec_elt_at_index (dm->devices, hw->dev_instance);
895 - rte_eth_dev_info_get (xd->port_id, &dev_info);
897 - pci_dev = dpdk_get_pci_device (&dev_info);
901 - vlib_pci_addr_t pci_addr;
903 - pci_addr.domain = pci_dev->addr.domain;
904 - pci_addr.bus = pci_dev->addr.bus;
905 - pci_addr.slot = pci_dev->addr.devid;
906 - pci_addr.function = pci_dev->addr.function;
909 - hash_get (dm->conf->device_config_index_by_pci_addr, pci_addr.as_u32);
913 - devconf = pool_elt_at_index (dm->conf->dev_confs, p[0]);
915 - devconf = &dm->conf->default_devconf;
917 - if (devconf->hqos_enabled == 0)
919 - vlib_cli_output (vm, "HQoS disabled for this interface");
923 - /* Detect the set of worker threads */
924 - p = hash_get_mem (tm->thread_registrations_by_name, "workers");
926 - /* Should never happen, shut up Coverity warning */
929 - error = clib_error_return (0, "no worker registrations?");
933 - tr = (vlib_thread_registration_t *) p[0];
935 - cfg = &devconf->hqos;
937 - wk = &xd->hqos_wt[tr->first_index];
938 - tctbl = wk->hqos_tc_table;
940 - vlib_cli_output (vm, " Thread:");
941 - vlib_cli_output (vm, " Input SWQ size = %u packets", cfg->swq_size);
942 - vlib_cli_output (vm, " Enqueue burst size = %u packets",
943 - ht->hqos_burst_enq);
944 - vlib_cli_output (vm, " Dequeue burst size = %u packets",
945 - ht->hqos_burst_deq);
947 - vlib_cli_output (vm,
948 - " Packet field 0: slab position = %4u, slab bitmask = 0x%016llx (subport)",
949 - wk->hqos_field0_slabpos, wk->hqos_field0_slabmask);
950 - vlib_cli_output (vm,
951 - " Packet field 1: slab position = %4u, slab bitmask = 0x%016llx (pipe)",
952 - wk->hqos_field1_slabpos, wk->hqos_field1_slabmask);
953 - vlib_cli_output (vm,
954 - " Packet field 2: slab position = %4u, slab bitmask = 0x%016llx (tc)",
955 - wk->hqos_field2_slabpos, wk->hqos_field2_slabmask);
956 - vlib_cli_output (vm,
957 - " Packet field 2 tc translation table: ([Mapped Value Range]: tc/queue tc/queue ...)");
958 - vlib_cli_output (vm,
960 - "%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",
961 - tctbl[0] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
962 - tctbl[0] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
963 - tctbl[1] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
964 - tctbl[1] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
965 - tctbl[2] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
966 - tctbl[2] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
967 - tctbl[3] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
968 - tctbl[3] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
969 - tctbl[4] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
970 - tctbl[4] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
971 - tctbl[5] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
972 - tctbl[5] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
973 - tctbl[6] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
974 - tctbl[6] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
975 - tctbl[7] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
976 - tctbl[7] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
977 - tctbl[8] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
978 - tctbl[8] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
979 - tctbl[9] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
980 - tctbl[9] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
981 - tctbl[10] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
982 - tctbl[10] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
983 - tctbl[11] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
984 - tctbl[11] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
985 - tctbl[12] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
986 - tctbl[12] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
987 - tctbl[13] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
988 - tctbl[13] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
989 - tctbl[14] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
990 - tctbl[14] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
991 - tctbl[15] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
992 - tctbl[15] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS);
993 - vlib_cli_output (vm,
995 - "%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",
996 - tctbl[16] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
997 - tctbl[16] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
998 - tctbl[17] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
999 - tctbl[17] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1000 - tctbl[18] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1001 - tctbl[18] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1002 - tctbl[19] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1003 - tctbl[19] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1004 - tctbl[20] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1005 - tctbl[20] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1006 - tctbl[21] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1007 - tctbl[21] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1008 - tctbl[22] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1009 - tctbl[22] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1010 - tctbl[23] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1011 - tctbl[23] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1012 - tctbl[24] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1013 - tctbl[24] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1014 - tctbl[25] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1015 - tctbl[25] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1016 - tctbl[26] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1017 - tctbl[26] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1018 - tctbl[27] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1019 - tctbl[27] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1020 - tctbl[28] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1021 - tctbl[28] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1022 - tctbl[29] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1023 - tctbl[29] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1024 - tctbl[30] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1025 - tctbl[30] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1026 - tctbl[31] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1027 - tctbl[31] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS);
1028 - vlib_cli_output (vm,
1030 - "%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",
1031 - tctbl[32] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1032 - tctbl[32] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1033 - tctbl[33] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1034 - tctbl[33] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1035 - tctbl[34] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1036 - tctbl[34] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1037 - tctbl[35] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1038 - tctbl[35] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1039 - tctbl[36] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1040 - tctbl[36] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1041 - tctbl[37] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1042 - tctbl[37] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1043 - tctbl[38] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1044 - tctbl[38] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1045 - tctbl[39] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1046 - tctbl[39] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1047 - tctbl[40] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1048 - tctbl[40] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1049 - tctbl[41] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1050 - tctbl[41] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1051 - tctbl[42] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1052 - tctbl[42] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1053 - tctbl[43] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1054 - tctbl[43] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1055 - tctbl[44] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1056 - tctbl[44] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1057 - tctbl[45] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1058 - tctbl[45] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1059 - tctbl[46] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1060 - tctbl[46] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1061 - tctbl[47] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1062 - tctbl[47] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS);
1063 - vlib_cli_output (vm,
1065 - "%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",
1066 - tctbl[48] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1067 - tctbl[48] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1068 - tctbl[49] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1069 - tctbl[49] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1070 - tctbl[50] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1071 - tctbl[50] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1072 - tctbl[51] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1073 - tctbl[51] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1074 - tctbl[52] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1075 - tctbl[52] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1076 - tctbl[53] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1077 - tctbl[53] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1078 - tctbl[54] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1079 - tctbl[54] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1080 - tctbl[55] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1081 - tctbl[55] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1082 - tctbl[56] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1083 - tctbl[56] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1084 - tctbl[57] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1085 - tctbl[57] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1086 - tctbl[58] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1087 - tctbl[58] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1088 - tctbl[59] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1089 - tctbl[59] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1090 - tctbl[60] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1091 - tctbl[60] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1092 - tctbl[61] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1093 - tctbl[61] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1094 - tctbl[62] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1095 - tctbl[62] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1096 - tctbl[63] / RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS,
1097 - tctbl[63] % RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS);
1098 - vlib_cli_output (vm, " Port:");
1099 - vlib_cli_output (vm, " Rate = %u bytes/second", cfg->port.rate);
1100 - vlib_cli_output (vm, " MTU = %u bytes", cfg->port.mtu);
1101 - vlib_cli_output (vm, " Frame overhead = %u bytes",
1102 - cfg->port.frame_overhead);
1103 - vlib_cli_output (vm, " Number of subports = %u",
1104 - cfg->port.n_subports_per_port);
1105 - vlib_cli_output (vm, " Number of pipes per subport = %u",
1106 - cfg->port.n_pipes_per_subport);
1107 - vlib_cli_output (vm,
1108 - " Packet queue size: TC0 = %u, TC1 = %u, TC2 = %u, TC3 = %u packets",
1109 - cfg->port.qsize[0], cfg->port.qsize[1], cfg->port.qsize[2],
1110 - cfg->port.qsize[3]);
1111 - vlib_cli_output (vm, " Number of pipe profiles = %u",
1112 - cfg->port.n_pipe_profiles);
1114 - for (subport_id = 0; subport_id < vec_len (cfg->subport); subport_id++)
1116 - vlib_cli_output (vm, " Subport %u:", subport_id);
1117 - vlib_cli_output (vm, " Rate = %u bytes/second",
1118 - cfg->subport[subport_id].tb_rate);
1119 - vlib_cli_output (vm, " Token bucket size = %u bytes",
1120 - cfg->subport[subport_id].tb_size);
1121 - vlib_cli_output (vm,
1122 - " Traffic class rate: TC0 = %u, TC1 = %u, TC2 = %u, TC3 = %u bytes/second",
1123 - cfg->subport[subport_id].tc_rate[0],
1124 - cfg->subport[subport_id].tc_rate[1],
1125 - cfg->subport[subport_id].tc_rate[2],
1126 - cfg->subport[subport_id].tc_rate[3]);
1127 - vlib_cli_output (vm, " TC period = %u milliseconds",
1128 - cfg->subport[subport_id].tc_period);
1131 - for (profile_id = 0; profile_id < vec_len (cfg->pipe); profile_id++)
1133 - vlib_cli_output (vm, " Pipe profile %u:", profile_id);
1134 - vlib_cli_output (vm, " Rate = %u bytes/second",
1135 - cfg->pipe[profile_id].tb_rate);
1136 - vlib_cli_output (vm, " Token bucket size = %u bytes",
1137 - cfg->pipe[profile_id].tb_size);
1138 - vlib_cli_output (vm,
1139 - " Traffic class rate: TC0 = %u, TC1 = %u, TC2 = %u, TC3 = %u bytes/second",
1140 - cfg->pipe[profile_id].tc_rate[0],
1141 - cfg->pipe[profile_id].tc_rate[1],
1142 - cfg->pipe[profile_id].tc_rate[2],
1143 - cfg->pipe[profile_id].tc_rate[3]);
1144 - vlib_cli_output (vm, " TC period = %u milliseconds",
1145 - cfg->pipe[profile_id].tc_period);
1146 -#ifdef RTE_SCHED_SUBPORT_TC_OV
1147 - vlib_cli_output (vm, " TC3 oversubscription_weight = %u",
1148 - cfg->pipe[profile_id].tc_ov_weight);
1151 - for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++)
1153 - vlib_cli_output (vm,
1154 - " TC%u WRR weights: Q0 = %u, Q1 = %u, Q2 = %u, Q3 = %u",
1155 - i, cfg->pipe[profile_id].wrr_weights[i * 4],
1156 - cfg->pipe[profile_id].wrr_weights[i * 4 + 1],
1157 - cfg->pipe[profile_id].wrr_weights[i * 4 + 2],
1158 - cfg->pipe[profile_id].wrr_weights[i * 4 + 3]);
1162 -#ifdef RTE_SCHED_RED
1163 - vlib_cli_output (vm, " Weighted Random Early Detection (WRED):");
1164 - for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++)
1166 - vlib_cli_output (vm, " TC%u min: G = %u, Y = %u, R = %u", i,
1167 - cfg->port.red_params[i][e_RTE_METER_GREEN].min_th,
1168 - cfg->port.red_params[i][e_RTE_METER_YELLOW].min_th,
1169 - cfg->port.red_params[i][e_RTE_METER_RED].min_th);
1171 - vlib_cli_output (vm, " TC%u max: G = %u, Y = %u, R = %u", i,
1172 - cfg->port.red_params[i][e_RTE_METER_GREEN].max_th,
1173 - cfg->port.red_params[i][e_RTE_METER_YELLOW].max_th,
1174 - cfg->port.red_params[i][e_RTE_METER_RED].max_th);
1176 - vlib_cli_output (vm,
1177 - " TC%u inverted probability: G = %u, Y = %u, R = %u",
1178 - i, cfg->port.red_params[i][e_RTE_METER_GREEN].maxp_inv,
1179 - cfg->port.red_params[i][e_RTE_METER_YELLOW].maxp_inv,
1180 - cfg->port.red_params[i][e_RTE_METER_RED].maxp_inv);
1182 - vlib_cli_output (vm, " TC%u weight: R = %u, Y = %u, R = %u", i,
1183 - cfg->port.red_params[i][e_RTE_METER_GREEN].wq_log2,
1184 - cfg->port.red_params[i][e_RTE_METER_YELLOW].wq_log2,
1185 - cfg->port.red_params[i][e_RTE_METER_RED].wq_log2);
1190 - unformat_free (line_input);
1196 - * This command is used to display details of an output interface's HQoS
1200 - * Example of how to display HQoS settings for an interfaces:
1201 - * @cliexstart{show dpdk interface hqos GigabitEthernet0/8/0}
1203 - * Input SWQ size = 4096 packets
1204 - * Enqueue burst size = 256 packets
1205 - * Dequeue burst size = 220 packets
1206 - * Packet field 0: slab position = 0, slab bitmask = 0x0000000000000000 (subport)
1207 - * Packet field 1: slab position = 40, slab bitmask = 0x0000000fff000000 (pipe)
1208 - * Packet field 2: slab position = 8, slab bitmask = 0x00000000000000fc (tc)
1209 - * Packet field 2 tc translation table: ([Mapped Value Range]: tc/queue tc/queue ...)
1210 - * [ 0 .. 15]: 0/0 0/1 0/2 0/3 1/0 1/1 1/2 1/3 2/0 2/1 2/2 2/3 3/0 3/1 3/2 3/3
1211 - * [16 .. 31]: 0/0 0/1 0/2 0/3 1/0 1/1 1/2 1/3 2/0 2/1 2/2 2/3 3/0 3/1 3/2 3/3
1212 - * [32 .. 47]: 0/0 0/1 0/2 0/3 1/0 1/1 1/2 1/3 2/0 2/1 2/2 2/3 3/0 3/1 3/2 3/3
1213 - * [48 .. 63]: 0/0 0/1 0/2 0/3 1/0 1/1 1/2 1/3 2/0 2/1 2/2 2/3 3/0 3/1 3/2 3/3
1215 - * Rate = 1250000000 bytes/second
1216 - * MTU = 1514 bytes
1217 - * Frame overhead = 24 bytes
1218 - * Number of subports = 1
1219 - * Number of pipes per subport = 4096
1220 - * Packet queue size: TC0 = 64, TC1 = 64, TC2 = 64, TC3 = 64 packets
1221 - * Number of pipe profiles = 2
1223 - * Rate = 1250000000 bytes/second
1224 - * Token bucket size = 1000000 bytes
1225 - * Traffic class rate: TC0 = 1250000000, TC1 = 1250000000, TC2 = 1250000000, TC3 = 1250000000 bytes/second
1226 - * TC period = 10 milliseconds
1228 - * Rate = 305175 bytes/second
1229 - * Token bucket size = 1000000 bytes
1230 - * Traffic class rate: TC0 = 305175, TC1 = 305175, TC2 = 305175, TC3 = 305175 bytes/second
1231 - * TC period = 40 milliseconds
1232 - * TC0 WRR weights: Q0 = 1, Q1 = 1, Q2 = 1, Q3 = 1
1233 - * TC1 WRR weights: Q0 = 1, Q1 = 1, Q2 = 1, Q3 = 1
1234 - * TC2 WRR weights: Q0 = 1, Q1 = 1, Q2 = 1, Q3 = 1
1235 - * TC3 WRR weights: Q0 = 1, Q1 = 1, Q2 = 1, Q3 = 1
1239 -VLIB_CLI_COMMAND (cmd_show_dpdk_if_hqos, static) = {
1240 - .path = "show dpdk interface hqos",
1241 - .short_help = "show dpdk interface hqos <interface>",
1242 - .function = show_dpdk_if_hqos,
1247 -static clib_error_t *
1248 -show_dpdk_hqos_queue_stats (vlib_main_t * vm, unformat_input_t * input,
1249 - vlib_cli_command_t * cmd)
1251 - unformat_input_t _line_input, *line_input = &_line_input;
1252 - clib_error_t *error = NULL;
1253 -#ifdef RTE_SCHED_COLLECT_STATS
1254 - dpdk_main_t *dm = &dpdk_main;
1255 - u32 hw_if_index = (u32) ~ 0;
1256 - u32 subport = (u32) ~ 0;
1257 - u32 pipe = (u32) ~ 0;
1258 - u32 tc = (u32) ~ 0;
1259 - u32 tc_q = (u32) ~ 0;
1260 - vnet_hw_interface_t *hw;
1261 - dpdk_device_t *xd;
1263 - struct rte_eth_dev_info dev_info;
1264 - struct rte_pci_device *pci_dev;
1265 - dpdk_device_config_t *devconf = 0;
1267 - struct rte_sched_queue_stats stats;
1270 - if (!unformat_user (input, unformat_line_input, line_input))
1273 - while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
1276 - (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
1280 - else if (unformat (line_input, "subport %d", &subport))
1283 - else if (unformat (line_input, "pipe %d", &pipe))
1286 - else if (unformat (line_input, "tc %d", &tc))
1289 - else if (unformat (line_input, "tc_q %d", &tc_q))
1294 - error = clib_error_return (0, "parse error: '%U'",
1295 - format_unformat_error, line_input);
1300 - if (hw_if_index == (u32) ~ 0)
1302 - error = clib_error_return (0, "please specify interface name!!");
1306 - hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
1307 - xd = vec_elt_at_index (dm->devices, hw->dev_instance);
1309 - rte_eth_dev_info_get (xd->port_id, &dev_info);
1311 - pci_dev = dpdk_get_pci_device (&dev_info);
1314 - { /* bonded interface has no pci info */
1315 - vlib_pci_addr_t pci_addr;
1317 - pci_addr.domain = pci_dev->addr.domain;
1318 - pci_addr.bus = pci_dev->addr.bus;
1319 - pci_addr.slot = pci_dev->addr.devid;
1320 - pci_addr.function = pci_dev->addr.function;
1323 - hash_get (dm->conf->device_config_index_by_pci_addr, pci_addr.as_u32);
1327 - devconf = pool_elt_at_index (dm->conf->dev_confs, p[0]);
1329 - devconf = &dm->conf->default_devconf;
1331 - if (devconf->hqos_enabled == 0)
1333 - vlib_cli_output (vm, "HQoS disabled for this interface");
1338 - * Figure out which queue to query. cf rte_sched_port_qindex. (Not sure why
1339 - * that method isn't made public by DPDK - how _should_ we get the queue ID?)
1341 - qindex = subport * devconf->hqos.port.n_pipes_per_subport + pipe;
1342 - qindex = qindex * RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE + tc;
1343 - qindex = qindex * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS + tc_q;
1345 - if (rte_sched_queue_read_stats (xd->hqos_ht->hqos, qindex, &stats, &qlen) !=
1348 - error = clib_error_return (0, "failed to read stats");
1352 - vlib_cli_output (vm, "%=24s%=16s", "Stats Parameter", "Value");
1353 - vlib_cli_output (vm, "%=24s%=16d", "Packets", stats.n_pkts);
1354 - vlib_cli_output (vm, "%=24s%=16d", "Packets dropped", stats.n_pkts_dropped);
1355 -#ifdef RTE_SCHED_RED
1356 - vlib_cli_output (vm, "%=24s%=16d", "Packets dropped (RED)",
1357 - stats.n_pkts_red_dropped);
1359 - vlib_cli_output (vm, "%=24s%=16d", "Bytes", stats.n_bytes);
1360 - vlib_cli_output (vm, "%=24s%=16d", "Bytes dropped", stats.n_bytes_dropped);
1364 - /* Get a line of input */
1365 - if (!unformat_user (input, unformat_line_input, line_input))
1368 - vlib_cli_output (vm, "RTE_SCHED_COLLECT_STATS disabled in DPDK");
1374 - unformat_free (line_input);
1380 - * This command is used to display statistics associated with a HQoS traffic class
1384 - * Statistic collection by the scheduler is disabled by default in DPDK. In order to
1385 - * turn it on, add the following line to '<em>../vpp/dpdk/Makefile</em>':
1386 - * - <b>$(call set,RTE_SCHED_COLLECT_STATS,y)</b>
1389 - * Example of how to display statistics of HQoS a HQoS traffic class queue:
1390 - * @cliexstart{show dpdk hqos queue GigabitEthernet0/9/0 subport 0 pipe 3181 tc 0 tc_q 0}
1391 - * Stats Parameter Value
1393 - * Packets dropped 0
1399 -VLIB_CLI_COMMAND (cmd_show_dpdk_hqos_queue_stats, static) = {
1400 - .path = "show dpdk hqos queue",
1401 - .short_help = "show dpdk hqos queue <interface> subport <subport_id> pipe <pipe_id> tc <tc_id> tc_q <queue_id>",
1402 - .function = show_dpdk_hqos_queue_stats,
1407 static clib_error_t *
1408 show_dpdk_version_command_fn (vlib_main_t * vm,
1409 unformat_input_t * input,
1410 diff --git a/src/plugins/dpdk/device/device.c b/src/plugins/dpdk/device/device.c
1411 index 323149043..c355edf6a 100644
1412 --- a/src/plugins/dpdk/device/device.c
1413 +++ b/src/plugins/dpdk/device/device.c
1414 @@ -180,21 +180,6 @@ static_always_inline
1415 queue_id = (queue_id + 1) % xd->tx_q_used;
1419 - if (PREDICT_FALSE (xd->flags & DPDK_DEVICE_FLAG_HQOS)) /* HQoS ON */
1421 - /* no wrap, transmit in one burst */
1422 - dpdk_device_hqos_per_worker_thread_t *hqos =
1423 - &xd->hqos_wt[vm->thread_index];
1425 - ASSERT (hqos->swq != NULL);
1427 - dpdk_hqos_metadata_set (hqos, mb, n_left);
1428 - n_sent = rte_ring_sp_enqueue_burst (hqos->swq, (void **) mb,
1433 if (PREDICT_TRUE (xd->flags & DPDK_DEVICE_FLAG_PMD))
1435 /* no wrap, transmit in one burst */
1436 diff --git a/src/plugins/dpdk/device/dpdk.h b/src/plugins/dpdk/device/dpdk.h
1437 index ab28ac06a..68d9e712b 100644
1438 --- a/src/plugins/dpdk/device/dpdk.h
1439 +++ b/src/plugins/dpdk/device/dpdk.h
1440 @@ -119,40 +119,6 @@ typedef enum
1442 typedef uint16_t dpdk_portid_t;
1446 - /* Required for vec_validate_aligned */
1447 - CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
1449 - struct rte_ring *swq;
1451 - u64 hqos_field0_slabmask;
1452 - u32 hqos_field0_slabpos;
1453 - u32 hqos_field0_slabshr;
1454 - u64 hqos_field1_slabmask;
1455 - u32 hqos_field1_slabpos;
1456 - u32 hqos_field1_slabshr;
1457 - u64 hqos_field2_slabmask;
1458 - u32 hqos_field2_slabpos;
1459 - u32 hqos_field2_slabshr;
1460 - u32 hqos_tc_table[64];
1461 -} dpdk_device_hqos_per_worker_thread_t;
1465 - /* Required for vec_validate_aligned */
1466 - CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
1467 - struct rte_ring **swq;
1468 - struct rte_mbuf **pkts_enq;
1469 - struct rte_mbuf **pkts_deq;
1470 - struct rte_sched_port *hqos;
1471 - u32 hqos_burst_enq;
1472 - u32 hqos_burst_deq;
1476 -} dpdk_device_hqos_per_hqos_thread_t;
1478 #define foreach_dpdk_device_flags \
1479 _( 0, ADMIN_UP, "admin-up") \
1480 _( 1, PROMISC, "promisc") \
1481 @@ -160,7 +126,6 @@ typedef struct
1482 _( 3, PMD_INIT_FAIL, "pmd-init-fail") \
1483 _( 4, MAYBE_MULTISEG, "maybe-multiseg") \
1484 _( 5, HAVE_SUBIF, "subif") \
1485 - _( 6, HQOS, "hqos") \
1486 _( 9, TX_OFFLOAD, "tx-offload") \
1487 _(10, INTEL_PHDR_CKSUM, "intel-phdr-cksum") \
1488 _(11, RX_FLOW_OFFLOAD, "rx-flow-offload") \
1489 @@ -235,10 +200,6 @@ typedef struct
1490 u32 parked_loop_count;
1491 struct rte_flow_error last_flow_error;
1493 - /* HQoS related */
1494 - dpdk_device_hqos_per_worker_thread_t *hqos_wt;
1495 - dpdk_device_hqos_per_hqos_thread_t *hqos_ht;
1497 /* af_packet instance number */
1498 u16 af_packet_instance_num;
1500 @@ -278,39 +239,6 @@ typedef struct
1501 #define HQOS_FLUSH_COUNT_THRESHOLD 100000
1504 -typedef struct dpdk_device_config_hqos_t
1507 - u32 hqos_thread_valid;
1513 - u32 pktfield0_slabpos;
1514 - u32 pktfield1_slabpos;
1515 - u32 pktfield2_slabpos;
1516 - u64 pktfield0_slabmask;
1517 - u64 pktfield1_slabmask;
1518 - u64 pktfield2_slabmask;
1521 - struct rte_sched_port_params port;
1522 - struct rte_sched_subport_params *subport;
1523 - struct rte_sched_pipe_params *pipe;
1524 - uint32_t *pipe_map;
1525 -} dpdk_device_config_hqos_t;
1527 -int dpdk_hqos_validate_mask (u64 mask, u32 n);
1528 -void dpdk_device_config_hqos_pipe_profile_default (dpdk_device_config_hqos_t *
1529 - hqos, u32 pipe_profile_id);
1531 -void dpdk_device_config_hqos_default (dpdk_device_config_hqos_t * hqos);
1533 -clib_error_t *dpdk_port_setup_hqos (dpdk_device_t * xd,
1534 - dpdk_device_config_hqos_t * hqos);
1535 -void dpdk_hqos_metadata_set (dpdk_device_hqos_per_worker_thread_t * hqos,
1536 - struct rte_mbuf **pkts, u32 n_pkts);
1538 #define foreach_dpdk_device_config_item \
1540 @@ -333,8 +261,6 @@ typedef struct
1541 foreach_dpdk_device_config_item
1543 clib_bitmap_t * workers;
1545 - dpdk_device_config_hqos_t hqos;
1549 @@ -397,7 +323,6 @@ typedef struct
1552 dpdk_device_t *devices;
1553 - dpdk_device_and_queue_t **devices_by_hqos_cpu;
1554 dpdk_per_thread_data_t *per_thread_data;
1556 /* buffer flags template, configurable to enable/disable tcp / udp cksum */
1557 @@ -409,10 +334,6 @@ typedef struct
1559 u8 admin_up_down_in_progress;
1561 - /* which cpus are running I/O TX */
1562 - int hqos_cpu_first_index;
1563 - int hqos_cpu_count;
1565 /* control interval of dpdk link state and stat polling */
1566 f64 link_state_poll_interval;
1567 f64 stat_poll_interval;
1568 @@ -502,8 +423,6 @@ format_function_t format_dpdk_tx_offload_caps;
1569 vnet_flow_dev_ops_function_t dpdk_flow_ops_fn;
1571 clib_error_t *unformat_rss_fn (unformat_input_t * input, uword * rss_fn);
1572 -clib_error_t *unformat_hqos (unformat_input_t * input,
1573 - dpdk_device_config_hqos_t * hqos);
1575 struct rte_pci_device *dpdk_get_pci_device (const struct rte_eth_dev_info
1577 diff --git a/src/plugins/dpdk/device/format.c b/src/plugins/dpdk/device/format.c
1578 index 20493eb77..8ef46512c 100644
1579 --- a/src/plugins/dpdk/device/format.c
1580 +++ b/src/plugins/dpdk/device/format.c
1581 @@ -913,25 +913,6 @@ unformat_rss_fn (unformat_input_t * input, uword * rss_fn)
1586 -unformat_hqos (unformat_input_t * input, dpdk_device_config_hqos_t * hqos)
1588 - clib_error_t *error = 0;
1590 - while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
1592 - if (unformat (input, "hqos-thread %u", &hqos->hqos_thread))
1593 - hqos->hqos_thread_valid = 1;
1596 - error = clib_error_return (0, "unknown input `%U'",
1597 - format_unformat_error, input);
1606 * fd.io coding-style-patch-verification: OFF
1607 diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
1608 index d0125e939..5d0e5a260 100644
1609 --- a/src/plugins/dpdk/device/init.c
1610 +++ b/src/plugins/dpdk/device/init.c
1611 @@ -214,29 +214,9 @@ dpdk_lib_init (dpdk_main_t * dm)
1613 vlib_pci_addr_t last_pci_addr;
1614 u32 last_pci_addr_port = 0;
1615 - vlib_thread_registration_t *tr_hqos;
1618 - u32 next_hqos_cpu = 0;
1619 u8 af_packet_instance_num = 0;
1620 last_pci_addr.as_u32 = ~0;
1622 - dm->hqos_cpu_first_index = 0;
1623 - dm->hqos_cpu_count = 0;
1625 - /* find out which cpus will be used for I/O TX */
1626 - p_hqos = hash_get_mem (tm->thread_registrations_by_name, "hqos-threads");
1627 - tr_hqos = p_hqos ? (vlib_thread_registration_t *) p_hqos[0] : 0;
1629 - if (tr_hqos && tr_hqos->count > 0)
1631 - dm->hqos_cpu_first_index = tr_hqos->first_index;
1632 - dm->hqos_cpu_count = tr_hqos->count;
1635 - vec_validate_aligned (dm->devices_by_hqos_cpu, tm->n_vlib_mains - 1,
1636 - CLIB_CACHE_LINE_BYTES);
1638 nports = rte_eth_dev_count_avail ();
1641 @@ -596,38 +576,6 @@ dpdk_lib_init (dpdk_main_t * dm)
1642 /* assign interface to input thread */
1645 - if (devconf->hqos_enabled)
1647 - xd->flags |= DPDK_DEVICE_FLAG_HQOS;
1650 - if (devconf->hqos.hqos_thread_valid)
1652 - if (devconf->hqos.hqos_thread >= dm->hqos_cpu_count)
1653 - return clib_error_return (0, "invalid HQoS thread index");
1655 - cpu = dm->hqos_cpu_first_index + devconf->hqos.hqos_thread;
1659 - if (dm->hqos_cpu_count == 0)
1660 - return clib_error_return (0, "no HQoS threads available");
1662 - cpu = dm->hqos_cpu_first_index + next_hqos_cpu;
1665 - if (next_hqos_cpu == dm->hqos_cpu_count)
1666 - next_hqos_cpu = 0;
1668 - devconf->hqos.hqos_thread_valid = 1;
1669 - devconf->hqos.hqos_thread = cpu;
1672 - dpdk_device_and_queue_t *dq;
1673 - vec_add2 (dm->devices_by_hqos_cpu[cpu], dq, 1);
1674 - dq->device = xd->device_index;
1678 error = ethernet_register_interface
1679 (dm->vnet_main, dpdk_device_class.index, xd->device_index,
1680 @@ -770,14 +718,6 @@ dpdk_lib_init (dpdk_main_t * dm)
1681 format_dpdk_device_name, i,
1682 format_dpdk_device_errors, xd);
1684 - if (devconf->hqos_enabled)
1687 - rv = dpdk_port_setup_hqos (xd, &devconf->hqos);
1693 * A note on Cisco VIC (PMD_ENIC) and VLAN:
1695 @@ -1060,11 +1000,7 @@ dpdk_device_config (dpdk_config_main_t * conf, vlib_pci_addr_t pci_addr,
1698 devconf->pci_addr.as_u32 = pci_addr.as_u32;
1699 - devconf->hqos_enabled = 0;
1700 devconf->tso = DPDK_DEVICE_TSO_DEFAULT;
1702 - dpdk_device_config_hqos_default (&devconf->hqos);
1707 @@ -1097,19 +1033,6 @@ dpdk_device_config (dpdk_config_main_t * conf, vlib_pci_addr_t pci_addr,
1708 devconf->vlan_strip_offload = DPDK_DEVICE_VLAN_STRIP_OFF;
1709 else if (unformat (input, "vlan-strip-offload on"))
1710 devconf->vlan_strip_offload = DPDK_DEVICE_VLAN_STRIP_ON;
1713 - (input, "hqos %U", unformat_vlib_cli_sub_input, &sub_input))
1715 - devconf->hqos_enabled = 1;
1716 - error = unformat_hqos (&sub_input, &devconf->hqos);
1720 - else if (unformat (input, "hqos"))
1722 - devconf->hqos_enabled = 1;
1724 else if (unformat (input, "tso on"))
1726 devconf->tso = DPDK_DEVICE_TSO_ON;