Whenever a flow is hw offloaded it is required to query the hw for the
flow counters statistics, specifically the number of packets and the
number of bytes used by the flow. In order to successfully call DPDK
rte_flow_query() API, a 'count' action must be implicitly added to the
flow actions when calling DPDK rte_flow_create() API.

Signed-off-by: Ophir Munk <[email protected]>
---
 lib/netdev-dpdk.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 0c0a513..e1f2331 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -4831,6 +4831,17 @@ end_proto_check:
             break;
         }
     }
+
+    /* Add 'count' action in order to read offloaded counters */
+    struct rte_flow_query_count count = {
+            .reset = 1,
+            .hits_set = 1,
+            .bytes_set = 1,
+            .hits = 0,
+            .bytes = 0,
+    };
+    struct rte_flow_action count_act = { RTE_FLOW_ACTION_TYPE_COUNT, &count};
+    add_flow_action(&actions, RTE_FLOW_ACTION_TYPE_COUNT, &count_act);
     add_flow_action(&actions, RTE_FLOW_ACTION_TYPE_END, NULL);
     ovs_mutex_lock(&dev->mutex);
     flow_attr.transfer = 1;
-- 
1.8.3.1

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

Reply via email to