You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/06/07 17:15:46 UTC

[incubator-nuttx] branch master updated (5b165a2294 -> 9d4c708913)

This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


    from 5b165a2294 libc/stdio: Generate the dummy atexit and on_exit
     new 298b4aba0c net/tcp: Hold the net lock in tcp_timer_expiry
     new fe85e9d0fa net: Remove devif_timer from comment
     new 9d4c708913 net/tcp: Search conn list again to aovid the race condition in tcp_timer_expiry

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 include/nuttx/net/netdev.h               |  6 ++----
 include/nuttx/net/radiodev.h             | 10 +++++-----
 net/arp/arp.h                            |  2 +-
 net/arp/arp_poll.c                       |  4 ++--
 net/ipforward/ipforward.h                |  2 +-
 net/ipforward/ipfwd_poll.c               |  2 +-
 net/sixlowpan/sixlowpan.h                |  2 +-
 net/sixlowpan/sixlowpan_tcpsend.c        |  2 +-
 net/tcp/tcp_timer.c                      | 18 +++++++++++++++---
 wireless/ieee802154/mac802154_loopback.c |  4 ++--
 wireless/pktradio/pktradio_loopback.c    |  4 ++--
 11 files changed, 33 insertions(+), 23 deletions(-)


[incubator-nuttx] 03/03: net/tcp: Search conn list again to aovid the race condition in tcp_timer_expiry

Posted by pk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 9d4c708913e6b414e6620911c364fc22c4061ebb
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sun Jun 5 23:43:17 2022 +0800

    net/tcp: Search conn list again to aovid the race condition in tcp_timer_expiry
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 net/tcp/tcp_timer.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/net/tcp/tcp_timer.c b/net/tcp/tcp_timer.c
index 800023dfaa..b17a26a189 100644
--- a/net/tcp/tcp_timer.c
+++ b/net/tcp/tcp_timer.c
@@ -138,11 +138,20 @@ static int tcp_get_timeout(FAR struct tcp_conn_s *conn)
 
 static void tcp_timer_expiry(FAR void *arg)
 {
-  FAR struct tcp_conn_s *conn = arg;
+  FAR struct tcp_conn_s *conn = NULL;
 
   net_lock();
-  conn->timeout = true;
-  netdev_txnotify_dev(conn->dev);
+
+  while ((conn = tcp_nextconn(conn)) != NULL)
+    {
+      if (conn == arg)
+        {
+          conn->timeout = true;
+          netdev_txnotify_dev(conn->dev);
+          break;
+        }
+    }
+
   net_unlock();
 }
 


[incubator-nuttx] 01/03: net/tcp: Hold the net lock in tcp_timer_expiry

Posted by pk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 298b4aba0ce0dcaf4f1663e2a2f2099de794556e
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sun Jun 5 19:30:49 2022 +0800

    net/tcp: Hold the net lock in tcp_timer_expiry
    
    to follow the call convention for d_txavail
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 net/tcp/tcp_timer.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/tcp/tcp_timer.c b/net/tcp/tcp_timer.c
index 0023221a30..800023dfaa 100644
--- a/net/tcp/tcp_timer.c
+++ b/net/tcp/tcp_timer.c
@@ -58,6 +58,7 @@
 #include <nuttx/net/netstats.h>
 #include <nuttx/net/tcp.h>
 
+#include "netdev/netdev.h"
 #include "devif/devif.h"
 #include "socket/socket.h"
 #include "tcp/tcp.h"
