From nobody Sun Feb 8 18:10:41 2026 Received: from mx10.didiglobal.com (mx10.didiglobal.com [111.202.70.125]) by smtp.subspace.kernel.org (Postfix) with SMTP id 2C3A9611A; Mon, 4 Mar 2024 03:46:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=111.202.70.125 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709524004; cv=none; b=WSdyItodg234DPAitnCfBfAZlqqDQKb04Zpyu5p8VEeaFb8zN5KJDOyOTapA7AFyHydyhp9kVbgj7Dp07VDhg3inj2tsRfszj2N5welVCoz9g2jbY44XgN2esQIVWxJ/csCJR994GIYPnIBzDCfvccnm4tnnbgFbEHLFzP+8wnE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709524004; c=relaxed/simple; bh=lzkyb7fMgaH03D4NRKlAE/xw349l58s0DtYj6e85f4g=; h=Date:From:To:CC:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=qFWUjp86hgVui0woozHPqnaEF5HJrRprFAKZR2+Bxe1n+gBAHXRb95tYK19oDL5HIZg29hCs8ImiqS516m03mn64oaHXBB+XAJmn/397IeBl/+Batn1EO2L9X0DKHLmmOYtwjsusWQsWkO9IUj2CpAutVq1fZ7lzvL8QXxbeTQs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=didiglobal.com; spf=pass smtp.mailfrom=didiglobal.com; arc=none smtp.client-ip=111.202.70.125 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=didiglobal.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=didiglobal.com Received: from mail.didiglobal.com (unknown [10.79.65.12]) by mx10.didiglobal.com (MailData Gateway V2.8.8) with ESMTPS id 4898218B7B3663; Mon, 4 Mar 2024 11:46:38 +0800 (CST) Received: from didi-ThinkCentre-M920t-N000 (10.79.64.101) by ZJY02-ACTMBX-02.didichuxing.com (10.79.65.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 4 Mar 2024 11:46:37 +0800 Date: Mon, 4 Mar 2024 11:46:32 +0800 X-MD-Sfrom: fuyuanli@didiglobal.com X-MD-SrcIP: 10.79.65.12 From: fuyuanli To: , , CC: , , , , Subject: [PATCH net-next v2] tcp: Add skb addr and sock addr to arguments of tracepoint tcp_probe. Message-ID: <20240304034632.GA21357@didi-ThinkCentre-M920t-N000> Mail-Followup-To: edumazet@google.com, rostedt@goodmis.org, mhiramat@kernel.org, mathieu.desnoyers@efficios.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, fuyuanli@didiglobal.com Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-ClientProxiedBy: ZJY02-PUBMBX-01.didichuxing.com (10.79.65.31) To ZJY02-ACTMBX-02.didichuxing.com (10.79.65.12) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" It is useful to expose skb addr and sock addr to user in tracepoint tcp_probe, so that we can get more information while monitoring receiving of tcp data, by ebpf or other ways. For example, we need to identify a packet by seq and end_seq when calculate transmit latency between lay 2 and lay 4 by ebpf, but which is not available in tcp_probe, so we can only use kprobe hooking tcp_rcv_esatblised to get them. But we can use tcp_probe directly if skb addr and sock addr are available, which is more efficient. Signed-off-by: fuyuanli Link: https://lore.kernel.org/netdev/20240229052813.GA23899@didi-ThinkCentr= e-M920t-N000/ Reviewed-by: Jason Xing --- v2: 1) Add printing about those two addresses. 2) Target "net-next" in the title of patch. --- include/trace/events/tcp.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/trace/events/tcp.h b/include/trace/events/tcp.h index 7b1ddffa3dfc..efb651683781 100644 --- a/include/trace/events/tcp.h +++ b/include/trace/events/tcp.h @@ -258,6 +258,8 @@ TRACE_EVENT(tcp_probe, __field(__u32, srtt) __field(__u32, rcv_wnd) __field(__u64, sock_cookie) + __field(const void *, skbaddr) + __field(const void *, skaddr) ), =20 TP_fast_assign( @@ -285,14 +287,18 @@ TRACE_EVENT(tcp_probe, __entry->ssthresh =3D tcp_current_ssthresh(sk); __entry->srtt =3D tp->srtt_us >> 3; __entry->sock_cookie =3D sock_gen_cookie(sk); + + __entry->skbaddr =3D skb; + __entry->skaddr =3D sk; ), =20 - TP_printk("family=3D%s src=3D%pISpc dest=3D%pISpc mark=3D%#x data_len=3D%= d snd_nxt=3D%#x snd_una=3D%#x snd_cwnd=3D%u ssthresh=3D%u snd_wnd=3D%u srtt= =3D%u rcv_wnd=3D%u sock_cookie=3D%llx", + TP_printk("family=3D%s src=3D%pISpc dest=3D%pISpc mark=3D%#x data_len=3D%= d snd_nxt=3D%#x snd_una=3D%#x snd_cwnd=3D%u ssthresh=3D%u snd_wnd=3D%u srtt= =3D%u rcv_wnd=3D%u sock_cookie=3D%llx skbaddr=3D%p skaddr=3D%p", show_family_name(__entry->family), __entry->saddr, __entry->daddr, __entry->mark, __entry->data_len, __entry->snd_nxt, __entry->snd_una, __entry->snd_cwnd, __entry->ssthresh, __entry->snd_wnd, - __entry->srtt, __entry->rcv_wnd, __entry->sock_cookie) + __entry->srtt, __entry->rcv_wnd, __entry->sock_cookie, + __entry->skbaddr, __entry->skaddr) ); =20 #define TP_STORE_ADDR_PORTS_SKB_V4(__entry, skb) \ --=20 2.17.1