SLIP: Review code, update comments, add missing configuration items
This commit is contained in:
parent
1ff1cd6c0c
commit
86769101a1
@ -52,7 +52,7 @@ config NET_DUMPPACKET
|
|||||||
|
|
||||||
comment "External Ethernet MAC Device Support"
|
comment "External Ethernet MAC Device Support"
|
||||||
|
|
||||||
config NET_DM90x0
|
menuconfig NET_DM90x0
|
||||||
bool "Davicom dm9000/dm9010 support"
|
bool "Davicom dm9000/dm9010 support"
|
||||||
default n
|
default n
|
||||||
---help---
|
---help---
|
||||||
@ -132,7 +132,7 @@ config NET_CS89x0
|
|||||||
---help---
|
---help---
|
||||||
Under construction -- do not use
|
Under construction -- do not use
|
||||||
|
|
||||||
config ENC28J60
|
menuconfig ENC28J60
|
||||||
bool "Microchip ENC28J60 support"
|
bool "Microchip ENC28J60 support"
|
||||||
default n
|
default n
|
||||||
select SPI
|
select SPI
|
||||||
@ -142,6 +142,7 @@ config ENC28J60
|
|||||||
DS39662C, 2008 Microchip Technology Inc.
|
DS39662C, 2008 Microchip Technology Inc.
|
||||||
|
|
||||||
if ENC28J60
|
if ENC28J60
|
||||||
|
|
||||||
config ENC28J60_NINTERFACES
|
config ENC28J60_NINTERFACES
|
||||||
int "Number of physical ENC28J60"
|
int "Number of physical ENC28J60"
|
||||||
default 1
|
default 1
|
||||||
@ -192,9 +193,9 @@ config ENC28J60_REGDEBUG
|
|||||||
---help---
|
---help---
|
||||||
Enable very low-level register access debug. Depends on DEBUG and DEBUG_NET.
|
Enable very low-level register access debug. Depends on DEBUG and DEBUG_NET.
|
||||||
|
|
||||||
endif
|
endif # ENC28J60
|
||||||
|
|
||||||
config ENCX24J600
|
menuconfig ENCX24J600
|
||||||
bool "Microchip ENCX24J600 support"
|
bool "Microchip ENCX24J600 support"
|
||||||
default n
|
default n
|
||||||
select SPI
|
select SPI
|
||||||
@ -205,6 +206,7 @@ config ENCX24J600
|
|||||||
with SPI or Parallel Interface DS39935B, 2009 Microchip Technology Inc.
|
with SPI or Parallel Interface DS39935B, 2009 Microchip Technology Inc.
|
||||||
|
|
||||||
if ENCX24J600
|
if ENCX24J600
|
||||||
|
|
||||||
config ENC28J60_NINTERFACES
|
config ENC28J60_NINTERFACES
|
||||||
int "Number of physical ENCX24J600"
|
int "Number of physical ENCX24J600"
|
||||||
default 1
|
default 1
|
||||||
@ -258,9 +260,9 @@ config ENCX24J600_REGDEBUG
|
|||||||
---help---
|
---help---
|
||||||
Enable very low-level register access debug. Depends on DEBUG and DEBUG_NET.
|
Enable very low-level register access debug. Depends on DEBUG and DEBUG_NET.
|
||||||
|
|
||||||
endif
|
endif # ENCX24J600
|
||||||
|
|
||||||
config NET_E1000
|
menuconfig NET_E1000
|
||||||
bool "E1000 support"
|
bool "E1000 support"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
@ -280,13 +282,52 @@ config E1000_BUFF_SIZE
|
|||||||
|
|
||||||
endif # NET_E1000
|
endif # NET_E1000
|
||||||
|
|
||||||
config NET_SLIP
|
menuconfig NET_SLIP
|
||||||
bool "SLIP (serial line) support"
|
bool "SLIP (serial line) support"
|
||||||
default n
|
default n
|
||||||
---help---
|
---help---
|
||||||
Reference: RFC 1055
|
Reference: RFC 1055
|
||||||
|
|
||||||
config NET_FTMAC100
|
if NET_SLIP
|
||||||
|
|
||||||
|
config NET_SLIP_STACKSIZE
|
||||||
|
int "Daemon stack size"
|
||||||
|
default 2048
|
||||||
|
---help---
|
||||||
|
Provides the stack size for SLIP RX and TX.
|
||||||
|
|
||||||
|
config NET_SLIP_DEFPRIO
|
||||||
|
int "Daemon priority"
|
||||||
|
default 128
|
||||||
|
---help---
|
||||||
|
Provides the priority for SLIP RX and TX threads.
|
||||||
|
|
||||||
|
config NET_SLIP_MTU
|
||||||
|
int "Packet size (MTU)"
|
||||||
|
default 296
|
||||||
|
---help---
|
||||||
|
Provides the size of the SLIP packet buffers.
|
||||||
|
|
||||||
|
The Linux slip module hard-codes its MTU size to 296 (40 bytes for
|
||||||
|
the IP+TPC headers plus 256 bytes of data). So you might as well
|
||||||
|
set CONFIG_NET_SLIP_MTU to 296 as well.
|
||||||
|
|
||||||
|
There may be an issue with this setting, however. I see that Linux
|
||||||
|
uses a MTU of 296 and window of 256, but actually only sends 168
|
||||||
|
bytes of data: 40 + 128. I believe that is to allow for the 2x
|
||||||
|
worst cast packet expansion. Ideally we would like to advertise the
|
||||||
|
256 MSS, but restrict transfers to 128 bytes (possibly by modifying
|
||||||
|
the tcp_mss() macro).
|
||||||
|
|
||||||
|
config SLIP_NINTERFACES
|
||||||
|
int "Number of SLIP interfaces"
|
||||||
|
default 1
|
||||||
|
---help---
|
||||||
|
Determines the number of physical interfaces that will be supported.
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
menuconfig NET_FTMAC100
|
||||||
bool "Faraday 10/100 Ethernet"
|
bool "Faraday 10/100 Ethernet"
|
||||||
default n
|
default n
|
||||||
---help---
|
---help---
|
||||||
@ -316,7 +357,7 @@ config FTMAC100_MAC0_ENV_ADDR
|
|||||||
|
|
||||||
endif # NET_FTMAC100
|
endif # NET_FTMAC100
|
||||||
|
|
||||||
config NET_VNET
|
menuconfig NET_VNET
|
||||||
bool "VNET support"
|
bool "VNET support"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
@ -83,12 +83,12 @@
|
|||||||
# warning "CONFIG_NET_MULTIBUFFER must be set"
|
# warning "CONFIG_NET_MULTIBUFFER must be set"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_SLIP_STACKSIZE
|
#ifndef CONFIG_NET_SLIP_STACKSIZE
|
||||||
# define CONFIG_SLIP_STACKSIZE 2048
|
# define CONFIG_NET_SLIP_STACKSIZE 2048
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_SLIP_DEFPRIO
|
#ifndef CONFIG_NET_SLIP_DEFPRIO
|
||||||
# define CONFIG_SLIP_DEFPRIO 128
|
# define CONFIG_NET_SLIP_DEFPRIO 128
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The Linux slip module hard-codes its MTU size to 296 (40 bytes for the
|
/* The Linux slip module hard-codes its MTU size to 296 (40 bytes for the
|
||||||
@ -99,7 +99,7 @@
|
|||||||
* a MTU of 296 and window of 256, but actually only sends 168 bytes of data:
|
* a MTU of 296 and window of 256, but actually only sends 168 bytes of data:
|
||||||
* 40 + 128. I believe that is to allow for the 2x worst cast packet
|
* 40 + 128. I believe that is to allow for the 2x worst cast packet
|
||||||
* expansion. Ideally we would like to advertise the 256 MSS, but restrict
|
* expansion. Ideally we would like to advertise the 256 MSS, but restrict
|
||||||
* uIP to 128 bytes (possibly by modifying the tcp_mss() macro).
|
* transfers to 128 bytes (possibly by modifying the tcp_mss() macro).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if CONFIG_NET_SLIP_MTU < 296
|
#if CONFIG_NET_SLIP_MTU < 296
|
||||||
@ -250,7 +250,7 @@ static void slip_semtake(FAR struct slip_driver_s *priv)
|
|||||||
* Description:
|
* Description:
|
||||||
* Just an inline wrapper around fwrite with error checking.
|
* Just an inline wrapper around fwrite with error checking.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Input Parameters:
|
||||||
* priv - Reference to the driver state structure
|
* priv - Reference to the driver state structure
|
||||||
* buffer - Buffer data to send
|
* buffer - Buffer data to send
|
||||||
* len - Buffer length in bytes
|
* len - Buffer length in bytes
|
||||||
@ -274,7 +274,7 @@ static inline void slip_write(FAR struct slip_driver_s *priv,
|
|||||||
* Description:
|
* Description:
|
||||||
* Just an inline wrapper around putc with error checking.
|
* Just an inline wrapper around putc with error checking.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Input Parameters:
|
||||||
* priv - Reference to the driver state structure
|
* priv - Reference to the driver state structure
|
||||||
* ch - The character to send
|
* ch - The character to send
|
||||||
*
|
*
|
||||||
@ -293,7 +293,7 @@ static inline void slip_putc(FAR struct slip_driver_s *priv, int ch)
|
|||||||
* Start hardware transmission. Called either from the txdone interrupt
|
* Start hardware transmission. Called either from the txdone interrupt
|
||||||
* handling or from watchdog based polling.
|
* handling or from watchdog based polling.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Input Parameters:
|
||||||
* priv - Reference to the driver state structure
|
* priv - Reference to the driver state structure
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
@ -407,7 +407,7 @@ static int slip_transmit(FAR struct slip_driver_s *priv)
|
|||||||
* 1. When the preceding TX packet send is complete, or
|
* 1. When the preceding TX packet send is complete, or
|
||||||
* 2. During normal periodic polling
|
* 2. During normal periodic polling
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Input Parameters:
|
||||||
* dev - Reference to the NuttX driver state structure
|
* dev - Reference to the NuttX driver state structure
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
@ -444,7 +444,7 @@ static int slip_txpoll(FAR struct net_driver_s *dev)
|
|||||||
* Description:
|
* Description:
|
||||||
* Polling and transmission is performed on tx thread.
|
* Polling and transmission is performed on tx thread.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Input Parameters:
|
||||||
* arg - Reference to the NuttX driver state structure
|
* arg - Reference to the NuttX driver state structure
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
@ -535,7 +535,7 @@ static void slip_txtask(int argc, FAR char *argv[])
|
|||||||
* Description:
|
* Description:
|
||||||
* Get one byte from the serial input.
|
* Get one byte from the serial input.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Input Parameters:
|
||||||
* priv - Reference to the driver state structure
|
* priv - Reference to the driver state structure
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
@ -561,7 +561,7 @@ static inline int slip_getc(FAR struct slip_driver_s *priv)
|
|||||||
* Description:
|
* Description:
|
||||||
* Read a packet from the serial input
|
* Read a packet from the serial input
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Input Parameters:
|
||||||
* priv - Reference to the driver state structure
|
* priv - Reference to the driver state structure
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
@ -666,7 +666,7 @@ static inline void slip_receive(FAR struct slip_driver_s *priv)
|
|||||||
* Description:
|
* Description:
|
||||||
* Wait for incoming data.
|
* Wait for incoming data.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Input Parameters:
|
||||||
* argc
|
* argc
|
||||||
* argv
|
* argv
|
||||||
*
|
*
|
||||||
@ -786,7 +786,7 @@ static int slip_rxtask(int argc, FAR char *argv[])
|
|||||||
* NuttX Callback: Bring up the Ethernet interface when an IP address is
|
* NuttX Callback: Bring up the Ethernet interface when an IP address is
|
||||||
* provided
|
* provided
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Input Parameters:
|
||||||
* dev - Reference to the NuttX driver state structure
|
* dev - Reference to the NuttX driver state structure
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
@ -816,7 +816,7 @@ static int slip_ifup(FAR struct net_driver_s *dev)
|
|||||||
* Description:
|
* Description:
|
||||||
* NuttX Callback: Stop the interface.
|
* NuttX Callback: Stop the interface.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Input Parameters:
|
||||||
* dev - Reference to the NuttX driver state structure
|
* dev - Reference to the NuttX driver state structure
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
@ -844,7 +844,7 @@ static int slip_ifdown(FAR struct net_driver_s *dev)
|
|||||||
* stimulus perform an out-of-cycle poll and, thereby, reduce the TX
|
* stimulus perform an out-of-cycle poll and, thereby, reduce the TX
|
||||||
* latency.
|
* latency.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Input Parameters:
|
||||||
* dev - Reference to the NuttX driver state structure
|
* dev - Reference to the NuttX driver state structure
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
@ -876,7 +876,7 @@ static int slip_txavail(FAR struct net_driver_s *dev)
|
|||||||
* NuttX Callback: Add the specified MAC address to the hardware multicast
|
* NuttX Callback: Add the specified MAC address to the hardware multicast
|
||||||
* address filtering
|
* address filtering
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Input Parameters:
|
||||||
* dev - Reference to the NuttX driver state structure
|
* dev - Reference to the NuttX driver state structure
|
||||||
* mac - The MAC address to be added
|
* mac - The MAC address to be added
|
||||||
*
|
*
|
||||||
@ -905,7 +905,7 @@ static int slip_addmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
|||||||
* NuttX Callback: Remove the specified MAC address from the hardware multicast
|
* NuttX Callback: Remove the specified MAC address from the hardware multicast
|
||||||
* address filtering
|
* address filtering
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Input Parameters:
|
||||||
* dev - Reference to the NuttX driver state structure
|
* dev - Reference to the NuttX driver state structure
|
||||||
* mac - The MAC address to be removed
|
* mac - The MAC address to be removed
|
||||||
*
|
*
|
||||||
@ -937,9 +937,12 @@ static int slip_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
|||||||
* Description:
|
* Description:
|
||||||
* Instantiate a SLIP network interface.
|
* Instantiate a SLIP network interface.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Input Parameters:
|
||||||
* intf - In the case where there are multiple SLIP interfaces, this value
|
* intf - In the case where there are multiple SLIP interfaces, this
|
||||||
* identifies which is to be initialized.
|
* value identifies which is to be initialized. The number of
|
||||||
|
* possible SLIP interfaces is determined by
|
||||||
|
* devname - This is the path to the serial device that will support SLIP.
|
||||||
|
* For example, this might be "/dev/ttyS1"
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* OK on success; Negated errno on failure.
|
* OK on success; Negated errno on failure.
|
||||||
@ -996,9 +999,9 @@ int slip_initialize(int intf, FAR const char *devname)
|
|||||||
argv[0] = buffer;
|
argv[0] = buffer;
|
||||||
argv[1] = NULL;
|
argv[1] = NULL;
|
||||||
|
|
||||||
priv->rxpid = task_create("rxslip", CONFIG_SLIP_DEFPRIO,
|
priv->rxpid = task_create("rxslip", CONFIG_NET_SLIP_DEFPRIO,
|
||||||
CONFIG_SLIP_STACKSIZE, (main_t)slip_rxtask,
|
CONFIG_NET_SLIP_STACKSIZE, (main_t)slip_rxtask,
|
||||||
(FAR char * const *)argv);
|
(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");
|
||||||
@ -1011,8 +1014,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_NET_SLIP_DEFPRIO,
|
||||||
CONFIG_SLIP_STACKSIZE, (main_t)slip_txtask,
|
CONFIG_NET_SLIP_STACKSIZE, (main_t)slip_txtask,
|
||||||
(FAR char * const *)argv);
|
(FAR char * const *)argv);
|
||||||
if (priv->txpid < 0)
|
if (priv->txpid < 0)
|
||||||
{
|
{
|
||||||
|
@ -48,8 +48,38 @@
|
|||||||
#ifdef CONFIG_NET_SLIP
|
#ifdef CONFIG_NET_SLIP
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Type Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
/* Configuration ***********************************************************/
|
||||||
|
/* Dependencies:
|
||||||
|
*
|
||||||
|
* CONFIG_NET_NOINTS - Required.
|
||||||
|
* CONFIG_NET_MULTIBUFFER - Required.
|
||||||
|
*
|
||||||
|
* SLIP Configuration:
|
||||||
|
*
|
||||||
|
* CONFIG_NET_SLIP - Enables building of the SLIP driver
|
||||||
|
* CONFIG_SLIP_STACKSIZE - Provides the stack size for SLIP RX and TX
|
||||||
|
* threads. Default: 2048
|
||||||
|
* CONFIG_SLIP_DEFPRIO - Provides the priority for SLIP RX and TX threads.
|
||||||
|
* Default 128.
|
||||||
|
* CONFIG_NET_SLIP_MTU - Provides the size of the SLIP packet buffers.
|
||||||
|
* Default 296
|
||||||
|
*
|
||||||
|
* The Linux slip module hard-codes its MTU size to 296 (40 bytes for the
|
||||||
|
* IP+TPC headers plus 256 bytes of data). So you might as well set
|
||||||
|
* CONFIG_NET_SLIP_MTU to 296 as well.
|
||||||
|
*
|
||||||
|
* There may be an issue with this setting, however. I see that Linux
|
||||||
|
* uses a MTU of 296 and window of 256, but actually only sends 168 bytes
|
||||||
|
* of data: 40 + 128. I believe that is to allow for the 2x worst cast
|
||||||
|
* packet expansion. Ideally we would like to advertise the 256 MSS,
|
||||||
|
* but restrict transfers to 128 bytes (possibly by modifying the tcp_mss()
|
||||||
|
* macro).
|
||||||
|
*
|
||||||
|
* CONFIG_SLIP_NINTERFACES determines the number of physical interfaces
|
||||||
|
* that will be supported.
|
||||||
|
*/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Data
|
* Public Data
|
||||||
@ -73,9 +103,12 @@ extern "C"
|
|||||||
* Description:
|
* Description:
|
||||||
* Instantiate a SLIP network interface.
|
* Instantiate a SLIP network interface.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Input Parameters:
|
||||||
* intf - In the case where there are multiple SLIP interfaces, this value
|
* intf - In the case where there are multiple SLIP interfaces, this
|
||||||
* identifies which is to be initialized.
|
* value identifies which is to be initialized. The number of
|
||||||
|
* possible SLIP interfaces is determined by
|
||||||
|
* devname - This is the path to the serial device that will support SLIP.
|
||||||
|
* For example, this might be "/dev/ttyS1"
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* OK on success; Negated errno on failure.
|
* OK on success; Negated errno on failure.
|
||||||
|
Loading…
Reference in New Issue
Block a user