[ovs-dev] [of1.5 v2 07/20] ofp-util: Implement OpenFlow 1.4 port status and port desc reply messages.

Ben Pfaff blp at nicira.com
Tue May 13 01:15:26 UTC 2014


On Sun, May 11, 2014 at 09:39:32PM +0300, Alexandru Copot wrote:
> On Sat, May 10, 2014 at 5:40 AM, Ben Pfaff <blp at nicira.com> wrote:
> > Signed-off-by: Ben Pfaff <blp at nicira.com>
> 
> >
> > diff --git a/lib/ofp-msgs.h b/lib/ofp-msgs.h
> > index df7569e..b548f6b 100644
> > --- a/lib/ofp-msgs.h
> > +++ b/lib/ofp-msgs.h
> > @@ -162,8 +162,10 @@ enum ofpraw {
> >
> >      /* OFPT 1.0 (12): struct ofp_port_status, struct ofp10_phy_port. */
> >      OFPRAW_OFPT10_PORT_STATUS,
> > -    /* OFPT 1.1+ (12): struct ofp_port_status, struct ofp11_port. */
> > +    /* OFPT 1.1-1.3 (12): struct ofp_port_status, struct ofp11_port. */
> >      OFPRAW_OFPT11_PORT_STATUS,
> > +    /* OFPT 1.4+ (12): struct ofp_port_status, struct ofp14_port, uint8_t[8][]. */
> > +    OFPRAW_OFPT14_PORT_STATUS,
> >
> >      /* OFPT 1.0 (13): struct ofp10_packet_out, uint8_t[]. */
> >      OFPRAW_OFPT10_PACKET_OUT,
> > @@ -360,8 +362,10 @@ enum ofpraw {
> >
> >      /* OFPST 1.0 (13): struct ofp10_phy_port[]. */
> >      OFPRAW_OFPST10_PORT_DESC_REPLY,
> > -    /* OFPST 1.1+ (13): struct ofp11_port[]. */
> > +    /* OFPST 1.1-1.3 (13): struct ofp11_port[]. */
> >      OFPRAW_OFPST11_PORT_DESC_REPLY,
> > +    /* OFPST 1.4+ (13): uint8_t[8][]. */
> > +    OFPRAW_OFPST14_PORT_DESC_REPLY,
> >
> >  /* Nicira extension messages.
> >   *
> > @@ -471,7 +475,8 @@ enum ofptype {
> >                                    * OFPRAW_OFPT11_FLOW_REMOVED.
> >                                    * OFPRAW_NXT_FLOW_REMOVED. */
> >      OFPTYPE_PORT_STATUS,         /* OFPRAW_OFPT10_PORT_STATUS.
> > -                                  * OFPRAW_OFPT11_PORT_STATUS. */
> > +                                  * OFPRAW_OFPT11_PORT_STATUS.
> > +                                  * OFPRAW_OFPT14_PORT_STATUS. */
> >
> 
> Now that there is OFPRAW_OFPT14_PORT_STATUS, encode_port_status()
> should use it for OF1.4 instead of OFPRAW_OFPT11_PORT_STATUS. Otherwise,
> now we get an abort.

Thanks.

I folded in the following incremental:

diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 33d1728..faddcd0 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -4232,10 +4232,13 @@ ofputil_encode_port_status(const struct ofputil_port_status *ps,
     case OFP11_VERSION:
     case OFP12_VERSION:
     case OFP13_VERSION:
-    case OFP14_VERSION:
         raw = OFPRAW_OFPT11_PORT_STATUS;
         break;
 
+    case OFP14_VERSION:
+        raw = OFPRAW_OFPT14_PORT_STATUS;
+        break;
+
     default:
         OVS_NOT_REACHED();
     }

The fact that this bug got through the unit tests means that none of the
existing tests exercises port status messages in OF1.4.  We do have at
least one test for port status messages for other protocol versions
(e.g. "ofproto - asynchronous message control (OpenFlow 1.3)") but it
depends on the implementation of async message control, which we haven't
yet updated for OF1.4.  So I guess that we should implement that first
before we add that test.

Thanks,

Ben.



More information about the dev mailing list