Skip to contentSkip to conversation

bpf, docs: Add note about type convention

PATCH In review [email protected] 3 participants 5 messages Jan 25, 2023 – Feb 8, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf, docs: Add note about type convention

From: Dave Thaler <[email protected]>

Add note about type convention

---
 Documentation/bpf/instruction-set.rst | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/bpf/instruction-set.rst +7 -0
index 2d3fe59bd26..77990c97b5e 100644
@@ -7,6 +7,11 @@ eBPF Instruction Set Specification, v1.0
 
 This document specifies version 1.0 of the eBPF instruction set.
 
+Documentation conventions
+=========================
+
+For brevity, this document uses the type notion "u64", "u32", etc.
+to mean an unsigned integer whose width is the specified number of bits.
 
 Registers and calling convention
 ================================
@@ -123,6 +128,8 @@ the destination register is unchanged whereas for ``BPF_ALU`` the upper
 
   dst_reg = (u32) dst_reg + (u32) src_reg;
 
+where '(u32)' indicates that the upper 32 bits are zeroed.
+
 ``BPF_ADD | BPF_X | BPF_ALU64`` means::
 
   dst_reg = dst_reg + src_reg
Signature · 1 line
2.33.4
#1 lore raw
Quoted 3 lines · On Wed, Jan 25, 2023 at 06:48:27PM +0000, [email protected] wrote:

From: Dave Thaler <[email protected]>

Add note about type convention

Could you please provide a slightly more descriptive commit summary?

Quoted 11 lines
---
 Documentation/bpf/instruction-set.rst | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/bpf/instruction-set.rst +0 -0
index 2d3fe59bd26..77990c97b5e 100644

Documentation/bpf/instruction-set.rst eBPF Instruction Set Specification, v1.0 · line 14

Quoted 8 lines
Documentation/bpf/instruction-set.rst +5 -0
@@ -7,6 +7,11 @@ eBPF Instruction Set Specification, v1.0
 
 This document specifies version 1.0 of the eBPF instruction set.
 
+Documentation conventions
+=========================
+
+For brevity, this document uses the type notion "u64", "u32", etc.
+to mean an unsigned integer whose width is the specified number of bits.

Can you use single quotes here to match the convention in the rest of the file?

Quoted 15 lines
Documentation/bpf/instruction-set.rst +2 -0
 Registers and calling convention
 ================================
@@ -123,6 +128,8 @@ the destination register is unchanged whereas for ``BPF_ALU`` the upper
 
   dst_reg = (u32) dst_reg + (u32) src_reg;
 
+where '(u32)' indicates that the upper 32 bits are zeroed.
+
 ``BPF_ADD | BPF_X | BPF_ALU64`` means::
 
   dst_reg = dst_reg + src_reg
Signature · 1 line
2.33.4
#2 lore raw

PATCH 1/1 bpf, docs: Add note about type convention

From: Dave Thaler <[email protected]>

Add explanation about use of "u64", "u32", etc. as the type convention used in BPF documentation.

---
V2 -> V3: updated commit message to respond to David Vernet

V1 -> V2: addressed comments from Alexei and Stanislav by using u64 instead of uint64_t

---
 Documentation/bpf/instruction-set.rst | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/bpf/instruction-set.rst +7 -0
index 2d3fe59bd26..77990c97b5e 100644
@@ -7,6 +7,11 @@ eBPF Instruction Set Specification, v1.0
 
 This document specifies version 1.0 of the eBPF instruction set.
 
+Documentation conventions
+=========================
+
+For brevity, this document uses the type notion "u64", "u32", etc.
+to mean an unsigned integer whose width is the specified number of bits.
 
 Registers and calling convention
 ================================
@@ -123,6 +128,8 @@ the destination register is unchanged whereas for ``BPF_ALU`` the upper
 
   dst_reg = (u32) dst_reg + (u32) src_reg;
 
+where '(u32)' indicates that the upper 32 bits are zeroed.
+
 ``BPF_ADD | BPF_X | BPF_ALU64`` means::
 
   dst_reg = dst_reg + src_reg
Signature · 1 line
2.33.4
Acked-by on v1 1/1
#3 lore raw
Quoted 6 lines · On Fri, Jan 27, 2023 at 01:47:06AM +0000, [email protected] wrote:

From: Dave Thaler <[email protected]>

Add explanation about use of "u64", "u32", etc. as the type convention used in BPF documentation.

Quoted 37 lines

---
V2 -> V3: updated commit message to respond to David Vernet

V1 -> V2: addressed comments from Alexei and Stanislav by using u64 instead of uint64_t

---
 Documentation/bpf/instruction-set.rst | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/bpf/instruction-set.rst +7 -0
index 2d3fe59bd26..77990c97b5e 100644
@@ -7,6 +7,11 @@ eBPF Instruction Set Specification, v1.0
 
 This document specifies version 1.0 of the eBPF instruction set.
 
+Documentation conventions
+=========================
+
+For brevity, this document uses the type notion "u64", "u32", etc.
+to mean an unsigned integer whose width is the specified number of bits.
 
 Registers and calling convention
 ================================
@@ -123,6 +128,8 @@ the destination register is unchanged whereas for ``BPF_ALU`` the upper
 
   dst_reg = (u32) dst_reg + (u32) src_reg;
 
+where '(u32)' indicates that the upper 32 bits are zeroed.
+
 ``BPF_ADD | BPF_X | BPF_ALU64`` means::
 
   dst_reg = dst_reg + src_reg
Signature · 1 line
2.33.4
#4 lore raw
In reply to [email protected]
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:

Hello:

This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:

Quoted 8 lines · On Fri, 27 Jan 2023 01:47:06 +0000 you wrote:

From: Dave Thaler <[email protected]>

Add explanation about use of "u64", "u32", etc. as the type convention used in BPF documentation.

[...]

Here is the summary with links:
- bpf, docs: Add note about type convention

    https://git.kernel.org/bpf/bpf-next/c/d00d5b82f073

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html