* [PATCH] adapter: restrict delta=0 RSSI to proximity filters
@ 2026-07-15 9:19 Xiuzhuo Shang
2026-07-15 10:13 ` bluez.test.bot
0 siblings, 1 reply; 2+ messages in thread
From: Xiuzhuo Shang @ 2026-07-15 9:19 UTC (permalink / raw)
To: luiz.dentz
Cc: linux-bluetooth, cheng.jiang, quic_chezhou, wei.deng, shuai.zhang,
mengshi.wu, jinwang.li, xiuzhuo.shang
When a discovery filter is active (filtered_discovery=true), BlueZ
unconditionally calls device_set_rssi_with_delta(..., delta=0),
causing every BLE advertisement to emit a PropertiesChanged(RSSI)
signal regardless of whether the RSSI value changed.
delta=0 is only needed when a client has expressed explicit proximity
interest by setting an RSSI or pathloss threshold in its discovery
filter. Filters that specify only transport type or UUIDs do not
require per-packet RSSI precision; for those, the standard
RSSI_THRESHOLD=8 rate-limiting is both correct and desirable.
The problem is triggered on dual-mode adapters by a transport-only
filter (e.g. Transport=le). In merge_discovery_filters(), the
transport-specific scan type (SCAN_TYPE_LE=6) does not equal the
adapter scan type (SCAN_TYPE_DUAL=7), so has_filtered_discovery is
set, filtered_discovery becomes true, and delta=0 is applied even
though no proximity condition was requested. With hundreds of BLE
devices advertising simultaneously this generates hundreds of
unnecessary PropertiesChanged(RSSI) signals per second.
Confirmed on QCS6490 (BlueZ 5.72) with Transport=le filter:
adapter.c: filtered_discovery=1 (current_discovery_filter=set)
device.c: device_set_rssi_with_delta() rssi=-86 delta_threshold=0
device.c: device_set_rssi_with_delta() rssi=-79 delta_threshold=0
Add discovery_filter_has_proximity() which walks discovery_list and
returns true only when at least one active filter carries a real
proximity condition (rssi != DISTANCE_VAL_INVALID or pathloss !=
DISTANCE_VAL_INVALID). Use this to gate the delta=0 path.
Other filter fields (transport, uuids, duplicate, discoverable)
express capability or content criteria and carry no proximity
implication, so they are intentionally excluded from the check.
Signed-off-by: Xiuzhuo Shang <xiuzhuo.shang@oss.qualcomm.com>
---
src/adapter.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/adapter.c b/src/adapter.c
index fb95e8553..1023e43a2 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -7255,6 +7255,22 @@ static void filter_duplicate_data(void *data, void *user_data)
*duplicate = client->discovery_filter->duplicate;
}
+static bool discovery_filter_has_proximity(struct btd_adapter *adapter)
+{
+ GSList *l;
+
+ for (l = adapter->discovery_list; l; l = g_slist_next(l)) {
+ struct discovery_client *client = l->data;
+ struct discovery_filter *filter = client->discovery_filter;
+
+ if (filter && (filter->rssi != DISTANCE_VAL_INVALID ||
+ filter->pathloss != DISTANCE_VAL_INVALID))
+ return true;
+ }
+
+ return false;
+}
+
static bool device_is_discoverable(struct btd_adapter *adapter,
struct eir_data *eir, const char *addr,
uint8_t bdaddr_type, bool *auto_connect)
@@ -7451,7 +7467,8 @@ void btd_adapter_device_found(struct btd_adapter *adapter,
if (name_resolve_failed)
device_name_resolve_fail(dev);
- if (adapter->filtered_discovery)
+ if (adapter->filtered_discovery &&
+ discovery_filter_has_proximity(adapter))
device_set_rssi_with_delta(dev, rssi, 0);
else
device_set_rssi(dev, rssi);
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: adapter: restrict delta=0 RSSI to proximity filters
2026-07-15 9:19 [PATCH] adapter: restrict delta=0 RSSI to proximity filters Xiuzhuo Shang
@ 2026-07-15 10:13 ` bluez.test.bot
0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2026-07-15 10:13 UTC (permalink / raw)
To: linux-bluetooth, xiuzhuo.shang
[-- Attachment #1: Type: text/plain, Size: 6567 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1128034
---Test result---
Test Summary:
CheckPatch PASS 0.54 seconds
GitLint PASS 0.24 seconds
BuildEll PASS 20.64 seconds
BluezMake FAIL 513.94 seconds
CheckSmatch PASS 314.45 seconds
bluezmakeextell PASS 103.77 seconds
IncrementalBuild FAIL 514.00 seconds
ScanBuild PASS 990.44 seconds
Details
##############################
Test: BluezMake - FAIL
Desc: Build BlueZ
Output:
tools/mgmt-tester.c: In function ‘main’:
tools/mgmt-tester.c:12990:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
12990 | int main(int argc, char *argv[])
| ^~~~
unit/test-avdtp.c: In function ‘main’:
unit/test-avdtp.c:766:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
766 | int main(int argc, char *argv[])
| ^~~~
unit/test-avrcp.c: In function ‘main’:
unit/test-avrcp.c:989:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
989 | int main(int argc, char *argv[])
| ^~~~
monitor/packet.c: In function ‘print_features_subpage’:
monitor/packet.c:2940:29: error: ‘%u’ directive writing between 1 and 10 bytes into a region of size between 5 and 7 [-Werror=format-overflow=]
2940 | sprintf(str, "Features[%u/%u]", page, i);
| ^~
monitor/packet.c:2940:16: note: directive argument in the range [0, 2147483646]
2940 | sprintf(str, "Features[%u/%u]", page, i);
| ^~~~~~~~~~~~~~~~~
In file included from /usr/include/stdio.h:867,
from monitor/packet.c:18:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 14 and 25 bytes into a destination of size 18
36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 | __bos (__s), __fmt, __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7058: monitor/packet.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4172: all] Error 2
##############################
Test: IncrementalBuild - FAIL
Desc: Incremental build with the patches in the series
Output:
tools/mgmt-tester.c: In function ‘main’:
tools/mgmt-tester.c:12990:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
12990 | int main(int argc, char *argv[])
| ^~~~
unit/test-avdtp.c: In function ‘main’:
unit/test-avdtp.c:766:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
766 | int main(int argc, char *argv[])
| ^~~~
unit/test-avrcp.c: In function ‘main’:
unit/test-avrcp.c:989:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
989 | int main(int argc, char *argv[])
| ^~~~
monitor/packet.c: In function ‘print_features_subpage’:
monitor/packet.c:2940:29: error: ‘%u’ directive writing between 1 and 10 bytes into a region of size between 5 and 7 [-Werror=format-overflow=]
2940 | sprintf(str, "Features[%u/%u]", page, i);
| ^~
monitor/packet.c:2940:16: note: directive argument in the range [0, 2147483646]
2940 | sprintf(str, "Features[%u/%u]", page, i);
| ^~~~~~~~~~~~~~~~~
In file included from /usr/include/stdio.h:867,
from monitor/packet.c:18:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 14 and 25 bytes into a destination of size 18
36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 | __bos (__s), __fmt, __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7058: monitor/packet.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4172: all] Error 2
adapter: restrict delta=0 RSSI to proximity filters
tools/mgmt-tester.c: In function ‘main’:
tools/mgmt-tester.c:12990:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
12990 | int main(int argc, char *argv[])
| ^~~~
unit/test-avdtp.c: In function ‘main’:
unit/test-avdtp.c:766:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
766 | int main(int argc, char *argv[])
| ^~~~
unit/test-avrcp.c: In function ‘main’:
unit/test-avrcp.c:989:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
989 | int main(int argc, char *argv[])
| ^~~~
monitor/packet.c: In function ‘print_features_subpage’:
monitor/packet.c:2940:29: error: ‘%u’ directive writing between 1 and 10 bytes into a region of size between 5 and 7 [-Werror=format-overflow=]
2940 | sprintf(str, "Features[%u/%u]", page, i);
| ^~
monitor/packet.c:2940:16: note: directive argument in the range [0, 2147483646]
2940 | sprintf(str, "Features[%u/%u]", page, i);
| ^~~~~~~~~~~~~~~~~
In file included from /usr/include/stdio.h:867,
from monitor/packet.c:18:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 14 and 25 bytes into a destination of size 18
36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 | __bos (__s), __fmt, __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7058: monitor/packet.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4172: all] Error 2
https://github.com/bluez/bluez/pull/2314
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-15 10:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-15 9:19 [PATCH] adapter: restrict delta=0 RSSI to proximity filters Xiuzhuo Shang
2026-07-15 10:13 ` bluez.test.bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox