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 4B2B243A21; Wed, 31 Jan 2024 17:02:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C95814026B; Wed, 31 Jan 2024 17:02:35 +0100 (CET) Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by mails.dpdk.org (Postfix) with ESMTP id 8866A40269 for ; Wed, 31 Jan 2024 17:02:34 +0100 (CET) Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-6dddc5e34e2so873339b3a.0 for ; Wed, 31 Jan 2024 08:02:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1706716953; x=1707321753; 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=feKySxjiN4YXTnkEkLGUgteM/ESfJFsQY2IZp6Jq6aE=; b=Zu907x6mdNBirmtv+2OljLDbQWMJ8mFmZQzW6l0rEyyx66rFeYu06qsyL2Ti8MXc0M ugm9NxW0hVpaIm1xmvM3w65fohu67pZ0xUOGMfMy2Ov7rRhX9+bySSAF3ZzZdwTiHJWO WoHXC7Naj2rpa/2SIIHFAdLmDg7EpwEyRCBwJMkeHaiGWpGzfuwC2wHW1rGrys0heEt3 Mb6elFSHO/fGbbKkxvA+pk/6Pp8lf8WPxYK4s/5IsUf4+wCLK7Bz3YzQbC9DTlRWYlHy rv+JbI7h9g9hXeCAynT0B6K6LIbC69rs2PSj84yCxYDLhYsMMW0GpoXvwlPqINYmVS2P lKvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706716953; x=1707321753; 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=feKySxjiN4YXTnkEkLGUgteM/ESfJFsQY2IZp6Jq6aE=; b=XfBZqSkIspIRGqL3uYL2zoWUhAVN029Oa/ApZr+L0ZGkESdzBAdCptPpDUyQLqVpHX 7hFN3skG+Uy1BerIUE20/T34K6u3XVK8p5aKrOYfwvvme8jC6pCM95SLni/Qu54sXUrt hkhAlC7Qw615dAsk1m5Gqe5PmoTDsWxVgCr+jb6eEUeZ2hibOO7NmHeBscaBLQ+Zakx5 x8JwdvAZXiFrXzKzEjXsmKrYKF4CehVIu9BOqQv2fCQ/KCHh1bSAiRhMhU3ud20i8JIp xHdLFeSecMMejXTUjF84kV7IN5iqdMOyRsrN/5PM0drmis0D4SX8/pbXYMakmvfa7MG6 GmyQ== X-Gm-Message-State: AOJu0YzPc3Swfxf42kFYYZEpdtkJ9OSbgWMaFV4xdzoLj8PasmhFfJZS KRAXWdelUaeFz5+/Ckz84jgl2CzzgfRiLJBEewK+8NtiAbufZL6e7riO2M/ubhM= X-Google-Smtp-Source: AGHT+IGfpUdds0Madj2XZ162biq4+FWFeOMYIX/UtgbkQLmC8XRipCnOHKGKSzg2ckWVVo4bh5YPkw== X-Received: by 2002:a05:6a00:148e:b0:6d9:ba0b:dd72 with SMTP id v14-20020a056a00148e00b006d9ba0bdd72mr5011506pfu.17.1706716953533; Wed, 31 Jan 2024 08:02:33 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCXIfM/HpiiFM/xJA+Z63CrO2Ip8CaBXzOd+TE3/mIb62kGo6AaPiCwLYNKmMxzUfNI3LHT/D/iQZw3deh1YJ1unCCdyNORPmfPahdRhN1alhUCCskDUnKNrUCzES+RTbwhC8Qn3qFaVdprXAptLhdDPOP8092l4jbIDh+Ix2w== Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id u4-20020aa78484000000b006dbd7e5bd1esm10067979pfn.52.2024.01.31.08.02.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 08:02:33 -0800 (PST) Date: Wed, 31 Jan 2024 08:02:31 -0800 From: Stephen Hemminger To: Mattias =?UTF-8?B?UsO2bm5ibG9t?= Cc: , , Morten =?UTF-8?B?QnLDuHJ1cA==?= , Tyler Retzlaff Subject: Re: [RFC v3] eal: add bitset type Message-ID: <20240131080231.65cb67b8@hermes.local> In-Reply-To: <20240131131301.418361-1-mattias.ronnblom@ericsson.com> References: <20240131131301.418361-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 Wed, 31 Jan 2024 14:13:01 +0100 Mattias R=C3=B6nnblom wrote: > Introduce a set of functions and macros that operate on sets of bits, > kept in arrays of 64-bit elements. >=20 > RTE bitset is designed for bitsets which are larger than what fits in > a single machine word (i.e., 64 bits). For very large bitsets, the > API may be a more appropriate choice. >=20 > RFC v3: > * Split the bitset from the htimer patchset, where it was originally > hosted. > * Rebase to current DPDK main. > * Add note that rte_bitset_init() need not be called if bitset words > have already been zeroed. > * Use REGISTER_FAST_TEST instead of REGISTER_TEST_COMMAND. > * Use rte_popcount64() instead of compiler builtin. >=20 > RFC v2: > * Replaced with include, to properly get > size_t typedef. > * Add to get __rte_experimental in . >=20 > Signed-off-by: Mattias R=C3=B6nnblom > --- > app/test/meson.build | 1 + > app/test/test_bitset.c | 645 +++++++++++++++++++++++++ > lib/eal/common/meson.build | 1 + > lib/eal/common/rte_bitset.c | 29 ++ > lib/eal/include/meson.build | 1 + > lib/eal/include/rte_bitset.h | 884 +++++++++++++++++++++++++++++++++++ > lib/eal/version.map | 3 + > 7 files changed, 1564 insertions(+) > create mode 100644 app/test/test_bitset.c > create mode 100644 lib/eal/common/rte_bitset.c > create mode 100644 lib/eal/include/rte_bitset.h >=20 > diff --git a/app/test/meson.build b/app/test/meson.build > index dcc93f4a43..e218be11d8 100644 > --- a/app/test/meson.build > +++ b/app/test/meson.build > @@ -32,6 +32,7 @@ source_file_deps =3D { > 'test_bitcount.c': [], > 'test_bitmap.c': [], > 'test_bitops.c': [], > + 'test_bitset.c': [], > 'test_bitratestats.c': ['metrics', 'bitratestats', 'ethdev'] + sampl= e_packet_forward_deps, > 'test_bpf.c': ['bpf', 'net'], > 'test_byteorder.c': [], > diff --git a/app/test/test_bitset.c b/app/test/test_bitset.c > new file mode 100644 > index 0000000000..688349b03b > --- /dev/null > +++ b/app/test/test_bitset.c > @@ -0,0 +1,645 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2023 Ericsson AB > + */ > + > +#include > +#include > + > +#include > + > +#include > + > +#include "test.h" > + > +#define MAGIC UINT64_C(0xdeadbeefdeadbeef) > + > +static void > +rand_buf(void *buf, size_t n) > +{ > + size_t i; > + > + for (i =3D 0; i < n; i++) > + ((char *)buf)[i] =3D (char)rte_rand(); Cast to char unneeded, and you don't want signed character here. Use uint8_t