Commit 506f7d4bcfbc ("northd: rely on new actions for ecmp-symmetric
routing") introduced northd usage of the chk_ecmp_nh, chk_ecmp_nh_mac,
and commit_ecmp_nh actions. Commit 23fdc5fe43b3 ("northd: Always ct
commit ECMP symmetric traffic in the original direction.") removed the
usage of these actions by northd. In the latter commit, it is
specifically noted that the actions' implementations were left alone,
since there was a possibility of a newer ovn-controller being used with
an older ovn-northd that still programmed those actions.That latter commit was made in September of 2023. Since then, we have released two LTS versions of OVN. This should safely allow for us to remove these actions from the code entirely. This commit removes the actions' implementations as well as the documentation for these actions. Signed-off-by: Mark Michelson <[email protected]> --- NEWS | 2 + lib/actions.c | 321 -------------------------------------------------- ovn-sb.xml | 51 -------- 3 files changed, 2 insertions(+), 372 deletions(-) diff --git a/NEWS b/NEWS index c40fd2108..f93bf30e2 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ Post v26.09.0 -------------- + - Removed implementations of the commit_ecmp_nh, chk_ecmp_nh, and + chk_ecmp_nh_mac actions from the code. - Mark tunnel ports as transient (other_config:transient=true) when the local chassis is a member of an HA chassis group. Systems which invoke ovs-ctl --delete-transient-ports during OVS startup diff --git a/lib/actions.c b/lib/actions.c index 77b053361..f5a0b737b 100644 --- a/lib/actions.c +++ b/lib/actions.c @@ -5078,327 +5078,6 @@ ovnact_sample_free(struct ovnact_sample *sample OVS_UNUSED) { } -static void -parse_commit_ecmp_nh(struct action_context *ctx, - struct ovnact_commit_ecmp_nh *ecmp_nh) -{ - uint8_t proto; - bool ipv6; - - lexer_force_match(ctx->lexer, LEX_T_LPAREN); /* Skip '('. */ - if (!lexer_match_id(ctx->lexer, "ipv6")) { - lexer_syntax_error(ctx->lexer, "invalid parameter"); - return; - } - if (!lexer_force_match(ctx->lexer, LEX_T_EQUALS)) { - lexer_syntax_error(ctx->lexer, "invalid parameter"); - return; - } - if (lexer_match_string(ctx->lexer, "true") || - lexer_match_id(ctx->lexer, "true")) { - ipv6 = true; - } else if (lexer_match_string(ctx->lexer, "false") || - lexer_match_id(ctx->lexer, "false")) { - ipv6 = false; - } else { - lexer_syntax_error(ctx->lexer, - "expecting true or false"); - return; - } - - lexer_force_match(ctx->lexer, LEX_T_COMMA); - - if (!lexer_match_id(ctx->lexer, "proto")) { - lexer_syntax_error(ctx->lexer, "invalid parameter"); - return; - } - if (!lexer_force_match(ctx->lexer, LEX_T_EQUALS)) { - lexer_syntax_error(ctx->lexer, "invalid parameter"); - return; - } - if (lexer_match_id(ctx->lexer, "tcp")) { - proto = IPPROTO_TCP; - } else if (lexer_match_id(ctx->lexer, "udp")) { - proto = IPPROTO_UDP; - } else if (lexer_match_id(ctx->lexer, "sctp")) { - proto = IPPROTO_SCTP; - } else { - lexer_syntax_error(ctx->lexer, "invalid protocol"); - return; - } - - lexer_force_match(ctx->lexer, LEX_T_RPAREN); /* Skip ')'. */ - - ecmp_nh->proto = proto; - ecmp_nh->ipv6 = ipv6; -} - -static void -format_COMMIT_ECMP_NH(const struct ovnact_commit_ecmp_nh *ecmp_nh, - struct ds *s) -{ - const char *proto; - - switch (ecmp_nh->proto) { - case IPPROTO_UDP: - proto = "udp"; - break; - case IPPROTO_SCTP: - proto = "sctp"; - break; - case IPPROTO_TCP: - default: - proto = "tcp"; - break; - } - ds_put_format(s, "commit_ecmp_nh(ipv6 = %s, proto = %s);", - ecmp_nh->ipv6 ? "true" : "false", proto); -} - -static void -ovnact_commit_ecmp_nh_free(struct ovnact_commit_ecmp_nh *ecmp_nh OVS_UNUSED) -{ -} - -static void -commit_ecmp_learn_action(struct ofpbuf *ofpacts, bool nw_conn, - bool ipv6, uint8_t proto) -{ - struct ofpact_learn *ol = ofpact_put_LEARN(ofpacts); - struct match match = MATCH_CATCHALL_INITIALIZER; - struct ofpact_learn_spec *ol_spec; - unsigned int imm_bytes; - uint8_t *src_imm; - - ol->flags = NX_LEARN_F_DELETE_LEARNED; - ol->idle_timeout = 20; /* seconds. */ - ol->hard_timeout = 30; /* seconds. */ - ol->priority = OFP_DEFAULT_PRIORITY; - ol->table_id = nw_conn ? OFTABLE_ECMP_NH_MAC : OFTABLE_ECMP_NH; - - /* Match on metadata of the packet that created the new table. */ - ol_spec = ofpbuf_put_zeros(ofpacts, sizeof *ol_spec); - ol_spec->dst.field = mf_from_id(MFF_METADATA); - ol_spec->dst.ofs = 0; - ol_spec->dst.n_bits = ol_spec->dst.field->n_bits; - ol_spec->n_bits = ol_spec->dst.n_bits; - ol_spec->dst_type = NX_LEARN_DST_MATCH; - ol_spec->src_type = NX_LEARN_SRC_FIELD; - ol_spec->src.field = mf_from_id(MFF_METADATA); - - if (nw_conn) { - ol_spec = ofpbuf_put_zeros(ofpacts, sizeof *ol_spec); - ol_spec->dst.field = mf_from_id(MFF_ETH_SRC); - ol_spec->src.field = mf_from_id(MFF_ETH_SRC); - ol_spec->dst.ofs = 0; - ol_spec->dst.n_bits = ol_spec->dst.field->n_bits; - ol_spec->n_bits = ol_spec->dst.n_bits; - ol_spec->dst_type = NX_LEARN_DST_MATCH; - ol_spec->src_type = NX_LEARN_SRC_FIELD; - } - - /* Match on the same ETH type as the packet that created the new table. */ - ol_spec = ofpbuf_put_zeros(ofpacts, sizeof *ol_spec); - ol_spec->dst.field = mf_from_id(MFF_ETH_TYPE); - ol_spec->dst.ofs = 0; - ol_spec->dst.n_bits = ol_spec->dst.field->n_bits; - ol_spec->n_bits = ol_spec->dst.n_bits; - ol_spec->dst_type = NX_LEARN_DST_MATCH; - ol_spec->src_type = NX_LEARN_SRC_IMMEDIATE; - union mf_value imm_eth_type = { - .be16 = ipv6 ? htons(ETH_TYPE_IPV6) : htons(ETH_TYPE_IP) - }; - mf_write_subfield_value(&ol_spec->dst, &imm_eth_type, &match); - /* Push value last, as this may reallocate 'ol_spec'. */ - imm_bytes = DIV_ROUND_UP(ol_spec->dst.n_bits, 8); - src_imm = ofpbuf_put_zeros(ofpacts, OFPACT_ALIGN(imm_bytes)); - memcpy(src_imm, &imm_eth_type, imm_bytes); - - /* IP src. */ - ol_spec = ofpbuf_put_zeros(ofpacts, sizeof *ol_spec); - ol_spec->dst.field = - ipv6 ? mf_from_id(MFF_IPV6_SRC) : mf_from_id(MFF_IPV4_SRC); - if (nw_conn) { - ol_spec->src.field = - ipv6 ? mf_from_id(MFF_IPV6_SRC) : mf_from_id(MFF_IPV4_SRC); - } else { - ol_spec->src.field = - ipv6 ? mf_from_id(MFF_IPV6_DST) : mf_from_id(MFF_IPV4_DST); - } - ol_spec->dst.ofs = 0; - ol_spec->dst.n_bits = ol_spec->dst.field->n_bits; - ol_spec->n_bits = ol_spec->dst.n_bits; - ol_spec->dst_type = NX_LEARN_DST_MATCH; - ol_spec->src_type = NX_LEARN_SRC_FIELD; - - /* IP dst. */ - ol_spec = ofpbuf_put_zeros(ofpacts, sizeof *ol_spec); - ol_spec->dst.field = - ipv6 ? mf_from_id(MFF_IPV6_DST) : mf_from_id(MFF_IPV4_DST); - if (nw_conn) { - ol_spec->src.field = - ipv6 ? mf_from_id(MFF_IPV6_DST) : mf_from_id(MFF_IPV4_DST); - } else { - ol_spec->src.field = - ipv6 ? mf_from_id(MFF_IPV6_SRC) : mf_from_id(MFF_IPV4_SRC); - } - ol_spec->dst.ofs = 0; - ol_spec->dst.n_bits = ol_spec->dst.field->n_bits; - ol_spec->n_bits = ol_spec->dst.n_bits; - ol_spec->dst_type = NX_LEARN_DST_MATCH; - ol_spec->src_type = NX_LEARN_SRC_FIELD; - - /* IP proto. */ - union mf_value imm_proto = { - .u8 = proto, - }; - ol_spec = ofpbuf_put_zeros(ofpacts, sizeof *ol_spec); - ol_spec->dst.field = mf_from_id(MFF_IP_PROTO); - ol_spec->src.field = mf_from_id(MFF_IP_PROTO); - ol_spec->dst.ofs = 0; - ol_spec->dst.n_bits = ol_spec->dst.field->n_bits; - ol_spec->n_bits = ol_spec->dst.n_bits; - ol_spec->dst_type = NX_LEARN_DST_MATCH; - ol_spec->src_type = NX_LEARN_SRC_IMMEDIATE; - mf_write_subfield_value(&ol_spec->dst, &imm_proto, &match); - /* Push value last, as this may reallocate 'ol_spec' */ - imm_bytes = DIV_ROUND_UP(ol_spec->dst.n_bits, 8); - src_imm = ofpbuf_put_zeros(ofpacts, OFPACT_ALIGN(imm_bytes)); - memcpy(src_imm, &imm_proto, imm_bytes); - - /* src port */ - ol_spec = ofpbuf_put_zeros(ofpacts, sizeof *ol_spec); - switch (proto) { - case IPPROTO_TCP: - ol_spec->dst.field = mf_from_id(MFF_TCP_SRC); - ol_spec->src.field = - nw_conn ? mf_from_id(MFF_TCP_SRC) : mf_from_id(MFF_TCP_DST); - break; - case IPPROTO_UDP: - ol_spec->dst.field = mf_from_id(MFF_UDP_SRC); - ol_spec->src.field = - nw_conn ? mf_from_id(MFF_UDP_SRC) : mf_from_id(MFF_UDP_DST); - break; - case IPPROTO_SCTP: - ol_spec->dst.field = mf_from_id(MFF_SCTP_SRC); - ol_spec->src.field = - nw_conn ? mf_from_id(MFF_SCTP_SRC) : mf_from_id(MFF_SCTP_DST); - break; - default: - OVS_NOT_REACHED(); - break; - } - ol_spec->dst.ofs = 0; - ol_spec->dst.n_bits = ol_spec->dst.field->n_bits; - ol_spec->n_bits = ol_spec->dst.n_bits; - ol_spec->dst_type = NX_LEARN_DST_MATCH; - ol_spec->src_type = NX_LEARN_SRC_FIELD; - - /* dst port */ - ol_spec = ofpbuf_put_zeros(ofpacts, sizeof *ol_spec); - switch (proto) { - case IPPROTO_TCP: - ol_spec->dst.field = mf_from_id(MFF_TCP_DST); - ol_spec->src.field = - nw_conn ? mf_from_id(MFF_TCP_DST) : mf_from_id(MFF_TCP_SRC); - break; - case IPPROTO_UDP: - ol_spec->dst.field = mf_from_id(MFF_UDP_DST); - ol_spec->src.field = - nw_conn ? mf_from_id(MFF_UDP_DST) : mf_from_id(MFF_UDP_SRC); - break; - case IPPROTO_SCTP: - ol_spec->dst.field = mf_from_id(MFF_SCTP_DST); - ol_spec->src.field = - nw_conn ? mf_from_id(MFF_SCTP_DST) : mf_from_id(MFF_SCTP_SRC); - break; - default: - OVS_NOT_REACHED(); - break; - } - ol_spec->dst.ofs = 0; - ol_spec->dst.n_bits = ol_spec->dst.field->n_bits; - ol_spec->n_bits = ol_spec->dst.n_bits; - ol_spec->dst_type = NX_LEARN_DST_MATCH; - ol_spec->src_type = NX_LEARN_SRC_FIELD; - - /* Set MLF_LOOKUP_COMMIT_ECMP_NH_BIT for ecmp replies. */ - ol_spec = ofpbuf_put_zeros(ofpacts, sizeof *ol_spec); - ol_spec->dst.field = mf_from_id(MFF_LOG_FLAGS); - ol_spec->dst.ofs = MLF_LOOKUP_COMMIT_ECMP_NH_BIT; - ol_spec->dst.n_bits = 1; - ol_spec->n_bits = ol_spec->dst.n_bits; - ol_spec->dst_type = NX_LEARN_DST_LOAD; - ol_spec->src_type = NX_LEARN_SRC_IMMEDIATE; - union mf_value imm_reg_value = { - .u8 = 1 - }; - mf_write_subfield_value(&ol_spec->dst, &imm_reg_value, &match); - - /* Push value last, as this may reallocate 'ol_spec' */ - imm_bytes = DIV_ROUND_UP(ol_spec->dst.n_bits, 8); - src_imm = ofpbuf_put_zeros(ofpacts, OFPACT_ALIGN(imm_bytes)); - ol = ofpacts->header; - memcpy(src_imm, &imm_reg_value, imm_bytes); - - ofpact_finish_LEARN(ofpacts, &ol); -} - -static void -encode_COMMIT_ECMP_NH(const struct ovnact_commit_ecmp_nh *ecmp_nh, - const struct ovnact_encode_params *ep OVS_UNUSED, - struct ofpbuf *ofpacts) -{ - commit_ecmp_learn_action(ofpacts, true, ecmp_nh->ipv6, ecmp_nh->proto); - commit_ecmp_learn_action(ofpacts, false, ecmp_nh->ipv6, ecmp_nh->proto); -} - -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); -} - static void parse_commit_lb_aff(struct action_context *ctx, struct ovnact_commit_lb_aff *lb_aff) diff --git a/ovn-sb.xml b/ovn-sb.xml index c72a20678..4ae24e483 100644 --- a/ovn-sb.xml +++ b/ovn-sb.xml @@ -2811,57 +2811,6 @@ tcp.flags = RST; </p> </dd> - <dt><code>commit_ecmp_nh(<var>ipv6</var>);</code></dt> - <dd> - <p> - <b>Parameters</b>: IPv4/IPv6 traffic. - </p> - - <p> - This action translates to an openflow "learn" action that inserts - two new flows in tables 76 and 77. - </p> - - <ul> - <li> - Match on the the 5-tuple and the expected next-hop mac address - in table 76: <code>nw_src=ip0</code>, <code>nw_dst=ip1</code>, - <code>ip_proto</code>,<code>tp_src=l4_port0</code>, - <code>tp_dst=l4_port1</code>,<code>dl_src=ethaddr</code> and - set <code>reg9[5]</code>. - </li> - <li> - Match on the 5-tuple in table 77: <code>nw_src=ip1</code>, - <code>nw_dst=ip0</code>, <code>ip_proto</code>, - <code>tp_src=l4_port1</code>, <code>tp_dst=l4_port0</code> - and set <code>reg9[5]</code> to 1 - </li> - </ul> - - <p> - This action is applied if the packet arrives via ECMP route or - 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 - any flow in table 76. 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 77. If it is so, then the 1-bit destination - register <var>R</var> is set to 1. - </p> - </dd> - <dt> <code> commit_lb_aff(<var>vip</var>, <var>backend</var>, -- 2.55.0 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
