Skip to content

Commit a4ae19e

Browse files
committed
Revert "[nrf noup] bluetooth: conn: Allow for an extra ref in bt_l2cap_send_pdu"
This reverts commit 510e36c. Signed-off-by: Marek Pieta <[email protected]>
1 parent d96f129 commit a4ae19e

File tree

2 files changed

+7
-18
lines changed

2 files changed

+7
-18
lines changed

subsys/bluetooth/host/conn.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -711,19 +711,12 @@ static int send_buf(struct bt_conn *conn, struct net_buf *buf,
711711

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

714-
/* Check that buf->ref is 1 or 2. It would be 1 if this was
715-
* the only reference (e.g. buf was removed from the conn
716-
* tx_queue). It would be 2 if the tx_data_pull kept it on
717-
* the tx_queue for segmentation.
718-
*
719-
* Allow for an additional buffer reference if callback is
720-
* provided. This can be used to extend lifetime of the net
721-
* buffer until the data transmission is confirmed by ACK of
722-
* the remote.
714+
/* Check that buf->ref is 1 or 2. It would be 1 if this
715+
* was the only reference (e.g. buf was removed
716+
* from the conn tx_queue). It would be 2 if the
717+
* tx_data_pull kept it on the tx_queue for segmentation.
723718
*/
724-
if (buf->ref > 2 + (cb ? 1 : 0)) {
725-
__ASSERT_NO_MSG(false);
726-
}
719+
__ASSERT_NO_MSG((buf->ref == 1) || (buf->ref == 2));
727720

728721
/* The reference is always transferred to the frag, so when
729722
* the frag is destroyed, the parent reference is decremented.

subsys/bluetooth/host/l2cap.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -761,17 +761,13 @@ int bt_l2cap_send_pdu(struct bt_l2cap_le_chan *le_chan, struct net_buf *pdu,
761761
return -ENOTCONN;
762762
}
763763

764-
/* Allow for an additional buffer reference if callback is provided. This can be used to
765-
* extend lifetime of the net buffer until the data transmission is confirmed by ACK of the
766-
* remote.
767-
*/
768-
if (pdu->ref > 1 + (cb ? 1 : 0)) {
764+
if (pdu->ref != 1) {
769765
/* The host may alter the buf contents when fragmenting. Higher
770766
* layers cannot expect the buf contents to stay intact. Extra
771767
* refs suggests a silent data corruption would occur if not for
772768
* this error.
773769
*/
774-
LOG_ERR("Expecting up to %d refs, got %d", cb ? 2 : 1, pdu->ref);
770+
LOG_ERR("Expecting 1 ref, got %d", pdu->ref);
775771
return -EINVAL;
776772
}
777773

0 commit comments

Comments
 (0)