-From: Felix Fietkau <nbd@openwrt.org>
+From: Felix Fietkau <nbd@nbd.name>
Date: Sun, 12 Apr 2015 23:19:32 +0200
Subject: [PATCH] bgmac: simplify dma init/cleanup
descriptors at device open, do both at the same time (during open).
Free all buffers when closing the device.
-Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
--- a/drivers/net/ethernet/broadcom/bgmac.c
}
static int bgmac_dma_alloc(struct bgmac *bgmac)
-@@ -621,8 +629,6 @@ static int bgmac_dma_alloc(struct bgmac
+@@ -621,8 +629,6 @@ static int bgmac_dma_alloc(struct bgmac
}
for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) {
ring = &bgmac->rx_ring[i];
ring->num_slots = BGMAC_RX_RING_SLOTS;
ring->mmio_base = ring_base[i];
-@@ -645,15 +651,6 @@ static int bgmac_dma_alloc(struct bgmac
+@@ -645,15 +651,6 @@ static int bgmac_dma_alloc(struct bgmac
ring->index_base = lower_32_bits(ring->dma_base);
else
ring->index_base = 0;
for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) {
ring = &bgmac->tx_ring[i];
-@@ -698,8 +695,13 @@ static void bgmac_dma_init(struct bgmac
+@@ -698,8 +695,13 @@ static void bgmac_dma_init(struct bgmac
if (ring->unaligned)
bgmac_dma_rx_enable(bgmac, ring);
bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_INDEX,
ring->index_base +
-@@ -708,6 +710,12 @@ static void bgmac_dma_init(struct bgmac
+@@ -708,6 +710,12 @@ static void bgmac_dma_init(struct bgmac
ring->start = 0;
ring->end = 0;
}
bgmac_enable(bgmac);
}
-@@ -1274,23 +1270,27 @@ static int bgmac_open(struct net_device
+@@ -1274,23 +1270,27 @@ static int bgmac_open(struct net_device
int err = 0;
bgmac_chip_reset(bgmac);
}
static int bgmac_stop(struct net_device *net_dev)
-@@ -1306,6 +1306,7 @@ static int bgmac_stop(struct net_device
+@@ -1306,6 +1306,7 @@ static int bgmac_stop(struct net_device
free_irq(bgmac->core->irq, net_dev);
bgmac_chip_reset(bgmac);