From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 44C66A0564; Sat, 7 Mar 2020 15:52:18 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8B0261BF90; Sat, 7 Mar 2020 15:52:17 +0100 (CET) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150054.outbound.protection.outlook.com [40.107.15.54]) by dpdk.org (Postfix) with ESMTP id A2A4A23D; Sat, 7 Mar 2020 15:52:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rymk7I/9oPRerXKphqTeInFNW0W3z/bv2OwBcl/h5Yo=; b=OVdU7q3xCg4Q9NQ8JvFWcgXMjA6iYpVT0xtgLVAkcJ2Zt7sbPAb7a8jF6TGyQBQBxDn0exhoU2EJmS1SrVVKev4MOxdewcvIksjy2bp9K3dlYtMs+XpMdaXwopFTblQEOGzB0W9qRYkaw+g+3k4oGxEn16Rorp0AHNNRte1qxns= Received: from DB3PR0202CA0003.eurprd02.prod.outlook.com (2603:10a6:8:1::16) by DB7PR08MB3451.eurprd08.prod.outlook.com (2603:10a6:10:49::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.14; Sat, 7 Mar 2020 14:52:11 +0000 Received: from DB5EUR03FT018.eop-EUR03.prod.protection.outlook.com (2603:10a6:8:1:cafe::14) by DB3PR0202CA0003.outlook.office365.com (2603:10a6:8:1::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.14 via Frontend Transport; Sat, 7 Mar 2020 14:52:11 +0000 Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dpdk.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dpdk.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT018.mail.protection.outlook.com (10.152.20.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.11 via Frontend Transport; Sat, 7 Mar 2020 14:52:11 +0000 Received: ("Tessian outbound 0420f1404d58:v42"); Sat, 07 Mar 2020 14:52:11 +0000 X-CR-MTA-TID: 64aa7808 Received: from 2d4d3b71c470.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 59805747-3EEE-4D95-BC41-4121D2F9FC12.1; Sat, 07 Mar 2020 14:52:06 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 2d4d3b71c470.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Sat, 07 Mar 2020 14:52:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RUo2sMWZdVSDYaeSLtW30MKaWULTFksKAMJwZPtdXM158bLgPafD9KcGDgtpTUfiaFlCrKmu5wlqXVrcO4rG9rZ8pl10pPWmPZ+0vQjN0aNVTID57UIT+TXLCI5fpG1YBpYTVI0V8/YGtt6nwMHJ715XHVZbGyI0vp3O+FyeDxyFRT1m/jZkG9z6a2ldyqimwASf9MRuYjRllS5uoR0qvHqoVtLTszbOMbgSTzkd36mgIn9X7qyoZ1lVIQj8nIjA2VNt+W8cMOSogZEbMCpiKliHweruNHVCG3LnQZiU1rgB/3TitWlvBPZ3YCxIudsf/YUsdulw7yetzsFtuA9bMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rymk7I/9oPRerXKphqTeInFNW0W3z/bv2OwBcl/h5Yo=; b=DC0nW1IDd1BHPSa92MRBPzTwWI7AwHOKxFIPME6goeJ5ZNwPKrlRO4g+CVb0yd+7vDAPW3Q7R7A2nmwJ6Egq7ukip6H8UddWX3OSC9bPF35lgaOrn+jSIWUpNSUfNtznFToq4N6pVl3FqeoqpvCyP7t0AfGqDnHxAbbaCf7zBod/1NrR6URqs10IgUffuZ/1VQn5jGTBMoN0JNsHQYj3KVKiM7iQKKbUz4Tiejs1UrS7YH+EEERZZf2kvRpIOqMUVtXoyH0JREFxMc1KI9KgexvQ+ACzex6LZSYRvgBhLyYxPOK1mul7R/v818v+QyVOlITDIuz6J1mQW5SL7/+x3Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rymk7I/9oPRerXKphqTeInFNW0W3z/bv2OwBcl/h5Yo=; b=OVdU7q3xCg4Q9NQ8JvFWcgXMjA6iYpVT0xtgLVAkcJ2Zt7sbPAb7a8jF6TGyQBQBxDn0exhoU2EJmS1SrVVKev4MOxdewcvIksjy2bp9K3dlYtMs+XpMdaXwopFTblQEOGzB0W9qRYkaw+g+3k4oGxEn16Rorp0AHNNRte1qxns= Received: from VI1PR08MB5376.eurprd08.prod.outlook.com (10.255.196.79) by VI1PR08MB3901.eurprd08.prod.outlook.com (20.178.80.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.15; Sat, 7 Mar 2020 14:52:04 +0000 Received: from VI1PR08MB5376.eurprd08.prod.outlook.com ([fe80::a0e2:2a9f:be7b:4b15]) by VI1PR08MB5376.eurprd08.prod.outlook.com ([fe80::a0e2:2a9f:be7b:4b15%3]) with mapi id 15.20.2793.013; Sat, 7 Mar 2020 14:52:04 +0000 From: Gavin Hu To: Kevin Traynor , "dev@dpdk.org" CC: nd , "thomas@monjalon.net" , "david.marchand@redhat.com" , "jerinj@marvell.com" , Honnappa Nagarahalli , Ruifeng Wang , Phil Yang , "stable@dpdk.org" , nd Thread-Topic: [dpdk-dev] [PATCH v1] mbuf: replace zero-length marker with unnamed union Thread-Index: AQHV8iEfnt/GvPVe10WEYhEzOB3ZNqg9OujA Date: Sat, 7 Mar 2020 14:52:04 +0000 Message-ID: References: <20200303162728.93744-1-gavin.hu@arm.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 91cfbce0-edb4-49ee-b184-4ccfd22136f8.0 x-checkrecipientchecked: true Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Gavin.Hu@arm.com; x-originating-ip: [113.29.88.7] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e551f49f-08a7-4b1b-9efe-08d7c2a71e1e X-MS-TrafficTypeDiagnostic: VI1PR08MB3901:|VI1PR08MB3901:|DB7PR08MB3451: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:6790;OLM:6790; x-forefront-prvs: 03355EE97E X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(396003)(39860400002)(136003)(366004)(346002)(376002)(189003)(199004)(71200400001)(478600001)(966005)(9686003)(55016002)(4326008)(33656002)(2906002)(81166006)(66446008)(81156014)(7696005)(55236004)(26005)(110136005)(54906003)(186003)(316002)(8936002)(8676002)(76116006)(52536014)(6506007)(86362001)(64756008)(66946007)(53546011)(66556008)(5660300002)(66476007); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB3901; H:VI1PR08MB5376.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: YI5yyeU9EBNh0yPEAulTRDPOi133IPaKtK+Jypy6AupyZTZYtEOV5eHmiEo7B38pYsTd7SNl9YkP/vE5ow0cI5u3I5u6tYeWfb+98rPIfKQ4Ft5VjJUCzst6cKw7Bt6Jx5C1+0gZKwyJ7VK8668+V6UC9UgIV4I2MLc546vGEdCM8O/EkbFsVlomP3LTazYb1GLDVbBCfn5EnocInwx2V+KVJ4vYRVVqKz7cdGu5o/c/GxXIPoixFt0omcMOdX3gBievc5UQ7gyQfNX7hYGmpuryZmF1ulduV9ghCTgz5mFMFVvI9INibfaN6+Pvv5K/XPAmacisgu4mlc52dX9KNTgXzKKhUBiZ82/E7kfptFSYeQx2KbGxBAyaoe+yoJ0cwFWEulBCe33Z8CJAr44tPMqG4w2bdaJFfCwENjVGbqn5yOVtKxySn3vADw+l+Z7U6Dg/ScHL/kpPxVAOchAWtaaIa3arcI2cv0xvSBLWhgTD9ttuXn38AQEyP4fZUAwnIz80fpTOlciLt/hhLpewSQ== x-ms-exchange-antispam-messagedata: OXGrnHjq6ee/GvN3bRAodp2EaPxjyBliU5rFK6ku1oCQHJL58+/UEnlA1iZWto1wQcb8azLvz+9if4q0nVWSHoiKSzWbIn7iEojBHS0Jl50MeghMmTklIM5mR3ReftoEMNjP+V2+9tTK79B8lPCtVw== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3901 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gavin.Hu@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT018.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; IPV:CAL; SCL:-1; CTRY:IE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(346002)(396003)(376002)(136003)(189003)(199004)(4326008)(52536014)(2906002)(26005)(70586007)(70206006)(186003)(450100002)(33656002)(336012)(5660300002)(356004)(53546011)(54906003)(81156014)(86362001)(81166006)(9686003)(316002)(55016002)(8936002)(8676002)(478600001)(7696005)(110136005)(26826003)(966005)(6506007); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR08MB3451; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:Pass; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; MX:1; A:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 4468c467-d665-42d9-6d45-08d7c2a719b4 X-Forefront-PRVS: 03355EE97E X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gA36Oy14VFiCZGJaemalwYSBKA+NdIb6avXUIpDQ8YMCa3duOmqq01eQnslPaEZDaobB5TlO5dpn4aDsj1fMNeRg/a3JisK9JJzjize9kbG0aqBv3u85J/wip6RlK/J7gVSsyxkulTGVj5mRjEaB3DSvur9Pa40pLbVGAmfugk+CmEqWwV6oWsg949IBzZD5Dj4ZeHzW0ZukUbmSmZ9bw/fpwezP4CFckiJbSffSD5pDUxytAkD9hlMlAOi1ksOxwkyz2huKUdtPgcYHnFcJuMCpBEO2uzprkqI1EC00lPj60rP33DEOP8UvVNHfGwWNoJn2SEOnU0Bls2zUgvih4nrFl1IexjSQsDeYjYVXhi0xnbDS6fMyzTZxa94wh6fOOtqDjkSoV3rpYQc2Tk/+wQrV0MaMjnRWfN/mq+g40EeecpOnItLlto8d8bRjSvdPoDtqeBbpeQ4vInehaHIff8EZRyCrdGazIIJPv0oZROB6WwUUf47SShVavcAyaqMff3C3NIUD+ZXNa5ajLr/6tA== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2020 14:52:11.6634 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e551f49f-08a7-4b1b-9efe-08d7c2a71e1e X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3451 Subject: Re: [dpdk-dev] [PATCH v1] mbuf: replace zero-length marker with unnamed union X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Kevin, > -----Original Message----- > From: Kevin Traynor > Sent: Wednesday, March 4, 2020 8:33 PM > To: Gavin Hu ; dev@dpdk.org > Cc: nd ; thomas@monjalon.net; > david.marchand@redhat.com; jerinj@marvell.com; Honnappa Nagarahalli > ; Ruifeng Wang > ; Phil Yang ; > stable@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v1] mbuf: replace zero-length marker with > unnamed union >=20 > On 03/03/2020 16:27, Gavin Hu wrote: > > gcc 10.0.1 reports: error: array subscript 0 is outside the bounds of a= n > > interior zero-length array 'RTE_MARKER64' {aka 'long unsigned int[0]'} > > [-Werror=3Dzero-length-bounds] 310 | *(uint64_t *)(&mbuf->rearm_data) = =3D > > val; > > > > Declaring zero-length arrays in other contexts, including as interior > > members of structure objects or as non-member objects, is discouraged. > > Accessing elements of zero-length arrays declared in such contexts is > > undefined and may be diagnosed.[1] > > > > Fix by using unnamed union and struct. > > > > https://bugs.dpdk.org/show_bug.cgi?id=3D396 > > > > Bugzilla ID: 396 > > > > [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html > > > > Fixes: 3e6181b07038 ("mbuf: use structure marker from EAL") > > Cc: stable@dpdk.org > > > > Signed-off-by: Gavin Hu > > --- > > lib/librte_mbuf/rte_mbuf_core.h | 54 +++++++++++++++++++-------------- > > 1 file changed, 32 insertions(+), 22 deletions(-) > > > > diff --git a/lib/librte_mbuf/rte_mbuf_core.h > b/lib/librte_mbuf/rte_mbuf_core.h > > index b9a59c879..5390ddcfa 100644 > > --- a/lib/librte_mbuf/rte_mbuf_core.h > > +++ b/lib/librte_mbuf/rte_mbuf_core.h > > @@ -480,31 +480,41 @@ struct rte_mbuf { > > rte_iova_t buf_physaddr; /**< deprecated */ > > } __rte_aligned(sizeof(rte_iova_t)); > > > > - /* next 8 bytes are initialised on RX descriptor rearm */ > > - RTE_MARKER64 rearm_data; > > - uint16_t data_off; > > - > > - /** > > - * Reference counter. Its size should at least equal to the size > > - * of port field (16 bits), to support zero-copy broadcast. > > - * It should only be accessed using the following functions: > > - * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and > > - * rte_mbuf_refcnt_set(). The functionality of these functions > (atomic, > > - * or non-atomic) is controlled by the > CONFIG_RTE_MBUF_REFCNT_ATOMIC > > - * config option. > > - */ > > RTE_STD_C11 > > union { > > - rte_atomic16_t refcnt_atomic; /**< Atomically accessed > refcnt */ > > - /** Non-atomically accessed refcnt */ > > - uint16_t refcnt; > > - }; > > - uint16_t nb_segs; /**< Number of segments. */ > > + /* next 8 bytes are initialised on RX descriptor rearm */ > > + uint64_t rearm_data; To address this historical issue, how about changing this line to uint64_t = rearm_data[1]?=20 > > + RTE_STD_C11 > > + struct { > > + uint16_t data_off; > > + > > + /** > > + * Reference counter. Its size should at least equal to > > + * the size of port field (16 bits), to support > > + * zero-copy broadcast. It should only be accessed > > + * using the following functions: > > + * rte_mbuf_refcnt_update(), > rte_mbuf_refcnt_read(), > > + * and rte_mbuf_refcnt_set(). The functionality of > > + * these functions (atomic, or non-atomic) is > > + * controlled by the > CONFIG_RTE_MBUF_REFCNT_ATOMIC > > + * config option. > > + */ > > + RTE_STD_C11 > > + union { > > + /**< Atomically accessed refcnt */ > > + rte_atomic16_t refcnt_atomic; > > + /** Non-atomically accessed refcnt > */ > > + uint16_t refcnt; > > + }; > > + uint16_t nb_segs; /**< Number of segments. */ > > > > - /** Input port (16 bits to support more than 256 virtual ports). > > - * The event eth Tx adapter uses this field to specify the output por= t. > > - */ > > - uint16_t port; > > + /** Input port (16 bits to support more than 256 > > + * virtual ports). The event eth Tx adapter uses this > > + * field to specify the output port. > > + */ > > + uint16_t port; > > + }; > > + }; > > > > uint64_t ol_flags; /**< Offload features. */ > > > > >=20 >=20 > Hi Gavin, this causes some errors on x86: >=20 > # gcc --version | head -1 > gcc (GCC) 10.0.1 20200216 (Red Hat 10.0.1-0.8) >=20 >=20 > In file included from > ../lib/librte_eal/common/include/arch/x86/rte_byteorder.h:13, > from ../drivers/net/sfc/sfc_ef10_rx.c:14: > ../drivers/net/sfc/sfc_ef10_rx.c: In function 'sfc_ef10_rx_process_event'= : > ../drivers/net/sfc/sfc_ef10_rx.c:309:39: error: subscripted value is > neither array nor pointer nor vector > 309 | RTE_BUILD_BUG_ON(sizeof(m->rearm_data[0]) !=3D > sizeof(rxq->rearm_data)); > | ^ > ../lib/librte_eal/common/include/rte_common.h:292:65: note: in > definition of macro 'RTE_BUILD_BUG_ON' > 292 | #define RTE_BUILD_BUG_ON(condition) ((void)sizeof(char[1 - > 2*!!(condition)])) > | > ^~~~~~~~~ > ../drivers/net/sfc/sfc_ef10_rx.c:310:15: error: subscripted value is > neither array nor pointer nor vector > 310 | m->rearm_data[0] =3D rxq->rearm_data; > |