From: Finn Christensen <[email protected]>

AFAIK, both Mellanox and Intel's NIC do not support a pure MARK action.
They both require to use it together with some other actions, like QUEUE.

To workaround it, retry with a queue action when first try failed.

Moreover, some Intel's NIC (say XL710) needs the QUEUE action set before
the MARK action.

Signed-off-by: Finn Christensen <[email protected]>
Signed-off-by: Yuanhan Liu <[email protected]>
---
 lib/netdev-dpdk.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 8089da8..230d506 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -3629,9 +3629,29 @@ netdev_dpdk_add_rte_flow_offload(struct netdev *netdev,
     }
     ADD_FLOW_ACTION(RTE_FLOW_ACTION_TYPE_END, NULL);
 
+    int tried = 0;
+    struct rte_flow_action_queue queue;
+again:
     flow = rte_flow_create(dev->port_id, &flow_attr, patterns.items,
                            actions.actions, &error);
-    if (!flow) {
+    if (!flow && !tried && actions_len) {
+        /*
+         * create flow failed, try again with QUEUE ACTION
+         * FIXME: to not fix with queue id.
+         */
+        queue.index = 0;
+
+        /* re-build the action */
+        actions.cnt = 0;
+        ADD_FLOW_ACTION(RTE_FLOW_ACTION_TYPE_QUEUE, &queue);
+        ADD_FLOW_ACTION(RTE_FLOW_ACTION_TYPE_MARK, &mark);
+        ADD_FLOW_ACTION(RTE_FLOW_ACTION_TYPE_END, NULL);
+
+        VLOG_INFO("rte flow create failed, try again with adding QUEUE 
action\n");
+        tried = 1;
+
+        goto again;
+    } else if (!flow) {
         VLOG_ERR("rte flow creat error: %u : message : %s\n",
                  error.type, error.message);
         goto err;
-- 
2.7.4

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to