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, 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 #if RTE_VERSION >= RTE_VERSION_NUM(16, 7, 0, 0)
173 unsigned count = rte_mempool_avail_count (rmp);
174 unsigned free_count = rte_mempool_in_use_count (rmp);
176 unsigned count = rte_mempool_count (rmp);
177 unsigned free_count = rte_mempool_free_count (rmp);
181 "name=\"%s\" available = %7d allocated = %7d total = %7d\n",
182 rmp->name, (u32) count, (u32) free_count,
183 (u32) (count + free_count));
187 vlib_cli_output (vm, "rte_mempool is NULL (!)\n");
194 VLIB_CLI_COMMAND (cmd_show_dpdk_bufferr,static) = {
195 .path = "show dpdk buffer",
196 .short_help = "show dpdk buffer state",
197 .function = show_dpdk_buffer,
202 static clib_error_t *
203 test_dpdk_buffer (vlib_main_t * vm, unformat_input_t * input,
204 vlib_cli_command_t * cmd)
206 static u32 *allocated_buffers;
209 u32 first, actual_alloc;
211 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
213 if (unformat (input, "allocate %d", &n_alloc))
215 else if (unformat (input, "free %d", &n_free))
223 if (vec_len (allocated_buffers) < n_free)
224 return clib_error_return (0, "Can't free %d, only %d allocated",
225 n_free, vec_len (allocated_buffers));
227 first = vec_len (allocated_buffers) - n_free;
228 vlib_buffer_free (vm, allocated_buffers + first, n_free);
229 _vec_len (allocated_buffers) = first;
233 first = vec_len (allocated_buffers);
234 vec_validate (allocated_buffers,
235 vec_len (allocated_buffers) + n_alloc - 1);
237 actual_alloc = vlib_buffer_alloc (vm, allocated_buffers + first,
239 _vec_len (allocated_buffers) = first + actual_alloc;
241 if (actual_alloc < n_alloc)
242 vlib_cli_output (vm, "WARNING: only allocated %d buffers",
246 vlib_cli_output (vm, "Currently %d buffers allocated",
247 vec_len (allocated_buffers));
249 if (allocated_buffers && vec_len (allocated_buffers) == 0)
250 vec_free (allocated_buffers);
256 VLIB_CLI_COMMAND (cmd_test_dpdk_buffer,static) = {
257 .path = "test dpdk buffer",
258 .short_help = "test dpdk buffer [allocate <nn>][free <nn>]",
259 .function = test_dpdk_buffer,
265 show_dpdk_device_stats (vlib_main_t * vm, dpdk_device_t * xd)
269 " last_burst_sz %d\n"
271 " full_frames_cnt %u\n"
272 " consec_full_frames_cnt %u\n"
273 " congestion_cnt %d\n"
274 " last_poll_time %llu\n"
275 " max_poll_delay %llu\n"
277 " total_packet_cnt %u\n",
279 xd->efd_agent.last_burst_sz,
280 xd->efd_agent.max_burst_sz,
281 xd->efd_agent.full_frames_cnt,
282 xd->efd_agent.consec_full_frames_cnt,
283 xd->efd_agent.congestion_cnt,
284 xd->efd_agent.last_poll_time,
285 xd->efd_agent.max_poll_delay,
286 xd->efd_agent.discard_cnt, xd->efd_agent.total_packet_cnt);
288 u32 device_queue_sz = rte_eth_rx_queue_count (xd->device_index,
290 vlib_cli_output (vm, " device_queue_sz %u\n", device_queue_sz);
294 show_efd_config (vlib_main_t * vm)
296 vlib_thread_main_t *tm = vlib_get_thread_main ();
297 dpdk_main_t *dm = &dpdk_main;
300 "dpdk: (0x%04x) enabled:%d monitor:%d drop_all:%d\n"
301 " dpdk_queue_hi_thresh %d\n"
302 " consec_full_frames_hi_thresh %d\n"
304 "worker: (0x%04x) enabled:%d monitor:%d\n"
305 " worker_queue_hi_thresh %d\n",
307 ((dm->efd.enabled & DPDK_EFD_DISCARD_ENABLED) ? 1 : 0),
308 ((dm->efd.enabled & DPDK_EFD_MONITOR_ENABLED) ? 1 : 0),
309 ((dm->efd.enabled & DPDK_EFD_DROPALL_ENABLED) ? 1 : 0),
310 dm->efd.queue_hi_thresh,
311 dm->efd.consec_full_frames_hi_thresh,
313 ((tm->efd.enabled & VLIB_EFD_DISCARD_ENABLED) ? 1 : 0),
314 ((dm->efd.enabled & VLIB_EFD_MONITOR_ENABLED) ? 1 : 0),
315 tm->efd.queue_hi_thresh);
318 "ip_prec_bitmap 0x%02x\n"
319 "mpls_exp_bitmap 0x%02x\n"
320 "vlan_cos_bitmap 0x%02x\n",
321 tm->efd.ip_prec_bitmap,
322 tm->efd.mpls_exp_bitmap, tm->efd.vlan_cos_bitmap);
325 static clib_error_t *
326 show_efd (vlib_main_t * vm,
327 unformat_input_t * input, vlib_cli_command_t * cmd)
330 if (unformat (input, "config"))
332 show_efd_config (vm);
334 else if (unformat (input, "dpdk"))
336 dpdk_main_t *dm = &dpdk_main;
340 (void) unformat (input, "device %d", &device_id);
342 vec_foreach (xd, dm->devices)
344 if ((xd->device_index == device_id) || (device_id == ~0))
346 show_dpdk_device_stats(vm, xd);
351 else if (unformat (input, "worker"))
353 vlib_thread_main_t *tm = vlib_get_thread_main ();
354 vlib_frame_queue_t *fq;
355 vlib_thread_registration_t *tr;
358 u32 first_worker_index = 0;
361 p = hash_get_mem (tm->thread_registrations_by_name, "workers");
363 tr = (vlib_thread_registration_t *) p[0];
366 num_workers = tr->count;
367 first_worker_index = tr->first_index;
372 "first_worker_index %d\n"
373 "vlib_frame_queues[%d]:\n",
374 num_workers, first_worker_index, tm->n_vlib_mains);
376 for (thread_id = 0; thread_id < tm->n_vlib_mains; thread_id++)
378 fq = vlib_frame_queues[thread_id];
382 "%2d: frames_queued %u\n"
383 " frames_queued_hint %u\n"
384 " enqueue_full_events %u\n"
385 " enqueue_efd_discards %u\n",
387 (fq->tail - fq->head),
388 (fq->tail - fq->head_hint),
389 fq->enqueue_full_events,
390 fq->enqueue_efd_discards);
394 else if (unformat (input, "help"))
396 vlib_cli_output (vm, "Usage: show efd config | "
397 "dpdk [device <id>] | worker\n");
401 show_efd_config (vm);
408 VLIB_CLI_COMMAND (show_efd_command, static) = {
410 .short_help = "Show efd [device <id>] | [config]",
411 .function = show_efd,
415 static clib_error_t *
416 clear_efd (vlib_main_t * vm,
417 unformat_input_t * input, vlib_cli_command_t * cmd)
419 dpdk_main_t *dm = &dpdk_main;
421 vlib_thread_main_t *tm = vlib_get_thread_main ();
422 vlib_frame_queue_t *fq;
426 vec_foreach (xd, dm->devices)
428 xd->efd_agent.last_burst_sz = 0;
429 xd->efd_agent.max_burst_sz = 0;
430 xd->efd_agent.full_frames_cnt = 0;
431 xd->efd_agent.consec_full_frames_cnt = 0;
432 xd->efd_agent.congestion_cnt = 0;
433 xd->efd_agent.last_poll_time = 0;
434 xd->efd_agent.max_poll_delay = 0;
435 xd->efd_agent.discard_cnt = 0;
436 xd->efd_agent.total_packet_cnt = 0;
440 for (thread_id = 0; thread_id < tm->n_vlib_mains; thread_id++)
442 fq = vlib_frame_queues[thread_id];
445 fq->enqueue_full_events = 0;
446 fq->enqueue_efd_discards = 0;
454 VLIB_CLI_COMMAND (clear_efd_command,static) = {
456 .short_help = "Clear early-fast-discard counters",
457 .function = clear_efd,
461 static clib_error_t *
462 parse_op_and_prec (vlib_main_t * vm, unformat_input_t * input,
463 vlib_cli_command_t * cmd,
464 char *prec_type, u8 * prec_bitmap)
466 clib_error_t *error = NULL;
470 if (unformat (input, "ge"))
472 op = EFD_OPERATION_GREATER_OR_EQUAL;
474 else if (unformat (input, "lt"))
476 op = EFD_OPERATION_LESS_THAN;
478 else if (unformat (input, "help"))
480 vlib_cli_output (vm, "enter operation [ge | lt] and precedence <0-7>)");
485 return clib_error_return (0, "unknown input `%U'",
486 format_unformat_error, input);
489 if (unformat (input, "%u", &prec))
493 return clib_error_return (0, "precedence %d is out of range <0-7>",
499 return clib_error_return (0, "unknown input `%U'",
500 format_unformat_error, input);
503 set_efd_bitmap (prec_bitmap, prec, op);
506 "EFD will be set for %s precedence %s%u%s.",
508 (op == EFD_OPERATION_LESS_THAN) ? "less than " : "",
511 EFD_OPERATION_GREATER_OR_EQUAL) ? " and greater" : "");
517 static clib_error_t *
518 set_efd (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd)
520 dpdk_main_t *dm = &dpdk_main;
521 vlib_thread_main_t *tm = vlib_get_thread_main ();
522 clib_error_t *error = NULL;
523 vlib_node_runtime_t *rt = vlib_node_get_runtime (vm, dpdk_input_node.index);
525 if (unformat (input, "enable"))
527 if (unformat (input, "dpdk"))
529 dm->efd.enabled |= DPDK_EFD_DISCARD_ENABLED;
531 else if (unformat (input, "worker"))
533 tm->efd.enabled |= VLIB_EFD_DISCARD_ENABLED;
535 else if (unformat (input, "monitor"))
537 dm->efd.enabled |= DPDK_EFD_MONITOR_ENABLED;
538 tm->efd.enabled |= VLIB_EFD_MONITOR_ENABLED;
540 else if (unformat (input, "drop_all"))
542 dm->efd.enabled |= DPDK_EFD_DROPALL_ENABLED;
544 else if (unformat (input, "default"))
546 dm->efd.enabled = (DPDK_EFD_DISCARD_ENABLED |
547 DPDK_EFD_MONITOR_ENABLED);
548 tm->efd.enabled = (VLIB_EFD_DISCARD_ENABLED |
549 VLIB_EFD_MONITOR_ENABLED);
553 return clib_error_return (0, "Usage: set efd enable [dpdk | "
554 "worker | monitor | drop_all | default]");
557 else if (unformat (input, "disable"))
559 if (unformat (input, "dpdk"))
561 dm->efd.enabled &= ~DPDK_EFD_DISCARD_ENABLED;
563 else if (unformat (input, "worker"))
565 tm->efd.enabled &= ~VLIB_EFD_DISCARD_ENABLED;
567 else if (unformat (input, "monitor"))
569 dm->efd.enabled &= ~DPDK_EFD_MONITOR_ENABLED;
570 tm->efd.enabled &= ~VLIB_EFD_MONITOR_ENABLED;
572 else if (unformat (input, "drop_all"))
574 dm->efd.enabled &= ~DPDK_EFD_DROPALL_ENABLED;
576 else if (unformat (input, "all"))
583 return clib_error_return (0, "Usage: set efd disable [dpdk | "
584 "worker | monitor | drop_all | all]");
587 else if (unformat (input, "worker_queue_hi_thresh"))
590 if (unformat (input, "%u", &mark))
592 tm->efd.queue_hi_thresh = mark;
596 return clib_error_return (0, "unknown input `%U'",
597 format_unformat_error, input);
600 else if (unformat (input, "dpdk_device_hi_thresh"))
603 if (unformat (input, "%u", &thresh))
605 dm->efd.queue_hi_thresh = thresh;
609 return clib_error_return (0, "unknown input `%U'",
610 format_unformat_error, input);
613 else if (unformat (input, "consec_full_frames_hi_thresh"))
616 if (unformat (input, "%u", &thresh))
618 dm->efd.consec_full_frames_hi_thresh = thresh;
622 return clib_error_return (0, "unknown input `%U'",
623 format_unformat_error, input);
626 else if (unformat (input, "ip-prec"))
628 return (parse_op_and_prec (vm, input, cmd,
629 "ip", &tm->efd.ip_prec_bitmap));
631 else if (unformat (input, "mpls-exp"))
633 return (parse_op_and_prec (vm, input, cmd,
634 "mpls", &tm->efd.mpls_exp_bitmap));
636 else if (unformat (input, "vlan-cos"))
638 return (parse_op_and_prec (vm, input, cmd,
639 "vlan", &tm->efd.vlan_cos_bitmap));
641 else if (unformat (input, "help"))
645 " set efd enable <dpdk | worker | monitor | drop_all | default> |\n"
646 " set efd disable <dpdk | worker | monitor | drop_all | all> |\n"
647 " set efd <ip-prec | mpls-exp | vlan-cos> <ge | lt> <0-7>\n"
648 " set efd worker_queue_hi_thresh <0-32> |\n"
649 " set efd dpdk_device_hi_thresh <0-%d> |\n"
650 " set efd consec_full_frames_hi_thresh <count> |\n",
651 DPDK_NB_RX_DESC_10GE);
655 return clib_error_return (0, "unknown input `%U'",
656 format_unformat_error, input);
660 rt->function = dpdk_input_efd_multiarch_select ();
661 else if (dm->use_rss)
662 rt->function = dpdk_input_rss_multiarch_select ();
664 rt->function = dpdk_input_multiarch_select ();
670 VLIB_CLI_COMMAND (cmd_set_efd,static) = {
672 .short_help = "set early-fast-discard commands",
677 static clib_error_t *
678 set_dpdk_if_desc (vlib_main_t * vm, unformat_input_t * input,
679 vlib_cli_command_t * cmd)
681 unformat_input_t _line_input, *line_input = &_line_input;
682 dpdk_main_t *dm = &dpdk_main;
683 vnet_hw_interface_t *hw;
685 u32 hw_if_index = (u32) ~ 0;
686 u32 nb_rx_desc = (u32) ~ 0;
687 u32 nb_tx_desc = (u32) ~ 0;
690 if (!unformat_user (input, unformat_line_input, line_input))
693 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
696 (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
699 else if (unformat (line_input, "tx %d", &nb_tx_desc))
701 else if (unformat (line_input, "rx %d", &nb_rx_desc))
704 return clib_error_return (0, "parse error: '%U'",
705 format_unformat_error, line_input);
708 unformat_free (line_input);
710 if (hw_if_index == (u32) ~ 0)
711 return clib_error_return (0, "please specify valid interface name");
713 hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
714 xd = vec_elt_at_index (dm->devices, hw->dev_instance);
716 if ((xd->flags & DPDK_DEVICE_FLAG_PMD) == 0)
717 return clib_error_return (0, "number of descriptors can be set only for "
720 if ((nb_rx_desc == (u32) ~ 0 || nb_rx_desc == xd->nb_rx_desc) &&
721 (nb_tx_desc == (u32) ~ 0 || nb_tx_desc == xd->nb_tx_desc))
722 return clib_error_return (0, "nothing changed");
724 if (nb_rx_desc != (u32) ~ 0)
725 xd->nb_rx_desc = nb_rx_desc;
727 if (nb_tx_desc != (u32) ~ 0)
728 xd->nb_rx_desc = nb_rx_desc;
730 rv = dpdk_port_setup (dm, xd);
736 VLIB_CLI_COMMAND (cmd_set_dpdk_if_desc,static) = {
737 .path = "set dpdk interface descriptors",
738 .short_help = "set dpdk interface descriptors <if-name> [rx <n>] [tx <n>]",
739 .function = set_dpdk_if_desc,
743 static clib_error_t *
744 show_dpdk_if_placement (vlib_main_t * vm, unformat_input_t * input,
745 vlib_cli_command_t * cmd)
747 vlib_thread_main_t *tm = vlib_get_thread_main ();
748 dpdk_main_t *dm = &dpdk_main;
749 dpdk_device_and_queue_t *dq;
752 if (tm->n_vlib_mains == 1)
753 vlib_cli_output (vm, "All interfaces are handled by main thread");
755 for (cpu = 0; cpu < vec_len (dm->devices_by_cpu); cpu++)
757 if (vec_len (dm->devices_by_cpu[cpu]))
758 vlib_cli_output (vm, "Thread %u (%s at lcore %u):", cpu,
759 vlib_worker_threads[cpu].name,
760 vlib_worker_threads[cpu].dpdk_lcore_id);
763 vec_foreach(dq, dm->devices_by_cpu[cpu])
765 u32 hw_if_index = dm->devices[dq->device].vlib_hw_if_index;
766 vnet_hw_interface_t * hi = vnet_get_hw_interface(dm->vnet_main, hw_if_index);
767 vlib_cli_output(vm, " %v queue %u", hi->name, dq->queue_id);
775 VLIB_CLI_COMMAND (cmd_show_dpdk_if_placement,static) = {
776 .path = "show dpdk interface placement",
777 .short_help = "show dpdk interface placement",
778 .function = show_dpdk_if_placement,
783 dpdk_device_queue_sort (void *a1, void *a2)
785 dpdk_device_and_queue_t *dq1 = a1;
786 dpdk_device_and_queue_t *dq2 = a2;
788 if (dq1->device > dq2->device)
790 else if (dq1->device < dq2->device)
792 else if (dq1->queue_id > dq2->queue_id)
794 else if (dq1->queue_id < dq2->queue_id)
800 static clib_error_t *
801 set_dpdk_if_placement (vlib_main_t * vm, unformat_input_t * input,
802 vlib_cli_command_t * cmd)
804 unformat_input_t _line_input, *line_input = &_line_input;
805 dpdk_main_t *dm = &dpdk_main;
806 dpdk_device_and_queue_t *dq;
807 vnet_hw_interface_t *hw;
809 u32 hw_if_index = (u32) ~ 0;
814 if (!unformat_user (input, unformat_line_input, line_input))
817 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
820 (line_input, "%U", unformat_vnet_hw_interface, dm->vnet_main,
823 else if (unformat (line_input, "queue %d", &queue))
825 else if (unformat (line_input, "thread %d", &cpu))
828 return clib_error_return (0, "parse error: '%U'",
829 format_unformat_error, line_input);
832 unformat_free (line_input);
834 if (hw_if_index == (u32) ~ 0)
835 return clib_error_return (0, "please specify valid interface name");
837 if (cpu < dm->input_cpu_first_index ||
838 cpu >= (dm->input_cpu_first_index + dm->input_cpu_count))
839 return clib_error_return (0, "please specify valid thread id");
841 hw = vnet_get_hw_interface (dm->vnet_main, hw_if_index);
842 xd = vec_elt_at_index (dm->devices, hw->dev_instance);
844 for (i = 0; i < vec_len (dm->devices_by_cpu); i++)
847 vec_foreach(dq, dm->devices_by_cpu[i])
849 if (hw_if_index == dm->devices[dq->device].vlib_hw_if_index &&
850 queue == dq->queue_id)
852 if (cpu == i) /* nothing to do */
855 vec_del1(dm->devices_by_cpu[i], dq - dm->devices_by_cpu[i]);
856 vec_add2(dm->devices_by_cpu[cpu], dq, 1);
857 dq->queue_id = queue;
858 dq->device = xd->device_index;
859 xd->cpu_socket_id_by_queue[queue] =
860 rte_lcore_to_socket_id(vlib_worker_threads[cpu].dpdk_lcore_id);
862 vec_sort_with_function(dm->devices_by_cpu[i],
863 dpdk_device_queue_sort);
865 vec_sort_with_function(dm->devices_by_cpu[cpu],
866 dpdk_device_queue_sort);
868 if (vec_len(dm->devices_by_cpu[i]) == 0)
869 vlib_node_set_state (vlib_mains[i], dpdk_input_node.index,
870 VLIB_NODE_STATE_DISABLED);
872 if (vec_len(dm->devices_by_cpu[cpu]) == 1)
873 vlib_node_set_state (vlib_mains[cpu], dpdk_input_node.index,
874 VLIB_NODE_STATE_POLLING);
882 return clib_error_return (0, "not found");
886 VLIB_CLI_COMMAND (cmd_set_dpdk_if_placement,static) = {
887 .path = "set dpdk interface placement",
888 .short_help = "set dpdk interface placement <if-name> [queue <n>] thread <n>",
889 .function = set_dpdk_if_placement,
894 dpdk_cli_init (vlib_main_t * vm)
899 VLIB_INIT_FUNCTION (dpdk_cli_init);
902 * fd.io coding-style-patch-verification: ON
905 * eval: (c-set-style "gnu")