On 09.01.2020 08:46, Eli Britstein wrote:
> From: Ophir Munk <[email protected]>
> 
> 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 <[email protected]>
> Signed-off-by: Ophir Munk <[email protected]>
> Reviewed-by: Oz Shlomo <[email protected]>
> Signed-off-by: Eli Britstein <[email protected]>
> ---
>  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.
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to