Bluetooth: GATT: Allocate request from a memory slab

This should reduce the footprint on applications that do a lot of
requests i.e have a lot of subscriptions.

Fixes #21103

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2019-12-30 10:45:35 -08:00 committed by Johan Hedberg
commit d278cdc3d7
6 changed files with 73 additions and 42 deletions

View file

@ -43,23 +43,6 @@ extern "C" {
#define BT_ATT_ERR_PROCEDURE_IN_PROGRESS 0xfe
#define BT_ATT_ERR_OUT_OF_RANGE 0xff
typedef void (*bt_att_func_t)(struct bt_conn *conn, u8_t err,
const void *pdu, u16_t length,
void *user_data);
typedef void (*bt_att_destroy_t)(void *user_data);
/* ATT request context */
struct bt_att_req {
sys_snode_t node;
bt_att_func_t func;
bt_att_destroy_t destroy;
struct net_buf_simple_state state;
struct net_buf *buf;
#if defined(CONFIG_BT_SMP)
bool retrying;
#endif /* CONFIG_BT_SMP */
};
#ifdef __cplusplus
}
#endif

View file

@ -879,7 +879,6 @@ typedef void (*bt_gatt_indicate_func_t)(struct bt_conn *conn,
/** @brief GATT Indicate Value parameters */
struct bt_gatt_indicate_params {
struct bt_att_req _req;
/** Notification Attribute UUID type */
const struct bt_uuid *uuid;
/** Indicate Attribute object*/
@ -963,7 +962,6 @@ u16_t bt_gatt_get_mtu(struct bt_conn *conn);
/** @brief GATT Exchange MTU parameters */
struct bt_gatt_exchange_params {
struct bt_att_req _req;
/** Response callback */
void (*func)(struct bt_conn *conn, u8_t err,
struct bt_gatt_exchange_params *params);
@ -1040,7 +1038,6 @@ enum {
/** @brief GATT Discover Attributes parameters */
struct bt_gatt_discover_params {
struct bt_att_req _req;
/** Discover UUID type */
struct bt_uuid *uuid;
/** Discover attribute callback */
@ -1121,7 +1118,6 @@ typedef u8_t (*bt_gatt_read_func_t)(struct bt_conn *conn, u8_t err,
* @param uuid 2 or 16 octet UUID
*/
struct bt_gatt_read_params {
struct bt_att_req _req;
bt_gatt_read_func_t func;
size_t handle_count;
union {
@ -1174,7 +1170,6 @@ typedef void (*bt_gatt_write_func_t)(struct bt_conn *conn, u8_t err,
/** @brief GATT Write parameters */
struct bt_gatt_write_params {
struct bt_att_req _req;
/** Response callback */
bt_gatt_write_func_t func;
/** Attribute handle */
@ -1308,7 +1303,6 @@ enum {
/** @brief GATT Subscribe parameters */
struct bt_gatt_subscribe_params {
struct bt_att_req _req;
bt_addr_le_t _peer;
/** Notification value callback */
bt_gatt_notify_func_t notify;