Skip to content

Commit

Permalink
zebra: Modify show zebra dplane providers to give more data
Browse files Browse the repository at this point in the history
The show zebra dplane provider command was ommitting
the input and output queues to the dplane itself.
It would be nice to have this insight as well.

New output:
r1# show zebra dplane providers
dataplane Incoming Queue from Zebra: 100
Zebra dataplane providers:
  Kernel (1): in: 6, q: 0, q_max: 3, out: 6, q: 14, q_max: 3
  dplane_fpm_nl (2): in: 6, q: 10, q_max: 3, out: 6, q: 0, q_max: 3
dataplane Outgoing Queue to Zebra: 43
r1#

Signed-off-by: Donald Sharp <[email protected]>
  • Loading branch information
donaldsharp committed Aug 16, 2024
1 parent 9c2731a commit 7bb5cb7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
1 change: 1 addition & 0 deletions zebra/rib.h
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ extern int rib_add_gr_run(afi_t afi, vrf_id_t vrf_id, uint8_t proto,
uint8_t instance, time_t restart_time);

extern void zebra_vty_init(void);
extern uint32_t zebra_rib_dplane_results_count(void);

extern pid_t pid;

Expand Down
18 changes: 13 additions & 5 deletions zebra/zebra_dplane.c
Original file line number Diff line number Diff line change
Expand Up @@ -6114,12 +6114,14 @@ int dplane_show_provs_helper(struct vty *vty, bool detailed)
struct zebra_dplane_provider *prov;
uint64_t in, in_q, in_max, out, out_q, out_max;

vty_out(vty, "Zebra dataplane providers:\n");

DPLANE_LOCK();
prov = dplane_prov_list_first(&zdplane_info.dg_providers);
in = dplane_ctx_queue_count(&zdplane_info.dg_update_list);
DPLANE_UNLOCK();

vty_out(vty, "dataplane Incoming Queue from Zebra: %" PRIu64 "\n", in);
vty_out(vty, "Zebra dataplane providers:\n");

/* Show counters, useful info from each registered provider */
while (prov) {
dplane_provider_lock(prov);
Expand All @@ -6138,13 +6140,19 @@ int dplane_show_provs_helper(struct vty *vty, bool detailed)
out_max = atomic_load_explicit(&prov->dp_out_max,
memory_order_relaxed);

vty_out(vty, "%s (%u): in: %"PRIu64", q: %"PRIu64", q_max: %"PRIu64", out: %"PRIu64", q: %"PRIu64", q_max: %"PRIu64"\n",
prov->dp_name, prov->dp_id, in, in_q, in_max,
out, out_q, out_max);
vty_out(vty,
" %s (%u): in: %" PRIu64 ", q: %" PRIu64
", q_max: %" PRIu64 ", out: %" PRIu64 ", q: %" PRIu64
", q_max: %" PRIu64 "\n",
prov->dp_name, prov->dp_id, in, in_q, in_max, out,
out_q, out_max);

prov = dplane_prov_list_next(&zdplane_info.dg_providers, prov);
}

out = zebra_rib_dplane_results_count();
vty_out(vty, "dataplane Outgoing Queue to Zebra: %" PRIu64 "\n", out);

return CMD_SUCCESS;
}

Expand Down
11 changes: 11 additions & 0 deletions zebra/zebra_rib.c
Original file line number Diff line number Diff line change
Expand Up @@ -5019,6 +5019,17 @@ static int rib_dplane_results(struct dplane_ctx_list_head *ctxlist)
return 0;
}

uint32_t zebra_rib_dplane_results_count(void)
{
uint32_t count;

frr_with_mutex (&dplane_mutex) {
count = dplane_ctx_queue_count(&rib_dplane_q);
}

return count;
}

/*
* Ensure there are no empty slots in the route_info array.
* Every route type in zebra should be present there.
Expand Down

0 comments on commit 7bb5cb7

Please sign in to comment.