Re: [RFC PATCH bpf-next v4 4/7] bpf: add bpf queue and stack maps

2018-10-07 Thread Mauricio Vasquez
On 10/04/2018 10:40 PM, Mauricio Vasquez wrote: On 10/04/2018 06:57 PM, Alexei Starovoitov wrote: On Thu, Oct 04, 2018 at 07:12:44PM +0200, Mauricio Vasquez B wrote: Implement two new kind of maps that support the peek, push and pop operations. A use case for this is to keep track of a po

Re: [RFC PATCH bpf-next v4 4/7] bpf: add bpf queue and stack maps

2018-10-05 Thread Alexei Starovoitov
On Thu, Oct 04, 2018 at 10:40:55PM -0500, Mauricio Vasquez wrote: > > > > + /* Round up queue size to nearest power of 2 */ > > > + max_entries = index_mask + 1; > > what's the point of roundup ? > > If the size of the buffer is power of two we can wrap the indexes with an > AND operation instead

Re: [RFC PATCH bpf-next v4 4/7] bpf: add bpf queue and stack maps

2018-10-04 Thread Alexei Starovoitov
On Thu, Oct 04, 2018 at 07:12:44PM +0200, Mauricio Vasquez B wrote: > Implement two new kind of maps that support the peek, push and pop > operations. > > 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 > --- > in

[RFC PATCH bpf-next v4 4/7] bpf: add bpf queue and stack maps

2018-10-04 Thread Mauricio Vasquez B
Implement two new kind of maps that support the peek, push and pop operations. 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 --- include/linux/bpf.h |7 + include/linux/bpf_types.h |2 include/u