Merge pull request #14825 from mjstapp/fix_opcode_switches

zebra: reduce number of switch statements with dplane opcodes
This commit is contained in:
Donald Sharp 2023-11-20 10:43:16 -05:00 committed by GitHub
commit e05bb2ddbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 42 additions and 494 deletions

View File

@ -1002,68 +1002,13 @@ static ssize_t netlink_intf_msg_encoder(struct zebra_dplane_ctx *ctx, void *buf,
op = dplane_ctx_get_op(ctx); op = dplane_ctx_get_op(ctx);
switch (op) { if (op == DPLANE_OP_INTF_UPDATE)
case DPLANE_OP_INTF_UPDATE:
cmd = RTM_SETLINK; cmd = RTM_SETLINK;
break; else if (op == DPLANE_OP_INTF_INSTALL)
case DPLANE_OP_INTF_INSTALL:
cmd = RTM_NEWLINK; cmd = RTM_NEWLINK;
break; else if (op == DPLANE_OP_INTF_DELETE)
case DPLANE_OP_INTF_DELETE:
cmd = RTM_DELLINK; cmd = RTM_DELLINK;
break; else {
case DPLANE_OP_NONE:
case DPLANE_OP_ROUTE_INSTALL:
case DPLANE_OP_ROUTE_UPDATE:
case DPLANE_OP_ROUTE_DELETE:
case DPLANE_OP_ROUTE_NOTIFY:
case DPLANE_OP_NH_INSTALL:
case DPLANE_OP_NH_UPDATE:
case DPLANE_OP_NH_DELETE:
case DPLANE_OP_LSP_INSTALL:
case DPLANE_OP_LSP_DELETE:
case DPLANE_OP_LSP_NOTIFY:
case DPLANE_OP_LSP_UPDATE:
case DPLANE_OP_PW_INSTALL:
case DPLANE_OP_PW_UNINSTALL:
case DPLANE_OP_SYS_ROUTE_ADD:
case DPLANE_OP_SYS_ROUTE_DELETE:
case DPLANE_OP_ADDR_INSTALL:
case DPLANE_OP_ADDR_UNINSTALL:
case DPLANE_OP_MAC_INSTALL:
case DPLANE_OP_MAC_DELETE:
case DPLANE_OP_NEIGH_INSTALL:
case DPLANE_OP_NEIGH_UPDATE:
case DPLANE_OP_NEIGH_DELETE:
case DPLANE_OP_NEIGH_DISCOVER:
case DPLANE_OP_VTEP_ADD:
case DPLANE_OP_VTEP_DELETE:
case DPLANE_OP_RULE_ADD:
case DPLANE_OP_RULE_DELETE:
case DPLANE_OP_RULE_UPDATE:
case DPLANE_OP_BR_PORT_UPDATE:
case DPLANE_OP_IPTABLE_ADD:
case DPLANE_OP_IPTABLE_DELETE:
case DPLANE_OP_IPSET_ADD:
case DPLANE_OP_IPSET_ENTRY_ADD:
case DPLANE_OP_IPSET_ENTRY_DELETE:
case DPLANE_OP_IPSET_DELETE:
case DPLANE_OP_NEIGH_IP_INSTALL:
case DPLANE_OP_NEIGH_IP_DELETE:
case DPLANE_OP_NEIGH_TABLE_UPDATE:
case DPLANE_OP_GRE_SET:
case DPLANE_OP_INTF_ADDR_ADD:
case DPLANE_OP_INTF_ADDR_DEL:
case DPLANE_OP_INTF_NETCONFIG:
case DPLANE_OP_TC_QDISC_INSTALL:
case DPLANE_OP_TC_QDISC_UNINSTALL:
case DPLANE_OP_TC_CLASS_ADD:
case DPLANE_OP_TC_CLASS_DELETE:
case DPLANE_OP_TC_CLASS_UPDATE:
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( flog_err(
EC_ZEBRA_NHG_FIB_UPDATE, EC_ZEBRA_NHG_FIB_UPDATE,
"Context received for kernel interface update with incorrect OP code (%u)", "Context received for kernel interface update with incorrect OP code (%u)",

View File

@ -2295,15 +2295,10 @@ void zebra_if_dplane_result(struct zebra_dplane_ctx *ctx)
ifp = if_lookup_by_index_per_ns(zns, ifindex); ifp = if_lookup_by_index_per_ns(zns, ifindex);
switch (op) { if (op == DPLANE_OP_INTF_ADDR_ADD || op == DPLANE_OP_INTF_ADDR_DEL) {
case DPLANE_OP_INTF_ADDR_ADD:
case DPLANE_OP_INTF_ADDR_DEL:
zebra_if_addr_update_ctx(ctx, ifp); zebra_if_addr_update_ctx(ctx, ifp);
break; } else if (op == DPLANE_OP_INTF_INSTALL ||
op == DPLANE_OP_INTF_UPDATE || op == DPLANE_OP_INTF_DELETE) {
case DPLANE_OP_INTF_INSTALL:
case DPLANE_OP_INTF_UPDATE:
case DPLANE_OP_INTF_DELETE:
/* /*
* Queued from the dplane means it is something * Queued from the dplane means it is something
* that we need to handle( create/delete the * that we need to handle( create/delete the
@ -2313,62 +2308,8 @@ void zebra_if_dplane_result(struct zebra_dplane_ctx *ctx)
zebra_if_dplane_ifp_handling(ctx); zebra_if_dplane_ifp_handling(ctx);
else else
zebra_if_update_ctx(ctx, ifp); zebra_if_update_ctx(ctx, ifp);
break; } else if (op == DPLANE_OP_INTF_NETCONFIG) {
case DPLANE_OP_INTF_NETCONFIG:
zebra_if_netconf_update_ctx(ctx, ifp, ifindex); zebra_if_netconf_update_ctx(ctx, ifp, ifindex);
break;
case DPLANE_OP_ROUTE_INSTALL:
case DPLANE_OP_ROUTE_UPDATE:
case DPLANE_OP_ROUTE_DELETE:
case DPLANE_OP_NH_DELETE:
case DPLANE_OP_NH_INSTALL:
case DPLANE_OP_NH_UPDATE:
case DPLANE_OP_ROUTE_NOTIFY:
case DPLANE_OP_LSP_INSTALL:
case DPLANE_OP_LSP_UPDATE:
case DPLANE_OP_LSP_DELETE:
case DPLANE_OP_LSP_NOTIFY:
case DPLANE_OP_PW_INSTALL:
case DPLANE_OP_PW_UNINSTALL:
case DPLANE_OP_SYS_ROUTE_ADD:
case DPLANE_OP_SYS_ROUTE_DELETE:
case DPLANE_OP_ADDR_INSTALL:
case DPLANE_OP_ADDR_UNINSTALL:
case DPLANE_OP_MAC_INSTALL:
case DPLANE_OP_MAC_DELETE:
case DPLANE_OP_NEIGH_INSTALL:
case DPLANE_OP_NEIGH_UPDATE:
case DPLANE_OP_NEIGH_DELETE:
case DPLANE_OP_NEIGH_IP_INSTALL:
case DPLANE_OP_NEIGH_IP_DELETE:
case DPLANE_OP_VTEP_ADD:
case DPLANE_OP_VTEP_DELETE:
case DPLANE_OP_RULE_ADD:
case DPLANE_OP_RULE_DELETE:
case DPLANE_OP_RULE_UPDATE:
case DPLANE_OP_NEIGH_DISCOVER:
case DPLANE_OP_BR_PORT_UPDATE:
case DPLANE_OP_NONE:
case DPLANE_OP_IPTABLE_ADD:
case DPLANE_OP_IPTABLE_DELETE:
case DPLANE_OP_IPSET_ADD:
case DPLANE_OP_IPSET_DELETE:
case DPLANE_OP_IPSET_ENTRY_ADD:
case DPLANE_OP_IPSET_ENTRY_DELETE:
case DPLANE_OP_NEIGH_TABLE_UPDATE:
case DPLANE_OP_GRE_SET:
case DPLANE_OP_TC_QDISC_INSTALL:
case DPLANE_OP_TC_QDISC_UNINSTALL:
case DPLANE_OP_TC_CLASS_ADD:
case DPLANE_OP_TC_CLASS_DELETE:
case DPLANE_OP_TC_CLASS_UPDATE:
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 */
} }
} }

View File

@ -4726,77 +4726,24 @@ static ssize_t netlink_neigh_msg_encoder(struct zebra_dplane_ctx *ctx,
void *buf, size_t buflen) void *buf, size_t buflen)
{ {
ssize_t ret = 0; ssize_t ret = 0;
enum dplane_op_e op;
switch (dplane_ctx_get_op(ctx)) { op = dplane_ctx_get_op(ctx);
case DPLANE_OP_NEIGH_INSTALL: if (op == DPLANE_OP_NEIGH_INSTALL || op == DPLANE_OP_NEIGH_UPDATE ||
case DPLANE_OP_NEIGH_UPDATE: op == DPLANE_OP_NEIGH_DISCOVER || op == DPLANE_OP_NEIGH_IP_INSTALL)
case DPLANE_OP_NEIGH_DISCOVER:
case DPLANE_OP_NEIGH_IP_INSTALL:
ret = netlink_neigh_update_ctx(ctx, RTM_NEWNEIGH, buf, buflen); ret = netlink_neigh_update_ctx(ctx, RTM_NEWNEIGH, buf, buflen);
break; else if (op == DPLANE_OP_NEIGH_DELETE || op == DPLANE_OP_NEIGH_IP_DELETE)
case DPLANE_OP_NEIGH_DELETE:
case DPLANE_OP_NEIGH_IP_DELETE:
ret = netlink_neigh_update_ctx(ctx, RTM_DELNEIGH, buf, buflen); ret = netlink_neigh_update_ctx(ctx, RTM_DELNEIGH, buf, buflen);
break; else if (op == DPLANE_OP_VTEP_ADD)
case DPLANE_OP_VTEP_ADD:
ret = netlink_vxlan_flood_update_ctx(ctx, RTM_NEWNEIGH, buf, ret = netlink_vxlan_flood_update_ctx(ctx, RTM_NEWNEIGH, buf,
buflen); buflen);
break; else if (op == DPLANE_OP_VTEP_DELETE)
case DPLANE_OP_VTEP_DELETE:
ret = netlink_vxlan_flood_update_ctx(ctx, RTM_DELNEIGH, buf, ret = netlink_vxlan_flood_update_ctx(ctx, RTM_DELNEIGH, buf,
buflen); buflen);
break; else if (op == DPLANE_OP_NEIGH_TABLE_UPDATE)
case DPLANE_OP_NEIGH_TABLE_UPDATE:
ret = netlink_neigh_table_update_ctx(ctx, buf, buflen); ret = netlink_neigh_table_update_ctx(ctx, buf, buflen);
break; else
case DPLANE_OP_ROUTE_INSTALL:
case DPLANE_OP_ROUTE_UPDATE:
case DPLANE_OP_ROUTE_DELETE:
case DPLANE_OP_ROUTE_NOTIFY:
case DPLANE_OP_NH_INSTALL:
case DPLANE_OP_NH_UPDATE:
case DPLANE_OP_NH_DELETE:
case DPLANE_OP_LSP_INSTALL:
case DPLANE_OP_LSP_UPDATE:
case DPLANE_OP_LSP_DELETE:
case DPLANE_OP_LSP_NOTIFY:
case DPLANE_OP_PW_INSTALL:
case DPLANE_OP_PW_UNINSTALL:
case DPLANE_OP_SYS_ROUTE_ADD:
case DPLANE_OP_SYS_ROUTE_DELETE:
case DPLANE_OP_ADDR_INSTALL:
case DPLANE_OP_ADDR_UNINSTALL:
case DPLANE_OP_MAC_INSTALL:
case DPLANE_OP_MAC_DELETE:
case DPLANE_OP_RULE_ADD:
case DPLANE_OP_RULE_DELETE:
case DPLANE_OP_RULE_UPDATE:
case DPLANE_OP_BR_PORT_UPDATE:
case DPLANE_OP_IPTABLE_ADD:
case DPLANE_OP_IPTABLE_DELETE:
case DPLANE_OP_IPSET_ADD:
case DPLANE_OP_IPSET_DELETE:
case DPLANE_OP_IPSET_ENTRY_ADD:
case DPLANE_OP_IPSET_ENTRY_DELETE:
case DPLANE_OP_GRE_SET:
case DPLANE_OP_INTF_ADDR_ADD:
case DPLANE_OP_INTF_ADDR_DEL:
case DPLANE_OP_INTF_NETCONFIG:
case DPLANE_OP_INTF_INSTALL:
case DPLANE_OP_INTF_UPDATE:
case DPLANE_OP_INTF_DELETE:
case DPLANE_OP_TC_QDISC_INSTALL:
case DPLANE_OP_TC_QDISC_UNINSTALL:
case DPLANE_OP_TC_CLASS_ADD:
case DPLANE_OP_TC_CLASS_DELETE:
case DPLANE_OP_TC_CLASS_UPDATE:
case DPLANE_OP_TC_FILTER_ADD:
case DPLANE_OP_TC_FILTER_DELETE:
case DPLANE_OP_TC_FILTER_UPDATE:
case DPLANE_OP_NONE:
case DPLANE_OP_STARTUP_STAGE:
ret = -1; ret = -1;
}
return ret; return ret;
} }

View File

@ -1770,9 +1770,7 @@ void zebra_mpls_lsp_dplane_result(struct zebra_dplane_ctx *ctx)
label = dplane_ctx_get_in_label(ctx); label = dplane_ctx_get_in_label(ctx);
switch (op) { if (op == DPLANE_OP_LSP_INSTALL || op == DPLANE_OP_LSP_UPDATE) {
case DPLANE_OP_LSP_INSTALL:
case DPLANE_OP_LSP_UPDATE:
/* Look for zebra LSP object */ /* Look for zebra LSP object */
zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT);
lsp_table = zvrf->lsp_table; lsp_table = zvrf->lsp_table;
@ -1783,7 +1781,7 @@ void zebra_mpls_lsp_dplane_result(struct zebra_dplane_ctx *ctx)
if (IS_ZEBRA_DEBUG_DPLANE) if (IS_ZEBRA_DEBUG_DPLANE)
zlog_debug("LSP ctx %p: in-label %u not found", zlog_debug("LSP ctx %p: in-label %u not found",
ctx, dplane_ctx_get_in_label(ctx)); ctx, dplane_ctx_get_in_label(ctx));
break; return;
} }
/* TODO -- Confirm that this result is still 'current' */ /* TODO -- Confirm that this result is still 'current' */
@ -1794,7 +1792,7 @@ void zebra_mpls_lsp_dplane_result(struct zebra_dplane_ctx *ctx)
flog_warn(EC_ZEBRA_LSP_INSTALL_FAILURE, flog_warn(EC_ZEBRA_LSP_INSTALL_FAILURE,
"LSP Install Failure: in-label %u", "LSP Install Failure: in-label %u",
lsp->ile.in_label); lsp->ile.in_label);
break; return;
} }
/* Update zebra object */ /* Update zebra object */
@ -1815,74 +1813,16 @@ void zebra_mpls_lsp_dplane_result(struct zebra_dplane_ctx *ctx)
? ZEBRA_SR_POLICY_LABEL_CREATED ? ZEBRA_SR_POLICY_LABEL_CREATED
: ZEBRA_SR_POLICY_LABEL_UPDATED; : ZEBRA_SR_POLICY_LABEL_UPDATED;
zebra_sr_policy_label_update(label, update_mode); zebra_sr_policy_label_update(label, update_mode);
break; } else if (op == DPLANE_OP_LSP_DELETE) {
case DPLANE_OP_LSP_DELETE:
if (status != ZEBRA_DPLANE_REQUEST_SUCCESS) { if (status != ZEBRA_DPLANE_REQUEST_SUCCESS) {
flog_warn(EC_ZEBRA_LSP_DELETE_FAILURE, flog_warn(EC_ZEBRA_LSP_DELETE_FAILURE,
"LSP Deletion Failure: in-label %u", "LSP Deletion Failure: in-label %u",
dplane_ctx_get_in_label(ctx)); dplane_ctx_get_in_label(ctx));
break; return;
} }
zebra_sr_policy_label_update(label, zebra_sr_policy_label_update(label,
ZEBRA_SR_POLICY_LABEL_REMOVED); ZEBRA_SR_POLICY_LABEL_REMOVED);
break; }
case DPLANE_OP_LSP_NOTIFY:
case DPLANE_OP_NONE:
case DPLANE_OP_ROUTE_INSTALL:
case DPLANE_OP_ROUTE_UPDATE:
case DPLANE_OP_ROUTE_DELETE:
case DPLANE_OP_ROUTE_NOTIFY:
case DPLANE_OP_NH_INSTALL:
case DPLANE_OP_NH_UPDATE:
case DPLANE_OP_NH_DELETE:
case DPLANE_OP_PW_INSTALL:
case DPLANE_OP_PW_UNINSTALL:
case DPLANE_OP_SYS_ROUTE_ADD:
case DPLANE_OP_SYS_ROUTE_DELETE:
case DPLANE_OP_ADDR_INSTALL:
case DPLANE_OP_ADDR_UNINSTALL:
case DPLANE_OP_MAC_INSTALL:
case DPLANE_OP_MAC_DELETE:
case DPLANE_OP_NEIGH_INSTALL:
case DPLANE_OP_NEIGH_UPDATE:
case DPLANE_OP_NEIGH_DELETE:
case DPLANE_OP_VTEP_ADD:
case DPLANE_OP_VTEP_DELETE:
case DPLANE_OP_RULE_ADD:
case DPLANE_OP_RULE_DELETE:
case DPLANE_OP_RULE_UPDATE:
case DPLANE_OP_NEIGH_DISCOVER:
case DPLANE_OP_BR_PORT_UPDATE:
case DPLANE_OP_IPTABLE_ADD:
case DPLANE_OP_IPTABLE_DELETE:
case DPLANE_OP_IPSET_ADD:
case DPLANE_OP_IPSET_DELETE:
case DPLANE_OP_IPSET_ENTRY_ADD:
case DPLANE_OP_IPSET_ENTRY_DELETE:
case DPLANE_OP_NEIGH_IP_INSTALL:
case DPLANE_OP_NEIGH_IP_DELETE:
case DPLANE_OP_NEIGH_TABLE_UPDATE:
case DPLANE_OP_GRE_SET:
case DPLANE_OP_INTF_ADDR_ADD:
case DPLANE_OP_INTF_ADDR_DEL:
case DPLANE_OP_INTF_NETCONFIG:
case DPLANE_OP_INTF_INSTALL:
case DPLANE_OP_INTF_UPDATE:
case DPLANE_OP_INTF_DELETE:
case DPLANE_OP_TC_QDISC_INSTALL:
case DPLANE_OP_TC_QDISC_UNINSTALL:
case DPLANE_OP_TC_CLASS_ADD:
case DPLANE_OP_TC_CLASS_DELETE:
case DPLANE_OP_TC_CLASS_UPDATE:
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 */
} }
/* /*

View File

@ -229,71 +229,18 @@ static int kernel_lsp_cmd(struct zebra_dplane_ctx *ctx)
const struct nexthop *nexthop = NULL; const struct nexthop *nexthop = NULL;
unsigned int nexthop_num = 0; unsigned int nexthop_num = 0;
int action; int action;
enum dplane_op_e op;
switch (dplane_ctx_get_op(ctx)) { op = dplane_ctx_get_op(ctx);
case DPLANE_OP_LSP_DELETE:
if (op == DPLANE_OP_LSP_DELETE)
action = RTM_DELETE; action = RTM_DELETE;
break; else if (op == DPLANE_OP_LSP_INSTALL)
case DPLANE_OP_LSP_INSTALL:
action = RTM_ADD; action = RTM_ADD;
break; else if (op == DPLANE_OP_LSP_UPDATE)
case DPLANE_OP_LSP_UPDATE:
action = RTM_CHANGE; action = RTM_CHANGE;
break; else
case DPLANE_OP_NONE:
case DPLANE_OP_ROUTE_INSTALL:
case DPLANE_OP_ROUTE_UPDATE:
case DPLANE_OP_ROUTE_DELETE:
case DPLANE_OP_ROUTE_NOTIFY:
case DPLANE_OP_NH_INSTALL:
case DPLANE_OP_NH_UPDATE:
case DPLANE_OP_NH_DELETE:
case DPLANE_OP_LSP_NOTIFY:
case DPLANE_OP_PW_INSTALL:
case DPLANE_OP_PW_UNINSTALL:
case DPLANE_OP_SYS_ROUTE_ADD:
case DPLANE_OP_SYS_ROUTE_DELETE:
case DPLANE_OP_ADDR_INSTALL:
case DPLANE_OP_ADDR_UNINSTALL:
case DPLANE_OP_MAC_INSTALL:
case DPLANE_OP_MAC_DELETE:
case DPLANE_OP_NEIGH_INSTALL:
case DPLANE_OP_NEIGH_UPDATE:
case DPLANE_OP_NEIGH_DELETE:
case DPLANE_OP_VTEP_ADD:
case DPLANE_OP_VTEP_DELETE:
case DPLANE_OP_RULE_ADD:
case DPLANE_OP_RULE_DELETE:
case DPLANE_OP_RULE_UPDATE:
case DPLANE_OP_NEIGH_DISCOVER:
case DPLANE_OP_BR_PORT_UPDATE:
case DPLANE_OP_IPTABLE_ADD:
case DPLANE_OP_IPTABLE_DELETE:
case DPLANE_OP_IPSET_ADD:
case DPLANE_OP_IPSET_DELETE:
case DPLANE_OP_IPSET_ENTRY_ADD:
case DPLANE_OP_IPSET_ENTRY_DELETE:
case DPLANE_OP_NEIGH_IP_INSTALL:
case DPLANE_OP_NEIGH_IP_DELETE:
case DPLANE_OP_NEIGH_TABLE_UPDATE:
case DPLANE_OP_GRE_SET:
case DPLANE_OP_INTF_ADDR_ADD:
case DPLANE_OP_INTF_ADDR_DEL:
case DPLANE_OP_INTF_NETCONFIG:
case DPLANE_OP_INTF_INSTALL:
case DPLANE_OP_INTF_UPDATE:
case DPLANE_OP_INTF_DELETE:
case DPLANE_OP_TC_QDISC_INSTALL:
case DPLANE_OP_TC_QDISC_UNINSTALL:
case DPLANE_OP_TC_CLASS_ADD:
case DPLANE_OP_TC_CLASS_DELETE:
case DPLANE_OP_TC_CLASS_UPDATE:
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; return -1;
}
head = dplane_ctx_get_nhlfe_list(ctx); head = dplane_ctx_get_nhlfe_list(ctx);
frr_each(nhlfe_list_const, head, nhlfe) { frr_each(nhlfe_list_const, head, nhlfe) {
@ -443,69 +390,14 @@ static enum zebra_dplane_result kmpw_uninstall(struct zebra_dplane_ctx *ctx)
enum zebra_dplane_result kernel_pw_update(struct zebra_dplane_ctx *ctx) enum zebra_dplane_result kernel_pw_update(struct zebra_dplane_ctx *ctx)
{ {
enum zebra_dplane_result result = ZEBRA_DPLANE_REQUEST_FAILURE; enum zebra_dplane_result result = ZEBRA_DPLANE_REQUEST_FAILURE;
enum dplane_op_e op;
switch (dplane_ctx_get_op(ctx)) { op = dplane_ctx_get_op(ctx);
case DPLANE_OP_PW_INSTALL:
if (op == DPLANE_OP_PW_INSTALL)
result = kmpw_install(ctx); result = kmpw_install(ctx);
break; else if (op == DPLANE_OP_PW_UNINSTALL)
case DPLANE_OP_PW_UNINSTALL:
result = kmpw_uninstall(ctx); result = kmpw_uninstall(ctx);
break;
case DPLANE_OP_NONE:
case DPLANE_OP_ROUTE_INSTALL:
case DPLANE_OP_ROUTE_UPDATE:
case DPLANE_OP_ROUTE_DELETE:
case DPLANE_OP_ROUTE_NOTIFY:
case DPLANE_OP_NH_INSTALL:
case DPLANE_OP_NH_UPDATE:
case DPLANE_OP_NH_DELETE:
case DPLANE_OP_LSP_INSTALL:
case DPLANE_OP_LSP_UPDATE:
case DPLANE_OP_LSP_DELETE:
case DPLANE_OP_LSP_NOTIFY:
case DPLANE_OP_SYS_ROUTE_ADD:
case DPLANE_OP_SYS_ROUTE_DELETE:
case DPLANE_OP_ADDR_INSTALL:
case DPLANE_OP_ADDR_UNINSTALL:
case DPLANE_OP_MAC_INSTALL:
case DPLANE_OP_MAC_DELETE:
case DPLANE_OP_NEIGH_INSTALL:
case DPLANE_OP_NEIGH_UPDATE:
case DPLANE_OP_NEIGH_DELETE:
case DPLANE_OP_VTEP_ADD:
case DPLANE_OP_VTEP_DELETE:
case DPLANE_OP_RULE_ADD:
case DPLANE_OP_RULE_DELETE:
case DPLANE_OP_RULE_UPDATE:
case DPLANE_OP_NEIGH_DISCOVER:
case DPLANE_OP_BR_PORT_UPDATE:
case DPLANE_OP_IPTABLE_ADD:
case DPLANE_OP_IPTABLE_DELETE:
case DPLANE_OP_IPSET_ADD:
case DPLANE_OP_IPSET_DELETE:
case DPLANE_OP_IPSET_ENTRY_ADD:
case DPLANE_OP_IPSET_ENTRY_DELETE:
case DPLANE_OP_NEIGH_IP_INSTALL:
case DPLANE_OP_NEIGH_IP_DELETE:
case DPLANE_OP_NEIGH_TABLE_UPDATE:
case DPLANE_OP_GRE_SET:
case DPLANE_OP_INTF_ADDR_ADD:
case DPLANE_OP_INTF_ADDR_DEL:
case DPLANE_OP_INTF_NETCONFIG:
case DPLANE_OP_INTF_INSTALL:
case DPLANE_OP_INTF_UPDATE:
case DPLANE_OP_INTF_DELETE:
case DPLANE_OP_TC_QDISC_INSTALL:
case DPLANE_OP_TC_QDISC_UNINSTALL:
case DPLANE_OP_TC_CLASS_ADD:
case DPLANE_OP_TC_CLASS_DELETE:
case DPLANE_OP_TC_CLASS_UPDATE:
case DPLANE_OP_TC_FILTER_ADD:
case DPLANE_OP_TC_FILTER_DELETE:
case DPLANE_OP_TC_FILTER_UPDATE:
case DPLANE_OP_STARTUP_STAGE:
break;
}
return result; return result;
} }

View File

@ -3173,8 +3173,7 @@ void zebra_nhg_dplane_result(struct zebra_dplane_ctx *ctx)
"Nexthop dplane ctx %p, op %s, nexthop ID (%u), result %s", "Nexthop dplane ctx %p, op %s, nexthop ID (%u), result %s",
ctx, dplane_op2str(op), id, dplane_res2str(status)); ctx, dplane_op2str(op), id, dplane_res2str(status));
switch (op) { if (op == DPLANE_OP_NH_DELETE) {
case DPLANE_OP_NH_DELETE:
if (status != ZEBRA_DPLANE_REQUEST_SUCCESS) if (status != ZEBRA_DPLANE_REQUEST_SUCCESS)
flog_err( flog_err(
EC_ZEBRA_DP_DELETE_FAIL, EC_ZEBRA_DP_DELETE_FAIL,
@ -3182,18 +3181,15 @@ void zebra_nhg_dplane_result(struct zebra_dplane_ctx *ctx)
id); id);
/* We already free'd the data, nothing to do */ /* We already free'd the data, nothing to do */
break; } else if (op == DPLANE_OP_NH_INSTALL || op == DPLANE_OP_NH_UPDATE) {
case DPLANE_OP_NH_INSTALL:
case DPLANE_OP_NH_UPDATE:
nhe = zebra_nhg_lookup_id(id); nhe = zebra_nhg_lookup_id(id);
if (!nhe) { if (!nhe) {
if (IS_ZEBRA_DEBUG_NHG) if (IS_ZEBRA_DEBUG_NHG)
zlog_debug( zlog_debug("%s operation performed on Nexthop ID (%u) in the kernel, that we no longer have in our table",
"%s operation preformed on Nexthop ID (%u) in the kernel, that we no longer have in our table", dplane_op2str(op), id);
dplane_op2str(op), id);
break; return;
} }
UNSET_FLAG(nhe->flags, NEXTHOP_GROUP_QUEUED); UNSET_FLAG(nhe->flags, NEXTHOP_GROUP_QUEUED);
@ -3221,61 +3217,6 @@ void zebra_nhg_dplane_result(struct zebra_dplane_ctx *ctx)
"Failed to install Nexthop (%pNG) into the kernel", "Failed to install Nexthop (%pNG) into the kernel",
nhe); nhe);
} }
break;
case DPLANE_OP_ROUTE_INSTALL:
case DPLANE_OP_ROUTE_UPDATE:
case DPLANE_OP_ROUTE_DELETE:
case DPLANE_OP_ROUTE_NOTIFY:
case DPLANE_OP_LSP_INSTALL:
case DPLANE_OP_LSP_UPDATE:
case DPLANE_OP_LSP_DELETE:
case DPLANE_OP_LSP_NOTIFY:
case DPLANE_OP_PW_INSTALL:
case DPLANE_OP_PW_UNINSTALL:
case DPLANE_OP_SYS_ROUTE_ADD:
case DPLANE_OP_SYS_ROUTE_DELETE:
case DPLANE_OP_ADDR_INSTALL:
case DPLANE_OP_ADDR_UNINSTALL:
case DPLANE_OP_MAC_INSTALL:
case DPLANE_OP_MAC_DELETE:
case DPLANE_OP_NEIGH_INSTALL:
case DPLANE_OP_NEIGH_UPDATE:
case DPLANE_OP_NEIGH_DELETE:
case DPLANE_OP_NEIGH_IP_INSTALL:
case DPLANE_OP_NEIGH_IP_DELETE:
case DPLANE_OP_VTEP_ADD:
case DPLANE_OP_VTEP_DELETE:
case DPLANE_OP_RULE_ADD:
case DPLANE_OP_RULE_DELETE:
case DPLANE_OP_RULE_UPDATE:
case DPLANE_OP_NEIGH_DISCOVER:
case DPLANE_OP_BR_PORT_UPDATE:
case DPLANE_OP_NONE:
case DPLANE_OP_IPTABLE_ADD:
case DPLANE_OP_IPTABLE_DELETE:
case DPLANE_OP_IPSET_ADD:
case DPLANE_OP_IPSET_DELETE:
case DPLANE_OP_IPSET_ENTRY_ADD:
case DPLANE_OP_IPSET_ENTRY_DELETE:
case DPLANE_OP_NEIGH_TABLE_UPDATE:
case DPLANE_OP_GRE_SET:
case DPLANE_OP_INTF_ADDR_ADD:
case DPLANE_OP_INTF_ADDR_DEL:
case DPLANE_OP_INTF_NETCONFIG:
case DPLANE_OP_INTF_INSTALL:
case DPLANE_OP_INTF_UPDATE:
case DPLANE_OP_INTF_DELETE:
case DPLANE_OP_TC_QDISC_INSTALL:
case DPLANE_OP_TC_QDISC_UNINSTALL:
case DPLANE_OP_TC_CLASS_ADD:
case DPLANE_OP_TC_CLASS_DELETE:
case DPLANE_OP_TC_CLASS_UPDATE:
case DPLANE_OP_TC_FILTER_ADD:
case DPLANE_OP_TC_FILTER_DELETE:
case DPLANE_OP_TC_FILTER_UPDATE:
case DPLANE_OP_STARTUP_STAGE:
break;
} }
} }

