Re: [PATCH v3 bpf 1/2] bpf: skip non exist keys in generic_map_lookup_batch

2025-02-10 Thread Yan Zhai
Hi Brian, Jiri thanks for the comments. On Mon, Feb 10, 2025 at 8:47 AM Brian Vazquez wrote: > > On Mon, Feb 10, 2025 at 4:19 AM Jiri Olsa wrote: > > > > On Sun, Feb 09, 2025 at 11:22:35PM -0800, Yan Zhai wrote: > > > The generic_map_lookup_batch currently ret

[PATCH v3 bpf 2/2] selftests: bpf: test batch lookup on array of maps with holes

2025-02-09 Thread Yan Zhai
Iterating through array of maps may encounter non existing keys. The batch operation should not fail on when this happens. Signed-off-by: Yan Zhai Acked-by: Hou Tao --- .../bpf/map_tests/map_in_map_batch_ops.c | 62 +-- 1 file changed, 44 insertions(+), 18 deletions

[PATCH v3 bpf 1/2] bpf: skip non exist keys in generic_map_lookup_batch

2025-02-09 Thread Yan Zhai
ps://lore.kernel.org/bpf/Z6JXtA1M5jAZx8xD@debian.debian/ Signed-off-by: Yan Zhai Acked-by: Hou Tao --- v2->v3: deleted a used macro v1->v2: incorporate more useful information inside commit message. --- kernel/bpf/syscall.c | 18 +- 1 file changed, 5 insertions(+), 13 deletions(-)

[PATCH v3 bpf 0/2] bpf: skip non exist keys in generic_map_lookup_batch

2025-02-09 Thread Yan Zhai
xisting key, and does not return EINTR any more. V2->V3: deleted a unused macro V1->V2: split the fix and selftests; fixed a few selftests issues. V2: https://lore.kernel.org/bpf/cover.1738905497.git@cloudflare.com/ V1: https://lore.kernel.org/bpf/Z6OYbS4WqQnmzi2z@debian.debian/ Yan

[PATCH v2 bpf 2/2] selftests: bpf: test batch lookup on array of maps with holes

2025-02-06 Thread Yan Zhai
Iterating through array of maps may encounter non existing keys. The batch operation should not fail on when this happens. Signed-off-by: Yan Zhai --- .../bpf/map_tests/map_in_map_batch_ops.c | 62 +-- 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/tools

[PATCH v2 bpf 1/2] bpf: skip non exist keys in generic_map_lookup_batch

2025-02-06 Thread Yan Zhai
ps://lore.kernel.org/bpf/Z6JXtA1M5jAZx8xD@debian.debian/ Signed-off-by: Yan Zhai --- v1->v2: incorporate more useful information inside commit message. v1: https://lore.kernel.org/bpf/Z6OYbS4WqQnmzi2z@debian.debian/ --- kernel/bpf/syscall.c | 16 +--- 1 file changed, 5 insertions(+), 11 delet

[PATCH v2 bpf 0/2] bpf: skip non exist keys in

2025-02-06 Thread Yan Zhai
avior by skipping the non-existing key, and does not return EINTR any more. V1->V2: split the fix and selftests; fixed a few selftests issues. V1: https://lore.kernel.org/bpf/Z6OYbS4WqQnmzi2z@debian.debian/ Yan Zhai (2): bpf: skip non exist keys in generic_map_lookup_batch selftests: bpf: t

Re: [PATCH bpf] bpf: skip non existing key in generic_map_lookup_batch

2025-02-06 Thread Yan Zhai
On Thu, Feb 6, 2025 at 2:20 AM Yan Zhai wrote: > > On Thu, Feb 6, 2025 at 12:40 AM Hou Tao wrote: > > > > > > > > Yes, the retry logic doesn't change the previous key. Thanks for the > > clarifying. > > > And by "skipping to the

Re: [PATCH bpf] bpf: skip non existing key in generic_map_lookup_batch

