From: Olivier Matz Date: Mon, 9 May 2016 16:19:35 +0000 (+0200) Subject: net/virtio: check mbuf is direct when using any layout X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=88c107840d67662f2f34e6fd69844f5e86a86075;p=dpdk.git net/virtio: check mbuf is direct when using any layout The commit dd856dfcb9e74 introduced an optimization that prepends virtio header to mbuf data. It can be used when the tx mbuf is writeable, so we need to check that the mbuf is direct (i.e. it embeds its own data). Fixes: dd856dfcb9e7 ("virtio: use any layout on Tx") Signed-off-by: Olivier Matz Acked-by: Yuanhan Liu --- diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index 04f6832649..2411dbaee8 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -873,6 +873,7 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) /* optimize ring usage */ if (vtpci_with_feature(hw, VIRTIO_F_ANY_LAYOUT) && rte_mbuf_refcnt_read(txm) == 1 && + RTE_MBUF_DIRECT(txm) && txm->nb_segs == 1 && rte_pktmbuf_headroom(txm) >= hdr_size && rte_is_aligned(rte_pktmbuf_mtod(txm, char *),