Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3398010imm; Tue, 29 May 2018 06:38:37 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLY7iVzMVEV3n35wPmO4kt2yfDr5Ug2lTOKP79Hxt4L1h2h0ULNxRY8usHcDb86SY9WBnZ2 X-Received: by 2002:a62:249b:: with SMTP id k27-v6mr11986862pfk.143.1527601116989; Tue, 29 May 2018 06:38:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527601116; cv=none; d=google.com; s=arc-20160816; b=UOr3lkMN/6HAJ/+0aKsRAfQivKBhDSA3hexBU6H4gQodOhLfyjF2To5FLvjFAYJb8h se/Kktc735cKALimMlXWOGpyp0OovCz8t4beIiOOGM+zRtuxv6BgmalKCrpSlhO9kTSa DXO83QTXkXCJdTQtYlCzRcUwv1ugqOr4ox3hnW35txYFPF2dWYevXmSlkdtHKje5/ZBV f5LFieobXaXUwSzccUxEjPHI7NF9x0XRUAz6lBzYEx9giKOFlytS3y8SbeIE5pufSO5N QRIJryDxCkptecmwPgC9Ly9sQRNA0lVEks1EAvZ3ktJRUuTLkvb2cgT+J7ON/5scC/8G A2Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Ch1pMEWb+dK4eJ+LZxoeMQfdEC44RR1yVoMXJNF5h9A=; b=MDl0cfpw4VVKlktadq9q6g6Wrdfe3gvqgCJTfdSw895pIvXbbxVaCPK3UKQbBRP4u4 RBLr55yBLYk/kZpTW2l7PNG7xC+kl9Ldj5SRsXKnFDfpD2j551PniTYm5zrIhmoVP01w IoluJ1QBAzW4dFdlZSyzsfEcbKHPaSq9CthRaJ6qVpm2yvOkod9XcMDtGEIHap9zU9Ud bBHlXGT+K41umaV0NWgW3Nm+ZzihlwtE5LSpOQeLP2a8L5tr9f9lFgW1jFFciVX5W9h7 IyNSDfDrIJ8Dp2jKlBMyC7h6AtfyczKJ76PA1unQ9aeR1v4gA+f441w/BfsYBoynocdW 3pSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Sd0mBczw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si32200982ply.226.2018.05.29.06.38.23; Tue, 29 May 2018 06:38:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Sd0mBczw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934648AbeE2Nfg (ORCPT + 99 others); Tue, 29 May 2018 09:35:36 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:43285 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934294AbeE2Nfa (ORCPT ); Tue, 29 May 2018 09:35:30 -0400 Received: by mail-pl0-f65.google.com with SMTP id c41-v6so8955584plj.10; Tue, 29 May 2018 06:35:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Ch1pMEWb+dK4eJ+LZxoeMQfdEC44RR1yVoMXJNF5h9A=; b=Sd0mBczwxe1LM4q6ix5MfhBqNyzLjo8xd8Ex5WUvTsZ00fygxXng5ssBBuQqlpvV8L D8h3I/d+10tr8jYGPZ+xC4iXrFP+RYGNnN85kdKAZ31pES2uT9CSXjerSAyZy0CECz1b G9491DSKIU3paBw/LDzVuJf/pc7HrZbzf3Mia3MWiuqE0BZHfWOUJ6jC2DPOPZNltGnp WK/CfSSAI2f+tlJZx2eOlikcFJHsM0SX72+LML2GYvv++yfQrTOIxuWq5PehcC7IVUsB 7mJw/69YH9Efo8KGH+SYUmWDdhO1CWuK/LRsgY48f/uJC4UJT8WrBB5sL2HFxcaodVhD 2t/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Ch1pMEWb+dK4eJ+LZxoeMQfdEC44RR1yVoMXJNF5h9A=; b=PuJsB4eEtllL9qy3ZxjBGW47iGO+GBr/Aa+NkgC05SmXfYKAltJkBvroI74Ejmn3BP Cr+JIm07FqKSMq6iuxHNaDUpukMbbjtlZdJd5mz2rCC2eYfZKacWB4OS6peq7KuCtdYv XKs+XYIraCBFJq8ANk9/Zh/4LmuHUf6wVPKBsnOS/XIN6IMg92RisrQXg0t9S1Sd657Y uLlN1Q/pN3iO2g44youeurhGncDsrnxedbTJuu4jtR4wqSfU6EL93tjTWNCRr/Lm2dJB KBD3OJkKHAJ0QZ6aJPiuoTUnwT/1K5zraZoSwsjrkjLwBiWsjNR/xNROjbKTHnT0Kb6O +Waw== X-Gm-Message-State: ALKqPwf4MBbD+uaVdneBYx70KpxL4EX0DvoDiSOoyX+2ez5SPNYflurh A03egkuy7SkWynbmikVvsUE= X-Received: by 2002:a17:902:24a5:: with SMTP id w34-v6mr17566848pla.52.1527600929710; Tue, 29 May 2018 06:35:29 -0700 (PDT) Received: from li1588-6.members.linode.com (li1588-6.members.linode.com. [139.162.104.6]) by smtp.gmail.com with ESMTPSA id q82-v6sm16459605pfg.170.2018.05.29.06.35.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 May 2018 06:35:28 -0700 (PDT) From: Yafang Shao To: songliubraving@fb.com, edumazet@google.com, davem@davemloft.net Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Yafang Shao Subject: [PATCH v4 net-next 1/2] tcp: use data length instead of skb->len in tcp_probe Date: Tue, 29 May 2018 21:35:14 +0800 Message-Id: <1527600915-10955-1-git-send-email-laoar.shao@gmail.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At this point skb->len is including tcp header length, so it is meaningless to user. data length could be more helpful, with which we can easily filter out the packet without payload. Cc: Eric Dumazet Acked-by: Song Liu Signed-off-by: Yafang Shao --- v4: no change on this patch v3: tcp_hdr() is a little expensive than skb->data, so replace it with skb->data. --- include/trace/events/tcp.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/trace/events/tcp.h b/include/trace/events/tcp.h index c1a5284..7ff0446 100644 --- a/include/trace/events/tcp.h +++ b/include/trace/events/tcp.h @@ -236,7 +236,7 @@ __field(__u16, sport) __field(__u16, dport) __field(__u32, mark) - __field(__u16, length) + __field(__u16, data_len) __field(__u32, snd_nxt) __field(__u32, snd_una) __field(__u32, snd_cwnd) @@ -250,6 +250,7 @@ TP_fast_assign( const struct tcp_sock *tp = tcp_sk(sk); const struct inet_sock *inet = inet_sk(sk); + const struct tcphdr *th = (const struct tcphdr *)skb->data; memset(__entry->saddr, 0, sizeof(struct sockaddr_in6)); memset(__entry->daddr, 0, sizeof(struct sockaddr_in6)); @@ -261,7 +262,7 @@ __entry->dport = ntohs(inet->inet_dport); __entry->mark = skb->mark; - __entry->length = skb->len; + __entry->data_len = skb->len - __tcp_hdrlen(th); __entry->snd_nxt = tp->snd_nxt; __entry->snd_una = tp->snd_una; __entry->snd_cwnd = tp->snd_cwnd; @@ -272,9 +273,9 @@ __entry->sock_cookie = sock_gen_cookie(sk); ), - TP_printk("src=%pISpc dest=%pISpc mark=%#x length=%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("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", __entry->saddr, __entry->daddr, __entry->mark, - __entry->length, __entry->snd_nxt, __entry->snd_una, + __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) ); -- 1.8.3.1