check_ecmp_nh_mac/check_ecmp_nh actions check if the packet under consideration matches the any flow in table OFTABLE_ECMP_NH_MAC/OFTABLE_ECMP_NH. If it is so, then the 1-bit destination register is set to 1. chk_ecmp_nh and chk_ecmp_nh_mac will be used to improve ECMP symmetric routing reliability.
Signed-off-by: Lorenzo Bianconi <[email protected]> --- include/ovn/actions.h | 2 ++ lib/actions.c | 54 +++++++++++++++++++++++++++++++++++++++++++ ovn-sb.xml | 20 ++++++++++++++++ utilities/ovn-trace.c | 4 ++++ 4 files changed, 80 insertions(+) diff --git a/include/ovn/actions.h b/include/ovn/actions.h index cef930e1a..4a3b9195a 100644 --- a/include/ovn/actions.h +++ b/include/ovn/actions.h @@ -119,6 +119,8 @@ struct ovn_extend_table; OVNACT(CHECK_IN_PORT_SEC, ovnact_result) \ OVNACT(CHECK_OUT_PORT_SEC, ovnact_result) \ OVNACT(COMMIT_ECMP_NH, ovnact_commit_ecmp_nh) \ + OVNACT(CHK_ECMP_NH_MAC, ovnact_result) \ + OVNACT(CHK_ECMP_NH, ovnact_result) \ /* enum ovnact_type, with a member OVNACT_<ENUM> for each action. */ enum OVS_PACKED_ENUM ovnact_type { diff --git a/lib/actions.c b/lib/actions.c index 132c63228..e941f3cb4 100644 --- a/lib/actions.c +++ b/lib/actions.c @@ -4452,6 +4452,52 @@ encode_COMMIT_ECMP_NH(const struct ovnact_commit_ecmp_nh *ecmp_nh, commit_ecmp_learn_action(ofpacts, false, ecmp_nh->ipv6); } +static void +parse_chk_ecmp_nh_mac(struct action_context *ctx, const struct expr_field *dst, + struct ovnact_result *res) +{ + parse_ovnact_result(ctx, "chk_ecmp_nh_mac", NULL, dst, res); +} + +static void +format_CHK_ECMP_NH_MAC(const struct ovnact_result *res, struct ds *s) +{ + expr_field_format(&res->dst, s); + ds_put_cstr(s, " = chk_ecmp_nh_mac();"); +} + +static void +encode_CHK_ECMP_NH_MAC(const struct ovnact_result *res, + const struct ovnact_encode_params *ep OVS_UNUSED, + struct ofpbuf *ofpacts) +{ + encode_result_action__(res, OFTABLE_ECMP_NH_MAC, + MLF_LOOKUP_COMMIT_ECMP_NH_BIT, ofpacts); +} + +static void +parse_chk_ecmp_nh(struct action_context *ctx, const struct expr_field *dst, + struct ovnact_result *res) +{ + parse_ovnact_result(ctx, "chk_ecmp_nh", NULL, dst, res); +} + +static void +format_CHK_ECMP_NH(const struct ovnact_result *res, struct ds *s) +{ + expr_field_format(&res->dst, s); + ds_put_cstr(s, " = chk_ecmp_nh();"); +} + +static void +encode_CHK_ECMP_NH(const struct ovnact_result *res, + const struct ovnact_encode_params *ep OVS_UNUSED, + struct ofpbuf *ofpacts) +{ + encode_result_action__(res, OFTABLE_ECMP_NH, + MLF_LOOKUP_COMMIT_ECMP_NH_BIT, ofpacts); +} + /* Parses an assignment or exchange or put_dhcp_opts action. */ static void parse_set_action(struct action_context *ctx) @@ -4528,6 +4574,14 @@ parse_set_action(struct action_context *ctx) && lexer_lookahead(ctx->lexer) == LEX_T_LPAREN) { parse_check_out_port_sec( ctx, &lhs, ovnact_put_CHECK_OUT_PORT_SEC(ctx->ovnacts)); + } else if (!strcmp(ctx->lexer->token.s, "chk_ecmp_nh_mac") + && lexer_lookahead(ctx->lexer) == LEX_T_LPAREN) { + parse_chk_ecmp_nh_mac(ctx, &lhs, + ovnact_put_CHK_ECMP_NH_MAC(ctx->ovnacts)); + } else if (!strcmp(ctx->lexer->token.s, "chk_ecmp_nh") + && lexer_lookahead(ctx->lexer) == LEX_T_LPAREN) { + parse_chk_ecmp_nh(ctx, &lhs, + ovnact_put_CHK_ECMP_NH(ctx->ovnacts)); } else { parse_assignment_action(ctx, false, &lhs); } diff --git a/ovn-sb.xml b/ovn-sb.xml index ef5586020..dfed06e95 100644 --- a/ovn-sb.xml +++ b/ovn-sb.xml @@ -2607,6 +2607,26 @@ tcp.flags = RST; if it is routed via an ECMP route </p> </dd> + + <dt><code><var>R</var> = check_ecmp_nh_mac();</code></dt> + <dd> + <p> + This action checks if the packet under consideration matches + the any flow in table <code>OFTABLE_ECMP_NH_MAC</code>. + If it is so, then the 1-bit destination register <var>R</var> + is set to 1. + </p> + </dd> + + <dt><code><var>R</var> = check_ecmp_nh();</code></dt> + <dd> + <p> + This action checks if the packet under consideration matches + the any flow in table <code>OFTABLE_ECMP_NH</code>. + If it is so, then the 1-bit destination register <var>R</var> + is set to 1. + </p> + </dd> </dl> </column> diff --git a/utilities/ovn-trace.c b/utilities/ovn-trace.c index fd84a1a5e..14daff672 100644 --- a/utilities/ovn-trace.c +++ b/utilities/ovn-trace.c @@ -3226,6 +3226,10 @@ trace_actions(const struct ovnact *ovnacts, size_t ovnacts_len, break; case OVNACT_COMMIT_ECMP_NH: break; + case OVNACT_CHK_ECMP_NH_MAC: + break; + case OVNACT_CHK_ECMP_NH: + break; } } ofpbuf_uninit(&stack); -- 2.36.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
