[v4,15/39] vhost: use C11 alignas
Checks
Commit Message
* Move __rte_aligned from the end of {struct,union} definitions to
be between {struct,union} and tag.
The placement between {struct,union} and the tag allows the desired
alignment to be imparted on the type regardless of the toolchain being
used for all of GCC, LLVM, MSVC compilers building both C and C++.
* Replace use of __rte_aligned(a) on variables/fields with alignas(a).
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
lib/vhost/vhost.h | 8 ++++----
lib/vhost/vhost_crypto.c | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
@@ -271,7 +271,7 @@ struct vhost_async {
/**
* Structure contains variables relevant to RX/TX virtqueues.
*/
-struct vhost_virtqueue {
+struct __rte_cache_aligned vhost_virtqueue {
union {
struct vring_desc *desc;
struct vring_packed_desc *desc_packed;
@@ -349,7 +349,7 @@ struct vhost_virtqueue {
struct virtqueue_stats stats;
RTE_ATOMIC(bool) irq_pending;
-} __rte_cache_aligned;
+};
/* Virtio device status as per Virtio specification */
#define VIRTIO_DEVICE_STATUS_RESET 0x00
@@ -477,7 +477,7 @@ struct inflight_mem_info {
* Device structure contains all configuration information relating
* to the device.
*/
-struct virtio_net {
+struct __rte_cache_aligned virtio_net {
/* Frontend (QEMU) memory and memory region information */
struct rte_vhost_memory *mem;
uint64_t features;
@@ -536,7 +536,7 @@ struct virtio_net {
struct rte_vhost_user_extern_ops extern_ops;
struct vhost_backend_ops *backend_ops;
-} __rte_cache_aligned;
+};
static inline void
vq_assert_lock__(struct virtio_net *dev, struct vhost_virtqueue *vq, const char *func)
@@ -190,7 +190,7 @@ static int get_iv_len(enum rte_crypto_cipher_algorithm algo)
* one DPDK crypto device that deals with all crypto workloads. It is declared
* here and defined in vhost_crypto.c
*/
-struct vhost_crypto {
+struct __rte_cache_aligned vhost_crypto {
/** Used to lookup DPDK Cryptodev Session based on VIRTIO crypto
* session ID.
*/
@@ -213,7 +213,7 @@ struct vhost_crypto {
struct virtio_net *dev;
uint8_t option;
-} __rte_cache_aligned;
+};
struct vhost_crypto_writeback_data {
uint8_t *src;