summaryrefslogtreecommitdiff
path: root/include/net/bluetooth/hci_core.h
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2011-08-17 16:23:00 +0300
committerGustavo F. Padovan <padovan@profusion.mobi>2011-09-21 12:58:10 -0300
commit52087a792c1513b85de674a4fc67fb92855474c3 (patch)
tree4b7bf7510a44378a5cecfcb66d22364624c2dd56 /include/net/bluetooth/hci_core.h
parentda3ba88a9996cd64c6768bed5727e02da81e2c8d (diff)
downloadlinux-3.10-52087a792c1513b85de674a4fc67fb92855474c3.tar.gz
linux-3.10-52087a792c1513b85de674a4fc67fb92855474c3.tar.bz2
linux-3.10-52087a792c1513b85de674a4fc67fb92855474c3.zip
Bluetooth: make use of connection number to optimize the scheduler
This checks if there is any existing connection according to its type before start iterating in the list and immediately stop iterating when reaching the number of connections. Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'include/net/bluetooth/hci_core.h')
-rw-r--r--include/net/bluetooth/hci_core.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 8f441b8b296..e2ba4d6b419 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -395,6 +395,22 @@ static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c)
}
}
+static inline unsigned int hci_conn_num(struct hci_dev *hdev, __u8 type)
+{
+ struct hci_conn_hash *h = &hdev->conn_hash;
+ switch (type) {
+ case ACL_LINK:
+ return h->acl_num;
+ case LE_LINK:
+ return h->le_num;
+ case SCO_LINK:
+ case ESCO_LINK:
+ return h->sco_num;
+ default:
+ return 0;
+ }
+}
+
static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev,
__u16 handle)
{