/* Returns the currently configured packet in format for 'ofconn', one of
* NXPIF_*.
*
- * The default, if no other format has been set, is NXPIF_OPENFLOW10. */
+ * The default, if no other format has been set, is NXPIF_STANDARD. */
enum nx_packet_in_format
ofconn_get_packet_in_format(struct ofconn *ofconn)
{
ofconn->role = OFPCR12_ROLE_EQUAL;
ofconn_set_protocol(ofconn, OFPUTIL_P_NONE);
- ofconn->packet_in_format = NXPIF_OPENFLOW10;
+ ofconn->packet_in_format = NXPIF_STANDARD;
rconn_packet_counter_destroy(ofconn->packet_in_counter);
ofconn->packet_in_counter = rconn_packet_counter_create();
}
}
+/* Sends an OFPT_TABLE_STATUS message with 'reason' to appropriate controllers
+ * managed by 'mgr'. When the table state changes, the controller needs to be
+ * informed with the OFPT_TABLE_STATUS message. The reason values
+ * OFPTR_VACANCY_DOWN and OFPTR_VACANCY_UP identify a vacancy message. The
+ * vacancy events are generated when the remaining space in the flow table
+ * changes and crosses one of the vacancy thereshold specified by
+ * OFPT_TABLE_MOD. */
+void
+connmgr_send_table_status(struct connmgr *mgr,
+ const struct ofputil_table_desc *td,
+ uint8_t reason)
+{
+ struct ofputil_table_status ts;
+ struct ofconn *ofconn;
+
+ ts.reason = reason;
+ ts.desc = *td;
+
+ LIST_FOR_EACH (ofconn, node, &mgr->all_conns) {
+ if (ofconn_receives_async_msg(ofconn, OAM_TABLE_STATUS, reason)) {
+ struct ofpbuf *msg;
+
+ msg = ofputil_encode_table_status(&ts,
+ ofconn_get_protocol(ofconn));
+ if (msg) {
+ ofconn_send(ofconn, msg, NULL);
+ }
+ }
+ }
+}
+
/* Given 'pin', sends an OFPT_PACKET_IN message to each OpenFlow controller as
- * necessary according to their individual configurations.
- *
- * The caller doesn't need to fill in pin->buffer_id or pin->total_len. */
+ * necessary according to their individual configurations. */
void
-connmgr_send_packet_in(struct connmgr *mgr,
- const struct ofproto_packet_in *pin)
+connmgr_send_async_msg(struct connmgr *mgr,
+ const struct ofproto_async_msg *am)
{
struct ofconn *ofconn;
LIST_FOR_EACH (ofconn, node, &mgr->all_conns) {
enum ofputil_protocol protocol = ofconn_get_protocol(ofconn);
if (protocol == OFPUTIL_P_NONE || !rconn_is_connected(ofconn->rconn)
- || ofconn->controller_id != pin->controller_id
- || !ofconn_receives_async_msg(ofconn, OAM_PACKET_IN,
- pin->up.reason)) {
+ || ofconn->controller_id != am->controller_id
+ || !ofconn_receives_async_msg(ofconn, am->oam,
+ am->pin.up.public.reason)) {
continue;
}
- struct ofpbuf *msg = ofputil_encode_packet_in(
- &pin->up, protocol, ofconn->packet_in_format,
- pin->max_len >= 0 ? pin->max_len : ofconn->miss_send_len,
+ struct ofpbuf *msg = ofputil_encode_packet_in_private(
+ &am->pin.up, protocol, ofconn->packet_in_format,
+ am->pin.max_len >= 0 ? am->pin.max_len : ofconn->miss_send_len,
ofconn->pktbuf);
struct ovs_list txq;
- bool is_miss = (pin->up.reason == OFPR_NO_MATCH ||
- pin->up.reason == OFPR_EXPLICIT_MISS ||
- pin->up.reason == OFPR_IMPLICIT_MISS);
+ bool is_miss = (am->pin.up.public.reason == OFPR_NO_MATCH ||
+ am->pin.up.public.reason == OFPR_EXPLICIT_MISS ||
+ am->pin.up.public.reason == OFPR_IMPLICIT_MISS);
pinsched_send(ofconn->schedulers[is_miss],
- pin->up.flow_metadata.flow.in_port.ofp_port, msg, &txq);
+ am->pin.up.public.flow_metadata.flow.in_port.ofp_port,
+ msg, &txq);
do_send_packet_ins(ofconn, &txq);
}
}
}
ovs_mutex_unlock(&ofproto_mutex);
}
+
+void
+ofproto_async_msg_free(struct ofproto_async_msg *am)
+{
+ free(am->pin.up.public.packet);
+ free(am->pin.up.public.userdata);
+ free(am->pin.up.stack);
+ free(am->pin.up.actions);
+ free(am->pin.up.action_set);
+ free(am);
+}