mirror of
https://github.com/apache/nuttx.git
synced 2026-05-22 05:42:05 +08:00
Remove CONFIG_NET_MULTILINK. This increases code size by a little, but greatly reduces the complexity of the network code.
This commit is contained in:
+1
-30
@@ -47,31 +47,6 @@
|
||||
|
||||
#include <nuttx/net/ip.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/* If there is only one supported link layer, then the size of the link
|
||||
* layer address is a constant.
|
||||
*
|
||||
* NOTE: Literal constants are used here to avoid bringing in all of the
|
||||
* header files where they are correctly defined.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NET_MULTILINK
|
||||
# if defined(CONFIG_NET_ETHERNET)
|
||||
# define NETDEV_LLADDRSIZE 6 /* IFHWADDRLEN */
|
||||
# elif defined(CONFIG_NET_6LOWPAN)
|
||||
# ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
|
||||
# define NETDEV_LLADDRSIZE 10 /* NET_6LOWPAN_EADDRSIZE */
|
||||
# else
|
||||
# define NETDEV_LLADDRSIZE 2 /* NET_6LOWPAN_SADDRSIZE */
|
||||
# endif
|
||||
# else
|
||||
# define NETDEV_LLADDRSIZE 0 /* No link layer address */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
@@ -458,11 +433,7 @@ int netdev_type_lladdrsize(uint8_t lltype);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_MULTILINK
|
||||
# define netdev_dev_lladdrsize(dev) netdev_type_lladdrsize((dev)->d_lltype)
|
||||
#else
|
||||
# define netdev_dev_lladdrsize(dev) NETDEV_LLADDRSIZE
|
||||
#endif
|
||||
#define netdev_dev_lladdrsize(dev) netdev_type_lladdrsize((dev)->d_lltype)
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -380,11 +380,7 @@ static int netdev_iee802154_ioctl(FAR struct socket *psock, int cmd,
|
||||
/* Find the device with this name */
|
||||
|
||||
dev = netdev_findbyname(ifname);
|
||||
#ifdef CONFIG_NET_MULTILINK
|
||||
if (dev != NULL && dev->d_lltype == NET_LL_IEEE802154)
|
||||
#else
|
||||
if (dev != NULL)
|
||||
#endif
|
||||
{
|
||||
/* Perform the device IOCTL */
|
||||
|
||||
@@ -447,11 +443,7 @@ static int netdev_pktradio_ioctl(FAR struct socket *psock, int cmd,
|
||||
/* Find the device with this name */
|
||||
|
||||
dev = netdev_findbyname(ifname);
|
||||
#ifdef CONFIG_NET_MULTILINK
|
||||
if (dev != NULL && dev->d_lltype == NET_LL_PKTRADIO)
|
||||
#else
|
||||
if (dev != NULL)
|
||||
#endif
|
||||
{
|
||||
/* Perform the device IOCTL */
|
||||
|
||||
@@ -825,11 +817,7 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd,
|
||||
if (dev)
|
||||
{
|
||||
#ifdef CONFIG_NET_ETHERNET
|
||||
#ifdef CONFIG_NET_MULTILINK
|
||||
if (dev->d_lltype == NET_LL_ETHERNET)
|
||||
#else
|
||||
if (true)
|
||||
#endif
|
||||
{
|
||||
req->ifr_hwaddr.sa_family = AF_INETX;
|
||||
memcpy(req->ifr_hwaddr.sa_data,
|
||||
@@ -840,12 +828,8 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd,
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN
|
||||
#ifdef CONFIG_NET_MULTILINK
|
||||
if (dev->d_lltype == NET_LL_IEEE802154 ||
|
||||
dev->d_lltype == NET_LL_PKTRADIO)
|
||||
#else
|
||||
if (true)
|
||||
#endif
|
||||
{
|
||||
req->ifr_hwaddr.sa_family = AF_INETX;
|
||||
memcpy(req->ifr_hwaddr.sa_data,
|
||||
@@ -868,11 +852,7 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd,
|
||||
if (dev)
|
||||
{
|
||||
#ifdef CONFIG_NET_ETHERNET
|
||||
#ifdef CONFIG_NET_MULTILINK
|
||||
if (dev->d_lltype == NET_LL_ETHERNET)
|
||||
#else
|
||||
if (true)
|
||||
#endif
|
||||
{
|
||||
memcpy(dev->d_mac.ether.ether_addr_octet,
|
||||
req->ifr_hwaddr.sa_data, IFHWADDRLEN);
|
||||
@@ -882,12 +862,8 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd,
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN
|
||||
#ifdef CONFIG_NET_MULTILINK
|
||||
if (dev->d_lltype == NET_LL_IEEE802154 ||
|
||||
dev->d_lltype == NET_LL_PKTRADIO)
|
||||
#else
|
||||
if (true)
|
||||
#endif
|
||||
{
|
||||
FAR struct sixlowpan_driver_s *radio;
|
||||
struct sixlowpan_properties_s properties;
|
||||
|
||||
@@ -82,16 +82,6 @@
|
||||
# define NETDEV_DEFAULT_FORMAT NETDEV_LO_FORMAT
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Then next available device number */
|
||||
|
||||
#ifndef CONFIG_NET_MULTILINK
|
||||
static int g_next_devnum = 0;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
@@ -119,7 +109,6 @@ struct net_driver_s *g_netdevices = NULL;
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_MULTILINK
|
||||
static int find_devnum(FAR const char *devfmt)
|
||||
{
|
||||
FAR struct net_driver_s *curr;
|
||||
@@ -151,7 +140,6 @@ static int find_devnum(FAR const char *devfmt)
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@@ -187,11 +175,8 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
|
||||
|
||||
if (dev != NULL)
|
||||
{
|
||||
#ifdef CONFIG_NET_MULTILINK
|
||||
/* We are supporting multiple network devices and using different link
|
||||
* level protocols. Set the protocol usd by the device and the size
|
||||
* level protocols. Set the protocol used by the device and the size
|
||||
* of the link header used by this protocol.
|
||||
/* Set the protocol used by the device and the size of the link
|
||||
* header used by this protocol.
|
||||
*/
|
||||
|
||||
switch (lltype)
|
||||
@@ -273,12 +258,6 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
|
||||
|
||||
dev->d_lltype = (uint8_t)lltype;
|
||||
|
||||
#else
|
||||
/* Use the default device name */
|
||||
|
||||
devfmt = NETDEV_DEFAULT_FORMAT;
|
||||
#endif
|
||||
|
||||
/* There are no clients of the device yet */
|
||||
|
||||
dev->d_conncb = NULL;
|
||||
@@ -290,8 +269,7 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
|
||||
|
||||
net_lock();
|
||||
|
||||
#ifdef CONFIG_NET_MULTILINK
|
||||
# ifdef CONFIG_NET_LOOPBACK
|
||||
#ifdef CONFIG_NET_LOOPBACK
|
||||
/* The local loopback device is a special case: There can be only one
|
||||
* local loopback device so it is unnumbered.
|
||||
*/
|
||||
@@ -301,17 +279,10 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
|
||||
devnum = 0;
|
||||
}
|
||||
else
|
||||
# endif
|
||||
#endif
|
||||
{
|
||||
devnum = find_devnum(devfmt);
|
||||
}
|
||||
#else
|
||||
/* There is only a single link type. Finding the next network device
|
||||
* number is simple.
|
||||
*/
|
||||
|
||||
devnum = g_next_devnum++;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_USER_DEVFMT
|
||||
if (*dev->d_ifname)
|
||||
|
||||
Reference in New Issue
Block a user