gnrc: 6Lo fixes for BLE
This commit is contained in:
parent
0d55a8a1c6
commit
d4661af4c8
@ -65,23 +65,6 @@
|
|||||||
|
|
||||||
/* XXX: netdev required by gnrc_netif, but not implemented fully for
|
/* XXX: netdev required by gnrc_netif, but not implemented fully for
|
||||||
* nordic_softdevice_ble for legacy reasons */
|
* nordic_softdevice_ble for legacy reasons */
|
||||||
static int _netdev_init(netdev_t *netdev);
|
|
||||||
static int _netdev_get(netdev_t *netdev, netopt_t opt,
|
|
||||||
void *value, size_t max_len);
|
|
||||||
static int _netdev_set(netdev_t *netdev, netopt_t opt,
|
|
||||||
const void *value, size_t value_len);
|
|
||||||
|
|
||||||
static const netdev_driver_t _ble_netdev_driver = {
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
_netdev_init,
|
|
||||||
NULL,
|
|
||||||
_netdev_get,
|
|
||||||
_netdev_set,
|
|
||||||
};
|
|
||||||
static netdev_t _ble_dummy_dev = {
|
|
||||||
.driver = &_ble_netdev_driver,
|
|
||||||
};
|
|
||||||
|
|
||||||
static char _stack[(THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE)];
|
static char _stack[(THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE)];
|
||||||
|
|
||||||
@ -293,6 +276,19 @@ static const gnrc_netif_ops_t _ble_ops = {
|
|||||||
.msg_handler = _netif_msg_handler,
|
.msg_handler = _netif_msg_handler,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const netdev_driver_t _ble_netdev_driver = {
|
||||||
|
.send = NULL,
|
||||||
|
.recv = NULL,
|
||||||
|
.init = _netdev_init,
|
||||||
|
.isr = NULL,
|
||||||
|
.get = _netdev_get,
|
||||||
|
.set = _netdev_set,
|
||||||
|
};
|
||||||
|
|
||||||
|
static netdev_t _ble_dummy_dev = {
|
||||||
|
.driver = &_ble_netdev_driver,
|
||||||
|
};
|
||||||
|
|
||||||
void gnrc_nordic_ble_6lowpan_init(void)
|
void gnrc_nordic_ble_6lowpan_init(void)
|
||||||
{
|
{
|
||||||
gnrc_netif_create(_stack, sizeof(_stack), BLE_PRIO,
|
gnrc_netif_create(_stack, sizeof(_stack), BLE_PRIO,
|
||||||
|
|||||||
@ -1195,6 +1195,9 @@ static void _init_from_device(gnrc_netif_t *netif)
|
|||||||
#ifdef MODULE_NORDIC_SOFTDEVICE_BLE
|
#ifdef MODULE_NORDIC_SOFTDEVICE_BLE
|
||||||
case NETDEV_TYPE_BLE:
|
case NETDEV_TYPE_BLE:
|
||||||
netif->ipv6.mtu = IPV6_MIN_MTU;
|
netif->ipv6.mtu = IPV6_MIN_MTU;
|
||||||
|
#ifdef MODULE_GNRC_SIXLOWPAN_IPHC
|
||||||
|
netif->flags |= GNRC_NETIF_FLAGS_6LO_HC;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -257,11 +257,10 @@ static void _send(gnrc_pktsnip_t *pkt)
|
|||||||
DEBUG("6lo: iface->sixlo.max_frag_size = %" PRIu8 " for interface %"
|
DEBUG("6lo: iface->sixlo.max_frag_size = %" PRIu8 " for interface %"
|
||||||
PRIkernel_pid "\n", iface->sixlo.max_frag_size, hdr->if_pid);
|
PRIkernel_pid "\n", iface->sixlo.max_frag_size, hdr->if_pid);
|
||||||
|
|
||||||
/* IP should not send anything here if it is not a 6LoWPAN interface,
|
/* Note, that datagram_size cannot be used here, because the header size
|
||||||
* so we don't need to check for NULL pointers.
|
|
||||||
* Note, that datagram_size cannot be used here, because the header size
|
|
||||||
* might be changed by IPHC. */
|
* might be changed by IPHC. */
|
||||||
if (gnrc_pkt_len(pkt2->next) <= iface->sixlo.max_frag_size) {
|
if ((iface->sixlo.max_frag_size == 0) ||
|
||||||
|
(gnrc_pkt_len(pkt2->next) <= iface->sixlo.max_frag_size)) {
|
||||||
DEBUG("6lo: Send SND command for %p to %" PRIu16 "\n",
|
DEBUG("6lo: Send SND command for %p to %" PRIu16 "\n",
|
||||||
(void *)pkt2, hdr->if_pid);
|
(void *)pkt2, hdr->if_pid);
|
||||||
if (gnrc_netapi_send(hdr->if_pid, pkt2) < 1) {
|
if (gnrc_netapi_send(hdr->if_pid, pkt2) < 1) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user