@@ -139,8 +140,10 @@ static void tcp_timer_expiry(FAR void *arg)
 {
   FAR struct tcp_conn_s *conn = arg;
 
+  net_lock();
   conn->timeout = true;
-  conn->dev->d_txavail(conn->dev);
+  netdev_txnotify_dev(conn->dev);
+  net_unlock();
 }
 
 /****************************************************************************


[incubator-nuttx] 02/03: net: Remove devif_timer from comment

Posted by pk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit fe85e9d0fa30ebc0fe4e7920dd2072838aa88016
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sun Jun 5 23:34:03 2022 +0800

    net: Remove devif_timer from comment
    
    since devif_timer has been removed in:
    commit 035d9258643a5adaa188476487a1e5423744d7ab
    Author: zhanghongyu <zh...@xiaomi.com>
    Date:   Sun May 29 21:47:28 2022 +0800
    
        devif: remove all devif_timer
    
        Signed-off-by: zhanghongyu <zh...@xiaomi.com>
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 include/nuttx/net/netdev.h               |  6 ++----
 include/nuttx/net/radiodev.h             | 10 +++++-----
 net/arp/arp.h                            |  2 +-
 net/arp/arp_poll.c                       |  4 ++--
 net/ipforward/ipforward.h                |  2 +-
 net/ipforward/ipfwd_poll.c               |  2 +-
 net/sixlowpan/sixlowpan.h                |  2 +-
 net/sixlowpan/sixlowpan_tcpsend.c        |  2 +-
 wireless/ieee802154/mac802154_loopback.c |  4 ++--
 wireless/pktradio/pktradio_loopback.c    |  4 ++--
 10 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/include/nuttx/net/netdev.h b/include/nuttx/net/netdev.h
index be811e31e8..866e2cbfe2 100644
--- a/include/nuttx/net/netdev.h
+++ b/include/nuttx/net/netdev.h
@@ -496,10 +496,8 @@ int sixlowpan_input(FAR struct radio_driver_s *ieee,
  * Polling of connections
  *
  * These functions will traverse each active network connection structure
- * and perform appropriate operations:  devif_timer() will perform TCP timer
- * operations (and UDP polling operations); devif_poll() will perform TCP
- * and UDP polling operations. The CAN driver MUST implement logic to
- * periodically call devif_timer(); devif_poll() may be called asynchronously
+ * and perform appropriate operations:  devif_poll() will perform TCP
+ * and UDP polling operations. devif_poll() may be called asynchronously
  * from the network driver can accept another outgoing packet.
  *
  * In both cases, these functions will call the provided callback function
diff --git a/include/nuttx/net/radiodev.h b/include/nuttx/net/radiodev.h
index bc465a703d..861d3a51f9 100644
--- a/include/nuttx/net/radiodev.h
+++ b/include/nuttx/net/radiodev.h
@@ -68,11 +68,11 @@ struct radiodev_properties_s
  *     field of the IOB.
  *
  *     Outgoing frames are generated when the radio network driver calls
- *     the devif_poll(), devif_timer(), sixlowpan_input(), or
- *     ieee802154_input() interfaces.  In each case, the radio driver must
- *     provide a working buffer in the d_buf pointer.  A special form of
- *     the packet buffer must be used, struct sixlowpan_reassbuf_s.  This
- *     special for includes appended data for managing reassembly of packets.
+ *     the devif_poll(), sixlowpan_input(), or ieee802154_input()
+ *     interfaces.  In each case, the radio driver must provide a working
+ *     buffer in the d_buf pointer.  A special form of the packet buffer
+ *     must be used, struct sixlowpan_reassbuf_s.  This special for
+ *     includes appended data for managing reassembly of packets.
  *
  *   - Received frames are provided by radio network driver to the network
  *     via an IOB parameter in the sixlowpan_input() pr ieee802154_input()
diff --git a/net/arp/arp.h b/net/arp/arp.h
index a30c900561..e466eab22d 100644
--- a/net/arp/arp.h
+++ b/net/arp/arp.h
@@ -215,7 +215,7 @@ int arp_send(in_addr_t ipaddr);
  *
  * Assumptions:
  *   This function is called from the MAC device driver indirectly through
- *   devif_poll() and devif_timer().  The network must be locked.
+ *   devif_poll().  The network must be locked.
  *
  ****************************************************************************/
 
diff --git a/net/arp/arp_poll.c b/net/arp/arp_poll.c
index 680879b12a..a9ca0fb182 100644
--- a/net/arp/arp_poll.c
+++ b/net/arp/arp_poll.c
@@ -45,8 +45,8 @@
  *
  * Assumptions:
  *   This function is called from the MAC device driver indirectly through
- *   devif_poll() and devif_timer() and may be called from the timer
- *   interrupt/watchdog handler level.
+ *   devif_poll() and may be called from the timer  interrupt/watchdog
+ *   handler level.
  *
  ****************************************************************************/
 
diff --git a/net/ipforward/ipforward.h b/net/ipforward/ipforward.h
index ebc65519c0..30b8a9d973 100644
--- a/net/ipforward/ipforward.h
+++ b/net/ipforward/ipforward.h
@@ -234,7 +234,7 @@ int ipfwd_forward(FAR struct forward_s *fwd);
  *
  * Assumptions:
  *   This function is called from the MAC device driver indirectly through
