From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mauricio Vasquez Subject: Re: [PATCH bpf-next 1/3] bpf: add bpf queue map Date: Wed, 8 Aug 2018 21:55:56 -0500 Message-ID: <53008195-66f2-10b2-be8d-f5752ce19f93@polito.it> References: <153356387977.6981.12236150594041620482.stgit@kernel> <153356390770.6981.4228793745105954649.stgit@kernel> <7e8662a7-dc0d-a27e-921b-11d98c3ba1aa@iogearbox.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org To: Daniel Borkmann , Alexei Starovoitov Return-path: Received: from fm2nodo1.polito.it ([130.192.180.17]:34796 "EHLO fm2nodo1.polito.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727237AbeHIFSo (ORCPT ); Thu, 9 Aug 2018 01:18:44 -0400 In-Reply-To: <7e8662a7-dc0d-a27e-921b-11d98c3ba1aa@iogearbox.net> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 08/07/2018 08:52 AM, Daniel Borkmann wrote: > On 08/06/2018 03:58 PM, Mauricio Vasquez B wrote: >> Bpf queue implements a LIFO/FIFO data containers for ebpf programs. >> >> It allows to push an element to the queue by using the update operation >> and to pop an element from the queue by using the lookup operation. >> >> A use case for this is to keep track of a pool of elements, like >> network ports in a SNAT. >> >> Signed-off-by: Mauricio Vasquez B > [...] >> +static int prealloc_init(struct bpf_queue *queue) >> +{ >> + u32 node_size = sizeof(struct queue_node) + >> + round_up(queue->map.value_size, 8); >> + u32 num_entries = queue->map.max_entries; >> + int err; >> + >> + queue->nodes = bpf_map_area_alloc(node_size * num_entries, >> + queue->map.numa_node); > That doesn't work either. If you don't set numa node, then here in > your case you'll always use numa node 0, which is unintentional. > You need to get the node via bpf_map_attr_numa_node(attr) helper. > Same issue in queue_map_update_elem(). > This should work, map.numa_node is initialized using bpf_map_attr_numa_node() in bpf_map_init_from_attr() The htab does exactly the same.