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


##########
net/udp/udp_recvfrom.c:
##########
@@ -44,6 +44,10 @@
 #include "socket/socket.h"
 #include "utils/utils.h"
 
+#ifdef CONFIG_NET_TIMESTAMP

Review Comment:
   move before line 33, and remove #ifdef/#endif



##########
net/devif/ipv6_input.c:
##########
@@ -609,6 +609,12 @@ int ipv6_input(FAR struct net_driver_s *dev)
   FAR uint8_t *buf;
   int ret;
 
+  /* Store reception timestamp if enabled and not provided by hardware. */
+
+#if defined(CONFIG_NET_TIMESTAMP) && 
!defined(CONFIG_ARCH_HAVE_NETDEV_TIMESTAMP)
+  clock_gettime(CLOCK_REALTIME, &dev->d_rxtime);

Review Comment:
   let's create a new patch to update socketcan to allow the net can driver 
return timestamp too



##########
net/udp/udp_callback.c:
##########
@@ -38,6 +38,10 @@
 #include "udp/udp.h"
 #include "utils/utils.h"
 
+#ifdef CONFIG_NET_TIMESTAMP
+#include <sys/time.h>

Review Comment:
   move before line 31. And remove #ifdef/#endif?



##########
net/udp/udp.h:
##########
@@ -156,6 +156,10 @@ struct udp_conn_s
    */
 
   struct udp_poll_s pollinfo[CONFIG_NET_UDP_NPOLLWAITERS];
+
+#ifdef CONFIG_NET_TIMESTAMP
+  uint32_t timestamp; /* Nonzero when SO_TIMESTAMP is enabled */

Review Comment:
   ```suggestion
     int timestamp; /* Nonzero when SO_TIMESTAMP is enabled */
   ```



##########
net/udp/udp_callback.c:
##########
@@ -153,11 +157,26 @@ static uint16_t udp_datahandler(FAR struct net_driver_s 
*dev,
 #endif /* CONFIG_NET_IPv4 */
 
   /* Copy the meta info into the I/O buffer chain, just before data.
-   * Layout: |datalen|ifindex|src_addr_size|src_addr|data|
+   * Layout: |datalen|ifindex|src_addr_size|src_addr|[timestamp]|data|
    */
 
   offset = (dev->d_appdata - iob->io_data) - iob->io_offset;
 
+#ifdef CONFIG_NET_TIMESTAMP
+  /* Store timestamp while packet is being queued.
+   * This is done unconditionally to avoid race condition when SO_TIMESTAMP

Review Comment:
   should we make the similar change to can socket?



-- 
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