openwrt/target/linux/layerscape/patches-5.4/701-net-0047-sdk_dpaa-update-comments-about-recycling-and-back-po.patch
Yangbo Lu cddd459140 layerscape: add patches-5.4
Add patches for linux-5.4. The patches are from NXP LSDK-20.04 release
which was tagged LSDK-20.04-V5.4.
https://source.codeaurora.org/external/qoriq/qoriq-components/linux/

For boards LS1021A-IOT, and Traverse-LS1043 which are not involved in
LSDK, port the dts patches from 4.14.

The patches are sorted into the following categories:
  301-arch-xxxx
  302-dts-xxxx
  303-core-xxxx
  701-net-xxxx
  801-audio-xxxx
  802-can-xxxx
  803-clock-xxxx
  804-crypto-xxxx
  805-display-xxxx
  806-dma-xxxx
  807-gpio-xxxx
  808-i2c-xxxx
  809-jailhouse-xxxx
  810-keys-xxxx
  811-kvm-xxxx
  812-pcie-xxxx
  813-pm-xxxx
  814-qe-xxxx
  815-sata-xxxx
  816-sdhc-xxxx
  817-spi-xxxx
  818-thermal-xxxx
  819-uart-xxxx
  820-usb-xxxx
  821-vfio-xxxx

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2020-05-07 12:53:06 +02:00

68 lines
2.5 KiB
Diff

From 2d7b6e7daf076b63f461ce9c4ec6022ddc3d15bb Mon Sep 17 00:00:00 2001
From: Camelia Groza <camelia.groza@nxp.com>
Date: Mon, 15 Jan 2018 17:42:42 +0200
Subject: [PATCH] sdk_dpaa: update comments about recycling and back-pointer
storage
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
---
drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
--- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c
+++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c
@@ -121,6 +121,10 @@ static int _dpa_bp_add_8_bufs(const stru
put_page(virt_to_head_page(new_buf));
goto build_skb_failed;
}
+
+ /* Store the skb back-pointer before the start of the buffer.
+ * Otherwise it will be overwritten by the FMan.
+ */
DPA_WRITE_SKB_PTR(skb, skbh, new_buf, -1);
addr = dma_map_single(dev, new_buf,
@@ -344,7 +348,10 @@ bool dpa_buf_is_recyclable(struct sk_buf
* - buffer address aligned to cacheline bytes
* - offset of data from start of buffer no lower than a minimum value
* - offset of data from start of buffer no higher than a maximum value
+ * - the skb back-pointer is stored safely
*/
+
+ /* guarantee both the minimum size and the minimum data offset */
new = min(skb_end_pointer(skb) - min_size, skb->data - min_offset);
/* left align to the nearest cacheline */
@@ -694,6 +701,9 @@ int __hot skb_to_contig_fd(struct dpa_pr
dma_dir = DMA_BIDIRECTIONAL;
dma_map_size = dpa_bp->size;
+ /* Store the skb back-pointer before the start of the buffer.
+ * Otherwise it will be overwritten by the FMan.
+ */
DPA_WRITE_SKB_PTR(skb, skbh, buffer_start, -1);
*offset = skb_headroom(skb) - fd->offset;
} else
@@ -711,7 +721,7 @@ int __hot skb_to_contig_fd(struct dpa_pr
/* The buffer will be Tx-confirmed, but the TxConf cb must
* necessarily look at our Tx private data to retrieve the
- * skbuff. (In short: can't use DPA_WRITE_SKB_PTR() here.)
+ * skbuff. Store the back-pointer inside the buffer.
*/
DPA_WRITE_SKB_PTR(skb, skbh, buffer_start, 0);
}
@@ -975,7 +985,11 @@ int __hot skb_to_sg_fd(struct dpa_priv_s
fd->length20 = skb->len;
fd->offset = priv->tx_headroom;
- /* DMA map the SGT page */
+ /* DMA map the SGT page
+ *
+ * It's safe to store the skb back-pointer inside the buffer since
+ * S/G frames are non-recyclable.
+ */
DPA_WRITE_SKB_PTR(skb, skbh, sgt_buf, 0);
addr = dma_map_single(dpa_bp->dev, sgt_buf,
priv->tx_headroom + sgt_size,