netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] Fix BPF helpers documentation
@ 2018-04-28 23:06 Andrey Ignatov
  2018-04-28 23:06 ` [PATCH bpf-next 1/2] bpf: Fix helpers ctx struct types in uapi doc Andrey Ignatov
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Andrey Ignatov @ 2018-04-28 23:06 UTC (permalink / raw)
  To: ast, daniel, quentin.monnet, netdev; +Cc: Andrey Ignatov, kernel-team

BPF helpers documentation in UAPI refers to kernel ctx structures when it
has to refer to user visible ones. Fix it.

Andrey Ignatov (2):
  bpf: Fix helpers ctx struct types in uapi doc
  bpf: Sync bpf.h to tools/

 include/uapi/linux/bpf.h       | 12 ++++++------
 tools/include/uapi/linux/bpf.h | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)

-- 
2.9.5

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH bpf-next 1/2] bpf: Fix helpers ctx struct types in uapi doc
  2018-04-28 23:06 [PATCH bpf-next 0/2] Fix BPF helpers documentation Andrey Ignatov
@ 2018-04-28 23:06 ` Andrey Ignatov
  2018-04-28 23:06 ` [PATCH bpf-next 2/2] bpf: Sync bpf.h to tools/ Andrey Ignatov
  2018-04-29  9:49 ` [PATCH bpf-next 0/2] Fix BPF helpers documentation Quentin Monnet
  2 siblings, 0 replies; 5+ messages in thread
From: Andrey Ignatov @ 2018-04-28 23:06 UTC (permalink / raw)
  To: ast, daniel, quentin.monnet, netdev; +Cc: Andrey Ignatov, kernel-team

Helpers may operate on two types of ctx structures: user visible ones
(e.g. `struct bpf_sock_ops`) when used in user programs, and kernel ones
(e.g. `struct bpf_sock_ops_kern`) in kernel implementation.

UAPI documentation must refer to only user visible structures.

The patch replaces references to `_kern` structures in BPF helpers
description by corresponding user visible structures.

Signed-off-by: Andrey Ignatov <rdna@fb.com>
---
 include/uapi/linux/bpf.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index da77a93..730f448 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -1361,7 +1361,7 @@ union bpf_attr {
  * 	Return
  * 		0
  *
- * int bpf_setsockopt(struct bpf_sock_ops_kern *bpf_socket, int level, int optname, char *optval, int optlen)
+ * int bpf_setsockopt(struct bpf_sock_ops *bpf_socket, int level, int optname, char *optval, int optlen)
  * 	Description
  * 		Emulate a call to **setsockopt()** on the socket associated to
  * 		*bpf_socket*, which must be a full socket. The *level* at
@@ -1435,7 +1435,7 @@ union bpf_attr {
  * 	Return
  * 		**SK_PASS** on success, or **SK_DROP** on error.
  *
- * int bpf_sock_map_update(struct bpf_sock_ops_kern *skops, struct bpf_map *map, void *key, u64 flags)
+ * int bpf_sock_map_update(struct bpf_sock_ops *skops, struct bpf_map *map, void *key, u64 flags)
  * 	Description
  * 		Add an entry to, or update a *map* referencing sockets. The
  * 		*skops* is used as a new value for the entry associated to
@@ -1533,7 +1533,7 @@ union bpf_attr {
  * 	Return
  * 		0 on success, or a negative error in case of failure.
  *
- * int bpf_perf_prog_read_value(struct bpf_perf_event_data_kern *ctx, struct bpf_perf_event_value *buf, u32 buf_size)
+ * int bpf_perf_prog_read_value(struct bpf_perf_event_data *ctx, struct bpf_perf_event_value *buf, u32 buf_size)
  * 	Description
  * 		For en eBPF program attached to a perf event, retrieve the
  * 		value of the event counter associated to *ctx* and store it in
@@ -1544,7 +1544,7 @@ union bpf_attr {
  * 	Return
  * 		0 on success, or a negative error in case of failure.
  *
- * int bpf_getsockopt(struct bpf_sock_ops_kern *bpf_socket, int level, int optname, char *optval, int optlen)
+ * int bpf_getsockopt(struct bpf_sock_ops *bpf_socket, int level, int optname, char *optval, int optlen)
  * 	Description
  * 		Emulate a call to **getsockopt()** on the socket associated to
  * 		*bpf_socket*, which must be a full socket. The *level* at
@@ -1588,7 +1588,7 @@ union bpf_attr {
  * 	Return
  * 		0
  *
- * int bpf_sock_ops_cb_flags_set(struct bpf_sock_ops_kern *bpf_sock, int argval)
+ * int bpf_sock_ops_cb_flags_set(struct bpf_sock_ops *bpf_sock, int argval)
  * 	Description
  * 		Attempt to set the value of the **bpf_sock_ops_cb_flags** field
  * 		for the full TCP socket associated to *bpf_sock_ops* to
@@ -1721,7 +1721,7 @@ union bpf_attr {
  * 	Return
  * 		0 on success, or a negative error in case of failure.
  *
- * int bpf_bind(struct bpf_sock_addr_kern *ctx, struct sockaddr *addr, int addr_len)
+ * int bpf_bind(struct bpf_sock_addr *ctx, struct sockaddr *addr, int addr_len)
  * 	Description
  * 		Bind the socket associated to *ctx* to the address pointed by
  * 		*addr*, of length *addr_len*. This allows for making outgoing
-- 
2.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH bpf-next 2/2] bpf: Sync bpf.h to tools/
  2018-04-28 23:06 [PATCH bpf-next 0/2] Fix BPF helpers documentation Andrey Ignatov
  2018-04-28 23:06 ` [PATCH bpf-next 1/2] bpf: Fix helpers ctx struct types in uapi doc Andrey Ignatov
@ 2018-04-28 23:06 ` Andrey Ignatov
  2018-04-29  9:49 ` [PATCH bpf-next 0/2] Fix BPF helpers documentation Quentin Monnet
  2 siblings, 0 replies; 5+ messages in thread
From: Andrey Ignatov @ 2018-04-28 23:06 UTC (permalink / raw)
  To: ast, daniel, quentin.monnet, netdev; +Cc: Andrey Ignatov, kernel-team

The patch syncs bpf.h to tools/.

Signed-off-by: Andrey Ignatov <rdna@fb.com>
---
 tools/include/uapi/linux/bpf.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index da77a93..730f448 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -1361,7 +1361,7 @@ union bpf_attr {
  * 	Return
  * 		0
  *
- * int bpf_setsockopt(struct bpf_sock_ops_kern *bpf_socket, int level, int optname, char *optval, int optlen)
+ * int bpf_setsockopt(struct bpf_sock_ops *bpf_socket, int level, int optname, char *optval, int optlen)
  * 	Description
  * 		Emulate a call to **setsockopt()** on the socket associated to
  * 		*bpf_socket*, which must be a full socket. The *level* at
@@ -1435,7 +1435,7 @@ union bpf_attr {
  * 	Return
  * 		**SK_PASS** on success, or **SK_DROP** on error.
  *
- * int bpf_sock_map_update(struct bpf_sock_ops_kern *skops, struct bpf_map *map, void *key, u64 flags)
+ * int bpf_sock_map_update(struct bpf_sock_ops *skops, struct bpf_map *map, void *key, u64 flags)
  * 	Description
  * 		Add an entry to, or update a *map* referencing sockets. The
  * 		*skops* is used as a new value for the entry associated to
@@ -1533,7 +1533,7 @@ union bpf_attr {
  * 	Return
  * 		0 on success, or a negative error in case of failure.
  *
- * int bpf_perf_prog_read_value(struct bpf_perf_event_data_kern *ctx, struct bpf_perf_event_value *buf, u32 buf_size)
+ * int bpf_perf_prog_read_value(struct bpf_perf_event_data *ctx, struct bpf_perf_event_value *buf, u32 buf_size)
  * 	Description
  * 		For en eBPF program attached to a perf event, retrieve the
  * 		value of the event counter associated to *ctx* and store it in
@@ -1544,7 +1544,7 @@ union bpf_attr {
  * 	Return
  * 		0 on success, or a negative error in case of failure.
  *
- * int bpf_getsockopt(struct bpf_sock_ops_kern *bpf_socket, int level, int optname, char *optval, int optlen)
+ * int bpf_getsockopt(struct bpf_sock_ops *bpf_socket, int level, int optname, char *optval, int optlen)
  * 	Description
  * 		Emulate a call to **getsockopt()** on the socket associated to
  * 		*bpf_socket*, which must be a full socket. The *level* at
@@ -1588,7 +1588,7 @@ union bpf_attr {
  * 	Return
  * 		0
  *
- * int bpf_sock_ops_cb_flags_set(struct bpf_sock_ops_kern *bpf_sock, int argval)
+ * int bpf_sock_ops_cb_flags_set(struct bpf_sock_ops *bpf_sock, int argval)
  * 	Description
  * 		Attempt to set the value of the **bpf_sock_ops_cb_flags** field
  * 		for the full TCP socket associated to *bpf_sock_ops* to
@@ -1721,7 +1721,7 @@ union bpf_attr {
  * 	Return
  * 		0 on success, or a negative error in case of failure.
  *
- * int bpf_bind(struct bpf_sock_addr_kern *ctx, struct sockaddr *addr, int addr_len)
+ * int bpf_bind(struct bpf_sock_addr *ctx, struct sockaddr *addr, int addr_len)
  * 	Description
  * 		Bind the socket associated to *ctx* to the address pointed by
  * 		*addr*, of length *addr_len*. This allows for making outgoing
-- 
2.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH bpf-next 0/2] Fix BPF helpers documentation
  2018-04-28 23:06 [PATCH bpf-next 0/2] Fix BPF helpers documentation Andrey Ignatov
  2018-04-28 23:06 ` [PATCH bpf-next 1/2] bpf: Fix helpers ctx struct types in uapi doc Andrey Ignatov
  2018-04-28 23:06 ` [PATCH bpf-next 2/2] bpf: Sync bpf.h to tools/ Andrey Ignatov
@ 2018-04-29  9:49 ` Quentin Monnet
  2018-04-29 16:02   ` Alexei Starovoitov
  2 siblings, 1 reply; 5+ messages in thread
From: Quentin Monnet @ 2018-04-29  9:49 UTC (permalink / raw)
  To: Andrey Ignatov
  Cc: Alexei Starovoitov, Daniel Borkmann,
	Linux Kernel Network Developers, kernel-team

On 29 April 2018 at 00:06, Andrey Ignatov <rdna@fb.com> wrote:
> BPF helpers documentation in UAPI refers to kernel ctx structures when it
> has to refer to user visible ones. Fix it.
>
> Andrey Ignatov (2):
>   bpf: Fix helpers ctx struct types in uapi doc
>   bpf: Sync bpf.h to tools/
>
>  include/uapi/linux/bpf.h       | 12 ++++++------
>  tools/include/uapi/linux/bpf.h | 12 ++++++------
>  2 files changed, 12 insertions(+), 12 deletions(-)

Correct. Thanks a lot for the fix, Andrey!
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH bpf-next 0/2] Fix BPF helpers documentation
  2018-04-29  9:49 ` [PATCH bpf-next 0/2] Fix BPF helpers documentation Quentin Monnet
@ 2018-04-29 16:02   ` Alexei Starovoitov
  0 siblings, 0 replies; 5+ messages in thread
From: Alexei Starovoitov @ 2018-04-29 16:02 UTC (permalink / raw)
  To: Quentin Monnet
  Cc: Andrey Ignatov, Alexei Starovoitov, Daniel Borkmann,
	Linux Kernel Network Developers, kernel-team

On Sun, Apr 29, 2018 at 10:49:40AM +0100, Quentin Monnet wrote:
> On 29 April 2018 at 00:06, Andrey Ignatov <rdna@fb.com> wrote:
> > BPF helpers documentation in UAPI refers to kernel ctx structures when it
> > has to refer to user visible ones. Fix it.
> >
> > Andrey Ignatov (2):
> >   bpf: Fix helpers ctx struct types in uapi doc
> >   bpf: Sync bpf.h to tools/
> >
> >  include/uapi/linux/bpf.h       | 12 ++++++------
> >  tools/include/uapi/linux/bpf.h | 12 ++++++------
> >  2 files changed, 12 insertions(+), 12 deletions(-)
> 
> Correct. Thanks a lot for the fix, Andrey!
> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>

Applied, Thanks Andrey.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-04-29 16:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-28 23:06 [PATCH bpf-next 0/2] Fix BPF helpers documentation Andrey Ignatov
2018-04-28 23:06 ` [PATCH bpf-next 1/2] bpf: Fix helpers ctx struct types in uapi doc Andrey Ignatov
2018-04-28 23:06 ` [PATCH bpf-next 2/2] bpf: Sync bpf.h to tools/ Andrey Ignatov
2018-04-29  9:49 ` [PATCH bpf-next 0/2] Fix BPF helpers documentation Quentin Monnet
2018-04-29 16:02   ` Alexei Starovoitov

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).