lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAOwfj2Pm8ekwrh1k2pviOySA-YOuxfmPOsCBUhJoYyX3d=LuZw@mail.gmail.com>
Date:	Thu, 19 Dec 2013 05:29:28 -0600
From:	Vince Bridgers <vbridgers2013@...il.com>
To:	netdev@...r.kernel.org
Cc:	Giuseppe CAVALLARO <peppe.cavallaro@...com>,
	Rayagond K <rayagond@...avyalabs.com>
Subject: [PATCH net] drivers: stmmac: Fixes for STMMAC IEEE 1588 Timestamping

This patch fixes two issues found in the stmmac driver when testing
hardware enabled PTP using linuxptp ptp4l.

1) Advanced timestamping capability was not being enabled correctly
since setting the state variable adv_ts was masked by the netif
message mask for printing status to the console as the driver loaded.

2) Incorrect spinlocks were released in the stmmac_adjust_freq and
stmmac_adjust_time functions, leading to unstable behaviour.

Vince

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 8a7a23a..797b56a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -622,17 +622,15 @@ static int stmmac_init_ptp(struct stmmac_priv *priv)
     if (!(priv->dma_cap.time_stamp || priv->dma_cap.atime_stamp))
         return -EOPNOTSUPP;

-    if (netif_msg_hw(priv)) {
-        if (priv->dma_cap.time_stamp) {
-            pr_debug("IEEE 1588-2002 Time Stamp supported\n");
-            priv->adv_ts = 0;
-        }
-        if (priv->dma_cap.atime_stamp && priv->extend_desc) {
-            pr_debug
-                ("IEEE 1588-2008 Advanced Time Stamp supported\n");
-            priv->adv_ts = 1;
-        }
-    }
+    priv->adv_ts = 0;
+    if (priv->dma_cap.atime_stamp && priv->extend_desc)
+        priv->adv_ts = 1;
+
+    if (netif_msg_hw(priv) && priv->dma_cap.time_stamp)
+        pr_debug("IEEE 1588-2002 Time Stamp supported\n");
+
+    if (netif_msg_hw(priv) && priv->adv_ts)
+        pr_debug("IEEE 1588-2008 Advanced Time Stamp supported\n");

     priv->hw->ptp = &stmmac_ptp;
     priv->hwts_tx_en = 0;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
index b8b0eee..7680581 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
@@ -56,7 +56,7 @@ static int stmmac_adjust_freq(struct ptp_clock_info
*ptp, s32 ppb)

     priv->hw->ptp->config_addend(priv->ioaddr, addend);

-    spin_unlock_irqrestore(&priv->lock, flags);
+    spin_unlock_irqrestore(&priv->ptp_lock, flags);

     return 0;
 }
@@ -91,7 +91,7 @@ static int stmmac_adjust_time(struct ptp_clock_info
*ptp, s64 delta)

     priv->hw->ptp->adjust_systime(priv->ioaddr, sec, nsec, neg_adj);

-    spin_unlock_irqrestore(&priv->lock, flags);
+    spin_unlock_irqrestore(&priv->ptp_lock, flags);

     return 0;
 }
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