Orchestra: handle case where ORCHESTRA_UNICAST_PERIOD is smaller than the network size

This commit is contained in:
Simon Duquennoy 2016-05-20 13:40:20 +02:00
parent 366231f601
commit 287b4767e3

View file

@ -85,10 +85,16 @@ add_uc_link(const linkaddr_t *linkaddr)
{
if(linkaddr != NULL) {
uint16_t timeslot = get_node_timeslot(linkaddr);
tsch_schedule_add_link(sf_unicast,
ORCHESTRA_UNICAST_SENDER_BASED ? LINK_OPTION_RX : LINK_OPTION_TX | UNICAST_SLOT_SHARED_FLAG,
LINK_TYPE_NORMAL, &tsch_broadcast_address,
timeslot, channel_offset);
uint8_t link_options = ORCHESTRA_UNICAST_SENDER_BASED ? LINK_OPTION_RX : LINK_OPTION_TX | UNICAST_SLOT_SHARED_FLAG;
if(timeslot == get_node_timeslot(&linkaddr_node_addr)) {
/* This is also our timeslot, add necessary flags */
link_options |= ORCHESTRA_UNICAST_SENDER_BASED ? LINK_OPTION_TX | UNICAST_SLOT_SHARED_FLAG: LINK_OPTION_RX;
}
/* Add/update link */
tsch_schedule_add_link(sf_unicast, link_options, LINK_TYPE_NORMAL, &tsch_broadcast_address,
timeslot, channel_offset);
}
}
/*---------------------------------------------------------------------------*/
@ -123,7 +129,17 @@ remove_uc_link(const linkaddr_t *linkaddr)
}
item = nbr_table_next(nbr_routes, item);
}
tsch_schedule_remove_link(sf_unicast, l);
/* Do we need this timeslot? */
if(timeslot == get_node_timeslot(&linkaddr_node_addr)) {
/* This is our link, keep it but update the link options */
uint8_t link_options = ORCHESTRA_UNICAST_SENDER_BASED ? LINK_OPTION_TX | UNICAST_SLOT_SHARED_FLAG: LINK_OPTION_RX;
tsch_schedule_add_link(sf_unicast, link_options, LINK_TYPE_NORMAL, &tsch_broadcast_address,
timeslot, channel_offset);
} else {
/* Remove link */
tsch_schedule_remove_link(sf_unicast, l);
}
}
/*---------------------------------------------------------------------------*/
static void