diff --git a/drivers/wireless/spirit/drivers/spirit_netdev.c b/drivers/wireless/spirit/drivers/spirit_netdev.c index b53f29a8472..dc2193db221 100644 --- a/drivers/wireless/spirit/drivers/spirit_netdev.c +++ b/drivers/wireless/spirit/drivers/spirit_netdev.c @@ -126,7 +126,7 @@ #include #include #include -#include +#include #include #include @@ -352,7 +352,7 @@ static int spirit_get_mhrlen(FAR struct radio_driver_s *netdev, static int spirit_req_data(FAR struct radio_driver_s *netdev, FAR const void *meta, FAR struct iob_s *framelist); static int spirit_properties(FAR struct radio_driver_s *netdev, - FAR struct sixlowpan_properties_s *properties); + FAR struct radiodev_properties_s *properties); /* Initialization */ @@ -2141,8 +2141,8 @@ static int spirit_ioctl(FAR struct net_driver_s *dev, int cmd, { FAR struct radio_driver_s *radio = (FAR struct radio_driver_s *)dev; - FAR struct sixlowpan_properties_s *props = - (FAR struct sixlowpan_properties_s *)&cmddata->pifr_props; + FAR struct radiodev_properties_s *props = + (FAR struct radiodev_properties_s *)&cmddata->pifr_props; ret = spirit_properties(radio, props); } @@ -2373,10 +2373,10 @@ static int spirit_req_data(FAR struct radio_driver_s *netdev, ****************************************************************************/ static int spirit_properties(FAR struct radio_driver_s *netdev, - FAR struct sixlowpan_properties_s *properties) + FAR struct radiodev_properties_s *properties) { DEBUGASSERT(netdev != NULL && properties != NULL); - memset(properties, 0, sizeof(struct sixlowpan_properties_s)); + memset(properties, 0, sizeof(struct radiodev_properties_s)); /* General */ diff --git a/include/nuttx/net/netdev.h b/include/nuttx/net/netdev.h index fc27f6b7b73..5ab2058c685 100644 --- a/include/nuttx/net/netdev.h +++ b/include/nuttx/net/netdev.h @@ -463,8 +463,9 @@ int ipv6_input(FAR struct net_driver_s *dev); #endif #ifdef CONFIG_NET_6LOWPAN -struct radio_driver_s; /* See sixlowpan.h */ -struct iob_s; /* See iob.h */ +struct radio_driver_s; /* Forward reference. See radiodev.h */ +struct iob_s; /* Forward reference See iob.h */ + int sixlowpan_input(FAR struct radio_driver_s *ieee, FAR struct iob_s *framelist, FAR const void *metadata); #endif diff --git a/include/nuttx/net/radiodev.h b/include/nuttx/net/radiodev.h new file mode 100644 index 00000000000..1d9823a5989 --- /dev/null +++ b/include/nuttx/net/radiodev.h @@ -0,0 +1,296 @@ +/**************************************************************************** + * include/nuttx/net/radiodev.h + * + * Copyright (C) 2017, Gregory Nutt, all rights reserved + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __INCLUDE_NUTTX_NET_RADIODEV_H +#define __INCLUDE_NUTTX_NET_RADIODEV_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include +#include +#include + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/* Different packet radios may have different properties. If there are + * multiple packet radios, then those properties have to be queried at + * run time. This information is provided to the 6LoWPAN network via the + * following structure. + */ + +struct radiodev_properties_s +{ + uint8_t sp_addrlen; /* Length of an address */ + uint8_t sp_pktlen; /* Fixed packet/frame size (up to 255) */ + struct netdev_varaddr_s sp_mcast; /* Multicast address */ + struct netdev_varaddr_s sp_bcast; /* Broadcast address */ +#ifdef CONFIG_NET_STARPOINT + struct netdev_varaddr_s sp_hubnode; /* Address of the hub node in a star */ +#endif +}; + +/* The device structure for radio network device differs from the standard + * Ethernet MAC device structure. The main reason for this difference is + * that fragmentation must be supported. + * + * The radio network driver does not use the d_buf packet buffer directly. + * Rather, it uses a list smaller frame buffers. + * + * - The packet fragment data is provided in an IOB in the via the + * r_req_data() interface method each time that the radio needs to + * send more data. The length of the frame is provided in the io_len + * field of the IOB. + * + * In this case, the d_buf is not used at all and, if fact, may be + * NULL. + * + * - Received frames are provided by radio network driver to the network + * via an IOB parameter in the sixlowpan_input() pr ieee802154_input() + * interface. The length of the frame is io_len. + * + * - 6LoWPAN frames and will be uncompressed and possibly reassembled in + * the d_buf; d_len will hold the size of the reassembled packet. + * + * In this case, a d_buf of size CONFIG_NET_6LOWPAN_MTU must be provided. + * + * This is accomplished by "inheriting" the standard 'struct net_driver_s' + * and appending the frame buffer as well as other metadata needed to + * manage the fragmentation. 'struct radio_driver_s' is cast + * compatible with 'struct net_driver_s' when dev->d_lltype == + * NET_LL_IEEE802154 or dev->d_lltype == NET_LL_PKTRADIO. + * + * The radio network driver has reponsibility for initializing this + * structure. In general, all fields must be set to NULL. In addition: + * + * 1. On a TX poll, the radio network driver should provide its driver + * structure. During the course of the poll, the networking layer may + * generate outgoing frames. These frames will by provided to the MAC + * driver via the req_data() method. + * + * After sending each frame through the radio, the MAC driver must + * return the frame to the pool of free IOBs using the iob_free(). + * + * 2. When receiving data both buffers must be provided for 6LoWPAN + * frames; PF_IEEE802154 frames do not require the d_buf. + * + * The radio driver should receive the frame data directly into the + * payload area of an IOB frame structure. That IOB structure may be + * obtained using the iob_alloc() function. + * + * For 6LoWPAN, the larger dev.d_buf must have a size of at least the + * advertised MTU of the protocol, CONFIG_NET_6LOWPAN_MTU, plus + * CONFIG_NET_GUARDSIZE. If fragmentation is enabled, then the logical + * packet size may be significantly larger than the size of the frame + * buffer. The dev.d_buf is used for de-compressing each frame and + * reassembling any fragmented packets to create the full input packet + * that is provided to the application. + * + * The MAC driver should then inform the network of the reciptor of a + * frame by calling sixlowpan_input() or ieee802154_input(). That + * single frame (or, perhaps, list of frames) should be provided as + * second argument of that call. + * + * The network will free the IOB by calling iob_free after it has + * processed the incoming frame. As a complexity, the result of + * receiving a frame may be that the network may respond provide an + * outgoing frames in the via a nested call to the req_data() method. + */ + +struct iob_s; /* Forward reference */ + +struct radio_driver_s +{ + /* This definitiona must appear first in the structure definition to + * assure cast compatibility. + */ + + struct net_driver_s r_dev; + + /* Radio network driver-specific definitions follow. */ + +#ifdef CONFIG_WIRELESS_IEEE802154 + /* The msdu_handle is basically an id for the frame. The standard just + * says that the next highest layer should determine it. It is used in + * three places + * + * 1. When you do that data request + * 2. When the transmission is complete, the conf_data is called with + * that handle so that the user can be notified of the frames success/ + * failure + * 3. For a req_purge, to basically "cancel" the transaction. This is + * often particularly useful on a coordinator that has indirect data + * waiting to be requested from another device + * + * Here is a simple frame counter. + */ + + uint8_t r_msdu_handle; +#endif + +#if CONFIG_NET_6LOWPAN_FRAG + /* Fragmentation Support *************************************************/ + /* Fragmentation is handled frame by frame and requires that certain + * state information be retained from frame to frame. + */ + + /* r_dgramtag. Datagram tag to be put in the header of the set of + * fragments. It is used by the recipient to match fragments of the + * same payload. + * + * This is the sender's copy of the tag. It is incremented after each + * fragmented packet is sent so that it will be unique to that + * sequence fragmentation. Its value is then persistent, the values of + * other fragmentation variables are valid on during a single + * fragmentation sequence (while r_accumlen > 0) + */ + + uint16_t r_dgramtag; + + /* r_reasstag. Each frame in the reassembly has a tag. That tag must + * match the reassembly tag in the fragments being merged. + * + * This is the same tag as r_dgramtag but is saved on the receiving + * side to match all of the fragments of the packet. + */ + + uint16_t r_reasstag; + + /* r_pktlen. The total length of the IPv6 packet to be re-assembled in + * d_buf. Used to determine when the re-assembly is complete. + */ + + uint16_t r_pktlen; + + /* The current accumulated length of the packet being received in d_buf. + * Included IPv6 and protocol headers. Currently used only to determine + * there is a fragmentation sequence in progress. + */ + + uint16_t r_accumlen; + + /* r_boffset. Offset to the beginning of data in d_buf. As each fragment + * is received, data is placed at an appriate offset added to this. + */ + + uint16_t r_boffset; + + /* The source MAC address of the fragments being merged */ + + struct netdev_varaddr_s r_fragsrc; + + /* That time at which reassembly was started. If the elapsed time + * exceeds CONFIG_NET_6LOWPAN_MAXAGE, then the reassembly will + * be cancelled. + */ + + systime_t r_time; +#endif /* CONFIG_NET_6LOWPAN_FRAG */ + + /* MAC network driver callback functions **********************************/ + /************************************************************************** + * Name: r_get_mhrlen + * + * Description: + * Calculate the MAC header length given the frame meta-data. + * + * Input parameters: + * netdev - The networkd device that will mediate the MAC interface + * meta - Obfuscated metadata structure needed to recreate the + * radio MAC header + * + * Returned Value: + * A non-negative MAC headeer length is returned on success; a negated + * errno value is returned on any failure. + * + **************************************************************************/ + + CODE int (*r_get_mhrlen)(FAR struct radio_driver_s *netdev, + FAR const void *meta); + + /************************************************************************** + * Name: r_req_data + * + * Description: + * Requests the transfer of a list of frames to the MAC. + * + * Input parameters: + * netdev - The network device that will mediate the MAC interface + * meta - Obfuscated metadata structure needed to create the radio + * MAC header + * framelist - Head of a list of frames to be transferred. + * + * Returned Value: + * Zero (OK) returned on success; a negated errno value is returned on + * any failure. + * + **************************************************************************/ + + CODE int (*r_req_data)(FAR struct radio_driver_s *netdev, + FAR const void *meta, FAR struct iob_s *framelist); + + /************************************************************************** + * Name: r_properties + * + * Description: + * Different packet radios may have different properties. If there are + * multiple packet radios, then those properties have to be queried at + * run time. This information is provided to the 6LoWPAN network via the + * following structure. + * + * Input parameters: + * netdev - The network device to be queried + * properties - Location where radio properities will be returned. + * + * Returned Value: + * Zero (OK) returned on success; a negated errno value is returned on + * any failure. + * + **************************************************************************/ + + CODE int (*r_properties)(FAR struct radio_driver_s *netdev, + FAR struct radiodev_properties_s *properties); +}; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#endif /* __INCLUDE_NUTTX_NET_RADIODEV_H */ diff --git a/include/nuttx/net/sixlowpan.h b/include/nuttx/net/sixlowpan.h index a951f2757c1..4eab7cc48a6 100644 --- a/include/nuttx/net/sixlowpan.h +++ b/include/nuttx/net/sixlowpan.h @@ -54,10 +54,6 @@ #include -#include -#include -#include - #ifdef CONFIG_NET_6LOWPAN /**************************************************************************** @@ -341,246 +337,6 @@ (a)[4] == 0 && (a)[5] == 0 && (a)[6] == 0 && \ (((a)[7] & HTONS(0xff00)) == 0x0000)) -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* Different packet radios may have different properties. If there are - * multiple packet radios, then those properties have to be queried at - * run time. This information is provided to the 6LoWPAN network via the - * following structure. - */ - -struct sixlowpan_properties_s -{ - uint8_t sp_addrlen; /* Length of an address */ - uint8_t sp_pktlen; /* Fixed packet/frame size (up to 255) */ - struct netdev_varaddr_s sp_mcast; /* Multicast address */ - struct netdev_varaddr_s sp_bcast; /* Broadcast address */ -#ifdef CONFIG_NET_STARPOINT - struct netdev_varaddr_s sp_hubnode; /* Address of the hub node in a star */ -#endif -}; - -/* The device structure for radio network device differs from the standard - * Ethernet MAC device structure. The main reason for this difference is - * that fragmentation must be supported. - * - * The radio network driver does not use the d_buf packet buffer directly. - * Rather, it uses a list smaller frame buffers. - * - * - The packet fragment data is provided in an IOB in the via the - * r_req_data() interface method each time that the radio needs to - * send more data. The length of the frame is provided in the io_len - * field of the IOB. - * - * In this case, the d_buf is not used at all and, if fact, may be - * NULL. - * - * - Received frames are provided by radio network driver to the network - * via an IOB parameter in the sixlowpan_submit() interface. The - * length of the frawme is io_len and will be uncompressed and possibly - * reassembled in the d_buf; d_len will hold the size of the - * reassembled packet. - * - * In this case, a d_buf of size CONFIG_NET_6LOWPAN_MTU must be provided. - * - * This is accomplished by "inheriting" the standard 'struct net_driver_s' - * and appending the frame buffer as well as other metadata needed to - * manage the fragmentation. 'struct radio_driver_s' is cast - * compatible with 'struct net_driver_s' when dev->d_lltype == - * NET_LL_IEEE802154 or dev->d_lltype == NET_LL_PKTRADIO. - * - * The radio network driver has reponsibility for initializing this - * structure. In general, all fields must be set to NULL. In addition: - * - * 1. On a TX poll, the radio network driver should provide its driver - * structure. During the course of the poll, the networking layer may - * generate outgoing frames. These frames will by provided to the MAC - * driver via the req_data() method. - * - * After sending each frame through the radio, the MAC driver must - * return the frame to the pool of free IOBs using the iob_free(). - * - * 2. When receiving data both buffers must be provided: - * - * The radio driver should receive the frame data directly into the - * payload area of an IOB frame structure. That IOB structure may be - * obtained using the iob_alloc() function. - * - * The larger dev.d_buf must have a size of at least the advertised MTU - * of the protocol, CONFIG_NET_6LOWPAN_MTU, plus CONFIG_NET_GUARDSIZE. - * If fragmentation is enabled, then the logical packet size may be - * significantly larger than the size of the frame buffer. The dev.d_buf - * is used for de-compressing each frame and reassembling any fragmented - * packets to create the full input packet that is provided to the - * application. - * - * The MAC driver should then inform the network of the by calling - * sixlowpan_input(). That single frame (or, perhaps, list of frames) - * should be provided as second argument of that call. - * - * The network will free the IOB by calling iob_free after it has - * processed the incoming frame. As a complexity, the result of - * receiving a frame may be that the network may respond provide an - * outgoing frames in the via a nested calle to the req_data() method. - */ - -struct iob_s; /* Forward reference */ - -struct radio_driver_s -{ - /* This definitiona must appear first in the structure definition to - * assure cast compatibility. - */ - - struct net_driver_s r_dev; - - /* Radio network driver-specific definitions follow. */ - -#ifdef CONFIG_WIRELESS_IEEE802154 - /* The msdu_handle is basically an id for the frame. The standard just - * says that the next highest layer should determine it. It is used in - * three places - * - * 1. When you do that data request - * 2. When the transmission is complete, the conf_data is called with - * that handle so that the user can be notified of the frames success/ - * failure - * 3. For a req_purge, to basically "cancel" the transaction. This is - * often particularly useful on a coordinator that has indirect data - * waiting to be requested from another device - * - * Here is a simple frame counter. - */ - - uint8_t r_msdu_handle; -#endif - -#if CONFIG_NET_6LOWPAN_FRAG - /* Fragmentation Support *************************************************/ - /* Fragmentation is handled frame by frame and requires that certain - * state information be retained from frame to frame. - */ - - /* r_dgramtag. Datagram tag to be put in the header of the set of - * fragments. It is used by the recipient to match fragments of the - * same payload. - * - * This is the sender's copy of the tag. It is incremented after each - * fragmented packet is sent so that it will be unique to that - * sequence fragmentation. Its value is then persistent, the values of - * other fragmentation variables are valid on during a single - * fragmentation sequence (while r_accumlen > 0) - */ - - uint16_t r_dgramtag; - - /* r_reasstag. Each frame in the reassembly has a tag. That tag must - * match the reassembly tag in the fragments being merged. - * - * This is the same tag as r_dgramtag but is saved on the receiving - * side to match all of the fragments of the packet. - */ - - uint16_t r_reasstag; - - /* r_pktlen. The total length of the IPv6 packet to be re-assembled in - * d_buf. Used to determine when the re-assembly is complete. - */ - - uint16_t r_pktlen; - - /* The current accumulated length of the packet being received in d_buf. - * Included IPv6 and protocol headers. Currently used only to determine - * there is a fragmentation sequence in progress. - */ - - uint16_t r_accumlen; - - /* r_boffset. Offset to the beginning of data in d_buf. As each fragment - * is received, data is placed at an appriate offset added to this. - */ - - uint16_t r_boffset; - - /* The source MAC address of the fragments being merged */ - - struct netdev_varaddr_s r_fragsrc; - - /* That time at which reassembly was started. If the elapsed time - * exceeds CONFIG_NET_6LOWPAN_MAXAGE, then the reassembly will - * be cancelled. - */ - - systime_t r_time; -#endif /* CONFIG_NET_6LOWPAN_FRAG */ - - /* MAC network driver callback functions **********************************/ - /************************************************************************** - * Name: r_get_mhrlen - * - * Description: - * Calculate the MAC header length given the frame meta-data. - * - * Input parameters: - * netdev - The networkd device that will mediate the MAC interface - * meta - Obfuscated metadata structure needed to recreate the - * radio MAC header - * - * Returned Value: - * A non-negative MAC headeer length is returned on success; a negated - * errno value is returned on any failure. - * - **************************************************************************/ - - CODE int (*r_get_mhrlen)(FAR struct radio_driver_s *netdev, - FAR const void *meta); - - /************************************************************************** - * Name: r_req_data - * - * Description: - * Requests the transfer of a list of frames to the MAC. - * - * Input parameters: - * netdev - The network device that will mediate the MAC interface - * meta - Obfuscated metadata structure needed to create the radio - * MAC header - * framelist - Head of a list of frames to be transferred. - * - * Returned Value: - * Zero (OK) returned on success; a negated errno value is returned on - * any failure. - * - **************************************************************************/ - - CODE int (*r_req_data)(FAR struct radio_driver_s *netdev, - FAR const void *meta, FAR struct iob_s *framelist); - - /************************************************************************** - * Name: r_properties - * - * Description: - * Different packet radios may have different properties. If there are - * multiple packet radios, then those properties have to be queried at - * run time. This information is provided to the 6LoWPAN network via the - * following structure. - * - * Input parameters: - * netdev - The network device to be queried - * properties - Location where radio properities will be returned. - * - * Returned Value: - * Zero (OK) returned on success; a negated errno value is returned on - * any failure. - * - **************************************************************************/ - - CODE int (*r_properties)(FAR struct radio_driver_s *netdev, - FAR struct sixlowpan_properties_s *properties); -}; - /**************************************************************************** * Public Function Prototypes ****************************************************************************/ @@ -651,6 +407,9 @@ struct radio_driver_s * ****************************************************************************/ +struct radio_driver_s; /* Forward reference. See radiodev.h */ +struct iob_s; /* Forward reference See iob.h */ + int sixlowpan_input(FAR struct radio_driver_s *radio, FAR struct iob_s *framelist, FAR const void *metadata); diff --git a/include/nuttx/wireless/pktradio.h b/include/nuttx/wireless/pktradio.h index 6ec742bec39..d4f405b4142 100644 --- a/include/nuttx/wireless/pktradio.h +++ b/include/nuttx/wireless/pktradio.h @@ -112,8 +112,8 @@ struct pktradio_addr_s * run time. This information is provided to the 6LoWPAN network via the * following structure. * - * NOTE: This MUST be the same as the struct sixlowpan_properties_s as - * defined in sixlowpan.h. It is duplicated here with a different name in + * NOTE: This MUST be the same as the struct radiodev_properties_s as + * defined in radiodev.h. It is duplicated here with a different name in * order to avoid circular header file inclusion. */ diff --git a/net/ieee802154/Kconfig b/net/ieee802154/Kconfig index f32844ccfe4..dd153ad7900 100644 --- a/net/ieee802154/Kconfig +++ b/net/ieee802154/Kconfig @@ -22,6 +22,17 @@ config NET_IEEE802154 if NET_IEEE802154 +config NET_IEEE802154_FRAMELEN + int "IEEE802.15.4 Frame Length" + default 127 + range 1 999999 + ---help--- + For standard IEEE 802.15.4 radios, this should always be 127 bytes. + However, some IEEE 802.15.4 radios may non-standard frame lengths. + + This setting is currently used only for detection data transfers + that would exceed the radio frame length. + config NET_IEEE802154_NCONNS int "Max IEEE 802.15.4 sockets" default 4 diff --git a/net/ieee802154/ieee802154.h b/net/ieee802154/ieee802154.h index 35641acdc67..01f3540e13b 100644 --- a/net/ieee802154/ieee802154.h +++ b/net/ieee802154/ieee802154.h @@ -64,6 +64,22 @@ #define IEEE802154_POOL_PREALLOCATED 0 #define IEEE802154_POOL_DYNAMIC 1 +/* Frame size */ + +/* This maximum size of an IEEE802.15.4 frame. Certain, non-standard + * devices may exceed this value, however. + */ + +#define IEEE802154_MAC_STDFRAME 127 + +/* Space for a two byte FCS must be reserved at the end of the frame */ + +#define IEEE802154_MAC_FCSSIZE 2 + +/* This, then, is the usable size of the frame */ + +#define IEEE802154_FRAMELEN (CONFIG_NET_IEEE802154_FRAMELEN - IEEE802154_MAC_FCSSIZE) + /**************************************************************************** * Public Type Definitions ****************************************************************************/ @@ -126,7 +142,7 @@ EXTERN const struct sock_intf_s g_ieee802154_sockif; ****************************************************************************/ struct ieee802154_data_ind_s; /* Forward reference */ -struct radio_driver_s; /* Forward reference */ +struct radio_driver_s; /* Forward reference */ struct net_driver_s; /* Forward reference */ struct eth_hdr_s; /* Forward reference */ struct socket; /* Forward reference */ diff --git a/net/ieee802154/ieee802154_callback.c b/net/ieee802154/ieee802154_callback.c index 18538cef360..48eefd4580c 100644 --- a/net/ieee802154/ieee802154_callback.c +++ b/net/ieee802154/ieee802154_callback.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include "devif/devif.h" diff --git a/net/ieee802154/ieee802154_finddev.c b/net/ieee802154/ieee802154_finddev.c index 8cf41544e13..477328bc078 100644 --- a/net/ieee802154/ieee802154_finddev.c +++ b/net/ieee802154/ieee802154_finddev.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include #include "netdev/netdev.h" diff --git a/net/ieee802154/ieee802154_input.c b/net/ieee802154/ieee802154_input.c index c17ed82c869..3e4846ffdd5 100644 --- a/net/ieee802154/ieee802154_input.c +++ b/net/ieee802154/ieee802154_input.c @@ -43,7 +43,7 @@ #include #include -#include +#include #include #include "devif/devif.h" diff --git a/net/ieee802154/ieee802154_poll.c b/net/ieee802154/ieee802154_poll.c index 9e8da42f283..f46f6611b4c 100644 --- a/net/ieee802154/ieee802154_poll.c +++ b/net/ieee802154/ieee802154_poll.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include #include "devif/devif.h" diff --git a/net/ieee802154/ieee802154_recvfrom.c b/net/ieee802154/ieee802154_recvfrom.c index 9d06700afc1..83dd6b74dee 100644 --- a/net/ieee802154/ieee802154_recvfrom.c +++ b/net/ieee802154/ieee802154_recvfrom.c @@ -52,7 +52,7 @@ #include #include #include -#include +#include #include #include "netdev/netdev.h" diff --git a/net/ieee802154/ieee802154_sendto.c b/net/ieee802154/ieee802154_sendto.c index a125bb1bfa0..7941df8daff 100644 --- a/net/ieee802154/ieee802154_sendto.c +++ b/net/ieee802154/ieee802154_sendto.c @@ -55,7 +55,7 @@ #include #include #include -#include +#include #include #include @@ -334,8 +334,8 @@ static uint16_t ieee802154_sendto_interrupt(FAR struct net_driver_s *dev, * MAC header. */ - DEBUGASSERT(CONFIG_NET_6LOWPAN_FRAMELEN <= CONFIG_IOB_BUFSIZE); - if (pstate->is_buflen + hdrlen > CONFIG_IOB_BUFSIZE) + DEBUGASSERT(CONFIG_NET_IEEE802154_FRAMELEN <= CONFIG_IOB_BUFSIZE); + if (pstate->is_buflen + hdrlen > IEEE802154_FRAMELEN) { nerr("ERROR: User buffer will not fit into the frame: %u > %u\n", (unsigned int)(pstate->is_buflen + hdrlen), diff --git a/net/ieee802154/ieee802154_sockif.c b/net/ieee802154/ieee802154_sockif.c index c8bf2767e0e..62cd1c5de26 100644 --- a/net/ieee802154/ieee802154_sockif.c +++ b/net/ieee802154/ieee802154_sockif.c @@ -48,6 +48,7 @@ #include #include +#include #include #include diff --git a/net/netdev/netdev_ioctl.c b/net/netdev/netdev_ioctl.c index ff38ed0e0d2..37d11c8807e 100644 --- a/net/netdev/netdev_ioctl.c +++ b/net/netdev/netdev_ioctl.c @@ -57,6 +57,7 @@ #include #include +#include #include #ifdef CONFIG_NET_6LOWPAN @@ -866,7 +867,7 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd, dev->d_lltype == NET_LL_PKTRADIO) { FAR struct radio_driver_s *radio; - struct sixlowpan_properties_s properties; + struct radiodev_properties_s properties; /* Get the radio properties */ diff --git a/net/netdev/netdev_lladdrsize.c b/net/netdev/netdev_lladdrsize.c index 10fa3460145..e07586ce29a 100644 --- a/net/netdev/netdev_lladdrsize.c +++ b/net/netdev/netdev_lladdrsize.c @@ -47,6 +47,7 @@ #include #include +#include #include #include "netdev/netdev.h" @@ -76,7 +77,7 @@ static inline int netdev_pktradio_addrlen(FAR struct net_driver_s *dev) { FAR struct radio_driver_s *radio = (FAR struct radio_driver_s *)dev; - struct sixlowpan_properties_s properties; + struct radiodev_properties_s properties; int ret; DEBUGASSERT(radio != NULL && radio->r_properties != NULL); diff --git a/net/sixlowpan/Kconfig b/net/sixlowpan/Kconfig index 2b3175d3ddf..1c3da1dc133 100644 --- a/net/sixlowpan/Kconfig +++ b/net/sixlowpan/Kconfig @@ -14,12 +14,13 @@ config NET_6LOWPAN_FRAG used or not. Fragmentation is on by default. config NET_6LOWPAN_FRAMELEN - int "IEEE802.15.4 MAC Frame Length" + int "Max Radio Frame Size" default 127 range 1 999999 ---help--- - Some wireless devices may use non-standard frame lengths. This - setting should never be smaller than 127. + 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 non-standard frame lengths. choice prompt "6LoWPAN Compression" diff --git a/net/sixlowpan/sixlowpan_framelist.c b/net/sixlowpan/sixlowpan_framelist.c index 96022156689..5df2103d4b7 100644 --- a/net/sixlowpan/sixlowpan_framelist.c +++ b/net/sixlowpan/sixlowpan_framelist.c @@ -55,6 +55,7 @@ #include #include +#include #include #include "sixlowpan/sixlowpan_internal.h" diff --git a/net/sixlowpan/sixlowpan_framer.c b/net/sixlowpan/sixlowpan_framer.c index 8a253e876cc..95d44d85597 100644 --- a/net/sixlowpan/sixlowpan_framer.c +++ b/net/sixlowpan/sixlowpan_framer.c @@ -46,6 +46,7 @@ #include #include "nuttx/net/net.h" +#include "nuttx/net/radiodev.h" #include "nuttx/wireless/ieee802154/ieee802154_mac.h" #include "sixlowpan/sixlowpan_internal.h" diff --git a/net/sixlowpan/sixlowpan_hc06.c b/net/sixlowpan/sixlowpan_hc06.c index 1f7f1fb741b..85b41a0ff65 100644 --- a/net/sixlowpan/sixlowpan_hc06.c +++ b/net/sixlowpan/sixlowpan_hc06.c @@ -62,6 +62,7 @@ #include #include +#include #include #include "sixlowpan/sixlowpan_internal.h" diff --git a/net/sixlowpan/sixlowpan_hc1.c b/net/sixlowpan/sixlowpan_hc1.c index b732ef857d2..4daa4cabb06 100644 --- a/net/sixlowpan/sixlowpan_hc1.c +++ b/net/sixlowpan/sixlowpan_hc1.c @@ -54,6 +54,7 @@ #include #include +#include #include "sixlowpan/sixlowpan_internal.h" #ifdef CONFIG_NET_6LOWPAN_COMPRESSION_HC1 diff --git a/net/sixlowpan/sixlowpan_icmpv6send.c b/net/sixlowpan/sixlowpan_icmpv6send.c index 179907f8359..2bb7a46165b 100644 --- a/net/sixlowpan/sixlowpan_icmpv6send.c +++ b/net/sixlowpan/sixlowpan_icmpv6send.c @@ -43,6 +43,7 @@ #include #include +#include #include #include "icmpv6/icmpv6.h" diff --git a/net/sixlowpan/sixlowpan_input.c b/net/sixlowpan/sixlowpan_input.c index 6b4177a8ace..a5d14ed9644 100644 --- a/net/sixlowpan/sixlowpan_input.c +++ b/net/sixlowpan/sixlowpan_input.c @@ -59,6 +59,7 @@ #endif #include "nuttx/net/netdev.h" +#include "nuttx/net/radiodev.h" #include "nuttx/net/ip.h" #include "nuttx/net/icmpv6.h" #include "nuttx/net/sixlowpan.h" diff --git a/net/sixlowpan/sixlowpan_internal.h b/net/sixlowpan/sixlowpan_internal.h index 6909a81ff9f..a65666880f1 100644 --- a/net/sixlowpan/sixlowpan_internal.h +++ b/net/sixlowpan/sixlowpan_internal.h @@ -233,7 +233,7 @@ extern uint8_t g_frame_hdrlen; ****************************************************************************/ struct net_driver_s; /* Forward reference */ -struct radio_driver_s; /* Forward reference */ +struct radio_driver_s; /* Forward reference */ struct devif_callback_s; /* Forward reference */ struct ipv6_hdr_s; /* Forward reference */ struct netdev_varaddr_s; /* Forward reference */ diff --git a/net/sixlowpan/sixlowpan_send.c b/net/sixlowpan/sixlowpan_send.c index a097a77f04e..3f7cface202 100644 --- a/net/sixlowpan/sixlowpan_send.c +++ b/net/sixlowpan/sixlowpan_send.c @@ -47,6 +47,7 @@ #include #include #include +#include #include "netdev/netdev.h" #include "devif/devif.h" diff --git a/net/sixlowpan/sixlowpan_tcpsend.c b/net/sixlowpan/sixlowpan_tcpsend.c index 77f517e1313..d5b11d23d93 100644 --- a/net/sixlowpan/sixlowpan_tcpsend.c +++ b/net/sixlowpan/sixlowpan_tcpsend.c @@ -46,6 +46,7 @@ #include "nuttx/semaphore.h" #include "nuttx/net/netdev.h" +#include "nuttx/net/radiodev.h" #include "nuttx/net/netstats.h" #include "netdev/netdev.h" diff --git a/net/sixlowpan/sixlowpan_udpsend.c b/net/sixlowpan/sixlowpan_udpsend.c index 818f5bfb6c7..be7dfce581b 100644 --- a/net/sixlowpan/sixlowpan_udpsend.c +++ b/net/sixlowpan/sixlowpan_udpsend.c @@ -46,6 +46,7 @@ #include #include "nuttx/net/netdev.h" +#include "nuttx/net/radiodev.h" #include "nuttx/net/netstats.h" #include "netdev/netdev.h" diff --git a/net/sixlowpan/sixlowpan_utils.c b/net/sixlowpan/sixlowpan_utils.c index c3415374575..120db500598 100644 --- a/net/sixlowpan/sixlowpan_utils.c +++ b/net/sixlowpan/sixlowpan_utils.c @@ -54,6 +54,7 @@ #include #include +#include #include #include #include @@ -192,7 +193,7 @@ int sixlowpan_destaddrfromip(FAR struct radio_driver_s *radio, const net_ipv6addr_t ipaddr, FAR struct netdev_varaddr_s *destaddr) { - struct sixlowpan_properties_s properties; + struct radiodev_properties_s properties; int ret; #ifdef CONFIG_NET_STARPOINT diff --git a/wireless/ieee802154/mac802154_loopback.c b/wireless/ieee802154/mac802154_loopback.c index a4c96d9414b..86b5fd80b69 100644 --- a/wireless/ieee802154/mac802154_loopback.c +++ b/wireless/ieee802154/mac802154_loopback.c @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -167,7 +168,7 @@ static int lo_get_mhrlen(FAR struct radio_driver_s *netdev, static int lo_req_data(FAR struct radio_driver_s *netdev, FAR const void *meta, FAR struct iob_s *framelist); static int lo_properties(FAR struct radio_driver_s *netdev, - FAR struct sixlowpan_properties_s *properties); + FAR struct radiodev_properties_s *properties); /**************************************************************************** * Private Functions @@ -926,10 +927,10 @@ static int lo_req_data(FAR struct radio_driver_s *netdev, ****************************************************************************/ static int lo_properties(FAR struct radio_driver_s *netdev, - FAR struct sixlowpan_properties_s *properties) + FAR struct radiodev_properties_s *properties) { DEBUGASSERT(netdev != NULL && properties != NULL); - memset(properties, 0, sizeof(struct sixlowpan_properties_s)); + memset(properties, 0, sizeof(struct radiodev_properties_s)); /* General */ diff --git a/wireless/ieee802154/mac802154_netdev.c b/wireless/ieee802154/mac802154_netdev.c index 53e354b9fa8..654b8020b0e 100644 --- a/wireless/ieee802154/mac802154_netdev.c +++ b/wireless/ieee802154/mac802154_netdev.c @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -201,7 +202,7 @@ static int macnet_get_mhrlen(FAR struct radio_driver_s *netdev, static int macnet_req_data(FAR struct radio_driver_s *netdev, FAR const void *meta, FAR struct iob_s *framelist); static int macnet_properties(FAR struct radio_driver_s *netdev, - FAR struct sixlowpan_properties_s *properties); + FAR struct radiodev_properties_s *properties); /**************************************************************************** * Private Functions @@ -1073,10 +1074,10 @@ static int macnet_req_data(FAR struct radio_driver_s *netdev, ****************************************************************************/ static int macnet_properties(FAR struct radio_driver_s *netdev, - FAR struct sixlowpan_properties_s *properties) + FAR struct radiodev_properties_s *properties) { DEBUGASSERT(netdev != NULL && properties != NULL); - memset(properties, 0, sizeof(struct sixlowpan_properties_s)); + memset(properties, 0, sizeof(struct radiodev_properties_s)); /* General */ diff --git a/wireless/pktradio/pktradio_loopback.c b/wireless/pktradio/pktradio_loopback.c index a5b97198c8f..6362e6bc9fb 100644 --- a/wireless/pktradio/pktradio_loopback.c +++ b/wireless/pktradio/pktradio_loopback.c @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -177,7 +178,7 @@ static int lo_get_mhrlen(FAR struct radio_driver_s *netdev, static int lo_req_data(FAR struct radio_driver_s *netdev, FAR const void *meta, FAR struct iob_s *framelist); static int lo_properties(FAR struct radio_driver_s *netdev, - FAR struct sixlowpan_properties_s *properties); + FAR struct radiodev_properties_s *properties); /**************************************************************************** * Private Functions @@ -748,8 +749,8 @@ static int lo_ioctl(FAR struct net_driver_s *dev, int cmd, { FAR struct radio_driver_s *radio = (FAR struct radio_driver_s *)dev; - FAR struct sixlowpan_properties_s *props = - (FAR struct sixlowpan_properties_s *)&cmddata->pifr_props; + FAR struct radiodev_properties_s *props = + (FAR struct radiodev_properties_s *)&cmddata->pifr_props; ret = lo_properties(radio, props); } @@ -929,10 +930,10 @@ static int lo_req_data(FAR struct radio_driver_s *netdev, ****************************************************************************/ static int lo_properties(FAR struct radio_driver_s *netdev, - FAR struct sixlowpan_properties_s *properties) + FAR struct radiodev_properties_s *properties) { DEBUGASSERT(netdev != NULL && properties != NULL); - memset(properties, 0, sizeof(struct sixlowpan_properties_s)); + memset(properties, 0, sizeof(struct radiodev_properties_s)); /* General */