Completes conversion of CONFIG_NET_BUFIZE to CONFIG_NET_ETH/SLIP_MTU

This commit is contained in:
Gregory Nutt
2014-11-16 09:22:38 -06:00
parent b9cd425bc2
commit 859748a94e
10 changed files with 56 additions and 36 deletions
+23 -14
View File
@@ -47,25 +47,38 @@ config NET_PROMISCUOUS
Force the Ethernet driver to operate in promiscuous mode (if supported
by the Ethernet driver).
config NET_BUFSIZE
int "Network packet buffer size (MTU)"
default 1294 if !NET_SLIP && NET_IPv6
default 590 if !NET_SLIP && !NET_IPv6
default 296 if NET_SLIP && !NET_IPv6
config NET_ETH_MTU
int "Ethernet packet buffer size (MTU)"
default 1294 if NET_IPv6
default 590 if !NET_IPv6
depends on NET_ETHERNET
range 590 1518
---help---
Packet buffer size. This size includes the TCP/UDP payload plus the
size of TCP/UDP header, the IP header, and the Ethernet header
(assuming that the Ethernet transport is used). This value is
normally referred to as the MTU (Maximum Transmission Unit); the
payload is the MSS (Maximum Segment Size).
size of TCP/UDP header, the IP header, and the Ethernet header.
This value is normally referred to as the MTU (Maximum Transmission
Unit); the payload is the MSS (Maximum Segment Size).
IPv4 hosts are required to be able to handle an MSS of at least
536 octets, resulting in a minimum buffer size of 536+20+20+14 =
590 (For SLIP 256+20+20 = 296).
590.
IPv6 hosts are required to be able to handle an MSS of 1220 octets,
resulting in a minimum buffer size of of 1220+20+40+14 = 1294
config NET_SLIP_MTU
int # "SLIP packet buffer size (MTU)"
default 296
depends on NET_SLIP
range 296 1518
---help---
Packet buffer size. This size includes the TCP/UDP payload plus the
size of TCP/UDP header and the IP header. This value is normally
referred to as the MTU (Maximum Transmission Unit); the payload
payload is the MSS (Maximum Segment Size). SLIP is required to
support at lest 256+20+20 = 296. Values other than 296 are not
recommended.
config NET_RECEIVE_WINDOW
int "Receive window size"
default 1220 if !NET_SLIP && NET_IPv6
@@ -115,10 +128,6 @@ config NET_SLIP
at least one IP protocol selected and the following additional
network settings: NET_NOINTS and NET_MULTIBUFFER.
NET_BUFSIZE *must* be set to 296. Other optional configuration
settings that affect the SLIP driver: NET_STATISTICS.
Default: Ethernet
SLIP supports point-to-point IP communications over a serial port.
The default data link layer for uIP is Ethernet. If NET_SLIP is
defined in the NuttX configuration file, then SLIP will be supported.
+1 -1
View File
@@ -113,7 +113,7 @@
/* IP fragment re-assembly */
#define IP_MF 0x20
#define TCP_REASS_BUFSIZE (CONFIG_NET_BUFSIZE - NET_LL_HDRLEN(dev))
#define TCP_REASS_BUFSIZE (NET_LL_MTU(dev) - NET_LL_HDRLEN(dev))
#define TCP_REASS_LASTFRAG 0x01
/****************************************************************************
+1 -1
View File
@@ -99,7 +99,7 @@
void devif_iob_send(FAR struct net_driver_s *dev, FAR struct iob_s *iob,
unsigned int len, unsigned int offset)
{
DEBUGASSERT(dev && len > 0 && len < CONFIG_NET_BUFSIZE);
DEBUGASSERT(dev && len > 0 && len < NET_LL_MTU(dev));
/* Copy the data from the I/O buffer chain to the device buffer */
+1 -1
View File
@@ -99,7 +99,7 @@
void devif_pkt_send(FAR struct net_driver_s *dev, FAR const void *buf,
unsigned int len)
{
DEBUGASSERT(dev && len > 0 && len < CONFIG_NET_BUFSIZE);
DEBUGASSERT(dev && len > 0 && len < NET_LL_MTU(dev));
/* Copy the data into the device packet buffer */
+1 -1
View File
@@ -94,7 +94,7 @@
void devif_send(struct net_driver_s *dev, const void *buf, int len)
{
DEBUGASSERT(dev && len > 0 && len < CONFIG_NET_BUFSIZE);
DEBUGASSERT(dev && len > 0 && len < NET_LL_MTU(dev));
memcpy(dev->d_snddata, buf, len);
dev->d_sndlen = len;
+6 -2
View File
@@ -316,8 +316,12 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
case SIOCGIFMTU: /* Get MTU size */
{
req->ifr_mtu = CONFIG_NET_BUFSIZE;
ret = OK;
dev = netdev_ifrdev(req);
if (dev)
{
req->ifr_mtu = NET_LL_MTU(dev);
ret = OK;
}
}
break;
+1 -1
View File
@@ -31,7 +31,7 @@ config NET_TCP_REASSEMBLY
This features requires an additional amount of RAM to hold the
reassembly buffer and the reassembly code size is approximately 700
bytes. The reassembly buffer is of the same size as the d_buf buffer
(configured by CONFIG_NET_BUFSIZE).
(configured by CONFIG_NET_xxx_MTU).
Note: IP packet reassembly is not heavily tested (and, hence,
EXPERIMENTAL).
+1 -1
View File
@@ -128,7 +128,7 @@ static uint16_t upper_layer_chksum(FAR struct net_driver_s *dev, uint8_t proto)
/* Verify some minimal assumptions */
if (upper_layer_len > CONFIG_NET_BUFSIZE)
if (upper_layer_len > NET_LL_MTU(dev))
{
return 0;
}