DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] vhost: reserve some spaces for virtio_net and vhost_virtqueue struct
@ 2015-12-03  2:27 Yuanhan Liu
  2015-12-07 23:54 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Yuanhan Liu @ 2015-12-03  2:27 UTC (permalink / raw)
  To: dev; +Cc: Michael S. Tsirkin, Victor Kaplansky

So that we will not break ABI in future extension by adding few more
fields.

Struct vhost_virtqueue is reserved with 16 qwords (the later vhost-live
migration support would at least consume 3 of them), and struct virtio_net
is reserved with a bit more, 64 qwords, as there is only one instance for
a virtio nic instance.

Note that both reservation are not placed at the end of the struct, but
instead before the last field, since both the last field at the two struct
take a lot spaces. Putting the reservation after it would divide those
reserved fields to another cacheline. (we might need fix them in future, btw)

CC: Panu Matilainen <pmatilai@redhat.com>
CC: Thomas Monjalon <thomas.monjalon@6wind.com>
CC: Michael S. Tsirkin <mst@redhat.com>
CC: Victor Kaplansky <vkaplans@redhat.com>
Suggested-by: Panu Matilainen <pmatilai@redhat.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---

Is the reservation a bit too large? :)
---
 lib/librte_vhost/rte_virtio_net.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/librte_vhost/rte_virtio_net.h b/lib/librte_vhost/rte_virtio_net.h
index 5687452..10dcb90 100644
--- a/lib/librte_vhost/rte_virtio_net.h
+++ b/lib/librte_vhost/rte_virtio_net.h
@@ -90,6 +90,7 @@ struct vhost_virtqueue {
 	int			callfd;			/**< Used to notify the guest (trigger interrupt). */
 	int			kickfd;			/**< Currently unused as polling mode is enabled. */
 	int			enabled;
+	uint64_t		reserved[16];		/**< Reserve some spaces for future extension. */
 	struct buf_vector	buf_vec[BUF_VECTOR_MAX];	/**< for scatter RX. */
 } __rte_cache_aligned;
 
@@ -128,6 +129,7 @@ struct virtio_net {
 	char			ifname[IF_NAME_SZ];	/**< Name of the tap device or socket path. */
 	uint32_t		virt_qp_nb;	/**< number of queue pair we have allocated */
 	void			*priv;		/**< private context */
+	uint64_t		reserved[64];	/**< Reserve some spaces for future extension. */
 	struct vhost_virtqueue	*virtqueue[VHOST_MAX_QUEUE_PAIRS * 2];	/**< Contains all virtqueue information. */
 } __rte_cache_aligned;
 
-- 
1.9.0

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: reserve some spaces for virtio_net and vhost_virtqueue struct
  2015-12-03  2:27 [dpdk-dev] [PATCH] vhost: reserve some spaces for virtio_net and vhost_virtqueue struct Yuanhan Liu
@ 2015-12-07 23:54 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2015-12-07 23:54 UTC (permalink / raw)
  To: Yuanhan Liu; +Cc: dev, Victor Kaplansky, Michael S. Tsirkin

2015-12-03 10:27, Yuanhan Liu:
> So that we will not break ABI in future extension by adding few more
> fields.
> 
> Struct vhost_virtqueue is reserved with 16 qwords (the later vhost-live
> migration support would at least consume 3 of them), and struct virtio_net
> is reserved with a bit more, 64 qwords, as there is only one instance for
> a virtio nic instance.
> 
> Note that both reservation are not placed at the end of the struct, but
> instead before the last field, since both the last field at the two struct
> take a lot spaces. Putting the reservation after it would divide those
> reserved fields to another cacheline. (we might need fix them in future, btw)
> 
> CC: Panu Matilainen <pmatilai@redhat.com>
> CC: Thomas Monjalon <thomas.monjalon@6wind.com>
> CC: Michael S. Tsirkin <mst@redhat.com>
> CC: Victor Kaplansky <vkaplans@redhat.com>
> Suggested-by: Panu Matilainen <pmatilai@redhat.com>
> Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> ---
> 
> Is the reservation a bit too large? :)

You are maintainer in this area.

Applied, thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-07 23:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-03  2:27 [dpdk-dev] [PATCH] vhost: reserve some spaces for virtio_net and vhost_virtqueue struct Yuanhan Liu
2015-12-07 23:54 ` Thomas Monjalon

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).