1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
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, ¶m); \
}
+/* 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.
|