:Remove CONFIG_NET_6LOWPAN_FRAMELEN. In this case where multiple radios are support3d, this may not be a constant. 6LoWPAN now always queries the driver to get the maximum frame length.
This commit is contained in:
parent
c217c663ae
commit
6a6bf1b62f
10 changed files with 55 additions and 55 deletions
|
@ -43,7 +43,6 @@ CONFIG_LIBM=y
|
|||
CONFIG_MAX_TASKS=16
|
||||
CONFIG_MAX_WDOGPARMS=2
|
||||
CONFIG_MM_REGIONS=2
|
||||
CONFIG_NET_6LOWPAN_FRAMELEN=94
|
||||
CONFIG_NET_6LOWPAN=y
|
||||
CONFIG_NET_BROADCAST=y
|
||||
CONFIG_NET_HOSTNAME="B-L475E-IOT01A"
|
||||
|
|
|
@ -32,7 +32,6 @@ CONFIG_LIBM=y
|
|||
CONFIG_MAX_TASKS=16
|
||||
CONFIG_MAX_WDOGPARMS=2
|
||||
CONFIG_MM_REGIONS=2
|
||||
CONFIG_NET_6LOWPAN_FRAMELEN=94
|
||||
CONFIG_NET_6LOWPAN=y
|
||||
CONFIG_NET_BROADCAST=y
|
||||
CONFIG_NET_HOSTNAME="B-L475E-IOT01A"
|
||||
|
|
|
@ -44,7 +44,6 @@ CONFIG_LIBM=y
|
|||
CONFIG_MAX_TASKS=16
|
||||
CONFIG_MAX_WDOGPARMS=2
|
||||
CONFIG_MM_REGIONS=2
|
||||
CONFIG_NET_6LOWPAN_FRAMELEN=94
|
||||
CONFIG_NET_6LOWPAN=y
|
||||
CONFIG_NET_BROADCAST=y
|
||||
CONFIG_NET_HOSTNAME="B-L475E-IOT01A"
|
||||
|
|
|
@ -76,13 +76,9 @@
|
|||
|
||||
#define IEEE802154_MAC_FCSSIZE 2
|
||||
|
||||
/* This, then, is the usable size of the frame...
|
||||
* REVISIT: Too many frame length definitions
|
||||
*/
|
||||
/* This, then, is the usable size of the frame... */
|
||||
|
||||
#if defined(CONFIG_NET_6LOWPAN_FRAMELEN)
|
||||
# define IEEE802_MAX_FRAMELEN CONFIG_NET_6LOWPAN_FRAMELEN
|
||||
#elif defined(CONFIG_NET_IEEE802154_FRAMELEN)
|
||||
#if defined(CONFIG_NET_IEEE802154_FRAMELEN)
|
||||
# define IEEE802_MAX_FRAMELEN CONFIG_NET_IEEE802154_FRAMELEN
|
||||
#else
|
||||
# define IEEE802_MAX_FRAMELEN IEEE802154_MAC_STDFRAME
|
||||
|
|
|
@ -37,15 +37,6 @@ config NET_6LOWPAN_REASS_STATIC
|
|||
buffers. In that case, only static reassembly buffers are available;
|
||||
when those are exhausted, frames that require reassembly will be lost.
|
||||
|
||||
config NET_6LOWPAN_FRAMELEN
|
||||
int "Max Radio Frame Size"
|
||||
default 127
|
||||
range 1 999999
|
||||
---help---
|
||||
Wireless devices use a variety of frame sizes. For IEEE 802.15.4
|
||||
radios, this should be 127 bytes. However, some IEEE 802.15.4
|
||||
radios may support non-standard frame lengths.
|
||||
|
||||
choice
|
||||
prompt "6LoWPAN Compression"
|
||||
default NET_6LOWPAN_COMPRESSION_HC06
|
||||
|
|
|
@ -93,9 +93,9 @@ Optimal 6LoWPAN Configuration
|
|||
4. To be compressable, port numbers must be in the range 0xf0b0-0xf0bf,
|
||||
hexadecimal. That is 61616-61631 decimal.
|
||||
|
||||
5. IOBs: Must be big enough to hold one IEEE802.15.4 frame (CONFIG_NET_6LOWPAN_FRAMELEN,
|
||||
typically 127). There must be enough IOBs to decompose the largest IPv6
|
||||
packet (CONFIG_NET_6LOWPAN_MTU, default 1294, plus per frame overhead).
|
||||
5. IOBs: Must be big enough to hold one IEEE802.15.4 frame (typically 127).
|
||||
There must be enough IOBs to decompose the largest IPv6 packet
|
||||
(CONFIG_NET_6LOWPAN_MTU, default 1294, plus per frame overhead).
|
||||
|
||||
Fragmentation Headers
|
||||
---------------------
|
||||
|
|
|
@ -69,24 +69,17 @@
|
|||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
/* A single IOB must be big enough to hold a full frame */
|
||||
|
||||
#if CONFIG_IOB_BUFSIZE < CONFIG_NET_6LOWPAN_FRAMELEN
|
||||
# error IOBs must be large enough to hold full IEEE802.14.5 frame
|
||||
#endif
|
||||
|
||||
/* A IOB must also be big enought to hold the maximum MAC header (25 bytes?)
|
||||
* plus the FCS and have some amount of space left for the payload.
|
||||
/* A single IOB must be big enough to hold a full frame. This we have to
|
||||
* check at run time. A IOB must also be big enough to hold the maximum MAC
|
||||
* header (25 bytes?) plus the FCS and have some amount of space left for
|
||||
* the payload.
|
||||
*/
|
||||
|
||||
#if CONFIG_NET_6LOWPAN_FRAMELEN < (SIXLOWPAN_MAC_FCSSIZE + 25)
|
||||
# error CONFIG_NET_6LOWPAN_FRAMELEN too small to hold a IEEE802.14.5 frame
|
||||
#define MAX_MACHDR 25 /* REVISIT: This is IEEE 802.15.4 specific */
|
||||
#if CONFIG_IOB_BUFSIZE < (SIXLOWPAN_MAC_FCSSIZE + MAX_MACHDR)
|
||||
# error CONFIG_IOB_BUFSIZE too small to hold a IEEE802.14.5 frame
|
||||
#endif
|
||||
|
||||
/* We must reserve space at the end of the frame for a 2-byte FCS */
|
||||
|
||||
#define SIXLOWPAN_FRAMELEN (CONFIG_NET_6LOWPAN_FRAMELEN - SIXLOWPAN_MAC_FCSSIZE)
|
||||
|
||||
/* There must be at least enough IOBs to hold the full MTU. Probably still
|
||||
* won't work unless there are a few more.
|
||||
*/
|
||||
|
@ -385,6 +378,7 @@ int sixlowpan_queue_frames(FAR struct radio_driver_s *radio,
|
|||
FAR uint8_t *fptr;
|
||||
int framer_hdrlen;
|
||||
struct netdev_varaddr_s bcastmac;
|
||||
uint16_t framelen;
|
||||
uint16_t pktlen;
|
||||
uint16_t paysize;
|
||||
uint16_t outlen = 0;
|
||||
|
@ -495,9 +489,40 @@ int sixlowpan_queue_frames(FAR struct radio_driver_s *radio,
|
|||
|
||||
ninfo("Header of length=%u protosize=%u\n", g_frame_hdrlen, protosize);
|
||||
|
||||
/* Check if we need to fragment the packet into several frames */
|
||||
/* Get the maximum packet size supported by this radio. */
|
||||
|
||||
if (buflen > (SIXLOWPAN_FRAMELEN - g_frame_hdrlen - protosize))
|
||||
ret = sixlowpan_radio_framelen(radio);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("ERROR: sixlowpan_radio_framelen() failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Limit to the maximum size supported by the IOBs */
|
||||
|
||||
if (ret > CONFIG_IOB_BUFSIZE)
|
||||
{
|
||||
ret = CONFIG_IOB_BUFSIZE;
|
||||
}
|
||||
|
||||
/* Reserve space at the end for any FCS that the hardware may include
|
||||
* in the payload.
|
||||
*/
|
||||
|
||||
ret -= SIXLOWPAN_MAC_FCSSIZE;
|
||||
if (ret < MAX_MACHDR || ret > UINT16_MAX)
|
||||
{
|
||||
nerr("ERROR: Invalid frame size: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
framelen = (uint16_t)ret;
|
||||
|
||||
/* Check if we need to fragment the packet into several frames.
|
||||
* We may need to reserve space at the end of the frame for a 2-byte FCS
|
||||
*/
|
||||
|
||||
if (buflen > (framelen - g_frame_hdrlen - protosize))
|
||||
{
|
||||
/* qhead will hold the generated frame list; frames will be
|
||||
* added at qtail.
|
||||
|
@ -570,7 +595,7 @@ int sixlowpan_queue_frames(FAR struct radio_driver_s *radio,
|
|||
* bytes.
|
||||
*/
|
||||
|
||||
paysize = (SIXLOWPAN_FRAMELEN - g_frame_hdrlen) & ~7;
|
||||
paysize = (framelen - g_frame_hdrlen) & ~7;
|
||||
memcpy(fptr + g_frame_hdrlen + protosize, buf, paysize - protosize);
|
||||
|
||||
/* Set outlen to what we already sent from the IP payload */
|
||||
|
@ -642,8 +667,7 @@ int sixlowpan_queue_frames(FAR struct radio_driver_s *radio,
|
|||
/* Copy payload and enqueue */
|
||||
/* Check for the last fragment */
|
||||
|
||||
paysize = (SIXLOWPAN_FRAMELEN - fragn_hdrlen) &
|
||||
SIXLOWPAN_DISPATCH_FRAG_MASK;
|
||||
paysize = (framelen - fragn_hdrlen) & SIXLOWPAN_DISPATCH_FRAG_MASK;
|
||||
if (paysize > buflen - outlen + protosize)
|
||||
{
|
||||
/* Last fragment, truncate to the correct length */
|
||||
|
|
|
@ -89,13 +89,9 @@
|
|||
# define LO_ADDRSIZE IEEE802154_SADDRSIZE
|
||||
#endif
|
||||
|
||||
/* Frame size
|
||||
* REVISIT: Too many frame length definitions
|
||||
*/
|
||||
/* Frame size */
|
||||
|
||||
#if defined(CONFIG_NET_6LOWPAN_FRAMELEN)
|
||||
# define LO_FRAMELEN CONFIG_NET_6LOWPAN_FRAMELEN
|
||||
#elif defined(CONFIG_NET_IEEE802154_FRAMELEN)
|
||||
#if defined(CONFIG_NET_IEEE802154_FRAMELEN)
|
||||
# define LO_FRAMELEN CONFIG_NET_IEEE802154_FRAMELEN
|
||||
#else
|
||||
# define LO_FRAMELEN IEEE802154_MAX_PHY_PACKET_SIZE
|
||||
|
|
|
@ -105,13 +105,9 @@
|
|||
# define MACNET_ADDRSIZE IEEE802154_SADDRSIZE
|
||||
#endif
|
||||
|
||||
/* Frame size
|
||||
* REVISIT: Too many frame length definitions
|
||||
*/
|
||||
/* Frame size */
|
||||
|
||||
#if defined(CONFIG_NET_6LOWPAN_FRAMELEN)
|
||||
# define MACNET_FRAMELEN CONFIG_NET_6LOWPAN_FRAMELEN
|
||||
#elif defined(CONFIG_NET_IEEE802154_FRAMELEN)
|
||||
#if defined(CONFIG_NET_IEEE802154_FRAMELEN)
|
||||
# define MACNET_FRAMELEN CONFIG_NET_IEEE802154_FRAMELEN
|
||||
#else
|
||||
# define MACNET_FRAMELEN IEEE802154_MAX_PHY_PACKET_SIZE
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
|
||||
/* Fake value for MAC header length */
|
||||
|
||||
#if CONFIG_NET_6LOWPAN_FRAMELEN > 40
|
||||
#if CONFIG_IOB_BUFSIZE > 40
|
||||
# define MAC_HDRLEN 4
|
||||
#else
|
||||
# define MAC_HDRLEN 0
|
||||
|
@ -961,8 +961,8 @@ static int lo_properties(FAR struct radio_driver_s *netdev,
|
|||
|
||||
/* General */
|
||||
|
||||
properties->sp_addrlen = CONFIG_PKTRADIO_ADDRLEN; /* Length of an address */
|
||||
properties->sp_framelen = CONFIG_NET_6LOWPAN_FRAMELEN; /* Fixed frame length */
|
||||
properties->sp_addrlen = CONFIG_PKTRADIO_ADDRLEN; /* Length of an address */
|
||||
properties->sp_framelen = CONFIG_IOB_BUFSIZE; /* Fixed frame length */
|
||||
|
||||
/* Multicast address */
|
||||
|
||||
|
|
Loading…
Reference in a new issue