Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp288712pxb; Fri, 15 Jan 2021 03:23:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJxbhdSbjfOcZVgxG0o+Yp1HFUUS2SquleEUEwa+I2mftKzJzZ/L2S/bNqf2R4IlzOA7h/do X-Received: by 2002:a17:906:2b19:: with SMTP id a25mr5439485ejg.134.1610709809584; Fri, 15 Jan 2021 03:23:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610709809; cv=none; d=google.com; s=arc-20160816; b=mQ0vS4d3ElHDBSk7nVDyO9v29IoIHD1IaMOpqJlpcdJcqj/LFsw/17e+Tl0ZmNsg2X IA6bqHgWEcjztIn+UWJhl95RNWXGUfUpqYbzXk6pvgIj1DkLAaBYhdesvLlv9Q3UKN5q dtifAU7IxVgfpXse8zgEg/BpHYVDmN6BE1qIPkyZaamc+AILa6/lUAljZOnQD5bSRUk+ T9RE3CyXno7l6Q3IHlsz0qDCnP8RTXKIox7LmBPaOmKiVKQGj/21IxLvm91qGYhcDlGu zwZK0E1CmiO3fdttWSX3PSqbQbcbj0TEHwF7IMCGilgsUjKp1q6bC2rsaXIpLAH1BPsi Xsiw== 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=TIZ5+QlzRMhD/RwX4IqcdCtc797876KPO/iwoBLrka8=; b=M6XCFAwddHraWdCOfpNKJq1OxcuXguNRi7zHndguU8eNmqtdoP+0rOwUBPSRIgHyaz OMbI0fnPLgWRg7dsCosZSK6UPLlBd8h0RGx6luR2X8Vi6+tYqSyIR1a8mPBDkw3yUR+U baN0b3AuuhbjauFnMx6BVwEJrty3CQIg2mB0lNloQYbxGzk35l1cvelTJqOKn+qxb1sJ 1io7pIJsjVCiyqAKfJKz9KSsyrV6JoElsYB5puL8hSUXNOy8JEoIofrY9a8iGCCeDaJL lPBS3jXuqlj4xhngZrn1K9s8Nje1zKhfrXmnPzKBAS2duX3uY8/vhbZT19S3BDQdojnv BG7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=c6jafIG7; 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 la16si3510192ejb.730.2021.01.15.03.23.05; Fri, 15 Jan 2021 03:23:29 -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=c6jafIG7; 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 S1726944AbhAOLVx (ORCPT + 99 others); Fri, 15 Jan 2021 06:21:53 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:10732 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726626AbhAOLVv (ORCPT ); Fri, 15 Jan 2021 06:21:51 -0500 Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20210115112109epoutp0278fbc63408ce5b8108cd3e134b0e4921~aY_kayd700399303993epoutp020 for ; Fri, 15 Jan 2021 11:21:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20210115112109epoutp0278fbc63408ce5b8108cd3e134b0e4921~aY_kayd700399303993epoutp020 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1610709669; bh=TIZ5+QlzRMhD/RwX4IqcdCtc797876KPO/iwoBLrka8=; h=From:To:Cc:In-Reply-To:Subject:Date:References:From; b=c6jafIG7uR/tAT7oHUR82oBPAS5djFsNJjR6gOqzhuyTWrvw989k6ykTPT8XEa2kv bNcnbXn1MVbfTGL9ROl6BcgegiEhUxJIbBZj9TONtaF4nZ8fjTtYk2RwzPCx3Eo3ww S+z1NS0PcBLQwg7Cmzk4TITWHTitr69MlkdMsO1g= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20210115112108epcas2p3650881c6e6dda44b1e066345a2f30a45~aY_j0U_ok2153521535epcas2p3E; Fri, 15 Jan 2021 11:21:08 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.40.186]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4DHJdv08Pjz4x9Pq; Fri, 15 Jan 2021 11:21:07 +0000 (GMT) Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id AB.03.52511.2AA71006; Fri, 15 Jan 2021 20:21:06 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p4.samsung.com (KnoxPortal) with ESMTPA id 20210115112106epcas2p4bebb0ea08a25b4aa285161b6e8045fff~aY_hpGj3x1850918509epcas2p4n; Fri, 15 Jan 2021 11:21:06 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210115112106epsmtrp2792ee62467545d396f9a5d33453cec43~aY_hoNVKe0456404564epsmtrp2k; Fri, 15 Jan 2021 11:21:06 +0000 (GMT) X-AuditID: b6c32a48-50fff7000000cd1f-cb-60017aa2bab1 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id B3.86.13470.2AA71006; Fri, 15 Jan 2021 20:21:06 +0900 (KST) Received: from KORDO035731 (unknown [12.36.185.47]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210115112106epsmtip25180b12d6cf7c0367f296757b2df5d6e~aY_hYXimV2857228572epsmtip2b; Fri, 15 Jan 2021 11:21:06 +0000 (GMT) From: "Dongseok Yi" To: "'Alexander Lobakin'" , "'Steffen Klassert'" Cc: "'David S. Miller'" , , "'Hideaki YOSHIFUJI'" , "'Jakub Kicinski'" , "'Willem de Bruijn'" , , In-Reply-To: <20210115105048.2689-1-alobakin@pm.me> Subject: RE: [PATCH net] udp: ipv4: manipulate network header of NATed UDP GRO fraglist Date: Fri, 15 Jan 2021 20:21:06 +0900 Message-ID: <020101d6eb30$84363170$8ca29450$@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQHB+vDADvusEXIyolmvL0xqzqJZpgH0BKV0AUiOhq0CaVZx5gLGU+OUAgQYe3Kp/uIy8A== Content-Language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrLJsWRmVeSWpSXmKPExsWy7bCmue6iKsYEg7dTrCxWPd7OYjHnfAuL xYVtfawWl3fNYbNouNPMZnFsgZjF7s4f7Bbvthxht/i6t4vFgdNjy8qbTB4LNpV6bFrVyebR dm0Vk8fRPefYPPq2rGL02NS6hNXj8ya5AI6oHJuM1MSU1CKF1Lzk/JTMvHRbJe/geOd4UzMD Q11DSwtzJYW8xNxUWyUXnwBdt8wcoOuUFMoSc0qBQgGJxcVK+nY2RfmlJakKGfnFJbZKqQUp OQWGhgV6xYm5xaV56XrJ+blWhgYGRqZAlQk5Gf0LelgLLmtUnH/6g6WBcZ9CFyMHh4SAicSn K+JdjFwcQgI7GCXOTNrDCOF8YpSYtuIqlPONUeL9pUNADidYx7wLh6ESexklPkw4xQbhvGCU +DJ7J1gV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JzMstQifbsEroz+BT2sBZc1Ks4//cHS wLhPoYuRk0NCwERi3oXDjF2MXBxCArsZJR40H2TqYuQASkhI7NrsClEjLHG/5QgriC0k8IxR YtYZXxCbTUBL4s2sdrC4iECixKbrD1hB5jALTGSSaO64zwIx9ACTxKfJFxlBqjgFjCUW3J3H DmILC4RLfFvTzARiswioSvy//AGshlfAUqJ55lImCFtQ4uTMJywgNrOAtkTvw1ZGCFteYvvb OcwQ1ylI/Hy6DOqKMIkfjxdA1YtIzO5sY57AKDwLyahZSEbNQjJqFpKWBYwsqxglUwuKc9Nz iw0LDPNSy/WKE3OLS/PS9ZLzczcxgqNPS3MH4/ZVH/QOMTJxMB5ilOBgVhLhzVdmSBDiTUms rEotyo8vKs1JLT7EKM3BoiTOe6HrZLyQQHpiSWp2ampBahFMlomDU6qBKUDm6AfbA06T7nsd zf77h6koZW6qxcZVauK/Jh7/PuH2RMujYooZ+c8u9UxmtzuhYjtj0XTJ/cLTRb/v2Va2uCux evZxtq0z9soHePSk6dvv4frtn+hzk3+Kiolz1zTe1QtWnXW98ffkAu5jp26IJ0bkzrl56M5E XpOCVoYzEQqzcvav6i9aIS3+X+suv87yuGk3jt7hkWGtc5drKJv77MSXZbOviL3X2q1Subto 8fOFrB0t5nMqaj/yJF1Q/P94+vT2gqafNYvfWRXe9FS+Xyl9/FSLYNjDJ3PFt77dPz+/4/4v zo7VTH5uofUimfMFLjBz+B1+tnHVRKbn236+jSuLyBb5l9DwoMD7jYr+ShUlluKMREMt5qLi RABc6t80LQMAAA== X-CMS-MailID: 20210115112106epcas2p4bebb0ea08a25b4aa285161b6e8045fff 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: 20210115061039epcas2p479bc5f3dd3dad5a250c4e0fc42896704 References: <1610690304-167832-1-git-send-email-dseok.yi@samsung.com> <20210115081243.GM9390@gauss3.secunet.de> <01e801d6eb1c$2898c300$79ca4900$@samsung.com> <20210115092752.GN9390@gauss3.secunet.de> <20210115105048.2689-1-alobakin@pm.me> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-01-15 19:51, Alexander Lobakin wrote: > From: Steffen Klassert > Date: Fri, 15 Jan 2021 10:27:52 +0100 > > > On Fri, Jan 15, 2021 at 05:55:22PM +0900, Dongseok Yi wrote: > >> On 2021-01-15 17:12, Steffen Klassert wrote: > >>> On Fri, Jan 15, 2021 at 02:58:24PM +0900, Dongseok Yi wrote: > >>>> UDP/IP header of UDP GROed frag_skbs are not updated even after NAT > >>>> forwarding. Only the header of head_skb from ip_finish_output_gso -> > >>>> skb_gso_segment is updated but following frag_skbs are not updated. > >>>> > >>>> A call path skb_mac_gso_segment -> inet_gso_segment -> > >>>> udp4_ufo_fragment -> __udp_gso_segment -> __udp_gso_segment_list > >>>> does not try to update UDP/IP header of the segment list. > >>> > >>> We still need to find out why it works for Alexander, but not for you. > >>> Different usecases? > >> > >> This patch is not for > >> https://lore.kernel.org/patchwork/patch/1364544/ > >> Alexander might want to call udp_gro_receive_segment even when > >> !sk and ~NETIF_F_GRO_FRAGLIST. > > > > Yes, I know. But he said that fraglist GRO + NAT works for him. > > I want to find out why it works for him, but not for you. > > I found that it worked for me because I advertised fraglist GSO > support in my driver (and added actual support for xmitting > fraglists). If so, kernel won't resegment GSO into a list of > plain packets, so no __udp_gso_segment_list() will be called. > > I think it will break if I disable fraglist GSO feature through > Ethtool, so I could test your patches. Thanks for the reply. In my case I enabled NETIF_F_GRO_FRAGLIST on my driver. It expected that NAT done on each skb of the forwarded fraglist. > > >>> > >>> I would not like to add this to a generic codepath. I think we can > >>> relatively easy copy the full headers in skb_segment_list(). > >> > >> I tried to copy the full headers with the similar approach, but it > >> copies length too. Can we keep the length of each skb of the fraglist? > > > > Ah yes, good point. > > > > Then maybe you can move your approach into __udp_gso_segment_list() > > so that we dont touch generic code. > > Okay, I will move it into __udp_gso_segment_list() on v3. > >> > >>> > >>> I think about something like the (completely untested) patch below: > >>> > >>> diff --git a/net/core/skbuff.c b/net/core/skbuff.c > >>> index f62cae3f75d8..63ae7f79fad7 100644 > >>> --- a/net/core/skbuff.c > >>> +++ b/net/core/skbuff.c > >>> @@ -3651,13 +3651,14 @@ struct sk_buff *skb_segment_list(struct sk_buff *skb, > >>> unsigned int offset) > >>> { > >>> struct sk_buff *list_skb = skb_shinfo(skb)->frag_list; > >>> + unsigned int doffset = skb->data - skb_mac_header(skb); > >>> unsigned int tnl_hlen = skb_tnl_header_len(skb); > >>> unsigned int delta_truesize = 0; > >>> unsigned int delta_len = 0; > >>> struct sk_buff *tail = NULL; > >>> struct sk_buff *nskb; > >>> > >>> - skb_push(skb, -skb_network_offset(skb) + offset); > >>> + skb_push(skb, doffset); > >>> > >>> skb_shinfo(skb)->frag_list = NULL; > >>> > >>> @@ -3675,7 +3676,7 @@ struct sk_buff *skb_segment_list(struct sk_buff *skb, > >>> delta_len += nskb->len; > >>> delta_truesize += nskb->truesize; > >>> > >>> - skb_push(nskb, -skb_network_offset(nskb) + offset); > >>> + skb_push(nskb, doffset); > >>> > >>> skb_release_head_state(nskb); > >>> __copy_skb_header(nskb, skb); > >>> diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c > >>> index ff39e94781bf..1181398378b8 100644 > >>> --- a/net/ipv4/udp_offload.c > >>> +++ b/net/ipv4/udp_offload.c > >>> @@ -190,9 +190,22 @@ EXPORT_SYMBOL(skb_udp_tunnel_segment); > >>> static struct sk_buff *__udp_gso_segment_list(struct sk_buff *skb, > >>> netdev_features_t features) > >>> { > >>> + struct sk_buff *list_skb = skb_shinfo(skb)->frag_list; > >>> unsigned int mss = skb_shinfo(skb)->gso_size; > >>> + unsigned int offset; > >>> > >>> - skb = skb_segment_list(skb, features, skb_mac_header_len(skb)); > >>> + skb_headers_offset_update(list_skb, skb_headroom(list_skb) - skb_headroom(skb)); > >>> + > >>> + /* Check for header changes and copy the full header in that case. */ > >>> + if ((udp_hdr(skb)->dest == udp_hdr(list_skb)->dest) && > >>> + (udp_hdr(skb)->source == udp_hdr(list_skb)->source) && > >>> + (ip_hdr(skb)->daddr == ip_hdr(list_skb)->daddr) && > >>> + (ip_hdr(skb)->saddr == ip_hdr(list_skb)->saddr)) > >>> + offset = skb_mac_header_len(skb); > >>> + else > >>> + offset = skb->data - skb_mac_header(skb); > >>> + > >>> + skb = skb_segment_list(skb, features, offset); > >>> if (IS_ERR(skb)) > >>> return skb; > >>> > >>> > >>> After that you can apply the CSUM magic in __udp_gso_segment_list(). > > I'll test and let you know if it works. If doesn't, I think I'll be > able to get a working one based on this. > > >> Sorry, I don't know CSUM magic well. Is it used for checksum > >> incremental update too? > > > > With that I meant the checksum updating you did in your patch. Ah, I see. > > Thanks, > Al