Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1529835imu; Wed, 28 Nov 2018 10:52:46 -0800 (PST) X-Google-Smtp-Source: AFSGD/Vzb9i7RUBr6VpCAED0ON94bDOCqduHNs6n76oEZJiB4Siv8VhhBaqm7T5wrCQnB2b6bWOY X-Received: by 2002:a63:314c:: with SMTP id x73mr34637264pgx.323.1543431166615; Wed, 28 Nov 2018 10:52:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543431166; cv=none; d=google.com; s=arc-20160816; b=cYos0iPts7BmlOfzdK7wgDA+L2quuywIe2BSvk/ZrSeX6i38XMl9vAXZ67qshZNK6l l22ZyGXocJW6UBuZcpesQyu5rMOPk4pznoDhAPdOx1qUermyJVGXhDCiKsvv/g6mh0iH nRw9wcZMtapfp14mP+vo3MksSX8sd+lq6dia3oYgTqeYuX/hnWe9o30hw/D4CAA/IQ2Z lcBSKbgEr39JNWEYnT0htY2hXlyWdJAhdPHqQwaRPqUMCATk+V9F4KCf3cnkL84yPLNM hKoPuYxOCNgXc+H39AAwedbpTakEb5LCsN9hMs/YgXDNqgwU18FNRMEjViOkBUUZCCjt WoUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id:date :references:subject:cc:to:from; bh=edbSYPnWDYiFeKCOFeoAaujWfr/f+EgzANiJt4psp5I=; b=M0Hnvr3MHQKQu3xZEY4WlLpS8264BFV+cAr+Z0iBnsgFadfnMYJqBDvt7U6NOZGVUe HJhmxPYKlBpRmuE4oIDgklFp0JvNhOyHW1/SlZAgtY1sBCke08qo9drgACEH9/HDrkdI 2y2jkTJYw6ql8atk921Bm7w8azGH2Dh1K8vwuaWialKkrgaSsRD/JqeGxj+YKTjXaouP DSXbcWMg9yqE6g1ShDJHiG/zeE4lWshT8AUDMcy0sRenupG3xWfLYe9aK4bzWyXOFoUq aNJc015mTGVSYquxdOFNRw+y9S9e8JoiS24XFOzzKHCDFiIRj170haT6Fu3NNvFPxfVn wqMg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a18si8109078pgj.77.2018.11.28.10.52.31; Wed, 28 Nov 2018 10:52:46 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727508AbeK2FyZ (ORCPT + 99 others); Thu, 29 Nov 2018 00:54:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:27022 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726285AbeK2FyZ (ORCPT ); Thu, 29 Nov 2018 00:54:25 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3A55A308A941; Wed, 28 Nov 2018 18:51:48 +0000 (UTC) Received: from dhcp-25.97.bos.redhat.com (unknown [10.18.25.61]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2B5FA7B605; Wed, 28 Nov 2018 18:51:44 +0000 (UTC) From: Aaron Conole To: Alexei Starovoitov 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 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> Date: Wed, 28 Nov 2018 13:51:42 -0500 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 28 Nov 2018 18:51:48 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)? Still I need a way to get the conntrack information from netfilter (or really any other entity that will provide it) into the bpf map, whatever map type it takes. > 'close to a copy of hashmap'... why hashmap is not enough for your purpose? It might be (see the item 2. in that list). I'm trying to allow netfilter conntrack to update the bpf map so that the flow offload data is available, and make sure that when I look up a 5-tuple from the bpf program in the map, I get the appropriate flow-offload data (ie: forward direction addresses could be different from reverse direction so just swapping addresses / ports will not match). Like I wrote in the cover letter (but probably poorly, sorry for that), I want to forward packets into the stack until a connection is added to the table, and then push the packets directly to the places they need to go, doing the nat etc. 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. Maybe I don't see a better solution, though - or possibly there's a more generic approach that works better.