Skip to content

zebra: add debug in route install around nhg not ready - #21265

Merged
ton31337 merged 1 commit into
FRRouting:masterfrom
chiragshah6:zdev
Mar 20, 2026
Merged

zebra: add debug in route install around nhg not ready#21265
ton31337 merged 1 commit into
FRRouting:masterfrom
chiragshah6:zdev

Conversation

@chiragshah6

@chiragshah6 chiragshah6 commented Mar 19, 2026

Copy link
Copy Markdown
Member

debug log:

2026/03/20 01:41:09.401823 ZEBRA: [ZSM84-3K06X] dplane_ctx_route_init
route 81.0.0.5/32 op ROUTE_UPDATE nhg id 225 flags 0x5 nh 27.0.0.1 if 4
vrfid 0 not installed nor queued

Tracepoint:

2026-03-20T01:35:06.111 frr_zebra:dplane_ctx_route_kernel_nhg_not_ready
{'op': 2, 'nhe_id': 141, 'nhe_flags': 515, 'vrf_id': 41}
2026-03-20T01:35:10.366 frr_zebra:dplane_ctx_route_kernel_nhg_not_ready
{'op': 2, 'nhe_id': 73529432, 'nhe_flags': 3, 'vrf_id': 31}
2026-03-20T01:35:10.366 frr_zebra:dplane_ctx_route_kernel_nhg_not_ready
{'op': 2, 'nhe_id': 73529444, 'nhe_flags': 3, 'vrf_id': 41}

@greptile-apps

greptile-apps Bot commented Mar 19, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds observability instrumentation to the zebra dataplane route install path β€” specifically for the case where a kernel nexthop group (NHG) is not yet installed or queued when a route install/update is attempted.

Changes:

  • zebra/zebra_dplane.c: Before returning ENOENT when a kernel NHG is not ready, a new frrtrace call fires the new LTTng tracepoint and a zlog_debug message (gated on IS_ZEBRA_DEBUG_DPLANE_DETAIL or IS_ZEBRA_DEBUG_RIB_DETAILED) logs the route node, operation, NHG id, NHG flags, and first nexthop to aid in diagnosing stalled route installs.
  • zebra/zebra_trace.h: Defines the new dplane_ctx_route_kernel_nhg_not_ready LTTng tracepoint with four scalar fields (op, nhe_id, nhe_flags, vrf_id). The tracepoint definition uses 4-space indentation instead of the tab indentation used by every other block in this file β€” since the file has a /* clang-format off */ guard, this won't be auto-corrected.

Confidence Score: 5/5

  • This PR is safe to merge; it adds debug/trace instrumentation only and does not change any control-flow logic.
  • The only functional change is adding a tracepoint call and a guarded debug log before an already-existing return ENOENT. No existing behavior is altered. The sole issue is a cosmetic indentation inconsistency in zebra_trace.h.
  • zebra/zebra_trace.h β€” indentation style inconsistency (spaces vs. tabs)

Important Files Changed

Filename Overview
zebra/zebra_dplane.c Adds an frrtrace call and a conditional zlog_debug log before returning ENOENT when a kernel NHG is not installed or queued. Logic is correct and consistent with surrounding debug patterns in the file.
zebra/zebra_trace.h Adds a new dplane_ctx_route_kernel_nhg_not_ready LTTng tracepoint with four scalar fields. The tracepoint definition is logically correct but uses 4-space indentation instead of the tab indentation used by all other tracepoint blocks in the file.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[dplane_ctx_route_init called\nop = INSTALL or UPDATE] --> B{HAVE_NETLINK?}
    B -- No --> E[Continue normal init]
    B -- Yes --> C{kernel_nexthops_enabled\nAND op is INSTALL/UPDATE?}
    C -- No --> E
    C -- Yes --> D{NHG installed\nOR queued?}
    D -- Yes --> E
    D -- No --> F["frrtrace(dplane_ctx_route_kernel_nhg_not_ready)\n[NEW]"]
    F --> G{"IS_ZEBRA_DEBUG_DPLANE_DETAIL\nOR IS_ZEBRA_DEBUG_RIB_DETAILED?\n[NEW]"}
    G -- Yes --> H["zlog_debug: route/op/nhg id/flags/nh\n[NEW]"]
    G -- No --> I[return ENOENT]
    H --> I
    E --> J[return AOK]
Loading
Prompt To Fix All With AI
This is a comment left during a code review.
Path: zebra/zebra_trace.h
Line: 465-479

Comment:
**Inconsistent indentation (spaces vs. tabs)**

The new `TRACEPOINT_EVENT` block uses 4-space indentation, while every other tracepoint event in this file uses tab indentation. Since the file has a `/* clang-format off */` directive at line 40, clang-format won't auto-correct this β€” the inconsistency will persist as-is. The block should use tabs to match the surrounding code.

```suggestion
TRACEPOINT_EVENT(
	frr_zebra,
	dplane_ctx_route_kernel_nhg_not_ready,
	TP_ARGS(
		enum dplane_op_e, op,
		uint32_t, nhe_id,
		uint32_t, nhe_flags,
		vrf_id_t, vrf_id),
	TP_FIELDS(
		ctf_integer(uint32_t, op, op)
		ctf_integer(uint32_t, nhe_id, nhe_id)
		ctf_integer(uint32_t, nhe_flags, nhe_flags)
		ctf_integer(vrf_id_t, vrf_id, vrf_id)
	)
)
```

How can I resolve this? If you propose a fix, please make it concise.

Last reviewed commit: "zebra: add debug rou..."

Comment thread zebra/zebra_trace.h Outdated
@chiragshah6
chiragshah6 force-pushed the zdev branch 2 times, most recently from 41fd620 to bd4091a Compare March 19, 2026 21:15
Ticket: #4929905

debug log:
2026/03/20 01:41:09.401823 ZEBRA: [ZSM84-3K06X] dplane_ctx_route_init
route 81.0.0.5/32 op ROUTE_UPDATE nhg id 225 flags 0x5 nh 27.0.0.1 if 4
vrfid 0 not installed nor queued

Tracepoint:

2026-03-20T01:35:06.111 frr_zebra:dplane_ctx_route_kernel_nhg_not_ready
{'op': 2, 'nhe_id': 141, 'nhe_flags': 515, 'vrf_id': 41}
2026-03-20T01:35:10.366 frr_zebra:dplane_ctx_route_kernel_nhg_not_ready
{'op': 2, 'nhe_id': 73529432, 'nhe_flags': 3, 'vrf_id': 31}
2026-03-20T01:35:10.366 frr_zebra:dplane_ctx_route_kernel_nhg_not_ready
{'op': 2, 'nhe_id': 73529444, 'nhe_flags': 3, 'vrf_id': 41}

Signed-off-by: Chirag Shah <chirag@nvidia.com>
@ton31337
ton31337 merged commit 1323200 into FRRouting:master Mar 20, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants