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 5A7F243BF1; Tue, 27 Feb 2024 11:03:07 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4219C4027D; Tue, 27 Feb 2024 11:03:07 +0100 (CET) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by mails.dpdk.org (Postfix) with ESMTP id 4DE9640150 for ; Tue, 27 Feb 2024 11:03:04 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4TkY0s2L4xz1xpNv; Tue, 27 Feb 2024 18:01:33 +0800 (CST) Received: from dggpeml500021.china.huawei.com (unknown [7.185.36.21]) by mail.maildlp.com (Postfix) with ESMTPS id 5DC9E140384; Tue, 27 Feb 2024 18:03:02 +0800 (CST) Received: from frapeml500007.china.huawei.com (7.182.85.172) by dggpeml500021.china.huawei.com (7.185.36.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 27 Feb 2024 18:03:00 +0800 Received: from frapeml500007.china.huawei.com ([7.182.85.172]) by frapeml500007.china.huawei.com ([7.182.85.172]) with mapi id 15.01.2507.035; Tue, 27 Feb 2024 11:02:58 +0100 From: Konstantin Ananyev To: Tyler Retzlaff , "dev@dpdk.org" CC: Ajit Khaparde , Andrew Boyer , Andrew Rybchenko , Bruce Richardson , Chenbo Xia , Fengchengwen , "Dariusz Sosnowski" , David Christensen , Hyong Youb Kim , Jerin Jacob , haijie , 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 , "Zhuangyuzeng (Yisen)" , Yuying Zhang , "mb@smartsharesystems.com" Subject: RE: [PATCH v6 02/23] mbuf: consolidate driver asserts for mbuf struct Thread-Topic: [PATCH v6 02/23] mbuf: consolidate driver asserts for mbuf struct Thread-Index: AQHaaT/Z5mMR5z/UzkO7/6byTKqO3rEd9bOw Date: Tue, 27 Feb 2024 10:02:58 +0000 Message-ID: <2ddfa1d315c844f0b9621a76101e5abc@huawei.com> References: <1706657173-26166-1-git-send-email-roretzla@linux.microsoft.com> <1709012499-12813-1-git-send-email-roretzla@linux.microsoft.com> <1709012499-12813-3-git-send-email-roretzla@linux.microsoft.com> In-Reply-To: <1709012499-12813-3-git-send-email-roretzla@linux.microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.206.138.42] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 > Subject: [PATCH v6 02/23] mbuf: consolidate driver asserts for mbuf struc= t >=20 > Collect duplicated RTE_BUILD_BUG_ON checks from drivers and place them > at global scope with struct rte_mbuf definition using static_assert. >=20 > Signed-off-by: Tyler Retzlaff > --- > lib/mbuf/rte_mbuf_core.h | 34 ++++++++++++++++++++++++++++++++++ > 1 file changed, 34 insertions(+) >=20 > 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". > */ >=20 > +#include > +#include > #include >=20 > +#include > #include > #include >=20 > @@ -673,6 +676,37 @@ struct rte_mbuf { > uint32_t dynfield1[9]; /**< Reserved for dynamic fields. */ > } __rte_cache_aligned; >=20 > +static_assert(!(offsetof(struct rte_mbuf, ol_flags) !=3D > + offsetof(struct rte_mbuf, rearm_data) + 8), "ol_flags"); > +static_assert(!(offsetof(struct rte_mbuf, rearm_data) !=3D > + RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16)), "rearm_data"); > +static_assert(!(offsetof(struct rte_mbuf, data_off) !=3D > + 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) !=3D > + offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4), "pkt_len"); > +static_assert(!(offsetof(struct rte_mbuf, data_len) !=3D > + offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8), "data_len"); > +static_assert(!(offsetof(struct rte_mbuf, vlan_tci) !=3D > + offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10), "vlan_tci"); > +static_assert(!(offsetof(struct rte_mbuf, hash) !=3D > + offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12), "hash"); > + > /** > * Function typedef of callback to free externally attached buffer. > */ > -- Acked-by: Konstantin Ananyev =20 > 1.8.3.1