tsch: add start sending EB when a node joins RPL newwork in tsch.

This commit is contained in:
Takeshi Sakoda 2018-11-21 17:27:35 +09:00
parent 666e4263cd
commit 3a1d604418
2 changed files with 18 additions and 0 deletions

View File

@ -862,6 +862,12 @@ PROCESS_THREAD(tsch_send_eb_process, ev, data)
unsigned long delay; unsigned long delay;
if(tsch_is_associated && tsch_current_eb_period > 0) { if(tsch_is_associated && tsch_current_eb_period > 0) {
#ifdef TSCH_RPL_CHECK_DODAG_JOINED
/* Implementation section 6.3 of RFC 8180 */
if(!TSCH_RPL_CHECK_DODAG_JOINED()) {
goto tsch_send_eb_skipped;
}
#endif /* TSCH_RPL_CHECK_DODAG_JOINED */
/* Enqueue EB only if there isn't already one in queue */ /* Enqueue EB only if there isn't already one in queue */
if(tsch_queue_packet_count(&tsch_eb_address) == 0) { if(tsch_queue_packet_count(&tsch_eb_address) == 0) {
uint8_t hdr_len = 0; uint8_t hdr_len = 0;
@ -881,6 +887,9 @@ PROCESS_THREAD(tsch_send_eb_process, ev, data)
} }
} }
} }
#ifdef TSCH_RPL_CHECK_DODAG_JOINED
tsch_send_eb_skipped:
#endif /* TSCH_RPL_CHECK_DODAG_JOINED */
if(tsch_current_eb_period > 0) { if(tsch_current_eb_period > 0) {
/* Next EB transmission with a random delay /* Next EB transmission with a random delay
* within [tsch_current_eb_period*0.75, tsch_current_eb_period[ */ * within [tsch_current_eb_period*0.75, tsch_current_eb_period[ */

View File

@ -88,6 +88,10 @@ frequency hopping for enhanced reliability.
#define TSCH_CALLBACK_KA_SENT tsch_rpl_callback_ka_sent #define TSCH_CALLBACK_KA_SENT tsch_rpl_callback_ka_sent
#endif /* TSCH_CALLBACK_KA_SENT */ #endif /* TSCH_CALLBACK_KA_SENT */
#ifndef TSCH_RPL_CHECK_DODAG_JOINED
#define TSCH_RPL_CHECK_DODAG_JOINED tsch_rpl_check_dodag_joined
#endif /* TSCH_RPL_CHECK_DODAG_JOINED */
#endif /* UIP_CONF_IPV6_RPL */ #endif /* UIP_CONF_IPV6_RPL */
#if BUILD_WITH_ORCHESTRA #if BUILD_WITH_ORCHESTRA
@ -117,6 +121,11 @@ void TSCH_CALLBACK_LEAVING_NETWORK();
void TSCH_CALLBACK_KA_SENT(); void TSCH_CALLBACK_KA_SENT();
#endif #endif
/* Called by TSCH before sending a EB */
#ifdef TSCH_RPL_CHECK_DODAG_JOINED
int TSCH_RPL_CHECK_DODAG_JOINED();
#endif
/* Called by TSCH form interrupt after receiving a frame, enabled upper-layer to decide /* Called by TSCH form interrupt after receiving a frame, enabled upper-layer to decide
* whether to ACK or NACK */ * whether to ACK or NACK */
#ifdef TSCH_CALLBACK_DO_NACK #ifdef TSCH_CALLBACK_DO_NACK