Re: [PATCH v1 05/15] net: prepare for non devmem TCP memory providers

Pavel Begunkov
2024-10-13T22:32:59Z

On 10/9/24 22:45, Pavel Begunkov wrote:
> On 10/9/24 21:56, Mina Almasry wrote:
>> On Mon, Oct 7, 2024 at 3:16 PM David Wei <dw@davidwei.uk> wrote:
>>>
>>> From: Pavel Begunkov <asml.silence@gmail.com>
>>>
>>> There is a good bunch of places in generic paths assuming that the only
>>> page pool memory provider is devmem TCP. As we want to reuse the net_iov
>>> and provider infrastructure, we need to patch it up and explicitly check
>>> the provider type when we branch into devmem TCP code.
>>>
>>> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
>>> Signed-off-by: David Wei <dw@davidwei.uk>
>>> ---
>>>   net/core/devmem.c         |  4 ++--
>>>   net/core/page_pool_user.c | 15 +++++++++------
>>>   net/ipv4/tcp.c            |  6 ++++++
>>>   3 files changed, 17 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/net/core/devmem.c b/net/core/devmem.c
>>> index 83d13eb441b6..b0733cf42505 100644
>>> --- a/net/core/devmem.c
>>> +++ b/net/core/devmem.c
>>> @@ -314,10 +314,10 @@ void dev_dmabuf_uninstall(struct net_device *dev)
>>>          unsigned int i;
>>>
>>>          for (i = 0; i < dev->real_num_rx_queues; i++) {
>>> -               binding = dev->_rx[i].mp_params.mp_priv;
>>> -               if (!binding)
>>> +               if (dev->_rx[i].mp_params.mp_ops != &dmabuf_devmem_ops)
>>>                          continue;
>>>
>>
>> Sorry if I missed it (and please ignore me if I did), but
>> dmabuf_devmem_ops are maybe not defined yet?
>
> You exported it in devmem.h

A correction, this patchset exposed it before. This place is
fine, but I'll wrap it around into a function since it causes
compilation problems in other places for some configurations.

>> I'm also wondering how to find all the annyoing places where we need
>> to check this. Looks like maybe a grep for net_devmem_dmabuf_binding
>> is the way to go? I need to check whether these are all the places we
>> need the check but so far looks fine.
>
> I whac-a-mole'd them the best I can following recent devmem TCP
> changes. Would be great if you take a look and might remember
> some more places to check. And thanks for the review!
>

--
Pavel Begunkov