Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions frr/if_grout.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ void grout_link_change(struct gr_iface *gr_if, bool new, bool startup) {
dplane_ctx_set_op(ctx, DPLANE_OP_INTF_INSTALL);
dplane_ctx_set_status(ctx, ZEBRA_DPLANE_REQUEST_QUEUED);
dplane_ctx_set_ifp_mtu(ctx, gr_if->base.mtu);
dplane_ctx_set_ifp_speed_set(ctx, true);
dplane_ctx_set_ifp_speed(ctx, gr_if->base.speed);

// no bridge support in grout
dplane_ctx_set_ifp_bridge_ifindex(ctx, IFINDEX_INTERNAL);
Expand Down
5 changes: 5 additions & 0 deletions frr/zebra_dplane_grout.c
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,11 @@ static enum zebra_dplane_result zd_grout_process_update(struct zebra_dplane_ctx
case DPLANE_OP_SRV6_ENCAP_SRCADDR_SET:
return grout_set_sr_tunsrc(ctx);

case DPLANE_OP_INTF_SPEED_GET:
// Workaround: return fail INTF_SPEED_GET to stop zebra from repeatedly polling.
// Speed is already provided via INTF_INSTALL/UPDATE.
return ZEBRA_DPLANE_REQUEST_FAILURE;

case DPLANE_OP_NONE:
return ZEBRA_DPLANE_REQUEST_SUCCESS;

Expand Down
9 changes: 8 additions & 1 deletion subprojects/frr.wrap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ url = https://github.com/FRRouting/frr
revision = frr-10.5.0
depth = 1
diff_files =
frr/meson-add-dependency-definition.patch
frr/meson-add-dependency-definition.patch,
frr/0001-zebra-Track-the-number-of-times-that-the-intf-speed-.patch,
frr/0002-zebra-Allow-bonds-to-refigure-speed.patch,
frr/0003-zebra-add-dplane-helpers-provide-interface-speed.patch,
frr/0004-zebra-kernel-get_speed-take-vrf_id-and-ifname-as-par.patch,
frr/0005-zebra-get-interface-speed-from-dataplane-via-ethtool.patch,
frr/0006-zebra-schedule-speed-query-timer-only-when-the-inter.patch,
frr/0007-zebra-skip-kernel-provider-work-when-skip_kernel-is-.patch

[provide]
dependency_names = frr
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
From afdf8a3574fac4b3e075d0f1f29b76914562b240 Mon Sep 17 00:00:00 2001
From: Donald Sharp <sharpd@nvidia.com>
Date: Wed, 22 Oct 2025 11:04:43 -0400
Subject: [PATCH 1/7] zebra: Track the number of times that the intf speed was
checked

Adding a json value to `show int X json` to allow us to get the
number of times that the speed was checked.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
---
zebra/interface.c | 5 +++++
zebra/interface.h | 1 +
2 files changed, 6 insertions(+)

diff --git a/zebra/interface.c b/zebra/interface.c
index 52c2619eed..e1fd092532 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -68,6 +68,8 @@ static void if_zebra_speed_update(struct event *thread)
bool changed = false;
int error = 0;

+ zif->speed_checked++;
+
new_speed = kernel_get_speed(ifp, &error);

/* error may indicate vrf not available or
@@ -164,6 +166,7 @@ static int if_zebra_new_hook(struct interface *ifp)
* down upon startup.
*/
zebra_if->speed_update_count = 0;
+ zebra_if->speed_checked = 0;
event_add_timer(zrouter.master, if_zebra_speed_update, ifp, 15,
&zebra_if->speed_update);
event_ignore_late_timer(zebra_if->speed_update);
@@ -3027,6 +3030,8 @@ static void if_dump_vty_json(struct vty *vty, struct interface *ifp,
json_object_string_add(json_if, "shutdownConfig", if_zebra_data_state(zebra_if->shutdown));

json_object_string_add(json_if, "mplsConfig", if_zebra_data_state(zebra_if->mpls_config));
+ json_object_int_add(json_if, "speedChecked", zebra_if->speed_checked);
+

if (ifp->ifindex == IFINDEX_INTERNAL) {
json_object_boolean_add(json_if, "pseudoInterface", true);
diff --git a/zebra/interface.h b/zebra/interface.h
index fca170aee4..98d0dcb325 100644
--- a/zebra/interface.h
+++ b/zebra/interface.h
@@ -207,6 +207,7 @@ struct zebra_if {

uint8_t speed_update_count;
struct event *speed_update;
+ uint32_t speed_checked;

/*
* Does this interface have a v6 to v4 ll neighbor entry
--
2.43.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
From 717719db35310c7f8b1398d335a42d76a143f0f1 Mon Sep 17 00:00:00 2001
From: Donald Sharp <sharpd@nvidia.com>
Date: Wed, 22 Oct 2025 13:40:33 -0400
Subject: [PATCH 2/7] zebra: Allow bonds to refigure speed

When a member of a bond goes down, notice
that this has happened and schedule a interface
speed update. This will allow the interface
speed to stay accurate to some extent.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
---
zebra/interface.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)

diff --git a/zebra/interface.c b/zebra/interface.c
index e1fd092532..100e6c10fc 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -911,6 +911,25 @@ static void if_down_del_nbr_connected(struct interface *ifp)
}
}

+static void if_handle_bond_speed_change(struct interface *ifp)
+{
+ struct zebra_if *zif = ifp->info;
+ struct zebra_l2info_bondslave *part_of_bond;
+
+ if (!IS_ZEBRA_IF_BOND_SLAVE(ifp))
+ return;
+
+ part_of_bond = &zif->bondslave_info;
+
+ if (part_of_bond->bond_if) {
+ zif = part_of_bond->bond_if->info;
+
+ if (!event_is_scheduled(zif->speed_update))
+ event_add_timer(zrouter.master, if_zebra_speed_update, part_of_bond->bond_if, 1,
+ &zif->speed_update);
+ }
+}
+
/* Interface is up. */
void if_up(struct interface *ifp, bool install_connected)
{
@@ -975,6 +994,8 @@ void if_up(struct interface *ifp, bool install_connected)

if_addr_wakeup(ifp);

+ if_handle_bond_speed_change(ifp);
+
rib_update_handle_vrf_all(RIB_UPDATE_KERNEL, ZEBRA_ROUTE_KERNEL);
}

@@ -1027,6 +1048,8 @@ void if_down(struct interface *ifp)
/* Delete all neighbor addresses learnt through IPv6 RA */
if_down_del_nbr_connected(ifp);

+ if_handle_bond_speed_change(ifp);
+
rib_update_handle_vrf_all(RIB_UPDATE_INTERFACE_DOWN, ZEBRA_ROUTE_KERNEL);
}

--
2.43.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
From ff6bb34486de63def948902cde22d222eaf88592 Mon Sep 17 00:00:00 2001
From: Maxime Leroy <maxime@leroys.fr>
Date: Thu, 14 Aug 2025 12:07:19 +0200
Subject: [PATCH 3/7] zebra: add dplane helpers provide interface speed

Add dplane ctx helpers to carry interface speed.

Signed-off-by: Maxime Leroy <maxime@leroys.fr>
---
zebra/interface.c | 12 +++++++++---
zebra/zebra_dplane.c | 31 +++++++++++++++++++++++++++++++
zebra/zebra_dplane.h | 4 ++++
3 files changed, 44 insertions(+), 3 deletions(-)

diff --git a/zebra/interface.c b/zebra/interface.c
index 100e6c10fc..f128b5f422 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -1950,8 +1950,8 @@ static void zebra_if_dplane_ifp_handling(struct zebra_dplane_ctx *ctx)
uint32_t mtu;
ns_id_t link_nsid;
struct zebra_if *zif;
- bool protodown, protodown_set, startup;
- uint32_t rc_bitfield;
+ bool protodown, protodown_set, startup, speed_set;
+ uint32_t rc_bitfield, speed;
uint8_t old_hw_addr[INTERFACE_HWADDR_MAX];
char *desc;
uint8_t family;
@@ -1976,6 +1976,8 @@ static void zebra_if_dplane_ifp_handling(struct zebra_dplane_ctx *ctx)
startup = dplane_ctx_get_ifp_startup(ctx);
desc = dplane_ctx_get_ifp_desc(ctx);
family = dplane_ctx_get_ifp_family(ctx);
+ speed_set = dplane_ctx_get_ifp_speed_set(ctx);
+ speed = dplane_ctx_get_ifp_speed(ctx);

#ifndef AF_BRIDGE
/*
@@ -2011,7 +2013,9 @@ static void zebra_if_dplane_ifp_handling(struct zebra_dplane_ctx *ctx)
if_update_state_mtu(ifp, mtu);
if_update_state_mtu6(ifp, mtu);
if_update_state_metric(ifp, 0);
- if_update_state_speed(ifp, kernel_get_speed(ifp, NULL));
+ if (!speed_set)
+ speed = kernel_get_speed(ifp, NULL);
+ if_update_state_speed(ifp, speed);
ifp->ptm_status = ZEBRA_PTM_STATUS_UNKNOWN;
ifp->txqlen = dplane_ctx_get_intf_txqlen(ctx);

@@ -2087,6 +2091,8 @@ static void zebra_if_dplane_ifp_handling(struct zebra_dplane_ctx *ctx)
if_update_state_mtu(ifp, mtu);
if_update_state_mtu6(ifp, mtu);
if_update_state_metric(ifp, 0);
+ if (speed_set)
+ if_update_state_speed(ifp, speed);
ifp->txqlen = dplane_ctx_get_intf_txqlen(ctx);

/*
diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c
index 06d5d04d7f..40ea590e14 100644
--- a/zebra/zebra_dplane.c
+++ b/zebra/zebra_dplane.c
@@ -235,6 +235,9 @@ struct dplane_intf_info {
uint32_t metric;
uint32_t flags;

+ bool speed_set;
+ uint32_t speed;
+
bool protodown;
bool protodown_set;
bool pd_reason_val;
@@ -1780,6 +1783,34 @@ void dplane_ctx_set_ifp_zif_type(struct zebra_dplane_ctx *ctx,
ctx->u.intf.zif_type = zif_type;
}

+void dplane_ctx_set_ifp_speed_set(struct zebra_dplane_ctx *ctx, bool set)
+{
+ DPLANE_CTX_VALID(ctx);
+
+ ctx->u.intf.speed_set = set;
+}
+
+bool dplane_ctx_get_ifp_speed_set(const struct zebra_dplane_ctx *ctx)
+{
+ DPLANE_CTX_VALID(ctx);
+
+ return ctx->u.intf.speed_set;
+}
+
+void dplane_ctx_set_ifp_speed(struct zebra_dplane_ctx *ctx, uint32_t speed)
+{
+ DPLANE_CTX_VALID(ctx);
+
+ ctx->u.intf.speed = speed;
+}
+
+uint32_t dplane_ctx_get_ifp_speed(const struct zebra_dplane_ctx *ctx)
+{
+ DPLANE_CTX_VALID(ctx);
+
+ return ctx->u.intf.speed;
+}
+
void dplane_ctx_set_ifname(struct zebra_dplane_ctx *ctx, const char *ifname)
{
DPLANE_CTX_VALID(ctx);
diff --git a/zebra/zebra_dplane.h b/zebra/zebra_dplane.h
index dd8a69e7db..cf1f70843e 100644
--- a/zebra/zebra_dplane.h
+++ b/zebra/zebra_dplane.h
@@ -435,6 +435,10 @@ uint8_t dplane_ctx_get_ifp_family(const struct zebra_dplane_ctx *ctx);
struct zebra_vxlan_vni_array;
void dplane_ctx_set_ifp_vxlan_vni_array(struct zebra_dplane_ctx *ctx,
struct zebra_vxlan_vni_array *vniarray);
+void dplane_ctx_set_ifp_speed_set(struct zebra_dplane_ctx *ctx, bool set);
+bool dplane_ctx_get_ifp_speed_set(const struct zebra_dplane_ctx *ctx);
+void dplane_ctx_set_ifp_speed(struct zebra_dplane_ctx *ctx, uint32_t speed);
+uint32_t dplane_ctx_get_ifp_speed(const struct zebra_dplane_ctx *ctx);

/*
* These defines mirror the values for bridge values in linux
--
2.43.0

Loading
Loading