Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2845634lqt; Tue, 23 Apr 2024 03:32:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVSlJRZVGfQnhN0Sst4a+g335yyfZWVjxHHRjYfh8PKfAkyRBOfymW2XQrq8VdR6lvYKF3JvmGzM6iYdy4cWiw14l00Fw3EUVVsFhF8JQ== X-Google-Smtp-Source: AGHT+IGRy+6yrGLctOyfg1cr3o8zH5aKCQdNns3x9qIliwgmR/0Cbzkbf9otrZy2c2Uhi8TQVNLc X-Received: by 2002:a50:9508:0:b0:568:b622:f225 with SMTP id u8-20020a509508000000b00568b622f225mr8063180eda.30.1713868325584; Tue, 23 Apr 2024 03:32:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713868325; cv=pass; d=google.com; s=arc-20160816; b=gPCnjWF5WXw7hD/KA7IPhoe6LrHucx06tp2G1dcdJVhjcHTzB4DE4eU1ynjH4uf5re iBixUy2zNoPzSOHl7fbn1zWGioB46ExQ9LNjRj9BhO1+dEFCRuWdIUuddbCsdTnnbYIR RFmbYVtK5vUCTrDesD2FxoRDlidaKsK3QDB8EpYCbTzemm0rdkKq7GJVTWOUQmN0pDfe 2ofE8cBoB5lUZVGLj78pocHQQpFdqnRG5ygZyUCTKnHFAJM/d7kBGGIwFmFYVU7EB17z HsOPa5oEVdUR/SVGlDQx5ij6DVME9GVatS7IlW0I2Lz78HsasFy2fJk2Tanwvot03qI1 sBNA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=e6sfNgyyq3CP0DjLtTP2ZBLYSGUFE+AaTMTxRx7+2Mw=; fh=L9ocUoAr6xDY4E+A2/xvER64rp9DOQm7VdRVv4pUEts=; b=SovDKIz7ToYMKP6U2Mip57hzffaMT0JUUIoXYKLvHW+yPfUW1nwMxjb1ijC1pYayWZ zwgfsncSFL6djHKdwP0UoUHsNok88OZjyyYRNJWaNaBbCrsp2J5MTuFaDW1Pupfk0f1w KIdUzeRClmYwtqVtoMfVmaciPaR5vPq/4kf7BZgzROllYn9sackPPcdHocBNHCVmCXuh c48Iy0Erizk4VavIBh6g+wHWCiDiRRlqOq6lmBsluFw2tdgXTEUKs8hsOdTeu1Vekwwj t2SKu1+E6gaJbxJRO+5aZl+0+QVsDGyZMpb9fwhXn2QNTP6t12e6orwrh1zohwTf3JlR zTJA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=Sdkb0v8A; arc=pass (i=1 dkim=pass dkdomain=nbd.name dmarc=pass fromdomain=nbd.name); spf=pass (google.com: domain of linux-kernel+bounces-154859-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154859-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nbd.name Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id z15-20020a056402274f00b00571fe8194a1si3663545edd.346.2024.04.23.03.32.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 03:32:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-154859-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=fail header.i=@nbd.name header.s=20160729 header.b=Sdkb0v8A; arc=pass (i=1 dkim=pass dkdomain=nbd.name dmarc=pass fromdomain=nbd.name); spf=pass (google.com: domain of linux-kernel+bounces-154859-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154859-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nbd.name 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 9B41A1F258AE for ; Tue, 23 Apr 2024 10:25:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E1FD64CF2; Tue, 23 Apr 2024 10:25:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="Sdkb0v8A" Received: from nbd.name (nbd.name [46.4.11.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE1B95CDF2; Tue, 23 Apr 2024 10:25:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.4.11.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713867941; cv=none; b=SvZPreLDrTdZyc9AjON+dSJJbgIJoRwKyHFwl1fikir7lS/G7Ta/pYsYeWJbYE9yFXujkSWESOJQmwocdkhIPoh69ntueISkTanCEZyKkymPLzYmfcVDKFagxuorff7WhBaR/f8kpzTD5+Dm6QOv6VMcqe/XCcEOGnYdlmw2Aek= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713867941; c=relaxed/simple; bh=Y8f5+YKLqjKKXsFmgIr/oOVxZIeWK6XAH8GXTpW6zo4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=HLlRBL7soTniS5uYvronqlR1zBwOl3IOmuK8q5v7tcOWT/2JXh9w++sWOyo6MCkNnAOhlGcHCJbOx73yxbivUy4bR1X4AmIc1j9MWBnQdmFmjicwnpk694iiDWqdt/2KSI3ZFp6CS8SWVCACZZtCw7AVB4oMK1UoQg9ugiws9ro= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name; spf=none smtp.mailfrom=nbd.name; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b=Sdkb0v8A; arc=none smtp.client-ip=46.4.11.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=nbd.name DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=e6sfNgyyq3CP0DjLtTP2ZBLYSGUFE+AaTMTxRx7+2Mw=; b=Sdkb0v8ApZ8eALsQJahEXgrNj4 7EOx8+0/ILDg5MFyUY/fHFjMDPTuFRY1+r2zZJ+t7ZQDD4vFNuEQiImMbhMm489QKlTkkMl3UE10/ KQxnokWGZdgrO6TFW0SSATzzFXlYVFvcfgnt+DY5y0iggp65fnsH3HBnNiJ62OSzWITc=; Received: from p54ae9c93.dip0.t-ipconnect.de ([84.174.156.147] helo=nf.local) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1rzDLB-0061vs-11; Tue, 23 Apr 2024 12:25:33 +0200 Message-ID: <63abfa26-d990-46c3-8982-3eaf7b8f8ee5@nbd.name> Date: Tue, 23 Apr 2024 12:25:26 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC] net: add TCP fraglist GRO support To: Eric Dumazet Cc: netdev@vger.kernel.org, "David S. Miller" , Jakub Kicinski , Paolo Abeni , David Ahern , linux-kernel@vger.kernel.org References: <20240423094117.93206-1-nbd@nbd.name> Content-Language: en-US From: Felix Fietkau Autocrypt: addr=nbd@nbd.name; keydata= xsDiBEah5CcRBADIY7pu4LIv3jBlyQ/2u87iIZGe6f0f8pyB4UjzfJNXhJb8JylYYRzIOSxh ExKsdLCnJqsG1PY1mqTtoG8sONpwsHr2oJ4itjcGHfn5NJSUGTbtbbxLro13tHkGFCoCr4Z5 Pv+XRgiANSpYlIigiMbOkide6wbggQK32tC20QxUIwCg4k6dtV/4kwEeiOUfErq00TVqIiEE AKcUi4taOuh/PQWx/Ujjl/P1LfJXqLKRPa8PwD4j2yjoc9l+7LptSxJThL9KSu6gtXQjcoR2 vCK0OeYJhgO4kYMI78h1TSaxmtImEAnjFPYJYVsxrhay92jisYc7z5R/76AaELfF6RCjjGeP wdalulG+erWju710Bif7E1yjYVWeA/9Wd1lsOmx6uwwYgNqoFtcAunDaMKi9xVQW18FsUusM TdRvTZLBpoUAy+MajAL+R73TwLq3LnKpIcCwftyQXK5pEDKq57OhxJVv1Q8XkA9Dn1SBOjNB l25vJDFAT9ntp9THeDD2fv15yk4EKpWhu4H00/YX8KkhFsrtUs69+vZQwc0cRmVsaXggRmll dGthdSA8bmJkQG5iZC5uYW1lPsJgBBMRAgAgBQJGoeQnAhsjBgsJCAcDAgQVAggDBBYCAwEC HgECF4AACgkQ130UHQKnbvXsvgCgjsAIIOsY7xZ8VcSm7NABpi91yTMAniMMmH7FRenEAYMa VrwYTIThkTlQzsFNBEah5FQQCACMIep/hTzgPZ9HbCTKm9xN4bZX0JjrqjFem1Nxf3MBM5vN CYGBn8F4sGIzPmLhl4xFeq3k5irVg/YvxSDbQN6NJv8o+tP6zsMeWX2JjtV0P4aDIN1pK2/w VxcicArw0VYdv2ZCarccFBgH2a6GjswqlCqVM3gNIMI8ikzenKcso8YErGGiKYeMEZLwHaxE Y7mTPuOTrWL8uWWRL5mVjhZEVvDez6em/OYvzBwbkhImrryF29e3Po2cfY2n7EKjjr3/141K DHBBdgXlPNfDwROnA5ugjjEBjwkwBQqPpDA7AYPvpHh5vLbZnVGu5CwG7NAsrb2isRmjYoqk wu++3117AAMFB/9S0Sj7qFFQcD4laADVsabTpNNpaV4wAgVTRHKV/kC9luItzwDnUcsZUPdQ f3MueRJ3jIHU0UmRBG3uQftqbZJj3ikhnfvyLmkCNe+/hXhPu9sGvXyi2D4vszICvc1KL4RD aLSrOsROx22eZ26KqcW4ny7+va2FnvjsZgI8h4sDmaLzKczVRIiLITiMpLFEU/VoSv0m1F4B FtRgoiyjFzigWG0MsTdAN6FJzGh4mWWGIlE7o5JraNhnTd+yTUIPtw3ym6l8P+gbvfoZida0 TspgwBWLnXQvP5EDvlZnNaKa/3oBes6z0QdaSOwZCRA3QSLHBwtgUsrT6RxRSweLrcabwkkE GBECAAkFAkah5FQCGwwACgkQ130UHQKnbvW2GgCeMncXpbbWNT2AtoAYICrKyX5R3iMAoMhw cL98efvrjdstUfTCP2pfetyN In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 23.04.24 12:15, Eric Dumazet wrote: > On Tue, Apr 23, 2024 at 11:41 AM Felix Fietkau wrote: >> >> When forwarding TCP after GRO, software segmentation is very expensive, >> especially when the checksum needs to be recalculated. >> One case where that's currently unavoidable is when routing packets over >> PPPoE. Performance improves significantly when using fraglist GRO >> implemented in the same way as for UDP. >> >> Here's a measurement of running 2 TCP streams through a MediaTek MT7622 >> device (2-core Cortex-A53), which runs NAT with flow offload enabled from >> one ethernet port to PPPoE on another ethernet port + cake qdisc set to >> 1Gbps. >> >> rx-gro-list off: 630 Mbit/s, CPU 35% idle >> rx-gro-list on: 770 Mbit/s, CPU 40% idle > > Hi Felix > > changelog is a bit terse, and patch complex. > > Could you elaborate why this issue > seems to be related to a specific driver ? > > I think we should push hard to not use frag_list in drivers :/ > > And GRO itself could avoid building frag_list skbs > in hosts where forwarding is enabled. > > (Note that we also can increase MAX_SKB_FRAGS to 45 these days) The issue is not related to a specific driver at all. Here's how traffic flows: TCP packets are received on the SoC ethernet driver, the network stack performs regular GRO. The packet gets forwarded by flow offloading until it reaches the PPPoE device. PPPoE does not support GSO packets, so the packets need to be segmented again. This is *very* expensive, since data needs to be copied and checksummed. So in my patch, I changed the code to build fraglist GRO instead of regular GRO packets, whenever there is no local socket to receive the packets. This makes segmenting very cheap, since the original skbs are preserved on the trip through the stack. The only cost is an extra socket lookup whenever NETIF_F_FRAGLIST_GRO is enabled. PPPoE in this case is only an example. The same issue appears when forwarding to any netdev which does not support TSO, which in my case affects most wifi drivers as well. - Felix