Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Conflicts: drivers/net/wireless/rtlwifi/pci.c include/linux/netlink.h
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/rfkill.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/crypto.h>
|
||||
#include <net/sock.h>
|
||||
|
||||
#include <asm/system.h>
|
||||
@@ -59,6 +60,8 @@ static void hci_tx_task(unsigned long arg);
|
||||
|
||||
static DEFINE_RWLOCK(hci_task_lock);
|
||||
|
||||
static int enable_smp;
|
||||
|
||||
/* HCI device list */
|
||||
LIST_HEAD(hci_dev_list);
|
||||
DEFINE_RWLOCK(hci_dev_list_lock);
|
||||
@@ -1202,6 +1205,177 @@ int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash,
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev,
|
||||
bdaddr_t *bdaddr)
|
||||
{
|
||||
struct list_head *p;
|
||||
|
||||
list_for_each(p, &hdev->blacklist) {
|
||||
struct bdaddr_list *b;
|
||||
|
||||
b = list_entry(p, struct bdaddr_list, list);
|
||||
|
||||
if (bacmp(bdaddr, &b->bdaddr) == 0)
|
||||
return b;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int hci_blacklist_clear(struct hci_dev *hdev)
|
||||
{
|
||||
struct list_head *p, *n;
|
||||
|
||||
list_for_each_safe(p, n, &hdev->blacklist) {
|
||||
struct bdaddr_list *b;
|
||||
|
||||
b = list_entry(p, struct bdaddr_list, list);
|
||||
|
||||
list_del(p);
|
||||
kfree(b);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr)
|
||||
{
|
||||
struct bdaddr_list *entry;
|
||||
int err;
|
||||
|
||||
if (bacmp(bdaddr, BDADDR_ANY) == 0)
|
||||
return -EBADF;
|
||||
|
||||
hci_dev_lock(hdev);
|
||||
|
||||
if (hci_blacklist_lookup(hdev, bdaddr)) {
|
||||
err = -EEXIST;
|
||||
goto err;
|
||||
}
|
||||
|
||||
entry = kzalloc(sizeof(struct bdaddr_list), GFP_KERNEL);
|
||||
if (!entry) {
|
||||
return -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
|
||||
bacpy(&entry->bdaddr, bdaddr);
|
||||
|
||||
list_add(&entry->list, &hdev->blacklist);
|
||||
|
||||
err = 0;
|
||||
|
||||
err:
|
||||
hci_dev_unlock(hdev);
|
||||
return err;
|
||||
}
|
||||
|
||||
int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr)
|
||||
{
|
||||
struct bdaddr_list *entry;
|
||||
int err = 0;
|
||||
|
||||
hci_dev_lock(hdev);
|
||||
|
||||
if (bacmp(bdaddr, BDADDR_ANY) == 0) {
|
||||
hci_blacklist_clear(hdev);
|
||||
goto done;
|
||||
}
|
||||
|
||||
entry = hci_blacklist_lookup(hdev, bdaddr);
|
||||
if (!entry) {
|
||||
err = -ENOENT;
|
||||
goto done;
|
||||
}
|
||||
|
||||
list_del(&entry->list);
|
||||
kfree(entry);
|
||||
|
||||
done:
|
||||
hci_dev_unlock(hdev);
|
||||
return err;
|
||||
}
|
||||
|
||||
static void hci_clear_adv_cache(unsigned long arg)
|
||||
{
|
||||
struct hci_dev *hdev = (void *) arg;
|
||||
|
||||
hci_dev_lock(hdev);
|
||||
|
||||
hci_adv_entries_clear(hdev);
|
||||
|
||||
hci_dev_unlock(hdev);
|
||||
}
|
||||
|
||||
int hci_adv_entries_clear(struct hci_dev *hdev)
|
||||
{
|
||||
struct adv_entry *entry, *tmp;
|
||||
|
||||
list_for_each_entry_safe(entry, tmp, &hdev->adv_entries, list) {
|
||||
list_del(&entry->list);
|
||||
kfree(entry);
|
||||
}
|
||||
|
||||
BT_DBG("%s adv cache cleared", hdev->name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct adv_entry *hci_find_adv_entry(struct hci_dev *hdev, bdaddr_t *bdaddr)
|
||||
{
|
||||
struct adv_entry *entry;
|
||||
|
||||
list_for_each_entry(entry, &hdev->adv_entries, list)
|
||||
if (bacmp(bdaddr, &entry->bdaddr) == 0)
|
||||
return entry;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline int is_connectable_adv(u8 evt_type)
|
||||
{
|
||||
if (evt_type == ADV_IND || evt_type == ADV_DIRECT_IND)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hci_add_adv_entry(struct hci_dev *hdev,
|
||||
struct hci_ev_le_advertising_info *ev)
|
||||
{
|
||||
struct adv_entry *entry;
|
||||
|
||||
if (!is_connectable_adv(ev->evt_type))
|
||||
return -EINVAL;
|
||||
|
||||
/* Only new entries should be added to adv_entries. So, if
|
||||
* bdaddr was found, don't add it. */
|
||||
if (hci_find_adv_entry(hdev, &ev->bdaddr))
|
||||
return 0;
|
||||
|
||||
entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
|
||||
if (!entry)
|
||||
return -ENOMEM;
|
||||
|
||||
bacpy(&entry->bdaddr, &ev->bdaddr);
|
||||
entry->bdaddr_type = ev->bdaddr_type;
|
||||
|
||||
list_add(&entry->list, &hdev->adv_entries);
|
||||
|
||||
BT_DBG("%s adv entry added: address %s type %u", hdev->name,
|
||||
batostr(&entry->bdaddr), entry->bdaddr_type);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct crypto_blkcipher *alloc_cypher(void)
|
||||
{
|
||||
if (enable_smp)
|
||||
return crypto_alloc_blkcipher("ecb(aes)", 0, CRYPTO_ALG_ASYNC);
|
||||
|
||||
return ERR_PTR(-ENOTSUPP);
|
||||
}
|
||||
|
||||
/* Register HCI device */
|
||||
int hci_register_dev(struct hci_dev *hdev)
|
||||
{
|
||||
@@ -1268,6 +1442,10 @@ int hci_register_dev(struct hci_dev *hdev)
|
||||
|
||||
INIT_LIST_HEAD(&hdev->remote_oob_data);
|
||||
|
||||
INIT_LIST_HEAD(&hdev->adv_entries);
|
||||
setup_timer(&hdev->adv_timer, hci_clear_adv_cache,
|
||||
(unsigned long) hdev);
|
||||
|
||||
INIT_WORK(&hdev->power_on, hci_power_on);
|
||||
INIT_WORK(&hdev->power_off, hci_power_off);
|
||||
setup_timer(&hdev->off_timer, hci_auto_off, (unsigned long) hdev);
|
||||
@@ -1282,6 +1460,11 @@ int hci_register_dev(struct hci_dev *hdev)
|
||||
if (!hdev->workqueue)
|
||||
goto nomem;
|
||||
|
||||
hdev->tfm = alloc_cypher();
|
||||
if (IS_ERR(hdev->tfm))
|
||||
BT_INFO("Failed to load transform for ecb(aes): %ld",
|
||||
PTR_ERR(hdev->tfm));
|
||||
|
||||
hci_register_sysfs(hdev);
|
||||
|
||||
hdev->rfkill = rfkill_alloc(hdev->name, &hdev->dev,
|
||||
@@ -1330,6 +1513,9 @@ int hci_unregister_dev(struct hci_dev *hdev)
|
||||
!test_bit(HCI_SETUP, &hdev->flags))
|
||||
mgmt_index_removed(hdev->id);
|
||||
|
||||
if (!IS_ERR(hdev->tfm))
|
||||
crypto_free_blkcipher(hdev->tfm);
|
||||
|
||||
hci_notify(hdev, HCI_DEV_UNREG);
|
||||
|
||||
if (hdev->rfkill) {
|
||||
@@ -1340,6 +1526,7 @@ int hci_unregister_dev(struct hci_dev *hdev)
|
||||
hci_unregister_sysfs(hdev);
|
||||
|
||||
hci_del_off_timer(hdev);
|
||||
del_timer(&hdev->adv_timer);
|
||||
|
||||
destroy_workqueue(hdev->workqueue);
|
||||
|
||||
@@ -1348,6 +1535,7 @@ int hci_unregister_dev(struct hci_dev *hdev)
|
||||
hci_uuids_clear(hdev);
|
||||
hci_link_keys_clear(hdev);
|
||||
hci_remote_oob_data_clear(hdev);
|
||||
hci_adv_entries_clear(hdev);
|
||||
hci_dev_unlock_bh(hdev);
|
||||
|
||||
__hci_dev_put(hdev);
|
||||
@@ -1891,7 +2079,7 @@ static inline void hci_sched_acl(struct hci_dev *hdev)
|
||||
while (quote-- && (skb = skb_dequeue(&conn->data_q))) {
|
||||
BT_DBG("skb %p len %d", skb, skb->len);
|
||||
|
||||
hci_conn_enter_active_mode(conn);
|
||||
hci_conn_enter_active_mode(conn, bt_cb(skb)->force_active);
|
||||
|
||||
hci_send_frame(skb);
|
||||
hdev->acl_last_tx = jiffies;
|
||||
@@ -2030,7 +2218,7 @@ static inline void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
if (conn) {
|
||||
register struct hci_proto *hp;
|
||||
|
||||
hci_conn_enter_active_mode(conn);
|
||||
hci_conn_enter_active_mode(conn, bt_cb(skb)->force_active);
|
||||
|
||||
/* Send to upper protocol */
|
||||
hp = hci_proto[HCI_PROTO_L2CAP];
|
||||
@@ -2164,3 +2352,6 @@ static void hci_cmd_task(unsigned long arg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module_param(enable_smp, bool, 0644);
|
||||
MODULE_PARM_DESC(enable_smp, "Enable SMP support (LE only)");
|
||||
|
Reference in New Issue
Block a user