- /* "master" and "other" roles get all asynchronous messages by default,
- * except that the controller needs to enable nonstandard "packet-in"
- * reasons itself. */
- master[OAM_PACKET_IN] = (1u << OFPR_NO_MATCH) | (1u << OFPR_ACTION);
- master[OAM_PORT_STATUS] = ((1u << OFPPR_ADD)
- | (1u << OFPPR_DELETE)
- | (1u << OFPPR_MODIFY));
- master[OAM_FLOW_REMOVED] = ((1u << OFPRR_IDLE_TIMEOUT)
- | (1u << OFPRR_HARD_TIMEOUT)
- | (1u << OFPRR_DELETE));
-
- /* "slave" role gets port status updates by default. */
- slave[OAM_PACKET_IN] = 0;
- slave[OAM_PORT_STATUS] = ((1u << OFPPR_ADD)
- | (1u << OFPPR_DELETE)
- | (1u << OFPPR_MODIFY));
- slave[OAM_FLOW_REMOVED] = 0;
+ if (ofconn->enable_async_msgs) {
+ uint32_t *master = ofconn->master_async_config;
+ uint32_t *slave = ofconn->slave_async_config;
+
+ /* "master" and "other" roles get all asynchronous messages by default,
+ * except that the controller needs to enable nonstandard "packet-in"
+ * reasons itself. */
+ master[OAM_PACKET_IN] = (1u << OFPR_NO_MATCH) | (1u << OFPR_ACTION);
+ master[OAM_PORT_STATUS] = ((1u << OFPPR_ADD)
+ | (1u << OFPPR_DELETE)
+ | (1u << OFPPR_MODIFY));
+ master[OAM_FLOW_REMOVED] = ((1u << OFPRR_IDLE_TIMEOUT)
+ | (1u << OFPRR_HARD_TIMEOUT)
+ | (1u << OFPRR_DELETE));
+
+ /* "slave" role gets port status updates by default. */
+ slave[OAM_PACKET_IN] = 0;
+ slave[OAM_PORT_STATUS] = ((1u << OFPPR_ADD)
+ | (1u << OFPPR_DELETE)
+ | (1u << OFPPR_MODIFY));
+ slave[OAM_FLOW_REMOVED] = 0;
+ } else {
+ memset(ofconn->master_async_config, 0,
+ sizeof ofconn->master_async_config);
+ memset(ofconn->slave_async_config, 0,
+ sizeof ofconn->slave_async_config);
+ }