b44: Add DMA_ATTR_NO_WARN to dma_map_single attempts
Subsystems (3)
RFC PATCH 1/4 b44: Add DMA_ATTR_NO_WARN to dma_map_single attempts
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.
--- 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.)
drivers/net/ethernet/broadcom/b44.c +5 -4
@@ -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;
Signature · 1 line
2.24.0