Netdev List
 help / color / mirror / Atom feed
From: Sergei Antonov <saproj@gmail.com>
To: netdev@vger.kernel.org
Cc: Sergei Antonov <saproj@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Pavel Skripkin <paskripkin@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Guobin Huang <huangguobin4@huawei.com>,
	Paolo Abeni <pabeni@redhat.com>
Subject: [PATCH] net: moxa: inherit DMA masks to make dma_map_single() work
Date: Fri, 12 Aug 2022 18:48:20 +0300	[thread overview]
Message-ID: <20220812154820.2225457-1-saproj@gmail.com> (raw)

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@gmail.com>
CC: Jakub Kicinski <kuba@kernel.org>
CC: Pavel Skripkin <paskripkin@gmail.com>
CC: David S. Miller <davem@davemloft.net>
CC: Guobin Huang <huangguobin4@huawei.com>
CC: Paolo Abeni <pabeni@redhat.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;
+
 	SET_NETDEV_DEV(ndev, &pdev->dev);
 
 	ret = register_netdev(ndev);
-- 
2.32.0


             reply	other threads:[~2022-08-12 15:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-12 15:48 Sergei Antonov [this message]
2022-08-12 16:13 ` [PATCH] net: moxa: inherit DMA masks to make dma_map_single() work Andrew Lunn
2022-08-12 16:35   ` Sergei Antonov
2022-08-12 16:38     ` Andrew Lunn
2022-08-12 16:58       ` Florian Fainelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220812154820.2225457-1-saproj@gmail.com \
    --to=saproj@gmail.com \
    --cc=davem@davemloft.net \
    --cc=huangguobin4@huawei.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=paskripkin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox