summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas.abraitis@gmail.com>2020-03-31 09:19:08 +0300
committerGitHub <noreply@github.com>2020-03-31 09:19:08 +0300
commit2349b827e5bf018b637f14f96bdcc5555fbcdbc0 (patch)
tree9ae7d1a8663799415fc7fcd47090c21223778d9d
parent22ee2a88a0f42279e9c2e2011455f252586410d3 (diff)
parent43aa59653862fbbed0e1ccb813a23444be57acaa (diff)
Merge pull request #6118 from qlyoung/display-ibuf-count
bgpd: display ingress packet queue size
-rw-r--r--bgpd/bgp_vty.c51
1 files changed, 41 insertions, 10 deletions
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index aea6dbbf4e..a35bfe47ed 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -9036,11 +9036,20 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
json_object_int_add(json_peer, "msgSent",
PEER_TOTAL_TX(peer));
+ atomic_size_t outq_count, inq_count;
+ outq_count = atomic_load_explicit(
+ &peer->obuf->count,
+ memory_order_relaxed);
+ inq_count = atomic_load_explicit(
+ &peer->ibuf->count,
+ memory_order_relaxed);
+
json_object_int_add(json_peer, "tableVersion",
peer->version[afi][safi]);
json_object_int_add(json_peer, "outq",
- peer->obuf->count);
- json_object_int_add(json_peer, "inq", 0);
+ outq_count);
+ json_object_int_add(json_peer, "inq",
+ inq_count);
peer_uptime(peer->uptime, timebuf, BGP_UPTIME_LEN,
use_json, json_peer);
@@ -9122,12 +9131,21 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
vty_out(vty, "%*s", max_neighbor_width - len,
" ");
+ atomic_size_t outq_count, inq_count;
+ outq_count = atomic_load_explicit(
+ &peer->obuf->count,
+ memory_order_relaxed);
+ inq_count = atomic_load_explicit(
+ &peer->ibuf->count,
+ memory_order_relaxed);
+
vty_out(vty,
- "4 %10u %9u %9u %8" PRIu64 " %4d %4zu %8s",
+ "4 %10u %9u %9u %8" PRIu64
+ " %4zu %4zu %8s",
peer->as, PEER_TOTAL_RX(peer),
PEER_TOTAL_TX(peer),
- peer->version[afi][safi], 0,
- peer->obuf->count,
+ peer->version[afi][safi], inq_count,
+ outq_count,
peer_uptime(peer->uptime, timebuf,
BGP_UPTIME_LEN, 0, NULL));
@@ -11711,9 +11729,17 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
json_object *json_stat = NULL;
json_stat = json_object_new_object();
/* Packet counts. */
- json_object_int_add(json_stat, "depthInq", 0);
+
+ atomic_size_t outq_count, inq_count;
+ outq_count = atomic_load_explicit(&p->obuf->count,
+ memory_order_relaxed);
+ inq_count = atomic_load_explicit(&p->ibuf->count,
+ memory_order_relaxed);
+
+ json_object_int_add(json_stat, "depthInq",
+ (unsigned long)inq_count);
json_object_int_add(json_stat, "depthOutq",
- (unsigned long)p->obuf->count);
+ (unsigned long)outq_count);
json_object_int_add(json_stat, "opensSent",
atomic_load_explicit(&p->open_out,
memory_order_relaxed));
@@ -11754,11 +11780,16 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
json_object_int_add(json_stat, "totalRecv", PEER_TOTAL_RX(p));
json_object_object_add(json_neigh, "messageStats", json_stat);
} else {
+ atomic_size_t outq_count, inq_count;
+ outq_count = atomic_load_explicit(&p->obuf->count,
+ memory_order_relaxed);
+ inq_count = atomic_load_explicit(&p->ibuf->count,
+ memory_order_relaxed);
+
/* Packet counts. */
vty_out(vty, " Message statistics:\n");
- vty_out(vty, " Inq depth is 0\n");
- vty_out(vty, " Outq depth is %lu\n",
- (unsigned long)p->obuf->count);
+ vty_out(vty, " Inq depth is %zu\n", inq_count);
+ vty_out(vty, " Outq depth is %zu\n", outq_count);
vty_out(vty, " Sent Rcvd\n");
vty_out(vty, " Opens: %10d %10d\n",
atomic_load_explicit(&p->open_out,