Bluetooth: convert conn hash to RCU

Handling hci_conn_hash with RCU make us avoid some locking and disable
tasklets.

Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
This commit is contained in:
Gustavo F. Padovan
2011-12-14 22:54:12 -02:00
parent 8192edef03
commit bf4c632524
3 changed files with 62 additions and 36 deletions

View File

@@ -418,18 +418,17 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
hci_dev_hold(hdev);
tasklet_disable(&hdev->tx_task);
hci_conn_hash_add(hdev, conn);
if (hdev->notify)
if (hdev->notify) {
tasklet_disable(&hdev->tx_task);
hdev->notify(hdev, HCI_NOTIFY_CONN_ADD);
tasklet_enable(&hdev->tx_task);
}
atomic_set(&conn->devref, 0);
hci_conn_init_sysfs(conn);
tasklet_enable(&hdev->tx_task);
return conn;
}
@@ -465,15 +464,15 @@ int hci_conn_del(struct hci_conn *conn)
}
}
tasklet_disable(&hdev->tx_task);
hci_chan_list_flush(conn);
hci_conn_hash_del(hdev, conn);
if (hdev->notify)
if (hdev->notify) {
tasklet_disable(&hdev->tx_task);
hdev->notify(hdev, HCI_NOTIFY_CONN_DEL);
tasklet_enable(&hdev->tx_task);
tasklet_enable(&hdev->tx_task);
}
skb_queue_purge(&conn->data_q);
@@ -808,7 +807,7 @@ void hci_conn_hash_flush(struct hci_dev *hdev)
BT_DBG("hdev %s", hdev->name);
list_for_each_entry(c, &h->list, list) {
list_for_each_entry_rcu(c, &h->list, list) {
c->state = BT_CLOSED;
hci_proto_disconn_cfm(c, HCI_ERROR_LOCAL_HOST_TERM);