From d4661af4c85daf01a603f382f23770d6ee221d5d Mon Sep 17 00:00:00 2001 From: Martine Lenders <m.lenders@fu-berlin.de> Date: Thu, 18 Jan 2018 11:18:11 +0100 Subject: [PATCH] gnrc: 6Lo fixes for BLE --- .../src/gnrc_nordic_ble_6lowpan.c | 30 ++++++++----------- sys/net/gnrc/netif/gnrc_netif.c | 3 ++ .../network_layer/sixlowpan/gnrc_sixlowpan.c | 7 ++--- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/pkg/nordic_softdevice_ble/src/gnrc_nordic_ble_6lowpan.c b/pkg/nordic_softdevice_ble/src/gnrc_nordic_ble_6lowpan.c index a2c438ca24..312a6135b4 100644 --- a/pkg/nordic_softdevice_ble/src/gnrc_nordic_ble_6lowpan.c +++ b/pkg/nordic_softdevice_ble/src/gnrc_nordic_ble_6lowpan.c @@ -65,23 +65,6 @@ /* XXX: netdev required by gnrc_netif, but not implemented fully for * 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)]; @@ -293,6 +276,19 @@ static const gnrc_netif_ops_t _ble_ops = { .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) { gnrc_netif_create(_stack, sizeof(_stack), BLE_PRIO, diff --git a/sys/net/gnrc/netif/gnrc_netif.c b/sys/net/gnrc/netif/gnrc_netif.c index a7b6653928..7068d3b7f0 100644 --- a/sys/net/gnrc/netif/gnrc_netif.c +++ b/sys/net/gnrc/netif/gnrc_netif.c @@ -1195,6 +1195,9 @@ static void _init_from_device(gnrc_netif_t *netif) #ifdef MODULE_NORDIC_SOFTDEVICE_BLE case NETDEV_TYPE_BLE: netif->ipv6.mtu = IPV6_MIN_MTU; +#ifdef MODULE_GNRC_SIXLOWPAN_IPHC + netif->flags |= GNRC_NETIF_FLAGS_6LO_HC; +#endif break; #endif default: diff --git a/sys/net/gnrc/network_layer/sixlowpan/gnrc_sixlowpan.c b/sys/net/gnrc/network_layer/sixlowpan/gnrc_sixlowpan.c index a1f361b953..7b18baca08 100644 --- a/sys/net/gnrc/network_layer/sixlowpan/gnrc_sixlowpan.c +++ b/sys/net/gnrc/network_layer/sixlowpan/gnrc_sixlowpan.c @@ -257,11 +257,10 @@ static void _send(gnrc_pktsnip_t *pkt) DEBUG("6lo: iface->sixlo.max_frag_size = %" PRIu8 " for interface %" PRIkernel_pid "\n", iface->sixlo.max_frag_size, hdr->if_pid); - /* IP should not send anything here if it is not a 6LoWPAN interface, - * so we don't need to check for NULL pointers. - * Note, that datagram_size cannot be used here, because the header size + /* Note, that datagram_size cannot be used here, because the header size * 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", (void *)pkt2, hdr->if_pid); if (gnrc_netapi_send(hdr->if_pid, pkt2) < 1) { -- GitLab