summaryrefslogtreecommitdiff
path: root/net/core/net_test.c
AgeCommit message (Collapse)Author
11 daysnetmem: rename get/put_netmem() to netmem_inc/dec_ref()Mina Almasry
Follow the object_action() naming convention for netmem non-page_pool reference helpers by renaming get_netmem() and put_netmem() to netmem_inc_ref() and netmem_dec_ref(). Use netmem_inc_ref() and netmem_dec_ref() rather than netmem_ref() and netmem_unref() because netmem_ref is already a typedef (typedef unsigned long __bitwise netmem_ref). Suggested-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Mina Almasry <almasrymina@google.com> Link: https://patch.msgid.link/20261021015558.4124825-3-almasrymina@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11 daysnetmem: rename get/put_net_iov() to net_iov_inc/dec_ref()Mina Almasry
Follow the object_action() naming convention for net_iov non-page_pool reference helpers by renaming get_net_iov() and put_net_iov() to net_iov_inc_ref() and net_iov_dec_ref(), and renaming net_devmem_get_net_iov() and net_devmem_put_net_iov() to net_devmem_net_iov_inc_ref() and net_devmem_net_iov_dec_ref(). Use *_inc_ref() and *_dec_ref() rather than *_ref() and *_unref() to pair symmetrically with netmem_inc_ref() and netmem_dec_ref() (since netmem_ref is already the typedef for the generic network memory handle). Suggested-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Mina Almasry <almasrymina@google.com> Link: https://patch.msgid.link/20261021015558.4124825-2-almasrymina@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
12 daysnet: Port skb_segment tests of the test_bpf module to KUnitDaniel Borkmann
The old test_bpf module is going away, therefore port the two test cases which were added in 76db8087c4c9 ("net: bpf: add a test for skb_segment in test_bpf module") as well as cf204a718357 ("bpf, testing: Introduce 'gso_linear_no_head_frag' skb_segment test") into the net_test.c to retain coverage. With it in place: # Subtest: gso_test_func ok 1 no_gso ok 2 linear ok 3 frags ok 4 frags_pure ok 5 gso_partial ok 6 frag_list ok 7 frag_list_pure ok 8 frag_list_non_uniform ok 9 frag_list_head_frag ok 10 frag_list_no_head_frag ok 11 gso_by_frags ok 12 resegment ok 13 resegment_multi ok 14 resegment_tail ok 15 resegment_one_mss # gso_test_func: pass:15 fail:0 skip:0 total:15 Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Cc: Willem de Bruijn <willemb@google.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20261015151033.591439-1-daniel@iogearbox.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
12 daysnet: kunit: test netmem, page_pool, and skb frag refcountingMina Almasry
Verify that non-pp (page._refcount / binding->ref) and page_pool (pp_ref_count) references stay balanced without cross-counter leaks or underflows across regular pages, page_pool pages, non-pp net_iovs, and page_pool net_iovs with both pp_recycle=0 and pp_recycle=1. Cover get/put_net_iov(), get/put_netmem(), napi_pp_get/put_page(), skb_netmem_ref/unref(), skb_frag_ref/unref(), pskb_copy(), skb_zerocopy(), skb_shift(), skb_split(), skb_try_coalesce(), skb_release_data() (clones, unclone ordering, pskb_extract(), and skb_morph()), skb_segment(), and devmem tcp_recvmsg_dmabuf() / SO_DEVMEM_DONTNEED. Export skb_shift() via EXPORT_SYMBOL_IF_KUNIT() so the test links when built as a module (CONFIG_NET_TEST=m). Assisted-by: LLM Signed-off-by: Mina Almasry <almasrymina@google.com> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Link: https://patch.msgid.link/20261014173945.373295-7-almasrymina@google.com Acked-by: Stanislav Fomichev <sdf@fomichev.me> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-10-13net: net_test: add tests for TCP re-segmentationWang Zhan
The GSO engine can now be asked to group several MSS segments into one output skb, which is what re-segmentation needs. Add KUnit coverage for the max_segs parameter. The parameterized GSO test gains a max_segs input and four cases: a limit of two MSS applied to a 3003 byte and to a 5003 byte payload, a tail which holds one MSS and is therefore not a GSO skb, and a max_segs of one MSS which must leave the output unchanged. It drives skb_segment() directly, because the synthetic protocol it uses has no gso_segment callback. Assisted-by: LLM Signed-off-by: Wang Zhan <wang.zhan@smartx.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20261008100651.2534957-7-wang.zhan@smartx.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2024-04-01pfcp: always set pfcp metadataMichal Swiatkowski
In PFCP receive path set metadata needed by flower code to do correct classification based on this metadata. Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com> Signed-off-by: Marcin Szycik <marcin.szycik@linux.intel.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2024-04-01net: net_test: add tests for IP tunnel flags conversion helpersAlexander Lobakin
Now that there are helpers for converting IP tunnel flags between the old __be16 format and the bitmap format, make sure they work as expected by adding a couple of tests to the networking testing suite. The helpers are all inline, so no dependencies on the related CONFIG_* (or a standalone module) are needed. Cover three possible cases: 1. No bits past BIT(15) are set, VTI/SIT bits are not set. This conversion is almost a direct assignment. 2. No bits past BIT(15) are set, but VTI/SIT bit is set. During the conversion, it must be transformed into BIT(16) in the bitmap, but still compatible with the __be16 format. 3. The bitmap has bits past BIT(15) set (not the VTI/SIT one). The result will be truncated. Note that currently __IP_TUNNEL_FLAG_NUM is 17 (incl. special), which means that the result of this case is currently semi-false-positive. When BIT(17) is finally here, it will be adjusted accordingly. Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>