Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2466960imm; Mon, 28 May 2018 08:37:12 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpSR2laivHMrLSFVHLu/Sb/0utW+MIV7HxmkACBd+M2dmjyY0fBxoh7Q/s7jcv1zb8bSX/y X-Received: by 2002:aa7:8084:: with SMTP id v4-v6mr13947842pff.105.1527521832290; Mon, 28 May 2018 08:37:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527521832; cv=none; d=google.com; s=arc-20160816; b=TAQVTwf3S3RkjkOqobNJg3TxzOep3hODxTl+mfm4ShXbXmW0TK0Xm9Kv7i8lBsm9vS 7jmE8nfOh3CjD8WArKBfeAXMNL+2ke10uFMKKa5kVot8h+5aCrDCgunNJ5REy5Fzq+p3 9wdysfE1DwZeQIWKSgspLyWPyAxRbAIDFIozJ/T2zPLw+IdRvCqVoJHNZuvHA7rtR7h6 wi14CZfrcQ7AbZi/+V3mMMwwIBT0AXsNYU2u5gF5Zate15w6fV1K7EPAbguA7hTQvCat /25Ujldo7g0DzbEH0zCwPdh2kSo66798bekmePR9RL7LA9Cmp2s4QrNekIfSHpQ+Spau Wa3w== 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=MBvOJol/rKNolXyQVGFIkkejRvAKn3SlHc1WjGwFIhQ=; b=gydLgW5n86rsr7w+t0H/9sUXVImX/AGyTbfPaJBCfFpDNi6ra+n8Y+Hok32pjscWv9 +Yp+xCerWQ+8v38tBCV16HkKZp8ZF5THQa6M3fDPmMUPDMmGROHWqlEweolvK8wmIy/I 9yWKmmi/rrQkkaxpXSL99x2ur+6T3CWCfYfV3TnnMA9o1T8/LyC4gS8aUqpuyExE/xzf MGr2diyremMoBFQ5xlRqdIcj9wcwKCO0JinUVC0+6BLG+emqiKk8E7l+oKHJ0tcVW72O Ulp0GFAjvt6Z9Syt6fSyvL6RdrnPe6Ymib9vyjOSVfzh8rBwUtWO5yfiAfppyILJo7yV fTyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ROpvqTBG; 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 d132-v6si23675097pgc.253.2018.05.28.08.36.57; Mon, 28 May 2018 08:37:12 -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=ROpvqTBG; 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 S969044AbeE1PgY (ORCPT + 99 others); Mon, 28 May 2018 11:36:24 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:43057 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968791AbeE1PgS (ORCPT ); Mon, 28 May 2018 11:36:18 -0400 Received: by mail-pg0-f67.google.com with SMTP id p8-v6so5404907pgq.10; Mon, 28 May 2018 08:36:18 -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=MBvOJol/rKNolXyQVGFIkkejRvAKn3SlHc1WjGwFIhQ=; b=ROpvqTBG0S2kg45bnduhlTSML9GMdeRqvoSVHKVIst1gg0JhAqAMS6FoNw0I87/9/R CB6Zk5/eL/zcPTShjHwOk3EzyMvPHqhre2MscKpZAru8JLfjD93cZYNZtSwn4MMa+XmT 1MQd1Y1SjsL+pMaxKgBLWNpMrdRLRxD8o3zbTXGL+aVjtZI/oN9Z/+iEu8D/NZu8xwlv kdAxtN8glddH2To+ulDjotgEb6DXWPp4Q0mXgOFeUABQRwNL/ZQlGMJjPQN1g49T1Y+A 2JHr1xNt/RvVmowv/oqVxHmCFhQCOTgKypFLCLrwA9LmLIE4WRAqtOV+E28DcGE/fGY6 jTNw== 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=MBvOJol/rKNolXyQVGFIkkejRvAKn3SlHc1WjGwFIhQ=; b=dezwJlmE2AiXHsh7WfRAK/CZoNKYHiMkuOLy98x6Aa3zBEImr/lYX4vPTYiVJdH0CD 8dhc0mWWl6/VnAtHzjBNBQYVuArDcEO4aXRsAS9PKAc50vY/FbuP8yAqTS4UrAlTvbcx QogkWBpClVW8dkTPXHxLp+XSPY9zvLWPaG7iAkFfmadxCtf4A0RWtsa+Gp6cRu7S6PxM SBWpy9KxA/bjqakrIT8eRxVlxV293I0YsAnuLARSd2Dx3EdkvyD+BE2Z6wQ3EAo56vhP 03+t8ONy2jjkDvlwMMvcBwmpu2cIeeIGvTtG1veCeulRlA0LUL/pFuOeqVDvPsIQMPsz qqyA== X-Gm-Message-State: ALKqPwcXlkMab3OECDytwVvKGP5PFJcdESCgcJIZ4Xhm83zxKKQoafrJ eSvQoadLmLL8n6nrkyOqQoo= X-Received: by 2002:a62:c00e:: with SMTP id x14-v6mr13823569pff.67.1527521778176; Mon, 28 May 2018 08:36:18 -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 n10-v6sm71302232pfk.145.2018.05.28.08.36.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 May 2018 08:36:17 -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 v3 net-next 1/2] tcp: use data length instead of skb->len in tcp_probe Date: Mon, 28 May 2018 23:35:52 +0800 Message-Id: <1527521753-17963-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 --- v3: tcp_hdr() is a little expensive than skb->data, so replace it with skb->data. Signed-off-by: Yafang Shao --- 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