Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp3754344rwo; Mon, 24 Jul 2023 16:33:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlHPmuEV/89ftgv5JQHoaKruUbTg/9g/YurpzxdcOYmmNtZqz671G584y7yytcA0+I8xI0PC X-Received: by 2002:a05:6a00:2385:b0:668:731b:517e with SMTP id f5-20020a056a00238500b00668731b517emr12936278pfc.24.1690241601626; Mon, 24 Jul 2023 16:33:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690241601; cv=none; d=google.com; s=arc-20160816; b=kfKFM8gtxM5ul+oTOInKv/5bNyimYZ4bzQ5aHYvbmsXoQ2fY3rcgtH7Nsq8oNYCOTC YNt2WQWz6Zs08VUq0539MrZOBwOwBuTURufjI7olhlQ7ZUpjYufAfNE+DFHJhYMCs7gS 5E+zVA7GxnmF8e8ewvgr+GA0tp8PO4uPrKTVOtY30Fia43qkoJrdvyuHhl9Or0v6UCB8 9O0ycTE7Y9aDvOo8FHEaCkrWigJuOiNYLwzCye6EyEhFPESjlsCwxpEBr0Jee0rwKErD 0p6jnvLphAWxquM0ctJnIQ+oObvuZGNz/wCG1yO9Lmk96nSq1AFhMwuH6VpNixsSFNLB Nrqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:mime-version:date :dkim-signature:message-id; bh=H6YN2MhKnObTVNJlwXZBDVh2nU9Nss9o5bGaetiiYLk=; fh=PgkIEfiBTts5OtN05lGuMJnSbk37yhIYMFAW4TvNVSg=; b=G6GaX7sXLTLaxHnc4E6zhUrFHZhzPxB+A6vFky4xsnwdCFmJ+jhCy8HneWScg70jPW dK37iK+axzuKqnDPY8Jrmv5PZMvOAWpGlfx+BV8gYYCoZqz0pe00YMqFRIzPFQ0MS3l9 q9gVtHZuYkg62gzbSjl1c4xDrwv2AITBewUZ/OGg3ipPQFMuKr2KOpV9gC4StajT+kJo QQh+6bBhMOjLAZ23vh2ykkFV9wauabw31PaGbunGM+n+kpgl/eShgH/an+JSiHBMI+Wv JL/6HiZn5OgnQOkwb99otNGiub++4QPDCyrM7YNJof3uSLikfQVpNDIWBFaEtbk2Ggt2 eBfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=OCUfQwf3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fd30-20020a056a002e9e00b0067b2f265d2asi10692781pfb.262.2023.07.24.16.33.09; Mon, 24 Jul 2023 16:33:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=OCUfQwf3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230060AbjGXXCV (ORCPT + 99 others); Mon, 24 Jul 2023 19:02:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229974AbjGXXCS (ORCPT ); Mon, 24 Jul 2023 19:02:18 -0400 X-Greylist: delayed 376 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 24 Jul 2023 16:02:17 PDT Received: from out-34.mta1.migadu.com (out-34.mta1.migadu.com [95.215.58.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38F7CE70 for ; Mon, 24 Jul 2023 16:02:17 -0700 (PDT) Message-ID: <4c524936-989b-f679-d9ec-cf374c849c6f@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1690239359; 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=H6YN2MhKnObTVNJlwXZBDVh2nU9Nss9o5bGaetiiYLk=; b=OCUfQwf35fGkg4l3oybIH0OevuT0Zex7S9aARt7wwkSawx/N3p+55TqfELamAc59XkvMjd d7IpN68fWVMFNKZi6ikR2rcdDcsxH8tPMrEqc0sDib+tNM+8LPPKLQfT+bVf5ujtSCOD0Y kqnZnwP9B6xmC1zwwimS+v7HKW0BxFw= Date: Mon, 24 Jul 2023 15:55:49 -0700 MIME-Version: 1.0 Subject: Re: [PATCH bpf-next v6 4/8] net: remove duplicate reuseport_lookup functions Content-Language: en-US To: Lorenz Bauer Cc: Hemanth Malla , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Ahern , Willem de Bruijn , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Joe Stringer , Mykola Lysenko , Shuah Khan , Kuniyuki Iwashima References: <20230720-so-reuseport-v6-0-7021b683cdae@isovalent.com> <20230720-so-reuseport-v6-4-7021b683cdae@isovalent.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Martin KaFai Lau In-Reply-To: <20230720-so-reuseport-v6-4-7021b683cdae@isovalent.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/20/23 8:30 AM, Lorenz Bauer wrote: > @@ -452,7 +436,14 @@ static struct sock *udp4_lib_lookup2(struct net *net, > daddr, hnum, dif, sdif); > if (score > badness) { > badness = score; > - result = lookup_reuseport(net, sk, skb, saddr, sport, daddr, hnum); > + > + if (sk->sk_state == TCP_ESTABLISHED) { > + result = sk; > + continue; > + } Thanks for the cleanup. I also found moving the TCP_ESTABLISHED check here made the score logic easier to reason.