]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Add code to get/set interface to pass up from dplane
authorDonald Sharp <sharpd@nvidia.com>
Thu, 20 Apr 2023 12:51:42 +0000 (08:51 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Wed, 5 Jul 2023 17:03:14 +0000 (13:03 -0400)
1) Add a bunch of get/set functions and associated data
structure in zebra_dplane to allow the setting and retrieval
of interface netlink data up into the master pthread.

2) Add a bit of code to breakup startup into stages.  This is
because FRR currently has a mix of dplane and non dplane interactions
and the code needs to be paused before continuing on.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 files changed:
zebra/dplane_fpm_nl.c
zebra/if_netlink.c
zebra/interface.c
zebra/kernel_netlink.c
zebra/kernel_socket.c
zebra/rt_netlink.c
zebra/zebra_dplane.c
zebra/zebra_dplane.h
zebra/zebra_mpls.c
zebra/zebra_mpls_openbsd.c
zebra/zebra_nhg.c
zebra/zebra_rib.c
zebra/zebra_script.c

index be2f55120ce31dc63bc60ebe8aba002076b811e0..51b1df255814e652add81e9f08be776ad54c925a 100644 (file)
@@ -933,6 +933,7 @@ static int fpm_nl_enqueue(struct fpm_nl_ctx *fnc, struct zebra_dplane_ctx *ctx)
        case DPLANE_OP_TC_FILTER_DELETE:
        case DPLANE_OP_TC_FILTER_UPDATE:
        case DPLANE_OP_NONE:
+       case DPLANE_OP_STARTUP_STAGE:
                break;
 
        }
index 202bd9159e4fefe5a70eb4ea2b91ec111f30a180..55d63cc4eba67b161f982c8371411de3e98a21e9 100644 (file)
@@ -1340,6 +1340,7 @@ static ssize_t netlink_intf_msg_encoder(struct zebra_dplane_ctx *ctx, void *buf,
        case DPLANE_OP_TC_FILTER_ADD:
        case DPLANE_OP_TC_FILTER_DELETE:
        case DPLANE_OP_TC_FILTER_UPDATE:
+       case DPLANE_OP_STARTUP_STAGE:
                flog_err(
                        EC_ZEBRA_NHG_FIB_UPDATE,
                        "Context received for kernel interface update with incorrect OP code (%u)",
index ba6a376536e90430be410f6045b50bc6565db08e..8cf934bf7638f7f99289506ac6c06a6a7c30b6d7 100644 (file)
@@ -1586,6 +1586,7 @@ void zebra_if_dplane_result(struct zebra_dplane_ctx *ctx)
        case DPLANE_OP_TC_FILTER_ADD:
        case DPLANE_OP_TC_FILTER_DELETE:
        case DPLANE_OP_TC_FILTER_UPDATE:
+       case DPLANE_OP_STARTUP_STAGE:
                break; /* should never hit here */
        }
 }
index 78b1dfe27633039f3c515d01883d42abb49f587b..2fab21ed93b404fb76946ed347452c143cccd4b0 100644 (file)
@@ -1631,6 +1631,7 @@ static enum netlink_msg_status nl_put_msg(struct nl_batch *bth,
        case DPLANE_OP_IPSET_DELETE:
        case DPLANE_OP_IPSET_ENTRY_ADD:
        case DPLANE_OP_IPSET_ENTRY_DELETE:
+       case DPLANE_OP_STARTUP_STAGE:
                return FRR_NETLINK_ERROR;
 
        case DPLANE_OP_GRE_SET:
index b8dc92b2e93e16a107dc529aa244f3a247ebddd9..ccbe9b27cf060422a1c5a6659c8bb3ccad6c351d 100644 (file)
@@ -1617,6 +1617,7 @@ void kernel_update_multi(struct dplane_ctx_list_head *ctx_list)
                case DPLANE_OP_GRE_SET:
                case DPLANE_OP_INTF_ADDR_ADD:
                case DPLANE_OP_INTF_ADDR_DEL:
+               case DPLANE_OP_STARTUP_STAGE:
                        zlog_err("Unhandled dplane data for %s",
                                 dplane_op2str(dplane_ctx_get_op(ctx)));
                        res = ZEBRA_DPLANE_REQUEST_FAILURE;
index 0f542ab807563d5214571d2261bedd7a18cec7a7..a51d7b849b27fa5f81a1b24cbbeec87b4e19383a 100644 (file)
@@ -4672,6 +4672,7 @@ static ssize_t netlink_neigh_msg_encoder(struct zebra_dplane_ctx *ctx,
        case DPLANE_OP_TC_FILTER_DELETE:
        case DPLANE_OP_TC_FILTER_UPDATE:
        case DPLANE_OP_NONE:
+       case DPLANE_OP_STARTUP_STAGE:
                ret = -1;
        }
 
index 75f1cf0582f2fb2f24fea58b7d6d4d67eeebbaf8..6dd1a9c18dbfac881940d6daf6bf76d4a2d0b154 100644 (file)
@@ -180,10 +180,43 @@ struct dplane_br_port_info {
  */
 struct dplane_intf_info {
 
+       enum zebra_iftype zif_type;
+       ifindex_t bond_ifindex;
+       ifindex_t link_ifindex;
+       int32_t mtu;
+       vrf_id_t vrf_id;
+       enum zebra_slave_iftype zif_slave_type;
+       ifindex_t master_ifindex;
+       ifindex_t bridge_ifindex;
+       ns_id_t link_nsid;
+       enum zebra_slave_iftype zslave_type;
+       uint8_t bypass;
+       enum zebra_link_type zltype;
+       bool startup;
+       uint8_t family;
+       struct zebra_vxlan_vni_array *vniarray;
+       struct zebra_dplane_bridge_vlan_info bvinfo;
+       struct zebra_dplane_bridge_vlan_info_array *bvarray;
+
+       char desc[128];
+
+       int32_t hw_addr_len;
+       uint8_t hw_addr[INTERFACE_HWADDR_MAX];
+
+       uint32_t table_id;
+
+       struct zebra_l2info_bridge binfo;
+       struct zebra_l2info_vlan vinfo;
+       struct zebra_l2info_vxlan vxinfo;
+       struct zebra_l2info_gre grinfo;
+
+       uint32_t rc_bitfield;
+
        uint32_t metric;
        uint32_t flags;
 
        bool protodown;
+       bool protodown_set;
        bool pd_reason_val;
 
 #define DPLANE_INTF_CONNECTED   (1 << 0) /* Connected peer, p2p */
@@ -397,6 +430,7 @@ struct zebra_dplane_ctx {
                struct dplane_neigh_table neightable;
                struct dplane_gre_ctx gre;
                struct dplane_netconf_info netconf;
+               enum zebra_dplane_startup_notifications spot;
        } u;
 
        /* Namespace info, used especially for netlink kernel communication */
@@ -808,8 +842,14 @@ static void dplane_ctx_free_internal(struct zebra_dplane_ctx *ctx)
        case DPLANE_OP_NONE:
        case DPLANE_OP_IPSET_ADD:
        case DPLANE_OP_IPSET_DELETE:
+               break;
        case DPLANE_OP_INTF_INSTALL:
        case DPLANE_OP_INTF_UPDATE:
+               if (ctx->u.intf.vniarray)
+                       XFREE(MTYPE_TMP, ctx->u.intf.vniarray);
+               if (ctx->u.intf.bvarray)
+                       XFREE(MTYPE_TMP, ctx->u.intf.bvarray);
+               break;
        case DPLANE_OP_INTF_DELETE:
        case DPLANE_OP_TC_QDISC_INSTALL:
        case DPLANE_OP_TC_QDISC_UNINSTALL:
@@ -833,6 +873,7 @@ static void dplane_ctx_free_internal(struct zebra_dplane_ctx *ctx)
                break;
        case DPLANE_OP_GRE_SET:
        case DPLANE_OP_INTF_NETCONFIG:
+       case DPLANE_OP_STARTUP_STAGE:
                break;
        }
 }
@@ -1156,6 +1197,8 @@ const char *dplane_op2str(enum dplane_op_e op)
        case DPLANE_OP_TC_FILTER_UPDATE:
                ret = "TC__FILTER_UPDATE";
                break;
+       case DPLANE_OP_STARTUP_STAGE:
+               ret = "STARTUP_STAGE";
        }
 
        return ret;
@@ -1297,6 +1340,422 @@ const char *dplane_ctx_get_ifname(const struct zebra_dplane_ctx *ctx)
        return ctx->zd_ifname;
 }
 
+void dplane_ctx_set_ifp_bridge_vlan_info_array(
+       struct zebra_dplane_ctx *ctx,
+       struct zebra_dplane_bridge_vlan_info_array *bvarray)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.bvarray = bvarray;
+}
+
+const struct zebra_dplane_bridge_vlan_info_array *
+dplane_ctx_get_ifp_bridge_vlan_info_array(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.bvarray;
+}
+
+void dplane_ctx_set_ifp_vxlan_vni_array(struct zebra_dplane_ctx *ctx,
+                                       struct zebra_vxlan_vni_array *vniarray)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.vniarray = vniarray;
+}
+
+const struct zebra_vxlan_vni_array *
+dplane_ctx_get_ifp_vxlan_vni_array(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.vniarray;
+}
+
+void dplane_ctx_set_ifp_bridge_vlan_info(
+       struct zebra_dplane_ctx *ctx,
+       struct zebra_dplane_bridge_vlan_info *bvinfo)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.bvinfo = *bvinfo;
+}
+
+const struct zebra_dplane_bridge_vlan_info *
+dplane_ctx_get_ifp_bridge_vlan_info(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return &ctx->u.intf.bvinfo;
+}
+
+void dplane_ctx_set_ifp_family(struct zebra_dplane_ctx *ctx, uint8_t family)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.family = family;
+}
+
+uint8_t dplane_ctx_get_ifp_family(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.family;
+}
+
+void dplane_ctx_set_ifp_zltype(struct zebra_dplane_ctx *ctx,
+                              enum zebra_link_type zltype)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.zltype = zltype;
+}
+
+enum zebra_link_type
+dplane_ctx_get_ifp_zltype(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.zltype;
+}
+
+void dplane_ctx_set_ifp_link_ifindex(struct zebra_dplane_ctx *ctx,
+                                    ifindex_t link_ifindex)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.link_ifindex = link_ifindex;
+}
+
+ifindex_t dplane_ctx_get_ifp_link_ifindex(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.link_ifindex;
+}
+
+void dplane_ctx_set_ifp_desc(struct zebra_dplane_ctx *ctx, const char *desc)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       strlcpy(ctx->u.intf.desc, desc, sizeof(ctx->u.intf.desc));
+}
+
+char *dplane_ctx_get_ifp_desc(struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.desc;
+}
+
+void dplane_ctx_set_ifp_flags(struct zebra_dplane_ctx *ctx, uint64_t flags)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.flags = flags;
+}
+
+uint64_t dplane_ctx_get_ifp_flags(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.flags;
+}
+
+void dplane_ctx_set_ifp_bypass(struct zebra_dplane_ctx *ctx, uint8_t bypass)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.bypass = bypass;
+}
+
+uint8_t dplane_ctx_get_ifp_bypass(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.bypass;
+}
+
+void dplane_ctx_set_ifp_bridge_ifindex(struct zebra_dplane_ctx *ctx,
+                                      ifindex_t bridge_ifindex)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.bridge_ifindex = bridge_ifindex;
+}
+
+ifindex_t dplane_ctx_get_ifp_bridge_ifindex(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.bridge_ifindex;
+}
+
+void dplane_ctx_set_ifp_zif_slave_type(struct zebra_dplane_ctx *ctx,
+                                      enum zebra_slave_iftype zslave_type)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.zslave_type = zslave_type;
+}
+
+enum zebra_slave_iftype
+dplane_ctx_get_ifp_zif_slave_type(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.zslave_type;
+}
+
+void dplane_ctx_set_ifp_master_ifindex(struct zebra_dplane_ctx *ctx,
+                                      ifindex_t master_ifindex)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.master_ifindex = master_ifindex;
+}
+
+ifindex_t dplane_ctx_get_ifp_master_ifindex(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.master_ifindex;
+}
+
+void dplane_ctx_set_ifp_mtu(struct zebra_dplane_ctx *ctx, uint32_t mtu)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.mtu = mtu;
+}
+
+uint32_t dplane_ctx_get_ifp_mtu(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.mtu;
+}
+
+void dplane_ctx_set_ifp_vrf_id(struct zebra_dplane_ctx *ctx, vrf_id_t vrf_id)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.vrf_id = vrf_id;
+}
+
+vrf_id_t dplane_ctx_get_ifp_vrf_id(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.vrf_id;
+}
+
+void dplane_ctx_set_ifp_link_nsid(struct zebra_dplane_ctx *ctx,
+                                 ns_id_t link_nsid)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.link_nsid = link_nsid;
+}
+
+ns_id_t dplane_ctx_get_ifp_link_nsid(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.link_nsid;
+}
+
+void dplane_ctx_set_ifp_startup(struct zebra_dplane_ctx *ctx, bool startup)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.startup = startup;
+}
+
+bool dplane_ctx_get_ifp_startup(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.startup;
+}
+
+void dplane_ctx_set_ifp_protodown_set(struct zebra_dplane_ctx *ctx, bool set)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.protodown_set = set;
+}
+
+bool dplane_ctx_get_ifp_protodown_set(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.protodown_set;
+}
+
+void dplane_ctx_set_ifp_protodown(struct zebra_dplane_ctx *ctx, bool protodown)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.protodown = protodown;
+}
+
+bool dplane_ctx_get_ifp_protodown(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.protodown;
+}
+
+ifindex_t dplane_ctx_get_ifp_bond_ifindex(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.bond_ifindex;
+}
+
+void dplane_ctx_set_ifp_rc_bitfield(struct zebra_dplane_ctx *ctx,
+                                   uint32_t rc_bitfield)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.rc_bitfield = rc_bitfield;
+}
+
+uint32_t dplane_ctx_get_ifp_rc_bitfield(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.rc_bitfield;
+}
+
+void dplane_ctx_set_ifp_gre_info(struct zebra_dplane_ctx *ctx,
+                                struct zebra_l2info_gre *grinfo)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.grinfo = *grinfo;
+}
+
+const struct zebra_l2info_gre *
+dplane_ctx_get_ifp_gre_info(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return &ctx->u.intf.grinfo;
+}
+
+void dplane_ctx_set_ifp_vxlan_info(struct zebra_dplane_ctx *ctx,
+                                  struct zebra_l2info_vxlan *vxinfo)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.vxinfo = *vxinfo;
+}
+
+const struct zebra_l2info_vxlan *
+dplane_ctx_get_ifp_vxlan_info(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return &ctx->u.intf.vxinfo;
+}
+
+void dplane_ctx_set_ifp_vlan_info(struct zebra_dplane_ctx *ctx,
+                                 struct zebra_l2info_vlan *vinfo)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.vinfo = *vinfo;
+}
+
+const struct zebra_l2info_vlan *
+dplane_ctx_get_ifp_vlan_info(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return &ctx->u.intf.vinfo;
+}
+
+void dplane_ctx_set_ifp_bridge_info(struct zebra_dplane_ctx *ctx,
+                                   struct zebra_l2info_bridge *binfo)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.binfo = *binfo;
+}
+
+const struct zebra_l2info_bridge *
+dplane_ctx_get_ifp_bridge_info(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return &ctx->u.intf.binfo;
+}
+
+void dplane_ctx_set_ifp_table_id(struct zebra_dplane_ctx *ctx,
+                                uint32_t table_id)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.table_id = table_id;
+}
+
+uint32_t dplane_ctx_get_ifp_table_id(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.table_id;
+}
+
+void dplane_ctx_set_ifp_hw_addr(struct zebra_dplane_ctx *ctx,
+                               int32_t hw_addr_len, uint8_t *hw_addr)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.hw_addr_len = hw_addr_len;
+       memcpy(ctx->u.intf.hw_addr, hw_addr, hw_addr_len);
+}
+
+int32_t dplane_ctx_get_ifp_hw_addr_len(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.hw_addr_len;
+}
+
+const uint8_t *dplane_ctx_get_ifp_hw_addr(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.hw_addr;
+}
+
+void dplane_ctx_set_ifp_bond_ifindex(struct zebra_dplane_ctx *ctx,
+                                    ifindex_t bond_ifindex)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.bond_ifindex = bond_ifindex;
+}
+
+enum zebra_iftype
+dplane_ctx_get_ifp_zif_type(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.zif_type;
+}
+
+void dplane_ctx_set_ifp_zif_type(struct zebra_dplane_ctx *ctx,
+                                enum zebra_iftype zif_type)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.zif_type = zif_type;
+}
+
 void dplane_ctx_set_ifname(struct zebra_dplane_ctx *ctx, const char *ifname)
 {
        DPLANE_CTX_VALID(ctx);
@@ -6065,6 +6524,7 @@ static void kernel_dplane_log_detail(struct zebra_dplane_ctx *ctx)
        case DPLANE_OP_TC_FILTER_ADD:
        case DPLANE_OP_TC_FILTER_DELETE:
        case DPLANE_OP_TC_FILTER_UPDATE:
+       case DPLANE_OP_STARTUP_STAGE:
                break;
        }
 }
@@ -6237,6 +6697,7 @@ static void kernel_dplane_handle_result(struct zebra_dplane_ctx *ctx)
                break;
 
        case DPLANE_OP_NONE:
+       case DPLANE_OP_STARTUP_STAGE:
                if (res != ZEBRA_DPLANE_REQUEST_SUCCESS)
                        atomic_fetch_add_explicit(&zdplane_info.dg_other_errors,
                                                  1, memory_order_relaxed);
@@ -6927,6 +7388,25 @@ void zebra_dplane_start(void)
        frr_pthread_run(zdplane_info.dg_pthread, NULL);
 }
 
+enum zebra_dplane_startup_notifications
+dplane_ctx_get_startup_spot(struct zebra_dplane_ctx *ctx)
+{
+       return ctx->u.spot;
+}
+
+void zebra_dplane_startup_stage(struct zebra_ns *zns,
+                               enum zebra_dplane_startup_notifications spot)
+{
+       struct zebra_dplane_ctx *ctx = dplane_ctx_alloc();
+
+       ctx->zd_op = DPLANE_OP_STARTUP_STAGE;
+       ctx->zd_status = ZEBRA_DPLANE_REQUEST_QUEUED;
+
+       ctx->u.spot = spot;
+       dplane_ctx_set_ns_id(ctx, zns->ns_id);
+
+       dplane_provider_enqueue_to_zebra(ctx);
+}
 /*
  * Initialize the dataplane module at startup; called by zebra rib_init()
  */
index e602a071ff3800d9f327e809d6d9fa8e06bde2c3..be18115939c80ff2247fc079ddcb3cfb3dc6aac8 100644 (file)
@@ -87,6 +87,11 @@ enum zebra_dplane_result {
        ZEBRA_DPLANE_REQUEST_FAILURE,
 };
 
+enum zebra_dplane_startup_notifications {
+       ZEBRA_DPLANE_INTERFACES_READ,
+       ZEBRA_DPLANE_TUNNELS_READ,
+       ZEBRA_DPLANE_ADDRESSES_READ,
+};
 /*
  * API between the zebra dataplane system and the main zebra processing
  * context.
@@ -188,7 +193,10 @@ enum dplane_op_e {
        DPLANE_OP_TC_CLASS_UPDATE,
        DPLANE_OP_TC_FILTER_ADD,
        DPLANE_OP_TC_FILTER_DELETE,
-       DPLANE_OP_TC_FILTER_UPDATE
+       DPLANE_OP_TC_FILTER_UPDATE,
+
+       /* Startup Control */
+       DPLANE_OP_STARTUP_STAGE,
 };
 
 /*
@@ -323,6 +331,105 @@ const char *dplane_ctx_get_ifname(const struct zebra_dplane_ctx *ctx);
 void dplane_ctx_set_ifname(struct zebra_dplane_ctx *ctx, const char *ifname);
 ifindex_t dplane_ctx_get_ifindex(const struct zebra_dplane_ctx *ctx);
 void dplane_ctx_set_ifindex(struct zebra_dplane_ctx *ctx, ifindex_t ifindex);
+void dplane_ctx_set_ifp_bond_ifindex(struct zebra_dplane_ctx *ctx,
+                                    ifindex_t ifindex);
+ifindex_t dplane_ctx_get_ifp_bond_ifindex(const struct zebra_dplane_ctx *ctx);
+enum zebra_iftype
+dplane_ctx_get_ifp_zif_type(const struct zebra_dplane_ctx *ctx);
+void dplane_ctx_set_ifp_zif_type(struct zebra_dplane_ctx *ctx,
+                                enum zebra_iftype zif_type);
+void dplane_ctx_set_ifp_table_id(struct zebra_dplane_ctx *ctx,
+                                uint32_t table_id);
+uint32_t dplane_ctx_get_ifp_table_id(const struct zebra_dplane_ctx *ctx);
+void dplane_ctx_set_ifp_hw_addr(struct zebra_dplane_ctx *ctx,
+                               int32_t hw_addr_len, uint8_t *hw_addr);
+int32_t dplane_ctx_get_ifp_hw_addr_len(const struct zebra_dplane_ctx *ctx);
+const uint8_t *dplane_ctx_get_ifp_hw_addr(const struct zebra_dplane_ctx *ctx);
+struct zebra_l2info_bridge;
+void dplane_ctx_set_ifp_bridge_info(struct zebra_dplane_ctx *ctx,
+                                   struct zebra_l2info_bridge *binfo);
+const struct zebra_l2info_bridge *
+dplane_ctx_get_ifp_bridge_info(const struct zebra_dplane_ctx *ctx);
+struct zebra_l2info_vlan;
+void dplane_ctx_set_ifp_vlan_info(struct zebra_dplane_ctx *ctx,
+                                 struct zebra_l2info_vlan *vinfo);
+const struct zebra_l2info_vlan *
+dplane_ctx_get_ifp_vlan_info(const struct zebra_dplane_ctx *ctx);
+struct zebra_l2info_vxlan;
+void dplane_ctx_set_ifp_vxlan_info(struct zebra_dplane_ctx *ctx,
+                                  struct zebra_l2info_vxlan *vxinfo);
+const struct zebra_l2info_vxlan *
+dplane_ctx_get_ifp_vxlan_info(const struct zebra_dplane_ctx *ctx);
+struct zebra_l2info_gre;
+void dplane_ctx_set_ifp_gre_info(struct zebra_dplane_ctx *ctx,
+                                struct zebra_l2info_gre *greinfo);
+const struct zebra_l2info_gre *
+dplane_ctx_get_ifp_gre_info(const struct zebra_dplane_ctx *ctx);
+void dplane_ctx_set_ifp_zltype(struct zebra_dplane_ctx *ctx,
+                              enum zebra_link_type zlt);
+enum zebra_link_type
+dplane_ctx_get_ifp_zltype(const struct zebra_dplane_ctx *ctx);
+void dplane_ctx_set_ifp_link_nsid(struct zebra_dplane_ctx *ctx, ns_id_t ns_id);
+ns_id_t dplane_ctx_get_ifp_link_nsid(const struct zebra_dplane_ctx *ctx);
+void dplane_ctx_set_ifp_desc(struct zebra_dplane_ctx *ctx, const char *desc);
+char *dplane_ctx_get_ifp_desc(struct zebra_dplane_ctx *ctx);
+void dplane_ctx_set_ifp_mtu(struct zebra_dplane_ctx *ctx, uint32_t mtu);
+uint32_t dplane_ctx_get_ifp_mtu(const struct zebra_dplane_ctx *ctx);
+void dplane_ctx_set_ifp_vrf_id(struct zebra_dplane_ctx *ctx, vrf_id_t vrf_id);
+vrf_id_t dplane_ctx_get_ifp_vrf_id(const struct zebra_dplane_ctx *ctx);
+enum zebra_slave_iftype;
+void dplane_ctx_set_ifp_zif_slave_type(struct zebra_dplane_ctx *ctx,
+                                      enum zebra_slave_iftype zslave_type);
+enum zebra_slave_iftype
+dplane_ctx_get_ifp_zif_slave_type(const struct zebra_dplane_ctx *ctx);
+void dplane_ctx_set_ifp_master_ifindex(struct zebra_dplane_ctx *ctx,
+                                      ifindex_t master_ifindex);
+ifindex_t dplane_ctx_get_ifp_master_ifindex(const struct zebra_dplane_ctx *ctx);
+void dplane_ctx_set_ifp_bridge_ifindex(struct zebra_dplane_ctx *ctx,
+                                      ifindex_t bridge_ifindex);
+ifindex_t dplane_ctx_get_ifp_bridge_ifindex(const struct zebra_dplane_ctx *ctx);
+void dplane_ctx_set_ifp_bypass(struct zebra_dplane_ctx *ctx, uint8_t bypass);
+uint8_t dplane_ctx_get_ifp_bypass(const struct zebra_dplane_ctx *ctx);
+void dplane_ctx_set_ifp_flags(struct zebra_dplane_ctx *ctx, uint64_t flags);
+uint64_t dplane_ctx_get_ifp_flags(const struct zebra_dplane_ctx *ctx);
+void dplane_ctx_set_ifp_protodown(struct zebra_dplane_ctx *ctx, bool protodown);
+bool dplane_ctx_get_ifp_protodown(const struct zebra_dplane_ctx *ctx);
+void dplane_ctx_set_ifp_startup(struct zebra_dplane_ctx *ctx, bool startup);
+bool dplane_ctx_get_ifp_startup(const struct zebra_dplane_ctx *ctx);
+void dplane_ctx_set_ifp_protodown_set(struct zebra_dplane_ctx *ctx, bool set);
+bool dplane_ctx_get_ifp_protodown_set(const struct zebra_dplane_ctx *ctx);
+void dplane_ctx_set_ifp_rc_bitfield(struct zebra_dplane_ctx *ctx,
+                                   uint32_t rc_bitfield);
+uint32_t dplane_ctx_get_ifp_rc_bitfield(const struct zebra_dplane_ctx *ctx);
+void dplane_ctx_set_ifp_link_ifindex(struct zebra_dplane_ctx *ctx,
+                                    ifindex_t link_ifindex);
+ifindex_t dplane_ctx_get_ifp_link_ifindex(const struct zebra_dplane_ctx *ctx);
+void dplane_ctx_set_ifp_family(struct zebra_dplane_ctx *ctx, uint8_t family);
+uint8_t dplane_ctx_get_ifp_family(const struct zebra_dplane_ctx *ctx);
+struct zebra_vxlan_vni_array;
+void dplane_ctx_set_ifp_vxlan_vni_array(struct zebra_dplane_ctx *ctx,
+                                       struct zebra_vxlan_vni_array *vniarray);
+const struct zebra_vxlan_vni_array *
+dplane_ctx_get_ifp_vxlan_vni_array(const struct zebra_dplane_ctx *ctx);
+struct zebra_dplane_bridge_vlan_info {
+       uint16_t flags;
+       uint16_t vid;
+};
+void dplane_ctx_set_ifp_bridge_vlan_info(
+       struct zebra_dplane_ctx *ctx,
+       struct zebra_dplane_bridge_vlan_info *bvinfo);
+const struct zebra_dplane_bridge_vlan_info *
+dplane_ctx_get_ifp_bridge_vlan_info(const struct zebra_dplane_ctx *ctx);
+
+struct zebra_dplane_bridge_vlan_info_array {
+       int count;
+       struct zebra_dplane_bridge_vlan_info array[0];
+};
+void dplane_ctx_set_ifp_bridge_vlan_info_array(
+       struct zebra_dplane_ctx *ctx,
+       struct zebra_dplane_bridge_vlan_info_array *bvarray);
+const struct zebra_dplane_bridge_vlan_info_array *
+dplane_ctx_get_ifp_bridge_vlan_info_array(const struct zebra_dplane_ctx *ctx);
 
 /* Retrieve last/current provider id */
 uint32_t dplane_ctx_get_provider(const struct zebra_dplane_ctx *ctx);
@@ -1066,6 +1173,9 @@ void zebra_dplane_pre_finish(void);
 void zebra_dplane_finish(void);
 void zebra_dplane_shutdown(void);
 
+void zebra_dplane_startup_stage(struct zebra_ns *zns,
+                               enum zebra_dplane_startup_notifications spot);
+
 /*
  * decision point for sending a routing update through the old
  * straight to zebra master pthread or through the dplane to
@@ -1076,6 +1186,9 @@ void dplane_rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p,
                              struct nexthop_group *ng, int startup,
                              struct zebra_dplane_ctx *ctx);
 
+enum zebra_dplane_startup_notifications
+dplane_ctx_get_startup_spot(struct zebra_dplane_ctx *ctx);
+
 #ifdef __cplusplus
 }
 #endif
index 47d5b64a3fa1e9d2272a159e53de4817a7961e9e..ef109774d97d9b202d0db645a26ff279d9af6c1e 100644 (file)
@@ -1883,6 +1883,7 @@ void zebra_mpls_lsp_dplane_result(struct zebra_dplane_ctx *ctx)
        case DPLANE_OP_TC_FILTER_ADD:
        case DPLANE_OP_TC_FILTER_DELETE:
        case DPLANE_OP_TC_FILTER_UPDATE:
+       case DPLANE_OP_STARTUP_STAGE:
                break;
 
        } /* Switch */
index ee6f7045f558c008295850a82acc7e8e2c9d0744..5015f2ed1adf7a1aa52a03766a48e76657e02235 100644 (file)
@@ -291,6 +291,7 @@ static int kernel_lsp_cmd(struct zebra_dplane_ctx *ctx)
        case DPLANE_OP_TC_FILTER_ADD:
        case DPLANE_OP_TC_FILTER_DELETE:
        case DPLANE_OP_TC_FILTER_UPDATE:
+       case DPLANE_OP_STARTUP_STAGE:
                return -1;
        }
 
@@ -502,6 +503,7 @@ enum zebra_dplane_result kernel_pw_update(struct zebra_dplane_ctx *ctx)
        case DPLANE_OP_TC_FILTER_ADD:
        case DPLANE_OP_TC_FILTER_DELETE:
        case DPLANE_OP_TC_FILTER_UPDATE:
+       case DPLANE_OP_STARTUP_STAGE:
                break;
        }
 
index 96e021292be469b7b1fe822c9dc87419079a3690..6b7922744f941f73f60ac17dccf95cddd1bbf536 100644 (file)
@@ -3270,6 +3270,7 @@ void zebra_nhg_dplane_result(struct zebra_dplane_ctx *ctx)
        case DPLANE_OP_TC_FILTER_ADD:
        case DPLANE_OP_TC_FILTER_DELETE:
        case DPLANE_OP_TC_FILTER_UPDATE:
+       case DPLANE_OP_STARTUP_STAGE:
                break;
        }
 }
index 71ac443c791a5850667540d5c08797f690079eb3..18345b052f0fde2aee3aefbc326064b473e470f3 100644 (file)
@@ -2182,6 +2182,7 @@ static void rib_process_result(struct zebra_dplane_ctx *ctx)
        case DPLANE_OP_TC_FILTER_ADD:
        case DPLANE_OP_TC_FILTER_DELETE:
        case DPLANE_OP_TC_FILTER_UPDATE:
+       case DPLANE_OP_STARTUP_STAGE:
                break;
        }
 
@@ -4861,6 +4862,7 @@ static void rib_process_dplane_results(struct event *thread)
                        case DPLANE_OP_NEIGH_TABLE_UPDATE:
                        case DPLANE_OP_GRE_SET:
                        case DPLANE_OP_NONE:
+                       case DPLANE_OP_STARTUP_STAGE:
                                break;
 
                        } /* Dispatch by op code */
index 3f107cb48d4504a258e2a6b8ba26dc09032f3695..9f8490ac66ffec26d1da565d48c77f456c87feea 100644 (file)
@@ -415,6 +415,7 @@ void lua_pushzebra_dplane_ctx(lua_State *L, const struct zebra_dplane_ctx *ctx)
                /* Not currently handled */
        case DPLANE_OP_INTF_NETCONFIG: /*NYI*/
        case DPLANE_OP_NONE:
+       case DPLANE_OP_STARTUP_STAGE:
                break;
        } /* Dispatch by op code */
 }