aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c11
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c10
2 files changed, 12 insertions, 9 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
index aa6476439aee..e0ef02f9503b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
@@ -214,13 +214,13 @@ static int dwmac4_wrback_get_tx_timestamp_status(struct dma_desc *p)
214{ 214{
215 /* Context type from W/B descriptor must be zero */ 215 /* Context type from W/B descriptor must be zero */
216 if (le32_to_cpu(p->des3) & TDES3_CONTEXT_TYPE) 216 if (le32_to_cpu(p->des3) & TDES3_CONTEXT_TYPE)
217 return -EINVAL; 217 return 0;
218 218
219 /* Tx Timestamp Status is 1 so des0 and des1'll have valid values */ 219 /* Tx Timestamp Status is 1 so des0 and des1'll have valid values */
220 if (le32_to_cpu(p->des3) & TDES3_TIMESTAMP_STATUS) 220 if (le32_to_cpu(p->des3) & TDES3_TIMESTAMP_STATUS)
221 return 0; 221 return 1;
222 222
223 return 1; 223 return 0;
224} 224}
225 225
226static inline u64 dwmac4_get_timestamp(void *desc, u32 ats) 226static inline u64 dwmac4_get_timestamp(void *desc, u32 ats)
@@ -282,7 +282,10 @@ static int dwmac4_wrback_get_rx_timestamp_status(void *desc, u32 ats)
282 } 282 }
283 } 283 }
284exit: 284exit:
285 return ret; 285 if (likely(ret == 0))
286 return 1;
287
288 return 0;
286} 289}
287 290
288static void dwmac4_rd_init_rx_desc(struct dma_desc *p, int disable_rx_ic, 291static void dwmac4_rd_init_rx_desc(struct dma_desc *p, int disable_rx_ic,
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index d54e5d74b3fd..d16d11bfc046 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -434,14 +434,14 @@ static void stmmac_get_tx_hwtstamp(struct stmmac_priv *priv,
434 return; 434 return;
435 435
436 /* check tx tstamp status */ 436 /* check tx tstamp status */
437 if (!priv->hw->desc->get_tx_timestamp_status(p)) { 437 if (priv->hw->desc->get_tx_timestamp_status(p)) {
438 /* get the valid tstamp */ 438 /* get the valid tstamp */
439 ns = priv->hw->desc->get_timestamp(p, priv->adv_ts); 439 ns = priv->hw->desc->get_timestamp(p, priv->adv_ts);
440 440
441 memset(&shhwtstamp, 0, sizeof(struct skb_shared_hwtstamps)); 441 memset(&shhwtstamp, 0, sizeof(struct skb_shared_hwtstamps));
442 shhwtstamp.hwtstamp = ns_to_ktime(ns); 442 shhwtstamp.hwtstamp = ns_to_ktime(ns);
443 443
444 netdev_info(priv->dev, "get valid TX hw timestamp %llu\n", ns); 444 netdev_dbg(priv->dev, "get valid TX hw timestamp %llu\n", ns);
445 /* pass tstamp to stack */ 445 /* pass tstamp to stack */
446 skb_tstamp_tx(skb, &shhwtstamp); 446 skb_tstamp_tx(skb, &shhwtstamp);
447 } 447 }
@@ -468,19 +468,19 @@ static void stmmac_get_rx_hwtstamp(struct stmmac_priv *priv, struct dma_desc *p,
468 return; 468 return;
469 469
470 /* Check if timestamp is available */ 470 /* Check if timestamp is available */
471 if (!priv->hw->desc->get_rx_timestamp_status(p, priv->adv_ts)) { 471 if (priv->hw->desc->get_rx_timestamp_status(p, priv->adv_ts)) {
472 /* For GMAC4, the valid timestamp is from CTX next desc. */ 472 /* For GMAC4, the valid timestamp is from CTX next desc. */
473 if (priv->plat->has_gmac4) 473 if (priv->plat->has_gmac4)
474 ns = priv->hw->desc->get_timestamp(np, priv->adv_ts); 474 ns = priv->hw->desc->get_timestamp(np, priv->adv_ts);
475 else 475 else
476 ns = priv->hw->desc->get_timestamp(p, priv->adv_ts); 476 ns = priv->hw->desc->get_timestamp(p, priv->adv_ts);
477 477
478 netdev_info(priv->dev, "get valid RX hw timestamp %llu\n", ns); 478 netdev_dbg(priv->dev, "get valid RX hw timestamp %llu\n", ns);
479 shhwtstamp = skb_hwtstamps(skb); 479 shhwtstamp = skb_hwtstamps(skb);
480 memset(shhwtstamp, 0, sizeof(struct skb_shared_hwtstamps)); 480 memset(shhwtstamp, 0, sizeof(struct skb_shared_hwtstamps));
481 shhwtstamp->hwtstamp = ns_to_ktime(ns); 481 shhwtstamp->hwtstamp = ns_to_ktime(ns);
482 } else { 482 } else {
483 netdev_err(priv->dev, "cannot get RX hw timestamp\n"); 483 netdev_dbg(priv->dev, "cannot get RX hw timestamp\n");
484 } 484 }
485} 485}
486 486