diff mbox series

[ovs-dev,22/62] netdev-offload-dpdk: fix dpif_type caused thread dead lock

Message ID 20201228092520.11807-23-taoyunxiang@cmss.chinamobile.com
State Not Applicable
Headers show
Series DPDK Offload API to test | expand

Commit Message

Tao YunXiang Dec. 28, 2020, 9:24 a.m. UTC
From: Rongyin <rongyin@cmss.chinamobile.com>

NOTE: https://patchwork.ozlabs.org/patch/1205684/

Code Source From: Self Code

Description:

    fix dpif_type caused thread dead lock

Jira:  #[Optional]
市场项目编号(名称):[Optional]
---
 lib/dpif-netdev.c         |  1 +
 lib/netdev-offload-dpdk.c | 17 +++++++++++------
 lib/netdev-offload.h      |  1 +
 3 files changed, 13 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 74ceadc..008ffa8 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -2437,6 +2437,7 @@  dp_netdev_flow_offload_put(struct dp_flow_offload_item *offload)
         }
     }
     info.flow_mark = mark;
+    info.dpif_type_str = dpif_type_str;
 
     port = netdev_ports_get(in_port, dpif_type_str);
     if (!port) {
diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c
index 3e268bf..ea1eb2e 100644
--- a/lib/netdev-offload-dpdk.c
+++ b/lib/netdev-offload-dpdk.c
@@ -628,14 +628,14 @@  free_flow_actions(struct flow_actions *actions)
     actions->cnt = 0;
 }
 
-static int
+static void
 parse_vxlan_match(struct flow_patterns *patterns,
                   const struct match *match)
 {
     struct rte_flow_item_vxlan *vx_spec, *vx_mask;
 
     if (is_all_zeros(&match->wc.masks.tunnel, sizeof match->wc.masks.tunnel)) {
-        return 0;
+        return ;
     }
     VLOG_DBG("TIMO:in parse_vxlan_match");
 
@@ -656,7 +656,7 @@  parse_vxlan_match(struct flow_patterns *patterns,
                        htonl(ntohll(match->wc.masks.tunnel.tun_id) << 8));
 
     add_flow_pattern(patterns, RTE_FLOW_ITEM_TYPE_VXLAN, vx_spec, vx_mask);
-    return 0;
+    return ;
 }
 
 static int
@@ -994,7 +994,7 @@  add_output_action(struct netdev *netdev,
     int ret = 0;
 
     port = nl_attr_get_odp_port(nla);
-    outdev = netdev_ports_get(port, netdev->dpif_type);
+    outdev = netdev_ports_get(port, info->dpif_type_str);
     if (outdev == NULL) {
         VLOG_DBG_RL(&rl, "Cannot find netdev for odp port %"PRIu32, port);
         return -1;
@@ -1247,11 +1247,14 @@  parse_clone_actions(struct netdev *netdev,
         } else if (clone_type == OVS_ACTION_ATTR_OUTPUT) {
             if (add_output_action(netdev, actions, ca, info)) {
                 return -1;
+            }
+            /*
             } else if (info->valid_ucast) {
                 VLOG_DBG_RL(&rl, "Unsupported multicast output action");
                 return -1;
+                info->valid_ucast = true;
             }
-            info->valid_ucast = true;
+             */
         } else if (clone_type == OVS_ACTION_ATTR_PUSH_VLAN) {
             const struct ovs_action_push_vlan *vlan = nl_attr_get(ca);
             struct rte_flow_action_of_push_vlan *vlan_tci;
@@ -1292,11 +1295,13 @@  parse_flow_actions(struct netdev *netdev,
         if (nl_attr_type(nla) == OVS_ACTION_ATTR_OUTPUT) {
             if (add_output_action(netdev, actions, nla, info)) {
                 return -1;
+            /*
             } else if (info->valid_ucast) {
                 VLOG_DBG_RL(&rl, "Unsupported multicast output action");
                 return -1;
+                info->valid_ucast = true;
+             */
             }
-            info->valid_ucast = true;
         } else if (nl_attr_type(nla) == OVS_ACTION_ATTR_DROP) {
             add_flow_action(actions, RTE_FLOW_ACTION_TYPE_DROP, NULL);
         } else if (nl_attr_type(nla) == OVS_ACTION_ATTR_SET ||
diff --git a/lib/netdev-offload.h b/lib/netdev-offload.h
index 8264e32..a4b8d5f 100644
--- a/lib/netdev-offload.h
+++ b/lib/netdev-offload.h
@@ -78,6 +78,7 @@  struct offload_info {
                                   * to delete the original flow. */
     bool valid_ucast;            /* flag to judge multicast && broadcast */
     bool vxlan_decap;            /* flag to turn on vxlan decap */
+    const char *dpif_type_str;   /* dpif type string. */
 };
 
 int netdev_flow_flush(struct netdev *);