include: Copy over new nexthop.h

Time to upgrade features of linux to have newer versions
of the nexthop.h from linux.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2025-08-29 20:31:42 -04:00
parent 3c0c39f428
commit 7e5e407a0c

View file

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _UAPI_LINUX_NEXTHOP_H
#define _UAPI_LINUX_NEXTHOP_H
#ifndef _LINUX_NEXTHOP_H
#define _LINUX_NEXTHOP_H
#include <linux/types.h>
@ -16,10 +16,15 @@ struct nhmsg {
struct nexthop_grp {
__u32 id; /* nexthop id - must exist */
__u8 weight; /* weight of this nexthop */
__u8 resvd1;
__u8 weight_high; /* high order bits of weight */
__u16 resvd2;
};
static __inline__ __u16 nexthop_grp_weight(const struct nexthop_grp *entry)
{
return ((entry->weight_high << 8) | entry->weight) + 1;
}
enum {
NEXTHOP_GRP_TYPE_MPATH, /* hash-threshold nexthop group
* default type if not specified
@ -30,6 +35,12 @@ enum {
#define NEXTHOP_GRP_TYPE_MAX (__NEXTHOP_GRP_TYPE_MAX - 1)
#define NHA_OP_FLAG_DUMP_STATS BIT(0)
#define NHA_OP_FLAG_DUMP_HW_STATS BIT(1)
/* Response OP_FLAGS. */
#define NHA_OP_FLAG_RESP_GRP_RESVD_0 BIT(31) /* Dump clears resvd fields. */
enum {
NHA_UNSPEC,
NHA_ID, /* u32; id for nexthop. id == 0 means auto-assign */
@ -60,6 +71,18 @@ enum {
/* nested; nexthop bucket attributes */
NHA_RES_BUCKET,
/* u32; operation-specific flags */
NHA_OP_FLAGS,
/* nested; nexthop group stats */
NHA_GROUP_STATS,
/* u32; nexthop hardware stats enable */
NHA_HW_STATS_ENABLE,
/* u32; read-only; whether any driver collects HW stats */
NHA_HW_STATS_USED,
__NHA_MAX,
};
@ -101,4 +124,34 @@ enum {
#define NHA_RES_BUCKET_MAX (__NHA_RES_BUCKET_MAX - 1)
enum {
NHA_GROUP_STATS_UNSPEC,
/* nested; nexthop group entry stats */
NHA_GROUP_STATS_ENTRY,
__NHA_GROUP_STATS_MAX,
};
#define NHA_GROUP_STATS_MAX (__NHA_GROUP_STATS_MAX - 1)
enum {
NHA_GROUP_STATS_ENTRY_UNSPEC,
/* u32; nexthop id of the nexthop group entry */
NHA_GROUP_STATS_ENTRY_ID,
/* uint; number of packets forwarded via the nexthop group entry */
NHA_GROUP_STATS_ENTRY_PACKETS,
/* uint; number of packets forwarded via the nexthop group entry in
* hardware
*/
NHA_GROUP_STATS_ENTRY_PACKETS_HW,
__NHA_GROUP_STATS_ENTRY_MAX,
};
#define NHA_GROUP_STATS_ENTRY_MAX (__NHA_GROUP_STATS_ENTRY_MAX - 1)
#endif