From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7028843C03; Tue, 27 Feb 2024 06:42:27 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4002D42E59; Tue, 27 Feb 2024 06:42:14 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id BD5C442E28 for ; Tue, 27 Feb 2024 06:41:41 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id C0D8320B74C2; Mon, 26 Feb 2024 21:41:40 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C0D8320B74C2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1709012500; bh=Yy8P6Wt0r/jg+qdObE8aOhUH7XBv9xmNrQlsx890pro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gZHj7XRf/tPYlMtCyjcflobhOHw3YZgqXc+beW42Y3ERwwdDI9gcOSTYVvW1QVtql KgA6IWhEsm5y7HAB0qQVWO+p3w7UNYZvR25IEp79bD5PSMrldXNz5Khn0TsSE1N8Sd piYfw/vqJeNefe4JK/y1WXMlfQHUecgr1nWqKDgA= From: Tyler Retzlaff To: dev@dpdk.org Cc: Ajit Khaparde , Andrew Boyer , Andrew Rybchenko , Bruce Richardson , Chenbo Xia , Chengwen Feng , Dariusz Sosnowski , David Christensen , Hyong Youb Kim , Jerin Jacob , Jie Hai , Jingjing Wu , John Daley , Kevin Laatz , Kiran Kumar K , Konstantin Ananyev , Maciej Czekaj , Matan Azrad , Maxime Coquelin , Nithin Dabilpuram , Ori Kam , Ruifeng Wang , Satha Rao , Somnath Kotur , Suanming Mou , Sunil Kumar Kori , Viacheslav Ovsiienko , Yisen Zhuang , Yuying Zhang , mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v6 02/23] mbuf: consolidate driver asserts for mbuf struct Date: Mon, 26 Feb 2024 21:41:18 -0800 Message-Id: <1709012499-12813-3-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1709012499-12813-1-git-send-email-roretzla@linux.microsoft.com> References: <1706657173-26166-1-git-send-email-roretzla@linux.microsoft.com> <1709012499-12813-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Collect duplicated RTE_BUILD_BUG_ON checks from drivers and place them at global scope with struct rte_mbuf definition using static_assert. Signed-off-by: Tyler Retzlaff --- lib/mbuf/rte_mbuf_core.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h index 7000c04..36551c2 100644 --- a/lib/mbuf/rte_mbuf_core.h +++ b/lib/mbuf/rte_mbuf_core.h @@ -16,8 +16,11 @@ * New fields and flags should fit in the "dynamic space". */ +#include +#include #include +#include #include #include @@ -673,6 +676,37 @@ struct rte_mbuf { uint32_t dynfield1[9]; /**< Reserved for dynamic fields. */ } __rte_cache_aligned; +static_assert(!(offsetof(struct rte_mbuf, ol_flags) != + offsetof(struct rte_mbuf, rearm_data) + 8), "ol_flags"); +static_assert(!(offsetof(struct rte_mbuf, rearm_data) != + RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16)), "rearm_data"); +static_assert(!(offsetof(struct rte_mbuf, data_off) != + offsetof(struct rte_mbuf, rearm_data)), "data_off"); +static_assert(!(offsetof(struct rte_mbuf, data_off) < + offsetof(struct rte_mbuf, rearm_data)), "data_off"); +static_assert(!(offsetof(struct rte_mbuf, refcnt) < + offsetof(struct rte_mbuf, rearm_data)), "refcnt"); +static_assert(!(offsetof(struct rte_mbuf, nb_segs) < + offsetof(struct rte_mbuf, rearm_data)), "nb_segs"); +static_assert(!(offsetof(struct rte_mbuf, port) < + offsetof(struct rte_mbuf, rearm_data)), "port"); +static_assert(!(offsetof(struct rte_mbuf, data_off) - + offsetof(struct rte_mbuf, rearm_data) > 6), "data_off"); +static_assert(!(offsetof(struct rte_mbuf, refcnt) - + offsetof(struct rte_mbuf, rearm_data) > 6), "refcnt"); +static_assert(!(offsetof(struct rte_mbuf, nb_segs) - + offsetof(struct rte_mbuf, rearm_data) > 6), "nb_segs"); +static_assert(!(offsetof(struct rte_mbuf, port) - + offsetof(struct rte_mbuf, rearm_data) > 6), "port"); +static_assert(!(offsetof(struct rte_mbuf, pkt_len) != + offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4), "pkt_len"); +static_assert(!(offsetof(struct rte_mbuf, data_len) != + offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8), "data_len"); +static_assert(!(offsetof(struct rte_mbuf, vlan_tci) != + offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10), "vlan_tci"); +static_assert(!(offsetof(struct rte_mbuf, hash) != + offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12), "hash"); + /** * Function typedef of callback to free externally attached buffer. */ -- 1.8.3.1