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

1.android_vh_tcp_rcv_rtt_update
To record the rcv rtt and its update time.

We use "srtt_us" in tcp_sock struct to judge the network quality.
But sometimes, an uplink request is sent, and downlink data is received for a long time.
During this period, the "srtt_us" is not updated, but the "rcv_rtt_est" may be updated.
So in this case, we may choose to use rcv rtt instead of rtt to judge the network quality.

Bug: 398691197
Change-Id: I92b26b4302ff7ea5cbabaa9bb3bb71dacfe702db
Signed-off-by: Chenghao Zhao <zhaochenghao@honor.com>
This commit is contained in:
Chenghao Zhao
2025-02-24 11:37:09 +08:00
committed by Treehugger Robot
parent 7bac2bddbe
commit 0ebf9a330d
3 changed files with 6 additions and 0 deletions
+1
View File
@@ -257,6 +257,7 @@ 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_tcp_rcv_established_fast_path);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tcp_rcv_established_slow_path);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tcp_rcv_rtt_update);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_should_memcg_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpu_capacity_show);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_init);
+3
View File
@@ -26,6 +26,7 @@ DECLARE_HOOK(android_vh_ptype_head,
struct sock;
struct sockaddr_in6;
struct tcp_sock;
DECLARE_HOOK(android_vh_tcp_v4_connect,
TP_PROTO(struct sock *sk, struct sockaddr *uaddr), TP_ARGS(sk, uaddr));
DECLARE_HOOK(android_vh_tcp_v6_connect,
@@ -86,6 +87,8 @@ DECLARE_HOOK(android_vh_dc_send_copy,
TP_PROTO(struct sk_buff *skb, struct net_device *dev), TP_ARGS(skb, dev));
DECLARE_HOOK(android_vh_dc_receive,
TP_PROTO(struct sk_buff *skb, int *flag), TP_ARGS(skb, flag));
DECLARE_HOOK(android_vh_tcp_rcv_rtt_update,
TP_PROTO(struct tcp_sock *tp, u32 sample, int win_dep), TP_ARGS(tp, sample, win_dep));
/* macro versions of hooks are no longer required */
#endif /* _TRACE_HOOK_NET_VH_H */
+2
View File
@@ -649,6 +649,8 @@ static void tcp_rcv_rtt_update(struct tcp_sock *tp, u32 sample, int win_dep)
u32 new_sample = tp->rcv_rtt_est.rtt_us;
long m = sample;
trace_android_vh_tcp_rcv_rtt_update(tp, sample, win_dep);
if (new_sample != 0) {
/* If we sample in larger samples in the non-timestamp
* case, we could grossly overestimate the RTT especially