*/
#include <config.h>
-#include "ofp-msgs.h"
#include "byte-order.h"
-#include "dynamic-string.h"
#include "hash.h"
-#include "hmap.h"
-#include "ofpbuf.h"
+#include "openvswitch/hmap.h"
#include "openflow/nicira-ext.h"
#include "openflow/openflow.h"
-#include "ovs-thread.h"
+#include "openvswitch/dynamic-string.h"
+#include "openvswitch/ofp-msgs.h"
+#include "openvswitch/ofpbuf.h"
#include "openvswitch/vlog.h"
+#include "ovs-thread.h"
+#include "util.h"
VLOG_DEFINE_THIS_MODULE(ofp_msgs);
};
OFP_ASSERT(sizeof(struct ofp_vendor_header) == 16);
+/* Statistics request or reply message. */
+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 ofp10_stats_msg) == 12);
+
+/* Vendor extension stats message. */
+struct ofp10_vendor_stats_msg {
+ 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
+ * consortium. */
+ /* Followed by vendor-defined arbitrary additional data. */
+};
+OFP_ASSERT(sizeof(struct ofp10_vendor_stats_msg) == 16);
+
+struct ofp11_stats_msg {
+ struct ofp_header header;
+ ovs_be16 type; /* One of the OFPST_* constants. */
+ ovs_be16 flags; /* OFPSF_REQ_* flags (none yet defined). */
+ uint8_t pad[4];
+ /* Followed by the body of the request. */
+};
+OFP_ASSERT(sizeof(struct ofp11_stats_msg) == 16);
+
/* Vendor extension stats message. */
struct ofp11_vendor_stats_msg {
struct ofp11_stats_msg osm; /* Type OFPST_VENDOR. */
/* Followed by vendor-defined additional data. */
};
OFP_ASSERT(sizeof(struct ofp11_vendor_stats_msg) == 24);
+
+/* Header for Nicira vendor stats request and reply messages in OpenFlow
+ * 1.0. */
+struct nicira10_stats_msg {
+ struct ofp10_vendor_stats_msg vsm; /* Vendor NX_VENDOR_ID. */
+ ovs_be32 subtype; /* One of NXST_* below. */
+ uint8_t pad[4]; /* Align to 64-bits. */
+};
+OFP_ASSERT(sizeof(struct nicira10_stats_msg) == 24);
+
/* A thin abstraction of OpenFlow headers:
*
* - 'version' and 'type' come straight from struct ofp_header, so these are
case OFP13_VERSION:
case OFP14_VERSION:
case OFP15_VERSION:
+ case OFP16_VERSION:
return type == OFPT11_STATS_REQUEST;
}
case OFP13_VERSION:
case OFP14_VERSION:
case OFP15_VERSION:
+ case OFP16_VERSION:
return type == OFPT11_STATS_REPLY;
}
case OFP13_VERSION:
case OFP14_VERSION:
case OFP15_VERSION:
+ case OFP16_VERSION:
if (hdrs->type == OFPT11_STATS_REQUEST ||
hdrs->type == OFPT11_STATS_REPLY) {
return (hdrs->stat == OFPST_VENDOR
enum ofperr
ofpraw_decode(enum ofpraw *raw, const struct ofp_header *oh)
{
- struct ofpbuf msg;
-
- ofpbuf_use_const(&msg, oh, ntohs(oh->length));
+ struct ofpbuf msg = ofpbuf_const_initializer(oh, ntohs(oh->length));
return ofpraw_pull(raw, &msg);
}
case OFP13_VERSION:
case OFP14_VERSION:
case OFP15_VERSION:
+ case OFP16_VERSION:
ovs_assert(hdrs.type == OFPT11_STATS_REQUEST);
hdrs.type = OFPT11_STATS_REPLY;
break;
{
struct ofpbuf *msg;
- list_init(replies);
+ ovs_list_init(replies);
msg = ofpraw_alloc_stats_reply(request, 1000);
- list_push_back(replies, &msg->list_node);
+ ovs_list_push_back(replies, &msg->list_node);
}
/* Prepares to append up to 'len' bytes to the series of statistics replies in
struct ofpbuf *
ofpmp_reserve(struct ovs_list *replies, size_t len)
{
- struct ofpbuf *msg = ofpbuf_from_list(list_back(replies));
+ struct ofpbuf *msg = ofpbuf_from_list(ovs_list_back(replies));
if (msg->size + len <= UINT16_MAX) {
ofpbuf_prealloc_tailroom(msg, len);
ofpbuf_put(next, msg->data, hdrs_len);
next->header = next->data;
next->msg = ofpbuf_tail(next);
- list_push_back(replies, &next->list_node);
+ ovs_list_push_back(replies, &next->list_node);
*ofpmp_flags__(msg->data) |= htons(OFPSF_REPLY_MORE);
void
ofpmp_postappend(struct ovs_list *replies, size_t start_ofs)
{
- struct ofpbuf *msg = ofpbuf_from_list(list_back(replies));
+ struct ofpbuf *msg = ofpbuf_from_list(ovs_list_back(replies));
ovs_assert(start_ofs <= UINT16_MAX);
if (msg->size > UINT16_MAX) {
enum ofp_version
ofpmp_version(struct ovs_list *replies)
{
- struct ofpbuf *msg = ofpbuf_from_list(list_back(replies));
+ struct ofpbuf *msg = ofpbuf_from_list(ovs_list_back(replies));
const struct ofp_header *oh = msg->data;
return oh->version;
enum ofpraw
ofpmp_decode_raw(struct ovs_list *replies)
{
- struct ofpbuf *msg = ofpbuf_from_list(list_back(replies));
+ struct ofpbuf *msg = ofpbuf_from_list(ovs_list_back(replies));
enum ofperr error;
enum ofpraw raw;
case OFP13_VERSION:
case OFP14_VERSION:
case OFP15_VERSION:
+ case OFP16_VERSION:
return &((struct ofp11_stats_msg *) oh)->flags;
default:
OVS_NOT_REACHED();