Skip to content

Commit

Permalink
net: nexthop: Add hardware statistics notifications
Browse files Browse the repository at this point in the history
Add hw_stats field to several notifier structures to communicate to the
drivers that HW statistics should be configured for nexthops within a given
group.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ido Schimmel authored and David S. Miller committed Mar 8, 2024
1 parent 95fedd7 commit 5877786
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/net/nexthop.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ struct nh_group {
bool resilient;
bool fdb_nh;
bool has_v4;
bool hw_stats;

struct nh_res_table __rcu *res_table;
struct nh_grp_entry nh_entries[] __counted_by(num_nh);
Expand Down Expand Up @@ -193,6 +194,7 @@ struct nh_notifier_grp_entry_info {
struct nh_notifier_grp_info {
u16 num_nh;
bool is_fdb;
bool hw_stats;
struct nh_notifier_grp_entry_info nh_entries[] __counted_by(num_nh);
};

Expand All @@ -206,6 +208,7 @@ struct nh_notifier_res_bucket_info {

struct nh_notifier_res_table_info {
u16 num_nh_buckets;
bool hw_stats;
struct nh_notifier_single_info nhs[] __counted_by(num_nh_buckets);
};

Expand Down
2 changes: 2 additions & 0 deletions net/ipv4/nexthop.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ static int nh_notifier_mpath_info_init(struct nh_notifier_info *info,

info->nh_grp->num_nh = num_nh;
info->nh_grp->is_fdb = nhg->fdb_nh;
info->nh_grp->hw_stats = nhg->hw_stats;

for (i = 0; i < num_nh; i++) {
struct nh_grp_entry *nhge = &nhg->nh_entries[i];
Expand Down Expand Up @@ -172,6 +173,7 @@ static int nh_notifier_res_table_info_init(struct nh_notifier_info *info,
return -ENOMEM;

info->nh_res_table->num_nh_buckets = num_nh_buckets;
info->nh_res_table->hw_stats = nhg->hw_stats;

for (i = 0; i < num_nh_buckets; i++) {
struct nh_res_bucket *bucket = &res_table->nh_buckets[i];
Expand Down

0 comments on commit 5877786

Please sign in to comment.