From: Ben Pfaff Date: Thu, 28 Jun 2012 04:13:13 +0000 (-0700) Subject: openflow: Rename OpenFlow 1.0 statistics messages with "10" infix. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7011767c3497ed1dc05f2bdee96a09b4bc050439;p=openvswitch openflow: Rename OpenFlow 1.0 statistics messages with "10" infix. Signed-off-by: Ben Pfaff Tested-by: Simon Horman Reviewed-by: Simon Horman --- diff --git a/include/openflow/openflow-1.0.h b/include/openflow/openflow-1.0.h index 23cfb8d0..b2077f02 100644 --- a/include/openflow/openflow-1.0.h +++ b/include/openflow/openflow-1.0.h @@ -422,34 +422,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. */ @@ -458,10 +444,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; @@ -479,19 +465,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. */ @@ -503,20 +480,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. */ @@ -536,22 +513,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. */ @@ -559,11 +536,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 ae91c442..3c456ba1 100644 --- a/include/openflow/openflow-common.h +++ b/include/openflow/openflow-common.h @@ -272,6 +272,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 1d11e7f3..48ecafc6 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->type == OFPT11_STATS_REQUEST || @@ -619,7 +619,7 @@ ofpraw_put__(enum ofpraw raw, uint8_t version, ovs_be32 xid, } 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); @@ -855,7 +855,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 9bd5ee4e..162d6e04 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 d1cab7bd..c4e7b8f4 100644 --- a/lib/ofp-print.c +++ b/lib/ofp-print.c @@ -1073,7 +1073,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)); } @@ -1081,7 +1081,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; @@ -1124,7 +1124,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; @@ -1172,7 +1172,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); @@ -1185,7 +1185,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 c9346a50..e41bab2b 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -1284,7 +1284,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; @@ -1364,7 +1364,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 @@ -1461,7 +1461,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); @@ -1573,7 +1573,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; ofpbuf_put_uninit(reply, sizeof *ofs); ofpacts_put_openflow10(fs->ofpacts, fs->ofpacts_len, reply); diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index c25c513c..f05cd2e7 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -1153,7 +1153,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 6eef1063..f0d57ee0 100644 --- a/ofproto/ofproto-provider.h +++ b/ofproto/ofproto-provider.h @@ -481,10 +481,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 f6140963..522b791f 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -2208,7 +2208,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; @@ -2244,7 +2244,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 @@ -2273,7 +2273,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; @@ -2705,7 +2705,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); @@ -2751,7 +2751,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 e9ad1816..258115ec 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -954,7 +954,7 @@ ofctl_dump_aggregate(int argc, char *argv[]) static void ofctl_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); @@ -1416,7 +1416,7 @@ ofctl_snoop(int argc OVS_UNUSED, char *argv[]) static void ofctl_dump_ports(int argc, char *argv[]) { - struct ofp_port_stats_request *req; + struct ofp10_port_stats_request *req; struct ofpbuf *request; uint16_t port;