From: Felix Fietkau Date: Mon, 13 Apr 2015 20:08:30 +0000 (+0000) Subject: kernel: fix more bgmac dma init/cleanup issues X-Git-Tag: reboot~3315 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=87f854059aa3c703a87e08649801b15c93b845e7;p=oweals%2Fopenwrt.git kernel: fix more bgmac dma init/cleanup issues Signed-off-by: Felix Fietkau SVN-Revision: 45422 --- 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 - 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 } 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 + 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 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 - 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 --- 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 #include 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 /************************************************** * 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 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);