A dp_packet object comes from either dp_packet_new() (which resets all
fields to good default values) or from a DPDK mempool.

Reset offsets in netdev-dpdk so that inner offsets are in a clean state
before calling flow extraction for the first time.

On recirculation, inner offsets can be left untouched when extracting
flow informations again.

Reported-at: https://issues.redhat.com/browse/FDP-1517
Signed-off-by: David Marchand <[email protected]>
---
 lib/flow.c        | 9 +++------
 lib/netdev-dpdk.c | 1 +
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/lib/flow.c b/lib/flow.c
index b522f7f116..0855aca218 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -863,12 +863,9 @@ miniflow_extract(struct dp_packet *packet, struct miniflow 
*dst)
 
     /* Initialize packet's layer pointer and offsets. */
     frame = data;
-    if (dp_packet_tunnel(packet)) {
-        /* Preserve inner offsets from previous circulation. */
-        dp_packet_reset_outer_offsets(packet);
-    } else {
-        dp_packet_reset_offsets(packet);
-    }
+
+    /* Preserve inner offsets from previous circulation (if any). */
+    dp_packet_reset_outer_offsets(packet);
 
     if (packet_type == htonl(PT_ETH)) {
         /* Must have full Ethernet header to proceed. */
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 5692111b32..ef024a2d6e 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -2619,6 +2619,7 @@ netdev_dpdk_batch_init_packet_fields(struct 
dp_packet_batch *batch)
 
     DP_PACKET_BATCH_FOR_EACH (i, packet, batch) {
         dp_packet_reset_cutlen(packet);
+        dp_packet_reset_offsets(packet);
         packet->packet_type = htonl(PT_ETH);
         packet->has_hash = !!(packet->mbuf.ol_flags & RTE_MBUF_F_RX_RSS_HASH);
         packet->has_mark = !!(packet->mbuf.ol_flags & RTE_MBUF_F_RX_FDIR_ID);
-- 
2.50.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to