This isn't used yet but it will be in future commits.
This also looks forward to supporting Open vSwitch extensions to OAM_*,
which will be coming up soon.
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
OFPRAW_OFPT13_SET_ASYNC,
/* NXT 1.0+ (19): struct nx_async_config. */
OFPRAW_NXT_SET_ASYNC_CONFIG,
+ /* NXT 1.0-1.3 (27): uint8_t[8][]. */
+ OFPRAW_NXT_SET_ASYNC_CONFIG2,
/* OFPT 1.4+ (28): uint8_t[8][]. */
OFPRAW_OFPT14_SET_ASYNC,
OFPTYPE_GET_ASYNC_REPLY, /* OFPRAW_OFPT13_GET_ASYNC_REPLY.
* OFPRAW_OFPT14_GET_ASYNC_REPLY. */
OFPTYPE_SET_ASYNC_CONFIG, /* OFPRAW_NXT_SET_ASYNC_CONFIG.
+ * OFPRAW_NXT_SET_ASYNC_CONFIG2.
* OFPRAW_OFPT13_SET_ASYNC.
* OFPRAW_OFPT14_SET_ASYNC. */
decode_legacy_async_masks(msg->flow_removed_mask, OAM_FLOW_REMOVED,
oh->version, ac);
} else if (raw == OFPRAW_OFPT14_SET_ASYNC ||
- raw == OFPRAW_OFPT14_GET_ASYNC_REPLY) {
+ raw == OFPRAW_OFPT14_GET_ASYNC_REPLY ||
+ raw == OFPRAW_NXT_SET_ASYNC_CONFIG2) {
*ac = *basis;
while (b.size > 0) {
struct ofpbuf property;
/* Encodes and returns a reply to the OFPT_GET_ASYNC_REQUEST in 'oh' that
* states that the asynchronous message configuration is 'ac'. */
struct ofpbuf *
-ofputil_encode_get_async_config(const struct ofp_header *oh,
- const struct ofputil_async_cfg *ac)
+ofputil_encode_get_async_reply(const struct ofp_header *oh,
+ const struct ofputil_async_cfg *ac)
{
struct ofpbuf *buf;
return buf;
}
+/* Encodes and returns a message, in a format appropriate for OpenFlow version
+ * 'ofp_version', that sets the asynchronous message configuration to 'ac'.
+ *
+ * Specify 'oams' as a bitmap of OAM_* that indicate the asynchronous messages
+ * to configure. OF1.0 through OF1.3 can't natively configure a subset of
+ * messages, so more messages than requested may be configured. OF1.0 through
+ * OF1.3 also can't configure OVS extension OAM_* values, so if 'oam' includes
+ * any extensions then this function encodes an Open vSwitch extension message
+ * that does support configuring OVS extension OAM_*. */
+struct ofpbuf *
+ofputil_encode_set_async_config(const struct ofputil_async_cfg *ac,
+ uint32_t oams, enum ofp_version ofp_version)
+{
+ enum ofpraw raw = (ofp_version >= OFP14_VERSION ? OFPRAW_OFPT14_SET_ASYNC
+ : oams & OAM_EXTENSIONS ? OFPRAW_NXT_SET_ASYNC_CONFIG2
+ : ofp_version >= OFP13_VERSION ? OFPRAW_OFPT13_SET_ASYNC
+ : OFPRAW_NXT_SET_ASYNC_CONFIG);
+ struct ofpbuf *request = ofpraw_alloc(raw, ofp_version, 0);
+ ofputil_put_async_config__(ac, request,
+ (raw == OFPRAW_OFPT14_SET_ASYNC ||
+ raw == OFPRAW_NXT_SET_ASYNC_CONFIG2),
+ ofp_version, oams);
+ return request;
+}
+
struct ofputil_async_cfg
ofputil_async_cfg_default(enum ofp_version version)
{
void ofputil_uninit_tlv_table(struct ovs_list *mappings);
enum ofputil_async_msg_type {
+ /* Standard asynchronous messages. */
OAM_PACKET_IN, /* OFPT_PACKET_IN or NXT_PACKET_IN. */
OAM_PORT_STATUS, /* OFPT_PORT_STATUS. */
OAM_FLOW_REMOVED, /* OFPT_FLOW_REMOVED or NXT_FLOW_REMOVED. */
OAM_ROLE_STATUS, /* OFPT_ROLE_STATUS. */
OAM_TABLE_STATUS, /* OFPT_TABLE_STATUS. */
OAM_REQUESTFORWARD, /* OFPT_REQUESTFORWARD. */
+
+ /* Extension asynchronous messages (none yet--coming soon!). */
+#define OAM_EXTENSIONS 0 /* Bitmap of all extensions. */
+
OAM_N_TYPES
};
const char *ofputil_async_msg_type_to_string(enum ofputil_async_msg_type);
const struct ofputil_async_cfg *,
struct ofputil_async_cfg *);
-struct ofpbuf *ofputil_encode_get_async_config(
+struct ofpbuf *ofputil_encode_get_async_reply(
const struct ofp_header *, const struct ofputil_async_cfg *);
+struct ofpbuf *ofputil_encode_set_async_config(
+ const struct ofputil_async_cfg *, uint32_t oams, enum ofp_version);
struct ofputil_async_cfg ofputil_async_cfg_default(enum ofp_version);
handle_nxt_get_async_request(struct ofconn *ofconn, const struct ofp_header *oh)
{
struct ofputil_async_cfg ac = ofconn_get_async_config(ofconn);
- ofconn_send_reply(ofconn, ofputil_encode_get_async_config(oh, &ac));
+ ofconn_send_reply(ofconn, ofputil_encode_get_async_reply(oh, &ac));
return 0;
}