Skip to content

Commit 7eddcac

Browse files
alwa-nordicrlubos
authored andcommitted
Revert "[nrf noup] bluetooth: conn: Skip buffer ref count check in send_buf"
This reverts commit 827eb44. Signed-off-by: Aleksander Wasaznik <[email protected]>
1 parent 880bb77 commit 7eddcac

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

subsys/bluetooth/host/conn.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -698,17 +698,13 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf,
698698

699699
uint16_t frag_len = MIN(conn_mtu(conn), len);
700700

701-
/* If ATT sent callback is delayed until data transmission is done by BLE controller, the
702-
* transmitted buffer may have an additional reference. The reference is used to extend
703-
* lifetime of the net buffer until the data transmission is confirmed by ACK of the remote.
704-
*
705-
* send_buf function can be called multiple times, if buffer has to be fragmented over HCI.
706-
* In that case, the callback is provided as an argument only for the last transmitted
707-
* fragment. The `buf->ref == 1` check is skipped because it's impossible to properly
708-
* validate number of references for the sent fragments if buffers may have the additional
709-
* reference.
710-
*/
711-
__ASSERT_NO_MSG(IS_ENABLED(CONFIG_BT_ATT_SENT_CB_AFTER_TX) || (buf->ref == 1));
701+
if (buf->ref > 1 + (cb ? 1 : 0)) {
702+
/* Allow for an additional buffer reference if callback is provided.
703+
* This can be used to extend lifetime of the net buffer until the
704+
* data transmission is confirmed by ACK of the remote.
705+
*/
706+
__ASSERT_NO_MSG(false);
707+
}
712708

713709
if (buf->len > frag_len) {
714710
LOG_DBG("keep %p around", buf);

0 commit comments

Comments
 (0)