Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6534656rdb; Tue, 2 Jan 2024 05:21:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IE5vASp1NryK+lGTk0ur9Y7xGb4N3Svb8zRV5VDa5KiT+/re7VjYN8J4ATeGF+3aB+LPjAm X-Received: by 2002:a05:6358:7255:b0:174:8ce1:11ad with SMTP id i21-20020a056358725500b001748ce111admr20928662rwa.9.1704201675458; Tue, 02 Jan 2024 05:21:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704201675; cv=none; d=google.com; s=arc-20160816; b=GBOwkPPgwtU+Z//75YR+lCxKN/cOH+h4RgyC1k0dHo362Qk60PyQVH5Ji33ln13yCw O2sRrpVnXEcWoMtB02SK3UHdEUHu4gSWEQ09cPDqoDXBUz02pK8TN3dTuqBcD00iJEYf SRtJQMuLcGnw2SsCn3WmxHf/et9z25wy1i3/JWs6c/mrSkJZZaCkTH4isdeSAYtgXSjM Z/J660KM7ylZoP5Wq8Fagde8qXqqos/RQAEv+NPtnD6zb7lQZ3sUFLuOxVCC9M0MK7Bu CTFVH4EQBExxI9B+dn1XT8dQCUjJWL45YjsGgEFuq7mWCWYFrxcC/ZZC/ag9s48Q2Jqa v8TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:references:to:from:subject :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :date:message-id:dkim-signature; bh=j5PNTurghlPI/wU+fXieHZ4gaYw2koYqIseDXj5bnCo=; fh=Y340ezozF7Wvm1cTQGi0slwbR/3t9Devzu6PpLAqLHM=; b=i/n3W9K6jIbbkHOnGCoOdBks4mJ5awUoa3b8QKhr5EJcMWN65C/RBGvvK2l6nMpkij ZbL3dEXoH4salA13GDW50np5k3NxDUfLDp6FrZaLcqT9EnNaIBI9NXGYmAlfyM+8kXPU nsR06Mino6PZHvUT4xAgeZ3FVBAjYMMriqSVRxISAaaaYW9oSSqSb+8wsF4KjV/ypB+p +wTM41QXv6qhVzAGcJUTCGhW2QpDLOK5DeMfxX2esFMkEX9wUcLO1YpnpEpo/TDzc+re EKQQtKcz3DBDlTPOWWmtLF62oRGmQP0p7XTGhu0GxgILREpattfaXjUxsL3f3EjRBBYs M+mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ih3D4CVK; spf=pass (google.com: domain of linux-kernel+bounces-14396-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14396-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id t6-20020a6564c6000000b005cd78685329si17378521pgv.778.2024.01.02.05.21.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 05:21:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14396-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ih3D4CVK; spf=pass (google.com: domain of linux-kernel+bounces-14396-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14396-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 0E33A283157 for ; Tue, 2 Jan 2024 13:21:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 28CE6FBEF; Tue, 2 Jan 2024 13:21:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ih3D4CVK" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 D5F81F9EB; Tue, 2 Jan 2024 13:21:03 +0000 (UTC) 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-wr1-f43.google.com with SMTP id ffacd0b85a97d-33679c49fe5so8174511f8f.3; Tue, 02 Jan 2024 05:21:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704201662; x=1704806462; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:references:to:from:subject :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=j5PNTurghlPI/wU+fXieHZ4gaYw2koYqIseDXj5bnCo=; b=ih3D4CVKHytliUvNDPFK4SOlu0n3djAwJpOO1shEhTQBKvPTLtLQgQSs9HWIxNCSnf TU4p6PlqnR5APTuS4vKNeEi7X5JyqlpIaldDR6zlKLII80U9f5lEE+Bh4bOudKik7Gm2 iwHU09tSJC4Jlo1ItAfzVqj/BNiVaEKX/hfRYETGGzkIAwH/4PYCvz1sTL1+VlSesM47 kMxfzFbmKCvBCz1lwFi9QskHipaEm9yLaaE22ZuntJ74JhBjcFzAU1lFn9NdJbruXUva sjOnuVSztFBKXlkVVChzjCYZ2lD98w7wJg7RzJ6LDlxZdqnkPAgJyJQ4zc44+wpcbDjp QO7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704201662; x=1704806462; h=content-transfer-encoding:in-reply-to:references:to:from:subject :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=j5PNTurghlPI/wU+fXieHZ4gaYw2koYqIseDXj5bnCo=; b=BPHKLjc4PNsqAzprxrA64mKDLXvwrz4K4fjEzYDyn43bJMyBmIxPpRSOVlI0t76OHm S67VFAEt7s8/xfuYDarO/VmubbdERW3x3/W2rbji7hyPPa839nLQOd5PYlOhUUs9E4bp 0DgmCJWIGOzj4poiFYRrizIe6KMkM79KbWa698LbpqwC5YC2nxkmBVhKvH+4dsZJAiQc 0UkWQXtEoUuu96RhQhDw+JxNSqhji4HlkFB4ukVr1n22YH7etusQHpEsGM8F3zs+sc7i 1OE6obnahH+8tvhIhYL0KMfJhU3F6oQ7LTOsrHg2z5YabEYeosFTqeJmGuMd8Mt5OnNu CcMw== X-Gm-Message-State: AOJu0YxYQ43VWcrCfQDICPrDjz8A+ooHXbwMf9y1fs3RAn97P0vR/dsq eNkiDCLIonRYTOrqpiwxMCQkrE9pcGRY4IzJ X-Received: by 2002:a5d:4482:0:b0:336:7f81:d825 with SMTP id j2-20020a5d4482000000b003367f81d825mr9192600wrq.56.1704201662000; Tue, 02 Jan 2024 05:21:02 -0800 (PST) Received: from debian ([146.70.204.204]) by smtp.gmail.com with ESMTPSA id r8-20020a5d4948000000b003367a5b6b69sm28254743wrs.106.2024.01.02.05.20.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Jan 2024 05:21:01 -0800 (PST) Message-ID: <27d4cc21-1ce5-4417-bd0c-6dd43a92e4aa@gmail.com> Date: Tue, 2 Jan 2024 14:20:55 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: [PATCH net-next v2 1/3] net: gso: add HBH extension header offload support From: Richard Gobert To: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, shuah@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org References: <127b8199-1cd4-42d7-9b2b-875abaad93fe@gmail.com> In-Reply-To: <127b8199-1cd4-42d7-9b2b-875abaad93fe@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit This commit adds net_offload to IPv6 Hop-by-Hop extension headers (as it is done for routing and dstopts) since it is supported in GSO and GRO. This allows to remove specific HBH conditionals in GSO and GRO when pulling and parsing an incoming packet. Signed-off-by: Richard Gobert Reviewed-by: Willem de Bruijn --- net/ipv6/exthdrs_offload.c | 11 +++++++++++ net/ipv6/ip6_offload.c | 25 +++++++++++-------------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/net/ipv6/exthdrs_offload.c b/net/ipv6/exthdrs_offload.c index 06750d65d480..4c00398f4dca 100644 --- a/net/ipv6/exthdrs_offload.c +++ b/net/ipv6/exthdrs_offload.c @@ -16,6 +16,10 @@ static const struct net_offload dstopt_offload = { .flags = INET6_PROTO_GSO_EXTHDR, }; +static const struct net_offload hbh_offload = { + .flags = INET6_PROTO_GSO_EXTHDR, +}; + int __init ipv6_exthdrs_offload_init(void) { int ret; @@ -28,9 +32,16 @@ int __init ipv6_exthdrs_offload_init(void) if (ret) goto out_rt; + ret = inet6_add_offload(&hbh_offload, IPPROTO_HOPOPTS); + if (ret) + goto out_dstopts; + out: return ret; +out_dstopts: + inet6_del_offload(&dstopt_offload, IPPROTO_DSTOPTS); + out_rt: inet6_del_offload(&rthdr_offload, IPPROTO_ROUTING); goto out; diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c index d6314287338d..0e0b5fed0995 100644 --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c @@ -45,15 +45,13 @@ static int ipv6_gso_pull_exthdrs(struct sk_buff *skb, int proto) struct ipv6_opt_hdr *opth; int len; - if (proto != NEXTHDR_HOP) { - ops = rcu_dereference(inet6_offloads[proto]); + ops = rcu_dereference(inet6_offloads[proto]); - if (unlikely(!ops)) - break; + if (unlikely(!ops)) + break; - if (!(ops->flags & INET6_PROTO_GSO_EXTHDR)) - break; - } + if (!(ops->flags & INET6_PROTO_GSO_EXTHDR)) + break; if (unlikely(!pskb_may_pull(skb, 8))) break; @@ -171,13 +169,12 @@ static int ipv6_exthdrs_len(struct ipv6hdr *iph, proto = iph->nexthdr; for (;;) { - if (proto != NEXTHDR_HOP) { - *opps = rcu_dereference(inet6_offloads[proto]); - if (unlikely(!(*opps))) - break; - if (!((*opps)->flags & INET6_PROTO_GSO_EXTHDR)) - break; - } + *opps = rcu_dereference(inet6_offloads[proto]); + if (unlikely(!(*opps))) + break; + if (!((*opps)->flags & INET6_PROTO_GSO_EXTHDR)) + break; + opth = (void *)opth + optlen; optlen = ipv6_optlen(opth); len += optlen; -- 2.36.1