bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Stringer <joe@wand.net.nz>
To: bpf@vger.kernel.org
Cc: Joe Stringer <joe@cilium.io>,
	netdev@vger.kernel.org, daniel@iogearbox.net, ast@kernel.org,
	mtk.manpages@gmail.com, Quentin Monnet <quentin@isovalent.com>
Subject: [PATCH bpf-next 16/17] docs/bpf: Add bpf() syscall command reference
Date: Tue, 16 Feb 2021 17:08:20 -0800	[thread overview]
Message-ID: <20210217010821.1810741-17-joe@wand.net.nz> (raw)
In-Reply-To: <20210217010821.1810741-1-joe@wand.net.nz>

From: Joe Stringer <joe@cilium.io>

Generate the syscall command reference from the UAPI header file and
include it in the main bpf docs page.

Reviewed-by: Quentin Monnet <quentin@isovalent.com>
Signed-off-by: Joe Stringer <joe@cilium.io>
---
 Documentation/Makefile             |  2 ++
 Documentation/bpf/Makefile         | 28 ++++++++++++++++++++++++++++
 Documentation/bpf/bpf_commands.rst |  5 +++++
 Documentation/bpf/index.rst        | 14 +++++++++++---
 4 files changed, 46 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/bpf/Makefile
 create mode 100644 Documentation/bpf/bpf_commands.rst

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 9c42dde97671..408542825cc2 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -73,6 +73,7 @@ loop_cmd = $(echo-cmd) $(cmd_$(1)) || exit;
 
 quiet_cmd_sphinx = SPHINX  $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
       cmd_sphinx = $(MAKE) BUILDDIR=$(abspath $(BUILDDIR)) $(build)=Documentation/userspace-api/media $2 && \
+	$(MAKE) BUILDDIR=$(abspath $(BUILDDIR)) $(build)=Documentation/bpf $2 && \
 	PYTHONDONTWRITEBYTECODE=1 \
 	BUILDDIR=$(abspath $(BUILDDIR)) SPHINX_CONF=$(abspath $(srctree)/$(src)/$5/$(SPHINX_CONF)) \
 	$(PYTHON3) $(srctree)/scripts/jobserver-exec \
@@ -133,6 +134,7 @@ refcheckdocs:
 
 cleandocs:
 	$(Q)rm -rf $(BUILDDIR)
+	$(Q)$(MAKE) BUILDDIR=$(abspath $(BUILDDIR)) $(build)=Documentation/bpf clean
 	$(Q)$(MAKE) BUILDDIR=$(abspath $(BUILDDIR)) $(build)=Documentation/userspace-api/media clean
 
 dochelp:
diff --git a/Documentation/bpf/Makefile b/Documentation/bpf/Makefile
new file mode 100644
index 000000000000..4f14db0891cc
--- /dev/null
+++ b/Documentation/bpf/Makefile
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: GPL-2.0
+
+# Rules to convert a .h file to inline RST documentation
+
+SRC_DIR = $(srctree)/Documentation/bpf
+PARSER = $(srctree)/scripts/bpf_doc.py
+UAPI = $(srctree)/include/uapi/linux
+
+TARGETS = $(BUILDDIR)/bpf/bpf_syscall.rst
+
+$(BUILDDIR)/bpf/bpf_syscall.rst: $(UAPI)/bpf.h
+	$(PARSER) syscall > $@
+
+.PHONY: all html epub xml latex linkcheck clean
+
+all: $(IMGDOT) $(BUILDDIR)/bpf $(TARGETS)
+
+html: all
+epub: all
+xml: all
+latex: $(IMGPDF) all
+linkcheck:
+
+clean:
+	-rm -f -- $(TARGETS) 2>/dev/null
+
+$(BUILDDIR)/bpf:
+	$(Q)mkdir -p $@
diff --git a/Documentation/bpf/bpf_commands.rst b/Documentation/bpf/bpf_commands.rst
new file mode 100644
index 000000000000..da388ffac85b
--- /dev/null
+++ b/Documentation/bpf/bpf_commands.rst
@@ -0,0 +1,5 @@
+**************************
+bpf() subcommand reference
+**************************
+
+.. kernel-include:: $BUILDDIR/bpf/bpf_syscall.rst
diff --git a/Documentation/bpf/index.rst b/Documentation/bpf/index.rst
index 4f2874b729c3..631d02d4dc49 100644
--- a/Documentation/bpf/index.rst
+++ b/Documentation/bpf/index.rst
@@ -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)
 =====================
 
@@ -35,6 +32,17 @@ 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)`_.
+
+.. toctree::
+   :maxdepth: 1
+
+   bpf_commands
+
 
 Helper functions
 ================
-- 
2.27.0


  parent reply	other threads:[~2021-02-17  1:10 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-17  1:08 [PATCH bpf-next 00/17] Improve BPF syscall command documentation Joe Stringer
2021-02-17  1:08 ` [PATCH bpf-next 01/17] bpf: Import syscall arg documentation Joe Stringer
2021-02-17  1:08 ` [PATCH bpf-next 02/17] bpf: Add minimal bpf() command documentation Joe Stringer
2021-02-17  1:08 ` [PATCH bpf-next 03/17] bpf: Document BPF_F_LOCK in syscall commands Joe Stringer
2021-02-17  1:08 ` [PATCH bpf-next 04/17] bpf: Document BPF_PROG_PIN syscall command Joe Stringer
2021-02-17  1:08 ` [PATCH bpf-next 05/17] bpf: Document BPF_PROG_ATTACH " Joe Stringer
2021-02-17  1:08 ` [PATCH bpf-next 06/17] bpf: Document BPF_PROG_TEST_RUN " Joe Stringer
2021-02-17  1:08 ` [PATCH bpf-next 07/17] bpf: Document BPF_PROG_QUERY " Joe Stringer
2021-02-17  1:08 ` [PATCH bpf-next 08/17] bpf: Document BPF_MAP_*_BATCH syscall commands Joe Stringer
2021-02-17  1:08 ` [PATCH bpf-next 09/17] scripts/bpf: Rename bpf_helpers_doc.py -> bpf_doc.py Joe Stringer
2021-02-17  1:08 ` [PATCH bpf-next 10/17] scripts/bpf: Abstract eBPF API target parameter Joe Stringer
2021-02-17  1:08 ` [PATCH bpf-next 11/17] scripts/bpf: Add syscall commands printer Joe Stringer
2021-02-17  1:08 ` [PATCH bpf-next 12/17] tools/bpf: Rename Makefile.{helpers,docs} Joe Stringer
2021-02-17  1:08 ` [PATCH bpf-next 13/17] tools/bpf: Templatize man page generation Joe Stringer
2021-02-17  1:08 ` [PATCH bpf-next 14/17] tools/bpf: Build bpf-sycall.2 in Makefile.docs Joe Stringer
2021-02-17  1:08 ` [PATCH bpf-next 15/17] selftests/bpf: Add docs target Joe Stringer
2021-02-17  1:08 ` Joe Stringer [this message]
2021-02-17  1:08 ` [PATCH bpf-next 17/17] tools: Sync uapi bpf.h header with latest changes Joe Stringer
2021-02-17 13:55 ` [PATCH bpf-next 00/17] Improve BPF syscall command documentation Toke Høiland-Jørgensen
2021-02-18  4:08   ` Joe Stringer
2021-02-18 11:33     ` Toke Høiland-Jørgensen
2021-02-17 17:32 ` Jonathan Corbet
2021-02-18  4:22   ` Joe Stringer
2021-02-18 19:26     ` Jonathan Corbet
2021-02-18 21:53       ` Joe Stringer

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=20210217010821.1810741-17-joe@wand.net.nz \
    --to=joe@wand.net.nz \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=joe@cilium.io \
    --cc=mtk.manpages@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=quentin@isovalent.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).