From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: <dev@dpdk.org>
Cc: <thomas.monjalon@6wind.com>, <bruce.richardson@intel.com>,
<jianbo.liu@linaro.org>, <huawei.xie@intel.com>,
<yuanhan.liu@linux.intel.com>,
Jerin Jacob <jerin.jacob@caviumnetworks.com>
Subject: [dpdk-dev] [PATCH v3 1/4] virtio: conditional compilation cleanup
Date: Tue, 5 Jul 2016 18:19:23 +0530 [thread overview]
Message-ID: <1467722966-2572-2-git-send-email-jerin.jacob@caviumnetworks.com> (raw)
In-Reply-To: <1467722966-2572-1-git-send-email-jerin.jacob@caviumnetworks.com>
Removed unnecessary compile time dependency on "use_simple_rxtx".
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
drivers/net/virtio/Makefile | 3 ---
drivers/net/virtio/virtio_pci.h | 1 +
drivers/net/virtio/virtio_rxtx.c | 24 ++++++++----------------
drivers/net/virtio/virtio_rxtx.h | 3 +--
drivers/net/virtio/virtio_rxtx_simple.c | 8 ++++++--
drivers/net/virtio/virtio_user_ethdev.c | 1 +
6 files changed, 17 insertions(+), 23 deletions(-)
diff --git a/drivers/net/virtio/Makefile b/drivers/net/virtio/Makefile
index 3020b68..b9b0d8d 100644
--- a/drivers/net/virtio/Makefile
+++ b/drivers/net/virtio/Makefile
@@ -50,10 +50,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtqueue.c
SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_pci.c
SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_rxtx.c
SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_ethdev.c
-
-ifeq ($(findstring RTE_MACHINE_CPUFLAG_SSSE3,$(CFLAGS)),RTE_MACHINE_CPUFLAG_SSSE3)
SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_rxtx_simple.c
-endif
ifeq ($(CONFIG_RTE_VIRTIO_USER),y)
SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_user/vhost_user.c
diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h
index dd7693f..b8295a7 100644
--- a/drivers/net/virtio/virtio_pci.h
+++ b/drivers/net/virtio/virtio_pci.h
@@ -253,6 +253,7 @@ struct virtio_hw {
uint8_t use_msix;
uint8_t started;
uint8_t modern;
+ uint8_t use_simple_rxtx;
uint8_t mac_addr[ETHER_ADDR_LEN];
uint32_t notify_off_multiplier;
uint8_t *isr;
diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index a27208e..e707954 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -67,10 +67,6 @@
#define VIRTIO_SIMPLE_FLAGS ((uint32_t)ETH_TXQ_FLAGS_NOMULTSEGS | \
ETH_TXQ_FLAGS_NOOFFLOADS)
-#ifdef RTE_MACHINE_CPUFLAG_SSSE3
-static int use_simple_rxtx;
-#endif
-
static void
vq_ring_free_chain(struct virtqueue *vq, uint16_t desc_idx)
{
@@ -333,6 +329,7 @@ virtio_dev_rxtx_start(struct rte_eth_dev *dev)
*/
uint16_t i;
uint16_t desc_idx;
+ struct virtio_hw *hw = dev->data->dev_private;
PMD_INIT_FUNC_TRACE();
@@ -353,8 +350,7 @@ virtio_dev_rxtx_start(struct rte_eth_dev *dev)
nbufs = 0;
error = ENOSPC;
-#ifdef RTE_MACHINE_CPUFLAG_SSSE3
- if (use_simple_rxtx) {
+ if (hw->use_simple_rxtx) {
for (desc_idx = 0; desc_idx < vq->vq_nentries;
desc_idx++) {
vq->vq_ring.avail->ring[desc_idx] = desc_idx;
@@ -362,7 +358,7 @@ virtio_dev_rxtx_start(struct rte_eth_dev *dev)
VRING_DESC_F_WRITE;
}
}
-#endif
+
memset(&rxvq->fake_mbuf, 0, sizeof(rxvq->fake_mbuf));
for (desc_idx = 0; desc_idx < RTE_PMD_VIRTIO_RX_MAX_BURST;
desc_idx++) {
@@ -378,12 +374,11 @@ virtio_dev_rxtx_start(struct rte_eth_dev *dev)
/******************************************
* Enqueue allocated buffers *
*******************************************/
-#ifdef RTE_MACHINE_CPUFLAG_SSSE3
- if (use_simple_rxtx)
+ if (hw->use_simple_rxtx)
error = virtqueue_enqueue_recv_refill_simple(vq, m);
else
-#endif
error = virtqueue_enqueue_recv_refill(vq, m);
+
if (error) {
rte_pktmbuf_free(m);
break;
@@ -404,8 +399,7 @@ virtio_dev_rxtx_start(struct rte_eth_dev *dev)
struct virtqueue *vq = txvq->vq;
virtio_dev_vring_start(vq);
-#ifdef RTE_MACHINE_CPUFLAG_SSSE3
- if (use_simple_rxtx) {
+ if (hw->use_simple_rxtx) {
uint16_t mid_idx = vq->vq_nentries >> 1;
for (desc_idx = 0; desc_idx < mid_idx; desc_idx++) {
@@ -426,7 +420,7 @@ virtio_dev_rxtx_start(struct rte_eth_dev *dev)
desc_idx++)
vq->vq_ring.avail->ring[desc_idx] = desc_idx;
}
-#endif
+
VIRTQUEUE_DUMP(vq);
}
}
@@ -456,9 +450,7 @@ virtio_dev_rx_queue_setup(struct rte_eth_dev *dev,
dev->data->rx_queues[queue_idx] = rxvq;
-#ifdef RTE_MACHINE_CPUFLAG_SSSE3
virtio_rxq_vec_setup(rxvq);
-#endif
return 0;
}
@@ -517,7 +509,7 @@ virtio_dev_tx_queue_setup(struct rte_eth_dev *dev,
PMD_INIT_LOG(INFO, "Using simple rx/tx path");
dev->tx_pkt_burst = virtio_xmit_pkts_simple;
dev->rx_pkt_burst = virtio_recv_pkts_vec;
- use_simple_rxtx = 1;
+ hw->use_simple_rxtx = 1;
}
#endif
diff --git a/drivers/net/virtio/virtio_rxtx.h b/drivers/net/virtio/virtio_rxtx.h
index 058b56a..28f82d6 100644
--- a/drivers/net/virtio/virtio_rxtx.h
+++ b/drivers/net/virtio/virtio_rxtx.h
@@ -86,10 +86,9 @@ struct virtnet_ctl {
const struct rte_memzone *mz; /**< mem zone to populate RX ring. */
};
-#ifdef RTE_MACHINE_CPUFLAG_SSSE3
int virtio_rxq_vec_setup(struct virtnet_rx *rxvq);
int virtqueue_enqueue_recv_refill_simple(struct virtqueue *vq,
struct rte_mbuf *m);
-#endif
+
#endif /* _VIRTIO_RXTX_H_ */
diff --git a/drivers/net/virtio/virtio_rxtx_simple.c b/drivers/net/virtio/virtio_rxtx_simple.c
index 242ad90..67430da 100644
--- a/drivers/net/virtio/virtio_rxtx_simple.c
+++ b/drivers/net/virtio/virtio_rxtx_simple.c
@@ -37,8 +37,6 @@
#include <string.h>
#include <errno.h>
-#include <tmmintrin.h>
-
#include <rte_cycles.h>
#include <rte_memory.h>
#include <rte_memzone.h>
@@ -131,6 +129,10 @@ virtio_rxq_rearm_vec(struct virtnet_rx *rxvq)
vq_update_avail_idx(vq);
}
+#ifdef RTE_MACHINE_CPUFLAG_SSSE3
+
+#include <tmmintrin.h>
+
/* virtio vPMD receive routine, only accept(nb_pkts >= RTE_VIRTIO_DESC_PER_LOOP)
*
* This routine is for non-mergeable RX, one desc for each guest buffer.
@@ -293,6 +295,8 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
return nb_pkts_received;
}
+#endif
+
#define VIRTIO_TX_FREE_THRESH 32
#define VIRTIO_TX_MAX_FREE_BUF_SZ 32
#define VIRTIO_TX_FREE_NR 32
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 3d3c9da..3185a4c 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -303,6 +303,7 @@ virtio_user_eth_dev_alloc(const char *name)
hw->vtpci_ops = &virtio_user_ops;
hw->use_msix = 0;
hw->modern = 0;
+ hw->use_simple_rxtx = 0;
hw->virtio_user_dev = dev;
data->dev_private = hw;
data->numa_node = SOCKET_ID_ANY;
--
2.5.5
next prev parent reply other threads:[~2016-07-05 12:50 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-27 11:54 [dpdk-dev] [PATCH 0/4] Virtio NEON support for ARM Jerin Jacob
2016-06-27 11:54 ` [dpdk-dev] [PATCH 1/4] virtio: Fix compile time dependency of use_simple_rxtx usage Jerin Jacob
2016-06-27 11:54 ` [dpdk-dev] [PATCH 2/4] virtio: introduce RTE_LIBRTE_VIRTIO_INC_VECTOR Jerin Jacob
2016-06-27 14:19 ` Thomas Monjalon
2016-06-27 14:48 ` Jerin Jacob
2016-06-27 14:59 ` Thomas Monjalon
2016-06-29 11:18 ` Jerin Jacob
2016-06-29 11:25 ` Thomas Monjalon
2016-06-29 11:40 ` Jerin Jacob
2016-06-30 5:44 ` Yuanhan Liu
2016-06-27 11:54 ` [dpdk-dev] [PATCH 3/4] virtio: move SSE based Rx implementation to separate file Jerin Jacob
2016-06-28 6:17 ` Jianbo Liu
2016-06-29 11:27 ` Jerin Jacob
2016-06-30 5:43 ` Yuanhan Liu
2016-06-27 11:54 ` [dpdk-dev] [PATCH 4/4] virtio: add neon support Jerin Jacob
2016-07-01 11:16 ` [dpdk-dev] From: Jerin Jacob <jerin.jacob@caviumnetworks.com> Jerin Jacob
2016-07-01 11:16 ` [dpdk-dev] [PATCH v2 1/3] virtio: conditional compilation cleanup Jerin Jacob
2016-07-04 7:36 ` Yuanhan Liu
2016-07-04 8:36 ` Jerin Jacob
2016-07-04 8:42 ` Yuanhan Liu
2016-07-04 9:07 ` Jerin Jacob
2016-07-04 11:02 ` Yuanhan Liu
2016-07-04 12:15 ` Jerin Jacob
2016-07-04 12:26 ` Yuanhan Liu
2016-07-04 12:50 ` Jerin Jacob
2016-07-04 12:57 ` Yuanhan Liu
2016-07-01 11:16 ` [dpdk-dev] [PATCH v2 2/3] virtio: move SSE based Rx implementation to separate file Jerin Jacob
2016-07-04 7:42 ` Yuanhan Liu
2016-07-04 8:38 ` Jerin Jacob
2016-07-01 11:16 ` [dpdk-dev] [PATCH v2 3/3] virtio: add neon support Jerin Jacob
2016-07-04 7:53 ` Yuanhan Liu
2016-07-04 8:55 ` Jerin Jacob
2016-07-04 9:02 ` Yuanhan Liu
2016-07-05 12:49 ` [dpdk-dev] [PATCH v3 0/4] Virtio NEON support for ARM Jerin Jacob
2016-07-05 12:49 ` Jerin Jacob [this message]
2016-07-05 12:49 ` [dpdk-dev] [PATCH v3 2/4] virtio: move SSE based Rx implementation to separate file Jerin Jacob
2016-08-18 6:52 ` Yuanhan Liu
2016-08-19 3:24 ` Jerin Jacob
2016-08-23 7:43 ` Yuanhan Liu
2016-07-05 12:49 ` [dpdk-dev] [PATCH v3 3/4] virtio: add cpuflag based vector handler selection Jerin Jacob
2016-07-05 12:49 ` [dpdk-dev] [PATCH v3 4/4] virtio: add neon support Jerin Jacob
2016-07-06 3:11 ` Jianbo Liu
2016-09-28 0:37 ` [dpdk-dev] [PATCH v3 0/4] Virtio NEON support for ARM Yuanhan Liu
2016-07-01 11:19 ` [dpdk-dev] [PATCH v2 0/3] " Jerin Jacob
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1467722966-2572-2-git-send-email-jerin.jacob@caviumnetworks.com \
--to=jerin.jacob@caviumnetworks.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=huawei.xie@intel.com \
--cc=jianbo.liu@linaro.org \
--cc=thomas.monjalon@6wind.com \
--cc=yuanhan.liu@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).