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
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 { · 5 unmodified lines
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 { · 4 unmodified lines
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 *