From 3471c3b8c1f3be6e958a2b1e05d08dc8823b057e Mon Sep 17 00:00:00 2001 From: Juha Heiskanen Date: Mon, 4 May 2020 13:08:39 +0300 Subject: [PATCH] Add possibility to configure Mesh MAC neighbourtable size. Accepted values are 5-255. MAC neighbour table size is limited to 8-bit number so thats why 255 is max value. --- features/nanostack/mbed-mesh-api/mbed_lib.json | 6 ++++++ features/nanostack/mbed-mesh-api/source/nd_tasklet.c | 2 +- features/nanostack/mbed-mesh-api/source/thread_tasklet.c | 2 +- features/nanostack/mbed-mesh-api/source/wisun_tasklet.c | 3 ++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/features/nanostack/mbed-mesh-api/mbed_lib.json b/features/nanostack/mbed-mesh-api/mbed_lib.json index 5a1ca84f10..e61c13cda3 100644 --- a/features/nanostack/mbed-mesh-api/mbed_lib.json +++ b/features/nanostack/mbed-mesh-api/mbed_lib.json @@ -6,6 +6,12 @@ "help": "Nanostack's heap size [bytes: 0-‭4294967295‬]", "value": 32500 }, + "mac-neigh-table-size": { + "help": "Number of devices stored to the SW MAC neighbour table", + "value_min": 5, + "value_max": 255, + "value": 32 + }, "use-malloc-for-heap": { "help": "Use `malloc()` for reserving the Nanostack's internal heap.", "value": false diff --git a/features/nanostack/mbed-mesh-api/source/nd_tasklet.c b/features/nanostack/mbed-mesh-api/source/nd_tasklet.c index 8500553d01..be711054b3 100644 --- a/features/nanostack/mbed-mesh-api/source/nd_tasklet.c +++ b/features/nanostack/mbed-mesh-api/source/nd_tasklet.c @@ -425,7 +425,7 @@ int8_t nd_tasklet_network_init(int8_t device_id) { // TODO, read interface name from configuration mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; + storage_sizes.device_decription_table_size = MBED_CONF_MBED_MESH_API_MAC_NEIGH_TABLE_SIZE; storage_sizes.key_description_table_size = 3; storage_sizes.key_lookup_size = 1; storage_sizes.key_usage_size = 3; diff --git a/features/nanostack/mbed-mesh-api/source/thread_tasklet.c b/features/nanostack/mbed-mesh-api/source/thread_tasklet.c index 59718b8608..300707f761 100644 --- a/features/nanostack/mbed-mesh-api/source/thread_tasklet.c +++ b/features/nanostack/mbed-mesh-api/source/thread_tasklet.c @@ -461,7 +461,7 @@ int8_t thread_tasklet_network_init(int8_t device_id) { // TODO, read interface name from configuration mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; + storage_sizes.device_decription_table_size = MBED_CONF_MBED_MESH_API_MAC_NEIGH_TABLE_SIZE; storage_sizes.key_description_table_size = 6; storage_sizes.key_lookup_size = 1; storage_sizes.key_usage_size = 3; diff --git a/features/nanostack/mbed-mesh-api/source/wisun_tasklet.c b/features/nanostack/mbed-mesh-api/source/wisun_tasklet.c index f51d140526..df1915816c 100644 --- a/features/nanostack/mbed-mesh-api/source/wisun_tasklet.c +++ b/features/nanostack/mbed-mesh-api/source/wisun_tasklet.c @@ -38,6 +38,7 @@ #include MBED_CONF_MBED_MESH_API_CERTIFICATE_HEADER #endif + // For tracing we need to define flag, have include and define group //#define HAVE_DEBUG #define TRACE_GROUP "WSND" @@ -581,7 +582,7 @@ int8_t wisun_tasklet_network_init(int8_t device_id) { // TODO, read interface name from configuration mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; + storage_sizes.device_decription_table_size = MBED_CONF_MBED_MESH_API_MAC_NEIGH_TABLE_SIZE; storage_sizes.key_description_table_size = 4; storage_sizes.key_lookup_size = 1; storage_sizes.key_usage_size = 3;