From 32a1e15499e524e9b3c2cfc0ff40d777e6ff1ff7 Mon Sep 17 00:00:00 2001 From: Jeremy Wood Date: Thu, 20 Sep 2018 14:16:24 -0700 Subject: [PATCH 1/3] nimble/host: Convert BLE_GAP_MAX_UPDATE_ENTRIES from define to syscfg. Previously, BLE_GAP_MAX_UPDATE_ENTRIES was a define in ble_gap.c. Now it's a syscfg in nimble/host/syscfg.yml. There are cases where this value needs to be increased to support multiple simultaneous connections. --- nimble/host/src/ble_gap.c | 6 ++---- nimble/host/syscfg.yml | 6 ++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/nimble/host/src/ble_gap.c b/nimble/host/src/ble_gap.c index 9e71a5d55..121c5c759 100644 --- a/nimble/host/src/ble_gap.c +++ b/nimble/host/src/ble_gap.c @@ -87,8 +87,6 @@ #define BLE_GAP_UPDATE_TIMEOUT_MS 30000 /* ms */ -#define BLE_GAP_MAX_UPDATE_ENTRIES 1 - static const struct ble_gap_conn_params ble_gap_conn_params_dflt = { .scan_itvl = 0x0010, .scan_window = 0x0010, @@ -188,7 +186,7 @@ struct ble_gap_snapshot { static SLIST_HEAD(ble_gap_hook_list, ble_gap_event_listener) ble_gap_event_listener_list; static os_membuf_t ble_gap_update_entry_mem[ - OS_MEMPOOL_SIZE(BLE_GAP_MAX_UPDATE_ENTRIES, + OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_GAP_MAX_UPDATE_ENTRIES), sizeof (struct ble_gap_update_entry))]; static struct os_mempool ble_gap_update_entry_pool; static struct ble_gap_update_entry_list ble_gap_update_entries; @@ -4747,7 +4745,7 @@ ble_gap_init(void) SLIST_INIT(&ble_gap_event_listener_list); rc = os_mempool_init(&ble_gap_update_entry_pool, - BLE_GAP_MAX_UPDATE_ENTRIES, + MYNEWT_VAL(BLE_GAP_MAX_UPDATE_ENTRIES), sizeof (struct ble_gap_update_entry), ble_gap_update_entry_mem, "ble_gap_update"); diff --git a/nimble/host/syscfg.yml b/nimble/host/syscfg.yml index fe601e7f6..1218a9e52 100644 --- a/nimble/host/syscfg.yml +++ b/nimble/host/syscfg.yml @@ -171,6 +171,12 @@ syscfg.defs: for debugging. value: 0 + # GAP options. + BLE_GAP_MAX_UPDATE_ENTRIES: + description: > + The maximum number of GAP update entries. (0/1) + value: 1 + # Supported GATT procedures. By default: # o Notify and indicate are enabled; # o All other procedures are enabled for centrals. From 7252a28c9e606ef24047f893ac514a041bca3dbd Mon Sep 17 00:00:00 2001 From: Jeremy Wood Date: Mon, 24 Sep 2018 09:53:56 -0700 Subject: [PATCH 2/3] nimble/host: Change BLE_GAP_MAX_UPDATE_ENTRIES to more descriptive BLE_GAP_MAX_PENDING_CONN_PARAM_UPDATE. --- nimble/host/src/ble_gap.c | 4 ++-- nimble/host/syscfg.yml | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/nimble/host/src/ble_gap.c b/nimble/host/src/ble_gap.c index 121c5c759..b315f0124 100644 --- a/nimble/host/src/ble_gap.c +++ b/nimble/host/src/ble_gap.c @@ -186,7 +186,7 @@ struct ble_gap_snapshot { static SLIST_HEAD(ble_gap_hook_list, ble_gap_event_listener) ble_gap_event_listener_list; static os_membuf_t ble_gap_update_entry_mem[ - OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_GAP_MAX_UPDATE_ENTRIES), + OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_GAP_MAX_PENDING_CONN_PARAM_UPDATE), sizeof (struct ble_gap_update_entry))]; static struct os_mempool ble_gap_update_entry_pool; static struct ble_gap_update_entry_list ble_gap_update_entries; @@ -4745,7 +4745,7 @@ ble_gap_init(void) SLIST_INIT(&ble_gap_event_listener_list); rc = os_mempool_init(&ble_gap_update_entry_pool, - MYNEWT_VAL(BLE_GAP_MAX_UPDATE_ENTRIES), + MYNEWT_VAL(BLE_GAP_MAX_PENDING_CONN_PARAM_UPDATE), sizeof (struct ble_gap_update_entry), ble_gap_update_entry_mem, "ble_gap_update"); diff --git a/nimble/host/syscfg.yml b/nimble/host/syscfg.yml index 1218a9e52..df49742cd 100644 --- a/nimble/host/syscfg.yml +++ b/nimble/host/syscfg.yml @@ -172,9 +172,11 @@ syscfg.defs: value: 0 # GAP options. - BLE_GAP_MAX_UPDATE_ENTRIES: + BLE_GAP_MAX_PENDING_CONN_PARAM_UPDATE: description: > - The maximum number of GAP update entries. (0/1) + Controls the number of connection parameter updates that can be pending + simultaneously. Devices with many concurrent connections may need + to increase this value. value: 1 # Supported GATT procedures. By default: From bbf67ae5947a4fb3af0e3804f7e0d556390dd17c Mon Sep 17 00:00:00 2001 From: Jeremy Wood Date: Mon, 24 Sep 2018 22:57:49 -0700 Subject: [PATCH 3/3] nimble/host: Add MYNEWT_VAL_BLE_GAP_MAX_PENDING_CONN_PARAM_UPDATE to porting syscfg.h's. --- porting/examples/linux/include/syscfg/syscfg.h | 4 ++++ porting/nimble/include/syscfg/syscfg.h | 4 ++++ porting/npl/riot/include/syscfg/syscfg.h | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/porting/examples/linux/include/syscfg/syscfg.h b/porting/examples/linux/include/syscfg/syscfg.h index 6b3f3f86a..766d13337 100644 --- a/porting/examples/linux/include/syscfg/syscfg.h +++ b/porting/examples/linux/include/syscfg/syscfg.h @@ -493,6 +493,10 @@ #define MYNEWT_VAL_BLE_ATT_SVR_WRITE_NO_RSP (1) #endif +#ifndef MYNEWT_VAL_BLE_GAP_MAX_PENDING_CONN_PARAM_UPDATE +#define MYNEWT_VAL_BLE_GAP_MAX_PENDING_CONN_PARAM_UPDATE (1) +#endif + #ifndef MYNEWT_VAL_BLE_GATT_DISC_ALL_CHRS #define MYNEWT_VAL_BLE_GATT_DISC_ALL_CHRS (MYNEWT_VAL_BLE_ROLE_CENTRAL) #endif diff --git a/porting/nimble/include/syscfg/syscfg.h b/porting/nimble/include/syscfg/syscfg.h index e4996785f..8d58db968 100644 --- a/porting/nimble/include/syscfg/syscfg.h +++ b/porting/nimble/include/syscfg/syscfg.h @@ -478,6 +478,10 @@ #define MYNEWT_VAL_BLE_ATT_SVR_WRITE_NO_RSP (1) #endif +#ifndef MYNEWT_VAL_BLE_GAP_MAX_PENDING_CONN_PARAM_UPDATE +#define MYNEWT_VAL_BLE_GAP_MAX_PENDING_CONN_PARAM_UPDATE (1) +#endif + #ifndef MYNEWT_VAL_BLE_GATT_DISC_ALL_CHRS #define MYNEWT_VAL_BLE_GATT_DISC_ALL_CHRS (MYNEWT_VAL_BLE_ROLE_CENTRAL) #endif diff --git a/porting/npl/riot/include/syscfg/syscfg.h b/porting/npl/riot/include/syscfg/syscfg.h index c613f460e..11985c3fe 100644 --- a/porting/npl/riot/include/syscfg/syscfg.h +++ b/porting/npl/riot/include/syscfg/syscfg.h @@ -681,6 +681,10 @@ #define MYNEWT_VAL_BLE_ATT_SVR_WRITE_NO_RSP (1) #endif +#ifndef MYNEWT_VAL_BLE_GAP_MAX_PENDING_CONN_PARAM_UPDATE +#define MYNEWT_VAL_BLE_GAP_MAX_PENDING_CONN_PARAM_UPDATE (1) +#endif + #ifndef MYNEWT_VAL_BLE_GATT_DISC_ALL_CHRS #define MYNEWT_VAL_BLE_GATT_DISC_ALL_CHRS (MYNEWT_VAL_BLE_ROLE_CENTRAL) #endif