DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: dev@dpdk.org, chenbo.xia@intel.com, olivier.matz@6wind.com,
	amorenoz@redhat.com, david.marchand@redhat.com
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
Subject: [dpdk-dev] [PATCH v4 24/44] net/virtio: remove last PCI refs in non-PCI code
Date: Tue, 26 Jan 2021 11:16:19 +0100
Message-ID: <20210126101639.250481-25-maxime.coquelin@redhat.com> (raw)
In-Reply-To: <20210126101639.250481-1-maxime.coquelin@redhat.com>

This patch finalizes the bus isolation part of this
refactoring.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
---
 drivers/net/virtio/virtio_ethdev.c           | 21 +++++++++-----------
 drivers/net/virtio/virtio_rxtx.c             | 18 ++++++++---------
 drivers/net/virtio/virtio_rxtx_packed.h      |  2 +-
 drivers/net/virtio/virtio_rxtx_packed_avx.h  |  2 +-
 drivers/net/virtio/virtio_rxtx_packed_neon.h |  2 +-
 drivers/net/virtio/virtio_user/vhost.h       |  4 +++-
 drivers/net/virtio/virtqueue.c               |  2 +-
 drivers/net/virtio/virtqueue.h               |  8 ++++----
 8 files changed, 29 insertions(+), 30 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index a2195bdda8..5f7ea390c8 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -9,14 +9,11 @@
 #include <unistd.h>
 
 #include <rte_ethdev_driver.h>
-#include <rte_ethdev_pci.h>
 #include <rte_memcpy.h>
 #include <rte_string_fns.h>
 #include <rte_memzone.h>
 #include <rte_malloc.h>
 #include <rte_branch_prediction.h>
-#include <rte_pci.h>
-#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_ip.h>
 #include <rte_arp.h>
@@ -32,7 +29,7 @@
 #include <rte_kvargs.h>
 
 #include "virtio_ethdev.h"
-#include "virtio_pci.h"
+#include "virtio.h"
 #include "virtio_logs.h"
 #include "virtqueue.h"
 #include "virtio_rxtx.h"
@@ -422,7 +419,7 @@ virtio_init_vring(struct virtqueue *vq)
 }
 
 static int
-virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx)
+virtio_init_queue(struct rte_eth_dev *dev, uint16_t queue_idx)
 {
 	char vq_name[VIRTQUEUE_MAX_NAME_SZ];
 	char vq_hdr_name[VIRTQUEUE_MAX_NAME_SZ];
@@ -435,18 +432,18 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx)
 	struct virtqueue *vq;
 	size_t sz_hdr_mz = 0;
 	void *sw_ring = NULL;
-	int queue_type = virtio_get_queue_type(hw, vtpci_queue_idx);
+	int queue_type = virtio_get_queue_type(hw, queue_idx);
 	int ret;
 	int numa_node = dev->device->numa_node;
 
 	PMD_INIT_LOG(INFO, "setting up queue: %u on NUMA node %d",
-			vtpci_queue_idx, numa_node);
+			queue_idx, numa_node);
 
 	/*
 	 * Read the virtqueue size from the Queue Size field
 	 * Always power of 2 and if 0 virtqueue does not exist
 	 */
-	vq_size = VIRTIO_OPS(hw)->get_queue_num(hw, vtpci_queue_idx);
+	vq_size = VIRTIO_OPS(hw)->get_queue_num(hw, queue_idx);
 	PMD_INIT_LOG(DEBUG, "vq_size: %u", vq_size);
 	if (vq_size == 0) {
 		PMD_INIT_LOG(ERR, "virtqueue does not exist");
@@ -459,7 +456,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx)
 	}
 
 	snprintf(vq_name, sizeof(vq_name), "port%d_vq%d",
-		 dev->data->port_id, vtpci_queue_idx);
+		 dev->data->port_id, queue_idx);
 
 	size = RTE_ALIGN_CEIL(sizeof(*vq) +
 				vq_size * sizeof(struct vq_desc_extra),
@@ -481,10 +478,10 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx)
 		PMD_INIT_LOG(ERR, "can not allocate vq");
 		return -ENOMEM;
 	}
-	hw->vqs[vtpci_queue_idx] = vq;
+	hw->vqs[queue_idx] = vq;
 
 	vq->hw = hw;
