All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Stringer <joe@cilium.io>
To: bpf@vger.kernel.org
Cc: daniel@iogearbox.net, ast@kernel.org, linux-doc@vger.kernel.org,
	linux-man@vger.kernel.org,
	"Toke Høiland-Jørgensen" <toke@redhat.com>,
	"Quentin Monnet" <quentin@isovalent.com>,
	"Daniel Mack" <daniel@zonque.org>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"Sean Young" <sean@mess.org>, "Petar Penkov" <ppenkov@google.com>
Subject: [PATCHv2 bpf-next 05/15] bpf: Document BPF_PROG_ATTACH syscall command
Date: Tue,  2 Mar 2021 09:19:37 -0800	[thread overview]
Message-ID: <20210302171947.2268128-6-joe@cilium.io> (raw)
In-Reply-To: <20210302171947.2268128-1-joe@cilium.io>

Document the prog attach command in more detail, based on git commits:
* commit f4324551489e ("bpf: add BPF_PROG_ATTACH and BPF_PROG_DETACH
  commands")
* commit 4f738adba30a ("bpf: create tcp_bpf_ulp allowing BPF to monitor
  socket TX/RX data")
* commit f4364dcfc86d ("media: rc: introduce BPF_PROG_LIRC_MODE2")
* commit d58e468b1112 ("flow_dissector: implements flow dissector BPF
  hook")

Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
Reviewed-by: Quentin Monnet <quentin@isovalent.com>
Signed-off-by: Joe Stringer <joe@cilium.io>
---
CC: Daniel Mack <daniel@zonque.org>
CC: John Fastabend <john.fastabend@gmail.com>
CC: Sean Young <sean@mess.org>
CC: Petar Penkov <ppenkov@google.com>
---
 include/uapi/linux/bpf.h | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 6946dde90c56..a8f2964ec885 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -253,6 +253,43 @@ union bpf_iter_link_info {
  *		Attach an eBPF program to a *target_fd* at the specified
  *		*attach_type* hook.
  *
+ *		The *attach_type* specifies the eBPF attachment point to
+ *		attach the program to, and must be one of *bpf_attach_type*
+ *		(see below).
+ *
+ *		The *attach_bpf_fd* must be a valid file descriptor for a
+ *		loaded eBPF program of a cgroup, flow dissector, LIRC, sockmap
+ *		or sock_ops type corresponding to the specified *attach_type*.
+ *
+ *		The *target_fd* must be a valid file descriptor for a kernel
+ *		object which depends on the attach type of *attach_bpf_fd*:
+ *
+ *		**BPF_PROG_TYPE_CGROUP_DEVICE**,
+ *		**BPF_PROG_TYPE_CGROUP_SKB**,
+ *		**BPF_PROG_TYPE_CGROUP_SOCK**,
+ *		**BPF_PROG_TYPE_CGROUP_SOCK_ADDR**,
+ *		**BPF_PROG_TYPE_CGROUP_SOCKOPT**,
+ *		**BPF_PROG_TYPE_CGROUP_SYSCTL**,
+ *		**BPF_PROG_TYPE_SOCK_OPS**
+ *
+ *			Control Group v2 hierarchy with the eBPF controller
+ *			enabled. Requires the kernel to be compiled with
+ *			**CONFIG_CGROUP_BPF**.
+ *
+ *		**BPF_PROG_TYPE_FLOW_DISSECTOR**
+ *
+ *			Network namespace (eg /proc/self/ns/net).
+ *
+ *		**BPF_PROG_TYPE_LIRC_MODE2**
+ *
+ *			LIRC device path (eg /dev/lircN). Requires the kernel
+ *			to be compiled with **CONFIG_BPF_LIRC_MODE2**.
+ *
+ *		**BPF_PROG_TYPE_SK_SKB**,
+ *		**BPF_PROG_TYPE_SK_MSG**
+ *
+ *			eBPF map of socket type (eg **BPF_MAP_TYPE_SOCKHASH**).
+ *
  *	Return
  *		Returns zero on success. On error, -1 is returned and *errno*
  *		is set appropriately.
-- 
2.27.0


  parent reply	other threads:[~2021-03-03  3:55 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-02 17:19 [PATCHv2 bpf-next 00/15] Improve BPF syscall command documentation Joe Stringer
2021-03-02 17:19 ` [PATCHv2 bpf-next 01/15] bpf: Import syscall arg documentation Joe Stringer
2021-03-03 19:38   ` Yonghong Song
2021-03-03 20:20     ` Yonghong Song
2021-03-02 17:19 ` [PATCHv2 bpf-next 02/15] bpf: Add minimal bpf() command documentation Joe Stringer
2021-03-03 19:44   ` Yonghong Song
2021-03-02 17:19 ` [PATCHv2 bpf-next 03/15] bpf: Document BPF_F_LOCK in syscall commands Joe Stringer
2021-03-03 20:16   ` Yonghong Song
2021-03-02 17:19 ` [PATCHv2 bpf-next 04/15] bpf: Document BPF_PROG_PIN syscall command Joe Stringer
2021-03-03 20:21   ` Yonghong Song
2021-03-02 17:19 ` Joe Stringer [this message]
2021-03-03 20:23   ` [PATCHv2 bpf-next 05/15] bpf: Document BPF_PROG_ATTACH " Yonghong Song
2021-03-02 17:19 ` [PATCHv2 bpf-next 06/15] bpf: Document BPF_PROG_TEST_RUN " Joe Stringer
2021-03-03 20:29   ` Yonghong Song
2021-03-03 23:53     ` Joe Stringer
2021-04-10 18:12       ` Joe Stringer
2021-03-02 17:19 ` [PATCHv2 bpf-next 07/15] bpf: Document BPF_PROG_QUERY " Joe Stringer
2021-03-03 20:31   ` Yonghong Song
2021-03-02 17:19 ` [PATCHv2 bpf-next 08/15] bpf: Document BPF_MAP_*_BATCH syscall commands Joe Stringer
2021-03-03 17:38   ` Brian Vazquez
2021-03-03 20:44   ` Yonghong Song
2021-03-02 17:19 ` [PATCHv2 bpf-next 09/15] scripts/bpf: Abstract eBPF API target parameter Joe Stringer
2021-03-02 17:19 ` [PATCHv2 bpf-next 10/15] scripts/bpf: Add syscall commands printer Joe Stringer
2021-03-02 17:19 ` [PATCHv2 bpf-next 11/15] tools/bpf: Remove bpf-helpers from bpftool docs Joe Stringer
2021-03-02 17:19 ` [PATCHv2 bpf-next 12/15] selftests/bpf: Templatize man page generation Joe Stringer
2021-03-02 17:19 ` [PATCHv2 bpf-next 13/15] selftests/bpf: Test syscall command parsing Joe Stringer
2021-03-03 22:23   ` Yonghong Song
2021-03-03 23:50     ` Joe Stringer
2021-03-02 17:19 ` [PATCHv2 bpf-next 14/15] docs/bpf: Add bpf() syscall command reference Joe Stringer
2021-03-02 17:19 ` [PATCHv2 bpf-next 15/15] tools: Sync uapi bpf.h header with latest changes Joe Stringer
2021-03-03 17:25 ` [PATCHv2 bpf-next 00/15] Improve BPF syscall command documentation Jonathan Corbet
2021-03-03 18:50   ` Joe Stringer
2021-03-05  2:51 ` Alexei Starovoitov

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=20210302171947.2268128-6-joe@cilium.io \
    --to=joe@cilium.io \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=daniel@zonque.org \
    --cc=john.fastabend@gmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=ppenkov@google.com \
    --cc=quentin@isovalent.com \
    --cc=sean@mess.org \
    --cc=toke@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.