2022-06-06 10:24:34 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
|
2023-04-19 14:52:52 +02:00
|
|
|
#ifndef _LINUX_DROPREASON_CORE_H
|
|
|
|
#define _LINUX_DROPREASON_CORE_H
|
2022-06-06 10:24:34 +08:00
|
|
|
|
net: skb: export skb drop reaons to user by TRACE_DEFINE_ENUM
As Eric reported, the 'reason' field is not presented when trace the
kfree_skb event by perf:
$ perf record -e skb:kfree_skb -a sleep 10
$ perf script
ip_defrag 14605 [021] 221.614303: skb:kfree_skb:
skbaddr=0xffff9d2851242700 protocol=34525 location=0xffffffffa39346b1
reason:
The cause seems to be passing kernel address directly to TP_printk(),
which is not right. As the enum 'skb_drop_reason' is not exported to
user space through TRACE_DEFINE_ENUM(), perf can't get the drop reason
string from the 'reason' field, which is a number.
Therefore, we introduce the macro DEFINE_DROP_REASON(), which is used
to define the trace enum by TRACE_DEFINE_ENUM(). With the help of
DEFINE_DROP_REASON(), now we can remove the auto-generate that we
introduced in the commit ec43908dd556
("net: skb: use auto-generation to convert skb drop reason to string"),
and define the string array 'drop_reasons'.
Hmmmm...now we come back to the situation that have to maintain drop
reasons in both enum skb_drop_reason and DEFINE_DROP_REASON. But they
are both in dropreason.h, which makes it easier.
After this commit, now the format of kfree_skb is like this:
$ cat /tracing/events/skb/kfree_skb/format
name: kfree_skb
ID: 1524
format:
field:unsigned short common_type; offset:0; size:2; signed:0;
field:unsigned char common_flags; offset:2; size:1; signed:0;
field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
field:int common_pid; offset:4; size:4; signed:1;
field:void * skbaddr; offset:8; size:8; signed:0;
field:void * location; offset:16; size:8; signed:0;
field:unsigned short protocol; offset:24; size:2; signed:0;
field:enum skb_drop_reason reason; offset:28; size:4; signed:0;
print fmt: "skbaddr=%p protocol=%u location=%p reason: %s", REC->skbaddr, REC->protocol, REC->location, __print_symbolic(REC->reason, { 1, "NOT_SPECIFIED" }, { 2, "NO_SOCKET" } ......
Fixes: ec43908dd556 ("net: skb: use auto-generation to convert skb drop reason to string")
Link: https://lore.kernel.org/netdev/CANn89i+bx0ybvE55iMYf5GJM48WwV1HNpdm9Q6t-HaEstqpCSA@mail.gmail.com/
Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Menglong Dong <imagedong@tencent.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-09-05 11:50:15 +08:00
|
|
|
#define DEFINE_DROP_REASON(FN, FNe) \
|
|
|
|
FN(NOT_SPECIFIED) \
|
|
|
|
FN(NO_SOCKET) \
|
2025-01-16 14:34:35 +09:00
|
|
|
FN(SOCKET_CLOSE) \
|
2025-01-16 14:34:34 +09:00
|
|
|
FN(SOCKET_FILTER) \
|
|
|
|
FN(SOCKET_RCVBUFF) \
|
2025-01-16 14:34:40 +09:00
|
|
|
FN(UNIX_DISCONNECT) \
|
2025-01-16 14:34:38 +09:00
|
|
|
FN(UNIX_SKIP_OOB) \
|
net: skb: export skb drop reaons to user by TRACE_DEFINE_ENUM
As Eric reported, the 'reason' field is not presented when trace the
kfree_skb event by perf:
$ perf record -e skb:kfree_skb -a sleep 10
$ perf script
ip_defrag 14605 [021] 221.614303: skb:kfree_skb:
skbaddr=0xffff9d2851242700 protocol=34525 location=0xffffffffa39346b1
reason:
The cause seems to be passing kernel address directly to TP_printk(),
which is not right. As the enum 'skb_drop_reason' is not exported to
user space through TRACE_DEFINE_ENUM(), perf can't get the drop reason
string from the 'reason' field, which is a number.
Therefore, we introduce the macro DEFINE_DROP_REASON(), which is used
to define the trace enum by TRACE_DEFINE_ENUM(). With the help of
DEFINE_DROP_REASON(), now we can remove the auto-generate that we
introduced in the commit ec43908dd556
("net: skb: use auto-generation to convert skb drop reason to string"),
and define the string array 'drop_reasons'.
Hmmmm...now we come back to the situation that have to maintain drop
reasons in both enum skb_drop_reason and DEFINE_DROP_REASON. But they
are both in dropreason.h, which makes it easier.
After this commit, now the format of kfree_skb is like this:
$ cat /tracing/events/skb/kfree_skb/format
name: kfree_skb
ID: 1524
format:
field:unsigned short common_type; offset:0; size:2; signed:0;
field:unsigned char common_flags; offset:2; size:1; signed:0;
field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
field:int common_pid; offset:4; size:4; signed:1;
field:void * skbaddr; offset:8; size:8; signed:0;
field:void * location; offset:16; size:8; signed:0;
field:unsigned short protocol; offset:24; size:2; signed:0;
field:enum skb_drop_reason reason; offset:28; size:4; signed:0;
print fmt: "skbaddr=%p protocol=%u location=%p reason: %s", REC->skbaddr, REC->protocol, REC->location, __print_symbolic(REC->reason, { 1, "NOT_SPECIFIED" }, { 2, "NO_SOCKET" } ......
Fixes: ec43908dd556 ("net: skb: use auto-generation to convert skb drop reason to string")
Link: https://lore.kernel.org/netdev/CANn89i+bx0ybvE55iMYf5GJM48WwV1HNpdm9Q6t-HaEstqpCSA@mail.gmail.com/
Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Menglong Dong <imagedong@tencent.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-09-05 11:50:15 +08:00
|
|
|
FN(PKT_TOO_SMALL) \
|
|
|
|
FN(TCP_CSUM) \
|
|
|
|
FN(UDP_CSUM) \
|
|
|
|
FN(NETFILTER_DROP) \
|
|
|
|
FN(OTHERHOST) \
|
|
|
|
FN(IP_CSUM) \
|
|
|
|
FN(IP_INHDR) \
|
|
|
|
FN(IP_RPFILTER) \
|
|
|
|
FN(UNICAST_IN_L2_MULTICAST) \
|
|
|
|
FN(XFRM_POLICY) \
|
|
|
|
FN(IP_NOPROTO) \
|
|
|
|
FN(PROTO_MEM) \
|
2023-10-23 20:21:59 +01:00
|
|
|
FN(TCP_AUTH_HDR) \
|
net: skb: export skb drop reaons to user by TRACE_DEFINE_ENUM
As Eric reported, the 'reason' field is not presented when trace the
kfree_skb event by perf:
$ perf record -e skb:kfree_skb -a sleep 10
$ perf script
ip_defrag 14605 [021] 221.614303: skb:kfree_skb:
skbaddr=0xffff9d2851242700 protocol=34525 location=0xffffffffa39346b1
reason:
The cause seems to be passing kernel address directly to TP_printk(),
which is not right. As the enum 'skb_drop_reason' is not exported to
user space through TRACE_DEFINE_ENUM(), perf can't get the drop reason
string from the 'reason' field, which is a number.
Therefore, we introduce the macro DEFINE_DROP_REASON(), which is used
to define the trace enum by TRACE_DEFINE_ENUM(). With the help of
DEFINE_DROP_REASON(), now we can remove the auto-generate that we
introduced in the commit ec43908dd556
("net: skb: use auto-generation to convert skb drop reason to string"),
and define the string array 'drop_reasons'.
Hmmmm...now we come back to the situation that have to maintain drop
reasons in both enum skb_drop_reason and DEFINE_DROP_REASON. But they
are both in dropreason.h, which makes it easier.
After this commit, now the format of kfree_skb is like this:
$ cat /tracing/events/skb/kfree_skb/format
name: kfree_skb
ID: 1524
format:
field:unsigned short common_type; offset:0; size:2; signed:0;
field:unsigned char common_flags; offset:2; size:1; signed:0;
field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
field:int common_pid; offset:4; size:4; signed:1;
field:void * skbaddr; offset:8; size:8; signed:0;
field:void * location; offset:16; size:8; signed:0;
field:unsigned short protocol; offset:24; size:2; signed:0;
field:enum skb_drop_reason reason; offset:28; size:4; signed:0;
print fmt: "skbaddr=%p protocol=%u location=%p reason: %s", REC->skbaddr, REC->protocol, REC->location, __print_symbolic(REC->reason, { 1, "NOT_SPECIFIED" }, { 2, "NO_SOCKET" } ......
Fixes: ec43908dd556 ("net: skb: use auto-generation to convert skb drop reason to string")
Link: https://lore.kernel.org/netdev/CANn89i+bx0ybvE55iMYf5GJM48WwV1HNpdm9Q6t-HaEstqpCSA@mail.gmail.com/
Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Menglong Dong <imagedong@tencent.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-09-05 11:50:15 +08:00
|
|
|
FN(TCP_MD5NOTFOUND) \
|
|
|
|
FN(TCP_MD5UNEXPECTED) \
|
|
|
|
FN(TCP_MD5FAILURE) \
|
2023-10-23 20:22:04 +01:00
|
|
|
FN(TCP_AONOTFOUND) \
|
|
|
|
FN(TCP_AOUNEXPECTED) \
|
|
|
|
FN(TCP_AOKEYNOTFOUND) \
|
|
|
|
FN(TCP_AOFAILURE) \
|
net: skb: export skb drop reaons to user by TRACE_DEFINE_ENUM
As Eric reported, the 'reason' field is not presented when trace the
kfree_skb event by perf:
$ perf record -e skb:kfree_skb -a sleep 10
$ perf script
ip_defrag 14605 [021] 221.614303: skb:kfree_skb:
skbaddr=0xffff9d2851242700 protocol=34525 location=0xffffffffa39346b1
reason:
The cause seems to be passing kernel address directly to TP_printk(),
which is not right. As the enum 'skb_drop_reason' is not exported to
user space through TRACE_DEFINE_ENUM(), perf can't get the drop reason
string from the 'reason' field, which is a number.
Therefore, we introduce the macro DEFINE_DROP_REASON(), which is used
to define the trace enum by TRACE_DEFINE_ENUM(). With the help of
DEFINE_DROP_REASON(), now we can remove the auto-generate that we
introduced in the commit ec43908dd556
("net: skb: use auto-generation to convert skb drop reason to string"),
and define the string array 'drop_reasons'.
Hmmmm...now we come back to the situation that have to maintain drop
reasons in both enum skb_drop_reason and DEFINE_DROP_REASON. But they
are both in dropreason.h, which makes it easier.
After this commit, now the format of kfree_skb is like this:
$ cat /tracing/events/skb/kfree_skb/format
name: kfree_skb
ID: 1524
format:
field:unsigned short common_type; offset:0; size:2; signed:0;
field:unsigned char common_flags; offset:2; size:1; signed:0;
field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
field:int common_pid; offset:4; size:4; signed:1;
field:void * skbaddr; offset:8; size:8; signed:0;
field:void * location; offset:16; size:8; signed:0;
field:unsigned short protocol; offset:24; size:2; signed:0;
field:enum skb_drop_reason reason; offset:28; size:4; signed:0;
print fmt: "skbaddr=%p protocol=%u location=%p reason: %s", REC->skbaddr, REC->protocol, REC->location, __print_symbolic(REC->reason, { 1, "NOT_SPECIFIED" }, { 2, "NO_SOCKET" } ......
Fixes: ec43908dd556 ("net: skb: use auto-generation to convert skb drop reason to string")
Link: https://lore.kernel.org/netdev/CANn89i+bx0ybvE55iMYf5GJM48WwV1HNpdm9Q6t-HaEstqpCSA@mail.gmail.com/
Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Menglong Dong <imagedong@tencent.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-09-05 11:50:15 +08:00
|
|
|
FN(SOCKET_BACKLOG) \
|
|
|
|
FN(TCP_FLAGS) \
|
2024-02-26 11:22:23 +08:00
|
|
|
FN(TCP_ABORT_ON_DATA) \
|
net: skb: export skb drop reaons to user by TRACE_DEFINE_ENUM
As Eric reported, the 'reason' field is not presented when trace the
kfree_skb event by perf:
$ perf record -e skb:kfree_skb -a sleep 10
$ perf script
ip_defrag 14605 [021] 221.614303: skb:kfree_skb:
skbaddr=0xffff9d2851242700 protocol=34525 location=0xffffffffa39346b1
reason:
The cause seems to be passing kernel address directly to TP_printk(),
which is not right. As the enum 'skb_drop_reason' is not exported to
user space through TRACE_DEFINE_ENUM(), perf can't get the drop reason
string from the 'reason' field, which is a number.
Therefore, we introduce the macro DEFINE_DROP_REASON(), which is used
to define the trace enum by TRACE_DEFINE_ENUM(). With the help of
DEFINE_DROP_REASON(), now we can remove the auto-generate that we
introduced in the commit ec43908dd556
("net: skb: use auto-generation to convert skb drop reason to string"),
and define the string array 'drop_reasons'.
Hmmmm...now we come back to the situation that have to maintain drop
reasons in both enum skb_drop_reason and DEFINE_DROP_REASON. But they
are both in dropreason.h, which makes it easier.
After this commit, now the format of kfree_skb is like this:
$ cat /tracing/events/skb/kfree_skb/format
name: kfree_skb
ID: 1524
format:
field:unsigned short common_type; offset:0; size:2; signed:0;
field:unsigned char common_flags; offset:2; size:1; signed:0;
field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
field:int common_pid; offset:4; size:4; signed:1;
field:void * skbaddr; offset:8; size:8; signed:0;
field:void * location; offset:16; size:8; signed:0;
field:unsigned short protocol; offset:24; size:2; signed:0;
field:enum skb_drop_reason reason; offset:28; size:4; signed:0;
print fmt: "skbaddr=%p protocol=%u location=%p reason: %s", REC->skbaddr, REC->protocol, REC->location, __print_symbolic(REC->reason, { 1, "NOT_SPECIFIED" }, { 2, "NO_SOCKET" } ......
Fixes: ec43908dd556 ("net: skb: use auto-generation to convert skb drop reason to string")
Link: https://lore.kernel.org/netdev/CANn89i+bx0ybvE55iMYf5GJM48WwV1HNpdm9Q6t-HaEstqpCSA@mail.gmail.com/
Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Menglong Dong <imagedong@tencent.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-09-05 11:50:15 +08:00
|
|
|
FN(TCP_ZEROWINDOW) \
|
|
|
|
FN(TCP_OLD_DATA) \
|
|
|
|
FN(TCP_OVERWINDOW) \
|
|
|
|
FN(TCP_OFOMERGE) \
|
|
|
|
FN(TCP_RFC7323_PAWS) \
|
2025-01-13 13:55:57 +00:00
|
|
|
FN(TCP_RFC7323_PAWS_ACK) \
|
tcp: add TCP_RFC7323_TW_PAWS drop reason
Devices in the networking path, such as firewalls, NATs, or routers, which
can perform SNAT or DNAT, use addresses from their own limited address
pools to masquerade the source address during forwarding, causing PAWS
verification to fail more easily.
Currently, packet loss statistics for PAWS can only be viewed through MIB,
which is a global metric and cannot be precisely obtained through tracing
to get the specific 4-tuple of the dropped packet. In the past, we had to
use kprobe ret to retrieve relevant skb information from
tcp_timewait_state_process().
We add a drop_reason pointer, similar to what previous commit does:
commit e34100c2ecbb ("tcp: add a drop_reason pointer to tcp_check_req()")
This commit addresses the PAWSESTABREJECTED case and also sets the
corresponding drop reason.
We use 'pwru' to test.
Before this commit:
''''
./pwru 'port 9999'
2025/04/07 13:40:19 Listening for events..
TUPLE FUNC
172.31.75.115:12345->172.31.75.114:9999(tcp) sk_skb_reason_drop(SKB_DROP_REASON_NOT_SPECIFIED)
'''
After this commit:
'''
./pwru 'port 9999'
2025/04/07 13:51:34 Listening for events..
TUPLE FUNC
172.31.75.115:12345->172.31.75.114:9999(tcp) sk_skb_reason_drop(SKB_DROP_REASON_TCP_RFC7323_TW_PAWS)
'''
Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20250409112614.16153-2-jiayuan.chen@linux.dev
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-04-09 19:26:04 +08:00
|
|
|
FN(TCP_RFC7323_TW_PAWS) \
|
2025-03-01 20:14:20 +00:00
|
|
|
FN(TCP_RFC7323_TSECR) \
|
|
|
|
FN(TCP_LISTEN_OVERFLOW) \
|
2023-07-19 06:47:54 +00:00
|
|
|
FN(TCP_OLD_SEQUENCE) \
|
net: skb: export skb drop reaons to user by TRACE_DEFINE_ENUM
As Eric reported, the 'reason' field is not presented when trace the
kfree_skb event by perf:
$ perf record -e skb:kfree_skb -a sleep 10
$ perf script
ip_defrag 14605 [021] 221.614303: skb:kfree_skb:
skbaddr=0xffff9d2851242700 protocol=34525 location=0xffffffffa39346b1
reason:
The cause seems to be passing kernel address directly to TP_printk(),
which is not right. As the enum 'skb_drop_reason' is not exported to
user space through TRACE_DEFINE_ENUM(), perf can't get the drop reason
string from the 'reason' field, which is a number.
Therefore, we introduce the macro DEFINE_DROP_REASON(), which is used
to define the trace enum by TRACE_DEFINE_ENUM(). With the help of
DEFINE_DROP_REASON(), now we can remove the auto-generate that we
introduced in the commit ec43908dd556
("net: skb: use auto-generation to convert skb drop reason to string"),
and define the string array 'drop_reasons'.
Hmmmm...now we come back to the situation that have to maintain drop
reasons in both enum skb_drop_reason and DEFINE_DROP_REASON. But they
are both in dropreason.h, which makes it easier.
After this commit, now the format of kfree_skb is like this:
$ cat /tracing/events/skb/kfree_skb/format
name: kfree_skb
ID: 1524
format:
field:unsigned short common_type; offset:0; size:2; signed:0;
field:unsigned char common_flags; offset:2; size:1; signed:0;
field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
field:int common_pid; offset:4; size:4; signed:1;
field:void * skbaddr; offset:8; size:8; signed:0;
field:void * location; offset:16; size:8; signed:0;
field:unsigned short protocol; offset:24; size:2; signed:0;
field:enum skb_drop_reason reason; offset:28; size:4; signed:0;
print fmt: "skbaddr=%p protocol=%u location=%p reason: %s", REC->skbaddr, REC->protocol, REC->location, __print_symbolic(REC->reason, { 1, "NOT_SPECIFIED" }, { 2, "NO_SOCKET" } ......
Fixes: ec43908dd556 ("net: skb: use auto-generation to convert skb drop reason to string")
Link: https://lore.kernel.org/netdev/CANn89i+bx0ybvE55iMYf5GJM48WwV1HNpdm9Q6t-HaEstqpCSA@mail.gmail.com/
Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Menglong Dong <imagedong@tencent.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-09-05 11:50:15 +08:00
|
|
|
FN(TCP_INVALID_SEQUENCE) \
|
2025-07-11 11:39:59 +00:00
|
|
|
FN(TCP_INVALID_END_SEQUENCE) \
|
2024-02-26 11:22:23 +08:00
|
|
|
FN(TCP_INVALID_ACK_SEQUENCE) \
|
net: skb: export skb drop reaons to user by TRACE_DEFINE_ENUM
As Eric reported, the 'reason' field is not presented when trace the
kfree_skb event by perf:
$ perf record -e skb:kfree_skb -a sleep 10
$ perf script
ip_defrag 14605 [021] 221.614303: skb:kfree_skb:
skbaddr=0xffff9d2851242700 protocol=34525 location=0xffffffffa39346b1
reason:
The cause seems to be passing kernel address directly to TP_printk(),
which is not right. As the enum 'skb_drop_reason' is not exported to
user space through TRACE_DEFINE_ENUM(), perf can't get the drop reason
string from the 'reason' field, which is a number.
Therefore, we introduce the macro DEFINE_DROP_REASON(), which is used
to define the trace enum by TRACE_DEFINE_ENUM(). With the help of
DEFINE_DROP_REASON(), now we can remove the auto-generate that we
introduced in the commit ec43908dd556
("net: skb: use auto-generation to convert skb drop reason to string"),
and define the string array 'drop_reasons'.
Hmmmm...now we come back to the situation that have to maintain drop
reasons in both enum skb_drop_reason and DEFINE_DROP_REASON. But they
are both in dropreason.h, which makes it easier.
After this commit, now the format of kfree_skb is like this:
$ cat /tracing/events/skb/kfree_skb/format
name: kfree_skb
ID: 1524
format:
field:unsigned short common_type; offset:0; size:2; signed:0;
field:unsigned char common_flags; offset:2; size:1; signed:0;
field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
field:int common_pid; offset:4; size:4; signed:1;
field:void * skbaddr; offset:8; size:8; signed:0;
field:void * location; offset:16; size:8; signed:0;
field:unsigned short protocol; offset:24; size:2; signed:0;
field:enum skb_drop_reason reason; offset:28; size:4; signed:0;
print fmt: "skbaddr=%p protocol=%u location=%p reason: %s", REC->skbaddr, REC->protocol, REC->location, __print_symbolic(REC->reason, { 1, "NOT_SPECIFIED" }, { 2, "NO_SOCKET" } ......
Fixes: ec43908dd556 ("net: skb: use auto-generation to convert skb drop reason to string")
Link: https://lore.kernel.org/netdev/CANn89i+bx0ybvE55iMYf5GJM48WwV1HNpdm9Q6t-HaEstqpCSA@mail.gmail.com/
Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Menglong Dong <imagedong@tencent.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-09-05 11:50:15 +08:00
|
|
|
FN(TCP_RESET) \
|
|
|
|
FN(TCP_INVALID_SYN) \
|
|
|
|
FN(TCP_CLOSE) \
|
|
|
|
FN(TCP_FASTOPEN) \
|
|
|
|
FN(TCP_OLD_ACK) \
|
|
|
|
FN(TCP_TOO_OLD_ACK) \
|
|
|
|
FN(TCP_ACK_UNSENT_DATA) \
|
|
|
|
FN(TCP_OFO_QUEUE_PRUNE) \
|
|
|
|
FN(TCP_OFO_DROP) \
|
|
|
|
FN(IP_OUTNOROUTES) \
|
|
|
|
FN(BPF_CGROUP_EGRESS) \
|
|
|
|
FN(IPV6DISABLED) \
|
|
|
|
FN(NEIGH_CREATEFAIL) \
|
|
|
|
FN(NEIGH_FAILED) \
|
|
|
|
FN(NEIGH_QUEUEFULL) \
|
|
|
|
FN(NEIGH_DEAD) \
|
2025-05-21 10:14:08 +08:00
|
|
|
FN(NEIGH_HH_FILLFAIL) \
|
net: skb: export skb drop reaons to user by TRACE_DEFINE_ENUM
As Eric reported, the 'reason' field is not presented when trace the
kfree_skb event by perf:
$ perf record -e skb:kfree_skb -a sleep 10
$ perf script
ip_defrag 14605 [021] 221.614303: skb:kfree_skb:
skbaddr=0xffff9d2851242700 protocol=34525 location=0xffffffffa39346b1
reason:
The cause seems to be passing kernel address directly to TP_printk(),
which is not right. As the enum 'skb_drop_reason' is not exported to
user space through TRACE_DEFINE_ENUM(), perf can't get the drop reason
string from the 'reason' field, which is a number.
Therefore, we introduce the macro DEFINE_DROP_REASON(), which is used
to define the trace enum by TRACE_DEFINE_ENUM(). With the help of
DEFINE_DROP_REASON(), now we can remove the auto-generate that we
introduced in the commit ec43908dd556
("net: skb: use auto-generation to convert skb drop reason to string"),
and define the string array 'drop_reasons'.
Hmmmm...now we come back to the situation that have to maintain drop
reasons in both enum skb_drop_reason and DEFINE_DROP_REASON. But they
are both in dropreason.h, which makes it easier.
After this commit, now the format of kfree_skb is like this:
$ cat /tracing/events/skb/kfree_skb/format
name: kfree_skb
ID: 1524
format:
field:unsigned short common_type; offset:0; size:2; signed:0;
field:unsigned char common_flags; offset:2; size:1; signed:0;
field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
field:int common_pid; offset:4; size:4; signed:1;
field:void * skbaddr; offset:8; size:8; signed:0;
field:void * location; offset:16; size:8; signed:0;
field:unsigned short protocol; offset:24; size:2; signed:0;
field:enum skb_drop_reason reason; offset:28; size:4; signed:0;
print fmt: "skbaddr=%p protocol=%u location=%p reason: %s", REC->skbaddr, REC->protocol, REC->location, __print_symbolic(REC->reason, { 1, "NOT_SPECIFIED" }, { 2, "NO_SOCKET" } ......
Fixes: ec43908dd556 ("net: skb: use auto-generation to convert skb drop reason to string")
Link: https://lore.kernel.org/netdev/CANn89i+bx0ybvE55iMYf5GJM48WwV1HNpdm9Q6t-HaEstqpCSA@mail.gmail.com/
Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Menglong Dong <imagedong@tencent.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-09-05 11:50:15 +08:00
|
|
|
FN(TC_EGRESS) \
|
2024-02-26 11:22:18 +08:00
|
|
|
FN(SECURITY_HOOK) \
|
net: skb: export skb drop reaons to user by TRACE_DEFINE_ENUM
As Eric reported, the 'reason' field is not presented when trace the
kfree_skb event by perf:
$ perf record -e skb:kfree_skb -a sleep 10
$ perf script
ip_defrag 14605 [021] 221.614303: skb:kfree_skb:
skbaddr=0xffff9d2851242700 protocol=34525 location=0xffffffffa39346b1
reason:
The cause seems to be passing kernel address directly to TP_printk(),
which is not right. As the enum 'skb_drop_reason' is not exported to
user space through TRACE_DEFINE_ENUM(), perf can't get the drop reason
string from the 'reason' field, which is a number.
Therefore, we introduce the macro DEFINE_DROP_REASON(), which is used
to define the trace enum by TRACE_DEFINE_ENUM(). With the help of
DEFINE_DROP_REASON(), now we can remove the auto-generate that we
introduced in the commit ec43908dd556
("net: skb: use auto-generation to convert skb drop reason to string"),
and define the string array 'drop_reasons'.
Hmmmm...now we come back to the situation that have to maintain drop
reasons in both enum skb_drop_reason and DEFINE_DROP_REASON. But they
are both in dropreason.h, which makes it easier.
After this commit, now the format of kfree_skb is like this:
$ cat /tracing/events/skb/kfree_skb/format
name: kfree_skb
ID: 1524
format:
field:unsigned short common_type; offset:0; size:2; signed:0;
field:unsigned char common_flags; offset:2; size:1; signed:0;
field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
field:int common_pid; offset:4; size:4; signed:1;
field:void * skbaddr; offset:8; size:8; signed:0;
field:void * location; offset:16; size:8; signed:0;
field:unsigned short protocol; offset:24; size:2; signed:0;
field:enum skb_drop_reason reason; offset:28; size:4; signed:0;
print fmt: "skbaddr=%p protocol=%u location=%p reason: %s", REC->skbaddr, REC->protocol, REC->location, __print_symbolic(REC->reason, { 1, "NOT_SPECIFIED" }, { 2, "NO_SOCKET" } ......
Fixes: ec43908dd556 ("net: skb: use auto-generation to convert skb drop reason to string")
Link: https://lore.kernel.org/netdev/CANn89i+bx0ybvE55iMYf5GJM48WwV1HNpdm9Q6t-HaEstqpCSA@mail.gmail.com/
Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Menglong Dong <imagedong@tencent.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-09-05 11:50:15 +08:00
|
|
|
FN(QDISC_DROP) \
|
2024-12-11 11:17:09 +01:00
|
|
|
FN(QDISC_OVERLIMIT) \
|
|
|
|
FN(QDISC_CONGESTED) \
|
|
|
|
FN(CAKE_FLOOD) \
|
2024-12-04 17:19:50 +00:00
|
|
|
FN(FQ_BAND_LIMIT) \
|
|
|
|
FN(FQ_HORIZON_LIMIT) \
|
|
|
|
FN(FQ_FLOW_LIMIT) \
|
net: skb: export skb drop reaons to user by TRACE_DEFINE_ENUM
As Eric reported, the 'reason' field is not presented when trace the
kfree_skb event by perf:
$ perf record -e skb:kfree_skb -a sleep 10
$ perf script
ip_defrag 14605 [021] 221.614303: skb:kfree_skb:
skbaddr=0xffff9d2851242700 protocol=34525 location=0xffffffffa39346b1
reason:
The cause seems to be passing kernel address directly to TP_printk(),
which is not right. As the enum 'skb_drop_reason' is not exported to
user space through TRACE_DEFINE_ENUM(), perf can't get the drop reason
string from the 'reason' field, which is a number.
Therefore, we introduce the macro DEFINE_DROP_REASON(), which is used
to define the trace enum by TRACE_DEFINE_ENUM(). With the help of
DEFINE_DROP_REASON(), now we can remove the auto-generate that we
introduced in the commit ec43908dd556
("net: skb: use auto-generation to convert skb drop reason to string"),
and define the string array 'drop_reasons'.
Hmmmm...now we come back to the situation that have to maintain drop
reasons in both enum skb_drop_reason and DEFINE_DROP_REASON. But they
are both in dropreason.h, which makes it easier.
After this commit, now the format of kfree_skb is like this:
$ cat /tracing/events/skb/kfree_skb/format
name: kfree_skb
ID: 1524
format:
field:unsigned short common_type; offset:0; size:2; signed:0;
field:unsigned char common_flags; offset:2; size:1; signed:0;
field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
field:int common_pid; offset:4; size:4; signed:1;
field:void * skbaddr; offset:8; size:8; signed:0;
field:void * location; offset:16; size:8; signed:0;
field:unsigned short protocol; offset:24; size:2; signed:0;
field:enum skb_drop_reason reason; offset:28; size:4; signed:0;
print fmt: "skbaddr=%p protocol=%u location=%p reason: %s", REC->skbaddr, REC->protocol, REC->location, __print_symbolic(REC->reason, { 1, "NOT_SPECIFIED" }, { 2, "NO_SOCKET" } ......
Fixes: ec43908dd556 ("net: skb: use auto-generation to convert skb drop reason to string")
Link: https://lore.kernel.org/netdev/CANn89i+bx0ybvE55iMYf5GJM48WwV1HNpdm9Q6t-HaEstqpCSA@mail.gmail.com/
Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Menglong Dong <imagedong@tencent.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-09-05 11:50:15 +08:00
|
|
|
FN(CPU_BACKLOG) \
|
|
|
|
FN(XDP) \
|
|
|
|
FN(TC_INGRESS) \
|
|
|
|
FN(UNHANDLED_PROTO) \
|
|
|
|
FN(SKB_CSUM) \
|
|
|
|
FN(SKB_GSO_SEG) \
|
|
|
|
FN(SKB_UCOPY_FAULT) \
|
|
|
|
FN(DEV_HDR) \
|
|
|
|
FN(DEV_READY) \
|
|
|
|
FN(FULL_RING) \
|
|
|
|
FN(NOMEM) \
|
|
|
|
FN(HDR_TRUNC) \
|
|
|
|
FN(TAP_FILTER) \
|
|
|
|
FN(TAP_TXFILTER) \
|
|
|
|
FN(ICMP_CSUM) \
|
|
|
|
FN(INVALID_PROTO) \
|
|
|
|
FN(IP_INADDRERRORS) \
|
|
|
|
FN(IP_INNOROUTES) \
|
net: ip: make fib_validate_source() support drop reasons
In this commit, we make fib_validate_source() and __fib_validate_source()
return -reason instead of errno on error.
The return value of fib_validate_source can be -errno, 0, and 1. It's hard
to make fib_validate_source() return drop reasons directly.
The fib_validate_source() will return 1 if the scope of the source(revert)
route is HOST. And the __mkroute_input() will mark the skb with
IPSKB_DOREDIRECT in this case (combine with some other conditions). And
then, a REDIRECT ICMP will be sent in ip_forward() if this flag exists. We
can't pass this information to __mkroute_input if we make
fib_validate_source() return drop reasons.
Therefore, we introduce the wrapper fib_validate_source_reason() for
fib_validate_source(), which will return the drop reasons on error.
In the origin logic, LINUX_MIB_IPRPFILTER will be counted if
fib_validate_source() return -EXDEV. And now, we need to adjust it by
checking "reason == SKB_DROP_REASON_IP_RPFILTER". However, this will take
effect only after the patch "net: ip: make ip_route_input_noref() return
drop reasons", as we can't pass the drop reasons from
fib_validate_source() to ip_rcv_finish_core() in this patch.
Following new drop reasons are added in this patch:
SKB_DROP_REASON_IP_LOCAL_SOURCE
SKB_DROP_REASON_IP_INVALID_SOURCE
Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2024-11-07 20:55:53 +08:00
|
|
|
FN(IP_LOCAL_SOURCE) \
|
|
|
|
FN(IP_INVALID_SOURCE) \
|
2024-11-07 20:55:55 +08:00
|
|
|
FN(IP_LOCALNET) \
|
2024-11-07 20:55:56 +08:00
|
|
|
FN(IP_INVALID_DEST) \
|
net: skb: export skb drop reaons to user by TRACE_DEFINE_ENUM
As Eric reported, the 'reason' field is not presented when trace the
kfree_skb event by perf:
$ perf record -e skb:kfree_skb -a sleep 10
$ perf script
ip_defrag 14605 [021] 221.614303: skb:kfree_skb:
skbaddr=0xffff9d2851242700 protocol=34525 location=0xffffffffa39346b1
reason:
The cause seems to be passing kernel address directly to TP_printk(),
which is not right. As the enum 'skb_drop_reason' is not exported to
user space through TRACE_DEFINE_ENUM(), perf can't get the drop reason
string from the 'reason' field, which is a number.
Therefore, we introduce the macro DEFINE_DROP_REASON(), which is used
to define the trace enum by TRACE_DEFINE_ENUM(). With the help of
DEFINE_DROP_REASON(), now we can remove the auto-generate that we
introduced in the commit ec43908dd556
("net: skb: use auto-generation to convert skb drop reason to string"),
and define the string array 'drop_reasons'.
Hmmmm...now we come back to the situation that have to maintain drop
reasons in both enum skb_drop_reason and DEFINE_DROP_REASON. But they
are both in dropreason.h, which makes it easier.
After this commit, now the format of kfree_skb is like this:
$ cat /tracing/events/skb/kfree_skb/format
name: kfree_skb
ID: 1524
format:
field:unsigned short common_type; offset:0; size:2; signed:0;
field:unsigned char common_flags; offset:2; size:1; signed:0;
field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
field:int common_pid; offset:4; size:4; signed:1;
field:void * skbaddr; offset:8; size:8; signed:0;
field:void * location; offset:16; size:8; signed:0;
field:unsigned short protocol; offset:24; size:2; signed:0;
field:enum skb_drop_reason reason; offset:28; size:4; signed:0;
print fmt: "skbaddr=%p protocol=%u location=%p reason: %s", REC->skbaddr, REC->protocol, REC->location, __print_symbolic(REC->reason, { 1, "NOT_SPECIFIED" }, { 2, "NO_SOCKET" } ......
Fixes: ec43908dd556 ("net: skb: use auto-generation to convert skb drop reason to string")
Link: https://lore.kernel.org/netdev/CANn89i+bx0ybvE55iMYf5GJM48WwV1HNpdm9Q6t-HaEstqpCSA@mail.gmail.com/
Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Menglong Dong <imagedong@tencent.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-09-05 11:50:15 +08:00
|
|
|
FN(PKT_TOO_BIG) \
|
2022-10-29 15:45:18 +00:00
|
|
|
FN(DUP_FRAG) \
|
2022-10-29 15:45:19 +00:00
|
|
|
FN(FRAG_REASM_TIMEOUT) \
|
2022-10-29 15:45:20 +00:00
|
|
|
FN(FRAG_TOO_FAR) \
|
2023-02-01 17:43:45 +00:00
|
|
|
FN(TCP_MINTTL) \
|
2023-02-10 18:47:05 +00:00
|
|
|
FN(IPV6_BAD_EXTHDR) \
|
2023-02-10 18:47:08 +00:00
|
|
|
FN(IPV6_NDISC_FRAG) \
|
|
|
|
FN(IPV6_NDISC_HOP_LIMIT) \
|
|
|
|
FN(IPV6_NDISC_BAD_CODE) \
|
2023-02-16 16:28:40 +00:00
|
|
|
FN(IPV6_NDISC_BAD_OPTIONS) \
|
2023-02-16 16:28:41 +00:00
|
|
|
FN(IPV6_NDISC_NS_OTHERHOST) \
|
2023-08-18 09:40:39 +00:00
|
|
|
FN(QUEUE_PURGE) \
|
2023-12-16 17:44:36 -03:00
|
|
|
FN(TC_COOKIE_ERROR) \
|
2023-12-04 11:33:28 -08:00
|
|
|
FN(PACKET_SOCK_ERROR) \
|
2023-12-16 17:44:36 -03:00
|
|
|
FN(TC_CHAIN_NOTFOUND) \
|
|
|
|
FN(TC_RECLASSIFY_LOOP) \
|
2024-10-09 10:28:22 +08:00
|
|
|
FN(VXLAN_INVALID_HDR) \
|
|
|
|
FN(VXLAN_VNI_NOT_FOUND) \
|
2024-10-09 10:28:24 +08:00
|
|
|
FN(MAC_INVALID_SOURCE) \
|
|
|
|
FN(VXLAN_ENTRY_EXISTS) \
|
2024-12-19 11:36:05 -05:00
|
|
|
FN(NO_TX_TARGET) \
|
2024-10-09 10:28:22 +08:00
|
|
|
FN(IP_TUNNEL_ECN) \
|
2024-10-09 10:28:26 +08:00
|
|
|
FN(TUNNEL_TXINFO) \
|
2024-10-09 10:28:25 +08:00
|
|
|
FN(LOCAL_MAC) \
|
2024-11-07 20:56:00 +08:00
|
|
|
FN(ARP_PVLAN_DISABLE) \
|
2024-12-19 11:36:06 -05:00
|
|
|
FN(MAC_IEEE_MAC_CONTROL) \
|
|
|
|
FN(BRIDGE_INGRESS_STP_STATE) \
|
2025-06-04 18:06:04 +02:00
|
|
|
FN(CAN_RX_INVALID_FRAME) \
|
|
|
|
FN(CANFD_RX_INVALID_FRAME) \
|
|
|
|
FN(CANXL_RX_INVALID_FRAME) \
|
2025-07-16 18:26:53 +02:00
|
|
|
FN(PFMEMALLOC) \
|
sched: Add enqueue/dequeue of dualpi2 qdisc
DualPI2 provides L4S-type low latency & loss to traffic that uses a
scalable congestion controller (e.g. TCP-Prague, DCTCP) without
degrading the performance of 'classic' traffic (e.g. Reno,
Cubic etc.). It is to be the reference implementation of IETF RFC9332
DualQ Coupled AQM (https://datatracker.ietf.org/doc/html/rfc9332).
Note that creating two independent queues cannot meet the goal of
DualPI2 mentioned in RFC9332: "...to preserve fairness between
ECN-capable and non-ECN-capable traffic." Further, it could even
lead to starvation of Classic traffic, which is also inconsistent
with the requirements in RFC9332: "...although priority MUST be
bounded in order not to starve Classic traffic." DualPI2 is
designed to maintain approximate per-flow fairness on L-queue and
C-queue by forming a single qdisc using the coupling factor and
scheduler between two queues.
The qdisc provides two queues called low latency and classic. It
classifies packets based on the ECN field in the IP headers. By
default it directs non-ECN and ECT(0) into the classic queue and
ECT(1) and CE into the low latency queue, as per the IETF spec.
Each queue runs its own AQM:
* The classic AQM is called PI2, which is similar to the PIE AQM but
more responsive and simpler. Classic traffic requires a decent
target queue (default 15ms for Internet deployment) to fully
utilize the link and to avoid high drop rates.
* The low latency AQM is, by default, a very shallow ECN marking
threshold (1ms) similar to that used for DCTCP.
The DualQ isolates the low queuing delay of the Low Latency queue
from the larger delay of the 'Classic' queue. However, from a
bandwidth perspective, flows in either queue will share out the link
capacity as if there was just a single queue. This bandwidth pooling
effect is achieved by coupling together the drop and ECN-marking
probabilities of the two AQMs.
The PI2 AQM has two main parameters in addition to its target delay.
The integral gain factor alpha is used to slowly correct any persistent
standing queue error from the target delay, while the proportional gain
factor beta is used to quickly compensate for queue changes (growth or
shrinkage). Either alpha and beta are given as a parameter, or they can
be calculated by tc from alternative typical and maximum RTT parameters.
Internally, the output of a linear Proportional Integral (PI)
controller is used for both queues. This output is squared to
calculate the drop or ECN-marking probability of the classic queue.
This counterbalances the square-root rate equation of Reno/Cubic,
which is the trick that balances flow rates across the queues. For
the ECN-marking probability of the low latency queue, the output of
the base AQM is multiplied by a coupling factor. This determines the
balance between the flow rates in each queue. The default setting
makes the flow rates roughly equal, which should be generally
applicable.
If DUALPI2 AQM has detected overload (due to excessive non-responsive
traffic in either queue), it will switch to signaling congestion
solely using drop, irrespective of the ECN field. Alternatively, it
can be configured to limit the drop probability and let the queue
grow and eventually overflow (like tail-drop).
GSO splitting in DUALPI2 is configurable from userspace while the
default behavior is to split gso. When running DUALPI2 at unshaped
10gigE with 4 download streams test, splitting gso apart results in
halving the latency with no loss in throughput:
Summary of tcp_4down run 'no_split_gso':
avg median # data pts
Ping (ms) ICMP : 0.53 0.30 ms 350
TCP download avg : 2326.86 N/A Mbits/s 350
TCP download sum : 9307.42 N/A Mbits/s 350
TCP download::1 : 2672.99 2568.73 Mbits/s 350
TCP download::2 : 2586.96 2570.51 Mbits/s 350
TCP download::3 : 1786.26 1798.82 Mbits/s 350
TCP download::4 : 2261.21 2309.49 Mbits/s 350
Summart of tcp_4down run 'split_gso':
avg median # data pts
Ping (ms) ICMP : 0.22 0.23 ms 350
TCP download avg : 2335.02 N/A Mbits/s 350
TCP download sum : 9340.09 N/A Mbits/s 350
TCP download::1 : 2335.30 2334.22 Mbits/s 350
TCP download::2 : 2334.72 2334.20 Mbits/s 350
TCP download::3 : 2335.28 2334.58 Mbits/s 350
TCP download::4 : 2334.79 2334.39 Mbits/s 350
A similar result is observed when running DUALPI2 at unshaped 1gigE
with 1 download stream test:
Summary of tcp_1down run 'no_split_gso':
avg median # data pts
Ping (ms) ICMP : 1.13 1.25 ms 350
TCP download : 941.41 941.46 Mbits/s 350
Summart of tcp_1down run 'split_gso':
avg median # data pts
Ping (ms) ICMP : 0.51 0.55 ms 350
TCP download : 941.41 941.45 Mbits/s 350
Additional details can be found in the draft:
https://datatracker.ietf.org/doc/html/rfc9332
Signed-off-by: Koen De Schepper <koen.de_schepper@nokia-bell-labs.com>
Co-developed-by: Olga Albisser <olga@albisser.org>
Signed-off-by: Olga Albisser <olga@albisser.org>
Co-developed-by: Olivier Tilmans <olivier.tilmans@nokia.com>
Signed-off-by: Olivier Tilmans <olivier.tilmans@nokia.com>
Co-developed-by: Henrik Steen <henrist@henrist.net>
Signed-off-by: Henrik Steen <henrist@henrist.net>
Co-developed-by: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
Signed-off-by: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
Signed-off-by: Bob Briscoe <research@bobbriscoe.net>
Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Acked-by: Dave Taht <dave.taht@gmail.com>
Link: https://patch.msgid.link/20250722095915.24485-4-chia-yu.chang@nokia-bell-labs.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-07-22 11:59:12 +02:00
|
|
|
FN(DUALPI2_STEP_DROP) \
|
net: skb: export skb drop reaons to user by TRACE_DEFINE_ENUM
As Eric reported, the 'reason' field is not presented when trace the
kfree_skb event by perf:
$ perf record -e skb:kfree_skb -a sleep 10
$ perf script
ip_defrag 14605 [021] 221.614303: skb:kfree_skb:
skbaddr=0xffff9d2851242700 protocol=34525 location=0xffffffffa39346b1
reason:
The cause seems to be passing kernel address directly to TP_printk(),
which is not right. As the enum 'skb_drop_reason' is not exported to
user space through TRACE_DEFINE_ENUM(), perf can't get the drop reason
string from the 'reason' field, which is a number.
Therefore, we introduce the macro DEFINE_DROP_REASON(), which is used
to define the trace enum by TRACE_DEFINE_ENUM(). With the help of
DEFINE_DROP_REASON(), now we can remove the auto-generate that we
introduced in the commit ec43908dd556
("net: skb: use auto-generation to convert skb drop reason to string"),
and define the string array 'drop_reasons'.
Hmmmm...now we come back to the situation that have to maintain drop
reasons in both enum skb_drop_reason and DEFINE_DROP_REASON. But they
are both in dropreason.h, which makes it easier.
After this commit, now the format of kfree_skb is like this:
$ cat /tracing/events/skb/kfree_skb/format
name: kfree_skb
ID: 1524
format:
field:unsigned short common_type; offset:0; size:2; signed:0;
field:unsigned char common_flags; offset:2; size:1; signed:0;
field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
field:int common_pid; offset:4; size:4; signed:1;
field:void * skbaddr; offset:8; size:8; signed:0;
field:void * location; offset:16; size:8; signed:0;
field:unsigned short protocol; offset:24; size:2; signed:0;
field:enum skb_drop_reason reason; offset:28; size:4; signed:0;
print fmt: "skbaddr=%p protocol=%u location=%p reason: %s", REC->skbaddr, REC->protocol, REC->location, __print_symbolic(REC->reason, { 1, "NOT_SPECIFIED" }, { 2, "NO_SOCKET" } ......
Fixes: ec43908dd556 ("net: skb: use auto-generation to convert skb drop reason to string")
Link: https://lore.kernel.org/netdev/CANn89i+bx0ybvE55iMYf5GJM48WwV1HNpdm9Q6t-HaEstqpCSA@mail.gmail.com/
Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Menglong Dong <imagedong@tencent.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-09-05 11:50:15 +08:00
|
|
|
FNe(MAX)
|
|
|
|
|
2022-06-06 10:24:36 +08:00
|
|
|
/**
|
|
|
|
* enum skb_drop_reason - the reasons of skb drops
|
2022-06-06 10:24:34 +08:00
|
|
|
*
|
2022-06-06 10:24:36 +08:00
|
|
|
* The reason of skb drop, which is used in kfree_skb_reason().
|
2022-06-06 10:24:34 +08:00
|
|
|
*/
|
|
|
|
enum skb_drop_reason {
|
2022-06-06 10:24:36 +08:00
|
|
|
/**
|
|
|
|
* @SKB_NOT_DROPPED_YET: skb is not dropped yet (used for no-drop case)
|
|
|
|
*/
|
2022-06-06 10:24:34 +08:00
|
|
|
SKB_NOT_DROPPED_YET = 0,
|
2022-10-29 15:45:16 +00:00
|
|
|
/** @SKB_CONSUMED: packet has been consumed */
|
|
|
|
SKB_CONSUMED,
|
2022-06-06 10:24:36 +08:00
|
|
|
/** @SKB_DROP_REASON_NOT_SPECIFIED: drop reason is not specified */
|
|
|
|
SKB_DROP_REASON_NOT_SPECIFIED,
|
2024-02-26 11:22:18 +08:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_NO_SOCKET: no valid socket that can be used.
|
|
|
|
* Reason could be one of three cases:
|
|
|
|
* 1) no established/listening socket found during lookup process
|
|
|
|
* 2) no valid request socket during 3WHS process
|
|
|
|
* 3) no valid child socket during 3WHS process
|
|
|
|
*/
|
2022-06-06 10:24:36 +08:00
|
|
|
SKB_DROP_REASON_NO_SOCKET,
|
2025-01-16 14:34:35 +09:00
|
|
|
/** @SKB_DROP_REASON_SOCKET_CLOSE: socket is close()d */
|
|
|
|
SKB_DROP_REASON_SOCKET_CLOSE,
|
2025-01-16 14:34:34 +09:00
|
|
|
/** @SKB_DROP_REASON_SOCKET_FILTER: dropped by socket filter */
|
|
|
|
SKB_DROP_REASON_SOCKET_FILTER,
|
|
|
|
/** @SKB_DROP_REASON_SOCKET_RCVBUFF: socket receive buff is full */
|
|
|
|
SKB_DROP_REASON_SOCKET_RCVBUFF,
|
2025-01-16 14:34:40 +09:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_UNIX_DISCONNECT: recv queue is purged when SOCK_DGRAM
|
|
|
|
* or SOCK_SEQPACKET socket re-connect()s to another socket or notices
|
|
|
|
* during send() that the peer has been close()d.
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_UNIX_DISCONNECT,
|
2025-01-16 14:34:38 +09:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_UNIX_SKIP_OOB: Out-Of-Band data is skipped by
|
|
|
|
* recv() without MSG_OOB so dropped.
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_UNIX_SKIP_OOB,
|
2022-06-06 10:24:36 +08:00
|
|
|
/** @SKB_DROP_REASON_PKT_TOO_SMALL: packet size is too small */
|
|
|
|
SKB_DROP_REASON_PKT_TOO_SMALL,
|
|
|
|
/** @SKB_DROP_REASON_TCP_CSUM: TCP checksum error */
|
|
|
|
SKB_DROP_REASON_TCP_CSUM,
|
|
|
|
/** @SKB_DROP_REASON_UDP_CSUM: UDP checksum error */
|
|
|
|
SKB_DROP_REASON_UDP_CSUM,
|
|
|
|
/** @SKB_DROP_REASON_NETFILTER_DROP: dropped by netfilter */
|
|
|
|
SKB_DROP_REASON_NETFILTER_DROP,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_OTHERHOST: packet don't belong to current host
|
|
|
|
* (interface is in promisc mode)
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_OTHERHOST,
|
|
|
|
/** @SKB_DROP_REASON_IP_CSUM: IP checksum error */
|
|
|
|
SKB_DROP_REASON_IP_CSUM,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_IP_INHDR: there is something wrong with IP header (see
|
|
|
|
* IPSTATS_MIB_INHDRERRORS)
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_IP_INHDR,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_IP_RPFILTER: IP rpfilter validate failed. see the
|
|
|
|
* document for rp_filter in ip-sysctl.rst for more information
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_IP_RPFILTER,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_UNICAST_IN_L2_MULTICAST: destination address of L2 is
|
|
|
|
* multicast, but L3 is unicast.
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_UNICAST_IN_L2_MULTICAST,
|
|
|
|
/** @SKB_DROP_REASON_XFRM_POLICY: xfrm policy check failed */
|
|
|
|
SKB_DROP_REASON_XFRM_POLICY,
|
|
|
|
/** @SKB_DROP_REASON_IP_NOPROTO: no support for IP protocol */
|
|
|
|
SKB_DROP_REASON_IP_NOPROTO,
|
|
|
|
/**
|
2024-08-22 13:57:33 +01:00
|
|
|
* @SKB_DROP_REASON_PROTO_MEM: proto memory limitation, such as
|
|
|
|
* udp packet drop out of udp_memory_allocated.
|
2022-06-06 10:24:36 +08:00
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_PROTO_MEM,
|
2023-10-23 20:21:59 +01:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TCP_AUTH_HDR: TCP-MD5 or TCP-AO hashes are met
|
|
|
|
* twice or set incorrectly.
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TCP_AUTH_HDR,
|
2022-06-06 10:24:36 +08:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TCP_MD5NOTFOUND: no MD5 hash and one expected,
|
|
|
|
* corresponding to LINUX_MIB_TCPMD5NOTFOUND
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TCP_MD5NOTFOUND,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TCP_MD5UNEXPECTED: MD5 hash and we're not expecting
|
|
|
|
* one, corresponding to LINUX_MIB_TCPMD5UNEXPECTED
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TCP_MD5UNEXPECTED,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TCP_MD5FAILURE: MD5 hash and its wrong, corresponding
|
|
|
|
* to LINUX_MIB_TCPMD5FAILURE
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TCP_MD5FAILURE,
|
2023-10-23 20:22:04 +01:00
|
|
|
/**
|
2023-10-23 20:22:05 +01:00
|
|
|
* @SKB_DROP_REASON_TCP_AONOTFOUND: no TCP-AO hash and one was expected,
|
|
|
|
* corresponding to LINUX_MIB_TCPAOREQUIRED
|
2023-10-23 20:22:04 +01:00
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TCP_AONOTFOUND,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TCP_AOUNEXPECTED: TCP-AO hash is present and it
|
2023-10-23 20:22:05 +01:00
|
|
|
* was not expected, corresponding to LINUX_MIB_TCPAOKEYNOTFOUND
|
2023-10-23 20:22:04 +01:00
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TCP_AOUNEXPECTED,
|
2023-10-23 20:22:05 +01:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TCP_AOKEYNOTFOUND: TCP-AO key is unknown,
|
|
|
|
* corresponding to LINUX_MIB_TCPAOKEYNOTFOUND
|
|
|
|
*/
|
2023-10-23 20:22:04 +01:00
|
|
|
SKB_DROP_REASON_TCP_AOKEYNOTFOUND,
|
2023-10-23 20:22:05 +01:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TCP_AOFAILURE: TCP-AO hash is wrong,
|
|
|
|
* corresponding to LINUX_MIB_TCPAOBAD
|
|
|
|
*/
|
2023-10-23 20:22:04 +01:00
|
|
|
SKB_DROP_REASON_TCP_AOFAILURE,
|
2022-06-06 10:24:36 +08:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_SOCKET_BACKLOG: failed to add skb to socket backlog (
|
|
|
|
* see LINUX_MIB_TCPBACKLOGDROP)
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_SOCKET_BACKLOG,
|
|
|
|
/** @SKB_DROP_REASON_TCP_FLAGS: TCP flags invalid */
|
|
|
|
SKB_DROP_REASON_TCP_FLAGS,
|
2024-02-26 11:22:23 +08:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TCP_ABORT_ON_DATA: abort on data, corresponding to
|
|
|
|
* LINUX_MIB_TCPABORTONDATA
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TCP_ABORT_ON_DATA,
|
2022-06-06 10:24:36 +08:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TCP_ZEROWINDOW: TCP receive window size is zero,
|
|
|
|
* see LINUX_MIB_TCPZEROWINDOWDROP
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TCP_ZEROWINDOW,
|
|
|
|
/**
|
2024-08-22 13:57:33 +01:00
|
|
|
* @SKB_DROP_REASON_TCP_OLD_DATA: the TCP data received is already
|
2022-06-06 10:24:36 +08:00
|
|
|
* received before (spurious retrans may happened), see
|
|
|
|
* LINUX_MIB_DELAYEDACKLOST
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TCP_OLD_DATA,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TCP_OVERWINDOW: the TCP data is out of window,
|
|
|
|
* the seq of the first byte exceed the right edges of receive
|
|
|
|
* window
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TCP_OVERWINDOW,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TCP_OFOMERGE: the data of skb is already in the ofo
|
|
|
|
* queue, corresponding to LINUX_MIB_TCPOFOMERGE
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TCP_OFOMERGE,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TCP_RFC7323_PAWS: PAWS check, corresponding to
|
2024-02-26 11:22:23 +08:00
|
|
|
* LINUX_MIB_PAWSESTABREJECTED, LINUX_MIB_PAWSACTIVEREJECTED
|
2022-06-06 10:24:36 +08:00
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TCP_RFC7323_PAWS,
|
2025-01-13 13:55:57 +00:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TCP_RFC7323_PAWS_ACK: PAWS check, old ACK packet.
|
2025-01-13 13:55:58 +00:00
|
|
|
* Corresponds to LINUX_MIB_PAWS_OLD_ACK.
|
2025-01-13 13:55:57 +00:00
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TCP_RFC7323_PAWS_ACK,
|
tcp: add TCP_RFC7323_TW_PAWS drop reason
Devices in the networking path, such as firewalls, NATs, or routers, which
can perform SNAT or DNAT, use addresses from their own limited address
pools to masquerade the source address during forwarding, causing PAWS
verification to fail more easily.
Currently, packet loss statistics for PAWS can only be viewed through MIB,
which is a global metric and cannot be precisely obtained through tracing
to get the specific 4-tuple of the dropped packet. In the past, we had to
use kprobe ret to retrieve relevant skb information from
tcp_timewait_state_process().
We add a drop_reason pointer, similar to what previous commit does:
commit e34100c2ecbb ("tcp: add a drop_reason pointer to tcp_check_req()")
This commit addresses the PAWSESTABREJECTED case and also sets the
corresponding drop reason.
We use 'pwru' to test.
Before this commit:
''''
./pwru 'port 9999'
2025/04/07 13:40:19 Listening for events..
TUPLE FUNC
172.31.75.115:12345->172.31.75.114:9999(tcp) sk_skb_reason_drop(SKB_DROP_REASON_NOT_SPECIFIED)
'''
After this commit:
'''
./pwru 'port 9999'
2025/04/07 13:51:34 Listening for events..
TUPLE FUNC
172.31.75.115:12345->172.31.75.114:9999(tcp) sk_skb_reason_drop(SKB_DROP_REASON_TCP_RFC7323_TW_PAWS)
'''
Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20250409112614.16153-2-jiayuan.chen@linux.dev
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-04-09 19:26:04 +08:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TCP_RFC7323_TW_PAWS: PAWS check, socket is in
|
|
|
|
* TIME_WAIT state.
|
2025-04-09 19:26:05 +08:00
|
|
|
* Corresponds to LINUX_MIB_PAWS_TW_REJECTED.
|
tcp: add TCP_RFC7323_TW_PAWS drop reason
Devices in the networking path, such as firewalls, NATs, or routers, which
can perform SNAT or DNAT, use addresses from their own limited address
pools to masquerade the source address during forwarding, causing PAWS
verification to fail more easily.
Currently, packet loss statistics for PAWS can only be viewed through MIB,
which is a global metric and cannot be precisely obtained through tracing
to get the specific 4-tuple of the dropped packet. In the past, we had to
use kprobe ret to retrieve relevant skb information from
tcp_timewait_state_process().
We add a drop_reason pointer, similar to what previous commit does:
commit e34100c2ecbb ("tcp: add a drop_reason pointer to tcp_check_req()")
This commit addresses the PAWSESTABREJECTED case and also sets the
corresponding drop reason.
We use 'pwru' to test.
Before this commit:
''''
./pwru 'port 9999'
2025/04/07 13:40:19 Listening for events..
TUPLE FUNC
172.31.75.115:12345->172.31.75.114:9999(tcp) sk_skb_reason_drop(SKB_DROP_REASON_NOT_SPECIFIED)
'''
After this commit:
'''
./pwru 'port 9999'
2025/04/07 13:51:34 Listening for events..
TUPLE FUNC
172.31.75.115:12345->172.31.75.114:9999(tcp) sk_skb_reason_drop(SKB_DROP_REASON_TCP_RFC7323_TW_PAWS)
'''
Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20250409112614.16153-2-jiayuan.chen@linux.dev
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-04-09 19:26:04 +08:00
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TCP_RFC7323_TW_PAWS,
|
2025-03-01 20:14:20 +00:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TCP_RFC7323_TSECR: PAWS check, invalid TSEcr.
|
|
|
|
* Corresponds to LINUX_MIB_TSECRREJECTED.
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TCP_RFC7323_TSECR,
|
|
|
|
/** @SKB_DROP_REASON_TCP_LISTEN_OVERFLOW: listener queue full. */
|
|
|
|
SKB_DROP_REASON_TCP_LISTEN_OVERFLOW,
|
2023-07-19 06:47:54 +00:00
|
|
|
/** @SKB_DROP_REASON_TCP_OLD_SEQUENCE: Old SEQ field (duplicate packet) */
|
|
|
|
SKB_DROP_REASON_TCP_OLD_SEQUENCE,
|
2025-07-11 11:39:59 +00:00
|
|
|
/** @SKB_DROP_REASON_TCP_INVALID_SEQUENCE: Not acceptable SEQ field. */
|
2022-06-06 10:24:36 +08:00
|
|
|
SKB_DROP_REASON_TCP_INVALID_SEQUENCE,
|
2025-07-11 11:39:59 +00:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TCP_INVALID_END_SEQUENCE:
|
|
|
|
* Not acceptable END_SEQ field.
|
2025-07-11 11:40:00 +00:00
|
|
|
* Corresponds to LINUX_MIB_BEYOND_WINDOW.
|
2025-07-11 11:39:59 +00:00
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TCP_INVALID_END_SEQUENCE,
|
2024-02-26 11:22:23 +08:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TCP_INVALID_ACK_SEQUENCE: Not acceptable ACK SEQ
|
|
|
|
* field because ack sequence is not in the window between snd_una
|
|
|
|
* and snd_nxt
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TCP_INVALID_ACK_SEQUENCE,
|
2022-06-06 10:24:36 +08:00
|
|
|
/** @SKB_DROP_REASON_TCP_RESET: Invalid RST packet */
|
|
|
|
SKB_DROP_REASON_TCP_RESET,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TCP_INVALID_SYN: Incoming packet has unexpected
|
|
|
|
* SYN flag
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TCP_INVALID_SYN,
|
|
|
|
/** @SKB_DROP_REASON_TCP_CLOSE: TCP socket in CLOSE state */
|
|
|
|
SKB_DROP_REASON_TCP_CLOSE,
|
|
|
|
/** @SKB_DROP_REASON_TCP_FASTOPEN: dropped by FASTOPEN request socket */
|
|
|
|
SKB_DROP_REASON_TCP_FASTOPEN,
|
|
|
|
/** @SKB_DROP_REASON_TCP_OLD_ACK: TCP ACK is old, but in window */
|
|
|
|
SKB_DROP_REASON_TCP_OLD_ACK,
|
|
|
|
/** @SKB_DROP_REASON_TCP_TOO_OLD_ACK: TCP ACK is too old */
|
|
|
|
SKB_DROP_REASON_TCP_TOO_OLD_ACK,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TCP_ACK_UNSENT_DATA: TCP ACK for data we haven't
|
|
|
|
* sent yet
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TCP_ACK_UNSENT_DATA,
|
|
|
|
/** @SKB_DROP_REASON_TCP_OFO_QUEUE_PRUNE: pruned from TCP OFO queue */
|
|
|
|
SKB_DROP_REASON_TCP_OFO_QUEUE_PRUNE,
|
|
|
|
/** @SKB_DROP_REASON_TCP_OFO_DROP: data already in receive queue */
|
|
|
|
SKB_DROP_REASON_TCP_OFO_DROP,
|
|
|
|
/** @SKB_DROP_REASON_IP_OUTNOROUTES: route lookup failed */
|
|
|
|
SKB_DROP_REASON_IP_OUTNOROUTES,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_BPF_CGROUP_EGRESS: dropped by BPF_PROG_TYPE_CGROUP_SKB
|
|
|
|
* eBPF program
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_BPF_CGROUP_EGRESS,
|
|
|
|
/** @SKB_DROP_REASON_IPV6DISABLED: IPv6 is disabled on the device */
|
|
|
|
SKB_DROP_REASON_IPV6DISABLED,
|
|
|
|
/** @SKB_DROP_REASON_NEIGH_CREATEFAIL: failed to create neigh entry */
|
|
|
|
SKB_DROP_REASON_NEIGH_CREATEFAIL,
|
|
|
|
/** @SKB_DROP_REASON_NEIGH_FAILED: neigh entry in failed state */
|
|
|
|
SKB_DROP_REASON_NEIGH_FAILED,
|
|
|
|
/** @SKB_DROP_REASON_NEIGH_QUEUEFULL: arp_queue for neigh entry is full */
|
|
|
|
SKB_DROP_REASON_NEIGH_QUEUEFULL,
|
|
|
|
/** @SKB_DROP_REASON_NEIGH_DEAD: neigh entry is dead */
|
|
|
|
SKB_DROP_REASON_NEIGH_DEAD,
|
2025-05-21 10:14:08 +08:00
|
|
|
/** @SKB_DROP_REASON_NEIGH_HH_FILLFAIL: failed to fill the device hard header */
|
|
|
|
SKB_DROP_REASON_NEIGH_HH_FILLFAIL,
|
2022-06-06 10:24:36 +08:00
|
|
|
/** @SKB_DROP_REASON_TC_EGRESS: dropped in TC egress HOOK */
|
|
|
|
SKB_DROP_REASON_TC_EGRESS,
|
2024-02-26 11:22:18 +08:00
|
|
|
/** @SKB_DROP_REASON_SECURITY_HOOK: dropped due to security HOOK */
|
|
|
|
SKB_DROP_REASON_SECURITY_HOOK,
|
2022-06-06 10:24:36 +08:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_QDISC_DROP: dropped by qdisc when packet outputting (
|
|
|
|
* failed to enqueue to current qdisc)
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_QDISC_DROP,
|
2024-12-11 11:17:09 +01:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_QDISC_OVERLIMIT: dropped by qdisc when a qdisc
|
|
|
|
* instance exceeds its total buffer size limit.
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_QDISC_OVERLIMIT,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_QDISC_CONGESTED: dropped by a qdisc AQM algorithm
|
|
|
|
* due to congestion.
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_QDISC_CONGESTED,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_CAKE_FLOOD: dropped by the flood protection part of
|
|
|
|
* CAKE qdisc AQM algorithm (BLUE).
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_CAKE_FLOOD,
|
2024-12-04 17:19:50 +00:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_FQ_BAND_LIMIT: dropped by fq qdisc when per band
|
|
|
|
* limit is reached.
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_FQ_BAND_LIMIT,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_FQ_HORIZON_LIMIT: dropped by fq qdisc when packet
|
|
|
|
* timestamp is too far in the future.
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_FQ_HORIZON_LIMIT,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_FQ_FLOW_LIMIT: dropped by fq qdisc when a flow
|
|
|
|
* exceeds its limits.
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_FQ_FLOW_LIMIT,
|
2022-06-06 10:24:36 +08:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_CPU_BACKLOG: failed to enqueue the skb to the per CPU
|
|
|
|
* backlog queue. This can be caused by backlog queue full (see
|
|
|
|
* netdev_max_backlog in net.rst) or RPS flow limit
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_CPU_BACKLOG,
|
|
|
|
/** @SKB_DROP_REASON_XDP: dropped by XDP in input path */
|
|
|
|
SKB_DROP_REASON_XDP,
|
|
|
|
/** @SKB_DROP_REASON_TC_INGRESS: dropped in TC ingress HOOK */
|
|
|
|
SKB_DROP_REASON_TC_INGRESS,
|
|
|
|
/** @SKB_DROP_REASON_UNHANDLED_PROTO: protocol not implemented or not supported */
|
|
|
|
SKB_DROP_REASON_UNHANDLED_PROTO,
|
|
|
|
/** @SKB_DROP_REASON_SKB_CSUM: sk_buff checksum computation error */
|
|
|
|
SKB_DROP_REASON_SKB_CSUM,
|
|
|
|
/** @SKB_DROP_REASON_SKB_GSO_SEG: gso segmentation error */
|
|
|
|
SKB_DROP_REASON_SKB_GSO_SEG,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_SKB_UCOPY_FAULT: failed to copy data from user space,
|
|
|
|
* e.g., via zerocopy_sg_from_iter() or skb_orphan_frags_rx()
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_SKB_UCOPY_FAULT,
|
|
|
|
/** @SKB_DROP_REASON_DEV_HDR: device driver specific header/metadata is invalid */
|
|
|
|
SKB_DROP_REASON_DEV_HDR,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_DEV_READY: the device is not ready to xmit/recv due to
|
|
|
|
* any of its data structure that is not up/ready/initialized,
|
|
|
|
* e.g., the IFF_UP is not set, or driver specific tun->tfiles[txq]
|
|
|
|
* is not initialized
|
2022-06-06 10:24:34 +08:00
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_DEV_READY,
|
2022-06-06 10:24:36 +08:00
|
|
|
/** @SKB_DROP_REASON_FULL_RING: ring buffer is full */
|
|
|
|
SKB_DROP_REASON_FULL_RING,
|
|
|
|
/** @SKB_DROP_REASON_NOMEM: error due to OOM */
|
|
|
|
SKB_DROP_REASON_NOMEM,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_HDR_TRUNC: failed to trunc/extract the header from
|
|
|
|
* networking data, e.g., failed to pull the protocol header from
|
|
|
|
* frags via pskb_may_pull()
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_HDR_TRUNC,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TAP_FILTER: dropped by (ebpf) filter directly attached
|
|
|
|
* to tun/tap, e.g., via TUNSETFILTEREBPF
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TAP_FILTER,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TAP_TXFILTER: dropped by tx filter implemented at
|
|
|
|
* tun/tap, e.g., check_filter()
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TAP_TXFILTER,
|
|
|
|
/** @SKB_DROP_REASON_ICMP_CSUM: ICMP checksum error */
|
|
|
|
SKB_DROP_REASON_ICMP_CSUM,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_INVALID_PROTO: the packet doesn't follow RFC 2211,
|
|
|
|
* such as a broadcasts ICMP_TIMESTAMP
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_INVALID_PROTO,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_IP_INADDRERRORS: host unreachable, corresponding to
|
|
|
|
* IPSTATS_MIB_INADDRERRORS
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_IP_INADDRERRORS,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_IP_INNOROUTES: network unreachable, corresponding to
|
|
|
|
* IPSTATS_MIB_INADDRERRORS
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_IP_INNOROUTES,
|
net: ip: make fib_validate_source() support drop reasons
In this commit, we make fib_validate_source() and __fib_validate_source()
return -reason instead of errno on error.
The return value of fib_validate_source can be -errno, 0, and 1. It's hard
to make fib_validate_source() return drop reasons directly.
The fib_validate_source() will return 1 if the scope of the source(revert)
route is HOST. And the __mkroute_input() will mark the skb with
IPSKB_DOREDIRECT in this case (combine with some other conditions). And
then, a REDIRECT ICMP will be sent in ip_forward() if this flag exists. We
can't pass this information to __mkroute_input if we make
fib_validate_source() return drop reasons.
Therefore, we introduce the wrapper fib_validate_source_reason() for
fib_validate_source(), which will return the drop reasons on error.
In the origin logic, LINUX_MIB_IPRPFILTER will be counted if
fib_validate_source() return -EXDEV. And now, we need to adjust it by
checking "reason == SKB_DROP_REASON_IP_RPFILTER". However, this will take
effect only after the patch "net: ip: make ip_route_input_noref() return
drop reasons", as we can't pass the drop reasons from
fib_validate_source() to ip_rcv_finish_core() in this patch.
Following new drop reasons are added in this patch:
SKB_DROP_REASON_IP_LOCAL_SOURCE
SKB_DROP_REASON_IP_INVALID_SOURCE
Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2024-11-07 20:55:53 +08:00
|
|
|
/** @SKB_DROP_REASON_IP_LOCAL_SOURCE: the source ip is local */
|
|
|
|
SKB_DROP_REASON_IP_LOCAL_SOURCE,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_IP_INVALID_SOURCE: the source ip is invalid:
|
|
|
|
* 1) source ip is multicast or limited broadcast
|
|
|
|
* 2) source ip is zero and not IGMP
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_IP_INVALID_SOURCE,
|
2024-11-07 20:55:55 +08:00
|
|
|
/** @SKB_DROP_REASON_IP_LOCALNET: source or dest ip is local net */
|
|
|
|
SKB_DROP_REASON_IP_LOCALNET,
|
2024-11-07 20:55:56 +08:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_IP_INVALID_DEST: the dest ip is invalid:
|
|
|
|
* 1) dest ip is 0
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_IP_INVALID_DEST,
|
2022-06-06 10:24:36 +08:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_PKT_TOO_BIG: packet size is too big (maybe exceed the
|
|
|
|
* MTU)
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_PKT_TOO_BIG,
|
2022-10-29 15:45:18 +00:00
|
|
|
/** @SKB_DROP_REASON_DUP_FRAG: duplicate fragment */
|
|
|
|
SKB_DROP_REASON_DUP_FRAG,
|
2022-10-29 15:45:19 +00:00
|
|
|
/** @SKB_DROP_REASON_FRAG_REASM_TIMEOUT: fragment reassembly timeout */
|
|
|
|
SKB_DROP_REASON_FRAG_REASM_TIMEOUT,
|
2022-10-29 15:45:20 +00:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_FRAG_TOO_FAR: ipv4 fragment too far.
|
|
|
|
* (/proc/sys/net/ipv4/ipfrag_max_dist)
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_FRAG_TOO_FAR,
|
2023-02-01 17:43:45 +00:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TCP_MINTTL: ipv4 ttl or ipv6 hoplimit below
|
|
|
|
* the threshold (IP_MINTTL or IPV6_MINHOPCOUNT).
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TCP_MINTTL,
|
2023-02-10 18:47:05 +00:00
|
|
|
/** @SKB_DROP_REASON_IPV6_BAD_EXTHDR: Bad IPv6 extension header. */
|
|
|
|
SKB_DROP_REASON_IPV6_BAD_EXTHDR,
|
2023-02-10 18:47:08 +00:00
|
|
|
/** @SKB_DROP_REASON_IPV6_NDISC_FRAG: invalid frag (suppress_frag_ndisc). */
|
|
|
|
SKB_DROP_REASON_IPV6_NDISC_FRAG,
|
|
|
|
/** @SKB_DROP_REASON_IPV6_NDISC_HOP_LIMIT: invalid hop limit. */
|
|
|
|
SKB_DROP_REASON_IPV6_NDISC_HOP_LIMIT,
|
|
|
|
/** @SKB_DROP_REASON_IPV6_NDISC_BAD_CODE: invalid NDISC icmp6 code. */
|
|
|
|
SKB_DROP_REASON_IPV6_NDISC_BAD_CODE,
|
2023-02-16 16:28:40 +00:00
|
|
|
/** @SKB_DROP_REASON_IPV6_NDISC_BAD_OPTIONS: invalid NDISC options. */
|
|
|
|
SKB_DROP_REASON_IPV6_NDISC_BAD_OPTIONS,
|
2023-04-19 14:52:52 +02:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_IPV6_NDISC_NS_OTHERHOST: NEIGHBOUR SOLICITATION
|
2023-02-16 16:28:41 +00:00
|
|
|
* for another host.
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_IPV6_NDISC_NS_OTHERHOST,
|
2023-08-18 09:40:39 +00:00
|
|
|
/** @SKB_DROP_REASON_QUEUE_PURGE: bulk free. */
|
|
|
|
SKB_DROP_REASON_QUEUE_PURGE,
|
2023-12-16 17:44:36 -03:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TC_COOKIE_ERROR: An error occurred whilst
|
|
|
|
* processing a tc ext cookie.
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TC_COOKIE_ERROR,
|
2023-12-04 11:33:28 -08:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_PACKET_SOCK_ERROR: generic packet socket errors
|
|
|
|
* after its filter matches an incoming packet.
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_PACKET_SOCK_ERROR,
|
2023-12-16 17:44:36 -03:00
|
|
|
/** @SKB_DROP_REASON_TC_CHAIN_NOTFOUND: tc chain lookup failed. */
|
|
|
|
SKB_DROP_REASON_TC_CHAIN_NOTFOUND,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TC_RECLASSIFY_LOOP: tc exceeded max reclassify loop
|
|
|
|
* iterations.
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TC_RECLASSIFY_LOOP,
|
2024-10-09 10:28:22 +08:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_VXLAN_INVALID_HDR: VXLAN header is invalid. E.g.:
|
|
|
|
* 1) reserved fields are not zero
|
|
|
|
* 2) "I" flag is not set
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_VXLAN_INVALID_HDR,
|
|
|
|
/** @SKB_DROP_REASON_VXLAN_VNI_NOT_FOUND: no VXLAN device found for VNI */
|
|
|
|
SKB_DROP_REASON_VXLAN_VNI_NOT_FOUND,
|
2024-10-09 10:28:24 +08:00
|
|
|
/** @SKB_DROP_REASON_MAC_INVALID_SOURCE: source mac is invalid */
|
|
|
|
SKB_DROP_REASON_MAC_INVALID_SOURCE,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_VXLAN_ENTRY_EXISTS: trying to migrate a static
|
|
|
|
* entry or an entry pointing to a nexthop.
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_VXLAN_ENTRY_EXISTS,
|
2024-12-19 11:36:05 -05:00
|
|
|
/** @SKB_DROP_REASON_NO_TX_TARGET: no target found for xmit */
|
|
|
|
SKB_DROP_REASON_NO_TX_TARGET,
|
2024-10-09 10:28:22 +08:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_IP_TUNNEL_ECN: skb is dropped according to
|
|
|
|
* RFC 6040 4.2, see __INET_ECN_decapsulate() for detail.
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_IP_TUNNEL_ECN,
|
2024-10-09 10:28:26 +08:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_TUNNEL_TXINFO: packet without necessary metadata
|
|
|
|
* reached a device which is in "external" mode.
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_TUNNEL_TXINFO,
|
2024-10-09 10:28:25 +08:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_LOCAL_MAC: the source MAC address is equal to
|
|
|
|
* the MAC address of the local netdev.
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_LOCAL_MAC,
|
2024-11-07 20:56:00 +08:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_ARP_PVLAN_DISABLE: packet which is not IP is
|
|
|
|
* forwarded to the in_dev, and the proxy_arp_pvlan is not
|
|
|
|
* enabled.
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_ARP_PVLAN_DISABLE,
|
2024-12-19 11:36:06 -05:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_MAC_IEEE_MAC_CONTROL: the destination MAC address
|
|
|
|
* is an IEEE MAC Control address.
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_MAC_IEEE_MAC_CONTROL,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_BRIDGE_INGRESS_STP_STATE: the STP state of the
|
|
|
|
* ingress bridge port does not allow frames to be forwarded.
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_BRIDGE_INGRESS_STP_STATE,
|
2025-06-04 18:06:04 +02:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_CAN_RX_INVALID_FRAME: received
|
|
|
|
* non conform CAN frame (or device is unable to receive CAN frames)
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_CAN_RX_INVALID_FRAME,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_CANFD_RX_INVALID_FRAME: received
|
|
|
|
* non conform CAN-FD frame (or device is unable to receive CAN frames)
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_CANFD_RX_INVALID_FRAME,
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_CANXL_RX_INVALID_FRAME: received
|
|
|
|
* non conform CAN-XL frame (or device is unable to receive CAN frames)
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_CANXL_RX_INVALID_FRAME,
|
2025-07-16 18:26:53 +02:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_PFMEMALLOC: packet allocated from memory reserve
|
|
|
|
* reached a path or socket not eligible for use of memory reserves
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_PFMEMALLOC,
|
sched: Add enqueue/dequeue of dualpi2 qdisc
DualPI2 provides L4S-type low latency & loss to traffic that uses a
scalable congestion controller (e.g. TCP-Prague, DCTCP) without
degrading the performance of 'classic' traffic (e.g. Reno,
Cubic etc.). It is to be the reference implementation of IETF RFC9332
DualQ Coupled AQM (https://datatracker.ietf.org/doc/html/rfc9332).
Note that creating two independent queues cannot meet the goal of
DualPI2 mentioned in RFC9332: "...to preserve fairness between
ECN-capable and non-ECN-capable traffic." Further, it could even
lead to starvation of Classic traffic, which is also inconsistent
with the requirements in RFC9332: "...although priority MUST be
bounded in order not to starve Classic traffic." DualPI2 is
designed to maintain approximate per-flow fairness on L-queue and
C-queue by forming a single qdisc using the coupling factor and
scheduler between two queues.
The qdisc provides two queues called low latency and classic. It
classifies packets based on the ECN field in the IP headers. By
default it directs non-ECN and ECT(0) into the classic queue and
ECT(1) and CE into the low latency queue, as per the IETF spec.
Each queue runs its own AQM:
* The classic AQM is called PI2, which is similar to the PIE AQM but
more responsive and simpler. Classic traffic requires a decent
target queue (default 15ms for Internet deployment) to fully
utilize the link and to avoid high drop rates.
* The low latency AQM is, by default, a very shallow ECN marking
threshold (1ms) similar to that used for DCTCP.
The DualQ isolates the low queuing delay of the Low Latency queue
from the larger delay of the 'Classic' queue. However, from a
bandwidth perspective, flows in either queue will share out the link
capacity as if there was just a single queue. This bandwidth pooling
effect is achieved by coupling together the drop and ECN-marking
probabilities of the two AQMs.
The PI2 AQM has two main parameters in addition to its target delay.
The integral gain factor alpha is used to slowly correct any persistent
standing queue error from the target delay, while the proportional gain
factor beta is used to quickly compensate for queue changes (growth or
shrinkage). Either alpha and beta are given as a parameter, or they can
be calculated by tc from alternative typical and maximum RTT parameters.
Internally, the output of a linear Proportional Integral (PI)
controller is used for both queues. This output is squared to
calculate the drop or ECN-marking probability of the classic queue.
This counterbalances the square-root rate equation of Reno/Cubic,
which is the trick that balances flow rates across the queues. For
the ECN-marking probability of the low latency queue, the output of
the base AQM is multiplied by a coupling factor. This determines the
balance between the flow rates in each queue. The default setting
makes the flow rates roughly equal, which should be generally
applicable.
If DUALPI2 AQM has detected overload (due to excessive non-responsive
traffic in either queue), it will switch to signaling congestion
solely using drop, irrespective of the ECN field. Alternatively, it
can be configured to limit the drop probability and let the queue
grow and eventually overflow (like tail-drop).
GSO splitting in DUALPI2 is configurable from userspace while the
default behavior is to split gso. When running DUALPI2 at unshaped
10gigE with 4 download streams test, splitting gso apart results in
halving the latency with no loss in throughput:
Summary of tcp_4down run 'no_split_gso':
avg median # data pts
Ping (ms) ICMP : 0.53 0.30 ms 350
TCP download avg : 2326.86 N/A Mbits/s 350
TCP download sum : 9307.42 N/A Mbits/s 350
TCP download::1 : 2672.99 2568.73 Mbits/s 350
TCP download::2 : 2586.96 2570.51 Mbits/s 350
TCP download::3 : 1786.26 1798.82 Mbits/s 350
TCP download::4 : 2261.21 2309.49 Mbits/s 350
Summart of tcp_4down run 'split_gso':
avg median # data pts
Ping (ms) ICMP : 0.22 0.23 ms 350
TCP download avg : 2335.02 N/A Mbits/s 350
TCP download sum : 9340.09 N/A Mbits/s 350
TCP download::1 : 2335.30 2334.22 Mbits/s 350
TCP download::2 : 2334.72 2334.20 Mbits/s 350
TCP download::3 : 2335.28 2334.58 Mbits/s 350
TCP download::4 : 2334.79 2334.39 Mbits/s 350
A similar result is observed when running DUALPI2 at unshaped 1gigE
with 1 download stream test:
Summary of tcp_1down run 'no_split_gso':
avg median # data pts
Ping (ms) ICMP : 1.13 1.25 ms 350
TCP download : 941.41 941.46 Mbits/s 350
Summart of tcp_1down run 'split_gso':
avg median # data pts
Ping (ms) ICMP : 0.51 0.55 ms 350
TCP download : 941.41 941.45 Mbits/s 350
Additional details can be found in the draft:
https://datatracker.ietf.org/doc/html/rfc9332
Signed-off-by: Koen De Schepper <koen.de_schepper@nokia-bell-labs.com>
Co-developed-by: Olga Albisser <olga@albisser.org>
Signed-off-by: Olga Albisser <olga@albisser.org>
Co-developed-by: Olivier Tilmans <olivier.tilmans@nokia.com>
Signed-off-by: Olivier Tilmans <olivier.tilmans@nokia.com>
Co-developed-by: Henrik Steen <henrist@henrist.net>
Signed-off-by: Henrik Steen <henrist@henrist.net>
Co-developed-by: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
Signed-off-by: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
Signed-off-by: Bob Briscoe <research@bobbriscoe.net>
Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Acked-by: Dave Taht <dave.taht@gmail.com>
Link: https://patch.msgid.link/20250722095915.24485-4-chia-yu.chang@nokia-bell-labs.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-07-22 11:59:12 +02:00
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_DUALPI2_STEP_DROP: dropped by the step drop
|
|
|
|
* threshold of DualPI2 qdisc.
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_DUALPI2_STEP_DROP,
|
2022-06-06 10:24:36 +08:00
|
|
|
/**
|
2023-04-19 14:52:53 +02:00
|
|
|
* @SKB_DROP_REASON_MAX: the maximum of core drop reasons, which
|
|
|
|
* shouldn't be used as a real 'reason' - only for tracing code gen
|
2022-06-06 10:24:36 +08:00
|
|
|
*/
|
2022-06-06 10:24:34 +08:00
|
|
|
SKB_DROP_REASON_MAX,
|
2023-04-19 14:52:53 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @SKB_DROP_REASON_SUBSYS_MASK: subsystem mask in drop reasons,
|
|
|
|
* see &enum skb_drop_reason_subsys
|
|
|
|
*/
|
|
|
|
SKB_DROP_REASON_SUBSYS_MASK = 0xffff0000,
|
2022-06-06 10:24:34 +08:00
|
|
|
};
|
|
|
|
|
2023-04-19 14:52:53 +02:00
|
|
|
#define SKB_DROP_REASON_SUBSYS_SHIFT 16
|
|
|
|
|
2022-06-06 10:24:34 +08:00
|
|
|
#define SKB_DR_INIT(name, reason) \
|
|
|
|
enum skb_drop_reason name = SKB_DROP_REASON_##reason
|
|
|
|
#define SKB_DR(name) \
|
|
|
|
SKB_DR_INIT(name, NOT_SPECIFIED)
|
|
|
|
#define SKB_DR_SET(name, reason) \
|
|
|
|
(name = SKB_DROP_REASON_##reason)
|
|
|
|
#define SKB_DR_OR(name, reason) \
|
|
|
|
do { \
|
|
|
|
if (name == SKB_DROP_REASON_NOT_SPECIFIED || \
|
|
|
|
name == SKB_NOT_DROPPED_YET) \
|
|
|
|
SKB_DR_SET(name, reason); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#endif
|