History

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.

Pedro Tammela committed 5 years ago

Commit 5c507321 parent aadb2bb2 files · +32 −0Browse files

Showing the changes to include/uapi (1 of 2 files). Show all

Unified · Split

include/uapi/linux/bpf.h+16−0
@@ -4082,12 +4082,20 @@ union bpf_attr { · 4081 unmodified lines
4082 * of new data availability is sent.4082 * of new data availability is sent.
4083 * If **BPF_RB_FORCE_WAKEUP** is specified in *flags*, notification4083 * If **BPF_RB_FORCE_WAKEUP** is specified in *flags*, notification
4084 * of new data availability is sent unconditionally.4084 * 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.
4085 * Return4092 * Return
4086 * 0 on success, or a negative error in case of failure.4093 * 0 on success, or a negative error in case of failure.
4087 *4094 *
4088 * void *bpf_ringbuf_reserve(void *ringbuf, u64 size, u64 flags)4095 * void *bpf_ringbuf_reserve(void *ringbuf, u64 size, u64 flags)
4089 * Description4096 * Description
4090 * Reserve *size* bytes of payload in a ring buffer *ringbuf*.4097 * Reserve *size* bytes of payload in a ring buffer *ringbuf*.
4098 * *flags* must be 0.
4091 * Return4099 * Return
4092 * Valid pointer with *size* bytes of memory available; NULL,4100 * Valid pointer with *size* bytes of memory available; NULL,
4093 * otherwise.4101 * otherwise.
@@ -4099,6 +4107,10 @@ union bpf_attr { · 5 unmodified lines
4099 * of new data availability is sent.4107 * of new data availability is sent.
4100 * If **BPF_RB_FORCE_WAKEUP** is specified in *flags*, notification4108 * If **BPF_RB_FORCE_WAKEUP** is specified in *flags*, notification
4101 * of new data availability is sent unconditionally.4109 * 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.
4102 * Return4114 * Return
4103 * Nothing. Always succeeds.4115 * Nothing. Always succeeds.
4104 *4116 *
@@ -4109,6 +4121,10 @@ union bpf_attr { · 4 unmodified lines
4109 * of new data availability is sent.4121 * of new data availability is sent.
4110 * If **BPF_RB_FORCE_WAKEUP** is specified in *flags*, notification4122 * If **BPF_RB_FORCE_WAKEUP** is specified in *flags*, notification
4111 * of new data availability is sent unconditionally.4123 * 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.
4112 * Return4128 * Return
4113 * Nothing. Always succeeds.4129 * Nothing. Always succeeds.
4114 *4130 *