From 58281e91357d0d781b91039394307d3868cb59f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Nohlg=C3=A5rd?= Date: Sat, 30 Jun 2018 15:35:05 +0200 Subject: [PATCH 1/2] 6lo: Set more data flag on all but last frag --- .../sixlowpan/frag/gnrc_sixlowpan_frag.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sys/net/gnrc/network_layer/sixlowpan/frag/gnrc_sixlowpan_frag.c b/sys/net/gnrc/network_layer/sixlowpan/frag/gnrc_sixlowpan_frag.c index f2197eb97d..e0061596ec 100644 --- a/sys/net/gnrc/network_layer/sixlowpan/frag/gnrc_sixlowpan_frag.c +++ b/sys/net/gnrc/network_layer/sixlowpan/frag/gnrc_sixlowpan_frag.c @@ -117,6 +117,10 @@ static uint16_t _send_1st_fragment(gnrc_netif_t *iface, gnrc_pktsnip_t *pkt, hdr->disp_size.u8[0] |= SIXLOWPAN_FRAG_1_DISP; hdr->tag = byteorder_htons(_tag); + /* Tell the link layer that we will send more fragments */ + gnrc_netif_hdr_t *netif_hdr = frag->data; + netif_hdr->flags |= GNRC_NETIF_HDR_FLAGS_MORE_DATA; + pkt = pkt->next; /* don't copy netif header */ while (pkt != NULL) { @@ -182,6 +186,13 @@ static uint16_t _send_nth_fragment(gnrc_netif_t *iface, gnrc_pktsnip_t *pkt, memcpy(data, ((uint8_t *)pkt->data) + pkt_offset, clen); local_offset = clen; + if (local_offset == max_frag_size) { + if ((clen < (pkt->size - pkt_offset)) || (pkt->next != NULL)) { + /* Tell the link layer that we will send more fragments */ + gnrc_netif_hdr_t *netif_hdr = frag->data; + netif_hdr->flags |= GNRC_NETIF_HDR_FLAGS_MORE_DATA; + } + } pkt = pkt->next; break; } @@ -197,6 +208,11 @@ static uint16_t _send_nth_fragment(gnrc_netif_t *iface, gnrc_pktsnip_t *pkt, local_offset += clen; if (local_offset == max_frag_size) { + if ((clen < pkt->size) || (pkt->next != NULL)) { + /* Tell the link layer that we will send more fragments */ + gnrc_netif_hdr_t *netif_hdr = frag->data; + netif_hdr->flags |= GNRC_NETIF_HDR_FLAGS_MORE_DATA; + } break; } From 3cc088689e11094ffaa0c3ea36d41b5636abf14e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Nohlg=C3=A5rd?= Date: Tue, 14 Aug 2018 10:08:52 +0200 Subject: [PATCH 2/2] 6lo: Speling correction in comment --- sys/net/gnrc/network_layer/sixlowpan/frag/gnrc_sixlowpan_frag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/gnrc/network_layer/sixlowpan/frag/gnrc_sixlowpan_frag.c b/sys/net/gnrc/network_layer/sixlowpan/frag/gnrc_sixlowpan_frag.c index e0061596ec..a873267e34 100644 --- a/sys/net/gnrc/network_layer/sixlowpan/frag/gnrc_sixlowpan_frag.c +++ b/sys/net/gnrc/network_layer/sixlowpan/frag/gnrc_sixlowpan_frag.c @@ -259,7 +259,7 @@ void gnrc_sixlowpan_frag_send(gnrc_pktsnip_t *pkt, void *ctx, unsigned page) } #endif - /* Check weater to send the first or an Nth fragment */ + /* Check whether to send the first or an Nth fragment */ if (fragment_msg->offset == 0) { /* increment tag for successive, fragmented datagrams */ _tag++;