[ovs-dev] [PATCH 3/8] ofproto-dpif: Hide rule_dpif_miss_rule().

Ben Pfaff blp at nicira.com
Mon Aug 5 18:40:00 UTC 2013


On Sat, Aug 03, 2013 at 06:42:05PM -0700, Ethan Jackson wrote:
> It's simple to hide it than to make it thread safe and ensure it stays
> that way in the long term.
> 
> Signed-off-by: Ethan Jackson <ethan at nicira.com>

I don't like how this duplicates logic in two places.  Could we have
this code in just one place please?  I see that the concepts are a
little different in each place but perhaps we could have a function
that just takes a 'config' value and chooses between a packet_in_rule
and a miss_rule?  Even something like this:

/* Specify 0 for 'config' if you don't have a port. */
struct dpif_rule *
choose_miss_rule(enum ofputil_port_config config,
                 const struct dpif_rule *miss_rule,
                 const struct dpif_rule *no_packet_in_rule)
{
    return config & OFPUTIL_PC_NO_PACKET_IN ? no_packet_in_rule : miss_rule;
}

would avoid duplicating logic even if it doesn't simplify the code.



More information about the dev mailing list