summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2018-05-18 10:16:40 -0700
committerBen Pfaff <blp@ovn.org>2018-05-25 13:31:18 -0700
commitffc317b99150b907d20616c37a11f749fb64e6cd (patch)
tree12b366f2a3668e7d414eddb0b836d6ff8a3a78b1
parentd4ee9a73f0050227826aa4418a1191169cc6d6be (diff)
downloadopenvswitch-ffc317b99150b907d20616c37a11f749fb64e6cd.tar.gz
ovs-fields: Correct ideas about which OXM classes are official.
The purpose of including an OpenFlow version in the notes in meta-flow.h and ovs-fields.7 is to explain what version of OpenFlow standardized a given field. NXOXM_* are not standardized so they should not have an OpenFlow version. This commit corrects it. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
-rwxr-xr-xbuild-aux/extract-ofp-fields36
-rw-r--r--include/openvswitch/meta-flow.h30
2 files changed, 36 insertions, 30 deletions
diff --git a/build-aux/extract-ofp-fields b/build-aux/extract-ofp-fields
index 184b75e36..359259432 100755
--- a/build-aux/extract-ofp-fields
+++ b/build-aux/extract-ofp-fields
@@ -65,20 +65,19 @@ PREREQS = {"none": "MFP_NONE",
# - Experimenter OXM classes are written as (<oxm_vender>, 0xffff)
#
# If a name matches more than one prefix, the longest one is used.
-OXM_CLASSES = {"NXM_OF_": (0, 0x0000),
- "NXM_NX_": (0, 0x0001),
- "NXOXM_NSH_": (0x005ad650, 0xffff),
- "OXM_OF_": (0, 0x8000),
- "OXM_OF_PKT_REG": (0, 0x8001),
- "ONFOXM_ET_": (0x4f4e4600, 0xffff),
+OXM_CLASSES = {"NXM_OF_": (0, 0x0000, 'extension'),
+ "NXM_NX_": (0, 0x0001, 'extension'),
+ "NXOXM_NSH_": (0x005ad650, 0xffff, 'extension'),
+ "OXM_OF_": (0, 0x8000, 'standard'),
+ "OXM_OF_PKT_REG": (0, 0x8001, 'standard'),
+ "ONFOXM_ET_": (0x4f4e4600, 0xffff, 'standard'),
# This is the experimenter OXM class for Nicira, which is the
# one that OVS would be using instead of NXM_OF_ and NXM_NX_
# if OVS didn't have those grandfathered in. It is currently
# used only to test support for experimenter OXM, since there
# are barely any real uses of experimenter OXM in the wild.
- "NXOXM_ET_": (0x00002320, 0xffff)}
-
+ "NXOXM_ET_": (0x00002320, 0xffff, 'extension')}
def oxm_name_to_class(name):
prefix = ''
@@ -90,6 +89,11 @@ def oxm_name_to_class(name):
return class_
+def is_standard_oxm(name):
+ oxm_vendor, oxm_class, oxm_class_type = oxm_name_to_class(name)
+ return oxm_class_type == 'standard'
+
+
def decode_version_range(range):
if range in VERSION:
return (VERSION[range], VERSION[range])
@@ -167,7 +171,7 @@ def parse_oxm(s, prefix, n_bytes):
class_ = oxm_name_to_class(name)
if class_ is None:
fatal("unknown OXM class for %s" % name)
- oxm_vendor, oxm_class = class_
+ oxm_vendor, oxm_class, oxm_class_type = class_
if class_ in match_types:
if oxm_type in match_types[class_]:
@@ -186,14 +190,16 @@ def parse_oxm(s, prefix, n_bytes):
header = (oxm_vendor, oxm_class, int(oxm_type), oxm_length)
if of_version:
+ if oxm_class_type == 'extension':
+ fatal("%s: OXM extension can't have OpenFlow version" % name)
if of_version not in VERSION:
fatal("%s: unknown OpenFlow version %s" % (name, of_version))
of_version_nr = VERSION[of_version]
if of_version_nr < VERSION['1.2']:
fatal("%s: claimed version %s predates OXM" % (name, of_version))
- elif prefix == 'OXM':
- fatal("%s: missing OpenFlow version number" % name)
else:
+ if oxm_class_type == 'standard':
+ fatal("%s: missing OpenFlow version number" % name)
of_version_nr = 0
return (header, name, of_version_nr, ovs_version)
@@ -539,7 +545,7 @@ def field_to_xml(field_node, f, body, summary):
min_of_version = None
min_ovs_version = None
for header, name, of_version_nr, ovs_version_s in f['OXM']:
- if (not name.startswith('NXM')
+ if (is_standard_oxm(name)
and (min_ovs_version is None or of_version_nr < min_of_version)):
min_of_version = of_version_nr
ovs_version = [int(x) for x in ovs_version_s.split('.')]
@@ -612,7 +618,7 @@ l lx.
body += ["OpenFlow 1.1:;%s\n" % of11[f["OF1.1"]]]
oxms = []
- for header, name, of_version_nr, ovs_version in [x for x in sorted(f['OXM'], key=lambda x: x[2]) if not x[1].startswith('NXM')]:
+ for header, name, of_version_nr, ovs_version in [x for x in sorted(f['OXM'], key=lambda x: x[2]) if is_standard_oxm(x[1])]:
of_version = VERSION_REVERSE[of_version_nr]
oxms += [r"\fB%s\fR (%d) since OpenFlow %s and Open vSwitch %s" % (name, header[2], of_version, ovs_version)]
if not oxms:
@@ -620,7 +626,7 @@ l lx.
body += ['OXM:;T{\n%s\nT}\n' % r'\[char59] '.join(oxms)]
nxms = []
- for header, name, of_version_nr, ovs_version in [x for x in sorted(f['OXM'], key=lambda x: x[2]) if x[1].startswith('NXM')]:
+ for header, name, of_version_nr, ovs_version in [x for x in sorted(f['OXM'], key=lambda x: x[2]) if not is_standard_oxm(x[1])]:
nxms += [r"\fB%s\fR (%d) since Open vSwitch %s" % (name, header[2], ovs_version)]
if not nxms:
nxms = ['none']
@@ -664,7 +670,7 @@ Prefix;Vendor;Class
\_;\_;\_
'''
for key in sorted(OXM_CLASSES, key=OXM_CLASSES.get):
- vendor, class_ = OXM_CLASSES.get(key)
+ vendor, class_, class_type = OXM_CLASSES.get(key)
s += r"\fB%s\fR;" % key.rstrip('_')
if vendor:
s += r"\fL0x%08x\fR;" % vendor
diff --git a/include/openvswitch/meta-flow.h b/include/openvswitch/meta-flow.h
index 64470b524..627c8a391 100644
--- a/include/openvswitch/meta-flow.h
+++ b/include/openvswitch/meta-flow.h
@@ -239,7 +239,7 @@ enum OVS_PACKED_ENUM mf_field_id {
* Prerequisites: none.
* Access: read-only.
* NXM: NXM_NX_DP_HASH(35) since v2.2.
- * OXM: NXOXM_ET_DP_HASH(0) since OF1.5 and v2.4.
+ * OXM: NXOXM_ET_DP_HASH(0) since v2.4.
*/
MFF_DP_HASH,
@@ -460,7 +460,7 @@ enum OVS_PACKED_ENUM mf_field_id {
* Prerequisites: none.
* Access: read/write.
* NXM: none.
- * OXM: NXOXM_ET_ERSPAN_IDX(11) since OF1.5 and v2.10.
+ * OXM: NXOXM_ET_ERSPAN_IDX(11) since v2.10.
*/
MFF_TUN_ERSPAN_IDX,
@@ -474,7 +474,7 @@ enum OVS_PACKED_ENUM mf_field_id {
* Prerequisites: none.
* Access: read/write.
* NXM: none.
- * OXM: NXOXM_ET_ERSPAN_VER(12) since OF1.5 and v2.10.
+ * OXM: NXOXM_ET_ERSPAN_VER(12) since v2.10.
*/
MFF_TUN_ERSPAN_VER,
@@ -488,7 +488,7 @@ enum OVS_PACKED_ENUM mf_field_id {
* Prerequisites: none.
* Access: read/write.
* NXM: none.
- * OXM: NXOXM_ET_ERSPAN_DIR(13) since OF1.5 and v2.10.
+ * OXM: NXOXM_ET_ERSPAN_DIR(13) since v2.10.
*/
MFF_TUN_ERSPAN_DIR,
@@ -502,7 +502,7 @@ enum OVS_PACKED_ENUM mf_field_id {
* Prerequisites: none.
* Access: read/write.
* NXM: none.
- * OXM: NXOXM_ET_ERSPAN_HWID(14) since OF1.5 and v2.10.
+ * OXM: NXOXM_ET_ERSPAN_HWID(14) since v2.10.
*/
MFF_TUN_ERSPAN_HWID,
@@ -1810,7 +1810,7 @@ enum OVS_PACKED_ENUM mf_field_id {
* Prerequisites: NSH.
* Access: read/write.
* NXM: none.
- * OXM: NXOXM_NSH_FLAGS(1) since OF1.3 and v2.8.
+ * OXM: NXOXM_NSH_FLAGS(1) since v2.8.
*/
MFF_NSH_FLAGS,
@@ -1824,7 +1824,7 @@ enum OVS_PACKED_ENUM mf_field_id {
* Prerequisites: NSH.
* Access: read-only.
* NXM: none.
- * OXM: NXOXM_NSH_MDTYPE(2) since OF1.3 and v2.8.
+ * OXM: NXOXM_NSH_MDTYPE(2) since v2.8.
*/
MFF_NSH_MDTYPE,
@@ -1838,7 +1838,7 @@ enum OVS_PACKED_ENUM mf_field_id {
* Prerequisites: NSH.
* Access: read-only.
* NXM: none.
- * OXM: NXOXM_NSH_NP(3) since OF1.3 and v2.8.
+ * OXM: NXOXM_NSH_NP(3) since v2.8.
*/
MFF_NSH_NP,
@@ -1852,7 +1852,7 @@ enum OVS_PACKED_ENUM mf_field_id {
* Prerequisites: NSH.
* Access: read/write.
* NXM: none.
- * OXM: NXOXM_NSH_SPI(4) since OF1.3 and v2.8.
+ * OXM: NXOXM_NSH_SPI(4) since v2.8.
*/
MFF_NSH_SPI,
@@ -1866,7 +1866,7 @@ enum OVS_PACKED_ENUM mf_field_id {
* Prerequisites: NSH.
* Access: read/write.
* NXM: none.
- * OXM: NXOXM_NSH_SI(5) since OF1.3 and v2.8.
+ * OXM: NXOXM_NSH_SI(5) since v2.8.
*/
MFF_NSH_SI,
@@ -1880,10 +1880,10 @@ enum OVS_PACKED_ENUM mf_field_id {
* Prerequisites: NSH.
* Access: read/write.
* NXM: none.
- * OXM: NXOXM_NSH_C1(6) since OF1.3 and v2.8. <1>
- * OXM: NXOXM_NSH_C2(7) since OF1.3 and v2.8. <2>
- * OXM: NXOXM_NSH_C3(8) since OF1.3 and v2.8. <3>
- * OXM: NXOXM_NSH_C4(9) since OF1.3 and v2.8. <4>
+ * OXM: NXOXM_NSH_C1(6) since v2.8. <1>
+ * OXM: NXOXM_NSH_C2(7) since v2.8. <2>
+ * OXM: NXOXM_NSH_C3(8) since v2.8. <3>
+ * OXM: NXOXM_NSH_C4(9) since v2.8. <4>
*/
MFF_NSH_C1,
MFF_NSH_C2,
@@ -1900,7 +1900,7 @@ enum OVS_PACKED_ENUM mf_field_id {
* Prerequisites: NSH.
* Access: read/write.
* NXM: none.
- * OXM: NXOXM_NSH_TTL(10) since OF1.3 and v2.9.
+ * OXM: NXOXM_NSH_TTL(10) since v2.9.
*/
MFF_NSH_TTL,