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.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 476C6CA9EB6 for ; Wed, 23 Oct 2019 14:11:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0C39C2086D for ; Wed, 23 Oct 2019 14:11:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=mojatatu-com.20150623.gappssmtp.com header.i=@mojatatu-com.20150623.gappssmtp.com header.b="wz5fAXRB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403954AbfJWOLb (ORCPT ); Wed, 23 Oct 2019 10:11:31 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:44023 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730622AbfJWOLb (ORCPT ); Wed, 23 Oct 2019 10:11:31 -0400 Received: by mail-io1-f66.google.com with SMTP id c11so15994217iom.10 for ; Wed, 23 Oct 2019 07:11:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=7mTLchMz27yHE3v+HYqAFC8C62BOeIbxUWkxLK3+HgE=; b=wz5fAXRBiidu/z5ytS9ZYzs2p/f54ji1X/VUt1S6dvsdeizi+TGuiAKEwvYGaLPL+r AGH588kL/XUwIsKjL2jv4s+B+mklp2HceTbU5gVv29XMQ7hLhxNVgM+WZwxCqnL/kB6W 9S2F+4FcrsZ+WFLU8B7FoJ4GHK2y4auXPe+2E+L4lHBbjyFCo0n7n5vs+oetDQSEmKJd Sx02iGMm6a74v0mlzw7HpoZmpJ0jCQtdAGtStSCN2yPp3eqNCbqS5gDnffiiVraBHgZ5 qsdcvKnY5fmm7DMPKUIcd57u87UEU0AXNSxlTtfnmvSq2znf/ZUAU6mWI0NUofY4bUzw TZmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=7mTLchMz27yHE3v+HYqAFC8C62BOeIbxUWkxLK3+HgE=; b=l0NvKkG6MhG31y4OHx4fOMk2rG+2bVzA5O09M/ZA0UsWwti+Q+jm2rE/c4GfKaKy1Z vQW21YoqVk5qBided87JVKViTk6eN4LJa7tnY0Z5vfJ9TEGXfNA7J+xQzZWgMMBCJdFb 51LzVJ0qfrRW51xCZBfR0npgr7NzUkrPBjYJL9DYtdlSb7qmHxpOvlu1jaqhRG/N9ttj Br8MGQAj61Fqu+cdJ16S2S5n6plpcdD/4sIfmMUA/d9V4pX8cMJHyxjlaI5xLFI9GciD 1VVc5uSFuGWqwBzqv0E2IwQvaonO69tNsX4yQFicpaZATRYbNF0mhhz3dMLeCbNmx9Rl i+Yg== X-Gm-Message-State: APjAAAUivuuZL6EwPyvZOGQNhY3Y7uT6JOqysx15ycpkvTntF6mrqV9x M8twCDHcR+X+F/MuUpsEDy1iHA== X-Google-Smtp-Source: APXvYqzXSqJpybvFZImqCY3p1LdZnsNbk/MXtCsS6dh/u0592dO/rmk/bmILZWsaXLAyTeTec0xS6Q== X-Received: by 2002:a02:19c1:: with SMTP id b184mr9607390jab.54.1571839889615; Wed, 23 Oct 2019 07:11:29 -0700 (PDT) Received: from [10.0.0.194] ([64.26.149.125]) by smtp.googlemail.com with ESMTPSA id j74sm5898001ila.55.2019.10.23.07.11.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Oct 2019 07:11:27 -0700 (PDT) Subject: Re: [RFC PATCH v2 bpf-next 00/15] xdp_flow: Flow offload to XDP To: John Fastabend , Toshiaki Makita , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , Cong Wang , Jiri Pirko , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , Pravin B Shelar Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, William Tu , Stanislav Fomichev References: <20191018040748.30593-1-toshiaki.makita1@gmail.com> <5da9d8c125fd4_31cf2adc704105c456@john-XPS-13-9370.notmuch> <22e6652c-e635-4349-c863-255d6c1c548b@gmail.com> <5daf34614a4af_30ac2b1cb5d205bce4@john-XPS-13-9370.notmuch> From: Jamal Hadi Salim Message-ID: <1c794797-db6f-83a7-30b4-aa864f798e5b@mojatatu.com> Date: Wed, 23 Oct 2019 10:11:25 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <5daf34614a4af_30ac2b1cb5d205bce4@john-XPS-13-9370.notmuch> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org Sorry - didnt read every detail of this thread so i may be missing something. On 2019-10-22 12:54 p.m., John Fastabend wrote: > Toshiaki Makita wrote: >> On 2019/10/19 0:22, John Fastabend wrote: >>> Toshiaki Makita wrote: >>>> This is a PoC for an idea to offload flow, i.e. TC flower and nftables, >>>> to XDP. >>>> > > I don't know who this "someone" is that wants to use XDP through TC > flower or nftables transparently. TC at least is not known for a > great uapi. The uapi is netlink. You may be talking about lack of a friendly application library that abstracts out concepts? > It seems to me that it would be a relatively small project > to write a uapi that ran on top of a canned XDP program to add > flow rules. This could match tc cli if you wanted but why not take > the opportunity to write a UAPI that does flow management well. > Disagreement: Unfortunately legacy utilities and apps cant just be magically wished away. There's a lot of value in transparently making them work with new infrastructure. My usual exaggerated pitch: 1000 books have been written on this stuff, 100K people have RH certificates which entitle them to be "experts"; dinasour kernels exist in data centres and (/giggle) "enteprise". You cant just ignore all that. Summary: there is value in what Toshiaki is doing. I am disappointed that given a flexible canvas like XDP, we are still going after something like flower... if someone was using u32 as the abstraction it will justify it a lot more in my mind. Tying it to OVS as well is not doing it justice. Agreement: Having said that I dont think that flower/OVS should be the interface that XDP should be aware of. Neither do i agree that kernel "real estate" should belong to Oneway(TM) of doing things (we are still stuck with netfilter planting the columbus flag on all networking hooks). Let 1000 flowers bloom. So: couldnt Toshiaki's requirement be met with writting a user space daemon that trampolines flower to "XDP format" flow transforms? That way in the future someone could add a u32->XDP format flow definition and we are not doomed to forever just use flower. >> To some extent yes, but not completely. Flow insertion from userspace >> triggered by datapath upcall is necessary regardless of whether we use >> TC or not. > > Right but these are latency involved with OVS architecture not > kernel implementation artifacts. Actually what would be an interesting > metric would be to see latency of a native xdp implementation. > > I don't think we should add another implementation to the kernel > that is worse than what we have. > > > xdp_flow TC ovs kmod > -------- -------- -------- > 22ms 6ms 0.6ms > > TC is already order of magnitude off it seems :( > > > If ovs_kmod is .6ms why am I going to use something that is 6ms or > 22ms. I am speculating having not read Toshiaki's code. The obvious case for the layering is for policy management. As you go upwards hw->xdp->tc->userspace->remote control your policies get richer and the resolved policies pushed down are more resolved. I am guessing the numbers we see above are for that first packet which is used as a control packet. An automonous system like this is of course susceptible to attacks. The workaround would be to preload the rules, but even then you will need to deal with resource constraints. Comparison would be like hierarchies of cache to RAM: L1/2/3 before RAM. To illustrate: Very limited fastest L1 (aka NIC offload), Limited faster L2 (XDP algorithms), L3 being tc and RAM being the user space resolution. >I expect a native xdp implementation using a hash map to be > inline with ovs kmod if not better. Hashes are good for datapath use cases but not when you consider a holistic access where you have to worry about control aspect. cheers, jamal