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/03/12 17:24:26 UTC

[incubator-nuttx] branch master updated (1a7f49e -> 8b7d08f)

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 1a7f49e  arch/z[80|16]: Move up_getsp declaration to arch.h
     new 9c1fc8d  net: Remove net_lockinitialize
     new 716e27c  net/local: Remove local_initialize
     new 7028531  net/tcp: Remove tcp_listen_initialize
     new 19ec0b4  net/route: Remove net_init_fileroute
     new 4d0fcc2  net/igmp: Remove igmp_initialize
     new 7598070  net: Remove the unnecessary initialization code
     new 8b7d08f  net: Reoder the initialize sequence(mac->ip->tcp/udp)

The 7 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:
 net/bluetooth/bluetooth_conn.c   |  7 ----
 net/can/can_conn.c               | 10 +----
 net/icmp/icmp_conn.c             | 10 +----
 net/icmpv6/icmpv6_conn.c         | 10 +----
 net/ieee802154/ieee802154_conn.c |  7 ----
 net/igmp/igmp.h                  | 11 ++---
 net/igmp/igmp_initialize.c       | 20 +--------
 net/igmp/igmp_mcastmac.c         |  7 ++--
 net/igmp/igmp_poll.c             |  2 +-
 net/igmp/igmp_send.c             |  2 +-
 net/local/local.h                | 11 -----
 net/local/local_conn.c           | 14 -------
 net/net_initialize.c             | 91 +++++++++++++++-------------------------
 net/netlink/netlink_conn.c       | 10 +----
 net/pkt/pkt_conn.c               | 10 +----
 net/route/fileroute.h            | 19 ---------
 net/route/net_cacheroute.c       |  6 +--
 net/route/net_fileroute.c        | 34 +--------------
 net/route/net_initroute.c        |  5 ---
 net/tcp/tcp.h                    | 14 -------
 net/tcp/tcp_conn.c               |  9 ----
 net/tcp/tcp_listen.c             | 21 ----------
 net/tcp/tcp_wrbuffer.c           |  2 -
 net/udp/udp_conn.c               | 10 +----
 net/usrsock/usrsock_conn.c       | 10 +----
 net/utils/net_lock.c             | 19 ++-------
 net/utils/utils.h                | 10 -----
 27 files changed, 62 insertions(+), 319 deletions(-)

[incubator-nuttx] 05/07: net/igmp: Remove igmp_initialize

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 4d0fcc2526cae74555719fba354da1b3a21acbd3
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Mar 12 13:23:37 2022 +0800

    net/igmp: Remove igmp_initialize
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 net/igmp/igmp.h            | 11 ++++++-----
 net/igmp/igmp_initialize.c | 20 ++------------------
 net/igmp/igmp_mcastmac.c   |  7 ++++---
 net/igmp/igmp_poll.c       |  2 +-
 net/igmp/igmp_send.c       |  2 +-
 net/net_initialize.c       |  7 -------
 6 files changed, 14 insertions(+), 35 deletions(-)

diff --git a/net/igmp/igmp.h b/net/igmp/igmp.h
index 11b0760..1f10717 100644
--- a/net/igmp/igmp.h
+++ b/net/igmp/igmp.h
@@ -131,8 +131,8 @@ extern "C"
 #  define EXTERN extern
 #endif
 
-EXTERN in_addr_t g_ipv4_allsystems;
-EXTERN in_addr_t g_ipv4_allrouters;
+EXTERN const in_addr_t g_ipv4_allsystems;
+EXTERN const in_addr_t g_ipv4_allrouters;
 
 /****************************************************************************
  * Public Function Prototypes
@@ -272,7 +272,7 @@ void igmp_poll(FAR struct net_driver_s *dev);
  ****************************************************************************/
 
 void igmp_send(FAR struct net_driver_s *dev, FAR struct igmp_group_s *group,
-               FAR in_addr_t *destipaddr, uint8_t msgid);
+               FAR const in_addr_t *destipaddr, uint8_t msgid);
 
 /****************************************************************************
  * Name:  igmp_joingroup
@@ -359,7 +359,7 @@ bool igmp_cmptimer(FAR struct igmp_group_s *group, int maxticks);
  *
  ****************************************************************************/
 
-void igmp_addmcastmac(FAR struct net_driver_s *dev, FAR in_addr_t *ip);
+void igmp_addmcastmac(FAR struct net_driver_s *dev, FAR const in_addr_t *ip);
 
 /****************************************************************************
  * Name:  igmp_removemcastmac
@@ -369,7 +369,8 @@ void igmp_addmcastmac(FAR struct net_driver_s *dev, FAR in_addr_t *ip);
  *
  ****************************************************************************/
 
-void igmp_removemcastmac(FAR struct net_driver_s *dev, FAR in_addr_t *ip);
+void igmp_removemcastmac(FAR struct net_driver_s *dev,
+                         FAR const in_addr_t *ip);
 
 #undef EXTERN
 #ifdef __cplusplus
