Bluetooth: Handle ACL buffers sharing between multiple connections.

The BT host has fixed set of buffers to send data to SoC, generic value
is 5. When a connection, like A2DP playback is ready to send data it
fills one of the buffer available and sends to SoC. Once SoC got
acknowledged from remote side that the data received it updates the host
and the buffer is freed. Till host is acknowledged the send Complete
info, the data buffer is locked for that data transfer. The below is the
example for buffers availability.

Total free Buffers count : 5

Connections : 1

Conn_1  need to send data, picks buf_1 and send to SoC

free Buffers count: 4

Buffers used by Conn_1  : 1

Still Conn_1 has more data to send ....

free Buffers count: 3

Buffers used by Conn_1 : 2

Remote device Ack for buf_1, so 1 buffer is freed, updated state is

free Buffers count : 4

Buffers used by Conn_1 : 1

When there are more ACL connections to transfer data, like one
connection for A2DP playback and one for OPP data transfer, all the data
buffers available with host can be used by any ACL which has ready data
to send. This allows maximum throughputs possibility from host. But the
existing solution has a problem. If one connection has used all the
buffers at a instanace of time, and didnt release (this happens when remote
device doesnt ACK to send) the other connections will not have buffers to
send. In current usecase A2dp data cannot be sent to headset as OPP
connection is lost.   The current change is, when there are more
connections the quota for a connection that it can use maximum is
total buffers-1. This allows other connections not to get blocked,
 at the same time through puts are not going to dropped.

CRs-Fixed: 370497
Change-Id: Iac34f0a223555de80d1daebde34c7fc87668c0d5
Signed-off-by: Srinivas Krovvidi <skrovvid@codeaurora.org>
1 file changed