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=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 5B506C433DF for ; Thu, 18 Jun 2020 17:31:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD238208B8 for ; Thu, 18 Jun 2020 17:31:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=dectris.com header.i=@dectris.com header.b="c8ZEUZc4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732089AbgFRRbv (ORCPT ); Thu, 18 Jun 2020 13:31:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729546AbgFRRbu (ORCPT ); Thu, 18 Jun 2020 13:31:50 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7121C0613ED for ; Thu, 18 Jun 2020 10:31:48 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id l10so6913596wrr.10 for ; Thu, 18 Jun 2020 10:31:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dectris.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JqaYEW9ro3Fi3jPgS562P8d03wfWAt51jfhpJgRkxcI=; b=c8ZEUZc4gvCUPo6stmuWdn+y297x849AgRco7d/3H78tUqCIFncgRsZD+Yp9K3Qr6e bHyHrtownVi/X4/H8ghoEnnsgrkfnkhjTFKr9LqC+wQf4Pm/rNANMDf2J/1WseJcVvU9 BTT8+AqBSxXncE+oICxrJfSKAhkucri8sWvYE= 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; bh=JqaYEW9ro3Fi3jPgS562P8d03wfWAt51jfhpJgRkxcI=; b=oiTK/yhlZyWMcWeFo6C2pFSOxW1N6U8lviD1vhTtizXU2bkxYSViB72blGXbQGse9F 2LUNiWea84A7buzu++Sfv3t1rCGozk1C4lUjBRX1kjbEupG9DLkeJEtk7c+9PNZgr02b Bu52qZI4rjrgWWHSeDCmn4JKY+iTUdCjkxtrHaHSxnmVcubQ9+l+G9rp14P6Vc35/zcZ LFp8txUvQ1cEbwCbumi7uYwFyMNkINvS/cj9/Nzlo/Lpwr6hEzAXatl3i+FajMj3LBYl Pkkh6NUdWVJFpti74oTAFDtQ4/yqFoGGeddW+Aj/4wKlw9ems3hZGIhVozY83XFTUTff YN/g== X-Gm-Message-State: AOAM533ppq9shJraz9x95XvmvQPEBSb8tLT61xRNkPHQOd9O3cElk7VO TgMZTNqlN5OjUuuSFdLXnHhtUb/MMi7BE7MiRvflgA== X-Google-Smtp-Source: ABdhPJx6Vzf/2/1fm8qrYtG5MGN7RobEP/IHY8UjXGssWAMiy9DMDA68HfJcWiMv28PW7LEAtUkso5vOLNm7Axn3BY4= X-Received: by 2002:a5d:46c1:: with SMTP id g1mr2937387wrs.295.1592501507201; Thu, 18 Jun 2020 10:31:47 -0700 (PDT) MIME-Version: 1.0 References: <20190902110818.2f6a8894@carbon> <20200618150347.ihtdvsfuurgfka7i@bsd-mbp.dhcp.thefacebook.com> In-Reply-To: <20200618150347.ihtdvsfuurgfka7i@bsd-mbp.dhcp.thefacebook.com> From: Kal Cutter Conley Date: Thu, 18 Jun 2020 19:31:36 +0200 Message-ID: Subject: Re: net/mlx5e: bind() always returns EINVAL with XDP_ZEROCOPY To: Jonathan Lemon Cc: Saeed Mahameed , "brouer@redhat.com" , Maxim Mikityanskiy , "magnus.karlsson@intel.com" , "toke.hoiland-jorgensen@kau.se" , "xdp-newbies@vger.kernel.org" , Tariq Toukan , "gospo@broadcom.com" , "jakub.kicinski@netronome.com" , "netdev@vger.kernel.org" , "bjorn.topel@intel.com" Content-Type: text/plain; charset="UTF-8" Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, Jun 18, 2020 at 5:23 PM Jonathan Lemon wrote: > > On Sun, Jun 14, 2020 at 10:55:30AM +0200, Kal Cutter Conley wrote: > > Hi Saeed, > > Thanks for explaining the reasoning behind the special mlx5 queue > > numbering with XDP zerocopy. > > > > We have a process using AF_XDP that also shares the network interface > > with other processes on the system. ethtool rx flow classification > > rules are used to route the traffic to the appropriate XSK queue > > N..(2N-1). The issue is these queues are only valid as long they are > > active (as far as I can tell). This means if my AF_XDP process dies > > other processes no longer receive ingress traffic routed over queues > > N..(2N-1) even though my XDP program is still loaded and would happily > > always return XDP_PASS. Other drivers do not have this usability issue > > because they use queues that are always valid. Is there a simple > > workaround for this issue? It seems to me queues N..(2N-1) should > > simply map to 0..(N-1) when they are not active? > > If your XDP program returns XDP_PASS, the packet should be delivered to > the xsk socket. If the application isn't running, where would it go? XDP_PASS means the packet is passed to the normal network stack for processing. XDP_REDIRECT means the packet should be delivered to the xsk socket. > > I do agree that the usability of this can be improved. What if the flow > rules are inserted and removed along with queue creatioin/destruction? The problem is the mlx5 driver allows flow rules to be set on N..(2N-1) at any time; even when no XDP program is loaded. Given this fact, it would be totally weird if they just suddenly disappeared the first time the queues go inactive. That's why I suggested that they just always map to queues 0..(N-1) when they are not active. This way, at least it's less surprising. What do people think? > Jonathan Kal