@@ -312,6 +312,27 @@ union bpf_iter_link_info {
312312 * *ctx_out*, *data_out* (for example, packet data), result of the
313313 * execution *retval*, and *duration* of the test run.
314314 *
315+ * The sizes of the buffers provided as input and output
316+ * parameters *ctx_in*, *ctx_out*, *data_in*, and *data_out* must
317+ * be provided in the corresponding variables *ctx_size_in*,
318+ * *ctx_size_out*, *data_size_in*, and/or *data_size_out*. If any
319+ * of these parameters are not provided (ie set to NULL), the
320+ * corresponding size field must be zero.
321+ *
322+ * Some program types have particular requirements:
323+ *
324+ * **BPF_PROG_TYPE_SK_LOOKUP**
325+ * *data_in* and *data_out* must be NULL.
326+ *
327+ * **BPF_PROG_TYPE_XDP**
328+ * *ctx_in* and *ctx_out* must be NULL.
329+ *
330+ * **BPF_PROG_TYPE_RAW_TRACEPOINT**,
331+ * **BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE**
332+ *
333+ * *ctx_out*, *data_in* and *data_out* must be NULL.
334+ * *repeat* must be zero.
335+ *
315336 * Return
316337 * Returns zero on success. On error, -1 is returned and *errno*
317338 * is set appropriately.
@@ -4578,7 +4599,7 @@ union bpf_attr {
45784599 *
45794600 * long bpf_check_mtu(void *ctx, u32 ifindex, u32 *mtu_len, s32 len_diff, u64 flags)
45804601 * Description
4581- * Check ctx packet size against exceeding MTU of net device (based
4602+ * Check packet size against exceeding MTU of net device (based
45824603 * on *ifindex*). This helper will likely be used in combination
45834604 * with helpers that adjust/change the packet size.
45844605 *
@@ -4595,6 +4616,14 @@ union bpf_attr {
45954616 * against the current net device. This is practical if this isn't
45964617 * used prior to redirect.
45974618 *
4619+ * On input *mtu_len* must be a valid pointer, else verifier will
4620+ * reject BPF program. If the value *mtu_len* is initialized to
4621+ * zero then the ctx packet size is use. When value *mtu_len* is
4622+ * provided as input this specify the L3 length that the MTU check
4623+ * is done against. Remember XDP and TC length operate at L2, but
4624+ * this value is L3 as this correlate to MTU and IP-header tot_len
4625+ * values which are L3 (similar behavior as bpf_fib_lookup).
4626+ *
45984627 * The Linux kernel route table can configure MTUs on a more
45994628 * specific per route level, which is not provided by this helper.
46004629 * For route level MTU checks use the **bpf_fib_lookup**\ ()
@@ -4619,11 +4648,9 @@ union bpf_attr {
46194648 *
46204649 * On return *mtu_len* pointer contains the MTU value of the net
46214650 * device. Remember the net device configured MTU is the L3 size,
4622- * which is returned here and XDP and TX length operate at L2.
4651+ * which is returned here and XDP and TC length operate at L2.
46234652 * Helper take this into account for you, but remember when using
4624- * MTU value in your BPF-code. On input *mtu_len* must be a valid
4625- * pointer and be initialized (to zero), else verifier will reject
4626- * BPF program.
4653+ * MTU value in your BPF-code.
46274654 *
46284655 * Return
46294656 * * 0 on success, and populate MTU value in *mtu_len* pointer.
0 commit comments