Skip to contentSkip to conversation

virtio: check mbuf is direct when using any layout

PATCH In review Olivier Matz 2 participants 2 messages May 9, 2016 – May 23, 2016 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 dd856dfcb9e74 "virtio: use any layout on Tx"
---
 drivers/net/virtio/virtio_rxtx.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/virtio/virtio_rxtx.c +1 -0
index ef21d8e..ae28634 100644
@@ -886,6 +886,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 *),
Signature · 1 line
2.8.0.rc3
#1 lore raw
Quoted 5 lines · Olivier Matz

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 dd856dfcb9e74 "virtio: use any layout on Tx"

Missing "()" here. Fixed and applied to dpdk-next-virtio.

Thanks.

	--yliu