net/virtio: drop redundant suffix in packed ring structure
authorTiwei Bie <tiwei.bie@intel.com>
Tue, 19 Mar 2019 06:43:08 +0000 (14:43 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 20 Mar 2019 17:15:42 +0000 (18:15 +0100)
Drop redundant suffix (_packed and _event) from the fields in
packed ring structure.

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Jens Freimann <jfreimann@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
drivers/net/virtio/virtio_ethdev.c
drivers/net/virtio/virtio_ring.h
drivers/net/virtio/virtio_rxtx.c
drivers/net/virtio/virtio_user/virtio_user_dev.c
drivers/net/virtio/virtio_user_ethdev.c
drivers/net/virtio/virtqueue.c
drivers/net/virtio/virtqueue.h

index bc91ad4..f452a9a 100644 (file)
@@ -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;
index 5a37629..6abec4d 100644 (file)
@@ -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);
 }
 
index 02f8d94..42d0f53 100644 (file)
@@ -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;
 
index d115737..2dc8f20 100644 (file)
@@ -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);
index 6423e1f..c5a76bd 100644 (file)
@@ -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
index 79491db..5ff1e35 100644 (file)
@@ -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;
index 48b3912..78df6d3 100644 (file)
@@ -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;
 }