2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-17 14:28:02 +00:00

ofp-util: Allow encoding of Open Flow 1.2 Flow Removed messages

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Simon Horman
2012-08-08 06:49:46 +09:00
committed by Ben Pfaff
parent eb5ee596d9
commit 8397473290
2 changed files with 23 additions and 1 deletions

View File

@@ -134,6 +134,8 @@ enum ofpraw {
/* OFPT 1.0 (11): struct ofp_flow_removed. */ /* OFPT 1.0 (11): struct ofp_flow_removed. */
OFPRAW_OFPT10_FLOW_REMOVED, OFPRAW_OFPT10_FLOW_REMOVED,
/* OFPT 1.1+ (11): struct ofp11_flow_removed, uint8_t[8][]. */
OFPRAW_OFPT11_FLOW_REMOVED,
/* NXT 1.0+ (14): struct nx_flow_removed, uint8_t[8][]. */ /* NXT 1.0+ (14): struct nx_flow_removed, uint8_t[8][]. */
OFPRAW_NXT_FLOW_REMOVED, OFPRAW_NXT_FLOW_REMOVED,
@@ -332,6 +334,7 @@ enum ofptype {
* OFPRAW_OFPT12_PACKET_IN. * OFPRAW_OFPT12_PACKET_IN.
* OFPRAW_NXT_PACKET_IN. */ * OFPRAW_NXT_PACKET_IN. */
OFPTYPE_FLOW_REMOVED, /* OFPRAW_OFPT10_FLOW_REMOVED. OFPTYPE_FLOW_REMOVED, /* OFPRAW_OFPT10_FLOW_REMOVED.
* OFPRAW_OFPT11_FLOW_REMOVED.
* OFPRAW_NXT_FLOW_REMOVED. */ * OFPRAW_NXT_FLOW_REMOVED. */
OFPTYPE_PORT_STATUS, /* OFPRAW_OFPT10_PORT_STATUS. OFPTYPE_PORT_STATUS, /* OFPRAW_OFPT10_PORT_STATUS.
* OFPRAW_OFPT11_PORT_STATUS. */ * OFPRAW_OFPT11_PORT_STATUS. */

View File

@@ -1861,6 +1861,26 @@ ofputil_encode_flow_removed(const struct ofputil_flow_removed *fr,
struct ofpbuf *msg; struct ofpbuf *msg;
switch (protocol) { switch (protocol) {
case OFPUTIL_P_OF12: {
struct ofp12_flow_removed *ofr;
msg = ofpraw_alloc_xid(OFPRAW_OFPT11_FLOW_REMOVED,
ofputil_protocol_to_ofp_version(protocol),
htonl(0), NXM_TYPICAL_LEN);
ofr = ofpbuf_put_zeros(msg, sizeof *ofr);
ofr->cookie = fr->cookie;
ofr->priority = htons(fr->rule.priority);
ofr->reason = fr->reason;
ofr->table_id = 0;
ofr->duration_sec = htonl(fr->duration_sec);
ofr->duration_nsec = htonl(fr->duration_nsec);
ofr->idle_timeout = htons(fr->idle_timeout);
ofr->packet_count = htonll(fr->packet_count);
ofr->byte_count = htonll(fr->byte_count);
oxm_put_match(msg, &fr->rule);
break;
}
case OFPUTIL_P_OF10: case OFPUTIL_P_OF10:
case OFPUTIL_P_OF10_TID: { case OFPUTIL_P_OF10_TID: {
struct ofp_flow_removed *ofr; struct ofp_flow_removed *ofr;
@@ -1903,7 +1923,6 @@ ofputil_encode_flow_removed(const struct ofputil_flow_removed *fr,
break; break;
} }
case OFPUTIL_P_OF12:
default: default:
NOT_REACHED(); NOT_REACHED();
} }