diff options
author | Damjan Marion <damarion@cisco.com> | 2016-11-15 19:47:58 +0100 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2016-11-17 17:18:14 +0000 |
commit | 4ee3a65b93282aec6d2016f174529d7ac5e364e1 (patch) | |
tree | 4dcac2749d0c52ee51c2d87a0c5d23a9302f4b58 /vnet/vnet/devices/dpdk/cli.c | |
parent | 5858a82e761b5782ee09b29fa2365cbcfae56fda (diff) |
dpdk: remove efd
Change-Id: I761af883403b6740bd24ce196ae0bfe6bc77b408
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'vnet/vnet/devices/dpdk/cli.c')
-rw-r--r-- | vnet/vnet/devices/dpdk/cli.c | 380 |
1 files changed, 0 insertions, 380 deletions
diff --git a/vnet/vnet/devices/dpdk/cli.c b/vnet/vnet/devices/dpdk/cli.c index 5e53a98beae..a9f91ec5a6d 100644 --- a/vnet/vnet/devices/dpdk/cli.c +++ b/vnet/vnet/devices/dpdk/cli.c @@ -256,386 +256,6 @@ VLIB_CLI_COMMAND (cmd_test_dpdk_buffer,static) = { }; /* *INDENT-ON* */ -static void -show_dpdk_device_stats (vlib_main_t * vm, dpdk_device_t * xd) -{ - vlib_cli_output (vm, - "device_index %d\n" - " last_burst_sz %d\n" - " max_burst_sz %d\n" - " full_frames_cnt %u\n" - " consec_full_frames_cnt %u\n" - " congestion_cnt %d\n" - " last_poll_time %llu\n" - " max_poll_delay %llu\n" - " discard_cnt %u\n" - " total_packet_cnt %u\n", - xd->device_index, - xd->efd_agent.last_burst_sz, - xd->efd_agent.max_burst_sz, - xd->efd_agent.full_frames_cnt, - xd->efd_agent.consec_full_frames_cnt, - xd->efd_agent.congestion_cnt, - xd->efd_agent.last_poll_time, - xd->efd_agent.max_poll_delay, - xd->efd_agent.discard_cnt, xd->efd_agent.total_packet_cnt); - - u32 device_queue_sz = rte_eth_rx_queue_count (xd->device_index, - 0 /* queue_id */ ); - vlib_cli_output (vm, " device_queue_sz %u\n", device_queue_sz); -} - -static void -show_efd_config (vlib_main_t * vm) -{ - vlib_thread_main_t *tm = vlib_get_thread_main (); - dpdk_main_t *dm = &dpdk_main; - - vlib_cli_output (vm, - "dpdk: (0x%04x) enabled:%d monitor:%d drop_all:%d\n" - " dpdk_queue_hi_thresh %d\n" - " consec_full_frames_hi_thresh %d\n" - "---------\n" - "worker: (0x%04x) enabled:%d monitor:%d\n" - " worker_queue_hi_thresh %d\n", - dm->efd.enabled, - ((dm->efd.enabled & DPDK_EFD_DISCARD_ENABLED) ? 1 : 0), - ((dm->efd.enabled & DPDK_EFD_MONITOR_ENABLED) ? 1 : 0), - ((dm->efd.enabled & DPDK_EFD_DROPALL_ENABLED) ? 1 : 0), - dm->efd.queue_hi_thresh, - dm->efd.consec_full_frames_hi_thresh, - tm->efd.enabled, - ((tm->efd.enabled & VLIB_EFD_DISCARD_ENABLED) ? 1 : 0), - ((dm->efd.enabled & VLIB_EFD_MONITOR_ENABLED) ? 1 : 0), - tm->efd.queue_hi_thresh); - vlib_cli_output (vm, - "---------\n" - "ip_prec_bitmap 0x%02x\n" - "mpls_exp_bitmap 0x%02x\n" - "vlan_cos_bitmap 0x%02x\n", - tm->efd.ip_prec_bitmap, - tm->efd.mpls_exp_bitmap, tm->efd.vlan_cos_bitmap); -} - -static clib_error_t * -show_efd (vlib_main_t * vm, - unformat_input_t * input, vlib_cli_command_t * cmd) -{ - - if (unformat (input, "config")) - { - show_efd_config (vm); - } - else if (unformat (input, "dpdk")) - { - dpdk_main_t *dm = &dpdk_main; - dpdk_device_t *xd; - u32 device_id = ~0; - - (void) unformat (input, "device %d", &device_id); - /* *INDENT-OFF* */ - vec_foreach (xd, dm->devices) - { - if ((xd->device_index == device_id) || (device_id == ~0)) - { - show_dpdk_device_stats(vm, xd); - } - } - /* *INDENT-ON* */ - } - else if (unformat (input, "worker")) - { - vlib_thread_main_t *tm = vlib_get_thread_main (); - vlib_thread_registration_t *tr; - u32 num_workers = 0; - u32 first_worker_index = 0; - uword *p; - - p = hash_get_mem (tm->thread_registrations_by_name, "workers"); - ASSERT (p); - tr = (vlib_thread_registration_t *) p[0]; - if (tr) - { - num_workers = tr->count; - first_worker_index = tr->first_index; - } - - vlib_cli_output (vm, - "num_workers %d\n" - "first_worker_index %d\n", - num_workers, first_worker_index); - - } - else if (unformat (input, "help")) - { - vlib_cli_output (vm, "Usage: show efd config | " - "dpdk [device <id>] | worker\n"); - } - else - { - show_efd_config (vm); - } - - return 0; -} - -/* *INDENT-OFF* */ -VLIB_CLI_COMMAND (show_efd_command, static) = { - .path = "show efd", - .short_help = "Show efd [device <id>] | [config]", - .function = show_efd, -}; -/* *INDENT-ON* */ - -static clib_error_t * -clear_efd (vlib_main_t * vm, - unformat_input_t * input, vlib_cli_command_t * cmd) -{ - dpdk_main_t *dm = &dpdk_main; - dpdk_device_t *xd; - - /* *INDENT-OFF* */ - vec_foreach (xd, dm->devices) - { - xd->efd_agent.last_burst_sz = 0; - xd->efd_agent.max_burst_sz = 0; - xd->efd_agent.full_frames_cnt = 0; - xd->efd_agent.consec_full_frames_cnt = 0; - xd->efd_agent.congestion_cnt = 0; - xd->efd_agent.last_poll_time = 0; - xd->efd_agent.max_poll_delay = 0; - xd->efd_agent.discard_cnt = 0; - xd->efd_agent.total_packet_cnt = 0; - } - /* *INDENT-ON* */ - - return 0; -} - -/* *INDENT-OFF* */ -VLIB_CLI_COMMAND (clear_efd_command,static) = { - .path = "clear efd", - .short_help = "Clear early-fast-discard counters", - .function = clear_efd, -}; -/* *INDENT-ON* */ - -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) -{ - clib_error_t *error = NULL; - u8 op = 0; - u8 prec = 0; - - if (unformat (input, "ge")) - { - op = EFD_OPERATION_GREATER_OR_EQUAL; - } - else if (unformat (input, "lt")) - { - op = EFD_OPERATION_LESS_THAN; - } - else if (unformat (input, "help")) - { - vlib_cli_output (vm, "enter operation [ge | lt] and precedence <0-7>)"); - return (error); - } - else - { - return clib_error_return (0, "unknown input `%U'", - format_unformat_error, input); - } - - if (unformat (input, "%u", &prec)) - { - if (prec > 7) - { - return clib_error_return (0, "precedence %d is out of range <0-7>", - prec); - } - } - else - { - return clib_error_return (0, "unknown input `%U'", - format_unformat_error, input); - } - - set_efd_bitmap (prec_bitmap, prec, op); - - vlib_cli_output (vm, - "EFD will be set for %s precedence %s%u%s.", - prec_type, - (op == EFD_OPERATION_LESS_THAN) ? "less than " : "", - prec, - (op == - EFD_OPERATION_GREATER_OR_EQUAL) ? " and greater" : ""); - - return (error); -} - - -static clib_error_t * -set_efd (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) -{ - dpdk_main_t *dm = &dpdk_main; - vlib_thread_main_t *tm = vlib_get_thread_main (); - clib_error_t *error = NULL; - vlib_node_runtime_t *rt = vlib_node_get_runtime (vm, dpdk_input_node.index); - - if (unformat (input, "enable")) - { - if (unformat (input, "dpdk")) - { - dm->efd.enabled |= DPDK_EFD_DISCARD_ENABLED; - } - else if (unformat (input, "worker")) - { - tm->efd.enabled |= VLIB_EFD_DISCARD_ENABLED; - } - else if (unformat (input, "monitor")) - { - dm->efd.enabled |= DPDK_EFD_MONITOR_ENABLED; - tm->efd.enabled |= VLIB_EFD_MONITOR_ENABLED; - } - else if (unformat (input, "drop_all")) - { - dm->efd.enabled |= DPDK_EFD_DROPALL_ENABLED; - } - else if (unformat (input, "default")) - { - dm->efd.enabled = (DPDK_EFD_DISCARD_ENABLED | - DPDK_EFD_MONITOR_ENABLED); - tm->efd.enabled = (VLIB_EFD_DISCARD_ENABLED | - VLIB_EFD_MONITOR_ENABLED); - } - else - { - return clib_error_return (0, "Usage: set efd enable [dpdk | " - "worker | monitor | drop_all | default]"); - } - } - else if (unformat (input, "disable")) - { - if (unformat (input, "dpdk")) - { - dm->efd.enabled &= ~DPDK_EFD_DISCARD_ENABLED; - } - else if (unformat (input, "worker")) - { - tm->efd.enabled &= ~VLIB_EFD_DISCARD_ENABLED; - } - else if (unformat (input, "monitor")) - { - dm->efd.enabled &= ~DPDK_EFD_MONITOR_ENABLED; - tm->efd.enabled &= ~VLIB_EFD_MONITOR_ENABLED; - } - else if (unformat (input, "drop_all")) - { - dm->efd.enabled &= ~DPDK_EFD_DROPALL_ENABLED; - } - else if (unformat (input, "all")) - { - dm->efd.enabled = 0; - tm->efd.enabled = 0; - } - else - { - return clib_error_return (0, "Usage: set efd disable [dpdk | " - "worker | monitor | drop_all | all]"); - } - } - else if (unformat (input, "worker_queue_hi_thresh")) - { - u32 mark; - if (unformat (input, "%u", &mark)) - { - tm->efd.queue_hi_thresh = mark; - } - else - { - return clib_error_return (0, "unknown input `%U'", - format_unformat_error, input); - } - } - else if (unformat (input, "dpdk_device_hi_thresh")) - { - u32 thresh; - if (unformat (input, "%u", &thresh)) - { - dm->efd.queue_hi_thresh = thresh; - } - else - { - return clib_error_return (0, "unknown input `%U'", - format_unformat_error, input); - } - } - else if (unformat (input, "consec_full_frames_hi_thresh")) - { - u32 thresh; - if (unformat (input, "%u", &thresh)) - { - dm->efd.consec_full_frames_hi_thresh = thresh; - } - else - { - return clib_error_return (0, "unknown input `%U'", - format_unformat_error, input); - } - } - else if (unformat (input, "ip-prec")) - { - return (parse_op_and_prec (vm, input, cmd, - "ip", &tm->efd.ip_prec_bitmap)); - } - else if (unformat (input, "mpls-exp")) - { - return (parse_op_and_prec (vm, input, cmd, - "mpls", &tm->efd.mpls_exp_bitmap)); - } - else if (unformat (input, "vlan-cos")) - { - return (parse_op_and_prec (vm, input, cmd, - "vlan", &tm->efd.vlan_cos_bitmap)); - } - else if (unformat (input, "help")) - { - vlib_cli_output (vm, - "Usage:\n" - " set efd enable <dpdk | worker | monitor | drop_all | default> |\n" - " set efd disable <dpdk | worker | monitor | drop_all | all> |\n" - " set efd <ip-prec | mpls-exp | vlan-cos> <ge | lt> <0-7>\n" - " set efd worker_queue_hi_thresh <0-32> |\n" - " set efd dpdk_device_hi_thresh <0-%d> |\n" - " set efd consec_full_frames_hi_thresh <count> |\n", - DPDK_NB_RX_DESC_10GE); - } - else - { - return clib_error_return (0, "unknown input `%U'", - format_unformat_error, input); - } - - if (dm->efd.enabled) - rt->function = dpdk_input_efd_multiarch_select (); - else if (dm->use_rss) - rt->function = dpdk_input_rss_multiarch_select (); - else - rt->function = dpdk_input_multiarch_select (); - - return error; -} - -/* *INDENT-OFF* */ -VLIB_CLI_COMMAND (cmd_set_efd,static) = { - .path = "set efd", - .short_help = "set early-fast-discard commands", - .function = set_efd, -}; -/* *INDENT-ON* */ - static clib_error_t * set_dpdk_if_desc (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) |