ANDROID: GKI: net: add vendor hook for network quality estimation

1.android_vh_udp_unicast_rcv_skb
For statistics of received IPv4 UDP packets for specified uids.
2.android_vh_udp6_unicast_rcv_skb
For statistics of received IPv6 UDP packets for specified uids.

Bug: 362208332
Change-Id: Ibd3a832b50966229c1f036c8b7589d43669f055e
Signed-off-by: xinpei jiang <jiangxinpei@honor.com>
This commit is contained in:
jiangxinpei 2024-08-26 20:23:28 +08:00 committed by Treehugger Robot
parent 3a629fdc4a
commit 8b43dcfbfa
4 changed files with 10 additions and 0 deletions

View File

@ -360,6 +360,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tcp_connect);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_inet_csk_clone_lock);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tcp_clean_rtx_queue);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tcp_rcv_synack);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_udp_unicast_rcv_skb);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_udp6_unicast_rcv_skb);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_try_to_unmap_one);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_record_rwsem_reader_owned);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_clear_rwsem_reader_owned);

View File

@ -114,6 +114,12 @@ DECLARE_HOOK(android_vh_tcp_clean_rtx_queue,
struct inet_connection_sock;
DECLARE_HOOK(android_vh_tcp_rcv_synack,
TP_PROTO(struct inet_connection_sock *icsk), TP_ARGS(icsk));
DECLARE_HOOK(android_vh_udp_unicast_rcv_skb,
TP_PROTO(struct sk_buff *skb, struct sock *sk),
TP_ARGS(skb, sk));
DECLARE_HOOK(android_vh_udp6_unicast_rcv_skb,
TP_PROTO(struct sk_buff *skb, struct sock *sk),
TP_ARGS(skb, sk));
/* macro versions of hooks are no longer required */
#endif /* _TRACE_HOOK_NET_VH_H */

View File

@ -2379,6 +2379,7 @@ static int udp_unicast_rcv_skb(struct sock *sk, struct sk_buff *skb,
if (inet_get_convert_csum(sk) && uh->check && !IS_UDPLITE(sk))
skb_checksum_try_convert(skb, IPPROTO_UDP, inet_compute_pseudo);
trace_android_vh_udp_unicast_rcv_skb(skb, sk);
ret = udp_queue_rcv_skb(sk, skb);
/* a return value > 0 means to resubmit the input, but

View File

@ -934,6 +934,7 @@ static int udp6_unicast_rcv_skb(struct sock *sk, struct sk_buff *skb,
if (inet_get_convert_csum(sk) && uh->check && !IS_UDPLITE(sk))
skb_checksum_try_convert(skb, IPPROTO_UDP, ip6_compute_pseudo);
trace_android_vh_udp6_unicast_rcv_skb(skb, sk);
ret = udpv6_queue_rcv_skb(sk, skb);
/* a return value > 0 means to resubmit the input */