net/virtio: fix mbuf data offset for simple Rx
authorOlivier Matz <olivier.matz@6wind.com>
Mon, 12 Feb 2018 15:46:10 +0000 (16:46 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 13 Feb 2018 17:41:19 +0000 (18:41 +0100)
The mbuf->data_off was was not properly set for the first received
mbufs. Fix this by setting it in virtqueue_enqueue_recv_refill_simple(),
which is used to enqueue the first mbuf in the ring.

The function virtio_rxq_rearm_vec(), which is used to rearm the ring
with new mbufs, is valid and does not need to be updated.

Fixes: cab0461234e7 ("virtio: fill Rx avail ring with blank mbufs")
Cc: stable@dpdk.org
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
drivers/net/virtio/virtio_rxtx_simple.c

index 7247a08..b1f610f 100644 (file)
@@ -36,6 +36,7 @@ virtqueue_enqueue_recv_refill_simple(struct virtqueue *vq,
        uint16_t desc_idx;
 
        cookie->port = vq->rxq.port_id;
+       cookie->data_off = RTE_PKTMBUF_HEADROOM;
 
        desc_idx = vq->vq_avail_idx & (vq->vq_nentries - 1);
        dxp = &vq->vq_descx[desc_idx];