Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4254751pxb; Mon, 1 Feb 2021 17:20:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJzWzLyFREMa44EHH3v1CawMrPAGx6/OZ6W6sJmizAZVKaenD9ODcPZF7TtHh1Qx6ExE4nzl X-Received: by 2002:a17:907:3f29:: with SMTP id hq41mr20228679ejc.227.1612228854321; Mon, 01 Feb 2021 17:20:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612228854; cv=none; d=google.com; s=arc-20160816; b=pM2HeSwghHfZ3tlMB05B+dxwOs89bFxeM1h43gLpG7P7JbvQulmUweICIGYduPQigW oiNP/tVTAUh28U30WbVAzc7yK/l6AKR0ZDB+PCbJDL0V1gdSvoOmahxnG6q0RG8sn/lv YiyWef3ggDnyMts7EvC0uM07WCE/SFzgaH0DQ4nJDqY3Vb6uqO+RUnihdHyQjIXws/ql uIU4o3shWXHntcIQ+kmuLveYrJmQEpHzAyUdaCm74E2oIwbPmI9AdFimaMO3Bk7Ue/tl AqKzQWmrti4a34tb1nkN7U9INSM++7CCep6tbvews6VSNEbc6QCOdFRZ5h8PRyHQjfwN 29Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type:content-language :thread-index:content-transfer-encoding:mime-version:message-id:date :subject:in-reply-to:cc:to:from:dkim-signature:dkim-filter; bh=i5rADIZ0Sj9wrKQNewc1LdBisv/3fefoGp/S9dd+tMg=; b=xAJ85Zs0CWRNymqAT+6S/EmGBDGVFOoostNsKJyifbjAo0lqUpc5w0dF/zP/Sm7ssH K0C89sbtzK+sey1BEQm49cpieY24aEoMaoZiiB63wcXDLGWQOq7ES71x/IjKHXOvn0pb SM0dd7xcgZv4pARvK2L1Il1UU1srZ1XmzqVMeA/YnUNExfwW33MtAbtpI33lA7ky/+kN dXp2L2k1lmDRlTRBzQTZlaFBNcsNmIg8327dUFuxQzkOXw7/aNByNfQiKeyS5CcHyZsK 8dS3bJAnh/lYd/4d22i7vGLyRJhIiiftfa2x/msALVhc4kjCIMP548klSUgYLK9g2qdn qrFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=LLaHMoDh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ds8si10857083ejc.713.2021.02.01.17.20.28; Mon, 01 Feb 2021 17:20:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=LLaHMoDh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230157AbhBBBSj (ORCPT + 99 others); Mon, 1 Feb 2021 20:18:39 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:60070 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229554AbhBBBSg (ORCPT ); Mon, 1 Feb 2021 20:18:36 -0500 Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20210202011750epoutp0409376e9981d99450533653b5ff8392c9~fyW8G1HIW0110901109epoutp04_ for ; Tue, 2 Feb 2021 01:17:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20210202011750epoutp0409376e9981d99450533653b5ff8392c9~fyW8G1HIW0110901109epoutp04_ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1612228670; bh=i5rADIZ0Sj9wrKQNewc1LdBisv/3fefoGp/S9dd+tMg=; h=From:To:Cc:In-Reply-To:Subject:Date:References:From; b=LLaHMoDhHIAukChdgyxQIXinMarjXkptkFflN3u9i2Ef1UY2NABlsM55/jAApaT2u iU4gakDEIUXoFbDfFTt0d1nyTmKDeFSt9xVO3UGft9IF16kGE9vuQbc07Sn5KRKnVn JrcbyX1DNy2VlNrvkElimzxftpgWBVP7bUrNyyh4= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20210202011749epcas2p3d66e8c65e040f9d6d38468e97dd46745~fyW7mA8fD3022530225epcas2p3v; Tue, 2 Feb 2021 01:17:49 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.40.190]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4DV6PR2Phyz4x9QF; Tue, 2 Feb 2021 01:17:47 +0000 (GMT) Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 73.69.56312.B38A8106; Tue, 2 Feb 2021 10:17:47 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p2.samsung.com (KnoxPortal) with ESMTPA id 20210202011746epcas2p2a58b8b98e06879185dbf469312e8703a~fyW4vqdF03223432234epcas2p2Y; Tue, 2 Feb 2021 01:17:46 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210202011746epsmtrp1bef97ea754c72a067e4eb6fe627dfa09~fyW4ukgAq0897208972epsmtrp1h; Tue, 2 Feb 2021 01:17:46 +0000 (GMT) X-AuditID: b6c32a46-1efff7000000dbf8-4b-6018a83b6b26 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id A0.8E.13470.A38A8106; Tue, 2 Feb 2021 10:17:46 +0900 (KST) Received: from KORDO035731 (unknown [12.36.185.47]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210202011746epsmtip154393722742c3b8029f2ed718dfe39d2~fyW4azFO91746717467epsmtip1T; Tue, 2 Feb 2021 01:17:46 +0000 (GMT) From: "Dongseok Yi" To: "'Alexander Lobakin'" Cc: "'David S. Miller'" , "'Steffen Klassert'" , , "'Jakub Kicinski'" , "'Hideaki YOSHIFUJI'" , "'David Ahern'" , "'Alexei Starovoitov'" , "'Daniel Borkmann'" , "'Andrii Nakryiko'" , "'Martin KaFai Lau'" , "'Song Liu'" , "'Yonghong Song'" , "'John Fastabend'" , "'KP Singh'" , "'Willem de Bruijn'" , , , In-Reply-To: <20210130155458.8523-1-alobakin@pm.me> Subject: RE: [RESEND PATCH net v4] udp: ipv4: manipulate network header of NATed UDP GRO fraglist Date: Tue, 2 Feb 2021 10:17:46 +0900 Message-ID: <021c01d6f901$36da2d80$a48e8880$@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQH3UkD7ra4ajhnLvSE7bwMwZ51/XAG/rNSqAaWf2U6p6DEcMA== Content-Language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA02Te0xTVxzHd+5tbwsb5q68Tlii3XVsk4XSVstuVYib0tzEbWG6GF2IpSl3 FOwrvWCQPcDxbJliFREqm2wjEzodS22Qh+hWGFpZsEqHjo1FM15u8rA8FJGwthcz/vucc77f 3+/7u/ccPiqYxGL4Wfoc2qRXaQkslNPStUEWv6URpounqnHS/vdFDvlo8TRKzi78wSNnuq9i 5Ldfz6Nk3Y1iDvlDewlCft7aiJDj08OAHLt8BCE9LUe5ZH97HUYW/lmEkT31UeRC168o2WF+ zCMnnd08cryhBpBznRbOtnDK2fQ7QlmLJnlUm22IR9U7cinLnVso5bCbMap0wI5Qv1zqw6ij T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-CMS-MailID: 20210202011746epcas2p2a58b8b98e06879185dbf469312e8703a X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210129232630epcas2p1071e141ef8059c4d5c0e4b28c181a171 References: <1611962007-80092-1-git-send-email-dseok.yi@samsung.com> <20210130155458.8523-1-alobakin@pm.me> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/31/21 12:55 AM, Alexander Lobakin wrote: > From: Dongseok Yi > Date: Sat, 30 Jan 2021 08:13:27 +0900 > > > +static struct sk_buff *__udpv4_gso_segment_list_csum(struct sk_buff *segs) > > +{ > > + struct sk_buff *seg; > > + struct udphdr *uh, *uh2; > > + struct iphdr *iph, *iph2; > > + > > + seg = segs; > > + uh = udp_hdr(seg); > > + iph = ip_hdr(seg); > > + > > + if ((udp_hdr(seg)->dest == udp_hdr(seg->next)->dest) && > > + (udp_hdr(seg)->source == udp_hdr(seg->next)->source) && > > + (ip_hdr(seg)->daddr == ip_hdr(seg->next)->daddr) && > > + (ip_hdr(seg)->saddr == ip_hdr(seg->next)->saddr)) > > + return segs; > > + > > + while ((seg = seg->next)) { > > + uh2 = udp_hdr(seg); > > + iph2 = ip_hdr(seg); > > + > > + __udpv4_gso_segment_csum(seg, > > + &iph2->saddr, &iph->saddr, > > + &uh2->source, &uh->source); > > + __udpv4_gso_segment_csum(seg, > > + &iph2->daddr, &iph->daddr, > > + &uh2->dest, &uh->dest); > > + } > > + > > + return segs; > > +} > > + > > static struct sk_buff *__udp_gso_segment_list(struct sk_buff *skb, > > - netdev_features_t features) > > + netdev_features_t features, > > + bool is_ipv6) > > { > > unsigned int mss = skb_shinfo(skb)->gso_size; > > > > @@ -198,11 +257,11 @@ static struct sk_buff *__udp_gso_segment_list(struct sk_buff *skb, > > > > udp_hdr(skb)->len = htons(sizeof(struct udphdr) + mss); > > > > - return skb; > > + return is_ipv6 ? skb : __udpv4_gso_segment_list_csum(skb); > > I don't think it's okay to fix checksums only for IPv4. > IPv6 checksum mangling doesn't depend on any code from net/ipv6. Just > use inet_proto_csum_replace16() for v6 addresses (see nf_nat_proto.c > for reference). You can guard the path for IPv6 with > IS_ENABLED(CONFIG_IPV6) to optimize IPv4-only systems a bit. As you can see in __udpv4_gso_segment_list_csum, we compare ports and addrs. We should use *struct ipv6hdr* to compare the values for IPv6 but I am not sure the struct could be under net/ipv4. The initial idea was to support both IPv4 and IPv6. Thanks, that's a good point. But the supporting IPv6 would be a new feature. I want to fix IPv4 first, so the title is restricted to ipv4. > > > } > > > > struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, > > - netdev_features_t features) > > + netdev_features_t features, bool is_ipv6) > > { > > struct sock *sk = gso_skb->sk; > > unsigned int sum_truesize = 0; > > @@ -214,7 +273,7 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, > > __be16 newlen; > > > > if (skb_shinfo(gso_skb)->gso_type & SKB_GSO_FRAGLIST) > > - return __udp_gso_segment_list(gso_skb, features); > > + return __udp_gso_segment_list(gso_skb, features, is_ipv6); > > > > mss = skb_shinfo(gso_skb)->gso_size; > > if (gso_skb->len <= sizeof(*uh) + mss) > > @@ -328,7 +387,7 @@ static struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, > > goto out; > > > > if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) > > - return __udp_gso_segment(skb, features); > > + return __udp_gso_segment(skb, features, false); > > > > mss = skb_shinfo(skb)->gso_size; > > if (unlikely(skb->len <= mss)) > > diff --git a/net/ipv6/udp_offload.c b/net/ipv6/udp_offload.c > > index c7bd7b1..faa823c 100644 > > --- a/net/ipv6/udp_offload.c > > +++ b/net/ipv6/udp_offload.c > > @@ -42,7 +42,7 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, > > goto out; > > > > if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) > > - return __udp_gso_segment(skb, features); > > + return __udp_gso_segment(skb, features, true); > > > > mss = skb_shinfo(skb)->gso_size; > > if (unlikely(skb->len <= mss)) > > -- > > 2.7.4 > > Thanks, > Al