mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
net/net_initialize: remove the empty functions that are not needed
streamline the code structure Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
parent
43b16fdb7c
commit
aba8cd4d86
18 changed files with 15 additions and 305 deletions
|
|
@ -149,19 +149,6 @@ EXTERN const struct sock_intf_s g_can_sockif;
|
|||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
struct sockaddr_can; /* Forward reference */
|
||||
|
||||
/****************************************************************************
|
||||
* Name: can_initialize()
|
||||
*
|
||||
* Description:
|
||||
* Initialize the NetLink connection structures. Called once and only
|
||||
* from the networking layer.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void can_initialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: can_alloc()
|
||||
*
|
||||
|
|
|
|||
|
|
@ -71,19 +71,6 @@ static dq_queue_t g_active_can_connections;
|
|||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: can_initialize()
|
||||
*
|
||||
* Description:
|
||||
* Initialize the User Socket connection structures. Called once and only
|
||||
* from the networking layer.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void can_initialize(void)
|
||||
{
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: can_alloc()
|
||||
*
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#
|
||||
# ##############################################################################
|
||||
|
||||
set(SRCS devif_initialize.c devif_callback.c)
|
||||
set(SRCS devif_callback.c)
|
||||
|
||||
# Device driver IP packet receipt interfaces
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
# Network device interface source files
|
||||
|
||||
NET_CSRCS += devif_initialize.c devif_callback.c
|
||||
NET_CSRCS += devif_callback.c
|
||||
|
||||
# Device driver IP packet receipt interfaces
|
||||
|
||||
|
|
|
|||
|
|
@ -294,22 +294,6 @@ extern "C"
|
|||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: devif_initialize
|
||||
*
|
||||
* Description:
|
||||
* Perform initialization of the network device interface layer
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void devif_initialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: devif_callback_alloc
|
||||
*
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
#include <nuttx/net/netconfig.h>
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/net/netdev.h>
|
||||
#include <nuttx/net/netstats.h>
|
||||
|
||||
#include "netdev/netdev.h"
|
||||
#include "utils/utils.h"
|
||||
|
|
@ -49,6 +50,16 @@
|
|||
#define DEVIF_CB_DONT_FREE (1 << 0)
|
||||
#define DEVIF_CB_PEND_FREE (1 << 1)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/* IP/TCP/UDP/ICMP statistics for all network interfaces */
|
||||
|
||||
#ifdef CONFIG_NET_STATISTICS
|
||||
struct net_stats_s g_netstats;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -1,92 +0,0 @@
|
|||
/****************************************************************************
|
||||
* net/devif/devif_initialize.c
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* Copyright (C) 2007-2011, 2014, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Adapted for NuttX from logic in uIP which also has a BSD-like license:
|
||||
*
|
||||
* Original author Adam Dunkels <adam@dunkels.com>
|
||||
* Copyright () 2001-2003, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#ifdef CONFIG_NET
|
||||
|
||||
#include <nuttx/net/netstats.h>
|
||||
|
||||
#include "devif/devif.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/* IP/TCP/UDP/ICMP/CAN statistics for all network interfaces */
|
||||
|
||||
#ifdef CONFIG_NET_STATISTICS
|
||||
struct net_stats_s g_netstats;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: devif_initialize
|
||||
*
|
||||
* Description:
|
||||
* Perform initialization of the network device interface layer
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions:
|
||||
* Called early in the initialization sequence so that no special
|
||||
* protection is required.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void devif_initialize(void)
|
||||
{
|
||||
}
|
||||
#endif /* CONFIG_NET */
|
||||
|
|
@ -83,19 +83,6 @@ struct forward_s
|
|||
struct ipv4_hdr_s; /* Forward reference */
|
||||
struct ipv6_hdr_s; /* Forward reference */
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ipfwd_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the struct forward_s allocator.
|
||||
*
|
||||
* Assumptions:
|
||||
* Called early in system initialization.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void ipfwd_initialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ipfwd_alloc
|
||||
*
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@
|
|||
|
||||
#define MAX_HDRLEN (L2_MAXHDRLEN + L3_MAXHDRLEN)
|
||||
|
||||
static_assert(MAX_HDRLEN <= CONFIG_IOB_BUFSIZE, "IOB buffer size too small");
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
|
@ -78,26 +80,6 @@ NET_BUFPOOL_DECLARE(g_fwdpool, sizeof(struct forward_s),
|
|||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ipfwd_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the struct forward_s allocator.
|
||||
*
|
||||
* Assumptions:
|
||||
* Called early in system initialization.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void ipfwd_initialize(void)
|
||||
{
|
||||
/* The IOB size must be such that the maximum L2 and L3 headers fit into
|
||||
* the contiguous memory of the first IOB in the IOB chain.
|
||||
*/
|
||||
|
||||
DEBUGASSERT(MAX_HDRLEN <= CONFIG_IOB_BUFSIZE);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ipfwd_alloc
|
||||
*
|
||||
|
|
|
|||
|
|
@ -77,40 +77,18 @@
|
|||
|
||||
void net_initialize(void)
|
||||
{
|
||||
/* Initialize the device interface layer */
|
||||
|
||||
devif_initialize();
|
||||
|
||||
#ifdef CONFIG_NET_BLUETOOTH
|
||||
/* Initialize Bluetooth socket support */
|
||||
|
||||
bluetooth_initialize();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_CAN
|
||||
/* Initialize SocketCAN support */
|
||||
|
||||
can_initialize();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_IEEE802154
|
||||
/* Initialize IEEE 802.15.4 socket support */
|
||||
|
||||
ieee802154_initialize();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_NETLINK
|
||||
/* Initialize the Netlink IPC support */
|
||||
|
||||
netlink_initialize();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_PKT
|
||||
/* Initialize packet socket support */
|
||||
|
||||
pkt_initialize();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_ROUTE
|
||||
/* Initialize the routing table */
|
||||
|
||||
|
|
@ -125,24 +103,6 @@ void net_initialize(void)
|
|||
#endif
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
|
||||
#ifdef HAVE_FWDALLOC
|
||||
/* Initialize IP forwarding support */
|
||||
|
||||
ipfwd_initialize();
|
||||
#endif
|
||||
|
||||
#ifdef NET_TCP_HAVE_STACK
|
||||
/* Initialize the TCP/IP connection structures */
|
||||
|
||||
tcp_initialize();
|
||||
#endif /* CONFIG_NET_TCP */
|
||||
|
||||
#ifdef NET_UDP_HAVE_STACK
|
||||
/* Initialize the UDP connection structures */
|
||||
|
||||
udp_initialize();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_USRSOCK
|
||||
/* Initialize the user-space socket API */
|
||||
|
||||
|
|
|
|||
|
|
@ -300,17 +300,6 @@ extern "C"
|
|||
|
||||
EXTERN const struct sock_intf_s g_netlink_sockif;
|
||||
|
||||
/****************************************************************************
|
||||
* Name: netlink_initialize()
|
||||
*
|
||||
* Description:
|
||||
* Initialize the NetLink connection structures. Called once and only
|
||||
* from the networking layer.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void netlink_initialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: netlink_alloc()
|
||||
*
|
||||
|
|
|
|||
|
|
@ -138,19 +138,6 @@ netlink_get_terminator(FAR const struct nlmsghdr *req)
|
|||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: netlink_initialize()
|
||||
*
|
||||
* Description:
|
||||
* Initialize the NetLink connection structures. Called once and only
|
||||
* from the networking layer.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void netlink_initialize(void)
|
||||
{
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: netlink_alloc()
|
||||
*
|
||||
|
|
|
|||
|
|
@ -136,17 +136,6 @@ EXTERN const struct sock_intf_s g_pkt_sockif;
|
|||
struct net_driver_s; /* Forward reference */
|
||||
struct socket; /* Forward reference */
|
||||
|
||||
/****************************************************************************
|
||||
* Name: pkt_initialize()
|
||||
*
|
||||
* Description:
|
||||
* Initialize the packet socket connection structures. Called once and
|
||||
* only from the network initialization logic.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void pkt_initialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: pkt_alloc()
|
||||
*
|
||||
|
|
|
|||
|
|
@ -78,19 +78,6 @@ static dq_queue_t g_active_pkt_connections;
|
|||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: pkt_initialize()
|
||||
*
|
||||
* Description:
|
||||
* Initialize the packet socket connection structures. Called once and
|
||||
* only from the network initialization layer.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void pkt_initialize(void)
|
||||
{
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: pkt_alloc()
|
||||
*
|
||||
|
|
|
|||
|
|
@ -459,17 +459,6 @@ extern "C"
|
|||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: tcp_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the TCP/IP connection structures. Called only once and only
|
||||
* from the network layer at start-up.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void tcp_initialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: tcp_alloc
|
||||
*
|
||||
|
|
|
|||
|
|
@ -607,19 +607,6 @@ int tcp_selectport(uint8_t domain,
|
|||
return portno;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: tcp_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the TCP/IP connection structures. Called only once and only
|
||||
* from the network layer at start-up.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void tcp_initialize(void)
|
||||
{
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: tcp_alloc
|
||||
*
|
||||
|
|
|
|||
|
|
@ -201,17 +201,6 @@ extern "C"
|
|||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: udp_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the UDP connection structures. Called once and only from
|
||||
* the UIP layer.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void udp_initialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: udp_alloc
|
||||
*
|
||||
|
|
|
|||
|
|
@ -537,19 +537,6 @@ errout:
|
|||
return portno;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: udp_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the UDP connection structures. Called once and only from
|
||||
* the UIP layer.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void udp_initialize(void)
|
||||
{
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: udp_alloc
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue