Skip to content

Commit

Permalink
openvswitch: Refactor ovs_flow_tbl_insert().
Browse files Browse the repository at this point in the history
Rework so that ovs_flow_tbl_insert() calls flow_{key,mask}_insert().
This tidies up a future patch.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
joestringer authored and davem330 committed Jan 26, 2015
1 parent 5b4237b commit d29ab6f
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions net/openvswitch/flow_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,16 +585,10 @@ static int flow_mask_insert(struct flow_table *tbl, struct sw_flow *flow,
}

/* Must be called with OVS mutex held. */
int ovs_flow_tbl_insert(struct flow_table *table, struct sw_flow *flow,
const struct sw_flow_mask *mask)
static void flow_key_insert(struct flow_table *table, struct sw_flow *flow)
{
struct table_instance *new_ti = NULL;
struct table_instance *ti;
int err;

err = flow_mask_insert(table, flow, mask);
if (err)
return err;

flow->hash = flow_hash(&flow->key, flow->mask->range.start,
flow->mask->range.end);
Expand All @@ -613,6 +607,19 @@ int ovs_flow_tbl_insert(struct flow_table *table, struct sw_flow *flow,
table_instance_destroy(ti, true);
table->last_rehash = jiffies;
}
}

/* Must be called with OVS mutex held. */
int ovs_flow_tbl_insert(struct flow_table *table, struct sw_flow *flow,
const struct sw_flow_mask *mask)
{
int err;

err = flow_mask_insert(table, flow, mask);
if (err)
return err;
flow_key_insert(table, flow);

return 0;
}

Expand Down

0 comments on commit d29ab6f

Please sign in to comment.