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-gre/packet.h>
26 #include "dpdk_priv.h"
29 pcap_trace_command_fn (vlib_main_t * vm,
30 unformat_input_t * input,
31 vlib_cli_command_t * cmd)
33 dpdk_main_t * dm = &dpdk_main;
37 clib_error_t * error = 0;
39 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
41 if (unformat (input, "on"))
43 if (dm->tx_pcap_enable == 0)
45 if (dm->pcap_filename == 0)
46 dm->pcap_filename = format (0, "/tmp/vpe.pcap%c", 0);
48 memset (&dm->pcap_main, 0, sizeof (dm->pcap_main));
49 dm->pcap_main.file_name = (char *) dm->pcap_filename;
50 dm->pcap_main.n_packets_to_capture = 100;
51 if (dm->pcap_pkts_to_capture)
52 dm->pcap_main.n_packets_to_capture = dm->pcap_pkts_to_capture;
54 dm->pcap_main.packet_type = PCAP_PACKET_TYPE_ethernet;
55 dm->tx_pcap_enable = 1;
57 vlib_cli_output (vm, "pcap tx capture on...");
61 vlib_cli_output (vm, "pcap tx capture already on...");
65 else if (unformat (input, "off"))
67 if (dm->tx_pcap_enable)
69 vlib_cli_output (vm, "captured %d pkts...",
70 dm->pcap_main.n_packets_captured+1);
71 if (dm->pcap_main.n_packets_captured)
73 dm->pcap_main.n_packets_to_capture =
74 dm->pcap_main.n_packets_captured;
75 error = pcap_write (&dm->pcap_main);
77 clib_error_report (error);
79 vlib_cli_output (vm, "saved to %s...", dm->pcap_filename);
84 vlib_cli_output (vm, "pcap tx capture already off...");
87 dm->tx_pcap_enable = 0;
90 else if (unformat (input, "max %d", &max))
92 dm->pcap_pkts_to_capture = max;
96 else if (unformat (input, "intfc %U",
97 unformat_vnet_sw_interface, dm->vnet_main,
98 &dm->pcap_sw_if_index))
100 else if (unformat (input, "intfc any"))
102 dm->pcap_sw_if_index = 0;
105 else if (unformat (input, "file %s", &filename))
107 u8 * chroot_filename;
108 /* Brain-police user path input */
109 if (strstr((char *)filename, "..") || 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);
150 VLIB_CLI_COMMAND (pcap_trace_command, static) = {
151 .path = "pcap tx trace",
153 "pcap tx trace on off max <nn> intfc <intfc> file <name> status",
154 .function = pcap_trace_command_fn,
158 static clib_error_t *
159 show_dpdk_buffer (vlib_main_t * vm, unformat_input_t * input,
160 vlib_cli_command_t * cmd)
162 struct rte_mempool * rmp;
165 for(i = 0; i < vec_len(vm->buffer_main->pktmbuf_pools); i++)
167 rmp = vm->buffer_main->pktmbuf_pools[i];
170 #if RTE_VERSION >= RTE_VERSION_NUM(16, 7, 0, 0)
171 unsigned count = rte_mempool_avail_count(rmp);
172 unsigned free_count = rte_mempool_in_use_count(rmp);
174 unsigned count = rte_mempool_count(rmp);
175 unsigned free_count = rte_mempool_free_count(rmp);
178 vlib_cli_output(vm, "name=\"%s\" available = %7d allocated = %7d total = %7d\n",
179 rmp->name, (u32)count, (u32)free_count,
180 (u32)(count+free_count));
184 vlib_cli_output(vm, "rte_mempool is NULL (!)\n");
190 VLIB_CLI_COMMAND (cmd_show_dpdk_bufferr,static) = {
191 .path = "show dpdk buffer",
192 .short_help = "show dpdk buffer state",
193 .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);
250 VLIB_CLI_COMMAND (cmd_test_dpdk_buffer,static) = {
251 .path = "test dpdk buffer",
252 .short_help = "test dpdk buffer [allocate <nn>][free <nn>]",
253 .function = test_dpdk_buffer,
258 show_dpdk_device_stats (vlib_main_t * vm, dpdk_device_t * xd)
262 " last_burst_sz %d\n"
264 " full_frames_cnt %u\n"
265 " consec_full_frames_cnt %u\n"
266 " congestion_cnt %d\n"
267 " last_poll_time %llu\n"
268 " max_poll_delay %llu\n"
270 " total_packet_cnt %u\n",
272 xd->efd_agent.last_burst_sz,
273 xd->efd_agent.max_burst_sz,
274 xd->efd_agent.full_frames_cnt,
275 xd->efd_agent.consec_full_frames_cnt,
276 xd->efd_agent.congestion_cnt,
277 xd->efd_agent.last_poll_time,
278 xd->efd_agent.max_poll_delay,
279 xd->efd_agent.discard_cnt,
280 xd->efd_agent.total_packet_cnt);
282 u32 device_queue_sz = rte_eth_rx_queue_count(xd->device_index,
285 " device_queue_sz %u\n",
290 show_efd_config (vlib_main_t * vm)
292 vlib_thread_main_t * tm = vlib_get_thread_main();
293 dpdk_main_t * dm = &dpdk_main;
296 "dpdk: (0x%04x) enabled:%d monitor:%d drop_all:%d\n"
297 " dpdk_queue_hi_thresh %d\n"
298 " consec_full_frames_hi_thresh %d\n"
300 "worker: (0x%04x) enabled:%d monitor:%d\n"
301 " worker_queue_hi_thresh %d\n",
303 ((dm->efd.enabled & DPDK_EFD_DISCARD_ENABLED) ? 1:0),
304 ((dm->efd.enabled & DPDK_EFD_MONITOR_ENABLED) ? 1:0),
305 ((dm->efd.enabled & DPDK_EFD_DROPALL_ENABLED) ? 1:0),
306 dm->efd.queue_hi_thresh,
307 dm->efd.consec_full_frames_hi_thresh,
309 ((tm->efd.enabled & VLIB_EFD_DISCARD_ENABLED) ? 1:0),
310 ((dm->efd.enabled & VLIB_EFD_MONITOR_ENABLED) ? 1:0),
311 tm->efd.queue_hi_thresh);
314 "ip_prec_bitmap 0x%02x\n"
315 "mpls_exp_bitmap 0x%02x\n"
316 "vlan_cos_bitmap 0x%02x\n",
317 tm->efd.ip_prec_bitmap,
318 tm->efd.mpls_exp_bitmap,
319 tm->efd.vlan_cos_bitmap);
322 static clib_error_t *
323 show_efd (vlib_main_t * vm,
324 unformat_input_t * input,
325 vlib_cli_command_t * cmd)
328 if (unformat(input, "config")) {
330 } else if (unformat(input, "dpdk")) {
331 dpdk_main_t * dm = &dpdk_main;
335 unformat(input, "device %d", &device_id);
336 vec_foreach (xd, dm->devices) {
337 if ((xd->device_index == device_id) || (device_id == ~0)) {
338 show_dpdk_device_stats(vm, xd);
341 } else if (unformat(input, "worker")) {
342 vlib_thread_main_t * tm = vlib_get_thread_main();
343 vlib_frame_queue_t *fq;
344 vlib_thread_registration_t * tr;
347 u32 first_worker_index = 0;
350 p = hash_get_mem (tm->thread_registrations_by_name, "workers");
352 tr = (vlib_thread_registration_t *) p[0];
355 num_workers = tr->count;
356 first_worker_index = tr->first_index;
361 "first_worker_index %d\n"
362 "vlib_frame_queues[%d]:\n",
367 for (thread_id = 0; thread_id < tm->n_vlib_mains; thread_id++) {
368 fq = vlib_frame_queues[thread_id];
371 "%2d: frames_queued %u\n"
372 " frames_queued_hint %u\n"
373 " enqueue_full_events %u\n"
374 " enqueue_efd_discards %u\n",
376 (fq->tail - fq->head),
377 (fq->tail - fq->head_hint),
378 fq->enqueue_full_events,
379 fq->enqueue_efd_discards);
382 } else if (unformat(input, "help")) {
383 vlib_cli_output(vm, "Usage: show efd config | "
384 "dpdk [device <id>] | worker\n");
392 VLIB_CLI_COMMAND (show_efd_command, static) = {
394 .short_help = "Show efd [device <id>] | [config]",
395 .function = show_efd,
398 static clib_error_t *
399 clear_efd (vlib_main_t * vm,
400 unformat_input_t * input,
401 vlib_cli_command_t * cmd)
403 dpdk_main_t * dm = &dpdk_main;
405 vlib_thread_main_t * tm = vlib_get_thread_main();
406 vlib_frame_queue_t *fq;
409 vec_foreach (xd, dm->devices) {
410 xd->efd_agent.last_burst_sz = 0;
411 xd->efd_agent.max_burst_sz = 0;
412 xd->efd_agent.full_frames_cnt = 0;
413 xd->efd_agent.consec_full_frames_cnt = 0;
414 xd->efd_agent.congestion_cnt = 0;
415 xd->efd_agent.last_poll_time = 0;
416 xd->efd_agent.max_poll_delay = 0;
417 xd->efd_agent.discard_cnt = 0;
418 xd->efd_agent.total_packet_cnt = 0;
421 for (thread_id = 0; thread_id < tm->n_vlib_mains; thread_id++) {
422 fq = vlib_frame_queues[thread_id];
424 fq->enqueue_full_events = 0;
425 fq->enqueue_efd_discards = 0;
432 VLIB_CLI_COMMAND (clear_efd_command,static) = {
434 .short_help = "Clear early-fast-discard counters",
435 .function = clear_efd,
438 static clib_error_t *
439 parse_op_and_prec (vlib_main_t *vm, unformat_input_t *input,
440 vlib_cli_command_t *cmd,
441 char *prec_type, u8 *prec_bitmap)
443 clib_error_t * error = NULL;
447 if (unformat(input, "ge")) {
448 op = EFD_OPERATION_GREATER_OR_EQUAL;
449 } else if (unformat(input, "lt")) {
450 op = EFD_OPERATION_LESS_THAN;
451 } else if (unformat(input, "help")) {
453 "enter operation [ge | lt] and precedence <0-7>)");
456 return clib_error_return(0, "unknown input `%U'",
457 format_unformat_error, input);
460 if (unformat (input, "%u", &prec)) {
462 return clib_error_return(0, "precedence %d is out of range <0-7>",
466 return clib_error_return(0, "unknown input `%U'",
467 format_unformat_error, input);
470 set_efd_bitmap(prec_bitmap, prec, op);
473 "EFD will be set for %s precedence %s%u%s.",
475 (op == EFD_OPERATION_LESS_THAN) ? "less than " : "",
477 (op == EFD_OPERATION_GREATER_OR_EQUAL) ? " and greater" : "");
483 static clib_error_t *
484 set_efd (vlib_main_t *vm, unformat_input_t *input,
485 vlib_cli_command_t *cmd)
487 dpdk_main_t * dm = &dpdk_main;
488 vlib_thread_main_t * tm = vlib_get_thread_main();
489 clib_error_t * error = NULL;
490 vlib_node_runtime_t * rt = vlib_node_get_runtime (vm, dpdk_input_node.index);
492 if (unformat(input, "enable")) {
493 if (unformat(input, "dpdk")) {
494 dm->efd.enabled |= DPDK_EFD_DISCARD_ENABLED;
495 } else if (unformat(input, "worker")) {
496 tm->efd.enabled |= VLIB_EFD_DISCARD_ENABLED;
497 } else if (unformat(input, "monitor")) {
498 dm->efd.enabled |= DPDK_EFD_MONITOR_ENABLED;
499 tm->efd.enabled |= VLIB_EFD_MONITOR_ENABLED;
500 } else if (unformat(input, "drop_all")) {
501 dm->efd.enabled |= DPDK_EFD_DROPALL_ENABLED;
502 } else if (unformat(input, "default")) {
503 dm->efd.enabled = (DPDK_EFD_DISCARD_ENABLED |
504 DPDK_EFD_MONITOR_ENABLED);
505 tm->efd.enabled = (VLIB_EFD_DISCARD_ENABLED |
506 VLIB_EFD_MONITOR_ENABLED);
508 return clib_error_return(0, "Usage: set efd enable [dpdk | "
509 "worker | monitor | drop_all | default]");
511 } else if (unformat(input, "disable")) {
512 if (unformat(input, "dpdk")) {
513 dm->efd.enabled &= ~DPDK_EFD_DISCARD_ENABLED;
514 } else if (unformat(input, "worker")) {
515 tm->efd.enabled &= ~VLIB_EFD_DISCARD_ENABLED;
516 } else if (unformat(input, "monitor")) {
517 dm->efd.enabled &= ~DPDK_EFD_MONITOR_ENABLED;
518 tm->efd.enabled &= ~VLIB_EFD_MONITOR_ENABLED;
519 } else if (unformat(input, "drop_all")) {
520 dm->efd.enabled &= ~DPDK_EFD_DROPALL_ENABLED;
521 } else if (unformat(input, "all")) {
525 return clib_error_return(0, "Usage: set efd disable [dpdk | "
526 "worker | monitor | drop_all | all]");
528 } else if (unformat(input, "worker_queue_hi_thresh")) {
530 if (unformat (input, "%u", &mark)) {
531 tm->efd.queue_hi_thresh = mark;
533 return clib_error_return(0, "unknown input `%U'",
534 format_unformat_error, input);
536 } else if (unformat(input, "dpdk_device_hi_thresh")) {
538 if (unformat (input, "%u", &thresh)) {
539 dm->efd.queue_hi_thresh = thresh;
541 return clib_error_return(0, "unknown input `%U'",
542 format_unformat_error, input);
544 } else if (unformat(input, "consec_full_frames_hi_thresh")) {
546 if (unformat (input, "%u", &thresh)) {
547 dm->efd.consec_full_frames_hi_thresh = thresh;
549 return clib_error_return(0, "unknown input `%U'",
550 format_unformat_error, input);
552 } else if (unformat(input, "ip-prec")) {
553 return (parse_op_and_prec(vm, input, cmd,
554 "ip", &tm->efd.ip_prec_bitmap));
555 } else if (unformat(input, "mpls-exp")) {
556 return (parse_op_and_prec(vm, input, cmd,
557 "mpls", &tm->efd.mpls_exp_bitmap));
558 } else if (unformat(input, "vlan-cos")) {
559 return (parse_op_and_prec(vm, input, cmd,
560 "vlan", &tm->efd.vlan_cos_bitmap));
561 } else if (unformat(input, "help")) {
564 " set efd enable <dpdk | worker | monitor | drop_all | default> |\n"
565 " set efd disable <dpdk | worker | monitor | drop_all | all> |\n"
566 " set efd <ip-prec | mpls-exp | vlan-cos> <ge | lt> <0-7>\n"
567 " set efd worker_queue_hi_thresh <0-32> |\n"
568 " set efd dpdk_device_hi_thresh <0-%d> |\n"
569 " set efd consec_full_frames_hi_thresh <count> |\n",
570 DPDK_NB_RX_DESC_10GE);
572 return clib_error_return(0, "unknown input `%U'",
573 format_unformat_error, input);
577 rt->function = dpdk_input_efd_multiarch_select();
578 else if (dm->use_rss)
579 rt->function = dpdk_input_rss_multiarch_select();
581 rt->function = dpdk_input_multiarch_select();
586 VLIB_CLI_COMMAND (cmd_set_efd,static) = {
588 .short_help = "set early-fast-discard commands",
592 static clib_error_t *
593 set_dpdk_if_desc (vlib_main_t *vm, unformat_input_t *input,
594 vlib_cli_command_t *cmd)
596 unformat_input_t _line_input, * line_input = &_line_input;
597 dpdk_main_t * dm = &dpdk_main;
598 vnet_hw_interface_t * hw;
600 u32 hw_if_index = (u32) ~0;
601 u32 nb_rx_desc = (u32) ~0;
602 u32 nb_tx_desc = (u32) ~0;
605 if (! unformat_user (input, unformat_line_input, line_input))
608 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) {
609 if (unformat (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
612 else if (unformat (line_input, "tx %d", &nb_tx_desc))
614 else if (unformat (line_input, "rx %d", &nb_rx_desc))
617 return clib_error_return (0, "parse error: '%U'",
618 format_unformat_error, line_input);
621 unformat_free (line_input);
623 if (hw_if_index == (u32) ~0)
624 return clib_error_return (0, "please specify valid interface name");
626 hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
627 xd = vec_elt_at_index (dm->devices, hw->dev_instance);
629 if (xd->dev_type != VNET_DPDK_DEV_ETH)
630 return clib_error_return (0, "number of descriptors can be set only for "
633 if ((nb_rx_desc == (u32) ~0 || nb_rx_desc == xd->nb_rx_desc) &&
634 (nb_tx_desc == (u32) ~0 || nb_tx_desc == xd->nb_tx_desc))
635 return clib_error_return (0, "nothing changed");
637 if (nb_rx_desc != (u32) ~0)
638 xd->nb_rx_desc = nb_rx_desc;
640 if (nb_tx_desc != (u32) ~0)
641 xd->nb_rx_desc = nb_rx_desc;
643 rv = dpdk_port_setup(dm, xd);
648 VLIB_CLI_COMMAND (cmd_set_dpdk_if_desc,static) = {
649 .path = "set dpdk interface descriptors",
650 .short_help = "set dpdk interface descriptors <if-name> [rx <n>] [tx <n>]",
651 .function = set_dpdk_if_desc,
654 static clib_error_t *
655 show_dpdk_if_placement (vlib_main_t *vm, unformat_input_t *input,
656 vlib_cli_command_t *cmd)
658 vlib_thread_main_t * tm = vlib_get_thread_main();
659 dpdk_main_t * dm = &dpdk_main;
660 dpdk_device_and_queue_t * dq;
663 if (tm->n_vlib_mains == 1)
664 vlib_cli_output(vm, "All interfaces are handled by main thread");
666 for(cpu = 0; cpu < vec_len(dm->devices_by_cpu); cpu++)
668 if (vec_len(dm->devices_by_cpu[cpu]))
669 vlib_cli_output(vm, "Thread %u (%s at lcore %u):", cpu,
670 vlib_worker_threads[cpu].name,
671 vlib_worker_threads[cpu].dpdk_lcore_id);
673 vec_foreach(dq, dm->devices_by_cpu[cpu])
675 u32 hw_if_index = dm->devices[dq->device].vlib_hw_if_index;
676 vnet_hw_interface_t * hi = vnet_get_hw_interface(dm->vnet_main, hw_if_index);
677 vlib_cli_output(vm, " %v queue %u", hi->name, dq->queue_id);
683 VLIB_CLI_COMMAND (cmd_show_dpdk_if_placement,static) = {
684 .path = "show dpdk interface placement",
685 .short_help = "show dpdk interface placement",
686 .function = show_dpdk_if_placement,
690 dpdk_device_queue_sort(void * a1, void * a2)
692 dpdk_device_and_queue_t * dq1 = a1;
693 dpdk_device_and_queue_t * dq2 = a2;
695 if (dq1->device > dq2->device)
697 else if (dq1->device < dq2->device)
699 else if (dq1->queue_id > dq2->queue_id)
701 else if (dq1->queue_id < dq2->queue_id)
707 static clib_error_t *
708 set_dpdk_if_placement (vlib_main_t *vm, unformat_input_t *input,
709 vlib_cli_command_t *cmd)
711 unformat_input_t _line_input, * line_input = &_line_input;
712 dpdk_main_t * dm = &dpdk_main;
713 dpdk_device_and_queue_t * dq;
714 vnet_hw_interface_t * hw;
716 u32 hw_if_index = (u32) ~0;
721 if (! unformat_user (input, unformat_line_input, line_input))
724 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) {
725 if (unformat (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
728 else if (unformat (line_input, "queue %d", &queue))
730 else if (unformat (line_input, "thread %d", &cpu))
733 return clib_error_return (0, "parse error: '%U'",
734 format_unformat_error, line_input);
737 unformat_free (line_input);
739 if (hw_if_index == (u32) ~0)
740 return clib_error_return (0, "please specify valid interface name");
742 if (cpu < dm->input_cpu_first_index ||
743 cpu >= (dm->input_cpu_first_index + dm->input_cpu_count))
744 return clib_error_return (0, "please specify valid thread id");
746 hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
747 xd = vec_elt_at_index (dm->devices, hw->dev_instance);
749 for(i = 0; i < vec_len(dm->devices_by_cpu); i++)
751 vec_foreach(dq, dm->devices_by_cpu[i])
753 if (hw_if_index == dm->devices[dq->device].vlib_hw_if_index &&
754 queue == dq->queue_id)
756 if (cpu == i) /* nothing to do */
759 vec_del1(dm->devices_by_cpu[i], dq - dm->devices_by_cpu[i]);
760 vec_add2(dm->devices_by_cpu[cpu], dq, 1);
761 dq->queue_id = queue;
762 dq->device = xd->device_index;
763 xd->cpu_socket_id_by_queue[queue] =
764 rte_lcore_to_socket_id(vlib_worker_threads[cpu].dpdk_lcore_id);
766 vec_sort_with_function(dm->devices_by_cpu[i],
767 dpdk_device_queue_sort);
769 vec_sort_with_function(dm->devices_by_cpu[cpu],
770 dpdk_device_queue_sort);
772 if (vec_len(dm->devices_by_cpu[i]) == 0)
773 vlib_node_set_state (vlib_mains[i], dpdk_input_node.index,
774 VLIB_NODE_STATE_DISABLED);
776 if (vec_len(dm->devices_by_cpu[cpu]) == 1)
777 vlib_node_set_state (vlib_mains[cpu], dpdk_input_node.index,
778 VLIB_NODE_STATE_POLLING);
785 return clib_error_return (0, "not found");
788 VLIB_CLI_COMMAND (cmd_set_dpdk_if_placement,static) = {
789 .path = "set dpdk interface placement",
790 .short_help = "set dpdk interface placement <if-name> [queue <n>] thread <n>",
791 .function = set_dpdk_if_placement,
795 dpdk_cli_init (vlib_main_t * vm)
800 VLIB_INIT_FUNCTION (dpdk_cli_init);