[ovs-dev] [PATCH V7 10/18] dpif-netdev: Update offloaded flows statistics

Ilya Maximets i.maximets at ovn.org
Tue Jan 14 21:53:48 UTC 2020


On 09.01.2020 08:46, Eli Britstein wrote:
> From: Ophir Munk <ophirmu at mellanox.com>
> 
> In case a flow is HW offloaded, packets do not reach the SW, thus not
> counted for statistics. Use netdev flow get API in order to update the
> statistics of flows by the HW statistics.
> 
> Co-authored-by: Eli Britstein <elibr at mellanox.com>
> Signed-off-by: Ophir Munk <ophirmu at mellanox.com>
> Reviewed-by: Oz Shlomo <ozsh at mellanox.com>
> Signed-off-by: Eli Britstein <elibr at mellanox.com>
> ---
>  lib/dpif-netdev.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++---------
>  1 file changed, 66 insertions(+), 13 deletions(-)
> 

ofpbuf could be used by offload provider and we have
to allocate some memory and initialize it before calling
netdev_flow_get().

Suggesting following incremental.  I could squash into this
patch before applying the series if it looks OK to you.
What do you think?

---
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 84194df5d..5b7bc4a83 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -3037,9 +3037,10 @@ dpif_netdev_get_flow_offload_status(const struct dp_netdev *dp,
                                     struct dpif_flow_attrs *attrs)
 {
     struct nlattr *actions;
-    struct ofpbuf wbuffer;
     struct netdev *netdev;
     struct match match;
+    struct ofpbuf buf;
+    uint64_t act_buf[1024 / 8];
 
     int ret = 0;
 
@@ -3051,11 +3052,12 @@ dpif_netdev_get_flow_offload_status(const struct dp_netdev *dp,
     if (!netdev) {
         return false;
     }
+    ofpbuf_use_stack(&buf, &act_buf, sizeof act_buf);
     /* Taking a global 'port_mutex' to fulfill thread safety
      * restrictions for the netdev-offload-dpdk module. */
     ovs_mutex_lock(&dp->port_mutex);
     ret = netdev_flow_get(netdev, &match, &actions, &netdev_flow->mega_ufid,
-                          stats, attrs, &wbuffer);
+                          stats, attrs, &buf);
     ovs_mutex_unlock(&dp->port_mutex);
     netdev_close(netdev);
     if (ret) {
---

Best regards, Ilya Maximets.


More information about the dev mailing list