- *   devif_poll() and devif_timer().
+ *   devif_poll().
  *
  ****************************************************************************/
 
diff --git a/net/ipforward/ipfwd_poll.c b/net/ipforward/ipfwd_poll.c
index 9c6c65682b..b3b909a40b 100644
--- a/net/ipforward/ipfwd_poll.c
+++ b/net/ipforward/ipfwd_poll.c
@@ -153,7 +153,7 @@ static void ipfwd_packet_conversion(FAR struct net_driver_s *dev, int proto)
  *
  * Assumptions:
  *   This function is called from the MAC device driver indirectly through
- *   devif_poll() and devif_timer().
+ *   devif_poll().
  *
  ****************************************************************************/
 
diff --git a/net/sixlowpan/sixlowpan.h b/net/sixlowpan/sixlowpan.h
index 3185fc111d..d56e2e2c78 100644
--- a/net/sixlowpan/sixlowpan.h
+++ b/net/sixlowpan/sixlowpan.h
@@ -106,7 +106,7 @@ ssize_t psock_6lowpan_tcp_send(FAR struct socket *psock, FAR const void *buf,
  *   3. TCP output resulting from TX or timer polling
  *
  *   Cases 2 and 3 will be handled here.  Logic in ipv6_tcp_input(),
- *   devif_poll(), and devif_timer() detect if (1) an attempt to return with
+ *   and devif_poll() detect if (1) an attempt to return with
  *   d_len > 0 and (2) that the device is an IEEE802.15.4 MAC network
  *   driver. Under those conditions, this function will be called to create
  *   the IEEE80215.4 frames.
diff --git a/net/sixlowpan/sixlowpan_tcpsend.c b/net/sixlowpan/sixlowpan_tcpsend.c
index cd2d3d9f64..02d4b92ea4 100644
--- a/net/sixlowpan/sixlowpan_tcpsend.c
+++ b/net/sixlowpan/sixlowpan_tcpsend.c
@@ -823,7 +823,7 @@ ssize_t psock_6lowpan_tcp_send(FAR struct socket *psock, FAR const void *buf,
  *   3. TCP output resulting from TX or timer polling
  *
  *   Cases 2 and 3 will be handled here.  Logic in ipv6_tcp_input(),
- *   devif_poll(), and devif_timer() detect if (1) an attempt to return with
+ *   and devif_poll() detect if (1) an attempt to return with
  *   d_len > 0 and (2) that the device is an IEEE802.15.4 MAC network
  *   driver. Under those conditions, this function will be called to create
  *   the IEEE80215.4 frames.
diff --git a/wireless/ieee802154/mac802154_loopback.c b/wireless/ieee802154/mac802154_loopback.c
index 72894415cb..53005f6e80 100644
--- a/wireless/ieee802154/mac802154_loopback.c
+++ b/wireless/ieee802154/mac802154_loopback.c
@@ -284,8 +284,8 @@ static inline void lo_netmask(FAR struct net_driver_s *dev)
  *
  * Description:
  *   Check if the network has any outgoing packets ready to send.  This is
- *   a callback from devif_poll() or devif_timer().  devif_poll() will be
- *   called only during normal TX polling.
+ *   a callback from devif_poll().  devif_poll() will be called only during
+ *   normal TX polling.
  *
  * Input Parameters:
  *   dev - Reference to the NuttX driver state structure
diff --git a/wireless/pktradio/pktradio_loopback.c b/wireless/pktradio/pktradio_loopback.c
index cd9d14f67c..55f03dec36 100644
--- a/wireless/pktradio/pktradio_loopback.c
+++ b/wireless/pktradio/pktradio_loopback.c
@@ -273,8 +273,8 @@ static inline void lo_netmask(FAR struct net_driver_s *dev)
  *
  * Description:
  *   Check if the network has any outgoing packets ready to send.  This is
- *   a callback from devif_poll() or devif_timer().  devif_poll() will be
- *   called only during normal TX polling.
+ *   a callback from devif_poll().  devif_poll() will be called only during
+ *   normal TX polling.
  *
  * Input Parameters:
  *   dev - Reference to the NuttX driver state structure