[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHS8izOJVRu=qvsqZyXERKxA-fcqGuNVfiVsXsszQYAjD4d00g@mail.gmail.com>
Date: Wed, 28 May 2025 09:59:14 -0700
From: Mina Almasry <almasrymina@...gle.com>
To: Toke Høiland-Jørgensen <toke@...hat.com>
Cc: Byungchul Park <byungchul@...com>, 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,
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 16/16] mt76: use netmem descriptor and APIs for page pool
On Wed, May 28, 2025 at 12:34 AM Toke Høiland-Jørgensen <toke@...hat.com> wrote:
>
> Byungchul Park <byungchul@...com> writes:
>
> > On Wed, May 28, 2025 at 11:29:11AM +0900, Byungchul Park 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 mt76 code.
> >>
> >> Signed-off-by: Byungchul Park <byungchul@...com>
> >> ---
> >> drivers/net/wireless/mediatek/mt76/dma.c | 6 ++---
> >> drivers/net/wireless/mediatek/mt76/mt76.h | 12 +++++-----
> >> .../net/wireless/mediatek/mt76/sdio_txrx.c | 24 +++++++++----------
> >> drivers/net/wireless/mediatek/mt76/usb.c | 10 ++++----
> >> 4 files changed, 26 insertions(+), 26 deletions(-)
> >>
> >> diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c
> >> index 35b4ec91979e..cceff435ec4a 100644
> >> --- a/drivers/net/wireless/mediatek/mt76/dma.c
> >> +++ b/drivers/net/wireless/mediatek/mt76/dma.c
> >> @@ -820,10 +820,10 @@ mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data,
> >> int nr_frags = shinfo->nr_frags;
> >>
> >> if (nr_frags < ARRAY_SIZE(shinfo->frags)) {
> >> - struct page *page = virt_to_head_page(data);
> >> - int offset = data - page_address(page) + q->buf_offset;
> >> + netmem_ref netmem = netmem_compound_head(virt_to_netmem(data));
> >> + int offset = data - netmem_address(netmem) + q->buf_offset;
> >>
> >> - skb_add_rx_frag(skb, nr_frags, page, offset, len, q->buf_size);
> >> + skb_add_rx_frag_netmem(skb, nr_frags, netmem, offset, len, q->buf_size);
> >> } else {
> >> mt76_put_page_pool_buf(data, allow_direct);
> >> }
> >> diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
> >> index 5f8d81cda6cd..f075c1816554 100644
> >> --- a/drivers/net/wireless/mediatek/mt76/mt76.h
> >> +++ b/drivers/net/wireless/mediatek/mt76/mt76.h
> >> @@ -1795,21 +1795,21 @@ int mt76_rx_token_consume(struct mt76_dev *dev, void *ptr,
> >> int mt76_create_page_pool(struct mt76_dev *dev, struct mt76_queue *q);
> >> static inline void mt76_put_page_pool_buf(void *buf, bool allow_direct)
> >> {
> >> - struct page *page = virt_to_head_page(buf);
> >> + netmem_ref netmem = netmem_compound_head(virt_to_netmem(buf));
> >>
> >> - page_pool_put_full_page(page->pp, page, allow_direct);
> >
> > To Mina,
> >
> > They touch ->pp field. That's why I thought they use page pool. Am I
> > missing something?
>
> It does, since commit: 2f5c3c77fc9b ("wifi: mt76: switch to page_pool allocator")
>
I am very sorry, I was clearly hallucinating when I first looked at
this. In my defence it was kinda late at night in my time zone :-D
Since this driver supports page_pool, I think it's reasonable to
convert it to netmem. It may not be intreseted in supporting devmem or
io_uring zcrx but there may be more netmem features in the future and
future proofing it sounds good to me.
Reviewed-by: Mina Almasry <almasrymina@...gle.com>
(although I would like to see a virt_to_head_netmem helper FWIW).
--
Thanks,
Mina
Powered by blists - more mailing lists