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=-2.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 E9BABC433E0 for ; Wed, 20 Jan 2021 23:42:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B1B2D23603 for ; Wed, 20 Jan 2021 23:42:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731119AbhATV31 (ORCPT ); Wed, 20 Jan 2021 16:29:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388484AbhATVQm (ORCPT ); Wed, 20 Jan 2021 16:16:42 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 847CFC0613D3; Wed, 20 Jan 2021 13:16:01 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id m25so36054520lfc.11; Wed, 20 Jan 2021 13:16:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=9xqprKmIF+4hdxWjhTmv8hWIdDfZ4cVF6MaI4G6iU6o=; b=rdpAmL4Bo3FJW4yTLuyknU0s8T2jZ6rOzXrGWbZYHNhr1wE32GcEmI1fYF1NHyvrdb Dy3Emjr4Wx2LjW/xq+x3shCaUiuh5RR+i8guyXycbGjLE6RCkZL9H5/PoqWLT7Z/7UBD tAA9A3eZIMK5odW53BXdB5xJcIcNDIqu5nrTMWBI0tyA5xhifTHQGVxfZG3I/8xOXrn/ wfJMwHagRn8SZQCxHKpERK46xHIN9kzcFM1DxQ3Rcat8MRyl96zHU0cwrzPjhuIc5Z43 naRGZwSpi5NlYEGw3i0UqRIDItoeZCKiFD5I04y7/K4IU2bHWFpHJneJ5s+mR2SOFJCI GyfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=9xqprKmIF+4hdxWjhTmv8hWIdDfZ4cVF6MaI4G6iU6o=; b=QBC3ie7E/ApjP1AOOcaOWjGe7r0iSKCCYLJkZHBFAnZDlQ5ru3XMdZfOtOBmPRj14M 7Xz4E8oI5gtuxSrLv67oYvlj/CHTYGUXmFlIIbSTtJtWCDpBN/wv0zQ+pW7bC0jlhMoZ JqBWCiEaoyEoLZ9bUm9zwBL5TfnZzNB4Ecg0eVU7c+2/bZILDDxrh1idnQLZmKVYCfGN ENzKsMmwvxKH+RsW1IxtVMMC3cn8rV5nrIXnLYBppJwJrLrwGvIXH7u4snirF488WmZk SVtuupb4FHpX+L/pAylxpiqUPR9gMAxgAMI5ncnHkabdnPkx1VmBe7d+QkW5nhStT/JQ xGtA== X-Gm-Message-State: AOAM532aDDleGV2iIZJtSbqYZnTzGSgr1QCmVGrSDoqPZD+yELhdaeKY yV2q6r1Oq7fblhewURnyTi1bCV4KaUV8OxdMbak= X-Google-Smtp-Source: ABdhPJyWpKQsdsemvpFnX2V5xepWtCSL2KgXs1BkC67NXEBPh3PyQFg/G5pHCoCVmg/btAKFkVwRr3PNhFRTR4ZxEHY= X-Received: by 2002:ac2:5b1e:: with SMTP id v30mr5448503lfn.540.1611177360030; Wed, 20 Jan 2021 13:16:00 -0800 (PST) MIME-Version: 1.0 References: <20210119155013.154808-1-bjorn.topel@gmail.com> <20210119155013.154808-5-bjorn.topel@gmail.com> <878s8neprj.fsf@toke.dk> <46162f5f-5b3c-903b-8b8d-7c1afc74cb05@intel.com> <87k0s74q1a.fsf@toke.dk> <3c6feb0d-6a64-2251-3cac-c79cff29d85c@intel.com> <8735yv4iv1.fsf@toke.dk> <87pn1z2w38.fsf@toke.dk> In-Reply-To: <87pn1z2w38.fsf@toke.dk> From: Alexei Starovoitov Date: Wed, 20 Jan 2021 13:15:48 -0800 Message-ID: Subject: Re: [PATCH bpf-next v2 4/8] xsk: register XDP sockets at bind(), and add new AF_XDP BPF helper To: =?UTF-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= Cc: =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Alexei Starovoitov , Daniel Borkmann , Network Development , bpf , "Karlsson, Magnus" , "Fijalkowski, Maciej" , Jakub Kicinski , Jonathan Lemon , maximmi@nvidia.com, "David S. Miller" , Jesper Dangaard Brouer , John Fastabend , Ciara Loftus , weqaar.a.janjua@intel.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Wed, Jan 20, 2021 at 12:26 PM Toke H=C3=B8iland-J=C3=B8rgensen wrote: > > This argument, however, I buy: bpf_redirect() is the single-purpose > helper for redirecting to an ifindex, bpf_redirect_xsk() is the > single-purpose helper for redirecting to an XSK, and bpf_redirect_map() > is the generic one that does both of those and more. Fair enough, > consider me convinced :) > > > A lot of back-and-forth for *one* if-statement, but it's kind of a > > design thing for me. ;-) > > Surely you don't mean to imply that you have *better* things to do with > your time than have a 10-emails-long argument over a single if > statement? ;) After reading this thread I think I have to pour cold water on the design. The performance blip comes from hard coded assumptions: + queue_id =3D xdp->rxq->queue_index; + xs =3D READ_ONCE(dev->_rx[queue_id].xsk); bpf can have specialized helpers, but imo this is beyond what's reasonable. Please move such things into the program and try to make bpf_redirect_map faster. Making af_xdp non-root is orthogonal. If there is actual need for that it has to be designed thoroughly and not presented as "this helper may help to do that". I don't think "may" will materialize unless people actually work toward the goal of non-root.