From: Yi Yang <[email protected]>

For multi-seg mbuf, pkt_len isn't equal to data_len,
data_len is data_len of the first seg, pkt_len is
sum of data_len of all the segs, so for such packets,
dp_packet_set_size shouldn't change data_len.

Signed-off-by: Yi Yang <[email protected]>
---
 lib/dp-packet.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/dp-packet.h b/lib/dp-packet.h
index 0430cca..070d111 100644
--- a/lib/dp-packet.h
+++ b/lib/dp-packet.h
@@ -575,7 +575,9 @@ dp_packet_set_size(struct dp_packet *b, uint32_t v)
      * (and thus 'v') will always be <= UINT16_MAX; this means that there is no
      * loss of accuracy in assigning 'v' to 'data_len'.
      */
-    b->mbuf.data_len = (uint16_t)v;  /* Current seg length. */
+    if (b->mbuf.nb_segs <= 1) {
+        b->mbuf.data_len = (uint16_t)v;  /* Current seg length. */
+    }
     b->mbuf.pkt_len = v;             /* Total length of all segments linked to
                                       * this segment. */
 }
-- 
2.7.4

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

Reply via email to