From: Jerin Jacob Date: Mon, 1 May 2017 06:40:18 +0000 (+0530) Subject: net/thunderx: add compile-time checks X-Git-Tag: spdx-start~3177 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=95b097c8033ed7901a8a424490d3e52e2bd7b5b0;p=dpdk.git net/thunderx: add compile-time checks The thunderx PMD is sensitive to the layout of the mbuf on the RX path. Add in some compile-time checks to make sure the mbuf layout assumptions are valid, and to provide hints to anyone changing the mbuf where things may need to be updated. Signed-off-by: Jerin Jacob --- diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 2152029b52..3421415cb6 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -1239,6 +1239,13 @@ nicvf_rxq_mbuf_setup(struct nicvf_rxq *rxq) struct rte_mbuf mb_def; RTE_BUILD_BUG_ON(sizeof(union mbuf_initializer) != 8); + RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_off) % 8 != 0); + RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) - + offsetof(struct rte_mbuf, data_off) != 2); + RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, nb_segs) - + offsetof(struct rte_mbuf, data_off) != 4); + RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, port) - + offsetof(struct rte_mbuf, data_off) != 6); mb_def.nb_segs = 1; mb_def.data_off = RTE_PKTMBUF_HEADROOM; mb_def.port = rxq->port_id;