diff mbox series

[net-next,1/2] xsk: Remove non-zero 'dma_page' check in xp_assign_dev

Message ID 1706089058-1364-1-git-send-email-wangyunjian@huawei.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series tun: AF_XDP Rx zero-copy support | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1079 this patch: 1079
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 0 of 0 maintainers
netdev/build_clang success Errors and warnings before: 1096 this patch: 1096
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1097 this patch: 1097
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 16 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

wangyunjian Jan. 24, 2024, 9:37 a.m. UTC
Now dma mappings are used by the physical NICs. However the vNIC
maybe do not need them. So remove non-zero 'dma_page' check in
xp_assign_dev.

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 net/xdp/xsk_buff_pool.c | 7 -------
 1 file changed, 7 deletions(-)

Comments

Xuan Zhuo Feb. 21, 2024, 9:52 a.m. UTC | #1
On Wed, 24 Jan 2024 17:37:38 +0800, Yunjian Wang <wangyunjian@huawei.com> wrote:
> Now dma mappings are used by the physical NICs. However the vNIC
> maybe do not need them. So remove non-zero 'dma_page' check in
> xp_assign_dev.

Could you tell me which one nic can work with AF_XDP without DMA?

Thanks.


>
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> ---
>  net/xdp/xsk_buff_pool.c | 7 -------
>  1 file changed, 7 deletions(-)
>
> diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c
> index 28711cc44ced..939b6e7b59ff 100644
> --- a/net/xdp/xsk_buff_pool.c
> +++ b/net/xdp/xsk_buff_pool.c
> @@ -219,16 +219,9 @@ int xp_assign_dev(struct xsk_buff_pool *pool,
>  	if (err)
>  		goto err_unreg_pool;
>
> -	if (!pool->dma_pages) {
> -		WARN(1, "Driver did not DMA map zero-copy buffers");
> -		err = -EINVAL;
> -		goto err_unreg_xsk;
> -	}
>  	pool->umem->zc = true;
>  	return 0;
>
> -err_unreg_xsk:
> -	xp_disable_drv_zc(pool);
>  err_unreg_pool:
>  	if (!force_zc)
>  		err = 0; /* fallback to copy mode */
> --
> 2.33.0
>
>
wangyunjian Feb. 21, 2024, 11:37 a.m. UTC | #2
> -----Original Message-----
> From: Xuan Zhuo [mailto:xuanzhuo@linux.alibaba.com]
> Sent: Wednesday, February 21, 2024 5:53 PM
> To: wangyunjian <wangyunjian@huawei.com>
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org;
> kvm@vger.kernel.org; virtualization@lists.linux.dev; xudingke
> <xudingke@huawei.com>; wangyunjian <wangyunjian@huawei.com>;
> mst@redhat.com; willemdebruijn.kernel@gmail.com; jasowang@redhat.com;
> kuba@kernel.org; davem@davemloft.net; magnus.karlsson@intel.com
> Subject: Re: [PATCH net-next 1/2] xsk: Remove non-zero 'dma_page' check in
> xp_assign_dev
> 
> On Wed, 24 Jan 2024 17:37:38 +0800, Yunjian Wang
> <wangyunjian@huawei.com> wrote:
> > Now dma mappings are used by the physical NICs. However the vNIC maybe
> > do not need them. So remove non-zero 'dma_page' check in
> > xp_assign_dev.
> 
> Could you tell me which one nic can work with AF_XDP without DMA?

TUN will support AF_XDP Tx zero-copy, which does not require DMA mappings.

Thanks

> 
> Thanks.
> 
> 
> >
> > Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> > ---
> >  net/xdp/xsk_buff_pool.c | 7 -------
> >  1 file changed, 7 deletions(-)
> >
> > diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c index
> > 28711cc44ced..939b6e7b59ff 100644
> > --- a/net/xdp/xsk_buff_pool.c
> > +++ b/net/xdp/xsk_buff_pool.c
> > @@ -219,16 +219,9 @@ int xp_assign_dev(struct xsk_buff_pool *pool,
> >  	if (err)
> >  		goto err_unreg_pool;
> >
> > -	if (!pool->dma_pages) {
> > -		WARN(1, "Driver did not DMA map zero-copy buffers");
> > -		err = -EINVAL;
> > -		goto err_unreg_xsk;
> > -	}
> >  	pool->umem->zc = true;
> >  	return 0;
> >
> > -err_unreg_xsk:
> > -	xp_disable_drv_zc(pool);
> >  err_unreg_pool:
> >  	if (!force_zc)
> >  		err = 0; /* fallback to copy mode */
> > --
> > 2.33.0
> >
> >
Xuan Zhuo Feb. 21, 2024, 11:39 a.m. UTC | #3
On Wed, 21 Feb 2024 11:37:22 +0000, wangyunjian <wangyunjian@huawei.com> wrote:
> > -----Original Message-----
> > From: Xuan Zhuo [mailto:xuanzhuo@linux.alibaba.com]
> > Sent: Wednesday, February 21, 2024 5:53 PM
> > To: wangyunjian <wangyunjian@huawei.com>
> > Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org;
> > kvm@vger.kernel.org; virtualization@lists.linux.dev; xudingke
> > <xudingke@huawei.com>; wangyunjian <wangyunjian@huawei.com>;
> > mst@redhat.com; willemdebruijn.kernel@gmail.com; jasowang@redhat.com;
> > kuba@kernel.org; davem@davemloft.net; magnus.karlsson@intel.com
> > Subject: Re: [PATCH net-next 1/2] xsk: Remove non-zero 'dma_page' check in
> > xp_assign_dev
> >
> > On Wed, 24 Jan 2024 17:37:38 +0800, Yunjian Wang
> > <wangyunjian@huawei.com> wrote:
> > > Now dma mappings are used by the physical NICs. However the vNIC maybe
> > > do not need them. So remove non-zero 'dma_page' check in
> > > xp_assign_dev.
> >
> > Could you tell me which one nic can work with AF_XDP without DMA?
>
> TUN will support AF_XDP Tx zero-copy, which does not require DMA mappings.


Great. Though I do not know how it works, but I think a new option or feature
is better.

Thanks.


>
> Thanks
>
> >
> > Thanks.
> >
> >
> > >
> > > Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> > > ---
> > >  net/xdp/xsk_buff_pool.c | 7 -------
> > >  1 file changed, 7 deletions(-)
> > >
> > > diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c index
> > > 28711cc44ced..939b6e7b59ff 100644
> > > --- a/net/xdp/xsk_buff_pool.c
> > > +++ b/net/xdp/xsk_buff_pool.c
> > > @@ -219,16 +219,9 @@ int xp_assign_dev(struct xsk_buff_pool *pool,
> > >  	if (err)
> > >  		goto err_unreg_pool;
> > >
> > > -	if (!pool->dma_pages) {
> > > -		WARN(1, "Driver did not DMA map zero-copy buffers");
> > > -		err = -EINVAL;
> > > -		goto err_unreg_xsk;
> > > -	}
> > >  	pool->umem->zc = true;
> > >  	return 0;
> > >
> > > -err_unreg_xsk:
> > > -	xp_disable_drv_zc(pool);
> > >  err_unreg_pool:
> > >  	if (!force_zc)
> > >  		err = 0; /* fallback to copy mode */
> > > --
> > > 2.33.0
> > >
> > >
diff mbox series

Patch

diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c
index 28711cc44ced..939b6e7b59ff 100644
--- a/net/xdp/xsk_buff_pool.c
+++ b/net/xdp/xsk_buff_pool.c
@@ -219,16 +219,9 @@  int xp_assign_dev(struct xsk_buff_pool *pool,
 	if (err)
 		goto err_unreg_pool;
 
-	if (!pool->dma_pages) {
-		WARN(1, "Driver did not DMA map zero-copy buffers");
-		err = -EINVAL;
-		goto err_unreg_xsk;
-	}
 	pool->umem->zc = true;
 	return 0;
 
-err_unreg_xsk:
-	xp_disable_drv_zc(pool);
 err_unreg_pool:
 	if (!force_zc)
 		err = 0; /* fallback to copy mode */