datapath.c (25cd9ba0abc0749e5cb78e6493c6f6b3311ec6c5) datapath.c (9b996e544a6bc7d201060fdcbdb5d4a9b734aa1b)
1/*
2 * Copyright (c) 2007-2014 Nicira, Inc.
3 *
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
6 * License as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but

--- 173 unchanged lines hidden (view full) ---

182
183 return ifindex;
184}
185
186static void destroy_dp_rcu(struct rcu_head *rcu)
187{
188 struct datapath *dp = container_of(rcu, struct datapath, rcu);
189
1/*
2 * Copyright (c) 2007-2014 Nicira, Inc.
3 *
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
6 * License as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but

--- 173 unchanged lines hidden (view full) ---

182
183 return ifindex;
184}
185
186static void destroy_dp_rcu(struct rcu_head *rcu)
187{
188 struct datapath *dp = container_of(rcu, struct datapath, rcu);
189
190 ovs_flow_tbl_destroy(&dp->table);
190 free_percpu(dp->stats_percpu);
191 release_net(ovs_dp_get_net(dp));
192 kfree(dp->ports);
193 kfree(dp);
194}
195
196static struct hlist_head *vport_hash_bucket(const struct datapath *dp,
197 u16 port_no)

--- 1241 unchanged lines hidden (view full) ---

1439 return 0;
1440
1441err_destroy_ports_array:
1442 ovs_unlock();
1443 kfree(dp->ports);
1444err_destroy_percpu:
1445 free_percpu(dp->stats_percpu);
1446err_destroy_table:
191 free_percpu(dp->stats_percpu);
192 release_net(ovs_dp_get_net(dp));
193 kfree(dp->ports);
194 kfree(dp);
195}
196
197static struct hlist_head *vport_hash_bucket(const struct datapath *dp,
198 u16 port_no)

--- 1241 unchanged lines hidden (view full) ---

1440 return 0;
1441
1442err_destroy_ports_array:
1443 ovs_unlock();
1444 kfree(dp->ports);
1445err_destroy_percpu:
1446 free_percpu(dp->stats_percpu);
1447err_destroy_table:
1447 ovs_flow_tbl_destroy(&dp->table, false);
1448 ovs_flow_tbl_destroy(&dp->table);
1448err_free_dp:
1449 release_net(ovs_dp_get_net(dp));
1450 kfree(dp);
1451err_free_reply:
1452 kfree_skb(reply);
1453err:
1454 return err;
1455}

--- 15 unchanged lines hidden (view full) ---

1471 list_del_rcu(&dp->list_node);
1472
1473 /* OVSP_LOCAL is datapath internal port. We need to make sure that
1474 * all ports in datapath are destroyed first before freeing datapath.
1475 */
1476 ovs_dp_detach_port(ovs_vport_ovsl(dp, OVSP_LOCAL));
1477
1478 /* RCU destroy the flow table */
1449err_free_dp:
1450 release_net(ovs_dp_get_net(dp));
1451 kfree(dp);
1452err_free_reply:
1453 kfree_skb(reply);
1454err:
1455 return err;
1456}

--- 15 unchanged lines hidden (view full) ---

1472 list_del_rcu(&dp->list_node);
1473
1474 /* OVSP_LOCAL is datapath internal port. We need to make sure that
1475 * all ports in datapath are destroyed first before freeing datapath.
1476 */
1477 ovs_dp_detach_port(ovs_vport_ovsl(dp, OVSP_LOCAL));
1478
1479 /* RCU destroy the flow table */
1479 ovs_flow_tbl_destroy(&dp->table, true);
1480
1481 call_rcu(&dp->rcu, destroy_dp_rcu);
1482}
1483
1484static int ovs_dp_cmd_del(struct sk_buff *skb, struct genl_info *info)
1485{
1486 struct sk_buff *reply;
1487 struct datapath *dp;
1488 int err;

--- 678 unchanged lines hidden ---
1480 call_rcu(&dp->rcu, destroy_dp_rcu);
1481}
1482
1483static int ovs_dp_cmd_del(struct sk_buff *skb, struct genl_info *info)
1484{
1485 struct sk_buff *reply;
1486 struct datapath *dp;
1487 int err;

--- 678 unchanged lines hidden ---