xdp-newbies.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Query on eBPF Map iterator in Kernel space
@ 2021-03-01 11:27 Shwetha Vittal
  2021-03-01 14:40 ` Toke Høiland-Jørgensen
  0 siblings, 1 reply; 5+ messages in thread
From: Shwetha Vittal @ 2021-03-01 11:27 UTC (permalink / raw)
  To: xdp-newbies

Hi,

Is there any way to iterate through eBPF Map elements in kernel space.
I know that there is one at user space bpf_map_get_next_key(). But it
doesn't work when tried in kernel space. I have a requirement to find
the record in the eBPF map which has the least value in kernel space
and pick it for further packet processing and therefore need to
iterate through eBF Map .

Kindly help

Thanks
Shwetha

-- 


Disclaimer:- This footer text is to convey that this email is sent by one 
of the users of IITH. So, do not mark it as SPAM.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Query on eBPF Map iterator in Kernel space
  2021-03-01 11:27 Query on eBPF Map iterator in Kernel space Shwetha Vittal
@ 2021-03-01 14:40 ` Toke Høiland-Jørgensen
  2021-03-02  6:24   ` Y Song
  0 siblings, 1 reply; 5+ messages in thread
From: Toke Høiland-Jørgensen @ 2021-03-01 14:40 UTC (permalink / raw)
  To: Shwetha Vittal, xdp-newbies

Shwetha Vittal <cs19resch01001@iith.ac.in> writes:

> Hi,
>
> Is there any way to iterate through eBPF Map elements in kernel space.
> I know that there is one at user space bpf_map_get_next_key(). But it
> doesn't work when tried in kernel space. I have a requirement to find
> the record in the eBPF map which has the least value in kernel space
> and pick it for further packet processing and therefore need to
> iterate through eBF Map .

There will be soon:
https://lore.kernel.org/bpf/20210226204920.3884074-1-yhs@fb.com/

-Toke


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Query on eBPF Map iterator in Kernel space
  2021-03-01 14:40 ` Toke Høiland-Jørgensen
@ 2021-03-02  6:24   ` Y Song
  2021-03-03  0:54     ` Shwetha Vittal
  0 siblings, 1 reply; 5+ messages in thread
From: Y Song @ 2021-03-02  6:24 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen; +Cc: Shwetha Vittal, Xdp

On Mon, Mar 1, 2021 at 6:44 AM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
>
> Shwetha Vittal <cs19resch01001@iith.ac.in> writes:
>
> > Hi,
> >
> > Is there any way to iterate through eBPF Map elements in kernel space.
> > I know that there is one at user space bpf_map_get_next_key(). But it
> > doesn't work when tried in kernel space. I have a requirement to find
> > the record in the eBPF map which has the least value in kernel space
> > and pick it for further packet processing and therefore need to
> > iterate through eBF Map .
>
> There will be soon:
> https://lore.kernel.org/bpf/20210226204920.3884074-1-yhs@fb.com/

What kind of maps are you trying to iterate? The above patch set
supports hash and array maps. Also, the above patch set has been
merged into bpf-next repo. Feel free to experiment with it!

>
> -Toke
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Query on eBPF Map iterator in Kernel space
  2021-03-02  6:24   ` Y Song
@ 2021-03-03  0:54     ` Shwetha Vittal
  2021-03-03  1:33       ` Y Song
  0 siblings, 1 reply; 5+ messages in thread
From: Shwetha Vittal @ 2021-03-03  0:54 UTC (permalink / raw)
  To: Y Song; +Cc: Toke Høiland-Jørgensen, Xdp

Sure thanks. I have created a hashmap. I will try with the new
proposed API  long bpf_for_each_map_elem(struct bpf_map *map, void
*callback_fn, void *callback_ctx, u64 flags) from bpf-next repository.

Thanks
Shwetha

On Tue, Mar 2, 2021 at 11:55 AM Y Song <ys114321@gmail.com> wrote:
>
> On Mon, Mar 1, 2021 at 6:44 AM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
> >
> > Shwetha Vittal <cs19resch01001@iith.ac.in> writes:
> >
> > > Hi,
> > >
> > > Is there any way to iterate through eBPF Map elements in kernel space.
> > > I know that there is one at user space bpf_map_get_next_key(). But it
> > > doesn't work when tried in kernel space. I have a requirement to find
> > > the record in the eBPF map which has the least value in kernel space
> > > and pick it for further packet processing and therefore need to
> > > iterate through eBF Map .
> >
> > There will be soon:
> > https://lore.kernel.org/bpf/20210226204920.3884074-1-yhs@fb.com/
>
> What kind of maps are you trying to iterate? The above patch set
> supports hash and array maps. Also, the above patch set has been
> merged into bpf-next repo. Feel free to experiment with it!
>
> >
> > -Toke
> >

-- 


Disclaimer:- This footer text is to convey that this email is sent by one 
of the users of IITH. So, do not mark it as SPAM.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Query on eBPF Map iterator in Kernel space
  2021-03-03  0:54     ` Shwetha Vittal
@ 2021-03-03  1:33       ` Y Song
  0 siblings, 0 replies; 5+ messages in thread
From: Y Song @ 2021-03-03  1:33 UTC (permalink / raw)
  To: Shwetha Vittal; +Cc: Toke Høiland-Jørgensen, Xdp

On Tue, Mar 2, 2021 at 4:55 PM Shwetha Vittal <cs19resch01001@iith.ac.in> wrote:
>
> Sure thanks. I have created a hashmap. I will try with the new
> proposed API  long bpf_for_each_map_elem(struct bpf_map *map, void
> *callback_fn, void *callback_ctx, u64 flags) from bpf-next repository.

Great. Let us know if you hit any issues or have any suggestions. Thanks!

>
> Thanks
> Shwetha
>
> On Tue, Mar 2, 2021 at 11:55 AM Y Song <ys114321@gmail.com> wrote:
> >
> > On Mon, Mar 1, 2021 at 6:44 AM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
> > >
> > > Shwetha Vittal <cs19resch01001@iith.ac.in> writes:
> > >
> > > > Hi,
> > > >
> > > > Is there any way to iterate through eBPF Map elements in kernel space.
> > > > I know that there is one at user space bpf_map_get_next_key(). But it
> > > > doesn't work when tried in kernel space. I have a requirement to find
> > > > the record in the eBPF map which has the least value in kernel space
> > > > and pick it for further packet processing and therefore need to
> > > > iterate through eBF Map .
> > >
> > > There will be soon:
> > > https://lore.kernel.org/bpf/20210226204920.3884074-1-yhs@fb.com/
> >
> > What kind of maps are you trying to iterate? The above patch set
> > supports hash and array maps. Also, the above patch set has been
> > merged into bpf-next repo. Feel free to experiment with it!
> >
> > >
> > > -Toke
> > >
>
> --
>
>
> Disclaimer:- This footer text is to convey that this email is sent by one
> of the users of IITH. So, do not mark it as SPAM.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-03-03  2:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-01 11:27 Query on eBPF Map iterator in Kernel space Shwetha Vittal
2021-03-01 14:40 ` Toke Høiland-Jørgensen
2021-03-02  6:24   ` Y Song
2021-03-03  0:54     ` Shwetha Vittal
2021-03-03  1:33       ` Y Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).