<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c, branch linux-5.17.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.17.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.17.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2021-11-25T22:37:38Z</updated>
<entry>
<title>selftests/bpf: Migrate selftests to bpf_map_create()</title>
<updated>2021-11-25T22:37:38Z</updated>
<author>
<name>Andrii Nakryiko</name>
</author>
<published>2021-11-24T19:32:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2fe256a429cb6c0b0064563af4158470143a363c'/>
<id>urn:sha1:2fe256a429cb6c0b0064563af4158470143a363c</id>
<content type='text'>
Conversion is straightforward for most cases. In few cases tests are
using mutable map_flags and attribute structs, but bpf_map_create_opts
can be used in the similar fashion, so there were no problems. Just lots
of repetitive conversions.

Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Link: https://lore.kernel.org/bpf/20211124193233.3115996-5-andrii@kernel.org
</content>
</entry>
<entry>
<title>selftests/bpf: Turn on libbpf 1.0 mode and fix all IS_ERR checks</title>
<updated>2021-05-26T00:32:35Z</updated>
<author>
<name>Andrii Nakryiko</name>
</author>
<published>2021-05-25T03:59:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bad2e478af3b4df9fd84b4db7779ea91bd618c16'/>
<id>urn:sha1:bad2e478af3b4df9fd84b4db7779ea91bd618c16</id>
<content type='text'>
Turn ony libbpf 1.0 mode. Fix all the explicit IS_ERR checks that now will be
broken because libbpf returns NULL on error (and sets errno). Fix
ASSERT_OK_PTR and ASSERT_ERR_PTR to work for both old mode and new modes and
use them throughout selftests. This is trivial to do by using
libbpf_get_error() API that all libbpf users are supposed to use, instead of
IS_ERR checks.

A bunch of checks also did explicit -1 comparison for various fd-returning
APIs. Such checks are replaced with &gt;= 0 or &lt; 0 cases.

There were also few misuses of bpf_object__find_map_by_name() in test_maps.
Those are fixed in this patch as well.

Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Acked-by: John Fastabend &lt;john.fastabend@gmail.com&gt;
Acked-by: Toke Høiland-Jørgensen &lt;toke@redhat.com&gt;
Link: https://lore.kernel.org/bpf/20210525035935.1461796-3-andrii@kernel.org
</content>
</entry>
<entry>
<title>selftests/bpf: Add a test case for loading BPF_SK_SKB_VERDICT</title>
<updated>2021-04-01T17:56:14Z</updated>
<author>
<name>Cong Wang</name>
</author>
<published>2021-03-31T02:32:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8d7cb74f2ccb5486ab8c631a8fcdc7621bbbc42c'/>
<id>urn:sha1:8d7cb74f2ccb5486ab8c631a8fcdc7621bbbc42c</id>
<content type='text'>
This adds a test case to ensure BPF_SK_SKB_VERDICT and
BPF_SK_STREAM_VERDICT will never be attached at the same time.

Signed-off-by: Cong Wang &lt;cong.wang@bytedance.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20210331023237.41094-17-xiyou.wangcong@gmail.com
</content>
</entry>
<entry>
<title>bpf: Remove extra lock_sock for TCP_ZEROCOPY_RECEIVE</title>
<updated>2021-01-20T22:23:00Z</updated>
<author>
<name>Stanislav Fomichev</name>
</author>
<published>2021-01-15T16:34:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9cacf81f8161111db25f98e78a7a0e32ae142b3f'/>
<id>urn:sha1:9cacf81f8161111db25f98e78a7a0e32ae142b3f</id>
<content type='text'>
Add custom implementation of getsockopt hook for TCP_ZEROCOPY_RECEIVE.
We skip generic hooks for TCP_ZEROCOPY_RECEIVE and have a custom
call in do_tcp_getsockopt using the on-stack data. This removes
3% overhead for locking/unlocking the socket.

Without this patch:
     3.38%     0.07%  tcp_mmap  [kernel.kallsyms]  [k] __cgroup_bpf_run_filter_getsockopt
            |
             --3.30%--__cgroup_bpf_run_filter_getsockopt
                       |
                        --0.81%--__kmalloc

With the patch applied:
     0.52%     0.12%  tcp_mmap  [kernel.kallsyms]  [k] __cgroup_bpf_run_filter_getsockopt_kern

Note, exporting uapi/tcp.h requires removing netinet/tcp.h
from test_progs.h because those headers have confliciting
definitions.

Signed-off-by: Stanislav Fomichev &lt;sdf@google.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Acked-by: Martin KaFai Lau &lt;kafai@fb.com&gt;
Link: https://lore.kernel.org/bpf/20210115163501.805133-2-sdf@google.com
</content>
</entry>
<entry>
<title>selftests/bpf: Properly initialize linfo in sockmap_basic</title>
<updated>2020-10-02T14:47:32Z</updated>
<author>
<name>Stanislav Fomichev</name>
</author>
<published>2020-10-02T00:04:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=48ca6243c6adf1a3d7e7a0fd519ba918eb7b00ca'/>
<id>urn:sha1:48ca6243c6adf1a3d7e7a0fd519ba918eb7b00ca</id>
<content type='text'>
When using -Werror=missing-braces, compiler complains about missing braces.
Let's use use ={} initialization which should do the job:

