From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 71DFBA05FE for ; Tue, 19 Mar 2019 07:44:36 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6D7E34F94; Tue, 19 Mar 2019 07:43:55 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 60D1A4C91 for ; Tue, 19 Mar 2019 07:43:42 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Mar 2019 23:43:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,496,1544515200"; d="scan'208";a="123847060" Received: from dpdk-tbie.sh.intel.com ([10.67.104.173]) by orsmga007.jf.intel.com with ESMTP; 18 Mar 2019 23:43:40 -0700 From: Tiwei Bie To: maxime.coquelin@redhat.com, zhihong.wang@intel.com, dev@dpdk.org Date: Tue, 19 Mar 2019 14:43:08 +0800 Message-Id: <20190319064312.13743-7-tiwei.bie@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190319064312.13743-1-tiwei.bie@intel.com> References: <20190319064312.13743-1-tiwei.bie@intel.com> Subject: [dpdk-dev] [PATCH 06/10] net/virtio: drop redundant suffix in packed ring structure 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190319064308.uqH3OBXuGjLvzFSgF-8n6qE-cdAaK2qIOapn3CMZGeg@z> Drop redundant suffix (_packed and _event) from the fields in packed ring structure. Signed-off-by: Tiwei Bie --- 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