From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 0D8F7568A for ; Thu, 3 Dec 2015 03:23:32 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 02 Dec 2015 18:23:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,375,1444719600"; d="scan'208";a="863515277" Received: from yliu-dev.sh.intel.com ([10.239.66.49]) by orsmga002.jf.intel.com with ESMTP; 02 Dec 2015 18:23:30 -0800 From: Yuanhan Liu To: dev@dpdk.org Date: Thu, 3 Dec 2015 10:27:02 +0800 Message-Id: <1449109622-11675-1-git-send-email-yuanhan.liu@linux.intel.com> X-Mailer: git-send-email 1.9.0 Cc: "Michael S. Tsirkin" , Victor Kaplansky Subject: [dpdk-dev] [PATCH] vhost: reserve some spaces for virtio_net and vhost_virtqueue struct X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2015 02:23:33 -0000 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 CC: Thomas Monjalon CC: Michael S. Tsirkin CC: Victor Kaplansky Suggested-by: Panu Matilainen Signed-off-by: Yuanhan Liu --- 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