diff mbox series

[ovs-dev,4/6] netdev-dpdk: add meter algorithms

Message ID 20221216155054.986464-5-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 fail test: fail

Commit Message

Simon Horman Dec. 16, 2022, 3:50 p.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>
---
 lib/netdev-dpdk.c | 58 +++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 51 insertions(+), 7 deletions(-)

Comments

0-day Robot Dec. 16, 2022, 4:06 p.m. UTC | #1
References:  <20221216155054.986464-5-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: Jin Liu <jin.liu@corigine.com>
Lines checked: 97, 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 180f3fb4b299..4e96c678aff7 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -5275,6 +5275,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_create(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_create(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_create(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_create(struct rte_mtr_meter_profile *profile,
                                  struct rte_mtr_capabilities *cap,
@@ -5282,16 +5326,16 @@  netdev_dpdk_meter_profile_create(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_create(profile, rate, burst, flag);
+    } else if (cap->meter_trtcm_rfc2698_n_max) {
+        netdev_dpdk_meter_profile_rfc2698_create(profile, rate, burst, flag);
+    } else if (cap->meter_trtcm_rfc4115_n_max) {
+        netdev_dpdk_meter_profile_rfc4115_create(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;
 }