Re: [RFC PATCH v3 10/12] tcp: RX path for devmem TCP

From: Edward Cree
Date: Wed Nov 08 2023 - 10:36:12 EST


On 06/11/2023 21:17, Stanislav Fomichev wrote:
> I guess I'm just wondering whether other people have any suggestions
> here. Not sure Jonathan's way was better, but we fundamentally
> have two queues between the kernel and the userspace:
> - userspace receiving tokens (recvmsg + magical flag)
> - userspace refilling tokens (setsockopt + magical flag)
>
> So having some kind of shared memory producer-consumer queue feels natural.
> And using 'classic' socket api here feels like a stretch, idk.

Do 'refilled tokens' (returned memory areas) get used for anything other
than subsequent RX? If not then surely the way to return a memory area
in an io_uring idiom is just to post a new read sqe ('RX descriptor')
pointing into it, rather than explicitly returning it with setsockopt.
(Being async means you can post lots of these, unlike recvmsg(), so you
don't need any kernel management to keep the RX queue filled; it can
just be all handled by the userland thus simplifying APIs overall.)
Or I'm misunderstanding something?

-e