Skip to content

Commit

Permalink
Revert "[nrf noup] bluetooth: conn: Allow for an extra ref in bt_l2ca…
Browse files Browse the repository at this point in the history
…p_send_pdu"

This reverts commit b0ce7fe.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
  • Loading branch information
PavelVPV committed Oct 24, 2024
1 parent 07bd6bd commit cd4b14f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
8 changes: 1 addition & 7 deletions subsys/bluetooth/host/conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,13 +695,7 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf,

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

if (buf->ref > 1 + (cb ? 1 : 0)) {
/* Allow for an additional buffer reference if callback is provided.
* This can be used to extend lifetime of the net buffer until the
* data transmission is confirmed by ACK of the remote.
*/
__ASSERT_NO_MSG(false);
}
__ASSERT_NO_MSG(buf->ref == 1);

if (buf->len > frag_len) {
LOG_DBG("keep %p around", buf);
Expand Down
8 changes: 2 additions & 6 deletions subsys/bluetooth/host/l2cap.c
Original file line number Diff line number Diff line change
Expand Up @@ -717,17 +717,13 @@ static void cancel_data_ready(struct bt_l2cap_le_chan *le_chan)
int bt_l2cap_send_pdu(struct bt_l2cap_le_chan *le_chan, struct net_buf *pdu,
bt_conn_tx_cb_t cb, void *user_data)
{
/* Allow for an additional buffer reference if callback is provided. This can be used to
* extend lifetime of the net buffer until the data transmission is confirmed by ACK of the
* remote.
*/
if (pdu->ref > 1 + (cb ? 1 : 0)) {
if (pdu->ref != 1) {
/* The host may alter the buf contents when fragmenting. Higher
* layers cannot expect the buf contents to stay intact. Extra
* refs suggests a silent data corruption would occur if not for
* this error.
*/
LOG_ERR("Expecting up to %d refs, got %d", cb ? 2 : 1, pdu->ref);
LOG_ERR("Expecting 1 ref, got %d", pdu->ref);
return -EINVAL;
}

Expand Down

0 comments on commit cd4b14f

Please sign in to comment.