Skip to content

Commit

Permalink
actions: introduce chk_ecmp_nh and chk_ecmp_nh_mac actions
Browse files Browse the repository at this point in the history
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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Mark Michelson <mmichels@redhat.com>
Acked-by: Mark Michelson <mmichels@redhat.com>
  • Loading branch information
LorenzoBianconi authored and putnopvut committed Aug 19, 2022
1 parent b504ea1 commit be4f46c
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/ovn/actions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
54 changes: 54 additions & 0 deletions lib/actions.c
Original file line number Diff line number Diff line change
Expand Up @@ -4554,6 +4554,52 @@ encode_COMMIT_ECMP_NH(const struct ovnact_commit_ecmp_nh *ecmp_nh,
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);
}

/* Parses an assignment or exchange or put_dhcp_opts action. */
static void
parse_set_action(struct action_context *ctx)
Expand Down Expand Up @@ -4630,6 +4676,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);
}
Expand Down
18 changes: 18 additions & 0 deletions ovn-sb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2606,6 +2606,24 @@ 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
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>
</dl>
</column>

Expand Down
8 changes: 8 additions & 0 deletions tests/ovn.at
Original file line number Diff line number Diff line change
Expand Up @@ -2084,6 +2084,14 @@ commit_ecmp_nh(ipv6 = "true", proto = udp);
commit_ecmp_nh(proto = sctp);
Syntax error at `proto' invalid parameter.

# chk_ecmp_nh_mac
reg9[5] = chk_ecmp_nh_mac();
encodes as set_field:0/0x2000->reg10,resubmit(,76),move:NXM_NX_REG10[13]->OXM_OF_PKT_REG4[5]

# chk_ecmp_nh
reg9[5] = chk_ecmp_nh();
encodes as set_field:0/0x2000->reg10,resubmit(,77),move:NXM_NX_REG10[13]->OXM_OF_PKT_REG4[5]

# push/pop
push(xxreg0);push(xxreg1[10..20]);push(eth.src);pop(xxreg0[0..47]);pop(xxreg0[48..57]);pop(xxreg1);
formats as push(xxreg0); push(xxreg1[10..20]); push(eth.src); pop(xxreg0[0..47]); pop(xxreg0[48..57]); pop(xxreg1);
Expand Down
4 changes: 4 additions & 0 deletions utilities/ovn-trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -3294,6 +3294,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);
Expand Down

0 comments on commit be4f46c

Please sign in to comment.