From: George Spelvin <lkml@sdf.org>
To: michael.chan@broadcom.com, netdev@vger.kernel.org
Cc: hauke@hauke-m.de, lkml@sdf.org
Subject: [RFC PATCH 1/4] b44: Add DMA_ATTR_NO_WARN to dma_map_single attempts
Date: Sun, 8 Dec 2019 08:35:07 GMT [thread overview]
Message-ID: <201912080835.xB88Z74s014619@sdf.org> (raw)
The b44 family of fast ethernet chips have a hardware bug limiting
DMA to the low 30 bits of address space. The driver implements its
own bouncing through ZONE_DMA if buffers are outside this range,
but not before the DMA layer tries the SWIOTLB driver for help.
The latter is designed only for helping devices with a 32-bit DMA
restriction, is not even initialized on machines with < 4GB of RAM,
and proceeds to spam the log with:
b44 0000:02:00.0: swiotlb buffer is full (sz: 66 bytes), total 0 (slots), used 0 (slots)
b44 0000:02:00.0: swiotlb buffer is full (sz: 72 bytes), total 0 (slots), used 0 (slots)
b44 0000:02:00.0: swiotlb buffer is full (sz: 401 bytes), total 0 (slots), used 0 (slots)
swiotlb_tbl_map_single: 7 callbacks suppressed
b44 0000:02:00.0: swiotlb buffer is full (sz: 90 bytes), total 0 (slots), used 0 (slots)
b44 0000:02:00.0: swiotlb buffer is full (sz: 74 bytes), total 0 (slots), used 0 (slots)
b44 0000:02:00.0: swiotlb buffer is full (sz: 74 bytes), total 0 (slots), used 0 (slots)
b44 0000:02:00.0: swiotlb buffer is full (sz: 74 bytes), total 0 (slots), used 0 (slots)
b44 0000:02:00.0: swiotlb buffer is full (sz: 66 bytes), total 0 (slots), used 0 (slots)
b44 0000:02:00.0: swiotlb buffer is full (sz: 426 bytes), total 0 (slots), used 0 (slots)
DMA_ATTR_NO_WARN on the first (non-ZONE_DMA) attempt turns off this
repeated complaint.
There still is a remaining bug: kernel/dma/direct.c:report_addr() throws
a WARN_ON_ONCE the first time this happens. I'm less certain how to fix
that, but it's less annoying.
Signed-off-by: George Spelvin <lkml@sdf.org>
---
drivers/net/ethernet/broadcom/b44.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
This is the only substantive patch in the series. The other three are
relatively minor issues that I ran into while studying the surrounding
code. (Although #3/4 actually fixes a resource leak.)
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
index 97ab0dd25552..394671230c1c 100644
--- a/drivers/net/ethernet/broadcom/b44.c
+++ b/drivers/net/ethernet/broadcom/b44.c
@@ -674,9 +674,9 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked)
if (skb == NULL)
return -ENOMEM;
- mapping = dma_map_single(bp->sdev->dma_dev, skb->data,
- RX_PKT_BUF_SZ,
- DMA_FROM_DEVICE);
+ mapping = dma_map_single_attrs(bp->sdev->dma_dev, skb->data,
+ RX_PKT_BUF_SZ, DMA_FROM_DEVICE,
+ DMA_ATTR_NO_WARN);
/* Hardware bug work-around, the chip is unable to do PCI DMA
to/from anything above 1GB :-( */
@@ -988,7 +988,8 @@ static netdev_tx_t b44_start_xmit(struct sk_buff *skb, struct net_device *dev)
goto err_out;
}
- mapping = dma_map_single(bp->sdev->dma_dev, skb->data, len, DMA_TO_DEVICE);
+ mapping = dma_map_single_attrs(bp->sdev->dma_dev, skb->data, len,
+ DMA_TO_DEVICE, DMA_ATTR_NO_WARN);
if (dma_mapping_error(bp->sdev->dma_dev, mapping) || mapping + len > DMA_BIT_MASK(30)) {
struct sk_buff *bounce_skb;
--
2.24.0
reply other threads:[~2019-12-08 8:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=201912080835.xB88Z74s014619@sdf.org \
--to=lkml@sdf.org \
--cc=hauke@hauke-m.de \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).