diff options
author | Jarno Rajahalme <jarno@ovn.org> | 2017-01-04 16:10:56 -0800 |
---|---|---|
committer | Jarno Rajahalme <jarno@ovn.org> | 2017-01-04 16:10:56 -0800 |
commit | 21b2fa61712684b03c5a5a0dc2090fb5bbf9d1ad (patch) | |
tree | 0fcb43076d89406916229ef03f7764094fc7f902 /lib/meta-flow.c | |
parent | e7dce33f09654f6a3f6b9920c5ce16c9c71ccb7f (diff) | |
download | openvswitch-21b2fa61712684b03c5a5a0dc2090fb5bbf9d1ad.tar.gz |
ofp-parse: Allow match field names in actions and brackets in matches.
Allow using match field names in addition to the canonical register
names in actions (including 'load', 'move', 'push', 'pop', 'output',
'multipath', 'bundle_load', and 'learn'). Allow also leaving out the
trailing '[]' to indicate full field. These changes allow simpler
syntax similar to 'set_field' to be used also elsewhere.
Correspondingly, allow the '[start..end]' syntax to be used in matches
in addition to the more explicit 'value/mask' notation. For example,
to match on the value 2 of the bits 14..15 of NXM_NX_REG0, the match
could include:
... reg0[14..15]=2 ...
instead of
... reg0=0x8000/0xc000 ...
Note that only contiguous masks can be specified with the bracket
notation.
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'lib/meta-flow.c')
-rw-r--r-- | lib/meta-flow.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/meta-flow.c b/lib/meta-flow.c index e25adec1c..6fc8ff98f 100644 --- a/lib/meta-flow.c +++ b/lib/meta-flow.c @@ -80,6 +80,17 @@ mf_from_name(const char *name) return shash_find_data(&mf_by_name, name); } +/* Returns the field with the given 'name' (which is 'len' bytes long), or a + * null pointer if no field has that name. */ +const struct mf_field * +mf_from_name_len(const char *name, size_t len) +{ + nxm_init(); + + struct shash_node *node = shash_find_len(&mf_by_name, name, len); + return node ? node->data : NULL; +} + static void nxm_do_init(void) { |