[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231213074912.1275130-1-yinjun.zhang@corigine.com>
Date: Wed, 13 Dec 2023 15:49:12 +0800
From: Yinjun Zhang <yinjun.zhang@...igine.com>
To: almasrymina@...gle.com
Cc: arnd@...db.de,
bpf@...r.kernel.org,
christian.koenig@....com,
corbet@....net,
davem@...emloft.net,
dri-devel@...ts.freedesktop.org,
dsahern@...nel.org,
edumazet@...gle.com,
hawk@...nel.org,
hramamurthy@...gle.com,
ilias.apalodimas@...aro.org,
jeroendb@...gle.com,
kaiyuanz@...gle.com,
kuba@...nel.org,
linux-arch@...r.kernel.org,
linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org,
linux-media@...r.kernel.org,
linyunsheng@...wei.com,
netdev@...r.kernel.org,
pabeni@...hat.com,
pkaligineedi@...gle.com,
shailend@...gle.com,
shakeelb@...gle.com,
shuah@...nel.org,
sumit.semwal@...aro.org,
willemb@...gle.com,
willemdebruijn.kernel@...il.com
Subject: Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider
On Thu, 7 Dec 2023 16:52:39 -0800, Mina Almasry wrote:
<...>
> +static int mp_dmabuf_devmem_init(struct page_pool *pool)
> +{
> + struct netdev_dmabuf_binding *binding = pool->mp_priv;
> +
> + if (!binding)
> + return -EINVAL;
> +
> + if (!(pool->p.flags & PP_FLAG_DMA_MAP))
> + return -EOPNOTSUPP;
> +
> + if (pool->p.flags & PP_FLAG_DMA_SYNC_DEV)
> + return -EOPNOTSUPP;
> +
> + netdev_dmabuf_binding_get(binding);
> + return 0;
> +}
> +
> +static struct page *mp_dmabuf_devmem_alloc_pages(struct page_pool *pool,
> + gfp_t gfp)
> +{
> + struct netdev_dmabuf_binding *binding = pool->mp_priv;
> + struct page_pool_iov *ppiov;
> +
> + ppiov = netdev_alloc_dmabuf(binding);
Since it only supports one-page allocation, we'd better add a check in
`ops->init()` that `pool->p.order` must be 0.
> + if (!ppiov)
> + return NULL;
> +
> + ppiov->pp = pool;
> + pool->pages_state_hold_cnt++;
> + trace_page_pool_state_hold(pool, (struct page *)ppiov,
> + pool->pages_state_hold_cnt);
> + return (struct page *)((unsigned long)ppiov | PP_IOV);
> +}
<...>
Powered by blists - more mailing lists