Until now, all fields that OVS can match against have been fixed size (variable length headers can be skipped during parsing but the match is fixed). However, Geneve options can vary in size so we must not require the size of these fields to be known at compile time.
This allows data types to be annotated with not only their size but whether the field can be smaller than that. The following patches will change OpenFlow parsing based on that. Signed-off-by: Jesse Gross <je...@nicira.com> --- build-aux/extract-ofp-fields | 23 +++++++++++++++-------- lib/meta-flow.h | 1 + 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/build-aux/extract-ofp-fields b/build-aux/extract-ofp-fields index ca2ca04..042f633 100755 --- a/build-aux/extract-ofp-fields +++ b/build-aux/extract-ofp-fields @@ -14,12 +14,12 @@ VERSION = {"1.0": 0x01, "1.4": 0x05, "1.5": 0x06} -TYPES = {"u8": 1, - "be16": 2, - "be32": 4, - "MAC": 6, - "be64": 8, - "IPv6": 16} +TYPES = {"u8": (1, False), + "be16": (2, False), + "be32": (4, False), + "MAC": (6, False), + "be64": (8, False), + "IPv6": (16, False)} FORMATTING = {"decimal": ("MFS_DECIMAL", 1, 8), "hexadecimal": ("MFS_HEXADECIMAL", 1, 127), @@ -234,7 +234,8 @@ def parse_field(mff, comment): type_ = m.group(1) if type_ not in TYPES: fatal("%s: unknown type %s" % (mff, d['Type'])) - f['n_bytes'] = TYPES[type_] + + f['n_bytes'] = TYPES[type_][0] if m.group(2): f['n_bits'] = int(m.group(2)) if f['n_bits'] > f['n_bytes'] * 8: @@ -242,6 +243,7 @@ def parse_field(mff, comment): % (mff, f['n_bits'], 8 * f['n_bytes'])) else: f['n_bits'] = 8 * f['n_bytes'] + f['variable'] = TYPES[type_][1] if d['Maskable'] == 'no': f['mask'] = 'MFM_NONE' @@ -307,7 +309,12 @@ def make_meta_flow(fields): output += [" \"%s\", \"%s\"," % (f['name'], f['extra_name'])] else: output += [" \"%s\", NULL," % f['name']] - output += [" %d, %d," % (f['n_bytes'], f['n_bits'])] + + if f['variable']: + variable = 'true' + else: + variable = 'false' + output += [" %d, %d, %s," % (f['n_bytes'], f['n_bits'], variable)] if f['writable']: rw = 'true' diff --git a/lib/meta-flow.h b/lib/meta-flow.h index 6079dcb..ce50b16 100644 --- a/lib/meta-flow.h +++ b/lib/meta-flow.h @@ -1512,6 +1512,7 @@ struct mf_field { */ unsigned int n_bytes; /* Width of the field in bytes. */ unsigned int n_bits; /* Number of significant bits in field. */ + bool variable_len; /* Length is variable, if so width is max. */ /* Properties. */ enum mf_maskable maskable; -- 2.1.0 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev