Rename NET_LL_MTU to NET_DEV_MTU; rename d_llmtu to d_mtu
This commit is contained in:
parent
1f3ce25381
commit
2340d46d20
@ -85,10 +85,14 @@
|
||||
* supported concurrently. In this case, the size of link layer header
|
||||
* varies and is obtained from the network device structure.
|
||||
*
|
||||
* Support is also provided to select different MTU sizes for each different
|
||||
* link layer protocol. A better solution would be to support device-by-
|
||||
* device MTU sizes. This minimum support is require to support the
|
||||
* optimal SLIP MTU of 296 bytes and the standard Ethernet MTU of 1500
|
||||
* There are other device-specific features that at tied to the link layer:
|
||||
*
|
||||
* - Maximum Transfer Unit (MTU)
|
||||
* - TCP Receive Window size
|
||||
*
|
||||
* A better solution would be to support device-by-device MTU and receive
|
||||
* window sizes. This minimum support is require to support the optimal
|
||||
* SLIP MTU of 296 bytes and the standard Ethernet MTU of 1500
|
||||
* bytes.
|
||||
*/
|
||||
|
||||
@ -111,14 +115,14 @@
|
||||
*/
|
||||
|
||||
# define NET_LL_HDRLEN(d) ((d)->d_llhdrlen)
|
||||
# define NET_LL_MTU(d) ((d)->d_llmtu)
|
||||
# define NET_DEV_MTU(d) ((d)->d_mtu)
|
||||
|
||||
# ifdef CONFIG_NET_ETHERNET
|
||||
# define _MIN_ETH_MTU CONFIG_NET_ETH_MTU
|
||||
# define _MAX_ETH_MTU CONFIG_NET_ETH_MTU
|
||||
# define _MIN_ETH_MTU CONFIG_NET_ETH_MTU
|
||||
# define _MAX_ETH_MTU CONFIG_NET_ETH_MTU
|
||||
# else
|
||||
# define _MIN_ETH_MTU UINT16_MAX
|
||||
# define _MAX_ETH_MTU 0
|
||||
# define _MIN_ETH_MTU UINT16_MAX
|
||||
# define _MAX_ETH_MTU 0
|
||||
# endif
|
||||
|
||||
# ifdef CONFIG_NET_SLIP
|
||||
@ -129,8 +133,8 @@
|
||||
# define _MAX_SLIP_MTU _MAX_ETH_MTU
|
||||
# endif
|
||||
|
||||
# define MIN_NET_LL_MTU _MIN_SLIP_MTU
|
||||
# define MAX_NET_LL_MTU _MAX_SLIP_MTU
|
||||
# define MIN_NET_DEV_MTU _MIN_SLIP_MTU
|
||||
# define MAX_NET_DEV_MTU _MAX_SLIP_MTU
|
||||
|
||||
#elif defined(CONFIG_NET_SLIP)
|
||||
/* There is no link layer header with SLIP */
|
||||
@ -138,18 +142,18 @@
|
||||
# ifdef CONFIG_NET_IPv6
|
||||
# error SLIP is not available for IPv6
|
||||
# endif
|
||||
# define NET_LL_HDRLEN(d) 0
|
||||
# define NET_LL_MTU(d) CONFIG_NET_SLIP_MTU
|
||||
# define MIN_NET_LL_MTU CONFIG_NET_SLIP_MTU
|
||||
# define MAX_NET_LL_MTU CONFIG_NET_SLIP_MTU
|
||||
# define NET_LL_HDRLEN(d) 0
|
||||
# define NET_DEV_MTU(d) CONFIG_NET_SLIP_MTU
|
||||
# define MIN_NET_DEV_MTU CONFIG_NET_SLIP_MTU
|
||||
# define MAX_NET_DEV_MTU CONFIG_NET_SLIP_MTU
|
||||
|
||||
#else /* if defined(CONFIG_NET_ETHERNET) */
|
||||
/* Assume standard Ethernet link layer header */
|
||||
|
||||
# define NET_LL_HDRLEN(d) 14
|
||||
# define NET_LL_MTU(d) CONFIG_NET_ETH_MTU
|
||||
# define MIN_NET_LL_MTU CONFIG_NET_ETH_MTU
|
||||
# define MAX_NET_LL_MTU CONFIG_NET_ETH_MTU
|
||||
# define NET_LL_HDRLEN(d) 14
|
||||
# define NET_DEV_MTU(d) CONFIG_NET_ETH_MTU
|
||||
# define MIN_NET_DEV_MTU CONFIG_NET_ETH_MTU
|
||||
# define MAX_NET_DEV_MTU CONFIG_NET_ETH_MTU
|
||||
|
||||
#endif /* MULTILINK or SLIP or ETHERNET */
|
||||
|
||||
@ -206,10 +210,10 @@
|
||||
#endif
|
||||
|
||||
/* The UDP maximum packet size. This is should not be to set to more
|
||||
* than NET_LL_MTU(d) - NET_LL_HDRLEN(dev) - IPUDP_HDRLEN.
|
||||
* than NET_DEV_MTU(d) - NET_LL_HDRLEN(dev) - IPUDP_HDRLEN.
|
||||
*/
|
||||
|
||||
#define UDP_MSS(d) (NET_LL_MTU(d) - NET_LL_HDRLEN(d) - IPUDP_HDRLEN)
|
||||
#define UDP_MSS(d) (NET_DEV_MTU(d) - NET_LL_HDRLEN(d) - IPUDP_HDRLEN)
|
||||
|
||||
#ifdef CONFIG_NET_ETHERNET
|
||||
# define MIN_UDP_MSS (CONFIG_NET_ETH_MTU - ETH_HDRLEN - IPUDP_HDRLEN)
|
||||
@ -283,7 +287,7 @@
|
||||
#define TCP_MAXSYNRTX 5
|
||||
|
||||
/* The TCP maximum segment size. This is should not be set to more
|
||||
* than NET_LL_MTU(dev) - NET_LL_HDRLEN(dev) - IPTCP_HDRLEN.
|
||||
* than NET_DEV_MTU(dev) - NET_LL_HDRLEN(dev) - IPTCP_HDRLEN.
|
||||
*
|
||||
* In the case where there are multiple network devices with different
|
||||
* link layer protocols (CONFIG_NET_MULTILINK), each network device
|
||||
@ -291,7 +295,7 @@
|
||||
* the minimum MSS for that case.
|
||||
*/
|
||||
|
||||
#define TCP_MSS(d) (NET_LL_MTU(d) - NET_LL_HDRLEN(d) - IPTCP_HDRLEN)
|
||||
#define TCP_MSS(d) (NET_DEV_MTU(d) - NET_LL_HDRLEN(d) - IPTCP_HDRLEN)
|
||||
|
||||
#ifdef CONFIG_NET_ETHERNET
|
||||
# define MIN_TCP_MSS (CONFIG_NET_ETH_MTU - ETH_HDRLEN - IPTCP_HDRLEN)
|
||||
|
@ -101,7 +101,7 @@ struct net_driver_s
|
||||
|
||||
uint8_t d_lltype; /* See enum net_datalink_e */
|
||||
uint8_t d_llhdrlen; /* Link layer header size */
|
||||
uint16_t d_llmtu; /* Maximum packet size */
|
||||
uint16_t d_mtu; /* Maximum packet size */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_ETHERNET
|
||||
@ -131,7 +131,7 @@ struct net_driver_s
|
||||
#ifdef CONFIG_NET_MULTIBUFFER
|
||||
uint8_t *d_buf;
|
||||
#else
|
||||
uint8_t d_buf[MAX_NET_LL_MTU + CONFIG_NET_GUARDSIZE];
|
||||
uint8_t d_buf[MAX_NET_DEV_MTU + CONFIG_NET_GUARDSIZE];
|
||||
#endif
|
||||
|
||||
/* d_appdata points to the location where application data can be read from
|
||||
|
@ -113,7 +113,7 @@
|
||||
/* IP fragment re-assembly */
|
||||
|
||||
#define IP_MF 0x20
|
||||
#define TCP_REASS_BUFSIZE (NET_LL_MTU(dev) - NET_LL_HDRLEN(dev))
|
||||
#define TCP_REASS_BUFSIZE (NET_DEV_MTU(dev) - NET_LL_HDRLEN(dev))
|
||||
#define TCP_REASS_LASTFRAG 0x01
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -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 < NET_LL_MTU(dev));
|
||||
DEBUGASSERT(dev && len > 0 && len < NET_DEV_MTU(dev));
|
||||
|
||||
/* Copy the data from the I/O buffer chain to the device buffer */
|
||||
|
||||
|
@ -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 < NET_LL_MTU(dev));
|
||||
DEBUGASSERT(dev && len > 0 && len < NET_DEV_MTU(dev));
|
||||
|
||||
/* Copy the data into the device packet buffer */
|
||||
|
||||
|
@ -94,7 +94,7 @@
|
||||
|
||||
void devif_send(struct net_driver_s *dev, const void *buf, int len)
|
||||
{
|
||||
DEBUGASSERT(dev && len > 0 && len < NET_LL_MTU(dev));
|
||||
DEBUGASSERT(dev && len > 0 && len < NET_DEV_MTU(dev));
|
||||
|
||||
memcpy(dev->d_snddata, buf, len);
|
||||
dev->d_sndlen = len;
|
||||
|
@ -319,7 +319,7 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
||||
dev = netdev_ifrdev(req);
|
||||
if (dev)
|
||||
{
|
||||
req->ifr_mtu = NET_LL_MTU(dev);
|
||||
req->ifr_mtu = NET_DEV_MTU(dev);
|
||||
ret = OK;
|
||||
}
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
|
||||
#ifdef CONFIG_NET_ETHERNET
|
||||
case NET_LL_ETHERNET: /* Ethernet */
|
||||
dev->d_llhdrlen = ETH_HDRLEN;
|
||||
dev->d_llmtu = CONFIG_NET_ETH_MTU;
|
||||
dev->d_mtu = CONFIG_NET_ETH_MTU;
|
||||
devfmt = NETDEV_ETH_FORMAT;
|
||||
break;
|
||||
#endif
|
||||
@ -142,7 +142,7 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
|
||||
#ifdef CONFIG_NET_SLIP
|
||||
case NET_LL_SLIP: /* Serial Line Internet Protocol (SLIP) */
|
||||
dev->d_llhdrlen = 0;
|
||||
dev->d_llmtu = CONFIG_NET_SLIP_MTU;
|
||||
dev->d_mtu = CONFIG_NET_SLIP_MTU;
|
||||
devfmt = NETDEV_SLIP_FORMAT;
|
||||
break;
|
||||
#endif
|
||||
@ -150,7 +150,7 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
|
||||
#if 0 /* REVISIT: Not yet supported */
|
||||
case NET_LL_PPP: /* Point-to-Point Protocol (PPP) */
|
||||
dev->d_llhdrlen = 0;
|
||||
dev->d_llmtu = CONFIG_NET_PPP_MTU;
|
||||
dev->d_mtu = CONFIG_NET_PPP_MTU;
|
||||
devfmt = NETDEV_PPP_FORMAT;
|
||||
break;
|
||||
#endif
|
||||
|
@ -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 > NET_LL_MTU(dev))
|
||||
if (upper_layer_len > NET_DEV_MTU(dev))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user