Received: by 2002:a05:6520:4d:b0:139:a872:a4c9 with SMTP id i13csp2565201lkm; Mon, 20 Sep 2021 18:51:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnHZIRA6HkOfG3OnL6i62iT6gDAocUrZIa+qa+cdRzALzLl7EXf7BdgG/OZ1a9o+c4o71e X-Received: by 2002:a5e:d513:: with SMTP id e19mr20334363iom.82.1632188973431; Mon, 20 Sep 2021 18:49:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632188973; cv=none; d=google.com; s=arc-20160816; b=pDmPj9Yq9sH0zH8/WCBGpRVl5Y7GykmyH26UH+FO37idEy9JG1AQkIXFhh9XQbDBo6 soF4eiHeU7SF+eJroT5rnMbP5x+Y27WX/v/4Zk/YfksAzzWPALTwZTScnvMhBlSlMhsT 4SdD4nv5C0tJEPHVhxkJhGHxRwj5eWThe5DpPorHEURvrJ2qOUVsceOwTCyUcToqFe1g R3INUM8agQJUVXVx/1XyfWQRCU2Bf/sbUCqgcpWHFFwOrg1OnWDIblU5TPHvgBGebgA4 4c/SOdLWPV5ZSBLOVCn5QQAfJEo78gHeJY4nWj7BaVOlgZeJa0y3g1e1w5cNAgGKshGJ 3ZGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=BVUQwCPVABzZfjfA1MSF2RPyACpP6SrhyHePd1BxqFg=; b=zF1yQX80N8tqN/Oc6iPA5OKNRBu1Ms0XZefJyVbfblk5h1XK53rpdAQ//2hZEKRLhk 4QsJr6z+nu0t/oj9gY/B2lQ+KFTOoObAiN37EZ9cgr6lMRSVXu4UP6qJz6TLQYdw6qj2 fuZ4EL2nyJcza+c6nCccMCPicJDR7GYdMyj+fC52xBzxvus0E3oTOXm88A6Cgdibb8lF kjtryDqQqMDEkFQliz74c6dTiZOMYUPKjyCAHQKZ2N59lBeM6g3uvRuDhzZdgkbkygol dESWz7vfaZaoyrr6xx8iQkO+EgjL5ZCu9ooY+6koqyTP07PNZgItxvVCDwM0I2IWiVjn C6tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=g9WffIev; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id i4si15222778ilj.162.2021.09.20.18.49.22; Mon, 20 Sep 2021 18:49:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=g9WffIev; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1349130AbhITRpF (ORCPT + 99 others); Mon, 20 Sep 2021 13:45:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352853AbhITRmU (ORCPT ); Mon, 20 Sep 2021 13:42:20 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03FB2C0363F0; Mon, 20 Sep 2021 09:54:14 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id l6so6704934plh.9; Mon, 20 Sep 2021 09:54:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=BVUQwCPVABzZfjfA1MSF2RPyACpP6SrhyHePd1BxqFg=; b=g9WffIev9n4JE+zerOPcdBgNXleWbDeoTCeVmLdadn3pey8Bwg8/boq87gclfAlkLB 3J80pTkp6GGPTLA9xMks6McvHizR8cvufA1imk++YXgynql9GBMF9CQsqsM7EoHpBP3K 2CtFG9AcI5WenoNglbB+5VvWa1mRDU/id8PJIs88bI+9Bd/NJcyVfjh4qD1oXCWKVlcZ eOsTjx8ITIBo2YPoQoXjh2jBXXz1XgGG+bkc5Fsd+hxU5qZ07b1poV+/c+Kzk+tjWNR8 jemoApnW7UHvlHZqCCf0QDUhzCumHbJGinZdxAYUiobmKsmqmkDmJfgovN465XqwHzuG 6Bww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=BVUQwCPVABzZfjfA1MSF2RPyACpP6SrhyHePd1BxqFg=; b=QHgL6bXEmaSqLYv4D++2oJet2EvDY52YBgqA5sOCjWLaYBEnE4ZduLhC0HVx8z/Pbc VfiwYhcDT3FK3DtoiyERCAyd6moooD4TnO8IDFZWBPnKadURmt4M0EjOzlkrrAsgUjtz IrVCyKwhlHbCDkld0PvwpozGancrKiLq2Qno5jBmQSbYdhw7s4MQrTPy0/KvvXiCkqVG t5LQ6ZFIyPuDqpblTdU9fei4ISTx4IEqTMXmI9Xb4bx4Fc3bi/yfNClvBoSBrcC0bWqB Knv3C3TRf6FTPhqlLeVSpWPeUdK2RMOxAeBLWT7VvEbii+94IeUYaCAfVTO2v3BQQD2f 3u5g== X-Gm-Message-State: AOAM532jxRyyms7qkP18oGIgi7c8NUUUfB3KvreLuKOZB6BhsrMf1YUJ xaU8a7nURY9DlgxS9o9ROXSiSQb6v7ebtV/eImQ= X-Received: by 2002:a17:903:32cd:b0:13d:9b0e:7897 with SMTP id i13-20020a17090332cd00b0013d9b0e7897mr12692999plr.30.1632156853516; Mon, 20 Sep 2021 09:54:13 -0700 (PDT) MIME-Version: 1.0 References: <20210914143515.106394-1-yan2228598786@gmail.com> In-Reply-To: <20210914143515.106394-1-yan2228598786@gmail.com> From: Cong Wang Date: Mon, 20 Sep 2021 09:54:02 -0700 Message-ID: Subject: Re: [PATCH] tcp: tcp_drop adds `SNMP` and `reason` parameter for tracing To: Zhongya Yan Cc: Eric Dumazet , Steven Rostedt , Brendan Gregg , Linux Kernel Network Developers , LKML , Jakub Kicinski , Ingo Molnar , David Miller , Hideaki YOSHIFUJI , dsahern@kernel.org, Yonghong Song , 2228598786@qq.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 14, 2021 at 7:38 AM Zhongya Yan wrote= : > > When we wanted to trace the use of the `tcp_drop(struct sock *sk, struct = sk_buff *skb)` function, we didn't know why `tcp` was deleting `skb'. To so= lve this problem, I updated the function `tcp_drop(struct sock *sk, struct = sk_buff *skb, int field, const char *reason)`. > This way you can understand the reason for the deletion based on the prom= pt message. > `field`: represents the SNMP-related value > `reason`: represents the reason why `tcp` deleted the current `skb`, and = contains some hints. > Of course, if you want to know more about the reason for updating the cur= rent function, you can check: https://www.brendangregg.com/blog/2018-05-31/= linux-tcpdrop.html I think you fail to explain why only TCP needs it? This should be useful for all kinds of drops, not just TCP, therefore you should consider extending net/core/drop_monitor.c instead of just tcp_drop(). Also, kernel does not have to explain it in strings, those SNMP counters are already available for user-space, so kernel could just use SNMP enums and let user-space interpret them. In many cases, you are just adding strings for those SNMP enums. Thanks.