BPF List
 help / color / mirror / Atom feed
From: David Vernet <void@manifault.com>
To: "Aoyang Fang (SSE, 222010547)" <aoyangfang@link.cuhk.edu.cn>
Cc: "bpf@vger.kernel.org" <bpf@vger.kernel.org>,
	"bpf@ietf.org" <bpf@ietf.org>
Subject: Re: [PATCH] update the consistency issue in documentation
Date: Wed, 3 Jan 2024 21:39:54 -0600	[thread overview]
Message-ID: <20240104033954.GC303539@maniforge> (raw)
In-Reply-To: <F349E672-63EB-4DA3-84F8-45E360E02594@link.cuhk.edu.cn>

[-- Attachment #1: Type: text/plain, Size: 4191 bytes --]

On Thu, Jan 04, 2024 at 03:09:32AM +0000, Aoyang Fang (SSE, 222010547) wrote:
> From fa9f3f47ddeb3e9a615c17aea57d2ecd53a7d201 Mon Sep 17 00:00:00 2001
> From: lincyawer <53161583+Lincyaw@users.noreply.github.com>
> Date: Thu, 4 Jan 2024 10:51:36 +0800
> Subject: [PATCH] The original documentation of BPF_JMP instructions is somehow
> misleading. The code part of instruction, e.g., BPF_JEQ's value is noted as
> 0x1, however, in `include/uapi/linux/bpf.h`, the value of BPF_JEQ is 0x10. At
> the same time, the description convention is inconsistent with the BPF_ALU,
> whose code are also 4bit, but the value of BPF_ADD is 0x00
> 
> Signed-off-by: lincyawer <53161583+Lincyaw@users.noreply.github.com>

Hi Aoyang,

Could you please resend this patch to the lists in plain text? The Linux
kernel mailing lists will drop html-encoded emails. Please see [0] for
more information. You can just use git send-email with a patch file as
follows:

$ git format-patch HEAD~ --subject-prefix='PATCH bpf-next' HEAD~
$ git send-email <patch> --to bpf@vger.kernel.org --cc bpf@ietf.org

[0]: https://docs.kernel.org/process/submitting-patches.html#no-mime-no-links-no-compression-no-attachments-just-plain-text

Please make sure that the Signed-off-by tag includes your name and real
email address as well.

Thanks,
David

> ---
> .../bpf/standardization/instruction-set.rst | 34 +++++++++----------
> 1 file changed, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/Documentation/bpf/standardization/instruction-set.rst b/Documentation/bpf/standardization/instruction-set.rst
> index 245b6defc..dee3b1fa8 100644
> --- a/Documentation/bpf/standardization/instruction-set.rst
> +++ b/Documentation/bpf/standardization/instruction-set.rst
> @@ -355,23 +355,23 @@ The 'code' field encodes the operation as below:
> ======== ===== === =========================================== =========================================
> code value src description notes
> ======== ===== === =========================================== =========================================
> -BPF_JA 0x0 0x0 PC += offset BPF_JMP class
> -BPF_JA 0x0 0x0 PC += imm BPF_JMP32 class
> -BPF_JEQ 0x1 any PC += offset if dst == src
> -BPF_JGT 0x2 any PC += offset if dst > src unsigned
> -BPF_JGE 0x3 any PC += offset if dst >= src unsigned
> -BPF_JSET 0x4 any PC += offset if dst & src
> -BPF_JNE 0x5 any PC += offset if dst != src
> -BPF_JSGT 0x6 any PC += offset if dst > src signed
> -BPF_JSGE 0x7 any PC += offset if dst >= src signed
> -BPF_CALL 0x8 0x0 call helper function by address see `Helper functions`_
> -BPF_CALL 0x8 0x1 call PC += imm see `Program-local functions`_
> -BPF_CALL 0x8 0x2 call helper function by BTF ID see `Helper functions`_
> -BPF_EXIT 0x9 0x0 return BPF_JMP only
> -BPF_JLT 0xa any PC += offset if dst < src unsigned
> -BPF_JLE 0xb any PC += offset if dst <= src unsigned
> -BPF_JSLT 0xc any PC += offset if dst < src signed
> -BPF_JSLE 0xd any PC += offset if dst <= src signed
> +BPF_JA 0x00 0x0 PC += offset BPF_JMP class
> +BPF_JA 0x00 0x0 PC += imm BPF_JMP32 class
> +BPF_JEQ 0x10 any PC += offset if dst == src
> +BPF_JGT 0x20 any PC += offset if dst > src unsigned
> +BPF_JGE 0x30 any PC += offset if dst >= src unsigned
> +BPF_JSET 0x40 any PC += offset if dst & src
> +BPF_JNE 0x50 any PC += offset if dst != src
> +BPF_JSGT 0x60 any PC += offset if dst > src signed
> +BPF_JSGE 0x70 any PC += offset if dst >= src signed
> +BPF_CALL 0x80 0x0 call helper function by address see `Helper functions`_
> +BPF_CALL 0x80 0x1 call PC += imm see `Program-local functions`_
> +BPF_CALL 0x80 0x2 call helper function by BTF ID see `Helper functions`_
> +BPF_EXIT 0x90 0x0 return BPF_JMP only
> +BPF_JLT 0xa0 any PC += offset if dst < src unsigned
> +BPF_JLE 0xb0 any PC += offset if dst <= src unsigned
> +BPF_JSLT 0xc0 any PC += offset if dst < src signed
> +BPF_JSLE 0xd0 any PC += offset if dst <= src signed
> ======== ===== === =========================================== =========================================
> The BPF program needs to store the return value into register R0 before doing a
> --
> 2.42.0
> 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: David Vernet <void@manifault.com>
To: "Aoyang Fang (SSE, 222010547)" <aoyangfang@link.cuhk.edu.cn>
Cc: "bpf@vger.kernel.org" <bpf@vger.kernel.org>,
	"bpf@ietf.org" <bpf@ietf.org>
Subject: Re: [Bpf] [PATCH] update the consistency issue in documentation
Date: Wed, 3 Jan 2024 21:39:54 -0600	[thread overview]
Message-ID: <20240104033954.GC303539@maniforge> (raw)
Message-ID: <20240104033954.78M72cwmjEfNXsem6lfSf5mhZwyAAMS96tSTNeFvnzk@z> (raw)
In-Reply-To: <F349E672-63EB-4DA3-84F8-45E360E02594@link.cuhk.edu.cn>


[-- Attachment #1.1: Type: text/plain, Size: 4191 bytes --]

On Thu, Jan 04, 2024 at 03:09:32AM +0000, Aoyang Fang (SSE, 222010547) wrote:
> From fa9f3f47ddeb3e9a615c17aea57d2ecd53a7d201 Mon Sep 17 00:00:00 2001
> From: lincyawer <53161583+Lincyaw@users.noreply.github.com>
> Date: Thu, 4 Jan 2024 10:51:36 +0800
> Subject: [PATCH] The original documentation of BPF_JMP instructions is somehow
> misleading. The code part of instruction, e.g., BPF_JEQ's value is noted as
> 0x1, however, in `include/uapi/linux/bpf.h`, the value of BPF_JEQ is 0x10. At
> the same time, the description convention is inconsistent with the BPF_ALU,
> whose code are also 4bit, but the value of BPF_ADD is 0x00
> 
> Signed-off-by: lincyawer <53161583+Lincyaw@users.noreply.github.com>

Hi Aoyang,

Could you please resend this patch to the lists in plain text? The Linux
kernel mailing lists will drop html-encoded emails. Please see [0] for
more information. You can just use git send-email with a patch file as
follows:

$ git format-patch HEAD~ --subject-prefix='PATCH bpf-next' HEAD~
$ git send-email <patch> --to bpf@vger.kernel.org --cc bpf@ietf.org

[0]: https://docs.kernel.org/process/submitting-patches.html#no-mime-no-links-no-compression-no-attachments-just-plain-text

Please make sure that the Signed-off-by tag includes your name and real
email address as well.

Thanks,
David

> ---
> .../bpf/standardization/instruction-set.rst | 34 +++++++++----------
> 1 file changed, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/Documentation/bpf/standardization/instruction-set.rst b/Documentation/bpf/standardization/instruction-set.rst
> index 245b6defc..dee3b1fa8 100644
> --- a/Documentation/bpf/standardization/instruction-set.rst
> +++ b/Documentation/bpf/standardization/instruction-set.rst
> @@ -355,23 +355,23 @@ The 'code' field encodes the operation as below:
> ======== ===== === =========================================== =========================================
> code value src description notes
> ======== ===== === =========================================== =========================================
> -BPF_JA 0x0 0x0 PC += offset BPF_JMP class
> -BPF_JA 0x0 0x0 PC += imm BPF_JMP32 class
> -BPF_JEQ 0x1 any PC += offset if dst == src
> -BPF_JGT 0x2 any PC += offset if dst > src unsigned
> -BPF_JGE 0x3 any PC += offset if dst >= src unsigned
> -BPF_JSET 0x4 any PC += offset if dst & src
> -BPF_JNE 0x5 any PC += offset if dst != src
> -BPF_JSGT 0x6 any PC += offset if dst > src signed
> -BPF_JSGE 0x7 any PC += offset if dst >= src signed
> -BPF_CALL 0x8 0x0 call helper function by address see `Helper functions`_
> -BPF_CALL 0x8 0x1 call PC += imm see `Program-local functions`_
> -BPF_CALL 0x8 0x2 call helper function by BTF ID see `Helper functions`_
> -BPF_EXIT 0x9 0x0 return BPF_JMP only
> -BPF_JLT 0xa any PC += offset if dst < src unsigned
> -BPF_JLE 0xb any PC += offset if dst <= src unsigned
> -BPF_JSLT 0xc any PC += offset if dst < src signed
> -BPF_JSLE 0xd any PC += offset if dst <= src signed
> +BPF_JA 0x00 0x0 PC += offset BPF_JMP class
> +BPF_JA 0x00 0x0 PC += imm BPF_JMP32 class
> +BPF_JEQ 0x10 any PC += offset if dst == src
> +BPF_JGT 0x20 any PC += offset if dst > src unsigned
> +BPF_JGE 0x30 any PC += offset if dst >= src unsigned
> +BPF_JSET 0x40 any PC += offset if dst & src
> +BPF_JNE 0x50 any PC += offset if dst != src
> +BPF_JSGT 0x60 any PC += offset if dst > src signed
> +BPF_JSGE 0x70 any PC += offset if dst >= src signed
> +BPF_CALL 0x80 0x0 call helper function by address see `Helper functions`_
> +BPF_CALL 0x80 0x1 call PC += imm see `Program-local functions`_
> +BPF_CALL 0x80 0x2 call helper function by BTF ID see `Helper functions`_
> +BPF_EXIT 0x90 0x0 return BPF_JMP only
> +BPF_JLT 0xa0 any PC += offset if dst < src unsigned
> +BPF_JLE 0xb0 any PC += offset if dst <= src unsigned
> +BPF_JSLT 0xc0 any PC += offset if dst < src signed
> +BPF_JSLE 0xd0 any PC += offset if dst <= src signed
> ======== ===== === =========================================== =========================================
> The BPF program needs to store the return value into register R0 before doing a
> --
> 2.42.0
> 
> 

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 76 bytes --]

-- 
Bpf mailing list
Bpf@ietf.org
https://www.ietf.org/mailman/listinfo/bpf

       reply	other threads:[~2024-01-04  3:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <F349E672-63EB-4DA3-84F8-45E360E02594@link.cuhk.edu.cn>
2024-01-04  3:39 ` David Vernet [this message]
2024-01-04  3:39   ` [Bpf] [PATCH] update the consistency issue in documentation David Vernet
2024-01-04  3:12 Aoyang Fang (SSE, 222010547)
2024-01-04 19:12 ` dthaler1968
     [not found]   ` <20654405-C500-4A24-B09E-A28B25DF32AC@link.cuhk.edu.cn>
2024-01-05  1:31     ` dthaler1968

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=20240104033954.GC303539@maniforge \
    --to=void@manifault.com \
    --cc=aoyangfang@link.cuhk.edu.cn \
    --cc=bpf@ietf.org \
    --cc=bpf@vger.kernel.org \
    /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