Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / include / uapi / linux / nexthop.h
blobbc49baf4a267f01e3344a7dba331b5281c809375
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef _UAPI_LINUX_NEXTHOP_H
3 #define _UAPI_LINUX_NEXTHOP_H
5 #include <linux/types.h>
7 struct nhmsg {
8 unsigned char nh_family;
9 unsigned char nh_scope; /* return only */
10 unsigned char nh_protocol; /* Routing protocol that installed nh */
11 unsigned char resvd;
12 unsigned int nh_flags; /* RTNH_F flags */
15 /* entry in a nexthop group */
16 struct nexthop_grp {
17 __u32 id; /* nexthop id - must exist */
18 __u8 weight; /* weight of this nexthop */
19 __u8 weight_high; /* high order bits of weight */
20 __u16 resvd2;
23 static inline __u16 nexthop_grp_weight(const struct nexthop_grp *entry)
25 return ((entry->weight_high << 8) | entry->weight) + 1;
28 enum {
29 NEXTHOP_GRP_TYPE_MPATH, /* hash-threshold nexthop group
30 * default type if not specified
32 NEXTHOP_GRP_TYPE_RES, /* resilient nexthop group */
33 __NEXTHOP_GRP_TYPE_MAX,
36 #define NEXTHOP_GRP_TYPE_MAX (__NEXTHOP_GRP_TYPE_MAX - 1)
38 #define NHA_OP_FLAG_DUMP_STATS BIT(0)
39 #define NHA_OP_FLAG_DUMP_HW_STATS BIT(1)
41 /* Response OP_FLAGS. */
42 #define NHA_OP_FLAG_RESP_GRP_RESVD_0 BIT(31) /* Dump clears resvd fields. */
44 enum {
45 NHA_UNSPEC,
46 NHA_ID, /* u32; id for nexthop. id == 0 means auto-assign */
48 NHA_GROUP, /* array of nexthop_grp */
49 NHA_GROUP_TYPE, /* u16 one of NEXTHOP_GRP_TYPE */
50 /* if NHA_GROUP attribute is added, no other attributes can be set */
52 NHA_BLACKHOLE, /* flag; nexthop used to blackhole packets */
53 /* if NHA_BLACKHOLE is added, OIF, GATEWAY, ENCAP can not be set */
55 NHA_OIF, /* u32; nexthop device */
56 NHA_GATEWAY, /* be32 (IPv4) or in6_addr (IPv6) gw address */
57 NHA_ENCAP_TYPE, /* u16; lwt encap type */
58 NHA_ENCAP, /* lwt encap data */
60 /* NHA_OIF can be appended to dump request to return only
61 * nexthops using given device
63 NHA_GROUPS, /* flag; only return nexthop groups in dump */
64 NHA_MASTER, /* u32; only return nexthops with given master dev */
66 NHA_FDB, /* flag; nexthop belongs to a bridge fdb */
67 /* if NHA_FDB is added, OIF, BLACKHOLE, ENCAP cannot be set */
69 /* nested; resilient nexthop group attributes */
70 NHA_RES_GROUP,
71 /* nested; nexthop bucket attributes */
72 NHA_RES_BUCKET,
74 /* u32; operation-specific flags */
75 NHA_OP_FLAGS,
77 /* nested; nexthop group stats */
78 NHA_GROUP_STATS,
80 /* u32; nexthop hardware stats enable */
81 NHA_HW_STATS_ENABLE,
83 /* u32; read-only; whether any driver collects HW stats */
84 NHA_HW_STATS_USED,
86 __NHA_MAX,
89 #define NHA_MAX (__NHA_MAX - 1)
91 enum {
92 NHA_RES_GROUP_UNSPEC,
93 /* Pad attribute for 64-bit alignment. */
94 NHA_RES_GROUP_PAD = NHA_RES_GROUP_UNSPEC,
96 /* u16; number of nexthop buckets in a resilient nexthop group */
97 NHA_RES_GROUP_BUCKETS,
98 /* clock_t as u32; nexthop bucket idle timer (per-group) */
99 NHA_RES_GROUP_IDLE_TIMER,
100 /* clock_t as u32; nexthop unbalanced timer */
101 NHA_RES_GROUP_UNBALANCED_TIMER,
102 /* clock_t as u64; nexthop unbalanced time */
103 NHA_RES_GROUP_UNBALANCED_TIME,
105 __NHA_RES_GROUP_MAX,
108 #define NHA_RES_GROUP_MAX (__NHA_RES_GROUP_MAX - 1)
110 enum {
111 NHA_RES_BUCKET_UNSPEC,
112 /* Pad attribute for 64-bit alignment. */
113 NHA_RES_BUCKET_PAD = NHA_RES_BUCKET_UNSPEC,
115 /* u16; nexthop bucket index */
116 NHA_RES_BUCKET_INDEX,
117 /* clock_t as u64; nexthop bucket idle time */
118 NHA_RES_BUCKET_IDLE_TIME,
119 /* u32; nexthop id assigned to the nexthop bucket */
120 NHA_RES_BUCKET_NH_ID,
122 __NHA_RES_BUCKET_MAX,
125 #define NHA_RES_BUCKET_MAX (__NHA_RES_BUCKET_MAX - 1)
127 enum {
128 NHA_GROUP_STATS_UNSPEC,
130 /* nested; nexthop group entry stats */
131 NHA_GROUP_STATS_ENTRY,
133 __NHA_GROUP_STATS_MAX,
136 #define NHA_GROUP_STATS_MAX (__NHA_GROUP_STATS_MAX - 1)
138 enum {
139 NHA_GROUP_STATS_ENTRY_UNSPEC,
141 /* u32; nexthop id of the nexthop group entry */
142 NHA_GROUP_STATS_ENTRY_ID,
144 /* uint; number of packets forwarded via the nexthop group entry */
145 NHA_GROUP_STATS_ENTRY_PACKETS,
147 /* uint; number of packets forwarded via the nexthop group entry in
148 * hardware
150 NHA_GROUP_STATS_ENTRY_PACKETS_HW,
152 __NHA_GROUP_STATS_ENTRY_MAX,
155 #define NHA_GROUP_STATS_ENTRY_MAX (__NHA_GROUP_STATS_ENTRY_MAX - 1)
157 #endif