From: Hou Tao <houtao1@huawei.com>
To: Anton Protopopov <aspsk@isovalent.com>,
Alexei Starovoitov <ast@kernel.org>, <bpf@vger.kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>, Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>, Brian Vazquez <brianvv@google.com>,
Joe Stringer <joe@isovalent.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH bpf-next 2/2] bpf: update uapi/linux/bpf.h docs on the batch map ops
Date: Wed, 26 Jul 2023 17:12:49 +0800 [thread overview]
Message-ID: <dfb8a282-be49-d1a5-12c5-366307fbc2c9@huawei.com> (raw)
In-Reply-To: <20230717114307.46124-3-aspsk@isovalent.com>
Hi,
On 7/17/2023 7:43 PM, Anton Protopopov wrote:
> The map_lookup{,_and_delete}_batch operations return same values. Make
> this clear in documentation. Also, update the comments so that this is
> more clear that -ENOENT is a valid return value in case of success. (In
> fact, this is the most common return value, as this is reasonable to do
> map_lookup_batch(MAX_ENTRIES), which, in case of success, will always
> return -ENOENT.)
>
> Signed-off-by: Anton Protopopov <aspsk@isovalent.com>
> ---
> include/uapi/linux/bpf.h | 22 ++++++++++++----------
> 1 file changed, 12 insertions(+), 10 deletions(-)
>
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index 600d0caebbd8..9e6e277bedab 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -632,17 +632,19 @@ union bpf_iter_link_info {
> * returning the lock. This must be specified if the
> * elements contain a spinlock.
> *
> - * On success, *count* elements from the map are copied into the
> - * user buffer, with the keys copied into *keys* and the values
> - * copied into the corresponding indices in *values*.
> - *
> - * If an error is returned and *errno* is not **EFAULT**, *count*
> - * is set to the number of successfully processed elements.
> + * On success, up to *count* elements from the map are copied into
> + * the user buffer, with the keys copied into *keys* and the
> + * values copied into the corresponding indices in *values*.
> *
> * Return
> * Returns zero on success. On error, -1 is returned and *errno*
> * is set appropriately.
> *
> + * If an error is returned and *errno* is not **EFAULT**, then
Maybe we should say "is not EFAULT or EINVAL" ? Otherwise, the update
looks good to me, so
Acked-by: Hou Tao <houtao1@huawei.com>
> + * *count* is set to the number of successfully processed
> + * elements. In particular, the *errno* may be set to **ENOENT**
> + * in case of success to indicate that the end of map is reached.
> + *
> * May set *errno* to **ENOSPC** to indicate that *keys* or
> * *values* is too small to dump an entire bucket during
> * iteration of a hash-based map type.
> @@ -655,15 +657,15 @@ union bpf_iter_link_info {
> * **BPF_MAP_LOOKUP_BATCH** with two exceptions:
> *
> * * Every element that is successfully returned is also deleted
> - * from the map. This is at least *count* elements. Note that
> - * *count* is both an input and an output parameter.
> + * from the map. The *count* parameter is set to the number of
> + * returned elements. This value can be less than the actual
> + * number of deleted elements, see the next item.
> * * Upon returning with *errno* set to **EFAULT**, up to
> * *count* elements may be deleted without returning the keys
> * and values of the deleted elements.
> *
> * Return
> - * Returns zero on success. On error, -1 is returned and *errno*
> - * is set appropriately.
> + * Same as the BPF_MAP_LOOKUP_BATCH return values.
> *
> * BPF_MAP_UPDATE_BATCH
> * Description
prev parent reply other threads:[~2023-07-26 9:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-17 11:43 [PATCH bpf-next 0/2] fix setting return values for htab batch ops and docs Anton Protopopov
2023-07-17 11:43 ` [PATCH bpf-next 1/2] bpf: fix setting return values for htab batch ops Anton Protopopov
2023-07-19 0:52 ` Alexei Starovoitov
2023-07-19 7:09 ` Anton Protopopov
2023-07-19 16:28 ` Alexei Starovoitov
2023-07-17 11:43 ` [PATCH bpf-next 2/2] bpf: update uapi/linux/bpf.h docs on the batch map ops Anton Protopopov
2023-07-26 9:12 ` Hou Tao [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=dfb8a282-be49-d1a5-12c5-366307fbc2c9@huawei.com \
--to=houtao1@huawei.com \
--cc=andrii@kernel.org \
--cc=aspsk@isovalent.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brianvv@google.com \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=joe@isovalent.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=sdf@google.com \
--cc=song@kernel.org \
--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
Powered by JetHome