From patchwork Tue Jan 16 18:41:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 135896 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 88139438E3; Tue, 16 Jan 2024 19:43:20 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8757D40A87; Tue, 16 Jan 2024 19:43:15 +0100 (CET) Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by mails.dpdk.org (Postfix) with ESMTP id 24C8E402EE for ; Tue, 16 Jan 2024 19:43:13 +0100 (CET) Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1d3f29fea66so57824035ad.3 for ; Tue, 16 Jan 2024 10:43:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1705430592; x=1706035392; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1SWSIFusGLFhG/6i4J5g4k7EjSwAUH/UQr+4g4W+7kw=; b=KjxgAQqQ+5t6vbBAzGqLYFTTEn1GiHwV5QoBp1ZgZyVf/ev15CxbsB6RGBP7XMpJ/E z7hPEVF+SG+NtdkydBN3WHqe95QTMq/4sjhUL0OM9n+me0lqK4UPks+2x8PQKgEC7+9k 4okYb4864g2DsHlEKeJBXdlq6SPdUBuozuTJpGSvGDrWHcpnfe5ux4QzTOvDmLv9cYP1 GTbygYYpSFKbBYgrcamXOexcH8muEOKAQUdH5BSBTV6iatt2+vwA1PRslkBsztPcnN3u 6NMap9Vge/2n2tknNcxtwz+Fe0MaxdP0T5QUO8BePriEiy20BpJwofHx/vWiUbWlIq8r Ap9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705430592; x=1706035392; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1SWSIFusGLFhG/6i4J5g4k7EjSwAUH/UQr+4g4W+7kw=; b=ABTweoBUNYjgBiA+/zADhLuAE/f4jI8oQqYjsBn4zkz+UMbQJvN99cGP0xdbLabTO3 pt/p6LiatA7JnUohIoSe0dIajrI5sVfSOJOBaQ148iO80V0pD+Kdx1dheDTYHw+vtCLt OCXSeSWPc8DO3CJPIoDrkGhgb0KJb2+Iik1pSXAjPfCsQnHSQqtlpsRPEwlYLWE18I2p vo4qTaTCQS83SZXK8Ap0ArSDJfPxkUxkUSlkFy9bbGBiZofBkK7CFwHRH72zgWhzrgQZ WF+HHYXV6B9o2RGjliXYaBEd5iO+HHTu1qLiSUm9LoqKA+fixxvx0nf0QbU+Br+OPZ0G AIxQ== X-Gm-Message-State: AOJu0Yxmu2gPDaByhbD7N+HjIjBxPsd1SAVIlvgsCPdjT8qIkKZHHuWC eL4pXcosL27qZSWme6kFyOcgEhTC2h8w/6CDseQxE+yQCML3eg== X-Google-Smtp-Source: AGHT+IHqOONUP9+y5HuzY47yF51/yGEbErLNp41H9TjNFdZGQys/oSk7ilpiQuOtK90cMtl48s1pxg== X-Received: by 2002:a17:903:60f:b0:1d4:47ea:639c with SMTP id kg15-20020a170903060f00b001d447ea639cmr3694889plb.33.1705430592271; Tue, 16 Jan 2024 10:43:12 -0800 (PST) Received: from hermes.lan (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id m8-20020a1709026bc800b001d60a70809bsm379238plt.168.2024.01.16.10.43.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 10:43:11 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , liang.j.ma@intel.com, Bruce Richardson , Tyler Retzlaff , Liang Ma , Peter Mccarthy , =?utf-8?q?Se=C3=A1n_Harte?= Subject: [PATCH v3 1/5] event/opdl: fix non-constant compile time assertion Date: Tue, 16 Jan 2024 10:41:11 -0800 Message-ID: <20240116184307.162882-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116184307.162882-1-stephen@networkplumber.org> References: <20231111172153.57461-1-stephen@networkplumber.org> <20240116184307.162882-1-stephen@networkplumber.org> 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 RTE_BUILD_BUG_ON() was being used with a non-constant value. The inline function rte_is_power_of_2() is not constant since inline expansion happens later in the compile process. Replace it with macro which will be constant. Fixes: 4236ce9bf5bf ("event/opdl: add OPDL ring infrastructure library") Cc: liang.j.ma@intel.com Signed-off-by: Stephen Hemminger Acked-by: Bruce Richardson Acked-by: Tyler Retzlaff --- drivers/event/opdl/opdl_ring.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/event/opdl/opdl_ring.c b/drivers/event/opdl/opdl_ring.c index 69392b56bbec..24e0bbe3222d 100644 --- a/drivers/event/opdl/opdl_ring.c +++ b/drivers/event/opdl/opdl_ring.c @@ -31,6 +31,9 @@ #define OPDL_OPA_MASK (0xFF) #define OPDL_OPA_OFFSET (0x38) +/* Equivalent to rte_is_power_of_2() but as macro. */ +#define IS_POWER_OF_2(x) (((x) & ((x) - 1)) == 0) + /* Types of dependency between stages */ enum dep_type { DEP_NONE = 0, /* no dependency */ @@ -910,7 +913,7 @@ opdl_ring_create(const char *name, uint32_t num_slots, uint32_t slot_size, RTE_CACHE_LINE_MASK) != 0); RTE_BUILD_BUG_ON((offsetof(struct opdl_ring, slots) & RTE_CACHE_LINE_MASK) != 0); - RTE_BUILD_BUG_ON(!rte_is_power_of_2(OPDL_DISCLAIMS_PER_LCORE)); + RTE_BUILD_BUG_ON(!IS_POWER_OF_2(OPDL_DISCLAIMS_PER_LCORE)); /* Parameter checking */ if (name == NULL) {