[ovs-dev] [of1.1 v4 3/5] openflow: Rename OpenFlow 1.0 statistics messages with "10" infix.

Ben Pfaff blp at nicira.com
Wed Jul 4 06:10:19 UTC 2012


Reviewed-by: Simon Horman <horms at verge.net.au>
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 include/openflow/openflow-1.0.h    |   57 +++++++++++-------------------------
 include/openflow/openflow-common.h |   23 ++++++++++++++
 lib/ofp-msgs.c                     |   10 +++---
 lib/ofp-msgs.h                     |   14 ++++----
 lib/ofp-print.c                    |   10 +++---
 lib/ofp-util.c                     |    8 ++--
 ofproto/ofproto-dpif.c             |    2 +-
 ofproto/ofproto-provider.h         |    4 +-
 ofproto/ofproto.c                  |   10 +++---
 utilities/ovs-ofctl.c              |    4 +-
 10 files changed, 71 insertions(+), 71 deletions(-)

diff --git a/include/openflow/openflow-1.0.h b/include/openflow/openflow-1.0.h
index b008d88..dd9c019 100644
--- a/include/openflow/openflow-1.0.h
+++ b/include/openflow/openflow-1.0.h
@@ -427,34 +427,20 @@ struct ofp_error_msg {
 OFP_ASSERT(sizeof(struct ofp_error_msg) == 4);
 
 /* Statistics request or reply message. */
-struct ofp_stats_msg {
+struct ofp10_stats_msg {
     struct ofp_header header;
     ovs_be16 type;              /* One of the OFPST_* constants. */
     ovs_be16 flags;             /* Requests: always 0.
                                  * Replies: 0 or OFPSF_REPLY_MORE. */
 };
-OFP_ASSERT(sizeof(struct ofp_stats_msg) == 12);
+OFP_ASSERT(sizeof(struct ofp10_stats_msg) == 12);
 
 enum ofp_stats_reply_flags {
     OFPSF_REPLY_MORE  = 1 << 0  /* More replies to follow. */
 };
 
-#define DESC_STR_LEN   256
-#define SERIAL_NUM_LEN 32
-/* Body of reply to OFPST_DESC request.  Each entry is a NULL-terminated ASCII
- * string. */
-struct ofp_desc_stats {
-    char mfr_desc[DESC_STR_LEN];       /* Manufacturer description. */
-    char hw_desc[DESC_STR_LEN];        /* Hardware description. */
-    char sw_desc[DESC_STR_LEN];        /* Software description. */
-    char serial_num[SERIAL_NUM_LEN];   /* Serial number. */
-    char dp_desc[DESC_STR_LEN];        /* Human readable description of
-                                          the datapath. */
-};
-OFP_ASSERT(sizeof(struct ofp_desc_stats) == 1056);
-
 /* Stats request of type OFPST_AGGREGATE or OFPST_FLOW. */
-struct ofp_flow_stats_request {
+struct ofp10_flow_stats_request {
     struct ofp10_match match; /* Fields to match. */
     uint8_t table_id;         /* ID of table to read (from ofp_table_stats)
                                  or 0xff for all tables. */
@@ -463,10 +449,10 @@ struct ofp_flow_stats_request {
                                  as an output port.  A value of OFPP_NONE
                                  indicates no restriction. */
 };
-OFP_ASSERT(sizeof(struct ofp_flow_stats_request) == 44);
+OFP_ASSERT(sizeof(struct ofp10_flow_stats_request) == 44);
 
 /* Body of reply to OFPST_FLOW request. */
-struct ofp_flow_stats {
+struct ofp10_flow_stats {
     ovs_be16 length;          /* Length of this entry. */
     uint8_t table_id;         /* ID of table flow came from. */
     uint8_t pad;
@@ -484,19 +470,10 @@ struct ofp_flow_stats {
     ovs_32aligned_be64 byte_count;   /* Number of bytes in flow. */
     struct ofp_action_header actions[0]; /* Actions. */
 };
-OFP_ASSERT(sizeof(struct ofp_flow_stats) == 88);
-
-/* Reply to OFPST_AGGREGATE request. */
-struct ofp_aggregate_stats_reply {
-    ovs_32aligned_be64 packet_count; /* Number of packets in flows. */
-    ovs_32aligned_be64 byte_count;   /* Number of bytes in flows. */
-    ovs_be32 flow_count;      /* Number of flows. */
-    uint8_t pad[4];           /* Align to 64 bits. */
-};
-OFP_ASSERT(sizeof(struct ofp_aggregate_stats_reply) == 24);
+OFP_ASSERT(sizeof(struct ofp10_flow_stats) == 88);
 
 /* Body of reply to OFPST_TABLE request. */
-struct ofp_table_stats {
+struct ofp10_table_stats {
     uint8_t table_id;        /* Identifier of table.  Lower numbered tables
                                 are consulted first. */
     uint8_t pad[3];          /* Align to 32-bits. */
@@ -508,20 +485,20 @@ struct ofp_table_stats {
     ovs_32aligned_be64 lookup_count;  /* # of packets looked up in table. */
     ovs_32aligned_be64 matched_count; /* Number of packets that hit table. */
 };
-OFP_ASSERT(sizeof(struct ofp_table_stats) == 64);
+OFP_ASSERT(sizeof(struct ofp10_table_stats) == 64);
 
 /* Stats request of type OFPST_PORT. */
-struct ofp_port_stats_request {
+struct ofp10_port_stats_request {
     ovs_be16 port_no;        /* OFPST_PORT message may request statistics
                                 for a single port (specified with port_no)
                                 or for all ports (port_no == OFPP_NONE). */
     uint8_t pad[6];
 };
-OFP_ASSERT(sizeof(struct ofp_port_stats_request) == 8);
+OFP_ASSERT(sizeof(struct ofp10_port_stats_request) == 8);
 
 /* Body of reply to OFPST_PORT request. If a counter is unsupported, set
  * the field to all ones. */
-struct ofp_port_stats {
+struct ofp10_port_stats {
     ovs_be16 port_no;
     uint8_t pad[6];          /* Align to 64-bits. */
     ovs_32aligned_be64 rx_packets;     /* Number of received packets. */
@@ -541,22 +518,22 @@ struct ofp_port_stats {
     ovs_32aligned_be64 rx_crc_err;   /* Number of CRC errors. */
     ovs_32aligned_be64 collisions;   /* Number of collisions. */
 };
-OFP_ASSERT(sizeof(struct ofp_port_stats) == 104);
+OFP_ASSERT(sizeof(struct ofp10_port_stats) == 104);
 
 /* All ones is used to indicate all queues in a port (for stats retrieval). */
 #define OFPQ_ALL      0xffffffff
 
 /* Body for stats request of type OFPST_QUEUE. */
-struct ofp_queue_stats_request {
+struct ofp10_queue_stats_request {
     ovs_be16 port_no;        /* All ports if OFPP_ALL. */
     uint8_t pad[2];          /* Align to 32-bits. */
     ovs_be32 queue_id;       /* All queues if OFPQ_ALL. */
 };
-OFP_ASSERT(sizeof(struct ofp_queue_stats_request) == 8);
+OFP_ASSERT(sizeof(struct ofp10_queue_stats_request) == 8);
 
 /* Body for stats reply of type OFPST_QUEUE consists of an array of this
  * structure type. */
-struct ofp_queue_stats {
+struct ofp10_queue_stats {
     ovs_be16 port_no;
     uint8_t pad[2];          /* Align to 32-bits. */
     ovs_be32 queue_id;       /* Queue id. */
@@ -564,11 +541,11 @@ struct ofp_queue_stats {
     ovs_32aligned_be64 tx_packets; /* Number of transmitted packets. */
     ovs_32aligned_be64 tx_errors;  /* # of packets dropped due to overrun. */
 };
-OFP_ASSERT(sizeof(struct ofp_queue_stats) == 32);
+OFP_ASSERT(sizeof(struct ofp10_queue_stats) == 32);
 
 /* Vendor extension stats message. */
 struct ofp10_vendor_stats_msg {
-    struct ofp_stats_msg osm;   /* Type OFPST_VENDOR. */
+    struct ofp10_stats_msg osm; /* Type OFPST_VENDOR. */
     ovs_be32 vendor;            /* Vendor ID:
                                  * - MSB 0: low-order bytes are IEEE OUI.
                                  * - MSB != 0: defined by OpenFlow
diff --git a/include/openflow/openflow-common.h b/include/openflow/openflow-common.h
index 9d228b7..9f8cf68 100644
--- a/include/openflow/openflow-common.h
+++ b/include/openflow/openflow-common.h
@@ -271,6 +271,29 @@ struct ofp_port_status {
 };
 OFP_ASSERT(sizeof(struct ofp_port_status) == 8);
 
+#define DESC_STR_LEN   256
+#define SERIAL_NUM_LEN 32
+/* Body of reply to OFPST_DESC request.  Each entry is a NULL-terminated ASCII
+ * string. */
+struct ofp_desc_stats {
+    char mfr_desc[DESC_STR_LEN];       /* Manufacturer description. */
+    char hw_desc[DESC_STR_LEN];        /* Hardware description. */
+    char sw_desc[DESC_STR_LEN];        /* Software description. */
+    char serial_num[SERIAL_NUM_LEN];   /* Serial number. */
+    char dp_desc[DESC_STR_LEN];        /* Human readable description of
+                                          the datapath. */
+};
+OFP_ASSERT(sizeof(struct ofp_desc_stats) == 1056);
+
+/* Reply to OFPST_AGGREGATE request. */
+struct ofp_aggregate_stats_reply {
+    ovs_32aligned_be64 packet_count; /* Number of packets in flows. */
+    ovs_32aligned_be64 byte_count;   /* Number of bytes in flows. */
+    ovs_be32 flow_count;      /* Number of flows. */
+    uint8_t pad[4];           /* Align to 64 bits. */
+};
+OFP_ASSERT(sizeof(struct ofp_aggregate_stats_reply) == 24);
+
 /* The match type indicates the match structure (set of fields that compose the
  * match) in use. The match type is placed in the type field at the beginning
  * of all match structures. The "OpenFlow Extensible Match" type corresponds
diff --git a/lib/ofp-msgs.c b/lib/ofp-msgs.c
index 24ebc0c..ca7f490 100644
--- a/lib/ofp-msgs.c
+++ b/lib/ofp-msgs.c
@@ -174,13 +174,13 @@ ofphdrs_decode(struct ofphdrs *hdrs,
     } else if (hdrs->version == OFP10_VERSION
                && (hdrs->type == OFPT10_STATS_REQUEST ||
                    hdrs->type == OFPT10_STATS_REPLY)) {
-        const struct ofp_stats_msg *osm;
+        const struct ofp10_stats_msg *osm;
 
         /* Get statistic type (OFPST_*). */
         if (length < sizeof *osm) {
             return OFPERR_OFPBRC_BAD_LEN;
         }
-        osm = (const struct ofp_stats_msg *) oh;
+        osm = (const struct ofp10_stats_msg *) oh;
         hdrs->stat = ntohs(osm->type);
 
         if (hdrs->stat == OFPST_VENDOR) {
@@ -278,7 +278,7 @@ ofphdrs_len(const struct ofphdrs *hdrs)
             hdrs->type == OFPT10_STATS_REPLY) {
             return (hdrs->stat == OFPST_VENDOR
                     ? sizeof(struct nicira10_stats_msg)
-                    : sizeof(struct ofp_stats_msg));
+                    : sizeof(struct ofp10_stats_msg));
         }
     } else if (hdrs->version == OFP11_VERSION) {
         if (hdrs->type == OFPT11_STATS_REQUEST ||
@@ -524,7 +524,7 @@ ofpraw_put__(enum ofpraw raw, uint8_t version, ovs_be32 xid, size_t tailroom,
     } else if (version == OFP10_VERSION
                && (hdrs->type == OFPT10_STATS_REQUEST ||
                    hdrs->type == OFPT10_STATS_REPLY)) {
-        struct ofp_stats_msg *osm = buf->l2;
+        struct ofp10_stats_msg *osm = buf->l2;
 
         osm->type = htons(hdrs->stat);
         osm->flags = htons(0);
@@ -712,7 +712,7 @@ static ovs_be16 *
 ofpmp_flags__(const struct ofp_header *oh)
 {
     return (oh->version == OFP10_VERSION
-            ? &((struct ofp_stats_msg *) oh)->flags
+            ? &((struct ofp10_stats_msg *) oh)->flags
             : &((struct ofp11_stats_msg *) oh)->flags);
 }
 
diff --git a/lib/ofp-msgs.h b/lib/ofp-msgs.h
index d02d336..b4dae50 100644
--- a/lib/ofp-msgs.h
+++ b/lib/ofp-msgs.h
@@ -175,7 +175,7 @@ enum ofpraw {
     /* OFPST 1.0+ (0): struct ofp_desc_stats. */
     OFPRAW_OFPST_DESC_REPLY,
 
-    /* OFPST 1.0 (1): struct ofp_flow_stats_request. */
+    /* OFPST 1.0 (1): struct ofp10_flow_stats_request. */
     OFPRAW_OFPST_FLOW_REQUEST,
     /* NXST 1.0 (0): struct nx_flow_stats_request, uint8_t[8][]. */
     OFPRAW_NXST_FLOW_REQUEST,
@@ -185,7 +185,7 @@ enum ofpraw {
     /* NXST 1.0 (0): uint8_t[]. */
     OFPRAW_NXST_FLOW_REPLY,
 
-    /* OFPST 1.0 (2): struct ofp_flow_stats_request. */
+    /* OFPST 1.0 (2): struct ofp10_flow_stats_request. */
     OFPRAW_OFPST_AGGREGATE_REQUEST,
     /* NXST 1.0 (1): struct nx_flow_stats_request, uint8_t[8][]. */
     OFPRAW_NXST_AGGREGATE_REQUEST,
@@ -198,19 +198,19 @@ enum ofpraw {
     /* OFPST 1.0 (3): void. */
     OFPRAW_OFPST_TABLE_REQUEST,
 
-    /* OFPST 1.0 (3): struct ofp_table_stats[]. */
+    /* OFPST 1.0 (3): struct ofp10_table_stats[]. */
     OFPRAW_OFPST_TABLE_REPLY,
 
-    /* OFPST 1.0 (4): struct ofp_port_stats_request. */
+    /* OFPST 1.0 (4): struct ofp10_port_stats_request. */
     OFPRAW_OFPST_PORT_REQUEST,
 
-    /* OFPST 1.0 (4): struct ofp_port_stats[]. */
+    /* OFPST 1.0 (4): struct ofp10_port_stats[]. */
     OFPRAW_OFPST_PORT_REPLY,
 
-    /* OFPST 1.0 (5): struct ofp_queue_stats_request. */
+    /* OFPST 1.0 (5): struct ofp10_queue_stats_request. */
     OFPRAW_OFPST_QUEUE_REQUEST,
 
-    /* OFPST 1.0 (5): struct ofp_queue_stats[]. */
+    /* OFPST 1.0 (5): struct ofp10_queue_stats[]. */
     OFPRAW_OFPST_QUEUE_REPLY,
 
     /* OFPST 1.0 (13): void. */
diff --git a/lib/ofp-print.c b/lib/ofp-print.c
index 141bd39..0e32e79 100644
--- a/lib/ofp-print.c
+++ b/lib/ofp-print.c
@@ -1059,7 +1059,7 @@ static void print_port_stat(struct ds *string, const char *leader,
 static void
 ofp_print_ofpst_port_request(struct ds *string, const struct ofp_header *oh)
 {
-    const struct ofp_port_stats_request *psr = ofpmsg_body(oh);
+    const struct ofp10_port_stats_request *psr = ofpmsg_body(oh);
     ds_put_format(string, " port_no=%"PRIu16, ntohs(psr->port_no));
 }
 
@@ -1067,7 +1067,7 @@ static void
 ofp_print_ofpst_port_reply(struct ds *string, const struct ofp_header *oh,
                            int verbosity)
 {
-    struct ofp_port_stats *ps;
+    struct ofp10_port_stats *ps;
     struct ofpbuf b;
     size_t n;
 
@@ -1110,7 +1110,7 @@ static void
 ofp_print_ofpst_table_reply(struct ds *string, const struct ofp_header *oh,
                             int verbosity)
 {
-    struct ofp_table_stats *ts;
+    struct ofp10_table_stats *ts;
     struct ofpbuf b;
     size_t n;
 
@@ -1158,7 +1158,7 @@ ofp_print_queue_name(struct ds *string, uint32_t queue_id)
 static void
 ofp_print_ofpst_queue_request(struct ds *string, const struct ofp_header *oh)
 {
-    const struct ofp_queue_stats_request *qsr = ofpmsg_body(oh);
+    const struct ofp10_queue_stats_request *qsr = ofpmsg_body(oh);
 
     ds_put_cstr(string, "port=");
     ofputil_format_port(ntohs(qsr->port_no), string);
@@ -1171,7 +1171,7 @@ static void
 ofp_print_ofpst_queue_reply(struct ds *string, const struct ofp_header *oh,
                             int verbosity)
 {
-    struct ofp_queue_stats *qs;
+    struct ofp10_queue_stats *qs;
     struct ofpbuf b;
     size_t n;
 
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index e5fcdf1..9b69a7d 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -1261,7 +1261,7 @@ ofputil_flow_mod_usable_protocols(const struct ofputil_flow_mod *fms,
 
 static enum ofperr
 ofputil_decode_ofpst_flow_request(struct ofputil_flow_stats_request *fsr,
-                                  const struct ofp_flow_stats_request *ofsr,
+                                  const struct ofp10_flow_stats_request *ofsr,
                                   bool aggregate)
 {
     fsr->aggregate = aggregate;
@@ -1341,7 +1341,7 @@ ofputil_encode_flow_stats_request(const struct ofputil_flow_stats_request *fsr,
     switch (protocol) {
     case OFPUTIL_P_OF10:
     case OFPUTIL_P_OF10_TID: {
-        struct ofp_flow_stats_request *ofsr;
+        struct ofp10_flow_stats_request *ofsr;
 
         raw = (fsr->aggregate
                ? OFPRAW_OFPST_AGGREGATE_REQUEST
@@ -1437,7 +1437,7 @@ ofputil_decode_flow_stats_reply(struct ofputil_flow_stats *fs,
     if (!msg->size) {
         return EOF;
     } else if (raw == OFPRAW_OFPST_FLOW_REPLY) {
-        const struct ofp_flow_stats *ofs;
+        const struct ofp10_flow_stats *ofs;
         size_t length;
 
         ofs = ofpbuf_try_pull(msg, sizeof *ofs);
@@ -1549,7 +1549,7 @@ ofputil_append_flow_stats_reply(const struct ofputil_flow_stats *fs,
 
     ofpraw_decode_partial(&raw, reply->data, reply->size);
     if (raw == OFPRAW_OFPST_FLOW_REPLY) {
-        struct ofp_flow_stats *ofs;
+        struct ofp10_flow_stats *ofs;
 
         ofs = ofpbuf_put_uninit(reply, sizeof *ofs);
         ofs->table_id = fs->table_id;
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 2451d44..b712237 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -1146,7 +1146,7 @@ get_features(struct ofproto *ofproto_ OVS_UNUSED,
 }
 
 static void
-get_tables(struct ofproto *ofproto_, struct ofp_table_stats *ots)
+get_tables(struct ofproto *ofproto_, struct ofp10_table_stats *ots)
 {
     struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofproto_);
     struct dpif_dp_stats s;
diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h
index afd17a6..2e1f082 100644
--- a/ofproto/ofproto-provider.h
+++ b/ofproto/ofproto-provider.h
@@ -467,10 +467,10 @@ struct ofproto_class {
      *   - 'matched_count' to the number of packets looked up in this flow
      *     table so far that matched one of the flow entries.
      *
-     * Keep in mind that all of the members of struct ofp_table_stats are in
+     * Keep in mind that all of the members of struct ofp10_table_stats are in
      * network byte order.
      */
-    void (*get_tables)(struct ofproto *ofproto, struct ofp_table_stats *ots);
+    void (*get_tables)(struct ofproto *ofproto, struct ofp10_table_stats *ots);
 
 /* ## ---------------- ## */
 /* ## ofport Functions ## */
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 25f481a..d552827 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -2170,7 +2170,7 @@ handle_table_stats_request(struct ofconn *ofconn,
                            const struct ofp_header *request)
 {
     struct ofproto *p = ofconn_get_ofproto(ofconn);
-    struct ofp_table_stats *ots;
+    struct ofp10_table_stats *ots;
     struct ofpbuf *msg;
     size_t i;
 
@@ -2208,7 +2208,7 @@ static void
 append_port_stat(struct ofport *port, struct list *replies)
 {
     struct netdev_stats stats;
-    struct ofp_port_stats *ops;
+    struct ofp10_port_stats *ops;
 
     /* Intentionally ignore return value, since errors will set
      * 'stats' to all-1s, which is correct for OpenFlow, and
@@ -2237,7 +2237,7 @@ handle_port_stats_request(struct ofconn *ofconn,
                           const struct ofp_header *request)
 {
     struct ofproto *p = ofconn_get_ofproto(ofconn);
-    const struct ofp_port_stats_request *psr = ofpmsg_body(request);
+    const struct ofp10_port_stats_request *psr = ofpmsg_body(request);
     struct ofport *port;
     struct list replies;
 
@@ -2667,7 +2667,7 @@ static void
 put_queue_stats(struct queue_stats_cbdata *cbdata, uint32_t queue_id,
                 const struct netdev_queue_stats *stats)
 {
-    struct ofp_queue_stats *reply;
+    struct ofp10_queue_stats *reply;
 
     reply = ofpmp_append(&cbdata->replies, sizeof *reply);
     reply->port_no = htons(cbdata->ofport->pp.port_no);
@@ -2713,7 +2713,7 @@ handle_queue_stats_request(struct ofconn *ofconn,
                            const struct ofp_header *rq)
 {
     struct ofproto *ofproto = ofconn_get_ofproto(ofconn);
-    const struct ofp_queue_stats_request *qsr = ofpmsg_body(rq);
+    const struct ofp10_queue_stats_request *qsr = ofpmsg_body(rq);
     struct queue_stats_cbdata cbdata;
     unsigned int port_no;
     struct ofport *port;
diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index 425448e..73e1bfa 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -784,7 +784,7 @@ do_dump_aggregate(int argc, char *argv[])
 static void
 do_queue_stats(int argc, char *argv[])
 {
-    struct ofp_queue_stats_request *req;
+    struct ofp10_queue_stats_request *req;
     struct ofpbuf *request;
 
     request = ofpraw_alloc(OFPRAW_OFPST_QUEUE_REQUEST, OFP10_VERSION, 0);
@@ -1195,7 +1195,7 @@ do_snoop(int argc OVS_UNUSED, char *argv[])
 static void
 do_dump_ports(int argc, char *argv[])
 {
-    struct ofp_port_stats_request *req;
+    struct ofp10_port_stats_request *req;
     struct ofpbuf *request;
     uint16_t port;
 
-- 
1.7.2.5




More information about the dev mailing list