diff --git a/patches.suse/net-qcom-emac-Use-proper-free-methods-during-TX.patch b/patches.suse/net-qcom-emac-Use-proper-free-methods-during-TX.patch new file mode 100644 index 0000000..07d0b2b --- /dev/null +++ b/patches.suse/net-qcom-emac-Use-proper-free-methods-during-TX.patch @@ -0,0 +1,73 @@ +From 388c93a3a44a236da79ea39029a8a7e41e4f35f1 Mon Sep 17 00:00:00 2001 +From: Hemanth Puranik +Date: Tue, 6 Mar 2018 08:18:06 +0530 +Subject: [PATCH 4/8] net: qcom/emac: Use proper free methods during TX +References: git-fixes +Patch-mainline: v4.16-rc7 +Git-commit: cc5db3150e87fe7f7e947bf333b6c1c97f848ecb + +This patch fixes the warning messages/call traces seen if DMA debug is +enabled, In case of fragmented skb's memory was allocated using +dma_map_page but freed using dma_unmap_single. This patch modifies buffer +allocations in TX path to use dma_map_page in all the places and +dma_unmap_page while freeing the buffers. + +Signed-off-by: Hemanth Puranik +Acked-by: Timur Tabi +Signed-off-by: David S. Miller +Signed-off-by: Denis Kirjanov +--- + drivers/net/ethernet/qualcomm/emac/emac-mac.c | 23 ++++++++++++++--------- + 1 file changed, 14 insertions(+), 9 deletions(-) + +diff --git a/drivers/net/ethernet/qualcomm/emac/emac-mac.c b/drivers/net/ethernet/qualcomm/emac/emac-mac.c +index 7715a0d4b28b..af197513d75a 100644 +--- a/drivers/net/ethernet/qualcomm/emac/emac-mac.c ++++ b/drivers/net/ethernet/qualcomm/emac/emac-mac.c +@@ -1182,9 +1182,9 @@ void emac_mac_tx_process(struct emac_adapter *adpt, struct emac_tx_queue *tx_q) + while (tx_q->tpd.consume_idx != hw_consume_idx) { + tpbuf = GET_TPD_BUFFER(tx_q, tx_q->tpd.consume_idx); + if (tpbuf->dma_addr) { +- dma_unmap_single(adpt->netdev->dev.parent, +- tpbuf->dma_addr, tpbuf->length, +- DMA_TO_DEVICE); ++ dma_unmap_page(adpt->netdev->dev.parent, ++ tpbuf->dma_addr, tpbuf->length, ++ DMA_TO_DEVICE); + tpbuf->dma_addr = 0; + } + +@@ -1341,9 +1341,11 @@ static void emac_tx_fill_tpd(struct emac_adapter *adpt, + + tpbuf = GET_TPD_BUFFER(tx_q, tx_q->tpd.produce_idx); + tpbuf->length = mapped_len; +- tpbuf->dma_addr = dma_map_single(adpt->netdev->dev.parent, +- skb->data, tpbuf->length, +- DMA_TO_DEVICE); ++ tpbuf->dma_addr = dma_map_page(adpt->netdev->dev.parent, ++ virt_to_page(skb->data), ++ offset_in_page(skb->data), ++ tpbuf->length, ++ DMA_TO_DEVICE); + ret = dma_mapping_error(adpt->netdev->dev.parent, + tpbuf->dma_addr); + if (ret) +@@ -1359,9 +1361,12 @@ static void emac_tx_fill_tpd(struct emac_adapter *adpt, + if (mapped_len < len) { + tpbuf = GET_TPD_BUFFER(tx_q, tx_q->tpd.produce_idx); + tpbuf->length = len - mapped_len; +- tpbuf->dma_addr = dma_map_single(adpt->netdev->dev.parent, +- skb->data + mapped_len, +- tpbuf->length, DMA_TO_DEVICE); ++ tpbuf->dma_addr = dma_map_page(adpt->netdev->dev.parent, ++ virt_to_page(skb->data + ++ mapped_len), ++ offset_in_page(skb->data + ++ mapped_len), ++ tpbuf->length, DMA_TO_DEVICE); + ret = dma_mapping_error(adpt->netdev->dev.parent, + tpbuf->dma_addr); + if (ret) +-- +2.16.4 + diff --git a/series.conf b/series.conf index e6f01be..ece1e02 100644 --- a/series.conf +++ b/series.conf @@ -25510,6 +25510,7 @@ patches.suse/e1000e-Fix-check_for_link-return-value-with-autoneg-.patch patches.suse/e1000e-allocate-ring-descriptors-with-dma_zalloc_coh.patch patches.suse/qed-Free-RoCE-ILT-Memory-on-rmmod-qedr.patch + patches.suse/net-qcom-emac-Use-proper-free-methods-during-TX.patch patches.suse/net-smsc911x-Fix-unload-crash-when-link-is-up.patch patches.suse/net-Fix-hlist-corruptions-in-inet_evict_bucket.patch patches.suse/l2tp-do-not-accept-arbitrary-sockets.patch