b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | From bfc02cc199dc6259c2f4e2af8f77c88fe8ba4cc5 Mon Sep 17 00:00:00 2001 |
| 2 | From: Camelia Groza <camelia.groza@nxp.com> |
| 3 | Date: Tue, 5 Mar 2019 11:55:54 +0200 |
| 4 | Subject: [PATCH] sdk_dpaa: ls1043a errata: impose S/G frame realignment |
| 5 | |
| 6 | Scatter/Gather frames are not support on LS1043A beacuse they trigger |
| 7 | the A010022 errata. |
| 8 | |
| 9 | Even though we do not advertise S/G support to the stack, we need to |
| 10 | make sure that if S/G frames do reach the driver somehow, they trigger |
| 11 | the errata workaround. |
| 12 | |
| 13 | Signed-off-by: Camelia Groza <camelia.groza@nxp.com> |
| 14 | --- |
| 15 | drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.h | 7 ++++--- |
| 16 | .../net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c | 23 +++++----------------- |
| 17 | 2 files changed, 9 insertions(+), 21 deletions(-) |
| 18 | |
| 19 | --- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.h |
| 20 | +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.h |
| 21 | @@ -653,9 +653,10 @@ static inline void _dpa_bp_free_pf(void |
| 22 | |
| 23 | /* LS1043A SoC has a HW issue regarding FMan DMA transactions; The issue |
| 24 | * manifests itself at high traffic rates when frames cross 4K memory |
| 25 | - * boundaries or when they are not aligned to 16 bytes; For the moment, we |
| 26 | - * use a SW workaround that realigns frames to 256 bytes. Scatter/Gather |
| 27 | - * frames aren't supported on egress. |
| 28 | + * boundaries, when they are not aligned to 16 bytes or when they have |
| 29 | + * Scatter/Gather fragments; For the moment, we use a SW workaround that |
| 30 | + * realigns frames to 256 bytes. Scatter/Gather frames aren't supported |
| 31 | + * on egress. |
| 32 | */ |
| 33 | |
| 34 | #ifndef CONFIG_PPC |
| 35 | --- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c |
| 36 | +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c |
| 37 | @@ -772,18 +772,19 @@ EXPORT_SYMBOL(skb_to_contig_fd); |
| 38 | |
| 39 | #ifndef CONFIG_PPC |
| 40 | /* Verify the conditions that trigger the A010022 errata: data unaligned to |
| 41 | - * 16 bytes and 4K memory address crossings. |
| 42 | + * 16 bytes, 4K memory address crossings and S/G fragments. |
| 43 | */ |
| 44 | static bool a010022_check_skb(struct sk_buff *skb, struct dpa_priv_s *priv) |
| 45 | { |
| 46 | - int nr_frags, i = 0; |
| 47 | - skb_frag_t *frag; |
| 48 | - |
| 49 | /* Check if the headroom is aligned */ |
| 50 | if (((uintptr_t)skb->data - priv->tx_headroom) % |
| 51 | priv->buf_layout[TX].data_align != 0) |
| 52 | return true; |
| 53 | |
| 54 | + /* Check for paged data in the skb. We do not support S/G fragments */ |
| 55 | + if (skb_is_nonlinear(skb)) |
| 56 | + return true; |
| 57 | + |
| 58 | /* Check if the headroom crosses a boundary */ |
| 59 | if (HAS_DMA_ISSUE(skb->head, skb_headroom(skb))) |
| 60 | return true; |
| 61 | @@ -796,20 +797,6 @@ static bool a010022_check_skb(struct sk_ |
| 62 | if (HAS_DMA_ISSUE(skb->head, skb_end_offset(skb))) |
| 63 | return true; |
| 64 | |
| 65 | - nr_frags = skb_shinfo(skb)->nr_frags; |
| 66 | - |
| 67 | - while (i < nr_frags) { |
| 68 | - frag = &skb_shinfo(skb)->frags[i]; |
| 69 | - |
| 70 | - /* Check if a paged fragment crosses a boundary from its |
| 71 | - * offset to its end. |
| 72 | - */ |
| 73 | - if (HAS_DMA_ISSUE(frag->page_offset, frag->size)) |
| 74 | - return true; |
| 75 | - |
| 76 | - i++; |
| 77 | - } |
| 78 | - |
| 79 | return false; |
| 80 | } |
| 81 | |