Skip to content

Commit a1dce20

Browse files
lylezhu2012fabiobaltieri
authored andcommitted
Bluetooth: Classic: L2CAP: Make TxWindow size on both sides the same
In retransmission mode and flow control mode, the TxWindow size should be same on both sides. When one side is updated, also update the other side. Signed-off-by: Lyle Zhu <[email protected]>
1 parent a371f0c commit a1dce20

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

subsys/bluetooth/host/classic/l2cap_br.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2838,6 +2838,18 @@ static uint16_t l2cap_br_conf_rsp_opt_ret_fc(struct bt_l2cap_chan *chan, struct
28382838
br_chan->rx.max_transmit = opt_ret_fc->max_transmit;
28392839
br_chan->rx.max_window = sys_le16_to_cpu(opt_ret_fc->tx_windows_size);
28402840
br_chan->rx.mps = sys_le16_to_cpu(opt_ret_fc->mps);
2841+
2842+
if ((opt_ret_fc->mode == BT_L2CAP_BR_LINK_MODE_RET) ||
2843+
(opt_ret_fc->mode == BT_L2CAP_BR_LINK_MODE_FC)) {
2844+
/*
2845+
* Bluetooth Core specification Version 6.0 | Vol 3, Part A, section 5.4.
2846+
*
2847+
* In Retransmission mode and Flow Control mode this parameter should be
2848+
* negotiated to reflect the buffer sizes allocated for the connection on
2849+
* both sides.
2850+
*/
2851+
br_chan->tx.max_window = br_chan->rx.max_window;
2852+
}
28412853
}
28422854

28432855
if (!accept) {
@@ -3251,6 +3263,18 @@ static uint16_t l2cap_br_conf_rsp_unaccept_opt_ret_fc(struct bt_l2cap_chan *chan
32513263
br_chan->rx.max_transmit = opt_ret_fc->max_transmit;
32523264
br_chan->rx.max_window = opt_ret_fc->tx_windows_size;
32533265
br_chan->rx.mps = sys_le16_to_cpu(opt_ret_fc->mps);
3266+
3267+
if ((opt_ret_fc->mode == BT_L2CAP_BR_LINK_MODE_RET) ||
3268+
(opt_ret_fc->mode == BT_L2CAP_BR_LINK_MODE_FC)) {
3269+
/*
3270+
* Bluetooth Core specification Version 6.0 | Vol 3, Part A, section 5.4.
3271+
*
3272+
* In Retransmission mode and Flow Control mode this parameter should be
3273+
* negotiated to reflect the buffer sizes allocated for the connection on
3274+
* both sides.
3275+
*/
3276+
br_chan->tx.max_window = br_chan->rx.max_window;
3277+
}
32543278
}
32553279

32563280
if (br_chan->rx.mode == BT_L2CAP_BR_LINK_MODE_BASIC) {
@@ -3975,6 +3999,18 @@ static uint16_t l2cap_br_conf_opt_ret_fc(struct bt_l2cap_chan *chan, struct net_
39753999
br_chan->tx.max_transmit = opt_ret_fc->max_transmit;
39764000
br_chan->tx.max_window = opt_ret_fc->tx_windows_size;
39774001
br_chan->tx.mps = sys_le16_to_cpu(opt_ret_fc->mps);
4002+
4003+
if ((opt_ret_fc->mode == BT_L2CAP_BR_LINK_MODE_RET) ||
4004+
(opt_ret_fc->mode == BT_L2CAP_BR_LINK_MODE_FC)) {
4005+
/*
4006+
* Bluetooth Core specification Version 6.0 | Vol 3, Part A, section 5.4.
4007+
*
4008+
* In Retransmission mode and Flow Control mode this parameter should be
4009+
* negotiated to reflect the buffer sizes allocated for the connection on
4010+
* both sides.
4011+
*/
4012+
br_chan->rx.max_window = br_chan->tx.max_window;
4013+
}
39784014
}
39794015

39804016
if (!accept) {

0 commit comments

Comments
 (0)