Skip to contentSkip to conversation

Bluetooth: Defer connection-parameter removal when unpairing

PATCH In review Alfonso Acosta 3 participants 4 messages Oct 11, 2014 – Oct 15, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v6 1/1 Bluetooth: Defer connection-parameter removal when unpairing

Systematically removing the LE connection parameters and autoconnect action is inconvenient for rebonding without disconnecting from userland (i.e. unpairing followed by repairing without disconnecting). The parameters will be lost after unparing and userland needs to take care of book-keeping them and re-adding them.

This patch allows userland to forget about parameter management when rebonding without disconnecting. It defers clearing the connection parameters when unparing without disconnecting, giving a chance of keeping the parameters if a repairing happens before the connection is closed.

include/net/bluetooth/hci_core.h +1 -0
index 07ddeed62..b8685a7 100644
@@ -555,6 +555,7 @@ enum {
 	HCI_CONN_STK_ENCRYPT,
 	HCI_CONN_AUTH_INITIATOR,
 	HCI_CONN_DROP,
+	HCI_CONN_PARAM_REMOVAL_PEND,
 };
 
 static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)
net/bluetooth/hci_conn.c +3 -0
index b9517bd..11aac06 100644
@@ -544,6 +544,9 @@ int hci_conn_del(struct hci_conn *conn)
 
 	hci_conn_del_sysfs(conn);
 
+	if (test_bit(HCI_CONN_PARAM_REMOVAL_PEND, &conn->flags))
+		hci_conn_params_del(conn->hdev, &conn->dst, conn->dst_type);
+
 	hci_dev_put(hdev);
 
 	hci_conn_put(conn);
net/bluetooth/mgmt.c +38 -13

79 lines not on this page · raw message

Signature · 1 line
1.9.1
maintainer Acked-by on v6 1/1
#1 lore raw

Hi Alfonso,

Quoted 6 lines

Systematically removing the LE connection parameters and autoconnect action is inconvenient for rebonding without disconnecting from userland (i.e. unpairing followed by repairing without disconnecting). The parameters will be lost after unparing and userland needs to take care of book-keeping them and re-adding them.

Quoted 7 lines

This patch allows userland to forget about parameter management when rebonding without disconnecting. It defers clearing the connection parameters when unparing without disconnecting, giving a chance of keeping the parameters if a repairing happens before the connection is closed.

patch looks good, but I wonder why we do not have a diffstat here. Are you not using git format-patch and git send-email to send patches? If not, then you might want to start with that.

Anyhow, since we are in the middle of the merge window for 3.18, I am not yet applying the patch to bluetooth-next, but just for reference here, ack from my side.

Regards

Marcel

#2 lore raw

Hi Marcel

Quoted 1 line

patch looks good, but I wonder why we do not have a diffstat here. Are you not using git format-patch and git send-email to send patches? If not, then you might want to start with that.

I am indeed using format-patch. I went through my commands and I saw I inserted a -p by error (probably a residue of "log -p").

Do you want me to send a new patch with the stats?

Signature · 5 lines
Alfonso Acosta

Embedded Systems Engineer at Spotify
Birger Jarlsgatan 61, Stockholm, Sweden
http://www.spotify.com
#3 lore raw
In reply to Alfonso Acosta

Hi Alfonso,

Quoted 6 lines · Alfonso Acosta

Systematically removing the LE connection parameters and autoconnect action is inconvenient for rebonding without disconnecting from userland (i.e. unpairing followed by repairing without disconnecting). The parameters will be lost after unparing and userland needs to take care of book-keeping them and re-adding them.

Quoted 7 lines

This patch allows userland to forget about parameter management when rebonding without disconnecting. It defers clearing the connection parameters when unparing without disconnecting, giving a chance of keeping the parameters if a repairing happens before the connection is closed.

This patch has now been applied to the bluetooth-next tree. Thanks.

Johan