From: Quentin Monnet Subject: Re: [PATCH bpf-next 1/3] bpf: helper to pop data from messages Date: Mon, 26 Nov 2018 11:16:38 +0000 Message-ID: <4a776156-5c75-3c50-e62a-227924397d77@netronome.com> References: <1542937130-4860-1-git-send-email-john.fastabend@gmail.com> <1542937130-4860-2-git-send-email-john.fastabend@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Daniel Borkmann , ast@kernel.org, netdev@vger.kernel.org To: John Fastabend Return-path: Received: from mail-wr1-f67.google.com ([209.85.221.67]:34259 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727317AbeKZWKa (ORCPT ); Mon, 26 Nov 2018 17:10:30 -0500 Received: by mail-wr1-f67.google.com with SMTP id j2so18477680wrw.1 for ; Mon, 26 Nov 2018 03:16:41 -0800 (PST) In-Reply-To: Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: 2018-11-26 02:05 UTC+0100 ~ Daniel Borkmann > On 11/23/2018 02:38 AM, John Fastabend wrote: >> This adds a BPF SK_MSG program helper so that we can pop data from a >> msg. We use this to pop metadata from a previous push data call. >> >> Signed-off-by: John Fastabend >> --- >> include/uapi/linux/bpf.h | 13 +++- >> net/core/filter.c | 169 +++++++++++++++++++++++++++++++++++++++++++++++ >> net/ipv4/tcp_bpf.c | 14 +++- >> 3 files changed, 192 insertions(+), 4 deletions(-) >> >> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h >> index c1554aa..64681f8 100644 >> --- a/include/uapi/linux/bpf.h >> +++ b/include/uapi/linux/bpf.h >> @@ -2268,6 +2268,16 @@ union bpf_attr { >> * >> * Return >> * 0 on success, or a negative error in case of failure. >> + * >> + * int bpf_msg_pop_data(struct sk_msg_buff *msg, u32 start, u32 pop, u64 flags) >> + * Description >> + * Will remove 'pop' bytes from a msg starting at byte 'start'. >> + * This result in ENOMEM errors under certain situations where >> + * a allocation and copy are required due to a full ring buffer. >> + * However, the helper will try to avoid doing the allocation >> + * if possible. Other errors can occur if input parameters are >> + * invalid either do to start byte not being valid part of msg >> + * payload and/or pop value being to large. >> */ Hi John, If you respin could you please update the helper documentation to use RST syntax for argument and constant names (*pop* instead of 'pop', *msg*, *start*, *flags*, **ENOMEM**), and document the return value from the helper? Thanks a lot, Quentin