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 3BA06A0526 for ; Tue, 21 Jul 2020 09:50:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E859B1BFCD; Tue, 21 Jul 2020 09:50:30 +0200 (CEST) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by dpdk.org (Postfix) with ESMTP id CB2491BFCD for ; Tue, 21 Jul 2020 09:50:28 +0200 (CEST) Received: by mail-wm1-f65.google.com with SMTP id q15so1818391wmj.2 for ; Tue, 21 Jul 2020 00:50:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=fgLgnWMFZW/rI10t9agkUV+lfNYWgJDR/Phv7qtkpZY=; b=K3b6ypoxTclQONJv4QwliAh6eX62gT+b318D0Sn0Xgx7nRghmurVHniIbX/gHfBJPk gY4vk/5HlcguTxjB3QDr54b4rx4h//1beGeHI0jusha/lqMbdgTBIOWxyYJ4jxETkDlH iuFbzWFNJ4CVxUNvnNBWV3ApqhkV/MvKxQDLKjveswTVuYEslw3fZwAVRTMGV/vJfG/d g8Eoa0CwK3oHsHGQjgftEuO44yTDF68P6lv+4bJBZERar/8c6zUSd1K60EZOUfjuuHJA bj8tP3Rj2SK9s2S/rsVqbr5hYv4BSifyrrNsI0PxysGSXyB9D5GNMc/y5AujbLr7EKss HimA== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=fgLgnWMFZW/rI10t9agkUV+lfNYWgJDR/Phv7qtkpZY=; b=lxb99fCrvCNG12N0ZT06AyUoKlYZCR78AGiNf11rZwbf0x9YV7e3hDDJiBIWlDngJA UMNBOy05ntcQ42c8lbPaDhKsHiAAyPNMKq2jf7P5eGJFNcPm4dLwkQhejnqkCPh8SqJo FPNW/uFqfPdZkVxyhdT8bbd+ebHkxfkUqBpT/yu2auxY6gACiMOb2Wsyjo/FV4RJxawV Jdr7Rg/9UGizH8qAxnku9NQui6fqDyTECTICQH+gCk2vfir1m+Ok9LBLIXA2CL0Pdp3X kuYn8RCOwOigcRR6ljzwARCnTesHQWsBd8Y4nyuKcJsIunKecSYxijuFQu9DCNhpiltN 173Q== X-Gm-Message-State: AOAM530Wg7R2e6haJndoifYqltdJK2gOq+gK2u+/otXGzbW7xCvoawSf pOp5zfjsc6sdi/+DmQ9AnWv/ig== X-Google-Smtp-Source: ABdhPJylmCE3A/7o6DC0b98jKPjiN8WQ9maZ7+H1YaKOBvbLQuusAfyNErMO37sPaBW/xEdrWtBKBQ== X-Received: by 2002:a1c:ed01:: with SMTP id l1mr2860437wmh.33.1595317828456; Tue, 21 Jul 2020 00:50:28 -0700 (PDT) Received: from 6wind.com (2a01cb0c0005a600345636f7e65ed1a0.ipv6.abo.wanadoo.fr. [2a01:cb0c:5:a600:3456:36f7:e65e:d1a0]) by smtp.gmail.com with ESMTPSA id k14sm35339874wrn.76.2020.07.21.00.50.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2020 00:50:27 -0700 (PDT) Date: Tue, 21 Jul 2020 09:50:27 +0200 From: Olivier Matz To: Raslan Darawsheh Cc: Ferruh Yigit , "dev@dpdk.org" , "stable@dpdk.org" Message-ID: <20200721075027.GG5869@platinum> References: <1594901556-11826-1-git-send-email-rasland@mellanox.com> <20200721070925.GF5869@platinum> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] net: fix compilation with pedantic enabled 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" Hi Raslan, On Tue, Jul 21, 2020 at 07:37:51AM +0000, Raslan Darawsheh wrote: > Hi, > > -----Original Message----- > > From: Olivier Matz > > Sent: Tuesday, July 21, 2020 10:09 AM > > To: Ferruh Yigit > > Cc: Raslan Darawsheh ; dev@dpdk.org; > > stable@dpdk.org > > Subject: Re: [dpdk-dev] [PATCH] net: fix compilation with pedantic enabled > > > > Hi, > > > > On Tue, Jul 21, 2020 at 01:05:57AM +0100, Ferruh Yigit wrote: > > > On 7/16/2020 1:12 PM, Raslan Darawsheh wrote: > > > > when trying to compile rte_mpls with pedantic enabled, > > > > it will complain about bit field defintion. > > > > error: type of bit-field 'bs' is a GCC extension [-Werror=pedantic] > > > > error: type of bit-field 'tc' is a GCC extension [-Werror=pedantic] > > > > error: type of bit-field 'tag_lsb' is a GCC extension [-Werror=pedantic] > > > ' > > > I tried to reproduce by adding to '-pedantic' to 'rte_net.c' (which uses > > > 'rte_mpls.h') but not able to get the warning. Is this happen with specific > > > version of the compiler? > > Yes It happens only with old compilers, maybe I should have mentioned that in the commit log (my mistake). > gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28) > > > > > > > > > > > > This fixes the compilation error. > > > > > > > > Fixes: e480cf487a0d ("net: add MPLS header structure") > > > > Cc: olivier.matz@6wind.com > > > > Cc: stable@dpdk.org > > > > > > > > Signed-off-by: Raslan Darawsheh > > > > --- > > > > lib/librte_net/rte_mpls.h | 12 ++++++------ > > > > 1 file changed, 6 insertions(+), 6 deletions(-) > > > > > > > > diff --git a/lib/librte_net/rte_mpls.h b/lib/librte_net/rte_mpls.h > > > > index db91707..ecd1f64 100644 > > > > --- a/lib/librte_net/rte_mpls.h > > > > +++ b/lib/librte_net/rte_mpls.h > > > > @@ -24,13 +24,13 @@ extern "C" { > > > > struct rte_mpls_hdr { > > > > uint16_t tag_msb; /**< Label(msb). */ > > > > #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN > > > > - uint8_t tag_lsb:4; /**< Label(lsb). */ > > > > - uint8_t tc:3; /**< Traffic class. */ > > > > - uint8_t bs:1; /**< Bottom of stack. */ > > > > + uint32_t tag_lsb:4; /**< Label(lsb). */ > > > > + uint32_t tc:3; /**< Traffic class. */ > > > > + uint32_t bs:1; /**< Bottom of stack. */ > > > > #else > > > > - uint8_t bs:1; /**< Bottom of stack. */ > > > > - uint8_t tc:3; /**< Traffic class. */ > > > > - uint8_t tag_lsb:4; /**< label(lsb) */ > > > > + uint32_t bs:1; /**< Bottom of stack. */ > > > > + uint32_t tc:3; /**< Traffic class. */ > > > > + uint32_t tag_lsb:4; /**< label(lsb) */ > > > > #endif > > > > uint8_t ttl; /**< Time to live. */ > > > > } __rte_packed; > > > > > > The struct size keeps same after change, do you know if this behavior is > > part of > > > standard and guaranteed? > > > > I have the same fear. > To my understanding and please correct me if I'm wrong, the type of the bit fields shouldn't change the size of the structure, > As long as the bit order is kept the same, and I made a small test for it and checked the size of the struct it gave 4 bytes (sizeof()) with both definitions. You are probably right, however we saw some differences in the behavior in specific conditions. See https://patchwork.dpdk.org/patch/70458/ for instance. > > > > Would it make sense to add __extension__ instead? We already do that > > for gre, for instance. > Yes I guess this can work as well, > > Kindest regards > Raslan Darawsheh