2025-02-06 Thread Yan Zhai
On Thu, Feb 6, 2025 at 12:40 AM Hou Tao wrote: > > Hi, > > On 2/6/2025 12:57 AM, Yan Zhai wrote: > > The generic_map_lookup_batch currently returns EINTR if it fails with > > ENOENT and retries several times on bpf_map_copy_value. The next batch > > would start fro

[PATCH bpf] bpf: skip non existing key in generic_map_lookup_batch

2025-02-05 Thread Yan Zhai
f it finds a non existing element, skip to the next key. Fixes: cb4d03ab499d ("bpf: Add generic support for lookup batch op") Closes: https://lore.kernel.org/bpf/Z6JXtA1M5jAZx8xD@debian.debian/ Signed-off-by: Yan Zhai --- kernel/bpf/syscall.c | 16 ++ .../b

[PATCH v3 net] udp: gso: do not drop small packets when PMTU reduces

2025-01-31 Thread Yan Zhai
smaller than requested gso_size, and return EMSGSIZE instead of EINVAL on MTU/PMTU check failure to be more specific on the error cause. Fixes: 4094871db1d6 ("udp: only do GSO if # of segs > 1") Signed-off-by: Yan Zhai Suggested-by: Willem de Bruijn --- v2->v3: simplify the code;

Re: [PATCH v2 net] udp: gso: do not drop small packets when PMTU reduces

2025-01-30 Thread Yan Zhai
On Thu, Jan 30, 2025 at 9:35 AM Willem de Bruijn wrote: > > Yan Zhai wrote: > > Commit 4094871db1d6 ("udp: only do GSO if # of segs > 1") avoided GSO > > for small packets. But the kernel currently dismisses GSO requests only > > after checking MTU/PMT

Re: [PATCH] udp: gso: fix MTU check for small packets

2025-01-29 Thread Yan Zhai
v2 link here: https://lore.kernel.org/netdev/Z5swit7ykNRbJFMS@debian.debian/T/#u On Wed, Jan 29, 2025 at 10:48 AM Yan Zhai wrote: > > On Wed, Jan 29, 2025 at 8:08 AM Willem de Bruijn > wrote: > > > > Yan Zhai wrote: > > > On Tue, Jan 28, 2025 at 8:45 AM

[PATCH v2 net] udp: gso: do not drop small packets when PMTU reduces

2025-01-29 Thread Yan Zhai
smaller than requested gso_size, and return EMSGSIZE instead of EINVAL on MTU/PMTU check failure to be more specific on the error cause. Fixes: 4094871db1d6 ("udp: only do GSO if # of segs > 1") Signed-off-by: Yan Zhai -- v1->v2: add a missing MTU check when fall back to no GS

Re: [PATCH] udp: gso: fix MTU check for small packets

2025-01-29 Thread Yan Zhai
On Wed, Jan 29, 2025 at 8:08 AM Willem de Bruijn wrote: > > Yan Zhai wrote: > > On Tue, Jan 28, 2025 at 8:45 AM Willem de Bruijn > > wrote: > > > > > > Yan Zhai wrote: > > > > Hi Willem, > > > > > > > > Thanks for getti

Re: [PATCH] udp: gso: fix MTU check for small packets

2025-01-28 Thread Yan Zhai
On Tue, Jan 28, 2025 at 8:45 AM Willem de Bruijn wrote: > > Yan Zhai wrote: > > Hi Willem, > > > > Thanks for getting back to me. > > > > On Mon, Jan 27, 2025 at 8:33 AM Willem de Bruijn > > wrote: > > > > > > Yan Zhai wrote: >

Re: [PATCH] udp: gso: fix MTU check for small packets

2025-01-27 Thread Yan Zhai
Hi Willem, Thanks for getting back to me. On Mon, Jan 27, 2025 at 8:33 AM Willem de Bruijn wrote: > > Yan Zhai wrote: > > Commit 4094871db1d6 ("udp: only do GSO if # of segs > 1") avoided GSO > > for small packets. But the kernel currently dismisses GSO requests

[PATCH] udp: gso: fix MTU check for small packets

