<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/tools/lib/bpf/ringbuf.c, branch v6.12.80</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.12.80</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.12.80'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2024-05-02T23:41:03+00:00</updated>
<entry>
<title>libbpf: fix ring_buffer__consume_n() return result logic</title>
<updated>2024-05-02T23:41:03+00:00</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andrii@kernel.org</email>
</author>
<published>2024-04-30T20:19:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=087d757fb4736ecbd3e42eebf9b39d5225d4a2ee'/>
<id>urn:sha1:087d757fb4736ecbd3e42eebf9b39d5225d4a2ee</id>
<content type='text'>
Add INT_MAX check to ring_buffer__consume_n(). We do the similar check
to handle int return result of all these ring buffer APIs in other APIs
and ring_buffer__consume_n() is missing one. This patch fixes this
omission.

Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Kumar Kartikeya Dwivedi &lt;memxor@gmail.com&gt;
Link: https://lore.kernel.org/r/20240430201952.888293-2-andrii@kernel.org
Signed-off-by: Martin KaFai Lau &lt;martin.lau@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: fix potential overflow in ring__consume_n()</title>
<updated>2024-05-02T23:41:02+00:00</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andrii@kernel.org</email>
</author>
<published>2024-04-30T20:19:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=00f0e08f23fc007f4a5a71cd7e37fcdb15af0c1b'/>
<id>urn:sha1:00f0e08f23fc007f4a5a71cd7e37fcdb15af0c1b</id>
<content type='text'>
ringbuf_process_ring() return int64_t, while ring__consume_n() assigns
it to int. It's highly unlikely, but possible for ringbuf_process_ring()
to return value larger than INT_MAX, so use int64_t. ring__consume_n()
does check INT_MAX before returning int result to the user.

Fixes: 4d22ea94ea33 ("libbpf: Add ring__consume_n / ring_buffer__consume_n")
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Kumar Kartikeya Dwivedi &lt;memxor@gmail.com&gt;
Link: https://lore.kernel.org/r/20240430201952.888293-1-andrii@kernel.org
Signed-off-by: Martin KaFai Lau &lt;martin.lau@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: Add ring__consume_n / ring_buffer__consume_n</title>
<updated>2024-04-06T16:11:55+00:00</updated>
<author>
<name>Andrea Righi</name>
<email>andrea.righi@canonical.com</email>
</author>
<published>2024-04-06T09:15:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4d22ea94ea33550538b3b14429d52cb9f96ad2c3'/>
<id>urn:sha1:4d22ea94ea33550538b3b14429d52cb9f96ad2c3</id>
<content type='text'>
Introduce a new API to consume items from a ring buffer, limited to a
specified amount, and return to the caller the actual number of items
consumed.

Signed-off-by: Andrea Righi &lt;andrea.righi@canonical.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/lkml/20240310154726.734289-1-andrea.righi@canonical.com/T
Link: https://lore.kernel.org/bpf/20240406092005.92399-4-andrea.righi@canonical.com
</content>
</entry>
<entry>
<title>libbpf: ringbuf: Allow to consume up to a certain amount of items</title>
<updated>2024-04-06T16:11:54+00:00</updated>
<author>
<name>Andrea Righi</name>
<email>andrea.righi@canonical.com</email>
</author>
<published>2024-04-06T09:15:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=13e8125a22763557d719db996f70c71f77c9509c'/>
<id>urn:sha1:13e8125a22763557d719db996f70c71f77c9509c</id>
<content type='text'>
In some cases, instead of always consuming all items from ring buffers
in a greedy way, we may want to consume up to a certain amount of items,
for example when we need to copy items from the BPF ring buffer to a
limited user buffer.

This change allows to set an upper limit to the amount of items consumed
from one or more ring buffers.

Signed-off-by: Andrea Righi &lt;andrea.righi@canonical.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20240406092005.92399-3-andrea.righi@canonical.com
</content>
</entry>
<entry>
<title>libbpf: Add ring__consume</title>
<updated>2023-09-25T23:22:43+00:00</updated>
<author>
<name>Martin Kelly</name>
<email>martin.kelly@crowdstrike.com</email>
</author>
<published>2023-09-25T21:50:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=16058ff28b7eedd62f1643beb841e3bd611674fe'/>
<id>urn:sha1:16058ff28b7eedd62f1643beb841e3bd611674fe</id>
<content type='text'>
Add ring__consume to consume a single ringbuffer, analogous to
ring_buffer__consume.

