aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2013-03-06 09:13:37 -0800
committerBen Pfaff <blp@nicira.com>2013-03-08 10:47:53 -0800
commitd55759b9fb2389901d202f1bf3b1299384caa4e7 (patch)
treee724a7e6840425c98502fb1bcc832ff3c983d45b
parentc3480393c283d2df630edcf56e7beaf1cf481312 (diff)
Add table_id to NXM flow_removed messages.
Feature #15466. Requested-by: Ronghua Zhang <rzhang@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
-rw-r--r--NEWS2
-rw-r--r--include/openflow/nicira-ext.h10
-rw-r--r--lib/ofp-util.c3
-rw-r--r--tests/ofp-print.at4
4 files changed, 14 insertions, 5 deletions
diff --git a/NEWS b/NEWS
index c2ebfcd9..4c86a8f7 100644
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,8 @@ v1.10.0 - xx xxx xxxx
value of other-config:dp-desc in the Bridge table.
- It is possible to request the OpenFlow port number with the
"ofport_request" column in the Interface table.
+ - The NXM flow_removed message now reports the OpenFlow table ID
+ from which the flow was removed.
- Tunneling:
- New support for the VXLAN tunnel protocol (see the IETF draft here:
http://tools.ietf.org/html/draft-mahalingam-dutt-dcops-vxlan-03).
diff --git a/include/openflow/nicira-ext.h b/include/openflow/nicira-ext.h
index 91c96b36..a10285fd 100644
--- a/include/openflow/nicira-ext.h
+++ b/include/openflow/nicira-ext.h
@@ -1810,12 +1810,18 @@ struct nx_flow_mod {
};
OFP_ASSERT(sizeof(struct nx_flow_mod) == 32);
-/* NXT_FLOW_REMOVED (analogous to OFPT_FLOW_REMOVED). */
+/* NXT_FLOW_REMOVED (analogous to OFPT_FLOW_REMOVED).
+ *
+ * 'table_id' is present only in Open vSwitch 1.11 and later. In earlier
+ * versions of Open vSwitch, this is a padding byte that is always zeroed.
+ * Therefore, a 'table_id' value of 0 indicates that the table ID is not known,
+ * and other values may be interpreted as one more than the flow's former table
+ * ID. */
struct nx_flow_removed {
ovs_be64 cookie; /* Opaque controller-issued identifier. */
ovs_be16 priority; /* Priority level of flow entry. */
uint8_t reason; /* One of OFPRR_*. */
- uint8_t pad[1]; /* Align to 32-bits. */
+ uint8_t table_id; /* Flow's former table ID, plus one. */
ovs_be32 duration_sec; /* Time flow was alive in seconds. */
ovs_be32 duration_nsec; /* Time flow was alive in nanoseconds beyond
duration_sec. */
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 40983504..2cbecbb3 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -2327,7 +2327,7 @@ ofputil_decode_flow_removed(struct ofputil_flow_removed *fr,
fr->priority = ntohs(nfr->priority);
fr->cookie = nfr->cookie;
fr->reason = nfr->reason;
- fr->table_id = 255;
+ fr->table_id = nfr->table_id ? nfr->table_id - 1 : 255;
fr->duration_sec = ntohl(nfr->duration_sec);
fr->duration_nsec = ntohl(nfr->duration_nsec);
fr->idle_timeout = ntohs(nfr->idle_timeout);
@@ -2406,6 +2406,7 @@ ofputil_encode_flow_removed(const struct ofputil_flow_removed *fr,
nfr->cookie = fr->cookie;
nfr->priority = htons(fr->priority);
nfr->reason = fr->reason;
+ nfr->table_id = fr->table_id + 1;
nfr->duration_sec = htonl(fr->duration_sec);
nfr->duration_nsec = htonl(fr->duration_nsec);
nfr->idle_timeout = htons(fr->idle_timeout);
diff --git a/tests/ofp-print.at b/tests/ofp-print.at
index 40212918..292ab71a 100644
--- a/tests/ofp-print.at
+++ b/tests/ofp-print.at
@@ -1699,7 +1699,7 @@ AT_SETUP([NXT_FLOW_REMOVED])
AT_KEYWORDS([ofp-print])
AT_CHECK([ovs-ofctl ofp-print "\
01 04 00 78 00 00 00 00 00 00 23 20 00 00 00 0e \
-00 00 00 00 00 00 00 00 ff ff 00 00 00 00 00 06 \
+00 00 00 00 00 00 00 00 ff ff 00 02 00 00 00 06 \
01 6e 36 00 00 05 00 3c 00 00 00 00 00 00 00 01 \
00 00 00 00 00 00 00 3c 00 00 00 02 00 03 00 00 \
02 06 50 54 00 00 00 06 00 00 04 06 50 54 00 00 \
@@ -1707,7 +1707,7 @@ AT_CHECK([ovs-ofctl ofp-print "\
1e 02 00 02 00 00 20 04 c0 a8 00 01 00 00 22 04 \
c0 a8 00 02 00 00 00 00 \
"], [0], [dnl
-NXT_FLOW_REMOVED (xid=0x0): priority=65535,arp,in_port=3,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06,arp_spa=192.168.0.1,arp_tpa=192.168.0.2,arp_op=2 reason=idle duration6.024s idle5 pkts1 bytes60
+NXT_FLOW_REMOVED (xid=0x0): priority=65535,arp,in_port=3,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06,arp_spa=192.168.0.1,arp_tpa=192.168.0.2,arp_op=2 reason=idle table_id=1 duration6.024s idle5 pkts1 bytes60
])
AT_CLEANUP