[ovs-dev] [netlink v3 4/5] vport: Add smp_wmb() to vport_alloc().

Ben Pfaff blp at nicira.com
Wed Nov 17 01:11:25 UTC 2010


I'm not sure whether this is necessary or makes sense.  If it does, then
it should be folded into the previous commit.  If it doesn't, then this
commit should be dropped.
---
 datapath/vport.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/datapath/vport.c b/datapath/vport.c
index b67a34b..b9334ee 100644
--- a/datapath/vport.c
+++ b/datapath/vport.c
@@ -560,6 +560,10 @@ struct vport *vport_alloc(int priv_size, const struct vport_ops *ops, const stru
 		spin_lock_init(&vport->stats_lock);
 	}
 
+	/* Ensure that 'vport' fields, especially 'dp', are visible on all CPUs
+	 * in case packets start getting received immediately. */
+	smp_wmb();
+
 	return vport;
 }
 
-- 
1.7.1





More information about the dev mailing list