summaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
authorJesse Gross <jesse@nicira.com>2015-05-06 17:57:03 -0700
committerJesse Gross <jesse@nicira.com>2015-06-25 11:08:57 -0700
commitf047e8468984c35177fb0932116f302b29221550 (patch)
tree2a12d5525b4f876c986fd8feab2beffb61714ffe /build-aux
parent3ee6026aba255e9d29b802aca6a80c09eaadf9fd (diff)
downloadopenvswitch-f047e8468984c35177fb0932116f302b29221550.tar.gz
metaflow: Allow fields to be marked as variable length.
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 <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'build-aux')
-rwxr-xr-xbuild-aux/extract-ofp-fields23
1 files changed, 15 insertions, 8 deletions
diff --git a/build-aux/extract-ofp-fields b/build-aux/extract-ofp-fields
index ca2ca044e..042f633f2 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'