Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions subsys/bluetooth/mesh/blob_srv.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,13 @@
BLOB_CHUNK_SDU_LEN(srv->state.xfer.chunk_size),
BT_MESH_APP_SEG_SDU_MAX);

count = MIN(CONFIG_BT_MESH_BLOB_SRV_PULL_REQ_COUNT,
bt_mesh.lpn.queue_size / segments_per_chunk);
/* It is possible that the friend node cannot hold all segments per chunk. In this
* case, we should request at least 1 chunk. As requesting `0` would be invalid.
*/
count = MAX(1, MIN(CONFIG_BT_MESH_BLOB_SRV_PULL_REQ_COUNT,
bt_mesh.lpn.queue_size / segments_per_chunk));

}

Check notice on line 160 in subsys/bluetooth/mesh/blob_srv.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/bluetooth/mesh/blob_srv.c:160 - bt_mesh.lpn.queue_size / segments_per_chunk)); - + bt_mesh.lpn.queue_size / segments_per_chunk));
#endif

return MIN(count, missing_chunks(&srv->block));
Expand Down Expand Up @@ -821,7 +825,27 @@
net_buf_simple_add_u8(&rsp, BLOB_BLOCK_SIZE_LOG_MIN);
net_buf_simple_add_u8(&rsp, BLOB_BLOCK_SIZE_LOG_MAX);
net_buf_simple_add_le16(&rsp, CONFIG_BT_MESH_BLOB_CHUNK_COUNT_MAX);

#if defined(CONFIG_BT_MESH_LOW_POWER)
/* If friendship is established, then chunk size is according to friend's queue size.
* Chunk size = (Queue size * Segment size) - (Opcode (1) - Chunk Number (2)
* - 8 byte MIC (max))
*/
if (bt_mesh_lpn_established() && bt_mesh.lpn.queue_size > 0) {
uint16_t chunk_size = (bt_mesh.lpn.queue_size * 12) - 11;

chunk_size = MIN(chunk_size, BLOB_RX_CHUNK_SIZE);
net_buf_simple_add_le16(&rsp, chunk_size);
if (bt_mesh.lpn.queue_size <= 2) {
LOG_WRN("FndQ too small %u", bt_mesh.lpn.queue_size);
}
} else {
net_buf_simple_add_le16(&rsp, BLOB_RX_CHUNK_SIZE);
}
#else
net_buf_simple_add_le16(&rsp, BLOB_RX_CHUNK_SIZE);
#endif

net_buf_simple_add_le32(&rsp, CONFIG_BT_MESH_BLOB_SIZE_MAX);
net_buf_simple_add_le16(&rsp, MTU_SIZE_MAX);
net_buf_simple_add_u8(&rsp, BT_MESH_BLOB_XFER_MODE_ALL);
Expand Down
Loading