Commit a1762456 authored by Fredrik Hallenberg's avatar Fredrik Hallenberg Committed by David S. Miller

net: stmmac: Fix bad RX timestamp extraction

As noted in dwmac4_wrback_get_rx_timestamp_status the timestamp is found
in the context descriptor following the current descriptor. However the
current code looks for the context descriptor in the current
descriptor, which will always fail.
Signed-off-by: default avatarFredrik Hallenberg <megahallon@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 200922c9
...@@ -409,7 +409,7 @@ struct stmmac_desc_ops { ...@@ -409,7 +409,7 @@ struct stmmac_desc_ops {
/* get timestamp value */ /* get timestamp value */
u64(*get_timestamp) (void *desc, u32 ats); u64(*get_timestamp) (void *desc, u32 ats);
/* get rx timestamp status */ /* get rx timestamp status */
int (*get_rx_timestamp_status) (void *desc, u32 ats); int (*get_rx_timestamp_status)(void *desc, void *next_desc, u32 ats);
/* Display ring */ /* Display ring */
void (*display_ring)(void *head, unsigned int size, bool rx); void (*display_ring)(void *head, unsigned int size, bool rx);
/* set MSS via context descriptor */ /* set MSS via context descriptor */
......
...@@ -258,7 +258,8 @@ static int dwmac4_rx_check_timestamp(void *desc) ...@@ -258,7 +258,8 @@ static int dwmac4_rx_check_timestamp(void *desc)
return ret; return ret;
} }
static int dwmac4_wrback_get_rx_timestamp_status(void *desc, u32 ats) static int dwmac4_wrback_get_rx_timestamp_status(void *desc, void *next_desc,
u32 ats)
{ {
struct dma_desc *p = (struct dma_desc *)desc; struct dma_desc *p = (struct dma_desc *)desc;
int ret = -EINVAL; int ret = -EINVAL;
...@@ -270,7 +271,7 @@ static int dwmac4_wrback_get_rx_timestamp_status(void *desc, u32 ats) ...@@ -270,7 +271,7 @@ static int dwmac4_wrback_get_rx_timestamp_status(void *desc, u32 ats)
/* Check if timestamp is OK from context descriptor */ /* Check if timestamp is OK from context descriptor */
do { do {
ret = dwmac4_rx_check_timestamp(desc); ret = dwmac4_rx_check_timestamp(next_desc);
if (ret < 0) if (ret < 0)
goto exit; goto exit;
i++; i++;
......
...@@ -400,7 +400,8 @@ static u64 enh_desc_get_timestamp(void *desc, u32 ats) ...@@ -400,7 +400,8 @@ static u64 enh_desc_get_timestamp(void *desc, u32 ats)
return ns; return ns;
} }
static int enh_desc_get_rx_timestamp_status(void *desc, u32 ats) static int enh_desc_get_rx_timestamp_status(void *desc, void *next_desc,
u32 ats)
{ {
if (ats) { if (ats) {
struct dma_extended_desc *p = (struct dma_extended_desc *)desc; struct dma_extended_desc *p = (struct dma_extended_desc *)desc;
......
...@@ -265,7 +265,7 @@ static u64 ndesc_get_timestamp(void *desc, u32 ats) ...@@ -265,7 +265,7 @@ static u64 ndesc_get_timestamp(void *desc, u32 ats)
return ns; return ns;
} }
static int ndesc_get_rx_timestamp_status(void *desc, u32 ats) static int ndesc_get_rx_timestamp_status(void *desc, void *next_desc, u32 ats)
{ {
struct dma_desc *p = (struct dma_desc *)desc; struct dma_desc *p = (struct dma_desc *)desc;
......
...@@ -482,7 +482,7 @@ static void stmmac_get_rx_hwtstamp(struct stmmac_priv *priv, struct dma_desc *p, ...@@ -482,7 +482,7 @@ static void stmmac_get_rx_hwtstamp(struct stmmac_priv *priv, struct dma_desc *p,
desc = np; desc = np;
/* Check if timestamp is available */ /* Check if timestamp is available */
if (priv->hw->desc->get_rx_timestamp_status(desc, priv->adv_ts)) { if (priv->hw->desc->get_rx_timestamp_status(p, np, priv->adv_ts)) {
ns = priv->hw->desc->get_timestamp(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);
......
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