[ovs-dev] [PATCH 2/5] lib/dp-packet: copy additional packet info when do packet copy

Michael Qiu qdy220091330 at gmail.com
Thu Oct 27 06:15:21 UTC 2016


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 at chinac.com>
Signed-off-by: Jijiang Liu <liujijiang at chinac.com>
---
 lib/dp-packet.c   | 3 +++
 lib/netdev-dpdk.c | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/lib/dp-packet.c b/lib/dp-packet.c
index bf8522e..619f651 100644
--- a/lib/dp-packet.c
+++ b/lib/dp-packet.c
@@ -175,6 +175,9 @@ dp_packet_clone_with_headroom(const struct dp_packet *buffer, size_t headroom)
     new_buffer->cutlen = buffer->cutlen;
 #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 27b4ee2..ad92504 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -1589,6 +1589,10 @@ dpdk_do_tx_copy(struct netdev *netdev, int qid, struct dp_packet_batch *batch)
         memcpy(rte_pktmbuf_mtod(mbufs[newcnt], void *),
                dp_packet_data(batch->packets[i]), size);
 
+        mbufs[newcnt]->nb_segs = batch->packets[i]->mbuf.nb_segs;
+        mbufs[newcnt]->ol_flags = batch->packets[i]->mbuf.ol_flags;
+        mbufs[newcnt]->packet_type = batch->packets[i]->mbuf.packet_type;
+        mbufs[newcnt]->tx_offload = batch->packets[i]->mbuf.tx_offload;
         rte_pktmbuf_data_len(mbufs[newcnt]) = size;
         rte_pktmbuf_pkt_len(mbufs[newcnt]) = size;
 
-- 
1.8.3.1




More information about the dev mailing list