Skip to content

Commit 5c50732

Browse files
tammelaanakryiko
authored andcommitted
libbpf: Clarify flags in ringbuf helpers
In 'bpf_ringbuf_reserve()' we require the flag to '0' at the moment. For 'bpf_ringbuf_{discard,submit,output}' a flag of '0' might send a notification to the process if needed. Signed-off-by: Pedro Tammela <pctammela@mojatatu.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20210412192434.944343-1-pctammela@mojatatu.com
1 parent aadb2bb commit 5c50732

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

  • include/uapi/linux
  • tools/include/uapi/linux

‎include/uapi/linux/bpf.h‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4082,12 +4082,20 @@ union bpf_attr {
40824082
* of new data availability is sent.
40834083
* If **BPF_RB_FORCE_WAKEUP** is specified in *flags*, notification
40844084
* of new data availability is sent unconditionally.
4085+
* If **0** is specified in *flags*, an adaptive notification
4086+
* of new data availability is sent.
4087+
*
4088+
* An adaptive notification is a notification sent whenever the user-space
4089+
* process has caught up and consumed all available payloads. In case the user-space
4090+
* process is still processing a previous payload, then no notification is needed
4091+
* as it will process the newly added payload automatically.
40854092
* Return
40864093
* 0 on success, or a negative error in case of failure.
40874094
*
40884095
* void *bpf_ringbuf_reserve(void *ringbuf, u64 size, u64 flags)
40894096
* Description
40904097
* Reserve *size* bytes of payload in a ring buffer *ringbuf*.
4098+
* *flags* must be 0.
40914099
* Return
40924100
* Valid pointer with *size* bytes of memory available; NULL,
40934101
* otherwise.
@@ -4099,6 +4107,10 @@ union bpf_attr {
40994107
* of new data availability is sent.
41004108
* If **BPF_RB_FORCE_WAKEUP** is specified in *flags*, notification
41014109
* of new data availability is sent unconditionally.
4110+
* If **0** is specified in *flags*, an adaptive notification
4111+
* of new data availability is sent.
4112+
*
4113+
* See 'bpf_ringbuf_output()' for the definition of adaptive notification.
41024114
* Return
41034115
* Nothing. Always succeeds.
41044116
*
@@ -4109,6 +4121,10 @@ union bpf_attr {
41094121
* of new data availability is sent.
41104122
* If **BPF_RB_FORCE_WAKEUP** is specified in *flags*, notification
41114123
* of new data availability is sent unconditionally.
4124+
* If **0** is specified in *flags*, an adaptive notification
4125+
* of new data availability is sent.
4126+
*
4127+
* See 'bpf_ringbuf_output()' for the definition of adaptive notification.
41124128
* Return
41134129
* Nothing. Always succeeds.
41144130
*

‎tools/include/uapi/linux/bpf.h‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4082,12 +4082,20 @@ union bpf_attr {
40824082
* of new data availability is sent.
40834083
* If **BPF_RB_FORCE_WAKEUP** is specified in *flags*, notification
40844084
* of new data availability is sent unconditionally.
4085+
* If **0** is specified in *flags*, an adaptive notification
4086+
* of new data availability is sent.
4087+
*
4088+
* An adaptive notification is a notification sent whenever the user-space
4089+
* process has caught up and consumed all available payloads. In case the user-space
4090+
* process is still processing a previous payload, then no notification is needed
4091+
* as it will process the newly added payload automatically.
40854092
* Return
40864093
* 0 on success, or a negative error in case of failure.
40874094
*
40884095
* void *bpf_ringbuf_reserve(void *ringbuf, u64 size, u64 flags)
40894096
* Description
40904097
* Reserve *size* bytes of payload in a ring buffer *ringbuf*.
4098+
* *flags* must be 0.
40914099
* Return
40924100
* Valid pointer with *size* bytes of memory available; NULL,
40934101
* otherwise.
@@ -4099,6 +4107,10 @@ union bpf_attr {
40994107
* of new data availability is sent.
41004108
* If **BPF_RB_FORCE_WAKEUP** is specified in *flags*, notification
41014109
* of new data availability is sent unconditionally.
4110+
* If **0** is specified in *flags*, an adaptive notification
4111+
* of new data availability is sent.
4112+
*
4113+
* See 'bpf_ringbuf_output()' for the definition of adaptive notification.
41024114
* Return
41034115
* Nothing. Always succeeds.
41044116
*
@@ -4109,6 +4121,10 @@ union bpf_attr {
41094121
* of new data availability is sent.
41104122
* If **BPF_RB_FORCE_WAKEUP** is specified in *flags*, notification
41114123
* of new data availability is sent unconditionally.
4124+
* If **0** is specified in *flags*, an adaptive notification
4125+
* of new data availability is sent.
4126+
*
4127+
* See 'bpf_ringbuf_output()' for the definition of adaptive notification.
41124128
* Return
41134129
* Nothing. Always succeeds.
41144130
*

0 commit comments

Comments
 (0)