Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-10 Thread Jakub Kicinski
On Tue, 7 Nov 2023 11:53:22 -0800 Mina Almasry wrote: > My bad on not including some docs about this. The next version should > have the commit message beefed up to explain all this, or a docs > patch. Yes, please. Would be great to have the user facing interface well explained under

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-10 Thread Jakub Kicinski
On Tue, 7 Nov 2023 14:23:20 -0800 Stanislav Fomichev wrote: > Can we mark a socket as devmem-only? Do we have any use-case for those > hybrid setups? Or, let me put it that way: do we expect API callers > to handle both linear and non-linear cases correctly? > As a consumer of the previous

RE: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-08 Thread David Laight
From: Mina Almasry > Sent: 06 November 2023 02:44 > > For device memory TCP, we expect the skb headers to be available in host > memory for access, and we expect the skb frags to be in device memory > and unaccessible to the host. We expect there to be no mixing and > matching of device memory

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-07 Thread Stanislav Fomichev
On 11/07, Eric Dumazet wrote: > On Tue, Nov 7, 2023 at 10:05 PM Stanislav Fomichev wrote: > > > > > I don't understand. We require an elaborate setup to receive devmem cmsgs, > > why would some random application receive those? > > > A TCP socket can receive 'valid TCP packets' from many

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-07 Thread Eric Dumazet
On Tue, Nov 7, 2023 at 10:05 PM Stanislav Fomichev wrote: > > I don't understand. We require an elaborate setup to receive devmem cmsgs, > why would some random application receive those? A TCP socket can receive 'valid TCP packets' from many different sources, especially with BPF hooks...

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-07 Thread Stanislav Fomichev
On 11/07, Mina Almasry wrote: > On Mon, Nov 6, 2023 at 5:06 PM Stanislav Fomichev wrote: > [..] > > > > > And the socket has to know this association; otherwise those tokens > > > > > are useless since they don't carry anything to identify the dmabuf. > > > > > > > > > > I think my other issue

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-07 Thread Mina Almasry
On Mon, Nov 6, 2023 at 5:06 PM Stanislav Fomichev wrote: [..] > > > > And the socket has to know this association; otherwise those tokens > > > > are useless since they don't carry anything to identify the dmabuf. > > > > > > > > I think my other issue with MSG_SOCK_DEVMEM being on recvmsg is

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-07 Thread Stanislav Fomichev
On 11/07, Willem de Bruijn wrote: > On Tue, Nov 7, 2023 at 12:44 PM Stanislav Fomichev wrote: > > > > On 11/06, Willem de Bruijn wrote: > > > > > > > I think my other issue with MSG_SOCK_DEVMEM being on recvmsg is > > > > > > > that > > > > > > > it somehow implies that I have an option of

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-07 Thread Willem de Bruijn
On Tue, Nov 7, 2023 at 12:44 PM Stanislav Fomichev wrote: > > On 11/06, Willem de Bruijn wrote: > > > > > > I think my other issue with MSG_SOCK_DEVMEM being on recvmsg is that > > > > > > it somehow implies that I have an option of passing or not passing > > > > > > it > > > > > > for an

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-07 Thread Stanislav Fomichev
On 11/06, Willem de Bruijn wrote: > > > > > I think my other issue with MSG_SOCK_DEVMEM being on recvmsg is that > > > > > it somehow implies that I have an option of passing or not passing it > > > > > for an individual system call. > > > > > If we know that we're going to use dmabuf with the

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread Willem de Bruijn
> > > > I think my other issue with MSG_SOCK_DEVMEM being on recvmsg is that > > > > it somehow implies that I have an option of passing or not passing it > > > > for an individual system call. > > > > If we know that we're going to use dmabuf with the socket, maybe we > > > > should move this

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread David Ahern
On 11/6/23 5:20 PM, Mina Almasry wrote: > The user is free to modify or delete flow steering rules outside of the > lifetime of the socket. Technically it's possible for the user to > reconfigure flow steering while the socket is simultaneously receiving, > and the result will be packets switching

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread Stanislav Fomichev
On 11/06, Mina Almasry wrote: > On Mon, Nov 6, 2023 at 4:08 PM Willem de Bruijn > wrote: > > > > On Mon, Nov 6, 2023 at 3:55 PM Stanislav Fomichev wrote: > > > > > > On Mon, Nov 6, 2023 at 3:27 PM Mina Almasry > > > wrote: > > > > > > > > On Mon, Nov 6, 2023 at 2:59 PM Stanislav Fomichev > >

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread Stanislav Fomichev
On 11/06, Stanislav Fomichev wrote: > On 11/06, Willem de Bruijn wrote: > > On Mon, Nov 6, 2023 at 3:55 PM Stanislav Fomichev wrote: > > > > > > On Mon, Nov 6, 2023 at 3:27 PM Mina Almasry > > > wrote: > > > > > > > > On Mon, Nov 6, 2023 at 2:59 PM Stanislav Fomichev > > > > wrote: > > > > >

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread Mina Almasry
On Mon, Nov 6, 2023 at 4:16 PM David Ahern wrote: > > On 11/5/23 7:44 PM, Mina Almasry wrote: > > diff --git a/net/core/datagram.c b/net/core/datagram.c > > index 176eb5834746..cdd4fb129968 100644 > > --- a/net/core/datagram.c > > +++ b/net/core/datagram.c > > @@ -425,6 +425,9 @@ static int

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread Mina Almasry
On Mon, Nov 6, 2023 at 4:08 PM Willem de Bruijn wrote: > > On Mon, Nov 6, 2023 at 3:55 PM Stanislav Fomichev wrote: > > > > On Mon, Nov 6, 2023 at 3:27 PM Mina Almasry wrote: > > > > > > On Mon, Nov 6, 2023 at 2:59 PM Stanislav Fomichev wrote: > > > > > > > > On 11/06, Mina Almasry wrote: > >

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread David Ahern
On 11/5/23 7:44 PM, Mina Almasry wrote: > diff --git a/net/core/datagram.c b/net/core/datagram.c > index 176eb5834746..cdd4fb129968 100644 > --- a/net/core/datagram.c > +++ b/net/core/datagram.c > @@ -425,6 +425,9 @@ static int __skb_datagram_iter(const struct sk_buff *skb, > int offset, >

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread Stanislav Fomichev
On 11/06, Willem de Bruijn wrote: > On Mon, Nov 6, 2023 at 3:55 PM Stanislav Fomichev wrote: > > > > On Mon, Nov 6, 2023 at 3:27 PM Mina Almasry wrote: > > > > > > On Mon, Nov 6, 2023 at 2:59 PM Stanislav Fomichev wrote: > > > > > > > > On 11/06, Mina Almasry wrote: > > > > > On Mon, Nov 6,

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread Willem de Bruijn
On Mon, Nov 6, 2023 at 3:55 PM Stanislav Fomichev wrote: > > On Mon, Nov 6, 2023 at 3:27 PM Mina Almasry wrote: > > > > On Mon, Nov 6, 2023 at 2:59 PM Stanislav Fomichev wrote: > > > > > > On 11/06, Mina Almasry wrote: > > > > On Mon, Nov 6, 2023 at 1:59 PM Stanislav Fomichev > > > > wrote: >

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread Mina Almasry
On Mon, Nov 6, 2023 at 3:37 PM David Ahern wrote: > > On 11/6/23 3:18 PM, Mina Almasry wrote: > >> @@ -991,7 +993,7 @@ struct sk_buff { > >> #if IS_ENABLED(CONFIG_IP_SCTP) > >> __u8csum_not_inet:1; > >> #endif > >> - > >> +__u8

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread Stanislav Fomichev
On Mon, Nov 6, 2023 at 3:27 PM Mina Almasry wrote: > > On Mon, Nov 6, 2023 at 2:59 PM Stanislav Fomichev wrote: > > > > On 11/06, Mina Almasry wrote: > > > On Mon, Nov 6, 2023 at 1:59 PM Stanislav Fomichev wrote: > > > > > > > > On 11/06, Mina Almasry wrote: > > > > > On Mon, Nov 6, 2023 at

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread David Ahern
On 11/6/23 3:18 PM, Mina Almasry wrote: >> @@ -991,7 +993,7 @@ struct sk_buff { >> #if IS_ENABLED(CONFIG_IP_SCTP) >> __u8csum_not_inet:1; >> #endif >> - >> +__u8devmem:1; >> #if defined(CONFIG_NET_SCHED) ||

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread Mina Almasry
On Mon, Nov 6, 2023 at 2:59 PM Stanislav Fomichev wrote: > > On 11/06, Mina Almasry wrote: > > On Mon, Nov 6, 2023 at 1:59 PM Stanislav Fomichev wrote: > > > > > > On 11/06, Mina Almasry wrote: > > > > On Mon, Nov 6, 2023 at 11:34 AM David Ahern wrote: > > > > > > > > > > On 11/6/23 11:47 AM,

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread Kaiyuan Zhang
> > But there is still always 1 dmabuf to 1 socket association (on rx), right? > In practice yes, but my understanding is that such association is only enforced by NIC features such as flow steering. So why not have a separate control channel action to say: this socket fd > is supposed to receive

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread Stanislav Fomichev
On 11/06, Mina Almasry wrote: > On Mon, Nov 6, 2023 at 1:59 PM Stanislav Fomichev wrote: > > > > On 11/06, Mina Almasry wrote: > > > On Mon, Nov 6, 2023 at 11:34 AM David Ahern wrote: > > > > > > > > On 11/6/23 11:47 AM, Stanislav Fomichev wrote: > > > > > On 11/05, Mina Almasry wrote: > > > >

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread Mina Almasry
On Mon, Nov 6, 2023 at 1:59 PM Stanislav Fomichev wrote: > > On 11/06, Mina Almasry wrote: > > On Mon, Nov 6, 2023 at 11:34 AM David Ahern wrote: > > > > > > On 11/6/23 11:47 AM, Stanislav Fomichev wrote: > > > > On 11/05, Mina Almasry wrote: > > > >> For device memory TCP, we expect the skb

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread Stanislav Fomichev
On 11/06, Mina Almasry wrote: > On Mon, Nov 6, 2023 at 11:34 AM David Ahern wrote: > > > > On 11/6/23 11:47 AM, Stanislav Fomichev wrote: > > > On 11/05, Mina Almasry wrote: > > >> For device memory TCP, we expect the skb headers to be available in host > > >> memory for access, and we expect the

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread Stanislav Fomichev
On 11/05, Mina Almasry wrote: > For device memory TCP, we expect the skb headers to be available in host > memory for access, and we expect the skb frags to be in device memory > and unaccessible to the host. We expect there to be no mixing and > matching of device memory frags (unaccessible) with

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread Mina Almasry
On Mon, Nov 6, 2023 at 11:34 AM David Ahern wrote: > > On 11/6/23 11:47 AM, Stanislav Fomichev wrote: > > On 11/05, Mina Almasry wrote: > >> For device memory TCP, we expect the skb headers to be available in host > >> memory for access, and we expect the skb frags to be in device memory > >> and

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread David Ahern
On 11/6/23 11:47 AM, Stanislav Fomichev wrote: > On 11/05, Mina Almasry wrote: >> For device memory TCP, we expect the skb headers to be available in host >> memory for access, and we expect the skb frags to be in device memory >> and unaccessible to the host. We expect there to be no mixing and

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread Stanislav Fomichev
On 11/05, Mina Almasry wrote: > For device memory TCP, we expect the skb headers to be available in host > memory for access, and we expect the skb frags to be in device memory > and unaccessible to the host. We expect there to be no mixing and > matching of device memory frags (unaccessible) with

[RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-05 Thread Mina Almasry
For device memory TCP, we expect the skb headers to be available in host memory for access, and we expect the skb frags to be in device memory and unaccessible to the host. We expect there to be no mixing and matching of device memory frags (unaccessible) with host memory frags (accessible) in the