1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

gnrc_netif: introduce gnrc_netif_6lo pseudo-module for 6LoWPAN members

This aims to reduce circular dependencies in GNRC.
This commit is contained in:
Martine S. Lenders 2020-05-05 17:55:11 +02:00
parent 0d2f0a5ba4
commit 9801a439fc
No known key found for this signature in database
GPG Key ID: CCD317364F63286F
6 changed files with 14 additions and 10 deletions

View File

@ -274,6 +274,9 @@ ifneq (,$(filter gnrc_sixlowpan,$(USEMODULE)))
DEFAULT_MODULE += auto_init_gnrc_sixlowpan
USEMODULE += gnrc_nettype_sixlowpan
USEMODULE += sixlowpan
ifneq (,$(filter gnrc_netif,$(USEMODULE)))
USEMODULE += gnrc_netif_6lo
endif
endif
ifneq (,$(filter gnrc_sixlowpan_ctx,$(USEMODULE)))

View File

@ -33,6 +33,7 @@ PSEUDOMODULES += gnrc_netapi_callbacks
PSEUDOMODULES += gnrc_netapi_mbox
PSEUDOMODULES += gnrc_netif_events
PSEUDOMODULES += gnrc_pktbuf_cmd
PSEUDOMODULES += gnrc_netif_6lo
PSEUDOMODULES += gnrc_netif_cmd_%
PSEUDOMODULES += gnrc_netif_dedup
PSEUDOMODULES += gnrc_nettype_%

View File

@ -94,11 +94,11 @@ static void _netif_init(gnrc_netif_t *netif)
/* save the threads context pointer, so we can set its flags */
_netif_thread = (thread_t *)thread_get(thread_getpid());
#ifdef MODULE_GNRC_SIXLOWPAN
#if IS_USED(MODULE_GNRC_NETIF_6LO)
/* we disable fragmentation for this device, as the L2CAP layer takes care
* of this */
_nimble_netif->sixlo.max_frag_size = 0;
#endif
#endif /* IS_USED(MODULE_GNRC_NETIF_6LO) */
}
static int _send_pkt(nimble_netif_conn_t *conn, gnrc_pktsnip_t *pkt)

View File

@ -38,7 +38,7 @@
#if IS_USED(MODULE_GNRC_NETIF_LORAWAN)
#include "net/gnrc/netif/lorawan.h"
#endif
#ifdef MODULE_GNRC_SIXLOWPAN
#if IS_USED(MODULE_GNRC_NETIF_6LO)
#include "net/gnrc/netif/6lo.h"
#endif
#if defined(MODULE_GNRC_NETIF_DEDUP) && (GNRC_NETIF_L2ADDR_MAXLEN > 0)
@ -129,7 +129,7 @@ typedef struct {
gnrc_netif_dedup_t last_pkt;
#endif
#endif
#if defined(MODULE_GNRC_SIXLOWPAN) || DOXYGEN
#if IS_USED(MODULE_GNRC_NETIF_6LO) || defined(DOXYGEN)
gnrc_netif_6lo_t sixlo; /**< 6Lo component */
#endif
uint8_t cur_hl; /**< Current hop-limit for out-going packets */

View File

@ -1296,14 +1296,14 @@ static void _test_options(gnrc_netif_t *netif)
assert((IEEE802154_SHORT_ADDRESS_LEN == netif->l2addr_len) ||
(IEEE802154_LONG_ADDRESS_LEN == netif->l2addr_len));
#ifdef MODULE_GNRC_IPV6
#ifdef MODULE_GNRC_SIXLOWPAN
#if IS_USED(MODULE_GNRC_NETIF_6LO)
assert(netif->ipv6.mtu == IPV6_MIN_MTU);
assert(netif->sixlo.max_frag_size > 0);
assert(-ENOTSUP != netif->dev->driver->get(netif->dev, NETOPT_PROTO,
&tmp, sizeof(tmp)));
#else /* MODULE_GNRC_SIXLOWPAN */
#else /* IS_USED(MODULE_GNRC_NETIF_6LO) */
assert(netif->ipv6.mtu < UINT16_MAX);
#endif /* MODULE_GNRC_SIXLOWPAN */
#endif /* IS_USED(MODULE_GNRC_NETIF_6LO) */
#endif /* MODULE_GNRC_IPV6 */
#ifdef MODULE_GNRC_SIXLOWPAN_ND
assert((netif->device_type != NETDEV_TYPE_IEEE802154) ||

View File

@ -144,12 +144,12 @@ void gnrc_netif_ipv6_init_mtu(gnrc_netif_t *netif)
res = dev->driver->get(dev, NETOPT_MAX_PDU_SIZE,
&tmp, sizeof(tmp));
assert(res == sizeof(tmp));
#ifdef MODULE_GNRC_SIXLOWPAN
#if IS_USED(MODULE_GNRC_NETIF_6LO)
netif->ipv6.mtu = MAX(IPV6_MIN_MTU, tmp);
netif->sixlo.max_frag_size = tmp;
#else
#else /* IS_USED(MODULE_GNRC_NETIF_6LO) */
netif->ipv6.mtu = tmp;
#endif
#endif /* IS_USED(MODULE_GNRC_NETIF_6LO) */
break;
#endif /* defined(MODULE_NETDEV_IEEE802154) || defined(MODULE_NRFMIN) || \
* defined(MODULE_XBEE) || defined(MODULE_ESP_NOW) */