diff options
author | David S. Miller <davem@davemloft.net> | 2017-10-21 21:50:40 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-21 21:50:40 -0400 |
commit | 748759d57e1b33427113bad7dc685ea3c139649e (patch) | |
tree | 906675b01e13a79b89ec716663174890d01a8d16 | |
parent | 0247880a09a145be00daabf6c08f28fd739de560 (diff) | |
parent | 9454360dec1c96800576693955b92a2792b74def (diff) |
Merge branch 'stmmac-hw-tstamp-fixes'
Jose Abreu says:
====================
net: stmmac: Fix HW timestamping
Three fixes for HW timestamping feature, all of them for RX side.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c index e0ef02f9503b..4b286e27c4ca 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | |||
@@ -275,7 +275,7 @@ static int dwmac4_wrback_get_rx_timestamp_status(void *desc, u32 ats) | |||
275 | goto exit; | 275 | goto exit; |
276 | i++; | 276 | i++; |
277 | 277 | ||
278 | } while ((ret == 1) || (i < 10)); | 278 | } while ((ret == 1) && (i < 10)); |
279 | 279 | ||
280 | if (i == 10) | 280 | if (i == 10) |
281 | ret = -EBUSY; | 281 | ret = -EBUSY; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 1763e48c84e2..284c10720daf 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -473,19 +473,18 @@ static void stmmac_get_rx_hwtstamp(struct stmmac_priv *priv, struct dma_desc *p, | |||
473 | struct dma_desc *np, struct sk_buff *skb) | 473 | struct dma_desc *np, struct sk_buff *skb) |
474 | { | 474 | { |
475 | struct skb_shared_hwtstamps *shhwtstamp = NULL; | 475 | struct skb_shared_hwtstamps *shhwtstamp = NULL; |
476 | struct dma_desc *desc = p; | ||
476 | u64 ns; | 477 | u64 ns; |
477 | 478 | ||
478 | if (!priv->hwts_rx_en) | 479 | if (!priv->hwts_rx_en) |
479 | return; | 480 | return; |
481 | /* For GMAC4, the valid timestamp is from CTX next desc. */ | ||
482 | if (priv->plat->has_gmac4) | ||
483 | desc = np; | ||
480 | 484 | ||
481 | /* Check if timestamp is available */ | 485 | /* Check if timestamp is available */ |
482 | if (priv->hw->desc->get_rx_timestamp_status(p, priv->adv_ts)) { | 486 | if (priv->hw->desc->get_rx_timestamp_status(desc, priv->adv_ts)) { |
483 | /* For GMAC4, the valid timestamp is from CTX next desc. */ | 487 | ns = priv->hw->desc->get_timestamp(desc, priv->adv_ts); |
484 | if (priv->plat->has_gmac4) | ||
485 | ns = priv->hw->desc->get_timestamp(np, priv->adv_ts); | ||
486 | else | ||
487 | ns = priv->hw->desc->get_timestamp(p, priv->adv_ts); | ||
488 | |||
489 | netdev_dbg(priv->dev, "get valid RX hw timestamp %llu\n", ns); | 488 | netdev_dbg(priv->dev, "get valid RX hw timestamp %llu\n", ns); |
490 | shhwtstamp = skb_hwtstamps(skb); | 489 | shhwtstamp = skb_hwtstamps(skb); |
491 | memset(shhwtstamp, 0, sizeof(struct skb_shared_hwtstamps)); | 490 | memset(shhwtstamp, 0, sizeof(struct skb_shared_hwtstamps)); |
@@ -3333,6 +3332,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) | |||
3333 | * them in stmmac_rx_refill() function so that | 3332 | * them in stmmac_rx_refill() function so that |
3334 | * device can reuse it. | 3333 | * device can reuse it. |
3335 | */ | 3334 | */ |
3335 | dev_kfree_skb_any(rx_q->rx_skbuff[entry]); | ||
3336 | rx_q->rx_skbuff[entry] = NULL; | 3336 | rx_q->rx_skbuff[entry] = NULL; |
3337 | dma_unmap_single(priv->device, | 3337 | dma_unmap_single(priv->device, |
3338 | rx_q->rx_skbuff_dma[entry], | 3338 | rx_q->rx_skbuff_dma[entry], |