2025-01-26 Thread Yan Zhai
4094871db1d6 ("udp: only do GSO if # of segs > 1") Signed-off-by: Yan Zhai --- net/ipv4/udp.c | 18 -- net/ipv6/udp.c | 18 -- tools/testing/selftests/net/udpgso.c | 14 ++ 3 files changed, 30 i

[PATCH net-next v5 7/7] af_packet: use sk_skb_reason_drop to free rx packets

2024-06-17 Thread Yan Zhai
Replace kfree_skb_reason with sk_skb_reason_drop and pass the receiving socket to the tracepoint. Reported-by: kernel test robot Closes: https://lore.kernel.org/r/202406011859.aacus8gv-...@intel.com/ Signed-off-by: Yan Zhai --- v2->v3: fixed uninitialized sk, added missing report tags. ---

[PATCH net-next v5 6/7] udp: use sk_skb_reason_drop to free rx packets

2024-06-17 Thread Yan Zhai
Replace kfree_skb_reason with sk_skb_reason_drop and pass the receiving socket to the tracepoint. Reported-by: kernel test robot Closes: https://lore.kernel.org/r/202406011751.npvn0ssk-...@intel.com/ Signed-off-by: Yan Zhai --- v2->v3: added missing report tags --- net/ipv4/udp.c |

[PATCH net-next v5 5/7] tcp: use sk_skb_reason_drop to free rx packets

2024-06-17 Thread Yan Zhai
Replace kfree_skb_reason with sk_skb_reason_drop and pass the receiving socket to the tracepoint. Reported-by: kernel test robot Closes: https://lore.kernel.org/r/202406011539.jhwbd7dx-...@intel.com/ Signed-off-by: Yan Zhai --- v2->v3: added missing report tags --- net/ipv4/syncookies.c

[PATCH net-next v5 4/7] net: raw: use sk_skb_reason_drop to free rx packets

2024-06-17 Thread Yan Zhai
Replace kfree_skb_reason with sk_skb_reason_drop and pass the receiving socket to the tracepoint. Signed-off-by: Yan Zhai --- net/ipv4/raw.c | 4 ++-- net/ipv6/raw.c | 8 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 1a0953650356

[PATCH net-next v5 3/7] ping: use sk_skb_reason_drop to free rx packets

2024-06-17 Thread Yan Zhai
Replace kfree_skb_reason with sk_skb_reason_drop and pass the receiving socket to the tracepoint. Signed-off-by: Yan Zhai --- net/ipv4/ping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index 823306487a82..619ddc087957 100644 --- a/net

[PATCH net-next v5 2/7] net: introduce sk_skb_reason_drop function

2024-06-17 Thread Yan Zhai
are still usable but they are now just inline helpers that call sk_skb_reason_drop. Note it is not feasible to do the same to consume_skb. Packets not dropped can flow through multiple receive handlers, and have multiple receiving sockets. Leave it untouched for now. Suggested-by: Eric Dumazet Sig

[PATCH net-next v5 1/7] net: add rx_sk to trace_kfree_skb

2024-06-17 Thread Yan Zhai
othing about a receiver. Allow passing an extra receiving socket to the tracepoint to improve the visibility on receiving drops. Signed-off-by: Yan Zhai --- v4->v5: rename rx_skaddr -> rx_sk as Jesper Dangaard Brouer suggested v3->v4: adjusted the TP_STRUCT field order to be consisten

[PATCH net-next v5 0/7] net: pass receive socket to drop tracepoint

2024-06-17 Thread Yan Zhai
org/linux-kernel/cover.1717206060.git@cloudflare.com/ V1: https://lore.kernel.org/netdev/cover.1717105215.git@cloudflare.com/ Yan Zhai (7): net: add rx_sk to trace_kfree_skb net: introduce sk_skb_reason_drop function ping: use sk_skb_reason_drop to free rx packets net: raw: use sk_skb_reas

Re: [PATCH v4 net-next 1/7] net: add rx_sk to trace_kfree_skb

2024-06-14 Thread Yan Zhai
On Fri, Jun 14, 2024 at 5:15 AM Paolo Abeni wrote: > > On Wed, 2024-06-12 at 09:59 +0200, Jesper Dangaard Brouer wrote: > > > > On 11/06/2024 22.11, Yan Zhai wrote: > > > skb does not include enough information to find out receiving > > > sockets/services and

