[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250528060416.GD9346@system.software.com>
Date: Wed, 28 May 2025 15:04:16 +0900
From: Byungchul Park <byungchul@...com>
To: Mina Almasry <almasrymina@...gle.com>
Cc: willy@...radead.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
kernel_team@...ynix.com, kuba@...nel.org,
ilias.apalodimas@...aro.org, harry.yoo@...cle.com, hawk@...nel.org,
akpm@...ux-foundation.org, davem@...emloft.net,
john.fastabend@...il.com, andrew+netdev@...n.ch,
asml.silence@...il.com, toke@...hat.com, tariqt@...dia.com,
edumazet@...gle.com, pabeni@...hat.com, saeedm@...dia.com,
leon@...nel.org, ast@...nel.org, daniel@...earbox.net,
david@...hat.com, lorenzo.stoakes@...cle.com,
Liam.Howlett@...cle.com, vbabka@...e.cz, rppt@...nel.org,
surenb@...gle.com, mhocko@...e.com, horms@...nel.org,
linux-rdma@...r.kernel.org, bpf@...r.kernel.org,
vishal.moola@...il.com
Subject: Re: [PATCH v2 15/16] netdevsim: use netmem descriptor and APIs for
page pool
On Tue, May 27, 2025 at 08:25:54PM -0700, Mina Almasry wrote:
> On Tue, May 27, 2025 at 7:29 PM Byungchul Park <byungchul@...com> wrote:
> >
> > To simplify struct page, the effort to separate its own descriptor from
> > struct page is required and the work for page pool is on going.
> >
> > Use netmem descriptor and APIs for page pool in netdevsim code.
> >
> > Signed-off-by: Byungchul Park <byungchul@...com>
> > ---
> > drivers/net/netdevsim/netdev.c | 19 ++++++++++---------
> > drivers/net/netdevsim/netdevsim.h | 2 +-
> > 2 files changed, 11 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
> > index af545d42961c..d134a6195bfa 100644
> > --- a/drivers/net/netdevsim/netdev.c
> > +++ b/drivers/net/netdevsim/netdev.c
> > @@ -821,7 +821,7 @@ nsim_pp_hold_read(struct file *file, char __user *data,
> > struct netdevsim *ns = file->private_data;
> > char buf[3] = "n\n";
> >
> > - if (ns->page)
> > + if (ns->netmem)
> > buf[0] = 'y';
> >
> > return simple_read_from_buffer(data, count, ppos, buf, 2);
> > @@ -841,18 +841,19 @@ nsim_pp_hold_write(struct file *file, const char __user *data,
> >
> > rtnl_lock();
> > ret = count;
> > - if (val == !!ns->page)
> > + if (val == !!ns->netmem)
> > goto exit;
> >
> > if (!netif_running(ns->netdev) && val) {
> > ret = -ENETDOWN;
> > } else if (val) {
> > - ns->page = page_pool_dev_alloc_pages(ns->rq[0]->page_pool);
> > - if (!ns->page)
> > + ns->netmem = page_pool_alloc_netmems(ns->rq[0]->page_pool,
> > + GFP_ATOMIC | __GFP_NOWARN);
>
> Can we add a page_pool_dev_alloc_netmems instead of doing this GFP at
> the callsite? Other drivers will be interested in using
> _dev_alloc_netmems as well.
Sounds good. I can add it tho, however, Tariq Toukan might also need
the API while working on converting to netmem in mlx5.
Since I will re-work on his work done, why don't we ask him to add the
API so that he, I, and any other drivers can use it?
+cc tariqt@...dia.com
Byungchul
>
> --
> Thanks,
> Mina
Powered by blists - more mailing lists