bfd_wait(mport->bfd);
}
/* Computes the next wakeup time for this mport. */
- next_wake_time = MIN(bfd_wake_time(mport->bfd), cfm_wake_time(mport->cfm));
- heap_change(&monitor_heap, heap_max(&monitor_heap),
+ next_wake_time = MIN(bfd_wake_time(mport->bfd),
+ cfm_wake_time(mport->cfm));
+ heap_change(&monitor_heap, &mport->heap_node,
MSEC_TO_PRIO(next_wake_time));
}
monitor_running = false;
}
}
+
+/* Moves the mport on top of the heap. This is necessary when
+ * for example, bfd POLL is received and the mport should
+ * immediately send FINAL back. */
+void
+ofproto_dpif_monitor_port_send_soon_safe(const struct ofport_dpif *ofport)
+{
+ ovs_rwlock_wrlock(&monitor_rwlock);
+ ofproto_dpif_monitor_port_send_soon(ofport);
+ ovs_rwlock_unlock(&monitor_rwlock);
+}
+
+void
+ofproto_dpif_monitor_port_send_soon(const struct ofport_dpif *ofport)
+ OVS_REQ_WRLOCK(monitor_rwlock)
+{
+ struct mport *mport;
+
+ monitor_init();
+ mport = mport_find(ofport);
+ if (mport) {
+ heap_change(&monitor_heap, &mport->heap_node, LLONG_MAX);
+ }
+}
struct cfm;
struct ofport_dpif;
+void ofproto_dpif_monitor_port_send_soon(const struct ofport_dpif *);
+void ofproto_dpif_monitor_port_send_soon_safe(const struct ofport_dpif *);
+
void ofproto_dpif_monitor_port_update(const struct ofport_dpif *,
struct bfd *, struct cfm *,
uint8_t[OFP_ETH_ALEN]);
#include "ofp-actions.h"
#include "ofproto/ofproto-dpif-ipfix.h"
#include "ofproto/ofproto-dpif-mirror.h"
+#include "ofproto/ofproto-dpif-monitor.h"
#include "ofproto/ofproto-dpif-sflow.h"
#include "ofproto/ofproto-dpif.h"
#include "ofproto/ofproto-provider.h"
} else if (xport->bfd && bfd_should_process_flow(xport->bfd, flow, wc)) {
if (packet) {
bfd_process_packet(xport->bfd, flow, packet);
+ /* If POLL received, immediately sends FINAL back. */
+ if (bfd_should_send_packet(xport->bfd)) {
+ if (xport->peer) {
+ ofproto_dpif_monitor_port_send_soon(xport->ofport);
+ } else {
+ ofproto_dpif_monitor_port_send_soon_safe(xport->ofport);
+ }
+ }
}
return SLOW_BFD;
} else if (xport->xbundle && xport->xbundle->lacp