diff options
author | Eyal Bari <ebari@cisco.com> | 2018-05-31 11:30:16 +0300 |
---|---|---|
committer | John Lo <loj@cisco.com> | 2018-06-04 14:27:52 +0000 |
commit | d3de756a8bcda21ed37b87df7b1c77edaee3459b (patch) | |
tree | 8427dc20a73afdb97bee4d2ed446df36f55ef4ff /src/vnet/flow | |
parent | 3a0325f9cab7838c21b19698b89cfc65e3236085 (diff) |
flow:add enabled hw format function
Change-Id: Ide1f76e9207b6022d5258a119f8d59cca85651b5
Signed-off-by: Eyal Bari <ebari@cisco.com>
Diffstat (limited to 'src/vnet/flow')
-rw-r--r-- | src/vnet/flow/flow.h | 1 | ||||
-rw-r--r-- | src/vnet/flow/flow_cli.c | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/vnet/flow/flow.h b/src/vnet/flow/flow.h index bc9b2f19cc3..19b6761474d 100644 --- a/src/vnet/flow/flow.h +++ b/src/vnet/flow/flow.h @@ -181,6 +181,7 @@ typedef struct extern vnet_flow_main_t flow_main; format_function_t format_flow_actions; +format_function_t format_flow_enabled_hw; #endif /* included_vnet_flow_flow_h */ diff --git a/src/vnet/flow/flow_cli.c b/src/vnet/flow/flow_cli.c index 11f3bcfad97..27f2d386279 100644 --- a/src/vnet/flow/flow_cli.c +++ b/src/vnet/flow/flow_cli.c @@ -90,6 +90,30 @@ format_flow_actions (u8 * s, va_list * args) return s; } +u8 * +format_flow_enabled_hw (u8 * s, va_list * args) +{ + u32 flow_index = va_arg (*args, u32); + vnet_flow_t *f = vnet_get_flow (flow_index); + if (f == 0) + return format (s, "not found"); + + u8 *t = 0; + u32 hw_if_index; + uword private_data; + vnet_main_t *vnm = vnet_get_main (); + /* *INDENT-OFF* */ + hash_foreach (hw_if_index, private_data, f->private_data, + ({ + t = format (t, "%s%U", t ? ", " : "", + format_vnet_hw_if_index_name, vnm, hw_if_index); + })); + /* *INDENT-ON* */ + s = format (s, "%v", t); + vec_free (t); + return s; +} + static const char *flow_type_strings[] = { 0, #define _(a,b,c) c, foreach_flow_type |