Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2883862lqp; Mon, 25 Mar 2024 11:57:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUSvrWorqYOSMCkzr+TlxO0lSiJGu9orSCmQg2KNyjadHf0E8QS7t2vPoTHXxJ2Jg7/EcW25tydYz0CVgqHBfvjAyd4BlMci7Ed8zgp+Q== X-Google-Smtp-Source: AGHT+IFq+XEophpbtc2fGx910Q66exceJEISbuvP7sCf6k4l5zcgnHunZ3KRucxW4o6MPecBgRB9 X-Received: by 2002:a50:cd93:0:b0:568:b71a:5954 with SMTP id p19-20020a50cd93000000b00568b71a5954mr6260136edi.10.1711393035321; Mon, 25 Mar 2024 11:57:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711393035; cv=pass; d=google.com; s=arc-20160816; b=GxIgcPKlEWda6igT/jV8ytmu4l0ydjSarHj2CFytE/UyYZM/IfU2pP5khEtOZZNYFf TGl792OCSzwIyfkmqGhILaMImNr821OA5S7JmkSuFZpVsMTLtlDBs3l3uX1lJ6EkS7rr oMbbtrqG9Ysynr5CK4cBh2LXtECbXgrfEhoi06Gfud8XC0RNYE/erQoShzFAi6s/hd2d VdTS0HrblEyJz+WN+UpPmkvoWLthUJfHAM3nEbCMpD0FQFD80MDAQCxvIKnEDvdrsC70 a3dOTto3bAsXmQxC7bRlZIwtWSSqBD1r6TezqkGDxHIqoaKunkVsh62piDsr6FViasvy rd2w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:references:in-reply-to :message-id:to:from:date:dkim-signature; bh=1bp10ctRl8y8tt0avIquIVKHyA25BiReIcnLxTfH/WA=; fh=5Ec5ZSKU5Q1WMn2GqgPvogzULkWsn/OHljJ4miSwDJI=; b=imvpsBMyta/bZiK0rROR6q/ORKVp56YzTzM2eVQsGGUjzETfb2CCm3NJdNndMLSitH qS2RrhoYNZwmxAvfuRa9TtkLf/E6vYgyKTvccIeHNP5CP/ROGxEUlWAeTMROR3zuPYen +HMkDEblyDA1SfNegJh8rwS3yYBrUrNZJA+Sv10G4PRheF9PxAo0qkjWfBjrkv7Tiooa BvYQ6UGS/nNMKsw9l5eIwH98SLpjL9zQBT1On3YiH5GZjHZlgg1P2zA8mrwuc0eAXcUb tV6OzMz5lbE2jdE3N3BYTS7IPPxj1X/54HeCZ5gTwtqs18gvuMbBZFRRir9Wa+5xVfGS vq3w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=I8MsTo9Z; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-117751-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117751-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ig13-20020a056402458d00b0056ba9f8d580si2858138edb.292.2024.03.25.11.57.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 11:57:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117751-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=I8MsTo9Z; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-117751-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117751-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2576C1F6412C for ; Mon, 25 Mar 2024 18:54:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E49E679F3; Mon, 25 Mar 2024 18:53:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="I8MsTo9Z" Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com [209.85.128.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C5E46FDC; Mon, 25 Mar 2024 18:53:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711392820; cv=none; b=tFn7x7KMYxqXqSPc0wNNkskEducJjE251MOO8EWIiNR43CoYeMloCeBm3Z/ggA/A4vNTu5i3DKIbHhkSGxC37iiCZljR2rA8obrQ8ZqJtLxkDYgqbfZ8pS6NcpAvf1FIahXKILUsnlsGFhlCdn5L6go2Pm+mhpwV4qjorRwFyKQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711392820; c=relaxed/simple; bh=dHJnqiu0d3Amh21YXYif8J99OePzMNkm5pLyOHnLViE=; h=Date:From:To:Message-ID:In-Reply-To:References:Subject: Mime-Version:Content-Type; b=tue1fJza5SsdSacrW2aQ/xtE5wSMAheuU/LEu7yqUgF1Al+4TXIDtpPUH784Mbg82n7peUxi9XcgnJZ2UTDfRxkZbqcASyR+m53llV8gn3gY2aBUcJ+xhVji8XbDWjX1/rsmCPgvSryZQyO0u8d9OD29aeCx8IvjQVql/fNLrr8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=I8MsTo9Z; arc=none smtp.client-ip=209.85.128.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-60a0579a968so49991327b3.3; Mon, 25 Mar 2024 11:53:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711392817; x=1711997617; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=1bp10ctRl8y8tt0avIquIVKHyA25BiReIcnLxTfH/WA=; b=I8MsTo9Z6eDEXCX81L7ehB8WvD1FPboKKynGCqtmFo2gDBps4KD1sewxbyJw7ll2jg g0G4SMVFRpyUMZUlx/wfFCx6+bDD8kF8LNzXiJyXzAsXIcGTMjR7GQBitVRwPF48a9pA OEqD13rejGwirjrToQKncNeQB8ykdHWP/GRCpoYfgVEW7iHSIepoI6maDrmCJdvT0Y0L Ot5dyfZX3xUynTI658uLDy0VgaGLdwCrCwpIfZAxcb3BriKwCB/EfKHtT9FNwcvkQeFy zO8JBmzRmVCSk1B7IzymU10yCr2sQ+LjCCteBZb6zVnqgvZuyklNDPXKT/rkPO8J5Qs0 s4NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711392817; x=1711997617; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1bp10ctRl8y8tt0avIquIVKHyA25BiReIcnLxTfH/WA=; b=IBFmfyJNImWeNKtwifnZTPfmaxJ9mPBMq6QQm5i+7rI8b+RXYFpADKJVUPqv5FkHg5 dsjSawGcI9ps7oo1uHGO0Z33IIThqGg82jQT956W9keSd18gqgaVmgkyS12L3Mm8Whjp c+ntSJ4EuDKWgsXZpogin8ZjOsBdAFDDtzMD568Aq5Sm8CKcJEKpO25Zz3V4eevvbAiH hP4ovMOeSkRqb6dh78coZT2ahaMFkowyJGLR3vMoOyqcJs9s++6uVpzHjQ4s3I3yDV2W /lkCc/0GpGbuMIn/ROkFF7hkqx2nlgZfETjZqwzC0cPJY7i9+BKZBTncayBIiRDgLSoE c0eA== X-Forwarded-Encrypted: i=1; AJvYcCV49euTUqMToeN3+tT40DGdnIZstjrD5YFnM0RE059Sl5BCKDpphrabNAQnTMhtzw1r3XkbRUbgsxgZBqYY9B9yIn+Boemn5qGhclNqho8PNLP7wNcpw0Ddwg27UH4vZume3S/VldUE9iMUUjkEM533CpR+y0OeeiItViCsWsu4Aa7heezY X-Gm-Message-State: AOJu0Yyk3+hrQp4e4GKUcJYHdto1Yx+dB1F/WrDi4eCM4sWmgdWm3B5K NdFLWTmN5OUKOfjBM61AqoRB2eYc6lR9LgJc7rIC3d7UxYgTGf4O X-Received: by 2002:a81:8805:0:b0:60c:ba36:1ff6 with SMTP id y5-20020a818805000000b0060cba361ff6mr6332111ywf.32.1711392817444; Mon, 25 Mar 2024 11:53:37 -0700 (PDT) Received: from localhost (55.87.194.35.bc.googleusercontent.com. [35.194.87.55]) by smtp.gmail.com with ESMTPSA id pc17-20020a05620a841100b007881a59042dsm2341233qkn.66.2024.03.25.11.53.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 11:53:37 -0700 (PDT) Date: Mon, 25 Mar 2024 14:53:36 -0400 From: Willem de Bruijn To: Richard Gobert , davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, willemdebruijn.kernel@gmail.com, dsahern@kernel.org, xeb@mail.ru, shuah@kernel.org, idosch@nvidia.com, amcohen@nvidia.com, petrm@nvidia.com, jbenc@redhat.com, bpoirier@nvidia.com, b.galvani@gmail.com, liujian56@huawei.com, horms@kernel.org, linyunsheng@huawei.com, richardbgobert@gmail.com, therbert@google.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Message-ID: <6601c830c1daa_11c6072943b@willemb.c.googlers.com.notmuch> In-Reply-To: <20240325182543.87683-5-richardbgobert@gmail.com> References: <20240325182543.87683-1-richardbgobert@gmail.com> <20240325182543.87683-5-richardbgobert@gmail.com> Subject: Re: [PATCH net-next v4 4/4] net: gro: move L3 flush checks to tcp_gro_receive Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Richard Gobert wrote: > {inet,ipv6}_gro_receive functions perform flush checks (ttl, flags, > iph->id, ...) against all packets in a loop. These flush checks are used > currently only in tcp flows in GRO. > > These checks need to be done only once in tcp_gro_receive and only against > the found p skb, since they only affect flush and not same_flow. > > Levaraging the previous commit in the series, in which correct network > header offsets are saved for both outer and inner network headers - > allowing these checks to be done only once, in tcp_gro_receive. As a > result, NAPI_GRO_CB(p)->flush is not used at all. In addition - flush_id > checks are more declarative and contained in inet_gro_flush, thus removing > the need for flush_id in napi_gro_cb. > > This results in less parsing code for UDP flows and non-loop flush tests > for TCP flows. > > For example, running 40 IP/UDP netperf connections: > ./super_netperf.sh 40 -H 1.1.1.2 -t UDP_STREAM -l 120 > > Running perf top for 90s we can see that relatively less time is spent > on inet_gro_receive when GRO is not coalescing UDP: > > net-next: > 1.26% [kernel] [k] inet_gro_receive > > patch applied: > 0.85% [kernel] [k] inet_gro_receive > > udpgro_bench.sh single connection GRO improvement: > net-next: > 0.76% [kernel] [k] inet_gro_receive > > patch applied: > 0.61% [kernel] [k] inet_gro_receive > > Signed-off-by: Richard Gobert In v3 we discussed how the flush on network layer differences (like TTL or ToS) currently only affect the TCP GRO path, but should apply more broadly. We agreed that it is fine to leave that to a separate patch series. But seeing this patch, it introduces a lot of churn, but also makes it harder to address that issue for UDP, as it now moves network layer checks directly to the TCP code.