diff mbox series

[ovs-dev,18/62] netdev-offload-dpdk.c: add flag to exclude multicast scenario

Message ID 20201228092520.11807-19-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: Liuchang <liuchang@cmss.chinamobile.com>

Code Source From: Self Code
Description:
    Now we can only offload unicast flow,so we should seperate
these pkts before offloading

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

Patch

diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c
index 7d34870..970eada 100644
--- a/lib/netdev-offload-dpdk.c
+++ b/lib/netdev-offload-dpdk.c
@@ -1201,9 +1201,13 @@  parse_clone_actions(struct netdev *netdev,
                 continue;
             }
         } else if (clone_type == OVS_ACTION_ATTR_OUTPUT) {
-            if (add_output_action(netdev, actions, ca,info)) {
+            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;
         } 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;
@@ -1235,14 +1239,20 @@  parse_flow_actions(struct netdev *netdev,
     struct nlattr *nla;
     size_t left;
     uint8_t i = 0;
+    
 
     add_count_action(actions);
     NL_ATTR_FOR_EACH_UNSAFE (nla, left, nl_actions, nl_actions_len) {
+
         VLOG_DBG("TIMO:action type %0d:%d",i++,nl_attr_type(nla));
         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;
         } 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 67504dd..cadbde1 100644
--- a/lib/netdev-offload.h
+++ b/lib/netdev-offload.h
@@ -76,6 +76,7 @@  struct offload_info {
 
     bool tc_modify_flow_deleted; /* Indicate the tc modify flow put success
                                   * to delete the original flow. */
+    bool valid_ucast;            /* flag to judge multicast && broadcast */
 };
 
 int netdev_flow_flush(struct netdev *);