* [PATCH] net: dont use __netdev_alloc_skb for bounce buffer
@ 2012-07-02 18:36 Eric Dumazet
2012-07-02 20:03 ` Stefan Bader
2012-07-09 6:52 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2012-07-02 18:36 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Stefan Bader
From: Eric Dumazet <edumazet@google.com>
commit a1c7fff7e1 (net: netdev_alloc_skb() use build_skb()) broke b44 on
some 64bit machines.
It appears b44 and b43 use __netdev_alloc_skb() instead of alloc_skb()
for their bounce buffers.
There is no need to add an extra NET_SKB_PAD reservation for bounce
buffers :
- In TX path, NET_SKB_PAD is useless
- In RX path in b44, we force a copy of incoming frames if
GFP_DMA allocations were needed.
Reported-and-bisected-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
drivers/net/ethernet/broadcom/b44.c | 4 ++--
drivers/net/wireless/b43legacy/dma.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
index 46b8b7d..d09c6b5 100644
--- a/drivers/net/ethernet/broadcom/b44.c
+++ b/drivers/net/ethernet/broadcom/b44.c
@@ -656,7 +656,7 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked)
dma_unmap_single(bp->sdev->dma_dev, mapping,
RX_PKT_BUF_SZ, DMA_FROM_DEVICE);
dev_kfree_skb_any(skb);
- skb = __netdev_alloc_skb(bp->dev, RX_PKT_BUF_SZ, GFP_ATOMIC|GFP_DMA);
+ skb = alloc_skb(RX_PKT_BUF_SZ, GFP_ATOMIC | GFP_DMA);
if (skb == NULL)
return -ENOMEM;
mapping = dma_map_single(bp->sdev->dma_dev, skb->data,
@@ -967,7 +967,7 @@ static netdev_tx_t b44_start_xmit(struct sk_buff *skb, struct net_device *dev)
dma_unmap_single(bp->sdev->dma_dev, mapping, len,
DMA_TO_DEVICE);
- bounce_skb = __netdev_alloc_skb(dev, len, GFP_ATOMIC | GFP_DMA);
+ bounce_skb = alloc_skb(len, GFP_ATOMIC | GFP_DMA);
if (!bounce_skb)
goto err_out;
diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c
index f1f8bd0..c8baf02 100644
--- a/drivers/net/wireless/b43legacy/dma.c
+++ b/drivers/net/wireless/b43legacy/dma.c
@@ -1072,7 +1072,7 @@ static int dma_tx_fragment(struct b43legacy_dmaring *ring,
meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
/* create a bounce buffer in zone_dma on mapping failure. */
if (b43legacy_dma_mapping_error(ring, meta->dmaaddr, skb->len, 1)) {
- bounce_skb = __dev_alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA);
+ bounce_skb = alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA);
if (!bounce_skb) {
ring->current_slot = old_top_slot;
ring->used_slots = old_used_slots;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: dont use __netdev_alloc_skb for bounce buffer
2012-07-02 18:36 [PATCH] net: dont use __netdev_alloc_skb for bounce buffer Eric Dumazet
@ 2012-07-02 20:03 ` Stefan Bader
2012-07-09 6:52 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Bader @ 2012-07-02 20:03 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev
[-- Attachment #1: Type: text/plain, Size: 2780 bytes --]
I can confirm that, with the below patch applied, at least the b44 regression is
fixed and network is usable again.
-Stefan
On 02.07.2012 20:36, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> commit a1c7fff7e1 (net: netdev_alloc_skb() use build_skb()) broke b44 on
> some 64bit machines.
>
> It appears b44 and b43 use __netdev_alloc_skb() instead of alloc_skb()
> for their bounce buffers.
>
> There is no need to add an extra NET_SKB_PAD reservation for bounce
> buffers :
>
> - In TX path, NET_SKB_PAD is useless
>
> - In RX path in b44, we force a copy of incoming frames if
> GFP_DMA allocations were needed.
>
> Reported-and-bisected-by: Stefan Bader <stefan.bader@canonical.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
> drivers/net/ethernet/broadcom/b44.c | 4 ++--
> drivers/net/wireless/b43legacy/dma.c | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
> index 46b8b7d..d09c6b5 100644
> --- a/drivers/net/ethernet/broadcom/b44.c
> +++ b/drivers/net/ethernet/broadcom/b44.c
> @@ -656,7 +656,7 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked)
> dma_unmap_single(bp->sdev->dma_dev, mapping,
> RX_PKT_BUF_SZ, DMA_FROM_DEVICE);
> dev_kfree_skb_any(skb);
> - skb = __netdev_alloc_skb(bp->dev, RX_PKT_BUF_SZ, GFP_ATOMIC|GFP_DMA);
> + skb = alloc_skb(RX_PKT_BUF_SZ, GFP_ATOMIC | GFP_DMA);
> if (skb == NULL)
> return -ENOMEM;
> mapping = dma_map_single(bp->sdev->dma_dev, skb->data,
> @@ -967,7 +967,7 @@ static netdev_tx_t b44_start_xmit(struct sk_buff *skb, struct net_device *dev)
> dma_unmap_single(bp->sdev->dma_dev, mapping, len,
> DMA_TO_DEVICE);
>
> - bounce_skb = __netdev_alloc_skb(dev, len, GFP_ATOMIC | GFP_DMA);
> + bounce_skb = alloc_skb(len, GFP_ATOMIC | GFP_DMA);
> if (!bounce_skb)
> goto err_out;
>
> diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c
> index f1f8bd0..c8baf02 100644
> --- a/drivers/net/wireless/b43legacy/dma.c
> +++ b/drivers/net/wireless/b43legacy/dma.c
> @@ -1072,7 +1072,7 @@ static int dma_tx_fragment(struct b43legacy_dmaring *ring,
> meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
> /* create a bounce buffer in zone_dma on mapping failure. */
> if (b43legacy_dma_mapping_error(ring, meta->dmaaddr, skb->len, 1)) {
> - bounce_skb = __dev_alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA);
> + bounce_skb = alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA);
> if (!bounce_skb) {
> ring->current_slot = old_top_slot;
> ring->used_slots = old_used_slots;
>
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 900 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: dont use __netdev_alloc_skb for bounce buffer
2012-07-02 18:36 [PATCH] net: dont use __netdev_alloc_skb for bounce buffer Eric Dumazet
2012-07-02 20:03 ` Stefan Bader
@ 2012-07-09 6:52 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2012-07-09 6:52 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev, stefan.bader
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 02 Jul 2012 20:36:12 +0200
> From: Eric Dumazet <edumazet@google.com>
>
> commit a1c7fff7e1 (net: netdev_alloc_skb() use build_skb()) broke b44 on
> some 64bit machines.
>
> It appears b44 and b43 use __netdev_alloc_skb() instead of alloc_skb()
> for their bounce buffers.
>
> There is no need to add an extra NET_SKB_PAD reservation for bounce
> buffers :
>
> - In TX path, NET_SKB_PAD is useless
>
> - In RX path in b44, we force a copy of incoming frames if
> GFP_DMA allocations were needed.
>
> Reported-and-bisected-by: Stefan Bader <stefan.bader@canonical.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied, thanks Eric.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-07-09 6:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-02 18:36 [PATCH] net: dont use __netdev_alloc_skb for bounce buffer Eric Dumazet
2012-07-02 20:03 ` Stefan Bader
2012-07-09 6:52 ` David Miller
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).