diff --git a/net/igmp/igmp_initialize.c b/net/igmp/igmp_initialize.c
index 8281ee6..e53ab20 100644
--- a/net/igmp/igmp_initialize.c
+++ b/net/igmp/igmp_initialize.c
@@ -59,30 +59,14 @@
  * Public Data
  ****************************************************************************/
 
-in_addr_t g_ipv4_allsystems;
-in_addr_t g_ipv4_allrouters;
+const in_addr_t g_ipv4_allsystems = HTONL(0xe0000001);
+const in_addr_t g_ipv4_allrouters = HTONL(0xe0000002);
 
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
 
 /****************************************************************************
- * Name:  igmp_initialize
- *
- * Description:
- *   Perform one-time IGMP initialization.
- *
- ****************************************************************************/
-
-void igmp_initialize(void)
-{
-  ninfo("IGMP initializing\n");
-
-  net_ipaddr(g_ipv4_allrouters, 224, 0, 0, 2);
-  net_ipaddr(g_ipv4_allsystems, 224, 0, 0, 1);
-}
-
-/****************************************************************************
  * Name:  igmp_devinit
  *
  * Description:
diff --git a/net/igmp/igmp_mcastmac.c b/net/igmp/igmp_mcastmac.c
index 4a357fc..aa70a80 100644
--- a/net/igmp/igmp_mcastmac.c
+++ b/net/igmp/igmp_mcastmac.c
@@ -70,7 +70,7 @@
  *
  ****************************************************************************/
 
