<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/include/net/dropreason.h, branch v6.3</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.3</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.3'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2023-02-20T08:54:23Z</updated>
<entry>
<title>ipv6: icmp6: add SKB_DROP_REASON_IPV6_NDISC_NS_OTHERHOST</title>
<updated>2023-02-20T08:54:23Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2023-02-16T16:28:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c34b8bb11ebc135e970653bd6fc8e3f863fb6a81'/>
<id>urn:sha1:c34b8bb11ebc135e970653bd6fc8e3f863fb6a81</id>
<content type='text'>
Hosts can often receive neighbour discovery messages
that are not for them.

Use a dedicated drop reason to make clear the packet is dropped
for this normal case.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ipv6: icmp6: add SKB_DROP_REASON_IPV6_NDISC_BAD_OPTIONS</title>
<updated>2023-02-20T08:54:23Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2023-02-16T16:28:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=784d4477f07b930df73bc77e842e03f1dacb83aa'/>
<id>urn:sha1:784d4477f07b930df73bc77e842e03f1dacb83aa</id>
<content type='text'>
This is a generic drop reason for any error detected
in ndisc_parse_options().

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ipv6: icmp6: add drop reason support to ndisc_rcv()</title>
<updated>2023-02-14T03:55:32Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2023-02-10T18:47:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=545dbcd124b02c9dc93c8a5894c71d682effc3e6'/>
<id>urn:sha1:545dbcd124b02c9dc93c8a5894c71d682effc3e6</id>
<content type='text'>
Creates three new drop reasons:

SKB_DROP_REASON_IPV6_NDISC_FRAG: invalid frag (suppress_frag_ndisc).

SKB_DROP_REASON_IPV6_NDISC_HOP_LIMIT: invalid hop limit.

SKB_DROP_REASON_IPV6_NDISC_BAD_CODE: invalid NDISC icmp6 code.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reviewed-by: David Ahern &lt;dsahern@kernel.org&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: dropreason: add SKB_DROP_REASON_IPV6_BAD_EXTHDR</title>
<updated>2023-02-14T03:55:32Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2023-02-10T18:47:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=dc68eaf2c29f410fb078fd6da8e56201d3282e0b'/>
<id>urn:sha1:dc68eaf2c29f410fb078fd6da8e56201d3282e0b</id>
<content type='text'>
This drop reason can be used whenever an IPv6 packet
has a malformed extension header.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reviewed-by: David Ahern &lt;dsahern@kernel.org&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>tcp: add TCP_MINTTL drop reason</title>
<updated>2023-02-03T05:14:50Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2023-02-01T17:43:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2798e36dc233a409a5d3f26f73029596dc504020'/>
<id>urn:sha1:2798e36dc233a409a5d3f26f73029596dc504020</id>
<content type='text'>
In the unlikely case incoming packets are dropped because
of IP_MINTTL / IPV6_MINHOPCOUNT constraints...

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Link: https://lore.kernel.org/r/20230201174345.2708943-1-edumazet@google.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: dropreason: add SKB_DROP_REASON_FRAG_TOO_FAR</title>
<updated>2022-11-01T03:14:27Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2022-10-29T15:45:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3bdfb04f13ebdd4ae50fc5dc595663874781e48c'/>
<id>urn:sha1:3bdfb04f13ebdd4ae50fc5dc595663874781e48c</id>
<content type='text'>
IPv4 reassembly unit can decide to drop frags based on
/proc/sys/net/ipv4/ipfrag_max_dist sysctl.

Add a specific drop reason to track this specific
and weird case.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: dropreason: add SKB_DROP_REASON_FRAG_REASM_TIMEOUT</title>
<updated>2022-11-01T03:14:27Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2022-10-29T15:45:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=77adfd3a1d44c4730fd2af99b497e04ddc2b5837'/>
<id>urn:sha1:77adfd3a1d44c4730fd2af99b497e04ddc2b5837</id>
<content type='text'>
Used to track skbs freed after a timeout happened
in a reassmbly unit.

Passing a @reason argument to inet_frag_rbtree_purge()
allows to use correct consumed status for frags
that have been successfully re-assembled.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: dropreason: add SKB_DROP_REASON_DUP_FRAG</title>
<updated>2022-11-01T03:14:26Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2022-10-29T15:45:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4ecbb1c27c363686d11a241cd682a454a8454c2b'/>
<id>urn:sha1:4ecbb1c27c363686d11a241cd682a454a8454c2b</id>
<content type='text'>
This is used to track when a duplicate segment received by various
reassembly units is dropped.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: dropreason: add SKB_CONSUMED reason</title>
<updated>2022-11-01T03:14:26Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2022-10-29T15:45:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0e84afe8ebfbb9eade3f4f6de4720887bf908e26'/>
<id>urn:sha1:0e84afe8ebfbb9eade3f4f6de4720887bf908e26</id>
<content type='text'>
This will allow to simply use in the future:

	kfree_skb_reason(skb, reason);

Instead of repeating sequences like:

	if (dropped)
	    kfree_skb_reason(skb, reason);
	else
	    consume_skb(skb);

For instance, following patch in the series is adding
@reason to skb_release_data() and skb_release_all(),
so that we can propagate a meaningful @reason whenever
consume_skb()/kfree_skb() have to take care of a potential frag_list.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: skb: export skb drop reaons to user by TRACE_DEFINE_ENUM</title>
<updated>2022-09-07T14:28:08Z</updated>
<author>
<name>Menglong Dong</name>
<email>imagedong@tencent.com</email>
</author>
<published>2022-09-05T03:50:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9cb252c4c1c53ae58bc565bab76e98133288f23a'/>
<id>urn:sha1:9cb252c4c1c53ae58bc565bab76e98133288f23a</id>
<content type='text'>
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-&gt;skbaddr, REC-&gt;protocol, REC-&gt;location, __print_symbolic(REC-&gt;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 &lt;edumazet@google.com&gt;
Signed-off-by: Menglong Dong &lt;imagedong@tencent.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
