From 46b51e9e992884c81f4838440cd2967e67db3a79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20B=C3=B6hler?= Date: Sun, 2 Apr 2023 10:40:47 +0200 Subject: [PATCH 1/6] ramips: tplink,mr600v2: fix image generation for sysupgrade image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The MR600v2 does not find its rootfs if it is neither directly after the kernel or aligned to an erase block boundary (64k). This aligns the rootfs to 0x10000 allowing the device to boot again. Based on investigation by forum user relghuar. Signed-off-by: Andreas Böhler --- target/linux/ramips/image/mt7621.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 2697f84bf7..9dbcf09eb2 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -2158,6 +2158,9 @@ define Device/tplink_mr600-v2-eu TPLINK_FLASHLAYOUT := 16Mltq DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap \ kmod-usb-net-qmi-wwan uqmi kmod-usb3 -uboot-envtools + IMAGE/factory.bin := tplink-v2-image -e -a 0x10000 + IMAGE/sysupgrade.bin := tplink-v2-image -s -e -a 0x10000 | check-size | \ + append-metadata KERNEL := $(KERNEL_DTB) | uImage lzma KERNEL_INITRAMFS := $$(KERNEL) | tplink-v2-header TPLINK_BOARD_ID := MR600-V2-EU From 9fb1dbb1df35911b407fa0faaa2443fbc0f0ddde Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Thu, 25 May 2023 13:38:47 +0200 Subject: [PATCH 2/6] realtek: Add missing headers We are missing a bunch of headers, which trigger errors on 6.1, probably due to changed header-in-header dependencies. Best add them now. Signed-off-by: Olliver Schinagl --- .../linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/common.c | 2 ++ target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c | 1 + .../linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c | 1 + .../linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl839x.c | 1 + .../linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl930x.c | 1 + .../linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl931x.c | 1 + target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/tc.c | 1 + 7 files changed, 8 insertions(+) diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/common.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/common.c index 4b928f248b..0434312afc 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/common.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/common.c @@ -6,6 +6,8 @@ #include #include #include +#include +#include #include #include #include diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c index 5b5608b9b4..5744c70ea3 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only #include +#include #include #include diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c index 0f9c3c33a4..adff404fdd 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only #include +#include #include #include diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl839x.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl839x.c index fe5572a447..ff80a9074e 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl839x.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl839x.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only #include +#include #include "rtl83xx.h" diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl930x.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl930x.c index e65f95e9f1..c4f200bc0e 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl930x.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl930x.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only #include +#include #include #include "rtl83xx.h" diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl931x.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl931x.c index 5e1b00add5..3221109c18 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl931x.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl931x.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only #include +#include #include "rtl83xx.h" diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/tc.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/tc.c index 2c2175922c..3f7c31e04d 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/tc.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/tc.c @@ -2,6 +2,7 @@ #include #include +#include #include #include #include From d881f65da1e6f3bc4237b39cf2373bef51c3828c Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Wed, 24 May 2023 12:58:37 +0200 Subject: [PATCH 3/6] realtek: eth: Do not write directly to dev->addr One is never to write to dev->addr directly. In 6.1 it will be a const and with the newly enabled WERROR, we get a failing grade. Lets fix this ahead of time. Signed-off-by: Olliver Schinagl --- .../drivers/net/ethernet/rtl838x_eth.c | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/target/linux/realtek/files-5.15/drivers/net/ethernet/rtl838x_eth.c b/target/linux/realtek/files-5.15/drivers/net/ethernet/rtl838x_eth.c index e9ebc7c73c..9dcb7a3b78 100644 --- a/target/linux/realtek/files-5.15/drivers/net/ethernet/rtl838x_eth.c +++ b/target/linux/realtek/files-5.15/drivers/net/ethernet/rtl838x_eth.c @@ -1557,7 +1557,7 @@ static int rtl838x_set_mac_address(struct net_device *dev, void *p) if (!is_valid_ether_addr(addr->sa_data)) return -EADDRNOTAVAIL; - memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); + dev_addr_set(dev, addr->sa_data); rtl838x_set_mac_hw(dev, mac); pr_info("Using MAC %08x%08x\n", sw_r32(priv->r->mac), sw_r32(priv->r->mac + 4)); @@ -2352,6 +2352,7 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev) struct resource *res, *mem; phy_interface_t phy_mode; struct phylink *phylink; + u8 mac_addr[ETH_ALEN]; int err = 0, rxrings, rxringlen; struct ring_b *ring; @@ -2478,17 +2479,18 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev) * 1) from device tree data * 2) from internal registers set by bootloader */ - of_get_mac_address(pdev->dev.of_node, dev->dev_addr); - if (is_valid_ether_addr(dev->dev_addr)) { - rtl838x_set_mac_hw(dev, (u8 *)dev->dev_addr); + of_get_mac_address(pdev->dev.of_node, mac_addr); + if (is_valid_ether_addr(mac_addr)) { + rtl838x_set_mac_hw(dev, mac_addr); } else { - dev->dev_addr[0] = (sw_r32(priv->r->mac) >> 8) & 0xff; - dev->dev_addr[1] = sw_r32(priv->r->mac) & 0xff; - dev->dev_addr[2] = (sw_r32(priv->r->mac + 4) >> 24) & 0xff; - dev->dev_addr[3] = (sw_r32(priv->r->mac + 4) >> 16) & 0xff; - dev->dev_addr[4] = (sw_r32(priv->r->mac + 4) >> 8) & 0xff; - dev->dev_addr[5] = sw_r32(priv->r->mac + 4) & 0xff; + mac_addr[0] = (sw_r32(priv->r->mac) >> 8) & 0xff; + mac_addr[1] = sw_r32(priv->r->mac) & 0xff; + mac_addr[2] = (sw_r32(priv->r->mac + 4) >> 24) & 0xff; + mac_addr[3] = (sw_r32(priv->r->mac + 4) >> 16) & 0xff; + mac_addr[4] = (sw_r32(priv->r->mac + 4) >> 8) & 0xff; + mac_addr[5] = sw_r32(priv->r->mac + 4) & 0xff; } + dev_addr_set(dev, mac_addr); /* if the address is invalid, use a random value */ if (!is_valid_ether_addr(dev->dev_addr)) { struct sockaddr sa = { AF_UNSPEC }; From 7b31c2e9ed4da7bfeecbd393c17c249eca870717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Wed, 12 Apr 2023 13:01:25 +0200 Subject: [PATCH 4/6] kernel: Backport mvneta crash fix to 5.15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport Russell King's series [1] net: mvneta: reduce size of TSO header allocation to pending-5.15 to fix random crashes on Turris Omnia. This also backports two patches that are dependencies to this series: net: mvneta: Delete unused variable net: mvneta: fix potential double-frees in mvneta_txq_sw_deinit() [1] https://lore.kernel.org/netdev/ZCsbJ4nG+So%2Fn9qY@shell.armlinux.org.uk/ Signed-off-by: Marek Behún Signed-off-by: Christian Lamparter (squashed) --- ...16-net-mvneta-Delete-unused-variable.patch | 62 ++++++ ...otential-double-frees-in-mvneta_txq_.patch | 37 ++++ ...transmit-path-dma-unmapping-on-error.patch | 111 +++++++++++ ...rk-mapped-and-tso-buffers-separately.patch | 42 ++++ ...uf-type-to-determine-whether-to-dma-.patch | 59 ++++++ ...tso_build_hdr-into-mvneta_tso_put_hd.patch | 65 +++++++ ...cate-TSO-header-DMA-memory-in-chunks.patch | 179 ++++++++++++++++++ .../700-mvneta-tx-queue-workaround.patch | 4 +- ...ethernet-marvell-mvnetaMQPrioOffload.patch | 4 +- ...xt-ethernet-marvell-mvnetaMQPrioFlag.patch | 2 +- ...t-ethernet-marvell-mvnetaMQPrioQueue.patch | 8 +- ...hernet-marvell-mvnetaMQPrioTCOffload.patch | 6 +- 12 files changed, 567 insertions(+), 12 deletions(-) create mode 100644 target/linux/generic/backport-5.15/708-01-v5.16-net-mvneta-Delete-unused-variable.patch create mode 100644 target/linux/generic/backport-5.15/708-02-v6.3-net-mvneta-fix-potential-double-frees-in-mvneta_txq_.patch create mode 100644 target/linux/generic/pending-5.15/704-01-v6.4-net-mvneta-fix-transmit-path-dma-unmapping-on-error.patch create mode 100644 target/linux/generic/pending-5.15/704-02-v6.4-net-mvneta-mark-mapped-and-tso-buffers-separately.patch create mode 100644 target/linux/generic/pending-5.15/704-03-v6.4-net-mvneta-use-buf-type-to-determine-whether-to-dma-.patch create mode 100644 target/linux/generic/pending-5.15/704-04-v6.4-net-mvneta-move-tso_build_hdr-into-mvneta_tso_put_hd.patch create mode 100644 target/linux/generic/pending-5.15/704-05-v6.4-net-mvneta-allocate-TSO-header-DMA-memory-in-chunks.patch diff --git a/target/linux/generic/backport-5.15/708-01-v5.16-net-mvneta-Delete-unused-variable.patch b/target/linux/generic/backport-5.15/708-01-v5.16-net-mvneta-Delete-unused-variable.patch new file mode 100644 index 0000000000..421563ef08 --- /dev/null +++ b/target/linux/generic/backport-5.15/708-01-v5.16-net-mvneta-Delete-unused-variable.patch @@ -0,0 +1,62 @@ +From 43ed6fff01333868a1d0e19876f67c22d9939952 Mon Sep 17 00:00:00 2001 +From: Yuval Shaia +Date: Wed, 13 Oct 2021 09:49:21 +0300 +Subject: [PATCH] net: mvneta: Delete unused variable + +The variable pp is not in use - delete it. + +Signed-off-by: Yuval Shaia +Link: https://lore.kernel.org/r/20211013064921.26346-1-yshaia@marvell.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/ethernet/marvell/mvneta.c | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +--- a/drivers/net/ethernet/marvell/mvneta.c ++++ b/drivers/net/ethernet/marvell/mvneta.c +@@ -1914,7 +1914,7 @@ static int mvneta_rx_refill(struct mvnet + } + + /* Handle tx checksum */ +-static u32 mvneta_skb_tx_csum(struct mvneta_port *pp, struct sk_buff *skb) ++static u32 mvneta_skb_tx_csum(struct sk_buff *skb) + { + if (skb->ip_summed == CHECKSUM_PARTIAL) { + int ip_hdr_len = 0; +@@ -2595,8 +2595,7 @@ err_drop_frame: + } + + static inline void +-mvneta_tso_put_hdr(struct sk_buff *skb, +- struct mvneta_port *pp, struct mvneta_tx_queue *txq) ++mvneta_tso_put_hdr(struct sk_buff *skb, struct mvneta_tx_queue *txq) + { + int hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); + struct mvneta_tx_buf *buf = &txq->buf[txq->txq_put_index]; +@@ -2604,7 +2603,7 @@ mvneta_tso_put_hdr(struct sk_buff *skb, + + tx_desc = mvneta_txq_next_desc_get(txq); + tx_desc->data_size = hdr_len; +- tx_desc->command = mvneta_skb_tx_csum(pp, skb); ++ tx_desc->command = mvneta_skb_tx_csum(skb); + tx_desc->command |= MVNETA_TXD_F_DESC; + tx_desc->buf_phys_addr = txq->tso_hdrs_phys + + txq->txq_put_index * TSO_HEADER_SIZE; +@@ -2681,7 +2680,7 @@ static int mvneta_tx_tso(struct sk_buff + hdr = txq->tso_hdrs + txq->txq_put_index * TSO_HEADER_SIZE; + tso_build_hdr(skb, hdr, &tso, data_left, total_len == 0); + +- mvneta_tso_put_hdr(skb, pp, txq); ++ mvneta_tso_put_hdr(skb, txq); + + while (data_left > 0) { + int size; +@@ -2799,7 +2798,7 @@ static netdev_tx_t mvneta_tx(struct sk_b + /* Get a descriptor for the first part of the packet */ + tx_desc = mvneta_txq_next_desc_get(txq); + +- tx_cmd = mvneta_skb_tx_csum(pp, skb); ++ tx_cmd = mvneta_skb_tx_csum(skb); + + tx_desc->data_size = skb_headlen(skb); + diff --git a/target/linux/generic/backport-5.15/708-02-v6.3-net-mvneta-fix-potential-double-frees-in-mvneta_txq_.patch b/target/linux/generic/backport-5.15/708-02-v6.3-net-mvneta-fix-potential-double-frees-in-mvneta_txq_.patch new file mode 100644 index 0000000000..a16e68ee4f --- /dev/null +++ b/target/linux/generic/backport-5.15/708-02-v6.3-net-mvneta-fix-potential-double-frees-in-mvneta_txq_.patch @@ -0,0 +1,37 @@ +From 0cf39c6543469aae4a30cba354243125514ed568 Mon Sep 17 00:00:00 2001 +From: "Russell King (Oracle)" +Date: Wed, 29 Mar 2023 13:11:17 +0100 +Subject: [PATCH] net: mvneta: fix potential double-frees in + mvneta_txq_sw_deinit() + +Reported on the Turris forum, mvneta provokes kernel warnings in the +architecture DMA mapping code when mvneta_setup_txqs() fails to +allocate memory. This happens because when mvneta_cleanup_txqs() is +called in the mvneta_stop() path, we leave pointers in the structure +that have been freed. + +Then on mvneta_open(), we call mvneta_setup_txqs(), which starts +allocating memory. On memory allocation failure, mvneta_cleanup_txqs() +will walk all the queues freeing any non-NULL pointers - which includes +pointers that were previously freed in mvneta_stop(). + +Fix this by setting these pointers to NULL to prevent double-freeing +of the same memory. + +Link: https://forum.turris.cz/t/random-kernel-exceptions-on-hbl-tos-7-0/18865/8 +Signed-off-by: Russell King (Oracle) +--- + drivers/net/ethernet/marvell/mvneta.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/net/ethernet/marvell/mvneta.c ++++ b/drivers/net/ethernet/marvell/mvneta.c +@@ -3481,6 +3481,8 @@ static void mvneta_txq_sw_deinit(struct + + netdev_tx_reset_queue(nq); + ++ txq->buf = NULL; ++ txq->tso_hdrs = NULL; + txq->descs = NULL; + txq->last_desc = 0; + txq->next_desc_to_proc = 0; diff --git a/target/linux/generic/pending-5.15/704-01-v6.4-net-mvneta-fix-transmit-path-dma-unmapping-on-error.patch b/target/linux/generic/pending-5.15/704-01-v6.4-net-mvneta-fix-transmit-path-dma-unmapping-on-error.patch new file mode 100644 index 0000000000..287728ba1d --- /dev/null +++ b/target/linux/generic/pending-5.15/704-01-v6.4-net-mvneta-fix-transmit-path-dma-unmapping-on-error.patch @@ -0,0 +1,111 @@ +From d6d80269cf5c79f9dfe7d69f8b41a72015c89748 Mon Sep 17 00:00:00 2001 +From: "Russell King (Oracle)" +Date: Mon, 3 Apr 2023 19:30:20 +0100 +Subject: [PATCH 1/5] net: mvneta: fix transmit path dma-unmapping on error + +The transmit code assumes that the transmit descriptors that are used +begin with the first descriptor in the ring, but this may not be the +case. Fix this by providing a new function that dma-unmaps a range of +numbered descriptor entries, and use that to do the unmapping. + +Signed-off-by: Russell King (Oracle) +--- + drivers/net/ethernet/marvell/mvneta.c | 53 +++++++++++++++++---------- + 1 file changed, 33 insertions(+), 20 deletions(-) + +--- a/drivers/net/ethernet/marvell/mvneta.c ++++ b/drivers/net/ethernet/marvell/mvneta.c +@@ -2647,14 +2647,40 @@ mvneta_tso_put_data(struct net_device *d + return 0; + } + ++static void mvneta_release_descs(struct mvneta_port *pp, ++ struct mvneta_tx_queue *txq, ++ int first, int num) ++{ ++ int desc_idx, i; ++ ++ desc_idx = first + num; ++ if (desc_idx >= txq->size) ++ desc_idx -= txq->size; ++ ++ for (i = num; i >= 0; i--) { ++ struct mvneta_tx_desc *tx_desc = txq->descs + desc_idx; ++ ++ if (!IS_TSO_HEADER(txq, tx_desc->buf_phys_addr)) ++ dma_unmap_single(pp->dev->dev.parent, ++ tx_desc->buf_phys_addr, ++ tx_desc->data_size, ++ DMA_TO_DEVICE); ++ ++ mvneta_txq_desc_put(txq); ++ ++ if (desc_idx == 0) ++ desc_idx = txq->size; ++ desc_idx -= 1; ++ } ++} ++ + static int mvneta_tx_tso(struct sk_buff *skb, struct net_device *dev, + struct mvneta_tx_queue *txq) + { + int hdr_len, total_len, data_left; +- int desc_count = 0; ++ int first_desc, desc_count = 0; + struct mvneta_port *pp = netdev_priv(dev); + struct tso_t tso; +- int i; + + /* Count needed descriptors */ + if ((txq->count + tso_count_descs(skb)) >= txq->size) +@@ -2665,6 +2691,8 @@ static int mvneta_tx_tso(struct sk_buff + return 0; + } + ++ first_desc = txq->txq_put_index; ++ + /* Initialize the TSO handler, and prepare the first payload */ + hdr_len = tso_start(skb, &tso); + +@@ -2705,15 +2733,7 @@ err_release: + /* Release all used data descriptors; header descriptors must not + * be DMA-unmapped. + */ +- for (i = desc_count - 1; i >= 0; i--) { +- struct mvneta_tx_desc *tx_desc = txq->descs + i; +- if (!IS_TSO_HEADER(txq, tx_desc->buf_phys_addr)) +- dma_unmap_single(pp->dev->dev.parent, +- tx_desc->buf_phys_addr, +- tx_desc->data_size, +- DMA_TO_DEVICE); +- mvneta_txq_desc_put(txq); +- } ++ mvneta_release_descs(pp, txq, first_desc, desc_count - 1); + return 0; + } + +@@ -2723,6 +2743,7 @@ static int mvneta_tx_frag_process(struct + { + struct mvneta_tx_desc *tx_desc; + int i, nr_frags = skb_shinfo(skb)->nr_frags; ++ int first_desc = txq->txq_put_index; + + for (i = 0; i < nr_frags; i++) { + struct mvneta_tx_buf *buf = &txq->buf[txq->txq_put_index]; +@@ -2761,15 +2782,7 @@ error: + /* Release all descriptors that were used to map fragments of + * this packet, as well as the corresponding DMA mappings + */ +- for (i = i - 1; i >= 0; i--) { +- tx_desc = txq->descs + i; +- dma_unmap_single(pp->dev->dev.parent, +- tx_desc->buf_phys_addr, +- tx_desc->data_size, +- DMA_TO_DEVICE); +- mvneta_txq_desc_put(txq); +- } +- ++ mvneta_release_descs(pp, txq, first_desc, i - 1); + return -ENOMEM; + } + diff --git a/target/linux/generic/pending-5.15/704-02-v6.4-net-mvneta-mark-mapped-and-tso-buffers-separately.patch b/target/linux/generic/pending-5.15/704-02-v6.4-net-mvneta-mark-mapped-and-tso-buffers-separately.patch new file mode 100644 index 0000000000..4db3ffe4e1 --- /dev/null +++ b/target/linux/generic/pending-5.15/704-02-v6.4-net-mvneta-mark-mapped-and-tso-buffers-separately.patch @@ -0,0 +1,42 @@ +From e3c77d0a1b635d114c147fd2078afb57ed558b81 Mon Sep 17 00:00:00 2001 +From: "Russell King (Oracle)" +Date: Mon, 3 Apr 2023 19:30:25 +0100 +Subject: [PATCH 2/5] net: mvneta: mark mapped and tso buffers separately + +Mark dma-mapped skbs and TSO buffers separately, so we can use +buf->type to identify their differences. + +Signed-off-by: Russell King (Oracle) +--- + drivers/net/ethernet/marvell/mvneta.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/marvell/mvneta.c ++++ b/drivers/net/ethernet/marvell/mvneta.c +@@ -607,6 +607,7 @@ struct mvneta_rx_desc { + #endif + + enum mvneta_tx_buf_type { ++ MVNETA_TYPE_TSO, + MVNETA_TYPE_SKB, + MVNETA_TYPE_XDP_TX, + MVNETA_TYPE_XDP_NDO, +@@ -1852,7 +1853,8 @@ static void mvneta_txq_bufs_free(struct + dma_unmap_single(pp->dev->dev.parent, + tx_desc->buf_phys_addr, + tx_desc->data_size, DMA_TO_DEVICE); +- if (buf->type == MVNETA_TYPE_SKB && buf->skb) { ++ if ((buf->type == MVNETA_TYPE_TSO || ++ buf->type == MVNETA_TYPE_SKB) && buf->skb) { + bytes_compl += buf->skb->len; + pkts_compl++; + dev_kfree_skb_any(buf->skb); +@@ -2607,7 +2609,7 @@ mvneta_tso_put_hdr(struct sk_buff *skb, + tx_desc->command |= MVNETA_TXD_F_DESC; + tx_desc->buf_phys_addr = txq->tso_hdrs_phys + + txq->txq_put_index * TSO_HEADER_SIZE; +- buf->type = MVNETA_TYPE_SKB; ++ buf->type = MVNETA_TYPE_TSO; + buf->skb = NULL; + + mvneta_txq_inc_put(txq); diff --git a/target/linux/generic/pending-5.15/704-03-v6.4-net-mvneta-use-buf-type-to-determine-whether-to-dma-.patch b/target/linux/generic/pending-5.15/704-03-v6.4-net-mvneta-use-buf-type-to-determine-whether-to-dma-.patch new file mode 100644 index 0000000000..37511ff1dd --- /dev/null +++ b/target/linux/generic/pending-5.15/704-03-v6.4-net-mvneta-use-buf-type-to-determine-whether-to-dma-.patch @@ -0,0 +1,59 @@ +From fe2abc1abc0dfc6c13fe8f189216f00dbbb33044 Mon Sep 17 00:00:00 2001 +From: "Russell King (Oracle)" +Date: Mon, 3 Apr 2023 19:30:30 +0100 +Subject: [PATCH 3/5] net: mvneta: use buf->type to determine whether to + dma-unmap + +Now that we use a different buffer type for TSO headers, we can use +buf->type to determine whether the original buffer was DMA-mapped or +not. The rules are: + + MVNETA_TYPE_XDP_TX - from a DMA pool, no unmap is required + MVNETA_TYPE_XDP_NDO - dma_map_single()'d + MVNETA_TYPE_SKB - normal skbuff, dma_map_single()'d + MVNETA_TYPE_TSO - from the TSO buffer area + +This means we only need to call dma_unmap_single() on the XDP_NDO and +SKB types of buffer, and we no longer need the private IS_TSO_HEADER() +which relies on the TSO region being contiguously allocated. + +Signed-off-by: Russell King (Oracle) +--- + drivers/net/ethernet/marvell/mvneta.c | 11 ++++------- + 1 file changed, 4 insertions(+), 7 deletions(-) + +--- a/drivers/net/ethernet/marvell/mvneta.c ++++ b/drivers/net/ethernet/marvell/mvneta.c +@@ -334,10 +334,6 @@ + MVNETA_SKB_HEADROOM)) + #define MVNETA_MAX_RX_BUF_SIZE (PAGE_SIZE - MVNETA_SKB_PAD) + +-#define IS_TSO_HEADER(txq, addr) \ +- ((addr >= txq->tso_hdrs_phys) && \ +- (addr < txq->tso_hdrs_phys + txq->size * TSO_HEADER_SIZE)) +- + #define MVNETA_RX_GET_BM_POOL_ID(rxd) \ + (((rxd)->status & MVNETA_RXD_BM_POOL_MASK) >> MVNETA_RXD_BM_POOL_SHIFT) + +@@ -1848,8 +1844,8 @@ static void mvneta_txq_bufs_free(struct + + mvneta_txq_inc_get(txq); + +- if (!IS_TSO_HEADER(txq, tx_desc->buf_phys_addr) && +- buf->type != MVNETA_TYPE_XDP_TX) ++ if (buf->type == MVNETA_TYPE_XDP_NDO || ++ buf->type == MVNETA_TYPE_SKB) + dma_unmap_single(pp->dev->dev.parent, + tx_desc->buf_phys_addr, + tx_desc->data_size, DMA_TO_DEVICE); +@@ -2661,8 +2657,9 @@ static void mvneta_release_descs(struct + + for (i = num; i >= 0; i--) { + struct mvneta_tx_desc *tx_desc = txq->descs + desc_idx; ++ struct mvneta_tx_buf *buf = &txq->buf[desc_idx]; + +- if (!IS_TSO_HEADER(txq, tx_desc->buf_phys_addr)) ++ if (buf->type == MVNETA_TYPE_SKB) + dma_unmap_single(pp->dev->dev.parent, + tx_desc->buf_phys_addr, + tx_desc->data_size, diff --git a/target/linux/generic/pending-5.15/704-04-v6.4-net-mvneta-move-tso_build_hdr-into-mvneta_tso_put_hd.patch b/target/linux/generic/pending-5.15/704-04-v6.4-net-mvneta-move-tso_build_hdr-into-mvneta_tso_put_hd.patch new file mode 100644 index 0000000000..444b60f151 --- /dev/null +++ b/target/linux/generic/pending-5.15/704-04-v6.4-net-mvneta-move-tso_build_hdr-into-mvneta_tso_put_hd.patch @@ -0,0 +1,65 @@ +From 210ca75d4949f1ace8ea53a75148806cc28224a0 Mon Sep 17 00:00:00 2001 +From: "Russell King (Oracle)" +Date: Mon, 3 Apr 2023 19:30:35 +0100 +Subject: [PATCH 4/5] net: mvneta: move tso_build_hdr() into + mvneta_tso_put_hdr() + +Move tso_build_hdr() into mvneta_tso_put_hdr() so that all the TSO +header building code is in one place. + +Signed-off-by: Russell King (Oracle) +--- + drivers/net/ethernet/marvell/mvneta.c | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +--- a/drivers/net/ethernet/marvell/mvneta.c ++++ b/drivers/net/ethernet/marvell/mvneta.c +@@ -2592,19 +2592,24 @@ err_drop_frame: + return rx_done; + } + +-static inline void +-mvneta_tso_put_hdr(struct sk_buff *skb, struct mvneta_tx_queue *txq) ++static void mvneta_tso_put_hdr(struct sk_buff *skb, struct mvneta_tx_queue *txq, ++ struct tso_t *tso, int size, bool is_last) + { +- int hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); ++ int tso_offset, hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); + struct mvneta_tx_buf *buf = &txq->buf[txq->txq_put_index]; + struct mvneta_tx_desc *tx_desc; ++ char *hdr; ++ ++ tso_offset = txq->txq_put_index * TSO_HEADER_SIZE; ++ ++ hdr = txq->tso_hdrs + tso_offset; ++ tso_build_hdr(skb, hdr, tso, size, is_last); + + tx_desc = mvneta_txq_next_desc_get(txq); + tx_desc->data_size = hdr_len; + tx_desc->command = mvneta_skb_tx_csum(skb); + tx_desc->command |= MVNETA_TXD_F_DESC; +- tx_desc->buf_phys_addr = txq->tso_hdrs_phys + +- txq->txq_put_index * TSO_HEADER_SIZE; ++ tx_desc->buf_phys_addr = txq->tso_hdrs_phys + tso_offset; + buf->type = MVNETA_TYPE_TSO; + buf->skb = NULL; + +@@ -2697,17 +2702,12 @@ static int mvneta_tx_tso(struct sk_buff + + total_len = skb->len - hdr_len; + while (total_len > 0) { +- char *hdr; +- + data_left = min_t(int, skb_shinfo(skb)->gso_size, total_len); + total_len -= data_left; + desc_count++; + + /* prepare packet headers: MAC + IP + TCP */ +- hdr = txq->tso_hdrs + txq->txq_put_index * TSO_HEADER_SIZE; +- tso_build_hdr(skb, hdr, &tso, data_left, total_len == 0); +- +- mvneta_tso_put_hdr(skb, txq); ++ mvneta_tso_put_hdr(skb, txq, &tso, data_left, total_len == 0); + + while (data_left > 0) { + int size; diff --git a/target/linux/generic/pending-5.15/704-05-v6.4-net-mvneta-allocate-TSO-header-DMA-memory-in-chunks.patch b/target/linux/generic/pending-5.15/704-05-v6.4-net-mvneta-allocate-TSO-header-DMA-memory-in-chunks.patch new file mode 100644 index 0000000000..395a0bf5d2 --- /dev/null +++ b/target/linux/generic/pending-5.15/704-05-v6.4-net-mvneta-allocate-TSO-header-DMA-memory-in-chunks.patch @@ -0,0 +1,179 @@ +From 58d50fb089da553023df5a05f5ae86feaacc7f24 Mon Sep 17 00:00:00 2001 +From: "Russell King (Oracle)" +Date: Mon, 3 Apr 2023 19:30:40 +0100 +Subject: [PATCH 5/5] net: mvneta: allocate TSO header DMA memory in chunks + +Now that we no longer need to check whether the DMA address is within +the TSO header DMA memory range for the queue, we can allocate the TSO +header DMA memory in chunks rather than one contiguous order-6 chunk, +which can stress the kernel's memory subsystems to allocate. + +Instead, use order-1 (8k) allocations, which will result in 32 order-1 +pages containing 32 TSO headers. + +Signed-off-by: Russell King (Oracle) +--- + drivers/net/ethernet/marvell/mvneta.c | 88 +++++++++++++++++++++------ + 1 file changed, 70 insertions(+), 18 deletions(-) + +--- a/drivers/net/ethernet/marvell/mvneta.c ++++ b/drivers/net/ethernet/marvell/mvneta.c +@@ -314,6 +314,15 @@ + + #define MVNETA_MAX_SKB_DESCS (MVNETA_MAX_TSO_SEGS * 2 + MAX_SKB_FRAGS) + ++/* The size of a TSO header page */ ++#define MVNETA_TSO_PAGE_SIZE (2 * PAGE_SIZE) ++ ++/* Number of TSO headers per page. This should be a power of 2 */ ++#define MVNETA_TSO_PER_PAGE (MVNETA_TSO_PAGE_SIZE / TSO_HEADER_SIZE) ++ ++/* Maximum number of TSO header pages */ ++#define MVNETA_MAX_TSO_PAGES (MVNETA_MAX_TXD / MVNETA_TSO_PER_PAGE) ++ + /* descriptor aligned size */ + #define MVNETA_DESC_ALIGNED_SIZE 32 + +@@ -656,10 +665,10 @@ struct mvneta_tx_queue { + int next_desc_to_proc; + + /* DMA buffers for TSO headers */ +- char *tso_hdrs; ++ char *tso_hdrs[MVNETA_MAX_TSO_PAGES]; + + /* DMA address of TSO headers */ +- dma_addr_t tso_hdrs_phys; ++ dma_addr_t tso_hdrs_phys[MVNETA_MAX_TSO_PAGES]; + + /* Affinity mask for CPUs*/ + cpumask_t affinity_mask; +@@ -2592,24 +2601,71 @@ err_drop_frame: + return rx_done; + } + ++static void mvneta_free_tso_hdrs(struct mvneta_port *pp, ++ struct mvneta_tx_queue *txq) ++{ ++ struct device *dev = pp->dev->dev.parent; ++ int i; ++ ++ for (i = 0; i < MVNETA_MAX_TSO_PAGES; i++) { ++ if (txq->tso_hdrs[i]) { ++ dma_free_coherent(dev, MVNETA_TSO_PAGE_SIZE, ++ txq->tso_hdrs[i], ++ txq->tso_hdrs_phys[i]); ++ txq->tso_hdrs[i] = NULL; ++ } ++ } ++} ++ ++static int mvneta_alloc_tso_hdrs(struct mvneta_port *pp, ++ struct mvneta_tx_queue *txq) ++{ ++ struct device *dev = pp->dev->dev.parent; ++ int i, num; ++ ++ num = DIV_ROUND_UP(txq->size, MVNETA_TSO_PER_PAGE); ++ for (i = 0; i < num; i++) { ++ txq->tso_hdrs[i] = dma_alloc_coherent(dev, MVNETA_TSO_PAGE_SIZE, ++ &txq->tso_hdrs_phys[i], ++ GFP_KERNEL); ++ if (!txq->tso_hdrs[i]) { ++ mvneta_free_tso_hdrs(pp, txq); ++ return -ENOMEM; ++ } ++ } ++ ++ return 0; ++} ++ ++static char *mvneta_get_tso_hdr(struct mvneta_tx_queue *txq, dma_addr_t *dma) ++{ ++ int index, offset; ++ ++ index = txq->txq_put_index / MVNETA_TSO_PER_PAGE; ++ offset = (txq->txq_put_index % MVNETA_TSO_PER_PAGE) * TSO_HEADER_SIZE; ++ ++ *dma = txq->tso_hdrs_phys[index] + offset; ++ ++ return txq->tso_hdrs[index] + offset; ++} ++ + static void mvneta_tso_put_hdr(struct sk_buff *skb, struct mvneta_tx_queue *txq, + struct tso_t *tso, int size, bool is_last) + { +- int tso_offset, hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); ++ int hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); + struct mvneta_tx_buf *buf = &txq->buf[txq->txq_put_index]; + struct mvneta_tx_desc *tx_desc; ++ dma_addr_t hdr_phys; + char *hdr; + +- tso_offset = txq->txq_put_index * TSO_HEADER_SIZE; +- +- hdr = txq->tso_hdrs + tso_offset; ++ hdr = mvneta_get_tso_hdr(txq, &hdr_phys); + tso_build_hdr(skb, hdr, tso, size, is_last); + + tx_desc = mvneta_txq_next_desc_get(txq); + tx_desc->data_size = hdr_len; + tx_desc->command = mvneta_skb_tx_csum(skb); + tx_desc->command |= MVNETA_TXD_F_DESC; +- tx_desc->buf_phys_addr = txq->tso_hdrs_phys + tso_offset; ++ tx_desc->buf_phys_addr = hdr_phys; + buf->type = MVNETA_TYPE_TSO; + buf->skb = NULL; + +@@ -3401,7 +3457,7 @@ static void mvneta_rxq_deinit(struct mvn + static int mvneta_txq_sw_init(struct mvneta_port *pp, + struct mvneta_tx_queue *txq) + { +- int cpu; ++ int cpu, err; + + txq->size = pp->tx_ring_size; + +@@ -3426,11 +3482,9 @@ static int mvneta_txq_sw_init(struct mvn + return -ENOMEM; + + /* Allocate DMA buffers for TSO MAC/IP/TCP headers */ +- txq->tso_hdrs = dma_alloc_coherent(pp->dev->dev.parent, +- txq->size * TSO_HEADER_SIZE, +- &txq->tso_hdrs_phys, GFP_KERNEL); +- if (!txq->tso_hdrs) +- return -ENOMEM; ++ err = mvneta_alloc_tso_hdrs(pp, txq); ++ if (err) ++ return err; + + /* Setup XPS mapping */ + if (pp->neta_armada3700) +@@ -3482,10 +3536,7 @@ static void mvneta_txq_sw_deinit(struct + + kfree(txq->buf); + +- if (txq->tso_hdrs) +- dma_free_coherent(pp->dev->dev.parent, +- txq->size * TSO_HEADER_SIZE, +- txq->tso_hdrs, txq->tso_hdrs_phys); ++ mvneta_free_tso_hdrs(pp, txq); + if (txq->descs) + dma_free_coherent(pp->dev->dev.parent, + txq->size * MVNETA_DESC_ALIGNED_SIZE, +@@ -3494,7 +3545,6 @@ static void mvneta_txq_sw_deinit(struct + netdev_tx_reset_queue(nq); + + txq->buf = NULL; +- txq->tso_hdrs = NULL; + txq->descs = NULL; + txq->last_desc = 0; + txq->next_desc_to_proc = 0; +@@ -5543,6 +5593,8 @@ static int __init mvneta_driver_init(voi + { + int ret; + ++ BUILD_BUG_ON_NOT_POWER_OF_2(MVNETA_TSO_PER_PAGE); ++ + ret = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN, "net/mvneta:online", + mvneta_cpu_online, + mvneta_cpu_down_prepare); diff --git a/target/linux/mvebu/patches-5.15/700-mvneta-tx-queue-workaround.patch b/target/linux/mvebu/patches-5.15/700-mvneta-tx-queue-workaround.patch index 826f95d1c2..32e8ef4b7d 100644 --- a/target/linux/mvebu/patches-5.15/700-mvneta-tx-queue-workaround.patch +++ b/target/linux/mvebu/patches-5.15/700-mvneta-tx-queue-workaround.patch @@ -9,7 +9,7 @@ Signed-off-by: Felix Fietkau --- --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c -@@ -4943,6 +4943,16 @@ static int mvneta_setup_tc(struct net_de +@@ -5006,6 +5006,16 @@ static int mvneta_setup_tc(struct net_de } } @@ -26,7 +26,7 @@ Signed-off-by: Felix Fietkau static const struct net_device_ops mvneta_netdev_ops = { .ndo_open = mvneta_open, .ndo_stop = mvneta_stop, -@@ -4953,6 +4963,9 @@ static const struct net_device_ops mvnet +@@ -5016,6 +5026,9 @@ static const struct net_device_ops mvnet .ndo_fix_features = mvneta_fix_features, .ndo_get_stats64 = mvneta_get_stats64, .ndo_eth_ioctl = mvneta_ioctl, diff --git a/target/linux/mvebu/patches-5.15/702-net-next-ethernet-marvell-mvnetaMQPrioOffload.patch b/target/linux/mvebu/patches-5.15/702-net-next-ethernet-marvell-mvnetaMQPrioOffload.patch index c3a6d9f4d0..019b9528c3 100644 --- a/target/linux/mvebu/patches-5.15/702-net-next-ethernet-marvell-mvnetaMQPrioOffload.patch +++ b/target/linux/mvebu/patches-5.15/702-net-next-ethernet-marvell-mvnetaMQPrioOffload.patch @@ -26,7 +26,7 @@ Signed-off-by: David S. Miller #include /* Registers */ -@@ -4903,14 +4904,14 @@ static void mvneta_setup_rx_prio_map(str +@@ -4966,14 +4967,14 @@ static void mvneta_setup_rx_prio_map(str } static int mvneta_setup_mqprio(struct net_device *dev, @@ -44,7 +44,7 @@ Signed-off-by: David S. Miller if (num_tc > rxq_number) return -EINVAL; -@@ -4921,13 +4922,15 @@ static int mvneta_setup_mqprio(struct ne +@@ -4984,13 +4985,15 @@ static int mvneta_setup_mqprio(struct ne return 0; } diff --git a/target/linux/mvebu/patches-5.15/703-net-next-ethernet-marvell-mvnetaMQPrioFlag.patch b/target/linux/mvebu/patches-5.15/703-net-next-ethernet-marvell-mvnetaMQPrioFlag.patch index 8ef585be9a..c878a28843 100644 --- a/target/linux/mvebu/patches-5.15/703-net-next-ethernet-marvell-mvnetaMQPrioFlag.patch +++ b/target/linux/mvebu/patches-5.15/703-net-next-ethernet-marvell-mvnetaMQPrioFlag.patch @@ -17,7 +17,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c -@@ -4910,7 +4910,9 @@ static int mvneta_setup_mqprio(struct ne +@@ -4973,7 +4973,9 @@ static int mvneta_setup_mqprio(struct ne u8 num_tc; int i; diff --git a/target/linux/mvebu/patches-5.15/704-net-next-ethernet-marvell-mvnetaMQPrioQueue.patch b/target/linux/mvebu/patches-5.15/704-net-next-ethernet-marvell-mvnetaMQPrioQueue.patch index 196b986541..546a8486ef 100644 --- a/target/linux/mvebu/patches-5.15/704-net-next-ethernet-marvell-mvnetaMQPrioQueue.patch +++ b/target/linux/mvebu/patches-5.15/704-net-next-ethernet-marvell-mvnetaMQPrioQueue.patch @@ -22,7 +22,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c -@@ -493,7 +493,6 @@ struct mvneta_port { +@@ -498,7 +498,6 @@ struct mvneta_port { u8 mcast_count[256]; u16 tx_ring_size; u16 rx_ring_size; @@ -30,7 +30,7 @@ Signed-off-by: David S. Miller phy_interface_t phy_interface; struct device_node *dn; -@@ -4892,13 +4891,12 @@ static void mvneta_clear_rx_prio_map(str +@@ -4955,13 +4954,12 @@ static void mvneta_clear_rx_prio_map(str mvreg_write(pp, MVNETA_VLAN_PRIO_TO_RXQ, 0); } @@ -48,7 +48,7 @@ Signed-off-by: David S. Miller mvreg_write(pp, MVNETA_VLAN_PRIO_TO_RXQ, val); } -@@ -4907,8 +4905,8 @@ static int mvneta_setup_mqprio(struct ne +@@ -4970,8 +4968,8 @@ static int mvneta_setup_mqprio(struct ne struct tc_mqprio_qopt_offload *mqprio) { struct mvneta_port *pp = netdev_priv(dev); @@ -58,7 +58,7 @@ Signed-off-by: David S. Miller if (mqprio->qopt.hw != TC_MQPRIO_HW_OFFLOAD_TCS) return 0; -@@ -4918,21 +4916,28 @@ static int mvneta_setup_mqprio(struct ne +@@ -4981,21 +4979,28 @@ static int mvneta_setup_mqprio(struct ne if (num_tc > rxq_number) return -EINVAL; diff --git a/target/linux/mvebu/patches-5.15/705-net-next-ethernet-marvell-mvnetaMQPrioTCOffload.patch b/target/linux/mvebu/patches-5.15/705-net-next-ethernet-marvell-mvnetaMQPrioTCOffload.patch index d640da4d44..1d4a055a71 100644 --- a/target/linux/mvebu/patches-5.15/705-net-next-ethernet-marvell-mvnetaMQPrioTCOffload.patch +++ b/target/linux/mvebu/patches-5.15/705-net-next-ethernet-marvell-mvnetaMQPrioTCOffload.patch @@ -62,7 +62,7 @@ Signed-off-by: David S. Miller #define MVNETA_LPI_CTRL_0 0x2cc0 #define MVNETA_LPI_CTRL_1 0x2cc4 #define MVNETA_LPI_REQUEST_ENABLE BIT(0) -@@ -4901,11 +4928,74 @@ static void mvneta_map_vlan_prio_to_rxq( +@@ -4964,11 +4991,74 @@ static void mvneta_map_vlan_prio_to_rxq( mvreg_write(pp, MVNETA_VLAN_PRIO_TO_RXQ, val); } @@ -138,7 +138,7 @@ Signed-off-by: David S. Miller u8 num_tc; if (mqprio->qopt.hw != TC_MQPRIO_HW_OFFLOAD_TCS) -@@ -4919,6 +5009,7 @@ static int mvneta_setup_mqprio(struct ne +@@ -4982,6 +5072,7 @@ static int mvneta_setup_mqprio(struct ne mvneta_clear_rx_prio_map(pp); if (!num_tc) { @@ -146,7 +146,7 @@ Signed-off-by: David S. Miller netdev_reset_tc(dev); return 0; } -@@ -4939,6 +5030,33 @@ static int mvneta_setup_mqprio(struct ne +@@ -5002,6 +5093,33 @@ static int mvneta_setup_mqprio(struct ne } } From 1eb02ce3254ef6f115640df8ac470574d6903588 Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Wed, 17 May 2023 17:12:18 -0600 Subject: [PATCH 5/6] x86/64: Enable IOMMU_V2 support for later CPUs Support newer IOMMU_V2 on AMD platforms, useful for DPDK and KVM. Signed-off-by: Philip Prindeville --- target/linux/x86/64/config-5.15 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/x86/64/config-5.15 b/target/linux/x86/64/config-5.15 index a20891ea55..d972668e54 100644 --- a/target/linux/x86/64/config-5.15 +++ b/target/linux/x86/64/config-5.15 @@ -42,7 +42,7 @@ CONFIG_AGP_INTEL=y # CONFIG_AGP_SIS is not set # CONFIG_AGP_VIA is not set CONFIG_AMD_IOMMU=y -# CONFIG_AMD_IOMMU_V2 is not set +CONFIG_AMD_IOMMU_V2=y # CONFIG_AMD_PMC is not set # CONFIG_AMD_PTDMA is not set # CONFIG_AMD_SFH_HID is not set From a0d71934253f599f4ac651b1b3a429901049e802 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Thu, 1 Jun 2023 15:22:26 +0800 Subject: [PATCH 6/6] openssl: fix uci config for built-in engines Built-in engine configs are added in libopenssl-conf/install stage already, postinst/add_engine_config is just duplicating them, and due to the lack of `config` header it results a broken uci config: > uci: Parse error (invalid command) at line 3, byte 0 ``` config engine 'devcrypto' option enabled '1' engine 'devcrypto' option enabled '1' option builtin '1' ``` Add `builtin` option in libopenssl-conf/install stage and remove duplicate engine configuration in postinst/add_engine_config to fix this issue. Fixes: 0b70d55a64c39d ("openssl: make UCI config aware of built-in engines") Signed-off-by: Tianling Shen --- package/libs/openssl/Makefile | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile index bd1cfed447..66ababab3c 100644 --- a/package/libs/openssl/Makefile +++ b/package/libs/openssl/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openssl PKG_VERSION:=3.0.8 -PKG_RELEASE:=9 +PKG_RELEASE:=10 PKG_BUILD_FLAGS:=no-mips16 gc-sections PKG_BUILD_PARALLEL:=1 @@ -141,7 +141,6 @@ endef ifneq ($(CONFIG_OPENSSL_ENGINE_BUILTIN_PADLOCK)$(CONFIG_OPENSSL_ENGINE_BUILTIN_DEVCRYPTO),) define Package/libopenssl-conf/postinst #!/bin/sh -OPENSSL_UCI="$${IPKG_INSTROOT}/etc/config/openssl" add_engine_config() { if [ -z "$${IPKG_INSTROOT}" ] && uci -q get "openssl.$$1" >/dev/null; then @@ -149,12 +148,6 @@ add_engine_config() { uci set "openssl.$$1.builtin=1" && uci commit openssl return fi - { - echo "engine '$$1'" - echo " option enabled '1'" - echo " option builtin '1'" - echo - } >>"$${OPENSSL_UCI}" } $(if $(CONFIG_OPENSSL_ENGINE_BUILTIN_DEVCRYPTO),add_engine_config devcrypto) @@ -424,10 +417,10 @@ define Package/libopenssl-conf/install touch $(1)/etc/config/openssl $(if $(CONFIG_OPENSSL_ENGINE_BUILTIN_DEVCRYPTO), $(CP) ./files/devcrypto.cnf $(1)/etc/ssl/modules.cnf.d/ - echo -e "config engine 'devcrypto'\n\toption enabled '1'" >> $(1)/etc/config/openssl) + echo -e "config engine 'devcrypto'\n\toption enabled '1'\n\toption builtin '1'" >> $(1)/etc/config/openssl) $(if $(CONFIG_OPENSSL_ENGINE_BUILTIN_PADLOCK), $(CP) ./files/padlock.cnf $(1)/etc/ssl/modules.cnf.d/ - echo -e "\nconfig engine 'padlock'\n\toption enabled '1'" >> $(1)/etc/config/openssl) + echo -e "\nconfig engine 'padlock'\n\toption enabled '1'\n\toption builtin '1'" >> $(1)/etc/config/openssl) endef define Package/openssl-util/install