Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1611122lqg; Sun, 3 Mar 2024 19:46:56 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWkALZp7tQlLgBUyL+sG50WOUTg/oHfRQ60EECqmtd0b1WibG8WDGjrbq3p0vNDE5kfROjmDc07+7BIlnsg/WXf0o8LUlz+mDypV/G9Bg== X-Google-Smtp-Source: AGHT+IHHn94STetseJa4V12C7DMCDFNM2m8x8EHiEdumEOwKLdlZCLN04/rNbROJEbEoaiBYNWeX X-Received: by 2002:a05:6a21:e85:b0:1a1:18f8:ffd9 with SMTP id ma5-20020a056a210e8500b001a118f8ffd9mr13688735pzb.2.1709524016048; Sun, 03 Mar 2024 19:46:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709524016; cv=pass; d=google.com; s=arc-20160816; b=oNMm90GFfxecau1P+iQ45GQbG2rkA5I0fXTtCxZ2AToGJPffKmWTYQkJRwzv6h1yiA B++5UFzUJqK3prUt20InW8zQk+lewnpMVF7mW1PzGamSF0thdqvlcHK1v2U3w3D8M3gb BDOsehRBcFcwwEgLgzLbUNfLUXiJuq2+nANN7ZtTlMVJwhu5BaT/OsxlQdqrSEZrym1H xbC/P3vwcpTNOu8bqEsaj/khj2CVb2OL9u46x01rKQUkdao9fcpsHUqr9ZcFzDmJvqlb 7anzRm2MEI35xYNXGnTKQcp5XhF+uwWanNO87hogFB/zXMYzHfm3MPFpSLyy+IkPksfg O5xQ== 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=cL/qltYxknTIpIYFbL7eU4WpY7mdcaylgyrQq2mv87k=; fh=8ElmKV+4EsPPUELx+I9CSxv4kF4VEqxSftU+cyYh6mE=; b=0eS022CN/0XtEc9UR8wUaxFxd14aDMOKQrZZ7VNl9QpRLzK2lP4PD13YkozYxbZHVb 3Q6pJdxNgH2kZmgXMpp0N1wL23LFyrYljuAfYIkAKPEk+4N2FVwQCwmf1x3DGEv4XyG9 vcXOBpbknalVaWN0oIAyb7Y21mUPpvXKucnImbTRuhlnEeUSNXMSsZz8BtOaxj2zAFp4 uGjB63qTQFYWyPapd2gB2rh2mYDCGqvjTF3Lm8Adn8TIWBrSPPUVl+Btbi5ik1UwRMlS lNlfRTDm936UZm/XpUuwSZuVgqDMZBbjwcFqi4rv9r/4VzpitS3VcuA+b9la8V3r6Rv9 ncxQ==; 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-90031-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90031-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=didiglobal.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id i26-20020a63221a000000b005d8be4c1250si7443470pgi.554.2024.03.03.19.46.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Mar 2024 19:46:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90031-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; 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-90031-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90031-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id EA09BB20CDF for ; Mon, 4 Mar 2024 03:46:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D6CEA612E; Mon, 4 Mar 2024 03:46:44 +0000 (UTC) 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-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 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-ThinkCentre-M920t-N000/ --- 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) ), 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