mirror of
https://github.com/espressif/esp-idf.git
synced 2026-06-04 20:26:38 +03:00
fix(ble_mesh): ensure blob client/server work correctly with varying chunk sizes
(cherry picked from commit 3a8851422f)
Co-authored-by: luoxu <luoxu@espressif.com>
This commit is contained in:
@@ -341,8 +341,21 @@ static void blob_caps(struct bt_mesh_blob_cli *b,
|
||||
}
|
||||
|
||||
cli->xfer.blob.block_size_log = caps->max_block_size_log;
|
||||
#if CONFIG_BLE_MESH_LONG_PACKET
|
||||
if (cli->xfer.blob.chunk_enh_params.long_pkt_cfg_used) {
|
||||
cli->xfer.blob.chunk_size = MIN(caps->max_chunk_size, BLOB_TX_CHUNK_SIZE);
|
||||
} else {
|
||||
#if CONFIG_BLE_MESH_ALIGN_CHUNK_SIZE_TO_MAX_SEGMENT || \
|
||||
CONFIG_BLE_MESH_TX_BLOB_CHUNK_SIZE > BLOB_CHUNK_SIZE_MAX(BLE_MESH_EXT_TX_SDU_MAX)
|
||||
cli->xfer.blob.chunk_size = MIN(caps->max_chunk_size, BLOB_CHUNK_SIZE_MAX(BLE_MESH_TX_SDU_MAX));
|
||||
#else
|
||||
cli->xfer.blob.chunk_size = MIN(caps->max_chunk_size,
|
||||
CONFIG_BLE_MESH_TX_BLOB_CHUNK_SIZE);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
cli->xfer.blob.chunk_size = caps->max_chunk_size;
|
||||
|
||||
#endif
|
||||
/* If mode is not already set and server reported it supports all modes
|
||||
* default to PUSH, otherwise set value reported by server. If mode
|
||||
* was set and server supports all modes, keep old value; set
|
||||
|
||||
@@ -656,8 +656,11 @@ static void xfer_start_tx(struct bt_mesh_blob_cli *cli, uint16_t dst)
|
||||
net_buf_simple_add_le32(&buf, cli->xfer->size);
|
||||
net_buf_simple_add_u8(&buf, cli->xfer->block_size_log);
|
||||
#if CONFIG_BLE_MESH_LONG_PACKET
|
||||
/* todo: could let user select methold */
|
||||
net_buf_simple_add_le16(&buf, BLE_MESH_EXT_TX_SDU_MAX);
|
||||
if (cli->xfer->chunk_enh_params.long_pkt_cfg_used) {
|
||||
net_buf_simple_add_le16(&buf, BLE_MESH_EXT_TX_SDU_MAX);
|
||||
} else {
|
||||
net_buf_simple_add_le16(&buf, BLE_MESH_TX_SDU_MAX);
|
||||
}
|
||||
#else
|
||||
net_buf_simple_add_le16(&buf, BLE_MESH_TX_SDU_MAX);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user