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 13088A052E for ; Mon, 9 Mar 2020 16:47:45 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E720D1C0CA; Mon, 9 Mar 2020 16:47:44 +0100 (CET) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by dpdk.org (Postfix) with ESMTP id 6F13E1C0AC for ; Mon, 9 Mar 2020 16:47:42 +0100 (CET) Received: by mail-pg1-f196.google.com with SMTP id u12so4867007pgb.10 for ; Mon, 09 Mar 2020 08:47:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/jhYdSVM90VPew8RaKJbddD2ZPmT/q1mpirIBctfq9M=; b=RQw0E+uqg9mk7zjl8CwCv3YpgJfe7U+uEDYUJeS+TEBL7/zhiIx/CvJa/6vqDkmJSH 5hAoKT3FUylPNJFz/vMROZX1oHJilqbhVgqOkN/wEvU872eRoX8WBYcyo+D1rj1RwV5t 4MZ9Vkf+FMZSOgLXTmfKy7o+ZbtPLc6O2poocSI9ZEmXsxsB+Jsi6b9ekgemYEJQXFZg GrRw5smsnItYOLULq8KG6xycf7ORrSUy8SyAmhozCp4ZFVjC9aiJ4+GyKjCaM2tpM6DY iSzvjwPVAdQCu09vONT97TvvoSFn9pK/liA0fUz775Shiu8N2R2ue1pKfBiDebf+wrHC PKrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/jhYdSVM90VPew8RaKJbddD2ZPmT/q1mpirIBctfq9M=; b=YqSceThBAqZipdTSMsrIxfz/kWuL1qVILlaGAeUUXHzvIfokRvYNHPkPhW+IMZTPfL Y0mrImmxY7Tlx3oGrnjenlukbM2pYz4CkxEB3fYB6jK2XHFzuCnTSlBO7gs8fVOvBMqz dLpH4W8/osgeBMoquI97nbDeX8wVCyHqPfzhCQukfYq2inYyHFnsBgfMjmJ0ZYA/rw6P MVY4ybXf59ae0oJXcoTzBY3+ZXt8aTGNxbHU3QB/zQVR/q4TWVtTSML/IM3gEU0gPs9w cK4OqGAfStynd09uqkl/5i8XwxW5l9EXHAlXDkdX8JTiYIM/90hpEdBxoMVBQn2diMYq HP0A== X-Gm-Message-State: ANhLgQ0nE3k7R1zsnEf24bbhYUgqD4mdUggEocozLotlBKOjpFN4Yw2K 6Xjybpr5iPmRIrlPIMAYzohwcw== X-Google-Smtp-Source: ADFU+vvsQToWqdMncLb9J76UpAdvxlQPN+kcXeSBJkil3EDcqspgqXvTM0c7oyUKV3AAt40eHi1aXA== X-Received: by 2002:a63:fc62:: with SMTP id r34mr17335607pgk.437.1583768861514; Mon, 09 Mar 2020 08:47:41 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id x2sm43356079pge.2.2020.03.09.08.47.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2020 08:47:41 -0700 (PDT) Date: Mon, 9 Mar 2020 08:47:32 -0700 From: Stephen Hemminger To: Ferruh Yigit Cc: Gavin Hu , dev@dpdk.org, nd@arm.com, david.marchand@redhat.com, thomas@monjalon.net, ktraynor@redhat.com, jerinj@marvell.com, honnappa.nagarahalli@arm.com, ruifeng.wang@arm.com, phil.yang@arm.com, joyce.kong@arm.com, stable@dpdk.org, Olivier MATZ , Konstantin Ananyev , Andrew Rybchenko Message-ID: <20200309084732.3f845eee@hermes.lan> In-Reply-To: <4135ab73-75d3-421a-264d-2951fc096133@intel.com> References: <20200303162728.93744-1-gavin.hu@arm.com> <20200307155629.45021-1-gavin.hu@arm.com> <4135ab73-75d3-421a-264d-2951fc096133@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v2] mbuf: replace zero-length marker with unnamed union X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Mon, 9 Mar 2020 08:55:05 +0000 Ferruh Yigit wrote: > On 3/7/2020 3:56 PM, Gavin Hu wrote: > > 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=396 > > > > 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 > > --- > > v2: > > * change 'uint64_t rearm_data' to 'uint_64_t rearm_data[1]' to fix > > the SFC PMD compiling error on x86. > > --- > > 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..34cb152e2 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[1]; > We are using zero length array as markers only and know what we are doing with them, > what would you think disabling the warning instead of increasing the complexity > in mbuf struct? No to disabling warnings. Or get rid of the markers all together, the usage is awkward already.