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 06FC943320; Tue, 14 Nov 2023 01:16:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C86A0402C7; Tue, 14 Nov 2023 01:16:39 +0100 (CET) Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by mails.dpdk.org (Postfix) with ESMTP id 05784402BC for ; Tue, 14 Nov 2023 01:16:38 +0100 (CET) Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1cc30bf9e22so39084375ad.1 for ; Mon, 13 Nov 2023 16:16:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1699920998; x=1700525798; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=dy0h4WLQlHHOxvX5mYsBCXLSmotjCfvP2uQfNrs8F5M=; b=lYtYD2KZDvNFx/V3b7vsO2yS/QEyPGRPfWD7Rzu6yAueNoY/jeUAi6OlvUJkT0iwcg GV28UYjvaecAAIZozlT0eQGfnvKn4k6K4PQx/2r1YWX9h03YN0IHAzGhHFk0OajhQ42c YsrWxnQvuhEHovreLxpd9Kel+0+bh1PZb5Iyv8dbMHxLpRRs7S4YDv5i6bAsqqukIzNq tv6DJtjLodxqIzulGsDyEt6D88nSPm5C6Hdl5z+IZMlD31R+VwtyiYkwnDfCwv07IGDE 3Wc6mqOug1SX1VR6PHur5vRkfCgTob7gtvSvfnv5H1A7UvqwXFuLOWqciZvBv1GmvIvC +tYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699920998; x=1700525798; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dy0h4WLQlHHOxvX5mYsBCXLSmotjCfvP2uQfNrs8F5M=; b=MPOl2arztQ7VBEJZU1TW6byNupTpyzKl3iecxImxoMES/yycKPfL1JGNH8h++VYnuh vOwdB6MIqFBidA4SbpzJXtHCD6ZUdRYeWT7W1OoB4KPy5gNjuHVFTVKLsl2TQrdLoD8s WZ1Hel9D3vf1q9XhmqLG9hOpCOxvKfG8yi4+TTtBMQSQtB67YaGrlghJWWDi0fw3quU5 CkOI2wSHIJ4Y5JbdRVjU4Wb0bohy4G0JUGuFMeikm/uScLcfo5YFmha9g7i6BA3gS0Ae fmJjZlfoJOc4/eOh6WGdNsFOT+9DXiTfN6tM/zCeHh4VEoG9Uw6Z2d2SABKY3xYW3P2y jh4w== X-Gm-Message-State: AOJu0Yy4/kIL2WGop+Z0ZXBzD2uTViPCinL83OU4De3RY4t5R3OUvnNW PMpZzu42A8IGk28r4siCu4OiOA== X-Google-Smtp-Source: AGHT+IGawB4I1i87IlJhRXWbwgOf50RJ+i1IpAxc+TwqO0VblDwU1PL5xt/+93u6/ZE7ckDhKgf57w== X-Received: by 2002:a17:903:18d:b0:1cc:4d4e:bfb4 with SMTP id z13-20020a170903018d00b001cc4d4ebfb4mr1195868plg.12.1699920997657; Mon, 13 Nov 2023 16:16:37 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id s15-20020a170902ea0f00b001bc930d4517sm4590885plg.42.2023.11.13.16.16.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 16:16:37 -0800 (PST) Date: Mon, 13 Nov 2023 16:16:35 -0800 From: Stephen Hemminger To: Tyler Retzlaff Cc: dev@dpdk.org, ivan.malov@oktetlabs.ru, Andrew Rybchenko , Ivan Malov Subject: Re: [PATCH v2 2/3] net/sfc: fix non-constant expression inr RTE_BUILD_BUG_ON() Message-ID: <20231113161635.14f036cd@hermes.local> In-Reply-To: <20231113222855.GA26065@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <20231111172153.57461-1-stephen@networkplumber.org> <20231113170605.408281-1-stephen@networkplumber.org> <20231113170605.408281-3-stephen@networkplumber.org> <20231113141326.0df15fd6@hermes.local> <20231113222855.GA26065@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 On Mon, 13 Nov 2023 14:28:55 -0800 Tyler Retzlaff wrote: > On Mon, Nov 13, 2023 at 02:13:26PM -0800, Stephen Hemminger wrote: > > On Mon, 13 Nov 2023 09:06:04 -0800 > > Stephen Hemminger wrote: > > > > > The macro RTE_MIN has some hidden assignments to provide type > > > safety which means the statement can not be fully evaluted in > > > first pass of compiler. Replace RTE_MIN() with equivalent macro. > > > > > > This will cause errors from checkpatch about multiple evaluations > > > of same expression in macro but it is ok in this case. > > > > > > Fixes: 4f936666d790 ("net/sfc: support TSO for EF100 native datapath") > > > Cc: ivan.malov@oktetlabs.ru > > > Signed-off-by: Stephen Hemminger > > > > Building with clang finds another issue. > > ../drivers/net/sfc/sfc_rx.c:158:3: error: expected expression > > RTE_BUILD_BUG_ON(RTE_MBUF_F_RX_IP_CKSUM_UNKNOWN != 0); > > yet > > lib/mbuf/rte_mbuf_core.h:#define RTE_MBUF_F_RX_IP_CKSUM_UNKNOWN 0 > > curious. do you have the gcc -E / clang -E preprocessed output for the > expansion? wonder what it looks like. Building with clang and -E. This code: switch (desc_flags & (EFX_PKT_IPV4 | EFX_CKSUM_IPV4)) { case (EFX_PKT_IPV4 | EFX_CKSUM_IPV4): mbuf_flags |= RTE_MBUF_F_RX_IP_CKSUM_GOOD; break; case EFX_PKT_IPV4: mbuf_flags |= RTE_MBUF_F_RX_IP_CKSUM_BAD; break; default: RTE_BUILD_BUG_ON(RTE_MBUF_F_RX_IP_CKSUM_UNKNOWN != 0); SFC_ASSERT((mbuf_flags & RTE_MBUF_F_RX_IP_CKSUM_MASK) == RTE_MBUF_F_RX_IP_CKSUM_UNKNOWN); break; } Becomes: switch (desc_flags & (0x0800 | 0x0040)) { case (0x0800 | 0x0040): mbuf_flags |= (1ULL << 7); break; case 0x0800: mbuf_flags |= (1ULL << 4); break; default: _Static_assert(!(0 != 0), "RTE_MBUF_F_RX_IP_CKSUM_UNKNOWN != 0"); do {} while (0); break; } Doing same with Gcc: switch (desc_flags & (0x0800 | 0x0040)) { case (0x0800 | 0x0040): mbuf_flags |= (1ULL << 7); break; case 0x0800: mbuf_flags |= (1ULL << 4); break; default: # 158 "./drivers/net/sfc/sfc_rx.c" 3 4 _Static_assert # 158 "./drivers/net/sfc/sfc_rx.c" (!(0 != 0), "RTE_MBUF_F_RX_IP_CKSUM_UNKNOWN != 0"); do {} while (0) ;