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 AAD70438F4; Thu, 18 Jan 2024 17:54:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E85E542E1E; Thu, 18 Jan 2024 17:53:33 +0100 (CET) Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by mails.dpdk.org (Postfix) with ESMTP id A4A3342E01 for ; Thu, 18 Jan 2024 17:53:30 +0100 (CET) Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1d711d7a940so4821155ad.1 for ; Thu, 18 Jan 2024 08:53:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1705596810; x=1706201610; 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=X9xmfmIVA6kPAe6f9/4Re4t1OC9GO47PM9ilU44RqAs=; b=zZ7Sj2bI+fZqULUgl0LmHx7x7n3UXYcT2ncpRhmYkOdVwPqaJWb0snXbJ71OSt/wbW 1s+lnBpKGs3TvFNcZMBqS4/3fO6aDasoudMSV+I5Lq7UnZg1xJZDtwKc8bnA6Bqm4Ur+ wBX3xK8RYBT/KR8ks3SoT7Hp6V7R2jocvOqYbdLrVT429wfzcdY5WQiY3AZiodLoW9Le D52jwC/UsLQ8+AlvNgXG89vRodJ8OAuqif83zFKRQuq8Xte/cVXjHpxv5xPzTZWJEUwe Ty06aRUQrfS9YzzlTRI0eQJoOCijPAapBk2qh1Hj97UqvkxdqIwGlB8bLMf9lMOTkqgn usjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705596810; x=1706201610; 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=X9xmfmIVA6kPAe6f9/4Re4t1OC9GO47PM9ilU44RqAs=; b=wVLW6LyBTJDJXDwQ6GvimWFPr4Aas8aPySg+Wt/bWhaFcE50+88e2gKoJAeREbwEUG CL75snGRY3F8TeBSk33WLIIcXo9kW887SrIUS2+yjD3YbwpgRybSV+ULG/JXZdbJVuvg YjnKqM7NTTUOKPzFOR+BaFFB/6Ie7JOm/Nv5GfNqVi0r+3morZf7Hq150letXFeId0Xe quQE+5e8hbVxZs5asj9W+IdNWjR3pOTb3EfkstfOVH/f5CtfrGJBOl/C9DmP/LhCDCU1 uuxE7KuLtUfGsrxO89NLqSnXqHHastnvzw0vYJ2HsTrRKgdnk8Ftw00u1E0KjPLfscBv rtwA== X-Gm-Message-State: AOJu0YwUxF390qo2igejjFuLTdhIZ857F1JlDeDj0QTF251pTCHsSmqs p/476SzhlR/TJnV7oKPUPCs4eBWxhkI6Xxs0rXEe2A2oSecqjp8pwBHOgEWozDeZ/AwLo3e1tWB hLMg= X-Google-Smtp-Source: AGHT+IGKaHkRtmMEyRJ2HYzP79SzDJ5BMHg2fULmI0B0baoQDGPalMDsWzLubiei40klBYtdhtg5lw== X-Received: by 2002:a17:903:2696:b0:1d6:f87f:7627 with SMTP id jf22-20020a170903269600b001d6f87f7627mr1099809plb.130.1705596809901; Thu, 18 Jan 2024 08:53:29 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id u2-20020a170903304200b001d706912d1esm1427980pla.225.2024.01.18.08.53.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 08:53:29 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Konstantin Ananyev , Andrew Rybchenko , Dariusz Sosnowski , Viacheslav Ovsiienko , Ori Kam , Suanming Mou , Matan Azrad , =?UTF-8?q?Morten=20Br=C3=B8rup?= Subject: [PATCH v5 5/6] mempool: avoid floating point expression in static assertion Date: Thu, 18 Jan 2024 08:51:00 -0800 Message-ID: <20240118165315.63959-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240118165315.63959-1-stephen@networkplumber.org> References: <20231111172153.57461-1-stephen@networkplumber.org> <20240118165315.63959-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 Acked-by: Konstantin Ananyev Reviewed-by: Andrew Rybchenko --- 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..ca2eeedc9de3 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