Skip to content

Commit

Permalink
docs/bpf: Add bpf() syscall command reference
Browse files Browse the repository at this point in the history
Generate the syscall command reference from the UAPI header file and
include it in the main bpf docs page.

Signed-off-by: Joe Stringer <joe@cilium.io>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Quentin Monnet <quentin@isovalent.com>
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/bpf/20210302171947.2268128-15-joe@cilium.io
  • Loading branch information
Joe Stringer authored and Alexei Starovoitov committed Mar 5, 2021
1 parent accbd33 commit 6197e5b
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Documentation/bpf/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ BPF instruction-set.
The Cilium project also maintains a `BPF and XDP Reference Guide`_
that goes into great technical depth about the BPF Architecture.

The primary info for the bpf syscall is available in the `man-pages`_
for `bpf(2)`_.

BPF Type Format (BTF)
=====================

Expand All @@ -35,6 +32,12 @@ Two sets of Questions and Answers (Q&A) are maintained.
bpf_design_QA
bpf_devel_QA

Syscall API
===========

The primary info for the bpf syscall is available in the `man-pages`_
for `bpf(2)`_. For more information about the userspace API, see
Documentation/userspace-api/ebpf/index.rst.

Helper functions
================
Expand Down
17 changes: 17 additions & 0 deletions Documentation/userspace-api/ebpf/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.. SPDX-License-Identifier: GPL-2.0
eBPF Userspace API
==================

eBPF is a kernel mechanism to provide a sandboxed runtime environment in the
Linux kernel for runtime extension and instrumentation without changing kernel
source code or loading kernel modules. eBPF programs can be attached to various
kernel subsystems, including networking, tracing and Linux security modules
(LSM).

For internal kernel documentation on eBPF, see Documentation/bpf/index.rst.

.. toctree::
:maxdepth: 1

syscall
24 changes: 24 additions & 0 deletions Documentation/userspace-api/ebpf/syscall.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.. SPDX-License-Identifier: GPL-2.0
eBPF Syscall
------------

:Authors: - Alexei Starovoitov <ast@kernel.org>
- Joe Stringer <joe@wand.net.nz>
- Michael Kerrisk <mtk.manpages@gmail.com>

The primary info for the bpf syscall is available in the `man-pages`_
for `bpf(2)`_.

bpf() subcommand reference
~~~~~~~~~~~~~~~~~~~~~~~~~~

.. kernel-doc:: include/uapi/linux/bpf.h
:doc: eBPF Syscall Preamble

.. kernel-doc:: include/uapi/linux/bpf.h
:doc: eBPF Syscall Commands

.. Links:
.. _man-pages: https://www.kernel.org/doc/man-pages/
.. _bpf(2): https://man7.org/linux/man-pages/man2/bpf.2.html
1 change: 1 addition & 0 deletions Documentation/userspace-api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ place where this information is gathered.
unshare
spec_ctrl
accelerators/ocxl
ebpf/index
ioctl/index
iommu
media/index
Expand Down
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -3209,6 +3209,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git
T: git git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git
F: Documentation/bpf/
F: Documentation/networking/filter.rst
F: Documentation/userspace-api/ebpf/
F: arch/*/net/*
F: include/linux/bpf*
F: include/linux/filter.h
Expand Down

0 comments on commit 6197e5b

Please sign in to comment.