OVS locking was recently changed to have private OVS lock which
simplified overall locking.  Therefore there is no need to have
another global genl lock to protect OVS data structures.  Following
patch uses of parallel_ops genl family for OVS.  This also allows
more granual OVS locking using ovs_mutex for protecting OVS data
structures, which gives more concurrencey.  E.g multiple genl
operations OVS_PACKET_CMD_EXECUTE can run in parallel, etc.

Signed-off-by: Pravin B Shelar <pshe...@nicira.com>
---
 acinclude.m4        |    1 +
 datapath/compat.h   |    7 +++++++
 datapath/datapath.c |    4 ++++
 3 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 6033bfa..73ee5ce 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -271,6 +271,7 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
   OVS_GREP_IFELSE([$KSRC/include/net/checksum.h], [csum_replace4])
   OVS_GREP_IFELSE([$KSRC/include/net/checksum.h], [csum_unfold])
 
+  OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [parallel_ops])
   OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [NLA_NUL_STRING])
   OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_get_be16])
   OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_put_be16])
diff --git a/datapath/compat.h b/datapath/compat.h
index 4dfd192..65734ff 100644
--- a/datapath/compat.h
+++ b/datapath/compat.h
@@ -61,6 +61,13 @@ static inline void skb_clear_rxhash(struct sk_buff *skb)
 #define SET_NETNSOK    .netnsok = true,
 #endif
 
+#ifdef HAVE_PARALLEL_OPS
+#define SET_PARALLEL_OPS       .parallel_ops = true,
+#else
+#define SET_PARALLEL_OPS
+#endif
+
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
 #ifdef CONFIG_NETFILTER
 static inline u32 skb_get_mark(struct sk_buff *skb)
diff --git a/datapath/datapath.c b/datapath/datapath.c
index e5e0616..fba218e 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -280,6 +280,7 @@ static struct genl_family dp_packet_genl_family = {
        .version = OVS_PACKET_VERSION,
        .maxattr = OVS_PACKET_ATTR_MAX,
         SET_NETNSOK
+        SET_PARALLEL_OPS
 };
 
 int ovs_dp_upcall(struct datapath *dp, struct sk_buff *skb,
@@ -1010,6 +1011,7 @@ static struct genl_family dp_flow_genl_family = {
        .version = OVS_FLOW_VERSION,
        .maxattr = OVS_FLOW_ATTR_MAX,
         SET_NETNSOK
+        SET_PARALLEL_OPS
 };
 
 static struct genl_multicast_group ovs_dp_flow_multicast_group = {
@@ -1589,6 +1591,7 @@ static struct genl_family dp_datapath_genl_family = {
        .version = OVS_DATAPATH_VERSION,
        .maxattr = OVS_DP_ATTR_MAX,
         SET_NETNSOK
+        SET_PARALLEL_OPS
 };
 
 static struct genl_multicast_group ovs_dp_datapath_multicast_group = {
@@ -1968,6 +1971,7 @@ static struct genl_family dp_vport_genl_family = {
        .version = OVS_VPORT_VERSION,
        .maxattr = OVS_VPORT_ATTR_MAX,
         SET_NETNSOK
+        SET_PARALLEL_OPS
 };
 
 struct genl_multicast_group ovs_dp_vport_multicast_group = {
-- 
1.7.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to