From a033bf5b6b5600c1778700255d0e20db88dc72de Mon Sep 17 00:00:00 2001 From: Alexandra Rukomoinikova Date: Fri, 10 Jan 2025 19:23:38 +0300 Subject: [PATCH] lib: Fixed pipeline len for logical flows. Logical pipeline length was correctly calculated only for ingress. Calculation for egress was added. Signed-off-by: Alexandra Rukomoinikova Signed-off-by: 0-day Robot --- controller/lflow.c | 6 ++++-- lib/actions.c | 5 ++++- lib/ovn-util.h | 3 ++- tests/ovn.at | 4 ++-- tests/test-ovn.c | 3 ++- utilities/ovn-trace.c | 9 +++++---- 6 files changed, 19 insertions(+), 11 deletions(-) diff --git a/controller/lflow.c b/controller/lflow.c index 856261f405..f80c108554 100644 --- a/controller/lflow.c +++ b/controller/lflow.c @@ -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, }; diff --git a/lib/actions.c b/lib/actions.c index ea30be767e..a4920743a1 100644 --- a/lib/actions.c +++ b/lib/actions.c @@ -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); diff --git a/lib/ovn-util.h b/lib/ovn-util.h index 899bd9d12c..4b491569d6 100644 --- a/lib/ovn-util.h +++ b/lib/ovn-util.h @@ -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) diff --git a/tests/ovn.at b/tests/ovn.at index de01a649f6..3a9da6cb44 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -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; diff --git a/tests/test-ovn.c b/tests/test-ovn.c index b097ec084e..7ebb17723c 100644 --- a/tests/test-ovn.c +++ b/tests/test-ovn.c @@ -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, }; diff --git a/utilities/ovn-trace.c b/utilities/ovn-trace.c index bd31cdbf5e..88109b2e88 100644 --- a/utilities/ovn-trace.c +++ b/utilities/ovn-trace.c @@ -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];