Re: [PATCH bpf v7 1/5] strparser: add read_sock callback

From: Jakub Sitnicki
Date: Sat Jan 18 2025 - 09:57:14 EST


On Thu, Jan 16, 2025 at 10:05 PM +08, Jiayuan Chen wrote:
> Added a new read_sock handler, allowing users to customize read operations
> instead of relying on the native socket's read_sock.
>
> Signed-off-by: Jiayuan Chen <mrpre@xxxxxxx>
> ---
> Documentation/networking/strparser.rst | 11 ++++++++++-
> include/net/strparser.h | 2 ++
> net/strparser/strparser.c | 11 +++++++++--
> 3 files changed, 21 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/networking/strparser.rst b/Documentation/networking/strparser.rst
> index 6cab1f74ae05..e41c18eee2f4 100644
> --- a/Documentation/networking/strparser.rst
> +++ b/Documentation/networking/strparser.rst
> @@ -112,7 +112,7 @@ Functions
> Callbacks
> =========
>
> -There are six callbacks:
> +There are seven callbacks:
>
> ::
>
> @@ -182,6 +182,15 @@ There are six callbacks:
> the length of the message. skb->len - offset may be greater
> then full_len since strparser does not trim the skb.
>
> + ::
> +
> + int (*read_sock)(struct strparser *strp, read_descriptor_t *desc,
> + sk_read_actor_t recv_actor);
> +
> + read_sock is called when the user specify it, allowing for customized
> + read operations. If the callback is not set (NULL in strp_init) native
> + read_sock operation of the socket is used.
> +

Could be one sentence:

The read_sock callback is used by strparser instead of
sock->ops->read_sock, if provided.

> ::
>
> int (*read_sock_done)(struct strparser *strp, int err);

[...]