Skip to contentSkip to conversation

main: Disable EATT by default

PATCH In review Luiz Augusto von Dentz 2 participants 3 messages Mar 10, 2023 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/2 main: Disable EATT by default

From: Luiz Augusto von Dentz <[email protected]>

EATT is causing some problem with some platforms as they also attempt to configure it may cause a connection collision which needs to be handled by the kernel.

---
 src/main.c    | 2 +-
 src/main.conf | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
src/main.c +1 -1
index 2a4d9be05d7a..3198091fc12c 100644
@@ -1148,7 +1148,7 @@ static void init_defaults(void)
 
 	btd_opts.gatt_cache = BT_GATT_CACHE_ALWAYS;
 	btd_opts.gatt_mtu = BT_ATT_MAX_LE_MTU;
-	btd_opts.gatt_channels = 3;
+	btd_opts.gatt_channels = 1;
 
 	btd_opts.avdtp.session_mode = BT_IO_MODE_BASIC;
 	btd_opts.avdtp.stream_mode = BT_IO_MODE_BASIC;
src/main.conf +2 -2
index 11172c9dd7c6..d108934a8ae9 100644
@@ -255,8 +255,8 @@
 
 # Number of ATT channels
 # Possible values: 1-5 (1 disables EATT)
-# Default to 3
-#Channels = 3
+# Default to 1
+#Channels = 1
 
 [CSIS]
 # SIRK - Set Identification Resolution Key which is common for all the
Signature · 1 line
2.39.2
author maintainer
#1 lore raw

PATCH 2/2 gatt: Use DEFER_SETUP for EATT channels

From: Luiz Augusto von Dentz <[email protected]>

This makes use of DEFER_SETUP mechanism to do the following checks before accepting the connection:

- Checks a valid device object exits
- Checks if initiator/central as if the peripheral start connecting it may cause collisions.
- Checks if the limit of allowed connections has been reached.

---
 src/device.c        |  6 ++--
 src/device.h        |  1 +
 src/gatt-database.c | 88 +++++++++++++++++++++++++++++++++++----------
 3 files changed, 73 insertions(+), 22 deletions(-)
src/device.c +3 -3
index 652c03606b9e..77b38e97a7ea 100644
@@ -310,7 +310,7 @@ static struct bearer_state *get_state(struct btd_device *dev,
 		return &dev->le_state;
 }
 
-static bool get_initiator(struct btd_device *dev)
+bool btd_device_is_initiator(struct btd_device *dev)
 {
 	if (dev->le_state.connected)
 		return dev->le_state.initiator;
@@ -3964,7 +3964,7 @@ done:
 	}
 
 	/* Notify driver about the new connection */
-	service_accept(service, get_initiator(device));
+	service_accept(service, btd_device_is_initiator(device));
 }
 
 static void device_add_gatt_services(struct btd_device *device)
@@ -3984,7 +3984,7 @@ static void device_add_gatt_services(struct btd_device *device)
 static void device_accept_gatt_profiles(struct btd_device *device)
 {
 	GSList *l;
-	bool initiator = get_initiator(device);
+	bool initiator = btd_device_is_initiator(device);
 
 	DBG("initiator %s", initiator ? "true" : "false");
 
src/device.h +1 -0
index 96347ff229cc..3252e14eff84 100644
@@ -67,6 +67,7 @@ GSList *btd_device_get_primaries(struct btd_device *device);
 struct gatt_db *btd_device_get_gatt_db(struct btd_device *device);
 struct bt_gatt_client *btd_device_get_gatt_client(struct btd_device *device);
 struct bt_gatt_server *btd_device_get_gatt_server(struct btd_device *device);
+bool btd_device_is_initiator(struct btd_device *device);
 void *btd_device_get_attrib(struct btd_device *device);
 void btd_device_gatt_set_service_changed(struct btd_device *device,
 						uint16_t start, uint16_t end);
src/gatt-database.c +69 -19

124 lines not on this page · raw message

Signature · 1 line
2.39.2
#2 lore raw
In reply to Luiz Augusto von Dentz

This is an automated email and please do not reply to this email.

Dear Submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.

----- Output -----

error: patch failed: src/main.conf:255
error: src/main.conf: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch

Please resolve the issue and submit the patches again.

---
Regards,
Linux Bluetooth