xiaoxiang781216 commented on code in PR #20148:
URL: https://github.com/apache/nuttx/pull/20148#discussion_r4011302719


##########
include/nuttx/net/ioctl.h:
##########
@@ -161,6 +161,10 @@
 #define SIOCGIFVLAN        _SIOC(0x0043)  /* Get VLAN interface */
 #define SIOCSIFVLAN        _SIOC(0x0044)  /* Set VLAN interface */
 
+/* PTP Timestamping *********************************************************/
+
+#define SIOCG_TX_HW_TIMESTAMP _SIOC(0x0046) /* Get hardware TX timestamp */

Review Comment:
   does Linux define the similar ioctl?



##########
include/nuttx/net/ioctl.h:
##########
@@ -164,6 +164,7 @@
 /* PTP Timestamping *********************************************************/
 
 #define SIOCG_TX_HW_TIMESTAMP _SIOC(0x0046) /* Get hardware TX timestamp */
+#define SIOCS_PTP_ADJFREQ     _SIOC(0x0047) /* Set PTP hardware frequency 
adjustment (ppb) */

Review Comment:
   ditto



##########
arch/arm/src/common/stm32/stm32_eth_m3m4_v1.c:
##########
@@ -598,6 +599,15 @@
  * Private Types
  ****************************************************************************/
 
+#ifdef CONFIG_STM32_ETH_TIMESTAMP_TX
+struct stm32_ptp_txmeta_s
+{
+  bool            track_ts;     /* True if descriptor requires TS capture */
+  FAR sem_t      *wait_sem;     /* Semaphore to notify waiting thread */

Review Comment:
   remove ALL FAR 



##########
arch/arm/src/common/stm32/stm32_eth_m3m4_v1.c:
##########
@@ -3766,15 +3781,15 @@ static int stm32_eth_ptp_adjust(long ppb)
 
   if (ppb != 0)
     {
-      addend += addend * ppb / NSEC_PER_SEC;
+      addend += addend * (int64_t)ppb / NSEC_PER_SEC;
     }
 
   /* Check for overflows */
 
-  if (addend == 0 || (uint32_t)addend != addend)
+  if (addend <= 0 || (uint64_t)addend > UINT32_MAX)
     {
       nerr("PTP adjustment out of range: ppb=%ld, addend=%lld\n",
-           ppb, addend);
+           ppb, (long long)addend);

Review Comment:
   remove the cast, change specifier instead



##########
include/nuttx/net/ioctl.h:
##########
@@ -165,6 +165,7 @@
 
 #define SIOCG_TX_HW_TIMESTAMP _SIOC(0x0046) /* Get hardware TX timestamp */
 #define SIOCS_PTP_ADJFREQ     _SIOC(0x0047) /* Set PTP hardware frequency 
adjustment (ppb) */
+#define SIOCS_PTP_ADJPHASE    _SIOC(0x0048) /* Set PTP hardware phase 
adjustment (ns) */

Review Comment:
   ditto



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to