#include "ofproto-dpif-ipfix.h"
#include "ofproto-dpif-sflow.h"
#include "ofproto-dpif-xlate.h"
+#include "ovs-rcu.h"
#include "packets.h"
#include "poll-loop.h"
#include "seq.h"
udpif_destroy(struct udpif *udpif)
{
udpif_set_threads(udpif, 0, 0);
- udpif_flush();
+ udpif_flush(udpif);
list_remove(&udpif->list_node);
latch_destroy(&udpif->exit_latch);
udpif_set_threads(struct udpif *udpif, size_t n_handlers,
size_t n_revalidators)
{
+ ovsrcu_quiesce_start();
+
/* Stop the old threads (if any). */
if (udpif->handlers &&
(udpif->n_handlers != n_handlers
xpthread_create(&udpif->dispatcher, NULL, udpif_dispatcher, udpif);
xpthread_create(&udpif->flow_dumper, NULL, udpif_flow_dumper, udpif);
}
+
+ ovsrcu_quiesce_end();
}
/* Waits for all ongoing upcall translations to complete. This ensures that
}
}
-/* Removes all flows from all datapaths. */
+/* Remove flows from a single datapath. */
void
-udpif_flush(void)
+udpif_flush(struct udpif *udpif)
+{
+ size_t n_handlers, n_revalidators;
+
+ n_handlers = udpif->n_handlers;
+ n_revalidators = udpif->n_revalidators;
+
+ udpif_set_threads(udpif, 0, 0);
+ dpif_flow_flush(udpif->dpif);
+ udpif_set_threads(udpif, n_handlers, n_revalidators);
+}
+
+/* Removes all flows from all datapaths. */
+static void
+udpif_flush_all_datapaths(void)
{
struct udpif *udpif;
LIST_FOR_EACH (udpif, list_node, &all_udpifs) {
- dpif_flow_flush(udpif->dpif);
+ udpif_flush(udpif);
}
}
+
\f
/* Destroys and deallocates 'upcall'. */
static void
void *aux OVS_UNUSED)
{
atomic_store(&enable_megaflows, false);
- udpif_flush();
+ udpif_flush_all_datapaths();
unixctl_command_reply(conn, "megaflows disabled");
}
void *aux OVS_UNUSED)
{
atomic_store(&enable_megaflows, true);
- udpif_flush();
+ udpif_flush_all_datapaths();
unixctl_command_reply(conn, "megaflows enabled");
}