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. */
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;
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. */
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. */
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. */
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
};
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
} 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) {
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 ||
} 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);
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);
}
/* 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,
/* 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,
/* 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. */
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));
}
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;
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;
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);
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;
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;
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
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);
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);
}
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;
* - '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 ## */
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;
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
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;
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);
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;
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);
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;