gnrc: 6Lo fixes for BLE

This commit is contained in:
Martine Lenders 2018-01-18 11:18:11 +01:00 committed by dylad
parent 0d55a8a1c6
commit d4661af4c8
3 changed files with 19 additions and 21 deletions

View File

@ -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,

View File

@ -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:

View File

@ -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) {