diff options
author | David S. Miller <davem@davemloft.net> | 2010-07-01 20:34:14 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-07-01 20:34:14 -0400 |
commit | 05318bc905467237d4aa68a701f6e92a2b332218 (patch) | |
tree | 3b7577383bca50aeb442568aa16cf8f2167b8694 /drivers/net/wireless/at76c50x-usb.c | |
parent | ea812ca1b06113597adcd8e70c0f84a413d97544 (diff) | |
parent | 88c1f4f6dffe66e2fed8e7e3276e091ee850bed0 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6
Conflicts:
drivers/net/wireless/libertas/host.h
Diffstat (limited to 'drivers/net/wireless/at76c50x-usb.c')
-rw-r--r-- | drivers/net/wireless/at76c50x-usb.c | 108 |
1 files changed, 72 insertions, 36 deletions
diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c index 429b281d40d1..cd8caeab86ea 100644 --- a/drivers/net/wireless/at76c50x-usb.c +++ b/drivers/net/wireless/at76c50x-usb.c | |||
@@ -7,6 +7,7 @@ | |||
7 | * Copyright (c) 2004 Balint Seeber <n0_5p4m_p13453@hotmail.com> | 7 | * Copyright (c) 2004 Balint Seeber <n0_5p4m_p13453@hotmail.com> |
8 | * Copyright (c) 2007 Guido Guenther <agx@sigxcpu.org> | 8 | * Copyright (c) 2007 Guido Guenther <agx@sigxcpu.org> |
9 | * Copyright (c) 2007 Kalle Valo <kalle.valo@iki.fi> | 9 | * Copyright (c) 2007 Kalle Valo <kalle.valo@iki.fi> |
10 | * Copyright (c) 2010 Sebastian Smolorz <sesmo@gmx.net> | ||
10 | * | 11 | * |
11 | * This program is free software; you can redistribute it and/or | 12 | * This program is free software; you can redistribute it and/or |
12 | * modify it under the terms of the GNU General Public License as | 13 | * modify it under the terms of the GNU General Public License as |
@@ -1649,6 +1650,58 @@ exit: | |||
1649 | return NULL; | 1650 | return NULL; |
1650 | } | 1651 | } |
1651 | 1652 | ||
1653 | static int at76_join(struct at76_priv *priv) | ||
1654 | { | ||
1655 | struct at76_req_join join; | ||
1656 | int ret; | ||
1657 | |||
1658 | memset(&join, 0, sizeof(struct at76_req_join)); | ||
1659 | memcpy(join.essid, priv->essid, priv->essid_size); | ||
1660 | join.essid_size = priv->essid_size; | ||
1661 | memcpy(join.bssid, priv->bssid, ETH_ALEN); | ||
1662 | join.bss_type = INFRASTRUCTURE_MODE; | ||
1663 | join.channel = priv->channel; | ||
1664 | join.timeout = cpu_to_le16(2000); | ||
1665 | |||
1666 | at76_dbg(DBG_MAC80211, "%s: sending CMD_JOIN", __func__); | ||
1667 | ret = at76_set_card_command(priv->udev, CMD_JOIN, &join, | ||
1668 | sizeof(struct at76_req_join)); | ||
1669 | |||
1670 | if (ret < 0) { | ||
1671 | printk(KERN_ERR "%s: at76_set_card_command failed: %d\n", | ||
1672 | wiphy_name(priv->hw->wiphy), ret); | ||
1673 | return 0; | ||
1674 | } | ||
1675 | |||
1676 | ret = at76_wait_completion(priv, CMD_JOIN); | ||
1677 | at76_dbg(DBG_MAC80211, "%s: CMD_JOIN returned: 0x%02x", __func__, ret); | ||
1678 | if (ret != CMD_STATUS_COMPLETE) { | ||
1679 | printk(KERN_ERR "%s: at76_wait_completion failed: %d\n", | ||
1680 | wiphy_name(priv->hw->wiphy), ret); | ||
1681 | return 0; | ||
1682 | } | ||
1683 | |||
1684 | at76_set_pm_mode(priv); | ||
1685 | |||
1686 | return 0; | ||
1687 | } | ||
1688 | |||
1689 | static void at76_work_join_bssid(struct work_struct *work) | ||
1690 | { | ||
1691 | struct at76_priv *priv = container_of(work, struct at76_priv, | ||
1692 | work_join_bssid); | ||
1693 | |||
1694 | if (priv->device_unplugged) | ||
1695 | return; | ||
1696 | |||
1697 | mutex_lock(&priv->mtx); | ||
1698 | |||
1699 | if (is_valid_ether_addr(priv->bssid)) | ||
1700 | at76_join(priv); | ||
1701 | |||
1702 | mutex_unlock(&priv->mtx); | ||
1703 | } | ||
1704 | |||
1652 | static void at76_mac80211_tx_callback(struct urb *urb) | 1705 | static void at76_mac80211_tx_callback(struct urb *urb) |
1653 | { | 1706 | { |
1654 | struct at76_priv *priv = urb->context; | 1707 | struct at76_priv *priv = urb->context; |
@@ -1686,6 +1739,7 @@ static int at76_mac80211_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1686 | struct at76_priv *priv = hw->priv; | 1739 | struct at76_priv *priv = hw->priv; |
1687 | struct at76_tx_buffer *tx_buffer = priv->bulk_out_buffer; | 1740 | struct at76_tx_buffer *tx_buffer = priv->bulk_out_buffer; |
1688 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 1741 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
1742 | struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; | ||
1689 | int padding, submit_len, ret; | 1743 | int padding, submit_len, ret; |
1690 | 1744 | ||
1691 | at76_dbg(DBG_MAC80211, "%s()", __func__); | 1745 | at76_dbg(DBG_MAC80211, "%s()", __func__); |
@@ -1696,6 +1750,21 @@ static int at76_mac80211_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1696 | return NETDEV_TX_BUSY; | 1750 | return NETDEV_TX_BUSY; |
1697 | } | 1751 | } |
1698 | 1752 | ||
1753 | /* The following code lines are important when the device is going to | ||
1754 | * authenticate with a new bssid. The driver must send CMD_JOIN before | ||
1755 | * an authentication frame is transmitted. For this to succeed, the | ||
1756 | * correct bssid of the AP must be known. As mac80211 does not inform | ||
1757 | * drivers about the bssid prior to the authentication process the | ||
1758 | * following workaround is necessary. If the TX frame is an | ||
1759 | * authentication frame extract the bssid and send the CMD_JOIN. */ | ||
1760 | if (mgmt->frame_control & cpu_to_le16(IEEE80211_STYPE_AUTH)) { | ||
1761 | if (compare_ether_addr(priv->bssid, mgmt->bssid)) { | ||
1762 | memcpy(priv->bssid, mgmt->bssid, ETH_ALEN); | ||
1763 | ieee80211_queue_work(hw, &priv->work_join_bssid); | ||
1764 | return NETDEV_TX_BUSY; | ||
1765 | } | ||
1766 | } | ||
1767 | |||
1699 | ieee80211_stop_queues(hw); | 1768 | ieee80211_stop_queues(hw); |
1700 | 1769 | ||
1701 | at76_ledtrig_tx_activity(); /* tell ledtrigger we send a packet */ | 1770 | at76_ledtrig_tx_activity(); /* tell ledtrigger we send a packet */ |
@@ -1770,6 +1839,7 @@ static void at76_mac80211_stop(struct ieee80211_hw *hw) | |||
1770 | at76_dbg(DBG_MAC80211, "%s()", __func__); | 1839 | at76_dbg(DBG_MAC80211, "%s()", __func__); |
1771 | 1840 | ||
1772 | cancel_delayed_work(&priv->dwork_hw_scan); | 1841 | cancel_delayed_work(&priv->dwork_hw_scan); |
1842 | cancel_work_sync(&priv->work_join_bssid); | ||
1773 | cancel_work_sync(&priv->work_set_promisc); | 1843 | cancel_work_sync(&priv->work_set_promisc); |
1774 | 1844 | ||
1775 | mutex_lock(&priv->mtx); | 1845 | mutex_lock(&priv->mtx); |
@@ -1818,42 +1888,6 @@ static void at76_remove_interface(struct ieee80211_hw *hw, | |||
1818 | at76_dbg(DBG_MAC80211, "%s()", __func__); | 1888 | at76_dbg(DBG_MAC80211, "%s()", __func__); |
1819 | } | 1889 | } |
1820 | 1890 | ||
1821 | static int at76_join(struct at76_priv *priv) | ||
1822 | { | ||
1823 | struct at76_req_join join; | ||
1824 | int ret; | ||
1825 | |||
1826 | memset(&join, 0, sizeof(struct at76_req_join)); | ||
1827 | memcpy(join.essid, priv->essid, priv->essid_size); | ||
1828 | join.essid_size = priv->essid_size; | ||
1829 | memcpy(join.bssid, priv->bssid, ETH_ALEN); | ||
1830 | join.bss_type = INFRASTRUCTURE_MODE; | ||
1831 | join.channel = priv->channel; | ||
1832 | join.timeout = cpu_to_le16(2000); | ||
1833 | |||
1834 | at76_dbg(DBG_MAC80211, "%s: sending CMD_JOIN", __func__); | ||
1835 | ret = at76_set_card_command(priv->udev, CMD_JOIN, &join, | ||
1836 | sizeof(struct at76_req_join)); | ||
1837 | |||
1838 | if (ret < 0) { | ||
1839 | printk(KERN_ERR "%s: at76_set_card_command failed: %d\n", | ||
1840 | wiphy_name(priv->hw->wiphy), ret); | ||
1841 | return 0; | ||
1842 | } | ||
1843 | |||
1844 | ret = at76_wait_completion(priv, CMD_JOIN); | ||
1845 | at76_dbg(DBG_MAC80211, "%s: CMD_JOIN returned: 0x%02x", __func__, ret); | ||
1846 | if (ret != CMD_STATUS_COMPLETE) { | ||
1847 | printk(KERN_ERR "%s: at76_wait_completion failed: %d\n", | ||
1848 | wiphy_name(priv->hw->wiphy), ret); | ||
1849 | return 0; | ||
1850 | } | ||
1851 | |||
1852 | at76_set_pm_mode(priv); | ||
1853 | |||
1854 | return 0; | ||
1855 | } | ||
1856 | |||
1857 | static void at76_dwork_hw_scan(struct work_struct *work) | 1891 | static void at76_dwork_hw_scan(struct work_struct *work) |
1858 | { | 1892 | { |
1859 | struct at76_priv *priv = container_of(work, struct at76_priv, | 1893 | struct at76_priv *priv = container_of(work, struct at76_priv, |
@@ -2107,6 +2141,7 @@ static struct at76_priv *at76_alloc_new_device(struct usb_device *udev) | |||
2107 | mutex_init(&priv->mtx); | 2141 | mutex_init(&priv->mtx); |
2108 | INIT_WORK(&priv->work_set_promisc, at76_work_set_promisc); | 2142 | INIT_WORK(&priv->work_set_promisc, at76_work_set_promisc); |
2109 | INIT_WORK(&priv->work_submit_rx, at76_work_submit_rx); | 2143 | INIT_WORK(&priv->work_submit_rx, at76_work_submit_rx); |
2144 | INIT_WORK(&priv->work_join_bssid, at76_work_join_bssid); | ||
2110 | INIT_DELAYED_WORK(&priv->dwork_hw_scan, at76_dwork_hw_scan); | 2145 | INIT_DELAYED_WORK(&priv->dwork_hw_scan, at76_dwork_hw_scan); |
2111 | 2146 | ||
2112 | tasklet_init(&priv->rx_tasklet, at76_rx_tasklet, 0); | 2147 | tasklet_init(&priv->rx_tasklet, at76_rx_tasklet, 0); |
@@ -2508,5 +2543,6 @@ MODULE_AUTHOR("Balint Seeber <n0_5p4m_p13453@hotmail.com>"); | |||
2508 | MODULE_AUTHOR("Pavel Roskin <proski@gnu.org>"); | 2543 | MODULE_AUTHOR("Pavel Roskin <proski@gnu.org>"); |
2509 | MODULE_AUTHOR("Guido Guenther <agx@sigxcpu.org>"); | 2544 | MODULE_AUTHOR("Guido Guenther <agx@sigxcpu.org>"); |
2510 | MODULE_AUTHOR("Kalle Valo <kalle.valo@iki.fi>"); | 2545 | MODULE_AUTHOR("Kalle Valo <kalle.valo@iki.fi>"); |
2546 | MODULE_AUTHOR("Sebastian Smolorz <sesmo@gmx.net>"); | ||
2511 | MODULE_DESCRIPTION(DRIVER_DESC); | 2547 | MODULE_DESCRIPTION(DRIVER_DESC); |
2512 | MODULE_LICENSE("GPL"); | 2548 | MODULE_LICENSE("GPL"); |