]> git.puffer.fish Git - mirror/frr.git/commitdiff
include, zebra: Add recent nexthop.h 9898/head
authorDonald Sharp <sharpd@nvidia.com>
Mon, 25 Oct 2021 18:11:37 +0000 (14:11 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Mon, 25 Oct 2021 18:11:37 +0000 (14:11 -0400)
Add actual recent nexthop.h file from kernel
and fix up resulting fallout because FRR's
original nexthop.h did not match upstream
linux kernel.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
include/linux/nexthop.h
zebra/debug_nl.c
zebra/kernel_netlink.h

index ee2a15b9c7c490c78e9f464e0b44ab46b9f20f14..d8ffa8c9ca78492ec1f18c2634f20eb8f79b6ee7 100644 (file)
@@ -1,12 +1,9 @@
 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-#ifndef _LINUX_NEXTHOP_H
-#define _LINUX_NEXTHOP_H
+#ifndef _UAPI_LINUX_NEXTHOP_H
+#define _UAPI_LINUX_NEXTHOP_H
 
 #include <linux/types.h>
 
-#define RTM_NHA(h)  ((struct rtattr *)(((char *)(h)) + \
-                       NLMSG_ALIGN(sizeof(struct nhmsg))))
-
 struct nhmsg {
        unsigned char   nh_family;
        unsigned char   nh_scope;     /* return only */
@@ -15,6 +12,7 @@ struct nhmsg {
        unsigned int    nh_flags;     /* RTNH_F flags */
 };
 
+/* entry in a nexthop group */
 struct nexthop_grp {
        __u32   id;       /* nexthop id - must exist */
        __u8    weight;   /* weight of this nexthop */
@@ -23,7 +21,10 @@ struct nexthop_grp {
 };
 
 enum {
-       NEXTHOP_GRP_TYPE_MPATH,  /* default type if not specified */
+       NEXTHOP_GRP_TYPE_MPATH,  /* hash-threshold nexthop group
+                                 * default type if not specified
+                                 */
+       NEXTHOP_GRP_TYPE_RES,    /* resilient nexthop group */
        __NEXTHOP_GRP_TYPE_MAX,
 };
 
@@ -50,10 +51,54 @@ enum {
         */
        NHA_GROUPS,     /* flag; only return nexthop groups in dump */
        NHA_MASTER,     /* u32;  only return nexthops with given master dev */
-       NHA_FDB,        /* nexthop belongs to a bridge fdb */
+
+       NHA_FDB,        /* flag; nexthop belongs to a bridge fdb */
+       /* if NHA_FDB is added, OIF, BLACKHOLE, ENCAP cannot be set */
+
+       /* nested; resilient nexthop group attributes */
+       NHA_RES_GROUP,
+       /* nested; nexthop bucket attributes */
+       NHA_RES_BUCKET,
 
        __NHA_MAX,
 };
 
 #define NHA_MAX        (__NHA_MAX - 1)
+
+enum {
+       NHA_RES_GROUP_UNSPEC,
+       /* Pad attribute for 64-bit alignment. */
+       NHA_RES_GROUP_PAD = NHA_RES_GROUP_UNSPEC,
+
+       /* u16; number of nexthop buckets in a resilient nexthop group */
+       NHA_RES_GROUP_BUCKETS,
+       /* clock_t as u32; nexthop bucket idle timer (per-group) */
+       NHA_RES_GROUP_IDLE_TIMER,
+       /* clock_t as u32; nexthop unbalanced timer */
+       NHA_RES_GROUP_UNBALANCED_TIMER,
+       /* clock_t as u64; nexthop unbalanced time */
+       NHA_RES_GROUP_UNBALANCED_TIME,
+
+       __NHA_RES_GROUP_MAX,
+};
+
+#define NHA_RES_GROUP_MAX      (__NHA_RES_GROUP_MAX - 1)
+
+enum {
+       NHA_RES_BUCKET_UNSPEC,
+       /* Pad attribute for 64-bit alignment. */
+       NHA_RES_BUCKET_PAD = NHA_RES_BUCKET_UNSPEC,
+
+       /* u16; nexthop bucket index */
+       NHA_RES_BUCKET_INDEX,
+       /* clock_t as u64; nexthop bucket idle time */
+       NHA_RES_BUCKET_IDLE_TIME,
+       /* u32; nexthop id assigned to the nexthop bucket */
+       NHA_RES_BUCKET_NH_ID,
+
+       __NHA_RES_BUCKET_MAX,
+};
+
+#define NHA_RES_BUCKET_MAX     (__NHA_RES_BUCKET_MAX - 1)
+
 #endif
index 842579f89e6eb0b1210a86666f131f6129eaae51..2175aaff6024ba81de4a108b84f8fdbac7c54d86 100644 (file)
@@ -29,6 +29,7 @@
 #include <stdint.h>
 
 #include "zebra/rt_netlink.h"
+#include "zebra/kernel_netlink.h"
 
 const char *nlmsg_type2str(uint16_t type)
 {
index 37c76b9e598d4e4f101cb94fbfe5fd50ed9124d5..cf8b8c785e630ae17cd2198e07506775ecbc2255 100644 (file)
@@ -27,6 +27,10 @@ extern "C" {
 
 #ifdef HAVE_NETLINK
 
+#define RTM_NHA(h)                                                             \
+       ((struct rtattr *)(((char *)(h)) + NLMSG_ALIGN(sizeof(struct nhmsg))))
+
+
 #define NL_RCV_PKT_BUF_SIZE     32768
 #define NL_PKT_BUF_SIZE         8192