diff mbox series

[ovs-dev,47/62] dpif-netdev: fix offload fail bug during executing ovs-tcpdump

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

Commit Message

Tao YunXiang Dec. 28, 2020, 9:25 a.m. UTC
From: Taoyunxiang <taoyunxiang@cmss.chinamobile.com>

Code Source From: OpenSource
Description:
NOTE: when execute ovs-tcpdump, the flow_mark_flush would be called
several times, the second time when we try to call cmap_remove would
emit an error, as the formal calling would set mark value to 0xffffffff
so add a flag to ensure that the flow_mark_flush would be called only
once when we adjust pmd threads

Jira:  #[Optional]
市场项目编号(名称):[Optional]
---
 lib/dpif-netdev.c         | 7 +++++++
 lib/netdev-offload-dpdk.c | 7 +++++++
 2 files changed, 14 insertions(+)
diff mbox series

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 96eaeb2..e48423f 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -2304,6 +2304,13 @@  mark_to_flow_disassociate(struct dp_netdev_pmd_thread *pmd,
     uint32_t mark = flow->mark;
     int ret = 0;
 
+    /* Check if the mark is available,INVALID_FLOW_MARK
+     * means that the flow has been disassociated or never
+     * associated.
+     */
+    if (OVS_UNLIKELY(mark == INVALID_FLOW_MARK)) {
+        return -1;
+    }
     cmap_remove(&flow_mark.mark_to_flow, mark_node, hash_int(mark, 0));
     flow->mark = INVALID_FLOW_MARK;
 
diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c
index fb36466..f04f61f 100644
--- a/lib/netdev-offload-dpdk.c
+++ b/lib/netdev-offload-dpdk.c
@@ -1209,6 +1209,13 @@  add_output_action(struct netdev *netdev,
         VLOG_DBG_RL(&rl, "Cannot find netdev for odp port %"PRIu32, port);
         return -1;
     }
+    /* for mirror port, such as port create by executing ovs-tcpdump
+     * we should just jump output actions to mirroring port
+     */
+    if (strstr(outdev->name,"mi") != NULL) {
+        netdev_close(outdev);
+        return 0;
+    }
     if (!netdev_flow_api_equals(netdev, outdev) ||
         add_port_id_action(actions, outdev)) { 
         VLOG_DBG_RL(&rl, "%s: Output to port \'%s\' cannot be offloaded.",