diff mbox series

[ovs-dev,dpdk-latest,v3,5/6] netdev-dpdk: add meter algorithms

Message ID 20230330112057.14242-6-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>

Add the meter algorithms. DPDK meter support three algorithms,
and OVS also can support these algorithms.

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/netdev-dpdk.c | 58 +++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 51 insertions(+), 7 deletions(-)

Comments

0-day Robot March 30, 2023, 11:48 a.m. UTC | #1
References:  <20230330112057.14242-6-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: 99, 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/netdev-dpdk.c b/lib/netdev-dpdk.c
index cc2d0762226f..2ce95aed2455 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -5331,6 +5331,50 @@  netdev_dpdk_rte_flow_query_count(struct netdev *netdev,
     return ret;
 }
 
+/* RTE_MTR_TRTCM_RFC2697 meter profile */
+static void
+netdev_dpdk_meter_profile_rfc2697_init(struct rte_mtr_meter_profile *profile,
+                                       const uint64_t rate,
+                                       const uint64_t burst,
+                                       const int flag)
+{
+       profile->alg = RTE_MTR_SRTCM_RFC2697;
+       profile->packet_mode = flag;
+       profile->srtcm_rfc2697.cir = rate;
+       profile->srtcm_rfc2697.cbs = burst;
+       profile->srtcm_rfc2697.ebs = burst;
+}
+
+/* RTE_MTR_TRTCM_RFC2698 meter profile */
+static void
+netdev_dpdk_meter_profile_rfc2698_init(struct rte_mtr_meter_profile *profile,
+                                       const uint64_t rate,
+                                       const uint64_t burst,
+                                       const int flag)
+{
+       profile->alg = RTE_MTR_TRTCM_RFC2698;
+       profile->packet_mode = flag;
+       profile->trtcm_rfc2698.cir = rate;
+       profile->trtcm_rfc2698.cbs = burst;
+       profile->trtcm_rfc2698.pir = rate;
+       profile->trtcm_rfc2698.pbs = burst;
+}
+
+/* RTE_MTR_TRTCM_RFC2698 meter profile */
+static void
+netdev_dpdk_meter_profile_rfc4115_init(struct rte_mtr_meter_profile *profile,
+                                       const uint64_t rate,
+                                       const uint64_t burst,
+                                       const int flag)
+{
+       profile->alg = RTE_MTR_TRTCM_RFC4115;
+       profile->packet_mode = flag;
+       profile->trtcm_rfc4115.cir = rate;
+       profile->trtcm_rfc4115.cbs = burst;
+       profile->trtcm_rfc4115.eir = rate;
+       profile->trtcm_rfc4115.ebs = burst;
+}
+
 static int OVS_UNUSED
 netdev_dpdk_meter_profile_init(struct rte_mtr_meter_profile *profile,
                                struct rte_mtr_capabilities *cap,
@@ -5338,16 +5382,16 @@  netdev_dpdk_meter_profile_init(struct rte_mtr_meter_profile *profile,
                                const uint64_t burst,
                                const int flag)
 {
-    if (!cap->meter_srtcm_rfc2697_n_max) {
+    if (cap->meter_srtcm_rfc2697_n_max) {
+        netdev_dpdk_meter_profile_rfc2697_init(profile, rate, burst, flag);
+    } else if (cap->meter_trtcm_rfc2698_n_max) {
+        netdev_dpdk_meter_profile_rfc2698_init(profile, rate, burst, flag);
+    } else if (cap->meter_trtcm_rfc4115_n_max) {
+        netdev_dpdk_meter_profile_rfc4115_init(profile, rate, burst, flag);
+    } else {
         return EOPNOTSUPP;
     }
 
-    profile->alg = RTE_MTR_SRTCM_RFC2697;
-    profile->packet_mode = flag;
-    profile->srtcm_rfc2697.cir = rate;
-    profile->srtcm_rfc2697.cbs = burst;
-    profile->srtcm_rfc2697.ebs = burst;
-
     return 0;
 }