Skip to content

Commit 5931d9a

Browse files
dave-tuckerborkmann
authored andcommitted
bpf, docs: Fix ordering of bpf documentation
This commit fixes the display of the BPF documentation in the sidebar when rendered as HTML. Before this patch, the sidebar would render as follows for some sections: | BPF Documentation |- BPF Type Format (BTF) |- BPF Type Format (BTF) This was due to creating a heading in index.rst followed by a sphinx toctree, where the file referenced carries the same title as the section heading. To fix this I applied a pattern that has been established in other subfolders of Documentation: 1. Re-wrote index.rst to have a single toctree 2. Split the sections out in to their own files Additionally maps.rst and programs.rst make use of a glob pattern to include map_* or prog_* rst files in their toctree, meaning future map or program type documentation will be automatically included. Signed-off-by: Dave Tucker <dave@dtucker.co.uk> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/1a1eed800e7b9dc13b458de113a489641519b0cc.1636749493.git.dave@dtucker.co.uk
1 parent f5b1c2e commit 5931d9a

File tree

9 files changed

+80
-86
lines changed

9 files changed

+80
-86
lines changed

Documentation/bpf/faq.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
================================
2+
Frequently asked questions (FAQ)
3+
================================
4+
5+
Two sets of Questions and Answers (Q&A) are maintained.
6+
7+
.. toctree::
8+
:maxdepth: 1
9+
10+
bpf_design_QA
11+
bpf_devel_QA

Documentation/bpf/helpers.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Helper functions
2+
================
3+
4+
* `bpf-helpers(7)`_ maintains a list of helpers available to eBPF programs.
5+
6+
.. Links
7+
.. _bpf-helpers(7): https://man7.org/linux/man-pages/man7/bpf-helpers.7.html

Documentation/bpf/index.rst

Lines changed: 13 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -12,97 +12,26 @@ BPF instruction-set.
1212
The Cilium project also maintains a `BPF and XDP Reference Guide`_
1313
that goes into great technical depth about the BPF Architecture.
1414

15-
libbpf
16-
======
17-
18-
Documentation/bpf/libbpf/libbpf.rst is a userspace library for loading and interacting with bpf programs.
19-
20-
BPF Type Format (BTF)
21-
=====================
22-
2315
.. toctree::
2416
:maxdepth: 1
2517

18+
libbpf/index
2619
btf
27-
28-
29-
Frequently asked questions (FAQ)
30-
================================
31-
32-
Two sets of Questions and Answers (Q&A) are maintained.
33-
34-
.. toctree::
35-
:maxdepth: 1
36-
37-
bpf_design_QA
38-
bpf_devel_QA
39-
40-
Syscall API
41-
===========
42-
43-
The primary info for the bpf syscall is available in the `man-pages`_
44-
for `bpf(2)`_. For more information about the userspace API, see
45-
Documentation/userspace-api/ebpf/index.rst.
46-
47-
Helper functions
48-
================
49-
50-
* `bpf-helpers(7)`_ maintains a list of helpers available to eBPF programs.
51-
52-
53-
Program types
54-
=============
55-
56-
.. toctree::
57-
:maxdepth: 1
58-
59-
prog_cgroup_sockopt
60-
prog_cgroup_sysctl
61-
prog_flow_dissector
62-
bpf_lsm
63-
prog_sk_lookup
64-
65-
66-
Map types
67-
=========
68-
69-
.. toctree::
70-
:maxdepth: 1
71-
72-
map_cgroup_storage
73-
74-
75-
Testing and debugging BPF
76-
=========================
77-
78-
.. toctree::
79-
:maxdepth: 1
80-
81-
drgn
82-
s390
83-
84-
85-
Licensing
86-
=========
87-
88-
.. toctree::
89-
:maxdepth: 1
90-
20+
faq
21+
syscall_api
22+
helpers
23+
programs
24+
maps
9125
bpf_licensing
26+
test_debug
27+
other
9228

29+
.. only:: subproject and html
9330

94-
Other
95-
=====
96-
97-
.. toctree::
98-
:maxdepth: 1
31+
Indices
32+
=======
9933

100-
ringbuf
101-
llvm_reloc
34+
* :ref:`genindex`
10235

10336
.. Links:
104-
.. _networking-filter: ../networking/filter.rst
105-
.. _man-pages: https://www.kernel.org/doc/man-pages/
106-
.. _bpf(2): https://man7.org/linux/man-pages/man2/bpf.2.html
107-
.. _bpf-helpers(7): https://man7.org/linux/man-pages/man7/bpf-helpers.7.html
108-
.. _BPF and XDP Reference Guide: https://docs.cilium.io/en/latest/bpf/
37+
.. _BPF and XDP Reference Guide: https://docs.cilium.io/en/latest/bpf/

Documentation/bpf/libbpf/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
libbpf
44
======
55

6-
For API documentation see the `versioned API documentation site <https://libbpf.readthedocs.io/en/latest/api.html>`_.
7-
86
.. toctree::
97
:maxdepth: 1
108

@@ -14,6 +12,8 @@ For API documentation see the `versioned API documentation site <https://libbpf.
1412
This is documentation for libbpf, a userspace library for loading and
1513
interacting with bpf programs.
1614

15+
For API documentation see the `versioned API documentation site <https://libbpf.readthedocs.io/en/latest/api.html>`_.
16+
1717
All general BPF questions, including kernel functionality, libbpf APIs and
1818
their application, should be sent to bpf@vger.kernel.org mailing list.
1919
You can `subscribe <http://vger.kernel.org/vger-lists.html#bpf>`_ to the

Documentation/bpf/maps.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
=========
2+
Map Types
3+
=========
4+
5+
.. toctree::
6+
:maxdepth: 1
7+
:glob:
8+
9+
map_*

Documentation/bpf/other.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
=====
2+
Other
3+
=====
4+
5+
.. toctree::
6+
:maxdepth: 1
7+
8+
ringbuf
9+
llvm_reloc

Documentation/bpf/programs.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
=============
2+
Program Types
3+
=============
4+
5+
.. toctree::
6+
:maxdepth: 1
7+
:glob:
8+
9+
prog_*

Documentation/bpf/syscall_api.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
===========
2+
Syscall API
3+
===========
4+
5+
The primary info for the bpf syscall is available in the `man-pages`_
6+
for `bpf(2)`_. For more information about the userspace API, see
7+
Documentation/userspace-api/ebpf/index.rst.
8+
9+
.. Links:
10+
.. _man-pages: https://www.kernel.org/doc/man-pages/
11+
.. _bpf(2): https://man7.org/linux/man-pages/man2/bpf.2.html

Documentation/bpf/test_debug.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
=========================
2+
Testing and debugging BPF
3+
=========================
4+
5+
.. toctree::
6+
:maxdepth: 1
7+
8+
drgn
9+
s390

0 commit comments

Comments
 (0)