Bluetooth: OTS: Add configuration for OTS channel TX mtu

Add configuration for Object Transfer Service channel MTU for outgoing
L2CAP SDUs.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2021-06-04 16:39:36 +02:00 committed by Christopher Friedt
commit 9f989a0b00
2 changed files with 9 additions and 4 deletions

View file

@ -60,6 +60,11 @@ config BT_OTS_OLCP_GO_TO_SUPPORT
bool "Support OLCP Go To Operation"
default y
config BT_OTS_L2CAP_CHAN_TX_MTU
int "Size of TX MTU for Object Transfer Channel"
default 256
range 21 65533
config BT_OTS_L2CAP_CHAN_RX_MTU
int "Size of RX MTU for Object Transfer Channel"
# RX MTU will be truncated to account for the L2CAP PDU and SDU header.

View file

@ -26,9 +26,9 @@ LOG_MODULE_DECLARE(bt_ots, CONFIG_BT_OTS_LOG_LEVEL);
*/
#define BT_GATT_OTS_L2CAP_PSM 0x0025
/* Maximum size of outgoing data. */
#define OT_TX_MTU 256
NET_BUF_POOL_FIXED_DEFINE(ot_chan_tx_pool, 1, BT_L2CAP_SDU_BUF_SIZE(OT_TX_MTU),
NET_BUF_POOL_FIXED_DEFINE(ot_chan_tx_pool, 1,
BT_L2CAP_SDU_BUF_SIZE(CONFIG_BT_OTS_L2CAP_CHAN_TX_MTU),
NULL);
#if (CONFIG_BT_OTS_L2CAP_CHAN_RX_MTU > BT_L2CAP_SDU_RX_MTU)
@ -46,7 +46,7 @@ static int ots_l2cap_send(struct bt_gatt_ots_l2cap *l2cap_ctx)
uint32_t len;
/* Calculate maximum length of data chunk. */
len = MIN(l2cap_ctx->ot_chan.tx.mtu, OT_TX_MTU);
len = MIN(l2cap_ctx->ot_chan.tx.mtu, CONFIG_BT_OTS_L2CAP_CHAN_TX_MTU);
len = MIN(len, l2cap_ctx->tx.len - l2cap_ctx->tx.len_sent);
/* Prepare buffer for sending. */