From patchwork Fri Oct 30 18:33:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 1391233 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=pm.me Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=pm.me header.i=@pm.me header.a=rsa-sha256 header.s=protonmail header.b=iInLccsS; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CN9t563pLz9sRk for ; Sat, 31 Oct 2020 05:33:17 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727234AbgJ3SdQ (ORCPT ); Fri, 30 Oct 2020 14:33:16 -0400 Received: from mail-03.mail-europe.com ([91.134.188.129]:45876 "EHLO mail-03.mail-europe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727055AbgJ3SdQ (ORCPT ); Fri, 30 Oct 2020 14:33:16 -0400 Date: Fri, 30 Oct 2020 18:33:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1604082792; bh=LjCHrOdRA03o4xKg/F5+6+BqJIK8l1PZ5A6ied/We24=; h=Date:To:From:Cc:Reply-To:Subject:From; b=iInLccsSAHm9G0x94dqzQtSsPkfshjwiQnHvoKMjJqaLGyQU0SEfK4pGsMXLBDvgJ Wpns45I6YCiHVI3UA8Muhu0z8yk3j0bQecMxXbpibbHHeZzkUfpiQTqntv7lMQ1Xo7 5g3QANmbTiD7kLAqbCkfmY3zmkFz7Yzi82aI0DnilgLePcs3zz7DnpjwGelRJJdrsP iU2T90ICVCjizL2nDimEyTFUIbWNu0ozkOhhKvksdzrv+GHSjQhrLcnNREoFMeHBBt xnbmkOdQhYiLWJZ962jkm58q2PzW/TylWzbY4IPvmtl5DQg1JRreHz7yEIy6s1iAdw V8PFs0VQZwRMw== To: "David S. Miller" , Jakub Kicinski From: Alexander Lobakin Cc: Willem de Bruijn , Steffen Klassert , Alexander Lobakin , Antoine Tenart , Mauro Carvalho Chehab , Miaohe Lin , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: Alexander Lobakin Subject: [PATCH net-next] net: avoid unneeded UDP L4 and fraglist GSO resegmentation Message-ID: MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Commit 9fd1ff5d2ac7 ("udp: Support UDP fraglist GRO/GSO.") added a support for fraglist UDP L4 and fraglist GSO not only for local traffic, but also for forwarding. This works well on simple setups, but when any logical netdev (e.g. VLAN) is present, kernel stack always performs software resegmentation which actually kills the performance. Despite the fact that no mainline drivers currently supports fraglist GSO, this should and can be easily fixed by adding UDP L4 and fraglist GSO to the list of GSO types that can be passed-through the logical interfaces (NETIF_F_GSO_SOFTWARE). After this change, no resegmentation occurs (if a particular driver supports and advertises this), and the performance goes on par with e.g. 1:1 forwarding. The only logical netdevs that seem to be unaffected to this are bridge interfaces, as their code uses full NETIF_F_GSO_MASK. Tested on MIPS32 R2 router board with a WIP NIC driver in VLAN NAT: 20 Mbps baseline, 1 Gbps / link speed with this patch. Signed-off-by: Alexander Lobakin --- include/linux/netdev_features.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h index 0b17c4322b09..934de56644e7 100644 --- a/include/linux/netdev_features.h +++ b/include/linux/netdev_features.h @@ -207,8 +207,8 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start) NETIF_F_FSO) /* List of features with software fallbacks. */ -#define NETIF_F_GSO_SOFTWARE (NETIF_F_ALL_TSO | \ - NETIF_F_GSO_SCTP) +#define NETIF_F_GSO_SOFTWARE (NETIF_F_ALL_TSO | NETIF_F_GSO_SCTP | \ + NETIF_F_GSO_UDP_L4 | NETIF_F_GSO_FRAGLIST) /* * If one device supports one of these features, then enable them