Vacancy events and eviction are not yet implemented--see OPENFLOW-1.1+.
Signed-off-by: Ben Pfaff <[email protected]>
---
include/openflow/openflow-1.4.h | 41 +++++++++++++++++++++++++++++++++++++++++
lib/ofp-msgs.h | 7 +++++--
lib/ofp-util.c | 17 +++++++++++++++--
tests/ofp-print.at | 9 +++++++++
4 files changed, 70 insertions(+), 4 deletions(-)
diff --git a/include/openflow/openflow-1.4.h b/include/openflow/openflow-1.4.h
index 08f98f9..d912161 100644
--- a/include/openflow/openflow-1.4.h
+++ b/include/openflow/openflow-1.4.h
@@ -114,6 +114,47 @@ struct ofp14_port_mod {
};
OFP_ASSERT(sizeof(struct ofp14_port_mod) == 24);
+/* ## --------------- ## */
+/* ## ofp14_table_mod ## */
+/* ## --------------- ## */
+
+enum ofp14_table_mod_prop_type {
+ OFPTMPT14_EVICTION = 0x2, /* Eviction property. */
+ OFPTMPT14_VACANCY = 0x3, /* Vacancy property. */
+ OFPTMPT14_EXPERIMENTER = 0xFFFF, /* Experimenter property. */
+};
+
+enum ofp14_table_mod_prop_eviction_flag {
+ OFPTMPEF14_OTHER = 1 << 0, /* Using other factors. */
+ OFPTMPEF14_IMPORTANCE = 1 << 1, /* Using flow entry importance. */
+ OFPTMPEF14_LIFETIME = 1 << 2, /* Using flow entry lifetime. */
+};
+
+struct ofp14_table_mod_prop_eviction {
+ ovs_be16 type; /* OFPTMPT14_EVICTION. */
+ ovs_be16 length; /* Length in bytes of this property. */
+ ovs_be32 flags; /* Bitmap of OFPTMPEF14_* flags */
+};
+OFP_ASSERT(sizeof(struct ofp14_table_mod_prop_eviction) == 8);
+
+struct ofp14_table_mod_prop_vacancy {
+ ovs_be16 type; /* OFPTMPT14_VACANCY. */
+ ovs_be16 length; /* Length in bytes of this property. */
+ uint8_t vacancy_down; /* Vacancy threshold when space decreases (%). */
+ uint8_t vacancy_up; /* Vacancy threshold when space increases (%). */
+ uint8_t vacancy; /* Current vacancy (%) - only in ofp14_table_desc. */
+ uint8_t pad[1]; /* Align to 64 bits. */
+};
+OFP_ASSERT(sizeof(struct ofp14_table_mod_prop_vacancy) == 8);
+
+struct ofp14_table_mod {
+ uint8_t table_id; /* ID of the table, OFPTT_ALL indicates all tables */
+ uint8_t pad[3]; /* Pad to 32 bits */
+ ovs_be32 config; /* Bitmap of OFPTC_* flags */
+ /* Followed by 0 or more OFPTMPT14_* properties. */
+};
+OFP_ASSERT(sizeof(struct ofp14_table_mod) == 8);
+
/* ## -------------- ## */
/* ## Miscellaneous. ## */
diff --git a/lib/ofp-msgs.h b/lib/ofp-msgs.h
index 45271b7..def24ce 100644
--- a/lib/ofp-msgs.h
+++ b/lib/ofp-msgs.h
@@ -189,8 +189,10 @@ enum ofpraw {
/* OFPT 1.4+ (16): struct ofp14_port_mod, uint8_t[8][]. */
OFPRAW_OFPT14_PORT_MOD,
- /* OFPT 1.1+ (17): struct ofp11_table_mod. */
+ /* OFPT 1.1-1.3 (17): struct ofp11_table_mod. */
OFPRAW_OFPT11_TABLE_MOD,
+ /* OFPT 1.4+ (17): struct ofp14_table_mod, uint8_t[8][]. */
+ OFPRAW_OFPT14_TABLE_MOD,
/* OFPT 1.0 (18): void. */
OFPRAW_OFPT10_BARRIER_REQUEST,
@@ -490,7 +492,8 @@ enum ofptype {
OFPTYPE_PORT_MOD, /* OFPRAW_OFPT10_PORT_MOD.
* OFPRAW_OFPT11_PORT_MOD.
* OFPRAW_OFPT14_PORT_MOD. */
- OFPTYPE_TABLE_MOD, /* OFPRAW_OFPT11_TABLE_MOD. */
+ OFPTYPE_TABLE_MOD, /* OFPRAW_OFPT11_TABLE_MOD.
+ * OFPRAW_OFPT14_TABLE_MOD. */
/* Barrier messages. */
OFPTYPE_BARRIER_REQUEST, /* OFPRAW_OFPT10_BARRIER_REQUEST.
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 3a6eb5d..f77215a 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -4744,6 +4744,13 @@ ofputil_decode_table_mod(const struct ofp_header *oh,
pm->table_id = otm->table_id;
pm->config = ntohl(otm->config);
+ } else if (raw == OFPRAW_OFPT14_TABLE_MOD) {
+ const struct ofp14_table_mod *otm = ofpbuf_pull(&b, sizeof *otm);
+
+ pm->table_id = otm->table_id;
+ pm->config = ntohl(otm->config);
+ /* We do not understand any properties yet, so we do not bother
+ * parsing them. */
} else {
return OFPERR_OFPBRC_BAD_TYPE;
}
@@ -4778,9 +4785,15 @@ ofputil_encode_table_mod(const struct ofputil_table_mod
*pm,
otm->config = htonl(pm->config);
break;
}
- case OFP14_VERSION:
- OVS_NOT_REACHED();
+ case OFP14_VERSION: {
+ struct ofp14_table_mod *otm;
+
+ b = ofpraw_alloc(OFPRAW_OFPT14_TABLE_MOD, ofp_version, 0);
+ otm = ofpbuf_put_zeros(b, sizeof *otm);
+ otm->table_id = pm->table_id;
+ otm->config = htonl(pm->config);
break;
+ }
default:
OVS_NOT_REACHED();
}
diff --git a/tests/ofp-print.at b/tests/ofp-print.at
index 7d31d5b..5ef959e 100644
--- a/tests/ofp-print.at
+++ b/tests/ofp-print.at
@@ -1067,6 +1067,15 @@ OFPT_TABLE_MOD (OF1.3) (xid=0x2): table_id=2,
flow_miss_config=controller
])
AT_CLEANUP
+AT_SETUP([OFPT_TABLE_MOD - OF1.4])
+AT_KEYWORDS([ofp-print])
+AT_CHECK([ovs-ofctl ofp-print "\
+05 11 00 10 00 00 00 02 02 00 00 00 00 00 00 00 \
+" 3], [0], [dnl
+OFPT_TABLE_MOD (OF1.4) (xid=0x2): table_id=2, flow_miss_config=controller
+])
+AT_CLEANUP
+
AT_SETUP([OFPST_DESC request])
AT_KEYWORDS([ofp-print OFPT_STATS_REQUEST])
AT_CHECK([ovs-ofctl ofp-print "0110000c0000000100000000"], [0], [dnl
--
1.9.1
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev