[ovs-dev,RFC,v3,3/8] lib/dp-packet: copy mbuf info for packet copy

Message ID 1511288957-68599-4-git-send-email-mark.b.kavanagh@intel.com
State Superseded
Delegated to: Ian Stokes
Headers show
Series
  • netdev-dpdk: support multi-segment mbufs
Related show

Commit Message

Kavanagh, Mark B Nov. 21, 2017, 6:29 p.m.
From: Michael Qiu <qiudayu@chinac.com>

Currently, when doing packet copy, lots of DPDK mbuf's info
will be missed, like packet type, ol_flags, etc.
Those information is very important for DPDK to do
packets processing.

Signed-off-by: Michael Qiu <qiudayu@chinac.com>
[mark.b.kavanagh@intel.com rebased]
Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
---
 lib/dp-packet.c   | 3 +++
 lib/netdev-dpdk.c | 4 ++++
 2 files changed, 7 insertions(+)

Patch

diff --git a/lib/dp-packet.c b/lib/dp-packet.c
index 443c225..5078211 100644
--- a/lib/dp-packet.c
+++ b/lib/dp-packet.c
@@ -178,6 +178,9 @@  dp_packet_clone_with_headroom(const struct dp_packet *buffer, size_t headroom)
 
 #ifdef DPDK_NETDEV
     new_buffer->mbuf.ol_flags = buffer->mbuf.ol_flags;
+    new_buffer->mbuf.tx_offload = buffer->mbuf.tx_offload;
+    new_buffer->mbuf.packet_type = buffer->mbuf.packet_type;
+    new_buffer->mbuf.nb_segs = buffer->mbuf.nb_segs;
 #else
     new_buffer->rss_hash_valid = buffer->rss_hash_valid;
 #endif
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index c5eb851..61a0dca 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -1860,6 +1860,10 @@  dpdk_do_tx_copy(struct netdev *netdev, int qid, struct dp_packet_batch *batch)
         memcpy(rte_pktmbuf_mtod(pkts[txcnt], void *),
                dp_packet_data(packet), size);
         dp_packet_set_size((struct dp_packet *)pkts[txcnt], size);
+        pkts[txcnt]->nb_segs = packet->mbuf.nb_segs;
+        pkts[txcnt]->ol_flags = packet->mbuf.ol_flags;
+        pkts[txcnt]->packet_type = packet->mbuf.packet_type;
+        pkts[txcnt]->tx_offload = packet->mbuf.tx_offload;
 
         txcnt++;
     }