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=-3.9 required=3.0 tests=FROM_EXCESS_BASE64, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,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 C5FCBC43218 for ; Fri, 26 Apr 2019 20:26:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A2854208CA for ; Fri, 26 Apr 2019 20:26:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726834AbfDZU05 (ORCPT ); Fri, 26 Apr 2019 16:26:57 -0400 Received: from mga17.intel.com ([192.55.52.151]:8174 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725966AbfDZU05 (ORCPT ); Fri, 26 Apr 2019 16:26:57 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Apr 2019 13:26:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,398,1549958400"; d="scan'208";a="294866713" Received: from unknown (HELO btopel-mobl.ger.intel.com) ([10.255.41.98]) by orsmga004.jf.intel.com with ESMTP; 26 Apr 2019 13:26:52 -0700 Subject: Re: [PATCH net-next 4/6] xsk: Extend channels to support combined XSK/non-XSK traffic To: Maxim Mikityanskiy , "David S. Miller" , Magnus Karlsson Cc: "netdev@vger.kernel.org" , Saeed Mahameed , Jonathan Lemon , Eran Ben Elisha , Tariq Toukan References: <20190426114156.8297-1-maximmi@mellanox.com> <20190426114156.8297-5-maximmi@mellanox.com> From: =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= Message-ID: Date: Fri, 26 Apr 2019 22:26:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190426114156.8297-5-maximmi@mellanox.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 2019-04-26 13:42, Maxim Mikityanskiy wrote: > Currently, the drivers that implement AF_XDP zero-copy support (e.g., > i40e) switch the channel into a different mode when an XSK is opened. It > causes some issues that have to be taken into account. For example, RSS > needs to be reconfigured to skip the XSK-enabled channels, or the XDP > program should filter out traffic not intended for that socket and > XDP_PASS it with an additional copy. As nothing validates or forces the > proper configuration, it's easy to have packets drops, when they get > into an XSK by mistake, and, in fact, it's the default configuration. > There has to be some tool to have RSS reconfigured on each socket open > and close event, but such a tool is problematic to implement, because no > one reports these events, and it's race-prone. > > This commit extends XSK to support both kinds of traffic (XSK and > non-XSK) in the same channel. It implies having two RX queues in > XSK-enabled channels: one for the regular traffic, and the other for > XSK. It solves the problem with RSS: the default configuration just > works without the need to manually reconfigure RSS or to perform some > possibly complicated filtering in the XDP layer. It makes it easy to run > both AF_XDP and regular sockets on the same machine. In the XDP program, > the QID's most significant bit will serve as a flag to indicate whether > it's the XSK queue or not. The extension is compatible with the legacy > configuration, so if one wants to run the legacy mode, they can > reconfigure RSS and ignore the flag in the XDP program (implemented in > the reference XDP program in libbpf). mlx5e will support this extension. > > A single XDP program can run both with drivers supporting or not > supporting this extension. The xdpsock sample and libbpf are updated > accordingly. > > Signed-off-by: Maxim Mikityanskiy I acknowledge the problem you're addressing, but I'm not a fan of this design. Netdevs, queues and now channels. This is too complicated. The setup is complex as it is. Adding more cognitive load is not good. There's already an assumption that a user attaching to a certain netdev queue has to take care of the flow steering. What about adding a mode where the AF_XDP user just get a *new* queue, by binding to (say) netdev;qid==-1? This new queue wouldn't be included in the existing queue set. Create a bunch of AF_XDP sockets and steer traffic to that set. And yes, we need a mechanism to steer to that queue, in-app/socket or out-of-band. Please see this [1] discussion. I don't like this "let's split a queue into channels". Björn [1] https://lore.kernel.org/netdev/20190415183258.36dcee9a@carbon/