From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id C52725AB0 for ; Mon, 9 May 2016 18:20:10 +0200 (CEST) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id D0DD524CD9; Mon, 9 May 2016 18:18:33 +0200 (CEST) From: Olivier Matz To: dev@dpdk.org, yuanhan.liu@linux.intel.com, huawei.xie@intel.com, stephen@networkplumber.org Date: Mon, 9 May 2016 18:19:35 +0200 Message-Id: <1462810775-7538-1-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 2.8.0.rc3 Subject: [dpdk-dev] [PATCH] virtio: check mbuf is direct when using any layout X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2016 16:20:10 -0000 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" Signed-off-by: Olivier Matz --- drivers/net/virtio/virtio_rxtx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index ef21d8e..ae28634 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -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 *), -- 2.8.0.rc3