mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
meta-flow: Simplify handling of a variable number of registers.
At the time that Open vSwitch implemented registers, there was a high cost to adding additional fields, so I wrote the code so that the number of registers could be reduced at compile time. Now, fields are cheaper (though not free) and in the meantime I have never heard of anyone reducing the number of registers. Since I intend to add more code that would require awkward "#if"s like this, I think that this is a good time to simplify it by requiring FLOW_N_REGS to be fixed. This commit does that. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
This commit is contained in:
@@ -223,32 +223,17 @@ const struct mf_field mf_fields[MFF_N_IDS] = {
|
||||
OFPUTIL_P_NXM_OXM_ANY, \
|
||||
-1, \
|
||||
}
|
||||
#if FLOW_N_REGS > 0
|
||||
#if FLOW_N_REGS == 8
|
||||
REGISTER(0),
|
||||
#endif
|
||||
#if FLOW_N_REGS > 1
|
||||
REGISTER(1),
|
||||
#endif
|
||||
#if FLOW_N_REGS > 2
|
||||
REGISTER(2),
|
||||
#endif
|
||||
#if FLOW_N_REGS > 3
|
||||
REGISTER(3),
|
||||
#endif
|
||||
#if FLOW_N_REGS > 4
|
||||
REGISTER(4),
|
||||
#endif
|
||||
#if FLOW_N_REGS > 5
|
||||
REGISTER(5),
|
||||
#endif
|
||||
#if FLOW_N_REGS > 6
|
||||
REGISTER(6),
|
||||
#endif
|
||||
#if FLOW_N_REGS > 7
|
||||
REGISTER(7),
|
||||
#endif
|
||||
#if FLOW_N_REGS > 8
|
||||
#error
|
||||
#else
|
||||
#error "Need to update mf_fields[] to match FLOW_N_REGS"
|
||||
#endif
|
||||
|
||||
/* ## -- ## */
|
||||
|
Reference in New Issue
Block a user