diff mbox series

[ovs-dev,61/62,netdev-offload-dpdk] fix some multicast output action errors.

Message ID 20201228092520.11807-62-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: LIU CHANG <liuchang@cmss.chinamobile.com>

when unsupported multicast output action happens, the datapath flow will be
NOT offloaded, but datapath flow statistics show offloaded status is yes rather
than partial. At the same time, ovs-vswitchd log shows the dp flow successed to
add the corresponding netdev flow wrongly.
---
 lib/netdev-offload-dpdk.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c
index 3ee4f33..58e6bc9 100644
--- a/lib/netdev-offload-dpdk.c
+++ b/lib/netdev-offload-dpdk.c
@@ -768,7 +768,7 @@  add_flow_pattern(struct flow_patterns *patterns, enum rte_flow_item_type type,
     patterns->cnt++;
 }
 
-static void
+static int
 add_flow_action(struct flow_actions *actions, enum rte_flow_action_type type,
                 const void *conf)
 {
@@ -777,7 +777,7 @@  add_flow_action(struct flow_actions *actions, enum rte_flow_action_type type,
     if ( (actions->valid_ucast == true) && 
          (type == RTE_FLOW_ACTION_TYPE_PORT_ID) ) {
         VLOG_DBG_RL(&rl, "Unsupported multicast output action");
-        return ;
+        return -1;
     }
     if (cnt == 0) {
         actions->current_max = 8;
@@ -1303,15 +1303,22 @@  add_port_id_action(struct flow_actions *actions,
 {
     struct rte_flow_action_port_id *port_id;
     int outdev_id;
+    int ret;
 
     VLOG_DBG("TIMO DBG: in add_port_id_action");
+
     outdev_id = netdev_dpdk_get_port_id(outdev);
     if (outdev_id < 0) {
         return -1;
     }
+
     port_id = xzalloc(sizeof *port_id);
     port_id->id = outdev_id;
-    add_flow_action(actions, RTE_FLOW_ACTION_TYPE_PORT_ID, port_id);
+    ret=add_flow_action(actions, RTE_FLOW_ACTION_TYPE_PORT_ID, port_id);
+    if (ret < 0){
+        return -1;
+    }
+
     return 0;
 }
 
@@ -2256,12 +2263,10 @@  netdev_offload_dpdk_add_flow(struct dpif *dpif, struct netdev *netdev,
                                             info->flow_mark);
          */
         actions_offloaded = false;
-    }
-
-    if (!flow) {
         ret = -1;
         goto out;
     }
+
     ufid_to_rte_flow_associate(ufid, flow, actions_offloaded,netdev->name);
     VLOG_DBG("%s: installed flow %p by ufid "UUID_FMT"\n",
              netdev_get_name(netdev), flow, UUID_ARGS((struct uuid *)ufid));