Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp130509rwi; Sun, 30 Oct 2022 21:57:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6bYY60mLcNCEG98ofR5GM6t4xz8kBxBq/Sux/tEVou5R9kN3cY6rz9YVJ3btr3Jql/6lCr X-Received: by 2002:a17:902:e5c5:b0:186:5f09:8468 with SMTP id u5-20020a170902e5c500b001865f098468mr12762008plf.122.1667192235288; Sun, 30 Oct 2022 21:57:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667192235; cv=none; d=google.com; s=arc-20160816; b=Bi99OzAGcizbio9SE36phldQTs6YGkodJg0u+sNUZcvyNxYV6O0VrfuTAN4nt4LTzN JQmNphHqbm6iBBJAlipvtqcRvsLoBpE6uPz8rKQmRmMDoqQ9ZnCoIBb8J8Hyzofyi0s6 /5l52wlPYoz4H8kAxcpz38JjrPO4cLkOJVFP0W/eumwEFEBUM8SXWp3KzA+yOCT51nRh 1RsC1dQASOMUkYV9x6L7ciEZRHZDr/m5DSrd+AScLrnVYletrkJxvdnsbL6wnQEqnvOR oUXeXlP007qG5BjkboTYoe3okHt7qjpznpW/9SeGgh00MaWn/PPltCBeOAFbt6PotUmF G2Dg== 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=+uZsjIKULsVOshVcFDmebEMGoN/bqKIXqxINsAqCIDY=; b=z0y5yhCyQRCgV18DV0Di0vT10CmE3F5rv9lRYpb7MV7ccL21K0wpe+dafSIcEB7rN+ ZmpM1luXefbLR39mudLMG70vMlLt8SEL61CKaSvrmJREhmAeKOw7ngoFqkkLsbQ8/3aH quW2OTg6LisRu1XxvFx7UBLPn3k5tLpFnYSMAvhdD6uZQUNix+/3XtiXeq/aM7VeyUcA 5tEuP+BLf2hlm/Q8cpGn32S/2rPcib/4jBDclqbO2iNsr8kNdYEGIMbt3L9bHb65LJZo SJa5nWzDEf3mk3/7r7WaX+0Dmk8TmWvGemo2A9j202SiPBjE6SQkNE35y1D0h3ksg0Pk pzDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FhlRNd8Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u5-20020a17090a1f0500b00201d6d4cc79si6849676pja.113.2022.10.30.21.57.03; Sun, 30 Oct 2022 21:57:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FhlRNd8Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229562AbiJaDIh (ORCPT + 99 others); Sun, 30 Oct 2022 23:08:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbiJaDId (ORCPT ); Sun, 30 Oct 2022 23:08:33 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E88BF9582; Sun, 30 Oct 2022 20:08:32 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id d6so17298490lfs.10; Sun, 30 Oct 2022 20:08:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=+uZsjIKULsVOshVcFDmebEMGoN/bqKIXqxINsAqCIDY=; b=FhlRNd8Y8g8xmbiq7u7nn2UZXmiVYaDR1I5hnJpwY40qY334fcjQHj3ovw1dUHtGtX OX5JT5kwkkHIH4dRYJYJ2C7XbGOYvfOyMrL3UI1OZljeOXzpvtpfWILepT9XVfjonM6f HCmuqwVtYN/bfbqatqhpS3crti+FmcjXS4rfimL4ucAIwrQTK3mG6E8fhbTOu5XVxw9t hxWNpy8DPxxW3xiiZUQnYx9aVXt5eLRwjpVaq6aS9Y3fv2h9KmK0WGyy3awOOFEm/bfT MkiJf5YHOf2Ruy6YNwWdwHUksVnnz9/A+AWQJlWi63fThnOYRd4JMsH/adssJ3Ky2BMP /7fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+uZsjIKULsVOshVcFDmebEMGoN/bqKIXqxINsAqCIDY=; b=khwFBpD6rhOH6aSMqd6acNMNNHBuPIwucNQ8L2ylje0QmkklMy3zK/71N8Bxo8bEQB JloRjHnCl+kS8kZ7BOOOrg+LPEABnOEsuEZispKAOrg1DxBeOUnrnnNXJ6YrwuZ5IkwT jUoiSZeBZ0HqtGcXC+31yPStGyAMsgqr939DGCLgVVTo479tYPnoSwQVvmrtl4IRaYLc rIjk/qzSe53kvNge3Serr64vWLpGZZDldXR1boDTHUVvyl9GSM9T1e1SvqZbxdlcGY0i Q0rx6Dy5+KCmbToMv8iT6lLUjTvUfucaiYrw/Distg3PC/xdziMIkGSwSYXoGxWMjGHK LRfA== X-Gm-Message-State: ACrzQf2RPeLt7E2oir0aUKT5wyDg7Bl0pHNItrGOgkvfn+y35fMUsw+M B9RQWC4xbvPqcdevObf0tZcU0iYAaCP2GEleRKw= X-Received: by 2002:ac2:4bd2:0:b0:4a8:29b8:8e5 with SMTP id o18-20020ac24bd2000000b004a829b808e5mr4393348lfq.542.1667185711238; Sun, 30 Oct 2022 20:08:31 -0700 (PDT) MIME-Version: 1.0 References: <20221029130957.1292060-1-imagedong@tencent.com> <20221029130957.1292060-3-imagedong@tencent.com> In-Reply-To: From: Menglong Dong Date: Mon, 31 Oct 2022 11:08:19 +0800 Message-ID: Subject: Re: [PATCH net-next 2/9] net: tcp: add 'drop_reason' field to struct tcp_skb_cb To: Eric Dumazet Cc: kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com, yoshfuji@linux-ipv6.org, dsahern@kernel.org, imagedong@tencent.com, kafai@fb.com, asml.silence@gmail.com, keescook@chromium.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Sat, Oct 29, 2022 at 11:23 PM Eric Dumazet wrote: > > On Sat, Oct 29, 2022 at 6:11 AM wrote: > > > > From: Menglong Dong > > > > Because of the long call chain on processing skb in TCP protocol, it's > > hard to pass the drop reason to the code where the skb is freed. > > > > Therefore, we can store the drop reason to skb->cb, and pass it to > > kfree_skb_reason(). I'm lucky, the struct tcp_skb_cb still has 4 bytes > > spare space for this purpose. > > No, we have needs for this space for future use. > > skb->cb[] purpose is to store semi-permanent info, for skbs that stay > in a queue. > May I use it for a while? Or, can I make it a union with some field, such as 'header'? As the 'drop_reason' field will be set only if it is going to be freed. > Here, you need a state stored only in the context of the current context. > Stack variables are better. It's hard to get the drop reason through stack variables, especially some functions in TCP protocol, such as: tcp_rcv_synsent_state_process tcp_timewait_state_process tcp_conn_request tcp_rcv_state_process And it will mess the code a little up, just like what you comment in this series: https://lore.kernel.org/netdev/20220617100514.7230-1-imagedong@tencent.com/ I hope to complete this part, or I think I can't move ahead :/ Thanks! Menglong Dong