[ovs-dev,v4,1/3] dp-packet: preserve headroom when cloning a pkt batch
diff mbox series

Message ID 20200116170035.261803-2-fbl@sysclose.org
State Accepted
Headers show
Series
  • Add support for TSO with DPDK
Related show

Commit Message

Flavio Leitner Jan. 16, 2020, 5 p.m. UTC
The headroom is useful if the packet needs to insert additional
header, so preserve the original headroom when cloning the batch.

Signed-off-by: Flavio Leitner <fbl@sysclose.org>
---
 lib/dp-packet.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Ilya Maximets Jan. 17, 2020, 4:18 p.m. UTC | #1
On 16.01.2020 18:00, Flavio Leitner wrote:
> The headroom is useful if the packet needs to insert additional
> header, so preserve the original headroom when cloning the batch.
> 
> Signed-off-by: Flavio Leitner <fbl@sysclose.org>
> ---
>  lib/dp-packet.h | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 

Acked-by: Ilya Maximets <i.maximets@ovn.org>

Patch
diff mbox series

diff --git a/lib/dp-packet.h b/lib/dp-packet.h
index 3dd59e25d..133942155 100644
--- a/lib/dp-packet.h
+++ b/lib/dp-packet.h
@@ -879,7 +879,11 @@  dp_packet_batch_clone(struct dp_packet_batch *dst,
 
     dp_packet_batch_init(dst);
     DP_PACKET_BATCH_FOR_EACH (i, packet, src) {
-        dp_packet_batch_add(dst, dp_packet_clone(packet));
+        uint32_t headroom = dp_packet_headroom(packet);
+        struct dp_packet *pkt_clone;
+
+        pkt_clone  = dp_packet_clone_with_headroom(packet, headroom);
+        dp_packet_batch_add(dst, pkt_clone);
     }
     dst->trunc = src->trunc;
 }