summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2017-11-13 03:18:49 -0500
committerQuentin Young <qlyoung@cumulusnetworks.com>2017-11-30 16:18:07 -0500
commitd0ad6d8e5f21f594102db115d429963e12398a9c (patch)
tree1f1c5c58839312e442f0c46e540a1269f361c021
parentb785b7addab8cdd124c14a7abdf7b6d7dca104c8 (diff)
bgpd: yield more when generating UPDATEs
In the same vein as the round-robin input commit, this re-adds logic for limiting the amount of time spent generating UPDATEs per generation cycle. Missed this when shifting around wpkt_quanta; prior to MT it limited both calls to write() as well as UPDATE generation.
-rw-r--r--bgpd/bgp_packet.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index d814d6eb99..fe633413c2 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -371,9 +371,14 @@ int bgp_generate_updgrp_packets(struct thread *thread)
struct stream *s;
struct peer_af *paf;
struct bpacket *next_pkt;
+ uint32_t wpq;
+ uint32_t generated = 0;
afi_t afi;
safi_t safi;
+ wpq = atomic_load_explicit(&peer->bgp->wpkt_quanta,
+ memory_order_relaxed);
+
/*
* The code beyond this part deals with update packets, proceed only
* if peer is Established and updates are not on hold (as part of
@@ -458,7 +463,7 @@ int bgp_generate_updgrp_packets(struct thread *thread)
bgp_writes_on(peer);
bpacket_queue_advance_peer(paf);
}
- } while (s);
+ } while (s && (++generated < wpq));
bgp_write_proceed_actions(peer);