aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2015-04-13 20:08:30 +0000
committerFelix Fietkau <nbd@openwrt.org>2015-04-13 20:08:30 +0000
commit2fb7989420a673711f44c4dbc18bca1d85bf77e3 (patch)
tree199ae4847d43199e272f596f7d35cf30e007ae41
parentc08644341187fcc4c599de0caf2686b7b022ea85 (diff)
downloadmaster-187ad058-2fb7989420a673711f44c4dbc18bca1d85bf77e3.tar.gz
master-187ad058-2fb7989420a673711f44c4dbc18bca1d85bf77e3.tar.bz2
master-187ad058-2fb7989420a673711f44c4dbc18bca1d85bf77e3.zip
kernel: fix more bgmac dma init/cleanup issues
Signed-off-by: Felix Fietkau <nbd@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@45422 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--target/linux/generic/patches-3.18/077-07-bgmac-simplify-rx-DMA-error-handling.patch22
-rw-r--r--target/linux/generic/patches-3.18/077-08-bgmac-add-check-for-oversized-packets.patch2
-rw-r--r--target/linux/generic/patches-3.18/077-10-bgmac-simplify-dma-init-cleanup.patch7
-rw-r--r--target/linux/generic/patches-3.18/077-12-bgmac-drop-ring-num_slots.patch2
-rw-r--r--target/linux/generic/patches-3.18/077-14-bgmac-reset-all-4-GMAC-cores-on-init.patch2
-rw-r--r--target/linux/generic/patches-3.18/773-bgmac-add-srab-switch.patch6
6 files changed, 32 insertions, 9 deletions
diff --git a/target/linux/generic/patches-3.18/077-07-bgmac-simplify-rx-DMA-error-handling.patch b/target/linux/generic/patches-3.18/077-07-bgmac-simplify-rx-DMA-error-handling.patch
index e1e8c8f656..d6feed05b2 100644
--- a/target/linux/generic/patches-3.18/077-07-bgmac-simplify-rx-DMA-error-handling.patch
+++ b/target/linux/generic/patches-3.18/077-07-bgmac-simplify-rx-DMA-error-handling.patch
@@ -49,7 +49,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
- slot->dma_addr,
- BGMAC_RX_BUF_SIZE,
- DMA_FROM_DEVICE);
-+ kfree(buf);
++ put_page(virt_to_head_page(buf));
break;
}
@@ -99,3 +99,23 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
}
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;
+ }
+ }
+
diff --git a/target/linux/generic/patches-3.18/077-08-bgmac-add-check-for-oversized-packets.patch b/target/linux/generic/patches-3.18/077-08-bgmac-add-check-for-oversized-packets.patch
index 89e1a32368..9785621cbc 100644
--- a/target/linux/generic/patches-3.18/077-08-bgmac-add-check-for-oversized-packets.patch
+++ b/target/linux/generic/patches-3.18/077-08-bgmac-add-check-for-oversized-packets.patch
@@ -18,7 +18,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+ 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;
+ }
+
diff --git a/target/linux/generic/patches-3.18/077-10-bgmac-simplify-dma-init-cleanup.patch b/target/linux/generic/patches-3.18/077-10-bgmac-simplify-dma-init-cleanup.patch
index 16bb64870d..423b204aa0 100644
--- a/target/linux/generic/patches-3.18/077-10-bgmac-simplify-dma-init-cleanup.patch
+++ b/target/linux/generic/patches-3.18/077-10-bgmac-simplify-dma-init-cleanup.patch
@@ -152,15 +152,18 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
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);
diff --git a/target/linux/generic/patches-3.18/077-12-bgmac-drop-ring-num_slots.patch b/target/linux/generic/patches-3.18/077-12-bgmac-drop-ring-num_slots.patch
index 6709aaa4ea..36acc19716 100644
--- a/target/linux/generic/patches-3.18/077-12-bgmac-drop-ring-num_slots.patch
+++ b/target/linux/generic/patches-3.18/077-12-bgmac-drop-ring-num_slots.patch
@@ -44,7 +44,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
- 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
}
diff --git a/target/linux/generic/patches-3.18/077-14-bgmac-reset-all-4-GMAC-cores-on-init.patch b/target/linux/generic/patches-3.18/077-14-bgmac-reset-all-4-GMAC-cores-on-init.patch
index b38a116f93..c23496bd43 100644
--- a/target/linux/generic/patches-3.18/077-14-bgmac-reset-all-4-GMAC-cores-on-init.patch
+++ b/target/linux/generic/patches-3.18/077-14-bgmac-reset-all-4-GMAC-cores-on-init.patch
@@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
--- 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);
diff --git a/target/linux/generic/patches-3.18/773-bgmac-add-srab-switch.patch b/target/linux/generic/patches-3.18/773-bgmac-add-srab-switch.patch
index 14c640719c..d6f1f3301c 100644
--- a/target/linux/generic/patches-3.18/773-bgmac-add-srab-switch.patch
+++ b/target/linux/generic/patches-3.18/773-bgmac-add-srab-switch.patch
@@ -12,7 +12,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
#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);
}
@@ -30,7 +30,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
/**************************************************
* 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;
@@ -47,7 +47,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
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);