From f23d157c05649d369c5456e9a18bb47716306893 Mon Sep 17 00:00:00 2001 From: Joe Stringer Date: Fri, 13 Dec 2013 03:33:47 +0000 Subject: 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 Signed-off-by: Ethan Jackson Acked-by: Ethan Jackson --- lib/lacp.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/lacp.c') diff --git a/lib/lacp.c b/lib/lacp.c index fce65b31d..07f1e101a 100644 --- a/lib/lacp.c +++ b/lib/lacp.c @@ -18,12 +18,14 @@ #include +#include "connectivity.h" #include "dynamic-string.h" #include "hash.h" #include "hmap.h" #include "ofpbuf.h" #include "packets.h" #include "poll-loop.h" +#include "seq.h" #include "shash.h" #include "timer.h" #include "timeval.h" @@ -509,11 +511,16 @@ lacp_run(struct lacp *lacp, lacp_send_pdu *send_pdu) OVS_EXCLUDED(mutex) ovs_mutex_lock(&mutex); HMAP_FOR_EACH (slave, node, &lacp->slaves) { if (timer_expired(&slave->rx)) { + enum slave_status old_status = slave->status; + if (slave->status == LACP_CURRENT) { slave_set_expired(slave); } else if (slave->status == LACP_EXPIRED) { slave_set_defaulted(slave); } + if (slave->status != old_status) { + seq_change(connectivity_seq_get()); + } } } @@ -544,6 +551,7 @@ lacp_run(struct lacp *lacp, lacp_send_pdu *send_pdu) OVS_EXCLUDED(mutex) : LACP_SLOW_TIME_TX); timer_set_duration(&slave->tx, duration); + seq_change(connectivity_seq_get()); } } ovs_mutex_unlock(&mutex); -- cgit v1.2.1