Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 #ifndef _UAPI_LINUX_NEXTHOP_H
0003 #define _UAPI_LINUX_NEXTHOP_H
0004 
0005 #include <linux/types.h>
0006 
0007 struct nhmsg {
0008     unsigned char   nh_family;
0009     unsigned char   nh_scope;     /* return only */
0010     unsigned char   nh_protocol;  /* Routing protocol that installed nh */
0011     unsigned char   resvd;
0012     unsigned int    nh_flags;     /* RTNH_F flags */
0013 };
0014 
0015 /* entry in a nexthop group */
0016 struct nexthop_grp {
0017     __u32   id;   /* nexthop id - must exist */
0018     __u8    weight;   /* weight of this nexthop */
0019     __u8    resvd1;
0020     __u16   resvd2;
0021 };
0022 
0023 enum {
0024     NEXTHOP_GRP_TYPE_MPATH,  /* hash-threshold nexthop group
0025                   * default type if not specified
0026                   */
0027     NEXTHOP_GRP_TYPE_RES,    /* resilient nexthop group */
0028     __NEXTHOP_GRP_TYPE_MAX,
0029 };
0030 
0031 #define NEXTHOP_GRP_TYPE_MAX (__NEXTHOP_GRP_TYPE_MAX - 1)
0032 
0033 enum {
0034     NHA_UNSPEC,
0035     NHA_ID,     /* u32; id for nexthop. id == 0 means auto-assign */
0036 
0037     NHA_GROUP,  /* array of nexthop_grp */
0038     NHA_GROUP_TYPE, /* u16 one of NEXTHOP_GRP_TYPE */
0039     /* if NHA_GROUP attribute is added, no other attributes can be set */
0040 
0041     NHA_BLACKHOLE,  /* flag; nexthop used to blackhole packets */
0042     /* if NHA_BLACKHOLE is added, OIF, GATEWAY, ENCAP can not be set */
0043 
0044     NHA_OIF,    /* u32; nexthop device */
0045     NHA_GATEWAY,    /* be32 (IPv4) or in6_addr (IPv6) gw address */
0046     NHA_ENCAP_TYPE, /* u16; lwt encap type */
0047     NHA_ENCAP,  /* lwt encap data */
0048 
0049     /* NHA_OIF can be appended to dump request to return only
0050      * nexthops using given device
0051      */
0052     NHA_GROUPS, /* flag; only return nexthop groups in dump */
0053     NHA_MASTER, /* u32;  only return nexthops with given master dev */
0054 
0055     NHA_FDB,    /* flag; nexthop belongs to a bridge fdb */
0056     /* if NHA_FDB is added, OIF, BLACKHOLE, ENCAP cannot be set */
0057 
0058     /* nested; resilient nexthop group attributes */
0059     NHA_RES_GROUP,
0060     /* nested; nexthop bucket attributes */
0061     NHA_RES_BUCKET,
0062 
0063     __NHA_MAX,
0064 };
0065 
0066 #define NHA_MAX (__NHA_MAX - 1)
0067 
0068 enum {
0069     NHA_RES_GROUP_UNSPEC,
0070     /* Pad attribute for 64-bit alignment. */
0071     NHA_RES_GROUP_PAD = NHA_RES_GROUP_UNSPEC,
0072 
0073     /* u16; number of nexthop buckets in a resilient nexthop group */
0074     NHA_RES_GROUP_BUCKETS,
0075     /* clock_t as u32; nexthop bucket idle timer (per-group) */
0076     NHA_RES_GROUP_IDLE_TIMER,
0077     /* clock_t as u32; nexthop unbalanced timer */
0078     NHA_RES_GROUP_UNBALANCED_TIMER,
0079     /* clock_t as u64; nexthop unbalanced time */
0080     NHA_RES_GROUP_UNBALANCED_TIME,
0081 
0082     __NHA_RES_GROUP_MAX,
0083 };
0084 
0085 #define NHA_RES_GROUP_MAX   (__NHA_RES_GROUP_MAX - 1)
0086 
0087 enum {
0088     NHA_RES_BUCKET_UNSPEC,
0089     /* Pad attribute for 64-bit alignment. */
0090     NHA_RES_BUCKET_PAD = NHA_RES_BUCKET_UNSPEC,
0091 
0092     /* u16; nexthop bucket index */
0093     NHA_RES_BUCKET_INDEX,
0094     /* clock_t as u64; nexthop bucket idle time */
0095     NHA_RES_BUCKET_IDLE_TIME,
0096     /* u32; nexthop id assigned to the nexthop bucket */
0097     NHA_RES_BUCKET_NH_ID,
0098 
0099     __NHA_RES_BUCKET_MAX,
0100 };
0101 
0102 #define NHA_RES_BUCKET_MAX  (__NHA_RES_BUCKET_MAX - 1)
0103 
0104 #endif