tools/testing/selftests/bpf/prog_tests/sockmap_basic.c: In function 'test_sockmap_iter':
tools/testing/selftests/bpf/prog_tests/sockmap_basic.c:181:8: error: missing braces around initializer [-Werror=missing-braces]
  union bpf_iter_link_info linfo = {0};
        ^
tools/testing/selftests/bpf/prog_tests/sockmap_basic.c:181:8: error: (near initialization for 'linfo.map') [-Werror=missing-braces]
tools/testing/selftests/bpf/prog_tests/sockmap_basic.c: At top level:

Signed-off-by: Stanislav Fomichev &lt;sdf@google.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Link: https://lore.kernel.org/bpf/20201002000451.1794044-1-sdf@google.com
</content>
</entry>
<entry>
<title>selftest: bpf: Test copying a sockmap and sockhash</title>
<updated>2020-09-28T23:48:02Z</updated>
<author>
<name>Lorenz Bauer</name>
</author>
<published>2020-09-28T09:08:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5b87adc3ceee3c3131e24e9bc9ef92dd41db089f'/>
<id>urn:sha1:5b87adc3ceee3c3131e24e9bc9ef92dd41db089f</id>
<content type='text'>
Since we can now call map_update_elem(sockmap) from bpf_iter context
it's possible to copy a sockmap or sockhash in the kernel. Add a
selftest which exercises this.

Signed-off-by: Lorenz Bauer &lt;lmb@cloudflare.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20200928090805.23343-5-lmb@cloudflare.com
</content>
</entry>
<entry>
<title>selftests: bpf: Remove shared header from sockmap iter test</title>
<updated>2020-09-28T23:48:02Z</updated>
<author>
<name>Lorenz Bauer</name>
</author>
<published>2020-09-28T09:08:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=27870317337a6c24af503304620de8064c8d2e4a'/>
<id>urn:sha1:27870317337a6c24af503304620de8064c8d2e4a</id>
<content type='text'>
The shared header to define SOCKMAP_MAX_ENTRIES is a bit overkill.
Dynamically allocate the sock_fd array based on bpf_map__max_entries
instead.

Suggested-by: Yonghong Song &lt;yhs@fb.com&gt;
Signed-off-by: Lorenz Bauer &lt;lmb@cloudflare.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Link: https://lore.kernel.org/bpf/20200928090805.23343-4-lmb@cloudflare.com
</content>
</entry>
<entry>
<title>selftests: bpf: Add helper to compare socket cookies</title>
<updated>2020-09-28T23:47:58Z</updated>
<author>
<name>Lorenz Bauer</name>
</author>
<published>2020-09-28T09:08:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=26c3270ddb4955be358c888766ad1a6105dd7469'/>
<id>urn:sha1:26c3270ddb4955be358c888766ad1a6105dd7469</id>
<content type='text'>
We compare socket cookies to ensure that insertion into a sockmap worked.
Pull this out into a helper function for use in other tests.

Signed-off-by: Lorenz Bauer &lt;lmb@cloudflare.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20200928090805.23343-3-lmb@cloudflare.com
</content>
</entry>
<entry>
<title>selftests: bpf: Test iterating a sockmap</title>
<updated>2020-09-10T19:35:26Z</updated>
<author>
<name>Lorenz Bauer</name>
</author>
<published>2020-09-09T16:27:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2f7de9865ba3cbfcf8b504f07154fdb6124176a4'/>
<id>urn:sha1:2f7de9865ba3cbfcf8b504f07154fdb6124176a4</id>
<content type='text'>
Add a test that exercises a basic sockmap / sockhash iteration. For
now we simply count the number of elements seen. Once sockmap update
from iterators works we can extend this to perform a full copy.

Signed-off-by: Lorenz Bauer &lt;lmb@cloudflare.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20200909162712.221874-4-lmb@cloudflare.com
</content>
</entry>
<entry>
<title>selftests: bpf: Fix sockmap update nits</title>
<updated>2020-08-24T21:51:46Z</updated>
<author>
<name>Lorenz Bauer</name>
</author>
<published>2020-08-24T08:45:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8c3b3d971f2e4d72d8768457c40b513ca5d1f906'/>
<id>urn:sha1:8c3b3d971f2e4d72d8768457c40b513ca5d1f906</id>
<content type='text'>
Address review by Yonghong, to bring the new tests in line with the
usual code style.

Signed-off-by: Lorenz Bauer &lt;lmb@cloudflare.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Link: https://lore.kernel.org/bpf/20200824084523.13104-1-lmb@cloudflare.com
</content>
</entry>
</feed>
