]> xenbits.xensource.com Git - people/aperard/linux.git/commitdiff
net: nexthop: Have all NH notifiers carry NH ID
authorPetr Machata <petrm@nvidia.com>
Fri, 8 Mar 2024 12:59:46 +0000 (13:59 +0100)
committerJakub Kicinski <kuba@kernel.org>
Mon, 11 Mar 2024 21:14:07 +0000 (14:14 -0700)
When sending the notifications to collect NH statistics for resilient
groups, the driver will need to know the nexthop IDs in individual buckets
to look up the right counter. To that end, move the nexthop ID from struct
nh_notifier_grp_entry_info to nh_notifier_single_info.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://lore.kernel.org/r/8f964cd50b1a56d3606ce7ab4c50354ae019c43b.1709901020.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/nexthop.h
net/ipv4/nexthop.c

index 7ec9cc80f11c724a7a6406c09880d5a382b77fee..7ca315ad500e7f4e8135a964e1c0cf48f0139436 100644 (file)
@@ -185,6 +185,7 @@ struct nh_notifier_single_info {
                __be32 ipv4;
                struct in6_addr ipv6;
        };
+       u32 id;
        u8 is_reject:1,
           is_fdb:1,
           has_encap:1;
@@ -192,7 +193,6 @@ struct nh_notifier_single_info {
 
 struct nh_notifier_grp_entry_info {
        u8 weight;
-       u32 id;
        struct nh_notifier_single_info nh;
 };
 
index aa1b36650282867e42eb99010e5881513db78f2b..73b849be65042acfd0650e49aa7233c7f6a51f2e 100644 (file)
@@ -104,6 +104,7 @@ __nh_notifier_single_info_init(struct nh_notifier_single_info *nh_info,
        else if (nh_info->gw_family == AF_INET6)
                nh_info->ipv6 = nhi->fib_nhc.nhc_gw.ipv6;
 
+       nh_info->id = nhi->nh_parent->id;
        nh_info->is_reject = nhi->reject_nh;
        nh_info->is_fdb = nhi->fdb_nh;
        nh_info->has_encap = !!nhi->fib_nhc.nhc_lwtstate;
@@ -150,7 +151,6 @@ static int nh_notifier_mpath_info_init(struct nh_notifier_info *info,
                struct nh_info *nhi;
 
                nhi = rtnl_dereference(nhge->nh->nh_info);
-               info->nh_grp->nh_entries[i].id = nhge->nh->id;
                info->nh_grp->nh_entries[i].weight = nhge->weight;
                __nh_notifier_single_info_init(&info->nh_grp->nh_entries[i].nh,
                                               nhi);