|
|
d76f50 |
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
|
|
|
d76f50 |
index e0328f61d..64a0cc608 100644
|
|
|
d76f50 |
--- a/drivers/net/virtio/virtio_ethdev.c
|
|
|
d76f50 |
+++ b/drivers/net/virtio/virtio_ethdev.c
|
|
|
d76f50 |
@@ -1860,7 +1860,7 @@ virtio_dev_start(struct rte_eth_dev *dev)
|
|
|
d76f50 |
for (i = 0; i < dev->data->nb_rx_queues; i++) {
|
|
|
d76f50 |
rxvq = dev->data->rx_queues[i];
|
|
|
d76f50 |
/* Flush the old packets */
|
|
|
d76f50 |
- virtqueue_flush(rxvq->vq);
|
|
|
d76f50 |
+ virtqueue_rxvq_flush(rxvq->vq);
|
|
|
d76f50 |
virtqueue_notify(rxvq->vq);
|
|
|
d76f50 |
}
|
|
|
d76f50 |
|
|
|
d76f50 |
diff --git a/drivers/net/virtio/virtqueue.c b/drivers/net/virtio/virtqueue.c
|
|
|
d76f50 |
index c3a536f8a..696d0e4a4 100644
|
|
|
d76f50 |
--- a/drivers/net/virtio/virtqueue.c
|
|
|
d76f50 |
+++ b/drivers/net/virtio/virtqueue.c
|
|
|
d76f50 |
@@ -37,6 +37,7 @@
|
|
|
d76f50 |
#include "virtqueue.h"
|
|
|
d76f50 |
#include "virtio_logs.h"
|
|
|
d76f50 |
#include "virtio_pci.h"
|
|
|
d76f50 |
+#include "virtio_rxtx_simple.h"
|
|
|
d76f50 |
|
|
|
d76f50 |
/*
|
|
|
d76f50 |
* Two types of mbuf to be cleaned:
|
|
|
d76f50 |
@@ -62,8 +63,10 @@ virtqueue_detatch_unused(struct virtqueue *vq)
|
|
|
d76f50 |
|
|
|
d76f50 |
/* Flush the elements in the used ring. */
|
|
|
d76f50 |
void
|
|
|
d76f50 |
-virtqueue_flush(struct virtqueue *vq)
|
|
|
d76f50 |
+virtqueue_rxvq_flush(struct virtqueue *vq)
|
|
|
d76f50 |
{
|
|
|
d76f50 |
+ struct virtnet_rx *rxq = &vq->rxq;
|
|
|
d76f50 |
+ struct virtio_hw *hw = vq->hw;
|
|
|
d76f50 |
struct vring_used_elem *uep;
|
|
|
d76f50 |
struct vq_desc_extra *dxp;
|
|
|
d76f50 |
uint16_t used_idx, desc_idx;
|
|
|
d76f50 |
@@ -74,13 +77,27 @@ virtqueue_flush(struct virtqueue *vq)
|
|
|
d76f50 |
for (i = 0; i < nb_used; i++) {
|
|
|
d76f50 |
used_idx = vq->vq_used_cons_idx & (vq->vq_nentries - 1);
|
|
|
d76f50 |
uep = &vq->vq_ring.used->ring[used_idx];
|
|
|
d76f50 |
- desc_idx = (uint16_t)uep->id;
|
|
|
d76f50 |
- dxp = &vq->vq_descx[desc_idx];
|
|
|
d76f50 |
- if (dxp->cookie != NULL) {
|
|
|
d76f50 |
- rte_pktmbuf_free(dxp->cookie);
|
|
|
d76f50 |
- dxp->cookie = NULL;
|
|
|
d76f50 |
+ if (hw->use_simple_rx) {
|
|
|
d76f50 |
+ desc_idx = used_idx;
|
|
|
d76f50 |
+ rte_pktmbuf_free(vq->sw_ring[desc_idx]);
|
|
|
d76f50 |
+ vq->vq_free_cnt++;
|
|
|
d76f50 |
+ } else {
|
|
|
d76f50 |
+ desc_idx = (uint16_t)uep->id;
|
|
|
d76f50 |
+ dxp = &vq->vq_descx[desc_idx];
|
|
|
d76f50 |
+ if (dxp->cookie != NULL) {
|
|
|
d76f50 |
+ rte_pktmbuf_free(dxp->cookie);
|
|
|
d76f50 |
+ dxp->cookie = NULL;
|
|
|
d76f50 |
+ }
|
|
|
d76f50 |
+ vq_ring_free_chain(vq, desc_idx);
|
|
|
d76f50 |
}
|
|
|
d76f50 |
vq->vq_used_cons_idx++;
|
|
|
d76f50 |
- vq_ring_free_chain(vq, desc_idx);
|
|
|
d76f50 |
+ }
|
|
|
d76f50 |
+
|
|
|
d76f50 |
+ if (hw->use_simple_rx) {
|
|
|
d76f50 |
+ while (vq->vq_free_cnt >= RTE_VIRTIO_VPMD_RX_REARM_THRESH) {
|
|
|
d76f50 |
+ virtio_rxq_rearm_vec(rxq);
|
|
|
d76f50 |
+ if (virtqueue_kick_prepare(vq))
|
|
|
d76f50 |
+ virtqueue_notify(vq);
|
|
|
d76f50 |
+ }
|
|
|
d76f50 |
}
|
|
|
d76f50 |
}
|
|
|
d76f50 |
diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h
|
|
|
d76f50 |
index 2305d91a4..ab466c2db 100644
|
|
|
d76f50 |
--- a/drivers/net/virtio/virtqueue.h
|
|
|
d76f50 |
+++ b/drivers/net/virtio/virtqueue.h
|
|
|
d76f50 |
@@ -304,7 +304,7 @@ void virtqueue_dump(struct virtqueue *vq);
|
|
|
d76f50 |
struct rte_mbuf *virtqueue_detatch_unused(struct virtqueue *vq);
|
|
|
d76f50 |
|
|
|
d76f50 |
/* Flush the elements in the used ring. */
|
|
|
d76f50 |
-void virtqueue_flush(struct virtqueue *vq);
|
|
|
d76f50 |
+void virtqueue_rxvq_flush(struct virtqueue *vq);
|
|
|
d76f50 |
|
|
|
d76f50 |
static inline int
|
|
|
d76f50 |
virtqueue_full(const struct virtqueue *vq)
|