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 89535438E4; Wed, 17 Jan 2024 19:26:27 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 96A15410E7; Wed, 17 Jan 2024 19:26:00 +0100 (CET) Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by mails.dpdk.org (Postfix) with ESMTP id 0594640ED0 for ; Wed, 17 Jan 2024 19:25:56 +0100 (CET) Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-28e85db00d1so1343679a91.2 for ; Wed, 17 Jan 2024 10:25:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1705515955; x=1706120755; 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=VyJal8XhPWE5yAA11itU4Xb2rs4pO/W30a6Xj/Y2gnM=; b=mCaFga5HEMu98rsodBzDcVyuxitUMi/+pyy2JYCkq6kKLB8514PAxf8vrZK6mWlixI RDDlBPymrk3QMx/mLr5hW3moM5fn/Ogq33nAyK/cHR2eZTQRvEb1vc8xpRAQu8RrxOCP MKvap4wqo0rzYmpSH/Fijc3DNSN2T5GnYi4UiyvBhA78LD4MDEJTmzHmkgSZnuQ8AmvE omoPrt63i1gS+9dn9HNCiRN3GXdnZkF/g4Hd49IJ2Qh9uhe7OREryp0jezO5zNAT9KNc yWuge/zprRc/303vUck+VUNT/g/GjFu9N6ewV+OAJ39KHroNSl8JmesoW1eE+i+uGgAC 6VtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705515955; x=1706120755; 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=VyJal8XhPWE5yAA11itU4Xb2rs4pO/W30a6Xj/Y2gnM=; b=IvgWqxbDY5/4Gwx4cfuigpGBQXB0/31suycEMF4K0sbidzEGl3omXWclE2St2xftAH rrPAYc6Mknzs0zp13oRBQgSgTDRfzU7Jaf6IcWvZN255DSrL/zfC85sqXKbahpwYEzsM IcRj4yHJylC3Ex4KoV/REXsgX8SXY6DgmbmmuIpZRZ8VCr6Kz/QBwgOcU+Hj11XAn9a4 xSW9fKCHyA9Kv76JWuxHiWbVOVsGQZwpciTm+zeO8Z+DQfn/I2aAFj1ZlYEDDOE8BOpT SjVos0nuwt1k1bZRATStscjgI86Nmajs2KKG2Z30GXOIbzKy46mXfc/OmsV3F776hU2J zA7w== X-Gm-Message-State: AOJu0YzAg4+oZ2XkZvF6NwSKj/MIKkEFveWy8p5c8lrH69IYeSo7IatP R6S3/BDSNU84FsxJdDqb4hY3HZKLYrzkOWObKuVmqHTnn5GGZQ== X-Google-Smtp-Source: AGHT+IHgX3dC+CixunQBXOPSgeH3Q/nmsVKGQ0CXZ6fj85gpSDN4hpMncP4SR5PJ1LSsAjjA39JVIg== X-Received: by 2002:a17:90a:850c:b0:28e:8093:2764 with SMTP id l12-20020a17090a850c00b0028e80932764mr2009113pjn.1.1705515955313; Wed, 17 Jan 2024 10:25:55 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id qj15-20020a17090b28cf00b0028ce507cd7dsm14334124pjb.55.2024.01.17.10.25.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 10:25:55 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Dariusz Sosnowski , Viacheslav Ovsiienko , Ori Kam , Suanming Mou , Matan Azrad , Andrew Rybchenko , =?UTF-8?q?Morten=20Br=C3=B8rup?= Subject: [PATCH v4 5/6] mempool: avoid floating point expression in static assertion Date: Wed, 17 Jan 2024 10:19:59 -0800 Message-ID: <20240117182541.211125-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240117182541.211125-1-stephen@networkplumber.org> References: <20231111172153.57461-1-stephen@networkplumber.org> <20240117182541.211125-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 Clang does not handle casts in static_assert() expressions. It doesn't like use of floating point to calculate threshold. Use a different expression with same effect. Modify comment in mlx5 so that developers don't go searching for old value. Signed-off-by: Stephen Hemminger --- drivers/net/mlx5/mlx5_rxq.c | 2 +- lib/mempool/rte_mempool.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 1bb036afebb3..7d972b6d927c 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -1444,7 +1444,7 @@ mlx5_mprq_alloc_mp(struct rte_eth_dev *dev) /* * rte_mempool_create_empty() has sanity check to refuse large cache * size compared to the number of elements. - * CACHE_FLUSHTHRESH_MULTIPLIER is defined in a C file, so using a + * CALC_CACHE_FLUSHTHRESH() is defined in a C file, so using a * constant number 2 instead. */ obj_num = RTE_MAX(obj_num, MLX5_MPRQ_MP_CACHE_SZ * 2); diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c index b7a19bea7185..12390a2c8155 100644 --- a/lib/mempool/rte_mempool.c +++ b/lib/mempool/rte_mempool.c @@ -50,9 +50,10 @@ static void mempool_event_callback_invoke(enum rte_mempool_event event, struct rte_mempool *mp); -#define CACHE_FLUSHTHRESH_MULTIPLIER 1.5 -#define CALC_CACHE_FLUSHTHRESH(c) \ - ((typeof(c))((c) * CACHE_FLUSHTHRESH_MULTIPLIER)) +/* Note: avoid using floating point since that compiler + * may not think that is constant. + */ +#define CALC_CACHE_FLUSHTHRESH(c) (((c) * 3) / 2) #if defined(RTE_ARCH_X86) /* -- 2.43.0