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 0C6164331D; Mon, 13 Nov 2023 18:06:24 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5AC9740A80; Mon, 13 Nov 2023 18:06:20 +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 3C54D4026C for ; Mon, 13 Nov 2023 18:06:17 +0100 (CET) Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1cc938f9612so28595255ad.1 for ; Mon, 13 Nov 2023 09:06:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1699895176; x=1700499976; 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=O3lHp3Qtm1WSSZq+4sy/uPptKpSnWkMsyUR0UupaX6E=; b=wBS8Crl4fjJUZ7OT0D0K+RJOJoliIHvXGNcCcSgnR0baAVQaWhzPxzOs+hrr3Vj8bU RbgZycKEY0gSQZ70jL7M8wFNIfqeoKgiaX4tLsDK6iLvm9kt7qr+akxvbF4ezozI93p7 OOoPkgRl3Tv+7ipmKk0BGwaCJ7Zq1b2NK7/bU4/FIEsLOS4oaflLxfDm1q6bsfLGssTA ycWPjwzBWWeh0vwzBAvsM7r7DvaalgfsYOhh0BuZVmkFRrqXI/fBePz93kNI36IuF9Xf pvMm4m9clRc/UMcdtzo3Vd4NTsUoVAtP57Oqh7wq9cN4BMMMpgEZtOrvS591T5+k/I/J 5Pag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699895176; x=1700499976; 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=O3lHp3Qtm1WSSZq+4sy/uPptKpSnWkMsyUR0UupaX6E=; b=B9JLUKbIQMevwy0F7nBC0a7XeKTVD/13yfIrJjsAYXZFico/pswdKlXFMVItHvGPQH P0yT9QgH5HJV//FZRjXXpgCOlbKJM+LvQpehjhPb4Q32iYm153HflISQHmlaZET1PaJz FKyd1CPHc0ggG9b9NclTM5kRAQf2k2rh2mNc4ona+OabGrmtbWY+z9VxlRiihaXy8RPp WHBT2/bibcPWsxohXpP9NxxRi6cd45dgb35sdhHB45XPrDgqmtXTkMD/jmtYYDFLECkI vEiywIMKlKCZaYM576gE/MxO4p/5qdo02tP28ozOdiRe0F3OEdwBNXpRogYu7PjMV7Qz qxhg== X-Gm-Message-State: AOJu0YybPfnkfMWBj0xicYL3poBFBE+Vkd42iWoN0KrU0IpOntkUHXv+ qW7G60me1S003X//px5eCIAdswuNSZpmUJWnm5w= X-Google-Smtp-Source: AGHT+IHw7zTtQSgIZBlLVL5hXUGLCMngBylHtb83DCcO3q/qVqYMuJQWZTXOB7HtR14QJ5Le3PS9YA== X-Received: by 2002:a17:902:a582:b0:1cc:32be:b13 with SMTP id az2-20020a170902a58200b001cc32be0b13mr106697plb.64.1699895176107; Mon, 13 Nov 2023 09:06:16 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id l4-20020a170902eb0400b001c61901ed2esm4232051plb.219.2023.11.13.09.06.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 09:06:15 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , liang.j.ma@intel.com, Liang Ma , Peter Mccarthy , =?UTF-8?q?Se=C3=A1n=20Harte?= Subject: [PATCH v2 1/3] event/opdl: fix non-constant compile time assertion Date: Mon, 13 Nov 2023 09:06:03 -0800 Message-Id: <20231113170605.408281-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231113170605.408281-1-stephen@networkplumber.org> References: <20231111172153.57461-1-stephen@networkplumber.org> <20231113170605.408281-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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) { -- 2.39.2