Received: by 2002:a05:6358:795:b0:dc:4c66:fc3e with SMTP id n21csp493056rwj; Sat, 29 Oct 2022 06:27:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7WAmnfZJ1drgkY5oVWzvrwxTt8xat0L/sfqVHB5dCPv5u+pCDz5s6YujbVgbjuX82DCeh+ X-Received: by 2002:a17:907:3da2:b0:78d:45df:b4f with SMTP id he34-20020a1709073da200b0078d45df0b4fmr3743215ejc.651.1667050046557; Sat, 29 Oct 2022 06:27:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667050046; cv=none; d=google.com; s=arc-20160816; b=FGikPLgr/0VKDszIeyRqq+PPl2Rz5UDyy8xSRIxpu3o7xR/Z2SRHxgsi0j8XoNOaXA GGOS4qaYwtnEGLwCHfk4/L+Wgh1gY2Gu/58TpwCtAT0+0FZaYSGdGyiqF4vLsTPsj+zt jW7Q4Fu9enyvB/p6jIsPr65nLOZsVFynw7pRfa4aNzzBGbvA6Oe4PshAMkqbxcbg7uXF UldEVTX/jelcBOhG49LdrzeHTvfOihEs3f19MCjjXKjS8NIMrbj4TphVKOXxxnzsNVyd /PvH0Tdjm2VNOQrjZtX0yKEvBTVTD8Tx14ndu1TWqfUbyyFgnvotI3zT415mbndNw+9z cECw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DZK5NQKMxu7Q7E+ji+/bWQancP2wJOHTkQ/B4KtPPIU=; b=VwBG9+SPtNvZwJyOzhemUod2Dg+XjZHyONBpy38YeykSoryWF0Ni3qQqUbbrMuXnkL WOVDJ0wWg36BmC+UeSFK8ds7zoFdcyp6MdTdsq/tKH4cYCa+OvrcYhb6L4ZauBCzFXeq Ugrr3klcYfsm7ycwEbiT9MYCU4NXG3ub++56W7ARrNA+Mq9XTbPdk4zNCCsAPpwHD61H 4+ZcRcw4SJIM8m1TXJPSUcgh6xVLiBafE/RSujT9DMeSS1sY25AWjyqr3QVjlZ0kDBkj Nn9HMxEuI3s2+l6blAU8NCuRqFGVkE+wZV3Q0BZuivDMsXJO8JUJmMb6vo6MZ9TgK9uf 4x/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FJ7o32Gl; 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 b17-20020aa7cd11000000b00457166171c6si1469647edw.432.2022.10.29.06.27.00; Sat, 29 Oct 2022 06:27:26 -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=FJ7o32Gl; 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 S229875AbiJ2NLY (ORCPT + 99 others); Sat, 29 Oct 2022 09:11:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229777AbiJ2NLS (ORCPT ); Sat, 29 Oct 2022 09:11:18 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C51C46918F; Sat, 29 Oct 2022 06:11:11 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id h2so7076622pgp.4; Sat, 29 Oct 2022 06:11:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DZK5NQKMxu7Q7E+ji+/bWQancP2wJOHTkQ/B4KtPPIU=; b=FJ7o32Gllk7KI9sdfQ2eYONOatmIj1khojCKJVqftg8E5DWx6Ty8537rzVV2hveavq v6SF1dVE4KOC38S/3jV7BjoKPuHcSN3NhrmjaaS0BS+ri8Y0a86jh7nxZJdQ4FMCsVBV FB6wKOOSWUaJ4rsPjRmIK0LXT3JGJ70D7vC1osZbAcVn6teIGyUZHkNXIozn5NkK6Hun Yuq0xdxiG2yLaEbkcS+HR5SArtJj1dH58kUSyvWNIY8rWHsydHO3c0tyiQ6g0Ut8711j ZDeiw+iIrJhIzXBAjAgXIt5wuzoy2ZBfiuUN9uwYLmNIjtAe9VcAp64hPHc86iikMlR2 hkIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DZK5NQKMxu7Q7E+ji+/bWQancP2wJOHTkQ/B4KtPPIU=; b=6xx+DfBzK7bBsxM6QV4hz1bmEkdrHmmDUp8VFjGXWoqgCiglnx66lHNTyTa9DnbsYV UEZKcUffy82E1q0tFsMHtuJCIEmwyIW9qbSh5TfzTHgQQAJu0YQqbvm1GssXi9pkKuVY CCUazm+yqe1cpmJ7fLG2w4SVG38/5zbauHV7dw6L+nMSqkr4NgKpzV6harqDbZ6ONMzH ESnqjS9UCbD8tB9bHCiqKrjxsf+McEHPuavUznn/UrmS45xU2SbNleJPmwbW8cj9bpZz r6KRzRwyTqldAO/5BIwfGVALErHDMIdHv7AWlNjZ0OuTfAbIZ5V6NPiqqXSHG3Yj7Yv/ GB2Q== X-Gm-Message-State: ACrzQf1KG5atgFFVu6XimgS8wU0IpKZKou11u890LVLIixbDAic5Ksck sinEgkMYE02OVHjJ8peAmoY= X-Received: by 2002:a62:19cd:0:b0:56b:6a55:ffba with SMTP id 196-20020a6219cd000000b0056b6a55ffbamr4259598pfz.85.1667049071233; Sat, 29 Oct 2022 06:11:11 -0700 (PDT) Received: from localhost.localdomain ([203.205.141.21]) by smtp.gmail.com with ESMTPSA id s7-20020a170902988700b001811a197797sm1244069plp.194.2022.10.29.06.11.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Oct 2022 06:11:10 -0700 (PDT) From: menglong8.dong@gmail.com X-Google-Original-From: imagedong@tencent.com To: edumazet@google.com, kuba@kernel.org Cc: 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 Subject: [PATCH net-next 2/9] net: tcp: add 'drop_reason' field to struct tcp_skb_cb Date: Sat, 29 Oct 2022 21:09:50 +0800 Message-Id: <20221029130957.1292060-3-imagedong@tencent.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221029130957.1292060-1-imagedong@tencent.com> References: <20221029130957.1292060-1-imagedong@tencent.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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. Signed-off-by: Menglong Dong --- include/net/tcp.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/net/tcp.h b/include/net/tcp.h index 14d45661a84d..0b6e39ca83b4 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -888,6 +888,7 @@ struct tcp_skb_cb { has_rxtstamp:1, /* SKB has a RX timestamp */ unused:5; __u32 ack_seq; /* Sequence number ACK'd */ + enum skb_drop_reason drop_reason; /* Why skb is dropped */ union { struct { #define TCPCB_DELIVERED_CE_MASK ((1U<<20) - 1) @@ -912,6 +913,8 @@ struct tcp_skb_cb { }; #define TCP_SKB_CB(__skb) ((struct tcp_skb_cb *)&((__skb)->cb[0])) +#define TCP_SKB_DR(__skb, reason) \ + (TCP_SKB_CB(__skb)->drop_reason = SKB_DROP_REASON_##reason) extern const struct inet_connection_sock_af_ops ipv4_specific; -- 2.37.2