Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2014002imu; Wed, 28 Nov 2018 20:20:56 -0800 (PST) X-Google-Smtp-Source: AFSGD/WffXeVMXc236lHd5JmkpcqGkr4fwCnRp94HNtbpX14rGxiDwv/lsdmhcBjaY+EJIpAS9yA X-Received: by 2002:a17:902:820f:: with SMTP id x15mr1817644pln.224.1543465256495; Wed, 28 Nov 2018 20:20:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543465256; cv=none; d=google.com; s=arc-20160816; b=SArXeomiFwxtsVKzhBS99snf3zblL4BQR3Ev7dDqxw9tVHfzGKu+WNcVFPxfh/eVjy GDMcLKfeBOeL+CmVUy7CVTwUSEflb/SCizhYoJoBpTnjR7sh60ZfRH3P/Cfgd1NZYQ88 nDp+azukXIJDLY795t/SqAtrl5eiMBOX9hR0zgTPtC03WECHao9z/noYtpdYLol+2/iR qtBpHLSzxBKk47OZO3xs+Eh3s9mWqK7tE2epC8slWe9E0L/uXik+IbCOfbnZNTNYIF2A GsKpM8jskd8M8U6CYJbGVG2PIYJ8rOPek8lb4QIjxu6lTT14YodtkzMb7h87XwS4vdy6 y5Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=l6qTF1Vr6exiqQT5k4E6k6Ymf0bd5wzrn4t9MHPDzxg=; b=zDEjFBqYKEwY6i6jYkBGEA6L//1GOsQfoLDdsAU/v6DnF0OXw2b1/0hVRjIp/oN6gZ 7O5jzgk3bH7MYoFreIFqNZGMxD7x3xD6tfa3zKaWMG/Sne2j7VlBjyySboyYMh9PWrAJ IogxDugFeD22zK7QYm3QUKYBGVaEcfNOqUseJGvGM32ADdcf0UKxv/kV6oxM1ayiNO+0 QZGxlZ7WBL/iDrULDQxe8CKbdGo1V/0lriX2XNpDrTLUcAwfxUzVQKvMf3Z8zP6SzKpf tqCkByYl19F+AwG8yt85NHrG/XFc+5IhHLUHvSf9JPF9MLd5J4hGCmpVGnwhwXQv79BK 6n2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BHU2s8BR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j22si735002pfi.252.2018.11.28.20.20.41; Wed, 28 Nov 2018 20:20:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BHU2s8BR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727698AbeK2PXw (ORCPT + 99 others); Thu, 29 Nov 2018 10:23:52 -0500 Received: from mail-pf1-f177.google.com ([209.85.210.177]:46014 "EHLO mail-pf1-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727239AbeK2PXv (ORCPT ); Thu, 29 Nov 2018 10:23:51 -0500 Received: by mail-pf1-f177.google.com with SMTP id g62so352731pfd.12; Wed, 28 Nov 2018 20:19:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=l6qTF1Vr6exiqQT5k4E6k6Ymf0bd5wzrn4t9MHPDzxg=; b=BHU2s8BRxh1t5k88ifQUD6Ms83Ks6fYXDERt9zlbGJym2wTOsMnPH1XWwcqTU1HpUm jrNa23TxzS5PMxxlAFHTFg+aTV7yZwPxvKQqTL/FoH4sMIFWBxvayCcmLRZ9jJuHdM6F K1S6EeLO/tDEQiJRrxpI/nzPbUGatV2MpAIuxndkTnDy4RdFDSqTp2VShhG147a4wcgI 5IErky6HD7lVNfapyxSfFl+D3ECwciZ+Vrd5MfP9Z01wylwP9VXwYAKr+Ky4gm6vCsw3 KRxXK2GhNgVK6VSgPL2Urs4kurAHJYWB+SuGxuQVLGdNUy07kpfWm65f/P1ot9lgcazr 3CLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=l6qTF1Vr6exiqQT5k4E6k6Ymf0bd5wzrn4t9MHPDzxg=; b=AagiT3LM8mMBBQy/8YWMoFugrOKexNMpkh1dy1V3Sj+ni1U05Pigl150K1wbC8IHvK XJVeBOZIKWCtLq/HuZUeN5hSeTZnwkrPNZzW8b8FHizOTUUMpSAKY77FzG+cOh9VwyFk CJMccuYYvGqxgUnH83dmtJpMpp+o/ITV6gEM6P6MaJqL20ikIUJ6l17GRAWg6u/2E/Eo T3o8D20Vpxm2zg/d1nrR445SevUrzHQlnQApm1vVpIaeRWQs4IDTWnv+SIzuFb3niv3U h5a5z6ACVOxcbaUwTsd1HegSuy+I6sFVnxJ2fHeTwTmy+10FVtZ92klVqGS4EgnMuseG iW9A== X-Gm-Message-State: AA+aEWYym2UFk/yKXGYv+86vgMUSIPrvzRNRXWutotbFLGn7yltLN91y OdeYysHLoIIfdBXTd1+jayGzwJnB X-Received: by 2002:a63:d104:: with SMTP id k4mr34950455pgg.227.1543465193244; Wed, 28 Nov 2018 20:19:53 -0800 (PST) Received: from ast-mbp ([2620:10d:c090:200::7:1eff]) by smtp.gmail.com with ESMTPSA id x2sm837977pfx.78.2018.11.28.20.19.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Nov 2018 20:19:52 -0800 (PST) Date: Wed, 28 Nov 2018 20:19:50 -0800 From: Alexei Starovoitov To: Aaron Conole Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, Alexei Starovoitov , Daniel Borkmann , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , John Fastabend , Jesper Brouer , "David S . Miller" , Andy Gospodarek , Rony Efraim , Simon Horman , Marcelo Leitner Subject: Re: [RFC -next v0 1/3] bpf: modular maps Message-ID: <20181129041948.pepdcksplt6xppk3@ast-mbp> References: <20181125180919.13996-1-aconole@bytheb.org> <20181125180919.13996-2-aconole@bytheb.org> <20181127020608.4vucwmhrtu2cxrwu@ast-mbp.dhcp.thefacebook.com> <20181128051001.wcsgqx3d6c2aszp6@ast-mbp.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180223 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 28, 2018 at 01:51:42PM -0500, Aaron Conole wrote: > Alexei Starovoitov writes: > > > On Tue, Nov 27, 2018 at 09:24:05AM -0500, Aaron Conole wrote: > >> > >> 1. Introduce flowmap again, this time, basically having it close to a > >> copy of the hashmap. Introduce a few function calls that allow an > >> external module to easily manipulate all maps of that type to insert > >> / remove / update entries. This makes it similar to, for example, > >> devmap. > > > > what is a flowmap? > > How is this flowmap different from existing hash, lpm and lru maps? > > The biggest difference is how relationship works. Normal map would > have single key and single value. Flow map needs to have two keys > "single-value," because there are two sets of flow tuples to track > (forward and reverse direction). That means that when updating the k-v > pairs, we need to ensure that the data is always consistent and up to > date. Probably we could do that with the existing maps if we had some > kind of allocation mechanism, too (so, keep a pointer to data from two > keys - not sure if there's a way to do that in ebpf)? just swap the src/dst ips inside bpf program depending on direction and use the same hash map. That's what xdp/bpf users already do pretty successfully. bpf hash map is already offloaded into hw too. > forward direction addresses could be different from reverse direction so > just swapping addresses / ports will not match). That makes no sense to me. What would be an example of such flow? Certainly not a tcp flow. > That lets us use xdp as a fast forwarding path for > connections, getting all of the advantage of helper modules to do the > control / parsing, and all the advantage of xdp for packet movement. From 10k feet view it sounds correct, but details make no sense. You're saying doing nat in the stack, but that _is_ the packet movement where you wanted to use xdp.