From 5c75f84d6ebaff242365c840432ec6b27198bc0a Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Wed, 27 Mar 2024 13:29:26 +0100 Subject: [PATCH] gnrc_netif: remove deprecated CONFIG_GNRC_NETIF_LORAWAN_NETIF_HDR --- examples/gnrc_lorawan/Makefile | 9 --- examples/gnrc_lorawan/app.config | 1 - sys/include/net/gnrc/netif/lorawan.h | 15 ----- sys/net/gnrc/netif/Kconfig | 12 ---- .../gnrc/netif/lorawan/gnrc_netif_lorawan.c | 58 ++++++++----------- 5 files changed, 23 insertions(+), 72 deletions(-) delete mode 100644 examples/gnrc_lorawan/app.config diff --git a/examples/gnrc_lorawan/Makefile b/examples/gnrc_lorawan/Makefile index fd41712596..30325e4f9e 100644 --- a/examples/gnrc_lorawan/Makefile +++ b/examples/gnrc_lorawan/Makefile @@ -47,15 +47,6 @@ include $(RIOTBASE)/Makefile.include # Check if being configured via Kconfig ifndef CONFIG_KCONFIG_USEMODULE_LORAWAN - - # Tell GNRC to encode LoRaWAN port in the GNRC netif header. - # This allows us to use `gnrc_txtsnd` to send data from the shell using the - # `txtsnd` command. - # - # Note: From Release 22.01 all GNRC LoRaWAN packets will include the netif - # header. Therefore this flag will be removed after that - CFLAGS += -DCONFIG_GNRC_NETIF_LORAWAN_NETIF_HDR - CFLAGS += -DCONFIG_LORAMAC_APP_KEY_DEFAULT=\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" CFLAGS += -DCONFIG_LORAMAC_NWK_KEY_DEFAULT=\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" CFLAGS += -DCONFIG_LORAMAC_APP_EUI_DEFAULT=\"BBBBBBBBBBBBBBBB\" diff --git a/examples/gnrc_lorawan/app.config b/examples/gnrc_lorawan/app.config deleted file mode 100644 index d130c323c1..0000000000 --- a/examples/gnrc_lorawan/app.config +++ /dev/null @@ -1 +0,0 @@ -CONFIG_GNRC_NETIF_LORAWAN_NETIF_HDR=y diff --git a/sys/include/net/gnrc/netif/lorawan.h b/sys/include/net/gnrc/netif/lorawan.h index 78d0760672..6a7546e10c 100644 --- a/sys/include/net/gnrc/netif/lorawan.h +++ b/sys/include/net/gnrc/netif/lorawan.h @@ -31,21 +31,6 @@ extern "C" { */ #define GNRC_NETIF_LORAWAN_FLAGS_LINK_CHECK (0x1U) -/** - * @brief Encode LoRaWAN port in GNRC netif header. - * - * When set, GNRC netif will interpret the destination address of the - * GNRC netif header as the LoRaWAN port. For downlinks, a GNRC netif header - * with the received port in destination field will be included in the - * first snip. - * - * @deprecated From Release 2021.10 all GNRC LoRaWAN packets will include - * the GNRC Netif header. Therefore this parameter will be removed - */ -#if defined(DOXYGEN) -#define CONFIG_GNRC_NETIF_LORAWAN_NETIF_HDR -#endif - /** * @brief GNRC LoRaWAN interface descriptor */ diff --git a/sys/net/gnrc/netif/Kconfig b/sys/net/gnrc/netif/Kconfig index a77bc9fd96..364ef3e62c 100644 --- a/sys/net/gnrc/netif/Kconfig +++ b/sys/net/gnrc/netif/Kconfig @@ -44,18 +44,6 @@ config GNRC_NETIF_NONSTANDARD_6LO_MTU This is non compliant with RFC 4944 and RFC 7668 and might not be supported by other implementations. -config GNRC_NETIF_LORAWAN_NETIF_HDR - bool "Encode LoRaWAN port in GNRC netif header" - depends on USEMODULE_GNRC_LORAWAN - help - When set, GNRC Netif will interpret - the destination address of the GNRC netif header as - the LoRaWAN port. For downlinks, a GNRC netif header - with the received port in destination field will be - included in the first snip. From Release 2021.10 all - GNRC LoRaWAN packets will include the GNRC Netif - header. Therefore this parameter will be removed - config GNRC_NETIF_IPV6_BR_AUTO_6CTX bool "Automatically add 6LoWPAN compression at border router" default y diff --git a/sys/net/gnrc/netif/lorawan/gnrc_netif_lorawan.c b/sys/net/gnrc/netif/lorawan/gnrc_netif_lorawan.c index b151c6c52c..ed68289fdf 100644 --- a/sys/net/gnrc/netif/lorawan/gnrc_netif_lorawan.c +++ b/sys/net/gnrc/netif/lorawan/gnrc_netif_lorawan.c @@ -123,12 +123,8 @@ static inline void _set_be_addr(gnrc_lorawan_t *mac, uint8_t *be_addr) void gnrc_lorawan_mcps_indication(gnrc_lorawan_t *mac, mcps_indication_t *ind) { gnrc_netif_t *netif = container_of(mac, gnrc_netif_t, lorawan.mac); - gnrc_nettype_t nettype = IS_ACTIVE(CONFIG_GNRC_NETIF_LORAWAN_NETIF_HDR) - ? GNRC_NETTYPE_UNDEF - : GNRC_NETTYPE_LORAWAN; - uint32_t demux = IS_ACTIVE(CONFIG_GNRC_NETIF_LORAWAN_NETIF_HDR) - ? GNRC_NETREG_DEMUX_CTX_ALL - : ind->data.port; + gnrc_nettype_t nettype = GNRC_NETTYPE_UNDEF; + uint32_t demux = GNRC_NETREG_DEMUX_CTX_ALL; assert(ind->data.port >= LORAMAC_PORT_MIN && ind->data.port <= LORAMAC_PORT_MAX); @@ -141,20 +137,18 @@ void gnrc_lorawan_mcps_indication(gnrc_lorawan_t *mac, mcps_indication_t *ind) return; } - if (IS_ACTIVE(CONFIG_GNRC_NETIF_LORAWAN_NETIF_HDR)) { - gnrc_pktsnip_t *netif_snip = gnrc_netif_hdr_build(NULL, 0, - &ind->data.port, - sizeof(ind->data.port)); - if (netif_snip == NULL) { - DEBUG("gnrc_lorawan_netif: no space left in packet buffer\n"); - goto release; - } - - gnrc_netif_hdr_t *hdr = netif_snip->data; - gnrc_netif_hdr_set_netif(hdr, netif); - pkt = gnrc_pkt_append(pkt, netif_snip); + gnrc_pktsnip_t *netif_snip = gnrc_netif_hdr_build(NULL, 0, + &ind->data.port, + sizeof(ind->data.port)); + if (netif_snip == NULL) { + DEBUG("gnrc_lorawan_netif: no space left in packet buffer\n"); + goto release; } + gnrc_netif_hdr_t *hdr = netif_snip->data; + gnrc_netif_hdr_set_netif(hdr, netif); + pkt = gnrc_pkt_append(pkt, netif_snip); + if (!gnrc_netapi_dispatch_receive(nettype, demux, pkt)) { DEBUG("gnrc_lorawan_netif: unable to forward packet\n"); goto release; @@ -363,6 +357,8 @@ static gnrc_pktsnip_t *_recv(gnrc_netif_t *netif) static int _send(gnrc_netif_t *netif, gnrc_pktsnip_t *payload) { + gnrc_netif_hdr_t *netif_hdr; + const uint8_t *dst; mlme_request_t mlme_request; mlme_confirm_t mlme_confirm; @@ -371,26 +367,18 @@ static int _send(gnrc_netif_t *netif, gnrc_pktsnip_t *payload) assert(payload); - if (IS_ACTIVE(CONFIG_GNRC_NETIF_LORAWAN_NETIF_HDR)) { - gnrc_netif_hdr_t *netif_hdr; - const uint8_t *dst; - netif_hdr = payload->data; - dst = gnrc_netif_hdr_get_dst_addr(netif_hdr); + netif_hdr = payload->data; + dst = gnrc_netif_hdr_get_dst_addr(netif_hdr); - assert(payload->type == GNRC_NETTYPE_NETIF); - port = dst[0]; - - if (netif_hdr->dst_l2addr_len != sizeof(port)) { - goto end; - } - - /* Remove the netif hdr snip and point to the MSDU */ - payload = gnrc_pktbuf_remove_snip(payload, payload); + assert(payload->type == GNRC_NETTYPE_NETIF); + port = dst[0]; + if (netif_hdr->dst_l2addr_len != sizeof(port)) { + goto end; } - else { - port = netif->lorawan.port; - } + + /* Remove the netif hdr snip and point to the MSDU */ + payload = gnrc_pktbuf_remove_snip(payload, payload); if (netif->lorawan.flags & GNRC_NETIF_LORAWAN_FLAGS_LINK_CHECK) { mlme_request.type = MLME_LINK_CHECK;