[PATCH v4 net-next 7/7] af_packet: use sk_skb_reason_drop to free rx packets

2024-06-11 Thread Yan Zhai
Replace kfree_skb_reason with sk_skb_reason_drop and pass the receiving socket to the tracepoint. Reported-by: kernel test robot Closes: https://lore.kernel.org/r/202406011859.aacus8gv-...@intel.com/ Signed-off-by: Yan Zhai --- v2->v3: fixed uninitialized sk, added missing report tags. ---

[PATCH v4 net-next 6/7] udp: use sk_skb_reason_drop to free rx packets

2024-06-11 Thread Yan Zhai
Replace kfree_skb_reason with sk_skb_reason_drop and pass the receiving socket to the tracepoint. Reported-by: kernel test robot Closes: https://lore.kernel.org/r/202406011751.npvn0ssk-...@intel.com/ Signed-off-by: Yan Zhai --- v2->v3: added missing report tags --- net/ipv4/udp.c |

[PATCH v4 net-next 5/7] tcp: use sk_skb_reason_drop to free rx packets

2024-06-11 Thread Yan Zhai
Replace kfree_skb_reason with sk_skb_reason_drop and pass the receiving socket to the tracepoint. Reported-by: kernel test robot Closes: https://lore.kernel.org/r/202406011539.jhwbd7dx-...@intel.com/ Signed-off-by: Yan Zhai --- v2->v3: added missing report tags --- net/ipv4/syncookies.c

[PATCH v4 net-next 4/7] net: raw: use sk_skb_reason_drop to free rx packets

2024-06-11 Thread Yan Zhai
Replace kfree_skb_reason with sk_skb_reason_drop and pass the receiving socket to the tracepoint. Signed-off-by: Yan Zhai --- net/ipv4/raw.c | 4 ++-- net/ipv6/raw.c | 8 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 1a0953650356

[PATCH v4 net-next 3/7] ping: use sk_skb_reason_drop to free rx packets

2024-06-11 Thread Yan Zhai
Replace kfree_skb_reason with sk_skb_reason_drop and pass the receiving socket to the tracepoint. Signed-off-by: Yan Zhai --- net/ipv4/ping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index 823306487a82..619ddc087957 100644 --- a/net

[PATCH v4 net-next 2/7] net: introduce sk_skb_reason_drop function

2024-06-11 Thread Yan Zhai
are still usable but they are now just inline helpers that call sk_skb_reason_drop. Note it is not feasible to do the same to consume_skb. Packets not dropped can flow through multiple receive handlers, and have multiple receiving sockets. Leave it untouched for now. Suggested-by: Eric Dumazet Sig

[PATCH v4 net-next 1/7] net: add rx_sk to trace_kfree_skb

2024-06-11 Thread Yan Zhai
othing about a receiver. Allow passing an extra receiving socket to the tracepoint to improve the visibility on receiving drops. Signed-off-by: Yan Zhai --- v3->v4: adjusted the TP_STRUCT field order to be consistent v2->v3: fixed drop_monitor function prototype --- include/trace/event

[PATCH v4 net-next 0/7] net: pass receive socket to drop tracepoint

2024-06-11 Thread Yan Zhai
sted. V3: https://lore.kernel.org/netdev/cover.1717529533.git@cloudflare.com/ V2: https://lore.kernel.org/linux-kernel/cover.1717206060.git@cloudflare.com/ V1: https://lore.kernel.org/netdev/cover.1717105215.git@cloudflare.com/ Yan Zhai (7): net: add rx_sk to trace_kfree_skb net: int

Re: [RFC v3 net-next 1/7] net: add rx_sk to trace_kfree_skb

2024-06-10 Thread Yan Zhai
On Mon, Jun 10, 2024 at 11:54 AM Steven Rostedt wrote: > > On Thu, 6 Jun 2024 10:37:46 -0500 > Yan Zhai wrote: > > > > name: kfree_skb > > > ID: 1799 > > > format: > > > field:unsigned short common_type; offset:0; size:2; &

