/* OpenFlow state. */
enum nx_role role; /* Role. */
- enum nx_flow_format flow_format; /* Currently selected flow format. */
+ enum ofputil_protocol protocol; /* Current protocol variant. */
enum nx_packet_in_format packet_in_format; /* OFPT_PACKET_IN format. */
- bool flow_mod_table_id; /* NXT_FLOW_MOD_TABLE_ID enabled? */
/* Asynchronous flow table operation support. */
struct list opgroups; /* Contains pending "ofopgroups", if any. */
struct pinsched *schedulers[N_SCHEDULERS];
struct pktbuf *pktbuf; /* OpenFlow packet buffers. */
int miss_send_len; /* Bytes to send of buffered packets. */
+ uint16_t controller_id; /* Connection controller ID. */
/* Number of OpenFlow messages queued on 'rconn' as replies to OpenFlow
* requests, and the maximum number before we stop reading OpenFlow
struct vconn *vconn;
int retval;
- retval = pvconn_accept(ofservice->pvconn, OFP_VERSION, &vconn);
+ retval = pvconn_accept(ofservice->pvconn, OFP10_VERSION, &vconn);
if (!retval) {
struct rconn *rconn;
char *name;
struct vconn *vconn;
int retval;
- retval = pvconn_accept(mgr->snoops[i], OFP_VERSION, &vconn);
+ retval = pvconn_accept(mgr->snoops[i], OFP10_VERSION, &vconn);
if (!retval) {
add_snooper(mgr, vconn);
} else if (retval != EAGAIN) {
return (ofconn->master_async_config[OAM_PACKET_IN] & bit) != 0;
}
-/* Returns the currently configured flow format for 'ofconn', one of NXFF_*.
+/* Returns the currently configured protocol for 'ofconn', one of OFPUTIL_P_*.
*
- * The default, if no other format has been set, is NXFF_OPENFLOW10. */
-enum nx_flow_format
-ofconn_get_flow_format(struct ofconn *ofconn)
+ * The default, if no other format has been set, is OFPUTIL_P_OPENFLOW10. */
+enum ofputil_protocol
+ofconn_get_protocol(struct ofconn *ofconn)
{
- return ofconn->flow_format;
+ return ofconn->protocol;
}
-/* Sets the flow format for 'ofconn' to 'flow_format' (one of NXFF_*). */
+/* Sets the protocol for 'ofconn' to 'protocol' (one of OFPUTIL_P_*).
+ *
+ * (This doesn't actually send anything to accomplish this. Presumably the
+ * caller already did that.) */
void
-ofconn_set_flow_format(struct ofconn *ofconn, enum nx_flow_format flow_format)
+ofconn_set_protocol(struct ofconn *ofconn, enum ofputil_protocol protocol)
{
- ofconn->flow_format = flow_format;
+ ofconn->protocol = protocol;
}
/* Returns the currently configured packet in format for 'ofconn', one of
ofconn->packet_in_format = packet_in_format;
}
-/* Returns true if the NXT_FLOW_MOD_TABLE_ID extension is enabled, false
- * otherwise.
+/* Sets the controller connection ID for 'ofconn' to 'controller_id'.
*
- * By default the extension is not enabled. */
-bool
-ofconn_get_flow_mod_table_id(const struct ofconn *ofconn)
-{
- return ofconn->flow_mod_table_id;
-}
-
-/* Enables or disables (according to 'enable') the NXT_FLOW_MOD_TABLE_ID
- * extension on 'ofconn'. */
+ * The connection controller ID is used for OFPP_CONTROLLER and
+ * NXAST_CONTROLLER actions. See "struct nx_action_controller" for details. */
void
-ofconn_set_flow_mod_table_id(struct ofconn *ofconn, bool enable)
+ofconn_set_controller_id(struct ofconn *ofconn, uint16_t controller_id)
{
- ofconn->flow_mod_table_id = enable;
+ ofconn->controller_id = controller_id;
}
/* Returns the default miss send length for 'ofconn'. */
int i;
ofconn->role = NX_ROLE_OTHER;
- ofconn->flow_format = NXFF_OPENFLOW10;
+ ofconn->protocol = OFPUTIL_P_OF10;
ofconn->packet_in_format = NXPIF_OPENFLOW10;
- ofconn->flow_mod_table_id = false;
/* Disassociate 'ofconn' from all of the ofopgroups that it initiated that
* have not yet completed. (Those ofopgroups will still run to completion
ofconn->miss_send_len = (ofconn->type == OFCONN_PRIMARY
? OFP_DEFAULT_MISS_SEND_LEN
: 0);
+ ofconn->controller_id = 0;
rconn_packet_counter_destroy(ofconn->reply_counter);
ofconn->reply_counter = rconn_packet_counter_create();
int probe_interval;
ofconn->band = c->band;
+ ofconn->enable_async_msgs = c->enable_async_msgs;
rconn_set_max_backoff(ofconn->rconn, c->max_backoff);
* also prevents new flows from being added (and expiring). (It
* also prevents processing OpenFlow requests that would not add
* new flows, so it is imperfect.) */
- msg = ofputil_encode_flow_removed(fr, ofconn->flow_format);
+ msg = ofputil_encode_flow_removed(fr, ofconn->protocol);
ofconn_send_reply(ofconn, msg);
}
}
struct ofconn *ofconn;
LIST_FOR_EACH (ofconn, node, &mgr->all_conns) {
- if (ofconn_receives_async_msg(ofconn, OAM_PACKET_IN, pin->reason)) {
+ if (ofconn_receives_async_msg(ofconn, OAM_PACKET_IN, pin->reason)
+ && ofconn->controller_id == pin->controller_id) {
schedule_packet_in(ofconn, *pin, flow);
}
}