Skip to contentSkip to conversation

shared/att: Fix accepting Exchange MTU on EATT bearer

PATCH In review Luiz Augusto von Dentz 2 participants 5 messages Aug 25, 2021 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/3 shared/att: Fix accepting Exchange MTU on EATT bearer

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

If remote send Exchange MTU it shall fail as the MTU negotiation shall happen over L2CAP signalling not ATT for those channels.

---
 src/shared/att.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/shared/att.c +2 -1
index ccc753c4e..665d7f4b8 100644
@@ -962,7 +962,8 @@ static void handle_notify(struct bt_att_chan *chan, uint8_t *pdu,
 		 * link since the MTU size is negotiated using L2CAP channel
 		 * configuration procedures.
 		 */
-		if (bt_att_get_link_type(att) == BT_ATT_BREDR) {
+		if (bt_att_get_link_type(att) == BT_ATT_BREDR ||
+				chan->type == BT_ATT_EATT) {
 			switch (opcode) {
 			case BT_ATT_OP_MTU_REQ:
 				goto not_supported;
Signature · 1 line
2.31.1
author maintainer
#1 lore raw

PATCH 2/3 shared/att: Fix attempting to send Exchange MTU on EATT bearer

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

EATT bearer shall use the L2CAP signalling for negotiating the MTU size.

---
 src/shared/att.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
src/shared/att.c +8 -1
index 665d7f4b8..329497728 100644
@@ -411,10 +411,17 @@ static struct att_send_op *pick_next_send_op(struct bt_att_chan *chan)
 	 */
 	if (!chan->pending_req) {
 		op = queue_peek_head(att->req_queue);
-		if (op && op->len <= chan->mtu)
+		if (op && op->len <= chan->mtu) {
+			/* Don't send Exchange MTU over EATT */
+			if (op->opcode == BT_ATT_OP_MTU_REQ &&
+					chan->type == BT_ATT_EATT)
+				goto indicate;
+
 			return queue_pop_head(att->req_queue);
+		}
 	}
 
+indicate:
 	/* There is either a request pending or no requests queued. If there is
 	 * no pending indication, pick an operation from the indication queue.
 	 */
Signature · 1 line
2.31.1
author maintainer
#2 lore raw

PATCH 3/3 gatt: Do not always attempt to connect EATT immediately

In reply to Luiz Augusto von Dentz

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

Wait the bt_gatt_client becomes ready (has performed service discovery) before attempting to connect EATT when acting as peripheral/acceptor since the central/initiator might actually attempt to connect EATT channels in the same way which can potentially cause a collisions.

---
 src/device.c      |  7 +++++
 src/gatt-client.c | 74 +++++++++++++++++++++++------------------------
 src/gatt-client.h |  1 +
 3 files changed, 44 insertions(+), 38 deletions(-)
src/device.c +7 -0
index 998485be7..6253edc77 100644
@@ -5304,6 +5304,13 @@ static void gatt_client_init(struct btd_device *device)
 	}
 
 	btd_gatt_client_connected(device->client_dbus);
+
+	/* Only initiate EATT connection when acting as initiator, as acceptor
+	 * it shall be triggered only when ready to avoid possible clashes where
+	 * both sides attempt to connection at same time.
+	 */
+	if (device->connect)
+		bt_gatt_client_eatt_connect(device->client_dbus);
 }
 
 static void gatt_server_init(struct btd_device *device,
src/gatt-client.c +36 -38

104 lines not on this page · raw message

src/gatt-client.h +1 -0
index b6539207e..672c5e72f 100644
@@ -20,6 +20,7 @@ void btd_gatt_client_service_added(struct btd_gatt_client *client,
 void btd_gatt_client_service_removed(struct btd_gatt_client *client,
 					struct gatt_db_attribute *attrib);
 void btd_gatt_client_disconnected(struct btd_gatt_client *client);
+void bt_gatt_client_eatt_connect(struct btd_gatt_client *client);
 
 typedef void (*btd_gatt_client_service_path_t)(const char *service_path,
 							void *user_data);
Signature · 1 line
2.31.1
#3 lore raw
In reply to Luiz Augusto von Dentz

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=537355

---Test result---

Test Summary:

CheckPatch                    PASS      0.80 seconds
GitLint                       PASS      0.32 seconds
Prep - Setup ELL              PASS      42.62 seconds
Build - Prep                  PASS      0.15 seconds
Build - Configure             PASS      7.72 seconds
Build - Make                  PASS      190.27 seconds
Make Check                    PASS      9.03 seconds
Make Distcheck                PASS      224.50 seconds
Build w/ext ELL - Configure   PASS      7.65 seconds
Build w/ext ELL - Make        PASS      178.82 seconds

Details
##############################
Test: CheckPatch - PASS
Desc: Run checkpatch.pl script with rule in .checkpatch.conf

##############################
Test: GitLint - PASS
Desc: Run gitlint with rule in .gitlint

##############################
Test: Prep - Setup ELL - PASS
Desc: Clone, build, and install ELL

##############################
Test: Build - Prep - PASS
Desc: Prepare environment for build

##############################
Test: Build - Configure - PASS
Desc: Configure the BlueZ source tree

##############################
Test: Build - Make - PASS
Desc: Build the BlueZ source tree

##############################
Test: Make Check - PASS
Desc: Run 'make check'

##############################
Test: Make Distcheck - PASS
Desc: Run distcheck to check the distribution

##############################
Test: Build w/ext ELL - Configure - PASS
Desc: Configure BlueZ source with '--enable-external-ell' configuration

##############################
Test: Build w/ext ELL - Make - PASS
Desc: Build BlueZ source with '--enable-external-ell' configuration

---
Regards,
Linux Bluetooth

author maintainer
#4 lore raw

Hi,

Quoted 66 lines · On Wed, Aug 25, 2021 at 2:33 PM <[email protected]> wrote:

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=537355

---Test result---

Test Summary:

CheckPatch                    PASS      0.80 seconds
GitLint                       PASS      0.32 seconds
Prep - Setup ELL              PASS      42.62 seconds
Build - Prep                  PASS      0.15 seconds
Build - Configure             PASS      7.72 seconds
Build - Make                  PASS      190.27 seconds
Make Check                    PASS      9.03 seconds
Make Distcheck                PASS      224.50 seconds
Build w/ext ELL - Configure   PASS      7.65 seconds
Build w/ext ELL - Make        PASS      178.82 seconds

Details
##############################
Test: CheckPatch - PASS
Desc: Run checkpatch.pl script with rule in .checkpatch.conf

##############################
Test: GitLint - PASS
Desc: Run gitlint with rule in .gitlint

##############################
Test: Prep - Setup ELL - PASS
Desc: Clone, build, and install ELL

##############################
Test: Build - Prep - PASS
Desc: Prepare environment for build

##############################
Test: Build - Configure - PASS
Desc: Configure the BlueZ source tree

##############################
Test: Build - Make - PASS
Desc: Build the BlueZ source tree

##############################
Test: Make Check - PASS
Desc: Run 'make check'

##############################
Test: Make Distcheck - PASS
Desc: Run distcheck to check the distribution

##############################
Test: Build w/ext ELL - Configure - PASS
Desc: Configure BlueZ source with '--enable-external-ell' configuration

##############################
Test: Build w/ext ELL - Make - PASS
Desc: Build BlueZ source with '--enable-external-ell' configuration

Quoted 4 lines

---
Regards,
Linux Bluetooth

Pushed.

Signature · 1 line
Luiz Augusto von Dentz