linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin KaFai Lau <martin.lau@linux.dev>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Donald Hunter <donald.hunter@gmail.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>, Yonghong Song <yhs@meta.com>,
	David Vernet <void@manifault.com>, bpf <bpf@vger.kernel.org>,
	"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>
Subject: Re: [PATCH bpf-next v4] docs/bpf: Add documentation for BPF_MAP_TYPE_SK_STORAGE
Date: Fri, 9 Dec 2022 09:58:40 -0800	[thread overview]
Message-ID: <189b3ec2-1aaf-1935-0f93-4a2036fba440@linux.dev> (raw)
In-Reply-To: <CAADnVQ+E-fONc6BhT_HxErG43tHu32KE5uWtJTXu95HFb8EvLg@mail.gmail.com>

On 12/9/22 9:54 AM, Alexei Starovoitov wrote:
> On Fri, Dec 9, 2022 at 9:52 AM Martin KaFai Lau <martin.lau@linux.dev> wrote:
>>
>> On 12/9/22 3:24 AM, Donald Hunter wrote:
>>> Add documentation for the BPF_MAP_TYPE_SK_STORAGE including
>>> kernel version introduced, usage and examples.
>>
>> Thanks for writing the doc for sk_storage!
>>
>>> +User space
>>> +----------
>>> +
>>> +bpf_map_update_elem()
>>> +~~~~~~~~~~~~~~~~~~~~~
>>> +
>>> +.. code-block:: c
>>> +
>>> +   int bpf_map_update_elem(int map_fd, const void *key, const void *value, __u64 flags)
>>> +
>>> +Socket-local storage for the socket identified by ``key`` belonging to
>>> +``map_fd`` can be added or updated using the ``bpf_map_update_elem()`` libbpf > +function. ``key`` must be a pointer to a valid ``fd`` in the user space
>>> +program. The ``flags`` parameter can be used to control the update behaviour:
>>
>> The "``key`` belonging to ``map_fd``" seems confusing.  Also, it is useful to
>> highlight the ``key`` is a _socket_ ``fd``.
>>
>> May be something like:
>>
>> A socket-local storage can be added/updated locally to a socket identified by a
>> _socket_ ``fd`` stored in the pointer ``key``.  The pointer ``value`` has the
>> data to be added/updated to the socket ``fd``.  The type and size of ``value``
>> should be the same as the value type of the map definition.
>>
>> Feel free to rephrase the above in a better way.
>>
>>> +
>>> +- ``BPF_ANY`` will create storage for ``fd`` or update existing storage.
>>> +- ``BPF_NOEXIST`` will create storage for ``fd`` only if it did not already
>>> +  exist, otherwise the call will fail with ``-EEXIST``.
>>> +- ``BPF_EXIST`` will update existing storage for ``fd`` if it already exists,
>>> +  otherwise the call will fail with ``-ENOENT``.
>>> +
>>> +Returns ``0`` on success, or negative error in case of failure.
>>> +
>>> +bpf_map_lookup_elem()
>>> +~~~~~~~~~~~~~~~~~~~~~
>>> +
>>> +.. code-block:: c
>>> +
>>> +   int bpf_map_lookup_elem(int map_fd, const void *key, void *value)
>>> +
>>> +Socket-local storage for the socket identified by ``key`` belonging to
>>> +``map_fd`` can be retrieved using the ``bpf_map_lookup_elem()`` libbpf
>>> +function. ``key`` must be a pointer to a valid ``fd`` in the user space
>>
>> Same here.
>>
>>> +program. Returns ``0`` on success, or negative error in case of failure.
>>> +
>>> +bpf_map_delete_elem()
>>> +~~~~~~~~~~~~~~~~~~~~~
>>> +
>>> +.. code-block:: c
>>> +
>>> +   int bpf_map_delete_elem(int map_fd, const void *key)
>>> +
>>> +Socket-local storage for the socket identified by ``key`` belonging to
>>> +``map_fd`` can be deleted using the ``bpf_map_delete_elem()`` libbpf
>>> +function. Returns ``0`` on success, or negative error in case of failure.
>>
>> Same here.
> 
> 
> Sorry Martin. I just applied it without seeing your comments.
> Should I revert or this can be done in the follow up?
Ah, just noticed that also.  My bad that only catching up till v4.  It can 
definitely be a followup.

      reply	other threads:[~2022-12-09 18:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09 11:24 [PATCH bpf-next v4] docs/bpf: Add documentation for BPF_MAP_TYPE_SK_STORAGE Donald Hunter
2022-12-09 16:14 ` David Vernet
2022-12-09 17:50 ` patchwork-bot+netdevbpf
2022-12-09 17:52 ` Martin KaFai Lau
2022-12-09 17:54   ` Alexei Starovoitov
2022-12-09 17:58     ` Martin KaFai Lau [this message]

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=189b3ec2-1aaf-1935-0f93-4a2036fba440@linux.dev \
    --to=martin.lau@linux.dev \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=corbet@lwn.net \
    --cc=daniel@iogearbox.net \
    --cc=donald.hunter@gmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=void@manifault.com \
    --cc=yhs@meta.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).