summaryrefslogtreecommitdiff
path: root/lib/bfd.c
diff options
context:
space:
mode:
authorJoe Stringer <joestringer@nicira.com>2013-12-13 03:33:47 +0000
committerEthan Jackson <ethan@nicira.com>2013-12-12 15:03:50 -0800
commitf23d157c05649d369c5456e9a18bb47716306893 (patch)
tree2fe9b12007b6a0a5ed840e275e372346bb8ed65b /lib/bfd.c
parentda4a619179d6d6e9e6a82977c41cfcc2d1533ad8 (diff)
downloadopenvswitch-f23d157c05649d369c5456e9a18bb47716306893.tar.gz
ofproto-dpif: Don't poll ports when nothing changes
Previously, as part of ofproto-dpif run() processing, we would loop through all ports and poll for changes to carrier, bfd, cfm and lacp status. This information is used to determine whether bundles may be enabled, and to perform revalidation when needed. This patch makes the bfd, cfm, lacp and stp modules aware of the new global connectivity_seq, notifying on changes in port status. We can then use connectivity_seq to check if anything has changed before looping through all ports in ofproto-dpif. In a test environment of 5000 internal ports and 50 tunnel ports with bfd, this reduces average CPU usage of the main thread from about 35% to about 25%. Signed-off-by: Joe Stringer <joestringer@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
Diffstat (limited to 'lib/bfd.c')
-rw-r--r--lib/bfd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/bfd.c b/lib/bfd.c
index 1df5acd05..5ac20d6df 100644
--- a/lib/bfd.c
+++ b/lib/bfd.c
@@ -21,6 +21,7 @@
#include <netinet/ip.h>
#include "byte-order.h"
+#include "connectivity.h"
#include "csum.h"
#include "dpif.h"
#include "dynamic-string.h"
@@ -37,6 +38,7 @@
#include "packets.h"
#include "poll-loop.h"
#include "random.h"
+#include "seq.h"
#include "smap.h"
#include "timeval.h"
#include "unaligned.h"
@@ -505,8 +507,8 @@ bfd_run(struct bfd *bfd) OVS_EXCLUDED(mutex)
if (bfd->state > STATE_DOWN && now >= bfd->detect_time) {
bfd_set_state(bfd, STATE_DOWN, DIAG_EXPIRED);
- bfd_forwarding__(bfd);
}
+ bfd_forwarding__(bfd);
/* Decay may only happen when state is STATE_UP, bfd->decay_min_rx is
* configured, and decay_detect_time is reached. */
@@ -851,6 +853,7 @@ bfd_forwarding__(struct bfd *bfd) OVS_REQUIRES(mutex)
&& bfd->rmt_diag != DIAG_RCPATH_DOWN;
if (bfd->last_forwarding != last_forwarding) {
bfd->flap_count++;
+ seq_change(connectivity_seq_get());
}
return bfd->last_forwarding;
}
@@ -1052,6 +1055,8 @@ bfd_set_state(struct bfd *bfd, enum state state, enum diag diag)
if (bfd->state == STATE_UP && bfd->decay_min_rx) {
bfd_decay_update(bfd);
}
+
+ seq_change(connectivity_seq_get());
}
}