diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index fb9a157f7a51..c41f1f7e90a4 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -214,6 +214,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_shmem_get_folio); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_record_pcpu_rwsem_time_early); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_mmap_file); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_file_open); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_dc_send_copy); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_dc_receive); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_bpf_syscall); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ignore_dmabuf_vmap_bounds); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rproc_recovery); diff --git a/include/trace/hooks/net.h b/include/trace/hooks/net.h index 835943c31f3d..bb88ba2a1523 100644 --- a/include/trace/hooks/net.h +++ b/include/trace/hooks/net.h @@ -16,6 +16,7 @@ DECLARE_HOOK(android_vh_ptype_head, struct nf_conn; struct sock; +struct net_device; DECLARE_RESTRICTED_HOOK(android_rvh_nf_conn_alloc, TP_PROTO(struct nf_conn *nf_conn), TP_ARGS(nf_conn), 1); DECLARE_RESTRICTED_HOOK(android_rvh_nf_conn_free, @@ -31,7 +32,10 @@ DECLARE_HOOK(android_vh_netlink_poll, TP_PROTO(struct file *file, struct socket *sock, poll_table *wait, __poll_t *mask), TP_ARGS(file, sock, wait, mask)); - +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)); /* macro versions of hooks are no longer required */ #endif /* _TRACE_HOOK_NET_VH_H */ diff --git a/net/core/dev.c b/net/core/dev.c index 809a8f3ac55f..cb845f9b61dd 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3632,6 +3632,9 @@ static int xmit_one(struct sk_buff *skb, struct net_device *dev, len = skb->len; trace_net_dev_start_xmit(skb, dev); + + trace_android_vh_dc_send_copy(skb, dev); + rc = netdev_start_xmit(skb, dev, txq, more); trace_net_dev_xmit(skb, rc, dev, len); @@ -5331,6 +5334,7 @@ static int __netif_receive_skb_core(struct sk_buff **pskb, bool pfmemalloc, bool deliver_exact = false; int ret = NET_RX_DROP; __be16 type; + int flag = 0; net_timestamp_check(!READ_ONCE(netdev_tstamp_prequeue), skb); @@ -5350,6 +5354,10 @@ another_round: __this_cpu_inc(softnet_data.processed); + trace_android_vh_dc_receive(skb, &flag); + if (flag != 0) + return NET_RX_DROP; + if (static_branch_unlikely(&generic_xdp_needed_key)) { int ret2;