Skip to content

Commit

Permalink
lib: Fixed pipeline len for logical flows.
Browse files Browse the repository at this point in the history
Logical pipeline length was correctly calculated
only for ingress. Calculation for egress was added.

Signed-off-by: Alexandra Rukomoinikova <arukomoinikova@k2.cloud>
Signed-off-by: 0-day Robot <robot@bytheb.org>
  • Loading branch information
Alexandra Rukomoinikova authored and ovsrobot committed Jan 10, 2025
1 parent c9361e6 commit a033bf5
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
6 changes: 4 additions & 2 deletions controller/lflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,10 @@ lflow_parse_actions(const struct sbrec_logical_flow *lflow,
.nd_ra_opts = l_ctx_in->nd_ra_opts,
.controller_event_opts = l_ctx_in->controller_event_opts,

.pipeline = ingress ? OVNACT_P_INGRESS : OVNACT_P_EGRESS,
.n_tables = LOG_PIPELINE_LEN,
.pipeline = ingress ? OVNACT_P_INGRESS
: OVNACT_P_EGRESS,
.n_tables = ingress ? LOG_PIPELINE_INGRESS_LEN
: LOG_PIPELINE_EGRESS_LEN,
.cur_ltable = lflow->table_id,
};

Expand Down
5 changes: 4 additions & 1 deletion lib/actions.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,10 @@ parse_NEXT(struct action_context *ctx)
}
}

if (table >= ctx->pp->n_tables) {
if ((pipeline == OVNACT_P_INGRESS
&& table >= LOG_PIPELINE_INGRESS_LEN) ||
(pipeline == OVNACT_P_EGRESS
&& table >= LOG_PIPELINE_EGRESS_LEN)) {
lexer_error(ctx->lexer,
"\"next\" action cannot advance beyond table %d.",
ctx->pp->n_tables - 1);
Expand Down
3 changes: 2 additions & 1 deletion lib/ovn-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ BUILD_ASSERT_DECL(
#define SCTP_ABORT_CHUNK_FLAG_T (1 << 0)

/* The number of tables for the ingress and egress pipelines. */
#define LOG_PIPELINE_LEN 30
#define LOG_PIPELINE_INGRESS_LEN 31
#define LOG_PIPELINE_EGRESS_LEN 19

static inline uint32_t
hash_add_in6_addr(uint32_t hash, const struct in6_addr *addr)
Expand Down
4 changes: 2 additions & 2 deletions tests/ovn.at
Original file line number Diff line number Diff line change
Expand Up @@ -830,8 +830,8 @@ next();
Syntax error at `)' expecting "pipeline" or "table".
next(10;
Syntax error at `;' expecting `)'.
next(24);
"next" action cannot advance beyond table 23.
next(31);
"next" action cannot advance beyond table 30.

next(table=lflow_table);
formats as next;
Expand Down
3 changes: 2 additions & 1 deletion tests/test-ovn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1341,7 +1341,8 @@ test_parse_actions(struct ovs_cmdl_context *ctx OVS_UNUSED)
.dhcpv6_opts = &dhcpv6_opts,
.nd_ra_opts = &nd_ra_opts,
.controller_event_opts = &event_opts,
.n_tables = 24,
.pipeline = OVNACT_P_INGRESS,
.n_tables = 31,
.cur_ltable = 10,
};

Expand Down
9 changes: 5 additions & 4 deletions utilities/ovn-trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -990,16 +990,17 @@ parse_lflow_for_datapath(const struct sbrec_logical_flow *sblf,
return;
}

bool ingress = !strcmp(sblf->pipeline, "ingress");
struct ovnact_parse_params pp = {
.symtab = &symtab,
.dhcp_opts = &dhcp_opts,
.dhcpv6_opts = &dhcpv6_opts,
.nd_ra_opts = &nd_ra_opts,
.controller_event_opts = &event_opts,
.pipeline = (!strcmp(sblf->pipeline, "ingress")
? OVNACT_P_INGRESS
: OVNACT_P_EGRESS),
.n_tables = LOG_PIPELINE_LEN,
.pipeline = ingress ? OVNACT_P_INGRESS
: OVNACT_P_EGRESS,
.n_tables = ingress ? LOG_PIPELINE_INGRESS_LEN
: LOG_PIPELINE_EGRESS_LEN,
.cur_ltable = sblf->table_id,
};
uint64_t stub[1024 / 8];
Expand Down

0 comments on commit a033bf5

Please sign in to comment.