Signed-off-by: Martin Kelly &lt;martin.kelly@crowdstrike.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20230925215045.2375758-14-martin.kelly@crowdstrike.com
</content>
</entry>
<entry>
<title>libbpf: Add ring__map_fd</title>
<updated>2023-09-25T23:22:43+00:00</updated>
<author>
<name>Martin Kelly</name>
<email>martin.kelly@crowdstrike.com</email>
</author>
<published>2023-09-25T21:50:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ae769390377adaec2798bd1a69171f00d0a25be0'/>
<id>urn:sha1:ae769390377adaec2798bd1a69171f00d0a25be0</id>
<content type='text'>
Add ring__map_fd to get the file descriptor underlying a given
ringbuffer.

Signed-off-by: Martin Kelly &lt;martin.kelly@crowdstrike.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20230925215045.2375758-12-martin.kelly@crowdstrike.com
</content>
</entry>
<entry>
<title>libbpf: Add ring__size</title>
<updated>2023-09-25T23:22:43+00:00</updated>
<author>
<name>Martin Kelly</name>
<email>martin.kelly@crowdstrike.com</email>
</author>
<published>2023-09-25T21:50:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e79abf717fce6439022547124571dfe17f2ac15a'/>
<id>urn:sha1:e79abf717fce6439022547124571dfe17f2ac15a</id>
<content type='text'>
Add ring__size to get the total size of a given ringbuffer.

Signed-off-by: Martin Kelly &lt;martin.kelly@crowdstrike.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20230925215045.2375758-10-martin.kelly@crowdstrike.com
</content>
</entry>
<entry>
<title>libbpf: Add ring__avail_data_size</title>
<updated>2023-09-25T23:22:42+00:00</updated>
<author>
<name>Martin Kelly</name>
<email>martin.kelly@crowdstrike.com</email>
</author>
<published>2023-09-25T21:50:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3b34d2972612299fb38ad7f3c2bc62c2d03237f3'/>
<id>urn:sha1:3b34d2972612299fb38ad7f3c2bc62c2d03237f3</id>
<content type='text'>
Add ring__avail_data_size for querying the currently available data in
the ringbuffer, similar to the BPF_RB_AVAIL_DATA flag in
bpf_ringbuf_query. This is racy during ongoing operations but is still
useful for overall information on how a ringbuffer is behaving.

Signed-off-by: Martin Kelly &lt;martin.kelly@crowdstrike.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20230925215045.2375758-8-martin.kelly@crowdstrike.com
</content>
</entry>
<entry>
<title>libbpf: Add ring__producer_pos, ring__consumer_pos</title>
<updated>2023-09-25T23:22:42+00:00</updated>
<author>
<name>Martin Kelly</name>
<email>martin.kelly@crowdstrike.com</email>
</author>
<published>2023-09-25T21:50:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=059a8c0c5acd37ecfa64f1832e8765d30f253ce8'/>
<id>urn:sha1:059a8c0c5acd37ecfa64f1832e8765d30f253ce8</id>
<content type='text'>
Add APIs to get the producer and consumer position for a given
ringbuffer.

Signed-off-by: Martin Kelly &lt;martin.kelly@crowdstrike.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20230925215045.2375758-6-martin.kelly@crowdstrike.com
</content>
</entry>
<entry>
<title>libbpf: Add ring_buffer__ring</title>
<updated>2023-09-25T23:22:42+00:00</updated>
<author>
<name>Martin Kelly</name>
<email>martin.kelly@crowdstrike.com</email>
</author>
<published>2023-09-25T21:50:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1c97f6afd73934881ae8514c51efc8e162b4b406'/>
<id>urn:sha1:1c97f6afd73934881ae8514c51efc8e162b4b406</id>
<content type='text'>
Add a new function ring_buffer__ring, which exposes struct ring * to the
user, representing a single ringbuffer.

Signed-off-by: Martin Kelly &lt;martin.kelly@crowdstrike.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20230925215045.2375758-4-martin.kelly@crowdstrike.com
</content>
</entry>
</feed>
