Skip to content

nexthop: only iterate over l3 nexthops for aging - #478

Merged
rjarry merged 1 commit into
DPDK:mainfrom
rjarry:l3-nexthop-age
Jan 19, 2026
Merged

nexthop: only iterate over l3 nexthops for aging#478
rjarry merged 1 commit into
DPDK:mainfrom
rjarry:l3-nexthop-age

Conversation

@rjarry

@rjarry rjarry commented Jan 16, 2026

Copy link
Copy Markdown
Collaborator

The do_ageing() callback was using nexthop_iter() which iterates over the entire nexthop memory pool. This includes all nexthop types, even though aging only applies to L3 nexthops. The callback had to check the type and return early for non-L3 entries.

Instead, iterate directly over hash_by_addr which only contains L3 nexthops with an associated address. This avoids wasting cycles on nexthops that will never need aging.

Summary by CodeRabbit

  • Refactor
    • Optimized nexthop aging flow to be more efficient and reliable; internal aging callbacks now receive explicit context from the caller. No changes to public APIs or external behavior.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 16, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The ageing callback in the nexthop control module is refactored: it is renamed from nexthop_ageing_cb to l3_age and its second parameter changes from void* to struct nexthop_info_l3*. The callback no longer performs internal type checking or l3 data retrieval; callers must provide the l3 context. do_ageing is updated to iterate hash_by_addr directly, skip static nexthops, and invoke the callback with the prepared l3 context, moving context preparation out of the callback.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@aharivel aharivel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a clean optimization - good to merge as-is.

The do_ageing() callback was using nexthop_iter() which iterates over
the entire nexthop memory pool. This includes all nexthop types, even
though aging only applies to L3 nexthops. The callback had to check the
type and return early for non-L3 entries.

Instead, iterate directly over hash_by_addr which only contains L3
nexthops with an associated address. This avoids wasting cycles on
nexthops that will never need aging.

Signed-off-by: Robin Jarry <rjarry@redhat.com>
Reviewed-by: Anthony Harivel <aharivel@redhat.com>
@rjarry
rjarry merged commit 1495cd6 into DPDK:main Jan 19, 2026
6 checks passed
@rjarry
rjarry deleted the l3-nexthop-age branch January 19, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants