Re: [RFC PATCH net-next v5 12/14] net: add SO_DEVMEM_DONTNEED setsockopt to release RX frags

Helge Deller
2023-12-28T08:46:05Z

Hi Mina,

On 12/18/23 03:40, Mina Almasry wrote:
> Add an interface for the user to notify the kernel that it is done
> reading the devmem dmabuf frags returned as cmsg. The kernel will
> drop the reference on the frags to make them available for re-use.
>
> Signed-off-by: Willem de Bruijn <willemb@google.com>
> Signed-off-by: Kaiyuan Zhang <kaiyuanz@google.com>
> Signed-off-by: Mina Almasry <almasrymina@google.com>
>
> ---
>
> Changes in v1:
> - devmemtoken -> dmabuf_token (David).
> - Use napi_pp_put_page() for refcounting (Yunsheng).
> - Fix build error with missing socket options on other asms.
>
> ---
> arch/alpha/include/uapi/asm/socket.h | 8 ++++-
> arch/mips/include/uapi/asm/socket.h | 6 ++++
> arch/parisc/include/uapi/asm/socket.h | 6 ++++
> arch/sparc/include/uapi/asm/socket.h | 6 ++++
> include/uapi/asm-generic/socket.h | 1 +
> include/uapi/linux/uio.h | 4 +++
> net/core/sock.c | 45 +++++++++++++++++++++++++++
> 7 files changed, 75 insertions(+), 1 deletion(-)
>
...
> diff --git a/arch/parisc/include/uapi/asm/socket.h b/arch/parisc/include/uapi/asm/socket.h
> index be264c2b1a11..6b8674399363 100644
> --- a/arch/parisc/include/uapi/asm/socket.h
> +++ b/arch/parisc/include/uapi/asm/socket.h
> @@ -132,6 +132,12 @@
> #define SO_PASSPIDFD 0x404A
> #define SO_PEERPIDFD 0x404B
>
> +#define SO_DEVMEM_DONTNEED 0x404C
> +#define SO_DEVMEM_LINEAR 0x404D
> +#define SCM_DEVMEM_LINEAR SO_DEVMEM_LINEAR
> +#define SO_DEVMEM_DMABUF 0x404E
> +#define SCM_DEVMEM_DMABUF SO_DEVMEM_DMABUF

Could you please change this ^^ for parisc to use the same constants as
the generic version below (97-99).
Although 0x404c is the logical successor, I'd prefer to be in sync
with other generic code if possible...

Thanks!
Helge

...

> diff --git a/include/uapi/asm-generic/socket.h b/include/uapi/asm-generic/socket.h
> index 25a2f5255f52..1acb77780f10 100644
> --- a/include/uapi/asm-generic/socket.h
> +++ b/include/uapi/asm-generic/socket.h
> @@ -135,6 +135,7 @@
> #define SO_PASSPIDFD 76
> #define SO_PEERPIDFD 77
>
> +#define SO_DEVMEM_DONTNEED 97
> #define SO_DEVMEM_LINEAR 98
> #define SCM_DEVMEM_LINEAR SO_DEVMEM_LINEAR
> #define SO_DEVMEM_DMABUF 99