-	vq->vq_queue_index = vtpci_queue_idx;
+	vq->vq_queue_index = queue_idx;
 	vq->vq_nentries = vq_size;
 	if (virtio_with_packed_queue(hw)) {
 		vq->vq_packed.used_wrap_counter = 1;
@@ -527,7 +524,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx)
 
 	if (sz_hdr_mz) {
 		snprintf(vq_hdr_name, sizeof(vq_hdr_name), "port%d_vq%d_hdr",
-			 dev->data->port_id, vtpci_queue_idx);
+			 dev->data->port_id, queue_idx);
 		hdr_mz = rte_memzone_reserve_aligned(vq_hdr_name, sz_hdr_mz,
 				numa_node, RTE_MEMZONE_IOVA_CONTIG,
 				RTE_CACHE_LINE_SIZE);
diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 728085e99b..b5657d5c83 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -27,7 +27,7 @@
 
 #include "virtio_logs.h"
 #include "virtio_ethdev.h"
-#include "virtio_pci.h"
+#include "virtio.h"
 #include "virtqueue.h"
 #include "virtio_rxtx.h"
 #include "virtio_rxtx_simple.h"
@@ -628,9 +628,9 @@ virtio_dev_rx_queue_setup(struct rte_eth_dev *dev,
 			const struct rte_eth_rxconf *rx_conf,
 			struct rte_mempool *mp)
 {
-	uint16_t vtpci_queue_idx = 2 * queue_idx + VTNET_SQ_RQ_QUEUE_IDX;
+	uint16_t vq_idx = 2 * queue_idx + VTNET_SQ_RQ_QUEUE_IDX;
 	struct virtio_hw *hw = dev->data->dev_private;
-	struct virtqueue *vq = hw->vqs[vtpci_queue_idx];
+	struct virtqueue *vq = hw->vqs[vq_idx];
 	struct virtnet_rx *rxvq;
 	uint16_t rx_free_thresh;
 
@@ -678,9 +678,9 @@ virtio_dev_rx_queue_setup(struct rte_eth_dev *dev,
 int
 virtio_dev_rx_queue_setup_finish(struct rte_eth_dev *dev, uint16_t queue_idx)
 {
-	uint16_t vtpci_queue_idx = 2 * queue_idx + VTNET_SQ_RQ_QUEUE_IDX;
+	uint16_t vq_idx = 2 * queue_idx + VTNET_SQ_RQ_QUEUE_IDX;
 	struct virtio_hw *hw = dev->data->dev_private;
-	struct virtqueue *vq = hw->vqs[vtpci_queue_idx];
+	struct virtqueue *vq = hw->vqs[vq_idx];
 	struct virtnet_rx *rxvq = &vq->rxq;
 	struct rte_mbuf *m;
 	uint16_t desc_idx;
@@ -779,9 +779,9 @@ virtio_dev_tx_queue_setup(struct rte_eth_dev *dev,
 			unsigned int socket_id __rte_unused,
 			const struct rte_eth_txconf *tx_conf)
 {
-	uint8_t vtpci_queue_idx = 2 * queue_idx + VTNET_SQ_TQ_QUEUE_IDX;
+	uint8_t vq_idx = 2 * queue_idx + VTNET_SQ_TQ_QUEUE_IDX;
 	struct virtio_hw *hw = dev->data->dev_private;
-	struct virtqueue *vq = hw->vqs[vtpci_queue_idx];
+	struct virtqueue *vq = hw->vqs[vq_idx];
 	struct virtnet_tx *txvq;
 	uint16_t tx_free_thresh;
 
@@ -823,9 +823,9 @@ int
 virtio_dev_tx_queue_setup_finish(struct rte_eth_dev *dev,
 				uint16_t queue_idx)
 {
-	uint8_t vtpci_queue_idx = 2 * queue_idx + VTNET_SQ_TQ_QUEUE_IDX;
+	uint8_t vq_idx = 2 * queue_idx + VTNET_SQ_TQ_QUEUE_IDX;
 	struct virtio_hw *hw = dev->data->dev_private;
-	struct virtqueue *vq = hw->vqs[vtpci_queue_idx];
+	struct virtqueue *vq = hw->vqs[vq_idx];
 
 	PMD_INIT_FUNC_TRACE();
 
diff --git a/drivers/net/virtio/virtio_rxtx_packed.h b/drivers/net/virtio/virtio_rxtx_packed.h
index 8d99caeead..3037c8c871 100644
--- a/drivers/net/virtio/virtio_rxtx_packed.h
+++ b/drivers/net/virtio/virtio_rxtx_packed.h
@@ -15,7 +15,7 @@
 
 #include "virtio_logs.h"
 #include "virtio_ethdev.h"
-#include "virtio_pci.h"
+#include "virtio.h"
 #include "virtqueue.h"
 
 #define BYTE_SIZE 8
diff --git a/drivers/net/virtio/virtio_rxtx_packed_avx.h b/drivers/net/virtio/virtio_rxtx_packed_avx.h
index 2c610d57de..49e845d02a 100644
--- a/drivers/net/virtio/virtio_rxtx_packed_avx.h
+++ b/drivers/net/virtio/virtio_rxtx_packed_avx.h
@@ -12,7 +12,7 @@
 
 #include "virtio_logs.h"
 #include "virtio_ethdev.h"
-#include "virtio_pci.h"
+#include "virtio.h"
 #include "virtio_rxtx_packed.h"
 #include "virtqueue.h"
 
diff --git a/drivers/net/virtio/virtio_rxtx_packed_neon.h b/drivers/net/virtio/virtio_rxtx_packed_neon.h
index ae2d099c0b..af9dede41b 100644
--- a/drivers/net/virtio/virtio_rxtx_packed_neon.h
+++ b/drivers/net/virtio/virtio_rxtx_packed_neon.h
@@ -12,7 +12,7 @@
 #include <rte_vect.h>
 
 #include "virtio_ethdev.h"
-#include "virtio_pci.h"
+#include "virtio.h"
 #include "virtio_rxtx_packed.h"
 #include "virtqueue.h"
 
diff --git a/drivers/net/virtio/virtio_user/vhost.h b/drivers/net/virtio/virtio_user/vhost.h
index be286173b0..8ec3a6a62c 100644
--- a/drivers/net/virtio/virtio_user/vhost.h
+++ b/drivers/net/virtio/virtio_user/vhost.h
@@ -9,7 +9,9 @@
 #include <linux/types.h>
 #include <linux/ioctl.h>
 
-#include "../virtio_pci.h"
+#include <rte_errno.h>
+
+#include "../virtio.h"
 #include "../virtio_logs.h"
 #include "../virtqueue.h"
 
diff --git a/drivers/net/virtio/virtqueue.c b/drivers/net/virtio/virtqueue.c
index 59a2cb6599..1f9af3c31b 100644
--- a/drivers/net/virtio/virtqueue.c
+++ b/drivers/net/virtio/virtqueue.c
@@ -7,7 +7,7 @@
 
 #include "virtqueue.h"
 #include "virtio_logs.h"
-#include "virtio_pci.h"
+#include "virtio.h"
 #include "virtio_rxtx_simple.h"
 
 /*
diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h
index f419c0aa99..71b66f3208 100644
--- a/drivers/net/virtio/virtqueue.h
+++ b/drivers/net/virtio/virtqueue.h
@@ -259,7 +259,7 @@ struct virtqueue {
 	 */
 	uint16_t  vq_desc_head_idx;
 	uint16_t  vq_desc_tail_idx;
-	uint16_t  vq_queue_index;   /**< PCI queue index */
+	uint16_t  vq_queue_index;
 	uint16_t offset; /**< relative offset to obtain addr in mbuf */
 	uint16_t  *notify_addr;
 	struct rte_mbuf **sw_ring;  /**< RX software ring. */
@@ -448,11 +448,11 @@ virtqueue_full(const struct virtqueue *vq)
 }
 
 static inline int
-virtio_get_queue_type(struct virtio_hw *hw, uint16_t vtpci_queue_idx)
+virtio_get_queue_type(struct virtio_hw *hw, uint16_t vq_idx)
 {
-	if (vtpci_queue_idx == hw->max_queue_pairs * 2)
+	if (vq_idx == hw->max_queue_pairs * 2)
 		return VTNET_CQ;
-	else if (vtpci_queue_idx % 2 == 0)
+	else if (vq_idx % 2 == 0)
 		return VTNET_RQ;
 	else
 		return VTNET_TQ;
-- 
2.29.2


  parent reply	other threads:[~2021-01-26 10:21 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-26 10:15 [dpdk-dev] [PATCH v4 00/44] net/virtio: Virtio PMD rework Maxime Coquelin
2021-01-26 10:15 ` [dpdk-dev] [PATCH v4 01/44] bus/vdev: add helper to get vdev from ethdev Maxime Coquelin
2021-01-26 10:15 ` [dpdk-dev] [PATCH v4 02/44] bus/vdev: add driver IOVA VA mode requirement Maxime Coquelin
2021-01-26 11:50   ` Xia, Chenbo
2021-01-26 12:50   ` David Marchand
2021-01-26 13:23     ` Kinsella, Ray
2021-01-26 14:40       ` David Marchand
2021-01-26 15:28         ` Kinsella, Ray
2021-01-27  8:23   ` David Marchand
2021-01-27  8:25     ` Maxime Coquelin
2021-01-26 10:15 ` [dpdk-dev] [PATCH v4 03/44] net/virtio: fix getting old status on reconnect Maxime Coquelin
2021-01-26 10:15 ` [dpdk-dev] [PATCH v4 04/44] net/virtio: introduce Virtio bus type Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 05/44] net/virtio: refactor virtio-user device Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 06/44] net/virtio: introduce PCI device metadata Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 07/44] net/virtio: move PCI device init in dedicated file Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 08/44] net/virtio: move PCI specific dev init to PCI ethdev init Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 09/44] net/virtio: move MSIX detection to PCI ethdev Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 10/44] net/virtio: force IOVA as VA mode for Virtio-user Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 11/44] net/virtio: store PCI type in Virtio device metadata Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 12/44] net/virtio: add callback for device closing Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 13/44] net/virtio: validate features at bus level Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 14/44] net/virtio: remove bus type enum Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 15/44] net/virtio: move PCI-specific fields to PCI device Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 16/44] net/virtio: pack virtio HW struct Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 17/44] net/virtio: move legacy IO to Virtio PCI Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 18/44] net/virtio: introduce generic virtio header Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 19/44] net/virtio: move features definition to generic header Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 20/44] net/virtio: move virtqueue defines in " Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 21/44] net/virtio: move config definitions to " Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 22/44] net/virtio: make interrupt handling more generic Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 23/44] net/virtio: move vring alignment to generic header Maxime Coquelin
2021-01-26 10:16 ` Maxime Coquelin [this message]
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 25/44] net/virtio: make Vhost-user request sender consistent Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 26/44] net/virtio: add Virtio-user ops to set owner Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 27/44] net/virtio: add Virtio-user features ops Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 28/44] net/virtio: add Virtio-user protocol " Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 29/44] net/virtio: add Virtio-user memory tables ops Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 30/44] net/virtio: add Virtio-user vring setting ops Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 31/44] net/virtio: add Virtio-user vring file ops Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 32/44] net/virtio: add Virtio-user vring address ops Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 33/44] net/virtio: add Virtio-user status ops Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 34/44] net/virtio: remove useless request ops Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 35/44] net/virtio: improve Virtio-user errors handling Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 36/44] net/virtio: move Vhost-user requests to Vhost-user backend Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 37/44] net/virtio: make server mode blocking Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 38/44] net/virtio: move protocol features to Vhost-user Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 39/44] net/virtio: introduce backend data Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 40/44] net/virtio: move Vhost-user specifics to its backend Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 41/44] net/virtio: move Vhost-kernel data " Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 42/44] net/virtio: move Vhost-vDPA " Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 43/44] net/virtio: improve Vhost-user error logging Maxime Coquelin
2021-01-26 10:16 ` [dpdk-dev] [PATCH v4 44/44] net/virtio: handle Virtio-user setup failure properly Maxime Coquelin
2021-01-26 12:02   ` Xia, Chenbo
2021-01-26 12:59     ` Maxime Coquelin
2021-01-27 11:59 ` [dpdk-dev] [PATCH v4 00/44] net/virtio: Virtio PMD rework Maxime Coquelin
2021-02-01  8:44 ` Wang, Yinan
2021-02-01  8:49   ` Maxime Coquelin
2021-02-01 13:00 ` Ilya Maximets
2021-02-01 13:03   ` Ilya Maximets
2021-02-01 13:16     ` Maxime Coquelin
2021-02-01 13:42       ` Ilya Maximets
2021-02-01 13:51         ` Maxime Coquelin

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=20210126101639.250481-25-maxime.coquelin@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=amorenoz@redhat.com \
    --cc=chenbo.xia@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git