\f
/* Nicira vendor requests and replies. */
-/* Header for Nicira vendor requests and replies. */
-struct nicira_header {
- struct ofp_header header;
- ovs_be32 vendor; /* NX_VENDOR_ID. */
- ovs_be32 subtype; /* See the NXT numbers in ofp-msgs.h. */
-};
-OFP_ASSERT(sizeof(struct nicira_header) == 16);
-
/* Header for Nicira vendor stats request and reply messages in OpenFlow
* 1.0. */
struct nicira10_stats_msg {
};
OFP_ASSERT(sizeof(struct nicira10_stats_msg) == 24);
-/* Header for Nicira vendor stats request and reply messages in OpenFlow
- * 1.1. */
-struct nicira11_stats_msg {
- struct ofp11_vendor_stats_msg vsm; /* Vendor NX_VENDOR_ID. */
- ovs_be32 subtype; /* One of NXST_* below. */
-};
-OFP_ASSERT(sizeof(struct nicira11_stats_msg) == 24);
-
/* Fields to use when hashing flows. */
enum nx_hash_fields {
/* Ethernet source address (NXM_OF_ETH_SRC) only. */
#define OFPT11_STATS_REPLY 19
#define OFPST_VENDOR 0xffff
+/* Vendor extension message. */
+struct ofp_vendor_header {
+ struct ofp_header header; /* OFPT_VENDOR. */
+ ovs_be32 vendor; /* Vendor ID:
+ * - MSB 0: low-order bytes are IEEE OUI.
+ * - MSB != 0: defined by OpenFlow
+ * consortium. */
+
+ /* In theory everything after 'vendor' is vendor specific. In practice,
+ * the vendors we support put a 32-bit subtype here. We'll change this
+ * structure if we start adding support for other vendor formats. */
+ ovs_be32 subtype; /* Vendor-specific subtype. */
+
+ /* Followed by vendor-defined additional data. */
+};
+OFP_ASSERT(sizeof(struct ofp_vendor_header) == 16);
+
+/* Vendor extension stats message. */
+struct ofp11_vendor_stats_msg {
+ struct ofp11_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. */
+
+ /* In theory everything after 'vendor' is vendor specific. In practice,
+ * the vendors we support put a 32-bit subtype here. We'll change this
+ * structure if we start adding support for other vendor formats. */
+ ovs_be32 subtype; /* Vendor-specific subtype. */
+
+ /* Followed by vendor-defined additional data. */
+};
+OFP_ASSERT(sizeof(struct ofp11_vendor_stats_msg) == 24);
/* A thin abstraction of OpenFlow headers:
*
* - 'version' and 'type' come straight from struct ofp_header, so these are
ovh = (const struct ofp_vendor_header *) oh;
hdrs->vendor = ntohl(ovh->vendor);
- if (hdrs->vendor == NX_VENDOR_ID) {
- /* Get Nicira message subtype (NXT_*). */
- const struct nicira_header *nh;
-
- if (length < sizeof *nh) {
- return OFPERR_OFPBRC_BAD_LEN;
- }
- nh = (const struct nicira_header *) oh;
- hdrs->subtype = ntohl(nh->subtype);
+ if (hdrs->vendor == NX_VENDOR_ID || hdrs->vendor == ONF_VENDOR_ID) {
+ hdrs->subtype = ntohl(ovh->subtype);
} else {
log_bad_vendor(hdrs->vendor);
return OFPERR_OFPBRC_BAD_VENDOR;
ovsm = (const struct ofp11_vendor_stats_msg *) oh;
hdrs->vendor = ntohl(ovsm->vendor);
- if (hdrs->vendor == NX_VENDOR_ID) {
- /* Get Nicira statistic type (NXST_*). */
- const struct nicira11_stats_msg *nsm;
-
- if (length < sizeof *nsm) {
- return OFPERR_OFPBRC_BAD_LEN;
- }
- nsm = (const struct nicira11_stats_msg *) oh;
- hdrs->subtype = ntohl(nsm->subtype);
+ if (hdrs->vendor == NX_VENDOR_ID ||
+ hdrs->vendor == ONF_VENDOR_ID) {
+ hdrs->subtype = ntohl(ovsm->subtype);
} else {
log_bad_vendor(hdrs->vendor);
return OFPERR_OFPBRC_BAD_VENDOR;
ofphdrs_len(const struct ofphdrs *hdrs)
{
if (hdrs->type == OFPT_VENDOR) {
- return sizeof(struct nicira_header);
+ return sizeof(struct ofp_vendor_header);
}
switch ((enum ofp_version) hdrs->version) {
if (hdrs->type == OFPT11_STATS_REQUEST ||
hdrs->type == OFPT11_STATS_REPLY) {
return (hdrs->stat == OFPST_VENDOR
- ? sizeof(struct nicira11_stats_msg)
+ ? sizeof(struct ofp11_vendor_stats_msg)
: sizeof(struct ofp11_stats_msg));
}
break;
oh->xid = xid;
if (hdrs->type == OFPT_VENDOR) {
- struct nicira_header *nh = buf->header;
+ struct ofp_vendor_header *ovh = buf->header;
- ovs_assert(hdrs->vendor == NX_VENDOR_ID);
- nh->vendor = htonl(hdrs->vendor);
- nh->subtype = htonl(hdrs->subtype);
+ ovh->vendor = htonl(hdrs->vendor);
+ ovh->subtype = htonl(hdrs->subtype);
} else if (version == OFP10_VERSION
&& (hdrs->type == OFPT10_STATS_REQUEST ||
hdrs->type == OFPT10_STATS_REPLY)) {
struct ofp11_vendor_stats_msg *ovsm = buf->header;
ovsm->vendor = htonl(hdrs->vendor);
- if (hdrs->vendor == NX_VENDOR_ID) {
- struct nicira11_stats_msg *nsm = buf->header;
-
- nsm->subtype = htonl(hdrs->subtype);
- } else {
- OVS_NOT_REACHED();
- }
+ ovsm->subtype = htonl(hdrs->subtype);
}
}
}
*
* where the syntax of each part is:
*
- * - type: One of OFPT (standard OpenFlow message), OFPST (standard OpenFlow
- * statistics message), NXT (Nicira extension message), or NXST (Nicira
- * extension statistics message).
+ * - type: One of the following:
+ *
+ * * OFPT: standard OpenFlow message.
+ * * OFPST: standard OpenFlow statistics or multipart message.
+ * * NXT: Nicira extension message.
+ * * NXST: Nicira extension statistics or multipart message.
+ * * ONFT: Open Networking Foundation extension message.
+ * * ONFST: Open Networking Foundation multipart message.
*
* As new vendors implement extensions it will make sense to expand the
* dictionary of possible types.
* - number:
* For OFPT, the 'type' in struct ofp_header.
* For OFPST, the 'type' in struct ofp_stats_msg or ofp11_stats_msg.
- * For NXT, the 'subtype' in struct nicira_header.
- * For NXST, the 'subtype' in struct nicira10_stats_msg or
- * nicira11_stats_msg.
+ * For NXT or ONFT, the 'subtype' in struct ofp_vendor_header.
+ * For NXST or ONFST, the 'subtype' in an appropriate vendor stats
+ * struct.
*
* - arguments: The types of data that follow the OpenFlow headers (the
* message "body"). This can be "void" if the message has no body.