From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 1290F199BB for ; Thu, 7 Sep 2017 14:14:04 +0200 (CEST) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 3AE48CD5C9; Thu, 7 Sep 2017 14:10:17 +0200 (CEST) From: Olivier Matz To: dev@dpdk.org, yliu@fridaylinux.org, maxime.coquelin@redhat.com Cc: stephen@networkplumber.org Date: Thu, 7 Sep 2017 14:13:46 +0200 Message-Id: <20170907121347.16208-10-olivier.matz@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170907121347.16208-1-olivier.matz@6wind.com> References: <20170831134015.1383-1-olivier.matz@6wind.com> <20170907121347.16208-1-olivier.matz@6wind.com> Subject: [dpdk-dev] [PATCH v2 09/10] net/virtio: keep Rx handler whatever the Tx queue config X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Sep 2017 12:14:04 -0000 Split use_simple_rxtx into use_simple_rx and use_simple_tx, and ensure that only use_simple_tx is updated when txq flags forces to use the standard Tx handler. This change is also useful for next commit (disable simple Rx path when Rx checksum is requested). Signed-off-by: Olivier Matz --- drivers/net/virtio/virtio_ethdev.c | 19 ++++++++++++------- drivers/net/virtio/virtio_pci.h | 3 ++- drivers/net/virtio/virtio_rxtx.c | 8 ++++---- drivers/net/virtio/virtio_user_ethdev.c | 3 ++- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 0a4c677d7..271ebaedf 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1241,7 +1241,7 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev) { struct virtio_hw *hw = eth_dev->data->dev_private; - if (hw->use_simple_rxtx) { + 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; @@ -1256,7 +1256,7 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev) eth_dev->rx_pkt_burst = &virtio_recv_pkts; } - if (hw->use_simple_rxtx) { + 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; @@ -1741,14 +1741,19 @@ virtio_dev_configure(struct rte_eth_dev *dev) return -EBUSY; } - hw->use_simple_rxtx = 1; + hw->use_simple_rx = 1; + hw->use_simple_tx = 1; #if defined RTE_ARCH_ARM64 || defined CONFIG_RTE_ARCH_ARM - if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_NEON)) - hw->use_simple_rxtx = 0; + if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_NEON)) { + hw->use_simple_rx = 0; + hw->use_simple_tx = 0; + } #endif - if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) - hw->use_simple_rxtx = 0; + if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) { + hw->use_simple_rx = 0; + hw->use_simple_tx = 0; + } return 0; } diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h index 18caebdd7..2ff526c88 100644 --- a/drivers/net/virtio/virtio_pci.h +++ b/drivers/net/virtio/virtio_pci.h @@ -259,7 +259,8 @@ struct virtio_hw { uint8_t vlan_strip; uint8_t use_msix; uint8_t modern; - uint8_t use_simple_rxtx; + uint8_t use_simple_rx; + uint8_t use_simple_tx; uint8_t port_id; uint8_t mac_addr[ETHER_ADDR_LEN]; uint32_t notify_off_multiplier; diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index ef75ff5bd..45a9c919a 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -456,7 +456,7 @@ virtio_dev_rx_queue_setup_finish(struct rte_eth_dev *dev, uint16_t queue_idx) /* Allocate blank mbufs for the each rx descriptor */ nbufs = 0; - if (hw->use_simple_rxtx) { + if (hw->use_simple_rx) { for (desc_idx = 0; desc_idx < vq->vq_nentries; desc_idx++) { vq->vq_ring.avail->ring[desc_idx] = desc_idx; @@ -478,7 +478,7 @@ virtio_dev_rx_queue_setup_finish(struct rte_eth_dev *dev, uint16_t queue_idx) break; /* Enqueue allocated buffers */ - if (hw->use_simple_rxtx) + if (hw->use_simple_rx) error = virtqueue_enqueue_recv_refill_simple(vq, m); else error = virtqueue_enqueue_recv_refill(vq, m); @@ -525,7 +525,7 @@ virtio_dev_tx_queue_setup(struct rte_eth_dev *dev, /* cannot use simple rxtx funcs with multisegs or offloads */ if ((tx_conf->txq_flags & VIRTIO_SIMPLE_FLAGS) != VIRTIO_SIMPLE_FLAGS) - hw->use_simple_rxtx = 0; + hw->use_simple_tx = 0; if (nb_desc == 0 || nb_desc > vq->vq_nentries) nb_desc = vq->vq_nentries; @@ -567,7 +567,7 @@ virtio_dev_tx_queue_setup_finish(struct rte_eth_dev *dev, PMD_INIT_FUNC_TRACE(); - if (hw->use_simple_rxtx) { + if (hw->use_simple_tx) { for (desc_idx = 0; desc_idx < mid_idx; desc_idx++) { vq->vq_ring.avail->ring[desc_idx] = desc_idx + mid_idx; diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index c96144434..57c964d6d 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -369,7 +369,8 @@ virtio_user_eth_dev_alloc(struct rte_vdev_device *vdev) */ hw->use_msix = 1; hw->modern = 0; - hw->use_simple_rxtx = 0; + hw->use_simple_rx = 0; + hw->use_simple_tx = 0; hw->virtio_user_dev = dev; data->dev_flags = RTE_ETH_DEV_DETACHABLE; return eth_dev; -- 2.11.0