View File

@ -2020,9 +2020,7 @@ static void rib_process_result(struct zebra_dplane_ctx *ctx)
UNSET_FLAG(old_re->status, ROUTE_ENTRY_QUEUED); UNSET_FLAG(old_re->status, ROUTE_ENTRY_QUEUED);
} }
switch (op) { if (op == DPLANE_OP_ROUTE_INSTALL || op == DPLANE_OP_ROUTE_UPDATE) {
case DPLANE_OP_ROUTE_INSTALL:
case DPLANE_OP_ROUTE_UPDATE:
if (status == ZEBRA_DPLANE_REQUEST_SUCCESS) { if (status == ZEBRA_DPLANE_REQUEST_SUCCESS) {
if (re) { if (re) {
UNSET_FLAG(re->status, ROUTE_ENTRY_FAILED); UNSET_FLAG(re->status, ROUTE_ENTRY_FAILED);
@ -2113,8 +2111,7 @@ static void rib_process_result(struct zebra_dplane_ctx *ctx)
VRF_LOGNAME(vrf), dplane_ctx_get_vrf(ctx), VRF_LOGNAME(vrf), dplane_ctx_get_vrf(ctx),
dplane_ctx_get_table(ctx), rn); dplane_ctx_get_table(ctx), rn);
} }
break; } else if (op == DPLANE_OP_ROUTE_DELETE) {
case DPLANE_OP_ROUTE_DELETE:
rt_delete = true; rt_delete = true;
if (re) if (re)
SET_FLAG(re->status, ROUTE_ENTRY_FAILED); SET_FLAG(re->status, ROUTE_ENTRY_FAILED);
@ -2153,61 +2150,6 @@ static void rib_process_result(struct zebra_dplane_ctx *ctx)
if ((re && RIB_SYSTEM_ROUTE(re)) || if ((re && RIB_SYSTEM_ROUTE(re)) ||
(old_re && RIB_SYSTEM_ROUTE(old_re))) (old_re && RIB_SYSTEM_ROUTE(old_re)))
zebra_rib_fixup_system(rn); zebra_rib_fixup_system(rn);
break;
case DPLANE_OP_NONE:
case DPLANE_OP_ROUTE_NOTIFY:
case DPLANE_OP_NH_INSTALL:
case DPLANE_OP_NH_UPDATE:
case DPLANE_OP_NH_DELETE:
case DPLANE_OP_LSP_INSTALL:
case DPLANE_OP_LSP_UPDATE:
case DPLANE_OP_LSP_DELETE:
case DPLANE_OP_LSP_NOTIFY:
case DPLANE_OP_PW_INSTALL:
case DPLANE_OP_PW_UNINSTALL:
case DPLANE_OP_SYS_ROUTE_ADD:
case DPLANE_OP_SYS_ROUTE_DELETE:
case DPLANE_OP_ADDR_INSTALL:
case DPLANE_OP_ADDR_UNINSTALL:
case DPLANE_OP_MAC_INSTALL:
case DPLANE_OP_MAC_DELETE:
case DPLANE_OP_NEIGH_INSTALL:
case DPLANE_OP_NEIGH_UPDATE:
case DPLANE_OP_NEIGH_DELETE:
case DPLANE_OP_VTEP_ADD:
case DPLANE_OP_VTEP_DELETE:
case DPLANE_OP_RULE_ADD:
case DPLANE_OP_RULE_DELETE:
case DPLANE_OP_RULE_UPDATE:
case DPLANE_OP_NEIGH_DISCOVER:
case DPLANE_OP_BR_PORT_UPDATE:
case DPLANE_OP_IPTABLE_ADD:
case DPLANE_OP_IPTABLE_DELETE:
case DPLANE_OP_IPSET_ADD:
case DPLANE_OP_IPSET_DELETE:
case DPLANE_OP_IPSET_ENTRY_ADD:
case DPLANE_OP_IPSET_ENTRY_DELETE:
case DPLANE_OP_NEIGH_IP_INSTALL:
case DPLANE_OP_NEIGH_IP_DELETE:
case DPLANE_OP_NEIGH_TABLE_UPDATE:
case DPLANE_OP_GRE_SET:
case DPLANE_OP_INTF_ADDR_ADD:
case DPLANE_OP_INTF_ADDR_DEL:
case DPLANE_OP_INTF_NETCONFIG:
case DPLANE_OP_INTF_INSTALL:
case DPLANE_OP_INTF_UPDATE:
case DPLANE_OP_INTF_DELETE:
case DPLANE_OP_TC_QDISC_INSTALL:
case DPLANE_OP_TC_QDISC_UNINSTALL:
case DPLANE_OP_TC_CLASS_ADD:
case DPLANE_OP_TC_CLASS_DELETE:
case DPLANE_OP_TC_CLASS_UPDATE:
case DPLANE_OP_TC_FILTER_ADD:
case DPLANE_OP_TC_FILTER_DELETE:
case DPLANE_OP_TC_FILTER_UPDATE:
case DPLANE_OP_STARTUP_STAGE:
break;
} }
zebra_rib_evaluate_rn_nexthops(rn, seq, rt_delete); zebra_rib_evaluate_rn_nexthops(rn, seq, rt_delete);