netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>,
	Alexei Starovoitov <ast@kernel.org>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>,
	Jesper Dangaard Brouer <brouer@redhat.com>,
	David Miller <davem@davemloft.net>,
	Networking <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>
Subject: Re: [PATCH bpf-next v5 2/5] libbpf: Store map pin path and status in struct bpf_map
Date: Sat, 02 Nov 2019 11:57:03 +0100	[thread overview]
Message-ID: <8736f6mtq8.fsf@toke.dk> (raw)
In-Reply-To: <CAEf4BzZMO7j1LsESEetTJCRpw4HDZ994C5RigFU+uQ1tgQa_PQ@mail.gmail.com>

Andrii Nakryiko <andrii.nakryiko@gmail.com> writes:

> On Fri, Nov 1, 2019 at 2:53 AM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
>>
>> From: Toke Høiland-Jørgensen <toke@redhat.com>
>>
>> Support storing and setting a pin path in struct bpf_map, which can be used
>> for automatic pinning. Also store the pin status so we can avoid attempts
>> to re-pin a map that has already been pinned (or reused from a previous
>> pinning).
>>
>> The behaviour of bpf_object__{un,}pin_maps() is changed so that if it is
>> called with a NULL path argument (which was previously illegal), it will
>> (un)pin only those maps that have a pin_path set.
>>
>> Acked-by: Andrii Nakryiko <andriin@fb.com>
>> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
>> ---
>>  tools/lib/bpf/libbpf.c   |  164 +++++++++++++++++++++++++++++++++++-----------
>>  tools/lib/bpf/libbpf.h   |    8 ++
>>  tools/lib/bpf/libbpf.map |    3 +
>>  3 files changed, 134 insertions(+), 41 deletions(-)
>>
>
> [...]
>
>>  LIBBPF_API int bpf_object__pin_maps(struct bpf_object *obj, const char *path);
>>  LIBBPF_API int bpf_object__unpin_maps(struct bpf_object *obj,
>>                                       const char *path);
>> @@ -385,6 +390,9 @@ LIBBPF_API int bpf_map__resize(struct bpf_map *map, __u32 max_entries);
>>  LIBBPF_API bool bpf_map__is_offload_neutral(const struct bpf_map *map);
>>  LIBBPF_API bool bpf_map__is_internal(const struct bpf_map *map);
>>  LIBBPF_API void bpf_map__set_ifindex(struct bpf_map *map, __u32 ifindex);
>> +LIBBPF_API int bpf_map__set_pin_path(struct bpf_map *map, const char *path);
>> +LIBBPF_API const char *bpf_map__get_pin_path(struct bpf_map *map);
>> +LIBBPF_API bool bpf_map__is_pinned(struct bpf_map *map);
>
>
> Didn't notice this before and wasn't going to force another version
> just for this, but given you'll be fixing last patch anyways...
> bpf_map__is_pinned and bpf_map__get_pin_path are read-only "getters",
> so it would be appropriate for them to accept "const struct bpf_map *"
> instead.

Can do :)

  reply	other threads:[~2019-11-02 10:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-01  9:52 [PATCH bpf-next v5 0/5] libbpf: Support automatic pinning of maps using 'pinning' BTF attribute Toke Høiland-Jørgensen
2019-11-01  9:52 ` [PATCH bpf-next v5 1/5] libbpf: Fix error handling in bpf_map__reuse_fd() Toke Høiland-Jørgensen
2019-11-01  9:52 ` [PATCH bpf-next v5 2/5] libbpf: Store map pin path and status in struct bpf_map Toke Høiland-Jørgensen
2019-11-02  5:10   ` Andrii Nakryiko
2019-11-02 10:57     ` Toke Høiland-Jørgensen [this message]
2019-11-01  9:52 ` [PATCH bpf-next v5 3/5] libbpf: Move directory creation into _pin() functions Toke Høiland-Jørgensen
2019-11-01  9:53 ` [PATCH bpf-next v5 4/5] libbpf: Add auto-pinning of maps when loading BPF objects Toke Høiland-Jørgensen
2019-11-01  9:53 ` [PATCH bpf-next v5 5/5] selftests: Add tests for automatic map pinning Toke Høiland-Jørgensen
2019-11-02  5:07   ` Andrii Nakryiko
2019-11-02 10:56     ` Toke Høiland-Jørgensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8736f6mtq8.fsf@toke.dk \
    --to=toke@redhat.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brouer@redhat.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=kafai@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).