| 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. |