kernel: fix more bgmac dma init/cleanup issues
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 45422
This commit is contained in:
parent
232c61742e
commit
87f854059a
@ -49,7 +49,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|||||||
- slot->dma_addr,
|
- slot->dma_addr,
|
||||||
- BGMAC_RX_BUF_SIZE,
|
- BGMAC_RX_BUF_SIZE,
|
||||||
- DMA_FROM_DEVICE);
|
- DMA_FROM_DEVICE);
|
||||||
+ kfree(buf);
|
+ put_page(virt_to_head_page(buf));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,3 +99,23 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|||||||
}
|
}
|
||||||
|
|
||||||
return handled;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|||||||
+ if (len > BGMAC_RX_ALLOC_SIZE) {
|
+ if (len > BGMAC_RX_ALLOC_SIZE) {
|
||||||
+ bgmac_err(bgmac, "Found oversized packet at slot %d, DMA issue!\n",
|
+ bgmac_err(bgmac, "Found oversized packet at slot %d, DMA issue!\n",
|
||||||
+ ring->start);
|
+ ring->start);
|
||||||
+ kfree(buf);
|
+ put_page(virt_to_head_page(buf));
|
||||||
+ break;
|
+ break;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
@ -152,15 +152,18 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|||||||
|
|
||||||
err = request_irq(bgmac->core->irq, bgmac_interrupt, IRQF_SHARED,
|
err = request_irq(bgmac->core->irq, bgmac_interrupt, IRQF_SHARED,
|
||||||
KBUILD_MODNAME, net_dev);
|
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);
|
netif_carrier_on(net_dev);
|
||||||
|
+ return 0;
|
||||||
|
|
||||||
err_out:
|
err_out:
|
||||||
+ bgmac_dma_cleanup(bgmac);
|
+ bgmac_dma_cleanup(bgmac);
|
||||||
return err;
|
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);
|
free_irq(bgmac->core->irq, net_dev);
|
||||||
|
|
||||||
bgmac_chip_reset(bgmac);
|
bgmac_chip_reset(bgmac);
|
||||||
|
@ -44,7 +44,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|||||||
- for (i = 0; i < ring->num_slots; i++) {
|
- for (i = 0; i < ring->num_slots; i++) {
|
||||||
+ for (i = 0; i < BGMAC_RX_RING_SLOTS; i++) {
|
+ for (i = 0; i < BGMAC_RX_RING_SLOTS; i++) {
|
||||||
slot = &ring->slots[i];
|
slot = &ring->slots[i];
|
||||||
if (!slot->buf)
|
if (!slot->dma_addr)
|
||||||
continue;
|
continue;
|
||||||
@@ -543,7 +543,8 @@ static void bgmac_dma_rx_ring_free(struc
|
@@ -543,7 +543,8 @@ static void bgmac_dma_rx_ring_free(struc
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|||||||
|
|
||||||
--- a/drivers/net/ethernet/broadcom/bgmac.c
|
--- a/drivers/net/ethernet/broadcom/bgmac.c
|
||||||
+++ b/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,
|
ns_core = bcma_find_core_unit(core->bus,
|
||||||
BCMA_CORE_MAC_GBIT,
|
BCMA_CORE_MAC_GBIT,
|
||||||
ns_gmac);
|
ns_gmac);
|
||||||
|
@ -12,7 +12,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
|||||||
#include <bcm47xx_nvram.h>
|
#include <bcm47xx_nvram.h>
|
||||||
|
|
||||||
static const struct bcma_device_id bgmac_bcma_tbl[] = {
|
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);
|
mdiobus_free(mii_bus);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
|||||||
/**************************************************
|
/**************************************************
|
||||||
* BCMA bus ops
|
* 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->hw_features = net_dev->features;
|
||||||
net_dev->vlan_features = net_dev->features;
|
net_dev->vlan_features = net_dev->features;
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
|||||||
err = register_netdev(bgmac->net_dev);
|
err = register_netdev(bgmac->net_dev);
|
||||||
if (err) {
|
if (err) {
|
||||||
bgmac_err(bgmac, "Cannot register net device\n");
|
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);
|
struct bgmac *bgmac = bcma_get_drvdata(core);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user