Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp145000lqs; Mon, 4 Mar 2024 19:04:46 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWevHLHZbAg3SLUIJnVHfLhfmToBBs3il0jjBjNLNNHqIK8krLaB2v9bfwT66Eg13L/UyqxxUyK7mgg4XSInnrjLPa4ZxBbnnOJxjpcFA== X-Google-Smtp-Source: AGHT+IFxPQOLHPzh0QKUMP1k8JZhW/1zWVwUoBiTFa6bUardD2osD1zByCXy9wqiRAOjtin1TQni X-Received: by 2002:a17:906:e5b:b0:a44:9d15:93e8 with SMTP id q27-20020a1709060e5b00b00a449d1593e8mr7944157eji.50.1709607886291; Mon, 04 Mar 2024 19:04:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709607886; cv=pass; d=google.com; s=arc-20160816; b=ToMLYqlpUaKCyHKv7TpGSbtJzQjim7g8KTwbSDj8eJkV1gAcD2tXu1CB6x83s8/JIE Yqh6rppZdwy8YhGtAFhUYs/eg9nXvpe/I2mfTc7fWeyQJnsyFnb8mD2AeYHDvo4152M/ XCfCYzwXhYnKNPmYXFlXozpJTwG4RRPXNO724oS24480jqZsrOz2HT3WUT58JeH1uP29 CES/zk5wL+wOPgQ73Q5cyFOAlejBKeGIAeDdgxTitq9B/zxty8JltzA8tgRsszuLk9P/ M1T25f9XdCojrO6jaRZs6wgUb1DkFwZnztLwy4AtNllN3ONsN//vVZMYzNcS+k00j0QP oSLw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:mail-followup-to:message-id :subject:cc:to:from:date; bh=+S80+02qc/Ycl/b5QQ2Cilm8mhiF2E5dqrQsjJ5Mn34=; fh=8ElmKV+4EsPPUELx+I9CSxv4kF4VEqxSftU+cyYh6mE=; b=kiSiid6OE5WuiRnXihlazXUpbWzrxwOK+MxWUjcV+dllOhtPl3OnVX/hFVChdclQDt 73M/MZojxOHygaE6GJJAb2o5VpVlI1Maar4jACbZfJD6CHmqQ2qGDjuA7W8ofit+bMB8 coM3BvYLE0tEt9mIrrZyOybmKgNbP/tRGHuooPkUkJsxi3GD+wiWk9Csn6uqldvo9YrO lDX56i28/Rsv5mQgy502ydfQuwK9Kj11zSf7QTDDADmDTg2eNItBPFKNnN3fRPQyjop6 qRXXfwqCgxjKsyEXXbvHl6vPhxMeF1f2SUmyjSZcGphJgHwtgmYeN3AbkNebsT3g9Gbe G3iQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=didiglobal.com dmarc=pass fromdomain=didiglobal.com); spf=pass (google.com: domain of linux-kernel+bounces-91597-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91597-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=didiglobal.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id v17-20020a170906339100b00a3c55fbe3c8si4458573eja.593.2024.03.04.19.04.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 19:04:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-91597-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=didiglobal.com dmarc=pass fromdomain=didiglobal.com); spf=pass (google.com: domain of linux-kernel+bounces-91597-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91597-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=didiglobal.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C153C1F2313B for ; Tue, 5 Mar 2024 03:04:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D06A2942C; Tue, 5 Mar 2024 03:04:34 +0000 (UTC) Received: from mx9.didiglobal.com (mx9.didiglobal.com [111.202.70.124]) by smtp.subspace.kernel.org (Postfix) with SMTP id 891991865C; Tue, 5 Mar 2024 03:04:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=111.202.70.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709607873; cv=none; b=u1h44mBfRKffhqOpliaMv0f6XI2ywa0/RhotA0fBYqZQR+Z3skpagc3eVG5EurCSrq73ysfMOZp5OYVwHhDOQAoA/3OL5sr21lgqLKlrheANgGVgQE+GsYKCkoIfluGOjtcU7HJyDY8E0W9D5G8sd+19y3azucWEN9Vp2lOD5qI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709607873; c=relaxed/simple; bh=7Hnw9hlX+4zSjf4KQl6x8LEy3mDpM4USWbEat1p4VjY=; h=Date:From:To:CC:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=j5owLFYXOPbam41LQ0/8X5d6ImusjUQGTmNz+v+JKEkWePLkUvaXG/WIzk9AnqkyED0R0ohwEM6bxTvESut0C7X9wX+GRztob61lo/SZou7KBDC3sqGa+G8G5pQDUsWd6hKZyTXJzQuiQEh+shU2BzVGA1/mWiQXslH4dE+TIMs= 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.124 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 mx9.didiglobal.com (MailData Gateway V2.8.8) with ESMTPS id A4B0E1858BE7AE; Tue, 5 Mar 2024 11:04:22 +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; Tue, 5 Mar 2024 11:04:22 +0800 Date: Tue, 5 Mar 2024 11:04:17 +0800 X-MD-Sfrom: fuyuanli@didiglobal.com X-MD-SrcIP: 10.79.65.12 From: fuyuanli To: , , CC: , , , , Subject: [PATCH net-next v3] tcp: Add skb addr and sock addr to arguments of tracepoint tcp_probe. Message-ID: <20240305030358.GA13138@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-Type: text/plain; charset="us-ascii" 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) 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 layer 2 and layer 4 by ebpf, but which is not available in tcp_probe, so we can only use kprobe hooking tcp_rcv_established 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 Reviewed-by: Jason Xing --- v3 Link: https://lore.kernel.org/netdev/20240304034632.GA21357@didi-ThinkCentre-M920t-N000/ 1) Fix some errors of spellchecking in commit message. v2 Link: https://lore.kernel.org/netdev/20240229052813.GA23899@didi-ThinkCentre-M920t-N000/ 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) ), TP_fast_assign( @@ -285,14 +287,18 @@ TRACE_EVENT(tcp_probe, __entry->ssthresh = tcp_current_ssthresh(sk); __entry->srtt = tp->srtt_us >> 3; __entry->sock_cookie = sock_gen_cookie(sk); + + __entry->skbaddr = skb; + __entry->skaddr = sk; ), - TP_printk("family=%s src=%pISpc dest=%pISpc mark=%#x data_len=%d snd_nxt=%#x snd_una=%#x snd_cwnd=%u ssthresh=%u snd_wnd=%u srtt=%u rcv_wnd=%u sock_cookie=%llx", + TP_printk("family=%s src=%pISpc dest=%pISpc mark=%#x data_len=%d snd_nxt=%#x snd_una=%#x snd_cwnd=%u ssthresh=%u snd_wnd=%u srtt=%u rcv_wnd=%u sock_cookie=%llx skbaddr=%p skaddr=%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) ); #define TP_STORE_ADDR_PORTS_SKB_V4(__entry, skb) \ -- 2.17.1