From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68E5FC433E1 for ; Mon, 29 Mar 2021 13:31:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 31FE861932 for ; Mon, 29 Mar 2021 13:31:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231624AbhC2Nai (ORCPT ); Mon, 29 Mar 2021 09:30:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:37445 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231219AbhC2NaD (ORCPT ); Mon, 29 Mar 2021 09:30:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617024602; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8x2UubjN/SS+D1frWCVTn9hXRqqpt2VSD8hRfNxsSrc=; b=RMm7zzYT13yPqu84TLeH1hSwZ5ivoGMNorjpd2pJTZCzk+0FKj8mykXyGAYQyZTamUR6UR m1O1u4Ue7EU0xJwKaqtWuXa/QBh64nksERaSHs6mNkCCG2f1t/x3D3r+Ts1J0uZgDv0yj8 39h12y6vOOQk+xzR32XoJSjhtpDDwEU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-98-FS7P2Qp6O22-S2zEshQmYw-1; Mon, 29 Mar 2021 09:29:58 -0400 X-MC-Unique: FS7P2Qp6O22-S2zEshQmYw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E88931922967; Mon, 29 Mar 2021 13:29:56 +0000 (UTC) Received: from ovpn-114-151.ams2.redhat.com (ovpn-114-151.ams2.redhat.com [10.36.114.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id C1F4B101E249; Mon, 29 Mar 2021 13:29:54 +0000 (UTC) Message-ID: <3004a1540d80bd8f45a12b35c0d5ee9bfc8d15cb.camel@redhat.com> Subject: Re: [PATCH net-next v2 4/8] udp: never accept GSO_FRAGLIST packets From: Paolo Abeni To: Willem de Bruijn Cc: Network Development , "David S. Miller" , Jakub Kicinski , Steffen Klassert , Alexander Lobakin Date: Mon, 29 Mar 2021 15:29:53 +0200 In-Reply-To: References: <7fa75957409a3f5d14198261a7eddb2bf1bff8e1.1616692794.git.pabeni@redhat.com> <846f001b9f4b3d377318ddbe4907f79ff4256019.camel@redhat.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Mon, 2021-03-29 at 08:31 -0400, Willem de Bruijn wrote: > On Mon, Mar 29, 2021 at 4:14 AM Paolo Abeni wrote: > > On Fri, 2021-03-26 at 14:15 -0400, Willem de Bruijn wrote: > > > On Thu, Mar 25, 2021 at 1:24 PM Paolo Abeni wrote: > > > > Currently the UDP protocol delivers GSO_FRAGLIST packets to > > > > the sockets without the expected segmentation. > > > > > > > > This change addresses the issue introducing and maintaining > > > > a couple of new fields to explicitly accept SKB_GSO_UDP_L4 > > > > or GSO_FRAGLIST packets. Additionally updates udp_unexpected_gso() > > > > accordingly. > > > > > > > > UDP sockets enabling UDP_GRO stil keep accept_udp_fraglist > > > > zeroed. > > > > > > > > v1 -> v2: > > > > - use 2 bits instead of a whole GSO bitmask (Willem) > > > > > > > > Fixes: 9fd1ff5d2ac7 ("udp: Support UDP fraglist GRO/GSO.") > > > > Signed-off-by: Paolo Abeni > > > > > > This looks good to me in principle, thanks for the revision. > > > > > > I hadn't fully appreciated that gro_enabled implies accept_udp_l4, but > > > not necessarily vice versa. > > > > > > It is equivalent to (accept_udp_l4 && !up->gro_receive), right? > > > > In this series, yes. > > > > > Could the extra bit be avoided with > > > > > > " > > > + /* Prefer fraglist GRO unless target is a socket with UDP_GRO, > > > + * which requires all but last segments to be of same gso_size, > > > passed in cmsg */ > > > if (skb->dev->features & NETIF_F_GRO_FRAGLIST) > > > - NAPI_GRO_CB(skb)->is_flist = sk ? !udp_sk(sk)->gro_enabled: 1; > > > + NAPI_GRO_CB(skb)->is_flist = sk ? > > > (!udp_sk(sk)->gro_enabled || udp_sk(sk)->accept_udp_fraglist) : 1; > > > > This is not ovious at all to me. > > > > > + /* Apply transport layer GRO if forwarding is enabled or the > > > flow lands at a local socket */ > > > if ((!sk && (skb->dev->features & NETIF_F_GRO_UDP_FWD)) || > > > (sk && udp_sk(sk)->gro_enabled && !up->encap_rcv) || > > > NAPI_GRO_CB(skb)->is_flist) { > > > pp = call_gro_receive(udp_gro_receive_segment, head, skb); > > > return pp; > > > } > > > > > > + /* Continue with tunnel GRO */ > > > " > > > > > > .. not that the extra bit matters a lot. And these two conditions with > > > gro_enabled are not very obvious. > > > > > > Just a thought. > > > > Overall looks more complex to me. I would keep the extra bit, unless > > you have strong opinion. > > Sounds good. > > > Side note: I was wondering about a follow-up to simplify the condition: > > > > if ((!sk && (skb->dev->features & NETIF_F_GRO_UDP_FWD)) || > > (sk && udp_sk(sk)->gro_enabled && !up->encap_rcv) || NAPI_GRO_CB(skb)->is_flist) { > > > > Since UDP sockets could process (segmenting as needed) unexpected GSO > > packets, we could always do 'NETIF_F_GRO_UDP_FWD', when enabled on the > > device level. The above becomes: > > > > if (skb->dev->features & NETIF_F_GRO_UDP_FWD) || > > (sk && udp_sk(sk)->gro_enabled && !up->encap_rcv) || > > NAPI_GRO_CB(skb)->is_flist) { > > > > which is hopefully more clear (and simpler). As said, non for this > > series anyhow. > > UDP sockets can segment, but it is expensive. In this case I think the > simplification is not worth the possible regression. No strong opinion here, I will not do the thing mentioned above. Thanks! Paolo