Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9b996e54 authored by Pravin B Shelar's avatar Pravin B Shelar
Browse files

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: default avatarPravin B Shelar <pshelar@nicira.com>
Acked-by: default avatarThomas Graf <tgraf@redhat.com>
parent 25cd9ba0
Loading
Loading
Loading
Loading
+2 −3
Original line number Original line Diff line number Diff line
@@ -187,6 +187,7 @@ static void destroy_dp_rcu(struct rcu_head *rcu)
{
{
	struct datapath *dp = container_of(rcu, struct datapath, rcu);
	struct datapath *dp = container_of(rcu, struct datapath, rcu);


	ovs_flow_tbl_destroy(&dp->table);
	free_percpu(dp->stats_percpu);
	free_percpu(dp->stats_percpu);
	release_net(ovs_dp_get_net(dp));
	release_net(ovs_dp_get_net(dp));
	kfree(dp->ports);
	kfree(dp->ports);
@@ -1444,7 +1445,7 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
err_destroy_percpu:
err_destroy_percpu:
	free_percpu(dp->stats_percpu);
	free_percpu(dp->stats_percpu);
err_destroy_table:
err_destroy_table:
	ovs_flow_tbl_destroy(&dp->table, false);
	ovs_flow_tbl_destroy(&dp->table);
err_free_dp:
err_free_dp:
	release_net(ovs_dp_get_net(dp));
	release_net(ovs_dp_get_net(dp));
	kfree(dp);
	kfree(dp);
@@ -1476,8 +1477,6 @@ static void __dp_destroy(struct datapath *dp)
	ovs_dp_detach_port(ovs_vport_ovsl(dp, OVSP_LOCAL));
	ovs_dp_detach_port(ovs_vport_ovsl(dp, OVSP_LOCAL));


	/* RCU destroy the flow table */
	/* RCU destroy the flow table */
	ovs_flow_tbl_destroy(&dp->table, true);

	call_rcu(&dp->rcu, destroy_dp_rcu);
	call_rcu(&dp->rcu, destroy_dp_rcu);
}
}


+7 −4
Original line number Original line Diff line number Diff line
/*
/*
 * Copyright (c) 2007-2013 Nicira, Inc.
 * Copyright (c) 2007-2014 Nicira, Inc.
 *
 *
 * This program is free software; you can redistribute it and/or
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of version 2 of the GNU General Public
 * modify it under the terms of version 2 of the GNU General Public
@@ -250,11 +250,14 @@ static void table_instance_destroy(struct table_instance *ti, bool deferred)
		__table_instance_destroy(ti);
		__table_instance_destroy(ti);
}
}


void ovs_flow_tbl_destroy(struct flow_table *table, bool deferred)
/* No need for locking this function is called from RCU callback or
 * error path.
 */
void ovs_flow_tbl_destroy(struct flow_table *table)
{
{
	struct table_instance *ti = ovsl_dereference(table->ti);
	struct table_instance *ti = rcu_dereference_raw(table->ti);


	table_instance_destroy(ti, deferred);
	table_instance_destroy(ti, false);
}
}


struct sw_flow *ovs_flow_tbl_dump_next(struct table_instance *ti,
struct sw_flow *ovs_flow_tbl_dump_next(struct table_instance *ti,
+1 −1
Original line number Original line Diff line number Diff line
@@ -62,7 +62,7 @@ void ovs_flow_free(struct sw_flow *, bool deferred);


int ovs_flow_tbl_init(struct flow_table *);
int ovs_flow_tbl_init(struct flow_table *);
int ovs_flow_tbl_count(struct flow_table *table);
int ovs_flow_tbl_count(struct flow_table *table);
void ovs_flow_tbl_destroy(struct flow_table *table, bool deferred);
void ovs_flow_tbl_destroy(struct flow_table *table);
int ovs_flow_tbl_flush(struct flow_table *flow_table);
int ovs_flow_tbl_flush(struct flow_table *flow_table);


int ovs_flow_tbl_insert(struct flow_table *table, struct sw_flow *flow,
int ovs_flow_tbl_insert(struct flow_table *table, struct sw_flow *flow,