diff options
author | Jose Abreu <Jose.Abreu@synopsys.com> | 2017-10-20 09:37:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-21 21:50:40 -0400 |
commit | 98870943a561c64aca22d10820a881aa4fa728e4 (patch) | |
tree | c0cdcc2062738a131026e859324560d777dc2ab1 | |
parent | 9c8080d068b861a80d430ba0b42d8c9b07366b66 (diff) |
net: stmmac: Fix stmmac_get_rx_hwtstamp()
When using GMAC4 the valid timestamp is from CTX next desc but
we are passing the previous desc to get_rx_timestamp_status()
callback.
Fix this and while at it rework a little bit the function logic.
Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Joao Pinto <jpinto@synopsys.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index d67638c7078e..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)); |