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

2018-10-03 Thread Alexei Starovoitov
On Wed, Oct 03, 2018 at 12:01:37PM -0500, Mauricio Vasquez wrote: > > > On 10/01/2018 07:26 PM, Alexei Starovoitov wrote: > > On Mon, Oct 01, 2018 at 08:11:43AM -0500, Mauricio Vasquez wrote: > > > > > > +BPF_CALL_3(bpf_map_pop_elem, struct bpf_map *, map, void *, > > > > > > value, u32, size) >

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

2018-10-03 Thread Mauricio Vasquez
On 10/01/2018 07:26 PM, Alexei Starovoitov wrote: On Mon, Oct 01, 2018 at 08:11:43AM -0500, Mauricio Vasquez wrote: +BPF_CALL_3(bpf_map_pop_elem, struct bpf_map *, map, void *, value, u32, size) +{ +    void *ptr; + +    if (map->value_size != size) +    return -EINVAL; + +    ptr = map->

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

2018-10-01 Thread Alexei Starovoitov
On Mon, Oct 01, 2018 at 08:11:43AM -0500, Mauricio Vasquez wrote: > > > > +BPF_CALL_3(bpf_map_pop_elem, struct bpf_map *, map, void *, > > > > value, u32, size) > > > > +{ > > > > +    void *ptr; > > > > + > > > > +    if (map->value_size != size) > > > > +    return -EINVAL; > > > > + > > > >

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

2018-09-18 Thread Mauricio Vasquez
On 09/18/2018 06:27 PM, Alexei Starovoitov wrote: On Tue, Sep 18, 2018 at 06:52:51AM +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. Sign

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

2018-09-18 Thread Alexei Starovoitov
On Tue, Sep 18, 2018 at 06:52:51AM +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 v3 4/7] bpf: add bpf queue and stack maps

2018-09-17 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 |3 include/linux/bpf_types.h |2 include/ua