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 C36F643A21; Wed, 31 Jan 2024 17:28:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4F8FF4026B; Wed, 31 Jan 2024 17:28:53 +0100 (CET) Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) by mails.dpdk.org (Postfix) with ESMTP id BDB4D40269 for ; Wed, 31 Jan 2024 17:28:52 +0100 (CET) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 5CF4517CC2 for ; Wed, 31 Jan 2024 17:28:52 +0100 (CET) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id 512B117D3A; Wed, 31 Jan 2024 17:28:52 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on hermod.lysator.liu.se X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=ALL_TRUSTED,AWL, T_SCC_BODY_TEXT_LINE autolearn=disabled version=4.0.0 X-Spam-Score: -1.4 Received: from [192.168.1.59] (h-62-63-215-114.A163.priv.bahnhof.se [62.63.215.114]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id EC7C917D36; Wed, 31 Jan 2024 17:28:49 +0100 (CET) Message-ID: Date: Wed, 31 Jan 2024 17:28:49 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC v3] eal: add bitset type Content-Language: en-US To: Stephen Hemminger , =?UTF-8?Q?Mattias_R=C3=B6nnblom?= Cc: dev@dpdk.org, =?UTF-8?Q?Morten_Br=C3=B8rup?= , Tyler Retzlaff References: <20240131131301.418361-1-mattias.ronnblom@ericsson.com> <20240131080231.65cb67b8@hermes.local> From: =?UTF-8?Q?Mattias_R=C3=B6nnblom?= In-Reply-To: <20240131080231.65cb67b8@hermes.local> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP 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 2024-01-31 17:02, Stephen Hemminger wrote: > On Wed, 31 Jan 2024 14:13:01 +0100 > Mattias Rönnblom wrote: > >> Introduce a set of functions and macros that operate on sets of bits, >> kept in arrays of 64-bit elements. >> >> 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. >> >> 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. >> >> RFC v2: >> * Replaced with include, to properly get >> size_t typedef. >> * Add to get __rte_experimental in . >> >> Signed-off-by: Mattias Rönnblom >> --- >> 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 >> >> 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 = { >> 'test_bitcount.c': [], >> 'test_bitmap.c': [], >> 'test_bitops.c': [], >> + 'test_bitset.c': [], >> 'test_bitratestats.c': ['metrics', 'bitratestats', 'ethdev'] + sample_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 = 0; i < n; i++) >> + ((char *)buf)[i] = (char)rte_rand(); > Cast to char unneeded, and you don't want signed character here. > Use uint8_t Going through a char pointer is useful in that it never aliases some other type. I'll change it to unsigned char. Thanks.