The dp_packet_put_uninit() function is, in its current implementation, operating on the data buffer of a dp_packet as if it were contiguous, which in the case of multi-segment mbufs means they operate on the first mbuf in the chain. However, when making use of multi-segment mbufs, it is the data length of the last mbuf in the mbuf chain that should be adjusted. This function has thus been modified to support multi-segment mbufs.
Co-authored-by: Mark Kavanagh <[email protected]> Signed-off-by: Mark Kavanagh <[email protected]> Signed-off-by: Tiago Lam <[email protected]> --- lib/dp-packet.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/dp-packet.c b/lib/dp-packet.c index 2aaeaae..9f8503e 100644 --- a/lib/dp-packet.c +++ b/lib/dp-packet.c @@ -321,7 +321,19 @@ dp_packet_put_uninit(struct dp_packet *b, size_t size) void *p; dp_packet_prealloc_tailroom(b, size); p = dp_packet_tail(b); +#ifdef DPDK_NETDEV + struct rte_mbuf *mbuf; + + if (b->source == DPBUF_DPDK) { + mbuf = rte_pktmbuf_lastseg(&b->mbuf); + } else { + mbuf = CONST_CAST(struct rte_mbuf *, &b->mbuf); + } + + mbuf->data_len += size; +#endif dp_packet_set_size(b, dp_packet_size(b) + size); + return p; } -- 2.7.4 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
