]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: re-add update-group write triggers
authorQuentin Young <qlyoung@cumulusnetworks.com>
Mon, 12 Jun 2017 20:20:50 +0000 (20:20 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 30 Nov 2017 21:18:03 +0000 (16:18 -0500)
Removed in earlier version where the I/O pthread busy-waited for packets
to be posted to an output queue. Now that it's poll()-based, it's
necessary once again. Although this time we can say what we're actually
doing instead of a side effect of a write job.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
bgpd/bgp_updgrp.c
bgpd/bgp_updgrp.h
bgpd/bgp_updgrp_adv.c
bgpd/bgp_updgrp_packet.c

index 585c6cebbce9f14ec9b27a14ca60f1c3b8ae4435..a45353b375d09bfc40d4afec3a934df7b168a75f 100644 (file)
@@ -53,6 +53,7 @@
 #include "bgpd/bgp_updgrp.h"
 #include "bgpd/bgp_route.h"
 #include "bgpd/bgp_filter.h"
+#include "bgpd/bgp_io.h"
 
 /********************
  * PRIVATE FUNCTIONS
@@ -1867,6 +1868,21 @@ void peer_af_announce_route(struct peer_af *paf, int combine)
                            subgrp->peer_count - 1);
 }
 
+void subgroup_trigger_write(struct update_subgroup *subgrp)
+{
+       struct peer_af *paf;
+
+       /* For each peer in the subgroup, schedule a job to pull packets from
+        * the
+        * subgroup output queue into their own output queue. This action will
+        * trigger a write job on the I/O thread. */
+       SUBGRP_FOREACH_PEER(subgrp, paf)
+       if (paf->peer->status == Established)
+               thread_add_timer_msec(bm->master, bgp_generate_updgrp_packets,
+                                     paf->peer, 0,
+                                     &paf->peer->t_generate_updgrp_packets);
+}
+
 int update_group_clear_update_dbg(struct update_group *updgrp, void *arg)
 {
        UPDGRP_PEER_DBG_OFF(updgrp);
index 3e503a8be7404cf0345bcc41fdd3d68ce81e6067..97afe7a11afe9d62f5832a5d8f69e31aaba0405e 100644 (file)
@@ -442,6 +442,7 @@ extern void bgp_adj_out_unset_subgroup(struct bgp_node *rn,
                                       char withdraw, u_int32_t addpath_tx_id);
 void subgroup_announce_table(struct update_subgroup *subgrp,
                             struct bgp_table *table);
+extern void subgroup_trigger_write(struct update_subgroup *subgrp);
 
 extern int update_group_clear_update_dbg(struct update_group *updgrp,
                                         void *arg);
index 1ec9915ee561bee39ff131f935a158ef23a9d278..705cb152f0c12a48d896b644b6ea076ea625fe46 100644 (file)
@@ -483,6 +483,7 @@ void bgp_adj_out_unset_subgroup(struct bgp_node *rn,
 {
        struct bgp_adj_out *adj;
        struct bgp_advertise *adv;
+       bool trigger_write;
 
        if (DISABLE_BGP_ANNOUNCE)
                return;
@@ -500,9 +501,16 @@ void bgp_adj_out_unset_subgroup(struct bgp_node *rn,
                        adv->rn = rn;
                        adv->adj = adj;
 
+                       /* Note if we need to trigger a packet write */
+                       trigger_write =
+                               BGP_ADV_FIFO_EMPTY(&subgrp->sync->withdraw);
+
                        /* Add to synchronization entry for withdraw
                         * announcement.  */
                        BGP_ADV_FIFO_ADD(&subgrp->sync->withdraw, &adv->fifo);
+
+                       if (trigger_write)
+                               subgroup_trigger_write(subgrp);
                } else {
                        /* Remove myself from adjacency. */
                        BGP_ADJ_OUT_DEL(rn, adj);
index 77b3ce1937df5a59c27c0dd9d60ba2c5cbd9b6fb..de4a85ca249f1705dffe9eb21c86b55e6b68f6f3 100644 (file)
@@ -1148,6 +1148,7 @@ void subgroup_default_update_packet(struct update_subgroup *subgrp,
        bgp_packet_set_size(s);
 
        (void)bpacket_queue_add(SUBGRP_PKTQ(subgrp), s, &vecarr);
+       subgroup_trigger_write(subgrp);
 }
 
 void subgroup_default_withdraw_packet(struct update_subgroup *subgrp)
@@ -1240,6 +1241,7 @@ void subgroup_default_withdraw_packet(struct update_subgroup *subgrp)
        bgp_packet_set_size(s);
 
        (void)bpacket_queue_add(SUBGRP_PKTQ(subgrp), s, NULL);
+       subgroup_trigger_write(subgrp);
 }
 
 static void