Re: [RFC v3 net-next 1/7] net: add rx_sk to trace_kfree_skb

2024-06-06 Thread Yan Zhai
On Wed, Jun 5, 2024 at 6:57 PM Steven Rostedt wrote: > > On Tue, 4 Jun 2024 14:47:38 -0700 > Yan Zhai wrote: > > > skb does not include enough information to find out receiving > > sockets/services and netns/containers on packet drops. In theory > > skb->dev

[RFC v3 net-next 7/7] af_packet: use sk_skb_reason_drop to free rx packets

2024-06-04 Thread Yan Zhai
Replace kfree_skb_reason with sk_skb_reason_drop and pass the receiving socket to the tracepoint. Reported-by: kernel test robot Closes: https://lore.kernel.org/r/202406011859.aacus8gv-...@intel.com/ Signed-off-by: Yan Zhai --- v2->v3: fixed uninitialized sk, added missing report tags. ---

[RFC v3 net-next 6/7] udp: use sk_skb_reason_drop to free rx packets

2024-06-04 Thread Yan Zhai
Replace kfree_skb_reason with sk_skb_reason_drop and pass the receiving socket to the tracepoint. Reported-by: kernel test robot Closes: https://lore.kernel.org/r/202406011751.npvn0ssk-...@intel.com/ Signed-off-by: Yan Zhai --- v2->v3: added missing report tags --- net/ipv4/udp.c |

[RFC v3 net-next 5/7] tcp: use sk_skb_reason_drop to free rx packets

2024-06-04 Thread Yan Zhai
Replace kfree_skb_reason with sk_skb_reason_drop and pass the receiving socket to the tracepoint. Reported-by: kernel test robot Closes: https://lore.kernel.org/r/202406011539.jhwbd7dx-...@intel.com/ Signed-off-by: Yan Zhai --- v2->v3: added missing report tags --- net/ipv4/syncookies.c

[RFC v3 net-next 4/7] net: raw: use sk_skb_reason_drop to free rx packets

2024-06-04 Thread Yan Zhai
Replace kfree_skb_reason with sk_skb_reason_drop and pass the receiving socket to the tracepoint. Signed-off-by: Yan Zhai --- net/ipv4/raw.c | 4 ++-- net/ipv6/raw.c | 8 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 1a0953650356

[RFC v3 net-next 3/7] ping: use sk_skb_reason_drop to free rx packets

2024-06-04 Thread Yan Zhai
Replace kfree_skb_reason with sk_skb_reason_drop and pass the receiving socket to the tracepoint. Signed-off-by: Yan Zhai --- net/ipv4/ping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index 823306487a82..619ddc087957 100644 --- a/net

[RFC v3 net-next 2/7] net: introduce sk_skb_reason_drop function

2024-06-04 Thread Yan Zhai
are still usable but they are now just inline helpers that call sk_skb_reason_drop. Note it is not feasible to do the same to consume_skb. Packets not dropped can flow through multiple receive handlers, and have multiple receiving sockets. Leave it untouched for now. Suggested-by: Eric Dumazet Sig

[RFC v3 net-next 1/7] net: add rx_sk to trace_kfree_skb

2024-06-04 Thread Yan Zhai
othing about a receiver. Allow passing an extra receiving socket to the tracepoint to improve the visibility on receiving drops. Signed-off-by: Yan Zhai --- v2->v3: fixed drop_monitor function prototype --- include/trace/events/skb.h | 11 +++ net/core/dev.c | 2 +-

[RFC v3 net-next 0/7] net: pass receive socket to drop tracepoint

2024-06-04 Thread Yan Zhai
https://lore.kernel.org/netdev/cover.1717105215.git@cloudflare.com/ Yan Zhai (7): net: add rx_sk to trace_kfree_skb net: introduce sk_skb_reason_drop function ping: use sk_skb_reason_drop to free rx packets net: raw: use sk_skb_reason_drop to free rx packets tcp: use sk_skb_reason_dro