From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4472C432C3 for ; Wed, 3 Mar 2021 02:01:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B9F8264E6C for ; Wed, 3 Mar 2021 02:01:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232481AbhCCBxb (ORCPT ); Tue, 2 Mar 2021 20:53:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238176AbhCCBgY (ORCPT ); Tue, 2 Mar 2021 20:36:24 -0500 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15892C06178B for ; Tue, 2 Mar 2021 17:33:46 -0800 (PST) Received: by mail-il1-x12e.google.com with SMTP id g9so19897255ilc.3 for ; Tue, 02 Mar 2021 17:33:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=jG/l/GjC2trJKV6T6GkZHV/70MXLMmBwWWaLdYH3iSo=; b=fcHr9tFcTiU0SwHHEznl4CoqvaRP1VQXBWql778MWqlA8WK8NhljrwM5tFKy+fwddc KpupKZM6Q+QTS4P7jc+sFdRIhJnMCucSY+pPqmPU/uxKu6V8LDyKPBhB2/bKiOzw9ifs vBFk/C9mHWwhO81hHi+iYHpsRt6E7Y5UvfwdFIcN6QpvRVbiTuHAyBS+AOuhfX/LNN8b 2KPxce3UsgtmA7KLNoLNsPBJO11T2xG32jFwddo8vfBWAbyKnTDhsShqdpaSfPzzVH3M X3GHa0XaNhBfNcLH3EfyMlB3ajTHYsOW1ZGVDOzISL48B1qm8YDEIrHJd6n+K/AzvKhm t7iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=jG/l/GjC2trJKV6T6GkZHV/70MXLMmBwWWaLdYH3iSo=; b=pGyXlt6LrfWXjtMU33s2k/BT1WZHZy76nCltYV7GJn3ExDXuFSo7K5mU44jBSf/qOy mI8mmXYei1UQqvfiXk1T7HaDS99azvqqZmNKmT6cqZ6kNn/m9k+foBE6eJEnmiBwjwaI IUo1XNgCV0IGHvle9/frMm76FRLomGhoW4gLZhWE+dJPFK3J0GeEWDF3ryKfLSNn0jya 79z9+ePYSsiJo/8oAw+i4oJAL2q5KcgHtNwgBuuWrEmbLZdoNkAHAkqV1lZmcyX4zL19 sIUOL3JPcfWPw+8OV1knEzcUPpdm3VNZpyR1V3kIYtTJryETrduTv8z0kU3LGmq3sg4T tpeg== X-Gm-Message-State: AOAM530T19dDe0r3nwhwdwQzmQUmkeaYRXCo1hqYhqWpF86KM9KLXByx 7Np3nBtq0Enu096QsRnNSzNpcB1Js40pkuNBSfTc4DM53Og= X-Google-Smtp-Source: ABdhPJxYW23oyjeHKdPku40nMDKx9bAfTeeDN34EDkb/RXLUS4z7CqHm0bTsKh0W62ZmVsISG29fYgc/uU1zmo0LXhg= X-Received: by 2002:a05:6e02:f06:: with SMTP id x6mr18635645ilj.287.1614735225504; Tue, 02 Mar 2021 17:33:45 -0800 (PST) MIME-Version: 1.0 References: <87pn0jvswj.fsf@toke.dk> In-Reply-To: From: Y Song Date: Tue, 2 Mar 2021 17:33:09 -0800 Message-ID: Subject: Re: Query on eBPF Map iterator in Kernel space To: Shwetha Vittal Cc: =?UTF-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= , Xdp Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: xdp-newbies@vger.kernel.org On Tue, Mar 2, 2021 at 4:55 PM Shwetha Vittal w= rote: > > 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 wrote: > > > > On Mon, Mar 1, 2021 at 6:44 AM Toke H=C3=B8iland-J=C3=B8rgensen wrote: > > > > > > Shwetha Vittal writes: > > > > > > > Hi, > > > > > > > > Is there any way to iterate through eBPF Map elements in kernel spa= ce. > > > > 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 fi= nd > > > > the record in the eBPF map which has the least value in kernel spac= e > > > > 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.