This is the 4th patch of a series of 4 patches:

1/4: OpenFlow 1.2 bug fixes
2/4: Initial OpenFlow 1.3 support
3/4: OF13 TUNNEL_ID support (also on OF12 protocol)
4/4: NXPIF_OPENFLOW13 to allow OF13 packet_in to be used over OF12 (adds 
support for the matching flow cookie)

    Added NXPIF_OPENFLOW13, to allow OF 1.3 packet_in format to be used with OF 
1.2.
    Made packet in format validation to allow NXPIF_OPENFLOW10 and NXPIF_NXM 
only on
    OpenFlow 1.0 protocol, and NXPIF_OPENFLOW13 on OpenFlow 1.2 protocol.

Note that OF 1.3 packet_in packets will be sent using the OF version value of 
1.3, even if the connection is otherwise using
version of 1.2. Should probably add also NXPIF_OPENFLOW12 to allow the 
controller to switch back to the normal OF12 format?

 include/openflow/nicira-ext.h |    3 ++-
 lib/ofp-util.c                |    6 +++++-
 ofproto/ofproto.c             |    3 ++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/include/openflow/nicira-ext.h b/include/openflow/nicira-ext.h
index 88eba19..08b6ecf 100644
--- a/include/openflow/nicira-ext.h
+++ b/include/openflow/nicira-ext.h
@@ -158,7 +158,8 @@ OFP_ASSERT(sizeof(struct nx_flow_mod_table_id) == 8);
 
 enum nx_packet_in_format {
     NXPIF_OPENFLOW10 = 0,       /* Standard OpenFlow 1.0 compatible. */
-    NXPIF_NXM = 1               /* Nicira Extended. */
+    NXPIF_NXM = 1,              /* Nicira Extended. */
+    NXPIF_OPENFLOW13 = 2        /* Standard OpenFlow 1.3 compatible, useful on 
OpenFlow 1.2 protocol only */
 };
 
 /* NXT_SET_PACKET_IN_FORMAT request. */
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index c5452e9..9455041 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -953,6 +953,7 @@ ofputil_packet_in_format_is_valid(enum nx_packet_in_format 
packet_in_format)
     switch (packet_in_format) {
     case NXPIF_OPENFLOW10:
     case NXPIF_NXM:
+    case NXPIF_OPENFLOW13:
         return true;
     }
 
@@ -967,6 +968,8 @@ ofputil_packet_in_format_to_string(enum nx_packet_in_format 
packet_in_format)
         return "openflow10";
     case NXPIF_NXM:
         return "nxm";
+    case NXPIF_OPENFLOW13:
+        return "openflow13";
     default:
         NOT_REACHED();
     }
@@ -977,6 +980,7 @@ ofputil_packet_in_format_from_string(const char *s)
 {
     return (!strcmp(s, "openflow10") ? NXPIF_OPENFLOW10
             : !strcmp(s, "nxm") ? NXPIF_NXM
+            : !strcmp(s, "openflow13") ? NXPIF_OPENFLOW13
             : -1);
 }
 
@@ -2481,7 +2485,7 @@ ofputil_encode_packet_in(const struct ofputil_packet_in 
*pin,
     struct ofpbuf *packet;
 
     /* Add OFPT_PACKET_IN. */
-    if (protocol == OFPUTIL_P_OF13_OXM) {
+    if (protocol == OFPUTIL_P_OF13_OXM || (protocol == OFPUTIL_P_OF12_OXM && 
packet_in_format == NXPIF_OPENFLOW13)) {
         struct ofp13_packet_in *opi;
         struct match match;
 
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 6ab8d08..2f94660 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -3680,7 +3680,8 @@ handle_nxt_set_packet_in_format(struct ofconn *ofconn,
     uint32_t format;
 
     format = ntohl(msg->format);
-    if (format != NXPIF_OPENFLOW10 && format != NXPIF_NXM) {
+    if (!(oh->version == OFP10_VERSION && (format == NXPIF_OPENFLOW10 || 
format == NXPIF_NXM)
+          || oh->version == OFP12_VERSION && (format == NXPIF_OPENFLOW13))) {
         return OFPERR_OFPBRC_EPERM;
     }
 

_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to