acassis commented on code in PR #15285:
URL: https://github.com/apache/nuttx/pull/15285#discussion_r1894638700


##########
net/bluetooth/bluetooth_conn.c:
##########
@@ -42,10 +42,19 @@
 #include <nuttx/net/bluetooth.h>
 
 #include "devif/devif.h"
+#include "utils/utils.h"
 #include "bluetooth/bluetooth.h"
 
 #ifdef CONFIG_NET_BLUETOOTH
 
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#ifndef CONFIG_NET_BLUETOOTH_MAX_CONNS
+#  define CONFIG_NET_BLUETOOTH_MAX_CONNS 0

Review Comment:
   @wengzhe why to use 0 as max connections? Please for logic reasoning use 1 
and later in your logic operation decrease 1



##########
net/tcp/tcp_conn.c:
##########
@@ -74,18 +74,22 @@
 #include "utils/utils.h"
 
 /****************************************************************************
- * Private Data
+ * Pre-processor Definitions
  ****************************************************************************/
 
-/* The array containing all TCP connections. */
-
-#if CONFIG_NET_TCP_PREALLOC_CONNS > 0
-static struct tcp_conn_s g_tcp_connections[CONFIG_NET_TCP_PREALLOC_CONNS];
+#ifndef CONFIG_NET_TCP_MAX_CONNS
+#  define CONFIG_NET_TCP_MAX_CONNS 0

Review Comment:
   Ditto



##########
net/netlink/netlink_conn.c:
##########
@@ -49,19 +49,22 @@
 #ifdef CONFIG_NET_NETLINK
 
 /****************************************************************************
- * Private Data
+ * Pre-processor Definitions
  ****************************************************************************/
 
-/* The array containing all NetLink connections. */
-
-#if CONFIG_NETLINK_PREALLOC_CONNS > 0
-static struct netlink_conn_s
-g_netlink_connections[CONFIG_NETLINK_PREALLOC_CONNS];
+#ifndef CONFIG_NETLINK_MAX_CONNS
+#  define CONFIG_NETLINK_MAX_CONNS 0

Review Comment:
   Ditto



##########
net/ieee802154/ieee802154_conn.c:
##########
@@ -42,9 +42,18 @@
 
 #include "devif/devif.h"
 #include "ieee802154/ieee802154.h"
+#include "utils/utils.h"
 
 #ifdef CONFIG_NET_IEEE802154
 
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#ifndef CONFIG_NET_IEEE802154_MAX_CONNS
+#  define CONFIG_NET_IEEE802154_MAX_CONNS 0

Review Comment:
   Ditto



##########
net/icmp/icmp_conn.c:
##########
@@ -41,22 +41,27 @@
 
 #include "devif/devif.h"
 #include "icmp/icmp.h"
+#include "utils/utils.h"
 
 #ifdef CONFIG_NET_ICMP_SOCKET
 
 /****************************************************************************
- * Private Data
+ * Pre-processor Definitions
  ****************************************************************************/
 
-/* The array containing all IPPROTO_ICMP socket connections */
-
-#if CONFIG_NET_ICMP_PREALLOC_CONNS > 0
-static struct icmp_conn_s g_icmp_connections[CONFIG_NET_ICMP_PREALLOC_CONNS];
+#ifndef CONFIG_NET_ICMP_MAX_CONNS
+#  define CONFIG_NET_ICMP_MAX_CONNS 0

Review Comment:
   Here too



##########
net/udp/udp_conn.c:
##########
@@ -75,18 +75,22 @@
 #include "utils/utils.h"
 
 /****************************************************************************
- * Private Data
+ * Pre-processor Definitions
  ****************************************************************************/
 
-/* The array containing all UDP connections. */
-
-#if CONFIG_NET_UDP_PREALLOC_CONNS > 0
-static struct udp_conn_s g_udp_connections[CONFIG_NET_UDP_PREALLOC_CONNS];
+#ifndef CONFIG_NET_UDP_MAX_CONNS
+#  define CONFIG_NET_UDP_MAX_CONNS 0

Review Comment:
   Ditto



##########
net/can/can_conn.c:
##########
@@ -46,18 +46,22 @@
 #ifdef CONFIG_NET_CAN
 
 /****************************************************************************
- * Private Data
+ * Pre-processor Definitions
  ****************************************************************************/
 
-/* The array containing all NetLink connections. */
-
-#if CONFIG_CAN_PREALLOC_CONNS > 0
-static struct can_conn_s g_can_connections[CONFIG_CAN_PREALLOC_CONNS];
+#ifndef CONFIG_CAN_MAX_CONNS
+#  define CONFIG_CAN_MAX_CONNS 0

Review Comment:
   Ditto



##########
net/pkt/pkt_conn.c:
##########
@@ -52,19 +53,19 @@
    (addr1[2] == addr2[2]) && (addr1[3] == addr2[3]) && \
    (addr1[4] == addr2[4]) && (addr1[5] == addr2[5]))
 
+#ifndef CONFIG_NET_PKT_MAX_CONNS
+#  define CONFIG_NET_PKT_MAX_CONNS 0

Review Comment:
   Ditto



##########
net/icmpv6/icmpv6_conn.c:
##########
@@ -41,23 +41,28 @@
 
 #include "devif/devif.h"
 #include "icmpv6/icmpv6.h"
+#include "utils/utils.h"
 
 #ifdef CONFIG_NET_ICMPv6_SOCKET
 
 /****************************************************************************
- * Private Data
+ * Pre-processor Definitions
  ****************************************************************************/
 
-/* The array containing all IPPROTO_ICMP socket connections */
-
-#if CONFIG_NET_ICMPv6_PREALLOC_CONNS > 0
-static struct icmpv6_conn_s
-              g_icmpv6_connections[CONFIG_NET_ICMPv6_PREALLOC_CONNS];
+#ifndef CONFIG_NET_ICMPv6_MAX_CONNS
+#  define CONFIG_NET_ICMPv6_MAX_CONNS 0

Review Comment:
   Ditto



##########
net/usrsock/usrsock_conn.c:
##########
@@ -43,21 +43,26 @@
 #include <nuttx/net/usrsock.h>
 
 #include "usrsock/usrsock.h"
+#include "utils/utils.h"
 
 /****************************************************************************
- * Private Data
+ * Pre-processor Definitions
  ****************************************************************************/
 
-/* The array containing all usrsock connections. */
-
-#if CONFIG_NET_USRSOCK_PREALLOC_CONNS > 0
-static struct usrsock_conn_s
-              g_usrsock_connections[CONFIG_NET_USRSOCK_PREALLOC_CONNS];
+#ifndef CONFIG_NET_USRSOCK_MAX_CONNS
+#  define CONFIG_NET_USRSOCK_MAX_CONNS 0

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