diff options
author | Pravin B Shelar <pshelar@nicira.com> | 2015-08-08 02:51:33 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-08-10 17:03:54 -0400 |
commit | a9020fde67a6eb77f8130feff633189f99264db1 (patch) | |
tree | 4e911a8b9b4a774ba145f1d049df6e417863f902 /net/openvswitch/vport-netdev.c | |
parent | fb811395cd5a71b9e94a068f524a6f4a21b67bdb (diff) |
openvswitch: Move tunnel destroy function to oppenvswitch module.
This function will be used in gre and geneve vport implementations.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/openvswitch/vport-netdev.c')
-rw-r--r-- | net/openvswitch/vport-netdev.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/net/openvswitch/vport-netdev.c b/net/openvswitch/vport-netdev.c index cddb7069b11b..4b70aaa4a746 100644 --- a/net/openvswitch/vport-netdev.c +++ b/net/openvswitch/vport-netdev.c | |||
@@ -147,7 +147,7 @@ static struct vport *netdev_create(const struct vport_parms *parms) | |||
147 | return ovs_netdev_link(vport, parms->name); | 147 | return ovs_netdev_link(vport, parms->name); |
148 | } | 148 | } |
149 | 149 | ||
150 | void ovs_vport_free_rcu(struct rcu_head *rcu) | 150 | static void vport_netdev_free(struct rcu_head *rcu) |
151 | { | 151 | { |
152 | struct vport *vport = container_of(rcu, struct vport, rcu); | 152 | struct vport *vport = container_of(rcu, struct vport, rcu); |
153 | 153 | ||
@@ -155,7 +155,6 @@ void ovs_vport_free_rcu(struct rcu_head *rcu) | |||
155 | dev_put(vport->dev); | 155 | dev_put(vport->dev); |
156 | ovs_vport_free(vport); | 156 | ovs_vport_free(vport); |
157 | } | 157 | } |
158 | EXPORT_SYMBOL_GPL(ovs_vport_free_rcu); | ||
159 | 158 | ||
160 | void ovs_netdev_detach_dev(struct vport *vport) | 159 | void ovs_netdev_detach_dev(struct vport *vport) |
161 | { | 160 | { |
@@ -175,9 +174,25 @@ static void netdev_destroy(struct vport *vport) | |||
175 | ovs_netdev_detach_dev(vport); | 174 | ovs_netdev_detach_dev(vport); |
176 | rtnl_unlock(); | 175 | rtnl_unlock(); |
177 | 176 | ||
178 | call_rcu(&vport->rcu, ovs_vport_free_rcu); | 177 | call_rcu(&vport->rcu, vport_netdev_free); |
179 | } | 178 | } |
180 | 179 | ||
180 | void ovs_netdev_tunnel_destroy(struct vport *vport) | ||
181 | { | ||
182 | rtnl_lock(); | ||
183 | if (vport->dev->priv_flags & IFF_OVS_DATAPATH) | ||
184 | ovs_netdev_detach_dev(vport); | ||
185 | |||
186 | /* Early release so we can unregister the device */ | ||
187 | dev_put(vport->dev); | ||
188 | rtnl_delete_link(vport->dev); | ||
189 | vport->dev = NULL; | ||
190 | rtnl_unlock(); | ||
191 | |||
192 | call_rcu(&vport->rcu, vport_netdev_free); | ||
193 | } | ||
194 | EXPORT_SYMBOL_GPL(ovs_netdev_tunnel_destroy); | ||
195 | |||
181 | static unsigned int packet_length(const struct sk_buff *skb) | 196 | static unsigned int packet_length(const struct sk_buff *skb) |
182 | { | 197 | { |
183 | unsigned int length = skb->len - ETH_HLEN; | 198 | unsigned int length = skb->len - ETH_HLEN; |