DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tiwei Bie <tiwei.bie@intel.com>
To: maxime.coquelin@redhat.com, zhihong.wang@intel.com, dev@dpdk.org
Subject: [dpdk-dev] [PATCH 06/10] net/virtio: drop redundant suffix in packed ring structure
Date: Tue, 19 Mar 2019 14:43:08 +0800	[thread overview]
Message-ID: <20190319064312.13743-7-tiwei.bie@intel.com> (raw)
Message-ID: <20190319064308.uqH3OBXuGjLvzFSgF-8n6qE-cdAaK2qIOapn3CMZGeg@z> (raw)
In-Reply-To: <20190319064312.13743-1-tiwei.bie@intel.com>

Drop redundant suffix (_packed and _event) from the fields in
packed ring structure.

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
---
 drivers/net/virtio/virtio_ethdev.c            |  2 +-
 drivers/net/virtio/virtio_ring.h              | 15 ++++++-------
 drivers/net/virtio/virtio_rxtx.c              | 14 ++++++------
 .../net/virtio/virtio_user/virtio_user_dev.c  | 22 +++++++++----------
 drivers/net/virtio/virtio_user_ethdev.c       | 11 ++++------
 drivers/net/virtio/virtqueue.c                |  2 +-
 drivers/net/virtio/virtqueue.h                | 10 ++++-----
 7 files changed, 36 insertions(+), 40 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index bc91ad493..f452a9a79 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -147,7 +147,7 @@ virtio_send_command_packed(struct virtnet_ctl *cvq,
 {
 	struct virtqueue *vq = cvq->vq;
 	int head;
-	struct vring_packed_desc *desc = vq->vq_packed.ring.desc_packed;
+	struct vring_packed_desc *desc = vq->vq_packed.ring.desc;
 	struct virtio_pmd_ctrl *result;
 	uint16_t flags;
 	int sum = 0;
diff --git a/drivers/net/virtio/virtio_ring.h b/drivers/net/virtio/virtio_ring.h
index 5a37629fe..6abec4d87 100644
--- a/drivers/net/virtio/virtio_ring.h
+++ b/drivers/net/virtio/virtio_ring.h
@@ -78,10 +78,9 @@ struct vring_packed_desc_event {
 
 struct vring_packed {
 	unsigned int num;
-	struct vring_packed_desc *desc_packed;
-	struct vring_packed_desc_event *driver_event;
-	struct vring_packed_desc_event *device_event;
-
+	struct vring_packed_desc *desc;
+	struct vring_packed_desc_event *driver;
+	struct vring_packed_desc_event *device;
 };
 
 struct vring {
@@ -161,11 +160,11 @@ vring_init_packed(struct vring_packed *vr, uint8_t *p, unsigned long align,
 		 unsigned int num)
 {
 	vr->num = num;
-	vr->desc_packed = (struct vring_packed_desc *)p;
-	vr->driver_event = (struct vring_packed_desc_event *)(p +
+	vr->desc = (struct vring_packed_desc *)p;
+	vr->driver = (struct vring_packed_desc_event *)(p +
 			vr->num * sizeof(struct vring_packed_desc));
-	vr->device_event = (struct vring_packed_desc_event *)
-		RTE_ALIGN_CEIL(((uintptr_t)vr->driver_event +
+	vr->device = (struct vring_packed_desc_event *)
+		RTE_ALIGN_CEIL(((uintptr_t)vr->driver +
 				sizeof(struct vring_packed_desc_event)), align);
 }
 
diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 02f8d9451..42d0f533c 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -118,7 +118,7 @@ virtqueue_dequeue_burst_rx_packed(struct virtqueue *vq,
 	struct vring_packed_desc *desc;
 	uint16_t i;
 
-	desc = vq->vq_packed.ring.desc_packed;
+	desc = vq->vq_packed.ring.desc;
 
 	for (i = 0; i < num; i++) {
 		used_idx = vq->vq_used_cons_idx;
@@ -229,7 +229,7 @@ virtio_xmit_cleanup_inorder_packed(struct virtqueue *vq, int num)
 {
 	uint16_t used_idx, id, curr_id, free_cnt = 0;
 	uint16_t size = vq->vq_nentries;
-	struct vring_packed_desc *desc = vq->vq_packed.ring.desc_packed;
+	struct vring_packed_desc *desc = vq->vq_packed.ring.desc;
 	struct vq_desc_extra *dxp;
 
 	used_idx = vq->vq_used_cons_idx;
@@ -261,7 +261,7 @@ virtio_xmit_cleanup_normal_packed(struct virtqueue *vq, int num)
 {
 	uint16_t used_idx, id;
 	uint16_t size = vq->vq_nentries;
-	struct vring_packed_desc *desc = vq->vq_packed.ring.desc_packed;
+	struct vring_packed_desc *desc = vq->vq_packed.ring.desc;
 	struct vq_desc_extra *dxp;
 
 	used_idx = vq->vq_used_cons_idx;
@@ -430,7 +430,7 @@ static inline int
 virtqueue_enqueue_recv_refill_packed(struct virtqueue *vq,
 				     struct rte_mbuf **cookie, uint16_t num)
 {
-	struct vring_packed_desc *start_dp = vq->vq_packed.ring.desc_packed;
+	struct vring_packed_desc *start_dp = vq->vq_packed.ring.desc;
 	uint16_t flags = vq->vq_packed.cached_flags;
 	struct virtio_hw *hw = vq->hw;
 	struct vq_desc_extra *dxp;
@@ -635,7 +635,7 @@ virtqueue_enqueue_xmit_packed_fast(struct virtnet_tx *txvq,
 
 	id = in_order ? vq->vq_avail_idx : vq->vq_desc_head_idx;
 	idx = vq->vq_avail_idx;
-	dp = &vq->vq_packed.ring.desc_packed[idx];
+	dp = &vq->vq_packed.ring.desc[idx];
 
 	dxp = &vq->vq_descx[id];
 	dxp->ndescs = 1;
@@ -698,9 +698,9 @@ virtqueue_enqueue_xmit_packed(struct virtnet_tx *txvq, struct rte_mbuf *cookie,
 	head_idx = vq->vq_avail_idx;
 	idx = head_idx;
 	prev = head_idx;
-	start_dp = vq->vq_packed.ring.desc_packed;
+	start_dp = vq->vq_packed.ring.desc;
 
-	head_dp = &vq->vq_packed.ring.desc_packed[idx];
+	head_dp = &vq->vq_packed.ring.desc[idx];
 	head_flags = cookie->next ? VRING_DESC_F_NEXT : 0;
 	head_flags |= vq->vq_packed.cached_flags;
 
diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index d1157378d..2dc8f2051 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -52,11 +52,11 @@ virtio_user_kick_queue(struct virtio_user_dev *dev, uint32_t queue_sel)
 
 	if (dev->features & (1ULL << VIRTIO_F_RING_PACKED)) {
 		addr.desc_user_addr =
-			(uint64_t)(uintptr_t)pq_vring->desc_packed;
+			(uint64_t)(uintptr_t)pq_vring->desc;
 		addr.avail_user_addr =
-			(uint64_t)(uintptr_t)pq_vring->driver_event;
+			(uint64_t)(uintptr_t)pq_vring->driver;
 		addr.used_user_addr =
-			(uint64_t)(uintptr_t)pq_vring->device_event;
+			(uint64_t)(uintptr_t)pq_vring->device;
 	} else {
 		addr.desc_user_addr = (uint64_t)(uintptr_t)vring->desc;
 		addr.avail_user_addr = (uint64_t)(uintptr_t)vring->avail;
@@ -650,30 +650,30 @@ virtio_user_handle_ctrl_msg_packed(struct virtio_user_dev *dev,
 	n_descs++;
 
 	idx_status = idx_data;
-	while (vring->desc_packed[idx_status].flags & VRING_DESC_F_NEXT) {
+	while (vring->desc[idx_status].flags & VRING_DESC_F_NEXT) {
 		idx_status++;
 		if (idx_status >= dev->queue_size)
 			idx_status -= dev->queue_size;
 		n_descs++;
 	}
 
-	hdr = (void *)(uintptr_t)vring->desc_packed[idx_hdr].addr;
+	hdr = (void *)(uintptr_t)vring->desc[idx_hdr].addr;
 	if (hdr->class == VIRTIO_NET_CTRL_MQ &&
 	    hdr->cmd == VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET) {
 		uint16_t queues;
 
 		queues = *(uint16_t *)(uintptr_t)
-				vring->desc_packed[idx_data].addr;
+				vring->desc[idx_data].addr;
 		status = virtio_user_handle_mq(dev, queues);
 	}
 
 	/* Update status */
 	*(virtio_net_ctrl_ack *)(uintptr_t)
-		vring->desc_packed[idx_status].addr = status;
+		vring->desc[idx_status].addr = status;
 
 	/* Update used descriptor */
-	vring->desc_packed[idx_hdr].id = vring->desc_packed[idx_status].id;
-	vring->desc_packed[idx_hdr].len = sizeof(status);
+	vring->desc[idx_hdr].id = vring->desc[idx_status].id;
+	vring->desc[idx_hdr].len = sizeof(status);
 
 	return n_descs;
 }
@@ -685,14 +685,14 @@ virtio_user_handle_cq_packed(struct virtio_user_dev *dev, uint16_t queue_idx)
 	struct vring_packed *vring = &dev->packed_vrings[queue_idx];
 	uint16_t n_descs;
 
-	while (desc_is_avail(&vring->desc_packed[vq->used_idx],
+	while (desc_is_avail(&vring->desc[vq->used_idx],
 			     vq->used_wrap_counter)) {
 
 		n_descs = virtio_user_handle_ctrl_msg_packed(dev, vring,
 				vq->used_idx);
 
 		rte_smp_wmb();
-		vring->desc_packed[vq->used_idx].flags =
+		vring->desc[vq->used_idx].flags =
 			VRING_DESC_F_WRITE |
 			VRING_DESC_F_AVAIL(vq->used_wrap_counter) |
 			VRING_DESC_F_USED(vq->used_wrap_counter);
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 6423e1f61..c5a76bd91 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -290,17 +290,14 @@ virtio_user_setup_queue_packed(struct virtqueue *vq,
 			   sizeof(struct vring_packed_desc_event),
 			   VIRTIO_PCI_VRING_ALIGN);
 	vring->num = vq->vq_nentries;
-	vring->desc_packed =
-		(void *)(uintptr_t)desc_addr;
-	vring->driver_event =
-		(void *)(uintptr_t)avail_addr;
-	vring->device_event =
-		(void *)(uintptr_t)used_addr;
+	vring->desc = (void *)(uintptr_t)desc_addr;
+	vring->driver = (void *)(uintptr_t)avail_addr;
+	vring->device = (void *)(uintptr_t)used_addr;
 	dev->packed_queues[queue_idx].avail_wrap_counter = true;
 	dev->packed_queues[queue_idx].used_wrap_counter = true;
 
 	for (i = 0; i < vring->num; i++)
-		vring->desc_packed[i].flags = 0;
+		vring->desc[i].flags = 0;
 }
 
 static void
diff --git a/drivers/net/virtio/virtqueue.c b/drivers/net/virtio/virtqueue.c
index 79491db32..5ff1e3587 100644
--- a/drivers/net/virtio/virtqueue.c
+++ b/drivers/net/virtio/virtqueue.c
@@ -61,7 +61,7 @@ virtqueue_rxvq_flush_packed(struct virtqueue *vq)
 	struct vq_desc_extra *dxp;
 	uint16_t i;
 
-	struct vring_packed_desc *descs = vq->vq_packed.ring.desc_packed;
+	struct vring_packed_desc *descs = vq->vq_packed.ring.desc;
 	int cnt = 0;
 
 	i = vq->vq_used_cons_idx;
diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h
index 48b3912e6..78df6d390 100644
--- a/drivers/net/virtio/virtqueue.h
+++ b/drivers/net/virtio/virtqueue.h
@@ -302,10 +302,10 @@ vring_desc_init_packed(struct virtqueue *vq, int n)
 {
 	int i;
 	for (i = 0; i < n - 1; i++) {
-		vq->vq_packed.ring.desc_packed[i].id = i;
+		vq->vq_packed.ring.desc[i].id = i;
 		vq->vq_descx[i].next = i + 1;
 	}
-	vq->vq_packed.ring.desc_packed[i].id = i;
+	vq->vq_packed.ring.desc[i].id = i;
 	vq->vq_descx[i].next = VQ_RING_DESC_CHAIN_END;
 }
 
@@ -328,7 +328,7 @@ virtqueue_disable_intr_packed(struct virtqueue *vq)
 {
 	if (vq->vq_packed.event_flags_shadow != RING_EVENT_FLAGS_DISABLE) {
 		vq->vq_packed.event_flags_shadow = RING_EVENT_FLAGS_DISABLE;
-		vq->vq_packed.ring.driver_event->desc_event_flags =
+		vq->vq_packed.ring.driver->desc_event_flags =
 			vq->vq_packed.event_flags_shadow;
 	}
 }
@@ -353,7 +353,7 @@ virtqueue_enable_intr_packed(struct virtqueue *vq)
 {
 	if (vq->vq_packed.event_flags_shadow == RING_EVENT_FLAGS_DISABLE) {
 		vq->vq_packed.event_flags_shadow = RING_EVENT_FLAGS_ENABLE;
-		vq->vq_packed.ring.driver_event->desc_event_flags =
+		vq->vq_packed.ring.driver->desc_event_flags =
 			vq->vq_packed.event_flags_shadow;
 	}
 }
@@ -460,7 +460,7 @@ virtqueue_kick_prepare_packed(struct virtqueue *vq)
 	 * Ensure updated data is visible to vhost before reading the flags.
 	 */
 	virtio_mb(vq->hw->weak_barriers);
-	flags = vq->vq_packed.ring.device_event->desc_event_flags;
+	flags = vq->vq_packed.ring.device->desc_event_flags;
 
 	return flags != RING_EVENT_FLAGS_DISABLE;
 }
-- 
2.17.1


  parent reply	other threads:[~2019-03-19  6:44 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-19  6:43 [dpdk-dev] [PATCH 00/10] net/virtio: cleanups and fixes for packed/split ring Tiwei Bie
2019-03-19  6:43 ` Tiwei Bie
2019-03-19  6:43 ` [dpdk-dev] [PATCH 01/10] net/virtio: fix typo in packed ring init Tiwei Bie
2019-03-19  6:43   ` Tiwei Bie
2019-03-19  8:39   ` Jens Freimann
2019-03-19  8:39     ` Jens Freimann
2019-03-19 12:46   ` Maxime Coquelin
2019-03-19 12:46     ` Maxime Coquelin
2019-03-19  6:43 ` [dpdk-dev] [PATCH 02/10] net/virtio: fix interrupt helper for packed ring Tiwei Bie
2019-03-19  6:43   ` Tiwei Bie
2019-03-19 12:48   ` Maxime Coquelin
2019-03-19 12:48     ` Maxime Coquelin
2019-03-19  6:43 ` [dpdk-dev] [PATCH 03/10] net/virtio: add missing barrier in interrupt enable Tiwei Bie
2019-03-19  6:43   ` Tiwei Bie
2019-03-19 12:49   ` Maxime Coquelin
2019-03-19 12:49     ` Maxime Coquelin
2019-03-19  6:43 ` [dpdk-dev] [PATCH 04/10] net/virtio: optimize flags update for packed ring Tiwei Bie
2019-03-19  6:43   ` Tiwei Bie
2019-03-19  8:54   ` Jens Freimann
2019-03-19  8:54     ` Jens Freimann
2019-03-19  9:37     ` Tiwei Bie
2019-03-19  9:37       ` Tiwei Bie
2019-03-19 10:11       ` Jens Freimann
2019-03-19 10:11         ` Jens Freimann
2019-03-19 12:50         ` Maxime Coquelin
2019-03-19 12:50           ` Maxime Coquelin
2019-03-19 12:58   ` Maxime Coquelin
2019-03-19 12:58     ` Maxime Coquelin
2019-03-19  6:43 ` [dpdk-dev] [PATCH 05/10] net/virtio: refactor virtqueue structure Tiwei Bie
2019-03-19  6:43   ` Tiwei Bie
2019-03-19  9:44   ` Jens Freimann
2019-03-19  9:44     ` Jens Freimann
2019-03-19 10:09     ` Tiwei Bie
2019-03-19 10:09       ` Tiwei Bie
2019-03-19 13:28       ` Maxime Coquelin
2019-03-19 13:28         ` Maxime Coquelin
2019-03-19 13:47         ` Jens Freimann
2019-03-19 13:47           ` Jens Freimann
2019-03-19 13:50           ` Maxime Coquelin
2019-03-19 13:50             ` Maxime Coquelin
2019-03-19 14:59             ` Kevin Traynor
2019-03-19 14:59               ` Kevin Traynor
2019-03-20  4:40               ` Tiwei Bie
2019-03-20  4:40                 ` Tiwei Bie
2019-03-20 17:50                 ` Stephen Hemminger
2019-03-20 17:50                   ` Stephen Hemminger
2019-03-21 14:18                   ` Maxime Coquelin
2019-03-21 14:18                     ` Maxime Coquelin
2019-03-20  4:35         ` Tiwei Bie
2019-03-20  4:35           ` Tiwei Bie
2019-03-19 13:28   ` Maxime Coquelin
2019-03-19 13:28     ` Maxime Coquelin
2019-03-19  6:43 ` Tiwei Bie [this message]
2019-03-19  6:43   ` [dpdk-dev] [PATCH 06/10] net/virtio: drop redundant suffix in packed ring structure Tiwei Bie
2019-03-19  9:47   ` Jens Freimann
2019-03-19  9:47     ` Jens Freimann
2019-03-19 13:29   ` Maxime Coquelin
2019-03-19 13:29     ` Maxime Coquelin
2019-03-19  6:43 ` [dpdk-dev] [PATCH 07/10] net/virtio: drop unused field in Tx region structure Tiwei Bie
2019-03-19  6:43   ` Tiwei Bie
2019-03-19  9:51   ` Jens Freimann
2019-03-19  9:51     ` Jens Freimann
2019-03-19 13:33   ` Maxime Coquelin
2019-03-19 13:33     ` Maxime Coquelin
2019-03-19  6:43 ` [dpdk-dev] [PATCH 08/10] net/virtio: add interrupt helper for split ring Tiwei Bie
2019-03-19  6:43   ` Tiwei Bie
2019-03-19  9:53   ` Jens Freimann
2019-03-19  9:53     ` Jens Freimann
2019-03-19 13:34   ` Maxime Coquelin
2019-03-19 13:34     ` Maxime Coquelin
2019-03-19  6:43 ` [dpdk-dev] [PATCH 09/10] net/virtio: add ctrl vq " Tiwei Bie
2019-03-19  6:43   ` Tiwei Bie
2019-03-19  9:54   ` Jens Freimann
2019-03-19  9:54     ` Jens Freimann
2019-03-19 13:54   ` Maxime Coquelin
2019-03-19 13:54     ` Maxime Coquelin
2019-03-19  6:43 ` [dpdk-dev] [PATCH 10/10] net/virtio: improve batching in standard Rx path Tiwei Bie
2019-03-19  6:43   ` Tiwei Bie
2019-03-19 10:04   ` Jens Freimann
2019-03-19 10:04     ` Jens Freimann
2019-03-19 10:28     ` Tiwei Bie
2019-03-19 10:28       ` Tiwei Bie
2019-03-19 11:08       ` Maxime Coquelin
2019-03-19 11:08         ` Maxime Coquelin
2019-03-19 14:15   ` Maxime Coquelin
2019-03-19 14:15     ` Maxime Coquelin
2019-03-20  7:35 ` [dpdk-dev] [PATCH 00/10] net/virtio: cleanups and fixes for packed/split ring Maxime Coquelin
2019-03-20  7:35   ` 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=20190319064312.13743-7-tiwei.bie@intel.com \
    --to=tiwei.bie@intel.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=zhihong.wang@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).