X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fflow%2Fflow_cli.c;h=f3e6c3912bd0aa84a9a3601e4b6678516779f62f;hb=3a3668201;hp=e2a3141c5515360ad51cd91973f3ddafb516fe36;hpb=218e4ec5302a88d4400cc3b0897310f4d59675be;p=vpp.git diff --git a/src/vnet/flow/flow_cli.c b/src/vnet/flow/flow_cli.c index e2a3141c551..f3e6c3912bd 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, ({ @@ -243,6 +248,11 @@ no_args: 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* */ @@ -371,6 +381,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 +401,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; @@ -573,6 +589,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 +681,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 +717,19 @@ 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 ]", + .function = test_flow, }; /* *INDENT-ON* */