summaryrefslogtreecommitdiff
path: root/ovn/controller
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2016-07-28 14:49:21 -0700
committerBen Pfaff <blp@ovn.org>2016-08-08 11:01:02 -0700
commit98926186f89c2dee40646fac6fe676332aabd3f8 (patch)
treee13fff0d6ccb99f8827fccc4068d9350ee6f0ed3 /ovn/controller
parent6383b6df755fafaf0830081af6cfb45aeaf167fd (diff)
downloadopenvswitch-98926186f89c2dee40646fac6fe676332aabd3f8.tar.gz
logical-fields: Get rid of MFF_LOG_REGS in favor of something sensible.
It's super-awkward to have to define a macro to use MFF_LOG_REGS; this makes more sense. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Ryan Moats <rmoats@us.ibm.com>
Diffstat (limited to 'ovn/controller')
-rw-r--r--ovn/controller/lflow.c17
-rw-r--r--ovn/controller/physical.c6
2 files changed, 8 insertions, 15 deletions
diff --git a/ovn/controller/lflow.c b/ovn/controller/lflow.c
index fda10ebac..9eb92c838 100644
--- a/ovn/controller/lflow.c
+++ b/ovn/controller/lflow.c
@@ -52,15 +52,6 @@ lflow_reset_processing(void)
physical_reset_processing();
}
-static void
-add_logical_register(struct shash *symtab, enum mf_field_id id)
-{
- char name[8];
-
- snprintf(name, sizeof name, "reg%d", id - MFF_REG0);
- expr_symtab_add_field(symtab, name, id, NULL, false);
-}
-
void
lflow_init(void)
{
@@ -74,9 +65,11 @@ lflow_init(void)
expr_symtab_add_string(&symtab, "outport", MFF_LOG_OUTPORT, NULL);
/* Logical registers. */
-#define MFF_LOG_REG(ID) add_logical_register(&symtab, ID);
- MFF_LOG_REGS;
-#undef MFF_LOG_REG
+ for (int i = 0; i < MFF_N_LOG_REGS; i++) {
+ char *name = xasprintf("reg%d", i);
+ expr_symtab_add_field(&symtab, name, MFF_LOG_REG0 + i, NULL, false);
+ free(name);
+ }
expr_symtab_add_field(&symtab, "xxreg0", MFF_XXREG0, NULL, false);
expr_symtab_add_field(&symtab, "xxreg1", MFF_XXREG1, NULL, false);
diff --git a/ovn/controller/physical.c b/ovn/controller/physical.c
index 15d4e006b..589b053e3 100644
--- a/ovn/controller/physical.c
+++ b/ovn/controller/physical.c
@@ -908,9 +908,9 @@ physical_run(struct controller_ctx *ctx, enum mf_field_id mff_ovn_geneve,
* registers (for consistent behavior with packets that get tunneled). */
match_init_catchall(&match);
ofpbuf_clear(&ofpacts);
-#define MFF_LOG_REG(ID) put_load(0, ID, 0, 32, &ofpacts);
- MFF_LOG_REGS;
-#undef MFF_LOG_REGS
+ for (int i = 0; i < MFF_N_LOG_REGS; i++) {
+ put_load(0, MFF_REG0 + i, 0, 32, &ofpacts);
+ }
put_resubmit(OFTABLE_LOG_EGRESS_PIPELINE, &ofpacts);
ofctrl_add_flow(OFTABLE_CHECK_LOOPBACK, 0, &match, &ofpacts, hc_uuid);