ath79/mikrotik: use routerbootpart partitions
[oweals/openwrt.git] / target / linux / layerscape / patches-5.4 / 701-net-0075-sdk_dpaa-reserve-256-bytes-for-the-SGT-on-TX.patch
1 From 29757ae2e4a0e8e1e816c9eeef59121908320669 Mon Sep 17 00:00:00 2001
2 From: Camelia Groza <camelia.groza@nxp.com>
3 Date: Wed, 20 Jun 2018 18:00:42 +0300
4 Subject: [PATCH] sdk_dpaa: reserve 256 bytes for the SGT on TX
5
6 The FMan reads 256 bytes from the start of the SGT regardless of its
7 size. We reserve the same amount of memory on TX to access.
8
9 Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
10 ---
11  drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.h |  6 ++++--
12  drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c     | 10 +++++++---
13  2 files changed, 11 insertions(+), 5 deletions(-)
14
15 --- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.h
16 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.h
17 @@ -55,10 +55,12 @@
18         fm_set_##type##_port_params(port, &param); \
19  }
20  
21 +/* The SGT needs to be 256 bytes long. Even if the table has only one entry,
22 + * the FMan will read 256 bytes from its start.
23 + */
24 +#define DPA_SGT_SIZE 256
25  #define DPA_SGT_MAX_ENTRIES 16 /* maximum number of entries in SG Table */
26  
27 -#define DPA_SGT_ENTRIES_THRESHOLD      DPA_SGT_MAX_ENTRIES
28 -
29  #define DPA_BUFF_RELEASE_MAX 8 /* maximum number of buffers released at once */
30  
31  #define DPA_RX_PCD_HI_PRIO_FQ_INIT_FAIL(dpa_fq, _errno) \
32 --- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c
33 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c
34 @@ -246,8 +246,8 @@ struct sk_buff *_dpa_cleanup_tx_fd(const
35  
36         if (unlikely(fd->format == qm_fd_sg)) {
37                 nr_frags = skb_shinfo(skb)->nr_frags;
38 -               dma_unmap_single(dpa_bp->dev, addr, dpa_fd_offset(fd) +
39 -                                sizeof(struct qm_sg_entry) * (1 + nr_frags),
40 +               dma_unmap_single(dpa_bp->dev, addr,
41 +                                dpa_fd_offset(fd) + DPA_SGT_SIZE,
42                                  dma_dir);
43  
44                 /* The sgt buffer has been allocated with netdev_alloc_frag(),
45 @@ -896,7 +896,11 @@ int __hot skb_to_sg_fd(struct dpa_priv_s
46         nr_frags = skb_shinfo(skb)->nr_frags;
47         fd->format = qm_fd_sg;
48  
49 -       sgt_size = sizeof(struct qm_sg_entry) * (1 + nr_frags);
50 +       /* The FMan reads 256 bytes from the start of the SGT regardless of
51 +        * its size. In accordance, we reserve the same amount of memory as
52 +        * well.
53 +        */
54 +       sgt_size = DPA_SGT_SIZE;
55  
56         /* Get a page frag to store the SGTable, or a full page if the errata
57          * is in place and we need to avoid crossing a 4k boundary.