-static void igmp_mcastmac(in_addr_t *ip, FAR uint8_t *mac)
+static void igmp_mcastmac(FAR const in_addr_t *ip, FAR uint8_t *mac)
 {
   /* This mapping is from the IETF IN RFC 1700 */
 
@@ -97,7 +97,7 @@ static void igmp_mcastmac(in_addr_t *ip, FAR uint8_t *mac)
  *
  ****************************************************************************/
 
-void igmp_addmcastmac(FAR struct net_driver_s *dev, FAR in_addr_t *ip)
+void igmp_addmcastmac(FAR struct net_driver_s *dev, FAR const in_addr_t *ip)
 {
   uint8_t mcastmac[6];
 
@@ -117,7 +117,8 @@ void igmp_addmcastmac(FAR struct net_driver_s *dev, FAR in_addr_t *ip)
  *
  ****************************************************************************/
 
-void igmp_removemcastmac(FAR struct net_driver_s *dev, FAR in_addr_t *ip)
+void igmp_removemcastmac(FAR struct net_driver_s *dev,
+                         FAR const in_addr_t *ip)
 {
   uint8_t mcastmac[6];
 
diff --git a/net/igmp/igmp_poll.c b/net/igmp/igmp_poll.c
index 22fe26d..a2824ca 100644
--- a/net/igmp/igmp_poll.c
+++ b/net/igmp/igmp_poll.c
@@ -90,7 +90,7 @@
 static inline void igmp_sched_send(FAR struct net_driver_s *dev,
                                    FAR struct igmp_group_s *group)
 {
-  in_addr_t *dest;
+  FAR const in_addr_t *dest;
 
   /* REVISIT:  This should be deferred to a work queue */
 
diff --git a/net/igmp/igmp_send.c b/net/igmp/igmp_send.c
index eab7b4f..4b52d3a 100644
--- a/net/igmp/igmp_send.c
+++ b/net/igmp/igmp_send.c
@@ -102,7 +102,7 @@ static uint16_t igmp_chksum(FAR uint8_t *buffer, int buflen)
  ****************************************************************************/
 
 void igmp_send(FAR struct net_driver_s *dev, FAR struct igmp_group_s *group,
-               FAR in_addr_t *destipaddr, uint8_t msgid)
+               FAR const in_addr_t *destipaddr, uint8_t msgid)
 {
   FAR struct igmp_iphdr_s *ipv4 = IPv4BUF;
   FAR struct igmp_hdr_s *igmp;
diff --git a/net/net_initialize.c b/net/net_initialize.c
index 00c87c4..23c6912 100644
--- a/net/net_initialize.c
+++ b/net/net_initialize.c
@@ -43,7 +43,6 @@
 #include "ieee802154/ieee802154.h"
 #include "can/can.h"
 #include "netlink/netlink.h"
-#include "igmp/igmp.h"
 #include "route/route.h"
 #include "usrsock/usrsock.h"
 
@@ -158,12 +157,6 @@ void net_initialize(void)
 #endif
 #endif
 
-#ifdef CONFIG_NET_IGMP
-  /* Initialize IGMP support */
-
-  igmp_initialize();
-#endif
-
 #ifdef CONFIG_NET_ROUTE
   /* Initialize the routing table */
 

[incubator-nuttx] 01/07: net: Remove net_lockinitialize

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 9c1fc8da4e97cdb6e57cfeb3b5c9a664962d0040
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Mar 12 12:14:11 2022 +0800

    net: Remove net_lockinitialize
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 net/net_initialize.c |  5 -----
 net/utils/net_lock.c | 19 +++----------------
 net/utils/utils.h    | 10 ----------
 3 files changed, 3 insertions(+), 31 deletions(-)

diff --git a/net/net_initialize.c b/net/net_initialize.c
index 6836989..fa1a3be 100644
--- a/net/net_initialize.c
+++ b/net/net_initialize.c
@@ -47,7 +47,6 @@
 #include "igmp/igmp.h"
 #include "route/route.h"
 #include "usrsock/usrsock.h"
-#include "utils/utils.h"
 
 /****************************************************************************
  * Public Functions
@@ -78,10 +77,6 @@
 
 void net_initialize(void)
 {
-  /* Initialize the locking facility */
-
-  net_lockinitialize();
-
 #ifdef CONFIG_NET_IPv6
 #ifdef CONFIG_NET_6LOWPAN
   /* Initialize 6LoWPAN data structures */
diff --git a/net/utils/net_lock.c b/net/utils/net_lock.c
index 91666c5..db2af19 100644
--- a/net/utils/net_lock.c
+++ b/net/utils/net_lock.c
@@ -49,9 +49,9 @@
  * Private Data
  ****************************************************************************/
 
-static sem_t        g_netlock;
-static pid_t        g_holder = NO_HOLDER;
-static unsigned int g_count  = 0;
+static sem_t        g_netlock = SEM_INITIALIZER(1);
+static pid_t        g_holder  = NO_HOLDER;
+static unsigned int g_count;
 
 /****************************************************************************
  * Private Functions
@@ -150,19 +150,6 @@ _net_timedwait(sem_t *sem, bool interruptible, unsigned int timeout)
  ****************************************************************************/
 
 /****************************************************************************
- * Name: net_lockinitialize
- *
- * Description:
- *   Initialize the locking facility
- *
- ****************************************************************************/
-
-void net_lockinitialize(void)
-{
-  nxsem_init(&g_netlock, 0, 1);
-}
-
-/****************************************************************************
  * Name: net_lock
  *
  * Description:
diff --git a/net/utils/utils.h b/net/utils/utils.h
index 5004b5e..06d6d3a 100644
--- a/net/utils/utils.h
+++ b/net/utils/utils.h
@@ -62,16 +62,6 @@ struct net_driver_s;      /* Forward reference */
 struct timeval;           /* Forward reference */
 
 /****************************************************************************
- * Name: net_lockinitialize
- *
- * Description:
- *   Initialize the locking facility
- *
- ****************************************************************************/
-
-void net_lockinitialize(void);
-
-/****************************************************************************
  * Name: net_breaklock
  *
  * Description:

[incubator-nuttx] 07/07: net: Reoder the initialize sequence(mac->ip->tcp/udp)

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 8b7d08f59ab9953e5db334f48a4dc5dd1208627f
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Mar 12 14:16:00 2022 +0800

    net: Reoder the initialize sequence(mac->ip->tcp/udp)
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 net/net_initialize.c | 74 ++++++++++++++++++++++++++--------------------------
 1 file changed, 37 insertions(+), 37 deletions(-)

diff --git a/net/net_initialize.c b/net/net_initialize.c
index 23c6912..0fa2536 100644
--- a/net/net_initialize.c
+++ b/net/net_initialize.c
@@ -75,64 +75,70 @@
 
 void net_initialize(void)
 {
-#ifdef CONFIG_NET_IPv6
-#ifdef CONFIG_NET_6LOWPAN
-  /* Initialize 6LoWPAN data structures */
+  /* Initialize the device interface layer */
 
-  sixlowpan_initialize();
+  devif_initialize();
+
+#ifdef CONFIG_NET_BLUETOOTH
+  /* Initialize Bluetooth  socket support */
+
+  bluetooth_initialize();
 #endif
-#endif /* CONFIG_NET_IPv6 */
 
-  /* Initialize the device interface layer */
+#ifdef CONFIG_NET_CAN
+  /* Initialize SocketCAN support */
 
-  devif_initialize();
+  can_initialize();
+#endif
 
-#ifdef HAVE_FWDALLOC
-  /* Initialize IP forwarding support */
+#ifdef CONFIG_NET_IEEE802154
+  /* Initialize IEEE 802.15.4  socket support */
 
-  ipfwd_initialize();
+  ieee802154_initialize();
 #endif
 
-#ifdef CONFIG_NET_PKT
-  /* Initialize packet socket support */
+#ifdef CONFIG_NET_NETLINK
+  /* Initialize the Netlink IPC support */
 
-  pkt_initialize();
+  netlink_initialize();
 #endif
 
-#ifdef CONFIG_NET_ICMP_SOCKET
-  /* Initialize IPPPROTO_ICMP socket support */
+#ifdef CONFIG_NET_PKT
+  /* Initialize packet socket support */
 
-  icmp_sock_initialize();
+  pkt_initialize();
 #endif
 
-#ifdef CONFIG_NET_ICMPv6_SOCKET
-  /* Initialize IPPPROTO_ICMP6 socket support */
+#ifdef CONFIG_NET_ROUTE
+  /* Initialize the routing table */
 
-  icmpv6_sock_initialize();
+  net_init_route();
 #endif
 
-#ifdef CONFIG_NET_BLUETOOTH
-  /* Initialize Bluetooth  socket support */
+#ifdef CONFIG_NET_IPv6
+#ifdef CONFIG_NET_6LOWPAN
+  /* Initialize 6LoWPAN data structures */
 
-  bluetooth_initialize();
+  sixlowpan_initialize();
 #endif
+#endif /* CONFIG_NET_IPv6 */
 
-#ifdef CONFIG_NET_IEEE802154
-  /* Initialize IEEE 802.15.4  socket support */
+#ifdef HAVE_FWDALLOC
+  /* Initialize IP forwarding support */
 
-  ieee802154_initialize();
+  ipfwd_initialize();
 #endif
 
-#ifdef CONFIG_NET_CAN
-  /* Initialize SocketCAN support */
+#ifdef CONFIG_NET_ICMP_SOCKET
+  /* Initialize IPPPROTO_ICMP socket support */
 
-  can_initialize();
+  icmp_sock_initialize();
 #endif
 
-#ifdef CONFIG_NET_NETLINK
-  /* Initialize the Netlink IPC support */
+#ifdef CONFIG_NET_ICMPv6_SOCKET
+  /* Initialize IPPPROTO_ICMP6 socket support */
 
-  netlink_initialize();
+  icmpv6_sock_initialize();
 #endif
 
 #ifdef NET_TCP_HAVE_STACK
@@ -157,12 +163,6 @@ void net_initialize(void)
 #endif
 #endif
 
-#ifdef CONFIG_NET_ROUTE
-  /* Initialize the routing table */
-
-  net_init_route();
-#endif
-
 #ifdef CONFIG_NET_USRSOCK
   /* Initialize the user-space socket API */
 

[incubator-nuttx] 03/07: net/tcp: Remove tcp_listen_initialize

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 7028531e74813b6097045bc0910c94115e517c89
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Mar 12 12:26:14 2022 +0800

    net/tcp: Remove tcp_listen_initialize
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 net/net_initialize.c |  4 ----
 net/tcp/tcp.h        | 14 --------------
 net/tcp/tcp_listen.c | 21 ---------------------
 3 files changed, 39 deletions(-)

diff --git a/net/net_initialize.c b/net/net_initialize.c
index 185f354..00c87c4 100644
--- a/net/net_initialize.c
+++ b/net/net_initialize.c
@@ -137,10 +137,6 @@ void net_initialize(void)
 #endif
 
 #ifdef NET_TCP_HAVE_STACK
-  /* Initialize the listening port structures */
-
-  tcp_listen_initialize();
-
   /* Initialize the TCP/IP connection structures */
 
   tcp_initialize();
diff --git a/net/tcp/tcp.h b/net/tcp/tcp.h
index d5ec88c..b45e888 100644
--- a/net/tcp/tcp.h
+++ b/net/tcp/tcp.h
@@ -831,20 +831,6 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
                int hsec);
 
 /****************************************************************************
- * Name: tcp_listen_initialize
- *
- * Description:
- *   Setup the listening data structures
- *
- * Assumptions:
- *   Called early in the initialization phase while the system is still
- *   single-threaded.
- *
- ****************************************************************************/
-
-void tcp_listen_initialize(void);
-
-/****************************************************************************
  * Name: tcp_findlistener
  *
  * Description:
diff --git a/net/tcp/tcp_listen.c b/net/tcp/tcp_listen.c
index 4eb4c9c..ad43977 100644
--- a/net/tcp/tcp_listen.c
+++ b/net/tcp/tcp_listen.c
@@ -146,27 +146,6 @@ FAR struct tcp_conn_s *tcp_findlistener(FAR union ip_binding_u *uaddr,
  ****************************************************************************/
 
 /****************************************************************************
- * Name: tcp_listen_initialize
- *
- * Description:
- *   Setup the listening data structures
- *
- * Assumptions:
- *   Called early in the initialization phase while the system is still
- *   single-threaded.
- *
- ****************************************************************************/
-
-void tcp_listen_initialize(void)
-{
-  int ndx;
-  for (ndx = 0; ndx < CONFIG_NET_MAX_LISTENPORTS; ndx++)
-    {
-      tcp_listenports[ndx] = NULL;
-    }
-}
-
-/****************************************************************************
  * Name: tcp_unlisten
  *
  * Description:

[incubator-nuttx] 06/07: net: Remove the unnecessary initialization code

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 75980705087dd370a53e7bdffd13bf56036d3ac3
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Mar 12 14:13:40 2022 +0800

    net: Remove the unnecessary initialization code
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 net/bluetooth/bluetooth_conn.c   |  7 -------
 net/can/can_conn.c               | 10 +---------
 net/icmp/icmp_conn.c             | 10 +---------
 net/icmpv6/icmpv6_conn.c         | 10 +---------
 net/ieee802154/ieee802154_conn.c |  7 -------
 net/netlink/netlink_conn.c       | 10 +---------
 net/pkt/pkt_conn.c               | 10 +---------
 net/route/net_cacheroute.c       |  6 ++----
 net/tcp/tcp_conn.c               |  9 ---------
 net/tcp/tcp_wrbuffer.c           |  2 --
 net/udp/udp_conn.c               | 10 +---------
 net/usrsock/usrsock_conn.c       | 10 +---------
 12 files changed, 9 insertions(+), 92 deletions(-)

diff --git a/net/bluetooth/bluetooth_conn.c b/net/bluetooth/bluetooth_conn.c
index ad57aee..cc4f6f0 100644
--- a/net/bluetooth/bluetooth_conn.c
+++ b/net/bluetooth/bluetooth_conn.c
@@ -90,14 +90,7 @@ void bluetooth_conn_initialize(void)
 {
 #ifndef CONFIG_NET_ALLOC_CONNS
   int i;
-#endif
-
-  /* Initialize the queues */
 
-  dq_init(&g_free_bluetooth_connections);
-  dq_init(&g_active_bluetooth_connections);
-
-#ifndef CONFIG_NET_ALLOC_CONNS
   for (i = 0; i < CONFIG_NET_BLUETOOTH_NCONNS; i++)
     {
       /* Link each pre-allocated connection structure into the free list. */
diff --git a/net/can/can_conn.c b/net/can/can_conn.c
index dc1ee61..dead5e9 100644
--- a/net/can/can_conn.c
+++ b/net/can/can_conn.c
@@ -56,7 +56,7 @@ static struct can_conn_s g_can_connections[CONFIG_CAN_CONNS];
 /* A list of all free NetLink connections */
 
 static dq_queue_t g_free_can_connections;
-static sem_t g_free_sem;
+static sem_t g_free_sem = SEM_INITIALIZER(1);
 
 /* A list of all allocated NetLink connections */
 
@@ -101,15 +101,7 @@ void can_initialize(void)
 {
 #ifndef CONFIG_NET_ALLOC_CONNS
   int i;
-#endif
-
-  /* Initialize the queues */
 
-  dq_init(&g_free_can_connections);
-  dq_init(&g_active_can_connections);
-  nxsem_init(&g_free_sem, 0, 1);
-
-#ifndef CONFIG_NET_ALLOC_CONNS
   for (i = 0; i < CONFIG_CAN_CONNS; i++)
     {
       /* Mark the connection closed and move it to the free list */
diff --git a/net/icmp/icmp_conn.c b/net/icmp/icmp_conn.c
index 9fcc7b3..3ab0f27 100644
--- a/net/icmp/icmp_conn.c
+++ b/net/icmp/icmp_conn.c
@@ -55,7 +55,7 @@ static struct icmp_conn_s g_icmp_connections[CONFIG_NET_ICMP_NCONNS];
 /* A list of all free IPPROTO_ICMP socket connections */
 
 static dq_queue_t g_free_icmp_connections;
-static sem_t g_free_sem;
+static sem_t g_free_sem = SEM_INITIALIZER(1);
 
 /* A list of all allocated IPPROTO_ICMP socket connections */
 
@@ -78,15 +78,7 @@ void icmp_sock_initialize(void)
 {
 #ifndef CONFIG_NET_ALLOC_CONNS
   int i;
-#endif
-
-  /* Initialize the queues */
 
-  dq_init(&g_free_icmp_connections);
-  dq_init(&g_active_icmp_connections);
-  nxsem_init(&g_free_sem, 0, 1);
-
-#ifndef CONFIG_NET_ALLOC_CONNS
   for (i = 0; i < CONFIG_NET_ICMP_NCONNS; i++)
     {
       /* Move the connection structure to the free list */
diff --git a/net/icmpv6/icmpv6_conn.c b/net/icmpv6/icmpv6_conn.c
index 83c19dc..b026581 100644
--- a/net/icmpv6/icmpv6_conn.c
+++ b/net/icmpv6/icmpv6_conn.c
@@ -55,7 +55,7 @@ static struct icmpv6_conn_s g_icmpv6_connections[CONFIG_NET_ICMPv6_NCONNS];
 /* A list of all free IPPROTO_ICMP socket connections */
 
 static dq_queue_t g_free_icmpv6_connections;
-static sem_t g_free_sem;
+static sem_t g_free_sem = SEM_INITIALIZER(1);
 
 /* A list of all allocated IPPROTO_ICMP socket connections */
 
@@ -78,15 +78,7 @@ void icmpv6_sock_initialize(void)
 {
 #ifndef CONFIG_NET_ALLOC_CONNS
   int i;
-#endif
-
-  /* Initialize the queues */
 
-  dq_init(&g_free_icmpv6_connections);
-  dq_init(&g_active_icmpv6_connections);
-  nxsem_init(&g_free_sem, 0, 1);
-
-#ifndef CONFIG_NET_ALLOC_CONNS
   for (i = 0; i < CONFIG_NET_ICMPv6_NCONNS; i++)
     {
       /* Move the connection structure to the free list */
diff --git a/net/ieee802154/ieee802154_conn.c b/net/ieee802154/ieee802154_conn.c
index 2d47f3b..1a13bf2 100644
--- a/net/ieee802154/ieee802154_conn.c
+++ b/net/ieee802154/ieee802154_conn.c
@@ -84,14 +84,7 @@ void ieee802154_conn_initialize(void)
 {
 #ifndef CONFIG_NET_ALLOC_CONNS
   int i;
-#endif
-
-  /* Initialize the queues */
 
-  dq_init(&g_free_ieee802154_connections);
-  dq_init(&g_active_ieee802154_connections);
-
-#ifndef CONFIG_NET_ALLOC_CONNS
   for (i = 0; i < CONFIG_NET_IEEE802154_NCONNS; i++)
     {
       /* Link each pre-allocated connection structure into the free list. */
diff --git a/net/netlink/netlink_conn.c b/net/netlink/netlink_conn.c
index 328317e..168d2b9 100644
--- a/net/netlink/netlink_conn.c
+++ b/net/netlink/netlink_conn.c
@@ -57,7 +57,7 @@ static struct netlink_conn_s g_netlink_connections[CONFIG_NETLINK_CONNS];
 /* A list of all free NetLink connections */
 
 static dq_queue_t g_free_netlink_connections;
-static sem_t g_free_sem;
+static sem_t g_free_sem = SEM_INITIALIZER(1);
 
 /* A list of all allocated NetLink connections */
 
@@ -125,15 +125,7 @@ void netlink_initialize(void)
 {
 #ifndef CONFIG_NET_ALLOC_CONNS
   int i;
-#endif
-
-  /* Initialize the queues */
 
-  dq_init(&g_free_netlink_connections);
-  dq_init(&g_active_netlink_connections);
-  nxsem_init(&g_free_sem, 0, 1);
-
-#ifndef CONFIG_NET_ALLOC_CONNS
   for (i = 0; i < CONFIG_NETLINK_CONNS; i++)
     {
       /* Mark the connection closed and move it to the free list */
diff --git a/net/pkt/pkt_conn.c b/net/pkt/pkt_conn.c
index dfee569..d348fd0 100644
--- a/net/pkt/pkt_conn.c
+++ b/net/pkt/pkt_conn.c
@@ -63,7 +63,7 @@ static struct pkt_conn_s g_pkt_connections[CONFIG_NET_PKT_CONNS];
 /* A list of all free packet socket connections */
 
 static dq_queue_t g_free_pkt_connections;
-static sem_t g_free_sem;
+static sem_t g_free_sem = SEM_INITIALIZER(1);
 
 /* A list of all allocated packet socket connections */
 
@@ -105,15 +105,7 @@ void pkt_initialize(void)
 {
 #ifndef CONFIG_NET_ALLOC_CONNS
   int i;
-#endif
-
-  /* Initialize the queues */
 
-  dq_init(&g_free_pkt_connections);
-  dq_init(&g_active_pkt_connections);
-  nxsem_init(&g_free_sem, 0, 1);
-
-#ifndef CONFIG_NET_ALLOC_CONNS
   for (i = 0; i < CONFIG_NET_PKT_CONNS; i++)
     {
       dq_addlast(&g_pkt_connections[i].sconn.node, &g_free_pkt_connections);
diff --git a/net/route/net_cacheroute.c b/net/route/net_cacheroute.c
index 99fc307..c6629b7 100644
--- a/net/route/net_cacheroute.c
+++ b/net/route/net_cacheroute.c
@@ -122,7 +122,7 @@ static struct net_cache_ipv4_entry_s
 
 /* Serializes access to the routing table cache */
 
-static sem_t g_ipv4_cachelock;
+static sem_t g_ipv4_cachelock = SEM_INITIALIZER(1);
 #endif
 
 #if defined(CONFIG_ROUTE_IPv6_CACHEROUTE)
@@ -141,7 +141,7 @@ static struct net_cache_ipv6_entry_s
 
 /* Serializes access to the routing table cache */
 
-static sem_t g_ipv6_cachelock;
+static sem_t g_ipv6_cachelock = SEM_INITIALIZER(1);
 #endif
 
 /****************************************************************************
@@ -481,12 +481,10 @@ void net_init_cacheroute(void)
   /* Initialize the routing table cash and the free list */
 
 #ifdef CONFIG_ROUTE_IPv4_CACHEROUTE
-  nxsem_init(&g_ipv4_cachelock, 0, 1);
   net_reset_ipv4_cache();
 #endif
 
 #ifdef CONFIG_ROUTE_IPv6_CACHEROUTE
-  nxsem_init(&g_ipv6_cachelock, 0, 1);
   net_reset_ipv6_cache();
 #endif
 }
diff --git a/net/tcp/tcp_conn.c b/net/tcp/tcp_conn.c
index adf0a1e..b74f762 100644
--- a/net/tcp/tcp_conn.c
+++ b/net/tcp/tcp_conn.c
@@ -580,16 +580,7 @@ void tcp_initialize(void)
 {
 #ifndef CONFIG_NET_ALLOC_CONNS
   int i;
-#endif
-
-  /* Initialize the queues */
-
-  dq_init(&g_free_tcp_connections);
-  dq_init(&g_active_tcp_connections);
 
-  /* Now initialize each connection structure */
-
-#ifndef CONFIG_NET_ALLOC_CONNS
   for (i = 0; i < CONFIG_NET_TCP_CONNS; i++)
     {
       /* Mark the connection closed and move it to the free list */
diff --git a/net/tcp/tcp_wrbuffer.c b/net/tcp/tcp_wrbuffer.c
index 7fb1bec..bc2644f 100644
--- a/net/tcp/tcp_wrbuffer.c
+++ b/net/tcp/tcp_wrbuffer.c
@@ -94,8 +94,6 @@ void tcp_wrbuffer_initialize(void)
 {
   int i;
 
-  sq_init(&g_wrbuffer.freebuffers);
-
   for (i = 0; i < CONFIG_NET_TCP_NWRBCHAINS; i++)
     {
       sq_addfirst(&g_wrbuffer.buffers[i].wb_node, &g_wrbuffer.freebuffers);
diff --git a/net/udp/udp_conn.c b/net/udp/udp_conn.c
index 18f27a8..7ab5e8b 100644
--- a/net/udp/udp_conn.c
+++ b/net/udp/udp_conn.c
@@ -88,7 +88,7 @@ struct udp_conn_s g_udp_connections[CONFIG_NET_UDP_CONNS];
 /* A list of all free UDP connections */
 
 static dq_queue_t g_free_udp_connections;
-static sem_t g_free_sem;
+static sem_t g_free_sem = SEM_INITIALIZER(1);
 
 /* A list of all allocated UDP connections */
 
@@ -580,15 +580,7 @@ void udp_initialize(void)
 {
 #ifndef CONFIG_NET_ALLOC_CONNS
   int i;
-#endif
-
-  /* Initialize the queues */
 
-  dq_init(&g_free_udp_connections);
-  dq_init(&g_active_udp_connections);
-  nxsem_init(&g_free_sem, 0, 1);
-
-#ifndef CONFIG_NET_ALLOC_CONNS
   for (i = 0; i < CONFIG_NET_UDP_CONNS; i++)
     {
       /* Mark the connection closed and move it to the free list */
diff --git a/net/usrsock/usrsock_conn.c b/net/usrsock/usrsock_conn.c
index d6daac9..7bef3da 100644
--- a/net/usrsock/usrsock_conn.c
+++ b/net/usrsock/usrsock_conn.c
@@ -53,7 +53,7 @@ static struct usrsock_conn_s g_usrsock_connections[CONFIG_NET_USRSOCK_CONNS];
 /* A list of all free usrsock connections */
 
 static dq_queue_t g_free_usrsock_connections;
-static sem_t g_free_sem;
+static sem_t g_free_sem = SEM_INITIALIZER(1);
 
 /* A list of all allocated usrsock connections */
 
@@ -333,15 +333,7 @@ void usrsock_initialize(void)
 #ifndef CONFIG_NET_ALLOC_CONNS
   FAR struct usrsock_conn_s *conn;
   int i;
-#endif
-
-  /* Initialize the queues */
 
-  dq_init(&g_free_usrsock_connections);
-  dq_init(&g_active_usrsock_connections);
-  nxsem_init(&g_free_sem, 0, 1);
-
-#ifndef CONFIG_NET_ALLOC_CONNS
   for (i = 0; i < CONFIG_NET_USRSOCK_CONNS; i++)
     {
       conn = &g_usrsock_connections[i];

[incubator-nuttx] 04/07: net/route: Remove net_init_fileroute

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 19ec0b4fe321448049c3605027697b1fe64f45b9
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Mar 12 12:39:09 2022 +0800

    net/route: Remove net_init_fileroute
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 net/route/fileroute.h     | 19 -------------------
 net/route/net_fileroute.c | 34 ++--------------------------------
 net/route/net_initroute.c |  5 -----
 3 files changed, 2 insertions(+), 56 deletions(-)

diff --git a/net/route/fileroute.h b/net/route/fileroute.h
index 3eb5f29..454aaa6 100644
--- a/net/route/fileroute.h
+++ b/net/route/fileroute.h
@@ -47,25 +47,6 @@
 struct file; /* Forward reference */
 
 /****************************************************************************
- * Name: net_init_fileroute
- *
- * Description:
- *   Initialize the in-memory, RAM routing table
- *
- * Input Parameters:
- *   None
- *
- * Returned Value:
- *   None
- *
- * Assumptions:
- *   Called early in initialization so that no special protection is needed.
- *
- ****************************************************************************/
-
-void net_init_fileroute(void);
-
-/****************************************************************************
  * Name: net_openroute_ipv4/net_openroute_ipv6
  *
  * Description:
diff --git a/net/route/net_fileroute.c b/net/route/net_fileroute.c
index 739c0fd..e9ff85a 100644
--- a/net/route/net_fileroute.c
+++ b/net/route/net_fileroute.c
@@ -56,7 +56,7 @@
 #ifdef CONFIG_ROUTE_IPv4_FILEROUTE
 /* Semaphore used to lock a routing table for exclusive write-only access */
 
-static sem_t g_ipv4_exclsem;
+static sem_t g_ipv4_exclsem = SEM_INITIALIZER(1);
 static pid_t g_ipv4_holder = NO_HOLDER;
 static int g_ipv4_count;
 #endif
@@ -64,7 +64,7 @@ static int g_ipv4_count;
 #ifdef CONFIG_ROUTE_IPv6_FILEROUTE
 /* Semaphore used to lock a routing table for exclusive write-only access */
 
-static sem_t g_ipv6_exclsem;
+static sem_t g_ipv6_exclsem = SEM_INITIALIZER(1);
 static pid_t g_ipv6_holder = NO_HOLDER;
 static int g_ipv6_count;
 #endif
@@ -181,36 +181,6 @@ int net_routesize(FAR const char *path, size_t entrysize)
  ****************************************************************************/
 
 /****************************************************************************
- * Name: net_init_fileroute
- *
- * Description:
- *   Initialize the in-memory, RAM routing table
- *
- * Input Parameters:
- *   None
- *
- * Returned Value:
- *   None
- *
- * Assumptions:
- *   Called early in initialization so that no special protection is needed.
- *
- ****************************************************************************/
-
-void net_init_fileroute(void)
-{
-  /* Initialize semaphores */
-
-#ifdef CONFIG_ROUTE_IPv4_FILEROUTE
-  nxsem_init(&g_ipv4_exclsem, 0, 1);
-#endif
-
-#ifdef CONFIG_ROUTE_IPv6_FILEROUTE
-  nxsem_init(&g_ipv6_exclsem, 0, 1);
-#endif
-}
-
-/****************************************************************************
  * Name: net_openroute_ipv4/net_openroute_ipv6
  *
  * Description:
diff --git a/net/route/net_initroute.c b/net/route/net_initroute.c
index be66f3a..7af4464 100644
--- a/net/route/net_initroute.c
+++ b/net/route/net_initroute.c
@@ -25,7 +25,6 @@
 #include <nuttx/config.h>
 
 #include "route/ramroute.h"
-#include "route/fileroute.h"
 #include "route/cacheroute.h"
 #include "route/route.h"
 
@@ -55,10 +54,6 @@ void net_init_route(void)
   net_init_ramroute();
 #endif
 
-#if defined(CONFIG_ROUTE_IPv4_FILEROUTE) || defined(CONFIG_ROUTE_IPv6_FILEROUTE)
-  net_init_fileroute();
-#endif
-
 #if defined(CONFIG_ROUTE_IPv4_CACHEROUTE) || defined(CONFIG_ROUTE_IPv6_CACHEROUTE)
   net_init_cacheroute();
 #endif

[incubator-nuttx] 02/07: net/local: Remove local_initialize

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 716e27cbebadbc93ee7d2c550503768b24a0a838
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Mar 12 12:23:22 2022 +0800

    net/local: Remove local_initialize
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 net/local/local.h      | 11 -----------
 net/local/local_conn.c | 14 --------------
 net/net_initialize.c   |  7 -------
 3 files changed, 32 deletions(-)

diff --git a/net/local/local.h b/net/local/local.h
index ef74217..ca9eab2 100644
--- a/net/local/local.h
+++ b/net/local/local.h
@@ -204,17 +204,6 @@ struct sockaddr; /* Forward reference */
 struct socket;   /* Forward reference */
 
 /****************************************************************************
- * Name: local_initialize
- *
- * Description:
- *   Initialize the local, Unix domain connection structures.  Called once
- *   and only from the common network initialization logic.
- *
- ****************************************************************************/
-
-void local_initialize(void);
-
-/****************************************************************************
  * Name: local_alloc
  *
  * Description:
diff --git a/net/local/local_conn.c b/net/local/local_conn.c
index 72fb1d1..302c7cb 100644
--- a/net/local/local_conn.c
+++ b/net/local/local_conn.c
@@ -48,20 +48,6 @@ static dq_queue_t g_local_connections;
  ****************************************************************************/
 
 /****************************************************************************
- * Name: local_initialize
- *
- * Description:
- *   Initialize the local, Unix domain connection structures.  Called once
- *   and only from the common network initialization logic.
- *
- ****************************************************************************/
-
-void local_initialize(void)
-{
-  dq_init(&g_local_connections);
-}
-
-/****************************************************************************
  * Name: local_nextconn
  *
  * Description:
diff --git a/net/net_initialize.c b/net/net_initialize.c
index fa1a3be..185f354 100644
--- a/net/net_initialize.c
+++ b/net/net_initialize.c
@@ -41,7 +41,6 @@
 #include "pkt/pkt.h"
 #include "bluetooth/bluetooth.h"
 #include "ieee802154/ieee802154.h"
-#include "local/local.h"
 #include "can/can.h"
 #include "netlink/netlink.h"
 #include "igmp/igmp.h"
@@ -125,12 +124,6 @@ void net_initialize(void)
   ieee802154_initialize();
 #endif
 
-#ifdef CONFIG_NET_LOCAL
-  /* Initialize the local, "Unix domain" socket support */
-
-  local_initialize();
-#endif
-
 #ifdef CONFIG_NET_CAN
   /* Initialize SocketCAN support */