[ovs-dev] [PATCH v2 42/47] ofp-util: Support encoding of EXT-187 requests
Simon Horman
horms at verge.net.au
Tue Jun 10 10:27:46 UTC 2014
Support encoding of EXT-187: flow entry notification extension
(ONF flow monitor) requests.
Signed-off-by: Simon Horman <horms at verge.net.au>
---
v2
* First post
---
lib/ofp-util.c | 29 ++++++++++++++++++++++++++++-
ofproto/ofproto.c | 21 +++++++++++++--------
2 files changed, 41 insertions(+), 9 deletions(-)
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 91e4b39..c02af59 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -5443,6 +5443,32 @@ ofputil_append_nx_flow_monitor_request(
}
static void
+ofputil_append_onf13_flow_monitor_request(
+ const struct ofputil_flow_monitor_request *rq, struct ofpbuf *msg)
+{
+ struct onf13_flow_monitor_request *onffmr;
+ size_t start_ofs;
+ int match_len;
+
+ if (!ofpbuf_size(msg)) {
+ ofpraw_put(OFPRAW_ONFST13_FLOW_MONITOR_REQUEST, OFP13_VERSION, msg);
+ }
+
+ start_ofs = ofpbuf_size(msg);
+ ofpbuf_put_zeros(msg, sizeof *onffmr);
+ /* nx_put_match() is use to put an OXM match without an
+ * ofp_match_header */
+ match_len = nx_put_match(msg, &rq->match, htonll(0), htonll(0));
+
+ onffmr = ofpbuf_at_assert(msg, start_ofs, sizeof *onffmr);
+ onffmr->id = htonl(rq->id);
+ onffmr->flags = htons(nx_from_ofp14_flow_monitor_flags(rq->flags));
+ onffmr->out_port = ofputil_port_to_ofp11(rq->out_port);
+ onffmr->match_len = htons(match_len);
+ onffmr->table_id = rq->table_id;
+}
+
+static void
ofputil_append_of14_flow_monitor_request(
const struct ofputil_flow_monitor_request *rq, enum ofp_version version,
struct ofpbuf *msg)
@@ -5475,12 +5501,13 @@ ofputil_append_flow_monitor_request(
switch (version) {
case OFP10_VERSION:
return ofputil_append_nx_flow_monitor_request(rq, msg);
+ case OFP13_VERSION:
+ return ofputil_append_onf13_flow_monitor_request(rq, msg);
case OFP14_VERSION:
case OFP15_VERSION:
return ofputil_append_of14_flow_monitor_request(rq, version, msg);
case OFP11_VERSION:
case OFP12_VERSION:
- case OFP13_VERSION: /* XXX: Use OF extension! */
default:
OVS_NOT_REACHED();
}
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 6d34576..ea99b04 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -4831,16 +4831,18 @@ static void
ofproto_compose_paused_or_resumed(enum ofp_version ofp_version,
struct list *msgs, bool paused)
{
+ struct ofpbuf *msg;
+ enum ofpraw raw;
+
switch (ofp_version) {
- case OFP10_VERSION: {
- struct ofpbuf *msg;
- enum ofpraw raw;
+ case OFP10_VERSION:
raw = paused ? OFPRAW_NXT_FLOW_MONITOR_PAUSED
: OFPRAW_NXT_FLOW_MONITOR_RESUMED;
- msg = ofpraw_alloc_xid(raw, ofp_version, htonl(0), 0);
- list_push_back(msgs, &msg->list_node);
break;
- }
+ case OFP13_VERSION:
+ raw = paused ? OFPRAW_ONF13_FLOW_MONITOR_PAUSED
+ : OFPRAW_ONF13_FLOW_MONITOR_RESUMED;
+ break;
case OFP14_VERSION:
case OFP15_VERSION: {
struct ofputil_flow_update fu;
@@ -4849,14 +4851,17 @@ ofproto_compose_paused_or_resumed(enum ofp_version ofp_version,
ofputil_start_flow_update(ofp_version, msgs);
}
ofputil_append_flow_update(&fu, msgs);
- break;
+ return;
}
case OFP11_VERSION:
case OFP12_VERSION:
- case OFP13_VERSION: /* XXX: Use ONF extension */
default:
OVS_NOT_REACHED();
}
+
+ /* Create and send message for NX/ONF13 */
+ msg = ofpraw_alloc_xid(raw, ofp_version, htonl(0), 0);
+ list_push_back(msgs, &msg->list_node);
}
void
--
2.0.0.rc2
More information about the dev
mailing list