89 else if (
unformat (input,
"max %d", &max))
95 else if (
unformat (input,
"intfc %U",
99 else if (
unformat (input,
"intfc any"))
104 else if (
unformat (input,
"file %s", &filename))
108 if (strstr ((
char *) filename,
"..")
109 || index ((
char *) filename,
'/'))
116 chroot_filename =
format (0,
"/tmp/%s%c", filename, 0);
125 else if (
unformat (input,
"status"))
152 .path =
"pcap tx trace",
154 "pcap tx trace on off max <nn> intfc <intfc> file <name> status",
164 struct rte_mempool *rmp;
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",
183 (
u32) (count + free_count));
195 .path =
"show dpdk buffer",
196 .short_help =
"show dpdk buffer state",
206 static u32 *allocated_buffers;
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)
225 n_free,
vec_len (allocated_buffers));
227 first =
vec_len (allocated_buffers) - n_free;
229 _vec_len (allocated_buffers) =
first;
233 first =
vec_len (allocated_buffers);
235 vec_len (allocated_buffers) + n_alloc - 1);
239 _vec_len (allocated_buffers) = first + actual_alloc;
241 if (actual_alloc < n_alloc)
249 if (allocated_buffers &&
vec_len (allocated_buffers) == 0)
257 .path =
"test dpdk buffer",
258 .short_help =
"test dpdk buffer [allocate <nn>][free <nn>]",
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",
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",
318 "ip_prec_bitmap 0x%02x\n" 319 "mpls_exp_bitmap 0x%02x\n" 320 "vlan_cos_bitmap 0x%02x\n",
340 (void)
unformat (input,
"device %d", &device_id);
344 if ((xd->
device_index == device_id) || (device_id == ~0))
351 else if (
unformat (input,
"worker"))
358 u32 first_worker_index = 0;
366 num_workers = tr->
count;
372 "first_worker_index %d\n" 373 "vlib_frame_queues[%d]:\n",
376 for (thread_id = 0; thread_id < tm->
n_vlib_mains; 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",
397 "dpdk [device <id>] | worker\n");
410 .short_help =
"Show efd [device <id>] | [config]",
440 for (thread_id = 0; thread_id < tm->
n_vlib_mains; thread_id++)
456 .short_help =
"Clear early-fast-discard counters",
464 char *prec_type,
u8 * prec_bitmap)
480 vlib_cli_output (vm,
"enter operation [ge | lt] and precedence <0-7>)");
506 "EFD will be set for %s precedence %s%u%s.",
531 else if (
unformat (input,
"worker"))
535 else if (
unformat (input,
"monitor"))
540 else if (
unformat (input,
"drop_all"))
544 else if (
unformat (input,
"default"))
554 "worker | monitor | drop_all | default]");
557 else if (
unformat (input,
"disable"))
563 else if (
unformat (input,
"worker"))
567 else if (
unformat (input,
"monitor"))
572 else if (
unformat (input,
"drop_all"))
584 "worker | monitor | drop_all | all]");
587 else if (
unformat (input,
"worker_queue_hi_thresh"))
600 else if (
unformat (input,
"dpdk_device_hi_thresh"))
603 if (
unformat (input,
"%u", &thresh))
613 else if (
unformat (input,
"consec_full_frames_hi_thresh"))
616 if (
unformat (input,
"%u", &thresh))
626 else if (
unformat (input,
"ip-prec"))
631 else if (
unformat (input,
"mpls-exp"))
636 else if (
unformat (input,
"vlan-cos"))
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",
672 .short_help =
"set early-fast-discard commands",
685 u32 hw_if_index = (
u32) ~ 0;
686 u32 nb_rx_desc = (
u32) ~ 0;
687 u32 nb_tx_desc = (
u32) ~ 0;
699 else if (
unformat (line_input,
"tx %d", &nb_tx_desc))
701 else if (
unformat (line_input,
"rx %d", &nb_rx_desc))
710 if (hw_if_index == (
u32) ~ 0)
720 if ((nb_rx_desc == (
u32) ~ 0 || nb_rx_desc == xd->
nb_rx_desc) &&
724 if (nb_rx_desc != (
u32) ~ 0)
727 if (nb_tx_desc != (
u32) ~ 0)
737 .path =
"set dpdk interface descriptors",
738 .short_help =
"set dpdk interface descriptors <if-name> [rx <n>] [tx <n>]",
776 .path =
"show dpdk interface placement",
777 .short_help =
"show dpdk interface placement",
809 u32 hw_if_index = (
u32) ~ 0;
823 else if (
unformat (line_input,
"queue %d", &queue))
825 else if (
unformat (line_input,
"thread %d", &cpu))
834 if (hw_if_index == (
u32) ~ 0)
837 if (cpu < dm->input_cpu_first_index ||
870 VLIB_NODE_STATE_DISABLED);
874 VLIB_NODE_STATE_POLLING);
887 .path =
"set dpdk interface placement",
888 .short_help =
"set dpdk interface placement <if-name> [queue <n>] thread <n>",
unformat_function_t unformat_vnet_hw_interface
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
char * file_name
File name of pcap output.
sll srl srl sll sra u16x4 i
static void show_dpdk_device_stats(vlib_main_t *vm, dpdk_device_t *xd)
u32 n_packets_to_capture
Number of packets to capture.
static clib_error_t * show_dpdk_if_placement(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define VLIB_EFD_DISCARD_ENABLED
static clib_error_t * set_dpdk_if_placement(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
static clib_error_t * parse_op_and_prec(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd, char *prec_type, u8 *prec_bitmap)
vlib_buffer_main_t * buffer_main
vlib_worker_thread_t * vlib_worker_threads
unformat_function_t unformat_vnet_sw_interface
static clib_error_t * show_dpdk_buffer(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define clib_error_report(e)
clib_error_t * dpdk_port_setup(dpdk_main_t *dm, dpdk_device_t *xd)
void * dpdk_input_efd_multiarch_select()
vlib_node_function_t * function
#define VLIB_INIT_FUNCTION(x)
vlib_node_registration_t dpdk_input_node
(constructor) VLIB_REGISTER_NODE (dpdk_input_node)
int input_cpu_first_index
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
vlib_frame_queue_t ** vlib_frame_queues
#define VLIB_EFD_MONITOR_ENABLED
void * dpdk_input_multiarch_select()
static heap_elt_t * first(heap_header_t *h)
u16 consec_full_frames_hi_thresh
vlib_main_t ** vlib_mains
static clib_error_t * pcap_trace_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
dpdk_device_and_queue_t ** devices_by_cpu
static clib_error_t * clear_efd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 consec_full_frames_cnt
#define DPDK_EFD_DISCARD_ENABLED
#define DPDK_EFD_MONITOR_ENABLED
#define vec_del1(v, i)
Delete the element at index I.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
struct rte_mempool ** pktmbuf_pools
u16 * cpu_socket_id_by_queue
#define vec_free(V)
Free vector's memory (no header).
static clib_error_t * test_dpdk_buffer(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static vlib_thread_main_t * vlib_get_thread_main()
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
static int dpdk_device_queue_sort(void *a1, void *a2)
clib_error_t * pcap_write(pcap_main_t *pm)
Write PCAP file.
static clib_error_t * set_dpdk_if_desc(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define EFD_OPERATION_GREATER_OR_EQUAL
void * dpdk_input_rss_multiarch_select()
void vlib_buffer_free(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Free buffers Frees the entire buffer chain for each buffer.
static void vlib_node_set_state(vlib_main_t *vm, u32 node_index, vlib_node_state_t new_state)
Set node dispatch state.
uword * thread_registrations_by_name
u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
#define DPDK_NB_RX_DESC_10GE
static clib_error_t * show_efd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
pcap_packet_type_t packet_type
Packet type.
VLIB_CLI_COMMAND(set_interface_ip_source_and_port_range_check_command, static)
static clib_error_t * set_efd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
dpdk_device_type_t dev_type
dpdk_efd_agent_t efd_agent
#define DPDK_EFD_DROPALL_ENABLED
void set_efd_bitmap(u8 *bitmap, u32 value, u32 op)
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
#define hash_get_mem(h, key)
#define vec_foreach(var, vec)
Vector iterator.
#define EFD_OPERATION_LESS_THAN
#define clib_error_return(e, args...)
static void show_efd_config(vlib_main_t *vm)
u32 n_packets_captured
Number of packets currently captured.
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".
clib_error_t * dpdk_cli_init(vlib_main_t *vm)