diff options
author | Camelia Groza <camelia.groza@nxp.com> | 2017-09-14 07:40:53 (GMT) |
---|---|---|
committer | Xie Xiaobo <xiaobo.xie@nxp.com> | 2017-09-25 07:25:51 (GMT) |
commit | e27e150a27dad558f5564eaf174d2f46b74135de (patch) | |
tree | accd80620d5232c1701b4564dd68348a7e5b325d | |
parent | 9897d9fe6c03b27e5868f6a492434cf858a0eca4 (diff) | |
download | linux-e27e150a27dad558f5564eaf174d2f46b74135de.tar.xz |
sdk_dpaa: ls1043a errata: maintain timestamp info
When creating a new skb for the errata workaround, maintain the socket
and timestamp configurations for timestamp hardware offloading.
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
-rw-r--r-- | drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c index 7324e84..11b47e8 100644 --- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c @@ -42,6 +42,7 @@ #include <linux/skbuff.h> #include <linux/highmem.h> #include <linux/fsl_bman.h> +#include <net/sock.h> #include "dpaa_eth.h" #include "dpaa_eth_common.h" @@ -808,7 +809,11 @@ static struct sk_buff *a010022_realign_skb(struct sk_buff *skb, struct page *npage; void *npage_addr; - headroom = priv->tx_headroom; + /* Guarantee the minimum required headroom */ + if (skb_headroom(skb) >= priv->tx_headroom) + headroom = skb_headroom(skb); + else + headroom = priv->tx_headroom; npage = alloc_page(GFP_ATOMIC); if (unlikely(!npage)) { @@ -832,8 +837,11 @@ static struct sk_buff *a010022_realign_skb(struct sk_buff *skb, if (unlikely(!nskb)) goto err; - /* Code borrowed and adapted from skb_copy() */ - skb_reserve(nskb, headroom); + /* Reserve only the needed headroom in order to guarantee the data's + * alignment. + * Code borrowed and adapted from skb_copy(). + */ + skb_reserve(nskb, priv->tx_headroom); skb_put(nskb, skb->len); if (skb_copy_bits(skb, 0, nskb->data, skb->len)) { WARN_ONCE(1, "skb parsing failure\n"); @@ -841,6 +849,16 @@ static struct sk_buff *a010022_realign_skb(struct sk_buff *skb, } copy_skb_header(nskb, skb); +#ifdef CONFIG_FSL_DPAA_TS + /* Copy relevant timestamp info from the old skb to the new */ + if (priv->ts_tx_en) { + skb_shinfo(nskb)->tx_flags = skb_shinfo(skb)->tx_flags; + skb_shinfo(nskb)->hwtstamps = skb_shinfo(skb)->hwtstamps; + skb_shinfo(nskb)->tskey = skb_shinfo(skb)->tskey; + if (skb->sk) + skb_set_owner_w(nskb, skb->sk); + } +#endif /* We move the headroom when we align it so we have to reset the * network and transport header offsets relative to the new data * pointer. The checksum offload relies on these offsets. @@ -1041,6 +1059,16 @@ int __hot dpa_tx_extended(struct sk_buff *skb, struct net_device *net_dev, clear_fd(&fd); +#ifndef CONFIG_PPC + if (unlikely(dpaa_errata_a010022) && a010022_check_skb(skb, priv)) { + skb = a010022_realign_skb(skb, priv); + if (!skb) + goto skb_to_fd_failed; + } +#endif + + nonlinear = skb_is_nonlinear(skb); + #ifdef CONFIG_FSL_DPAA_1588 if (priv->tsu && priv->tsu->valid && priv->tsu->hwts_tx_en_ioctl) fd.cmd |= FM_FD_CMD_UPD; @@ -1052,16 +1080,6 @@ int __hot dpa_tx_extended(struct sk_buff *skb, struct net_device *net_dev, skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; #endif /* CONFIG_FSL_DPAA_TS */ -#ifndef CONFIG_PPC - if (unlikely(dpaa_errata_a010022) && a010022_check_skb(skb, priv)) { - skb = a010022_realign_skb(skb, priv); - if (!skb) - goto skb_to_fd_failed; - } -#endif - - nonlinear = skb_is_nonlinear(skb); - /* MAX_SKB_FRAGS is larger than our DPA_SGT_MAX_ENTRIES; make sure * we don't feed FMan with more fragments than it supports. * Btw, we're using the first sgt entry to store the linear part of |