X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fvirtio%2Fvirtio_rxtx_packed.c;h=45cf39df2222b8e0802d4ec4c7ec9fe68658ab36;hb=52600004e70826304fdc52cc1e56264d87a77688;hp=882dca36ec734bb9792cd68ad3948c1c616742f5;hpb=9ef38ddba35cb31c613dc0ab7afafbd5d422b429;p=dpdk.git diff --git a/drivers/net/virtio/virtio_rxtx_packed.c b/drivers/net/virtio/virtio_rxtx_packed.c index 882dca36ec..45cf39df22 100644 --- a/drivers/net/virtio/virtio_rxtx_packed.c +++ b/drivers/net/virtio/virtio_rxtx_packed.c @@ -27,7 +27,7 @@ virtio_xmit_pkts_packed_vec(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { struct virtnet_tx *txvq = tx_queue; - struct virtqueue *vq = txvq->vq; + struct virtqueue *vq = virtnet_txq_to_vq(txvq); struct virtio_hw *hw = vq->hw; uint16_t nb_tx = 0; uint16_t remained; @@ -81,7 +81,7 @@ virtio_recv_pkts_packed_vec(void *rx_queue, uint16_t nb_pkts) { struct virtnet_rx *rxvq = rx_queue; - struct virtqueue *vq = rxvq->vq; + struct virtqueue *vq = virtnet_rxq_to_vq(rxvq); struct virtio_hw *hw = vq->hw; uint16_t num, nb_rx = 0; uint32_t nb_enqueued = 0; @@ -95,11 +95,13 @@ virtio_recv_pkts_packed_vec(void *rx_queue, num = num - ((vq->vq_used_cons_idx + num) % PACKED_BATCH_SIZE); while (num) { - if (!virtqueue_dequeue_batch_packed_vec(rxvq, - &rx_pkts[nb_rx])) { - nb_rx += PACKED_BATCH_SIZE; - num -= PACKED_BATCH_SIZE; - continue; + if (num >= PACKED_BATCH_SIZE) { + if (!virtqueue_dequeue_batch_packed_vec(rxvq, + &rx_pkts[nb_rx])) { + nb_rx += PACKED_BATCH_SIZE; + num -= PACKED_BATCH_SIZE; + continue; + } } if (!virtqueue_dequeue_single_packed_vec(rxvq, &rx_pkts[nb_rx])) {