Network: Misc fixes for clean complete with both Ethernet and SLIP enabled

This commit is contained in:
Gregory Nutt 2014-11-15 08:55:50 -06:00
parent 3ffbfc6bbd
commit 2b758537ea
5 changed files with 40 additions and 42 deletions

View File

@ -961,7 +961,8 @@ int slip_initialize(int intf, FAR const char *devname)
argv[1] = NULL; argv[1] = NULL;
priv->rxpid = task_create("rxslip", CONFIG_SLIP_DEFPRIO, priv->rxpid = task_create("rxslip", CONFIG_SLIP_DEFPRIO,
CONFIG_SLIP_STACKSIZE, (main_t)slip_rxtask, argv); CONFIG_SLIP_STACKSIZE, (main_t)slip_rxtask,
(FAR char * const *)argv);
if (priv->rxpid < 0) if (priv->rxpid < 0)
{ {
ndbg("ERROR: Failed to start receiver task\n"); ndbg("ERROR: Failed to start receiver task\n");
@ -975,7 +976,8 @@ int slip_initialize(int intf, FAR const char *devname)
/* Start the SLIP transmitter task */ /* Start the SLIP transmitter task */
priv->txpid = task_create("txslip", CONFIG_SLIP_DEFPRIO, priv->txpid = task_create("txslip", CONFIG_SLIP_DEFPRIO,
CONFIG_SLIP_STACKSIZE, (main_t)slip_txtask, argv); CONFIG_SLIP_STACKSIZE, (main_t)slip_txtask,
(FAR char * const *)argv);
if (priv->txpid < 0) if (priv->txpid < 0)
{ {
ndbg("ERROR: Failed to start receiver task\n"); ndbg("ERROR: Failed to start receiver task\n");

View File

@ -82,17 +82,12 @@
* should be set to 0. * should be set to 0.
*/ */
#undef CONFIG_NET_ETHERNET
#undef CONFIG_NET_ARP
#ifdef CONFIG_NET_SLIP #ifdef CONFIG_NET_SLIP
# ifdef CONFIG_NET_IPv6 # ifdef CONFIG_NET_IPv6
# error "SLIP is not implemented for IPv6" # error SLIP is not available for IPv6
# endif # endif
# define NET_LL_HDRLEN 0 # define NET_LL_HDRLEN 0
#else #else
# define CONFIG_NET_ETHERNET 1
# define CONFIG_NET_ARP 1
# define NET_LL_HDRLEN 14 # define NET_LL_HDRLEN 14
#endif #endif

View File

@ -88,42 +88,15 @@ config NET_GUARDSIZE
packet size will be chopped down to the size indicated in the TCP packet size will be chopped down to the size indicated in the TCP
header. header.
source "net/socket/Kconfig" menu "Data link support"
source "net/netdev/Kconfig"
source "net/ipv6/Kconfig"
source "net/pkt/Kconfig"
source "net/tcp/Kconfig"
source "net/udp/Kconfig"
source "net/icmp/Kconfig"
source "net/igmp/Kconfig"
source "net/arp/Kconfig"
source "net/iob/Kconfig"
source "net/utils/Kconfig"
config NET_STATISTICS
bool "Collect network statistics"
default n
---help---
uIP statistics on or off
source "net/route/Kconfig"
config NET_MULTICAST
bool "Multi-cast Tx support"
default n
---help---
Outgoing multi-cast address support
# Select Data Link
config NET_MULTILINK config NET_MULTILINK
bool bool
default n default n
config NET_ETHERNET config NET_ETHERNET
bool bool "Ethernet support"
default y if !NET_SLIP default y
default n if NET_SLIP
select NETDEV_MULTINIC if NET_SLIP select NETDEV_MULTINIC if NET_SLIP
select NET_MULTILINK if NET_SLIP select NET_MULTILINK if NET_SLIP
---help--- ---help---
@ -182,4 +155,32 @@ config SLIP_DEFPRIO
The priority of the SLIP RX and TX tasks. Default: 128 The priority of the SLIP RX and TX tasks. Default: 128
endif # NET_SLIP endif # NET_SLIP
endmenu # Data link support
source "net/socket/Kconfig"
source "net/netdev/Kconfig"
source "net/ipv6/Kconfig"
source "net/pkt/Kconfig"
source "net/tcp/Kconfig"
source "net/udp/Kconfig"
source "net/icmp/Kconfig"
source "net/igmp/Kconfig"
source "net/arp/Kconfig"
source "net/iob/Kconfig"
source "net/utils/Kconfig"
config NET_STATISTICS
bool "Collect network statistics"
default n
---help---
uIP statistics on or off
source "net/route/Kconfig"
config NET_MULTICAST
bool "Multi-cast Tx support"
default n
---help---
Outgoing multi-cast address support
endif # NET endif # NET

View File

@ -40,6 +40,7 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <unistd.h> #include <unistd.h>
#include <string.h>
#include <semaphore.h> #include <semaphore.h>
#include <time.h> #include <time.h>
#include <debug.h> #include <debug.h>
@ -97,7 +98,7 @@ static uint16_t arp_send_interrupt(FAR struct net_driver_s *dev,
#ifdef CONFIG_NETDEV_MULTINIC #ifdef CONFIG_NETDEV_MULTINIC
/* Is this the device that we need to route this request? */ /* Is this the device that we need to route this request? */
if (strncmp(dev->d_ifname, state->snd_ifname, IFNAMSIZ) != 0) if (strncmp((FAR const char *)dev->d_ifname, (FAR const char *)state->snd_ifname, IFNAMSIZ) != 0)
{ {
/* No... pass on this one and wait for the device that we want */ /* No... pass on this one and wait for the device that we want */
@ -295,7 +296,7 @@ int arp_send(in_addr_t ipaddr)
#ifdef CONFIG_NETDEV_MULTINIC #ifdef CONFIG_NETDEV_MULTINIC
/* Remember the routing device name */ /* Remember the routing device name */
strncpy(state->snd_ifname, dev->d_ifname, IFNAMSIZ); strncpy((FAR char *)state.snd_ifname, (FAR const char *)dev->d_ifname, IFNAMSIZ);
#endif #endif
/* Now loop, testing if the address mapping is in the ARP table and re-sending the ARP request if it is not. /* Now loop, testing if the address mapping is in the ARP table and re-sending the ARP request if it is not.

View File

@ -147,7 +147,6 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
dev->d_llhdrlen = 0; dev->d_llhdrlen = 0;
break; break;
#endif #endif
break;
/* REVISIT: Here we must also set the size of the link header /* REVISIT: Here we must also set the size of the link header
* header the precedes network layer headers. * header the precedes network layer headers.
@ -162,7 +161,7 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
/* Remember the verified link type */ /* Remember the verified link type */
dev->d_lltype = (uint8_t)lltype dev->d_lltype = (uint8_t)lltype;
#endif #endif
/* Assign a device name to the interface */ /* Assign a device name to the interface */