Commit 748759d5 authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents 0247880a 9454360d
...@@ -275,7 +275,7 @@ static int dwmac4_wrback_get_rx_timestamp_status(void *desc, u32 ats) ...@@ -275,7 +275,7 @@ static int dwmac4_wrback_get_rx_timestamp_status(void *desc, u32 ats)
goto exit; goto exit;
i++; i++;
} while ((ret == 1) || (i < 10)); } while ((ret == 1) && (i < 10));
if (i == 10) if (i == 10)
ret = -EBUSY; ret = -EBUSY;
......
...@@ -473,19 +473,18 @@ static void stmmac_get_rx_hwtstamp(struct stmmac_priv *priv, struct dma_desc *p, ...@@ -473,19 +473,18 @@ static void stmmac_get_rx_hwtstamp(struct stmmac_priv *priv, struct dma_desc *p,
struct dma_desc *np, struct sk_buff *skb) struct dma_desc *np, struct sk_buff *skb)
{ {
struct skb_shared_hwtstamps *shhwtstamp = NULL; struct skb_shared_hwtstamps *shhwtstamp = NULL;
struct dma_desc *desc = p;
u64 ns; u64 ns;
if (!priv->hwts_rx_en) if (!priv->hwts_rx_en)
return; return;
/* Check if timestamp is available */
if (priv->hw->desc->get_rx_timestamp_status(p, priv->adv_ts)) {
/* For GMAC4, the valid timestamp is from CTX next desc. */ /* For GMAC4, the valid timestamp is from CTX next desc. */
if (priv->plat->has_gmac4) if (priv->plat->has_gmac4)
ns = priv->hw->desc->get_timestamp(np, priv->adv_ts); desc = np;
else
ns = priv->hw->desc->get_timestamp(p, priv->adv_ts);
/* Check if timestamp is available */
if (priv->hw->desc->get_rx_timestamp_status(desc, priv->adv_ts)) {
ns = priv->hw->desc->get_timestamp(desc, priv->adv_ts);
netdev_dbg(priv->dev, "get valid RX hw timestamp %llu\n", ns); netdev_dbg(priv->dev, "get valid RX hw timestamp %llu\n", ns);
shhwtstamp = skb_hwtstamps(skb); shhwtstamp = skb_hwtstamps(skb);
memset(shhwtstamp, 0, sizeof(struct skb_shared_hwtstamps)); 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,6 +3332,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
* them in stmmac_rx_refill() function so that * them in stmmac_rx_refill() function so that
* device can reuse it. * device can reuse it.
*/ */
dev_kfree_skb_any(rx_q->rx_skbuff[entry]);
rx_q->rx_skbuff[entry] = NULL; rx_q->rx_skbuff[entry] = NULL;
dma_unmap_single(priv->device, dma_unmap_single(priv->device,
rx_q->rx_skbuff_dma[entry], rx_q->rx_skbuff_dma[entry],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment