diff mbox series

[ovs-dev,1/2] flow: Return value from miniflow_extract()

Message ID 20240505064209.2866336-1-roid@nvidia.com
State Rejected
Headers show
Series [ovs-dev,1/2] flow: Return value from miniflow_extract() | 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 success test: success

Commit Message

Roi Dayan May 5, 2024, 6:42 a.m. UTC
From: Eli Britstein <elibr@nvidia.com>

Parsing of the packet has some validity checks. Return it as a return
value.

Signed-off-by: Eli Britstein <elibr@nvidia.com>
Acked-by: Roi Dayan <roid@nvidia.com>
---
 lib/flow.c | 6 +++++-
 lib/flow.h | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/lib/flow.c b/lib/flow.c
index 8e3402388cbc..417e0a63acd0 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -785,7 +785,7 @@  dump_invalid_packet(struct dp_packet *packet, const char *reason)
  *      present and the packet has at least the content used for the fields
  *      of interest for the flow, otherwise UINT16_MAX.
  */
-void
+bool
 miniflow_extract(struct dp_packet *packet, struct miniflow *dst)
 {
     /* Add code to this function (or its callees) to extract new fields. */
@@ -803,6 +803,7 @@  miniflow_extract(struct dp_packet *packet, struct miniflow *dst)
     uint8_t nw_frag, nw_tos, nw_ttl, nw_proto;
     uint8_t *ct_nw_proto_p = NULL;
     ovs_be16 ct_tp_src = 0, ct_tp_dst = 0;
+    bool rv = false;
 
     /* Metadata. */
     if (flow_tnl_dst_is_set(&md->tunnel)) {
@@ -1027,6 +1028,7 @@  miniflow_extract(struct dp_packet *packet, struct miniflow *dst)
                                     sizeof(uint64_t));
             }
         }
+        rv = true;
         goto out;
     }
 
@@ -1166,8 +1168,10 @@  miniflow_extract(struct dp_packet *packet, struct miniflow *dst)
             }
         }
     }
+    rv = true;
  out:
     dst->map = mf.map;
+    return rv;
 }
 
 static ovs_be16
diff --git a/lib/flow.h b/lib/flow.h
index 75a9be3c19d3..f91e074e2279 100644
--- a/lib/flow.h
+++ b/lib/flow.h
@@ -541,7 +541,7 @@  struct pkt_metadata;
 /* The 'dst' must follow with buffer space for FLOW_U64S 64-bit units.
  * 'dst->map' is ignored on input and set on output to indicate which fields
  * were extracted. */
-void miniflow_extract(struct dp_packet *packet, struct miniflow *dst);
+bool miniflow_extract(struct dp_packet *packet, struct miniflow *dst);
 void miniflow_map_init(struct miniflow *, const struct flow *);
 void flow_wc_map(const struct flow *, struct flowmap *);
 size_t miniflow_alloc(struct miniflow *dsts[], size_t n,