From 8e4e1713e4978447c5f799aa668dcc6d2cb0dee9 Mon Sep 17 00:00:00 2001 From: Pravin B Shelar Date: Mon, 15 Apr 2013 13:23:03 -0700 Subject: openvswitch: Simplify datapath locking. Currently OVS uses combination of genl and rtnl lock to protect datapath state. This was done due to networking stack locking. But this has complicated locking and there are few lock ordering issues with new tunneling protocols. Following patch simplifies locking by introducing new ovs mutex and now this lock is used to protect entire ovs state. Signed-off-by: Pravin B Shelar Signed-off-by: Jesse Gross --- net/openvswitch/vport.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'net/openvswitch/vport.h') diff --git a/net/openvswitch/vport.h b/net/openvswitch/vport.h index aee7d43114c9..7282b8436ba7 100644 --- a/net/openvswitch/vport.h +++ b/net/openvswitch/vport.h @@ -138,14 +138,14 @@ struct vport_parms { struct vport_ops { enum ovs_vport_type type; - /* Called with RTNL lock. */ + /* Called with ovs_mutex. */ struct vport *(*create)(const struct vport_parms *); void (*destroy)(struct vport *); int (*set_options)(struct vport *, struct nlattr *); int (*get_options)(const struct vport *, struct sk_buff *); - /* Called with rcu_read_lock or RTNL lock. */ + /* Called with rcu_read_lock or ovs_mutex. */ const char *(*get_name)(const struct vport *); void (*get_config)(const struct vport *, void *); int (*get_ifindex)(const struct vport *); -- cgit v1.2.3 From e0f0ecf33c3f13401f90bff5afdc3ed1bb40b9af Mon Sep 17 00:00:00 2001 From: Pravin B Shelar Date: Mon, 15 Apr 2013 13:30:37 -0700 Subject: openvswitch: Use generic struct pcpu_tstats. Rather than defining ovs specific stats struct (vport_percpu_stats), we can use existing pcpu_tstats to achieve exactly same functionality. Signed-off-by: Pravin B Shelar Signed-off-by: Jesse Gross --- net/openvswitch/vport.h | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'net/openvswitch/vport.h') diff --git a/net/openvswitch/vport.h b/net/openvswitch/vport.h index 7282b8436ba7..7ba08c30b853 100644 --- a/net/openvswitch/vport.h +++ b/net/openvswitch/vport.h @@ -19,6 +19,7 @@ #ifndef VPORT_H #define VPORT_H 1 +#include #include #include #include @@ -50,14 +51,6 @@ int ovs_vport_send(struct vport *, struct sk_buff *); /* The following definitions are for implementers of vport devices: */ -struct vport_percpu_stats { - u64 rx_bytes; - u64 rx_packets; - u64 tx_bytes; - u64 tx_packets; - struct u64_stats_sync sync; -}; - struct vport_err_stats { u64 rx_dropped; u64 rx_errors; @@ -89,7 +82,7 @@ struct vport { struct hlist_node dp_hash_node; const struct vport_ops *ops; - struct vport_percpu_stats __percpu *percpu_stats; + struct pcpu_tstats __percpu *percpu_stats; spinlock_t stats_lock; struct vport_err_stats err_stats; -- cgit v1.2.3