diff mbox series

[ovs-dev,v2,3/6] netdev-offload-dpdk: Introduce a dump_raw_encap helper function

Message ID 20210823160140.12788-4-salems@nvidia.com
State Deferred
Headers show
Series Adding support for multiple destinations | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Salem Sol Aug. 23, 2021, 4:01 p.m. UTC
From: Noa Levy <noae@nvidia.com>

Introduce a helper function as a pre-step towards supporting offload
multiple remote destinations.

Co-authored-by: Salem Sol <salems@nvidia.com>
Signed-off-by: Noa Levy <noae@nvidia.com>
Signed-off-by: Salem Sol <salems@nvidia.com>
---
 lib/netdev-offload-dpdk.c | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c
index 9b32816d1..cd63d3ae1 100644
--- a/lib/netdev-offload-dpdk.c
+++ b/lib/netdev-offload-dpdk.c
@@ -454,6 +454,24 @@  dump_vxlan_encap(struct ds *s, const struct rte_flow_item *items)
     }
 }
 
+static void
+dump_raw_encap(struct ds *s,
+               struct ds *s_extra,
+               const struct rte_flow_action_raw_encap *raw_encap)
+{
+    int i;
+
+    ds_put_cstr(s, "raw_encap index 0 / ");
+    if (raw_encap) {
+        ds_put_format(s_extra, "Raw-encap size=%ld set raw_encap 0 raw "
+                      "pattern is ", raw_encap->size);
+        for (i = 0; i < raw_encap->size; i++) {
+            ds_put_format(s_extra, "%02x", raw_encap->data[i]);
+        }
+        ds_put_cstr(s_extra, " / end_set; ");
+    }
+}
+
 static void
 dump_port_id(struct ds *s, const void *conf)
 {
@@ -593,15 +611,7 @@  dump_flow_action(struct ds *s, struct ds *s_extra,
     } else if (actions->type == RTE_FLOW_ACTION_TYPE_RAW_ENCAP) {
         const struct rte_flow_action_raw_encap *raw_encap = actions->conf;
 
-        ds_put_cstr(s, "raw_encap index 0 / ");
-        if (raw_encap) {
-            ds_put_format(s_extra, "Raw-encap size=%ld set raw_encap 0 raw "
-                          "pattern is ", raw_encap->size);
-            for (int i = 0; i < raw_encap->size; i++) {
-                ds_put_format(s_extra, "%02x", raw_encap->data[i]);
-            }
-            ds_put_cstr(s_extra, " / end_set;");
-        }
+        dump_raw_encap(s, s_extra, raw_encap);
     } else if (actions->type == RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP) {
         const struct rte_flow_action_vxlan_encap *vxlan_encap = actions->conf;
         const struct rte_flow_item *items = vxlan_encap->definition;