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 2DED9324A; Thu, 31 Aug 2017 15:40:55 +0200 (CEST) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 1B81DC9BD3; Thu, 31 Aug 2017 15:37:33 +0200 (CEST) From: Olivier Matz To: dev@dpdk.org, yliu@fridaylinux.org, maxime.coquelin@redhat.com Cc: stephen@networkplumber.org, stable@dpdk.org Date: Thu, 31 Aug 2017 15:40:14 +0200 Message-Id: <20170831134015.1383-9-olivier.matz@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170831134015.1383-1-olivier.matz@6wind.com> References: <20170831134015.1383-1-olivier.matz@6wind.com> Subject: [dpdk-stable] [PATCH 8/9] net/virtio: keep Rx handler whatever the Tx queue config X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Aug 2017 13:40:56 -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). Cc: stable@dpdk.org Signed-off-by: Olivier Matz --- drivers/net/virtio/virtio_ethdev.c | 25 ++++++++++++++++--------- drivers/net/virtio/virtio_pci.h | 3 ++- drivers/net/virtio/virtio_rxtx.c | 18 +++++++++--------- drivers/net/virtio/virtio_user_ethdev.c | 3 ++- 4 files changed, 29 insertions(+), 20 deletions(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 8dad3095f..4845d44b0 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,17 +1741,24 @@ 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_X86 - if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_SSE3)) - hw->use_simple_rxtx = 0; + if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_SSE3)) { + hw->use_simple_rx = 0; + hw->use_simple_tx = 0; + } #elif 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 c9d97b643..b81ba0d4a 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); @@ -502,17 +502,17 @@ virtio_dev_rx_queue_setup_finish(struct rte_eth_dev *dev, uint16_t queue_idx) } static void -virtio_update_rxtx_handler(struct rte_eth_dev *dev, +virtio_update_tx_handler(struct rte_eth_dev *dev, const struct rte_eth_txconf *tx_conf) { struct virtio_hw *hw = dev->data->dev_private; - uint8_t use_simple_rxtx = hw->use_simple_rxtx; + uint8_t use_simple_tx = hw->use_simple_tx; - /* cannot use simple rxtx funcs with multisegs or offloads */ + /* use simple tx func if single segment and no offloads */ if ((tx_conf->txq_flags & VIRTIO_SIMPLE_FLAGS) != VIRTIO_SIMPLE_FLAGS) - use_simple_rxtx = 0; + use_simple_tx = 0; - hw->use_simple_rxtx = use_simple_rxtx; + hw->use_simple_tx = use_simple_tx; } /* @@ -537,7 +537,7 @@ virtio_dev_tx_queue_setup(struct rte_eth_dev *dev, PMD_INIT_FUNC_TRACE(); - virtio_update_rxtx_handler(dev, tx_conf); + virtio_update_tx_handler(dev, tx_conf); if (nb_desc == 0 || nb_desc > vq->vq_nentries) nb_desc = vq->vq_nentries; @@ -579,7 +579,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