lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YvZ8NwzGV/9QDInR@lunn.ch>
Date:   Fri, 12 Aug 2022 18:13:43 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Sergei Antonov <saproj@...il.com>
Cc:     netdev@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>,
        Pavel Skripkin <paskripkin@...il.com>,
        "David S . Miller" <davem@...emloft.net>,
        Guobin Huang <huangguobin4@...wei.com>,
        Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH] net: moxa: inherit DMA masks to make dma_map_single()
 work

On Fri, Aug 12, 2022 at 06:48:20PM +0300, Sergei Antonov wrote:
> dma_map_single() calls fail in moxart_mac_setup_desc_ring() and
> moxart_mac_start_xmit() which leads to an incessant output of this:
> 
> [   16.043925] moxart-ethernet 92000000.mac eth0: DMA mapping error
> [   16.050957] moxart-ethernet 92000000.mac eth0: DMA mapping error
> [   16.058229] moxart-ethernet 92000000.mac eth0: DMA mapping error
> 
> To make dma_map_single() work, inherit DMA masks from the platform device.
> 
> Signed-off-by: Sergei Antonov <saproj@...il.com>
> CC: Jakub Kicinski <kuba@...nel.org>
> CC: Pavel Skripkin <paskripkin@...il.com>
> CC: David S. Miller <davem@...emloft.net>
> CC: Guobin Huang <huangguobin4@...wei.com>
> CC: Paolo Abeni <pabeni@...hat.com>
> ---
>  drivers/net/ethernet/moxa/moxart_ether.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c
> index a3214a762e4b..de99211d85c2 100644
> --- a/drivers/net/ethernet/moxa/moxart_ether.c
> +++ b/drivers/net/ethernet/moxa/moxart_ether.c
> @@ -537,6 +537,10 @@ static int moxart_mac_probe(struct platform_device *pdev)
>  	ndev->priv_flags |= IFF_UNICAST_FLT;
>  	ndev->irq = irq;
>  
> +	/* Inherit the DMA masks from the platform device */
> +	ndev->dev.dma_mask = p_dev->dma_mask;
> +	ndev->dev.coherent_dma_mask = p_dev->coherent_dma_mask;

There is only one other ethernet driver which does this. What you see
much more often is:

alacritech/slicoss.c:	paddr = dma_map_single(&sdev->pdev->dev, skb->data, maplen,
neterion/s2io.c:				dma_map_single(&sp->pdev->dev, ba->ba_1,
dlink/dl2k.c:			    cpu_to_le64(dma_map_single(&np->pdev->dev, skb->data,
micrel/ksz884x.c:		dma_buf->dma = dma_map_single(&hw_priv->pdev->dev, skb->data,

	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