X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=target%2Flinux%2Fgeneric%2Fpatches-3.18%2F077-12-bgmac-drop-ring-num_slots.patch;h=4dbb6f48de145dd66f2992fc67cef31c4cb3832c;hb=80722233476224eb695b186c0add6e9b5cf43d11;hp=7525b63d6adc1a1702ee296ff93babdab8914e71;hpb=afafbc0d7454cb3271477698782cdf3197d06295;p=lede.git 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 7525b63d6a..4dbb6f48de 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 @@ -1,11 +1,11 @@ -From: Felix Fietkau +From: Felix Fietkau Date: Sun, 12 Apr 2015 23:28:38 +0200 Subject: [PATCH] bgmac: drop ring->num_slots The ring size is always known at compile time, so make the code a bit more efficient -Signed-off-by: Felix Fietkau +Signed-off-by: Felix Fietkau --- --- a/drivers/net/ethernet/broadcom/bgmac.c @@ -19,7 +19,7 @@ Signed-off-by: Felix Fietkau ctl0 |= BGMAC_DESC_CTL0_EOT; ctl1 = len & BGMAC_DESC_CTL1_LEN; -@@ -378,7 +378,7 @@ static void bgmac_dma_rx_setup_desc(stru +@@ -382,7 +382,7 @@ static void bgmac_dma_rx_setup_desc(stru struct bgmac_dma_desc *dma_desc = ring->cpu_base + desc_idx; u32 ctl0 = 0, ctl1 = 0; @@ -28,7 +28,7 @@ Signed-off-by: Felix Fietkau ctl0 |= BGMAC_DESC_CTL0_EOT; ctl1 |= BGMAC_RX_BUF_SIZE & BGMAC_DESC_CTL1_LEN; /* Is there any BGMAC device that requires extension? */ -@@ -508,7 +508,7 @@ static void bgmac_dma_tx_ring_free(struc +@@ -521,7 +521,7 @@ static void bgmac_dma_tx_ring_free(struc struct bgmac_slot_info *slot; int i; @@ -37,16 +37,16 @@ Signed-off-by: Felix Fietkau int len = dma_desc[i].ctl1 & BGMAC_DESC_CTL1_LEN; slot = &ring->slots[i]; -@@ -533,7 +533,7 @@ static void bgmac_dma_rx_ring_free(struc +@@ -546,7 +546,7 @@ static void bgmac_dma_rx_ring_free(struc struct bgmac_slot_info *slot; int i; - 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; -@@ -547,7 +547,8 @@ static void bgmac_dma_rx_ring_free(struc +@@ -560,7 +560,8 @@ static void bgmac_dma_rx_ring_free(struc } static void bgmac_dma_ring_desc_free(struct bgmac *bgmac, @@ -56,7 +56,7 @@ Signed-off-by: Felix Fietkau { struct device *dma_dev = bgmac->core->dma_dev; int size; -@@ -556,7 +557,7 @@ static void bgmac_dma_ring_desc_free(str +@@ -569,7 +570,7 @@ static void bgmac_dma_ring_desc_free(str return; /* Free ring of descriptors */ @@ -65,7 +65,7 @@ Signed-off-by: Felix Fietkau dma_free_coherent(dma_dev, size, ring->cpu_base, ring->dma_base); } -@@ -577,10 +578,12 @@ static void bgmac_dma_free(struct bgmac +@@ -590,10 +591,12 @@ static void bgmac_dma_free(struct bgmac int i; for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) @@ -80,7 +80,7 @@ Signed-off-by: Felix Fietkau } static int bgmac_dma_alloc(struct bgmac *bgmac) -@@ -603,11 +606,10 @@ static int bgmac_dma_alloc(struct bgmac +@@ -616,11 +619,10 @@ static int bgmac_dma_alloc(struct bgmac for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) { ring = &bgmac->tx_ring[i]; @@ -93,7 +93,7 @@ Signed-off-by: Felix Fietkau ring->cpu_base = dma_zalloc_coherent(dma_dev, size, &ring->dma_base, GFP_KERNEL); -@@ -629,11 +631,10 @@ static int bgmac_dma_alloc(struct bgmac +@@ -642,11 +644,10 @@ static int bgmac_dma_alloc(struct bgmac for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) { ring = &bgmac->rx_ring[i]; @@ -106,7 +106,7 @@ Signed-off-by: Felix Fietkau ring->cpu_base = dma_zalloc_coherent(dma_dev, size, &ring->dma_base, GFP_KERNEL); -@@ -696,7 +697,7 @@ static int bgmac_dma_init(struct bgmac * +@@ -709,7 +710,7 @@ static int bgmac_dma_init(struct bgmac * ring->start = 0; ring->end = 0; @@ -114,7 +114,7 @@ Signed-off-by: Felix Fietkau + for (j = 0; j < BGMAC_RX_RING_SLOTS; j++) { err = bgmac_dma_rx_skb_for_slot(bgmac, &ring->slots[j]); if (err) - return err; + goto error; --- a/drivers/net/ethernet/broadcom/bgmac.h +++ b/drivers/net/ethernet/broadcom/bgmac.h @@ -419,11 +419,10 @@ struct bgmac_dma_ring {