diff mbox series

[ovs-dev,dpdk-latest,v3,3/6] dpif-netdev: Offloading meter with DPDK

Message ID 20230330112057.14242-4-simon.horman@corigine.com
State Changes Requested
Headers show
Series Add support for DPDK meter HW offload | expand

Checks

Context Check Description
ovsrobot/apply-robot warning apply and check: warning
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Simon Horman March 30, 2023, 11:20 a.m. UTC
From: Peng Zhang <peng.zhang@corigine.com>

OVS-DPDK meters are created in advance and OpenFlow rules refer to them by
their unique ID. A new API is used to offload them. By calling the API,
meters are created and try to be offload by port in the bridge with the
proxy port id.

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Co-authored-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
---
 lib/dpif-netdev.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

Comments

0-day Robot March 30, 2023, 11:43 a.m. UTC | #1
References:  <20230330112057.14242-4-simon.horman@corigine.com>
 

Bleep bloop.  Greetings Simon Horman, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
WARNING: Unexpected sign-offs from developers who are not authors or co-authors or committers: Simon Horman <simon.horman@corigine.com>
Lines checked: 70, Warnings: 1, Errors: 0


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
diff mbox series

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 2c08a71c8db2..e8d0ca6606de 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -7277,6 +7277,11 @@  dpif_netdev_meter_set(struct dpif *dpif, ofproto_meter_id meter_id,
 
     ovs_mutex_unlock(&dp->meters_lock);
 
+    if (netdev_is_flow_api_enabled()) {
+        dpdk_meter_offload_set(dpif_normalize_type(dpif_type(dpif)),
+                               meter_id, config);
+    }
+
     return 0;
 }
 
@@ -7313,8 +7318,18 @@  dpif_netdev_meter_get(const struct dpif *dpif,
 
         ovs_mutex_unlock(&meter->lock);
         stats->n_bands = i;
-    }
 
+        if (netdev_is_flow_api_enabled()) {
+            dpdk_meter_offload_get(dpif_normalize_type(dpif_type(dpif)),
+                                   meter_id_, stats);
+
+            /* nit: Meter offload currently only supports one band */
+            if (meter->n_bands) {
+                stats->bands[0].packet_count = stats->packet_in_count;
+                stats->bands[0].byte_count = stats->byte_in_count;
+            }
+        }
+    }
     return 0;
 }
 
@@ -7330,6 +7345,11 @@  dpif_netdev_meter_del(struct dpif *dpif,
     if (!error) {
         uint32_t meter_id = meter_id_.uint32;
 
+        if (netdev_is_flow_api_enabled()) {
+            dpdk_meter_offload_del(dpif_normalize_type(dpif_type(dpif)),
+                                   meter_id_, stats);
+        }
+
         ovs_mutex_lock(&dp->meters_lock);
         dp_meter_detach_free(&dp->meters, meter_id);
         ovs_mutex_unlock(&dp->meters_lock);