From d9e32ee337d6b29baaace654cb5dd13a77f59015 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 28 Mar 2017 11:16:28 -0600 Subject: [PATCH] 6loWPAN: More configurtion settings. --- include/nuttx/net/sixlowpan.h | 4 ++++ net/netdev/netdev_register.c | 2 +- net/sixlowpan/Kconfig | 40 ++++++++++++++++++++++------------ net/sixlowpan/sixlowpan_hc06.c | 4 ++-- 4 files changed, 33 insertions(+), 17 deletions(-) diff --git a/include/nuttx/net/sixlowpan.h b/include/nuttx/net/sixlowpan.h index 8901b453d1..4887d255f0 100644 --- a/include/nuttx/net/sixlowpan.h +++ b/include/nuttx/net/sixlowpan.h @@ -223,6 +223,10 @@ (((a)->u16[6]) == 0) && \ (((a)->u8[14]) == 0)) +/* Maximum size of an IEEE802.15.4 frame */ + +#define SIXLOWPAN_MAC_MAXFRAME 127 + /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/net/netdev/netdev_register.c b/net/netdev/netdev_register.c index dafc17dcc3..d275f6abfd 100644 --- a/net/netdev/netdev_register.c +++ b/net/netdev/netdev_register.c @@ -230,7 +230,7 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype) #ifdef CONFIG_NET_6LOWPAN case NET_LL_6LOWPAN: /* IEEE 802.15.4 */ dev->d_llhdrlen = 0; /* REVISIT */ - dev->d_mtu = CONFIG_NET_6LOWPAN_MTU; + dev->d_mtu = SIXLOWPAN_MAC_MAXFRAME; #ifdef CONFIG_NET_TCP dev->d_recvwndo = CONFIG_NET_6LOWPAN_TCP_RECVWNDO; #endif diff --git a/net/sixlowpan/Kconfig b/net/sixlowpan/Kconfig index b89d1345d9..ff47838489 100644 --- a/net/sixlowpan/Kconfig +++ b/net/sixlowpan/Kconfig @@ -43,6 +43,14 @@ config NET_6LOWPAN_COMPRESSION_HC06 endchoice # 6loWPAN Compression +config NET_6LOWPAN_COMPRESSION_THRESHOLD + int "Lower compression threshold" + default 63 + depends on !NET_6LOWPAN_COMPRESSION_IPv6 + ---help--- + CONFIG_NET_6LOWPAN_COMPRESSION_THRESHOLD sets a lower threshold for + when packets should not be compressed. + if NET_6LOWPAN_COMPRESSION_HC06 config NET_6LOWPAN_MAXADDRCONTEXT @@ -119,27 +127,31 @@ config NET_SIXLOWPAN_MAXAGE ---help--- Timeout for packet reassembly at the 6lowpan layer (should be < 60s) -config NET_6LOWPAN_MTU - int "6LoWPAN packet buffer size (MTU)" - default 1294 - range 590 1518 +config NET_6LOWPAN_MAX_MACTRANSMITS + int "Max MAC transmissions" + default 4 ---help--- - Packet buffer size. This size includes the TCP/UDP payload plus the - size of TCP/UDP header, the IP header, and data link layer headers. - This value is normally referred to as the MTU (Maximum Transmission - Unit); the payload is the MSS (Maximum Segment Size). + CONFIG_NET_6LOWPAN_MAX_MACTRANSMITS specifies how many times the MAC + layer should resend packets if no link-layer ACK wasreceived. This + only makes sense with the csma_driver. - 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+xx = xx. REVISIT! +config NET_SIXLOWPAN_MAXPAYLOAD + int "Max packet size" + default 102 + ---help--- + CONFIG_NET_SIXLOWPAN_MAXPAYLOAD specifies the maximum size of packets + before they get fragmented. The default is 127 bytes (the maximum size + of a 802.15.4 frame) - 25 bytes (for the 802.15.4 MAClayer header). This + can be increased for systems with larger packet sizes. config NET_6LOWPAN_TCP_RECVWNDO int "6LoWPAN TCP receive window size" - default 1220 + default 102 depends on NET_TCP ---help--- The size of the advertised receiver's window. Should be set low - (i.e., to the size of the MSS) if the application is slow to process - incoming data, or high (32768 bytes) if the application processes - data quickly. REVISIT! + (i.e., to the size of the IEEE802.15.4 frame payload) if the application + is slow to process incoming data, or high (32768 bytes) if the + application processes data quickly. REVISIT! endif # NET_6LOWPAN diff --git a/net/sixlowpan/sixlowpan_hc06.c b/net/sixlowpan/sixlowpan_hc06.c index f992676ef9..8ce6518bc4 100644 --- a/net/sixlowpan/sixlowpan_hc06.c +++ b/net/sixlowpan/sixlowpan_hc06.c @@ -150,8 +150,8 @@ void sixlowpan_hc06_initialize(void) g_hc06_addrcontexts[2].used = 1; g_hc06_addrcontexts[2].number = 2; - g_hc06_addrcontexts[2].prefix[0] = CONFIG_NET_6LOWPAN_MAXADDRCONTEXT_PREFIX_1_0; - g_hc06_addrcontexts[2].prefix[1] = CONFIG_NET_6LOWPAN_MAXADDRCONTEXT_PREFIX_1_1; + g_hc06_addrcontexts[2].prefix[0] = CONFIG_NET_6LOWPAN_MAXADDRCONTEXT_PREFIX_2_0; + g_hc06_addrcontexts[2].prefix[1] = CONFIG_NET_6LOWPAN_MAXADDRCONTEXT_PREFIX_2_1; } else #endif /* SIXLOWPAN_CONF_ADDR_CONTEXT_2 */