Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp543209pxb; Wed, 25 Aug 2021 09:05:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMhiGFzeZEzo5OxLVY7B20dnHTC5H83euZFsFu11biVkxPiByS2MmfiRIzacHd8nDYhceI X-Received: by 2002:a17:906:7690:: with SMTP id o16mr8489807ejm.347.1629907522491; Wed, 25 Aug 2021 09:05:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629907522; cv=none; d=google.com; s=arc-20160816; b=YnTB1FdOXiQ3TBxlktzPgaYBtiNzYAVCYAVwipRPyUOjJblG/HAG7XkOfwvpW6pOWP 8bwLorD0hfT11gObNN/xcgjH4SzaxMEqz+NnWKazda1BdqDcv8ZbCeyLNmcZMeS7TF2+ Jrdb3XsUMReZ/NIU2OYL2kp5Rn07sHKBFpzORk+yu1IajFiz9PkFkdcuZbT2JWBfvRZV s7d/t1B4Go3DmUNlnmdUsxF3pCIe3RDg9/3X8fK0oE61GCXJXiGymqOVlI+CVY//MFQb FNeaSzrKOXTHS9cf6aZAqD4fHeZdJKV7Y4e9qWVOyqPkcfbYwx4hvfrkDUpJPY5x4pNS ILXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=TyXbzbfKOZ2ktu22gQKsofdIYZHzHFuZobIG77fyCcY=; b=aSyKxspM9dhhTCCN4Glk80jZxstf9+ItrDVY2CXxuU5QLCZCQVBBYyCFIfUKb5yXeJ S+dLwMQg/QMl5yP4m3hFsEUhVlDs8GyFzFu6oWCDaA4iZCHANJLXV++BScHr73J2cgEq OfTjrPWzrt0LTgondl7EBmBv131vQTBvsjSDDLbqSBXEvoQ+DQhz7iUMKKLr7skJFUok NhJx+DGbM2kOApeEe4qe3JjlKUmqk0/nknBGfJ4BeMbiGKfoPdAq+UGEWbL55DT/NeOZ cyxroB9mXqtibNSDA8uhetz6WQoIDs0pYQRFwOyOgtEFITyN1HoXz43ClAk1XcECOFtP dNtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=tZoh19hI; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v21si413747edy.30.2021.08.25.09.04.57; Wed, 25 Aug 2021 09:05:22 -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=@google.com header.s=20161025 header.b=tZoh19hI; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241092AbhHYPsq (ORCPT + 99 others); Wed, 25 Aug 2021 11:48:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241083AbhHYPsp (ORCPT ); Wed, 25 Aug 2021 11:48:45 -0400 Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A440BC061757 for ; Wed, 25 Aug 2021 08:47:59 -0700 (PDT) Received: by mail-qk1-x72c.google.com with SMTP id 14so27827695qkc.4 for ; Wed, 25 Aug 2021 08:47:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TyXbzbfKOZ2ktu22gQKsofdIYZHzHFuZobIG77fyCcY=; b=tZoh19hIzrOZ2ezahl8c9mrXstZt3Vpr49rMu41rgyeCBgPXFkQoLeyMyU6qxzt9zz GAujAcoL5tMX2bEjDybWDgrgBdT/w0qlcF+LgSuTeJQffaAC+bHM0LbPFmaZalsk5F3V BaWhgyN2NwlhU0yHbKtsziByYbs6u7KplQrweghoZiXDZwQx5lDZvTYLQugWscF9g6zw +6kiRXw5zH8Yee6yYcVTu1QbZZib84i8TqFL0hqKvPtlI3Ahg1OjVmaT43D4vdJiKBkx sYjLx2BZ8iv6EB4E7a9p6j61d82Z5/4kKRlK3rzqAnNXFKY+7G0Fk+t2x21MMLsDEJYn 0gVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TyXbzbfKOZ2ktu22gQKsofdIYZHzHFuZobIG77fyCcY=; b=D1Q3yNiNyqRGfVkZkMErRUI48Cz9gXk9hlsA7lBXFdLOxc1MPFB0Ho4BdjBMp4YRnK SjwR4FIONRtgOsTySuJ7aDktt+5LA0ukE6S14n4dbHgQ3ZCxkzIrBkmWYtZnsGD+dXG8 dUqLWuWNz0dRJaSdsJRfsU8WqK3HWh6uYPKmdaQk0Q5ApjRBhoHT264T9jp39btDqFj1 aiPM0PH+MNnArTDs1vjdzVe/pQz9WD7nVO7sIrD3RPVnqlYEhAKBYe7FkER4+ZpgGz6a hI7ZA0zS7BOb+8m1R39is2GwQEZte8AjQFfxkNlsFWpXjw2YgMySBjWUBgcNrFC8mszj sVXw== X-Gm-Message-State: AOAM532w6Qxvzdl6XTQZFx/hydpoM4faJ+DEcsw/kHDyQZYxsyuUxZd3 IiR6lF+nCAoF4OxSbUB+1ry6uPFXHcus/YIWcDOgsg== X-Received: by 2002:a25:2cd5:: with SMTP id s204mr10547135ybs.452.1629906477320; Wed, 25 Aug 2021 08:47:57 -0700 (PDT) MIME-Version: 1.0 References: <20210825154043.247764-1-yan2228598786@gmail.com> In-Reply-To: <20210825154043.247764-1-yan2228598786@gmail.com> From: Eric Dumazet Date: Wed, 25 Aug 2021 08:47:46 -0700 Message-ID: Subject: Re: [PATCH] net: tcp_drop adds `reason` parameter for tracing v2 To: Zhongya Yan Cc: Jakub Kicinski , netdev , LKML , Steven Rostedt , Ingo Molnar , David Miller , Hideaki YOSHIFUJI , David Ahern , hengqi.chen@gmail.com, Yonghong Song Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 25, 2021 at 8:41 AM Zhongya Yan wrote: > > In this version, fix and modify some code issues. Changed the reason for `tcp_drop` from an enumeration to a mask and enumeration usage in the trace output. > By shifting `__LINE__` left by 6 bits to accommodate the `tcp_drop` call method source, 6 bits are enough to use. This allows for a more granular identification of the reason for calling `tcp_drop` without conflicts and essentially without overflow. > Example. > ``` ... */ > @@ -5703,15 +5700,15 @@ static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb, > TCP_INC_STATS(sock_net(sk), TCP_MIB_INERRS); > NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPSYNCHALLENGE); > tcp_send_challenge_ack(sk, skb); > - goto discard; > + tcp_drop(sk, skb, TCP_DROP_MASK(__LINE__, TCP_VALIDATE_INCOMING)); I'd rather use a string. So that we can more easily identify _why_ the packet was drop, without looking at the source code of the exact kernel version to locate line number 1057 You can be sure that we will get reports in the future from users of heavily modified kernels. Having to download a git tree, or apply semi-private patches is a no go. If you really want to include __FILE__ and __LINE__, these both can be stringified and included in the report, with the help of macros.