On 04/05/2018 12:10 PM, Jens Freimann wrote:
This implements the transmit path for devices with
support for Virtio 1.1.

Add the feature bit for Virtio 1.1 and enable code to
add buffers to vring and mark descriptors as available.

This is based on a patch by Yuanhan Liu.

Signed-off-by: Jens Freiman <jfreim...@redhat.com>
---
  drivers/net/virtio/virtio_ethdev.c |   8 ++-
  drivers/net/virtio/virtio_ethdev.h |   3 ++
  drivers/net/virtio/virtio_rxtx.c   | 102 ++++++++++++++++++++++++++++++++++++-
  3 files changed, 111 insertions(+), 2 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c 
b/drivers/net/virtio/virtio_ethdev.c
index cccefafe9..089a161ac 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -383,6 +383,8 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t 
vtpci_queue_idx)
        vq->hw = hw;
        vq->vq_queue_index = vtpci_queue_idx;
        vq->vq_nentries = vq_size;
+       if (vtpci_packed_queue(hw))
+               vq->vq_ring.avail_wrap_counter = 1;
/*
         * Reserve a memzone for vring elements
@@ -1328,7 +1330,11 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev)
                eth_dev->rx_pkt_burst = &virtio_recv_pkts;
        }
- if (hw->use_simple_tx) {
+       if (vtpci_packed_queue(hw)) {
+               PMD_INIT_LOG(INFO, "virtio: using virtio 1.1 Tx path on port 
%u",
+                       eth_dev->data->port_id);
+               eth_dev->tx_pkt_burst = virtio_xmit_pkts_packed;
+       } else if (hw->use_simple_tx) {
                PMD_INIT_LOG(INFO, "virtio: using simple Tx path on port %u",
                        eth_dev->data->port_id);
                eth_dev->tx_pkt_burst = virtio_xmit_pkts_simple;
diff --git a/drivers/net/virtio/virtio_ethdev.h 
b/drivers/net/virtio/virtio_ethdev.h
index bb40064ea..d457013cb 100644
--- a/drivers/net/virtio/virtio_ethdev.h
+++ b/drivers/net/virtio/virtio_ethdev.h
@@ -36,6 +36,7 @@
         1ULL << VIRTIO_NET_F_GUEST_ANNOUNCE |    \
         1u << VIRTIO_RING_F_INDIRECT_DESC |    \
         1ULL << VIRTIO_F_VERSION_1       |       \
+        1ULL << VIRTIO_F_RING_PACKED     |       \

Should it really advertise VIRTIO_F_RING_PACKED unconditionally, as it
is not yet fully supported? (non-pow2, indirect descs, etc...)

         1ULL << VIRTIO_F_IOMMU_PLATFORM)
#define VIRTIO_PMD_SUPPORTED_GUEST_FEATURES \

Reply via email to