Patchwork Fix b44 network regression in Quantal

login
register
mail settings
Submitter Stefan Bader
Date July 3, 2012, 10:17 a.m.
Message ID <1341310672-4859-1-git-send-email-stefan.bader@canonical.com>
Download mbox | patch
Permalink /patch/168783/
State New
Headers show

Comments

Stefan Bader - July 3, 2012, 10:17 a.m.
Frankly I don't understand why this exactly makes a difference,
but at least I can confirm from testing that the b44 part really
does fix the issue. Without the patch any network connection
is reset quite often (even loosing pings) and the PHY is powered
down during reset. With the patch applied network connection is
stable. I think the b43 I have in that machine never worked too
well with the b43 driver (had to use wl), so I cannot be sure
about the b43 part, but at least it is doing the same changes as for b44.

Eric sent out the patch to be added to linux-net, but I am not sure how
long it takes to get into mainline. And since it is a regression and
I was able to test (most of) it, I think it should be added as soon as
possible.

-Stefan

From 83385a5415d63ab9c2d6008d58037b5de6920a43 Mon Sep 17 00:00:00 2001
From: Eric Dumazet <edumazet@google.com>
Date: Mon, 2 Jul 2012 20:36:00 +0200
Subject: [PATCH] UBUNTU: (pre-up) net: dont use __netdev_alloc_skb for bounce buffer

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>

BugLink: http://bugs.launchpad.net/bugs/1018456
(Sent out to the net mailing list)
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
---
 drivers/net/ethernet/broadcom/b44.c  |    4 ++--
 drivers/net/wireless/b43legacy/dma.c |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
Leann Ogasawara - July 3, 2012, 1:35 p.m.
Applied to Quantal master-next.

Thanks,
Leann

On 07/03/2012 03:17 AM, Stefan Bader wrote:
> Frankly I don't understand why this exactly makes a difference,
> but at least I can confirm from testing that the b44 part really
> does fix the issue. Without the patch any network connection
> is reset quite often (even loosing pings) and the PHY is powered
> down during reset. With the patch applied network connection is
> stable. I think the b43 I have in that machine never worked too
> well with the b43 driver (had to use wl), so I cannot be sure
> about the b43 part, but at least it is doing the same changes as for b44.
>
> Eric sent out the patch to be added to linux-net, but I am not sure how
> long it takes to get into mainline. And since it is a regression and
> I was able to test (most of) it, I think it should be added as soon as
> possible.
>
> -Stefan
>
> From 83385a5415d63ab9c2d6008d58037b5de6920a43 Mon Sep 17 00:00:00 2001
> From: Eric Dumazet <edumazet@google.com>
> Date: Mon, 2 Jul 2012 20:36:00 +0200
> Subject: [PATCH] UBUNTU: (pre-up) net: dont use __netdev_alloc_skb for bounce buffer
>
> 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>
>
> BugLink: http://bugs.launchpad.net/bugs/1018456
> (Sent out to the net mailing list)
> Signed-off-by: Stefan Bader <stefan.bader@canonical.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;

Patch

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;