[ovs-dev,hwol,RFC,v1,3/5] netdev-dpdk: Add count hw offload action

Message ID 1546285557-1617-4-git-send-email-ophirmu@mellanox.com
State New
Delegated to: Ian Stokes
Headers show
Series
  • Support hw offloaded flows
Related show

Commit Message

Ophir Munk Dec. 31, 2018, 7:45 p.m.
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 <ophirmu@mellanox.com>
---
 lib/netdev-dpdk.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Patch

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;