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=-5.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT 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 50B74C282C0 for ; Fri, 25 Jan 2019 07:59:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 23D4C2196F for ; Fri, 25 Jan 2019 07:59:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729101AbfAYH67 (ORCPT ); Fri, 25 Jan 2019 02:58:59 -0500 Received: from a.mx.secunet.com ([62.96.220.36]:59258 "EHLO a.mx.secunet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726735AbfAYH66 (ORCPT ); Fri, 25 Jan 2019 02:58:58 -0500 Received: from localhost (localhost [127.0.0.1]) by a.mx.secunet.com (Postfix) with ESMTP id 8E31C202B3; Fri, 25 Jan 2019 08:58:56 +0100 (CET) X-Virus-Scanned: by secunet Received: from a.mx.secunet.com ([127.0.0.1]) by localhost (a.mx.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id P1VGoS5ZfVBC; Fri, 25 Jan 2019 08:58:56 +0100 (CET) Received: from mail-essen-01.secunet.de (mail-essen-01.secunet.de [10.53.40.204]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a.mx.secunet.com (Postfix) with ESMTPS id 2654720201; Fri, 25 Jan 2019 08:58:56 +0100 (CET) Received: from gauss2.secunet.de (10.182.7.193) by mail-essen-01.secunet.de (10.53.40.204) with Microsoft SMTP Server id 14.3.435.0; Fri, 25 Jan 2019 08:58:55 +0100 Received: by gauss2.secunet.de (Postfix, from userid 1000) id 775D13180213; Fri, 25 Jan 2019 08:58:55 +0100 (CET) Date: Fri, 25 Jan 2019 08:58:55 +0100 From: Steffen Klassert To: Paolo Abeni CC: , Willem de Bruijn , "Jason A. Donenfeld" Subject: Re: [PATCH RFC 3/3] udp: Support UDP fraglist GRO/GSO. Message-ID: <20190125075855.GT3581@gauss3.secunet.de> References: <20181221075334.9000-1-steffen.klassert@secunet.com> <20181221075334.9000-4-steffen.klassert@secunet.com> <7e001c0f99f688da4be762528ddc9287f49797fc.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <7e001c0f99f688da4be762528ddc9287f49797fc.camel@redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-G-Data-MailSecurity-for-Exchange-State: 0 X-G-Data-MailSecurity-for-Exchange-Error: 0 X-G-Data-MailSecurity-for-Exchange-Sender: 23 X-G-Data-MailSecurity-for-Exchange-Server: d65e63f7-5c15-413f-8f63-c0d707471c93 X-EXCLAIMER-MD-CONFIG: 2c86f778-e09b-4440-8b15-867914633a10 X-G-Data-MailSecurity-for-Exchange-Guid: 08AEE1E1-0A16-4669-9AF3-12819C79EB1D X-G-Data-MailSecurity-for-Exchange-ProcessedOnRouted: True Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, Jan 08, 2019 at 04:00:01PM +0100, Paolo Abeni wrote: > > I think we could still avoid the lookup when no vxlan/GRO sockets are > present moving the lookup into udp{4,6}_gro_receive. Very roughly > something alike: > > diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c > index f79f1b5b2f9e..b0c0983eac6b 100644 > --- a/net/ipv4/udp_offload.c > +++ b/net/ipv4/udp_offload.c > @@ -420,20 +420,16 @@ static struct sk_buff *udp_gro_receive_segment(struct list_head *head, > INDIRECT_CALLABLE_DECLARE(struct sock *udp6_lib_lookup_skb(struct sk_buff *skb, > __be16 sport, __be16 dport)); > struct sk_buff *udp_gro_receive(struct list_head *head, struct sk_buff *skb, > - struct udphdr *uh, udp_lookup_t lookup) > + struct udphdr *uh, struct sock *sk) > { > struct sk_buff *pp = NULL; > struct sk_buff *p; > struct udphdr *uh2; > unsigned int off = skb_gro_offset(skb); > int flush = 1; > - struct sock *sk; > > - rcu_read_lock(); > - sk = INDIRECT_CALL_INET(lookup, udp6_lib_lookup_skb, > - udp4_lib_lookup_skb, skb, uh->source, uh->dest); > - if (!sk) { > - NAPI_GRO_CB(skb)->is_flist = 1; > + if (!sk || !udp_sk(sk)->gro_receive) { > + NAPI_GRO_CB(skb)->is_flist = sk ? !udp_sk(sk)->gro_enabled: 1; > pp = call_gro_receive(udp_gro_receive_segment, head, skb); > rcu_read_unlock(); > return pp; > @@ -506,7 +502,12 @@ struct sk_buff *udp4_gro_receive(struct list_head *head, struct sk_buff *skb) > inet_gro_compute_pseudo); > skip: > NAPI_GRO_CB(skb)->is_ipv6 = 0; > - return udp_gro_receive(head, skb, uh, udp4_lib_lookup_skb); > + rcu_read_lock(); > + sk = static_branch_unlikely(&udp_encap_needed_key) ? > + udp4_lib_lookup_skb(skb, uh->source, uh->dest) : NULL; > + pp = udp_gro_receive(head, skb, uh, sk); > + rcu_read_unlock(); > + return pp; > > flush: > NAPI_GRO_CB(skb)->flush = 1; > --- > > Regardless of the above, I think we should drop the later check for > gro_receive: > > --- a/net/ipv4/udp_offload.c > +++ b/net/ipv4/udp_offload.c > @@ -450,8 +450,7 @@ struct sk_buff *udp_gro_receive(struct list_head *head, struct sk_buff *skb, > if (NAPI_GRO_CB(skb)->encap_mark || > (skb->ip_summed != CHECKSUM_PARTIAL && > NAPI_GRO_CB(skb)->csum_cnt == 0 && > - !NAPI_GRO_CB(skb)->csum_valid) || > - !udp_sk(sk)->gro_receive) > + !NAPI_GRO_CB(skb)->csum_valid)) > goto out_unlock; > > /* mark that this skb passed once through the tunnel gro layer */ > --- I've incorporated the above into the next RFC patchset. > Finally this will cause GRO/GSO for local UDP packets delivery to non > GSO_SEGMENT sockets. That could be possibly a win or a regression: we > save on netfilter/IP stack traversal, but we add additional work, some > performances figures would probably help. I did some tests for the local receive path with netperf and iperf, but in this case the sender that generates the packets is the bottleneck. So the benchmarks are not that meaningful for the receive path. Do you have some performance tests for UDP GRO receive? If so, I'd be glad if you could test this, or maybe better the next patchset I'll send during the next days. Thanks!