openwrt/target/linux/layerscape/patches-5.4/701-net-0075-sdk_dpaa-reserve-256-bytes-for-the-SGT-on-TX.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

58 lines
2.2 KiB
Diff

From 29757ae2e4a0e8e1e816c9eeef59121908320669 Mon Sep 17 00:00:00 2001
From: Camelia Groza <camelia.groza@nxp.com>
Date: Wed, 20 Jun 2018 18:00:42 +0300
Subject: [PATCH] sdk_dpaa: reserve 256 bytes for the SGT on TX
The FMan reads 256 bytes from the start of the SGT regardless of its
size. We reserve the same amount of memory on TX to access.
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
---
drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.h | 6 ++++--
drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c | 10 +++++++---
2 files changed, 11 insertions(+), 5 deletions(-)
--- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.h
+++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.h
@@ -55,10 +55,12 @@
fm_set_##type##_port_params(port, &param); \
}
+/* The SGT needs to be 256 bytes long. Even if the table has only one entry,
+ * the FMan will read 256 bytes from its start.
+ */
+#define DPA_SGT_SIZE 256
#define DPA_SGT_MAX_ENTRIES 16 /* maximum number of entries in SG Table */
-#define DPA_SGT_ENTRIES_THRESHOLD DPA_SGT_MAX_ENTRIES
-
#define DPA_BUFF_RELEASE_MAX 8 /* maximum number of buffers released at once */
#define DPA_RX_PCD_HI_PRIO_FQ_INIT_FAIL(dpa_fq, _errno) \
--- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c
+++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c
@@ -246,8 +246,8 @@ struct sk_buff *_dpa_cleanup_tx_fd(const
if (unlikely(fd->format == qm_fd_sg)) {
nr_frags = skb_shinfo(skb)->nr_frags;
- dma_unmap_single(dpa_bp->dev, addr, dpa_fd_offset(fd) +
- sizeof(struct qm_sg_entry) * (1 + nr_frags),
+ dma_unmap_single(dpa_bp->dev, addr,
+ dpa_fd_offset(fd) + DPA_SGT_SIZE,
dma_dir);
/* The sgt buffer has been allocated with netdev_alloc_frag(),
@@ -896,7 +896,11 @@ int __hot skb_to_sg_fd(struct dpa_priv_s
nr_frags = skb_shinfo(skb)->nr_frags;
fd->format = qm_fd_sg;
- sgt_size = sizeof(struct qm_sg_entry) * (1 + nr_frags);
+ /* The FMan reads 256 bytes from the start of the SGT regardless of
+ * its size. In accordance, we reserve the same amount of memory as
+ * well.
+ */
+ sgt_size = DPA_SGT_SIZE;
/* Get a page frag to store the SGTable, or a full page if the errata
* is in place and we need to avoid crossing a 4k boundary.