Skip to contentSkip to conversation

net: drop_monitor: support drop reason

PATCH Applied [email protected] 4 participants 4 messages Feb 9, 2022 – Feb 10, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v8 1/1 net: drop_monitor: support drop reason

From: Menglong Dong <[email protected]>

In the commit c504e5c2f964 ("net: skb: introduce kfree_skb_reason()") drop reason is introduced to the tracepoint of kfree_skb. Therefore, drop_monitor is able to report the drop reason to users by netlink.

The drop reasons are reported as string to users, which is exactly the same as what we do when reporting it to ftrace.

---
v8:
- pass drop reason to net_dm_packet_report_size()
- move drop reason validation to net_dm_packet_trace_kfree_skb_hit()

v7:
- take the size of NET_DM_ATTR_REASON into accounting in net_dm_packet_report_size()
- let compiler define the size of drop_reasons

v6:
- check the range of drop reason in net_dm_packet_report_fill()

v5:
- check if drop reason larger than SKB_DROP_REASON_MAX

v4:
- report drop reasons as string

v3:
- referring to cb->reason and cb->pc directly in
net_dm_packet_report_fill()

v2:
- get a pointer to struct net_dm_skb_cb instead of local var for each field

---
 include/uapi/linux/net_dropmon.h |  1 +
 net/core/drop_monitor.c          | 41 +++++++++++++++++++++++++++-----
 2 files changed, 36 insertions(+), 6 deletions(-)
include/uapi/linux/net_dropmon.h +1 -0
index 66048cc5d7b3..1bbea8f0681e 100644
@@ -93,6 +93,7 @@ enum net_dm_attr {
 	NET_DM_ATTR_SW_DROPS,			/* flag */
 	NET_DM_ATTR_HW_DROPS,			/* flag */
 	NET_DM_ATTR_FLOW_ACTION_COOKIE,		/* binary */
+	NET_DM_ATTR_REASON,			/* string */
 
 	__NET_DM_ATTR_MAX,
 	NET_DM_ATTR_MAX = __NET_DM_ATTR_MAX - 1
net/core/drop_monitor.c +35 -6

97 lines not on this page · raw message

Signature · 1 line
2.34.1
Reviewed-by on v8 1/1
#1 lore raw
Quoted 10 lines · On Wed, Feb 09, 2022 at 02:08:38PM +0800, [email protected] wrote:

From: Menglong Dong <[email protected]>

In the commit c504e5c2f964 ("net: skb: introduce kfree_skb_reason()") drop reason is introduced to the tracepoint of kfree_skb. Therefore, drop_monitor is able to report the drop reason to users by netlink.

The drop reasons are reported as string to users, which is exactly the same as what we do when reporting it to ftrace.

Reviewed-by on v8 1/1
#2 lore raw
In reply to [email protected]
Quoted 33 lines · On 2/8/22 10:08 PM, [email protected] wrote:

From: Menglong Dong <[email protected]>

In the commit c504e5c2f964 ("net: skb: introduce kfree_skb_reason()") drop reason is introduced to the tracepoint of kfree_skb. Therefore, drop_monitor is able to report the drop reason to users by netlink.

The drop reasons are reported as string to users, which is exactly the same as what we do when reporting it to ftrace.

---
v8:
- pass drop reason to net_dm_packet_report_size()
- move drop reason validation to net_dm_packet_trace_kfree_skb_hit()

v7:
- take the size of NET_DM_ATTR_REASON into accounting in net_dm_packet_report_size()
- let compiler define the size of drop_reasons

v6:
- check the range of drop reason in net_dm_packet_report_fill()

v5:
- check if drop reason larger than SKB_DROP_REASON_MAX

v4:
- report drop reasons as string

v3:
- referring to cb->reason and cb->pc directly in
net_dm_packet_report_fill()

Quoted 8 lines

v2:
- get a pointer to struct net_dm_skb_cb instead of local var for each field

---
 include/uapi/linux/net_dropmon.h |  1 +
 net/core/drop_monitor.c          | 41 +++++++++++++++++++++++++++-----
 2 files changed, 36 insertions(+), 6 deletions(-)
#3 lore raw
In reply to [email protected]
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Wed, 9 Feb 2022 14:08:38 +0800 you wrote:

From: Menglong Dong <[email protected]>

In the commit c504e5c2f964 ("net: skb: introduce kfree_skb_reason()") drop reason is introduced to the tracepoint of kfree_skb. Therefore, drop_monitor is able to report the drop reason to users by netlink.

The drop reasons are reported as string to users, which is exactly the same as what we do when reporting it to ftrace.

[...]

Here is the summary with links:
- [v8,net-next] net: drop_monitor: support drop reason

    https://git.kernel.org/netdev/net-next/c/5cad527d5ffa

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html