[PATCH v2 19/21] net/virtio: use C11 alignof
Tyler Retzlaff
roretzla at linux.microsoft.com
Tue Feb 13 19:34:50 CET 2024
Replace use of __alignof__(T) with C11 alignof(T) to improve portability
between toolchains.
Signed-off-by: Tyler Retzlaff <roretzla at linux.microsoft.com>
---
drivers/net/virtio/virtio_rxtx.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 99b9519..f69b945 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -2,6 +2,7 @@
* Copyright(c) 2010-2014 Intel Corporation
*/
+#include <stdalign.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -1797,7 +1798,7 @@
txm->nb_segs == 1 &&
rte_pktmbuf_headroom(txm) >= hdr_size &&
rte_is_aligned(rte_pktmbuf_mtod(txm, char *),
- __alignof__(struct virtio_net_hdr_mrg_rxbuf)))
+ alignof(struct virtio_net_hdr_mrg_rxbuf)))
can_push = 1;
else if (virtio_with_feature(hw, VIRTIO_RING_F_INDIRECT_DESC) &&
txm->nb_segs < VIRTIO_MAX_TX_INDIRECT)
@@ -1878,7 +1879,7 @@
txm->nb_segs == 1 &&
rte_pktmbuf_headroom(txm) >= hdr_size &&
rte_is_aligned(rte_pktmbuf_mtod(txm, char *),
- __alignof__(struct virtio_net_hdr_mrg_rxbuf)))
+ alignof(struct virtio_net_hdr_mrg_rxbuf)))
can_push = 1;
else if (virtio_with_feature(hw, VIRTIO_RING_F_INDIRECT_DESC) &&
txm->nb_segs < VIRTIO_MAX_TX_INDIRECT)
@@ -1980,7 +1981,7 @@
txm->nb_segs == 1 &&
rte_pktmbuf_headroom(txm) >= hdr_size &&
rte_is_aligned(rte_pktmbuf_mtod(txm, char *),
- __alignof__(struct virtio_net_hdr_mrg_rxbuf))) {
+ alignof(struct virtio_net_hdr_mrg_rxbuf))) {
inorder_pkts[nb_inorder_pkts] = txm;
nb_inorder_pkts++;
--
1.8.3.1
More information about the dev
mailing list