diff mbox series

[ovs-dev,v5,01/13] python: ovs: flow: Support dp-extra-info section.

Message ID 20240710170504.2162803-2-amorenoz@redhat.com
State Changes Requested
Headers show
Series Add flow visualization utility. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation fail test: fail

Commit Message

Adrián Moreno July 10, 2024, 5:04 p.m. UTC
DPDK flows can have this extra section that, for now, only has one
possible key (miniflow_bits). Add it to the ODPFlow flow.

Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
---
 python/ovs/flow/odp.py | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

Comments

Eelco Chaudron Aug. 16, 2024, 1:26 p.m. UTC | #1
On 10 Jul 2024, at 19:04, Adrian Moreno wrote:

> DPDK flows can have this extra section that, for now, only has one
> possible key (miniflow_bits). Add it to the ODPFlow flow.
>
> Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
> ---

Thanks for sending the v5, the changes look good to me.

Note that you need to rebase the series to the latest main branch.

Cheers,

Eelco

Acked-by: Eelco Chaudron <echaudro@redhat.com>
diff mbox series

Patch

diff --git a/python/ovs/flow/odp.py b/python/ovs/flow/odp.py
index a8f8c067a..d5faff03e 100644
--- a/python/ovs/flow/odp.py
+++ b/python/ovs/flow/odp.py
@@ -119,7 +119,15 @@  class ODPFlow(Flow):
         ]
 
         action_pos += 8  # len("actions:")
-        actions = odp_string[action_pos:]
+
+        dp_extra_pos = odp_string[action_pos:].find("dp-extra-info")
+        if dp_extra_pos > 0:
+            dp_extra_pos += action_pos
+            actions = odp_string[action_pos : dp_extra_pos]
+            dp_extra_pos += 14  # len("dp-extra-info:")
+            dp_extra = odp_string[dp_extra_pos :]
+        else:
+            actions = odp_string[action_pos:]
 
         field_parts = rest.lstrip(" ").partition(" ")
 
@@ -160,6 +168,19 @@  class ODPFlow(Flow):
         )
         sections.append(asection)
 
+        if dp_extra_pos > 0:
+            dparser = KVParser(
+                dp_extra, KVDecoders({"miniflow_bits": decode_default})
+            )
+            dparser.parse()
+            dsection = Section(
+                name="dp_extra_info",
+                pos=dp_extra_pos,
+                string=dp_extra,
+                data=dparser.kv(),
+            )
+            sections.append(dsection)
+
         super(ODPFlow, self).__init__(sections, odp_string, id)
 
     def __str__(self):