diff options
| author | Pravin B Shelar <pshelar@nicira.com> | 2014-05-06 21:41:20 -0400 |
|---|---|---|
| committer | Pravin B Shelar <pshelar@nicira.com> | 2014-11-06 02:52:34 -0500 |
| commit | 9b996e544a6bc7d201060fdcbdb5d4a9b734aa1b (patch) | |
| tree | 460ba6f2685e4030871b43db2d3183bc1f781747 /net/openvswitch | |
| parent | 25cd9ba0abc0749e5cb78e6493c6f6b3311ec6c5 (diff) | |
openvswitch: Move table destroy to dp-rcu callback.
Ths simplifies flow-table-destroy API. No need to pass explicit
parameter about context.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Thomas Graf <tgraf@redhat.com>
Diffstat (limited to 'net/openvswitch')
| -rw-r--r-- | net/openvswitch/datapath.c | 5 | ||||
| -rw-r--r-- | net/openvswitch/flow_table.c | 11 | ||||
| -rw-r--r-- | net/openvswitch/flow_table.h | 2 |
3 files changed, 10 insertions, 8 deletions
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 688cb9bc0ef1..a532a9c46d20 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
| @@ -187,6 +187,7 @@ static void destroy_dp_rcu(struct rcu_head *rcu) | |||
| 187 | { | 187 | { |
| 188 | struct datapath *dp = container_of(rcu, struct datapath, rcu); | 188 | struct datapath *dp = container_of(rcu, struct datapath, rcu); |
| 189 | 189 | ||
| 190 | ovs_flow_tbl_destroy(&dp->table); | ||
| 190 | free_percpu(dp->stats_percpu); | 191 | free_percpu(dp->stats_percpu); |
| 191 | release_net(ovs_dp_get_net(dp)); | 192 | release_net(ovs_dp_get_net(dp)); |
| 192 | kfree(dp->ports); | 193 | kfree(dp->ports); |
| @@ -1444,7 +1445,7 @@ err_destroy_ports_array: | |||
| 1444 | err_destroy_percpu: | 1445 | err_destroy_percpu: |
| 1445 | free_percpu(dp->stats_percpu); | 1446 | free_percpu(dp->stats_percpu); |
| 1446 | err_destroy_table: | 1447 | err_destroy_table: |
| 1447 | ovs_flow_tbl_destroy(&dp->table, false); | 1448 | ovs_flow_tbl_destroy(&dp->table); |
| 1448 | err_free_dp: | 1449 | err_free_dp: |
| 1449 | release_net(ovs_dp_get_net(dp)); | 1450 | release_net(ovs_dp_get_net(dp)); |
| 1450 | kfree(dp); | 1451 | kfree(dp); |
| @@ -1476,8 +1477,6 @@ static void __dp_destroy(struct datapath *dp) | |||
| 1476 | ovs_dp_detach_port(ovs_vport_ovsl(dp, OVSP_LOCAL)); | 1477 | ovs_dp_detach_port(ovs_vport_ovsl(dp, OVSP_LOCAL)); |
| 1477 | 1478 | ||
| 1478 | /* RCU destroy the flow table */ | 1479 | /* RCU destroy the flow table */ |
| 1479 | ovs_flow_tbl_destroy(&dp->table, true); | ||
| 1480 | |||
| 1481 | call_rcu(&dp->rcu, destroy_dp_rcu); | 1480 | call_rcu(&dp->rcu, destroy_dp_rcu); |
| 1482 | } | 1481 | } |
| 1483 | 1482 | ||
diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c index cf2d853646f0..90f8b40a350b 100644 --- a/net/openvswitch/flow_table.c +++ b/net/openvswitch/flow_table.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2007-2013 Nicira, Inc. | 2 | * Copyright (c) 2007-2014 Nicira, Inc. |
| 3 | * | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of version 2 of the GNU General Public | 5 | * modify it under the terms of version 2 of the GNU General Public |
| @@ -250,11 +250,14 @@ skip_flows: | |||
| 250 | __table_instance_destroy(ti); | 250 | __table_instance_destroy(ti); |
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | void ovs_flow_tbl_destroy(struct flow_table *table, bool deferred) | 253 | /* No need for locking this function is called from RCU callback or |
| 254 | * error path. | ||
| 255 | */ | ||
| 256 | void ovs_flow_tbl_destroy(struct flow_table *table) | ||
| 254 | { | 257 | { |
| 255 | struct table_instance *ti = ovsl_dereference(table->ti); | 258 | struct table_instance *ti = rcu_dereference_raw(table->ti); |
| 256 | 259 | ||
| 257 | table_instance_destroy(ti, deferred); | 260 | table_instance_destroy(ti, false); |
| 258 | } | 261 | } |
| 259 | 262 | ||
| 260 | struct sw_flow *ovs_flow_tbl_dump_next(struct table_instance *ti, | 263 | struct sw_flow *ovs_flow_tbl_dump_next(struct table_instance *ti, |
diff --git a/net/openvswitch/flow_table.h b/net/openvswitch/flow_table.h index 5918bff7f3f6..f682c8c07f44 100644 --- a/net/openvswitch/flow_table.h +++ b/net/openvswitch/flow_table.h | |||
| @@ -62,7 +62,7 @@ void ovs_flow_free(struct sw_flow *, bool deferred); | |||
| 62 | 62 | ||
| 63 | int ovs_flow_tbl_init(struct flow_table *); | 63 | int ovs_flow_tbl_init(struct flow_table *); |
| 64 | int ovs_flow_tbl_count(struct flow_table *table); | 64 | int ovs_flow_tbl_count(struct flow_table *table); |
| 65 | void ovs_flow_tbl_destroy(struct flow_table *table, bool deferred); | 65 | void ovs_flow_tbl_destroy(struct flow_table *table); |
| 66 | int ovs_flow_tbl_flush(struct flow_table *flow_table); | 66 | int ovs_flow_tbl_flush(struct flow_table *flow_table); |
| 67 | 67 | ||
| 68 | int ovs_flow_tbl_insert(struct flow_table *table, struct sw_flow *flow, | 68 | int ovs_flow_tbl_insert(struct flow_table *table, struct sw_flow *flow, |
