Re: [PATCH net-next 2/3] net: devmem: use memory provider helpers for net_iovs
From: Pavel Begunkov
Date: Sun Sep 27 2026 - 14:14:01 EST
On 9/22/26 21:43, Stanislav Fomichev wrote:
Use public memory-provider helpers for DMA address storage and page-pool
association instead of open-coding page_pool state and accounting.
Zero the net_iov array because net_mp_niov_set_page_pool() ORs
PP_SIGNATURE into pp_magic. Reject DMA addresses that cannot be
represented in net_iov metadata.
Reviewed-by: Pavel Begunkov <asml.silence@xxxxxxxxx>
@@ -247,7 +245,7 @@ net_devmem_bind_dmabuf(struct net_device *dev, void *vdev,
goto err_unmap;
}
}
- binding->area.niovs = kvmalloc_objs(*binding->area.niovs,
+ binding->area.niovs = kvzalloc_objs(*binding->area.niovs,
binding->area.num_niovs);
if (!binding->area.niovs) {
err = -ENOMEM;
@@ -274,8 +272,12 @@ net_devmem_bind_dmabuf(struct net_device *dev, void *vdev,
for (i = 0; i < nr_niovs; i++, niov_idx++) {
niov = &binding->area.niovs[niov_idx];
net_iov_init(niov, &binding->area, NET_IOV_DMABUF);
- page_pool_set_dma_addr_netmem(net_iov_to_netmem(niov),
- dma_addr);
+ if (net_mp_niov_set_dma_addr(niov, dma_addr)) {
I'd do this chunk as a separate patch with stable+fix tags to
keep it minimal and help backporting, e.g.
if (page_pool_set_dma_addr_netmem())
// fail;
Looks like the bot was saying the same (with an extra wall of text),
but I guess it depends on whether you need it backported.
+ err = -EFAULT;--
+ NL_SET_ERR_MSG(extack,
+ "dmabuf DMA address cannot be represented");
+ goto err_free_niovs;
+ }
if (direction == DMA_TO_DEVICE)
binding->tx_vec[niov_idx] = niov;
Pavel Begunkov