Bluetooth: l2cap: Fix initial credit calculaton for MTU < MPS
When required Rx MTU is less than configured Rx MPS, the resultant initial credits was 0 which prevented any L2CAP packet to be received. Fixed by ceiling the initial credits count in the credits calculation. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
parent
636f609d66
commit
14365080d2
1 changed files with 2 additions and 1 deletions
|
@ -641,7 +641,8 @@ static void l2cap_chan_rx_init(struct bt_l2cap_le_chan *chan)
|
|||
if (!chan->rx.init_credits) {
|
||||
if (chan->chan.ops->alloc_buf) {
|
||||
/* Auto tune credits to receive a full packet */
|
||||
chan->rx.init_credits = chan->rx.mtu /
|
||||
chan->rx.init_credits = (chan->rx.mtu +
|
||||
(L2CAP_MAX_LE_MPS - 1)) /
|
||||
L2CAP_MAX_LE_MPS;
|
||||
} else {
|
||||
chan->rx.init_credits = L2CAP_LE_MAX_CREDITS;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue