From a014450441aeb1bf3f335d98903eee41e955867e Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 20 Apr 2023 08:51:42 -0400 Subject: [PATCH] zebra: Add code to get/set interface to pass up from dplane 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 --- zebra/dplane_fpm_nl.c | 1 + zebra/if_netlink.c | 1 + zebra/interface.c | 1 + zebra/kernel_netlink.c | 1 + zebra/kernel_socket.c | 1 + zebra/rt_netlink.c | 1 + zebra/zebra_dplane.c | 480 +++++++++++++++++++++++++++++++++++++ zebra/zebra_dplane.h | 115 ++++++++- zebra/zebra_mpls.c | 1 + zebra/zebra_mpls_openbsd.c | 2 + zebra/zebra_nhg.c | 1 + zebra/zebra_rib.c | 2 + zebra/zebra_script.c | 1 + 13 files changed, 607 insertions(+), 1 deletion(-) diff --git a/zebra/dplane_fpm_nl.c b/zebra/dplane_fpm_nl.c index be2f55120c..51b1df2558 100644 --- a/zebra/dplane_fpm_nl.c +++ b/zebra/dplane_fpm_nl.c @@ -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; } diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index 202bd9159e..55d63cc4eb 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -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)", diff --git a/zebra/interface.c b/zebra/interface.c index ba6a376536..8cf934bf76 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -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 */ } } diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c index 78b1dfe276..2fab21ed93 100644 --- a/zebra/kernel_netlink.c +++ b/zebra/kernel_netlink.c @@ -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: diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index b8dc92b2e9..ccbe9b27cf 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -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; diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 0f542ab807..a51d7b849b 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -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; } diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index 75f1cf0582..6dd1a9c18d 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -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() */ diff --git a/zebra/zebra_dplane.h b/zebra/zebra_dplane.h index e602a071ff..be18115939 100644 --- a/zebra/zebra_dplane.h +++ b/zebra/zebra_dplane.h @@ -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 diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index 47d5b64a3f..ef109774d9 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -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 */ diff --git a/zebra/zebra_mpls_openbsd.c b/zebra/zebra_mpls_openbsd.c index ee6f7045f5..5015f2ed1a 100644 --- a/zebra/zebra_mpls_openbsd.c +++ b/zebra/zebra_mpls_openbsd.c @@ -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; } diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index 96e021292b..6b7922744f 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -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; } } diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 71ac443c79..18345b052f 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -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 */ diff --git a/zebra/zebra_script.c b/zebra/zebra_script.c index 3f107cb48d..9f8490ac66 100644 --- a/zebra/zebra_script.c +++ b/zebra/zebra_script.c @@ -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 */ } -- 2.39.5