- slot->dma_addr,
- BGMAC_RX_BUF_SIZE,
- DMA_FROM_DEVICE);
-+ kfree(buf);
++ put_page(virt_to_head_page(buf));
break;
}
}
return handled;
+@@ -528,14 +512,14 @@ static void bgmac_dma_rx_ring_free(struc
+
+ for (i = 0; i < ring->num_slots; i++) {
+ slot = &ring->slots[i];
+- if (!slot->buf)
++ if (!slot->dma_addr)
+ continue;
+
+- if (slot->dma_addr)
+- dma_unmap_single(dma_dev, slot->dma_addr,
+- BGMAC_RX_BUF_SIZE,
+- DMA_FROM_DEVICE);
++ dma_unmap_single(dma_dev, slot->dma_addr,
++ BGMAC_RX_BUF_SIZE,
++ DMA_FROM_DEVICE);
+ put_page(virt_to_head_page(slot->buf));
++ slot->dma_addr = 0;
+ }
+ }
+
+ if (len > BGMAC_RX_ALLOC_SIZE) {
+ bgmac_err(bgmac, "Found oversized packet at slot %d, DMA issue!\n",
+ ring->start);
-+ kfree(buf);
++ put_page(virt_to_head_page(buf));
+ break;
+ }
+
err = request_irq(bgmac->core->irq, bgmac_interrupt, IRQF_SHARED,
KBUILD_MODNAME, net_dev);
-@@ -1273,6 +1270,7 @@ static int bgmac_open(struct net_device
+@@ -1271,8 +1268,10 @@ static int bgmac_open(struct net_device
+ phy_start(bgmac->phy_dev);
+
netif_carrier_on(net_dev);
++ return 0;
err_out:
+ bgmac_dma_cleanup(bgmac);
return err;
}
-@@ -1289,6 +1287,7 @@ static int bgmac_stop(struct net_device
+@@ -1289,6 +1288,7 @@ static int bgmac_stop(struct net_device
free_irq(bgmac->core->irq, net_dev);
bgmac_chip_reset(bgmac);
- for (i = 0; i < ring->num_slots; i++) {
+ for (i = 0; i < BGMAC_RX_RING_SLOTS; i++) {
slot = &ring->slots[i];
- if (!slot->buf)
+ if (!slot->dma_addr)
continue;
@@ -543,7 +543,8 @@ static void bgmac_dma_rx_ring_free(struc
}
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -1604,8 +1604,11 @@ static int bgmac_probe(struct bcma_devic
+@@ -1605,8 +1605,11 @@ static int bgmac_probe(struct bcma_devic
ns_core = bcma_find_core_unit(core->bus,
BCMA_CORE_MAC_GBIT,
ns_gmac);
#include <bcm47xx_nvram.h>
static const struct bcma_device_id bgmac_bcma_tbl[] = {
-@@ -1519,6 +1520,17 @@ static void bgmac_mii_unregister(struct
+@@ -1520,6 +1521,17 @@ static void bgmac_mii_unregister(struct
mdiobus_free(mii_bus);
}
/**************************************************
* BCMA bus ops
**************************************************/
-@@ -1645,6 +1657,16 @@ static int bgmac_probe(struct bcma_devic
+@@ -1646,6 +1658,16 @@ static int bgmac_probe(struct bcma_devic
net_dev->hw_features = net_dev->features;
net_dev->vlan_features = net_dev->features;
err = register_netdev(bgmac->net_dev);
if (err) {
bgmac_err(bgmac, "Cannot register net device\n");
-@@ -1671,6 +1693,10 @@ static void bgmac_remove(struct bcma_dev
+@@ -1672,6 +1694,10 @@ static void bgmac_remove(struct bcma_dev
{
struct bgmac *bgmac = bcma_get_drvdata(core);