net/virtio: add non-mergeable support to in-order path
authorMaxime Coquelin <maxime.coquelin@redhat.com>
Thu, 20 Dec 2018 17:27:17 +0000 (18:27 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 21 Dec 2018 15:22:41 +0000 (16:22 +0100)
This patch adds support for in-order path when meargeable buffers
feature hasn't been negotiated.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
drivers/net/virtio/virtio_ethdev.c
drivers/net/virtio/virtio_ethdev.h
drivers/net/virtio/virtio_rxtx.c

index d0c65e3..446c338 100644 (file)
@@ -1481,10 +1481,9 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev)
                        eth_dev->rx_pkt_burst = virtio_recv_pkts_vec;
                } else if (hw->use_inorder_rx) {
                        PMD_INIT_LOG(INFO,
-                               "virtio: using inorder mergeable buffer Rx path on port %u",
+                               "virtio: using inorder Rx path on port %u",
                                eth_dev->data->port_id);
-                       eth_dev->rx_pkt_burst =
-                               &virtio_recv_mergeable_pkts_inorder;
+                       eth_dev->rx_pkt_burst = &virtio_recv_pkts_inorder;
                } else if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) {
                        PMD_INIT_LOG(INFO,
                                "virtio: using mergeable buffer Rx path on port %u",
@@ -2049,13 +2048,8 @@ virtio_dev_configure(struct rte_eth_dev *dev)
 
        if (vtpci_with_feature(hw, VIRTIO_F_IN_ORDER)) {
                hw->use_inorder_tx = 1;
-               if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF) &&
-                   !vtpci_packed_queue(hw)) {
-                       hw->use_inorder_rx = 1;
-                       hw->use_simple_rx = 0;
-               } else {
-                       hw->use_inorder_rx = 0;
-               }
+               hw->use_inorder_rx = 1;
+               hw->use_simple_rx = 0;
        }
 
        if (vtpci_packed_queue(hw)) {
index 364ecbb..f8d8a56 100644 (file)
@@ -83,7 +83,7 @@ uint16_t virtio_recv_mergeable_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 uint16_t virtio_recv_mergeable_pkts_packed(void *rx_queue,
                struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
 
-uint16_t virtio_recv_mergeable_pkts_inorder(void *rx_queue,
+uint16_t virtio_recv_pkts_inorder(void *rx_queue,
                struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
 
 uint16_t virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
index b02d41f..8f90804 100644 (file)
@@ -1330,7 +1330,7 @@ virtio_recv_pkts_packed(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 
 uint16_t
-virtio_recv_mergeable_pkts_inorder(void *rx_queue,
+virtio_recv_pkts_inorder(void *rx_queue,
                        struct rte_mbuf **rx_pkts,
                        uint16_t nb_pkts)
 {
@@ -1387,10 +1387,14 @@ virtio_recv_mergeable_pkts_inorder(void *rx_queue,
                header = (struct virtio_net_hdr_mrg_rxbuf *)
                         ((char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM
                         - hdr_size);
-               seg_num = header->num_buffers;
 
-               if (seg_num == 0)
+               if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) {
+                       seg_num = header->num_buffers;
+                       if (seg_num == 0)
+                               seg_num = 1;
+               } else {
                        seg_num = 1;
+               }
 
                rxm->data_off = RTE_PKTMBUF_HEADROOM;
                rxm->nb_segs = seg_num;