linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ 0/2] AVDTP SEID pool seems too small
@ 2021-08-29 15:50 Pauli Virtanen
  2021-08-29 15:50 ` [PATCH BlueZ 1/2] shared/util: use 64-bit bitmap in util_get/clear_uid Pauli Virtanen
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Pauli Virtanen @ 2021-08-29 15:50 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

Hi,

It seems that if media application is registered to multiple BT
adapters, BlueZ can easily run out of free AVDTP SEIDs.  This occurs in
practice when running Pipewire (or Pulseaudio) and plugging in 3+
adapters: their media application has 10+ SEPs for various vendor A2DP
codecs, registered for each adapter.  After having registered 32 SEPs
across all adapters, Media1.RegisterApplication starts failing, due to
SEP registration not finding free SEIDs.

However, if I understand the AVDTP spec and BlueZ implementation
correctly, this behavior is not quite correct: (i) the SEID pool in
BlueZ is limited to 8*sizeof(int) == 32 entries, which is smaller than
the 0x3E = 62 entries (AVDTP1.3, 8.20.1).  Also, (ii) BlueZ allocates
SEIDs from a pool shared by all adapters, whereas it seems they should
be device & connection local (AVDTP1.3, 4.10). Since adapters are
separate devices in this context, this then appears to imply that each
should have separate SEID pool.

If this interpretation is right (I don't know the AVDTP spec very
well, so...), here are two patches that address this.  In (limited)
tests this seemed to work.

Pauli Virtanen (2):
  shared/util: use 64-bit bitmap in util_get/clear_uid
  avdtp: use separate local SEID pool for each adapter

 android/avdtp.c        |  2 +-
 profiles/audio/a2dp.c  |  2 +-
 profiles/audio/avdtp.c | 55 ++++++++++++++++++++++++++++++++++++------
 profiles/audio/avdtp.h |  4 ++-
 src/advertising.c      |  2 +-
 src/shared/util.c      | 27 ++++++++++++---------
 src/shared/util.h      |  4 +--
 unit/test-avdtp.c      |  2 +-
 8 files changed, 71 insertions(+), 27 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-09-07  4:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-29 15:50 [PATCH BlueZ 0/2] AVDTP SEID pool seems too small Pauli Virtanen
2021-08-29 15:50 ` [PATCH BlueZ 1/2] shared/util: use 64-bit bitmap in util_get/clear_uid Pauli Virtanen
2021-08-29 16:48   ` AVDTP SEID pool seems too small bluez.test.bot
2021-09-03 22:59   ` [PATCH BlueZ 1/2] shared/util: use 64-bit bitmap in util_get/clear_uid Luiz Augusto von Dentz
2021-09-04  9:54     ` Pauli Virtanen
2021-08-29 15:50 ` [PATCH BlueZ 2/2] avdtp: use separate local SEID pool for each adapter Pauli Virtanen
2021-09-03 22:49   ` Luiz Augusto von Dentz
2021-09-04 10:36     ` Pauli Virtanen
2021-09-05 15:43 ` [PATCH BlueZ v2 1/2] shared/util: use 64-bit bitmap in util_get/clear_uid Pauli Virtanen
2021-09-05 16:49   ` [BlueZ,v2,1/2] " bluez.test.bot
2021-09-07  4:38     ` Luiz Augusto von Dentz
2021-09-05 15:43 ` [PATCH BlueZ v2 2/2] avdtp: use separate local SEID pool for each adapter Pauli Virtanen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).