diff mbox series

[BlueZ] monitor: Stop spamming logs when GATT db cannot be loaded

Message ID 20220602212229.1486206-1-luiz.dentz@gmail.com (mailing list archive)
State Superseded
Headers show
Series [BlueZ] monitor: Stop spamming logs when GATT db cannot be loaded | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/checkpatch success Checkpatch PASS
tedd_an/gitlint success Gitlint PASS
tedd_an/setupell success Setup ELL PASS
tedd_an/buildprep success Build Prep PASS
tedd_an/build success Build Configuration PASS
tedd_an/makecheck success Make Check PASS
tedd_an/makecheckvalgrind success Make Check PASS
tedd_an/makedistcheck success Make Distcheck PASS
tedd_an/build_extell success Build External ELL PASS
tedd_an/build_extell_make success Build Make with External ELL PASS

Commit Message

Luiz Augusto von Dentz June 2, 2022, 9:22 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This stops calling hci_devba everytime the GATT db needs to be loaded
since that causes a raw socket to be open to read back the address
pointed by the index, instead this is done only once at assign_handle
and store in packet_conn_data.
---
 monitor/att.c    | 6 +-----
 monitor/packet.c | 3 +++
 monitor/packet.h | 1 +
 3 files changed, 5 insertions(+), 5 deletions(-)

Comments

bluez.test.bot@gmail.com June 2, 2022, 10:46 p.m. UTC | #1
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=646996

---Test result---

Test Summary:
CheckPatch                    PASS      1.49 seconds
GitLint                       PASS      0.99 seconds
Prep - Setup ELL              PASS      51.03 seconds
Build - Prep                  PASS      0.75 seconds
Build - Configure             PASS      10.26 seconds
Build - Make                  PASS      1462.12 seconds
Make Check                    PASS      12.17 seconds
Make Check w/Valgrind         PASS      518.04 seconds
Make Distcheck                PASS      272.21 seconds
Build w/ext ELL - Configure   PASS      10.15 seconds
Build w/ext ELL - Make        PASS      1433.88 seconds
Incremental Build with patchesPASS      0.00 seconds



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/monitor/att.c b/monitor/att.c
index 152a5f320..00db8ddaa 100644
--- a/monitor/att.c
+++ b/monitor/att.c
@@ -1228,7 +1228,6 @@  static void load_gatt_db(struct packet_conn_data *conn)
 {
 	struct att_conn_data *data = conn->data;
 	char filename[PATH_MAX];
-	bdaddr_t src;
 	char local[18];
 	char peer[18];
 
@@ -1243,10 +1242,7 @@  static void load_gatt_db(struct packet_conn_data *conn)
 	if (!gatt_db_isempty(data->ldb) && !gatt_db_isempty(data->rdb))
 		return;
 
-	if (hci_devba(conn->index, &src) < 0)
-		return;
-
-	ba2str(&src, local);
+	ba2str((bdaddr_t *)conn->src, local);
 	ba2str((bdaddr_t *)conn->dst, peer);
 
 	if (gatt_db_isempty(data->ldb)) {
diff --git a/monitor/packet.c b/monitor/packet.c
index c7739fba5..bd9efd2c7 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -178,6 +178,9 @@  static void assign_handle(uint16_t index, uint16_t handle, uint8_t type,
 
 	for (i = 0; i < MAX_CONN; i++) {
 		if (conn_list[i].handle == 0x0000) {
+			if (hci_devba(index, (bdaddr_t *)conn_list[i].src) < 0)
+				return;
+
 			conn_list[i].index = index;
 			conn_list[i].handle = handle;
 			conn_list[i].type = type;
diff --git a/monitor/packet.h b/monitor/packet.h
index 97d683e3a..3a6b9f7a1 100644
--- a/monitor/packet.h
+++ b/monitor/packet.h
@@ -25,6 +25,7 @@ 
 
 struct packet_conn_data {
 	uint16_t index;
+	uint8_t  src[6];
 	uint16_t handle;
 	uint8_t  type;
 	uint8_t  dst[6];