[ovs-dev] [PATCH 1/5] netdev-offload-dpdk: Introduce a dump_port_id helper function

Salem Sol salems at nvidia.com
Sun Aug 22 09:25:26 UTC 2021


From: Noa Levy <noae at nvidia.com>

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

Signed-off-by: Noa Levy <noae at nvidia.com>
---
 lib/netdev-offload-dpdk.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c
index ed59d6fcd..9b32816d1 100644
--- a/lib/netdev-offload-dpdk.c
+++ b/lib/netdev-offload-dpdk.c
@@ -454,6 +454,20 @@ dump_vxlan_encap(struct ds *s, const struct rte_flow_item *items)
     }
 }
 
+static void
+dump_port_id(struct ds *s, const void *conf)
+{
+    const struct rte_flow_action_port_id *port_id = conf;
+
+    ds_put_cstr(s, "port_id ");
+    if (port_id) {
+        ds_put_format(s, "original %d id %d ", port_id->original,
+                      port_id->id);
+        }
+        ds_put_cstr(s, "/ ");
+}
+
+
 static void
 dump_flow_action(struct ds *s, struct ds *s_extra,
                  struct flow_actions *flow_actions, int act_index)
@@ -481,14 +495,7 @@ dump_flow_action(struct ds *s, struct ds *s_extra,
     } else if (actions->type == RTE_FLOW_ACTION_TYPE_COUNT) {
         ds_put_cstr(s, "count / ");
     } else if (actions->type == RTE_FLOW_ACTION_TYPE_PORT_ID) {
-        const struct rte_flow_action_port_id *port_id = actions->conf;
-
-        ds_put_cstr(s, "port_id ");
-        if (port_id) {
-            ds_put_format(s, "original %d id %d ",
-                          port_id->original, port_id->id);
-        }
-        ds_put_cstr(s, "/ ");
+        dump_port_id(s, actions->conf);
     } else if (actions->type == RTE_FLOW_ACTION_TYPE_DROP) {
         ds_put_cstr(s, "drop / ");
     } else if (actions->type == RTE_FLOW_ACTION_TYPE_SET_MAC_SRC ||
-- 
2.21.0



More information about the dev mailing list