X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fflow%2Fflow_cli.c;h=5f44a099f57d047b0ccec37910d7c1757c5f48e2;hb=b95e6d4e7;hp=7dd68677c3b36ae2006e95144d44f10e46d8683b;hpb=34bfa50b61f8cf454ddce9f378e3d5d29f74a72b;p=vpp.git diff --git a/src/vnet/flow/flow_cli.c b/src/vnet/flow/flow_cli.c index 7dd68677c3b..5f44a099f57 100644 --- a/src/vnet/flow/flow_cli.c +++ b/src/vnet/flow/flow_cli.c @@ -223,6 +223,11 @@ show_flow_entry (vlib_main_t * vm, unformat_input_t * input, vlib_cli_output (vm, "%-10s: %u", "index", f->index); vlib_cli_output (vm, "%-10s: %s", "type", flow_type_strings[f->type]); vlib_cli_output (vm, "%-10s: %U", "match", format_flow, f); + if (f->type == VNET_FLOW_TYPE_GENERIC) + { + vlib_cli_output (vm, "%s: %s", "spec", f->generic.pattern.spec); + vlib_cli_output (vm, "%s: %s", "mask", f->generic.pattern.mask); + } /* *INDENT-OFF* */ hash_foreach (hw_if_index, private_data, f->private_data, ({ @@ -240,10 +245,15 @@ show_flow_entry (vlib_main_t * vm, unformat_input_t * input, no_args: /* *INDENT-OFF* */ - pool_foreach (f, fm->global_flow_pool, + pool_foreach (f, fm->global_flow_pool) { vlib_cli_output (vm, "%U\n", format_flow, f); - }); + if (f->type == VNET_FLOW_TYPE_GENERIC) + { + vlib_cli_output (vm, "%s: %s", "spec", f->generic.pattern.spec); + vlib_cli_output (vm, "%s: %s", "mask", f->generic.pattern.mask); + } + } /* *INDENT-ON* */ return 0; @@ -353,7 +363,8 @@ test_flow (vlib_main_t * vm, unformat_input_t * input, u32 hw_if_index = ~0, flow_index = ~0; int rv; u32 teid = 0, session_id = 0, spi = 0; - u16 vni = 0; + u32 vni = 0; + u32 queue_start = 0, queue_end = 0; vnet_flow_type_t type = VNET_FLOW_TYPE_UNKNOWN; ip4_address_and_mask_t ip4s = { }; ip4_address_and_mask_t ip4d = { }; @@ -371,6 +382,8 @@ test_flow (vlib_main_t * vm, unformat_input_t * input, bool ipsec_esp_set = false, ipsec_ah_set = false; u8 *rss_type[3] = { }; u8 *type_str = NULL; + u8 *spec = NULL; + u8 *mask = NULL; clib_memset (&flow, 0, sizeof (vnet_flow_t)); flow.index = ~0; @@ -389,6 +402,10 @@ test_flow (vlib_main_t * vm, unformat_input_t * input, action = FLOW_ENABLE; else if (unformat (line_input, "disable")) action = FLOW_DISABLE; + else if (unformat (line_input, "spec %s", &spec)) + ; + else if (unformat (line_input, "mask %s", &mask)) + ; else if (unformat (line_input, "eth-type %U", unformat_ethernet_type_host_byte_order, ð_type)) flow_class = FLOW_ETHERNET_CLASS; @@ -506,6 +523,21 @@ test_flow (vlib_main_t * vm, unformat_input_t * input, #undef _ flow.actions |= VNET_FLOW_ACTION_RSS; } + else if (unformat (line_input, "rss queues")) + { + if (unformat (line_input, "%d to %d", &queue_start, &queue_end)) + ; + else + { + return clib_error_return (0, "unknown input `%U'", + format_unformat_error, line_input); + } + + flow.queue_index = queue_start; + flow.queue_num = queue_end - queue_start + 1; + + flow.actions |= VNET_FLOW_ACTION_RSS; + } else if (unformat (line_input, "%U", unformat_vnet_hw_interface, vnm, &hw_if_index)) ; @@ -573,6 +605,11 @@ test_flow (vlib_main_t * vm, unformat_input_t * input, break; default: + if (spec && mask) + { + type = VNET_FLOW_TYPE_GENERIC; + break; + } return clib_error_return (0, "Please specify a supported flow type"); } @@ -660,6 +697,13 @@ test_flow (vlib_main_t * vm, unformat_input_t * input, break; } } + if (type == VNET_FLOW_TYPE_GENERIC) + { + clib_memcpy (flow.generic.pattern.spec, spec, + sizeof (flow.generic.pattern.spec)); + clib_memcpy (flow.generic.pattern.mask, mask, + sizeof (flow.generic.pattern.mask)); + } flow.type = type; rv = vnet_flow_add (vnm, &flow, &flow_index); @@ -689,18 +733,20 @@ test_flow (vlib_main_t * vm, unformat_input_t * input, /* *INDENT-OFF* */ VLIB_CLI_COMMAND (test_flow_command, static) = { - .path = "test flow", - .short_help = "test flow [add|del|enable|disable] [index ] " - "[src-ip ] [dst-ip ] " - "[ip6-src-ip ] [ip6-dst-ip ] " - "[src-port ] [dst-port ] " - "[proto ] " - "[gtpc teid ] [gtpu teid ] [vxlan ] " - "[session id ] [spi ]" - "[next-node ] [mark ] [buffer-advance ] " - "[redirect-to-queue ] [drop] " - "[rss function ] [rss types ]", - .function = test_flow, + .path = "test flow", + .short_help = "test flow [add|del|enable|disable] [index ] " + "[src-ip ] [dst-ip ] " + "[ip6-src-ip ] [ip6-dst-ip ] " + "[src-port ] [dst-port ] " + "[proto ] " + "[gtpc teid ] [gtpu teid ] [vxlan ] " + "[session id ] [spi ]" + "[spec ] [mask ]" + "[next-node ] [mark ] [buffer-advance ] " + "[redirect-to-queue ] [drop] " + "[rss function ] [rss types ]" + "[rss queues to ]", + .function = test_flow, }; /* *INDENT-ON* */