From: "Mattias Rönnblom" <hofors@lysator.liu.se>
To: "Stephen Hemminger" <stephen@networkplumber.org>,
"Mattias Rönnblom" <mattias.ronnblom@ericsson.com>
Cc: dev@dpdk.org, "Morten Brørup" <mb@smartsharesystems.com>,
"Tyler Retzlaff" <roretzla@linux.microsoft.com>
Subject: Re: [RFC v3] eal: add bitset type
Date: Wed, 31 Jan 2024 17:28:49 +0100 [thread overview]
Message-ID: <bfda7680-f4e1-41b3-b693-9d5d74439b93@lysator.liu.se> (raw)
In-Reply-To: <20240131080231.65cb67b8@hermes.local>
On 2024-01-31 17:02, Stephen Hemminger wrote:
> On Wed, 31 Jan 2024 14:13:01 +0100
> Mattias Rönnblom <mattias.ronnblom@ericsson.com> 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
>> <rte_bitmap.h> 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 <sys/types.h> with <stddef.h> include, to properly get
>> size_t typedef.
>> * Add <rte_compat.h> to get __rte_experimental in <rte_bitset.h>.
>>
>> Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
>> ---
>> 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 <stdlib.h>
>> +#include <inttypes.h>
>> +
>> +#include <rte_random.h>
>> +
>> +#include <rte_bitset.h>
>> +
>> +#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.
next prev parent reply other threads:[~2024-01-31 16:28 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-31 13:13 Mattias Rönnblom
2024-01-31 16:02 ` Stephen Hemminger
2024-01-31 16:28 ` Mattias Rönnblom [this message]
2024-01-31 16:06 ` Stephen Hemminger
2024-01-31 18:45 ` Mattias Rönnblom
2024-02-01 8:04 ` Morten Brørup
2024-02-02 10:19 ` Mattias Rönnblom
2024-02-02 12:42 ` Morten Brørup
2024-02-16 10:23 ` [RFC v4 1/4] " Mattias Rönnblom
2024-02-16 10:23 ` [RFC v4 2/4] eal: add bitset test suite Mattias Rönnblom
2024-02-16 10:23 ` [RFC v4 3/4] service: use multi-word bitset to represent service flags Mattias Rönnblom
2024-02-16 10:23 ` [RFC v4 4/4] event/dsw: optimize serving port logic Mattias Rönnblom
2024-05-05 7:33 ` [RFC v5 1/6] eal: add bitset type Mattias Rönnblom
2024-05-05 7:33 ` [RFC v5 2/6] eal: add bitset test suite Mattias Rönnblom
2024-05-05 7:33 ` [RFC v5 3/6] eal: add atomic bitset functions Mattias Rönnblom
2024-05-05 7:33 ` [RFC v5 4/6] eal: add unit tests for atomic bitset operations Mattias Rönnblom
2024-05-05 7:33 ` [RFC v5 5/6] service: use multi-word bitset to represent service flags Mattias Rönnblom
2024-05-05 7:33 ` [RFC v5 6/6] event/dsw: optimize serving port logic Mattias Rönnblom
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bfda7680-f4e1-41b3-b693-9d5d74439b93@lysator.liu.se \
--to=hofors@lysator.liu.se \
--cc=dev@dpdk.org \
--cc=mattias.ronnblom@ericsson.com \
--cc=mb@smartsharesystems.com \
--cc=roretzla@linux.microsoft.com \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).