diff mbox series

[3/3] net/virtio: pack virtuqueue struct

Message ID 20201221161456.31696-4-maxime.coquelin@redhat.com (mailing list archive)
State New
Delegated to: Maxime Coquelin
Headers show
Series net/virtio: make virtqueue struct cache-friendly | expand

Checks

Context Check Description
ci/Intel-compilation fail apply issues
ci/checkpatch success coding style OK

Commit Message

Maxime Coquelin Dec. 21, 2020, 4:14 p.m. UTC
This patch optimizes packing of the virtuqueue
struct by moving fields around to fill holes.

Offset field is not used and so can be removed.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 drivers/net/virtio/virtqueue.h | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

Chenbo Xia Jan. 11, 2021, 2:56 a.m. UTC | #1
Hi Maxime,

> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Tuesday, December 22, 2020 12:15 AM
> To: dev@dpdk.org; Xia, Chenbo <chenbo.xia@intel.com>; amorenoz@redhat.com;
> david.marchand@redhat.com; olivier.matz@6wind.com
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
> Subject: [PATCH 3/3] net/virtio: pack virtuqueue struct

s/virtuqueue/virtqueue

> 
> This patch optimizes packing of the virtuqueue

Ditto

With above fixed:

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>

> struct by moving fields around to fill holes.
> 
> Offset field is not used and so can be removed.
> 
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  drivers/net/virtio/virtqueue.h | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h
> index c64e7dcbdf..3b08aac931 100644
> --- a/drivers/net/virtio/virtqueue.h
> +++ b/drivers/net/virtio/virtqueue.h
> @@ -245,6 +245,15 @@ struct virtqueue {
>  	uint16_t vq_avail_idx; /**< sync until needed */
>  	uint16_t vq_free_thresh; /**< free threshold */
> 
> +	/**
> +	 * Head of the free chain in the descriptor table. If
> +	 * there are no free descriptors, this will be set to
> +	 * VQ_RING_DESC_CHAIN_END.
> +	 */
> +	uint16_t  vq_desc_head_idx;
> +	uint16_t  vq_desc_tail_idx;
> +	uint16_t  vq_queue_index;   /**< PCI queue index */
> +
>  	void *vq_ring_virt_mem;  /**< linear address of vring*/
>  	unsigned int vq_ring_size;
> 
> @@ -257,15 +266,6 @@ struct virtqueue {
>  	rte_iova_t vq_ring_mem; /**< physical address of vring,
>  	                         * or virtual address for virtio_user. */
> 
> -	/**
> -	 * Head of the free chain in the descriptor table. If
> -	 * there are no free descriptors, this will be set to
> -	 * VQ_RING_DESC_CHAIN_END.
> -	 */
> -	uint16_t  vq_desc_head_idx;
> -	uint16_t  vq_desc_tail_idx;
> -	uint16_t  vq_queue_index;   /**< PCI queue index */
> -	uint16_t offset; /**< relative offset to obtain addr in mbuf */
>  	uint16_t  *notify_addr;
>  	struct rte_mbuf **sw_ring;  /**< RX software ring. */
>  	struct vq_desc_extra vq_descx[0];
> --
> 2.29.2
diff mbox series

Patch

diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h
index c64e7dcbdf..3b08aac931 100644
--- a/drivers/net/virtio/virtqueue.h
+++ b/drivers/net/virtio/virtqueue.h
@@ -245,6 +245,15 @@  struct virtqueue {
 	uint16_t vq_avail_idx; /**< sync until needed */
 	uint16_t vq_free_thresh; /**< free threshold */
 
+	/**
+	 * Head of the free chain in the descriptor table. If
+	 * there are no free descriptors, this will be set to
+	 * VQ_RING_DESC_CHAIN_END.
+	 */
+	uint16_t  vq_desc_head_idx;
+	uint16_t  vq_desc_tail_idx;
+	uint16_t  vq_queue_index;   /**< PCI queue index */
+
 	void *vq_ring_virt_mem;  /**< linear address of vring*/
 	unsigned int vq_ring_size;
 
@@ -257,15 +266,6 @@  struct virtqueue {
 	rte_iova_t vq_ring_mem; /**< physical address of vring,
 	                         * or virtual address for virtio_user. */
 
-	/**
-	 * Head of the free chain in the descriptor table. If
-	 * there are no free descriptors, this will be set to
-	 * VQ_RING_DESC_CHAIN_END.
-	 */
-	uint16_t  vq_desc_head_idx;
-	uint16_t  vq_desc_tail_idx;
-	uint16_t  vq_queue_index;   /**< PCI queue index */
-	uint16_t offset; /**< relative offset to obtain addr in mbuf */
 	uint16_t  *notify_addr;
 	struct rte_mbuf **sw_ring;  /**< RX software ring. */
 	struct vq_desc_extra vq_descx[0];