Maybe better to place this patch right after the non-mrg one.
On 04/05/2018 12:10 PM, Jens Freimann wrote:
Implement support for receiving merged buffers in virtio when packed virtqueues
are enabled.
Signed-off-by: Jens Freimann <jfreim...@redhat.com>
---
drivers/net/virtio/virtio_ethdev.c | 10 ++--
drivers/net/virtio/virtio_rxtx.c | 107 +++++++++++++++++++++++++++++++++----
drivers/net/virtio/virtqueue.h | 1 +
3 files changed, 104 insertions(+), 14 deletions(-)
diff --git a/drivers/net/virtio/virtio_ethdev.c
b/drivers/net/virtio/virtio_ethdev.c
index 7367d9c5d..a3c3376d7 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1322,15 +1322,15 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev)
{
struct virtio_hw *hw = eth_dev->data->dev_private;
- /* workarount for packed vqs which don't support mrg_rxbuf at this point */
- if (vtpci_packed_queue(hw) && vtpci_with_feature(hw,
VIRTIO_NET_F_MRG_RXBUF)) {
- eth_dev->rx_pkt_burst = &virtio_recv_pkts_packed;
- } else if (hw->use_simple_rx) {
+ if (hw->use_simple_rx) {
PMD_INIT_LOG(INFO, "virtio: using simple Rx path on port %u",
eth_dev->data->port_id);
eth_dev->rx_pkt_burst = virtio_recv_pkts_vec;
} else if (vtpci_packed_queue(hw)) {
- eth_dev->rx_pkt_burst = &virtio_recv_pkts_packed;
+ if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF))
+ eth_dev->rx_pkt_burst = &virtio_recv_mergeable_pkts;
+ else
+ eth_dev->rx_pkt_burst = &virtio_recv_pkts_packed;
} else if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) {
PMD_INIT_LOG(INFO,
"virtio: using mergeable buffer Rx path on port %u",
diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 9220ae661..a48ca6aaa 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -155,8 +155,8 @@ vq_ring_free_chain(struct virtqueue *vq, uint16_t desc_idx)
vq->vq_free_cnt = (uint16_t)(vq->vq_free_cnt + dxp->ndescs);
if ((dp->flags & VRING_DESC_F_INDIRECT) == 0) {
while (dp->flags & VRING_DESC_F_NEXT) {
- desc_idx_last = dp->next;
- dp = &vq->vq_ring.desc[dp->next];
+ desc_idx_last = desc_idx++;
+ dp = &vq->vq_ring.desc[desc_idx];
Are you sure this change is in the right patch?
}
}
dxp->ndescs = 0;
@@ -177,6 +177,76 @@ vq_ring_free_chain(struct virtqueue *vq, uint16_t desc_idx)
dp->next = VQ_RING_DESC_CHAIN_END;
}