From c052da844bdf7fc2f87500f76fca529c4e3dc598 Mon Sep 17 00:00:00 2001 From: Jesse Gross Date: Wed, 8 Dec 2010 19:21:40 -0800 Subject: [PATCH] datapath: Don't use RCU for internal dev vport. The vports are now attached and ready to go when they are allocated, so we don't have to worry about future changes. As a result, we can directly store the pointer in the internal dev's netdevice private space before it is registered. The registration process will handle the necessary write memory barriers and anyone who has a reference to the netdev will have done the read side barriers, we don't need to use RCU at all. Signed-off-by: Jesse Gross Acked-by: Ben Pfaff --- datapath/vport-internal_dev.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/datapath/vport-internal_dev.c b/datapath/vport-internal_dev.c index 86171dbc..c88fb3b3 100644 --- a/datapath/vport-internal_dev.c +++ b/datapath/vport-internal_dev.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include @@ -72,13 +71,10 @@ static int internal_dev_mac_addr(struct net_device *dev, void *p) /* Called with rcu_read_lock and bottom-halves disabled. */ static int internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev) { - struct internal_dev *internal_dev = internal_dev_priv(netdev); - struct vport *vport = rcu_dereference(internal_dev->vport); - compute_ip_summed(skb, true); OVS_CB(skb)->flow = NULL; - vport_receive(vport, skb); + vport_receive(internal_dev_priv(netdev)->vport, skb); return 0; } @@ -197,7 +193,7 @@ static struct vport *internal_dev_create(const struct vport_parms *parms) } internal_dev = internal_dev_priv(netdev_vport->dev); - rcu_assign_pointer(internal_dev->vport, vport); + internal_dev->vport = vport; err = register_netdevice(netdev_vport->dev); if (err) @@ -288,11 +284,8 @@ int is_internal_vport(const struct vport *vport) struct vport *internal_dev_get_vport(struct net_device *netdev) { - struct internal_dev *internal_dev; - if (!is_internal_dev(netdev)) return NULL; - internal_dev = internal_dev_priv(netdev); - return rcu_dereference(internal_dev->vport); + return internal_dev_priv(netdev)->vport; } -- 2.30.2