Skip to content

Commit

Permalink
Configure Thread neighbour and destination cache (ARMmbed#2057)
Browse files Browse the repository at this point in the history
Adjust Thread devices neighbour and destination cache parameters.
  • Loading branch information
Arto Kinnunen authored Apr 11, 2019
1 parent 7d8dab4 commit db51b73
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 5 deletions.
7 changes: 5 additions & 2 deletions source/6LoWPAN/Thread/thread_bbr_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1144,8 +1144,11 @@ int thread_bbr_start(int8_t interface_id, int8_t backbone_interface_id)
// By default multicast forwarding is not enabled as it causes multicast loops
multicast_fwd_set_forwarding(this->interface_id, false);

// Adjust BBR neighbor and destination cache size
arm_nwk_ipv6_max_cache_entries(THREAD_BBR_IPV6_DESTINATION_CACHE_SIZE);
// Configure BBR neighbour cache parameters
arm_nwk_ipv6_neighbour_cache_configure(THREAD_BBR_IPV6_NEIGHBOUR_CACHE_SIZE,
THREAD_BBR_IPV6_NEIGHBOUR_CACHE_SHORT_TERM,
THREAD_BBR_IPV6_NEIGHBOUR_CACHE_LONG_TERM,
THREAD_BBR_IPV6_NEIGHBOUR_CACHE_LIFETIME);

thread_extension_bbr_init(interface_id, backbone_interface_id);

Expand Down
25 changes: 25 additions & 0 deletions source/6LoWPAN/Thread/thread_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,31 @@ static void thread_interface_bootsrap_mode_init(protocol_interface_info_entry_t
tr_debug("Set End node Mode");
cur->thread_info->thread_device_mode = THREAD_DEVICE_MODE_END_DEVICE;
}

if (cur->thread_info->thread_device_mode == THREAD_DEVICE_MODE_ROUTER) {
// set router neighbour cache
ipv6_neighbour_cache_configure(THREAD_ROUTER_IPV6_NEIGHBOUR_CACHE_SIZE,
THREAD_ROUTER_IPV6_NEIGHBOUR_CACHE_SHORT_TERM,
THREAD_ROUTER_IPV6_NEIGHBOUR_CACHE_LONG_TERM,
THREAD_ROUTER_IPV6_NEIGHBOUR_CACHE_LIFETIME);
// set router destination cache
ipv6_destination_cache_configure(THREAD_ROUTER_IPV6_DESTINATION_CACHE_SIZE,
THREAD_ROUTER_IPV6_DESTINATION_CACHE_SHORT_TERM,
THREAD_ROUTER_IPV6_DESTINATION_CACHE_LONG_TERM,
THREAD_ROUTER_IPV6_DESTINATION_CACHE_LIFETIME);
} else {
// device is some sort of end device
ipv6_neighbour_cache_configure(THREAD_END_DEVICE_IPV6_NEIGHBOUR_CACHE_SIZE,
THREAD_END_DEVICE_IPV6_NEIGHBOUR_CACHE_SHORT_TERM,
THREAD_END_DEVICE_IPV6_NEIGHBOUR_CACHE_LONG_TERM,
THREAD_END_DEVICE_IPV6_NEIGHBOUR_CACHE_LIFETIME);

ipv6_destination_cache_configure(THREAD_END_DEVICE_IPV6_DESTINATION_CACHE_SIZE,
THREAD_END_DEVICE_IPV6_DESTINATION_CACHE_SHORT_TERM,
THREAD_END_DEVICE_IPV6_DESTINATION_CACHE_LONG_TERM,
THREAD_END_DEVICE_IPV6_DESTINATION_CACHE_LIFETIME);
}

cur->thread_info->thread_attached_state = THREAD_STATE_NETWORK_DISCOVER;
}

Expand Down
29 changes: 26 additions & 3 deletions source/6LoWPAN/Thread/thread_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,34 @@
*/
#define THREAD_BBR_ROUTER_ID_REQUEST_STATUS THREAD_COAP_STATUS_TLV_HAVE_CHILD_ID_REQUEST

/*
* Number of destination and neighbor cache entries assuming 250 thread devices (worst case) connecting to cloud service.
/* Border Router IPv6 neighbour and destination cache configuration
* Number of neighbor cache entries assuming 250 thread devices (worst case) connecting to cloud service.
* Six entries reserved for backbone devices.
*/
#define THREAD_BBR_IPV6_DESTINATION_CACHE_SIZE 256
#define THREAD_BBR_IPV6_NEIGHBOUR_CACHE_SIZE 256
#define THREAD_BBR_IPV6_NEIGHBOUR_CACHE_SHORT_TERM 128
#define THREAD_BBR_IPV6_NEIGHBOUR_CACHE_LONG_TERM 32
#define THREAD_BBR_IPV6_NEIGHBOUR_CACHE_LIFETIME 600

/* Router IPv6 neighbour and destination cache configuration */
#define THREAD_ROUTER_IPV6_NEIGHBOUR_CACHE_SIZE 128
#define THREAD_ROUTER_IPV6_NEIGHBOUR_CACHE_SHORT_TERM 64
#define THREAD_ROUTER_IPV6_NEIGHBOUR_CACHE_LONG_TERM 8
#define THREAD_ROUTER_IPV6_NEIGHBOUR_CACHE_LIFETIME 600
#define THREAD_ROUTER_IPV6_DESTINATION_CACHE_SIZE 32
#define THREAD_ROUTER_IPV6_DESTINATION_CACHE_SHORT_TERM 16
#define THREAD_ROUTER_IPV6_DESTINATION_CACHE_LONG_TERM 4
#define THREAD_ROUTER_IPV6_DESTINATION_CACHE_LIFETIME 600

/* End device IPv6 neighbour and destination cache configuration */
#define THREAD_END_DEVICE_IPV6_NEIGHBOUR_CACHE_SIZE 32
#define THREAD_END_DEVICE_IPV6_NEIGHBOUR_CACHE_SHORT_TERM 16
#define THREAD_END_DEVICE_IPV6_NEIGHBOUR_CACHE_LONG_TERM 4
#define THREAD_END_DEVICE_IPV6_NEIGHBOUR_CACHE_LIFETIME 600
#define THREAD_END_DEVICE_IPV6_DESTINATION_CACHE_SIZE 16
#define THREAD_END_DEVICE_IPV6_DESTINATION_CACHE_SHORT_TERM 8
#define THREAD_END_DEVICE_IPV6_DESTINATION_CACHE_LONG_TERM 4
#define THREAD_END_DEVICE_IPV6_DESTINATION_CACHE_LIFETIME 600

/*
* Timeout to solicit address from DHCP if previous request fails.
Expand Down

0 comments on commit db51b73

Please sign in to comment.