Commit d29ab6f8 authored by Joe Stringer's avatar Joe Stringer Committed by David S. Miller

openvswitch: Refactor ovs_flow_tbl_insert().

Rework so that ovs_flow_tbl_insert() calls flow_{key,mask}_insert().
This tidies up a future patch.
Signed-off-by: default avatarJoe Stringer <joestringer@nicira.com>
Acked-by: default avatarPravin B Shelar <pshelar@nicira.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5b4237bb
...@@ -585,16 +585,10 @@ static int flow_mask_insert(struct flow_table *tbl, struct sw_flow *flow, ...@@ -585,16 +585,10 @@ static int flow_mask_insert(struct flow_table *tbl, struct sw_flow *flow,
} }
/* Must be called with OVS mutex held. */ /* Must be called with OVS mutex held. */
int ovs_flow_tbl_insert(struct flow_table *table, struct sw_flow *flow, static void flow_key_insert(struct flow_table *table, struct sw_flow *flow)
const struct sw_flow_mask *mask)
{ {
struct table_instance *new_ti = NULL; struct table_instance *new_ti = NULL;
struct table_instance *ti; 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->hash = flow_hash(&flow->key, flow->mask->range.start,
flow->mask->range.end); flow->mask->range.end);
...@@ -613,6 +607,19 @@ int ovs_flow_tbl_insert(struct flow_table *table, struct sw_flow *flow, ...@@ -613,6 +607,19 @@ int ovs_flow_tbl_insert(struct flow_table *table, struct sw_flow *flow,
table_instance_destroy(ti, true); table_instance_destroy(ti, true);
table->last_rehash = jiffies; 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; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment