diff --git a/include/nuttx/net/bluetooth.h b/include/nuttx/net/bluetooth.h index f3a0a3c479b61e861f6bd4f5972a72d210696cb4..ebcd8c830cbc0487627a213fe704998c8dab2343 100644 --- a/include/nuttx/net/bluetooth.h +++ b/include/nuttx/net/bluetooth.h @@ -60,16 +60,17 @@ * mark. */ -#define BLUETOOTH_SMP_MTU 65 - #define BLUETOOTH_L2CAP_HDRLEN 4 /* Size of L2CAP header */ #define BLUETOOTH_ACL_HDRLEN 4 /* Size of ACL header */ #define BLUETOOTH_H4_HDRLEN 1 /* Size of H4 header */ -#define BLUETOOTH_FRAME_HDRLEN \ +#define BLUETOOTH_MAX_HDRLEN \ (BLUETOOTH_L2CAP_HDRLEN + BLUETOOTH_ACL_HDRLEN + BLUETOOTH_H4_HDRLEN) -#define BLUETOOTH_MAX_FRAMELEN (BLUETOOTH_SMP_MTU + BLUETOOTH_FRAME_HDRLEN) +#define BLUETOOTH_SMP_MTU 65 +#define BLUETOOTH_MAX_MTU 70 + +#define BLUETOOTH_MAX_FRAMELEN (BLUETOOTH_MAX_MTU + BLUETOOTH_MAX_HDRLEN) #define BLUETOOTH_ADDRSIZE 6 #define BLUETOOTH_ADDRCOPY(d,s) memcpy((d),(s),BLUETOOTH_ADDRSIZE) diff --git a/net/netdev/netdev_lladdrsize.c b/net/netdev/netdev_lladdrsize.c index 2640d0340643a3249ec4fa46c498b9d115f6eaa8..ec03f5089f2ed5ccfb7b9047af8a942d8db25a11 100644 --- a/net/netdev/netdev_lladdrsize.c +++ b/net/netdev/netdev_lladdrsize.c @@ -74,7 +74,8 @@ * ****************************************************************************/ -#if defined(CONFIG_NET_6LOWPAN) && defined(CONFIG_WIRELESS_PKTRADIO) +#if defined(CONFIG_NET_6LOWPAN) && (defined(CONFIG_WIRELESS_PKTRADIO) || \ + defined(CONFIG_NET_BLUETOOTH)) static inline int netdev_pktradio_addrlen(FAR struct net_driver_s *dev) { FAR struct radio_driver_s *radio = (FAR struct radio_driver_s *)dev; @@ -154,14 +155,19 @@ int netdev_dev_lladdrsize(FAR struct net_driver_s *dev) } #endif /* CONFIG_WIRELESS_IEEE802154 */ +#if defined(CONFIG_WIRELESS_PKTRADIO) || defined(CONFIG_NET_BLUETOOTH) #ifdef CONFIG_WIRELESS_PKTRADIO case NET_LL_PKTRADIO: +#endif +#ifdef CONFIG_NET_BLUETOOTH + case NET_LL_BLUETOOTH: +#endif { /* Return the size of the packet radio address */ return netdev_pktradio_addrlen(dev); } -#endif /* CONFIG_WIRELESS_PKTRADIO */ +#endif /* CONFIG_WIRELESS_PKTRADIO || CONFIG_NET_BLUETOOTH */ #endif /* CONFIG_NET_6LOWPAN */ default: diff --git a/net/netdev/netdev_register.c b/net/netdev/netdev_register.c index 8131b1912e726cd9cb1b91f2a444c4954e7dcf0d..54e2aa883a78bbd357a95290f07432ad33a3966d 100644 --- a/net/netdev/netdev_register.c +++ b/net/netdev/netdev_register.c @@ -221,7 +221,7 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype) #ifdef CONFIG_NET_BLUETOOTH case NET_LL_BLUETOOTH: /* Bluetooth */ - dev->d_llhdrlen = BLUETOOTH_FRAME_HDRLEN; + dev->d_llhdrlen = BLUETOOTH_MAX_HDRLEN; /* Determined at runtime */ #ifdef CONFIG_NET_6LOWPAN # warning Missing logic dev->d_mtu = CONFIG_NET_6LOWPAN_MTU; @@ -237,7 +237,7 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype) #if defined(CONFIG_NET_6LOWPAN) || defined(CONFIG_NET_IEEE802154) case NET_LL_IEEE802154: /* IEEE 802.15.4 MAC */ case NET_LL_PKTRADIO: /* Non-IEEE 802.15.4 packet radio */ - dev->d_llhdrlen = 0; + dev->d_llhdrlen = 0; /* Determined at runtime */ #ifdef CONFIG_NET_6LOWPAN dev->d_mtu = CONFIG_NET_6LOWPAN_MTU; #ifdef CONFIG_NET_TCP diff --git a/wireless/bluetooth/bt_netdev.c b/wireless/bluetooth/bt_netdev.c index 64f9e1f20182dddbc97e716b5a2223535bfd1da2..6c03c9ea9c0cb887d2c07cde60ba50c604d062be 100644 --- a/wireless/bluetooth/bt_netdev.c +++ b/wireless/bluetooth/bt_netdev.c @@ -223,7 +223,7 @@ static int btnet_advertise(FAR struct net_driver_s *dev) * a single Bluetooth device. */ - addr = g_btdev.bdaddr.val + addr = g_btdev.bdaddr.val; /* Set the MAC address using 6-byte local address from the device. */ @@ -845,7 +845,9 @@ static int btnet_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac) static int btnet_get_mhrlen(FAR struct radio_driver_s *netdev, FAR const void *meta) { - return BLUETOOTH_FRAME_HDRLEN; + /* Always report the maximum frame length. */ + + return BLUETOOTH_MAX_HDRLEN; } /**************************************************************************** @@ -918,12 +920,12 @@ static int btnet_req_data(FAR struct radio_driver_s *netdev, framelist = iob->io_flink; iob->io_flink = NULL; - DEBUGASSERT(iob->io_offset == BLUETOOTH_FRAME_HDRLEN && - iob->io_len >= BLUETOOTH_FRAME_HDRLEN); + DEBUGASSERT(iob->io_offset == BLUETOOTH_MAX_HDRLEN && + iob->io_len >= BLUETOOTH_MAX_HDRLEN); /* Allocate a buffer to contain the IOB */ - buf = bt_buf_alloc(BT_ACL_OUT, iob, BLUETOOTH_FRAME_HDRLEN); + buf = bt_buf_alloc(BT_ACL_OUT, iob, BLUETOOTH_MAX_HDRLEN); if (buf == NULL) { wlerr("ERROR: Failed to allocate buffer container\n");