diff options
author | Felix Fietkau <nbd@openwrt.org> | 2015-04-14 12:17:20 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2015-04-14 12:17:20 +0000 |
commit | 054044ff91891723025a6b35bd583c98e141ea3d (patch) | |
tree | a3f4744223e4a3ac72ac691f8690cf0cc57cf1c7 | |
parent | 023d3337d828ba911cc8713839e18afd6b7da244 (diff) | |
download | upstream-054044ff91891723025a6b35bd583c98e141ea3d.tar.gz upstream-054044ff91891723025a6b35bd583c98e141ea3d.tar.bz2 upstream-054044ff91891723025a6b35bd583c98e141ea3d.zip |
kernel: update bgmac patches to the latest version submitted
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@45431 3c298f89-4303-0410-b956-a3cf2f4a3e73
10 files changed, 102 insertions, 80 deletions
diff --git a/target/linux/generic/patches-3.18/077-04-bgmac-simplify-tx-ring-index-handling.patch b/target/linux/generic/patches-3.18/077-04-bgmac-simplify-tx-ring-index-handling.patch index cf62a50a2f..241a3083a9 100644 --- a/target/linux/generic/patches-3.18/077-04-bgmac-simplify-tx-ring-index-handling.patch +++ b/target/linux/generic/patches-3.18/077-04-bgmac-simplify-tx-ring-index-handling.patch @@ -25,22 +25,24 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> int i; if (skb->len > BGMAC_DESC_CTL1_LEN) { -@@ -158,13 +157,7 @@ static netdev_tx_t bgmac_dma_tx_add(stru - skb_checksum_help(skb); +@@ -159,12 +158,10 @@ static netdev_tx_t bgmac_dma_tx_add(stru nr_frags = skb_shinfo(skb)->nr_frags; -- + - if (ring->start <= ring->end) - free_slots = ring->start - ring->end + BGMAC_TX_RING_SLOTS; - else - free_slots = ring->start - ring->end; - - if (free_slots <= nr_frags + 1) { ++ /* ring->end - ring->start will return the number of valid slots, ++ * even when ring->end overflows ++ */ + if (ring->end - ring->start + nr_frags + 1 >= BGMAC_TX_RING_SLOTS) { bgmac_err(bgmac, "TX ring is full, queue should be stopped!\n"); netif_stop_queue(net_dev); return NETDEV_TX_BUSY; -@@ -200,7 +193,7 @@ static netdev_tx_t bgmac_dma_tx_add(stru +@@ -200,7 +197,7 @@ static netdev_tx_t bgmac_dma_tx_add(stru } slot->skb = skb; @@ -49,7 +51,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> netdev_sent_queue(net_dev, skb->len); wmb(); -@@ -208,13 +201,12 @@ static netdev_tx_t bgmac_dma_tx_add(stru +@@ -208,13 +205,12 @@ static netdev_tx_t bgmac_dma_tx_add(stru /* Increase ring->end to point empty slot. We tell hardware the first * slot it should *not* read. */ @@ -66,7 +68,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> netif_stop_queue(net_dev); return NETDEV_TX_OK; -@@ -256,17 +248,17 @@ static void bgmac_dma_tx_free(struct bgm +@@ -256,17 +252,17 @@ static void bgmac_dma_tx_free(struct bgm empty_slot &= BGMAC_DMA_TX_STATDPTR; empty_slot /= sizeof(struct bgmac_dma_desc); @@ -93,7 +95,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> if (ctl1 & BGMAC_DESC_CTL0_SOF) /* Unmap no longer used buffer */ dma_unmap_single(dma_dev, slot->dma_addr, len, -@@ -284,10 +276,8 @@ static void bgmac_dma_tx_free(struct bgm +@@ -284,10 +280,8 @@ static void bgmac_dma_tx_free(struct bgm slot->skb = NULL; } diff --git a/target/linux/generic/patches-3.18/077-05-bgmac-leave-interrupts-disabled-as-long-as-there-is-.patch b/target/linux/generic/patches-3.18/077-05-bgmac-leave-interrupts-disabled-as-long-as-there-is-.patch index 7118d0d145..3bbe9ea9cb 100644 --- a/target/linux/generic/patches-3.18/077-05-bgmac-leave-interrupts-disabled-as-long-as-there-is-.patch +++ b/target/linux/generic/patches-3.18/077-05-bgmac-leave-interrupts-disabled-as-long-as-there-is-.patch @@ -15,7 +15,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -1105,8 +1105,6 @@ static void bgmac_chip_reset(struct bgma +@@ -1109,8 +1109,6 @@ static void bgmac_chip_reset(struct bgma bgmac_phy_init(bgmac); netdev_reset_queue(bgmac->net_dev); @@ -24,7 +24,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> } static void bgmac_chip_intrs_on(struct bgmac *bgmac) -@@ -1221,14 +1219,13 @@ static irqreturn_t bgmac_interrupt(int i +@@ -1225,14 +1223,13 @@ static irqreturn_t bgmac_interrupt(int i if (!int_status) return IRQ_NONE; @@ -42,7 +42,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> napi_schedule(&bgmac->napi); return IRQ_HANDLED; -@@ -1237,25 +1234,17 @@ static irqreturn_t bgmac_interrupt(int i +@@ -1241,25 +1238,17 @@ static irqreturn_t bgmac_interrupt(int i static int bgmac_poll(struct napi_struct *napi, int weight) { struct bgmac *bgmac = container_of(napi, struct bgmac, napi); diff --git a/target/linux/generic/patches-3.18/077-06-bgmac-set-received-skb-headroom-to-NET_SKB_PAD.patch b/target/linux/generic/patches-3.18/077-06-bgmac-set-received-skb-headroom-to-NET_SKB_PAD.patch index e7fde163fd..2c490efbbb 100644 --- a/target/linux/generic/patches-3.18/077-06-bgmac-set-received-skb-headroom-to-NET_SKB_PAD.patch +++ b/target/linux/generic/patches-3.18/077-06-bgmac-set-received-skb-headroom-to-NET_SKB_PAD.patch @@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -342,13 +342,13 @@ static int bgmac_dma_rx_skb_for_slot(str +@@ -346,13 +346,13 @@ static int bgmac_dma_rx_skb_for_slot(str return -ENOMEM; /* Poison - if everything goes fine, hardware will overwrite it */ @@ -27,7 +27,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> if (dma_mapping_error(dma_dev, dma_addr)) { bgmac_err(bgmac, "DMA mapping error\n"); put_page(virt_to_head_page(buf)); -@@ -399,7 +399,7 @@ static int bgmac_dma_rx_read(struct bgma +@@ -403,7 +403,7 @@ static int bgmac_dma_rx_read(struct bgma while (ring->start != ring->end) { struct device *dma_dev = bgmac->core->dma_dev; struct bgmac_slot_info *slot = &ring->slots[ring->start]; @@ -36,7 +36,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> struct sk_buff *skb; void *buf = slot->buf; u16 len, flags; -@@ -450,8 +450,10 @@ static int bgmac_dma_rx_read(struct bgma +@@ -454,8 +454,10 @@ static int bgmac_dma_rx_read(struct bgma BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); skb = build_skb(buf, BGMAC_RX_ALLOC_SIZE); 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 d6feed05b2..2ca9d10f63 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 @@ -1,19 +1,40 @@ From: Felix Fietkau <nbd@openwrt.org> Date: Sun, 12 Apr 2015 22:23:07 +0200 -Subject: [PATCH] bgmac: simplify rx DMA error handling +Subject: [PATCH] bgmac: simplify/optimize rx DMA error handling -Unmap the DMA buffer before checking it. If an error occurs, free the -buffer and allocate a new one. If allocation or mapping fails, retry as -long as there is NAPI poll budget left (count every attempt instead of -every frame). +Allocate a new buffer before processing the completed one. If allocation +fails, reuse the old buffer. Signed-off-by: Felix Fietkau <nbd@openwrt.org> --- --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -404,51 +404,33 @@ static int bgmac_dma_rx_read(struct bgma +@@ -386,6 +386,19 @@ static void bgmac_dma_rx_setup_desc(stru + dma_desc->ctl1 = cpu_to_le32(ctl1); + } + ++static void bgmac_dma_rx_poison_buf(struct device *dma_dev, ++ struct bgmac_slot_info *slot) ++{ ++ struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET; ++ ++ dma_sync_single_for_cpu(dma_dev, slot->dma_addr, BGMAC_RX_BUF_SIZE, ++ DMA_FROM_DEVICE); ++ rx->len = cpu_to_le16(0xdead); ++ rx->flags = cpu_to_le16(0xbeef); ++ dma_sync_single_for_device(dma_dev, slot->dma_addr, BGMAC_RX_BUF_SIZE, ++ DMA_FROM_DEVICE); ++} ++ + static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring, + int weight) + { +@@ -406,53 +419,35 @@ static int bgmac_dma_rx_read(struct bgma + struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET; + struct sk_buff *skb; void *buf = slot->buf; ++ dma_addr_t dma_addr = slot->dma_addr; u16 len, flags; - /* Unmap buffer to make it accessible to the CPU */ @@ -23,19 +44,19 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> - /* Get info from the header */ - len = le16_to_cpu(rx->len); - flags = le16_to_cpu(rx->flags); -+ if (++handled >= weight - 1) /* Should never be greater */ -+ break; - +- do { - dma_addr_t old_dma_addr = slot->dma_addr; - int err; -+ if (!slot->dma_addr) ++ /* Prepare new skb as replacement */ ++ if (bgmac_dma_rx_skb_for_slot(bgmac, slot)) { ++ bgmac_dma_rx_poison_buf(dma_dev, slot); + break; ++ } + + /* Unmap buffer to make it accessible to the CPU */ -+ dma_unmap_single(dma_dev, slot->dma_addr, ++ dma_unmap_single(dma_dev, dma_addr, + BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); -+ slot->dma_addr = 0; + + /* Get info from the header */ + len = le16_to_cpu(rx->len); @@ -78,28 +99,16 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> skb = build_skb(buf, BGMAC_RX_ALLOC_SIZE); skb_put(skb, BGMAC_RX_FRAME_OFFSET + BGMAC_RX_BUF_OFFSET + len); -@@ -458,14 +440,16 @@ static int bgmac_dma_rx_read(struct bgma - skb_checksum_none_assert(skb); - skb->protocol = eth_type_trans(skb, bgmac->net_dev); - napi_gro_receive(&bgmac->napi, skb); -- handled++; +@@ -465,6 +460,8 @@ static int bgmac_dma_rx_read(struct bgma + handled++; } while (0); -+ /* Prepare new skb as replacement */ -+ if (bgmac_dma_rx_skb_for_slot(bgmac, slot)) -+ continue; -+ + bgmac_dma_rx_setup_desc(bgmac, ring, ring->start); + if (++ring->start >= BGMAC_RX_RING_SLOTS) ring->start = 0; -- -- if (handled >= weight) /* Should never be greater */ -- break; - } - return handled; -@@ -528,14 +512,14 @@ static void bgmac_dma_rx_ring_free(struc +@@ -532,14 +529,14 @@ static void bgmac_dma_rx_ring_free(struc for (i = 0; i < ring->num_slots; i++) { slot = &ring->slots[i]; 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 9785621cbc..705aa2d2a4 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 @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -428,6 +428,13 @@ static int bgmac_dma_rx_read(struct bgma +@@ -445,6 +445,13 @@ static int bgmac_dma_rx_read(struct bgma 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 423b204aa0..ed03db069e 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 @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -545,18 +545,26 @@ static void bgmac_dma_ring_desc_free(str +@@ -562,18 +562,26 @@ static void bgmac_dma_ring_desc_free(str ring->dma_base); } @@ -44,7 +44,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> } static int bgmac_dma_alloc(struct bgmac *bgmac) -@@ -604,8 +612,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++) { @@ -53,7 +53,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> ring = &bgmac->rx_ring[i]; ring->num_slots = BGMAC_RX_RING_SLOTS; ring->mmio_base = ring_base[i]; -@@ -628,15 +634,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; @@ -69,7 +69,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> } return 0; -@@ -646,10 +643,10 @@ err_dma_free: +@@ -663,10 +660,10 @@ err_dma_free: return -ENOMEM; } @@ -82,7 +82,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) { ring = &bgmac->tx_ring[i]; -@@ -681,8 +678,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); @@ -90,23 +90,27 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> + for (j = 0; j < ring->num_slots; j++) { + err = bgmac_dma_rx_skb_for_slot(bgmac, &ring->slots[j]); + if (err) -+ return err; ++ goto error; + bgmac_dma_rx_setup_desc(bgmac, ring, j); + } bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_INDEX, ring->index_base + -@@ -691,6 +693,8 @@ static void bgmac_dma_init(struct bgmac +@@ -708,6 +710,12 @@ static void bgmac_dma_init(struct bgmac ring->start = 0; ring->end = 0; } + + return 0; ++ ++error: ++ bgmac_dma_cleanup(bgmac); ++ return err; } /************************************************** -@@ -1166,11 +1170,8 @@ static void bgmac_enable(struct bgmac *b +@@ -1183,11 +1191,8 @@ static void bgmac_enable(struct bgmac *b } /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipinit */ @@ -119,7 +123,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> /* 1 interrupt per received frame */ bgmac_write(bgmac, BGMAC_INT_RECV_LAZY, 1 << BGMAC_IRL_FC_SHIFT); -@@ -1188,16 +1189,7 @@ static void bgmac_chip_init(struct bgmac +@@ -1205,16 +1210,7 @@ static void bgmac_chip_init(struct bgmac bgmac_write(bgmac, BGMAC_RXMAX_LENGTH, 32 + ETHER_MAX_LEN); @@ -137,14 +141,14 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> bgmac_enable(bgmac); } -@@ -1257,8 +1249,13 @@ 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); + + err = bgmac_dma_init(bgmac); + if (err) -+ goto err_out; ++ return err; + /* Specs say about reclaiming rings here, but we do that in DMA init */ - bgmac_chip_init(bgmac, true); @@ -152,18 +156,25 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> err = request_irq(bgmac->core->irq, bgmac_interrupt, IRQF_SHARED, KBUILD_MODNAME, net_dev); -@@ -1271,8 +1268,10 @@ static int bgmac_open(struct net_device + if (err < 0) { + bgmac_err(bgmac, "IRQ request error: %d!\n", err); +- goto err_out; ++ bgmac_dma_cleanup(bgmac); ++ return err; + } + napi_enable(&bgmac->napi); + phy_start(bgmac->phy_dev); netif_carrier_on(net_dev); +- +-err_out: +- return err; + return 0; - - err_out: -+ bgmac_dma_cleanup(bgmac); - return err; } -@@ -1289,6 +1288,7 @@ static int bgmac_stop(struct net_device + static int bgmac_stop(struct net_device *net_dev) +@@ -1306,6 +1306,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-11-bgmac-fix-DMA-rx-corruption.patch b/target/linux/generic/patches-3.18/077-11-bgmac-fix-DMA-rx-corruption.patch index 846e2ee0e2..2e670d89b0 100644 --- a/target/linux/generic/patches-3.18/077-11-bgmac-fix-DMA-rx-corruption.patch +++ b/target/linux/generic/patches-3.18/077-11-bgmac-fix-DMA-rx-corruption.patch @@ -17,7 +17,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -362,6 +362,16 @@ static int bgmac_dma_rx_skb_for_slot(str +@@ -366,6 +366,16 @@ static int bgmac_dma_rx_skb_for_slot(str return 0; } @@ -34,7 +34,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> static void bgmac_dma_rx_setup_desc(struct bgmac *bgmac, struct bgmac_dma_ring *ring, int desc_idx) { -@@ -380,6 +390,8 @@ static void bgmac_dma_rx_setup_desc(stru +@@ -384,6 +394,8 @@ static void bgmac_dma_rx_setup_desc(stru dma_desc->addr_high = cpu_to_le32(upper_32_bits(ring->slots[desc_idx].dma_addr)); dma_desc->ctl0 = cpu_to_le32(ctl0); dma_desc->ctl1 = cpu_to_le32(ctl1); @@ -42,8 +42,8 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> + ring->end = desc_idx; } - static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring, -@@ -394,9 +406,7 @@ static int bgmac_dma_rx_read(struct bgma + static void bgmac_dma_rx_poison_buf(struct device *dma_dev, +@@ -411,9 +423,7 @@ static int bgmac_dma_rx_read(struct bgma end_slot &= BGMAC_DMA_RX_STATDPTR; end_slot /= sizeof(struct bgmac_dma_desc); @@ -54,8 +54,8 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> struct device *dma_dev = bgmac->core->dma_dev; struct bgmac_slot_info *slot = &ring->slots[ring->start]; struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET; -@@ -459,6 +469,8 @@ static int bgmac_dma_rx_read(struct bgma - ring->start = 0; +@@ -476,6 +486,8 @@ static int bgmac_dma_rx_read(struct bgma + break; } + bgmac_dma_rx_update_index(bgmac, ring); @@ -63,7 +63,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> return handled; } -@@ -678,6 +690,8 @@ static int bgmac_dma_init(struct bgmac * +@@ -695,6 +707,8 @@ static int bgmac_dma_init(struct bgmac * if (ring->unaligned) bgmac_dma_rx_enable(bgmac, ring); @@ -72,7 +72,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> for (j = 0; j < ring->num_slots; j++) { err = bgmac_dma_rx_skb_for_slot(bgmac, &ring->slots[j]); if (err) -@@ -686,12 +700,7 @@ static int bgmac_dma_init(struct bgmac * +@@ -703,12 +717,7 @@ static int bgmac_dma_init(struct bgmac * bgmac_dma_rx_setup_desc(bgmac, ring, j); } 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 36acc19716..90f3e6d1df 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 @@ -19,7 +19,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> 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 <nbd@openwrt.org> ctl0 |= BGMAC_DESC_CTL0_EOT; ctl1 |= BGMAC_RX_BUF_SIZE & BGMAC_DESC_CTL1_LEN; /* Is there any BGMAC device that requires extension? */ -@@ -504,7 +504,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,7 +37,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> int len = dma_desc[i].ctl1 & BGMAC_DESC_CTL1_LEN; slot = &ring->slots[i]; -@@ -529,7 +529,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; @@ -46,7 +46,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> slot = &ring->slots[i]; if (!slot->dma_addr) continue; -@@ -543,7 +543,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 <nbd@openwrt.org> { struct device *dma_dev = bgmac->core->dma_dev; int size; -@@ -552,7 +553,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 <nbd@openwrt.org> dma_free_coherent(dma_dev, size, ring->cpu_base, ring->dma_base); } -@@ -573,10 +574,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 <nbd@openwrt.org> } static int bgmac_dma_alloc(struct bgmac *bgmac) -@@ -599,11 +602,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 <nbd@openwrt.org> ring->cpu_base = dma_zalloc_coherent(dma_dev, size, &ring->dma_base, GFP_KERNEL); -@@ -625,11 +627,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 <nbd@openwrt.org> ring->cpu_base = dma_zalloc_coherent(dma_dev, size, &ring->dma_base, GFP_KERNEL); -@@ -692,7 +693,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 <nbd@openwrt.org> + 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 { 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 c23496bd43..2a913a60e7 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 -@@ -1605,8 +1605,11 @@ static int bgmac_probe(struct bcma_devic +@@ -1623,8 +1623,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 d6f1f3301c..3b2751f529 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[] = { -@@ -1520,6 +1521,17 @@ static void bgmac_mii_unregister(struct +@@ -1538,6 +1539,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 **************************************************/ -@@ -1646,6 +1658,16 @@ static int bgmac_probe(struct bcma_devic +@@ -1664,6 +1676,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"); -@@ -1672,6 +1694,10 @@ static void bgmac_remove(struct bcma_dev +@@ -1690,6 +1712,10 @@ static void bgmac_remove(struct bcma_dev { struct bgmac *bgmac = bcma_get_drvdata(core); |