Bluetooth: l2cap: Decouple segmentation size
L2CAP Tx segmentation used BT_L2CAP_RX_MTU value which is the value used by fixed channel protocols. Decoupling the buffer size provides the opportunity to reduce RAM used per connection. Change-id: Id064f9b2e3f02073402815d09c3ea13a35df2a6c Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
This commit is contained in:
parent
3807a9529d
commit
27bad8743f
2 changed files with 15 additions and 9 deletions
|
@ -267,6 +267,15 @@ config BLUETOOTH_L2CAP_DYNAMIC_CHANNEL
|
|||
This option enables support for LE Connection oriented Channels,
|
||||
allowing the creation of dynamic L2CAP Channels.
|
||||
|
||||
config BLUETOOTH_L2CAP_DYN_CHAN_BUF_SIZE
|
||||
int "L2CAP Dynamic channel segment buffer size"
|
||||
depends on BLUETOOTH_L2CAP_DYNAMIC_CHANNEL
|
||||
range 23 BLUETOOTH_L2CAP_TX_MTU
|
||||
default 23
|
||||
help
|
||||
Size of the buffer used for segmentation of SDU when application
|
||||
supplied buffer does not have sufficient headroom.
|
||||
|
||||
config BLUETOOTH_GATT_DYNAMIC_DB
|
||||
bool "GATT dynamic database support"
|
||||
help
|
||||
|
|
|
@ -41,6 +41,9 @@
|
|||
#define L2CAP_CONN_TIMEOUT K_SECONDS(40)
|
||||
#define L2CAP_DISC_TIMEOUT K_SECONDS(1)
|
||||
|
||||
static sys_slist_t le_channels;
|
||||
|
||||
#if defined(CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL)
|
||||
/* Size of MTU is based on the maximum amount of data the buffer can hold
|
||||
* excluding ACL and driver headers.
|
||||
*/
|
||||
|
@ -48,20 +51,14 @@
|
|||
/* For now use MPS - SDU length to disable segmentation */
|
||||
#define L2CAP_MAX_LE_MTU (L2CAP_MAX_LE_MPS - 2)
|
||||
|
||||
#if defined(CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL)
|
||||
#define l2cap_lookup_ident(conn, ident) __l2cap_lookup_ident(conn, ident, false)
|
||||
#define l2cap_remove_ident(conn, ident) __l2cap_lookup_ident(conn, ident, true)
|
||||
#endif /* CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL */
|
||||
|
||||
static sys_slist_t le_channels;
|
||||
#if defined(CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL)
|
||||
static sys_slist_t servers;
|
||||
#endif /* CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL */
|
||||
|
||||
#if defined(CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL)
|
||||
/* Pool for outgoing LE data packets, MTU is 23 */
|
||||
NET_BUF_POOL_DEFINE(le_data_pool, CONFIG_BLUETOOTH_MAX_CONN,
|
||||
BT_L2CAP_BUF_SIZE(L2CAP_MAX_LE_MPS),
|
||||
NET_BUF_POOL_DEFINE(le_l2cap_dyn_chan_pool, CONFIG_BLUETOOTH_MAX_CONN,
|
||||
BT_L2CAP_BUF_SIZE(CONFIG_BLUETOOTH_L2CAP_DYN_CHAN_BUF_SIZE),
|
||||
BT_BUF_USER_DATA_MIN, NULL);
|
||||
#endif /* CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL */
|
||||
|
||||
|
@ -1016,7 +1013,7 @@ static inline struct net_buf *l2cap_alloc_seg(struct net_buf *buf)
|
|||
}
|
||||
}
|
||||
|
||||
return bt_l2cap_create_pdu(&le_data_pool, 0);
|
||||
return bt_l2cap_create_pdu(&le_l2cap_dyn_chan_pool, 0);
|
||||
}
|
||||
|
||||
static struct net_buf *l2cap_chan_create_seg(struct bt_l2cap_le_chan *ch,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue