diff mbox series

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

Message ID 20210531064613.30636-4-noae@nvidia.com
State New
Headers show
Series Multiple destinations | expand

Commit Message

Noa Levy May 31, 2021, 6:46 a.m. UTC
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 e284cec90..0f6edf70e 100644
--- a/lib/netdev-offload-dpdk.c
+++ b/lib/netdev-offload-dpdk.c
@@ -447,6 +447,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)
 {
@@ -583,15 +601,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;