Refreshed all patches. Compile-tested on: ar71xx Runtime-tested on: ar71xx
Signed-off-by: Koen Vandeputte <koen.vandepu...@ncentric.com> --- include/kernel-version.mk | 4 +- ...-detect-JEDEC-incompatible-w25q128-using-.patch | 2 +- ...80-NET-skip-GRO-for-foreign-MAC-addresses.patch | 10 +- .../202-core-linux-support-layerscape.patch | 2 +- .../401-mtd-spi-nor-support-layerscape.patch | 14 +- ...53-mtd-spi-nor-add-w25q256-3b-mode-switch.patch | 10 +- .../0054-mtd-add-chunked-read-io-to-m25p80.patch | 6 +- .../sunxi/patches-4.9/0052-stmmac-form-4-12.patch | 386 +++++++++++---------- 8 files changed, 228 insertions(+), 206 deletions(-) diff --git a/include/kernel-version.mk b/include/kernel-version.mk index 4be674ccdde7..8b3187b7085d 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -4,12 +4,12 @@ LINUX_RELEASE?=1 LINUX_VERSION-3.18 = .71 LINUX_VERSION-4.4 = .121 -LINUX_VERSION-4.9 = .91 +LINUX_VERSION-4.9 = .92 LINUX_VERSION-4.14 = .32 LINUX_KERNEL_HASH-3.18.71 = 5abc9778ad44ce02ed6c8ab52ece8a21c6d20d21f6ed8a19287b4a38a50c1240 LINUX_KERNEL_HASH-4.4.121 = 44a88268b5088dc326b30c9b9133ac35a9a200b636b7268d08f32abeae6ca729 -LINUX_KERNEL_HASH-4.9.91 = 60caa752ec9fa1c426f6a2f37db3f268d0961b67a723b6443949112167b39832 +LINUX_KERNEL_HASH-4.9.92 = 028dab1ee686b7bcf70ccd623828162ad2da63c73e6f0d88a6e622a3fe786e64 LINUX_KERNEL_HASH-4.14.32 = cb0979bec663089a43b10cfbeae0cf9673544b0ff5968c33ede614ec0f43b680 remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1)))) diff --git a/target/linux/bcm53xx/patches-4.9/400-mtd-spi-nor-detect-JEDEC-incompatible-w25q128-using-.patch b/target/linux/bcm53xx/patches-4.9/400-mtd-spi-nor-detect-JEDEC-incompatible-w25q128-using-.patch index 665c9786c76d..caed9ec41db3 100644 --- a/target/linux/bcm53xx/patches-4.9/400-mtd-spi-nor-detect-JEDEC-incompatible-w25q128-using-.patch +++ b/target/linux/bcm53xx/patches-4.9/400-mtd-spi-nor-detect-JEDEC-incompatible-w25q128-using-.patch @@ -13,7 +13,7 @@ Signed-off-by: Rafał Miłecki <zaj...@gmail.com> --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1190,6 +1190,18 @@ static const struct flash_info *spi_nor_ +@@ -1194,6 +1194,18 @@ static const struct flash_info *spi_nor_ } dev_err(nor->dev, "unrecognized JEDEC id bytes: %02x, %02x, %02x\n", id[0], id[1], id[2]); diff --git a/target/linux/generic/pending-4.9/680-NET-skip-GRO-for-foreign-MAC-addresses.patch b/target/linux/generic/pending-4.9/680-NET-skip-GRO-for-foreign-MAC-addresses.patch index 86a64d84245b..4d1f6c4c2b9c 100644 --- a/target/linux/generic/pending-4.9/680-NET-skip-GRO-for-foreign-MAC-addresses.patch +++ b/target/linux/generic/pending-4.9/680-NET-skip-GRO-for-foreign-MAC-addresses.patch @@ -34,7 +34,7 @@ Signed-off-by: Felix Fietkau <n...@nbd.name> __u16 tc_index; /* traffic control index */ --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -4542,6 +4542,9 @@ static enum gro_result dev_gro_receive(s +@@ -4550,6 +4550,9 @@ static enum gro_result dev_gro_receive(s enum gro_result ret; int grow; @@ -44,7 +44,7 @@ Signed-off-by: Felix Fietkau <n...@nbd.name> if (!(skb->dev->features & NETIF_F_GRO)) goto normal; -@@ -5830,6 +5833,48 @@ static void __netdev_adjacent_dev_unlink +@@ -5838,6 +5841,48 @@ static void __netdev_adjacent_dev_unlink &upper_dev->adj_list.lower); } @@ -93,7 +93,7 @@ Signed-off-by: Felix Fietkau <n...@nbd.name> static int __netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev, bool master, void *upper_priv, void *upper_info) -@@ -5902,6 +5947,7 @@ static int __netdev_upper_dev_link(struc +@@ -5910,6 +5955,7 @@ static int __netdev_upper_dev_link(struc goto rollback_lower_mesh; } @@ -101,7 +101,7 @@ Signed-off-by: Felix Fietkau <n...@nbd.name> ret = call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev, &changeupper_info.info); ret = notifier_to_errno(ret); -@@ -6028,6 +6074,7 @@ void netdev_upper_dev_unlink(struct net_ +@@ -6036,6 +6082,7 @@ void netdev_upper_dev_unlink(struct net_ list_for_each_entry(i, &upper_dev->all_adj_list.upper, list) __netdev_adjacent_dev_unlink(dev, i->dev, i->ref_nr); @@ -109,7 +109,7 @@ Signed-off-by: Felix Fietkau <n...@nbd.name> call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev, &changeupper_info.info); } -@@ -6628,6 +6675,7 @@ int dev_set_mac_address(struct net_devic +@@ -6636,6 +6683,7 @@ int dev_set_mac_address(struct net_devic if (err) return err; dev->addr_assign_type = NET_ADDR_SET; diff --git a/target/linux/layerscape/patches-4.9/202-core-linux-support-layerscape.patch b/target/linux/layerscape/patches-4.9/202-core-linux-support-layerscape.patch index 77e54f83403e..a284d8bbd47a 100644 --- a/target/linux/layerscape/patches-4.9/202-core-linux-support-layerscape.patch +++ b/target/linux/layerscape/patches-4.9/202-core-linux-support-layerscape.patch @@ -421,7 +421,7 @@ Signed-off-by: Yangbo Lu <yangbo...@nxp.com> * These are the defined Ethernet Protocol ID's. --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -6622,9 +6622,18 @@ int dev_set_mtu(struct net_device *dev, +@@ -6630,9 +6630,18 @@ int dev_set_mtu(struct net_device *dev, if (new_mtu == dev->mtu) return 0; diff --git a/target/linux/layerscape/patches-4.9/401-mtd-spi-nor-support-layerscape.patch b/target/linux/layerscape/patches-4.9/401-mtd-spi-nor-support-layerscape.patch index 6ffc2e1097fb..9d849686080c 100644 --- a/target/linux/layerscape/patches-4.9/401-mtd-spi-nor-support-layerscape.patch +++ b/target/linux/layerscape/patches-4.9/401-mtd-spi-nor-support-layerscape.patch @@ -768,7 +768,7 @@ Signed-off-by: Yangbo Lu <yangbo...@nxp.com> { "w25q32", INFO(0xef4016, 0, 64 * 1024, 64, SECT_4K) }, { "w25q32dw", INFO(0xef6016, 0, 64 * 1024, 64, -@@ -1192,6 +1216,53 @@ static const struct flash_info *spi_nor_ +@@ -1196,6 +1220,53 @@ static const struct flash_info *spi_nor_ id[0], id[1], id[2]); return ERR_PTR(-ENODEV); } @@ -822,7 +822,7 @@ Signed-off-by: Yangbo Lu <yangbo...@nxp.com> static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf) -@@ -1411,7 +1482,7 @@ static int macronix_quad_enable(struct s +@@ -1415,7 +1486,7 @@ static int macronix_quad_enable(struct s * Write status Register and configuration register with 2 bytes * The first byte will be written to the status register, while the * second byte will be written to the configuration register. @@ -831,7 +831,7 @@ Signed-off-by: Yangbo Lu <yangbo...@nxp.com> */ static int write_sr_cr(struct spi_nor *nor, u16 val) { -@@ -1459,6 +1530,24 @@ static int spansion_quad_enable(struct s +@@ -1463,6 +1534,24 @@ static int spansion_quad_enable(struct s return 0; } @@ -856,7 +856,7 @@ Signed-off-by: Yangbo Lu <yangbo...@nxp.com> static int set_quad_mode(struct spi_nor *nor, const struct flash_info *info) { int status; -@@ -1605,9 +1694,25 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1609,9 +1698,25 @@ int spi_nor_scan(struct spi_nor *nor, co write_sr(nor, 0); spi_nor_wait_till_ready(nor); } @@ -882,7 +882,7 @@ Signed-off-by: Yangbo Lu <yangbo...@nxp.com> mtd->priv = nor; mtd->type = MTD_NORFLASH; mtd->writesize = 1; -@@ -1641,6 +1746,8 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1645,6 +1750,8 @@ int spi_nor_scan(struct spi_nor *nor, co nor->flags |= SNOR_F_USE_FSR; if (info->flags & SPI_NOR_HAS_TB) nor->flags |= SNOR_F_HAS_SR_TB; @@ -891,7 +891,7 @@ Signed-off-by: Yangbo Lu <yangbo...@nxp.com> #ifdef CONFIG_MTD_SPI_NOR_USE_4K_SECTORS /* prefer "small sector" erase if possible */ -@@ -1680,9 +1787,15 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1684,9 +1791,15 @@ int spi_nor_scan(struct spi_nor *nor, co /* Some devices cannot do fast-read, no matter what DT tells us */ if (info->flags & SPI_NOR_NO_FR) nor->flash_read = SPI_NOR_NORMAL; @@ -910,7 +910,7 @@ Signed-off-by: Yangbo Lu <yangbo...@nxp.com> ret = set_quad_mode(nor, info); if (ret) { dev_err(dev, "quad mode not supported\n"); -@@ -1695,6 +1808,9 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1699,6 +1812,9 @@ int spi_nor_scan(struct spi_nor *nor, co /* Default commands */ switch (nor->flash_read) { diff --git a/target/linux/ramips/patches-4.9/0053-mtd-spi-nor-add-w25q256-3b-mode-switch.patch b/target/linux/ramips/patches-4.9/0053-mtd-spi-nor-add-w25q256-3b-mode-switch.patch index c43dd03eeb03..a27f922a0462 100644 --- a/target/linux/ramips/patches-4.9/0053-mtd-spi-nor-add-w25q256-3b-mode-switch.patch +++ b/target/linux/ramips/patches-4.9/0053-mtd-spi-nor-add-w25q256-3b-mode-switch.patch @@ -125,7 +125,7 @@ Signed-off-by: Felix Fietkau <n...@nbd.name> /* Catalyst / On Semiconductor -- non-JEDEC */ { "cat25c11", CAT25_INFO( 16, 8, 16, 1, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, -@@ -1205,6 +1257,9 @@ static int spi_nor_read(struct mtd_info +@@ -1209,6 +1261,9 @@ static int spi_nor_read(struct mtd_info if (ret) return ret; @@ -135,7 +135,7 @@ Signed-off-by: Felix Fietkau <n...@nbd.name> while (len) { loff_t addr = from; -@@ -1229,6 +1284,18 @@ static int spi_nor_read(struct mtd_info +@@ -1233,6 +1288,18 @@ static int spi_nor_read(struct mtd_info ret = 0; read_err: @@ -154,7 +154,7 @@ Signed-off-by: Felix Fietkau <n...@nbd.name> spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_READ); return ret; } -@@ -1330,6 +1397,10 @@ static int spi_nor_write(struct mtd_info +@@ -1334,6 +1401,10 @@ static int spi_nor_write(struct mtd_info if (ret) return ret; @@ -165,7 +165,7 @@ Signed-off-by: Felix Fietkau <n...@nbd.name> for (i = 0; i < len; ) { ssize_t written; loff_t addr = to + i; -@@ -1377,6 +1448,7 @@ static int spi_nor_write(struct mtd_info +@@ -1381,6 +1452,7 @@ static int spi_nor_write(struct mtd_info } write_err: @@ -173,7 +173,7 @@ Signed-off-by: Felix Fietkau <n...@nbd.name> spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE); return ret; } -@@ -1719,8 +1791,10 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1723,8 +1795,10 @@ int spi_nor_scan(struct spi_nor *nor, co else if (mtd->size > 0x1000000) { /* enable 4-byte addressing if the device exceeds 16MiB */ nor->addr_width = 4; diff --git a/target/linux/ramips/patches-4.9/0054-mtd-add-chunked-read-io-to-m25p80.patch b/target/linux/ramips/patches-4.9/0054-mtd-add-chunked-read-io-to-m25p80.patch index d6133e15965e..4045376842c5 100644 --- a/target/linux/ramips/patches-4.9/0054-mtd-add-chunked-read-io-to-m25p80.patch +++ b/target/linux/ramips/patches-4.9/0054-mtd-add-chunked-read-io-to-m25p80.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1453,6 +1453,67 @@ write_err: +@@ -1457,6 +1457,67 @@ write_err: return ret; } @@ -68,7 +68,7 @@ static int macronix_quad_enable(struct spi_nor *nor) { int ret, val; -@@ -1704,10 +1765,12 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1708,10 +1769,12 @@ int spi_nor_scan(struct spi_nor *nor, co } /* sst nor chips use AAI word program */ @@ -83,7 +83,7 @@ if (info->flags & USE_FSR) nor->flags |= SNOR_F_USE_FSR; -@@ -1739,11 +1802,20 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1743,11 +1806,20 @@ int spi_nor_scan(struct spi_nor *nor, co mtd->writebufsize = nor->page_size; if (np) { diff --git a/target/linux/sunxi/patches-4.9/0052-stmmac-form-4-12.patch b/target/linux/sunxi/patches-4.9/0052-stmmac-form-4-12.patch index 1356a4b9e97a..182648b98fa7 100644 --- a/target/linux/sunxi/patches-4.9/0052-stmmac-form-4-12.patch +++ b/target/linux/sunxi/patches-4.9/0052-stmmac-form-4-12.patch @@ -2887,7 +2887,7 @@ + + /* Display RX ring */ + priv->hw->desc->display_ring(head_rx, DMA_RX_SIZE, true); - } ++ } +} + +static void stmmac_display_tx_rings(struct stmmac_priv *priv) @@ -2906,15 +2906,15 @@ + head_tx = (void *)tx_q->dma_etx; + else + head_tx = (void *)tx_q->dma_tx; ++ ++ priv->hw->desc->display_ring(head_tx, DMA_TX_SIZE, false); + } ++} - /* Display Rx ring */ - priv->hw->desc->display_ring(head_rx, DMA_RX_SIZE, true); - /* Display Tx ring */ - priv->hw->desc->display_ring(head_tx, DMA_TX_SIZE, false); -+ priv->hw->desc->display_ring(head_tx, DMA_TX_SIZE, false); -+ } -+} -+ +static void stmmac_display_rings(struct stmmac_priv *priv) +{ + /* Display RX ring */ @@ -3131,7 +3131,7 @@ if (priv->hw->mode->set_16kib_bfsize) bfsize = priv->hw->mode->set_16kib_bfsize(dev->mtu); -@@ -1024,235 +1234,409 @@ static int init_dma_desc_rings(struct ne +@@ -1024,257 +1234,516 @@ static int init_dma_desc_rings(struct ne priv->dma_buf_sz = bfsize; @@ -3163,7 +3163,10 @@ + p = &((rx_q->dma_erx + i)->basic); + else + p = rx_q->dma_rx + i; -+ + +- ret = stmmac_init_rx_buffers(priv, p, i, flags); +- if (ret) +- goto err_init_rx_buffers; + ret = stmmac_init_rx_buffers(priv, p, i, flags, + queue); + if (ret) @@ -3173,18 +3176,15 @@ + rx_q->rx_skbuff[i], rx_q->rx_skbuff[i]->data, + (unsigned int)rx_q->rx_skbuff_dma[i]); + } - -- ret = stmmac_init_rx_buffers(priv, p, i, flags); -- if (ret) -- goto err_init_rx_buffers; ++ + rx_q->cur_rx = 0; + rx_q->dirty_rx = (unsigned int)(i - DMA_RX_SIZE); ++ ++ stmmac_clear_rx_descriptors(priv, queue); - netif_dbg(priv, probe, priv->dev, "[%p]\t[%p]\t[%x]\n", - priv->rx_skbuff[i], priv->rx_skbuff[i]->data, - (unsigned int)priv->rx_skbuff_dma[i]); -+ stmmac_clear_rx_descriptors(priv, queue); -+ + /* Setup the chained descriptor addresses */ + if (priv->mode == STMMAC_CHAIN_MODE) { + if (priv->extend_desc) @@ -3277,8 +3277,13 @@ + priv->hw->mode->init(tx_q->dma_tx, + tx_q->dma_tx_phy, + DMA_TX_SIZE, 0); -+ } -+ + } + +- priv->tx_skbuff_dma[i].buf = 0; +- priv->tx_skbuff_dma[i].map_as_page = false; +- priv->tx_skbuff_dma[i].len = 0; +- priv->tx_skbuff_dma[i].last_segment = false; +- priv->tx_skbuff[i] = NULL; + for (i = 0; i < DMA_TX_SIZE; i++) { + struct dma_desc *p; + if (priv->extend_desc) @@ -3300,13 +3305,8 @@ + tx_q->tx_skbuff_dma[i].len = 0; + tx_q->tx_skbuff_dma[i].last_segment = false; + tx_q->tx_skbuff[i] = NULL; - } - -- priv->tx_skbuff_dma[i].buf = 0; -- priv->tx_skbuff_dma[i].map_as_page = false; -- priv->tx_skbuff_dma[i].len = 0; -- priv->tx_skbuff_dma[i].last_segment = false; -- priv->tx_skbuff[i] = NULL; ++ } ++ + tx_q->dirty_tx = 0; + tx_q->cur_tx = 0; + @@ -3387,17 +3387,10 @@ - priv->tx_skbuff_dma[i].buf, - priv->tx_skbuff_dma[i].len, - DMA_TO_DEVICE); -- } + for (i = 0; i < DMA_TX_SIZE; i++) + stmmac_free_tx_buffer(priv, queue, i); +} - -- if (priv->tx_skbuff[i]) { -- dev_kfree_skb_any(priv->tx_skbuff[i]); -- priv->tx_skbuff[i] = NULL; -- priv->tx_skbuff_dma[i].buf = 0; -- priv->tx_skbuff_dma[i].map_as_page = false; -- } ++ +/** + * free_dma_rx_desc_resources - free RX dma desc resources + * @priv: private structure @@ -3426,11 +3419,10 @@ + + kfree(rx_q->rx_skbuff_dma); + kfree(rx_q->rx_skbuff); - } - } - - /** -- * alloc_dma_desc_resources - alloc TX/RX resources. ++ } ++} ++ ++/** + * free_dma_tx_desc_resources - free TX dma desc resources + * @priv: private structure + */ @@ -3463,90 +3455,36 @@ + +/** + * alloc_dma_rx_desc_resources - alloc RX resources. - * @priv: private structure - * Description: according to which descriptor can be used (extend or basic) - * this function allocates the resources for TX and RX paths. In case of - * reception, for example, it pre-allocated the RX socket buffer in order to - * allow zero-copy mechanism. - */ --static int alloc_dma_desc_resources(struct stmmac_priv *priv) ++ * @priv: private structure ++ * Description: according to which descriptor can be used (extend or basic) ++ * this function allocates the resources for TX and RX paths. In case of ++ * reception, for example, it pre-allocated the RX socket buffer in order to ++ * allow zero-copy mechanism. ++ */ +static int alloc_dma_rx_desc_resources(struct stmmac_priv *priv) - { ++{ + u32 rx_count = priv->plat->rx_queues_to_use; - int ret = -ENOMEM; ++ int ret = -ENOMEM; + u32 queue; - -- priv->rx_skbuff_dma = kmalloc_array(DMA_RX_SIZE, sizeof(dma_addr_t), -- GFP_KERNEL); -- if (!priv->rx_skbuff_dma) -- return -ENOMEM; ++ + /* RX queues buffers and DMA */ + for (queue = 0; queue < rx_count; queue++) { + struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue]; - -- priv->rx_skbuff = kmalloc_array(DMA_RX_SIZE, sizeof(struct sk_buff *), -- GFP_KERNEL); -- if (!priv->rx_skbuff) -- goto err_rx_skbuff; -- -- priv->tx_skbuff_dma = kmalloc_array(DMA_TX_SIZE, -- sizeof(*priv->tx_skbuff_dma), -- GFP_KERNEL); -- if (!priv->tx_skbuff_dma) -- goto err_tx_skbuff_dma; -- -- priv->tx_skbuff = kmalloc_array(DMA_TX_SIZE, sizeof(struct sk_buff *), -- GFP_KERNEL); -- if (!priv->tx_skbuff) -- goto err_tx_skbuff; -- -- if (priv->extend_desc) { -- priv->dma_erx = dma_zalloc_coherent(priv->device, DMA_RX_SIZE * -- sizeof(struct -- dma_extended_desc), -- &priv->dma_rx_phy, -- GFP_KERNEL); -- if (!priv->dma_erx) -- goto err_dma; ++ + rx_q->queue_index = queue; + rx_q->priv_data = priv; - -- priv->dma_etx = dma_zalloc_coherent(priv->device, DMA_TX_SIZE * -- sizeof(struct -- dma_extended_desc), -- &priv->dma_tx_phy, ++ + rx_q->rx_skbuff_dma = kmalloc_array(DMA_RX_SIZE, + sizeof(dma_addr_t), - GFP_KERNEL); -- if (!priv->dma_etx) { -- dma_free_coherent(priv->device, DMA_RX_SIZE * -- sizeof(struct dma_extended_desc), -- priv->dma_erx, priv->dma_rx_phy); -- goto err_dma; -- } -- } else { -- priv->dma_rx = dma_zalloc_coherent(priv->device, DMA_RX_SIZE * -- sizeof(struct dma_desc), -- &priv->dma_rx_phy, -- GFP_KERNEL); -- if (!priv->dma_rx) -- goto err_dma; ++ GFP_KERNEL); + if (!rx_q->rx_skbuff_dma) + return -ENOMEM; - -- priv->dma_tx = dma_zalloc_coherent(priv->device, DMA_TX_SIZE * -- sizeof(struct dma_desc), -- &priv->dma_tx_phy, -- GFP_KERNEL); -- if (!priv->dma_tx) { -- dma_free_coherent(priv->device, DMA_RX_SIZE * -- sizeof(struct dma_desc), -- priv->dma_rx, priv->dma_rx_phy); ++ + rx_q->rx_skbuff = kmalloc_array(DMA_RX_SIZE, + sizeof(struct sk_buff *), + GFP_KERNEL); + if (!rx_q->rx_skbuff) - goto err_dma; ++ goto err_dma; + + if (priv->extend_desc) { + rx_q->dma_erx = dma_zalloc_coherent(priv->device, @@ -3567,19 +3505,12 @@ + GFP_KERNEL); + if (!rx_q->dma_rx) + goto err_dma; - } - } - - return 0; - - err_dma: -- kfree(priv->tx_skbuff); --err_tx_skbuff: -- kfree(priv->tx_skbuff_dma); --err_tx_skbuff_dma: -- kfree(priv->rx_skbuff); --err_rx_skbuff: -- kfree(priv->rx_skbuff_dma); ++ } ++ } ++ ++ return 0; ++ ++err_dma: + free_dma_rx_desc_resources(priv); + + return ret; @@ -3636,7 +3567,7 @@ + GFP_KERNEL); + if (!tx_q->dma_tx) + goto err_dma_buffers; -+ } + } + } + + return 0; @@ -3644,9 +3575,9 @@ +err_dma_buffers: + free_dma_tx_desc_resources(priv); + - return ret; - } - ++ return ret; ++} ++ +/** + * alloc_dma_desc_resources - alloc TX/RX resources. + * @priv: private structure @@ -3672,78 +3603,119 @@ + * free_dma_desc_resources - free dma desc resources + * @priv: private structure + */ - static void free_dma_desc_resources(struct stmmac_priv *priv) - { -- /* Release the DMA TX/RX socket buffers */ -- dma_free_rx_skbufs(priv); -- dma_free_tx_skbufs(priv); -- -- /* Free DMA regions of consistent memory previously allocated */ -- if (!priv->extend_desc) { -- dma_free_coherent(priv->device, -- DMA_TX_SIZE * sizeof(struct dma_desc), -- priv->dma_tx, priv->dma_tx_phy); -- dma_free_coherent(priv->device, -- DMA_RX_SIZE * sizeof(struct dma_desc), -- priv->dma_rx, priv->dma_rx_phy); -- } else { -- dma_free_coherent(priv->device, DMA_TX_SIZE * -- sizeof(struct dma_extended_desc), -- priv->dma_etx, priv->dma_tx_phy); -- dma_free_coherent(priv->device, DMA_RX_SIZE * -- sizeof(struct dma_extended_desc), -- priv->dma_erx, priv->dma_rx_phy); -- } -- kfree(priv->rx_skbuff_dma); -- kfree(priv->rx_skbuff); -- kfree(priv->tx_skbuff_dma); -- kfree(priv->tx_skbuff); ++static void free_dma_desc_resources(struct stmmac_priv *priv) ++{ + /* Release the DMA RX socket buffers */ + free_dma_rx_desc_resources(priv); + + /* Release the DMA TX socket buffers */ + free_dma_tx_desc_resources(priv); - } - - /** -@@ -1262,19 +1646,104 @@ static void free_dma_desc_resources(stru - */ - static void stmmac_mac_enable_rx_queues(struct stmmac_priv *priv) - { -- int rx_count = priv->dma_cap.number_rx_queues; -- int queue = 0; ++} ++ ++/** ++ * stmmac_mac_enable_rx_queues - Enable MAC rx queues ++ * @priv: driver private structure ++ * Description: It is used for enabling the rx queues in the MAC ++ */ ++static void stmmac_mac_enable_rx_queues(struct stmmac_priv *priv) ++{ + u32 rx_queues_count = priv->plat->rx_queues_to_use; + int queue; + u8 mode; -- /* If GMAC does not have multiple queues, then this is not necessary*/ -- if (rx_count == 1) -- return; +- if (priv->tx_skbuff[i]) { +- dev_kfree_skb_any(priv->tx_skbuff[i]); +- priv->tx_skbuff[i] = NULL; +- priv->tx_skbuff_dma[i].buf = 0; +- priv->tx_skbuff_dma[i].map_as_page = false; +- } + for (queue = 0; queue < rx_queues_count; queue++) { + mode = priv->plat->rx_queues_cfg[queue].mode_to_use; + priv->hw->mac->rx_queue_enable(priv->hw, mode, queue); -+ } -+} + } + } -- /** -- * If the core is synthesized with multiple rx queues / multiple -- * dma channels, then rx queues will be disabled by default. -- * For now only rx queue 0 is enabled. -- */ -- priv->hw->mac->rx_queue_enable(priv->hw, queue); -+/** + /** +- * alloc_dma_desc_resources - alloc TX/RX resources. +- * @priv: private structure +- * Description: according to which descriptor can be used (extend or basic) +- * this function allocates the resources for TX and RX paths. In case of +- * reception, for example, it pre-allocated the RX socket buffer in order to +- * allow zero-copy mechanism. + * stmmac_start_rx_dma - start RX DMA channel + * @priv: driver private structure + * @chan: RX channel index + * Description: + * This starts a RX DMA channel -+ */ + */ +-static int alloc_dma_desc_resources(struct stmmac_priv *priv) +static void stmmac_start_rx_dma(struct stmmac_priv *priv, u32 chan) -+{ + { +- int ret = -ENOMEM; +- +- priv->rx_skbuff_dma = kmalloc_array(DMA_RX_SIZE, sizeof(dma_addr_t), +- GFP_KERNEL); +- if (!priv->rx_skbuff_dma) +- return -ENOMEM; +- +- priv->rx_skbuff = kmalloc_array(DMA_RX_SIZE, sizeof(struct sk_buff *), +- GFP_KERNEL); +- if (!priv->rx_skbuff) +- goto err_rx_skbuff; +- +- priv->tx_skbuff_dma = kmalloc_array(DMA_TX_SIZE, +- sizeof(*priv->tx_skbuff_dma), +- GFP_KERNEL); +- if (!priv->tx_skbuff_dma) +- goto err_tx_skbuff_dma; +- +- priv->tx_skbuff = kmalloc_array(DMA_TX_SIZE, sizeof(struct sk_buff *), +- GFP_KERNEL); +- if (!priv->tx_skbuff) +- goto err_tx_skbuff; +- +- if (priv->extend_desc) { +- priv->dma_erx = dma_zalloc_coherent(priv->device, DMA_RX_SIZE * +- sizeof(struct +- dma_extended_desc), +- &priv->dma_rx_phy, +- GFP_KERNEL); +- if (!priv->dma_erx) +- goto err_dma; +- +- priv->dma_etx = dma_zalloc_coherent(priv->device, DMA_TX_SIZE * +- sizeof(struct +- dma_extended_desc), +- &priv->dma_tx_phy, +- GFP_KERNEL); +- if (!priv->dma_etx) { +- dma_free_coherent(priv->device, DMA_RX_SIZE * +- sizeof(struct dma_extended_desc), +- priv->dma_erx, priv->dma_rx_phy); +- goto err_dma; +- } +- } else { +- priv->dma_rx = dma_zalloc_coherent(priv->device, DMA_RX_SIZE * +- sizeof(struct dma_desc), +- &priv->dma_rx_phy, +- GFP_KERNEL); +- if (!priv->dma_rx) +- goto err_dma; + netdev_dbg(priv->dev, "DMA RX processes started in channel %d\n", chan); + priv->hw->dma->start_rx(priv->ioaddr, chan); +} -+ + +- priv->dma_tx = dma_zalloc_coherent(priv->device, DMA_TX_SIZE * +- sizeof(struct dma_desc), +- &priv->dma_tx_phy, +- GFP_KERNEL); +- if (!priv->dma_tx) { +- dma_free_coherent(priv->device, DMA_RX_SIZE * +- sizeof(struct dma_desc), +- priv->dma_rx, priv->dma_rx_phy); +- goto err_dma; +- } +- } +/** + * stmmac_start_tx_dma - start TX DMA channel + * @priv: driver private structure @@ -3756,7 +3728,8 @@ + netdev_dbg(priv->dev, "DMA TX processes started in channel %d\n", chan); + priv->hw->dma->start_tx(priv->ioaddr, chan); +} -+ + +- return 0; +/** + * stmmac_stop_rx_dma - stop RX DMA channel + * @priv: driver private structure @@ -3769,7 +3742,16 @@ + netdev_dbg(priv->dev, "DMA RX processes stopped in channel %d\n", chan); + priv->hw->dma->stop_rx(priv->ioaddr, chan); +} -+ + +-err_dma: +- kfree(priv->tx_skbuff); +-err_tx_skbuff: +- kfree(priv->tx_skbuff_dma); +-err_tx_skbuff_dma: +- kfree(priv->rx_skbuff); +-err_rx_skbuff: +- kfree(priv->rx_skbuff_dma); +- return ret; +/** + * stmmac_stop_tx_dma - stop TX DMA channel + * @priv: driver private structure @@ -3781,8 +3763,9 @@ +{ + netdev_dbg(priv->dev, "DMA TX processes stopped in channel %d\n", chan); + priv->hw->dma->stop_tx(priv->ioaddr, chan); -+} -+ + } + +-static void free_dma_desc_resources(struct stmmac_priv *priv) +/** + * stmmac_start_all_dma - start all RX and TX DMA channels + * @priv: driver private structure @@ -3790,7 +3773,31 @@ + * This starts all the RX and TX DMA channels + */ +static void stmmac_start_all_dma(struct stmmac_priv *priv) -+{ + { +- /* Release the DMA TX/RX socket buffers */ +- dma_free_rx_skbufs(priv); +- dma_free_tx_skbufs(priv); +- +- /* Free DMA regions of consistent memory previously allocated */ +- if (!priv->extend_desc) { +- dma_free_coherent(priv->device, +- DMA_TX_SIZE * sizeof(struct dma_desc), +- priv->dma_tx, priv->dma_tx_phy); +- dma_free_coherent(priv->device, +- DMA_RX_SIZE * sizeof(struct dma_desc), +- priv->dma_rx, priv->dma_rx_phy); +- } else { +- dma_free_coherent(priv->device, DMA_TX_SIZE * +- sizeof(struct dma_extended_desc), +- priv->dma_etx, priv->dma_tx_phy); +- dma_free_coherent(priv->device, DMA_RX_SIZE * +- sizeof(struct dma_extended_desc), +- priv->dma_erx, priv->dma_rx_phy); +- } +- kfree(priv->rx_skbuff_dma); +- kfree(priv->rx_skbuff); +- kfree(priv->tx_skbuff_dma); +- kfree(priv->tx_skbuff); + u32 rx_channels_count = priv->plat->rx_queues_to_use; + u32 tx_channels_count = priv->plat->tx_queues_to_use; + u32 chan = 0; @@ -3800,23 +3807,38 @@ + + for (chan = 0; chan < tx_channels_count; chan++) + stmmac_start_tx_dma(priv, chan); -+} -+ -+/** + } + + /** +- * stmmac_mac_enable_rx_queues - Enable MAC rx queues +- * @priv: driver private structure +- * Description: It is used for enabling the rx queues in the MAC + * stmmac_stop_all_dma - stop all RX and TX DMA channels + * @priv: driver private structure + * Description: + * This stops the RX and TX DMA channels -+ */ + */ +-static void stmmac_mac_enable_rx_queues(struct stmmac_priv *priv) +static void stmmac_stop_all_dma(struct stmmac_priv *priv) -+{ + { +- int rx_count = priv->dma_cap.number_rx_queues; +- int queue = 0; + u32 rx_channels_count = priv->plat->rx_queues_to_use; + u32 tx_channels_count = priv->plat->tx_queues_to_use; + u32 chan = 0; -+ + +- /* If GMAC does not have multiple queues, then this is not necessary*/ +- if (rx_count == 1) +- return; + for (chan = 0; chan < rx_channels_count; chan++) + stmmac_stop_rx_dma(priv, chan); -+ + +- /** +- * If the core is synthesized with multiple rx queues / multiple +- * dma channels, then rx queues will be disabled by default. +- * For now only rx queue 0 is enabled. +- */ +- priv->hw->mac->rx_queue_enable(priv->hw, queue); + for (chan = 0; chan < tx_channels_count; chan++) + stmmac_stop_tx_dma(priv, chan); } -- 2.7.4 _______________________________________________ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev