diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-06-12 23:35:10 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-06-12 23:35:10 -0400 |
commit | a0e1d1d075cc0efe9a3ac8579bce9393d070e09f (patch) | |
tree | 92964216b94d2f9753c2ec043ab5a121f22bbd6d /drivers | |
parent | dd14cbc994709a1c5a64ed3621f583c49a27e521 (diff) | |
parent | b232923966f1210e1183353bbd1d52ee53b79fbf (diff) |
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: (89 commits)
myri10ge: update driver version
myri10ge: report when the link partner is running in Myrinet mode
myri10ge: limit the number of recoveries
NetXen: Fix link status messages
Revert "[netdrvr e100] experiment with doing RX in a similar manner to eepro100"
[PATCH] libertas: convert libertas_mpp into anycast_mask
[PATCH] libertas: actually send mesh frames to mesh netdev
[PATCH] libertas: deauthenticate from AP in channel switch
[PATCH] libertas: pull current channel from firmware on mesh autostart
[PATCH] libertas: reduce SSID and BSSID mixed-case abuse
[PATCH] libertas: remove WPA_SUPPLICANT structure
[PATCH] libertas: remove structure WLAN_802_11_SSID and libertas_escape_essid
[PATCH] libertas: tweak association debug output
[PATCH] libertas: fix big-endian associate command.
[PATCH] libertas: don't byte-swap firmware version number. It's a byte array.
[PATCH] libertas: more endianness fixes, in tx.c this time
[PATCH] libertas: More endianness fixes.
[PATCH] libertas: first pass at fixing up endianness issues
[PATCH] libertas: sparse fixes
[PATCH] libertas: fix character set in README
...
Diffstat (limited to 'drivers')
49 files changed, 4001 insertions, 3778 deletions
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 61696637a21e..763810c7f33a 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -285,6 +285,12 @@ enum scb_status { | |||
285 | rus_mask = 0x3C, | 285 | rus_mask = 0x3C, |
286 | }; | 286 | }; |
287 | 287 | ||
288 | enum ru_state { | ||
289 | RU_SUSPENDED = 0, | ||
290 | RU_RUNNING = 1, | ||
291 | RU_UNINITIALIZED = -1, | ||
292 | }; | ||
293 | |||
288 | enum scb_stat_ack { | 294 | enum scb_stat_ack { |
289 | stat_ack_not_ours = 0x00, | 295 | stat_ack_not_ours = 0x00, |
290 | stat_ack_sw_gen = 0x04, | 296 | stat_ack_sw_gen = 0x04, |
@@ -526,6 +532,7 @@ struct nic { | |||
526 | struct rx *rx_to_use; | 532 | struct rx *rx_to_use; |
527 | struct rx *rx_to_clean; | 533 | struct rx *rx_to_clean; |
528 | struct rfd blank_rfd; | 534 | struct rfd blank_rfd; |
535 | enum ru_state ru_running; | ||
529 | 536 | ||
530 | spinlock_t cb_lock ____cacheline_aligned; | 537 | spinlock_t cb_lock ____cacheline_aligned; |
531 | spinlock_t cmd_lock; | 538 | spinlock_t cmd_lock; |
@@ -947,7 +954,7 @@ static void e100_get_defaults(struct nic *nic) | |||
947 | ((nic->mac >= mac_82558_D101_A4) ? cb_cid : cb_i)); | 954 | ((nic->mac >= mac_82558_D101_A4) ? cb_cid : cb_i)); |
948 | 955 | ||
949 | /* Template for a freshly allocated RFD */ | 956 | /* Template for a freshly allocated RFD */ |
950 | nic->blank_rfd.command = cpu_to_le16(cb_el & cb_s); | 957 | nic->blank_rfd.command = cpu_to_le16(cb_el); |
951 | nic->blank_rfd.rbd = 0xFFFFFFFF; | 958 | nic->blank_rfd.rbd = 0xFFFFFFFF; |
952 | nic->blank_rfd.size = cpu_to_le16(VLAN_ETH_FRAME_LEN); | 959 | nic->blank_rfd.size = cpu_to_le16(VLAN_ETH_FRAME_LEN); |
953 | 960 | ||
@@ -1742,11 +1749,19 @@ static int e100_alloc_cbs(struct nic *nic) | |||
1742 | return 0; | 1749 | return 0; |
1743 | } | 1750 | } |
1744 | 1751 | ||
1745 | static inline void e100_start_receiver(struct nic *nic) | 1752 | static inline void e100_start_receiver(struct nic *nic, struct rx *rx) |
1746 | { | 1753 | { |
1747 | /* Start if RFA is non-NULL */ | 1754 | if(!nic->rxs) return; |
1748 | if(nic->rx_to_clean->skb) | 1755 | if(RU_SUSPENDED != nic->ru_running) return; |
1749 | e100_exec_cmd(nic, ruc_start, nic->rx_to_clean->dma_addr); | 1756 | |
1757 | /* handle init time starts */ | ||
1758 | if(!rx) rx = nic->rxs; | ||
1759 | |||
1760 | /* (Re)start RU if suspended or idle and RFA is non-NULL */ | ||
1761 | if(rx->skb) { | ||
1762 | e100_exec_cmd(nic, ruc_start, rx->dma_addr); | ||
1763 | nic->ru_running = RU_RUNNING; | ||
1764 | } | ||
1750 | } | 1765 | } |
1751 | 1766 | ||
1752 | #define RFD_BUF_LEN (sizeof(struct rfd) + VLAN_ETH_FRAME_LEN) | 1767 | #define RFD_BUF_LEN (sizeof(struct rfd) + VLAN_ETH_FRAME_LEN) |
@@ -1775,7 +1790,7 @@ static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx) | |||
1775 | put_unaligned(cpu_to_le32(rx->dma_addr), | 1790 | put_unaligned(cpu_to_le32(rx->dma_addr), |
1776 | (u32 *)&prev_rfd->link); | 1791 | (u32 *)&prev_rfd->link); |
1777 | wmb(); | 1792 | wmb(); |
1778 | prev_rfd->command &= ~cpu_to_le16(cb_el & cb_s); | 1793 | prev_rfd->command &= ~cpu_to_le16(cb_el); |
1779 | pci_dma_sync_single_for_device(nic->pdev, rx->prev->dma_addr, | 1794 | pci_dma_sync_single_for_device(nic->pdev, rx->prev->dma_addr, |
1780 | sizeof(struct rfd), PCI_DMA_TODEVICE); | 1795 | sizeof(struct rfd), PCI_DMA_TODEVICE); |
1781 | } | 1796 | } |
@@ -1813,6 +1828,10 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx, | |||
1813 | pci_unmap_single(nic->pdev, rx->dma_addr, | 1828 | pci_unmap_single(nic->pdev, rx->dma_addr, |
1814 | RFD_BUF_LEN, PCI_DMA_FROMDEVICE); | 1829 | RFD_BUF_LEN, PCI_DMA_FROMDEVICE); |
1815 | 1830 | ||
1831 | /* this allows for a fast restart without re-enabling interrupts */ | ||
1832 | if(le16_to_cpu(rfd->command) & cb_el) | ||
1833 | nic->ru_running = RU_SUSPENDED; | ||
1834 | |||
1816 | /* Pull off the RFD and put the actual data (minus eth hdr) */ | 1835 | /* Pull off the RFD and put the actual data (minus eth hdr) */ |
1817 | skb_reserve(skb, sizeof(struct rfd)); | 1836 | skb_reserve(skb, sizeof(struct rfd)); |
1818 | skb_put(skb, actual_size); | 1837 | skb_put(skb, actual_size); |
@@ -1843,18 +1862,45 @@ static void e100_rx_clean(struct nic *nic, unsigned int *work_done, | |||
1843 | unsigned int work_to_do) | 1862 | unsigned int work_to_do) |
1844 | { | 1863 | { |
1845 | struct rx *rx; | 1864 | struct rx *rx; |
1865 | int restart_required = 0; | ||
1866 | struct rx *rx_to_start = NULL; | ||
1867 | |||
1868 | /* are we already rnr? then pay attention!!! this ensures that | ||
1869 | * the state machine progression never allows a start with a | ||
1870 | * partially cleaned list, avoiding a race between hardware | ||
1871 | * and rx_to_clean when in NAPI mode */ | ||
1872 | if(RU_SUSPENDED == nic->ru_running) | ||
1873 | restart_required = 1; | ||
1846 | 1874 | ||
1847 | /* Indicate newly arrived packets */ | 1875 | /* Indicate newly arrived packets */ |
1848 | for(rx = nic->rx_to_clean; rx->skb; rx = nic->rx_to_clean = rx->next) { | 1876 | for(rx = nic->rx_to_clean; rx->skb; rx = nic->rx_to_clean = rx->next) { |
1849 | if(e100_rx_indicate(nic, rx, work_done, work_to_do)) | 1877 | int err = e100_rx_indicate(nic, rx, work_done, work_to_do); |
1878 | if(-EAGAIN == err) { | ||
1879 | /* hit quota so have more work to do, restart once | ||
1880 | * cleanup is complete */ | ||
1881 | restart_required = 0; | ||
1882 | break; | ||
1883 | } else if(-ENODATA == err) | ||
1850 | break; /* No more to clean */ | 1884 | break; /* No more to clean */ |
1851 | } | 1885 | } |
1852 | 1886 | ||
1887 | /* save our starting point as the place we'll restart the receiver */ | ||
1888 | if(restart_required) | ||
1889 | rx_to_start = nic->rx_to_clean; | ||
1890 | |||
1853 | /* Alloc new skbs to refill list */ | 1891 | /* Alloc new skbs to refill list */ |
1854 | for(rx = nic->rx_to_use; !rx->skb; rx = nic->rx_to_use = rx->next) { | 1892 | for(rx = nic->rx_to_use; !rx->skb; rx = nic->rx_to_use = rx->next) { |
1855 | if(unlikely(e100_rx_alloc_skb(nic, rx))) | 1893 | if(unlikely(e100_rx_alloc_skb(nic, rx))) |
1856 | break; /* Better luck next time (see watchdog) */ | 1894 | break; /* Better luck next time (see watchdog) */ |
1857 | } | 1895 | } |
1896 | |||
1897 | if(restart_required) { | ||
1898 | // ack the rnr? | ||
1899 | writeb(stat_ack_rnr, &nic->csr->scb.stat_ack); | ||
1900 | e100_start_receiver(nic, rx_to_start); | ||
1901 | if(work_done) | ||
1902 | (*work_done)++; | ||
1903 | } | ||
1858 | } | 1904 | } |
1859 | 1905 | ||
1860 | static void e100_rx_clean_list(struct nic *nic) | 1906 | static void e100_rx_clean_list(struct nic *nic) |
@@ -1862,6 +1908,8 @@ static void e100_rx_clean_list(struct nic *nic) | |||
1862 | struct rx *rx; | 1908 | struct rx *rx; |
1863 | unsigned int i, count = nic->params.rfds.count; | 1909 | unsigned int i, count = nic->params.rfds.count; |
1864 | 1910 | ||
1911 | nic->ru_running = RU_UNINITIALIZED; | ||
1912 | |||
1865 | if(nic->rxs) { | 1913 | if(nic->rxs) { |
1866 | for(rx = nic->rxs, i = 0; i < count; rx++, i++) { | 1914 | for(rx = nic->rxs, i = 0; i < count; rx++, i++) { |
1867 | if(rx->skb) { | 1915 | if(rx->skb) { |
@@ -1883,6 +1931,7 @@ static int e100_rx_alloc_list(struct nic *nic) | |||
1883 | unsigned int i, count = nic->params.rfds.count; | 1931 | unsigned int i, count = nic->params.rfds.count; |
1884 | 1932 | ||
1885 | nic->rx_to_use = nic->rx_to_clean = NULL; | 1933 | nic->rx_to_use = nic->rx_to_clean = NULL; |
1934 | nic->ru_running = RU_UNINITIALIZED; | ||
1886 | 1935 | ||
1887 | if(!(nic->rxs = kcalloc(count, sizeof(struct rx), GFP_ATOMIC))) | 1936 | if(!(nic->rxs = kcalloc(count, sizeof(struct rx), GFP_ATOMIC))) |
1888 | return -ENOMEM; | 1937 | return -ENOMEM; |
@@ -1897,6 +1946,7 @@ static int e100_rx_alloc_list(struct nic *nic) | |||
1897 | } | 1946 | } |
1898 | 1947 | ||
1899 | nic->rx_to_use = nic->rx_to_clean = nic->rxs; | 1948 | nic->rx_to_use = nic->rx_to_clean = nic->rxs; |
1949 | nic->ru_running = RU_SUSPENDED; | ||
1900 | 1950 | ||
1901 | return 0; | 1951 | return 0; |
1902 | } | 1952 | } |
@@ -1916,6 +1966,10 @@ static irqreturn_t e100_intr(int irq, void *dev_id) | |||
1916 | /* Ack interrupt(s) */ | 1966 | /* Ack interrupt(s) */ |
1917 | iowrite8(stat_ack, &nic->csr->scb.stat_ack); | 1967 | iowrite8(stat_ack, &nic->csr->scb.stat_ack); |
1918 | 1968 | ||
1969 | /* We hit Receive No Resource (RNR); restart RU after cleaning */ | ||
1970 | if(stat_ack & stat_ack_rnr) | ||
1971 | nic->ru_running = RU_SUSPENDED; | ||
1972 | |||
1919 | if(likely(netif_rx_schedule_prep(netdev))) { | 1973 | if(likely(netif_rx_schedule_prep(netdev))) { |
1920 | e100_disable_irq(nic); | 1974 | e100_disable_irq(nic); |
1921 | __netif_rx_schedule(netdev); | 1975 | __netif_rx_schedule(netdev); |
@@ -2007,7 +2061,7 @@ static int e100_up(struct nic *nic) | |||
2007 | if((err = e100_hw_init(nic))) | 2061 | if((err = e100_hw_init(nic))) |
2008 | goto err_clean_cbs; | 2062 | goto err_clean_cbs; |
2009 | e100_set_multicast_list(nic->netdev); | 2063 | e100_set_multicast_list(nic->netdev); |
2010 | e100_start_receiver(nic); | 2064 | e100_start_receiver(nic, NULL); |
2011 | mod_timer(&nic->watchdog, jiffies); | 2065 | mod_timer(&nic->watchdog, jiffies); |
2012 | if((err = request_irq(nic->pdev->irq, e100_intr, IRQF_SHARED, | 2066 | if((err = request_irq(nic->pdev->irq, e100_intr, IRQF_SHARED, |
2013 | nic->netdev->name, nic->netdev))) | 2067 | nic->netdev->name, nic->netdev))) |
@@ -2088,7 +2142,7 @@ static int e100_loopback_test(struct nic *nic, enum loopback loopback_mode) | |||
2088 | mdio_write(nic->netdev, nic->mii.phy_id, MII_BMCR, | 2142 | mdio_write(nic->netdev, nic->mii.phy_id, MII_BMCR, |
2089 | BMCR_LOOPBACK); | 2143 | BMCR_LOOPBACK); |
2090 | 2144 | ||
2091 | e100_start_receiver(nic); | 2145 | e100_start_receiver(nic, NULL); |
2092 | 2146 | ||
2093 | if(!(skb = netdev_alloc_skb(nic->netdev, ETH_DATA_LEN))) { | 2147 | if(!(skb = netdev_alloc_skb(nic->netdev, ETH_DATA_LEN))) { |
2094 | err = -ENOMEM; | 2148 | err = -ENOMEM; |
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index e85a933a4762..c0f81b5a30fb 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <asm/io.h> | 39 | #include <asm/io.h> |
40 | 40 | ||
41 | #define DRV_NAME "ehea" | 41 | #define DRV_NAME "ehea" |
42 | #define DRV_VERSION "EHEA_0061" | 42 | #define DRV_VERSION "EHEA_0064" |
43 | 43 | ||
44 | #define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ | 44 | #define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ |
45 | | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) | 45 | | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 152bb2016a2c..9e13433a268a 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -451,7 +451,8 @@ static struct ehea_cqe *ehea_proc_rwqes(struct net_device *dev, | |||
451 | processed_rq3++; | 451 | processed_rq3++; |
452 | } | 452 | } |
453 | 453 | ||
454 | if (cqe->status & EHEA_CQE_VLAN_TAG_XTRACT) | 454 | if ((cqe->status & EHEA_CQE_VLAN_TAG_XTRACT) |
455 | && port->vgrp) | ||
455 | vlan_hwaccel_receive_skb(skb, port->vgrp, | 456 | vlan_hwaccel_receive_skb(skb, port->vgrp, |
456 | cqe->vlan_tag); | 457 | cqe->vlan_tag); |
457 | else | 458 | else |
@@ -1910,10 +1911,7 @@ static void ehea_vlan_rx_register(struct net_device *dev, | |||
1910 | goto out; | 1911 | goto out; |
1911 | } | 1912 | } |
1912 | 1913 | ||
1913 | if (grp) | 1914 | memset(cb1->vlan_filter, 0, sizeof(cb1->vlan_filter)); |
1914 | memset(cb1->vlan_filter, 0, sizeof(cb1->vlan_filter)); | ||
1915 | else | ||
1916 | memset(cb1->vlan_filter, 0xFF, sizeof(cb1->vlan_filter)); | ||
1917 | 1915 | ||
1918 | hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id, | 1916 | hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id, |
1919 | H_PORT_CB1, H_PORT_CB1_ALL, cb1); | 1917 | H_PORT_CB1, H_PORT_CB1_ALL, cb1); |
@@ -1947,7 +1945,7 @@ static void ehea_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) | |||
1947 | } | 1945 | } |
1948 | 1946 | ||
1949 | index = (vid / 64); | 1947 | index = (vid / 64); |
1950 | cb1->vlan_filter[index] |= ((u64)(1 << (vid & 0x3F))); | 1948 | cb1->vlan_filter[index] |= ((u64)(0x8000000000000000 >> (vid & 0x3F))); |
1951 | 1949 | ||
1952 | hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id, | 1950 | hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id, |
1953 | H_PORT_CB1, H_PORT_CB1_ALL, cb1); | 1951 | H_PORT_CB1, H_PORT_CB1_ALL, cb1); |
@@ -1982,7 +1980,7 @@ static void ehea_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) | |||
1982 | } | 1980 | } |
1983 | 1981 | ||
1984 | index = (vid / 64); | 1982 | index = (vid / 64); |
1985 | cb1->vlan_filter[index] &= ~((u64)(1 << (vid & 0x3F))); | 1983 | cb1->vlan_filter[index] &= ~((u64)(0x8000000000000000 >> (vid & 0x3F))); |
1986 | 1984 | ||
1987 | hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id, | 1985 | hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id, |
1988 | H_PORT_CB1, H_PORT_CB1_ALL, cb1); | 1986 | H_PORT_CB1, H_PORT_CB1_ALL, cb1); |
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index 3bec0f733f01..6ec3d500f334 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -915,17 +915,36 @@ static int ibmveth_change_mtu(struct net_device *dev, int new_mtu) | |||
915 | { | 915 | { |
916 | struct ibmveth_adapter *adapter = dev->priv; | 916 | struct ibmveth_adapter *adapter = dev->priv; |
917 | int new_mtu_oh = new_mtu + IBMVETH_BUFF_OH; | 917 | int new_mtu_oh = new_mtu + IBMVETH_BUFF_OH; |
918 | int i; | 918 | int reinit = 0; |
919 | int i, rc; | ||
919 | 920 | ||
920 | if (new_mtu < IBMVETH_MAX_MTU) | 921 | if (new_mtu < IBMVETH_MAX_MTU) |
921 | return -EINVAL; | 922 | return -EINVAL; |
922 | 923 | ||
924 | for (i = 0; i < IbmVethNumBufferPools; i++) | ||
925 | if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) | ||
926 | break; | ||
927 | |||
928 | if (i == IbmVethNumBufferPools) | ||
929 | return -EINVAL; | ||
930 | |||
923 | /* Look for an active buffer pool that can hold the new MTU */ | 931 | /* Look for an active buffer pool that can hold the new MTU */ |
924 | for(i = 0; i<IbmVethNumBufferPools; i++) { | 932 | for(i = 0; i<IbmVethNumBufferPools; i++) { |
925 | if (!adapter->rx_buff_pool[i].active) | 933 | if (!adapter->rx_buff_pool[i].active) { |
926 | continue; | 934 | adapter->rx_buff_pool[i].active = 1; |
935 | reinit = 1; | ||
936 | } | ||
937 | |||
927 | if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) { | 938 | if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) { |
928 | dev->mtu = new_mtu; | 939 | if (reinit && netif_running(adapter->netdev)) { |
940 | adapter->pool_config = 1; | ||
941 | ibmveth_close(adapter->netdev); | ||
942 | adapter->pool_config = 0; | ||
943 | dev->mtu = new_mtu; | ||
944 | if ((rc = ibmveth_open(adapter->netdev))) | ||
945 | return rc; | ||
946 | } else | ||
947 | dev->mtu = new_mtu; | ||
929 | return 0; | 948 | return 0; |
930 | } | 949 | } |
931 | } | 950 | } |
@@ -1243,16 +1262,19 @@ const char * buf, size_t count) | |||
1243 | 1262 | ||
1244 | if (attr == &veth_active_attr) { | 1263 | if (attr == &veth_active_attr) { |
1245 | if (value && !pool->active) { | 1264 | if (value && !pool->active) { |
1246 | if(ibmveth_alloc_buffer_pool(pool)) { | 1265 | if (netif_running(netdev)) { |
1247 | ibmveth_error_printk("unable to alloc pool\n"); | 1266 | if(ibmveth_alloc_buffer_pool(pool)) { |
1248 | return -ENOMEM; | 1267 | ibmveth_error_printk("unable to alloc pool\n"); |
1249 | } | 1268 | return -ENOMEM; |
1250 | pool->active = 1; | 1269 | } |
1251 | adapter->pool_config = 1; | 1270 | pool->active = 1; |
1252 | ibmveth_close(netdev); | 1271 | adapter->pool_config = 1; |
1253 | adapter->pool_config = 0; | 1272 | ibmveth_close(netdev); |
1254 | if ((rc = ibmveth_open(netdev))) | 1273 | adapter->pool_config = 0; |
1255 | return rc; | 1274 | if ((rc = ibmveth_open(netdev))) |
1275 | return rc; | ||
1276 | } else | ||
1277 | pool->active = 1; | ||
1256 | } else if (!value && pool->active) { | 1278 | } else if (!value && pool->active) { |
1257 | int mtu = netdev->mtu + IBMVETH_BUFF_OH; | 1279 | int mtu = netdev->mtu + IBMVETH_BUFF_OH; |
1258 | int i; | 1280 | int i; |
@@ -1281,23 +1303,29 @@ const char * buf, size_t count) | |||
1281 | if (value <= 0 || value > IBMVETH_MAX_POOL_COUNT) | 1303 | if (value <= 0 || value > IBMVETH_MAX_POOL_COUNT) |
1282 | return -EINVAL; | 1304 | return -EINVAL; |
1283 | else { | 1305 | else { |
1284 | adapter->pool_config = 1; | 1306 | if (netif_running(netdev)) { |
1285 | ibmveth_close(netdev); | 1307 | adapter->pool_config = 1; |
1286 | adapter->pool_config = 0; | 1308 | ibmveth_close(netdev); |
1287 | pool->size = value; | 1309 | adapter->pool_config = 0; |
1288 | if ((rc = ibmveth_open(netdev))) | 1310 | pool->size = value; |
1289 | return rc; | 1311 | if ((rc = ibmveth_open(netdev))) |
1312 | return rc; | ||
1313 | } else | ||
1314 | pool->size = value; | ||
1290 | } | 1315 | } |
1291 | } else if (attr == &veth_size_attr) { | 1316 | } else if (attr == &veth_size_attr) { |
1292 | if (value <= IBMVETH_BUFF_OH || value > IBMVETH_MAX_BUF_SIZE) | 1317 | if (value <= IBMVETH_BUFF_OH || value > IBMVETH_MAX_BUF_SIZE) |
1293 | return -EINVAL; | 1318 | return -EINVAL; |
1294 | else { | 1319 | else { |
1295 | adapter->pool_config = 1; | 1320 | if (netif_running(netdev)) { |
1296 | ibmveth_close(netdev); | 1321 | adapter->pool_config = 1; |
1297 | adapter->pool_config = 0; | 1322 | ibmveth_close(netdev); |
1298 | pool->buff_size = value; | 1323 | adapter->pool_config = 0; |
1299 | if ((rc = ibmveth_open(netdev))) | 1324 | pool->buff_size = value; |
1300 | return rc; | 1325 | if ((rc = ibmveth_open(netdev))) |
1326 | return rc; | ||
1327 | } else | ||
1328 | pool->buff_size = value; | ||
1301 | } | 1329 | } |
1302 | } | 1330 | } |
1303 | 1331 | ||
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index b53b7ad999bc..0f9904fe3a5a 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -71,7 +71,7 @@ | |||
71 | #include "myri10ge_mcp.h" | 71 | #include "myri10ge_mcp.h" |
72 | #include "myri10ge_mcp_gen_header.h" | 72 | #include "myri10ge_mcp_gen_header.h" |
73 | 73 | ||
74 | #define MYRI10GE_VERSION_STR "1.3.0-1.233" | 74 | #define MYRI10GE_VERSION_STR "1.3.1-1.248" |
75 | 75 | ||
76 | MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); | 76 | MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); |
77 | MODULE_AUTHOR("Maintainer: help@myri.com"); | 77 | MODULE_AUTHOR("Maintainer: help@myri.com"); |
@@ -279,6 +279,8 @@ static int myri10ge_fill_thresh = 256; | |||
279 | module_param(myri10ge_fill_thresh, int, S_IRUGO | S_IWUSR); | 279 | module_param(myri10ge_fill_thresh, int, S_IRUGO | S_IWUSR); |
280 | MODULE_PARM_DESC(myri10ge_fill_thresh, "Number of empty rx slots allowed\n"); | 280 | MODULE_PARM_DESC(myri10ge_fill_thresh, "Number of empty rx slots allowed\n"); |
281 | 281 | ||
282 | static int myri10ge_reset_recover = 1; | ||
283 | |||
282 | static int myri10ge_wcfifo = 0; | 284 | static int myri10ge_wcfifo = 0; |
283 | module_param(myri10ge_wcfifo, int, S_IRUGO); | 285 | module_param(myri10ge_wcfifo, int, S_IRUGO); |
284 | MODULE_PARM_DESC(myri10ge_wcfifo, "Enable WC Fifo when WC is enabled\n"); | 286 | MODULE_PARM_DESC(myri10ge_wcfifo, "Enable WC Fifo when WC is enabled\n"); |
@@ -1154,9 +1156,11 @@ static inline void myri10ge_check_statblock(struct myri10ge_priv *mgp) | |||
1154 | struct mcp_irq_data *stats = mgp->fw_stats; | 1156 | struct mcp_irq_data *stats = mgp->fw_stats; |
1155 | 1157 | ||
1156 | if (unlikely(stats->stats_updated)) { | 1158 | if (unlikely(stats->stats_updated)) { |
1157 | if (mgp->link_state != stats->link_up) { | 1159 | unsigned link_up = ntohl(stats->link_up); |
1158 | mgp->link_state = stats->link_up; | 1160 | if (mgp->link_state != link_up) { |
1159 | if (mgp->link_state) { | 1161 | mgp->link_state = link_up; |
1162 | |||
1163 | if (mgp->link_state == MXGEFW_LINK_UP) { | ||
1160 | if (netif_msg_link(mgp)) | 1164 | if (netif_msg_link(mgp)) |
1161 | printk(KERN_INFO | 1165 | printk(KERN_INFO |
1162 | "myri10ge: %s: link up\n", | 1166 | "myri10ge: %s: link up\n", |
@@ -1166,8 +1170,11 @@ static inline void myri10ge_check_statblock(struct myri10ge_priv *mgp) | |||
1166 | } else { | 1170 | } else { |
1167 | if (netif_msg_link(mgp)) | 1171 | if (netif_msg_link(mgp)) |
1168 | printk(KERN_INFO | 1172 | printk(KERN_INFO |
1169 | "myri10ge: %s: link down\n", | 1173 | "myri10ge: %s: link %s\n", |
1170 | mgp->dev->name); | 1174 | mgp->dev->name, |
1175 | (link_up == MXGEFW_LINK_MYRINET ? | ||
1176 | "mismatch (Myrinet detected)" : | ||
1177 | "down")); | ||
1171 | netif_carrier_off(mgp->dev); | 1178 | netif_carrier_off(mgp->dev); |
1172 | mgp->link_changes++; | 1179 | mgp->link_changes++; |
1173 | } | 1180 | } |
@@ -2730,8 +2737,14 @@ static void myri10ge_watchdog(struct work_struct *work) | |||
2730 | * For now, just report it */ | 2737 | * For now, just report it */ |
2731 | reboot = myri10ge_read_reboot(mgp); | 2738 | reboot = myri10ge_read_reboot(mgp); |
2732 | printk(KERN_ERR | 2739 | printk(KERN_ERR |
2733 | "myri10ge: %s: NIC rebooted (0x%x), resetting\n", | 2740 | "myri10ge: %s: NIC rebooted (0x%x),%s resetting\n", |
2734 | mgp->dev->name, reboot); | 2741 | mgp->dev->name, reboot, |
2742 | myri10ge_reset_recover ? " " : " not"); | ||
2743 | if (myri10ge_reset_recover == 0) | ||
2744 | return; | ||
2745 | |||
2746 | myri10ge_reset_recover--; | ||
2747 | |||
2735 | /* | 2748 | /* |
2736 | * A rebooted nic will come back with config space as | 2749 | * A rebooted nic will come back with config space as |
2737 | * it was after power was applied to PCIe bus. | 2750 | * it was after power was applied to PCIe bus. |
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index ad6688eab265..91f25e0a638e 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -68,9 +68,10 @@ | |||
68 | #define _NETXEN_NIC_LINUX_SUBVERSION 2 | 68 | #define _NETXEN_NIC_LINUX_SUBVERSION 2 |
69 | #define NETXEN_NIC_LINUX_VERSIONID "3.4.2" | 69 | #define NETXEN_NIC_LINUX_VERSIONID "3.4.2" |
70 | 70 | ||
71 | #define NUM_FLASH_SECTORS (64) | 71 | #define NETXEN_NUM_FLASH_SECTORS (64) |
72 | #define FLASH_SECTOR_SIZE (64 * 1024) | 72 | #define NETXEN_FLASH_SECTOR_SIZE (64 * 1024) |
73 | #define FLASH_TOTAL_SIZE (NUM_FLASH_SECTORS * FLASH_SECTOR_SIZE) | 73 | #define NETXEN_FLASH_TOTAL_SIZE (NETXEN_NUM_FLASH_SECTORS \ |
74 | * NETXEN_FLASH_SECTOR_SIZE) | ||
74 | 75 | ||
75 | #define PHAN_VENDOR_ID 0x4040 | 76 | #define PHAN_VENDOR_ID 0x4040 |
76 | 77 | ||
@@ -677,28 +678,28 @@ struct netxen_new_user_info { | |||
677 | 678 | ||
678 | /* Flash memory map */ | 679 | /* Flash memory map */ |
679 | typedef enum { | 680 | typedef enum { |
680 | CRBINIT_START = 0, /* Crbinit section */ | 681 | NETXEN_CRBINIT_START = 0, /* Crbinit section */ |
681 | BRDCFG_START = 0x4000, /* board config */ | 682 | NETXEN_BRDCFG_START = 0x4000, /* board config */ |
682 | INITCODE_START = 0x6000, /* pegtune code */ | 683 | NETXEN_INITCODE_START = 0x6000, /* pegtune code */ |
683 | BOOTLD_START = 0x10000, /* bootld */ | 684 | NETXEN_BOOTLD_START = 0x10000, /* bootld */ |
684 | IMAGE_START = 0x43000, /* compressed image */ | 685 | NETXEN_IMAGE_START = 0x43000, /* compressed image */ |
685 | SECONDARY_START = 0x200000, /* backup images */ | 686 | NETXEN_SECONDARY_START = 0x200000, /* backup images */ |
686 | PXE_START = 0x3E0000, /* user defined region */ | 687 | NETXEN_PXE_START = 0x3E0000, /* user defined region */ |
687 | USER_START = 0x3E8000, /* User defined region for new boards */ | 688 | NETXEN_USER_START = 0x3E8000, /* User defined region for new boards */ |
688 | FIXED_START = 0x3F0000 /* backup of crbinit */ | 689 | NETXEN_FIXED_START = 0x3F0000 /* backup of crbinit */ |
689 | } netxen_flash_map_t; | 690 | } netxen_flash_map_t; |
690 | 691 | ||
691 | #define USER_START_OLD PXE_START /* for backward compatibility */ | 692 | #define NETXEN_USER_START_OLD NETXEN_PXE_START /* for backward compatibility */ |
692 | 693 | ||
693 | #define FLASH_START (CRBINIT_START) | 694 | #define NETXEN_FLASH_START (NETXEN_CRBINIT_START) |
694 | #define INIT_SECTOR (0) | 695 | #define NETXEN_INIT_SECTOR (0) |
695 | #define PRIMARY_START (BOOTLD_START) | 696 | #define NETXEN_PRIMARY_START (NETXEN_BOOTLD_START) |
696 | #define FLASH_CRBINIT_SIZE (0x4000) | 697 | #define NETXEN_FLASH_CRBINIT_SIZE (0x4000) |
697 | #define FLASH_BRDCFG_SIZE (sizeof(struct netxen_board_info)) | 698 | #define NETXEN_FLASH_BRDCFG_SIZE (sizeof(struct netxen_board_info)) |
698 | #define FLASH_USER_SIZE (sizeof(struct netxen_user_info)/sizeof(u32)) | 699 | #define NETXEN_FLASH_USER_SIZE (sizeof(struct netxen_user_info)/sizeof(u32)) |
699 | #define FLASH_SECONDARY_SIZE (USER_START-SECONDARY_START) | 700 | #define NETXEN_FLASH_SECONDARY_SIZE (NETXEN_USER_START-NETXEN_SECONDARY_START) |
700 | #define NUM_PRIMARY_SECTORS (0x20) | 701 | #define NETXEN_NUM_PRIMARY_SECTORS (0x20) |
701 | #define NUM_CONFIG_SECTORS (1) | 702 | #define NETXEN_NUM_CONFIG_SECTORS (1) |
702 | #define PFX "NetXen: " | 703 | #define PFX "NetXen: " |
703 | extern char netxen_nic_driver_name[]; | 704 | extern char netxen_nic_driver_name[]; |
704 | 705 | ||
@@ -1048,6 +1049,7 @@ int netxen_rom_se(struct netxen_adapter *adapter, int addr); | |||
1048 | int netxen_do_rom_se(struct netxen_adapter *adapter, int addr); | 1049 | int netxen_do_rom_se(struct netxen_adapter *adapter, int addr); |
1049 | 1050 | ||
1050 | /* Functions from netxen_nic_isr.c */ | 1051 | /* Functions from netxen_nic_isr.c */ |
1052 | int netxen_nic_link_ok(struct netxen_adapter *adapter); | ||
1051 | void netxen_nic_isr_other(struct netxen_adapter *adapter); | 1053 | void netxen_nic_isr_other(struct netxen_adapter *adapter); |
1052 | void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 link); | 1054 | void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 link); |
1053 | void netxen_handle_port_int(struct netxen_adapter *adapter, u32 enable); | 1055 | void netxen_handle_port_int(struct netxen_adapter *adapter, u32 enable); |
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c index 16fabb377488..0175f6c353f6 100644 --- a/drivers/net/netxen/netxen_nic_ethtool.c +++ b/drivers/net/netxen/netxen_nic_ethtool.c | |||
@@ -94,7 +94,7 @@ static const char netxen_nic_gstrings_test[][ETH_GSTRING_LEN] = { | |||
94 | 94 | ||
95 | static int netxen_nic_get_eeprom_len(struct net_device *dev) | 95 | static int netxen_nic_get_eeprom_len(struct net_device *dev) |
96 | { | 96 | { |
97 | return FLASH_TOTAL_SIZE; | 97 | return NETXEN_FLASH_TOTAL_SIZE; |
98 | } | 98 | } |
99 | 99 | ||
100 | static void | 100 | static void |
@@ -470,7 +470,7 @@ netxen_nic_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
470 | return 0; | 470 | return 0; |
471 | } | 471 | } |
472 | 472 | ||
473 | if (offset == BOOTLD_START) { | 473 | if (offset == NETXEN_BOOTLD_START) { |
474 | ret = netxen_flash_erase_primary(adapter); | 474 | ret = netxen_flash_erase_primary(adapter); |
475 | if (ret != FLASH_SUCCESS) { | 475 | if (ret != FLASH_SUCCESS) { |
476 | printk(KERN_ERR "%s: Flash erase failed.\n", | 476 | printk(KERN_ERR "%s: Flash erase failed.\n", |
@@ -478,10 +478,10 @@ netxen_nic_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
478 | return ret; | 478 | return ret; |
479 | } | 479 | } |
480 | 480 | ||
481 | ret = netxen_rom_se(adapter, USER_START); | 481 | ret = netxen_rom_se(adapter, NETXEN_USER_START); |
482 | if (ret != FLASH_SUCCESS) | 482 | if (ret != FLASH_SUCCESS) |
483 | return ret; | 483 | return ret; |
484 | ret = netxen_rom_se(adapter, FIXED_START); | 484 | ret = netxen_rom_se(adapter, NETXEN_FIXED_START); |
485 | if (ret != FLASH_SUCCESS) | 485 | if (ret != FLASH_SUCCESS) |
486 | return ret; | 486 | return ret; |
487 | 487 | ||
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index baff17a24d63..c012764d1145 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -257,7 +257,7 @@ u64 ctx_addr_sig_regs[][3] = { | |||
257 | #define ADDR_IN_RANGE(addr, low, high) \ | 257 | #define ADDR_IN_RANGE(addr, low, high) \ |
258 | (((addr) <= (high)) && ((addr) >= (low))) | 258 | (((addr) <= (high)) && ((addr) >= (low))) |
259 | 259 | ||
260 | #define NETXEN_FLASH_BASE (BOOTLD_START) | 260 | #define NETXEN_FLASH_BASE (NETXEN_BOOTLD_START) |
261 | #define NETXEN_PHANTOM_MEM_BASE (NETXEN_FLASH_BASE) | 261 | #define NETXEN_PHANTOM_MEM_BASE (NETXEN_FLASH_BASE) |
262 | #define NETXEN_MAX_MTU 8000 + NETXEN_ENET_HEADER_SIZE + NETXEN_ETH_FCS_SIZE | 262 | #define NETXEN_MAX_MTU 8000 + NETXEN_ENET_HEADER_SIZE + NETXEN_ETH_FCS_SIZE |
263 | #define NETXEN_MIN_MTU 64 | 263 | #define NETXEN_MIN_MTU 64 |
@@ -611,7 +611,7 @@ int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, u64 mac[]) | |||
611 | u32 *pmac = (u32 *) & mac[0]; | 611 | u32 *pmac = (u32 *) & mac[0]; |
612 | 612 | ||
613 | if (netxen_get_flash_block(adapter, | 613 | if (netxen_get_flash_block(adapter, |
614 | USER_START + | 614 | NETXEN_USER_START + |
615 | offsetof(struct netxen_new_user_info, | 615 | offsetof(struct netxen_new_user_info, |
616 | mac_addr), | 616 | mac_addr), |
617 | FLASH_NUM_PORTS * sizeof(u64), pmac) == -1) { | 617 | FLASH_NUM_PORTS * sizeof(u64), pmac) == -1) { |
@@ -619,7 +619,7 @@ int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, u64 mac[]) | |||
619 | } | 619 | } |
620 | if (*mac == ~0ULL) { | 620 | if (*mac == ~0ULL) { |
621 | if (netxen_get_flash_block(adapter, | 621 | if (netxen_get_flash_block(adapter, |
622 | USER_START_OLD + | 622 | NETXEN_USER_START_OLD + |
623 | offsetof(struct netxen_user_old_info, | 623 | offsetof(struct netxen_user_old_info, |
624 | mac_addr), | 624 | mac_addr), |
625 | FLASH_NUM_PORTS * sizeof(u64), | 625 | FLASH_NUM_PORTS * sizeof(u64), |
@@ -942,7 +942,7 @@ netxen_nic_pci_set_window(struct netxen_adapter *adapter, | |||
942 | int | 942 | int |
943 | netxen_nic_erase_pxe(struct netxen_adapter *adapter) | 943 | netxen_nic_erase_pxe(struct netxen_adapter *adapter) |
944 | { | 944 | { |
945 | if (netxen_rom_fast_write(adapter, PXE_START, 0) == -1) { | 945 | if (netxen_rom_fast_write(adapter, NETXEN_PXE_START, 0) == -1) { |
946 | printk(KERN_ERR "%s: erase pxe failed\n", | 946 | printk(KERN_ERR "%s: erase pxe failed\n", |
947 | netxen_nic_driver_name); | 947 | netxen_nic_driver_name); |
948 | return -1; | 948 | return -1; |
@@ -953,7 +953,7 @@ netxen_nic_erase_pxe(struct netxen_adapter *adapter) | |||
953 | int netxen_nic_get_board_info(struct netxen_adapter *adapter) | 953 | int netxen_nic_get_board_info(struct netxen_adapter *adapter) |
954 | { | 954 | { |
955 | int rv = 0; | 955 | int rv = 0; |
956 | int addr = BRDCFG_START; | 956 | int addr = NETXEN_BRDCFG_START; |
957 | struct netxen_board_info *boardinfo; | 957 | struct netxen_board_info *boardinfo; |
958 | int index; | 958 | int index; |
959 | u32 *ptr32; | 959 | u32 *ptr32; |
@@ -1115,7 +1115,7 @@ void netxen_nic_flash_print(struct netxen_adapter *adapter) | |||
1115 | u32 fw_build = 0; | 1115 | u32 fw_build = 0; |
1116 | char brd_name[NETXEN_MAX_SHORT_NAME]; | 1116 | char brd_name[NETXEN_MAX_SHORT_NAME]; |
1117 | struct netxen_new_user_info user_info; | 1117 | struct netxen_new_user_info user_info; |
1118 | int i, addr = USER_START; | 1118 | int i, addr = NETXEN_USER_START; |
1119 | __le32 *ptr32; | 1119 | __le32 *ptr32; |
1120 | 1120 | ||
1121 | struct netxen_board_info *board_info = &(adapter->ahw.boardcfg); | 1121 | struct netxen_board_info *board_info = &(adapter->ahw.boardcfg); |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index a36892457761..bb23f4c360db 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -585,7 +585,7 @@ int netxen_backup_crbinit(struct netxen_adapter *adapter) | |||
585 | { | 585 | { |
586 | int ret = FLASH_SUCCESS; | 586 | int ret = FLASH_SUCCESS; |
587 | int val; | 587 | int val; |
588 | char *buffer = kmalloc(FLASH_SECTOR_SIZE, GFP_KERNEL); | 588 | char *buffer = kmalloc(NETXEN_FLASH_SECTOR_SIZE, GFP_KERNEL); |
589 | 589 | ||
590 | if (!buffer) | 590 | if (!buffer) |
591 | return -ENOMEM; | 591 | return -ENOMEM; |
@@ -601,13 +601,13 @@ int netxen_backup_crbinit(struct netxen_adapter *adapter) | |||
601 | goto out_kfree; | 601 | goto out_kfree; |
602 | 602 | ||
603 | /* copy sector 0 to sector 63 */ | 603 | /* copy sector 0 to sector 63 */ |
604 | ret = netxen_rom_fast_read_words(adapter, CRBINIT_START, | 604 | ret = netxen_rom_fast_read_words(adapter, NETXEN_CRBINIT_START, |
605 | buffer, FLASH_SECTOR_SIZE); | 605 | buffer, NETXEN_FLASH_SECTOR_SIZE); |
606 | if (ret != FLASH_SUCCESS) | 606 | if (ret != FLASH_SUCCESS) |
607 | goto out_kfree; | 607 | goto out_kfree; |
608 | 608 | ||
609 | ret = netxen_rom_fast_write_words(adapter, FIXED_START, | 609 | ret = netxen_rom_fast_write_words(adapter, NETXEN_FIXED_START, |
610 | buffer, FLASH_SECTOR_SIZE); | 610 | buffer, NETXEN_FLASH_SECTOR_SIZE); |
611 | if (ret != FLASH_SUCCESS) | 611 | if (ret != FLASH_SUCCESS) |
612 | goto out_kfree; | 612 | goto out_kfree; |
613 | 613 | ||
@@ -654,7 +654,8 @@ void check_erased_flash(struct netxen_adapter *adapter, int addr) | |||
654 | int count = 0, erased_errors = 0; | 654 | int count = 0, erased_errors = 0; |
655 | int range; | 655 | int range; |
656 | 656 | ||
657 | range = (addr == USER_START) ? FIXED_START : addr + FLASH_SECTOR_SIZE; | 657 | range = (addr == NETXEN_USER_START) ? |
658 | NETXEN_FIXED_START : addr + NETXEN_FLASH_SECTOR_SIZE; | ||
658 | 659 | ||
659 | for (i = addr; i < range; i += 4) { | 660 | for (i = addr; i < range; i += 4) { |
660 | netxen_rom_fast_read(adapter, i, &val); | 661 | netxen_rom_fast_read(adapter, i, &val); |
@@ -689,7 +690,7 @@ netxen_flash_erase_sections(struct netxen_adapter *adapter, int start, int end) | |||
689 | int i; | 690 | int i; |
690 | 691 | ||
691 | for (i = start; i < end; i++) { | 692 | for (i = start; i < end; i++) { |
692 | ret = netxen_rom_se(adapter, i * FLASH_SECTOR_SIZE); | 693 | ret = netxen_rom_se(adapter, i * NETXEN_FLASH_SECTOR_SIZE); |
693 | if (ret) | 694 | if (ret) |
694 | break; | 695 | break; |
695 | ret = netxen_rom_wip_poll(adapter); | 696 | ret = netxen_rom_wip_poll(adapter); |
@@ -706,8 +707,8 @@ netxen_flash_erase_secondary(struct netxen_adapter *adapter) | |||
706 | int ret = FLASH_SUCCESS; | 707 | int ret = FLASH_SUCCESS; |
707 | int start, end; | 708 | int start, end; |
708 | 709 | ||
709 | start = SECONDARY_START / FLASH_SECTOR_SIZE; | 710 | start = NETXEN_SECONDARY_START / NETXEN_FLASH_SECTOR_SIZE; |
710 | end = USER_START / FLASH_SECTOR_SIZE; | 711 | end = NETXEN_USER_START / NETXEN_FLASH_SECTOR_SIZE; |
711 | ret = netxen_flash_erase_sections(adapter, start, end); | 712 | ret = netxen_flash_erase_sections(adapter, start, end); |
712 | 713 | ||
713 | return ret; | 714 | return ret; |
@@ -719,8 +720,8 @@ netxen_flash_erase_primary(struct netxen_adapter *adapter) | |||
719 | int ret = FLASH_SUCCESS; | 720 | int ret = FLASH_SUCCESS; |
720 | int start, end; | 721 | int start, end; |
721 | 722 | ||
722 | start = PRIMARY_START / FLASH_SECTOR_SIZE; | 723 | start = NETXEN_PRIMARY_START / NETXEN_FLASH_SECTOR_SIZE; |
723 | end = SECONDARY_START / FLASH_SECTOR_SIZE; | 724 | end = NETXEN_SECONDARY_START / NETXEN_FLASH_SECTOR_SIZE; |
724 | ret = netxen_flash_erase_sections(adapter, start, end); | 725 | ret = netxen_flash_erase_sections(adapter, start, end); |
725 | 726 | ||
726 | return ret; | 727 | return ret; |
@@ -1036,18 +1037,23 @@ void netxen_watchdog_task(struct work_struct *work) | |||
1036 | if ((adapter->portnum == 0) && netxen_nic_check_temp(adapter)) | 1037 | if ((adapter->portnum == 0) && netxen_nic_check_temp(adapter)) |
1037 | return; | 1038 | return; |
1038 | 1039 | ||
1040 | if (adapter->handle_phy_intr) | ||
1041 | adapter->handle_phy_intr(adapter); | ||
1042 | |||
1039 | netdev = adapter->netdev; | 1043 | netdev = adapter->netdev; |
1040 | if ((netif_running(netdev)) && !netif_carrier_ok(netdev)) { | 1044 | if ((netif_running(netdev)) && !netif_carrier_ok(netdev) && |
1041 | printk(KERN_INFO "%s port %d, %s carrier is now ok\n", | 1045 | netxen_nic_link_ok(adapter) ) { |
1042 | netxen_nic_driver_name, adapter->portnum, netdev->name); | 1046 | printk(KERN_INFO "%s %s (port %d), Link is up\n", |
1047 | netxen_nic_driver_name, netdev->name, adapter->portnum); | ||
1043 | netif_carrier_on(netdev); | 1048 | netif_carrier_on(netdev); |
1044 | } | ||
1045 | |||
1046 | if (netif_queue_stopped(netdev)) | ||
1047 | netif_wake_queue(netdev); | 1049 | netif_wake_queue(netdev); |
1050 | } else if(!(netif_running(netdev)) && netif_carrier_ok(netdev)) { | ||
1051 | printk(KERN_ERR "%s %s Link is Down\n", | ||
1052 | netxen_nic_driver_name, netdev->name); | ||
1053 | netif_carrier_off(netdev); | ||
1054 | netif_stop_queue(netdev); | ||
1055 | } | ||
1048 | 1056 | ||
1049 | if (adapter->handle_phy_intr) | ||
1050 | adapter->handle_phy_intr(adapter); | ||
1051 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); | 1057 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); |
1052 | } | 1058 | } |
1053 | 1059 | ||
diff --git a/drivers/net/netxen/netxen_nic_isr.c b/drivers/net/netxen/netxen_nic_isr.c index b213b062eb56..b2de6b6c2a7f 100644 --- a/drivers/net/netxen/netxen_nic_isr.c +++ b/drivers/net/netxen/netxen_nic_isr.c | |||
@@ -169,6 +169,24 @@ void netxen_nic_gbe_handle_phy_intr(struct netxen_adapter *adapter) | |||
169 | netxen_nic_isr_other(adapter); | 169 | netxen_nic_isr_other(adapter); |
170 | } | 170 | } |
171 | 171 | ||
172 | int netxen_nic_link_ok(struct netxen_adapter *adapter) | ||
173 | { | ||
174 | switch (adapter->ahw.board_type) { | ||
175 | case NETXEN_NIC_GBE: | ||
176 | return ((adapter->ahw.qg_linksup) & 1); | ||
177 | |||
178 | case NETXEN_NIC_XGBE: | ||
179 | return ((adapter->ahw.xg_linkup) & 1); | ||
180 | |||
181 | default: | ||
182 | printk(KERN_ERR"%s: Function: %s, Unknown board type\n", | ||
183 | netxen_nic_driver_name, __FUNCTION__); | ||
184 | break; | ||
185 | } | ||
186 | |||
187 | return 0; | ||
188 | } | ||
189 | |||
172 | void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter) | 190 | void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter) |
173 | { | 191 | { |
174 | struct net_device *netdev = adapter->netdev; | 192 | struct net_device *netdev = adapter->netdev; |
@@ -183,6 +201,10 @@ void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter) | |||
183 | printk(KERN_INFO "%s: %s NIC Link is down\n", | 201 | printk(KERN_INFO "%s: %s NIC Link is down\n", |
184 | netxen_nic_driver_name, netdev->name); | 202 | netxen_nic_driver_name, netdev->name); |
185 | adapter->ahw.xg_linkup = 0; | 203 | adapter->ahw.xg_linkup = 0; |
204 | if (netif_running(netdev)) { | ||
205 | netif_carrier_off(netdev); | ||
206 | netif_stop_queue(netdev); | ||
207 | } | ||
186 | /* read twice to clear sticky bits */ | 208 | /* read twice to clear sticky bits */ |
187 | /* WINDOW = 0 */ | 209 | /* WINDOW = 0 */ |
188 | netxen_nic_read_w0(adapter, NETXEN_NIU_XG_STATUS, &val1); | 210 | netxen_nic_read_w0(adapter, NETXEN_NIU_XG_STATUS, &val1); |
@@ -196,5 +218,7 @@ void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter) | |||
196 | printk(KERN_INFO "%s: %s NIC Link is up\n", | 218 | printk(KERN_INFO "%s: %s NIC Link is up\n", |
197 | netxen_nic_driver_name, netdev->name); | 219 | netxen_nic_driver_name, netdev->name); |
198 | adapter->ahw.xg_linkup = 1; | 220 | adapter->ahw.xg_linkup = 1; |
221 | netif_carrier_on(netdev); | ||
222 | netif_wake_queue(netdev); | ||
199 | } | 223 | } |
200 | } | 224 | } |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index c61181f23bd5..6167b58d2731 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -542,6 +542,13 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
542 | NETXEN_ROMUSB_GLB_PEGTUNE_DONE)); | 542 | NETXEN_ROMUSB_GLB_PEGTUNE_DONE)); |
543 | /* Handshake with the card before we register the devices. */ | 543 | /* Handshake with the card before we register the devices. */ |
544 | netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); | 544 | netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); |
545 | |||
546 | /* leave the hw in the same state as reboot */ | ||
547 | writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); | ||
548 | netxen_pinit_from_rom(adapter, 0); | ||
549 | udelay(500); | ||
550 | netxen_load_firmware(adapter); | ||
551 | netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); | ||
545 | } | 552 | } |
546 | 553 | ||
547 | /* | 554 | /* |
diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c index cef90a78351e..75102d30730f 100644 --- a/drivers/net/netxen/netxen_nic_niu.c +++ b/drivers/net/netxen/netxen_nic_niu.c | |||
@@ -454,16 +454,12 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port) | |||
454 | 454 | ||
455 | int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) | 455 | int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) |
456 | { | 456 | { |
457 | u32 reg; | ||
458 | u32 portnum = physical_port[adapter->portnum]; | 457 | u32 portnum = physical_port[adapter->portnum]; |
459 | 458 | ||
460 | netxen_crb_writelit_adapter(adapter, | 459 | netxen_crb_writelit_adapter(adapter, |
461 | NETXEN_NIU_XGE_CONFIG_0+(0x10000*portnum), 0x5); | 460 | NETXEN_NIU_XGE_CONFIG_1+(0x10000*portnum), 0x1447); |
462 | netxen_nic_hw_read_wx(adapter, | ||
463 | NETXEN_NIU_XGE_CONFIG_1+(0x10000*portnum), ®, 4); | ||
464 | reg = (reg & ~0x2000UL); | ||
465 | netxen_crb_writelit_adapter(adapter, | 461 | netxen_crb_writelit_adapter(adapter, |
466 | NETXEN_NIU_XGE_CONFIG_1+(0x10000*portnum), reg); | 462 | NETXEN_NIU_XGE_CONFIG_0+(0x10000*portnum), 0x5); |
467 | 463 | ||
468 | return 0; | 464 | return 0; |
469 | } | 465 | } |
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 22aec5cce683..b87f8d2a888b 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c | |||
@@ -54,6 +54,12 @@ | |||
54 | #define MII_M1111_PHY_LED_CONTROL 0x18 | 54 | #define MII_M1111_PHY_LED_CONTROL 0x18 |
55 | #define MII_M1111_PHY_LED_DIRECT 0x4100 | 55 | #define MII_M1111_PHY_LED_DIRECT 0x4100 |
56 | #define MII_M1111_PHY_LED_COMBINE 0x411c | 56 | #define MII_M1111_PHY_LED_COMBINE 0x411c |
57 | #define MII_M1111_PHY_EXT_CR 0x14 | ||
58 | #define MII_M1111_RX_DELAY 0x80 | ||
59 | #define MII_M1111_TX_DELAY 0x2 | ||
60 | #define MII_M1111_PHY_EXT_SR 0x1b | ||
61 | #define MII_M1111_HWCFG_MODE_MASK 0xf | ||
62 | #define MII_M1111_HWCFG_MODE_RGMII 0xb | ||
57 | 63 | ||
58 | MODULE_DESCRIPTION("Marvell PHY driver"); | 64 | MODULE_DESCRIPTION("Marvell PHY driver"); |
59 | MODULE_AUTHOR("Andy Fleming"); | 65 | MODULE_AUTHOR("Andy Fleming"); |
@@ -131,6 +137,45 @@ static int marvell_config_aneg(struct phy_device *phydev) | |||
131 | return err; | 137 | return err; |
132 | } | 138 | } |
133 | 139 | ||
140 | static int m88e1111_config_init(struct phy_device *phydev) | ||
141 | { | ||
142 | int err; | ||
143 | |||
144 | if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) || | ||
145 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)) { | ||
146 | int temp; | ||
147 | |||
148 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) { | ||
149 | temp = phy_read(phydev, MII_M1111_PHY_EXT_CR); | ||
150 | if (temp < 0) | ||
151 | return temp; | ||
152 | |||
153 | temp |= (MII_M1111_RX_DELAY | MII_M1111_TX_DELAY); | ||
154 | |||
155 | err = phy_write(phydev, MII_M1111_PHY_EXT_CR, temp); | ||
156 | if (err < 0) | ||
157 | return err; | ||
158 | } | ||
159 | |||
160 | temp = phy_read(phydev, MII_M1111_PHY_EXT_SR); | ||
161 | if (temp < 0) | ||
162 | return temp; | ||
163 | |||
164 | temp &= ~(MII_M1111_HWCFG_MODE_MASK); | ||
165 | temp |= MII_M1111_HWCFG_MODE_RGMII; | ||
166 | |||
167 | err = phy_write(phydev, MII_M1111_PHY_EXT_SR, temp); | ||
168 | if (err < 0) | ||
169 | return err; | ||
170 | } | ||
171 | |||
172 | err = phy_write(phydev, MII_BMCR, BMCR_RESET); | ||
173 | if (err < 0) | ||
174 | return err; | ||
175 | |||
176 | return 0; | ||
177 | } | ||
178 | |||
134 | static int m88e1145_config_init(struct phy_device *phydev) | 179 | static int m88e1145_config_init(struct phy_device *phydev) |
135 | { | 180 | { |
136 | int err; | 181 | int err; |
@@ -152,7 +197,7 @@ static int m88e1145_config_init(struct phy_device *phydev) | |||
152 | if (err < 0) | 197 | if (err < 0) |
153 | return err; | 198 | return err; |
154 | 199 | ||
155 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII) { | 200 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) { |
156 | int temp = phy_read(phydev, MII_M1145_PHY_EXT_CR); | 201 | int temp = phy_read(phydev, MII_M1145_PHY_EXT_CR); |
157 | if (temp < 0) | 202 | if (temp < 0) |
158 | return temp; | 203 | return temp; |
@@ -206,7 +251,7 @@ static struct phy_driver m88e1101_driver = { | |||
206 | .driver = {.owner = THIS_MODULE,}, | 251 | .driver = {.owner = THIS_MODULE,}, |
207 | }; | 252 | }; |
208 | 253 | ||
209 | static struct phy_driver m88e1111s_driver = { | 254 | static struct phy_driver m88e1111_driver = { |
210 | .phy_id = 0x01410cc0, | 255 | .phy_id = 0x01410cc0, |
211 | .phy_id_mask = 0xfffffff0, | 256 | .phy_id_mask = 0xfffffff0, |
212 | .name = "Marvell 88E1111", | 257 | .name = "Marvell 88E1111", |
@@ -216,6 +261,7 @@ static struct phy_driver m88e1111s_driver = { | |||
216 | .read_status = &genphy_read_status, | 261 | .read_status = &genphy_read_status, |
217 | .ack_interrupt = &marvell_ack_interrupt, | 262 | .ack_interrupt = &marvell_ack_interrupt, |
218 | .config_intr = &marvell_config_intr, | 263 | .config_intr = &marvell_config_intr, |
264 | .config_init = &m88e1111_config_init, | ||
219 | .driver = {.owner = THIS_MODULE,}, | 265 | .driver = {.owner = THIS_MODULE,}, |
220 | }; | 266 | }; |
221 | 267 | ||
@@ -241,9 +287,9 @@ static int __init marvell_init(void) | |||
241 | if (ret) | 287 | if (ret) |
242 | return ret; | 288 | return ret; |
243 | 289 | ||
244 | ret = phy_driver_register(&m88e1111s_driver); | 290 | ret = phy_driver_register(&m88e1111_driver); |
245 | if (ret) | 291 | if (ret) |
246 | goto err1111s; | 292 | goto err1111; |
247 | 293 | ||
248 | ret = phy_driver_register(&m88e1145_driver); | 294 | ret = phy_driver_register(&m88e1145_driver); |
249 | if (ret) | 295 | if (ret) |
@@ -251,9 +297,9 @@ static int __init marvell_init(void) | |||
251 | 297 | ||
252 | return 0; | 298 | return 0; |
253 | 299 | ||
254 | err1145: | 300 | err1145: |
255 | phy_driver_unregister(&m88e1111s_driver); | 301 | phy_driver_unregister(&m88e1111_driver); |
256 | err1111s: | 302 | err1111: |
257 | phy_driver_unregister(&m88e1101_driver); | 303 | phy_driver_unregister(&m88e1101_driver); |
258 | return ret; | 304 | return ret; |
259 | } | 305 | } |
@@ -261,7 +307,7 @@ static int __init marvell_init(void) | |||
261 | static void __exit marvell_exit(void) | 307 | static void __exit marvell_exit(void) |
262 | { | 308 | { |
263 | phy_driver_unregister(&m88e1101_driver); | 309 | phy_driver_unregister(&m88e1101_driver); |
264 | phy_driver_unregister(&m88e1111s_driver); | 310 | phy_driver_unregister(&m88e1111_driver); |
265 | phy_driver_unregister(&m88e1145_driver); | 311 | phy_driver_unregister(&m88e1145_driver); |
266 | } | 312 | } |
267 | 313 | ||
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index 3de564b23147..8dc09a3790cb 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig | |||
@@ -313,8 +313,8 @@ config USB_KC2190 | |||
313 | boolean "KT Technology KC2190 based cables (InstaNet)" | 313 | boolean "KT Technology KC2190 based cables (InstaNet)" |
314 | depends on USB_NET_CDC_SUBSET && EXPERIMENTAL | 314 | depends on USB_NET_CDC_SUBSET && EXPERIMENTAL |
315 | help | 315 | help |
316 | Choose this option if you're using a host-to-host cable | 316 | Choose this option if you're using a host-to-host cable |
317 | with one of these chips. | 317 | with one of these chips. |
318 | 318 | ||
319 | config USB_NET_ZAURUS | 319 | config USB_NET_ZAURUS |
320 | tristate "Sharp Zaurus (stock ROMs) and compatible" | 320 | tristate "Sharp Zaurus (stock ROMs) and compatible" |
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index 25b75b615188..b670b97bcfde 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c | |||
@@ -1562,7 +1562,7 @@ static void velocity_print_link_status(struct velocity_info *vptr) | |||
1562 | if (vptr->mii_status & VELOCITY_LINK_FAIL) { | 1562 | if (vptr->mii_status & VELOCITY_LINK_FAIL) { |
1563 | VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->dev->name); | 1563 | VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->dev->name); |
1564 | } else if (vptr->options.spd_dpx == SPD_DPX_AUTO) { | 1564 | } else if (vptr->options.spd_dpx == SPD_DPX_AUTO) { |
1565 | VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link autonegation", vptr->dev->name); | 1565 | VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->dev->name); |
1566 | 1566 | ||
1567 | if (vptr->mii_status & VELOCITY_SPEED_1000) | 1567 | if (vptr->mii_status & VELOCITY_SPEED_1000) |
1568 | VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps"); | 1568 | VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps"); |
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index e3f5bb0fe603..fa2399cbd5ca 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig | |||
@@ -266,16 +266,23 @@ config IPW2200_DEBUG | |||
266 | 266 | ||
267 | If you are not sure, say N here. | 267 | If you are not sure, say N here. |
268 | 268 | ||
269 | config LIBERTAS_USB | 269 | config LIBERTAS |
270 | tristate "Marvell Libertas 8388 802.11a/b/g cards" | 270 | tristate "Marvell 8xxx Libertas WLAN driver support" |
271 | depends on USB && WLAN_80211 | 271 | depends on WLAN_80211 |
272 | select IEEE80211 | ||
272 | select FW_LOADER | 273 | select FW_LOADER |
273 | ---help--- | 274 | ---help--- |
275 | A library for Marvell Libertas 8xxx devices. | ||
276 | |||
277 | config LIBERTAS_USB | ||
278 | tristate "Marvell Libertas 8388 USB 802.11b/g cards" | ||
279 | depends on LIBERTAS && USB | ||
280 | ---help--- | ||
274 | A driver for Marvell Libertas 8388 USB devices. | 281 | A driver for Marvell Libertas 8388 USB devices. |
275 | 282 | ||
276 | config LIBERTAS_USB_DEBUG | 283 | config LIBERTAS_DEBUG |
277 | bool "Enable full debugging output in the Libertas USB module." | 284 | bool "Enable full debugging output in the Libertas module." |
278 | depends on LIBERTAS_USB | 285 | depends on LIBERTAS |
279 | ---help--- | 286 | ---help--- |
280 | Debugging support. | 287 | Debugging support. |
281 | 288 | ||
diff --git a/drivers/net/wireless/libertas/11d.c b/drivers/net/wireless/libertas/11d.c index e0ecc4d483bb..4cf0ff7b833d 100644 --- a/drivers/net/wireless/libertas/11d.c +++ b/drivers/net/wireless/libertas/11d.c | |||
@@ -95,7 +95,7 @@ static u8 wlan_get_chan_11d(u8 band, u8 firstchan, u8 nrchan, u8 * chan) | |||
95 | 95 | ||
96 | for (i = 0; i < cfp_no; i++) { | 96 | for (i = 0; i < cfp_no; i++) { |
97 | if ((cfp + i)->channel == firstchan) { | 97 | if ((cfp + i)->channel == firstchan) { |
98 | lbs_pr_debug(1, "firstchan found\n"); | 98 | lbs_deb_11d("firstchan found\n"); |
99 | break; | 99 | break; |
100 | } | 100 | } |
101 | } | 101 | } |
@@ -129,12 +129,12 @@ static u8 wlan_channel_known_11d(u8 chan, | |||
129 | 129 | ||
130 | for (i = 0; i < nr_chan; i++) { | 130 | for (i = 0; i < nr_chan; i++) { |
131 | if (chan == chanpwr[i].chan) { | 131 | if (chan == chanpwr[i].chan) { |
132 | lbs_pr_debug(1, "11D: Found Chan:%d\n", chan); | 132 | lbs_deb_11d("11D: Found Chan:%d\n", chan); |
133 | return 1; | 133 | return 1; |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | lbs_pr_debug(1, "11D: Not Find Chan:%d\n", chan); | 137 | lbs_deb_11d("11D: Not Find Chan:%d\n", chan); |
138 | return 0; | 138 | return 0; |
139 | } | 139 | } |
140 | 140 | ||
@@ -174,7 +174,7 @@ static int generate_domain_info_11d(struct parsed_region_chan_11d | |||
174 | memcpy(domaininfo->countrycode, parsed_region_chan->countrycode, | 174 | memcpy(domaininfo->countrycode, parsed_region_chan->countrycode, |
175 | COUNTRY_CODE_LEN); | 175 | COUNTRY_CODE_LEN); |
176 | 176 | ||
177 | lbs_pr_debug(1, "11D:nrchan=%d\n", nr_chan); | 177 | lbs_deb_11d("11D:nrchan=%d\n", nr_chan); |
178 | lbs_dbg_hex("11D:parsed_region_chan:", (char *)parsed_region_chan, | 178 | lbs_dbg_hex("11D:parsed_region_chan:", (char *)parsed_region_chan, |
179 | sizeof(struct parsed_region_chan_11d)); | 179 | sizeof(struct parsed_region_chan_11d)); |
180 | 180 | ||
@@ -212,7 +212,7 @@ static int generate_domain_info_11d(struct parsed_region_chan_11d | |||
212 | } | 212 | } |
213 | domaininfo->nr_subband = nr_subband; | 213 | domaininfo->nr_subband = nr_subband; |
214 | 214 | ||
215 | lbs_pr_debug(1, "nr_subband=%x\n", domaininfo->nr_subband); | 215 | lbs_deb_11d("nr_subband=%x\n", domaininfo->nr_subband); |
216 | lbs_dbg_hex("11D:domaininfo:", (char *)domaininfo, | 216 | lbs_dbg_hex("11D:domaininfo:", (char *)domaininfo, |
217 | COUNTRY_CODE_LEN + 1 + | 217 | COUNTRY_CODE_LEN + 1 + |
218 | sizeof(struct ieeetypes_subbandset) * nr_subband); | 218 | sizeof(struct ieeetypes_subbandset) * nr_subband); |
@@ -233,13 +233,13 @@ static void wlan_generate_parsed_region_chan_11d(struct region_channel * region_ | |||
233 | struct chan_freq_power *cfp; | 233 | struct chan_freq_power *cfp; |
234 | 234 | ||
235 | if (region_chan == NULL) { | 235 | if (region_chan == NULL) { |
236 | lbs_pr_debug(1, "11D: region_chan is NULL\n"); | 236 | lbs_deb_11d("11D: region_chan is NULL\n"); |
237 | return; | 237 | return; |
238 | } | 238 | } |
239 | 239 | ||
240 | cfp = region_chan->CFP; | 240 | cfp = region_chan->CFP; |
241 | if (cfp == NULL) { | 241 | if (cfp == NULL) { |
242 | lbs_pr_debug(1, "11D: cfp equal NULL \n"); | 242 | lbs_deb_11d("11D: cfp equal NULL \n"); |
243 | return; | 243 | return; |
244 | } | 244 | } |
245 | 245 | ||
@@ -248,19 +248,19 @@ static void wlan_generate_parsed_region_chan_11d(struct region_channel * region_ | |||
248 | memcpy(parsed_region_chan->countrycode, | 248 | memcpy(parsed_region_chan->countrycode, |
249 | wlan_code_2_region(region_chan->region), COUNTRY_CODE_LEN); | 249 | wlan_code_2_region(region_chan->region), COUNTRY_CODE_LEN); |
250 | 250 | ||
251 | lbs_pr_debug(1, "11D: region[0x%x] band[%d]\n", parsed_region_chan->region, | 251 | lbs_deb_11d("11D: region[0x%x] band[%d]\n", parsed_region_chan->region, |
252 | parsed_region_chan->band); | 252 | parsed_region_chan->band); |
253 | 253 | ||
254 | for (i = 0; i < region_chan->nrcfp; i++, cfp++) { | 254 | for (i = 0; i < region_chan->nrcfp; i++, cfp++) { |
255 | parsed_region_chan->chanpwr[i].chan = cfp->channel; | 255 | parsed_region_chan->chanpwr[i].chan = cfp->channel; |
256 | parsed_region_chan->chanpwr[i].pwr = cfp->maxtxpower; | 256 | parsed_region_chan->chanpwr[i].pwr = cfp->maxtxpower; |
257 | lbs_pr_debug(1, "11D: Chan[%d] Pwr[%d]\n", | 257 | lbs_deb_11d("11D: Chan[%d] Pwr[%d]\n", |
258 | parsed_region_chan->chanpwr[i].chan, | 258 | parsed_region_chan->chanpwr[i].chan, |
259 | parsed_region_chan->chanpwr[i].pwr); | 259 | parsed_region_chan->chanpwr[i].pwr); |
260 | } | 260 | } |
261 | parsed_region_chan->nr_chan = region_chan->nrcfp; | 261 | parsed_region_chan->nr_chan = region_chan->nrcfp; |
262 | 262 | ||
263 | lbs_pr_debug(1, "11D: nrchan[%d]\n", parsed_region_chan->nr_chan); | 263 | lbs_deb_11d("11D: nrchan[%d]\n", parsed_region_chan->nr_chan); |
264 | 264 | ||
265 | return; | 265 | return; |
266 | } | 266 | } |
@@ -277,8 +277,9 @@ static u8 wlan_region_chan_supported_11d(u8 region, u8 band, u8 chan) | |||
277 | struct chan_freq_power *cfp; | 277 | struct chan_freq_power *cfp; |
278 | int cfp_no; | 278 | int cfp_no; |
279 | u8 idx; | 279 | u8 idx; |
280 | int ret = 0; | ||
280 | 281 | ||
281 | ENTER(); | 282 | lbs_deb_enter(LBS_DEB_11D); |
282 | 283 | ||
283 | cfp = libertas_get_region_cfp_table(region, band, &cfp_no); | 284 | cfp = libertas_get_region_cfp_table(region, band, &cfp_no); |
284 | if (cfp == NULL) | 285 | if (cfp == NULL) |
@@ -288,16 +289,19 @@ static u8 wlan_region_chan_supported_11d(u8 region, u8 band, u8 chan) | |||
288 | if (chan == (cfp + idx)->channel) { | 289 | if (chan == (cfp + idx)->channel) { |
289 | /* If Mrvl Chip Supported? */ | 290 | /* If Mrvl Chip Supported? */ |
290 | if ((cfp + idx)->unsupported) { | 291 | if ((cfp + idx)->unsupported) { |
291 | return 0; | 292 | ret = 0; |
292 | } else { | 293 | } else { |
293 | return 1; | 294 | ret = 1; |
294 | } | 295 | } |
296 | goto done; | ||
295 | } | 297 | } |
296 | } | 298 | } |
297 | 299 | ||
298 | /*chan is not in the region table */ | 300 | /*chan is not in the region table */ |
299 | LEAVE(); | 301 | |
300 | return 0; | 302 | done: |
303 | lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret); | ||
304 | return ret; | ||
301 | } | 305 | } |
302 | 306 | ||
303 | /** | 307 | /** |
@@ -321,7 +325,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset* | |||
321 | 325 | ||
322 | u8 j, i; | 326 | u8 j, i; |
323 | 327 | ||
324 | ENTER(); | 328 | lbs_deb_enter(LBS_DEB_11D); |
325 | 329 | ||
326 | /*validation Rules: | 330 | /*validation Rules: |
327 | 1. valid region Code | 331 | 1. valid region Code |
@@ -337,15 +341,14 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset* | |||
337 | if ((*(countryinfo->countrycode)) == 0 | 341 | if ((*(countryinfo->countrycode)) == 0 |
338 | || (countryinfo->len <= COUNTRY_CODE_LEN)) { | 342 | || (countryinfo->len <= COUNTRY_CODE_LEN)) { |
339 | /* No region Info or Wrong region info: treat as No 11D info */ | 343 | /* No region Info or Wrong region info: treat as No 11D info */ |
340 | LEAVE(); | 344 | goto done; |
341 | return 0; | ||
342 | } | 345 | } |
343 | 346 | ||
344 | /*Step1: check region_code */ | 347 | /*Step1: check region_code */ |
345 | parsed_region_chan->region = region = | 348 | parsed_region_chan->region = region = |
346 | wlan_region_2_code(countryinfo->countrycode); | 349 | wlan_region_2_code(countryinfo->countrycode); |
347 | 350 | ||
348 | lbs_pr_debug(1, "regioncode=%x\n", (u8) parsed_region_chan->region); | 351 | lbs_deb_11d("regioncode=%x\n", (u8) parsed_region_chan->region); |
349 | lbs_dbg_hex("CountryCode:", (char *)countryinfo->countrycode, | 352 | lbs_dbg_hex("CountryCode:", (char *)countryinfo->countrycode, |
350 | COUNTRY_CODE_LEN); | 353 | COUNTRY_CODE_LEN); |
351 | 354 | ||
@@ -361,7 +364,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset* | |||
361 | 364 | ||
362 | if (countryinfo->subband[j].firstchan <= lastchan) { | 365 | if (countryinfo->subband[j].firstchan <= lastchan) { |
363 | /*Step2&3. Check First Chan Num increment and no overlap */ | 366 | /*Step2&3. Check First Chan Num increment and no overlap */ |
364 | lbs_pr_debug(1, "11D: Chan[%d>%d] Overlap\n", | 367 | lbs_deb_11d("11D: Chan[%d>%d] Overlap\n", |
365 | countryinfo->subband[j].firstchan, lastchan); | 368 | countryinfo->subband[j].firstchan, lastchan); |
366 | continue; | 369 | continue; |
367 | } | 370 | } |
@@ -374,7 +377,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset* | |||
374 | 377 | ||
375 | if (!wlan_get_chan_11d(band, firstchan, i, &curchan)) { | 378 | if (!wlan_get_chan_11d(band, firstchan, i, &curchan)) { |
376 | /* Chan is not found in UN table */ | 379 | /* Chan is not found in UN table */ |
377 | lbs_pr_debug(1, "chan is not supported: %d \n", i); | 380 | lbs_deb_11d("chan is not supported: %d \n", i); |
378 | break; | 381 | break; |
379 | } | 382 | } |
380 | 383 | ||
@@ -389,7 +392,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset* | |||
389 | idx++; | 392 | idx++; |
390 | } else { | 393 | } else { |
391 | /*not supported and ignore the chan */ | 394 | /*not supported and ignore the chan */ |
392 | lbs_pr_debug(1, | 395 | lbs_deb_11d( |
393 | "11D:i[%d] chan[%d] unsupported in region[%x] band[%d]\n", | 396 | "11D:i[%d] chan[%d] unsupported in region[%x] band[%d]\n", |
394 | i, curchan, region, band); | 397 | i, curchan, region, band); |
395 | } | 398 | } |
@@ -401,11 +404,12 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset* | |||
401 | 404 | ||
402 | parsed_region_chan->nr_chan = idx; | 405 | parsed_region_chan->nr_chan = idx; |
403 | 406 | ||
404 | lbs_pr_debug(1, "nrchan=%x\n", parsed_region_chan->nr_chan); | 407 | lbs_deb_11d("nrchan=%x\n", parsed_region_chan->nr_chan); |
405 | lbs_dbg_hex("11D:parsed_region_chan:", (u8 *) parsed_region_chan, | 408 | lbs_dbg_hex("11D:parsed_region_chan:", (u8 *) parsed_region_chan, |
406 | 2 + COUNTRY_CODE_LEN + sizeof(struct parsed_region_chan_11d) * idx); | 409 | 2 + COUNTRY_CODE_LEN + sizeof(struct parsed_region_chan_11d) * idx); |
407 | 410 | ||
408 | LEAVE(); | 411 | done: |
412 | lbs_deb_enter(LBS_DEB_11D); | ||
409 | return 0; | 413 | return 0; |
410 | } | 414 | } |
411 | 415 | ||
@@ -420,16 +424,16 @@ u8 libertas_get_scan_type_11d(u8 chan, | |||
420 | { | 424 | { |
421 | u8 scan_type = cmd_scan_type_passive; | 425 | u8 scan_type = cmd_scan_type_passive; |
422 | 426 | ||
423 | ENTER(); | 427 | lbs_deb_enter(LBS_DEB_11D); |
424 | 428 | ||
425 | if (wlan_channel_known_11d(chan, parsed_region_chan)) { | 429 | if (wlan_channel_known_11d(chan, parsed_region_chan)) { |
426 | lbs_pr_debug(1, "11D: Found and do Active Scan\n"); | 430 | lbs_deb_11d("11D: Found and do Active Scan\n"); |
427 | scan_type = cmd_scan_type_active; | 431 | scan_type = cmd_scan_type_active; |
428 | } else { | 432 | } else { |
429 | lbs_pr_debug(1, "11D: Not Find and do Passive Scan\n"); | 433 | lbs_deb_11d("11D: Not Find and do Passive Scan\n"); |
430 | } | 434 | } |
431 | 435 | ||
432 | LEAVE(); | 436 | lbs_deb_leave_args(LBS_DEB_11D, "ret scan_type %d", scan_type); |
433 | return scan_type; | 437 | return scan_type; |
434 | 438 | ||
435 | } | 439 | } |
@@ -456,7 +460,7 @@ static int wlan_enable_11d(wlan_private * priv, u8 flag) | |||
456 | OID_802_11D_ENABLE, | 460 | OID_802_11D_ENABLE, |
457 | &priv->adapter->enable11d); | 461 | &priv->adapter->enable11d); |
458 | if (ret) | 462 | if (ret) |
459 | lbs_pr_debug(1, "11D: Fail to enable 11D \n"); | 463 | lbs_deb_11d("11D: Fail to enable 11D \n"); |
460 | 464 | ||
461 | return 0; | 465 | return 0; |
462 | } | 466 | } |
@@ -471,7 +475,7 @@ static int set_domain_info_11d(wlan_private * priv) | |||
471 | int ret; | 475 | int ret; |
472 | 476 | ||
473 | if (!priv->adapter->enable11d) { | 477 | if (!priv->adapter->enable11d) { |
474 | lbs_pr_debug(1, "11D: dnld domain Info with 11d disabled\n"); | 478 | lbs_deb_11d("11D: dnld domain Info with 11d disabled\n"); |
475 | return 0; | 479 | return 0; |
476 | } | 480 | } |
477 | 481 | ||
@@ -479,7 +483,7 @@ static int set_domain_info_11d(wlan_private * priv) | |||
479 | cmd_act_set, | 483 | cmd_act_set, |
480 | cmd_option_waitforrsp, 0, NULL); | 484 | cmd_option_waitforrsp, 0, NULL); |
481 | if (ret) | 485 | if (ret) |
482 | lbs_pr_debug(1, "11D: Fail to dnld domain Info\n"); | 486 | lbs_deb_11d("11D: Fail to dnld domain Info\n"); |
483 | 487 | ||
484 | return ret; | 488 | return ret; |
485 | } | 489 | } |
@@ -501,7 +505,7 @@ int libertas_set_universaltable(wlan_private * priv, u8 band) | |||
501 | 505 | ||
502 | adapter->universal_channel[i].nrcfp = | 506 | adapter->universal_channel[i].nrcfp = |
503 | sizeof(channel_freq_power_UN_BG) / size; | 507 | sizeof(channel_freq_power_UN_BG) / size; |
504 | lbs_pr_debug(1, "11D: BG-band nrcfp=%d\n", | 508 | lbs_deb_11d("11D: BG-band nrcfp=%d\n", |
505 | adapter->universal_channel[i].nrcfp); | 509 | adapter->universal_channel[i].nrcfp); |
506 | 510 | ||
507 | adapter->universal_channel[i].CFP = channel_freq_power_UN_BG; | 511 | adapter->universal_channel[i].CFP = channel_freq_power_UN_BG; |
@@ -531,9 +535,9 @@ int libertas_cmd_802_11d_domain_info(wlan_private * priv, | |||
531 | wlan_adapter *adapter = priv->adapter; | 535 | wlan_adapter *adapter = priv->adapter; |
532 | u8 nr_subband = adapter->domainreg.nr_subband; | 536 | u8 nr_subband = adapter->domainreg.nr_subband; |
533 | 537 | ||
534 | ENTER(); | 538 | lbs_deb_enter(LBS_DEB_11D); |
535 | 539 | ||
536 | lbs_pr_debug(1, "nr_subband=%x\n", nr_subband); | 540 | lbs_deb_11d("nr_subband=%x\n", nr_subband); |
537 | 541 | ||
538 | cmd->command = cpu_to_le16(cmdno); | 542 | cmd->command = cpu_to_le16(cmdno); |
539 | pdomaininfo->action = cpu_to_le16(cmdoption); | 543 | pdomaininfo->action = cpu_to_le16(cmdoption); |
@@ -542,8 +546,7 @@ int libertas_cmd_802_11d_domain_info(wlan_private * priv, | |||
542 | cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN); | 546 | cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN); |
543 | lbs_dbg_hex("11D: 802_11D_DOMAIN_INFO:", (u8 *) cmd, | 547 | lbs_dbg_hex("11D: 802_11D_DOMAIN_INFO:", (u8 *) cmd, |
544 | (int)(cmd->size)); | 548 | (int)(cmd->size)); |
545 | LEAVE(); | 549 | goto done; |
546 | return 0; | ||
547 | } | 550 | } |
548 | 551 | ||
549 | domain->header.type = cpu_to_le16(TLV_TYPE_DOMAIN); | 552 | domain->header.type = cpu_to_le16(TLV_TYPE_DOMAIN); |
@@ -567,10 +570,10 @@ int libertas_cmd_802_11d_domain_info(wlan_private * priv, | |||
567 | cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN); | 570 | cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN); |
568 | } | 571 | } |
569 | 572 | ||
570 | lbs_dbg_hex("11D:802_11D_DOMAIN_INFO:", (u8 *) cmd, (int)(cmd->size)); | 573 | lbs_dbg_hex("11D:802_11D_DOMAIN_INFO:", (u8 *) cmd, le16_to_cpu(cmd->size)); |
571 | |||
572 | LEAVE(); | ||
573 | 574 | ||
575 | done: | ||
576 | lbs_deb_enter(LBS_DEB_11D); | ||
574 | return 0; | 577 | return 0; |
575 | } | 578 | } |
576 | 579 | ||
@@ -585,17 +588,17 @@ int libertas_cmd_enable_11d(wlan_private * priv, struct iwreq *wrq) | |||
585 | int data = 0; | 588 | int data = 0; |
586 | int *val; | 589 | int *val; |
587 | 590 | ||
588 | ENTER(); | 591 | lbs_deb_enter(LBS_DEB_11D); |
589 | data = SUBCMD_DATA(wrq); | 592 | data = SUBCMD_DATA(wrq); |
590 | 593 | ||
591 | lbs_pr_debug(1, "enable 11D: %s\n", | 594 | lbs_deb_11d("enable 11D: %s\n", |
592 | (data == 1) ? "enable" : "Disable"); | 595 | (data == 1) ? "enable" : "Disable"); |
593 | 596 | ||
594 | wlan_enable_11d(priv, data); | 597 | wlan_enable_11d(priv, data); |
595 | val = (int *)wrq->u.name; | 598 | val = (int *)wrq->u.name; |
596 | *val = priv->adapter->enable11d; | 599 | *val = priv->adapter->enable11d; |
597 | 600 | ||
598 | LEAVE(); | 601 | lbs_deb_enter(LBS_DEB_11D); |
599 | return 0; | 602 | return 0; |
600 | } | 603 | } |
601 | 604 | ||
@@ -608,25 +611,24 @@ int libertas_cmd_enable_11d(wlan_private * priv, struct iwreq *wrq) | |||
608 | int libertas_ret_802_11d_domain_info(wlan_private * priv, | 611 | int libertas_ret_802_11d_domain_info(wlan_private * priv, |
609 | struct cmd_ds_command *resp) | 612 | struct cmd_ds_command *resp) |
610 | { | 613 | { |
611 | struct cmd_ds_802_11d_domain_info | 614 | struct cmd_ds_802_11d_domain_info *domaininfo = &resp->params.domaininforesp; |
612 | *domaininfo = &resp->params.domaininforesp; | ||
613 | struct mrvlietypes_domainparamset *domain = &domaininfo->domain; | 615 | struct mrvlietypes_domainparamset *domain = &domaininfo->domain; |
614 | u16 action = le16_to_cpu(domaininfo->action); | 616 | u16 action = le16_to_cpu(domaininfo->action); |
615 | s16 ret = 0; | 617 | s16 ret = 0; |
616 | u8 nr_subband = 0; | 618 | u8 nr_subband = 0; |
617 | 619 | ||
618 | ENTER(); | 620 | lbs_deb_enter(LBS_DEB_11D); |
619 | 621 | ||
620 | lbs_dbg_hex("11D DOMAIN Info Rsp Data:", (u8 *) resp, | 622 | lbs_dbg_hex("11D DOMAIN Info Rsp Data:", (u8 *) resp, |
621 | (int)le16_to_cpu(resp->size)); | 623 | (int)le16_to_cpu(resp->size)); |
622 | 624 | ||
623 | nr_subband = (domain->header.len - 3) / sizeof(struct ieeetypes_subbandset); | 625 | nr_subband = (le16_to_cpu(domain->header.len) - COUNTRY_CODE_LEN) / |
624 | /* countrycode 3 bytes */ | 626 | sizeof(struct ieeetypes_subbandset); |
625 | 627 | ||
626 | lbs_pr_debug(1, "11D Domain Info Resp: nr_subband=%d\n", nr_subband); | 628 | lbs_deb_11d("11D Domain Info Resp: nr_subband=%d\n", nr_subband); |
627 | 629 | ||
628 | if (nr_subband > MRVDRV_MAX_SUBBAND_802_11D) { | 630 | if (nr_subband > MRVDRV_MAX_SUBBAND_802_11D) { |
629 | lbs_pr_debug(1, "Invalid Numrer of Subband returned!!\n"); | 631 | lbs_deb_11d("Invalid Numrer of Subband returned!!\n"); |
630 | return -1; | 632 | return -1; |
631 | } | 633 | } |
632 | 634 | ||
@@ -637,12 +639,12 @@ int libertas_ret_802_11d_domain_info(wlan_private * priv, | |||
637 | case cmd_act_get: | 639 | case cmd_act_get: |
638 | break; | 640 | break; |
639 | default: | 641 | default: |
640 | lbs_pr_debug(1, "Invalid action:%d\n", domaininfo->action); | 642 | lbs_deb_11d("Invalid action:%d\n", domaininfo->action); |
641 | ret = -1; | 643 | ret = -1; |
642 | break; | 644 | break; |
643 | } | 645 | } |
644 | 646 | ||
645 | LEAVE(); | 647 | lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret); |
646 | return ret; | 648 | return ret; |
647 | } | 649 | } |
648 | 650 | ||
@@ -651,23 +653,22 @@ int libertas_ret_802_11d_domain_info(wlan_private * priv, | |||
651 | * @param priv pointer to wlan_private | 653 | * @param priv pointer to wlan_private |
652 | * @return 0; -1 | 654 | * @return 0; -1 |
653 | */ | 655 | */ |
654 | int libertas_parse_dnld_countryinfo_11d(wlan_private * priv) | 656 | int libertas_parse_dnld_countryinfo_11d(wlan_private * priv, |
657 | struct bss_descriptor * bss) | ||
655 | { | 658 | { |
656 | int ret; | 659 | int ret; |
657 | wlan_adapter *adapter = priv->adapter; | 660 | wlan_adapter *adapter = priv->adapter; |
658 | 661 | ||
659 | ENTER(); | 662 | lbs_deb_enter(LBS_DEB_11D); |
660 | if (priv->adapter->enable11d) { | 663 | if (priv->adapter->enable11d) { |
661 | memset(&adapter->parsed_region_chan, 0, | 664 | memset(&adapter->parsed_region_chan, 0, |
662 | sizeof(struct parsed_region_chan_11d)); | 665 | sizeof(struct parsed_region_chan_11d)); |
663 | ret = parse_domain_info_11d(&adapter->pattemptedbssdesc-> | 666 | ret = parse_domain_info_11d(&bss->countryinfo, 0, |
664 | countryinfo, 0, | ||
665 | &adapter->parsed_region_chan); | 667 | &adapter->parsed_region_chan); |
666 | 668 | ||
667 | if (ret == -1) { | 669 | if (ret == -1) { |
668 | lbs_pr_debug(1, "11D: Err Parse domain_info from AP..\n"); | 670 | lbs_deb_11d("11D: Err Parse domain_info from AP..\n"); |
669 | LEAVE(); | 671 | goto done; |
670 | return ret; | ||
671 | } | 672 | } |
672 | 673 | ||
673 | memset(&adapter->domainreg, 0, | 674 | memset(&adapter->domainreg, 0, |
@@ -678,13 +679,15 @@ int libertas_parse_dnld_countryinfo_11d(wlan_private * priv) | |||
678 | ret = set_domain_info_11d(priv); | 679 | ret = set_domain_info_11d(priv); |
679 | 680 | ||
680 | if (ret) { | 681 | if (ret) { |
681 | lbs_pr_debug(1, "11D: Err set domainInfo to FW\n"); | 682 | lbs_deb_11d("11D: Err set domainInfo to FW\n"); |
682 | LEAVE(); | 683 | goto done; |
683 | return ret; | ||
684 | } | 684 | } |
685 | } | 685 | } |
686 | LEAVE(); | 686 | ret = 0; |
687 | return 0; | 687 | |
688 | done: | ||
689 | lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret); | ||
690 | return ret; | ||
688 | } | 691 | } |
689 | 692 | ||
690 | /** | 693 | /** |
@@ -699,8 +702,8 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv) | |||
699 | struct region_channel *region_chan; | 702 | struct region_channel *region_chan; |
700 | u8 j; | 703 | u8 j; |
701 | 704 | ||
702 | ENTER(); | 705 | lbs_deb_enter(LBS_DEB_11D); |
703 | lbs_pr_debug(1, "11D:curbssparams.band[%d]\n", adapter->curbssparams.band); | 706 | lbs_deb_11d("11D:curbssparams.band[%d]\n", adapter->curbssparams.band); |
704 | 707 | ||
705 | if (priv->adapter->enable11d) { | 708 | if (priv->adapter->enable11d) { |
706 | /* update parsed_region_chan_11; dnld domaininf to FW */ | 709 | /* update parsed_region_chan_11; dnld domaininf to FW */ |
@@ -709,7 +712,7 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv) | |||
709 | sizeof(adapter->region_channel[0]); j++) { | 712 | sizeof(adapter->region_channel[0]); j++) { |
710 | region_chan = &adapter->region_channel[j]; | 713 | region_chan = &adapter->region_channel[j]; |
711 | 714 | ||
712 | lbs_pr_debug(1, "11D:[%d] region_chan->band[%d]\n", j, | 715 | lbs_deb_11d("11D:[%d] region_chan->band[%d]\n", j, |
713 | region_chan->band); | 716 | region_chan->band); |
714 | 717 | ||
715 | if (!region_chan || !region_chan->valid | 718 | if (!region_chan || !region_chan->valid |
@@ -722,10 +725,10 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv) | |||
722 | 725 | ||
723 | if (j >= sizeof(adapter->region_channel) / | 726 | if (j >= sizeof(adapter->region_channel) / |
724 | sizeof(adapter->region_channel[0])) { | 727 | sizeof(adapter->region_channel[0])) { |
725 | lbs_pr_debug(1, "11D:region_chan not found. band[%d]\n", | 728 | lbs_deb_11d("11D:region_chan not found. band[%d]\n", |
726 | adapter->curbssparams.band); | 729 | adapter->curbssparams.band); |
727 | LEAVE(); | 730 | ret = -1; |
728 | return -1; | 731 | goto done; |
729 | } | 732 | } |
730 | 733 | ||
731 | memset(&adapter->parsed_region_chan, 0, | 734 | memset(&adapter->parsed_region_chan, 0, |
@@ -742,13 +745,14 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv) | |||
742 | ret = set_domain_info_11d(priv); | 745 | ret = set_domain_info_11d(priv); |
743 | 746 | ||
744 | if (ret) { | 747 | if (ret) { |
745 | lbs_pr_debug(1, "11D: Err set domainInfo to FW\n"); | 748 | lbs_deb_11d("11D: Err set domainInfo to FW\n"); |
746 | LEAVE(); | 749 | goto done; |
747 | return ret; | ||
748 | } | 750 | } |
749 | 751 | ||
750 | } | 752 | } |
753 | ret = 0; | ||
751 | 754 | ||
752 | LEAVE(); | 755 | done: |
753 | return 0; | 756 | lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret); |
757 | return ret; | ||
754 | } | 758 | } |
diff --git a/drivers/net/wireless/libertas/11d.h b/drivers/net/wireless/libertas/11d.h index db2ebea9f231..73e42e712911 100644 --- a/drivers/net/wireless/libertas/11d.h +++ b/drivers/net/wireless/libertas/11d.h | |||
@@ -47,7 +47,7 @@ struct mrvlietypes_domainparamset { | |||
47 | } __attribute__ ((packed)); | 47 | } __attribute__ ((packed)); |
48 | 48 | ||
49 | struct cmd_ds_802_11d_domain_info { | 49 | struct cmd_ds_802_11d_domain_info { |
50 | u16 action; | 50 | __le16 action; |
51 | struct mrvlietypes_domainparamset domain; | 51 | struct mrvlietypes_domainparamset domain; |
52 | } __attribute__ ((packed)); | 52 | } __attribute__ ((packed)); |
53 | 53 | ||
@@ -98,7 +98,9 @@ int libertas_cmd_enable_11d(wlan_private * priv, struct iwreq *wrq); | |||
98 | int libertas_ret_802_11d_domain_info(wlan_private * priv, | 98 | int libertas_ret_802_11d_domain_info(wlan_private * priv, |
99 | struct cmd_ds_command *resp); | 99 | struct cmd_ds_command *resp); |
100 | 100 | ||
101 | int libertas_parse_dnld_countryinfo_11d(wlan_private * priv); | 101 | struct bss_descriptor; |
102 | int libertas_parse_dnld_countryinfo_11d(wlan_private * priv, | ||
103 | struct bss_descriptor * bss); | ||
102 | 104 | ||
103 | int libertas_create_dnld_countryinfo_11d(wlan_private * priv); | 105 | int libertas_create_dnld_countryinfo_11d(wlan_private * priv); |
104 | 106 | ||
diff --git a/drivers/net/wireless/libertas/Makefile b/drivers/net/wireless/libertas/Makefile index 56a8ea1fbf04..a1097f59fd46 100644 --- a/drivers/net/wireless/libertas/Makefile +++ b/drivers/net/wireless/libertas/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | usb8xxx-objs := main.o fw.o wext.o \ | 1 | libertas-objs := main.o fw.o wext.o \ |
2 | rx.o tx.o cmd.o \ | 2 | rx.o tx.o cmd.o \ |
3 | cmdresp.o scan.o \ | 3 | cmdresp.o scan.o \ |
4 | join.o 11d.o \ | 4 | join.o 11d.o \ |
@@ -8,5 +8,5 @@ usb8xxx-objs := main.o fw.o wext.o \ | |||
8 | usb8xxx-objs += if_bootcmd.o | 8 | usb8xxx-objs += if_bootcmd.o |
9 | usb8xxx-objs += if_usb.o | 9 | usb8xxx-objs += if_usb.o |
10 | 10 | ||
11 | obj-$(CONFIG_LIBERTAS) += libertas.o | ||
11 | obj-$(CONFIG_LIBERTAS_USB) += usb8xxx.o | 12 | obj-$(CONFIG_LIBERTAS_USB) += usb8xxx.o |
12 | |||
diff --git a/drivers/net/wireless/libertas/README b/drivers/net/wireless/libertas/README index 378577200b56..1f92f50b643c 100644 --- a/drivers/net/wireless/libertas/README +++ b/drivers/net/wireless/libertas/README | |||
@@ -1,7 +1,7 @@ | |||
1 | ================================================================================ | 1 | ================================================================================ |
2 | README for USB8388 | 2 | README for USB8388 |
3 | 3 | ||
4 | (c) Copyright © 2003-2006, Marvell International Ltd. | 4 | (c) Copyright © 2003-2006, Marvell International Ltd. |
5 | All Rights Reserved | 5 | All Rights Reserved |
6 | 6 | ||
7 | This software file (the "File") is distributed by Marvell International | 7 | This software file (the "File") is distributed by Marvell International |
@@ -47,15 +47,19 @@ Version 5 Command: | |||
47 | iwpriv ethX ledgpio <n> | 47 | iwpriv ethX ledgpio <n> |
48 | 48 | ||
49 | BT Commands: | 49 | BT Commands: |
50 | The blinding table (BT) contains a list of mac addresses that should be | 50 | The blinding table (BT) contains a list of mac addresses that will be, |
51 | ignored by the firmware. It is primarily used for debugging and | 51 | by default, ignored by the firmware. It is also possible to invert this |
52 | testing networks. It can be edited and inspected with the following | 52 | behavior so that we will ignore all traffic except for the portion |
53 | commands: | 53 | coming from mac addresess in the list. It is primarily used for |
54 | debugging and testing networks. It can be edited and inspected with | ||
55 | the following commands: | ||
54 | 56 | ||
55 | iwpriv ethX bt_reset | 57 | iwpriv ethX bt_reset |
56 | iwpriv ethX bt_add <mac_address> | 58 | iwpriv ethX bt_add <mac_address> |
57 | iwpriv ethX bt_del <mac_address> | 59 | iwpriv ethX bt_del <mac_address> |
58 | iwpriv ethX bt_list <id> | 60 | iwpriv ethX bt_list <id> |
61 | iwpriv ethX bt_get_invert <n> | ||
62 | iwpriv ethX bt_set_invert <n> | ||
59 | 63 | ||
60 | FWT Commands: | 64 | FWT Commands: |
61 | The forwarding table (FWT) is a feature used to manage mesh network | 65 | The forwarding table (FWT) is a feature used to manage mesh network |
@@ -135,7 +139,7 @@ fwt_add | |||
135 | This command is used to insert an entry into the FWT table. The list of | 139 | This command is used to insert an entry into the FWT table. The list of |
136 | parameters must follow the following structure: | 140 | parameters must follow the following structure: |
137 | 141 | ||
138 | iwpriv ethX fwt_add da ra [metric dir ssn dsn hopcount ttl expiration sleepmode snr] | 142 | iwpriv ethX fwt_add da ra [metric dir rate ssn dsn hopcount ttl expiration sleepmode snr] |
139 | 143 | ||
140 | The parameters between brackets are optional, but they must appear in | 144 | The parameters between brackets are optional, but they must appear in |
141 | the order specified. For example, if you want to specify the metric, | 145 | the order specified. For example, if you want to specify the metric, |
@@ -150,6 +154,9 @@ fwt_add | |||
150 | preferred, default is 0) | 154 | preferred, default is 0) |
151 | dir -- direction (1 for direct, 0 for reverse, | 155 | dir -- direction (1 for direct, 0 for reverse, |
152 | default is 1) | 156 | default is 1) |
157 | rate -- data rate used for transmission to the RA, | ||
158 | as specified for the rateadapt command, | ||
159 | default is 3 (11Mbps) | ||
153 | ssn -- Source Sequence Number (time at the RA for | 160 | ssn -- Source Sequence Number (time at the RA for |
154 | reverse routes. Default is 0) | 161 | reverse routes. Default is 0) |
155 | dsn -- Destination Sequence Number (time at the DA | 162 | dsn -- Destination Sequence Number (time at the DA |
@@ -207,13 +214,17 @@ fwt_list | |||
207 | 214 | ||
208 | The output is a string of the following form: | 215 | The output is a string of the following form: |
209 | 216 | ||
210 | da ra metric dir ssn dsn hopcount ttl expiration sleepmode snr | 217 | da ra valid metric dir rate ssn dsn hopcount ttl expiration |
218 | sleepmode snr precursor | ||
211 | 219 | ||
212 | where the different fields are:- | 220 | where the different fields are:- |
213 | da -- DA MAC address (in the form "00:11:22:33:44:55") | 221 | da -- DA MAC address (in the form "00:11:22:33:44:55") |
214 | ra -- RA MAC address (in the form "00:11:22:33:44:55") | 222 | ra -- RA MAC address (in the form "00:11:22:33:44:55") |
223 | valid -- whether the route is valid (0 if not valid) | ||
215 | metric -- route metric (cost: smaller-metric routes are preferred) | 224 | metric -- route metric (cost: smaller-metric routes are preferred) |
216 | dir -- direction (1 for direct, 0 for reverse) | 225 | dir -- direction (1 for direct, 0 for reverse) |
226 | rate -- data rate used for transmission to the RA, | ||
227 | as specified for the rateadapt command | ||
217 | ssn -- Source Sequence Number (time at the RA for reverse routes) | 228 | ssn -- Source Sequence Number (time at the RA for reverse routes) |
218 | dsn -- Destination Sequence Number (time at the DA for direct routes) | 229 | dsn -- Destination Sequence Number (time at the DA for direct routes) |
219 | hopcount -- hop count (currently unused) | 230 | hopcount -- hop count (currently unused) |
@@ -221,33 +232,10 @@ fwt_list | |||
221 | expiration -- entry expiration (in ticks, where a tick is 1024us, or ~ 1ms. Use 0 for an indefinite entry) | 232 | expiration -- entry expiration (in ticks, where a tick is 1024us, or ~ 1ms. Use 0 for an indefinite entry) |
222 | sleepmode -- RA's sleep mode (currently unused) | 233 | sleepmode -- RA's sleep mode (currently unused) |
223 | snr -- SNR in the link to RA (currently unused) | 234 | snr -- SNR in the link to RA (currently unused) |
235 | precursor -- predecessor in direct routes | ||
224 | 236 | ||
225 | fwt_list_route | 237 | fwt_list_route |
226 | This command is used to list a route from the FWT table. The only | 238 | This command is equivalent to fwt_list. |
227 | parameter is the route ID. If you want to list all the routes in a | ||
228 | table, start with rid=0, and keep incrementing rid until you get a | ||
229 | "(null)" string. This function is similar to fwt_list. The only | ||
230 | difference is the output format. Also note that this command is meant | ||
231 | for debugging. It is expected that users will use fwt_lookup and | ||
232 | fwt_list. One important reason for this is that the route id may change | ||
233 | as the route table is altered. | ||
234 | |||
235 | iwpriv ethX fwt_list_route rid | ||
236 | |||
237 | The output is a string of the following form: | ||
238 | |||
239 | da metric dir nid ssn dsn hopcount ttl expiration | ||
240 | |||
241 | where the different fields are:- | ||
242 | da -- DA MAC address (in the form "00:11:22:33:44:55") | ||
243 | metric -- route metric (cost: smaller-metric routes are preferred) | ||
244 | dir -- direction (1 for direct, 0 for reverse) | ||
245 | nid -- Next-hop (neighbor) host ID (nid) | ||
246 | ssn -- Source Sequence Number (time at the RA for reverse routes) | ||
247 | dsn -- Destination Sequence Number (time at the DA for direct routes) | ||
248 | hopcount -- hop count (currently unused) | ||
249 | ttl -- TTL count (only used in reverse entries) | ||
250 | expiration -- entry expiration (in ticks, where a tick is 1024us, or ~ 1ms. Use 0 for an indefinite entry) | ||
251 | 239 | ||
252 | fwt_list_neigh | 240 | fwt_list_neigh |
253 | This command is used to list a neighbor from the FWT table. The only | 241 | This command is used to list a neighbor from the FWT table. The only |
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index c260bd1b3d46..f67efa0815fe 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | #include <linux/bitops.h> | 3 | #include <linux/bitops.h> |
4 | #include <net/ieee80211.h> | 4 | #include <net/ieee80211.h> |
5 | #include <linux/etherdevice.h> | ||
5 | 6 | ||
6 | #include "assoc.h" | 7 | #include "assoc.h" |
7 | #include "join.h" | 8 | #include "join.h" |
@@ -13,59 +14,88 @@ | |||
13 | static const u8 bssid_any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; | 14 | static const u8 bssid_any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; |
14 | static const u8 bssid_off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | 15 | static const u8 bssid_off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; |
15 | 16 | ||
17 | static void print_assoc_req(const char * extra, struct assoc_request * assoc_req) | ||
18 | { | ||
19 | lbs_deb_assoc( | ||
20 | "#### Association Request: %s\n" | ||
21 | " flags: 0x%08lX\n" | ||
22 | " SSID: '%s'\n" | ||
23 | " channel: %d\n" | ||
24 | " band: %d\n" | ||
25 | " mode: %d\n" | ||
26 | " BSSID: " MAC_FMT "\n" | ||
27 | " Encryption:%s%s%s\n" | ||
28 | " auth: %d\n", | ||
29 | extra, assoc_req->flags, | ||
30 | escape_essid(assoc_req->ssid, assoc_req->ssid_len), | ||
31 | assoc_req->channel, assoc_req->band, assoc_req->mode, | ||
32 | MAC_ARG(assoc_req->bssid), | ||
33 | assoc_req->secinfo.WPAenabled ? " WPA" : "", | ||
34 | assoc_req->secinfo.WPA2enabled ? " WPA2" : "", | ||
35 | assoc_req->secinfo.wep_enabled ? " WEP" : "", | ||
36 | assoc_req->secinfo.auth_mode); | ||
37 | } | ||
38 | |||
39 | |||
16 | static int assoc_helper_essid(wlan_private *priv, | 40 | static int assoc_helper_essid(wlan_private *priv, |
17 | struct assoc_request * assoc_req) | 41 | struct assoc_request * assoc_req) |
18 | { | 42 | { |
19 | wlan_adapter *adapter = priv->adapter; | 43 | wlan_adapter *adapter = priv->adapter; |
20 | int ret = 0; | 44 | int ret = 0; |
21 | int i; | 45 | struct bss_descriptor * bss; |
46 | int channel = -1; | ||
22 | 47 | ||
23 | ENTER(); | 48 | lbs_deb_enter(LBS_DEB_ASSOC); |
24 | 49 | ||
25 | lbs_pr_debug(1, "New SSID requested: %s\n", assoc_req->ssid.ssid); | 50 | /* FIXME: take channel into account when picking SSIDs if a channel |
51 | * is set. | ||
52 | */ | ||
53 | |||
54 | if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) | ||
55 | channel = assoc_req->channel; | ||
56 | |||
57 | lbs_deb_assoc("New SSID requested: '%s'\n", | ||
58 | escape_essid(assoc_req->ssid, assoc_req->ssid_len)); | ||
26 | if (assoc_req->mode == IW_MODE_INFRA) { | 59 | if (assoc_req->mode == IW_MODE_INFRA) { |
27 | if (adapter->prescan) { | 60 | if (adapter->prescan) { |
28 | libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 1); | 61 | libertas_send_specific_ssid_scan(priv, assoc_req->ssid, |
62 | assoc_req->ssid_len, 0); | ||
29 | } | 63 | } |
30 | 64 | ||
31 | i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, | 65 | bss = libertas_find_ssid_in_list(adapter, assoc_req->ssid, |
32 | NULL, IW_MODE_INFRA); | 66 | assoc_req->ssid_len, NULL, IW_MODE_INFRA, channel); |
33 | if (i >= 0) { | 67 | if (bss != NULL) { |
34 | lbs_pr_debug(1, | 68 | lbs_deb_assoc("SSID found in scan list, associating\n"); |
35 | "SSID found in scan list ... associating...\n"); | 69 | memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor)); |
36 | 70 | ret = wlan_associate(priv, assoc_req); | |
37 | ret = wlan_associate(priv, &adapter->scantable[i]); | ||
38 | if (ret == 0) { | ||
39 | memcpy(&assoc_req->bssid, | ||
40 | &adapter->scantable[i].macaddress, | ||
41 | ETH_ALEN); | ||
42 | } | ||
43 | } else { | 71 | } else { |
44 | lbs_pr_debug(1, "SSID '%s' not found; cannot associate\n", | 72 | lbs_deb_assoc("SSID not found; cannot associate\n"); |
45 | assoc_req->ssid.ssid); | ||
46 | } | 73 | } |
47 | } else if (assoc_req->mode == IW_MODE_ADHOC) { | 74 | } else if (assoc_req->mode == IW_MODE_ADHOC) { |
48 | /* Scan for the network, do not save previous results. Stale | 75 | /* Scan for the network, do not save previous results. Stale |
49 | * scan data will cause us to join a non-existant adhoc network | 76 | * scan data will cause us to join a non-existant adhoc network |
50 | */ | 77 | */ |
51 | libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 0); | 78 | libertas_send_specific_ssid_scan(priv, assoc_req->ssid, |
79 | assoc_req->ssid_len, 1); | ||
52 | 80 | ||
53 | /* Search for the requested SSID in the scan table */ | 81 | /* Search for the requested SSID in the scan table */ |
54 | i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, NULL, | 82 | bss = libertas_find_ssid_in_list(adapter, assoc_req->ssid, |
55 | IW_MODE_ADHOC); | 83 | assoc_req->ssid_len, NULL, IW_MODE_ADHOC, channel); |
56 | if (i >= 0) { | 84 | if (bss != NULL) { |
57 | lbs_pr_debug(1, "SSID found at %d in List, so join\n", ret); | 85 | lbs_deb_assoc("SSID found, will join\n"); |
58 | libertas_join_adhoc_network(priv, &adapter->scantable[i]); | 86 | memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor)); |
87 | libertas_join_adhoc_network(priv, assoc_req); | ||
59 | } else { | 88 | } else { |
60 | /* else send START command */ | 89 | /* else send START command */ |
61 | lbs_pr_debug(1, "SSID not found in list, so creating adhoc" | 90 | lbs_deb_assoc("SSID not found, creating adhoc network\n"); |
62 | " with SSID '%s'\n", assoc_req->ssid.ssid); | 91 | memcpy(&assoc_req->bss.ssid, &assoc_req->ssid, |
63 | libertas_start_adhoc_network(priv, &assoc_req->ssid); | 92 | IW_ESSID_MAX_SIZE); |
93 | assoc_req->bss.ssid_len = assoc_req->ssid_len; | ||
94 | libertas_start_adhoc_network(priv, assoc_req); | ||
64 | } | 95 | } |
65 | memcpy(&assoc_req->bssid, &adapter->current_addr, ETH_ALEN); | ||
66 | } | 96 | } |
67 | 97 | ||
68 | LEAVE(); | 98 | lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); |
69 | return ret; | 99 | return ret; |
70 | } | 100 | } |
71 | 101 | ||
@@ -74,33 +104,31 @@ static int assoc_helper_bssid(wlan_private *priv, | |||
74 | struct assoc_request * assoc_req) | 104 | struct assoc_request * assoc_req) |
75 | { | 105 | { |
76 | wlan_adapter *adapter = priv->adapter; | 106 | wlan_adapter *adapter = priv->adapter; |
77 | int i, ret = 0; | 107 | int ret = 0; |
78 | 108 | struct bss_descriptor * bss; | |
79 | ENTER(); | ||
80 | 109 | ||
81 | lbs_pr_debug(1, "ASSOC: WAP: BSSID = " MAC_FMT "\n", | 110 | lbs_deb_enter_args(LBS_DEB_ASSOC, "BSSID " MAC_FMT, |
82 | MAC_ARG(assoc_req->bssid)); | 111 | MAC_ARG(assoc_req->bssid)); |
83 | 112 | ||
84 | /* Search for index position in list for requested MAC */ | 113 | /* Search for index position in list for requested MAC */ |
85 | i = libertas_find_BSSID_in_list(adapter, assoc_req->bssid, | 114 | bss = libertas_find_bssid_in_list(adapter, assoc_req->bssid, |
86 | assoc_req->mode); | 115 | assoc_req->mode); |
87 | if (i < 0) { | 116 | if (bss == NULL) { |
88 | lbs_pr_debug(1, "ASSOC: WAP: BSSID " MAC_FMT " not found, " | 117 | lbs_deb_assoc("ASSOC: WAP: BSSID " MAC_FMT " not found, " |
89 | "cannot associate.\n", MAC_ARG(assoc_req->bssid)); | 118 | "cannot associate.\n", MAC_ARG(assoc_req->bssid)); |
90 | goto out; | 119 | goto out; |
91 | } | 120 | } |
92 | 121 | ||
122 | memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor)); | ||
93 | if (assoc_req->mode == IW_MODE_INFRA) { | 123 | if (assoc_req->mode == IW_MODE_INFRA) { |
94 | ret = wlan_associate(priv, &adapter->scantable[i]); | 124 | ret = wlan_associate(priv, assoc_req); |
95 | lbs_pr_debug(1, "ASSOC: return from wlan_associate(bssd) was %d\n", ret); | 125 | lbs_deb_assoc("ASSOC: wlan_associate(bssid) returned %d\n", ret); |
96 | } else if (assoc_req->mode == IW_MODE_ADHOC) { | 126 | } else if (assoc_req->mode == IW_MODE_ADHOC) { |
97 | libertas_join_adhoc_network(priv, &adapter->scantable[i]); | 127 | libertas_join_adhoc_network(priv, assoc_req); |
98 | } | 128 | } |
99 | memcpy(&assoc_req->ssid, &adapter->scantable[i].ssid, | ||
100 | sizeof(struct WLAN_802_11_SSID)); | ||
101 | 129 | ||
102 | out: | 130 | out: |
103 | LEAVE(); | 131 | lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); |
104 | return ret; | 132 | return ret; |
105 | } | 133 | } |
106 | 134 | ||
@@ -113,12 +141,12 @@ static int assoc_helper_associate(wlan_private *priv, | |||
113 | /* If we're given and 'any' BSSID, try associating based on SSID */ | 141 | /* If we're given and 'any' BSSID, try associating based on SSID */ |
114 | 142 | ||
115 | if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) { | 143 | if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) { |
116 | if (memcmp(bssid_any, assoc_req->bssid, ETH_ALEN) | 144 | if (compare_ether_addr(bssid_any, assoc_req->bssid) |
117 | && memcmp(bssid_off, assoc_req->bssid, ETH_ALEN)) { | 145 | && compare_ether_addr(bssid_off, assoc_req->bssid)) { |
118 | ret = assoc_helper_bssid(priv, assoc_req); | 146 | ret = assoc_helper_bssid(priv, assoc_req); |
119 | done = 1; | 147 | done = 1; |
120 | if (ret) { | 148 | if (ret) { |
121 | lbs_pr_debug(1, "ASSOC: bssid: ret = %d\n", ret); | 149 | lbs_deb_assoc("ASSOC: bssid: ret = %d\n", ret); |
122 | } | 150 | } |
123 | } | 151 | } |
124 | } | 152 | } |
@@ -126,7 +154,7 @@ static int assoc_helper_associate(wlan_private *priv, | |||
126 | if (!done && test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { | 154 | if (!done && test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { |
127 | ret = assoc_helper_essid(priv, assoc_req); | 155 | ret = assoc_helper_essid(priv, assoc_req); |
128 | if (ret) { | 156 | if (ret) { |
129 | lbs_pr_debug(1, "ASSOC: bssid: ret = %d\n", ret); | 157 | lbs_deb_assoc("ASSOC: bssid: ret = %d\n", ret); |
130 | } | 158 | } |
131 | } | 159 | } |
132 | 160 | ||
@@ -140,12 +168,10 @@ static int assoc_helper_mode(wlan_private *priv, | |||
140 | wlan_adapter *adapter = priv->adapter; | 168 | wlan_adapter *adapter = priv->adapter; |
141 | int ret = 0; | 169 | int ret = 0; |
142 | 170 | ||
143 | ENTER(); | 171 | lbs_deb_enter(LBS_DEB_ASSOC); |
144 | 172 | ||
145 | if (assoc_req->mode == adapter->mode) { | 173 | if (assoc_req->mode == adapter->mode) |
146 | LEAVE(); | 174 | goto done; |
147 | return 0; | ||
148 | } | ||
149 | 175 | ||
150 | if (assoc_req->mode == IW_MODE_INFRA) { | 176 | if (assoc_req->mode == IW_MODE_INFRA) { |
151 | if (adapter->psstate != PS_STATE_FULL_POWER) | 177 | if (adapter->psstate != PS_STATE_FULL_POWER) |
@@ -158,9 +184,81 @@ static int assoc_helper_mode(wlan_private *priv, | |||
158 | cmd_802_11_snmp_mib, | 184 | cmd_802_11_snmp_mib, |
159 | 0, cmd_option_waitforrsp, | 185 | 0, cmd_option_waitforrsp, |
160 | OID_802_11_INFRASTRUCTURE_MODE, | 186 | OID_802_11_INFRASTRUCTURE_MODE, |
161 | (void *) (size_t) assoc_req->mode); | 187 | /* Shoot me now */ (void *) (size_t) assoc_req->mode); |
162 | 188 | ||
163 | LEAVE(); | 189 | done: |
190 | lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); | ||
191 | return ret; | ||
192 | } | ||
193 | |||
194 | |||
195 | static int update_channel(wlan_private * priv) | ||
196 | { | ||
197 | /* the channel in f/w could be out of sync, get the current channel */ | ||
198 | return libertas_prepare_and_send_command(priv, cmd_802_11_rf_channel, | ||
199 | cmd_opt_802_11_rf_channel_get, | ||
200 | cmd_option_waitforrsp, 0, NULL); | ||
201 | } | ||
202 | |||
203 | void libertas_sync_channel(struct work_struct *work) | ||
204 | { | ||
205 | wlan_private *priv = container_of(work, wlan_private, sync_channel); | ||
206 | |||
207 | if (update_channel(priv) != 0) | ||
208 | lbs_pr_info("Channel synchronization failed."); | ||
209 | } | ||
210 | |||
211 | static int assoc_helper_channel(wlan_private *priv, | ||
212 | struct assoc_request * assoc_req) | ||
213 | { | ||
214 | wlan_adapter *adapter = priv->adapter; | ||
215 | int ret = 0; | ||
216 | |||
217 | lbs_deb_enter(LBS_DEB_ASSOC); | ||
218 | |||
219 | ret = update_channel(priv); | ||
220 | if (ret < 0) { | ||
221 | lbs_deb_assoc("ASSOC: channel: error getting channel."); | ||
222 | } | ||
223 | |||
224 | if (assoc_req->channel == adapter->curbssparams.channel) | ||
225 | goto done; | ||
226 | |||
227 | lbs_deb_assoc("ASSOC: channel: %d -> %d\n", | ||
228 | adapter->curbssparams.channel, assoc_req->channel); | ||
229 | |||
230 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_rf_channel, | ||
231 | cmd_opt_802_11_rf_channel_set, | ||
232 | cmd_option_waitforrsp, 0, &assoc_req->channel); | ||
233 | if (ret < 0) { | ||
234 | lbs_deb_assoc("ASSOC: channel: error setting channel."); | ||
235 | } | ||
236 | |||
237 | ret = update_channel(priv); | ||
238 | if (ret < 0) { | ||
239 | lbs_deb_assoc("ASSOC: channel: error getting channel."); | ||
240 | } | ||
241 | |||
242 | if (assoc_req->channel != adapter->curbssparams.channel) { | ||
243 | lbs_deb_assoc("ASSOC: channel: failed to update channel to %d", | ||
244 | assoc_req->channel); | ||
245 | goto done; | ||
246 | } | ||
247 | |||
248 | if ( assoc_req->secinfo.wep_enabled | ||
249 | && (assoc_req->wep_keys[0].len | ||
250 | || assoc_req->wep_keys[1].len | ||
251 | || assoc_req->wep_keys[2].len | ||
252 | || assoc_req->wep_keys[3].len)) { | ||
253 | /* Make sure WEP keys are re-sent to firmware */ | ||
254 | set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags); | ||
255 | } | ||
256 | |||
257 | /* Must restart/rejoin adhoc networks after channel change */ | ||
258 | set_bit(ASSOC_FLAG_SSID, &assoc_req->flags); | ||
259 | |||
260 | done: | ||
261 | lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); | ||
164 | return ret; | 262 | return ret; |
165 | } | 263 | } |
166 | 264 | ||
@@ -172,7 +270,7 @@ static int assoc_helper_wep_keys(wlan_private *priv, | |||
172 | int i; | 270 | int i; |
173 | int ret = 0; | 271 | int ret = 0; |
174 | 272 | ||
175 | ENTER(); | 273 | lbs_deb_enter(LBS_DEB_ASSOC); |
176 | 274 | ||
177 | /* Set or remove WEP keys */ | 275 | /* Set or remove WEP keys */ |
178 | if ( assoc_req->wep_keys[0].len | 276 | if ( assoc_req->wep_keys[0].len |
@@ -216,7 +314,7 @@ static int assoc_helper_wep_keys(wlan_private *priv, | |||
216 | mutex_unlock(&adapter->lock); | 314 | mutex_unlock(&adapter->lock); |
217 | 315 | ||
218 | out: | 316 | out: |
219 | LEAVE(); | 317 | lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); |
220 | return ret; | 318 | return ret; |
221 | } | 319 | } |
222 | 320 | ||
@@ -226,14 +324,24 @@ static int assoc_helper_secinfo(wlan_private *priv, | |||
226 | wlan_adapter *adapter = priv->adapter; | 324 | wlan_adapter *adapter = priv->adapter; |
227 | int ret = 0; | 325 | int ret = 0; |
228 | 326 | ||
229 | ENTER(); | 327 | lbs_deb_enter(LBS_DEB_ASSOC); |
230 | 328 | ||
231 | memcpy(&adapter->secinfo, &assoc_req->secinfo, | 329 | memcpy(&adapter->secinfo, &assoc_req->secinfo, |
232 | sizeof(struct wlan_802_11_security)); | 330 | sizeof(struct wlan_802_11_security)); |
233 | 331 | ||
234 | ret = libertas_set_mac_packet_filter(priv); | 332 | ret = libertas_set_mac_packet_filter(priv); |
333 | if (ret) | ||
334 | goto out; | ||
235 | 335 | ||
236 | LEAVE(); | 336 | /* enable/disable RSN */ |
337 | ret = libertas_prepare_and_send_command(priv, | ||
338 | cmd_802_11_enable_rsn, | ||
339 | cmd_act_set, | ||
340 | cmd_option_waitforrsp, | ||
341 | 0, assoc_req); | ||
342 | |||
343 | out: | ||
344 | lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); | ||
237 | return ret; | 345 | return ret; |
238 | } | 346 | } |
239 | 347 | ||
@@ -243,16 +351,7 @@ static int assoc_helper_wpa_keys(wlan_private *priv, | |||
243 | { | 351 | { |
244 | int ret = 0; | 352 | int ret = 0; |
245 | 353 | ||
246 | ENTER(); | 354 | lbs_deb_enter(LBS_DEB_ASSOC); |
247 | |||
248 | /* enable/Disable RSN */ | ||
249 | ret = libertas_prepare_and_send_command(priv, | ||
250 | cmd_802_11_enable_rsn, | ||
251 | cmd_act_set, | ||
252 | cmd_option_waitforrsp, | ||
253 | 0, assoc_req); | ||
254 | if (ret) | ||
255 | goto out; | ||
256 | 355 | ||
257 | ret = libertas_prepare_and_send_command(priv, | 356 | ret = libertas_prepare_and_send_command(priv, |
258 | cmd_802_11_key_material, | 357 | cmd_802_11_key_material, |
@@ -260,8 +359,7 @@ static int assoc_helper_wpa_keys(wlan_private *priv, | |||
260 | cmd_option_waitforrsp, | 359 | cmd_option_waitforrsp, |
261 | 0, assoc_req); | 360 | 0, assoc_req); |
262 | 361 | ||
263 | out: | 362 | lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); |
264 | LEAVE(); | ||
265 | return ret; | 363 | return ret; |
266 | } | 364 | } |
267 | 365 | ||
@@ -272,7 +370,7 @@ static int assoc_helper_wpa_ie(wlan_private *priv, | |||
272 | wlan_adapter *adapter = priv->adapter; | 370 | wlan_adapter *adapter = priv->adapter; |
273 | int ret = 0; | 371 | int ret = 0; |
274 | 372 | ||
275 | ENTER(); | 373 | lbs_deb_enter(LBS_DEB_ASSOC); |
276 | 374 | ||
277 | if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { | 375 | if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { |
278 | memcpy(&adapter->wpa_ie, &assoc_req->wpa_ie, assoc_req->wpa_ie_len); | 376 | memcpy(&adapter->wpa_ie, &assoc_req->wpa_ie, assoc_req->wpa_ie_len); |
@@ -282,7 +380,7 @@ static int assoc_helper_wpa_ie(wlan_private *priv, | |||
282 | adapter->wpa_ie_len = 0; | 380 | adapter->wpa_ie_len = 0; |
283 | } | 381 | } |
284 | 382 | ||
285 | LEAVE(); | 383 | lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); |
286 | return ret; | 384 | return ret; |
287 | } | 385 | } |
288 | 386 | ||
@@ -294,25 +392,30 @@ static int should_deauth_infrastructure(wlan_adapter *adapter, | |||
294 | return 0; | 392 | return 0; |
295 | 393 | ||
296 | if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { | 394 | if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { |
297 | lbs_pr_debug(1, "Deauthenticating due to new SSID in " | 395 | lbs_deb_assoc("Deauthenticating due to new SSID in " |
298 | " configuration request.\n"); | 396 | " configuration request.\n"); |
299 | return 1; | 397 | return 1; |
300 | } | 398 | } |
301 | 399 | ||
302 | if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) { | 400 | if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) { |
303 | if (adapter->secinfo.auth_mode != assoc_req->secinfo.auth_mode) { | 401 | if (adapter->secinfo.auth_mode != assoc_req->secinfo.auth_mode) { |
304 | lbs_pr_debug(1, "Deauthenticating due to updated security " | 402 | lbs_deb_assoc("Deauthenticating due to updated security " |
305 | "info in configuration request.\n"); | 403 | "info in configuration request.\n"); |
306 | return 1; | 404 | return 1; |
307 | } | 405 | } |
308 | } | 406 | } |
309 | 407 | ||
310 | if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) { | 408 | if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) { |
311 | lbs_pr_debug(1, "Deauthenticating due to new BSSID in " | 409 | lbs_deb_assoc("Deauthenticating due to new BSSID in " |
312 | " configuration request.\n"); | 410 | " configuration request.\n"); |
313 | return 1; | 411 | return 1; |
314 | } | 412 | } |
315 | 413 | ||
414 | if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) { | ||
415 | lbs_deb_assoc("Deauthenticating due to channel switch.\n"); | ||
416 | return 1; | ||
417 | } | ||
418 | |||
316 | /* FIXME: deal with 'auto' mode somehow */ | 419 | /* FIXME: deal with 'auto' mode somehow */ |
317 | if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) { | 420 | if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) { |
318 | if (assoc_req->mode != IW_MODE_INFRA) | 421 | if (assoc_req->mode != IW_MODE_INFRA) |
@@ -329,10 +432,9 @@ static int should_stop_adhoc(wlan_adapter *adapter, | |||
329 | if (adapter->connect_status != libertas_connected) | 432 | if (adapter->connect_status != libertas_connected) |
330 | return 0; | 433 | return 0; |
331 | 434 | ||
332 | if (adapter->curbssparams.ssid.ssidlength != assoc_req->ssid.ssidlength) | 435 | if (libertas_ssid_cmp(adapter->curbssparams.ssid, |
333 | return 1; | 436 | adapter->curbssparams.ssid_len, |
334 | if (memcmp(adapter->curbssparams.ssid.ssid, assoc_req->ssid.ssid, | 437 | assoc_req->ssid, assoc_req->ssid_len) != 0) |
335 | adapter->curbssparams.ssid.ssidlength)) | ||
336 | return 1; | 438 | return 1; |
337 | 439 | ||
338 | /* FIXME: deal with 'auto' mode somehow */ | 440 | /* FIXME: deal with 'auto' mode somehow */ |
@@ -341,11 +443,16 @@ static int should_stop_adhoc(wlan_adapter *adapter, | |||
341 | return 1; | 443 | return 1; |
342 | } | 444 | } |
343 | 445 | ||
446 | if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) { | ||
447 | if (assoc_req->channel != adapter->curbssparams.channel) | ||
448 | return 1; | ||
449 | } | ||
450 | |||
344 | return 0; | 451 | return 0; |
345 | } | 452 | } |
346 | 453 | ||
347 | 454 | ||
348 | void wlan_association_worker(struct work_struct *work) | 455 | void libertas_association_worker(struct work_struct *work) |
349 | { | 456 | { |
350 | wlan_private *priv = container_of(work, wlan_private, assoc_work.work); | 457 | wlan_private *priv = container_of(work, wlan_private, assoc_work.work); |
351 | wlan_adapter *adapter = priv->adapter; | 458 | wlan_adapter *adapter = priv->adapter; |
@@ -353,40 +460,38 @@ void wlan_association_worker(struct work_struct *work) | |||
353 | int ret = 0; | 460 | int ret = 0; |
354 | int find_any_ssid = 0; | 461 | int find_any_ssid = 0; |
355 | 462 | ||
356 | ENTER(); | 463 | lbs_deb_enter(LBS_DEB_ASSOC); |
357 | 464 | ||
358 | mutex_lock(&adapter->lock); | 465 | mutex_lock(&adapter->lock); |
359 | assoc_req = adapter->assoc_req; | 466 | assoc_req = adapter->pending_assoc_req; |
360 | adapter->assoc_req = NULL; | 467 | adapter->pending_assoc_req = NULL; |
468 | adapter->in_progress_assoc_req = assoc_req; | ||
361 | mutex_unlock(&adapter->lock); | 469 | mutex_unlock(&adapter->lock); |
362 | 470 | ||
363 | if (!assoc_req) { | 471 | if (!assoc_req) |
364 | LEAVE(); | 472 | goto done; |
365 | return; | ||
366 | } | ||
367 | 473 | ||
368 | lbs_pr_debug(1, "ASSOC: starting new association request: flags = 0x%lX\n", | 474 | print_assoc_req(__func__, assoc_req); |
369 | assoc_req->flags); | ||
370 | 475 | ||
371 | /* If 'any' SSID was specified, find an SSID to associate with */ | 476 | /* If 'any' SSID was specified, find an SSID to associate with */ |
372 | if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags) | 477 | if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags) |
373 | && !assoc_req->ssid.ssidlength) | 478 | && !assoc_req->ssid_len) |
374 | find_any_ssid = 1; | 479 | find_any_ssid = 1; |
375 | 480 | ||
376 | /* But don't use 'any' SSID if there's a valid locked BSSID to use */ | 481 | /* But don't use 'any' SSID if there's a valid locked BSSID to use */ |
377 | if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) { | 482 | if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) { |
378 | if (memcmp(&assoc_req->bssid, bssid_any, ETH_ALEN) | 483 | if (compare_ether_addr(assoc_req->bssid, bssid_any) |
379 | && memcmp(&assoc_req->bssid, bssid_off, ETH_ALEN)) | 484 | && compare_ether_addr(assoc_req->bssid, bssid_off)) |
380 | find_any_ssid = 0; | 485 | find_any_ssid = 0; |
381 | } | 486 | } |
382 | 487 | ||
383 | if (find_any_ssid) { | 488 | if (find_any_ssid) { |
384 | u8 new_mode; | 489 | u8 new_mode; |
385 | 490 | ||
386 | ret = libertas_find_best_network_SSID(priv, &assoc_req->ssid, | 491 | ret = libertas_find_best_network_ssid(priv, assoc_req->ssid, |
387 | assoc_req->mode, &new_mode); | 492 | &assoc_req->ssid_len, assoc_req->mode, &new_mode); |
388 | if (ret) { | 493 | if (ret) { |
389 | lbs_pr_debug(1, "Could not find best network\n"); | 494 | lbs_deb_assoc("Could not find best network\n"); |
390 | ret = -ENETUNREACH; | 495 | ret = -ENETUNREACH; |
391 | goto out; | 496 | goto out; |
392 | } | 497 | } |
@@ -406,7 +511,7 @@ void wlan_association_worker(struct work_struct *work) | |||
406 | if (should_deauth_infrastructure(adapter, assoc_req)) { | 511 | if (should_deauth_infrastructure(adapter, assoc_req)) { |
407 | ret = libertas_send_deauthentication(priv); | 512 | ret = libertas_send_deauthentication(priv); |
408 | if (ret) { | 513 | if (ret) { |
409 | lbs_pr_debug(1, "Deauthentication due to new " | 514 | lbs_deb_assoc("Deauthentication due to new " |
410 | "configuration request failed: %d\n", | 515 | "configuration request failed: %d\n", |
411 | ret); | 516 | ret); |
412 | } | 517 | } |
@@ -415,7 +520,7 @@ void wlan_association_worker(struct work_struct *work) | |||
415 | if (should_stop_adhoc(adapter, assoc_req)) { | 520 | if (should_stop_adhoc(adapter, assoc_req)) { |
416 | ret = libertas_stop_adhoc_network(priv); | 521 | ret = libertas_stop_adhoc_network(priv); |
417 | if (ret) { | 522 | if (ret) { |
418 | lbs_pr_debug(1, "Teardown of AdHoc network due to " | 523 | lbs_deb_assoc("Teardown of AdHoc network due to " |
419 | "new configuration request failed: %d\n", | 524 | "new configuration request failed: %d\n", |
420 | ret); | 525 | ret); |
421 | } | 526 | } |
@@ -427,7 +532,16 @@ void wlan_association_worker(struct work_struct *work) | |||
427 | if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) { | 532 | if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) { |
428 | ret = assoc_helper_mode(priv, assoc_req); | 533 | ret = assoc_helper_mode(priv, assoc_req); |
429 | if (ret) { | 534 | if (ret) { |
430 | lbs_pr_debug(1, "ASSOC(:%d) mode: ret = %d\n", __LINE__, ret); | 535 | lbs_deb_assoc("ASSOC(:%d) mode: ret = %d\n", __LINE__, ret); |
536 | goto out; | ||
537 | } | ||
538 | } | ||
539 | |||
540 | if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) { | ||
541 | ret = assoc_helper_channel(priv, assoc_req); | ||
542 | if (ret) { | ||
543 | lbs_deb_assoc("ASSOC(:%d) channel: ret = %d\n", | ||
544 | __LINE__, ret); | ||
431 | goto out; | 545 | goto out; |
432 | } | 546 | } |
433 | } | 547 | } |
@@ -436,7 +550,7 @@ lbs_pr_debug(1, "ASSOC(:%d) mode: ret = %d\n", __LINE__, ret); | |||
436 | || test_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags)) { | 550 | || test_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags)) { |
437 | ret = assoc_helper_wep_keys(priv, assoc_req); | 551 | ret = assoc_helper_wep_keys(priv, assoc_req); |
438 | if (ret) { | 552 | if (ret) { |
439 | lbs_pr_debug(1, "ASSOC(:%d) wep_keys: ret = %d\n", __LINE__, ret); | 553 | lbs_deb_assoc("ASSOC(:%d) wep_keys: ret = %d\n", __LINE__, ret); |
440 | goto out; | 554 | goto out; |
441 | } | 555 | } |
442 | } | 556 | } |
@@ -444,7 +558,7 @@ lbs_pr_debug(1, "ASSOC(:%d) wep_keys: ret = %d\n", __LINE__, ret); | |||
444 | if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) { | 558 | if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) { |
445 | ret = assoc_helper_secinfo(priv, assoc_req); | 559 | ret = assoc_helper_secinfo(priv, assoc_req); |
446 | if (ret) { | 560 | if (ret) { |
447 | lbs_pr_debug(1, "ASSOC(:%d) secinfo: ret = %d\n", __LINE__, ret); | 561 | lbs_deb_assoc("ASSOC(:%d) secinfo: ret = %d\n", __LINE__, ret); |
448 | goto out; | 562 | goto out; |
449 | } | 563 | } |
450 | } | 564 | } |
@@ -452,7 +566,7 @@ lbs_pr_debug(1, "ASSOC(:%d) secinfo: ret = %d\n", __LINE__, ret); | |||
452 | if (test_bit(ASSOC_FLAG_WPA_IE, &assoc_req->flags)) { | 566 | if (test_bit(ASSOC_FLAG_WPA_IE, &assoc_req->flags)) { |
453 | ret = assoc_helper_wpa_ie(priv, assoc_req); | 567 | ret = assoc_helper_wpa_ie(priv, assoc_req); |
454 | if (ret) { | 568 | if (ret) { |
455 | lbs_pr_debug(1, "ASSOC(:%d) wpa_ie: ret = %d\n", __LINE__, ret); | 569 | lbs_deb_assoc("ASSOC(:%d) wpa_ie: ret = %d\n", __LINE__, ret); |
456 | goto out; | 570 | goto out; |
457 | } | 571 | } |
458 | } | 572 | } |
@@ -461,7 +575,7 @@ lbs_pr_debug(1, "ASSOC(:%d) wpa_ie: ret = %d\n", __LINE__, ret); | |||
461 | || test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) { | 575 | || test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) { |
462 | ret = assoc_helper_wpa_keys(priv, assoc_req); | 576 | ret = assoc_helper_wpa_keys(priv, assoc_req); |
463 | if (ret) { | 577 | if (ret) { |
464 | lbs_pr_debug(1, "ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret); | 578 | lbs_deb_assoc("ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret); |
465 | goto out; | 579 | goto out; |
466 | } | 580 | } |
467 | } | 581 | } |
@@ -475,21 +589,23 @@ lbs_pr_debug(1, "ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret); | |||
475 | 589 | ||
476 | ret = assoc_helper_associate(priv, assoc_req); | 590 | ret = assoc_helper_associate(priv, assoc_req); |
477 | if (ret) { | 591 | if (ret) { |
478 | lbs_pr_debug(1, "ASSOC: association attempt unsuccessful: %d\n", | 592 | lbs_deb_assoc("ASSOC: association attempt unsuccessful: %d\n", |
479 | ret); | 593 | ret); |
480 | success = 0; | 594 | success = 0; |
481 | } | 595 | } |
482 | 596 | ||
483 | if (adapter->connect_status != libertas_connected) { | 597 | if (adapter->connect_status != libertas_connected) { |
484 | lbs_pr_debug(1, "ASSOC: assoication attempt unsuccessful, " | 598 | lbs_deb_assoc("ASSOC: assoication attempt unsuccessful, " |
485 | "not connected.\n"); | 599 | "not connected.\n"); |
486 | success = 0; | 600 | success = 0; |
487 | } | 601 | } |
488 | 602 | ||
489 | if (success) { | 603 | if (success) { |
490 | lbs_pr_debug(1, "ASSOC: association attempt successful. " | 604 | lbs_deb_assoc("ASSOC: association attempt successful. " |
491 | "Associated to '%s' (" MAC_FMT ")\n", | 605 | "Associated to '%s' (" MAC_FMT ")\n", |
492 | assoc_req->ssid.ssid, MAC_ARG(assoc_req->bssid)); | 606 | escape_essid(adapter->curbssparams.ssid, |
607 | adapter->curbssparams.ssid_len), | ||
608 | MAC_ARG(adapter->curbssparams.bssid)); | ||
493 | libertas_prepare_and_send_command(priv, | 609 | libertas_prepare_and_send_command(priv, |
494 | cmd_802_11_rssi, | 610 | cmd_802_11_rssi, |
495 | 0, cmd_option_waitforrsp, 0, NULL); | 611 | 0, cmd_option_waitforrsp, 0, NULL); |
@@ -498,18 +614,23 @@ lbs_pr_debug(1, "ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret); | |||
498 | cmd_802_11_get_log, | 614 | cmd_802_11_get_log, |
499 | 0, cmd_option_waitforrsp, 0, NULL); | 615 | 0, cmd_option_waitforrsp, 0, NULL); |
500 | } else { | 616 | } else { |
501 | |||
502 | ret = -1; | 617 | ret = -1; |
503 | } | 618 | } |
504 | } | 619 | } |
505 | 620 | ||
506 | out: | 621 | out: |
507 | if (ret) { | 622 | if (ret) { |
508 | lbs_pr_debug(1, "ASSOC: reconfiguration attempt unsuccessful: %d\n", | 623 | lbs_deb_assoc("ASSOC: reconfiguration attempt unsuccessful: %d\n", |
509 | ret); | 624 | ret); |
510 | } | 625 | } |
626 | |||
627 | mutex_lock(&adapter->lock); | ||
628 | adapter->in_progress_assoc_req = NULL; | ||
629 | mutex_unlock(&adapter->lock); | ||
511 | kfree(assoc_req); | 630 | kfree(assoc_req); |
512 | LEAVE(); | 631 | |
632 | done: | ||
633 | lbs_deb_leave(LBS_DEB_ASSOC); | ||
513 | } | 634 | } |
514 | 635 | ||
515 | 636 | ||
@@ -520,9 +641,10 @@ struct assoc_request * wlan_get_association_request(wlan_adapter *adapter) | |||
520 | { | 641 | { |
521 | struct assoc_request * assoc_req; | 642 | struct assoc_request * assoc_req; |
522 | 643 | ||
523 | if (!adapter->assoc_req) { | 644 | if (!adapter->pending_assoc_req) { |
524 | adapter->assoc_req = kzalloc(sizeof(struct assoc_request), GFP_KERNEL); | 645 | adapter->pending_assoc_req = kzalloc(sizeof(struct assoc_request), |
525 | if (!adapter->assoc_req) { | 646 | GFP_KERNEL); |
647 | if (!adapter->pending_assoc_req) { | ||
526 | lbs_pr_info("Not enough memory to allocate association" | 648 | lbs_pr_info("Not enough memory to allocate association" |
527 | " request!\n"); | 649 | " request!\n"); |
528 | return NULL; | 650 | return NULL; |
@@ -532,15 +654,19 @@ struct assoc_request * wlan_get_association_request(wlan_adapter *adapter) | |||
532 | /* Copy current configuration attributes to the association request, | 654 | /* Copy current configuration attributes to the association request, |
533 | * but don't overwrite any that are already set. | 655 | * but don't overwrite any that are already set. |
534 | */ | 656 | */ |
535 | assoc_req = adapter->assoc_req; | 657 | assoc_req = adapter->pending_assoc_req; |
536 | if (!test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { | 658 | if (!test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { |
537 | memcpy(&assoc_req->ssid, adapter->curbssparams.ssid.ssid, | 659 | memcpy(&assoc_req->ssid, &adapter->curbssparams.ssid, |
538 | adapter->curbssparams.ssid.ssidlength); | 660 | IW_ESSID_MAX_SIZE); |
661 | assoc_req->ssid_len = adapter->curbssparams.ssid_len; | ||
539 | } | 662 | } |
540 | 663 | ||
541 | if (!test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) | 664 | if (!test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) |
542 | assoc_req->channel = adapter->curbssparams.channel; | 665 | assoc_req->channel = adapter->curbssparams.channel; |
543 | 666 | ||
667 | if (!test_bit(ASSOC_FLAG_BAND, &assoc_req->flags)) | ||
668 | assoc_req->band = adapter->curbssparams.band; | ||
669 | |||
544 | if (!test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) | 670 | if (!test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) |
545 | assoc_req->mode = adapter->mode; | 671 | assoc_req->mode = adapter->mode; |
546 | 672 | ||
@@ -581,7 +707,7 @@ struct assoc_request * wlan_get_association_request(wlan_adapter *adapter) | |||
581 | assoc_req->wpa_ie_len = adapter->wpa_ie_len; | 707 | assoc_req->wpa_ie_len = adapter->wpa_ie_len; |
582 | } | 708 | } |
583 | 709 | ||
710 | print_assoc_req(__func__, assoc_req); | ||
711 | |||
584 | return assoc_req; | 712 | return assoc_req; |
585 | } | 713 | } |
586 | |||
587 | |||
diff --git a/drivers/net/wireless/libertas/assoc.h b/drivers/net/wireless/libertas/assoc.h index 2ffd82d99b34..5e9c31f0932b 100644 --- a/drivers/net/wireless/libertas/assoc.h +++ b/drivers/net/wireless/libertas/assoc.h | |||
@@ -5,10 +5,12 @@ | |||
5 | 5 | ||
6 | #include "dev.h" | 6 | #include "dev.h" |
7 | 7 | ||
8 | void wlan_association_worker(struct work_struct *work); | 8 | void libertas_association_worker(struct work_struct *work); |
9 | 9 | ||
10 | struct assoc_request * wlan_get_association_request(wlan_adapter *adapter); | 10 | struct assoc_request * wlan_get_association_request(wlan_adapter *adapter); |
11 | 11 | ||
12 | void libertas_sync_channel(struct work_struct *work); | ||
13 | |||
12 | #define ASSOC_DELAY (HZ / 2) | 14 | #define ASSOC_DELAY (HZ / 2) |
13 | static inline void wlan_postpone_association_work(wlan_private *priv) | 15 | static inline void wlan_postpone_association_work(wlan_private *priv) |
14 | { | 16 | { |
@@ -21,9 +23,9 @@ static inline void wlan_postpone_association_work(wlan_private *priv) | |||
21 | static inline void wlan_cancel_association_work(wlan_private *priv) | 23 | static inline void wlan_cancel_association_work(wlan_private *priv) |
22 | { | 24 | { |
23 | cancel_delayed_work(&priv->assoc_work); | 25 | cancel_delayed_work(&priv->assoc_work); |
24 | if (priv->adapter->assoc_req) { | 26 | if (priv->adapter->pending_assoc_req) { |
25 | kfree(priv->adapter->assoc_req); | 27 | kfree(priv->adapter->pending_assoc_req); |
26 | priv->adapter->assoc_req = NULL; | 28 | priv->adapter->pending_assoc_req = NULL; |
27 | } | 29 | } |
28 | } | 30 | } |
29 | 31 | ||
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index de9cb46a70ff..124e029f1bf4 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -6,7 +6,6 @@ | |||
6 | #include <net/iw_handler.h> | 6 | #include <net/iw_handler.h> |
7 | #include "host.h" | 7 | #include "host.h" |
8 | #include "hostcmd.h" | 8 | #include "hostcmd.h" |
9 | #include "sbi.h" | ||
10 | #include "decl.h" | 9 | #include "decl.h" |
11 | #include "defs.h" | 10 | #include "defs.h" |
12 | #include "dev.h" | 11 | #include "dev.h" |
@@ -26,13 +25,11 @@ static u16 commands_allowed_in_ps[] = { | |||
26 | * @param command the command ID | 25 | * @param command the command ID |
27 | * @return TRUE or FALSE | 26 | * @return TRUE or FALSE |
28 | */ | 27 | */ |
29 | static u8 is_command_allowed_in_ps(u16 command) | 28 | static u8 is_command_allowed_in_ps(__le16 command) |
30 | { | 29 | { |
31 | int count = sizeof(commands_allowed_in_ps) | ||
32 | / sizeof(commands_allowed_in_ps[0]); | ||
33 | int i; | 30 | int i; |
34 | 31 | ||
35 | for (i = 0; i < count; i++) { | 32 | for (i = 0; i < ARRAY_SIZE(commands_allowed_in_ps); i++) { |
36 | if (command == cpu_to_le16(commands_allowed_in_ps[i])) | 33 | if (command == cpu_to_le16(commands_allowed_in_ps[i])) |
37 | return 1; | 34 | return 1; |
38 | } | 35 | } |
@@ -44,14 +41,13 @@ static int wlan_cmd_hw_spec(wlan_private * priv, struct cmd_ds_command *cmd) | |||
44 | { | 41 | { |
45 | struct cmd_ds_get_hw_spec *hwspec = &cmd->params.hwspec; | 42 | struct cmd_ds_get_hw_spec *hwspec = &cmd->params.hwspec; |
46 | 43 | ||
47 | ENTER(); | 44 | lbs_deb_enter(LBS_DEB_CMD); |
48 | 45 | ||
49 | cmd->command = cpu_to_le16(cmd_get_hw_spec); | 46 | cmd->command = cpu_to_le16(cmd_get_hw_spec); |
50 | cmd->size = | 47 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_get_hw_spec) + S_DS_GEN); |
51 | cpu_to_le16(sizeof(struct cmd_ds_get_hw_spec) + S_DS_GEN); | ||
52 | memcpy(hwspec->permanentaddr, priv->adapter->current_addr, ETH_ALEN); | 48 | memcpy(hwspec->permanentaddr, priv->adapter->current_addr, ETH_ALEN); |
53 | 49 | ||
54 | LEAVE(); | 50 | lbs_deb_leave(LBS_DEB_CMD); |
55 | return 0; | 51 | return 0; |
56 | } | 52 | } |
57 | 53 | ||
@@ -60,21 +56,19 @@ static int wlan_cmd_802_11_ps_mode(wlan_private * priv, | |||
60 | u16 cmd_action) | 56 | u16 cmd_action) |
61 | { | 57 | { |
62 | struct cmd_ds_802_11_ps_mode *psm = &cmd->params.psmode; | 58 | struct cmd_ds_802_11_ps_mode *psm = &cmd->params.psmode; |
63 | u16 action = cmd_action; | ||
64 | wlan_adapter *adapter = priv->adapter; | 59 | wlan_adapter *adapter = priv->adapter; |
65 | 60 | ||
66 | ENTER(); | 61 | lbs_deb_enter(LBS_DEB_CMD); |
67 | 62 | ||
68 | cmd->command = cpu_to_le16(cmd_802_11_ps_mode); | 63 | cmd->command = cpu_to_le16(cmd_802_11_ps_mode); |
69 | cmd->size = | 64 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ps_mode) + |
70 | cpu_to_le16(sizeof(struct cmd_ds_802_11_ps_mode) + | 65 | S_DS_GEN); |
71 | S_DS_GEN); | ||
72 | psm->action = cpu_to_le16(cmd_action); | 66 | psm->action = cpu_to_le16(cmd_action); |
73 | psm->multipledtim = 0; | 67 | psm->multipledtim = 0; |
74 | switch (action) { | 68 | switch (cmd_action) { |
75 | case cmd_subcmd_enter_ps: | 69 | case cmd_subcmd_enter_ps: |
76 | lbs_pr_debug(1, "PS command:" "SubCode- Enter PS\n"); | 70 | lbs_deb_cmd("PS command:" "SubCode- Enter PS\n"); |
77 | lbs_pr_debug(1, "locallisteninterval = %d\n", | 71 | lbs_deb_cmd("locallisteninterval = %d\n", |
78 | adapter->locallisteninterval); | 72 | adapter->locallisteninterval); |
79 | 73 | ||
80 | psm->locallisteninterval = | 74 | psm->locallisteninterval = |
@@ -86,18 +80,18 @@ static int wlan_cmd_802_11_ps_mode(wlan_private * priv, | |||
86 | break; | 80 | break; |
87 | 81 | ||
88 | case cmd_subcmd_exit_ps: | 82 | case cmd_subcmd_exit_ps: |
89 | lbs_pr_debug(1, "PS command:" "SubCode- Exit PS\n"); | 83 | lbs_deb_cmd("PS command:" "SubCode- Exit PS\n"); |
90 | break; | 84 | break; |
91 | 85 | ||
92 | case cmd_subcmd_sleep_confirmed: | 86 | case cmd_subcmd_sleep_confirmed: |
93 | lbs_pr_debug(1, "PS command: SubCode- sleep confirm\n"); | 87 | lbs_deb_cmd("PS command: SubCode- sleep confirm\n"); |
94 | break; | 88 | break; |
95 | 89 | ||
96 | default: | 90 | default: |
97 | break; | 91 | break; |
98 | } | 92 | } |
99 | 93 | ||
100 | LEAVE(); | 94 | lbs_deb_leave(LBS_DEB_CMD); |
101 | return 0; | 95 | return 0; |
102 | } | 96 | } |
103 | 97 | ||
@@ -115,8 +109,7 @@ static int wlan_cmd_802_11_inactivity_timeout(wlan_private * priv, | |||
115 | cmd->params.inactivity_timeout.action = cpu_to_le16(cmd_action); | 109 | cmd->params.inactivity_timeout.action = cpu_to_le16(cmd_action); |
116 | 110 | ||
117 | if (cmd_action) | 111 | if (cmd_action) |
118 | cmd->params.inactivity_timeout.timeout = | 112 | cmd->params.inactivity_timeout.timeout = cpu_to_le16(*timeout); |
119 | cpu_to_le16(*timeout); | ||
120 | else | 113 | else |
121 | cmd->params.inactivity_timeout.timeout = 0; | 114 | cmd->params.inactivity_timeout.timeout = 0; |
122 | 115 | ||
@@ -130,11 +123,10 @@ static int wlan_cmd_802_11_sleep_params(wlan_private * priv, | |||
130 | wlan_adapter *adapter = priv->adapter; | 123 | wlan_adapter *adapter = priv->adapter; |
131 | struct cmd_ds_802_11_sleep_params *sp = &cmd->params.sleep_params; | 124 | struct cmd_ds_802_11_sleep_params *sp = &cmd->params.sleep_params; |
132 | 125 | ||
133 | ENTER(); | 126 | lbs_deb_enter(LBS_DEB_CMD); |
134 | 127 | ||
135 | cmd->size = | 128 | cmd->size = cpu_to_le16((sizeof(struct cmd_ds_802_11_sleep_params)) + |
136 | cpu_to_le16((sizeof(struct cmd_ds_802_11_sleep_params)) + | 129 | S_DS_GEN); |
137 | S_DS_GEN); | ||
138 | cmd->command = cpu_to_le16(cmd_802_11_sleep_params); | 130 | cmd->command = cpu_to_le16(cmd_802_11_sleep_params); |
139 | 131 | ||
140 | if (cmd_action == cmd_act_get) { | 132 | if (cmd_action == cmd_act_get) { |
@@ -151,7 +143,7 @@ static int wlan_cmd_802_11_sleep_params(wlan_private * priv, | |||
151 | sp->reserved = cpu_to_le16(adapter->sp.sp_reserved); | 143 | sp->reserved = cpu_to_le16(adapter->sp.sp_reserved); |
152 | } | 144 | } |
153 | 145 | ||
154 | LEAVE(); | 146 | lbs_deb_leave(LBS_DEB_CMD); |
155 | return 0; | 147 | return 0; |
156 | } | 148 | } |
157 | 149 | ||
@@ -165,17 +157,16 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv, | |||
165 | int ret = 0; | 157 | int ret = 0; |
166 | struct assoc_request * assoc_req = pdata_buf; | 158 | struct assoc_request * assoc_req = pdata_buf; |
167 | 159 | ||
168 | ENTER(); | 160 | lbs_deb_enter(LBS_DEB_CMD); |
169 | 161 | ||
170 | cmd->command = cpu_to_le16(cmd_802_11_set_wep); | 162 | cmd->command = cpu_to_le16(cmd_802_11_set_wep); |
171 | cmd->size = cpu_to_le16((sizeof(struct cmd_ds_802_11_set_wep)) | 163 | cmd->size = cpu_to_le16(sizeof(*wep) + S_DS_GEN); |
172 | + S_DS_GEN); | ||
173 | 164 | ||
174 | if (cmd_act == cmd_act_add) { | 165 | if (cmd_act == cmd_act_add) { |
175 | int i; | 166 | int i; |
176 | 167 | ||
177 | if (!assoc_req) { | 168 | if (!assoc_req) { |
178 | lbs_pr_debug(1, "Invalid association request!"); | 169 | lbs_deb_cmd("Invalid association request!"); |
179 | ret = -1; | 170 | ret = -1; |
180 | goto done; | 171 | goto done; |
181 | } | 172 | } |
@@ -183,11 +174,10 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv, | |||
183 | wep->action = cpu_to_le16(cmd_act_add); | 174 | wep->action = cpu_to_le16(cmd_act_add); |
184 | 175 | ||
185 | /* default tx key index */ | 176 | /* default tx key index */ |
186 | wep->keyindex = cpu_to_le16((u16) | 177 | wep->keyindex = cpu_to_le16((u16)(assoc_req->wep_tx_keyidx & |
187 | (assoc_req->wep_tx_keyidx & | 178 | (u32)cmd_WEP_KEY_INDEX_MASK)); |
188 | (u32)cmd_WEP_KEY_INDEX_MASK)); | ||
189 | 179 | ||
190 | lbs_pr_debug(1, "Tx key Index: %u\n", wep->keyindex); | 180 | lbs_deb_cmd("Tx key Index: %u\n", le16_to_cpu(wep->keyindex)); |
191 | 181 | ||
192 | /* Copy key types and material to host command structure */ | 182 | /* Copy key types and material to host command structure */ |
193 | for (i = 0; i < 4; i++) { | 183 | for (i = 0; i < 4; i++) { |
@@ -195,19 +185,21 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv, | |||
195 | 185 | ||
196 | switch (pkey->len) { | 186 | switch (pkey->len) { |
197 | case KEY_LEN_WEP_40: | 187 | case KEY_LEN_WEP_40: |
198 | wep->keytype[i] = cmd_type_wep_40_bit; | 188 | wep->keytype[i] = |
189 | cpu_to_le16(cmd_type_wep_40_bit); | ||
199 | memmove(&wep->keymaterial[i], pkey->key, | 190 | memmove(&wep->keymaterial[i], pkey->key, |
200 | pkey->len); | 191 | pkey->len); |
201 | break; | 192 | break; |
202 | case KEY_LEN_WEP_104: | 193 | case KEY_LEN_WEP_104: |
203 | wep->keytype[i] = cmd_type_wep_104_bit; | 194 | wep->keytype[i] = |
195 | cpu_to_le16(cmd_type_wep_104_bit); | ||
204 | memmove(&wep->keymaterial[i], pkey->key, | 196 | memmove(&wep->keymaterial[i], pkey->key, |
205 | pkey->len); | 197 | pkey->len); |
206 | break; | 198 | break; |
207 | case 0: | 199 | case 0: |
208 | break; | 200 | break; |
209 | default: | 201 | default: |
210 | lbs_pr_debug(1, "Invalid WEP key %d length of %d\n", | 202 | lbs_deb_cmd("Invalid WEP key %d length of %d\n", |
211 | i, pkey->len); | 203 | i, pkey->len); |
212 | ret = -1; | 204 | ret = -1; |
213 | goto done; | 205 | goto done; |
@@ -219,36 +211,37 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv, | |||
219 | wep->action = cpu_to_le16(cmd_act_remove); | 211 | wep->action = cpu_to_le16(cmd_act_remove); |
220 | 212 | ||
221 | /* default tx key index */ | 213 | /* default tx key index */ |
222 | wep->keyindex = cpu_to_le16((u16) | 214 | wep->keyindex = cpu_to_le16((u16)(adapter->wep_tx_keyidx & |
223 | (adapter->wep_tx_keyidx & | 215 | (u32)cmd_WEP_KEY_INDEX_MASK)); |
224 | (u32)cmd_WEP_KEY_INDEX_MASK)); | ||
225 | } | 216 | } |
226 | 217 | ||
227 | ret = 0; | 218 | ret = 0; |
228 | 219 | ||
229 | done: | 220 | done: |
230 | LEAVE(); | 221 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); |
231 | return ret; | 222 | return ret; |
232 | } | 223 | } |
233 | 224 | ||
234 | static int wlan_cmd_802_11_enable_rsn(wlan_private * priv, | 225 | static int wlan_cmd_802_11_enable_rsn(wlan_private * priv, |
235 | struct cmd_ds_command *cmd, | 226 | struct cmd_ds_command *cmd, |
236 | u16 cmd_action) | 227 | u16 cmd_action, |
228 | void * pdata_buf) | ||
237 | { | 229 | { |
238 | struct cmd_ds_802_11_enable_rsn *penableRSN = &cmd->params.enbrsn; | 230 | struct cmd_ds_802_11_enable_rsn *penableRSN = &cmd->params.enbrsn; |
239 | wlan_adapter *adapter = priv->adapter; | 231 | struct assoc_request * assoc_req = pdata_buf; |
232 | |||
233 | lbs_deb_enter(LBS_DEB_CMD); | ||
240 | 234 | ||
241 | cmd->command = cpu_to_le16(cmd_802_11_enable_rsn); | 235 | cmd->command = cpu_to_le16(cmd_802_11_enable_rsn); |
242 | cmd->size = | 236 | cmd->size = cpu_to_le16(sizeof(*penableRSN) + S_DS_GEN); |
243 | cpu_to_le16(sizeof(struct cmd_ds_802_11_enable_rsn) + | ||
244 | S_DS_GEN); | ||
245 | penableRSN->action = cpu_to_le16(cmd_action); | 237 | penableRSN->action = cpu_to_le16(cmd_action); |
246 | if (adapter->secinfo.WPAenabled || adapter->secinfo.WPA2enabled) { | 238 | if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { |
247 | penableRSN->enable = cpu_to_le16(cmd_enable_rsn); | 239 | penableRSN->enable = cpu_to_le16(cmd_enable_rsn); |
248 | } else { | 240 | } else { |
249 | penableRSN->enable = cpu_to_le16(cmd_disable_rsn); | 241 | penableRSN->enable = cpu_to_le16(cmd_disable_rsn); |
250 | } | 242 | } |
251 | 243 | ||
244 | lbs_deb_leave(LBS_DEB_CMD); | ||
252 | return 0; | 245 | return 0; |
253 | } | 246 | } |
254 | 247 | ||
@@ -259,14 +252,12 @@ static void set_one_wpa_key(struct MrvlIEtype_keyParamSet * pkeyparamset, | |||
259 | pkeyparamset->keytypeid = cpu_to_le16(pkey->type); | 252 | pkeyparamset->keytypeid = cpu_to_le16(pkey->type); |
260 | 253 | ||
261 | if (pkey->flags & KEY_INFO_WPA_ENABLED) { | 254 | if (pkey->flags & KEY_INFO_WPA_ENABLED) { |
262 | pkeyparamset->keyinfo = cpu_to_le16(KEY_INFO_WPA_ENABLED); | 255 | pkeyparamset->keyinfo |= cpu_to_le16(KEY_INFO_WPA_ENABLED); |
263 | } else { | ||
264 | pkeyparamset->keyinfo = cpu_to_le16(!KEY_INFO_WPA_ENABLED); | ||
265 | } | 256 | } |
266 | |||
267 | if (pkey->flags & KEY_INFO_WPA_UNICAST) { | 257 | if (pkey->flags & KEY_INFO_WPA_UNICAST) { |
268 | pkeyparamset->keyinfo |= cpu_to_le16(KEY_INFO_WPA_UNICAST); | 258 | pkeyparamset->keyinfo |= cpu_to_le16(KEY_INFO_WPA_UNICAST); |
269 | } else if (pkey->flags & KEY_INFO_WPA_MCAST) { | 259 | } |
260 | if (pkey->flags & KEY_INFO_WPA_MCAST) { | ||
270 | pkeyparamset->keyinfo |= cpu_to_le16(KEY_INFO_WPA_MCAST); | 261 | pkeyparamset->keyinfo |= cpu_to_le16(KEY_INFO_WPA_MCAST); |
271 | } | 262 | } |
272 | 263 | ||
@@ -284,46 +275,45 @@ static int wlan_cmd_802_11_key_material(wlan_private * priv, | |||
284 | u16 cmd_action, | 275 | u16 cmd_action, |
285 | u32 cmd_oid, void *pdata_buf) | 276 | u32 cmd_oid, void *pdata_buf) |
286 | { | 277 | { |
287 | wlan_adapter *adapter = priv->adapter; | ||
288 | struct cmd_ds_802_11_key_material *pkeymaterial = | 278 | struct cmd_ds_802_11_key_material *pkeymaterial = |
289 | &cmd->params.keymaterial; | 279 | &cmd->params.keymaterial; |
280 | struct assoc_request * assoc_req = pdata_buf; | ||
290 | int ret = 0; | 281 | int ret = 0; |
291 | int index = 0; | 282 | int index = 0; |
292 | 283 | ||
293 | ENTER(); | 284 | lbs_deb_enter(LBS_DEB_CMD); |
294 | 285 | ||
295 | cmd->command = cpu_to_le16(cmd_802_11_key_material); | 286 | cmd->command = cpu_to_le16(cmd_802_11_key_material); |
296 | pkeymaterial->action = cpu_to_le16(cmd_action); | 287 | pkeymaterial->action = cpu_to_le16(cmd_action); |
297 | 288 | ||
298 | if (cmd_action == cmd_act_get) { | 289 | if (cmd_action == cmd_act_get) { |
299 | cmd->size = cpu_to_le16( S_DS_GEN | 290 | cmd->size = cpu_to_le16(S_DS_GEN + sizeof (pkeymaterial->action)); |
300 | + sizeof (pkeymaterial->action)); | ||
301 | ret = 0; | 291 | ret = 0; |
302 | goto done; | 292 | goto done; |
303 | } | 293 | } |
304 | 294 | ||
305 | memset(&pkeymaterial->keyParamSet, 0, sizeof(pkeymaterial->keyParamSet)); | 295 | memset(&pkeymaterial->keyParamSet, 0, sizeof(pkeymaterial->keyParamSet)); |
306 | 296 | ||
307 | if (adapter->wpa_unicast_key.len) { | 297 | if (test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) { |
308 | set_one_wpa_key(&pkeymaterial->keyParamSet[index], | 298 | set_one_wpa_key(&pkeymaterial->keyParamSet[index], |
309 | &adapter->wpa_unicast_key); | 299 | &assoc_req->wpa_unicast_key); |
310 | index++; | 300 | index++; |
311 | } | 301 | } |
312 | 302 | ||
313 | if (adapter->wpa_mcast_key.len) { | 303 | if (test_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags)) { |
314 | set_one_wpa_key(&pkeymaterial->keyParamSet[index], | 304 | set_one_wpa_key(&pkeymaterial->keyParamSet[index], |
315 | &adapter->wpa_mcast_key); | 305 | &assoc_req->wpa_mcast_key); |
316 | index++; | 306 | index++; |
317 | } | 307 | } |
318 | 308 | ||
319 | cmd->size = cpu_to_le16( S_DS_GEN | 309 | cmd->size = cpu_to_le16( S_DS_GEN |
320 | + sizeof (pkeymaterial->action) | 310 | + sizeof (pkeymaterial->action) |
321 | + index * sizeof(struct MrvlIEtype_keyParamSet)); | 311 | + (index * sizeof(struct MrvlIEtype_keyParamSet))); |
322 | 312 | ||
323 | ret = 0; | 313 | ret = 0; |
324 | 314 | ||
325 | done: | 315 | done: |
326 | LEAVE(); | 316 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); |
327 | return ret; | 317 | return ret; |
328 | } | 318 | } |
329 | 319 | ||
@@ -354,8 +344,7 @@ static int wlan_cmd_802_11_get_stat(wlan_private * priv, | |||
354 | { | 344 | { |
355 | cmd->command = cpu_to_le16(cmd_802_11_get_stat); | 345 | cmd->command = cpu_to_le16(cmd_802_11_get_stat); |
356 | cmd->size = | 346 | cmd->size = |
357 | cpu_to_le16(sizeof(struct cmd_ds_802_11_get_stat) + | 347 | cpu_to_le16(sizeof(struct cmd_ds_802_11_get_stat) + S_DS_GEN); |
358 | S_DS_GEN); | ||
359 | 348 | ||
360 | return 0; | 349 | return 0; |
361 | } | 350 | } |
@@ -369,14 +358,12 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv, | |||
369 | wlan_adapter *adapter = priv->adapter; | 358 | wlan_adapter *adapter = priv->adapter; |
370 | u8 ucTemp; | 359 | u8 ucTemp; |
371 | 360 | ||
372 | ENTER(); | 361 | lbs_deb_enter(LBS_DEB_CMD); |
373 | 362 | ||
374 | lbs_pr_debug(1, "SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid); | 363 | lbs_deb_cmd("SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid); |
375 | 364 | ||
376 | cmd->command = cpu_to_le16(cmd_802_11_snmp_mib); | 365 | cmd->command = cpu_to_le16(cmd_802_11_snmp_mib); |
377 | cmd->size = | 366 | cmd->size = cpu_to_le16(sizeof(*pSNMPMIB) + S_DS_GEN); |
378 | cpu_to_le16(sizeof(struct cmd_ds_802_11_snmp_mib) + | ||
379 | S_DS_GEN); | ||
380 | 367 | ||
381 | switch (cmd_oid) { | 368 | switch (cmd_oid) { |
382 | case OID_802_11_INFRASTRUCTURE_MODE: | 369 | case OID_802_11_INFRASTRUCTURE_MODE: |
@@ -407,7 +394,7 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv, | |||
407 | pSNMPMIB->querytype = cmd_act_set; | 394 | pSNMPMIB->querytype = cmd_act_set; |
408 | pSNMPMIB->bufsize = sizeof(u16); | 395 | pSNMPMIB->bufsize = sizeof(u16); |
409 | ulTemp = *(u32 *)pdata_buf; | 396 | ulTemp = *(u32 *)pdata_buf; |
410 | *((unsigned short *)(pSNMPMIB->value)) = | 397 | *((__le16 *)(pSNMPMIB->value)) = |
411 | cpu_to_le16((u16) ulTemp); | 398 | cpu_to_le16((u16) ulTemp); |
412 | } | 399 | } |
413 | break; | 400 | break; |
@@ -420,15 +407,12 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv, | |||
420 | pSNMPMIB->oid = cpu_to_le16((u16) fragthresh_i); | 407 | pSNMPMIB->oid = cpu_to_le16((u16) fragthresh_i); |
421 | 408 | ||
422 | if (cmd_action == cmd_act_get) { | 409 | if (cmd_action == cmd_act_get) { |
423 | pSNMPMIB->querytype = | 410 | pSNMPMIB->querytype = cpu_to_le16(cmd_act_get); |
424 | cpu_to_le16(cmd_act_get); | ||
425 | } else if (cmd_action == cmd_act_set) { | 411 | } else if (cmd_action == cmd_act_set) { |
426 | pSNMPMIB->querytype = | 412 | pSNMPMIB->querytype = cpu_to_le16(cmd_act_set); |
427 | cpu_to_le16(cmd_act_set); | 413 | pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16)); |
428 | pSNMPMIB->bufsize = | ||
429 | cpu_to_le16(sizeof(u16)); | ||
430 | ulTemp = *((u32 *) pdata_buf); | 414 | ulTemp = *((u32 *) pdata_buf); |
431 | *((unsigned short *)(pSNMPMIB->value)) = | 415 | *((__le16 *)(pSNMPMIB->value)) = |
432 | cpu_to_le16((u16) ulTemp); | 416 | cpu_to_le16((u16) ulTemp); |
433 | 417 | ||
434 | } | 418 | } |
@@ -443,16 +427,12 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv, | |||
443 | pSNMPMIB->oid = le16_to_cpu((u16) rtsthresh_i); | 427 | pSNMPMIB->oid = le16_to_cpu((u16) rtsthresh_i); |
444 | 428 | ||
445 | if (cmd_action == cmd_act_get) { | 429 | if (cmd_action == cmd_act_get) { |
446 | pSNMPMIB->querytype = | 430 | pSNMPMIB->querytype = cpu_to_le16(cmd_act_get); |
447 | cpu_to_le16(cmd_act_get); | ||
448 | } else if (cmd_action == cmd_act_set) { | 431 | } else if (cmd_action == cmd_act_set) { |
449 | pSNMPMIB->querytype = | 432 | pSNMPMIB->querytype = cpu_to_le16(cmd_act_set); |
450 | cpu_to_le16(cmd_act_set); | 433 | pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16)); |
451 | pSNMPMIB->bufsize = | 434 | ulTemp = *((u32 *)pdata_buf); |
452 | cpu_to_le16(sizeof(u16)); | 435 | *(__le16 *)(pSNMPMIB->value) = |
453 | ulTemp = *((u32 *) | ||
454 | pdata_buf); | ||
455 | *(unsigned short *)(pSNMPMIB->value) = | ||
456 | cpu_to_le16((u16) ulTemp); | 436 | cpu_to_le16((u16) ulTemp); |
457 | 437 | ||
458 | } | 438 | } |
@@ -462,13 +442,11 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv, | |||
462 | pSNMPMIB->oid = cpu_to_le16((u16) short_retrylim_i); | 442 | pSNMPMIB->oid = cpu_to_le16((u16) short_retrylim_i); |
463 | 443 | ||
464 | if (cmd_action == cmd_act_get) { | 444 | if (cmd_action == cmd_act_get) { |
465 | pSNMPMIB->querytype = | 445 | pSNMPMIB->querytype = cpu_to_le16(cmd_act_get); |
466 | cpu_to_le16(cmd_act_get); | ||
467 | } else if (cmd_action == cmd_act_set) { | 446 | } else if (cmd_action == cmd_act_set) { |
468 | pSNMPMIB->querytype = | 447 | pSNMPMIB->querytype = cpu_to_le16(cmd_act_set); |
469 | cpu_to_le16(cmd_act_set); | ||
470 | pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16)); | 448 | pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16)); |
471 | *((unsigned short *)(pSNMPMIB->value)) = | 449 | *((__le16 *)(pSNMPMIB->value)) = |
472 | cpu_to_le16((u16) adapter->txretrycount); | 450 | cpu_to_le16((u16) adapter->txretrycount); |
473 | } | 451 | } |
474 | 452 | ||
@@ -477,16 +455,18 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv, | |||
477 | break; | 455 | break; |
478 | } | 456 | } |
479 | 457 | ||
480 | lbs_pr_debug(1, | 458 | lbs_deb_cmd( |
481 | "SNMP_CMD: command=0x%x, size=0x%x, seqnum=0x%x, result=0x%x\n", | 459 | "SNMP_CMD: command=0x%x, size=0x%x, seqnum=0x%x, result=0x%x\n", |
482 | cmd->command, cmd->size, cmd->seqnum, cmd->result); | 460 | le16_to_cpu(cmd->command), le16_to_cpu(cmd->size), |
461 | le16_to_cpu(cmd->seqnum), le16_to_cpu(cmd->result)); | ||
483 | 462 | ||
484 | lbs_pr_debug(1, | 463 | lbs_deb_cmd( |
485 | "SNMP_CMD: action=0x%x, oid=0x%x, oidsize=0x%x, value=0x%x\n", | 464 | "SNMP_CMD: action=0x%x, oid=0x%x, oidsize=0x%x, value=0x%x\n", |
486 | pSNMPMIB->querytype, pSNMPMIB->oid, pSNMPMIB->bufsize, | 465 | le16_to_cpu(pSNMPMIB->querytype), le16_to_cpu(pSNMPMIB->oid), |
487 | *(u16 *) pSNMPMIB->value); | 466 | le16_to_cpu(pSNMPMIB->bufsize), |
467 | le16_to_cpu(*(__le16 *) pSNMPMIB->value)); | ||
488 | 468 | ||
489 | LEAVE(); | 469 | lbs_deb_leave(LBS_DEB_CMD); |
490 | return 0; | 470 | return 0; |
491 | } | 471 | } |
492 | 472 | ||
@@ -495,10 +475,9 @@ static int wlan_cmd_802_11_radio_control(wlan_private * priv, | |||
495 | int cmd_action) | 475 | int cmd_action) |
496 | { | 476 | { |
497 | wlan_adapter *adapter = priv->adapter; | 477 | wlan_adapter *adapter = priv->adapter; |
498 | struct cmd_ds_802_11_radio_control *pradiocontrol = | 478 | struct cmd_ds_802_11_radio_control *pradiocontrol = &cmd->params.radio; |
499 | &cmd->params.radio; | ||
500 | 479 | ||
501 | ENTER(); | 480 | lbs_deb_enter(LBS_DEB_CMD); |
502 | 481 | ||
503 | cmd->size = | 482 | cmd->size = |
504 | cpu_to_le16((sizeof(struct cmd_ds_802_11_radio_control)) + | 483 | cpu_to_le16((sizeof(struct cmd_ds_802_11_radio_control)) + |
@@ -527,7 +506,7 @@ static int wlan_cmd_802_11_radio_control(wlan_private * priv, | |||
527 | else | 506 | else |
528 | pradiocontrol->control &= cpu_to_le16(~TURN_ON_RF); | 507 | pradiocontrol->control &= cpu_to_le16(~TURN_ON_RF); |
529 | 508 | ||
530 | LEAVE(); | 509 | lbs_deb_leave(LBS_DEB_CMD); |
531 | return 0; | 510 | return 0; |
532 | } | 511 | } |
533 | 512 | ||
@@ -538,16 +517,16 @@ static int wlan_cmd_802_11_rf_tx_power(wlan_private * priv, | |||
538 | 517 | ||
539 | struct cmd_ds_802_11_rf_tx_power *prtp = &cmd->params.txp; | 518 | struct cmd_ds_802_11_rf_tx_power *prtp = &cmd->params.txp; |
540 | 519 | ||
541 | ENTER(); | 520 | lbs_deb_enter(LBS_DEB_CMD); |
542 | 521 | ||
543 | cmd->size = | 522 | cmd->size = |
544 | cpu_to_le16((sizeof(struct cmd_ds_802_11_rf_tx_power)) + | 523 | cpu_to_le16((sizeof(struct cmd_ds_802_11_rf_tx_power)) + S_DS_GEN); |
545 | S_DS_GEN); | ||
546 | cmd->command = cpu_to_le16(cmd_802_11_rf_tx_power); | 524 | cmd->command = cpu_to_le16(cmd_802_11_rf_tx_power); |
547 | prtp->action = cmd_action; | 525 | prtp->action = cpu_to_le16(cmd_action); |
548 | 526 | ||
549 | lbs_pr_debug(1, "RF_TX_POWER_CMD: size:%d cmd:0x%x Act:%d\n", cmd->size, | 527 | lbs_deb_cmd("RF_TX_POWER_CMD: size:%d cmd:0x%x Act:%d\n", |
550 | cmd->command, prtp->action); | 528 | le16_to_cpu(cmd->size), le16_to_cpu(cmd->command), |
529 | le16_to_cpu(prtp->action)); | ||
551 | 530 | ||
552 | switch (cmd_action) { | 531 | switch (cmd_action) { |
553 | case cmd_act_tx_power_opt_get: | 532 | case cmd_act_tx_power_opt_get: |
@@ -557,14 +536,12 @@ static int wlan_cmd_802_11_rf_tx_power(wlan_private * priv, | |||
557 | 536 | ||
558 | case cmd_act_tx_power_opt_set_high: | 537 | case cmd_act_tx_power_opt_set_high: |
559 | prtp->action = cpu_to_le16(cmd_act_set); | 538 | prtp->action = cpu_to_le16(cmd_act_set); |
560 | prtp->currentlevel = | 539 | prtp->currentlevel = cpu_to_le16(cmd_act_tx_power_index_high); |
561 | cpu_to_le16(cmd_act_tx_power_index_high); | ||
562 | break; | 540 | break; |
563 | 541 | ||
564 | case cmd_act_tx_power_opt_set_mid: | 542 | case cmd_act_tx_power_opt_set_mid: |
565 | prtp->action = cpu_to_le16(cmd_act_set); | 543 | prtp->action = cpu_to_le16(cmd_act_set); |
566 | prtp->currentlevel = | 544 | prtp->currentlevel = cpu_to_le16(cmd_act_tx_power_index_mid); |
567 | cpu_to_le16(cmd_act_tx_power_index_mid); | ||
568 | break; | 545 | break; |
569 | 546 | ||
570 | case cmd_act_tx_power_opt_set_low: | 547 | case cmd_act_tx_power_opt_set_low: |
@@ -572,7 +549,8 @@ static int wlan_cmd_802_11_rf_tx_power(wlan_private * priv, | |||
572 | prtp->currentlevel = cpu_to_le16(*((u16 *) pdata_buf)); | 549 | prtp->currentlevel = cpu_to_le16(*((u16 *) pdata_buf)); |
573 | break; | 550 | break; |
574 | } | 551 | } |
575 | LEAVE(); | 552 | |
553 | lbs_deb_leave(LBS_DEB_CMD); | ||
576 | return 0; | 554 | return 0; |
577 | } | 555 | } |
578 | 556 | ||
@@ -583,15 +561,12 @@ static int wlan_cmd_802_11_rf_antenna(wlan_private * priv, | |||
583 | struct cmd_ds_802_11_rf_antenna *rant = &cmd->params.rant; | 561 | struct cmd_ds_802_11_rf_antenna *rant = &cmd->params.rant; |
584 | 562 | ||
585 | cmd->command = cpu_to_le16(cmd_802_11_rf_antenna); | 563 | cmd->command = cpu_to_le16(cmd_802_11_rf_antenna); |
586 | cmd->size = | 564 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_antenna) + |
587 | cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_antenna) + | 565 | S_DS_GEN); |
588 | S_DS_GEN); | ||
589 | 566 | ||
590 | rant->action = cpu_to_le16(cmd_action); | 567 | rant->action = cpu_to_le16(cmd_action); |
591 | if ((cmd_action == cmd_act_set_rx) || | 568 | if ((cmd_action == cmd_act_set_rx) || (cmd_action == cmd_act_set_tx)) { |
592 | (cmd_action == cmd_act_set_tx)) { | 569 | rant->antennamode = cpu_to_le16((u16) (*(u32 *) pdata_buf)); |
593 | rant->antennamode = | ||
594 | cpu_to_le16((u16) (*(u32 *) pdata_buf)); | ||
595 | } | 570 | } |
596 | 571 | ||
597 | return 0; | 572 | return 0; |
@@ -610,13 +585,13 @@ static int wlan_cmd_802_11_rate_adapt_rateset(wlan_private * priv, | |||
610 | + S_DS_GEN); | 585 | + S_DS_GEN); |
611 | cmd->command = cpu_to_le16(cmd_802_11_rate_adapt_rateset); | 586 | cmd->command = cpu_to_le16(cmd_802_11_rate_adapt_rateset); |
612 | 587 | ||
613 | ENTER(); | 588 | lbs_deb_enter(LBS_DEB_CMD); |
614 | 589 | ||
615 | rateadapt->action = cmd_action; | 590 | rateadapt->action = cpu_to_le16(cmd_action); |
616 | rateadapt->enablehwauto = adapter->enablehwauto; | 591 | rateadapt->enablehwauto = cpu_to_le16(adapter->enablehwauto); |
617 | rateadapt->bitmap = adapter->ratebitmap; | 592 | rateadapt->bitmap = cpu_to_le16(adapter->ratebitmap); |
618 | 593 | ||
619 | LEAVE(); | 594 | lbs_deb_leave(LBS_DEB_CMD); |
620 | return 0; | 595 | return 0; |
621 | } | 596 | } |
622 | 597 | ||
@@ -626,12 +601,10 @@ static int wlan_cmd_802_11_data_rate(wlan_private * priv, | |||
626 | { | 601 | { |
627 | struct cmd_ds_802_11_data_rate *pdatarate = &cmd->params.drate; | 602 | struct cmd_ds_802_11_data_rate *pdatarate = &cmd->params.drate; |
628 | wlan_adapter *adapter = priv->adapter; | 603 | wlan_adapter *adapter = priv->adapter; |
629 | u16 action = cmd_action; | ||
630 | 604 | ||
631 | ENTER(); | 605 | lbs_deb_enter(LBS_DEB_CMD); |
632 | 606 | ||
633 | cmd->size = | 607 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_data_rate) + |
634 | cpu_to_le16(sizeof(struct cmd_ds_802_11_data_rate) + | ||
635 | S_DS_GEN); | 608 | S_DS_GEN); |
636 | 609 | ||
637 | cmd->command = cpu_to_le16(cmd_802_11_data_rate); | 610 | cmd->command = cpu_to_le16(cmd_802_11_data_rate); |
@@ -640,15 +613,15 @@ static int wlan_cmd_802_11_data_rate(wlan_private * priv, | |||
640 | 613 | ||
641 | pdatarate->action = cpu_to_le16(cmd_action); | 614 | pdatarate->action = cpu_to_le16(cmd_action); |
642 | 615 | ||
643 | if (action == cmd_act_set_tx_fix_rate) { | 616 | if (cmd_action == cmd_act_set_tx_fix_rate) { |
644 | pdatarate->datarate[0] = libertas_data_rate_to_index(adapter->datarate); | 617 | pdatarate->datarate[0] = libertas_data_rate_to_index(adapter->datarate); |
645 | lbs_pr_debug(1, "Setting FW for fixed rate 0x%02X\n", | 618 | lbs_deb_cmd("Setting FW for fixed rate 0x%02X\n", |
646 | adapter->datarate); | 619 | adapter->datarate); |
647 | } else if (action == cmd_act_set_tx_auto) { | 620 | } else if (cmd_action == cmd_act_set_tx_auto) { |
648 | lbs_pr_debug(1, "Setting FW for AUTO rate\n"); | 621 | lbs_deb_cmd("Setting FW for AUTO rate\n"); |
649 | } | 622 | } |
650 | 623 | ||
651 | LEAVE(); | 624 | lbs_deb_leave(LBS_DEB_CMD); |
652 | return 0; | 625 | return 0; |
653 | } | 626 | } |
654 | 627 | ||
@@ -659,8 +632,7 @@ static int wlan_cmd_mac_multicast_adr(wlan_private * priv, | |||
659 | struct cmd_ds_mac_multicast_adr *pMCastAdr = &cmd->params.madr; | 632 | struct cmd_ds_mac_multicast_adr *pMCastAdr = &cmd->params.madr; |
660 | wlan_adapter *adapter = priv->adapter; | 633 | wlan_adapter *adapter = priv->adapter; |
661 | 634 | ||
662 | cmd->size = | 635 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mac_multicast_adr) + |
663 | cpu_to_le16(sizeof(struct cmd_ds_mac_multicast_adr) + | ||
664 | S_DS_GEN); | 636 | S_DS_GEN); |
665 | cmd->command = cpu_to_le16(cmd_mac_multicast_adr); | 637 | cmd->command = cpu_to_le16(cmd_mac_multicast_adr); |
666 | 638 | ||
@@ -680,8 +652,8 @@ static int wlan_cmd_802_11_rf_channel(wlan_private * priv, | |||
680 | struct cmd_ds_802_11_rf_channel *rfchan = &cmd->params.rfchannel; | 652 | struct cmd_ds_802_11_rf_channel *rfchan = &cmd->params.rfchannel; |
681 | 653 | ||
682 | cmd->command = cpu_to_le16(cmd_802_11_rf_channel); | 654 | cmd->command = cpu_to_le16(cmd_802_11_rf_channel); |
683 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_channel) | 655 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_channel) + |
684 | + S_DS_GEN); | 656 | S_DS_GEN); |
685 | 657 | ||
686 | if (option == cmd_opt_802_11_rf_channel_set) { | 658 | if (option == cmd_opt_802_11_rf_channel_set) { |
687 | rfchan->currentchannel = cpu_to_le16(*((u16 *) pdata_buf)); | 659 | rfchan->currentchannel = cpu_to_le16(*((u16 *) pdata_buf)); |
@@ -698,9 +670,8 @@ static int wlan_cmd_802_11_rssi(wlan_private * priv, | |||
698 | wlan_adapter *adapter = priv->adapter; | 670 | wlan_adapter *adapter = priv->adapter; |
699 | 671 | ||
700 | cmd->command = cpu_to_le16(cmd_802_11_rssi); | 672 | cmd->command = cpu_to_le16(cmd_802_11_rssi); |
701 | cmd->size = | 673 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rssi) + S_DS_GEN); |
702 | cpu_to_le16(sizeof(struct cmd_ds_802_11_rssi) + S_DS_GEN); | 674 | cmd->params.rssi.N = cpu_to_le16(priv->adapter->bcn_avg_factor); |
703 | cmd->params.rssi.N = priv->adapter->bcn_avg_factor; | ||
704 | 675 | ||
705 | /* reset Beacon SNR/NF/RSSI values */ | 676 | /* reset Beacon SNR/NF/RSSI values */ |
706 | adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = 0; | 677 | adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = 0; |
@@ -719,7 +690,7 @@ static int wlan_cmd_reg_access(wlan_private * priv, | |||
719 | { | 690 | { |
720 | struct wlan_offset_value *offval; | 691 | struct wlan_offset_value *offval; |
721 | 692 | ||
722 | ENTER(); | 693 | lbs_deb_enter(LBS_DEB_CMD); |
723 | 694 | ||
724 | offval = (struct wlan_offset_value *)pdata_buf; | 695 | offval = (struct wlan_offset_value *)pdata_buf; |
725 | 696 | ||
@@ -729,9 +700,8 @@ static int wlan_cmd_reg_access(wlan_private * priv, | |||
729 | struct cmd_ds_mac_reg_access *macreg; | 700 | struct cmd_ds_mac_reg_access *macreg; |
730 | 701 | ||
731 | cmdptr->size = | 702 | cmdptr->size = |
732 | cpu_to_le16(sizeof | 703 | cpu_to_le16(sizeof (struct cmd_ds_mac_reg_access) |
733 | (struct cmd_ds_mac_reg_access) | 704 | + S_DS_GEN); |
734 | + S_DS_GEN); | ||
735 | macreg = | 705 | macreg = |
736 | (struct cmd_ds_mac_reg_access *)&cmdptr->params. | 706 | (struct cmd_ds_mac_reg_access *)&cmdptr->params. |
737 | macreg; | 707 | macreg; |
@@ -785,7 +755,7 @@ static int wlan_cmd_reg_access(wlan_private * priv, | |||
785 | break; | 755 | break; |
786 | } | 756 | } |
787 | 757 | ||
788 | LEAVE(); | 758 | lbs_deb_leave(LBS_DEB_CMD); |
789 | return 0; | 759 | return 0; |
790 | } | 760 | } |
791 | 761 | ||
@@ -796,8 +766,7 @@ static int wlan_cmd_802_11_mac_address(wlan_private * priv, | |||
796 | wlan_adapter *adapter = priv->adapter; | 766 | wlan_adapter *adapter = priv->adapter; |
797 | 767 | ||
798 | cmd->command = cpu_to_le16(cmd_802_11_mac_address); | 768 | cmd->command = cpu_to_le16(cmd_802_11_mac_address); |
799 | cmd->size = | 769 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_mac_address) + |
800 | cpu_to_le16(sizeof(struct cmd_ds_802_11_mac_address) + | ||
801 | S_DS_GEN); | 770 | S_DS_GEN); |
802 | cmd->result = 0; | 771 | cmd->result = 0; |
803 | 772 | ||
@@ -818,12 +787,11 @@ static int wlan_cmd_802_11_eeprom_access(wlan_private * priv, | |||
818 | { | 787 | { |
819 | struct wlan_ioctl_regrdwr *ea = pdata_buf; | 788 | struct wlan_ioctl_regrdwr *ea = pdata_buf; |
820 | 789 | ||
821 | ENTER(); | 790 | lbs_deb_enter(LBS_DEB_CMD); |
822 | 791 | ||
823 | cmd->command = cpu_to_le16(cmd_802_11_eeprom_access); | 792 | cmd->command = cpu_to_le16(cmd_802_11_eeprom_access); |
824 | cmd->size = | 793 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_eeprom_access) + |
825 | cpu_to_le16(sizeof(struct cmd_ds_802_11_eeprom_access) + | 794 | S_DS_GEN); |
826 | S_DS_GEN); | ||
827 | cmd->result = 0; | 795 | cmd->result = 0; |
828 | 796 | ||
829 | cmd->params.rdeeprom.action = cpu_to_le16(ea->action); | 797 | cmd->params.rdeeprom.action = cpu_to_le16(ea->action); |
@@ -839,11 +807,10 @@ static int wlan_cmd_bt_access(wlan_private * priv, | |||
839 | u16 cmd_action, void *pdata_buf) | 807 | u16 cmd_action, void *pdata_buf) |
840 | { | 808 | { |
841 | struct cmd_ds_bt_access *bt_access = &cmd->params.bt; | 809 | struct cmd_ds_bt_access *bt_access = &cmd->params.bt; |
842 | lbs_pr_debug(1, "BT CMD(%d)\n", cmd_action); | 810 | lbs_deb_cmd("BT CMD(%d)\n", cmd_action); |
843 | 811 | ||
844 | cmd->command = cpu_to_le16(cmd_bt_access); | 812 | cmd->command = cpu_to_le16(cmd_bt_access); |
845 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_bt_access) | 813 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_bt_access) + S_DS_GEN); |
846 | + S_DS_GEN); | ||
847 | cmd->result = 0; | 814 | cmd->result = 0; |
848 | bt_access->action = cpu_to_le16(cmd_action); | 815 | bt_access->action = cpu_to_le16(cmd_action); |
849 | 816 | ||
@@ -861,6 +828,11 @@ static int wlan_cmd_bt_access(wlan_private * priv, | |||
861 | break; | 828 | break; |
862 | case cmd_act_bt_access_reset: | 829 | case cmd_act_bt_access_reset: |
863 | break; | 830 | break; |
831 | case cmd_act_bt_access_set_invert: | ||
832 | bt_access->id = cpu_to_le32(*(u32 *) pdata_buf); | ||
833 | break; | ||
834 | case cmd_act_bt_access_get_invert: | ||
835 | break; | ||
864 | default: | 836 | default: |
865 | break; | 837 | break; |
866 | } | 838 | } |
@@ -872,11 +844,10 @@ static int wlan_cmd_fwt_access(wlan_private * priv, | |||
872 | u16 cmd_action, void *pdata_buf) | 844 | u16 cmd_action, void *pdata_buf) |
873 | { | 845 | { |
874 | struct cmd_ds_fwt_access *fwt_access = &cmd->params.fwt; | 846 | struct cmd_ds_fwt_access *fwt_access = &cmd->params.fwt; |
875 | lbs_pr_debug(1, "FWT CMD(%d)\n", cmd_action); | 847 | lbs_deb_cmd("FWT CMD(%d)\n", cmd_action); |
876 | 848 | ||
877 | cmd->command = cpu_to_le16(cmd_fwt_access); | 849 | cmd->command = cpu_to_le16(cmd_fwt_access); |
878 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_fwt_access) | 850 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_fwt_access) + S_DS_GEN); |
879 | + S_DS_GEN); | ||
880 | cmd->result = 0; | 851 | cmd->result = 0; |
881 | 852 | ||
882 | if (pdata_buf) | 853 | if (pdata_buf) |
@@ -894,11 +865,10 @@ static int wlan_cmd_mesh_access(wlan_private * priv, | |||
894 | u16 cmd_action, void *pdata_buf) | 865 | u16 cmd_action, void *pdata_buf) |
895 | { | 866 | { |
896 | struct cmd_ds_mesh_access *mesh_access = &cmd->params.mesh; | 867 | struct cmd_ds_mesh_access *mesh_access = &cmd->params.mesh; |
897 | lbs_pr_debug(1, "FWT CMD(%d)\n", cmd_action); | 868 | lbs_deb_cmd("FWT CMD(%d)\n", cmd_action); |
898 | 869 | ||
899 | cmd->command = cpu_to_le16(cmd_mesh_access); | 870 | cmd->command = cpu_to_le16(cmd_mesh_access); |
900 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mesh_access) | 871 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mesh_access) + S_DS_GEN); |
901 | + S_DS_GEN); | ||
902 | cmd->result = 0; | 872 | cmd->result = 0; |
903 | 873 | ||
904 | if (pdata_buf) | 874 | if (pdata_buf) |
@@ -916,23 +886,23 @@ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u | |||
916 | unsigned long flags; | 886 | unsigned long flags; |
917 | struct cmd_ds_command *cmdptr; | 887 | struct cmd_ds_command *cmdptr; |
918 | 888 | ||
919 | ENTER(); | 889 | lbs_deb_enter(LBS_DEB_CMD); |
920 | 890 | ||
921 | if (!cmdnode) { | 891 | if (!cmdnode) { |
922 | lbs_pr_debug(1, "QUEUE_CMD: cmdnode is NULL\n"); | 892 | lbs_deb_cmd("QUEUE_CMD: cmdnode is NULL\n"); |
923 | goto done; | 893 | goto done; |
924 | } | 894 | } |
925 | 895 | ||
926 | cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; | 896 | cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; |
927 | if (!cmdptr) { | 897 | if (!cmdptr) { |
928 | lbs_pr_debug(1, "QUEUE_CMD: cmdptr is NULL\n"); | 898 | lbs_deb_cmd("QUEUE_CMD: cmdptr is NULL\n"); |
929 | goto done; | 899 | goto done; |
930 | } | 900 | } |
931 | 901 | ||
932 | /* Exit_PS command needs to be queued in the header always. */ | 902 | /* Exit_PS command needs to be queued in the header always. */ |
933 | if (cmdptr->command == cmd_802_11_ps_mode) { | 903 | if (cmdptr->command == cmd_802_11_ps_mode) { |
934 | struct cmd_ds_802_11_ps_mode *psm = &cmdptr->params.psmode; | 904 | struct cmd_ds_802_11_ps_mode *psm = &cmdptr->params.psmode; |
935 | if (psm->action == cmd_subcmd_exit_ps) { | 905 | if (psm->action == cpu_to_le16(cmd_subcmd_exit_ps)) { |
936 | if (adapter->psstate != PS_STATE_FULL_POWER) | 906 | if (adapter->psstate != PS_STATE_FULL_POWER) |
937 | addtail = 0; | 907 | addtail = 0; |
938 | } | 908 | } |
@@ -948,13 +918,12 @@ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u | |||
948 | 918 | ||
949 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 919 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
950 | 920 | ||
951 | lbs_pr_debug(1, "QUEUE_CMD: Inserted node=%p, cmd=0x%x in cmdpendingq\n", | 921 | lbs_deb_cmd("QUEUE_CMD: Inserted node=%p, cmd=0x%x in cmdpendingq\n", |
952 | cmdnode, | 922 | cmdnode, |
953 | ((struct cmd_ds_gen*)cmdnode->bufvirtualaddr)->command); | 923 | le16_to_cpu(((struct cmd_ds_gen*)cmdnode->bufvirtualaddr)->command)); |
954 | 924 | ||
955 | done: | 925 | done: |
956 | LEAVE(); | 926 | lbs_deb_leave(LBS_DEB_CMD); |
957 | return; | ||
958 | } | 927 | } |
959 | 928 | ||
960 | /* | 929 | /* |
@@ -974,10 +943,10 @@ static int DownloadcommandToStation(wlan_private * priv, | |||
974 | u16 cmdsize; | 943 | u16 cmdsize; |
975 | u16 command; | 944 | u16 command; |
976 | 945 | ||
977 | ENTER(); | 946 | lbs_deb_enter(LBS_DEB_CMD); |
978 | 947 | ||
979 | if (!adapter || !cmdnode) { | 948 | if (!adapter || !cmdnode) { |
980 | lbs_pr_debug(1, "DNLD_CMD: adapter = %p, cmdnode = %p\n", | 949 | lbs_deb_cmd("DNLD_CMD: adapter = %p, cmdnode = %p\n", |
981 | adapter, cmdnode); | 950 | adapter, cmdnode); |
982 | if (cmdnode) { | 951 | if (cmdnode) { |
983 | spin_lock_irqsave(&adapter->driver_lock, flags); | 952 | spin_lock_irqsave(&adapter->driver_lock, flags); |
@@ -993,7 +962,7 @@ static int DownloadcommandToStation(wlan_private * priv, | |||
993 | 962 | ||
994 | spin_lock_irqsave(&adapter->driver_lock, flags); | 963 | spin_lock_irqsave(&adapter->driver_lock, flags); |
995 | if (!cmdptr || !cmdptr->size) { | 964 | if (!cmdptr || !cmdptr->size) { |
996 | lbs_pr_debug(1, "DNLD_CMD: cmdptr is Null or cmd size is Zero, " | 965 | lbs_deb_cmd("DNLD_CMD: cmdptr is Null or cmd size is Zero, " |
997 | "Not sending\n"); | 966 | "Not sending\n"); |
998 | __libertas_cleanup_and_insert_cmd(priv, cmdnode); | 967 | __libertas_cleanup_and_insert_cmd(priv, cmdnode); |
999 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 968 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
@@ -1004,8 +973,8 @@ static int DownloadcommandToStation(wlan_private * priv, | |||
1004 | adapter->cur_cmd = cmdnode; | 973 | adapter->cur_cmd = cmdnode; |
1005 | adapter->cur_cmd_retcode = 0; | 974 | adapter->cur_cmd_retcode = 0; |
1006 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 975 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
1007 | lbs_pr_debug(1, "DNLD_CMD:: Before download, size of cmd = %d\n", | 976 | lbs_deb_cmd("DNLD_CMD:: Before download, size of cmd = %d\n", |
1008 | cmdptr->size); | 977 | le16_to_cpu(cmdptr->size)); |
1009 | 978 | ||
1010 | cmdsize = cmdptr->size; | 979 | cmdsize = cmdptr->size; |
1011 | 980 | ||
@@ -1014,10 +983,10 @@ static int DownloadcommandToStation(wlan_private * priv, | |||
1014 | cmdnode->cmdwaitqwoken = 0; | 983 | cmdnode->cmdwaitqwoken = 0; |
1015 | cmdsize = cpu_to_le16(cmdsize); | 984 | cmdsize = cpu_to_le16(cmdsize); |
1016 | 985 | ||
1017 | ret = libertas_sbi_host_to_card(priv, MVMS_CMD, (u8 *) cmdptr, cmdsize); | 986 | ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmdptr, cmdsize); |
1018 | 987 | ||
1019 | if (ret != 0) { | 988 | if (ret != 0) { |
1020 | lbs_pr_debug(1, "DNLD_CMD: Host to Card failed\n"); | 989 | lbs_deb_cmd("DNLD_CMD: Host to Card failed\n"); |
1021 | spin_lock_irqsave(&adapter->driver_lock, flags); | 990 | spin_lock_irqsave(&adapter->driver_lock, flags); |
1022 | __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd); | 991 | __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd); |
1023 | adapter->cur_cmd = NULL; | 992 | adapter->cur_cmd = NULL; |
@@ -1026,12 +995,11 @@ static int DownloadcommandToStation(wlan_private * priv, | |||
1026 | goto done; | 995 | goto done; |
1027 | } | 996 | } |
1028 | 997 | ||
1029 | lbs_pr_debug(1, "DNLD_CMD: Sent command 0x%x @ %lu\n", command, jiffies); | 998 | lbs_deb_cmd("DNLD_CMD: Sent command 0x%x @ %lu\n", command, jiffies); |
1030 | lbs_dbg_hex("DNLD_CMD: command", cmdnode->bufvirtualaddr, cmdsize); | 999 | lbs_dbg_hex("DNLD_CMD: command", cmdnode->bufvirtualaddr, cmdsize); |
1031 | 1000 | ||
1032 | /* Setup the timer after transmit command */ | 1001 | /* Setup the timer after transmit command */ |
1033 | if (command == cmd_802_11_scan | 1002 | if (command == cmd_802_11_scan || command == cmd_802_11_authenticate |
1034 | || command == cmd_802_11_authenticate | ||
1035 | || command == cmd_802_11_associate) | 1003 | || command == cmd_802_11_associate) |
1036 | mod_timer(&adapter->command_timer, jiffies + (10*HZ)); | 1004 | mod_timer(&adapter->command_timer, jiffies + (10*HZ)); |
1037 | else | 1005 | else |
@@ -1039,8 +1007,8 @@ static int DownloadcommandToStation(wlan_private * priv, | |||
1039 | 1007 | ||
1040 | ret = 0; | 1008 | ret = 0; |
1041 | 1009 | ||
1042 | done: | 1010 | done: |
1043 | LEAVE(); | 1011 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); |
1044 | return ret; | 1012 | return ret; |
1045 | } | 1013 | } |
1046 | 1014 | ||
@@ -1049,17 +1017,16 @@ static int wlan_cmd_mac_control(wlan_private * priv, | |||
1049 | { | 1017 | { |
1050 | struct cmd_ds_mac_control *mac = &cmd->params.macctrl; | 1018 | struct cmd_ds_mac_control *mac = &cmd->params.macctrl; |
1051 | 1019 | ||
1052 | ENTER(); | 1020 | lbs_deb_enter(LBS_DEB_CMD); |
1053 | 1021 | ||
1054 | cmd->command = cpu_to_le16(cmd_mac_control); | 1022 | cmd->command = cpu_to_le16(cmd_mac_control); |
1055 | cmd->size = | 1023 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mac_control) + S_DS_GEN); |
1056 | cpu_to_le16(sizeof(struct cmd_ds_mac_control) + S_DS_GEN); | ||
1057 | mac->action = cpu_to_le16(priv->adapter->currentpacketfilter); | 1024 | mac->action = cpu_to_le16(priv->adapter->currentpacketfilter); |
1058 | 1025 | ||
1059 | lbs_pr_debug(1, "wlan_cmd_mac_control(): action=0x%X size=%d\n", | 1026 | lbs_deb_cmd("wlan_cmd_mac_control(): action=0x%X size=%d\n", |
1060 | mac->action, cmd->size); | 1027 | le16_to_cpu(mac->action), le16_to_cpu(cmd->size)); |
1061 | 1028 | ||
1062 | LEAVE(); | 1029 | lbs_deb_leave(LBS_DEB_CMD); |
1063 | return 0; | 1030 | return 0; |
1064 | } | 1031 | } |
1065 | 1032 | ||
@@ -1093,17 +1060,17 @@ int libertas_set_radio_control(wlan_private * priv) | |||
1093 | { | 1060 | { |
1094 | int ret = 0; | 1061 | int ret = 0; |
1095 | 1062 | ||
1096 | ENTER(); | 1063 | lbs_deb_enter(LBS_DEB_CMD); |
1097 | 1064 | ||
1098 | ret = libertas_prepare_and_send_command(priv, | 1065 | ret = libertas_prepare_and_send_command(priv, |
1099 | cmd_802_11_radio_control, | 1066 | cmd_802_11_radio_control, |
1100 | cmd_act_set, | 1067 | cmd_act_set, |
1101 | cmd_option_waitforrsp, 0, NULL); | 1068 | cmd_option_waitforrsp, 0, NULL); |
1102 | 1069 | ||
1103 | lbs_pr_debug(1, "RADIO_SET: on or off: 0x%X, preamble = 0x%X\n", | 1070 | lbs_deb_cmd("RADIO_SET: on or off: 0x%X, preamble = 0x%X\n", |
1104 | priv->adapter->radioon, priv->adapter->preamble); | 1071 | priv->adapter->radioon, priv->adapter->preamble); |
1105 | 1072 | ||
1106 | LEAVE(); | 1073 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); |
1107 | return ret; | 1074 | return ret; |
1108 | } | 1075 | } |
1109 | 1076 | ||
@@ -1111,16 +1078,16 @@ int libertas_set_mac_packet_filter(wlan_private * priv) | |||
1111 | { | 1078 | { |
1112 | int ret = 0; | 1079 | int ret = 0; |
1113 | 1080 | ||
1114 | ENTER(); | 1081 | lbs_deb_enter(LBS_DEB_CMD); |
1115 | 1082 | ||
1116 | lbs_pr_debug(1, "libertas_set_mac_packet_filter value = %x\n", | 1083 | lbs_deb_cmd("libertas_set_mac_packet_filter value = %x\n", |
1117 | priv->adapter->currentpacketfilter); | 1084 | priv->adapter->currentpacketfilter); |
1118 | 1085 | ||
1119 | /* Send MAC control command to station */ | 1086 | /* Send MAC control command to station */ |
1120 | ret = libertas_prepare_and_send_command(priv, | 1087 | ret = libertas_prepare_and_send_command(priv, |
1121 | cmd_mac_control, 0, 0, 0, NULL); | 1088 | cmd_mac_control, 0, 0, 0, NULL); |
1122 | 1089 | ||
1123 | LEAVE(); | 1090 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); |
1124 | return ret; | 1091 | return ret; |
1125 | } | 1092 | } |
1126 | 1093 | ||
@@ -1146,16 +1113,16 @@ int libertas_prepare_and_send_command(wlan_private * priv, | |||
1146 | struct cmd_ds_command *cmdptr; | 1113 | struct cmd_ds_command *cmdptr; |
1147 | unsigned long flags; | 1114 | unsigned long flags; |
1148 | 1115 | ||
1149 | ENTER(); | 1116 | lbs_deb_enter(LBS_DEB_CMD); |
1150 | 1117 | ||
1151 | if (!adapter) { | 1118 | if (!adapter) { |
1152 | lbs_pr_debug(1, "PREP_CMD: adapter is Null\n"); | 1119 | lbs_deb_cmd("PREP_CMD: adapter is Null\n"); |
1153 | ret = -1; | 1120 | ret = -1; |
1154 | goto done; | 1121 | goto done; |
1155 | } | 1122 | } |
1156 | 1123 | ||
1157 | if (adapter->surpriseremoved) { | 1124 | if (adapter->surpriseremoved) { |
1158 | lbs_pr_debug(1, "PREP_CMD: Card is Removed\n"); | 1125 | lbs_deb_cmd("PREP_CMD: Card is Removed\n"); |
1159 | ret = -1; | 1126 | ret = -1; |
1160 | goto done; | 1127 | goto done; |
1161 | } | 1128 | } |
@@ -1163,7 +1130,7 @@ int libertas_prepare_and_send_command(wlan_private * priv, | |||
1163 | cmdnode = libertas_get_free_cmd_ctrl_node(priv); | 1130 | cmdnode = libertas_get_free_cmd_ctrl_node(priv); |
1164 | 1131 | ||
1165 | if (cmdnode == NULL) { | 1132 | if (cmdnode == NULL) { |
1166 | lbs_pr_debug(1, "PREP_CMD: No free cmdnode\n"); | 1133 | lbs_deb_cmd("PREP_CMD: No free cmdnode\n"); |
1167 | 1134 | ||
1168 | /* Wake up main thread to execute next command */ | 1135 | /* Wake up main thread to execute next command */ |
1169 | wake_up_interruptible(&priv->mainthread.waitq); | 1136 | wake_up_interruptible(&priv->mainthread.waitq); |
@@ -1175,11 +1142,11 @@ int libertas_prepare_and_send_command(wlan_private * priv, | |||
1175 | 1142 | ||
1176 | cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; | 1143 | cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; |
1177 | 1144 | ||
1178 | lbs_pr_debug(1, "PREP_CMD: Val of cmd ptr=%p, command=0x%X\n", | 1145 | lbs_deb_cmd("PREP_CMD: Val of cmd ptr=%p, command=0x%X\n", |
1179 | cmdptr, cmd_no); | 1146 | cmdptr, cmd_no); |
1180 | 1147 | ||
1181 | if (!cmdptr) { | 1148 | if (!cmdptr) { |
1182 | lbs_pr_debug(1, "PREP_CMD: bufvirtualaddr of cmdnode is NULL\n"); | 1149 | lbs_deb_cmd("PREP_CMD: bufvirtualaddr of cmdnode is NULL\n"); |
1183 | libertas_cleanup_and_insert_cmd(priv, cmdnode); | 1150 | libertas_cleanup_and_insert_cmd(priv, cmdnode); |
1184 | ret = -1; | 1151 | ret = -1; |
1185 | goto done; | 1152 | goto done; |
@@ -1189,7 +1156,7 @@ int libertas_prepare_and_send_command(wlan_private * priv, | |||
1189 | adapter->seqnum++; | 1156 | adapter->seqnum++; |
1190 | cmdptr->seqnum = cpu_to_le16(adapter->seqnum); | 1157 | cmdptr->seqnum = cpu_to_le16(adapter->seqnum); |
1191 | 1158 | ||
1192 | cmdptr->command = cmd_no; | 1159 | cmdptr->command = cpu_to_le16(cmd_no); |
1193 | cmdptr->result = 0; | 1160 | cmdptr->result = 0; |
1194 | 1161 | ||
1195 | switch (cmd_no) { | 1162 | switch (cmd_no) { |
@@ -1298,13 +1265,13 @@ int libertas_prepare_and_send_command(wlan_private * priv, | |||
1298 | break; | 1265 | break; |
1299 | 1266 | ||
1300 | case cmd_802_11_enable_rsn: | 1267 | case cmd_802_11_enable_rsn: |
1301 | ret = wlan_cmd_802_11_enable_rsn(priv, cmdptr, cmd_action); | 1268 | ret = wlan_cmd_802_11_enable_rsn(priv, cmdptr, cmd_action, |
1269 | pdata_buf); | ||
1302 | break; | 1270 | break; |
1303 | 1271 | ||
1304 | case cmd_802_11_key_material: | 1272 | case cmd_802_11_key_material: |
1305 | ret = wlan_cmd_802_11_key_material(priv, cmdptr, | 1273 | ret = wlan_cmd_802_11_key_material(priv, cmdptr, cmd_action, |
1306 | cmd_action, cmd_oid, | 1274 | cmd_oid, pdata_buf); |
1307 | pdata_buf); | ||
1308 | break; | 1275 | break; |
1309 | 1276 | ||
1310 | case cmd_802_11_pairwise_tsc: | 1277 | case cmd_802_11_pairwise_tsc: |
@@ -1325,9 +1292,8 @@ int libertas_prepare_and_send_command(wlan_private * priv, | |||
1325 | case cmd_802_11_get_afc: | 1292 | case cmd_802_11_get_afc: |
1326 | 1293 | ||
1327 | cmdptr->command = cpu_to_le16(cmd_no); | 1294 | cmdptr->command = cpu_to_le16(cmd_no); |
1328 | cmdptr->size = | 1295 | cmdptr->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_afc) + |
1329 | cpu_to_le16(sizeof(struct cmd_ds_802_11_afc) + | 1296 | S_DS_GEN); |
1330 | S_DS_GEN); | ||
1331 | 1297 | ||
1332 | memmove(&cmdptr->params.afc, | 1298 | memmove(&cmdptr->params.afc, |
1333 | pdata_buf, sizeof(struct cmd_ds_802_11_afc)); | 1299 | pdata_buf, sizeof(struct cmd_ds_802_11_afc)); |
@@ -1406,29 +1372,26 @@ int libertas_prepare_and_send_command(wlan_private * priv, | |||
1406 | 1372 | ||
1407 | case cmd_get_tsf: | 1373 | case cmd_get_tsf: |
1408 | cmdptr->command = cpu_to_le16(cmd_get_tsf); | 1374 | cmdptr->command = cpu_to_le16(cmd_get_tsf); |
1409 | cmdptr->size = | 1375 | cmdptr->size = cpu_to_le16(sizeof(struct cmd_ds_get_tsf) + |
1410 | cpu_to_le16(sizeof(struct cmd_ds_get_tsf) | 1376 | S_DS_GEN); |
1411 | + S_DS_GEN); | ||
1412 | ret = 0; | 1377 | ret = 0; |
1413 | break; | 1378 | break; |
1414 | case cmd_802_11_tx_rate_query: | 1379 | case cmd_802_11_tx_rate_query: |
1415 | cmdptr->command = | 1380 | cmdptr->command = cpu_to_le16(cmd_802_11_tx_rate_query); |
1416 | cpu_to_le16(cmd_802_11_tx_rate_query); | 1381 | cmdptr->size = cpu_to_le16(sizeof(struct cmd_tx_rate_query) + |
1417 | cmdptr->size = | 1382 | S_DS_GEN); |
1418 | cpu_to_le16(sizeof(struct cmd_tx_rate_query) + | ||
1419 | S_DS_GEN); | ||
1420 | adapter->txrate = 0; | 1383 | adapter->txrate = 0; |
1421 | ret = 0; | 1384 | ret = 0; |
1422 | break; | 1385 | break; |
1423 | default: | 1386 | default: |
1424 | lbs_pr_debug(1, "PREP_CMD: unknown command- %#x\n", cmd_no); | 1387 | lbs_deb_cmd("PREP_CMD: unknown command- %#x\n", cmd_no); |
1425 | ret = -1; | 1388 | ret = -1; |
1426 | break; | 1389 | break; |
1427 | } | 1390 | } |
1428 | 1391 | ||
1429 | /* return error, since the command preparation failed */ | 1392 | /* return error, since the command preparation failed */ |
1430 | if (ret != 0) { | 1393 | if (ret != 0) { |
1431 | lbs_pr_debug(1, "PREP_CMD: command preparation failed\n"); | 1394 | lbs_deb_cmd("PREP_CMD: command preparation failed\n"); |
1432 | libertas_cleanup_and_insert_cmd(priv, cmdnode); | 1395 | libertas_cleanup_and_insert_cmd(priv, cmdnode); |
1433 | ret = -1; | 1396 | ret = -1; |
1434 | goto done; | 1397 | goto done; |
@@ -1441,7 +1404,7 @@ int libertas_prepare_and_send_command(wlan_private * priv, | |||
1441 | wake_up_interruptible(&priv->mainthread.waitq); | 1404 | wake_up_interruptible(&priv->mainthread.waitq); |
1442 | 1405 | ||
1443 | if (wait_option & cmd_option_waitforrsp) { | 1406 | if (wait_option & cmd_option_waitforrsp) { |
1444 | lbs_pr_debug(1, "PREP_CMD: Wait for CMD response\n"); | 1407 | lbs_deb_cmd("PREP_CMD: Wait for CMD response\n"); |
1445 | might_sleep(); | 1408 | might_sleep(); |
1446 | wait_event_interruptible(cmdnode->cmdwait_q, | 1409 | wait_event_interruptible(cmdnode->cmdwait_q, |
1447 | cmdnode->cmdwaitqwoken); | 1410 | cmdnode->cmdwaitqwoken); |
@@ -1449,7 +1412,7 @@ int libertas_prepare_and_send_command(wlan_private * priv, | |||
1449 | 1412 | ||
1450 | spin_lock_irqsave(&adapter->driver_lock, flags); | 1413 | spin_lock_irqsave(&adapter->driver_lock, flags); |
1451 | if (adapter->cur_cmd_retcode) { | 1414 | if (adapter->cur_cmd_retcode) { |
1452 | lbs_pr_debug(1, "PREP_CMD: command failed with return code=%d\n", | 1415 | lbs_deb_cmd("PREP_CMD: command failed with return code=%d\n", |
1453 | adapter->cur_cmd_retcode); | 1416 | adapter->cur_cmd_retcode); |
1454 | adapter->cur_cmd_retcode = 0; | 1417 | adapter->cur_cmd_retcode = 0; |
1455 | ret = -1; | 1418 | ret = -1; |
@@ -1457,9 +1420,10 @@ int libertas_prepare_and_send_command(wlan_private * priv, | |||
1457 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 1420 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
1458 | 1421 | ||
1459 | done: | 1422 | done: |
1460 | LEAVE(); | 1423 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); |
1461 | return ret; | 1424 | return ret; |
1462 | } | 1425 | } |
1426 | EXPORT_SYMBOL_GPL(libertas_prepare_and_send_command); | ||
1463 | 1427 | ||
1464 | /** | 1428 | /** |
1465 | * @brief This function allocates the command buffer and link | 1429 | * @brief This function allocates the command buffer and link |
@@ -1477,33 +1441,29 @@ int libertas_allocate_cmd_buffer(wlan_private * priv) | |||
1477 | u8 *ptempvirtualaddr; | 1441 | u8 *ptempvirtualaddr; |
1478 | wlan_adapter *adapter = priv->adapter; | 1442 | wlan_adapter *adapter = priv->adapter; |
1479 | 1443 | ||
1480 | ENTER(); | 1444 | lbs_deb_enter(LBS_DEB_CMD); |
1481 | 1445 | ||
1482 | /* Allocate and initialize cmdCtrlNode */ | 1446 | /* Allocate and initialize cmdCtrlNode */ |
1483 | ulbufsize = sizeof(struct cmd_ctrl_node) * MRVDRV_NUM_OF_CMD_BUFFER; | 1447 | ulbufsize = sizeof(struct cmd_ctrl_node) * MRVDRV_NUM_OF_CMD_BUFFER; |
1484 | 1448 | ||
1485 | if (!(tempcmd_array = kmalloc(ulbufsize, GFP_KERNEL))) { | 1449 | if (!(tempcmd_array = kzalloc(ulbufsize, GFP_KERNEL))) { |
1486 | lbs_pr_debug(1, | 1450 | lbs_deb_cmd( |
1487 | "ALLOC_CMD_BUF: failed to allocate tempcmd_array\n"); | 1451 | "ALLOC_CMD_BUF: failed to allocate tempcmd_array\n"); |
1488 | ret = -1; | 1452 | ret = -1; |
1489 | goto done; | 1453 | goto done; |
1490 | } | 1454 | } |
1491 | |||
1492 | adapter->cmd_array = tempcmd_array; | 1455 | adapter->cmd_array = tempcmd_array; |
1493 | memset(adapter->cmd_array, 0, ulbufsize); | ||
1494 | 1456 | ||
1495 | /* Allocate and initialize command buffers */ | 1457 | /* Allocate and initialize command buffers */ |
1496 | ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER; | 1458 | ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER; |
1497 | for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) { | 1459 | for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) { |
1498 | if (!(ptempvirtualaddr = kmalloc(ulbufsize, GFP_KERNEL))) { | 1460 | if (!(ptempvirtualaddr = kzalloc(ulbufsize, GFP_KERNEL))) { |
1499 | lbs_pr_debug(1, | 1461 | lbs_deb_cmd( |
1500 | "ALLOC_CMD_BUF: ptempvirtualaddr: out of memory\n"); | 1462 | "ALLOC_CMD_BUF: ptempvirtualaddr: out of memory\n"); |
1501 | ret = -1; | 1463 | ret = -1; |
1502 | goto done; | 1464 | goto done; |
1503 | } | 1465 | } |
1504 | 1466 | ||
1505 | memset(ptempvirtualaddr, 0, ulbufsize); | ||
1506 | |||
1507 | /* Update command buffer virtual */ | 1467 | /* Update command buffer virtual */ |
1508 | tempcmd_array[i].bufvirtualaddr = ptempvirtualaddr; | 1468 | tempcmd_array[i].bufvirtualaddr = ptempvirtualaddr; |
1509 | } | 1469 | } |
@@ -1514,8 +1474,9 @@ int libertas_allocate_cmd_buffer(wlan_private * priv) | |||
1514 | } | 1474 | } |
1515 | 1475 | ||
1516 | ret = 0; | 1476 | ret = 0; |
1517 | done: | 1477 | |
1518 | LEAVE(); | 1478 | done: |
1479 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); | ||
1519 | return ret; | 1480 | return ret; |
1520 | } | 1481 | } |
1521 | 1482 | ||
@@ -1527,16 +1488,16 @@ int libertas_allocate_cmd_buffer(wlan_private * priv) | |||
1527 | */ | 1488 | */ |
1528 | int libertas_free_cmd_buffer(wlan_private * priv) | 1489 | int libertas_free_cmd_buffer(wlan_private * priv) |
1529 | { | 1490 | { |
1530 | u32 ulbufsize; | 1491 | u32 ulbufsize; /* Someone needs to die for this. Slowly and painfully */ |
1531 | unsigned int i; | 1492 | unsigned int i; |
1532 | struct cmd_ctrl_node *tempcmd_array; | 1493 | struct cmd_ctrl_node *tempcmd_array; |
1533 | wlan_adapter *adapter = priv->adapter; | 1494 | wlan_adapter *adapter = priv->adapter; |
1534 | 1495 | ||
1535 | ENTER(); | 1496 | lbs_deb_enter(LBS_DEB_CMD); |
1536 | 1497 | ||
1537 | /* need to check if cmd array is allocated or not */ | 1498 | /* need to check if cmd array is allocated or not */ |
1538 | if (adapter->cmd_array == NULL) { | 1499 | if (adapter->cmd_array == NULL) { |
1539 | lbs_pr_debug(1, "FREE_CMD_BUF: cmd_array is Null\n"); | 1500 | lbs_deb_cmd("FREE_CMD_BUF: cmd_array is Null\n"); |
1540 | goto done; | 1501 | goto done; |
1541 | } | 1502 | } |
1542 | 1503 | ||
@@ -1546,7 +1507,7 @@ int libertas_free_cmd_buffer(wlan_private * priv) | |||
1546 | ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER; | 1507 | ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER; |
1547 | for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) { | 1508 | for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) { |
1548 | if (tempcmd_array[i].bufvirtualaddr) { | 1509 | if (tempcmd_array[i].bufvirtualaddr) { |
1549 | lbs_pr_debug(1, "Free all the array\n"); | 1510 | lbs_deb_cmd("Free all the array\n"); |
1550 | kfree(tempcmd_array[i].bufvirtualaddr); | 1511 | kfree(tempcmd_array[i].bufvirtualaddr); |
1551 | tempcmd_array[i].bufvirtualaddr = NULL; | 1512 | tempcmd_array[i].bufvirtualaddr = NULL; |
1552 | } | 1513 | } |
@@ -1554,13 +1515,13 @@ int libertas_free_cmd_buffer(wlan_private * priv) | |||
1554 | 1515 | ||
1555 | /* Release cmd_ctrl_node */ | 1516 | /* Release cmd_ctrl_node */ |
1556 | if (adapter->cmd_array) { | 1517 | if (adapter->cmd_array) { |
1557 | lbs_pr_debug(1, "Free cmd_array\n"); | 1518 | lbs_deb_cmd("Free cmd_array\n"); |
1558 | kfree(adapter->cmd_array); | 1519 | kfree(adapter->cmd_array); |
1559 | adapter->cmd_array = NULL; | 1520 | adapter->cmd_array = NULL; |
1560 | } | 1521 | } |
1561 | 1522 | ||
1562 | done: | 1523 | done: |
1563 | LEAVE(); | 1524 | lbs_deb_leave(LBS_DEB_CMD); |
1564 | return 0; | 1525 | return 0; |
1565 | } | 1526 | } |
1566 | 1527 | ||
@@ -1586,16 +1547,18 @@ struct cmd_ctrl_node *libertas_get_free_cmd_ctrl_node(wlan_private * priv) | |||
1586 | tempnode = (struct cmd_ctrl_node *)adapter->cmdfreeq.next; | 1547 | tempnode = (struct cmd_ctrl_node *)adapter->cmdfreeq.next; |
1587 | list_del((struct list_head *)tempnode); | 1548 | list_del((struct list_head *)tempnode); |
1588 | } else { | 1549 | } else { |
1589 | lbs_pr_debug(1, "GET_CMD_NODE: cmd_ctrl_node is not available\n"); | 1550 | lbs_deb_cmd("GET_CMD_NODE: cmd_ctrl_node is not available\n"); |
1590 | tempnode = NULL; | 1551 | tempnode = NULL; |
1591 | } | 1552 | } |
1592 | 1553 | ||
1593 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 1554 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
1594 | 1555 | ||
1595 | if (tempnode) { | 1556 | if (tempnode) { |
1557 | /* | ||
1596 | lbs_pr_debug(3, "GET_CMD_NODE: cmdCtrlNode available\n"); | 1558 | lbs_pr_debug(3, "GET_CMD_NODE: cmdCtrlNode available\n"); |
1597 | lbs_pr_debug(3, "GET_CMD_NODE: cmdCtrlNode Address = %p\n", | 1559 | lbs_pr_debug(3, "GET_CMD_NODE: cmdCtrlNode Address = %p\n", |
1598 | tempnode); | 1560 | tempnode); |
1561 | */ | ||
1599 | cleanup_cmdnode(tempnode); | 1562 | cleanup_cmdnode(tempnode); |
1600 | } | 1563 | } |
1601 | 1564 | ||
@@ -1638,7 +1601,7 @@ void libertas_set_cmd_ctrl_node(wlan_private * priv, | |||
1638 | struct cmd_ctrl_node *ptempnode, | 1601 | struct cmd_ctrl_node *ptempnode, |
1639 | u32 cmd_oid, u16 wait_option, void *pdata_buf) | 1602 | u32 cmd_oid, u16 wait_option, void *pdata_buf) |
1640 | { | 1603 | { |
1641 | ENTER(); | 1604 | lbs_deb_enter(LBS_DEB_CMD); |
1642 | 1605 | ||
1643 | if (!ptempnode) | 1606 | if (!ptempnode) |
1644 | return; | 1607 | return; |
@@ -1647,7 +1610,7 @@ void libertas_set_cmd_ctrl_node(wlan_private * priv, | |||
1647 | ptempnode->wait_option = wait_option; | 1610 | ptempnode->wait_option = wait_option; |
1648 | ptempnode->pdata_buf = pdata_buf; | 1611 | ptempnode->pdata_buf = pdata_buf; |
1649 | 1612 | ||
1650 | LEAVE(); | 1613 | lbs_deb_leave(LBS_DEB_CMD); |
1651 | } | 1614 | } |
1652 | 1615 | ||
1653 | /** | 1616 | /** |
@@ -1666,7 +1629,7 @@ int libertas_execute_next_command(wlan_private * priv) | |||
1666 | unsigned long flags; | 1629 | unsigned long flags; |
1667 | int ret = 0; | 1630 | int ret = 0; |
1668 | 1631 | ||
1669 | lbs_pr_debug(1, "libertas_execute_next_command\n"); | 1632 | lbs_deb_enter(LBS_DEB_CMD); |
1670 | 1633 | ||
1671 | spin_lock_irqsave(&adapter->driver_lock, flags); | 1634 | spin_lock_irqsave(&adapter->driver_lock, flags); |
1672 | 1635 | ||
@@ -1685,23 +1648,24 @@ int libertas_execute_next_command(wlan_private * priv) | |||
1685 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 1648 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
1686 | 1649 | ||
1687 | if (cmdnode) { | 1650 | if (cmdnode) { |
1688 | lbs_pr_debug(1, | 1651 | lbs_deb_cmd( |
1689 | "EXEC_NEXT_CMD: Got next command from cmdpendingq\n"); | 1652 | "EXEC_NEXT_CMD: Got next command from cmdpendingq\n"); |
1690 | cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; | 1653 | cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; |
1691 | 1654 | ||
1692 | if (is_command_allowed_in_ps(cmdptr->command)) { | 1655 | if (is_command_allowed_in_ps(cmdptr->command)) { |
1693 | if ((adapter->psstate == PS_STATE_SLEEP) | 1656 | if ((adapter->psstate == PS_STATE_SLEEP) || |
1694 | || (adapter->psstate == PS_STATE_PRE_SLEEP) | 1657 | (adapter->psstate == PS_STATE_PRE_SLEEP)) { |
1695 | ) { | 1658 | lbs_deb_cmd( |
1696 | lbs_pr_debug(1, | ||
1697 | "EXEC_NEXT_CMD: Cannot send cmd 0x%x in psstate %d\n", | 1659 | "EXEC_NEXT_CMD: Cannot send cmd 0x%x in psstate %d\n", |
1698 | cmdptr->command, adapter->psstate); | 1660 | le16_to_cpu(cmdptr->command), |
1661 | adapter->psstate); | ||
1699 | ret = -1; | 1662 | ret = -1; |
1700 | goto done; | 1663 | goto done; |
1701 | } | 1664 | } |
1702 | lbs_pr_debug(1, "EXEC_NEXT_CMD: OK to send command " | 1665 | lbs_deb_cmd("EXEC_NEXT_CMD: OK to send command " |
1703 | "0x%x in psstate %d\n", | 1666 | "0x%x in psstate %d\n", |
1704 | cmdptr->command, adapter->psstate); | 1667 | le16_to_cpu(cmdptr->command), |
1668 | adapter->psstate); | ||
1705 | } else if (adapter->psstate != PS_STATE_FULL_POWER) { | 1669 | } else if (adapter->psstate != PS_STATE_FULL_POWER) { |
1706 | /* | 1670 | /* |
1707 | * 1. Non-PS command: | 1671 | * 1. Non-PS command: |
@@ -1737,12 +1701,12 @@ int libertas_execute_next_command(wlan_private * priv) | |||
1737 | struct cmd_ds_802_11_ps_mode *psm = | 1701 | struct cmd_ds_802_11_ps_mode *psm = |
1738 | &cmdptr->params.psmode; | 1702 | &cmdptr->params.psmode; |
1739 | 1703 | ||
1740 | lbs_pr_debug(1, | 1704 | lbs_deb_cmd( |
1741 | "EXEC_NEXT_CMD: PS cmd- action=0x%x\n", | 1705 | "EXEC_NEXT_CMD: PS cmd- action=0x%x\n", |
1742 | psm->action); | 1706 | psm->action); |
1743 | if (psm->action != | 1707 | if (psm->action != |
1744 | cpu_to_le16(cmd_subcmd_exit_ps)) { | 1708 | cpu_to_le16(cmd_subcmd_exit_ps)) { |
1745 | lbs_pr_debug(1, | 1709 | lbs_deb_cmd( |
1746 | "EXEC_NEXT_CMD: Ignore Enter PS cmd\n"); | 1710 | "EXEC_NEXT_CMD: Ignore Enter PS cmd\n"); |
1747 | list_del((struct list_head *)cmdnode); | 1711 | list_del((struct list_head *)cmdnode); |
1748 | libertas_cleanup_and_insert_cmd(priv, cmdnode); | 1712 | libertas_cleanup_and_insert_cmd(priv, cmdnode); |
@@ -1751,10 +1715,9 @@ int libertas_execute_next_command(wlan_private * priv) | |||
1751 | goto done; | 1715 | goto done; |
1752 | } | 1716 | } |
1753 | 1717 | ||
1754 | if ((adapter->psstate == PS_STATE_SLEEP) | 1718 | if ((adapter->psstate == PS_STATE_SLEEP) || |
1755 | || (adapter->psstate == PS_STATE_PRE_SLEEP) | 1719 | (adapter->psstate == PS_STATE_PRE_SLEEP)) { |
1756 | ) { | 1720 | lbs_deb_cmd( |
1757 | lbs_pr_debug(1, | ||
1758 | "EXEC_NEXT_CMD: Ignore ExitPS cmd in sleep\n"); | 1721 | "EXEC_NEXT_CMD: Ignore ExitPS cmd in sleep\n"); |
1759 | list_del((struct list_head *)cmdnode); | 1722 | list_del((struct list_head *)cmdnode); |
1760 | libertas_cleanup_and_insert_cmd(priv, cmdnode); | 1723 | libertas_cleanup_and_insert_cmd(priv, cmdnode); |
@@ -1764,13 +1727,13 @@ int libertas_execute_next_command(wlan_private * priv) | |||
1764 | goto done; | 1727 | goto done; |
1765 | } | 1728 | } |
1766 | 1729 | ||
1767 | lbs_pr_debug(1, | 1730 | lbs_deb_cmd( |
1768 | "EXEC_NEXT_CMD: Sending Exit_PS down...\n"); | 1731 | "EXEC_NEXT_CMD: Sending Exit_PS down...\n"); |
1769 | } | 1732 | } |
1770 | } | 1733 | } |
1771 | list_del((struct list_head *)cmdnode); | 1734 | list_del((struct list_head *)cmdnode); |
1772 | lbs_pr_debug(1, "EXEC_NEXT_CMD: Sending 0x%04X command\n", | 1735 | lbs_deb_cmd("EXEC_NEXT_CMD: Sending 0x%04X command\n", |
1773 | cmdptr->command); | 1736 | le16_to_cpu(cmdptr->command)); |
1774 | DownloadcommandToStation(priv, cmdnode); | 1737 | DownloadcommandToStation(priv, cmdnode); |
1775 | } else { | 1738 | } else { |
1776 | /* | 1739 | /* |
@@ -1780,18 +1743,18 @@ int libertas_execute_next_command(wlan_private * priv) | |||
1780 | if ((adapter->psmode != wlan802_11powermodecam) && | 1743 | if ((adapter->psmode != wlan802_11powermodecam) && |
1781 | (adapter->psstate == PS_STATE_FULL_POWER) && | 1744 | (adapter->psstate == PS_STATE_FULL_POWER) && |
1782 | (adapter->connect_status == libertas_connected)) { | 1745 | (adapter->connect_status == libertas_connected)) { |
1783 | if (adapter->secinfo.WPAenabled | 1746 | if (adapter->secinfo.WPAenabled || |
1784 | || adapter->secinfo.WPA2enabled) { | 1747 | adapter->secinfo.WPA2enabled) { |
1785 | /* check for valid WPA group keys */ | 1748 | /* check for valid WPA group keys */ |
1786 | if (adapter->wpa_mcast_key.len | 1749 | if (adapter->wpa_mcast_key.len || |
1787 | || adapter->wpa_unicast_key.len) { | 1750 | adapter->wpa_unicast_key.len) { |
1788 | lbs_pr_debug(1, | 1751 | lbs_deb_cmd( |
1789 | "EXEC_NEXT_CMD: WPA enabled and GTK_SET" | 1752 | "EXEC_NEXT_CMD: WPA enabled and GTK_SET" |
1790 | " go back to PS_SLEEP"); | 1753 | " go back to PS_SLEEP"); |
1791 | libertas_ps_sleep(priv, 0); | 1754 | libertas_ps_sleep(priv, 0); |
1792 | } | 1755 | } |
1793 | } else { | 1756 | } else { |
1794 | lbs_pr_debug(1, | 1757 | lbs_deb_cmd( |
1795 | "EXEC_NEXT_CMD: command PendQ is empty," | 1758 | "EXEC_NEXT_CMD: command PendQ is empty," |
1796 | " go back to PS_SLEEP"); | 1759 | " go back to PS_SLEEP"); |
1797 | libertas_ps_sleep(priv, 0); | 1760 | libertas_ps_sleep(priv, 0); |
@@ -1801,6 +1764,7 @@ int libertas_execute_next_command(wlan_private * priv) | |||
1801 | 1764 | ||
1802 | ret = 0; | 1765 | ret = 0; |
1803 | done: | 1766 | done: |
1767 | lbs_deb_leave(LBS_DEB_CMD); | ||
1804 | return ret; | 1768 | return ret; |
1805 | } | 1769 | } |
1806 | 1770 | ||
@@ -1809,7 +1773,7 @@ void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str) | |||
1809 | union iwreq_data iwrq; | 1773 | union iwreq_data iwrq; |
1810 | u8 buf[50]; | 1774 | u8 buf[50]; |
1811 | 1775 | ||
1812 | ENTER(); | 1776 | lbs_deb_enter(LBS_DEB_CMD); |
1813 | 1777 | ||
1814 | memset(&iwrq, 0, sizeof(union iwreq_data)); | 1778 | memset(&iwrq, 0, sizeof(union iwreq_data)); |
1815 | memset(buf, 0, sizeof(buf)); | 1779 | memset(buf, 0, sizeof(buf)); |
@@ -1819,15 +1783,13 @@ void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str) | |||
1819 | iwrq.data.length = strlen(buf) + 1 + IW_EV_LCP_LEN; | 1783 | iwrq.data.length = strlen(buf) + 1 + IW_EV_LCP_LEN; |
1820 | 1784 | ||
1821 | /* Send Event to upper layer */ | 1785 | /* Send Event to upper layer */ |
1822 | lbs_pr_debug(1, "Event Indication string = %s\n", | 1786 | lbs_deb_cmd("Event Indication string = %s\n", (char *)buf); |
1823 | (char *)buf); | 1787 | lbs_deb_cmd("Event Indication String length = %d\n", iwrq.data.length); |
1824 | lbs_pr_debug(1, "Event Indication String length = %d\n", iwrq.data.length); | ||
1825 | 1788 | ||
1826 | lbs_pr_debug(1, "Sending wireless event IWEVCUSTOM for %s\n", str); | 1789 | lbs_deb_cmd("Sending wireless event IWEVCUSTOM for %s\n", str); |
1827 | wireless_send_event(priv->wlan_dev.netdev, IWEVCUSTOM, &iwrq, buf); | 1790 | wireless_send_event(priv->dev, IWEVCUSTOM, &iwrq, buf); |
1828 | 1791 | ||
1829 | LEAVE(); | 1792 | lbs_deb_leave(LBS_DEB_CMD); |
1830 | return; | ||
1831 | } | 1793 | } |
1832 | 1794 | ||
1833 | static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size) | 1795 | static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size) |
@@ -1836,19 +1798,19 @@ static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size) | |||
1836 | wlan_adapter *adapter = priv->adapter; | 1798 | wlan_adapter *adapter = priv->adapter; |
1837 | int ret = 0; | 1799 | int ret = 0; |
1838 | 1800 | ||
1839 | ENTER(); | 1801 | lbs_deb_enter(LBS_DEB_CMD); |
1840 | 1802 | ||
1841 | lbs_pr_debug(1, "SEND_SLEEPC_CMD: Before download, size of cmd = %d\n", | 1803 | lbs_deb_cmd("SEND_SLEEPC_CMD: Before download, size of cmd = %d\n", |
1842 | size); | 1804 | size); |
1843 | 1805 | ||
1844 | lbs_dbg_hex("SEND_SLEEPC_CMD: Sleep confirm command", cmdptr, size); | 1806 | lbs_dbg_hex("SEND_SLEEPC_CMD: Sleep confirm command", cmdptr, size); |
1845 | 1807 | ||
1846 | ret = libertas_sbi_host_to_card(priv, MVMS_CMD, cmdptr, size); | 1808 | ret = priv->hw_host_to_card(priv, MVMS_CMD, cmdptr, size); |
1847 | priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED; | 1809 | priv->dnld_sent = DNLD_RES_RECEIVED; |
1848 | 1810 | ||
1849 | spin_lock_irqsave(&adapter->driver_lock, flags); | 1811 | spin_lock_irqsave(&adapter->driver_lock, flags); |
1850 | if (adapter->intcounter || adapter->currenttxskb) | 1812 | if (adapter->intcounter || adapter->currenttxskb) |
1851 | lbs_pr_debug(1, "SEND_SLEEPC_CMD: intcounter=%d currenttxskb=%p\n", | 1813 | lbs_deb_cmd("SEND_SLEEPC_CMD: intcounter=%d currenttxskb=%p\n", |
1852 | adapter->intcounter, adapter->currenttxskb); | 1814 | adapter->intcounter, adapter->currenttxskb); |
1853 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 1815 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
1854 | 1816 | ||
@@ -1860,23 +1822,22 @@ static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size) | |||
1860 | if (!adapter->intcounter) { | 1822 | if (!adapter->intcounter) { |
1861 | adapter->psstate = PS_STATE_SLEEP; | 1823 | adapter->psstate = PS_STATE_SLEEP; |
1862 | } else { | 1824 | } else { |
1863 | lbs_pr_debug(1, "SEND_SLEEPC_CMD: After sent,IntC=%d\n", | 1825 | lbs_deb_cmd("SEND_SLEEPC_CMD: After sent,IntC=%d\n", |
1864 | adapter->intcounter); | 1826 | adapter->intcounter); |
1865 | } | 1827 | } |
1866 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 1828 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
1867 | 1829 | ||
1868 | lbs_pr_debug(1, "SEND_SLEEPC_CMD: Sent Confirm Sleep command\n"); | 1830 | lbs_deb_cmd("SEND_SLEEPC_CMD: Sent Confirm Sleep command\n"); |
1869 | lbs_pr_debug(1, "+"); | 1831 | lbs_deb_cmd("+"); |
1870 | } | 1832 | } |
1871 | 1833 | ||
1872 | LEAVE(); | 1834 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); |
1873 | return ret; | 1835 | return ret; |
1874 | } | 1836 | } |
1875 | 1837 | ||
1876 | void libertas_ps_sleep(wlan_private * priv, int wait_option) | 1838 | void libertas_ps_sleep(wlan_private * priv, int wait_option) |
1877 | { | 1839 | { |
1878 | 1840 | lbs_deb_enter(LBS_DEB_CMD); | |
1879 | ENTER(); | ||
1880 | 1841 | ||
1881 | /* | 1842 | /* |
1882 | * PS is currently supported only in Infrastructure mode | 1843 | * PS is currently supported only in Infrastructure mode |
@@ -1886,8 +1847,7 @@ void libertas_ps_sleep(wlan_private * priv, int wait_option) | |||
1886 | libertas_prepare_and_send_command(priv, cmd_802_11_ps_mode, | 1847 | libertas_prepare_and_send_command(priv, cmd_802_11_ps_mode, |
1887 | cmd_subcmd_enter_ps, wait_option, 0, NULL); | 1848 | cmd_subcmd_enter_ps, wait_option, 0, NULL); |
1888 | 1849 | ||
1889 | LEAVE(); | 1850 | lbs_deb_leave(LBS_DEB_CMD); |
1890 | return; | ||
1891 | } | 1851 | } |
1892 | 1852 | ||
1893 | /** | 1853 | /** |
@@ -1899,20 +1859,19 @@ void libertas_ps_sleep(wlan_private * priv, int wait_option) | |||
1899 | */ | 1859 | */ |
1900 | void libertas_ps_wakeup(wlan_private * priv, int wait_option) | 1860 | void libertas_ps_wakeup(wlan_private * priv, int wait_option) |
1901 | { | 1861 | { |
1902 | enum WLAN_802_11_POWER_MODE Localpsmode; | 1862 | __le32 Localpsmode; |
1903 | 1863 | ||
1904 | ENTER(); | 1864 | lbs_deb_enter(LBS_DEB_CMD); |
1905 | 1865 | ||
1906 | Localpsmode = wlan802_11powermodecam; | 1866 | Localpsmode = cpu_to_le32(wlan802_11powermodecam); |
1907 | 1867 | ||
1908 | lbs_pr_debug(1, "Exit_PS: Localpsmode = %d\n", Localpsmode); | 1868 | lbs_deb_cmd("Exit_PS: Localpsmode = %d\n", wlan802_11powermodecam); |
1909 | 1869 | ||
1910 | libertas_prepare_and_send_command(priv, cmd_802_11_ps_mode, | 1870 | libertas_prepare_and_send_command(priv, cmd_802_11_ps_mode, |
1911 | cmd_subcmd_exit_ps, | 1871 | cmd_subcmd_exit_ps, |
1912 | wait_option, 0, &Localpsmode); | 1872 | wait_option, 0, &Localpsmode); |
1913 | 1873 | ||
1914 | LEAVE(); | 1874 | lbs_deb_leave(LBS_DEB_CMD); |
1915 | return; | ||
1916 | } | 1875 | } |
1917 | 1876 | ||
1918 | /** | 1877 | /** |
@@ -1929,31 +1888,31 @@ void libertas_ps_confirm_sleep(wlan_private * priv, u16 psmode) | |||
1929 | wlan_adapter *adapter = priv->adapter; | 1888 | wlan_adapter *adapter = priv->adapter; |
1930 | u8 allowed = 1; | 1889 | u8 allowed = 1; |
1931 | 1890 | ||
1932 | ENTER(); | 1891 | lbs_deb_enter(LBS_DEB_CMD); |
1933 | 1892 | ||
1934 | if (priv->wlan_dev.dnld_sent) { | 1893 | if (priv->dnld_sent) { |
1935 | allowed = 0; | 1894 | allowed = 0; |
1936 | lbs_pr_debug(1, "D"); | 1895 | lbs_deb_cmd("D"); |
1937 | } | 1896 | } |
1938 | 1897 | ||
1939 | spin_lock_irqsave(&adapter->driver_lock, flags); | 1898 | spin_lock_irqsave(&adapter->driver_lock, flags); |
1940 | if (adapter->cur_cmd) { | 1899 | if (adapter->cur_cmd) { |
1941 | allowed = 0; | 1900 | allowed = 0; |
1942 | lbs_pr_debug(1, "C"); | 1901 | lbs_deb_cmd("C"); |
1943 | } | 1902 | } |
1944 | if (adapter->intcounter > 0) { | 1903 | if (adapter->intcounter > 0) { |
1945 | allowed = 0; | 1904 | allowed = 0; |
1946 | lbs_pr_debug(1, "I%d", adapter->intcounter); | 1905 | lbs_deb_cmd("I%d", adapter->intcounter); |
1947 | } | 1906 | } |
1948 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 1907 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
1949 | 1908 | ||
1950 | if (allowed) { | 1909 | if (allowed) { |
1951 | lbs_pr_debug(1, "Sending libertas_ps_confirm_sleep\n"); | 1910 | lbs_deb_cmd("Sending libertas_ps_confirm_sleep\n"); |
1952 | sendconfirmsleep(priv, (u8 *) & adapter->libertas_ps_confirm_sleep, | 1911 | sendconfirmsleep(priv, (u8 *) & adapter->libertas_ps_confirm_sleep, |
1953 | sizeof(struct PS_CMD_ConfirmSleep)); | 1912 | sizeof(struct PS_CMD_ConfirmSleep)); |
1954 | } else { | 1913 | } else { |
1955 | lbs_pr_debug(1, "Sleep Confirm has been delayed\n"); | 1914 | lbs_deb_cmd("Sleep Confirm has been delayed\n"); |
1956 | } | 1915 | } |
1957 | 1916 | ||
1958 | LEAVE(); | 1917 | lbs_deb_leave(LBS_DEB_CMD); |
1959 | } | 1918 | } |
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index c86454034b58..0c3b9a583d83 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c | |||
@@ -9,7 +9,6 @@ | |||
9 | #include <net/iw_handler.h> | 9 | #include <net/iw_handler.h> |
10 | 10 | ||
11 | #include "host.h" | 11 | #include "host.h" |
12 | #include "sbi.h" | ||
13 | #include "decl.h" | 12 | #include "decl.h" |
14 | #include "defs.h" | 13 | #include "defs.h" |
15 | #include "dev.h" | 14 | #include "dev.h" |
@@ -32,7 +31,7 @@ void libertas_mac_event_disconnected(wlan_private * priv) | |||
32 | if (adapter->connect_status != libertas_connected) | 31 | if (adapter->connect_status != libertas_connected) |
33 | return; | 32 | return; |
34 | 33 | ||
35 | lbs_pr_debug(1, "Handles disconnect event.\n"); | 34 | lbs_deb_cmd("Handles disconnect event.\n"); |
36 | 35 | ||
37 | memset(wrqu.ap_addr.sa_data, 0x00, ETH_ALEN); | 36 | memset(wrqu.ap_addr.sa_data, 0x00, ETH_ALEN); |
38 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; | 37 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
@@ -43,15 +42,15 @@ void libertas_mac_event_disconnected(wlan_private * priv) | |||
43 | */ | 42 | */ |
44 | 43 | ||
45 | msleep_interruptible(1000); | 44 | msleep_interruptible(1000); |
46 | wireless_send_event(priv->wlan_dev.netdev, SIOCGIWAP, &wrqu, NULL); | 45 | wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); |
47 | 46 | ||
48 | /* Free Tx and Rx packets */ | 47 | /* Free Tx and Rx packets */ |
49 | kfree_skb(priv->adapter->currenttxskb); | 48 | kfree_skb(priv->adapter->currenttxskb); |
50 | priv->adapter->currenttxskb = NULL; | 49 | priv->adapter->currenttxskb = NULL; |
51 | 50 | ||
52 | /* report disconnect to upper layer */ | 51 | /* report disconnect to upper layer */ |
53 | netif_stop_queue(priv->wlan_dev.netdev); | 52 | netif_stop_queue(priv->dev); |
54 | netif_carrier_off(priv->wlan_dev.netdev); | 53 | netif_carrier_off(priv->dev); |
55 | 54 | ||
56 | /* reset SNR/NF/RSSI values */ | 55 | /* reset SNR/NF/RSSI values */ |
57 | memset(adapter->SNR, 0x00, sizeof(adapter->SNR)); | 56 | memset(adapter->SNR, 0x00, sizeof(adapter->SNR)); |
@@ -62,35 +61,32 @@ void libertas_mac_event_disconnected(wlan_private * priv) | |||
62 | adapter->nextSNRNF = 0; | 61 | adapter->nextSNRNF = 0; |
63 | adapter->numSNRNF = 0; | 62 | adapter->numSNRNF = 0; |
64 | adapter->rxpd_rate = 0; | 63 | adapter->rxpd_rate = 0; |
65 | lbs_pr_debug(1, "Current SSID=%s, ssid length=%u\n", | 64 | lbs_deb_cmd("Current SSID='%s', ssid length=%u\n", |
66 | adapter->curbssparams.ssid.ssid, | 65 | escape_essid(adapter->curbssparams.ssid, |
67 | adapter->curbssparams.ssid.ssidlength); | 66 | adapter->curbssparams.ssid_len), |
68 | lbs_pr_debug(1, "Previous SSID=%s, ssid length=%u\n", | 67 | adapter->curbssparams.ssid_len); |
69 | adapter->previousssid.ssid, adapter->previousssid.ssidlength); | 68 | lbs_deb_cmd("Previous SSID='%s', ssid length=%u\n", |
70 | 69 | escape_essid(adapter->prev_ssid, adapter->prev_ssid_len), | |
71 | /* reset internal flags */ | 70 | adapter->prev_ssid_len); |
72 | adapter->secinfo.WPAenabled = 0; | ||
73 | adapter->secinfo.WPA2enabled = 0; | ||
74 | adapter->wpa_ie_len = 0; | ||
75 | 71 | ||
76 | adapter->connect_status = libertas_disconnected; | 72 | adapter->connect_status = libertas_disconnected; |
77 | 73 | ||
78 | /* | 74 | /* Save previous SSID and BSSID for possible reassociation */ |
79 | * memorize the previous SSID and BSSID | 75 | memcpy(&adapter->prev_ssid, &adapter->curbssparams.ssid, |
80 | * it could be used for re-assoc | 76 | IW_ESSID_MAX_SIZE); |
81 | */ | 77 | adapter->prev_ssid_len = adapter->curbssparams.ssid_len; |
82 | memcpy(&adapter->previousssid, | 78 | memcpy(adapter->prev_bssid, adapter->curbssparams.bssid, ETH_ALEN); |
83 | &adapter->curbssparams.ssid, sizeof(struct WLAN_802_11_SSID)); | ||
84 | memcpy(adapter->previousbssid, | ||
85 | adapter->curbssparams.bssid, ETH_ALEN); | ||
86 | 79 | ||
87 | /* need to erase the current SSID and BSSID info */ | 80 | /* Clear out associated SSID and BSSID since connection is |
88 | adapter->pattemptedbssdesc = NULL; | 81 | * no longer valid. |
89 | memset(&adapter->curbssparams, 0, sizeof(adapter->curbssparams)); | 82 | */ |
83 | memset(&adapter->curbssparams.bssid, 0, ETH_ALEN); | ||
84 | memset(&adapter->curbssparams.ssid, 0, IW_ESSID_MAX_SIZE); | ||
85 | adapter->curbssparams.ssid_len = 0; | ||
90 | 86 | ||
91 | if (adapter->psstate != PS_STATE_FULL_POWER) { | 87 | if (adapter->psstate != PS_STATE_FULL_POWER) { |
92 | /* make firmware to exit PS mode */ | 88 | /* make firmware to exit PS mode */ |
93 | lbs_pr_debug(1, "Disconnected, so exit PS mode.\n"); | 89 | lbs_deb_cmd("Disconnected, so exit PS mode.\n"); |
94 | libertas_ps_wakeup(priv, 0); | 90 | libertas_ps_wakeup(priv, 0); |
95 | } | 91 | } |
96 | } | 92 | } |
@@ -122,55 +118,45 @@ static void handle_mic_failureevent(wlan_private * priv, u32 event) | |||
122 | static int wlan_ret_reg_access(wlan_private * priv, | 118 | static int wlan_ret_reg_access(wlan_private * priv, |
123 | u16 type, struct cmd_ds_command *resp) | 119 | u16 type, struct cmd_ds_command *resp) |
124 | { | 120 | { |
121 | int ret = 0; | ||
125 | wlan_adapter *adapter = priv->adapter; | 122 | wlan_adapter *adapter = priv->adapter; |
126 | 123 | ||
127 | ENTER(); | 124 | lbs_deb_enter(LBS_DEB_CMD); |
128 | 125 | ||
129 | switch (type) { | 126 | switch (type) { |
130 | case cmd_ret_mac_reg_access: | 127 | case cmd_ret_mac_reg_access: |
131 | { | 128 | { |
132 | struct cmd_ds_mac_reg_access *reg; | 129 | struct cmd_ds_mac_reg_access *reg = &resp->params.macreg; |
133 | |||
134 | reg = | ||
135 | (struct cmd_ds_mac_reg_access *)&resp->params. | ||
136 | macreg; | ||
137 | 130 | ||
138 | adapter->offsetvalue.offset = reg->offset; | 131 | adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); |
139 | adapter->offsetvalue.value = reg->value; | 132 | adapter->offsetvalue.value = le32_to_cpu(reg->value); |
140 | break; | 133 | break; |
141 | } | 134 | } |
142 | 135 | ||
143 | case cmd_ret_bbp_reg_access: | 136 | case cmd_ret_bbp_reg_access: |
144 | { | 137 | { |
145 | struct cmd_ds_bbp_reg_access *reg; | 138 | struct cmd_ds_bbp_reg_access *reg = &resp->params.bbpreg; |
146 | reg = | ||
147 | (struct cmd_ds_bbp_reg_access *)&resp->params. | ||
148 | bbpreg; | ||
149 | 139 | ||
150 | adapter->offsetvalue.offset = reg->offset; | 140 | adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); |
151 | adapter->offsetvalue.value = reg->value; | 141 | adapter->offsetvalue.value = reg->value; |
152 | break; | 142 | break; |
153 | } | 143 | } |
154 | 144 | ||
155 | case cmd_ret_rf_reg_access: | 145 | case cmd_ret_rf_reg_access: |
156 | { | 146 | { |
157 | struct cmd_ds_rf_reg_access *reg; | 147 | struct cmd_ds_rf_reg_access *reg = &resp->params.rfreg; |
158 | reg = | ||
159 | (struct cmd_ds_rf_reg_access *)&resp->params. | ||
160 | rfreg; | ||
161 | 148 | ||
162 | adapter->offsetvalue.offset = reg->offset; | 149 | adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); |
163 | adapter->offsetvalue.value = reg->value; | 150 | adapter->offsetvalue.value = reg->value; |
164 | break; | 151 | break; |
165 | } | 152 | } |
166 | 153 | ||
167 | default: | 154 | default: |
168 | LEAVE(); | 155 | ret = -1; |
169 | return -1; | ||
170 | } | 156 | } |
171 | 157 | ||
172 | LEAVE(); | 158 | lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret); |
173 | return 0; | 159 | return ret; |
174 | } | 160 | } |
175 | 161 | ||
176 | static int wlan_ret_get_hw_spec(wlan_private * priv, | 162 | static int wlan_ret_get_hw_spec(wlan_private * priv, |
@@ -181,19 +167,20 @@ static int wlan_ret_get_hw_spec(wlan_private * priv, | |||
181 | wlan_adapter *adapter = priv->adapter; | 167 | wlan_adapter *adapter = priv->adapter; |
182 | int ret = 0; | 168 | int ret = 0; |
183 | 169 | ||
184 | ENTER(); | 170 | lbs_deb_enter(LBS_DEB_CMD); |
185 | 171 | ||
186 | adapter->fwcapinfo = le32_to_cpu(hwspec->fwcapinfo); | 172 | adapter->fwcapinfo = le32_to_cpu(hwspec->fwcapinfo); |
187 | 173 | ||
188 | adapter->fwreleasenumber = hwspec->fwreleasenumber; | 174 | memcpy(adapter->fwreleasenumber, hwspec->fwreleasenumber, 4); |
189 | 175 | ||
190 | lbs_pr_debug(1, "GET_HW_SPEC: FWReleaseVersion- 0x%X\n", | 176 | lbs_deb_cmd("GET_HW_SPEC: FWReleaseVersion- %u.%u.%u.p%u\n", |
191 | adapter->fwreleasenumber); | 177 | adapter->fwreleasenumber[2], adapter->fwreleasenumber[1], |
192 | lbs_pr_debug(1, "GET_HW_SPEC: Permanent addr- %2x:%2x:%2x:%2x:%2x:%2x\n", | 178 | adapter->fwreleasenumber[0], adapter->fwreleasenumber[3]); |
179 | lbs_deb_cmd("GET_HW_SPEC: Permanent addr- %2x:%2x:%2x:%2x:%2x:%2x\n", | ||
193 | hwspec->permanentaddr[0], hwspec->permanentaddr[1], | 180 | hwspec->permanentaddr[0], hwspec->permanentaddr[1], |
194 | hwspec->permanentaddr[2], hwspec->permanentaddr[3], | 181 | hwspec->permanentaddr[2], hwspec->permanentaddr[3], |
195 | hwspec->permanentaddr[4], hwspec->permanentaddr[5]); | 182 | hwspec->permanentaddr[4], hwspec->permanentaddr[5]); |
196 | lbs_pr_debug(1, "GET_HW_SPEC: hwifversion=0x%X version=0x%X\n", | 183 | lbs_deb_cmd("GET_HW_SPEC: hwifversion=0x%X version=0x%X\n", |
197 | hwspec->hwifversion, hwspec->version); | 184 | hwspec->hwifversion, hwspec->version); |
198 | 185 | ||
199 | adapter->regioncode = le16_to_cpu(hwspec->regioncode); | 186 | adapter->regioncode = le16_to_cpu(hwspec->regioncode); |
@@ -210,17 +197,15 @@ static int wlan_ret_get_hw_spec(wlan_private * priv, | |||
210 | if (i >= MRVDRV_MAX_REGION_CODE) { | 197 | if (i >= MRVDRV_MAX_REGION_CODE) { |
211 | adapter->regioncode = 0x10; | 198 | adapter->regioncode = 0x10; |
212 | adapter->regiontableindex = 0; | 199 | adapter->regiontableindex = 0; |
213 | lbs_pr_info( | 200 | lbs_pr_info("unidentified region code; using the default (USA)\n"); |
214 | "unidentified region code, use the default (USA)\n"); | ||
215 | } | 201 | } |
216 | 202 | ||
217 | if (adapter->current_addr[0] == 0xff) { | 203 | if (adapter->current_addr[0] == 0xff) |
218 | memmove(adapter->current_addr, hwspec->permanentaddr, | 204 | memmove(adapter->current_addr, hwspec->permanentaddr, ETH_ALEN); |
219 | ETH_ALEN); | ||
220 | } | ||
221 | 205 | ||
222 | memcpy(priv->wlan_dev.netdev->dev_addr, adapter->current_addr, ETH_ALEN); | 206 | memcpy(priv->dev->dev_addr, adapter->current_addr, ETH_ALEN); |
223 | memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN); | 207 | if (priv->mesh_dev) |
208 | memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN); | ||
224 | 209 | ||
225 | if (libertas_set_regiontable(priv, adapter->regioncode, 0)) { | 210 | if (libertas_set_regiontable(priv, adapter->regioncode, 0)) { |
226 | ret = -1; | 211 | ret = -1; |
@@ -232,8 +217,8 @@ static int wlan_ret_get_hw_spec(wlan_private * priv, | |||
232 | goto done; | 217 | goto done; |
233 | } | 218 | } |
234 | 219 | ||
235 | done: | 220 | done: |
236 | LEAVE(); | 221 | lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret); |
237 | return ret; | 222 | return ret; |
238 | } | 223 | } |
239 | 224 | ||
@@ -243,19 +228,21 @@ static int wlan_ret_802_11_sleep_params(wlan_private * priv, | |||
243 | struct cmd_ds_802_11_sleep_params *sp = &resp->params.sleep_params; | 228 | struct cmd_ds_802_11_sleep_params *sp = &resp->params.sleep_params; |
244 | wlan_adapter *adapter = priv->adapter; | 229 | wlan_adapter *adapter = priv->adapter; |
245 | 230 | ||
246 | ENTER(); | 231 | lbs_deb_enter(LBS_DEB_CMD); |
232 | |||
233 | lbs_deb_cmd("error=%x offset=%x stabletime=%x calcontrol=%x\n" | ||
234 | " extsleepclk=%x\n", le16_to_cpu(sp->error), | ||
235 | le16_to_cpu(sp->offset), le16_to_cpu(sp->stabletime), | ||
236 | sp->calcontrol, sp->externalsleepclk); | ||
247 | 237 | ||
248 | lbs_pr_debug(1, "error=%x offset=%x stabletime=%x calcontrol=%x\n" | ||
249 | " extsleepclk=%x\n", sp->error, sp->offset, | ||
250 | sp->stabletime, sp->calcontrol, sp->externalsleepclk); | ||
251 | adapter->sp.sp_error = le16_to_cpu(sp->error); | 238 | adapter->sp.sp_error = le16_to_cpu(sp->error); |
252 | adapter->sp.sp_offset = le16_to_cpu(sp->offset); | 239 | adapter->sp.sp_offset = le16_to_cpu(sp->offset); |
253 | adapter->sp.sp_stabletime = le16_to_cpu(sp->stabletime); | 240 | adapter->sp.sp_stabletime = le16_to_cpu(sp->stabletime); |
254 | adapter->sp.sp_calcontrol = le16_to_cpu(sp->calcontrol); | 241 | adapter->sp.sp_calcontrol = sp->calcontrol; |
255 | adapter->sp.sp_extsleepclk = le16_to_cpu(sp->externalsleepclk); | 242 | adapter->sp.sp_extsleepclk = sp->externalsleepclk; |
256 | adapter->sp.sp_reserved = le16_to_cpu(sp->reserved); | 243 | adapter->sp.sp_reserved = le16_to_cpu(sp->reserved); |
257 | 244 | ||
258 | LEAVE(); | 245 | lbs_deb_enter(LBS_DEB_CMD); |
259 | return 0; | 246 | return 0; |
260 | } | 247 | } |
261 | 248 | ||
@@ -281,42 +268,38 @@ static int wlan_ret_802_11_snmp_mib(wlan_private * priv, | |||
281 | u16 oid = le16_to_cpu(smib->oid); | 268 | u16 oid = le16_to_cpu(smib->oid); |
282 | u16 querytype = le16_to_cpu(smib->querytype); | 269 | u16 querytype = le16_to_cpu(smib->querytype); |
283 | 270 | ||
284 | ENTER(); | 271 | lbs_deb_enter(LBS_DEB_CMD); |
285 | 272 | ||
286 | lbs_pr_debug(1, "SNMP_RESP: value of the oid = %x, querytype=%x\n", oid, | 273 | lbs_deb_cmd("SNMP_RESP: value of the oid = %x, querytype=%x\n", oid, |
287 | querytype); | 274 | querytype); |
288 | lbs_pr_debug(1, "SNMP_RESP: Buf size = %x\n", | 275 | lbs_deb_cmd("SNMP_RESP: Buf size = %x\n", le16_to_cpu(smib->bufsize)); |
289 | le16_to_cpu(smib->bufsize)); | ||
290 | 276 | ||
291 | if (querytype == cmd_act_get) { | 277 | if (querytype == cmd_act_get) { |
292 | switch (oid) { | 278 | switch (oid) { |
293 | case fragthresh_i: | 279 | case fragthresh_i: |
294 | priv->adapter->fragthsd = | 280 | priv->adapter->fragthsd = |
295 | le16_to_cpu(* | 281 | le16_to_cpu(*((__le16 *)(smib->value))); |
296 | ((unsigned short *)(smib->value))); | 282 | lbs_deb_cmd("SNMP_RESP: fragthsd =%u\n", |
297 | lbs_pr_debug(1, "SNMP_RESP: fragthsd =%u\n", | 283 | priv->adapter->fragthsd); |
298 | priv->adapter->fragthsd); | ||
299 | break; | 284 | break; |
300 | case rtsthresh_i: | 285 | case rtsthresh_i: |
301 | priv->adapter->rtsthsd = | 286 | priv->adapter->rtsthsd = |
302 | le16_to_cpu(* | 287 | le16_to_cpu(*((__le16 *)(smib->value))); |
303 | ((unsigned short *)(smib->value))); | 288 | lbs_deb_cmd("SNMP_RESP: rtsthsd =%u\n", |
304 | lbs_pr_debug(1, "SNMP_RESP: rtsthsd =%u\n", | 289 | priv->adapter->rtsthsd); |
305 | priv->adapter->rtsthsd); | ||
306 | break; | 290 | break; |
307 | case short_retrylim_i: | 291 | case short_retrylim_i: |
308 | priv->adapter->txretrycount = | 292 | priv->adapter->txretrycount = |
309 | le16_to_cpu(* | 293 | le16_to_cpu(*((__le16 *)(smib->value))); |
310 | ((unsigned short *)(smib->value))); | 294 | lbs_deb_cmd("SNMP_RESP: txretrycount =%u\n", |
311 | lbs_pr_debug(1, "SNMP_RESP: txretrycount =%u\n", | 295 | priv->adapter->rtsthsd); |
312 | priv->adapter->rtsthsd); | ||
313 | break; | 296 | break; |
314 | default: | 297 | default: |
315 | break; | 298 | break; |
316 | } | 299 | } |
317 | } | 300 | } |
318 | 301 | ||
319 | LEAVE(); | 302 | lbs_deb_enter(LBS_DEB_CMD); |
320 | return 0; | 303 | return 0; |
321 | } | 304 | } |
322 | 305 | ||
@@ -328,7 +311,7 @@ static int wlan_ret_802_11_key_material(wlan_private * priv, | |||
328 | wlan_adapter *adapter = priv->adapter; | 311 | wlan_adapter *adapter = priv->adapter; |
329 | u16 action = le16_to_cpu(pkeymaterial->action); | 312 | u16 action = le16_to_cpu(pkeymaterial->action); |
330 | 313 | ||
331 | ENTER(); | 314 | lbs_deb_enter(LBS_DEB_CMD); |
332 | 315 | ||
333 | /* Copy the returned key to driver private data */ | 316 | /* Copy the returned key to driver private data */ |
334 | if (action == cmd_act_get) { | 317 | if (action == cmd_act_get) { |
@@ -371,7 +354,7 @@ static int wlan_ret_802_11_key_material(wlan_private * priv, | |||
371 | } | 354 | } |
372 | } | 355 | } |
373 | 356 | ||
374 | LEAVE(); | 357 | lbs_deb_enter(LBS_DEB_CMD); |
375 | return 0; | 358 | return 0; |
376 | } | 359 | } |
377 | 360 | ||
@@ -381,11 +364,11 @@ static int wlan_ret_802_11_mac_address(wlan_private * priv, | |||
381 | struct cmd_ds_802_11_mac_address *macadd = &resp->params.macadd; | 364 | struct cmd_ds_802_11_mac_address *macadd = &resp->params.macadd; |
382 | wlan_adapter *adapter = priv->adapter; | 365 | wlan_adapter *adapter = priv->adapter; |
383 | 366 | ||
384 | ENTER(); | 367 | lbs_deb_enter(LBS_DEB_CMD); |
385 | 368 | ||
386 | memcpy(adapter->current_addr, macadd->macadd, ETH_ALEN); | 369 | memcpy(adapter->current_addr, macadd->macadd, ETH_ALEN); |
387 | 370 | ||
388 | LEAVE(); | 371 | lbs_deb_enter(LBS_DEB_CMD); |
389 | return 0; | 372 | return 0; |
390 | } | 373 | } |
391 | 374 | ||
@@ -395,13 +378,13 @@ static int wlan_ret_802_11_rf_tx_power(wlan_private * priv, | |||
395 | struct cmd_ds_802_11_rf_tx_power *rtp = &resp->params.txp; | 378 | struct cmd_ds_802_11_rf_tx_power *rtp = &resp->params.txp; |
396 | wlan_adapter *adapter = priv->adapter; | 379 | wlan_adapter *adapter = priv->adapter; |
397 | 380 | ||
398 | ENTER(); | 381 | lbs_deb_enter(LBS_DEB_CMD); |
399 | 382 | ||
400 | adapter->txpowerlevel = le16_to_cpu(rtp->currentlevel); | 383 | adapter->txpowerlevel = le16_to_cpu(rtp->currentlevel); |
401 | 384 | ||
402 | lbs_pr_debug(1, "Current TxPower Level = %d\n", adapter->txpowerlevel); | 385 | lbs_deb_cmd("Current TxPower Level = %d\n", adapter->txpowerlevel); |
403 | 386 | ||
404 | LEAVE(); | 387 | lbs_deb_enter(LBS_DEB_CMD); |
405 | return 0; | 388 | return 0; |
406 | } | 389 | } |
407 | 390 | ||
@@ -413,14 +396,12 @@ static int wlan_ret_802_11_rf_antenna(wlan_private * priv, | |||
413 | u16 action = le16_to_cpu(pAntenna->action); | 396 | u16 action = le16_to_cpu(pAntenna->action); |
414 | 397 | ||
415 | if (action == cmd_act_get_rx) | 398 | if (action == cmd_act_get_rx) |
416 | adapter->rxantennamode = | 399 | adapter->rxantennamode = le16_to_cpu(pAntenna->antennamode); |
417 | le16_to_cpu(pAntenna->antennamode); | ||
418 | 400 | ||
419 | if (action == cmd_act_get_tx) | 401 | if (action == cmd_act_get_tx) |
420 | adapter->txantennamode = | 402 | adapter->txantennamode = le16_to_cpu(pAntenna->antennamode); |
421 | le16_to_cpu(pAntenna->antennamode); | ||
422 | 403 | ||
423 | lbs_pr_debug(1, "RF_ANT_RESP: action = 0x%x, mode = 0x%04x\n", | 404 | lbs_deb_cmd("RF_ANT_RESP: action = 0x%x, mode = 0x%04x\n", |
424 | action, le16_to_cpu(pAntenna->antennamode)); | 405 | action, le16_to_cpu(pAntenna->antennamode)); |
425 | 406 | ||
426 | return 0; | 407 | return 0; |
@@ -429,19 +410,17 @@ static int wlan_ret_802_11_rf_antenna(wlan_private * priv, | |||
429 | static int wlan_ret_802_11_rate_adapt_rateset(wlan_private * priv, | 410 | static int wlan_ret_802_11_rate_adapt_rateset(wlan_private * priv, |
430 | struct cmd_ds_command *resp) | 411 | struct cmd_ds_command *resp) |
431 | { | 412 | { |
432 | struct cmd_ds_802_11_rate_adapt_rateset *rates = | 413 | struct cmd_ds_802_11_rate_adapt_rateset *rates = &resp->params.rateset; |
433 | &resp->params.rateset; | ||
434 | wlan_adapter *adapter = priv->adapter; | 414 | wlan_adapter *adapter = priv->adapter; |
435 | 415 | ||
436 | ENTER(); | 416 | lbs_deb_enter(LBS_DEB_CMD); |
437 | 417 | ||
438 | if (rates->action == cmd_act_get) { | 418 | if (rates->action == cmd_act_get) { |
439 | adapter->enablehwauto = rates->enablehwauto; | 419 | adapter->enablehwauto = le16_to_cpu(rates->enablehwauto); |
440 | adapter->ratebitmap = rates->bitmap; | 420 | adapter->ratebitmap = le16_to_cpu(rates->bitmap); |
441 | } | 421 | } |
442 | 422 | ||
443 | LEAVE(); | 423 | lbs_deb_enter(LBS_DEB_CMD); |
444 | |||
445 | return 0; | 424 | return 0; |
446 | } | 425 | } |
447 | 426 | ||
@@ -452,43 +431,42 @@ static int wlan_ret_802_11_data_rate(wlan_private * priv, | |||
452 | wlan_adapter *adapter = priv->adapter; | 431 | wlan_adapter *adapter = priv->adapter; |
453 | u8 dot11datarate; | 432 | u8 dot11datarate; |
454 | 433 | ||
455 | ENTER(); | 434 | lbs_deb_enter(LBS_DEB_CMD); |
456 | 435 | ||
457 | lbs_dbg_hex("DATA_RATE_RESP: data_rate- ", | 436 | lbs_dbg_hex("DATA_RATE_RESP: data_rate- ", |
458 | (u8 *) pdatarate, sizeof(struct cmd_ds_802_11_data_rate)); | 437 | (u8 *) pdatarate, sizeof(struct cmd_ds_802_11_data_rate)); |
459 | 438 | ||
460 | dot11datarate = pdatarate->datarate[0]; | 439 | dot11datarate = pdatarate->datarate[0]; |
461 | if (pdatarate->action == cmd_act_get_tx_rate) { | 440 | if (pdatarate->action == cpu_to_le16(cmd_act_get_tx_rate)) { |
462 | memcpy(adapter->libertas_supported_rates, pdatarate->datarate, | 441 | memcpy(adapter->libertas_supported_rates, pdatarate->datarate, |
463 | sizeof(adapter->libertas_supported_rates)); | 442 | sizeof(adapter->libertas_supported_rates)); |
464 | } | 443 | } |
465 | adapter->datarate = libertas_index_to_data_rate(dot11datarate); | 444 | adapter->datarate = libertas_index_to_data_rate(dot11datarate); |
466 | 445 | ||
467 | LEAVE(); | 446 | lbs_deb_enter(LBS_DEB_CMD); |
468 | return 0; | 447 | return 0; |
469 | } | 448 | } |
470 | 449 | ||
471 | static int wlan_ret_802_11_rf_channel(wlan_private * priv, | 450 | static int wlan_ret_802_11_rf_channel(wlan_private * priv, |
472 | struct cmd_ds_command *resp) | 451 | struct cmd_ds_command *resp) |
473 | { | 452 | { |
474 | struct cmd_ds_802_11_rf_channel *rfchannel = | 453 | struct cmd_ds_802_11_rf_channel *rfchannel = &resp->params.rfchannel; |
475 | &resp->params.rfchannel; | ||
476 | wlan_adapter *adapter = priv->adapter; | 454 | wlan_adapter *adapter = priv->adapter; |
477 | u16 action = le16_to_cpu(rfchannel->action); | 455 | u16 action = le16_to_cpu(rfchannel->action); |
478 | u16 newchannel = le16_to_cpu(rfchannel->currentchannel); | 456 | u16 newchannel = le16_to_cpu(rfchannel->currentchannel); |
479 | 457 | ||
480 | ENTER(); | 458 | lbs_deb_enter(LBS_DEB_CMD); |
481 | 459 | ||
482 | if (action == cmd_opt_802_11_rf_channel_get | 460 | if (action == cmd_opt_802_11_rf_channel_get |
483 | && adapter->curbssparams.channel != newchannel) { | 461 | && adapter->curbssparams.channel != newchannel) { |
484 | lbs_pr_debug(1, "channel Switch: %d to %d\n", | 462 | lbs_deb_cmd("channel Switch: %d to %d\n", |
485 | adapter->curbssparams.channel, newchannel); | 463 | adapter->curbssparams.channel, newchannel); |
486 | 464 | ||
487 | /* Update the channel again */ | 465 | /* Update the channel again */ |
488 | adapter->curbssparams.channel = newchannel; | 466 | adapter->curbssparams.channel = newchannel; |
489 | } | 467 | } |
490 | 468 | ||
491 | LEAVE(); | 469 | lbs_deb_enter(LBS_DEB_CMD); |
492 | return 0; | 470 | return 0; |
493 | } | 471 | } |
494 | 472 | ||
@@ -500,12 +478,10 @@ static int wlan_ret_802_11_rssi(wlan_private * priv, | |||
500 | 478 | ||
501 | /* store the non average value */ | 479 | /* store the non average value */ |
502 | adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->SNR); | 480 | adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->SNR); |
503 | adapter->NF[TYPE_BEACON][TYPE_NOAVG] = | 481 | adapter->NF[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->noisefloor); |
504 | le16_to_cpu(rssirsp->noisefloor); | ||
505 | 482 | ||
506 | adapter->SNR[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgSNR); | 483 | adapter->SNR[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgSNR); |
507 | adapter->NF[TYPE_BEACON][TYPE_AVG] = | 484 | adapter->NF[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgnoisefloor); |
508 | le16_to_cpu(rssirsp->avgnoisefloor); | ||
509 | 485 | ||
510 | adapter->RSSI[TYPE_BEACON][TYPE_NOAVG] = | 486 | adapter->RSSI[TYPE_BEACON][TYPE_NOAVG] = |
511 | CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_NOAVG], | 487 | CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_NOAVG], |
@@ -515,7 +491,7 @@ static int wlan_ret_802_11_rssi(wlan_private * priv, | |||
515 | CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_AVG] / AVG_SCALE, | 491 | CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_AVG] / AVG_SCALE, |
516 | adapter->NF[TYPE_BEACON][TYPE_AVG] / AVG_SCALE); | 492 | adapter->NF[TYPE_BEACON][TYPE_AVG] / AVG_SCALE); |
517 | 493 | ||
518 | lbs_pr_debug(1, "Beacon RSSI value = 0x%x\n", | 494 | lbs_deb_cmd("Beacon RSSI value = 0x%x\n", |
519 | adapter->RSSI[TYPE_BEACON][TYPE_AVG]); | 495 | adapter->RSSI[TYPE_BEACON][TYPE_AVG]); |
520 | 496 | ||
521 | return 0; | 497 | return 0; |
@@ -528,11 +504,11 @@ static int wlan_ret_802_11_eeprom_access(wlan_private * priv, | |||
528 | struct wlan_ioctl_regrdwr *pbuf; | 504 | struct wlan_ioctl_regrdwr *pbuf; |
529 | pbuf = (struct wlan_ioctl_regrdwr *) adapter->prdeeprom; | 505 | pbuf = (struct wlan_ioctl_regrdwr *) adapter->prdeeprom; |
530 | 506 | ||
531 | lbs_pr_debug(1, "eeprom read len=%x\n", | 507 | lbs_deb_cmd("eeprom read len=%x\n", |
532 | le16_to_cpu(resp->params.rdeeprom.bytecount)); | 508 | le16_to_cpu(resp->params.rdeeprom.bytecount)); |
533 | if (pbuf->NOB < le16_to_cpu(resp->params.rdeeprom.bytecount)) { | 509 | if (pbuf->NOB < le16_to_cpu(resp->params.rdeeprom.bytecount)) { |
534 | pbuf->NOB = 0; | 510 | pbuf->NOB = 0; |
535 | lbs_pr_debug(1, "eeprom read return length is too big\n"); | 511 | lbs_deb_cmd("eeprom read return length is too big\n"); |
536 | return -1; | 512 | return -1; |
537 | } | 513 | } |
538 | pbuf->NOB = le16_to_cpu(resp->params.rdeeprom.bytecount); | 514 | pbuf->NOB = le16_to_cpu(resp->params.rdeeprom.bytecount); |
@@ -549,17 +525,15 @@ static int wlan_ret_802_11_eeprom_access(wlan_private * priv, | |||
549 | static int wlan_ret_get_log(wlan_private * priv, | 525 | static int wlan_ret_get_log(wlan_private * priv, |
550 | struct cmd_ds_command *resp) | 526 | struct cmd_ds_command *resp) |
551 | { | 527 | { |
552 | struct cmd_ds_802_11_get_log *logmessage = | 528 | struct cmd_ds_802_11_get_log *logmessage = &resp->params.glog; |
553 | (struct cmd_ds_802_11_get_log *)&resp->params.glog; | ||
554 | wlan_adapter *adapter = priv->adapter; | 529 | wlan_adapter *adapter = priv->adapter; |
555 | 530 | ||
556 | ENTER(); | 531 | lbs_deb_enter(LBS_DEB_CMD); |
557 | 532 | ||
558 | /* TODO Convert it to Big Endian before copy */ | 533 | /* Stored little-endian */ |
559 | memcpy(&adapter->logmsg, logmessage, | 534 | memcpy(&adapter->logmsg, logmessage, sizeof(struct cmd_ds_802_11_get_log)); |
560 | sizeof(struct cmd_ds_802_11_get_log)); | ||
561 | 535 | ||
562 | LEAVE(); | 536 | lbs_deb_enter(LBS_DEB_CMD); |
563 | return 0; | 537 | return 0; |
564 | } | 538 | } |
565 | 539 | ||
@@ -620,8 +594,7 @@ static inline int handle_cmd_response(u16 respcmd, | |||
620 | case cmd_ret_802_11_set_afc: | 594 | case cmd_ret_802_11_set_afc: |
621 | case cmd_ret_802_11_get_afc: | 595 | case cmd_ret_802_11_get_afc: |
622 | spin_lock_irqsave(&adapter->driver_lock, flags); | 596 | spin_lock_irqsave(&adapter->driver_lock, flags); |
623 | memmove(adapter->cur_cmd->pdata_buf, | 597 | memmove(adapter->cur_cmd->pdata_buf, &resp->params.afc, |
624 | &resp->params.afc, | ||
625 | sizeof(struct cmd_ds_802_11_afc)); | 598 | sizeof(struct cmd_ds_802_11_afc)); |
626 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 599 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
627 | 600 | ||
@@ -663,7 +636,7 @@ static inline int handle_cmd_response(u16 respcmd, | |||
663 | break; | 636 | break; |
664 | 637 | ||
665 | case cmd_ret_802_11_key_material: | 638 | case cmd_ret_802_11_key_material: |
666 | lbs_pr_debug(1, "CMD_RESP: KEY_MATERIAL command response\n"); | 639 | lbs_deb_cmd("CMD_RESP: KEY_MATERIAL command response\n"); |
667 | ret = wlan_ret_802_11_key_material(priv, resp); | 640 | ret = wlan_ret_802_11_key_material(priv, resp); |
668 | break; | 641 | break; |
669 | 642 | ||
@@ -687,22 +660,19 @@ static inline int handle_cmd_response(u16 respcmd, | |||
687 | 660 | ||
688 | case cmd_ret_802_11_tpc_cfg: | 661 | case cmd_ret_802_11_tpc_cfg: |
689 | spin_lock_irqsave(&adapter->driver_lock, flags); | 662 | spin_lock_irqsave(&adapter->driver_lock, flags); |
690 | memmove(adapter->cur_cmd->pdata_buf, | 663 | memmove(adapter->cur_cmd->pdata_buf, &resp->params.tpccfg, |
691 | &resp->params.tpccfg, | ||
692 | sizeof(struct cmd_ds_802_11_tpc_cfg)); | 664 | sizeof(struct cmd_ds_802_11_tpc_cfg)); |
693 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 665 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
694 | break; | 666 | break; |
695 | case cmd_ret_802_11_led_gpio_ctrl: | 667 | case cmd_ret_802_11_led_gpio_ctrl: |
696 | spin_lock_irqsave(&adapter->driver_lock, flags); | 668 | spin_lock_irqsave(&adapter->driver_lock, flags); |
697 | memmove(adapter->cur_cmd->pdata_buf, | 669 | memmove(adapter->cur_cmd->pdata_buf, &resp->params.ledgpio, |
698 | &resp->params.ledgpio, | ||
699 | sizeof(struct cmd_ds_802_11_led_ctrl)); | 670 | sizeof(struct cmd_ds_802_11_led_ctrl)); |
700 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 671 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
701 | break; | 672 | break; |
702 | case cmd_ret_802_11_pwr_cfg: | 673 | case cmd_ret_802_11_pwr_cfg: |
703 | spin_lock_irqsave(&adapter->driver_lock, flags); | 674 | spin_lock_irqsave(&adapter->driver_lock, flags); |
704 | memmove(adapter->cur_cmd->pdata_buf, | 675 | memmove(adapter->cur_cmd->pdata_buf, &resp->params.pwrcfg, |
705 | &resp->params.pwrcfg, | ||
706 | sizeof(struct cmd_ds_802_11_pwr_cfg)); | 676 | sizeof(struct cmd_ds_802_11_pwr_cfg)); |
707 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 677 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
708 | 678 | ||
@@ -724,23 +694,21 @@ static inline int handle_cmd_response(u16 respcmd, | |||
724 | case cmd_ret_fwt_access: | 694 | case cmd_ret_fwt_access: |
725 | spin_lock_irqsave(&adapter->driver_lock, flags); | 695 | spin_lock_irqsave(&adapter->driver_lock, flags); |
726 | if (adapter->cur_cmd->pdata_buf) | 696 | if (adapter->cur_cmd->pdata_buf) |
727 | memcpy(adapter->cur_cmd->pdata_buf, | 697 | memcpy(adapter->cur_cmd->pdata_buf, &resp->params.fwt, |
728 | &resp->params.fwt, | 698 | sizeof(resp->params.fwt)); |
729 | sizeof(resp->params.fwt)); | ||
730 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 699 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
731 | break; | 700 | break; |
732 | case cmd_ret_mesh_access: | 701 | case cmd_ret_mesh_access: |
733 | if (adapter->cur_cmd->pdata_buf) | 702 | if (adapter->cur_cmd->pdata_buf) |
734 | memcpy(adapter->cur_cmd->pdata_buf, | 703 | memcpy(adapter->cur_cmd->pdata_buf, &resp->params.mesh, |
735 | &resp->params.mesh, | ||
736 | sizeof(resp->params.mesh)); | 704 | sizeof(resp->params.mesh)); |
737 | break; | 705 | break; |
738 | case cmd_rte_802_11_tx_rate_query: | 706 | case cmd_rte_802_11_tx_rate_query: |
739 | priv->adapter->txrate = resp->params.txrate.txrate; | 707 | priv->adapter->txrate = resp->params.txrate.txrate; |
740 | break; | 708 | break; |
741 | default: | 709 | default: |
742 | lbs_pr_debug(1, "CMD_RESP: Unknown command response %#x\n", | 710 | lbs_deb_cmd("CMD_RESP: Unknown command response %#x\n", |
743 | resp->command); | 711 | resp->command); |
744 | break; | 712 | break; |
745 | } | 713 | } |
746 | return ret; | 714 | return ret; |
@@ -755,9 +723,9 @@ int libertas_process_rx_command(wlan_private * priv) | |||
755 | ulong flags; | 723 | ulong flags; |
756 | u16 result; | 724 | u16 result; |
757 | 725 | ||
758 | ENTER(); | 726 | lbs_deb_enter(LBS_DEB_CMD); |
759 | 727 | ||
760 | lbs_pr_debug(1, "CMD_RESP: @ %lu\n", jiffies); | 728 | lbs_deb_cmd("CMD_RESP: @ %lu\n", jiffies); |
761 | 729 | ||
762 | /* Now we got response from FW, cancel the command timer */ | 730 | /* Now we got response from FW, cancel the command timer */ |
763 | del_timer(&adapter->command_timer); | 731 | del_timer(&adapter->command_timer); |
@@ -766,7 +734,7 @@ int libertas_process_rx_command(wlan_private * priv) | |||
766 | spin_lock_irqsave(&adapter->driver_lock, flags); | 734 | spin_lock_irqsave(&adapter->driver_lock, flags); |
767 | 735 | ||
768 | if (!adapter->cur_cmd) { | 736 | if (!adapter->cur_cmd) { |
769 | lbs_pr_debug(1, "CMD_RESP: NULL cur_cmd=%p\n", adapter->cur_cmd); | 737 | lbs_deb_cmd("CMD_RESP: NULL cur_cmd=%p\n", adapter->cur_cmd); |
770 | ret = -1; | 738 | ret = -1; |
771 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 739 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
772 | goto done; | 740 | goto done; |
@@ -774,17 +742,17 @@ int libertas_process_rx_command(wlan_private * priv) | |||
774 | resp = (struct cmd_ds_command *)(adapter->cur_cmd->bufvirtualaddr); | 742 | resp = (struct cmd_ds_command *)(adapter->cur_cmd->bufvirtualaddr); |
775 | 743 | ||
776 | lbs_dbg_hex("CMD_RESP:", adapter->cur_cmd->bufvirtualaddr, | 744 | lbs_dbg_hex("CMD_RESP:", adapter->cur_cmd->bufvirtualaddr, |
777 | priv->wlan_dev.upld_len); | 745 | priv->upld_len); |
778 | 746 | ||
779 | respcmd = le16_to_cpu(resp->command); | 747 | respcmd = le16_to_cpu(resp->command); |
780 | 748 | ||
781 | result = le16_to_cpu(resp->result); | 749 | result = le16_to_cpu(resp->result); |
782 | 750 | ||
783 | lbs_pr_debug(1, "CMD_RESP: %x result: %d length: %d\n", respcmd, | 751 | lbs_deb_cmd("CMD_RESP: %x result: %d length: %d\n", respcmd, |
784 | result, priv->wlan_dev.upld_len); | 752 | result, priv->upld_len); |
785 | 753 | ||
786 | if (!(respcmd & 0x8000)) { | 754 | if (!(respcmd & 0x8000)) { |
787 | lbs_pr_debug(1, "Invalid response to command!"); | 755 | lbs_deb_cmd("Invalid response to command!"); |
788 | adapter->cur_cmd_retcode = -1; | 756 | adapter->cur_cmd_retcode = -1; |
789 | __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd); | 757 | __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd); |
790 | adapter->nr_cmd_pending--; | 758 | adapter->nr_cmd_pending--; |
@@ -795,56 +763,52 @@ int libertas_process_rx_command(wlan_private * priv) | |||
795 | } | 763 | } |
796 | 764 | ||
797 | /* Store the response code to cur_cmd_retcode. */ | 765 | /* Store the response code to cur_cmd_retcode. */ |
798 | adapter->cur_cmd_retcode = le16_to_cpu(resp->result); | 766 | adapter->cur_cmd_retcode = result;; |
799 | 767 | ||
800 | if (respcmd == cmd_ret_802_11_ps_mode) { | 768 | if (respcmd == cmd_ret_802_11_ps_mode) { |
801 | struct cmd_ds_802_11_ps_mode *psmode; | 769 | struct cmd_ds_802_11_ps_mode *psmode = &resp->params.psmode; |
770 | u16 action = le16_to_cpu(psmode->action); | ||
802 | 771 | ||
803 | psmode = &resp->params.psmode; | 772 | lbs_deb_cmd( |
804 | lbs_pr_debug(1, | ||
805 | "CMD_RESP: PS_MODE cmd reply result=%#x action=0x%X\n", | 773 | "CMD_RESP: PS_MODE cmd reply result=%#x action=0x%X\n", |
806 | resp->result, psmode->action); | 774 | result, action); |
807 | psmode->action = cpu_to_le16(psmode->action); | ||
808 | 775 | ||
809 | if (result) { | 776 | if (result) { |
810 | lbs_pr_debug(1, "CMD_RESP: PS command failed- %#x \n", | 777 | lbs_deb_cmd("CMD_RESP: PS command failed- %#x \n", |
811 | resp->result); | 778 | result); |
812 | if (adapter->mode == IW_MODE_ADHOC) { | 779 | /* |
813 | /* | 780 | * We should not re-try enter-ps command in |
814 | * We should not re-try enter-ps command in | 781 | * ad-hoc mode. It takes place in |
815 | * ad-hoc mode. It takes place in | 782 | * libertas_execute_next_command(). |
816 | * libertas_execute_next_command(). | 783 | */ |
817 | */ | 784 | if (adapter->mode == IW_MODE_ADHOC && |
818 | if (psmode->action == cmd_subcmd_enter_ps) | 785 | action == cmd_subcmd_enter_ps) |
819 | adapter->psmode = | 786 | adapter->psmode = wlan802_11powermodecam; |
820 | wlan802_11powermodecam; | 787 | } else if (action == cmd_subcmd_enter_ps) { |
821 | } | ||
822 | } else if (psmode->action == cmd_subcmd_enter_ps) { | ||
823 | adapter->needtowakeup = 0; | 788 | adapter->needtowakeup = 0; |
824 | adapter->psstate = PS_STATE_AWAKE; | 789 | adapter->psstate = PS_STATE_AWAKE; |
825 | 790 | ||
826 | lbs_pr_debug(1, "CMD_RESP: Enter_PS command response\n"); | 791 | lbs_deb_cmd("CMD_RESP: Enter_PS command response\n"); |
827 | if (adapter->connect_status != libertas_connected) { | 792 | if (adapter->connect_status != libertas_connected) { |
828 | /* | 793 | /* |
829 | * When Deauth Event received before Enter_PS command | 794 | * When Deauth Event received before Enter_PS command |
830 | * response, We need to wake up the firmware. | 795 | * response, We need to wake up the firmware. |
831 | */ | 796 | */ |
832 | lbs_pr_debug(1, | 797 | lbs_deb_cmd( |
833 | "Disconnected, Going to invoke libertas_ps_wakeup\n"); | 798 | "Disconnected, Going to invoke libertas_ps_wakeup\n"); |
834 | 799 | ||
835 | mutex_unlock(&adapter->lock); | ||
836 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 800 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
801 | mutex_unlock(&adapter->lock); | ||
837 | libertas_ps_wakeup(priv, 0); | 802 | libertas_ps_wakeup(priv, 0); |
838 | mutex_lock(&adapter->lock); | 803 | mutex_lock(&adapter->lock); |
839 | spin_lock_irqsave(&adapter->driver_lock, flags); | 804 | spin_lock_irqsave(&adapter->driver_lock, flags); |
840 | } | 805 | } |
841 | } else if (psmode->action == cmd_subcmd_exit_ps) { | 806 | } else if (action == cmd_subcmd_exit_ps) { |
842 | adapter->needtowakeup = 0; | 807 | adapter->needtowakeup = 0; |
843 | adapter->psstate = PS_STATE_FULL_POWER; | 808 | adapter->psstate = PS_STATE_FULL_POWER; |
844 | lbs_pr_debug(1, "CMD_RESP: Exit_PS command response\n"); | 809 | lbs_deb_cmd("CMD_RESP: Exit_PS command response\n"); |
845 | } else { | 810 | } else { |
846 | lbs_pr_debug(1, "CMD_RESP: PS- action=0x%X\n", | 811 | lbs_deb_cmd("CMD_RESP: PS- action=0x%X\n", action); |
847 | psmode->action); | ||
848 | } | 812 | } |
849 | 813 | ||
850 | __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd); | 814 | __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd); |
@@ -865,15 +829,15 @@ int libertas_process_rx_command(wlan_private * priv) | |||
865 | 829 | ||
866 | /* If the command is not successful, cleanup and return failure */ | 830 | /* If the command is not successful, cleanup and return failure */ |
867 | if ((result != 0 || !(respcmd & 0x8000))) { | 831 | if ((result != 0 || !(respcmd & 0x8000))) { |
868 | lbs_pr_debug(1, "CMD_RESP: command reply %#x result=%#x\n", | 832 | lbs_deb_cmd("CMD_RESP: command reply %#x result=%#x\n", |
869 | resp->command, resp->result); | 833 | respcmd, result); |
870 | /* | 834 | /* |
871 | * Handling errors here | 835 | * Handling errors here |
872 | */ | 836 | */ |
873 | switch (respcmd) { | 837 | switch (respcmd) { |
874 | case cmd_ret_hw_spec_info: | 838 | case cmd_ret_hw_spec_info: |
875 | case cmd_ret_802_11_reset: | 839 | case cmd_ret_802_11_reset: |
876 | lbs_pr_debug(1, "CMD_RESP: Reset command failed\n"); | 840 | lbs_deb_cmd("CMD_RESP: Reset command failed\n"); |
877 | break; | 841 | break; |
878 | 842 | ||
879 | } | 843 | } |
@@ -903,7 +867,7 @@ int libertas_process_rx_command(wlan_private * priv) | |||
903 | 867 | ||
904 | done: | 868 | done: |
905 | mutex_unlock(&adapter->lock); | 869 | mutex_unlock(&adapter->lock); |
906 | LEAVE(); | 870 | lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret); |
907 | return ret; | 871 | return ret; |
908 | } | 872 | } |
909 | 873 | ||
@@ -917,37 +881,37 @@ int libertas_process_event(wlan_private * priv) | |||
917 | eventcause = adapter->eventcause; | 881 | eventcause = adapter->eventcause; |
918 | spin_unlock_irq(&adapter->driver_lock); | 882 | spin_unlock_irq(&adapter->driver_lock); |
919 | 883 | ||
920 | ENTER(); | 884 | lbs_deb_enter(LBS_DEB_CMD); |
921 | 885 | ||
922 | lbs_pr_debug(1, "EVENT Cause %x\n", eventcause); | 886 | lbs_deb_cmd("EVENT Cause %x\n", eventcause); |
923 | 887 | ||
924 | switch (eventcause >> SBI_EVENT_CAUSE_SHIFT) { | 888 | switch (eventcause >> SBI_EVENT_CAUSE_SHIFT) { |
925 | case MACREG_INT_CODE_LINK_SENSED: | 889 | case MACREG_INT_CODE_LINK_SENSED: |
926 | lbs_pr_debug(1, "EVENT: MACREG_INT_CODE_LINK_SENSED\n"); | 890 | lbs_deb_cmd("EVENT: MACREG_INT_CODE_LINK_SENSED\n"); |
927 | break; | 891 | break; |
928 | 892 | ||
929 | case MACREG_INT_CODE_DEAUTHENTICATED: | 893 | case MACREG_INT_CODE_DEAUTHENTICATED: |
930 | lbs_pr_debug(1, "EVENT: Deauthenticated\n"); | 894 | lbs_deb_cmd("EVENT: Deauthenticated\n"); |
931 | libertas_mac_event_disconnected(priv); | 895 | libertas_mac_event_disconnected(priv); |
932 | break; | 896 | break; |
933 | 897 | ||
934 | case MACREG_INT_CODE_DISASSOCIATED: | 898 | case MACREG_INT_CODE_DISASSOCIATED: |
935 | lbs_pr_debug(1, "EVENT: Disassociated\n"); | 899 | lbs_deb_cmd("EVENT: Disassociated\n"); |
936 | libertas_mac_event_disconnected(priv); | 900 | libertas_mac_event_disconnected(priv); |
937 | break; | 901 | break; |
938 | 902 | ||
939 | case MACREG_INT_CODE_LINK_LOSE_NO_SCAN: | 903 | case MACREG_INT_CODE_LINK_LOSE_NO_SCAN: |
940 | lbs_pr_debug(1, "EVENT: Link lost\n"); | 904 | lbs_deb_cmd("EVENT: Link lost\n"); |
941 | libertas_mac_event_disconnected(priv); | 905 | libertas_mac_event_disconnected(priv); |
942 | break; | 906 | break; |
943 | 907 | ||
944 | case MACREG_INT_CODE_PS_SLEEP: | 908 | case MACREG_INT_CODE_PS_SLEEP: |
945 | lbs_pr_debug(1, "EVENT: SLEEP\n"); | 909 | lbs_deb_cmd("EVENT: SLEEP\n"); |
946 | lbs_pr_debug(1, "_"); | 910 | lbs_deb_cmd("_"); |
947 | 911 | ||
948 | /* handle unexpected PS SLEEP event */ | 912 | /* handle unexpected PS SLEEP event */ |
949 | if (adapter->psstate == PS_STATE_FULL_POWER) { | 913 | if (adapter->psstate == PS_STATE_FULL_POWER) { |
950 | lbs_pr_debug(1, | 914 | lbs_deb_cmd( |
951 | "EVENT: In FULL POWER mode - ignore PS SLEEP\n"); | 915 | "EVENT: In FULL POWER mode - ignore PS SLEEP\n"); |
952 | break; | 916 | break; |
953 | } | 917 | } |
@@ -958,12 +922,12 @@ int libertas_process_event(wlan_private * priv) | |||
958 | break; | 922 | break; |
959 | 923 | ||
960 | case MACREG_INT_CODE_PS_AWAKE: | 924 | case MACREG_INT_CODE_PS_AWAKE: |
961 | lbs_pr_debug(1, "EVENT: AWAKE \n"); | 925 | lbs_deb_cmd("EVENT: AWAKE \n"); |
962 | lbs_pr_debug(1, "|"); | 926 | lbs_deb_cmd("|"); |
963 | 927 | ||
964 | /* handle unexpected PS AWAKE event */ | 928 | /* handle unexpected PS AWAKE event */ |
965 | if (adapter->psstate == PS_STATE_FULL_POWER) { | 929 | if (adapter->psstate == PS_STATE_FULL_POWER) { |
966 | lbs_pr_debug(1, | 930 | lbs_deb_cmd( |
967 | "EVENT: In FULL POWER mode - ignore PS AWAKE\n"); | 931 | "EVENT: In FULL POWER mode - ignore PS AWAKE\n"); |
968 | break; | 932 | break; |
969 | } | 933 | } |
@@ -977,18 +941,18 @@ int libertas_process_event(wlan_private * priv) | |||
977 | * adapter->needtowakeup will be set to FALSE | 941 | * adapter->needtowakeup will be set to FALSE |
978 | * in libertas_ps_wakeup() | 942 | * in libertas_ps_wakeup() |
979 | */ | 943 | */ |
980 | lbs_pr_debug(1, "Waking up...\n"); | 944 | lbs_deb_cmd("Waking up...\n"); |
981 | libertas_ps_wakeup(priv, 0); | 945 | libertas_ps_wakeup(priv, 0); |
982 | } | 946 | } |
983 | break; | 947 | break; |
984 | 948 | ||
985 | case MACREG_INT_CODE_MIC_ERR_UNICAST: | 949 | case MACREG_INT_CODE_MIC_ERR_UNICAST: |
986 | lbs_pr_debug(1, "EVENT: UNICAST MIC ERROR\n"); | 950 | lbs_deb_cmd("EVENT: UNICAST MIC ERROR\n"); |
987 | handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_UNICAST); | 951 | handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_UNICAST); |
988 | break; | 952 | break; |
989 | 953 | ||
990 | case MACREG_INT_CODE_MIC_ERR_MULTICAST: | 954 | case MACREG_INT_CODE_MIC_ERR_MULTICAST: |
991 | lbs_pr_debug(1, "EVENT: MULTICAST MIC ERROR\n"); | 955 | lbs_deb_cmd("EVENT: MULTICAST MIC ERROR\n"); |
992 | handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_MULTICAST); | 956 | handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_MULTICAST); |
993 | break; | 957 | break; |
994 | case MACREG_INT_CODE_MIB_CHANGED: | 958 | case MACREG_INT_CODE_MIB_CHANGED: |
@@ -996,7 +960,7 @@ int libertas_process_event(wlan_private * priv) | |||
996 | break; | 960 | break; |
997 | 961 | ||
998 | case MACREG_INT_CODE_ADHOC_BCN_LOST: | 962 | case MACREG_INT_CODE_ADHOC_BCN_LOST: |
999 | lbs_pr_debug(1, "EVENT: HWAC - ADHOC BCN LOST\n"); | 963 | lbs_deb_cmd("EVENT: HWAC - ADHOC BCN LOST\n"); |
1000 | break; | 964 | break; |
1001 | 965 | ||
1002 | case MACREG_INT_CODE_RSSI_LOW: | 966 | case MACREG_INT_CODE_RSSI_LOW: |
@@ -1015,6 +979,17 @@ int libertas_process_event(wlan_private * priv) | |||
1015 | lbs_pr_alert( "EVENT: SNR_HIGH\n"); | 979 | lbs_pr_alert( "EVENT: SNR_HIGH\n"); |
1016 | break; | 980 | break; |
1017 | 981 | ||
982 | case MACREG_INT_CODE_MESH_AUTO_STARTED: | ||
983 | lbs_pr_alert( "EVENT: MESH_AUTO_STARTED\n"); | ||
984 | adapter->connect_status = libertas_connected ; | ||
985 | if (priv->mesh_open == 1) { | ||
986 | netif_wake_queue(priv->mesh_dev) ; | ||
987 | netif_carrier_on(priv->mesh_dev) ; | ||
988 | } | ||
989 | adapter->mode = IW_MODE_ADHOC ; | ||
990 | schedule_work(&priv->sync_channel); | ||
991 | break; | ||
992 | |||
1018 | default: | 993 | default: |
1019 | lbs_pr_alert( "EVENT: unknown event id: %#x\n", | 994 | lbs_pr_alert( "EVENT: unknown event id: %#x\n", |
1020 | eventcause >> SBI_EVENT_CAUSE_SHIFT); | 995 | eventcause >> SBI_EVENT_CAUSE_SHIFT); |
@@ -1024,6 +999,7 @@ int libertas_process_event(wlan_private * priv) | |||
1024 | spin_lock_irq(&adapter->driver_lock); | 999 | spin_lock_irq(&adapter->driver_lock); |
1025 | adapter->eventcause = 0; | 1000 | adapter->eventcause = 0; |
1026 | spin_unlock_irq(&adapter->driver_lock); | 1001 | spin_unlock_irq(&adapter->driver_lock); |
1027 | LEAVE(); | 1002 | |
1003 | lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret); | ||
1028 | return ret; | 1004 | return ret; |
1029 | } | 1005 | } |
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index 7d7bc5e86a56..715cbdaa1d4b 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/delay.h> | 4 | #include <linux/delay.h> |
5 | #include <linux/mm.h> | 5 | #include <linux/mm.h> |
6 | #include <net/iw_handler.h> | 6 | #include <net/iw_handler.h> |
7 | |||
7 | #include "dev.h" | 8 | #include "dev.h" |
8 | #include "decl.h" | 9 | #include "decl.h" |
9 | #include "host.h" | 10 | #include "host.h" |
@@ -15,7 +16,9 @@ static char *szStates[] = { | |||
15 | "Disconnected" | 16 | "Disconnected" |
16 | }; | 17 | }; |
17 | 18 | ||
18 | void libertas_debug_init(wlan_private * priv, struct net_device *dev); | 19 | #ifdef PROC_DEBUG |
20 | static void libertas_debug_init(wlan_private * priv, struct net_device *dev); | ||
21 | #endif | ||
19 | 22 | ||
20 | static int open_file_generic(struct inode *inode, struct file *file) | 23 | static int open_file_generic(struct inode *inode, struct file *file) |
21 | { | 24 | { |
@@ -60,43 +63,33 @@ static ssize_t libertas_getscantable(struct file *file, char __user *userbuf, | |||
60 | int numscansdone = 0, res; | 63 | int numscansdone = 0, res; |
61 | unsigned long addr = get_zeroed_page(GFP_KERNEL); | 64 | unsigned long addr = get_zeroed_page(GFP_KERNEL); |
62 | char *buf = (char *)addr; | 65 | char *buf = (char *)addr; |
66 | struct bss_descriptor * iter_bss; | ||
63 | 67 | ||
64 | pos += snprintf(buf+pos, len-pos, | 68 | pos += snprintf(buf+pos, len-pos, |
65 | "---------------------------------------"); | ||
66 | pos += snprintf(buf+pos, len-pos, | ||
67 | "---------------------------------------\n"); | ||
68 | pos += snprintf(buf+pos, len-pos, | ||
69 | "# | ch | ss | bssid | cap | TSF | Qual | SSID \n"); | 69 | "# | ch | ss | bssid | cap | TSF | Qual | SSID \n"); |
70 | pos += snprintf(buf+pos, len-pos, | ||
71 | "---------------------------------------"); | ||
72 | pos += snprintf(buf+pos, len-pos, | ||
73 | "---------------------------------------\n"); | ||
74 | 70 | ||
75 | while (numscansdone < priv->adapter->numinscantable) { | 71 | mutex_lock(&priv->adapter->lock); |
76 | struct bss_descriptor *pbssinfo; | 72 | list_for_each_entry (iter_bss, &priv->adapter->network_list, list) { |
77 | u16 cap; | 73 | u16 cap; |
78 | 74 | ||
79 | pbssinfo = &priv->adapter->scantable[numscansdone]; | 75 | memcpy(&cap, &iter_bss->cap, sizeof(cap)); |
80 | memcpy(&cap, &pbssinfo->cap, sizeof(cap)); | ||
81 | pos += snprintf(buf+pos, len-pos, | 76 | pos += snprintf(buf+pos, len-pos, |
82 | "%02u| %03d | %03ld | %02x:%02x:%02x:%02x:%02x:%02x |", | 77 | "%02u| %03d | %03ld | " MAC_FMT " |", |
83 | numscansdone, pbssinfo->channel, pbssinfo->rssi, | 78 | numscansdone, iter_bss->channel, iter_bss->rssi, |
84 | pbssinfo->macaddress[0], pbssinfo->macaddress[1], | 79 | MAC_ARG(iter_bss->bssid)); |
85 | pbssinfo->macaddress[2], pbssinfo->macaddress[3], | ||
86 | pbssinfo->macaddress[4], pbssinfo->macaddress[5]); | ||
87 | pos += snprintf(buf+pos, len-pos, " %04x-", cap); | 80 | pos += snprintf(buf+pos, len-pos, " %04x-", cap); |
88 | pos += snprintf(buf+pos, len-pos, "%c%c%c |", | 81 | pos += snprintf(buf+pos, len-pos, "%c%c%c |", |
89 | pbssinfo->cap.ibss ? 'A' : 'I', | 82 | iter_bss->cap.ibss ? 'A' : 'I', |
90 | pbssinfo->cap.privacy ? 'P' : ' ', | 83 | iter_bss->cap.privacy ? 'P' : ' ', |
91 | pbssinfo->cap.spectrummgmt ? 'S' : ' '); | 84 | iter_bss->cap.spectrummgmt ? 'S' : ' '); |
92 | pos += snprintf(buf+pos, len-pos, " %08llx |", pbssinfo->networktsf); | 85 | pos += snprintf(buf+pos, len-pos, " %08llx |", iter_bss->networktsf); |
93 | pos += snprintf(buf+pos, len-pos, " %d |", | 86 | pos += snprintf(buf+pos, len-pos, " %d |", SCAN_RSSI(iter_bss->rssi)); |
94 | SCAN_RSSI(priv->adapter->scantable[numscansdone].rssi)); | 87 | pos += snprintf(buf+pos, len-pos, " %s\n", |
95 | 88 | escape_essid(iter_bss->ssid, iter_bss->ssid_len)); | |
96 | pos += snprintf(buf+pos, len-pos, " %s\n", pbssinfo->ssid.ssid); | ||
97 | 89 | ||
98 | numscansdone++; | 90 | numscansdone++; |
99 | } | 91 | } |
92 | mutex_unlock(&priv->adapter->lock); | ||
100 | 93 | ||
101 | res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); | 94 | res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); |
102 | 95 | ||
@@ -111,7 +104,6 @@ static ssize_t libertas_sleepparams_write(struct file *file, | |||
111 | wlan_private *priv = file->private_data; | 104 | wlan_private *priv = file->private_data; |
112 | ssize_t buf_size, res; | 105 | ssize_t buf_size, res; |
113 | int p1, p2, p3, p4, p5, p6; | 106 | int p1, p2, p3, p4, p5, p6; |
114 | struct sleep_params sp; | ||
115 | unsigned long addr = get_zeroed_page(GFP_KERNEL); | 107 | unsigned long addr = get_zeroed_page(GFP_KERNEL); |
116 | char *buf = (char *)addr; | 108 | char *buf = (char *)addr; |
117 | 109 | ||
@@ -125,14 +117,12 @@ static ssize_t libertas_sleepparams_write(struct file *file, | |||
125 | res = -EFAULT; | 117 | res = -EFAULT; |
126 | goto out_unlock; | 118 | goto out_unlock; |
127 | } | 119 | } |
128 | sp.sp_error = p1; | 120 | priv->adapter->sp.sp_error = p1; |
129 | sp.sp_offset = p2; | 121 | priv->adapter->sp.sp_offset = p2; |
130 | sp.sp_stabletime = p3; | 122 | priv->adapter->sp.sp_stabletime = p3; |
131 | sp.sp_calcontrol = p4; | 123 | priv->adapter->sp.sp_calcontrol = p4; |
132 | sp.sp_extsleepclk = p5; | 124 | priv->adapter->sp.sp_extsleepclk = p5; |
133 | sp.sp_reserved = p6; | 125 | priv->adapter->sp.sp_reserved = p6; |
134 | |||
135 | memcpy(&priv->adapter->sp, &sp, sizeof(struct sleep_params)); | ||
136 | 126 | ||
137 | res = libertas_prepare_and_send_command(priv, | 127 | res = libertas_prepare_and_send_command(priv, |
138 | cmd_802_11_sleep_params, | 128 | cmd_802_11_sleep_params, |
@@ -185,7 +175,6 @@ static ssize_t libertas_extscan(struct file *file, const char __user *userbuf, | |||
185 | { | 175 | { |
186 | wlan_private *priv = file->private_data; | 176 | wlan_private *priv = file->private_data; |
187 | ssize_t res, buf_size; | 177 | ssize_t res, buf_size; |
188 | struct WLAN_802_11_SSID extscan_ssid; | ||
189 | union iwreq_data wrqu; | 178 | union iwreq_data wrqu; |
190 | unsigned long addr = get_zeroed_page(GFP_KERNEL); | 179 | unsigned long addr = get_zeroed_page(GFP_KERNEL); |
191 | char *buf = (char *)addr; | 180 | char *buf = (char *)addr; |
@@ -196,13 +185,10 @@ static ssize_t libertas_extscan(struct file *file, const char __user *userbuf, | |||
196 | goto out_unlock; | 185 | goto out_unlock; |
197 | } | 186 | } |
198 | 187 | ||
199 | memcpy(&extscan_ssid.ssid, buf, strlen(buf)-1); | 188 | libertas_send_specific_ssid_scan(priv, buf, strlen(buf)-1, 0); |
200 | extscan_ssid.ssidlength = strlen(buf)-1; | ||
201 | |||
202 | libertas_send_specific_SSID_scan(priv, &extscan_ssid, 1); | ||
203 | 189 | ||
204 | memset(&wrqu, 0, sizeof(union iwreq_data)); | 190 | memset(&wrqu, 0, sizeof(union iwreq_data)); |
205 | wireless_send_event(priv->wlan_dev.netdev, SIOCGIWSCAN, &wrqu, NULL); | 191 | wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL); |
206 | 192 | ||
207 | out_unlock: | 193 | out_unlock: |
208 | free_page(addr); | 194 | free_page(addr); |
@@ -251,16 +237,13 @@ static void libertas_parse_bssid(char *buf, size_t count, | |||
251 | { | 237 | { |
252 | char *hold; | 238 | char *hold; |
253 | unsigned int mac[ETH_ALEN]; | 239 | unsigned int mac[ETH_ALEN]; |
254 | int i; | ||
255 | 240 | ||
256 | hold = strstr(buf, "bssid="); | 241 | hold = strstr(buf, "bssid="); |
257 | if (!hold) | 242 | if (!hold) |
258 | return; | 243 | return; |
259 | hold += 6; | 244 | hold += 6; |
260 | sscanf(hold, "%2x:%2x:%2x:%2x:%2x:%2x", mac, mac+1, mac+2, mac+3, | 245 | sscanf(hold, MAC_FMT, mac, mac+1, mac+2, mac+3, mac+4, mac+5); |
261 | mac+4, mac+5); | 246 | memcpy(scan_cfg->bssid, mac, ETH_ALEN); |
262 | for(i=0;i<ETH_ALEN;i++) | ||
263 | scan_cfg->specificBSSID[i] = mac[i]; | ||
264 | } | 247 | } |
265 | 248 | ||
266 | static void libertas_parse_ssid(char *buf, size_t count, | 249 | static void libertas_parse_ssid(char *buf, size_t count, |
@@ -278,28 +261,26 @@ static void libertas_parse_ssid(char *buf, size_t count, | |||
278 | end = buf + count - 1; | 261 | end = buf + count - 1; |
279 | 262 | ||
280 | size = min((size_t)IW_ESSID_MAX_SIZE, (size_t) (end - hold)); | 263 | size = min((size_t)IW_ESSID_MAX_SIZE, (size_t) (end - hold)); |
281 | strncpy(scan_cfg->specificSSID, hold, size); | 264 | strncpy(scan_cfg->ssid, hold, size); |
282 | 265 | ||
283 | return; | 266 | return; |
284 | } | 267 | } |
285 | 268 | ||
286 | static void libertas_parse_keep(char *buf, size_t count, | 269 | static int libertas_parse_clear(char *buf, size_t count, const char *tag) |
287 | struct wlan_ioctl_user_scan_cfg *scan_cfg) | ||
288 | { | 270 | { |
289 | char *hold; | 271 | char *hold; |
290 | int val; | 272 | int val; |
291 | 273 | ||
292 | hold = strstr(buf, "keep="); | 274 | hold = strstr(buf, tag); |
293 | if (!hold) | 275 | if (!hold) |
294 | return; | 276 | return 0; |
295 | hold += 5; | 277 | hold += strlen(tag); |
296 | sscanf(hold, "%d", &val); | 278 | sscanf(hold, "%d", &val); |
297 | 279 | ||
298 | if (val != 0) | 280 | if (val != 0) |
299 | val = 1; | 281 | val = 1; |
300 | 282 | ||
301 | scan_cfg->keeppreviousscan = val; | 283 | return val; |
302 | return; | ||
303 | } | 284 | } |
304 | 285 | ||
305 | static int libertas_parse_dur(char *buf, size_t count, | 286 | static int libertas_parse_dur(char *buf, size_t count, |
@@ -382,17 +363,18 @@ static ssize_t libertas_setuserscan(struct file *file, | |||
382 | dur = libertas_parse_dur(buf, count, scan_cfg); | 363 | dur = libertas_parse_dur(buf, count, scan_cfg); |
383 | libertas_parse_chan(buf, count, scan_cfg, dur); | 364 | libertas_parse_chan(buf, count, scan_cfg, dur); |
384 | libertas_parse_bssid(buf, count, scan_cfg); | 365 | libertas_parse_bssid(buf, count, scan_cfg); |
366 | scan_cfg->clear_bssid = libertas_parse_clear(buf, count, "clear_bssid="); | ||
385 | libertas_parse_ssid(buf, count, scan_cfg); | 367 | libertas_parse_ssid(buf, count, scan_cfg); |
386 | libertas_parse_keep(buf, count, scan_cfg); | 368 | scan_cfg->clear_ssid = libertas_parse_clear(buf, count, "clear_ssid="); |
387 | libertas_parse_probes(buf, count, scan_cfg); | 369 | libertas_parse_probes(buf, count, scan_cfg); |
388 | libertas_parse_type(buf, count, scan_cfg); | 370 | libertas_parse_type(buf, count, scan_cfg); |
389 | 371 | ||
390 | wlan_scan_networks(priv, scan_cfg); | 372 | wlan_scan_networks(priv, scan_cfg, 1); |
391 | wait_event_interruptible(priv->adapter->cmd_pending, | 373 | wait_event_interruptible(priv->adapter->cmd_pending, |
392 | !priv->adapter->nr_cmd_pending); | 374 | !priv->adapter->nr_cmd_pending); |
393 | 375 | ||
394 | memset(&wrqu, 0x00, sizeof(union iwreq_data)); | 376 | memset(&wrqu, 0x00, sizeof(union iwreq_data)); |
395 | wireless_send_event(priv->wlan_dev.netdev, SIOCGIWSCAN, &wrqu, NULL); | 377 | wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL); |
396 | 378 | ||
397 | out_unlock: | 379 | out_unlock: |
398 | free_page(addr); | 380 | free_page(addr); |
@@ -407,11 +389,11 @@ static int libertas_event_initcmd(wlan_private *priv, void **response_buf, | |||
407 | u16 wait_option = cmd_option_waitforrsp; | 389 | u16 wait_option = cmd_option_waitforrsp; |
408 | 390 | ||
409 | if (!(*cmdnode = libertas_get_free_cmd_ctrl_node(priv))) { | 391 | if (!(*cmdnode = libertas_get_free_cmd_ctrl_node(priv))) { |
410 | lbs_pr_debug(1, "failed libertas_get_free_cmd_ctrl_node\n"); | 392 | lbs_deb_debugfs("failed libertas_get_free_cmd_ctrl_node\n"); |
411 | return -ENOMEM; | 393 | return -ENOMEM; |
412 | } | 394 | } |
413 | if (!(*response_buf = kmalloc(3000, GFP_KERNEL))) { | 395 | if (!(*response_buf = kmalloc(3000, GFP_KERNEL))) { |
414 | lbs_pr_debug(1, "failed to allocate response buffer!\n"); | 396 | lbs_deb_debugfs("failed to allocate response buffer!\n"); |
415 | return -ENOMEM; | 397 | return -ENOMEM; |
416 | } | 398 | } |
417 | libertas_set_cmd_ctrl_node(priv, *cmdnode, 0, wait_option, NULL); | 399 | libertas_set_cmd_ctrl_node(priv, *cmdnode, 0, wait_option, NULL); |
@@ -420,8 +402,8 @@ static int libertas_event_initcmd(wlan_private *priv, void **response_buf, | |||
420 | (*cmdnode)->cmdflags |= CMD_F_HOSTCMD; | 402 | (*cmdnode)->cmdflags |= CMD_F_HOSTCMD; |
421 | (*cmdnode)->cmdwaitqwoken = 0; | 403 | (*cmdnode)->cmdwaitqwoken = 0; |
422 | *cmd = (struct cmd_ds_command *)(*cmdnode)->bufvirtualaddr; | 404 | *cmd = (struct cmd_ds_command *)(*cmdnode)->bufvirtualaddr; |
423 | (*cmd)->command = cmd_802_11_subscribe_event; | 405 | (*cmd)->command = cpu_to_le16(cmd_802_11_subscribe_event); |
424 | (*cmd)->seqnum = ++priv->adapter->seqnum; | 406 | (*cmd)->seqnum = cpu_to_le16(++priv->adapter->seqnum); |
425 | (*cmd)->result = 0; | 407 | (*cmd)->result = 0; |
426 | return 0; | 408 | return 0; |
427 | } | 409 | } |
@@ -447,26 +429,25 @@ static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf, | |||
447 | } | 429 | } |
448 | 430 | ||
449 | event = &pcmdptr->params.subscribe_event; | 431 | event = &pcmdptr->params.subscribe_event; |
450 | event->action = cmd_act_get; | 432 | event->action = cpu_to_le16(cmd_act_get); |
451 | pcmdptr->size = | 433 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); |
452 | cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN); | ||
453 | libertas_queue_cmd(adapter, pcmdnode, 1); | 434 | libertas_queue_cmd(adapter, pcmdnode, 1); |
454 | wake_up_interruptible(&priv->mainthread.waitq); | 435 | wake_up_interruptible(&priv->mainthread.waitq); |
455 | 436 | ||
456 | /* Sleep until response is generated by FW */ | 437 | /* Sleep until response is generated by FW */ |
457 | wait_event_interruptible(pcmdnode->cmdwait_q, | 438 | wait_event_interruptible(pcmdnode->cmdwait_q, |
458 | pcmdnode->cmdwaitqwoken); | 439 | pcmdnode->cmdwaitqwoken); |
459 | 440 | ||
460 | pcmdptr = response_buf; | 441 | pcmdptr = response_buf; |
461 | if (pcmdptr->result) { | 442 | if (pcmdptr->result) { |
462 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 443 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
463 | pcmdptr->result); | 444 | le16_to_cpu(pcmdptr->result)); |
464 | kfree(response_buf); | 445 | kfree(response_buf); |
465 | free_page(addr); | 446 | free_page(addr); |
466 | return 0; | 447 | return 0; |
467 | } | 448 | } |
468 | 449 | ||
469 | if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { | 450 | if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { |
470 | lbs_pr_err("command response incorrect!\n"); | 451 | lbs_pr_err("command response incorrect!\n"); |
471 | kfree(response_buf); | 452 | kfree(response_buf); |
472 | free_page(addr); | 453 | free_page(addr); |
@@ -474,17 +455,17 @@ static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf, | |||
474 | } | 455 | } |
475 | 456 | ||
476 | cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); | 457 | cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); |
477 | event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); | 458 | event = (void *)(response_buf + S_DS_GEN); |
478 | while (cmd_len < pcmdptr->size) { | 459 | while (cmd_len < le16_to_cpu(pcmdptr->size)) { |
479 | struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); | 460 | struct mrvlietypesheader *header = (void *)(response_buf + cmd_len); |
480 | switch(header->type) { | 461 | switch (header->type) { |
481 | struct mrvlietypes_rssithreshold *Lowrssi; | 462 | struct mrvlietypes_rssithreshold *Lowrssi; |
482 | case TLV_TYPE_RSSI_LOW: | 463 | case __constant_cpu_to_le16(TLV_TYPE_RSSI_LOW): |
483 | Lowrssi = (struct mrvlietypes_rssithreshold *)(response_buf + cmd_len); | 464 | Lowrssi = (void *)(response_buf + cmd_len); |
484 | pos += snprintf(buf+pos, len-pos, "%d %d %d\n", | 465 | pos += snprintf(buf+pos, len-pos, "%d %d %d\n", |
485 | Lowrssi->rssivalue, | 466 | Lowrssi->rssivalue, |
486 | Lowrssi->rssifreq, | 467 | Lowrssi->rssifreq, |
487 | (event->events & 0x0001)?1:0); | 468 | (event->events & cpu_to_le16(0x0001))?1:0); |
488 | default: | 469 | default: |
489 | cmd_len += sizeof(struct mrvlietypes_snrthreshold); | 470 | cmd_len += sizeof(struct mrvlietypes_snrthreshold); |
490 | break; | 471 | break; |
@@ -512,21 +493,20 @@ static u16 libertas_get_events_bitmap(wlan_private *priv) | |||
512 | return res; | 493 | return res; |
513 | 494 | ||
514 | event = &pcmdptr->params.subscribe_event; | 495 | event = &pcmdptr->params.subscribe_event; |
515 | event->action = cmd_act_get; | 496 | event->action = cpu_to_le16(cmd_act_get); |
516 | pcmdptr->size = | 497 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); |
517 | cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN); | ||
518 | libertas_queue_cmd(adapter, pcmdnode, 1); | 498 | libertas_queue_cmd(adapter, pcmdnode, 1); |
519 | wake_up_interruptible(&priv->mainthread.waitq); | 499 | wake_up_interruptible(&priv->mainthread.waitq); |
520 | 500 | ||
521 | /* Sleep until response is generated by FW */ | 501 | /* Sleep until response is generated by FW */ |
522 | wait_event_interruptible(pcmdnode->cmdwait_q, | 502 | wait_event_interruptible(pcmdnode->cmdwait_q, |
523 | pcmdnode->cmdwaitqwoken); | 503 | pcmdnode->cmdwaitqwoken); |
524 | 504 | ||
525 | pcmdptr = response_buf; | 505 | pcmdptr = response_buf; |
526 | 506 | ||
527 | if (pcmdptr->result) { | 507 | if (pcmdptr->result) { |
528 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 508 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
529 | pcmdptr->result); | 509 | le16_to_cpu(pcmdptr->result)); |
530 | kfree(response_buf); | 510 | kfree(response_buf); |
531 | return 0; | 511 | return 0; |
532 | } | 512 | } |
@@ -538,7 +518,7 @@ static u16 libertas_get_events_bitmap(wlan_private *priv) | |||
538 | } | 518 | } |
539 | 519 | ||
540 | event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); | 520 | event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); |
541 | event_bitmap = event->events; | 521 | event_bitmap = le16_to_cpu(event->events); |
542 | kfree(response_buf); | 522 | kfree(response_buf); |
543 | return event_bitmap; | 523 | return event_bitmap; |
544 | } | 524 | } |
@@ -579,7 +559,7 @@ static ssize_t libertas_lowrssi_write(struct file *file, | |||
579 | goto out_unlock; | 559 | goto out_unlock; |
580 | 560 | ||
581 | event = &pcmdptr->params.subscribe_event; | 561 | event = &pcmdptr->params.subscribe_event; |
582 | event->action = cmd_act_set; | 562 | event->action = cpu_to_le16(cmd_act_set); |
583 | pcmdptr->size = cpu_to_le16(S_DS_GEN + | 563 | pcmdptr->size = cpu_to_le16(S_DS_GEN + |
584 | sizeof(struct cmd_ds_802_11_subscribe_event) + | 564 | sizeof(struct cmd_ds_802_11_subscribe_event) + |
585 | sizeof(struct mrvlietypes_rssithreshold)); | 565 | sizeof(struct mrvlietypes_rssithreshold)); |
@@ -588,30 +568,30 @@ static ssize_t libertas_lowrssi_write(struct file *file, | |||
588 | ptr = (u8*) pcmdptr+cmd_len; | 568 | ptr = (u8*) pcmdptr+cmd_len; |
589 | rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr); | 569 | rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr); |
590 | rssi_threshold->header.type = cpu_to_le16(0x0104); | 570 | rssi_threshold->header.type = cpu_to_le16(0x0104); |
591 | rssi_threshold->header.len = 2; | 571 | rssi_threshold->header.len = cpu_to_le16(2); |
592 | rssi_threshold->rssivalue = cpu_to_le16(value); | 572 | rssi_threshold->rssivalue = value; |
593 | rssi_threshold->rssifreq = cpu_to_le16(freq); | 573 | rssi_threshold->rssifreq = freq; |
594 | event_bitmap |= subscribed ? 0x0001 : 0x0; | 574 | event_bitmap |= subscribed ? 0x0001 : 0x0; |
595 | event->events = event_bitmap; | 575 | event->events = cpu_to_le16(event_bitmap); |
596 | 576 | ||
597 | libertas_queue_cmd(adapter, pcmdnode, 1); | 577 | libertas_queue_cmd(adapter, pcmdnode, 1); |
598 | wake_up_interruptible(&priv->mainthread.waitq); | 578 | wake_up_interruptible(&priv->mainthread.waitq); |
599 | 579 | ||
600 | /* Sleep until response is generated by FW */ | 580 | /* Sleep until response is generated by FW */ |
601 | wait_event_interruptible(pcmdnode->cmdwait_q, | 581 | wait_event_interruptible(pcmdnode->cmdwait_q, |
602 | pcmdnode->cmdwaitqwoken); | 582 | pcmdnode->cmdwaitqwoken); |
603 | 583 | ||
604 | pcmdptr = response_buf; | 584 | pcmdptr = response_buf; |
605 | 585 | ||
606 | if (pcmdptr->result) { | 586 | if (pcmdptr->result) { |
607 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 587 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
608 | pcmdptr->result); | 588 | le16_to_cpu(pcmdptr->result)); |
609 | kfree(response_buf); | 589 | kfree(response_buf); |
610 | free_page(addr); | 590 | free_page(addr); |
611 | return 0; | 591 | return 0; |
612 | } | 592 | } |
613 | 593 | ||
614 | if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { | 594 | if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { |
615 | lbs_pr_err("command response incorrect!\n"); | 595 | lbs_pr_err("command response incorrect!\n"); |
616 | kfree(response_buf); | 596 | kfree(response_buf); |
617 | free_page(addr); | 597 | free_page(addr); |
@@ -645,27 +625,26 @@ static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf, | |||
645 | } | 625 | } |
646 | 626 | ||
647 | event = &pcmdptr->params.subscribe_event; | 627 | event = &pcmdptr->params.subscribe_event; |
648 | event->action = cmd_act_get; | 628 | event->action = cpu_to_le16(cmd_act_get); |
649 | pcmdptr->size = | 629 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); |
650 | cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN); | ||
651 | libertas_queue_cmd(adapter, pcmdnode, 1); | 630 | libertas_queue_cmd(adapter, pcmdnode, 1); |
652 | wake_up_interruptible(&priv->mainthread.waitq); | 631 | wake_up_interruptible(&priv->mainthread.waitq); |
653 | 632 | ||
654 | /* Sleep until response is generated by FW */ | 633 | /* Sleep until response is generated by FW */ |
655 | wait_event_interruptible(pcmdnode->cmdwait_q, | 634 | wait_event_interruptible(pcmdnode->cmdwait_q, |
656 | pcmdnode->cmdwaitqwoken); | 635 | pcmdnode->cmdwaitqwoken); |
657 | 636 | ||
658 | pcmdptr = response_buf; | 637 | pcmdptr = response_buf; |
659 | 638 | ||
660 | if (pcmdptr->result) { | 639 | if (pcmdptr->result) { |
661 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 640 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
662 | pcmdptr->result); | 641 | le16_to_cpu(pcmdptr->result)); |
663 | kfree(response_buf); | 642 | kfree(response_buf); |
664 | free_page(addr); | 643 | free_page(addr); |
665 | return 0; | 644 | return 0; |
666 | } | 645 | } |
667 | 646 | ||
668 | if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { | 647 | if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { |
669 | lbs_pr_err("command response incorrect!\n"); | 648 | lbs_pr_err("command response incorrect!\n"); |
670 | kfree(response_buf); | 649 | kfree(response_buf); |
671 | free_page(addr); | 650 | free_page(addr); |
@@ -673,17 +652,17 @@ static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf, | |||
673 | } | 652 | } |
674 | 653 | ||
675 | cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); | 654 | cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); |
676 | event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); | 655 | event = (void *)(response_buf + S_DS_GEN); |
677 | while (cmd_len < pcmdptr->size) { | 656 | while (cmd_len < le16_to_cpu(pcmdptr->size)) { |
678 | struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); | 657 | struct mrvlietypesheader *header = (void *)(response_buf + cmd_len); |
679 | switch(header->type) { | 658 | switch (header->type) { |
680 | struct mrvlietypes_snrthreshold *LowSnr; | 659 | struct mrvlietypes_snrthreshold *LowSnr; |
681 | case TLV_TYPE_SNR_LOW: | 660 | case __constant_cpu_to_le16(TLV_TYPE_SNR_LOW): |
682 | LowSnr = (struct mrvlietypes_snrthreshold *)(response_buf + cmd_len); | 661 | LowSnr = (void *)(response_buf + cmd_len); |
683 | pos += snprintf(buf+pos, len-pos, "%d %d %d\n", | 662 | pos += snprintf(buf+pos, len-pos, "%d %d %d\n", |
684 | LowSnr->snrvalue, | 663 | LowSnr->snrvalue, |
685 | LowSnr->snrfreq, | 664 | LowSnr->snrfreq, |
686 | (event->events & 0x0002)?1:0); | 665 | (event->events & cpu_to_le16(0x0002))?1:0); |
687 | default: | 666 | default: |
688 | cmd_len += sizeof(struct mrvlietypes_snrthreshold); | 667 | cmd_len += sizeof(struct mrvlietypes_snrthreshold); |
689 | break; | 668 | break; |
@@ -733,7 +712,7 @@ static ssize_t libertas_lowsnr_write(struct file *file, | |||
733 | goto out_unlock; | 712 | goto out_unlock; |
734 | 713 | ||
735 | event = &pcmdptr->params.subscribe_event; | 714 | event = &pcmdptr->params.subscribe_event; |
736 | event->action = cmd_act_set; | 715 | event->action = cpu_to_le16(cmd_act_set); |
737 | pcmdptr->size = cpu_to_le16(S_DS_GEN + | 716 | pcmdptr->size = cpu_to_le16(S_DS_GEN + |
738 | sizeof(struct cmd_ds_802_11_subscribe_event) + | 717 | sizeof(struct cmd_ds_802_11_subscribe_event) + |
739 | sizeof(struct mrvlietypes_snrthreshold)); | 718 | sizeof(struct mrvlietypes_snrthreshold)); |
@@ -741,30 +720,30 @@ static ssize_t libertas_lowsnr_write(struct file *file, | |||
741 | ptr = (u8*) pcmdptr+cmd_len; | 720 | ptr = (u8*) pcmdptr+cmd_len; |
742 | snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr); | 721 | snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr); |
743 | snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_LOW); | 722 | snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_LOW); |
744 | snr_threshold->header.len = 2; | 723 | snr_threshold->header.len = cpu_to_le16(2); |
745 | snr_threshold->snrvalue = cpu_to_le16(value); | 724 | snr_threshold->snrvalue = value; |
746 | snr_threshold->snrfreq = cpu_to_le16(freq); | 725 | snr_threshold->snrfreq = freq; |
747 | event_bitmap |= subscribed ? 0x0002 : 0x0; | 726 | event_bitmap |= subscribed ? 0x0002 : 0x0; |
748 | event->events = event_bitmap; | 727 | event->events = cpu_to_le16(event_bitmap); |
749 | 728 | ||
750 | libertas_queue_cmd(adapter, pcmdnode, 1); | 729 | libertas_queue_cmd(adapter, pcmdnode, 1); |
751 | wake_up_interruptible(&priv->mainthread.waitq); | 730 | wake_up_interruptible(&priv->mainthread.waitq); |
752 | 731 | ||
753 | /* Sleep until response is generated by FW */ | 732 | /* Sleep until response is generated by FW */ |
754 | wait_event_interruptible(pcmdnode->cmdwait_q, | 733 | wait_event_interruptible(pcmdnode->cmdwait_q, |
755 | pcmdnode->cmdwaitqwoken); | 734 | pcmdnode->cmdwaitqwoken); |
756 | 735 | ||
757 | pcmdptr = response_buf; | 736 | pcmdptr = response_buf; |
758 | 737 | ||
759 | if (pcmdptr->result) { | 738 | if (pcmdptr->result) { |
760 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 739 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
761 | pcmdptr->result); | 740 | le16_to_cpu(pcmdptr->result)); |
762 | kfree(response_buf); | 741 | kfree(response_buf); |
763 | free_page(addr); | 742 | free_page(addr); |
764 | return 0; | 743 | return 0; |
765 | } | 744 | } |
766 | 745 | ||
767 | if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { | 746 | if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { |
768 | lbs_pr_err("command response incorrect!\n"); | 747 | lbs_pr_err("command response incorrect!\n"); |
769 | kfree(response_buf); | 748 | kfree(response_buf); |
770 | free_page(addr); | 749 | free_page(addr); |
@@ -799,27 +778,26 @@ static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf, | |||
799 | } | 778 | } |
800 | 779 | ||
801 | event = &pcmdptr->params.subscribe_event; | 780 | event = &pcmdptr->params.subscribe_event; |
802 | event->action = cmd_act_get; | 781 | event->action = cpu_to_le16(cmd_act_get); |
803 | pcmdptr->size = | 782 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); |
804 | cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN); | ||
805 | libertas_queue_cmd(adapter, pcmdnode, 1); | 783 | libertas_queue_cmd(adapter, pcmdnode, 1); |
806 | wake_up_interruptible(&priv->mainthread.waitq); | 784 | wake_up_interruptible(&priv->mainthread.waitq); |
807 | 785 | ||
808 | /* Sleep until response is generated by FW */ | 786 | /* Sleep until response is generated by FW */ |
809 | wait_event_interruptible(pcmdnode->cmdwait_q, | 787 | wait_event_interruptible(pcmdnode->cmdwait_q, |
810 | pcmdnode->cmdwaitqwoken); | 788 | pcmdnode->cmdwaitqwoken); |
811 | 789 | ||
812 | pcmdptr = response_buf; | 790 | pcmdptr = response_buf; |
813 | 791 | ||
814 | if (pcmdptr->result) { | 792 | if (pcmdptr->result) { |
815 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 793 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
816 | pcmdptr->result); | 794 | le16_to_cpu(pcmdptr->result)); |
817 | kfree(response_buf); | 795 | kfree(response_buf); |
818 | free_page(addr); | 796 | free_page(addr); |
819 | return 0; | 797 | return 0; |
820 | } | 798 | } |
821 | 799 | ||
822 | if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { | 800 | if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { |
823 | lbs_pr_err("command response incorrect!\n"); | 801 | lbs_pr_err("command response incorrect!\n"); |
824 | kfree(response_buf); | 802 | kfree(response_buf); |
825 | free_page(addr); | 803 | free_page(addr); |
@@ -827,17 +805,17 @@ static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf, | |||
827 | } | 805 | } |
828 | 806 | ||
829 | cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); | 807 | cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); |
830 | event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); | 808 | event = (void *)(response_buf + S_DS_GEN); |
831 | while (cmd_len < pcmdptr->size) { | 809 | while (cmd_len < le16_to_cpu(pcmdptr->size)) { |
832 | struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); | 810 | struct mrvlietypesheader *header = (void *)(response_buf + cmd_len); |
833 | switch(header->type) { | 811 | switch (header->type) { |
834 | struct mrvlietypes_failurecount *failcount; | 812 | struct mrvlietypes_failurecount *failcount; |
835 | case TLV_TYPE_FAILCOUNT: | 813 | case __constant_cpu_to_le16(TLV_TYPE_FAILCOUNT): |
836 | failcount = (struct mrvlietypes_failurecount *)(response_buf + cmd_len); | 814 | failcount = (void *)(response_buf + cmd_len); |
837 | pos += snprintf(buf+pos, len-pos, "%d %d %d\n", | 815 | pos += snprintf(buf+pos, len-pos, "%d %d %d\n", |
838 | failcount->failvalue, | 816 | failcount->failvalue, |
839 | failcount->Failfreq, | 817 | failcount->Failfreq, |
840 | (event->events & 0x0004)?1:0); | 818 | (event->events & cpu_to_le16(0x0004))?1:0); |
841 | default: | 819 | default: |
842 | cmd_len += sizeof(struct mrvlietypes_failurecount); | 820 | cmd_len += sizeof(struct mrvlietypes_failurecount); |
843 | break; | 821 | break; |
@@ -886,7 +864,7 @@ static ssize_t libertas_failcount_write(struct file *file, | |||
886 | goto out_unlock; | 864 | goto out_unlock; |
887 | 865 | ||
888 | event = &pcmdptr->params.subscribe_event; | 866 | event = &pcmdptr->params.subscribe_event; |
889 | event->action = cmd_act_set; | 867 | event->action = cpu_to_le16(cmd_act_set); |
890 | pcmdptr->size = cpu_to_le16(S_DS_GEN + | 868 | pcmdptr->size = cpu_to_le16(S_DS_GEN + |
891 | sizeof(struct cmd_ds_802_11_subscribe_event) + | 869 | sizeof(struct cmd_ds_802_11_subscribe_event) + |
892 | sizeof(struct mrvlietypes_failurecount)); | 870 | sizeof(struct mrvlietypes_failurecount)); |
@@ -894,30 +872,30 @@ static ssize_t libertas_failcount_write(struct file *file, | |||
894 | ptr = (u8*) pcmdptr+cmd_len; | 872 | ptr = (u8*) pcmdptr+cmd_len; |
895 | failcount = (struct mrvlietypes_failurecount *)(ptr); | 873 | failcount = (struct mrvlietypes_failurecount *)(ptr); |
896 | failcount->header.type = cpu_to_le16(TLV_TYPE_FAILCOUNT); | 874 | failcount->header.type = cpu_to_le16(TLV_TYPE_FAILCOUNT); |
897 | failcount->header.len = 2; | 875 | failcount->header.len = cpu_to_le16(2); |
898 | failcount->failvalue = cpu_to_le16(value); | 876 | failcount->failvalue = value; |
899 | failcount->Failfreq = cpu_to_le16(freq); | 877 | failcount->Failfreq = freq; |
900 | event_bitmap |= subscribed ? 0x0004 : 0x0; | 878 | event_bitmap |= subscribed ? 0x0004 : 0x0; |
901 | event->events = event_bitmap; | 879 | event->events = cpu_to_le16(event_bitmap); |
902 | 880 | ||
903 | libertas_queue_cmd(adapter, pcmdnode, 1); | 881 | libertas_queue_cmd(adapter, pcmdnode, 1); |
904 | wake_up_interruptible(&priv->mainthread.waitq); | 882 | wake_up_interruptible(&priv->mainthread.waitq); |
905 | 883 | ||
906 | /* Sleep until response is generated by FW */ | 884 | /* Sleep until response is generated by FW */ |
907 | wait_event_interruptible(pcmdnode->cmdwait_q, | 885 | wait_event_interruptible(pcmdnode->cmdwait_q, |
908 | pcmdnode->cmdwaitqwoken); | 886 | pcmdnode->cmdwaitqwoken); |
909 | 887 | ||
910 | pcmdptr = (struct cmd_ds_command *)response_buf; | 888 | pcmdptr = (struct cmd_ds_command *)response_buf; |
911 | 889 | ||
912 | if (pcmdptr->result) { | 890 | if (pcmdptr->result) { |
913 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 891 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
914 | pcmdptr->result); | 892 | le16_to_cpu(pcmdptr->result)); |
915 | kfree(response_buf); | 893 | kfree(response_buf); |
916 | free_page(addr); | 894 | free_page(addr); |
917 | return 0; | 895 | return 0; |
918 | } | 896 | } |
919 | 897 | ||
920 | if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { | 898 | if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { |
921 | lbs_pr_err("command response incorrect!\n"); | 899 | lbs_pr_err("command response incorrect!\n"); |
922 | kfree(response_buf); | 900 | kfree(response_buf); |
923 | free_page(addr); | 901 | free_page(addr); |
@@ -951,27 +929,26 @@ static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf, | |||
951 | } | 929 | } |
952 | 930 | ||
953 | event = &pcmdptr->params.subscribe_event; | 931 | event = &pcmdptr->params.subscribe_event; |
954 | event->action = cmd_act_get; | 932 | event->action = cpu_to_le16(cmd_act_get); |
955 | pcmdptr->size = | 933 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); |
956 | cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN); | ||
957 | libertas_queue_cmd(adapter, pcmdnode, 1); | 934 | libertas_queue_cmd(adapter, pcmdnode, 1); |
958 | wake_up_interruptible(&priv->mainthread.waitq); | 935 | wake_up_interruptible(&priv->mainthread.waitq); |
959 | 936 | ||
960 | /* Sleep until response is generated by FW */ | 937 | /* Sleep until response is generated by FW */ |
961 | wait_event_interruptible(pcmdnode->cmdwait_q, | 938 | wait_event_interruptible(pcmdnode->cmdwait_q, |
962 | pcmdnode->cmdwaitqwoken); | 939 | pcmdnode->cmdwaitqwoken); |
963 | 940 | ||
964 | pcmdptr = response_buf; | 941 | pcmdptr = response_buf; |
965 | 942 | ||
966 | if (pcmdptr->result) { | 943 | if (pcmdptr->result) { |
967 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 944 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
968 | pcmdptr->result); | 945 | le16_to_cpu(pcmdptr->result)); |
969 | free_page(addr); | 946 | free_page(addr); |
970 | kfree(response_buf); | 947 | kfree(response_buf); |
971 | return 0; | 948 | return 0; |
972 | } | 949 | } |
973 | 950 | ||
974 | if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { | 951 | if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { |
975 | lbs_pr_err("command response incorrect!\n"); | 952 | lbs_pr_err("command response incorrect!\n"); |
976 | free_page(addr); | 953 | free_page(addr); |
977 | kfree(response_buf); | 954 | kfree(response_buf); |
@@ -979,16 +956,16 @@ static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf, | |||
979 | } | 956 | } |
980 | 957 | ||
981 | cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); | 958 | cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); |
982 | event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); | 959 | event = (void *)(response_buf + S_DS_GEN); |
983 | while (cmd_len < pcmdptr->size) { | 960 | while (cmd_len < le16_to_cpu(pcmdptr->size)) { |
984 | struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); | 961 | struct mrvlietypesheader *header = (void *)(response_buf + cmd_len); |
985 | switch(header->type) { | 962 | switch (header->type) { |
986 | struct mrvlietypes_beaconsmissed *bcnmiss; | 963 | struct mrvlietypes_beaconsmissed *bcnmiss; |
987 | case TLV_TYPE_BCNMISS: | 964 | case __constant_cpu_to_le16(TLV_TYPE_BCNMISS): |
988 | bcnmiss = (struct mrvlietypes_beaconsmissed *)(response_buf + cmd_len); | 965 | bcnmiss = (void *)(response_buf + cmd_len); |
989 | pos += snprintf(buf+pos, len-pos, "%d N/A %d\n", | 966 | pos += snprintf(buf+pos, len-pos, "%d N/A %d\n", |
990 | bcnmiss->beaconmissed, | 967 | bcnmiss->beaconmissed, |
991 | (event->events & 0x0008)?1:0); | 968 | (event->events & cpu_to_le16(0x0008))?1:0); |
992 | default: | 969 | default: |
993 | cmd_len += sizeof(struct mrvlietypes_beaconsmissed); | 970 | cmd_len += sizeof(struct mrvlietypes_beaconsmissed); |
994 | break; | 971 | break; |
@@ -1038,7 +1015,7 @@ static ssize_t libertas_bcnmiss_write(struct file *file, | |||
1038 | goto out_unlock; | 1015 | goto out_unlock; |
1039 | 1016 | ||
1040 | event = &pcmdptr->params.subscribe_event; | 1017 | event = &pcmdptr->params.subscribe_event; |
1041 | event->action = cmd_act_set; | 1018 | event->action = cpu_to_le16(cmd_act_set); |
1042 | pcmdptr->size = cpu_to_le16(S_DS_GEN + | 1019 | pcmdptr->size = cpu_to_le16(S_DS_GEN + |
1043 | sizeof(struct cmd_ds_802_11_subscribe_event) + | 1020 | sizeof(struct cmd_ds_802_11_subscribe_event) + |
1044 | sizeof(struct mrvlietypes_beaconsmissed)); | 1021 | sizeof(struct mrvlietypes_beaconsmissed)); |
@@ -1046,29 +1023,29 @@ static ssize_t libertas_bcnmiss_write(struct file *file, | |||
1046 | ptr = (u8*) pcmdptr+cmd_len; | 1023 | ptr = (u8*) pcmdptr+cmd_len; |
1047 | bcnmiss = (struct mrvlietypes_beaconsmissed *)(ptr); | 1024 | bcnmiss = (struct mrvlietypes_beaconsmissed *)(ptr); |
1048 | bcnmiss->header.type = cpu_to_le16(TLV_TYPE_BCNMISS); | 1025 | bcnmiss->header.type = cpu_to_le16(TLV_TYPE_BCNMISS); |
1049 | bcnmiss->header.len = 2; | 1026 | bcnmiss->header.len = cpu_to_le16(2); |
1050 | bcnmiss->beaconmissed = cpu_to_le16(value); | 1027 | bcnmiss->beaconmissed = value; |
1051 | event_bitmap |= subscribed ? 0x0008 : 0x0; | 1028 | event_bitmap |= subscribed ? 0x0008 : 0x0; |
1052 | event->events = event_bitmap; | 1029 | event->events = cpu_to_le16(event_bitmap); |
1053 | 1030 | ||
1054 | libertas_queue_cmd(adapter, pcmdnode, 1); | 1031 | libertas_queue_cmd(adapter, pcmdnode, 1); |
1055 | wake_up_interruptible(&priv->mainthread.waitq); | 1032 | wake_up_interruptible(&priv->mainthread.waitq); |
1056 | 1033 | ||
1057 | /* Sleep until response is generated by FW */ | 1034 | /* Sleep until response is generated by FW */ |
1058 | wait_event_interruptible(pcmdnode->cmdwait_q, | 1035 | wait_event_interruptible(pcmdnode->cmdwait_q, |
1059 | pcmdnode->cmdwaitqwoken); | 1036 | pcmdnode->cmdwaitqwoken); |
1060 | 1037 | ||
1061 | pcmdptr = response_buf; | 1038 | pcmdptr = response_buf; |
1062 | 1039 | ||
1063 | if (pcmdptr->result) { | 1040 | if (pcmdptr->result) { |
1064 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 1041 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
1065 | pcmdptr->result); | 1042 | le16_to_cpu(pcmdptr->result)); |
1066 | kfree(response_buf); | 1043 | kfree(response_buf); |
1067 | free_page(addr); | 1044 | free_page(addr); |
1068 | return 0; | 1045 | return 0; |
1069 | } | 1046 | } |
1070 | 1047 | ||
1071 | if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { | 1048 | if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { |
1072 | lbs_pr_err("command response incorrect!\n"); | 1049 | lbs_pr_err("command response incorrect!\n"); |
1073 | free_page(addr); | 1050 | free_page(addr); |
1074 | kfree(response_buf); | 1051 | kfree(response_buf); |
@@ -1102,27 +1079,26 @@ static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf, | |||
1102 | } | 1079 | } |
1103 | 1080 | ||
1104 | event = &pcmdptr->params.subscribe_event; | 1081 | event = &pcmdptr->params.subscribe_event; |
1105 | event->action = cmd_act_get; | 1082 | event->action = cpu_to_le16(cmd_act_get); |
1106 | pcmdptr->size = | 1083 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); |
1107 | cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN); | ||
1108 | libertas_queue_cmd(adapter, pcmdnode, 1); | 1084 | libertas_queue_cmd(adapter, pcmdnode, 1); |
1109 | wake_up_interruptible(&priv->mainthread.waitq); | 1085 | wake_up_interruptible(&priv->mainthread.waitq); |
1110 | 1086 | ||
1111 | /* Sleep until response is generated by FW */ | 1087 | /* Sleep until response is generated by FW */ |
1112 | wait_event_interruptible(pcmdnode->cmdwait_q, | 1088 | wait_event_interruptible(pcmdnode->cmdwait_q, |
1113 | pcmdnode->cmdwaitqwoken); | 1089 | pcmdnode->cmdwaitqwoken); |
1114 | 1090 | ||
1115 | pcmdptr = response_buf; | 1091 | pcmdptr = response_buf; |
1116 | 1092 | ||
1117 | if (pcmdptr->result) { | 1093 | if (pcmdptr->result) { |
1118 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 1094 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
1119 | pcmdptr->result); | 1095 | le16_to_cpu(pcmdptr->result)); |
1120 | kfree(response_buf); | 1096 | kfree(response_buf); |
1121 | free_page(addr); | 1097 | free_page(addr); |
1122 | return 0; | 1098 | return 0; |
1123 | } | 1099 | } |
1124 | 1100 | ||
1125 | if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { | 1101 | if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { |
1126 | lbs_pr_err("command response incorrect!\n"); | 1102 | lbs_pr_err("command response incorrect!\n"); |
1127 | kfree(response_buf); | 1103 | kfree(response_buf); |
1128 | free_page(addr); | 1104 | free_page(addr); |
@@ -1130,17 +1106,17 @@ static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf, | |||
1130 | } | 1106 | } |
1131 | 1107 | ||
1132 | cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); | 1108 | cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); |
1133 | event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); | 1109 | event = (void *)(response_buf + S_DS_GEN); |
1134 | while (cmd_len < pcmdptr->size) { | 1110 | while (cmd_len < le16_to_cpu(pcmdptr->size)) { |
1135 | struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); | 1111 | struct mrvlietypesheader *header = (void *)(response_buf + cmd_len); |
1136 | switch(header->type) { | 1112 | switch (header->type) { |
1137 | struct mrvlietypes_rssithreshold *Highrssi; | 1113 | struct mrvlietypes_rssithreshold *Highrssi; |
1138 | case TLV_TYPE_RSSI_HIGH: | 1114 | case __constant_cpu_to_le16(TLV_TYPE_RSSI_HIGH): |
1139 | Highrssi = (struct mrvlietypes_rssithreshold *)(response_buf + cmd_len); | 1115 | Highrssi = (void *)(response_buf + cmd_len); |
1140 | pos += snprintf(buf+pos, len-pos, "%d %d %d\n", | 1116 | pos += snprintf(buf+pos, len-pos, "%d %d %d\n", |
1141 | Highrssi->rssivalue, | 1117 | Highrssi->rssivalue, |
1142 | Highrssi->rssifreq, | 1118 | Highrssi->rssifreq, |
1143 | (event->events & 0x0010)?1:0); | 1119 | (event->events & cpu_to_le16(0x0010))?1:0); |
1144 | default: | 1120 | default: |
1145 | cmd_len += sizeof(struct mrvlietypes_snrthreshold); | 1121 | cmd_len += sizeof(struct mrvlietypes_snrthreshold); |
1146 | break; | 1122 | break; |
@@ -1190,7 +1166,7 @@ static ssize_t libertas_highrssi_write(struct file *file, | |||
1190 | goto out_unlock; | 1166 | goto out_unlock; |
1191 | 1167 | ||
1192 | event = &pcmdptr->params.subscribe_event; | 1168 | event = &pcmdptr->params.subscribe_event; |
1193 | event->action = cmd_act_set; | 1169 | event->action = cpu_to_le16(cmd_act_set); |
1194 | pcmdptr->size = cpu_to_le16(S_DS_GEN + | 1170 | pcmdptr->size = cpu_to_le16(S_DS_GEN + |
1195 | sizeof(struct cmd_ds_802_11_subscribe_event) + | 1171 | sizeof(struct cmd_ds_802_11_subscribe_event) + |
1196 | sizeof(struct mrvlietypes_rssithreshold)); | 1172 | sizeof(struct mrvlietypes_rssithreshold)); |
@@ -1198,29 +1174,29 @@ static ssize_t libertas_highrssi_write(struct file *file, | |||
1198 | ptr = (u8*) pcmdptr+cmd_len; | 1174 | ptr = (u8*) pcmdptr+cmd_len; |
1199 | rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr); | 1175 | rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr); |
1200 | rssi_threshold->header.type = cpu_to_le16(TLV_TYPE_RSSI_HIGH); | 1176 | rssi_threshold->header.type = cpu_to_le16(TLV_TYPE_RSSI_HIGH); |
1201 | rssi_threshold->header.len = 2; | 1177 | rssi_threshold->header.len = cpu_to_le16(2); |
1202 | rssi_threshold->rssivalue = cpu_to_le16(value); | 1178 | rssi_threshold->rssivalue = value; |
1203 | rssi_threshold->rssifreq = cpu_to_le16(freq); | 1179 | rssi_threshold->rssifreq = freq; |
1204 | event_bitmap |= subscribed ? 0x0010 : 0x0; | 1180 | event_bitmap |= subscribed ? 0x0010 : 0x0; |
1205 | event->events = event_bitmap; | 1181 | event->events = cpu_to_le16(event_bitmap); |
1206 | 1182 | ||
1207 | libertas_queue_cmd(adapter, pcmdnode, 1); | 1183 | libertas_queue_cmd(adapter, pcmdnode, 1); |
1208 | wake_up_interruptible(&priv->mainthread.waitq); | 1184 | wake_up_interruptible(&priv->mainthread.waitq); |
1209 | 1185 | ||
1210 | /* Sleep until response is generated by FW */ | 1186 | /* Sleep until response is generated by FW */ |
1211 | wait_event_interruptible(pcmdnode->cmdwait_q, | 1187 | wait_event_interruptible(pcmdnode->cmdwait_q, |
1212 | pcmdnode->cmdwaitqwoken); | 1188 | pcmdnode->cmdwaitqwoken); |
1213 | 1189 | ||
1214 | pcmdptr = response_buf; | 1190 | pcmdptr = response_buf; |
1215 | 1191 | ||
1216 | if (pcmdptr->result) { | 1192 | if (pcmdptr->result) { |
1217 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 1193 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
1218 | pcmdptr->result); | 1194 | le16_to_cpu(pcmdptr->result)); |
1219 | kfree(response_buf); | 1195 | kfree(response_buf); |
1220 | return 0; | 1196 | return 0; |
1221 | } | 1197 | } |
1222 | 1198 | ||
1223 | if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { | 1199 | if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { |
1224 | lbs_pr_err("command response incorrect!\n"); | 1200 | lbs_pr_err("command response incorrect!\n"); |
1225 | kfree(response_buf); | 1201 | kfree(response_buf); |
1226 | return 0; | 1202 | return 0; |
@@ -1253,27 +1229,26 @@ static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf, | |||
1253 | } | 1229 | } |
1254 | 1230 | ||
1255 | event = &pcmdptr->params.subscribe_event; | 1231 | event = &pcmdptr->params.subscribe_event; |
1256 | event->action = cmd_act_get; | 1232 | event->action = cpu_to_le16(cmd_act_get); |
1257 | pcmdptr->size = | 1233 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); |
1258 | cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN); | ||
1259 | libertas_queue_cmd(adapter, pcmdnode, 1); | 1234 | libertas_queue_cmd(adapter, pcmdnode, 1); |
1260 | wake_up_interruptible(&priv->mainthread.waitq); | 1235 | wake_up_interruptible(&priv->mainthread.waitq); |
1261 | 1236 | ||
1262 | /* Sleep until response is generated by FW */ | 1237 | /* Sleep until response is generated by FW */ |
1263 | wait_event_interruptible(pcmdnode->cmdwait_q, | 1238 | wait_event_interruptible(pcmdnode->cmdwait_q, |
1264 | pcmdnode->cmdwaitqwoken); | 1239 | pcmdnode->cmdwaitqwoken); |
1265 | 1240 | ||
1266 | pcmdptr = response_buf; | 1241 | pcmdptr = response_buf; |
1267 | 1242 | ||
1268 | if (pcmdptr->result) { | 1243 | if (pcmdptr->result) { |
1269 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 1244 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
1270 | pcmdptr->result); | 1245 | le16_to_cpu(pcmdptr->result)); |
1271 | kfree(response_buf); | 1246 | kfree(response_buf); |
1272 | free_page(addr); | 1247 | free_page(addr); |
1273 | return 0; | 1248 | return 0; |
1274 | } | 1249 | } |
1275 | 1250 | ||
1276 | if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { | 1251 | if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { |
1277 | lbs_pr_err("command response incorrect!\n"); | 1252 | lbs_pr_err("command response incorrect!\n"); |
1278 | kfree(response_buf); | 1253 | kfree(response_buf); |
1279 | free_page(addr); | 1254 | free_page(addr); |
@@ -1281,17 +1256,17 @@ static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf, | |||
1281 | } | 1256 | } |
1282 | 1257 | ||
1283 | cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); | 1258 | cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); |
1284 | event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); | 1259 | event = (void *)(response_buf + S_DS_GEN); |
1285 | while (cmd_len < pcmdptr->size) { | 1260 | while (cmd_len < le16_to_cpu(pcmdptr->size)) { |
1286 | struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); | 1261 | struct mrvlietypesheader *header = (void *)(response_buf + cmd_len); |
1287 | switch(header->type) { | 1262 | switch (header->type) { |
1288 | struct mrvlietypes_snrthreshold *HighSnr; | 1263 | struct mrvlietypes_snrthreshold *HighSnr; |
1289 | case TLV_TYPE_SNR_HIGH: | 1264 | case __constant_cpu_to_le16(TLV_TYPE_SNR_HIGH): |
1290 | HighSnr = (struct mrvlietypes_snrthreshold *)(response_buf + cmd_len); | 1265 | HighSnr = (void *)(response_buf + cmd_len); |
1291 | pos += snprintf(buf+pos, len-pos, "%d %d %d\n", | 1266 | pos += snprintf(buf+pos, len-pos, "%d %d %d\n", |
1292 | HighSnr->snrvalue, | 1267 | HighSnr->snrvalue, |
1293 | HighSnr->snrfreq, | 1268 | HighSnr->snrfreq, |
1294 | (event->events & 0x0020)?1:0); | 1269 | (event->events & cpu_to_le16(0x0020))?1:0); |
1295 | default: | 1270 | default: |
1296 | cmd_len += sizeof(struct mrvlietypes_snrthreshold); | 1271 | cmd_len += sizeof(struct mrvlietypes_snrthreshold); |
1297 | break; | 1272 | break; |
@@ -1341,7 +1316,7 @@ static ssize_t libertas_highsnr_write(struct file *file, | |||
1341 | goto out_unlock; | 1316 | goto out_unlock; |
1342 | 1317 | ||
1343 | event = &pcmdptr->params.subscribe_event; | 1318 | event = &pcmdptr->params.subscribe_event; |
1344 | event->action = cmd_act_set; | 1319 | event->action = cpu_to_le16(cmd_act_set); |
1345 | pcmdptr->size = cpu_to_le16(S_DS_GEN + | 1320 | pcmdptr->size = cpu_to_le16(S_DS_GEN + |
1346 | sizeof(struct cmd_ds_802_11_subscribe_event) + | 1321 | sizeof(struct cmd_ds_802_11_subscribe_event) + |
1347 | sizeof(struct mrvlietypes_snrthreshold)); | 1322 | sizeof(struct mrvlietypes_snrthreshold)); |
@@ -1349,30 +1324,30 @@ static ssize_t libertas_highsnr_write(struct file *file, | |||
1349 | ptr = (u8*) pcmdptr+cmd_len; | 1324 | ptr = (u8*) pcmdptr+cmd_len; |
1350 | snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr); | 1325 | snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr); |
1351 | snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_HIGH); | 1326 | snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_HIGH); |
1352 | snr_threshold->header.len = 2; | 1327 | snr_threshold->header.len = cpu_to_le16(2); |
1353 | snr_threshold->snrvalue = cpu_to_le16(value); | 1328 | snr_threshold->snrvalue = value; |
1354 | snr_threshold->snrfreq = cpu_to_le16(freq); | 1329 | snr_threshold->snrfreq = freq; |
1355 | event_bitmap |= subscribed ? 0x0020 : 0x0; | 1330 | event_bitmap |= subscribed ? 0x0020 : 0x0; |
1356 | event->events = event_bitmap; | 1331 | event->events = cpu_to_le16(event_bitmap); |
1357 | 1332 | ||
1358 | libertas_queue_cmd(adapter, pcmdnode, 1); | 1333 | libertas_queue_cmd(adapter, pcmdnode, 1); |
1359 | wake_up_interruptible(&priv->mainthread.waitq); | 1334 | wake_up_interruptible(&priv->mainthread.waitq); |
1360 | 1335 | ||
1361 | /* Sleep until response is generated by FW */ | 1336 | /* Sleep until response is generated by FW */ |
1362 | wait_event_interruptible(pcmdnode->cmdwait_q, | 1337 | wait_event_interruptible(pcmdnode->cmdwait_q, |
1363 | pcmdnode->cmdwaitqwoken); | 1338 | pcmdnode->cmdwaitqwoken); |
1364 | 1339 | ||
1365 | pcmdptr = response_buf; | 1340 | pcmdptr = response_buf; |
1366 | 1341 | ||
1367 | if (pcmdptr->result) { | 1342 | if (pcmdptr->result) { |
1368 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 1343 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
1369 | pcmdptr->result); | 1344 | le16_to_cpu(pcmdptr->result)); |
1370 | kfree(response_buf); | 1345 | kfree(response_buf); |
1371 | free_page(addr); | 1346 | free_page(addr); |
1372 | return 0; | 1347 | return 0; |
1373 | } | 1348 | } |
1374 | 1349 | ||
1375 | if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { | 1350 | if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { |
1376 | lbs_pr_err("command response incorrect!\n"); | 1351 | lbs_pr_err("command response incorrect!\n"); |
1377 | kfree(response_buf); | 1352 | kfree(response_buf); |
1378 | free_page(addr); | 1353 | free_page(addr); |
@@ -1760,7 +1735,7 @@ void libertas_debugfs_remove_one(wlan_private *priv) | |||
1760 | 1735 | ||
1761 | debugfs_remove(priv->regs_dir); | 1736 | debugfs_remove(priv->regs_dir); |
1762 | 1737 | ||
1763 | for(i=0; i<ARRAY_SIZE(debugfs_files); i++) | 1738 | for(i=0; i<ARRAY_SIZE(debugfs_events_files); i++) |
1764 | debugfs_remove(priv->debugfs_events_files[i]); | 1739 | debugfs_remove(priv->debugfs_events_files[i]); |
1765 | 1740 | ||
1766 | debugfs_remove(priv->events_dir); | 1741 | debugfs_remove(priv->events_dir); |
@@ -1769,13 +1744,19 @@ void libertas_debugfs_remove_one(wlan_private *priv) | |||
1769 | #endif | 1744 | #endif |
1770 | for(i=0; i<ARRAY_SIZE(debugfs_files); i++) | 1745 | for(i=0; i<ARRAY_SIZE(debugfs_files); i++) |
1771 | debugfs_remove(priv->debugfs_files[i]); | 1746 | debugfs_remove(priv->debugfs_files[i]); |
1747 | debugfs_remove(priv->debugfs_dir); | ||
1772 | } | 1748 | } |
1773 | 1749 | ||
1750 | |||
1751 | |||
1774 | /* debug entry */ | 1752 | /* debug entry */ |
1775 | 1753 | ||
1754 | #ifdef PROC_DEBUG | ||
1755 | |||
1776 | #define item_size(n) (FIELD_SIZEOF(wlan_adapter, n)) | 1756 | #define item_size(n) (FIELD_SIZEOF(wlan_adapter, n)) |
1777 | #define item_addr(n) (offsetof(wlan_adapter, n)) | 1757 | #define item_addr(n) (offsetof(wlan_adapter, n)) |
1778 | 1758 | ||
1759 | |||
1779 | struct debug_data { | 1760 | struct debug_data { |
1780 | char name[32]; | 1761 | char name[32]; |
1781 | u32 size; | 1762 | u32 size; |
@@ -1863,7 +1844,7 @@ static ssize_t wlan_debugfs_write(struct file *f, const char __user *buf, | |||
1863 | return 0; | 1844 | return 0; |
1864 | 1845 | ||
1865 | if (copy_from_user(pdata, buf, cnt)) { | 1846 | if (copy_from_user(pdata, buf, cnt)) { |
1866 | lbs_pr_debug(1, "Copy from user failed\n"); | 1847 | lbs_deb_debugfs("Copy from user failed\n"); |
1867 | kfree(pdata); | 1848 | kfree(pdata); |
1868 | return 0; | 1849 | return 0; |
1869 | } | 1850 | } |
@@ -1913,7 +1894,7 @@ static struct file_operations libertas_debug_fops = { | |||
1913 | * @param dev pointer net_device | 1894 | * @param dev pointer net_device |
1914 | * @return N/A | 1895 | * @return N/A |
1915 | */ | 1896 | */ |
1916 | void libertas_debug_init(wlan_private * priv, struct net_device *dev) | 1897 | static void libertas_debug_init(wlan_private * priv, struct net_device *dev) |
1917 | { | 1898 | { |
1918 | int i; | 1899 | int i; |
1919 | 1900 | ||
@@ -1927,4 +1908,5 @@ void libertas_debug_init(wlan_private * priv, struct net_device *dev) | |||
1927 | priv->debugfs_dir, &items[0], | 1908 | priv->debugfs_dir, &items[0], |
1928 | &libertas_debug_fops); | 1909 | &libertas_debug_fops); |
1929 | } | 1910 | } |
1911 | #endif | ||
1930 | 1912 | ||
diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h index dfe27642322c..40f56bb1eac8 100644 --- a/drivers/net/wireless/libertas/decl.h +++ b/drivers/net/wireless/libertas/decl.h | |||
@@ -6,6 +6,8 @@ | |||
6 | #ifndef _WLAN_DECL_H_ | 6 | #ifndef _WLAN_DECL_H_ |
7 | #define _WLAN_DECL_H_ | 7 | #define _WLAN_DECL_H_ |
8 | 8 | ||
9 | #include <linux/device.h> | ||
10 | |||
9 | #include "defs.h" | 11 | #include "defs.h" |
10 | 12 | ||
11 | /** Function Prototype Declaration */ | 13 | /** Function Prototype Declaration */ |
@@ -66,18 +68,24 @@ void libertas_ps_wakeup(wlan_private * priv, int wait_option); | |||
66 | 68 | ||
67 | void libertas_tx_runqueue(wlan_private *priv); | 69 | void libertas_tx_runqueue(wlan_private *priv); |
68 | 70 | ||
69 | extern struct chan_freq_power *libertas_find_cfp_by_band_and_channel( | 71 | struct chan_freq_power *libertas_find_cfp_by_band_and_channel( |
70 | wlan_adapter * adapter, u8 band, u16 channel); | 72 | wlan_adapter * adapter, u8 band, u16 channel); |
71 | 73 | ||
72 | extern void libertas_mac_event_disconnected(wlan_private * priv); | 74 | void libertas_mac_event_disconnected(wlan_private * priv); |
73 | 75 | ||
74 | void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str); | 76 | void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str); |
75 | 77 | ||
76 | int reset_device(wlan_private *priv); | 78 | /* fw.c */ |
79 | int libertas_init_fw(wlan_private * priv, char *fw_name); | ||
80 | |||
77 | /* main.c */ | 81 | /* main.c */ |
78 | extern struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band, | 82 | struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band, |
79 | int *cfp_no); | 83 | int *cfp_no); |
80 | wlan_private *wlan_add_card(void *card); | 84 | wlan_private *libertas_add_card(void *card, struct device *dmdev); |
81 | int wlan_remove_card(void *card); | 85 | int libertas_activate_card(wlan_private *priv, char *fw_name); |
86 | int libertas_remove_card(wlan_private *priv); | ||
87 | int libertas_add_mesh(wlan_private *priv, struct device *dev); | ||
88 | void libertas_remove_mesh(wlan_private *priv); | ||
89 | |||
82 | 90 | ||
83 | #endif /* _WLAN_DECL_H_ */ | 91 | #endif /* _WLAN_DECL_H_ */ |
diff --git a/drivers/net/wireless/libertas/defs.h b/drivers/net/wireless/libertas/defs.h index 80dd9ea19c8e..4dd43e59bda0 100644 --- a/drivers/net/wireless/libertas/defs.h +++ b/drivers/net/wireless/libertas/defs.h | |||
@@ -7,14 +7,79 @@ | |||
7 | 7 | ||
8 | #include <linux/spinlock.h> | 8 | #include <linux/spinlock.h> |
9 | 9 | ||
10 | extern unsigned int libertas_debug; | ||
11 | |||
12 | #ifdef CONFIG_LIBERTAS_DEBUG | 10 | #ifdef CONFIG_LIBERTAS_DEBUG |
13 | #define DEBUG | 11 | #define DEBUG |
14 | #define PROC_DEBUG | 12 | #define PROC_DEBUG |
15 | #endif | 13 | #endif |
16 | 14 | ||
17 | #define DRV_NAME "usb8xxx" | 15 | #ifndef DRV_NAME |
16 | #define DRV_NAME "libertas" | ||
17 | #endif | ||
18 | |||
19 | |||
20 | #define LBS_DEB_ENTER 0x00000001 | ||
21 | #define LBS_DEB_LEAVE 0x00000002 | ||
22 | #define LBS_DEB_MAIN 0x00000004 | ||
23 | #define LBS_DEB_NET 0x00000008 | ||
24 | #define LBS_DEB_MESH 0x00000010 | ||
25 | #define LBS_DEB_WEXT 0x00000020 | ||
26 | #define LBS_DEB_IOCTL 0x00000040 | ||
27 | #define LBS_DEB_SCAN 0x00000080 | ||
28 | #define LBS_DEB_ASSOC 0x00000100 | ||
29 | #define LBS_DEB_JOIN 0x00000200 | ||
30 | #define LBS_DEB_11D 0x00000400 | ||
31 | #define LBS_DEB_DEBUGFS 0x00000800 | ||
32 | #define LBS_DEB_ETHTOOL 0x00001000 | ||
33 | #define LBS_DEB_HOST 0x00002000 | ||
34 | #define LBS_DEB_CMD 0x00004000 | ||
35 | #define LBS_DEB_RX 0x00008000 | ||
36 | #define LBS_DEB_TX 0x00010000 | ||
37 | #define LBS_DEB_USB 0x00020000 | ||
38 | #define LBS_DEB_CS 0x00040000 | ||
39 | #define LBS_DEB_FW 0x00080000 | ||
40 | #define LBS_DEB_THREAD 0x00100000 | ||
41 | #define LBS_DEB_HEX 0x00200000 | ||
42 | |||
43 | extern unsigned int libertas_debug; | ||
44 | |||
45 | #ifdef DEBUG | ||
46 | #define LBS_DEB_LL(grp, fmt, args...) \ | ||
47 | do { if ((libertas_debug & (grp)) == (grp)) \ | ||
48 | printk(KERN_DEBUG DRV_NAME "%s: " fmt, \ | ||
49 | in_interrupt() ? " (INT)" : "", ## args); } while (0) | ||
50 | #else | ||
51 | #define LBS_DEB_LL(grp, fmt, args...) do {} while (0) | ||
52 | #endif | ||
53 | |||
54 | #define lbs_deb_enter(grp) \ | ||
55 | LBS_DEB_LL(grp | LBS_DEB_ENTER, "%s():%d enter\n", __FUNCTION__, __LINE__); | ||
56 | #define lbs_deb_enter_args(grp, fmt, args...) \ | ||
57 | LBS_DEB_LL(grp | LBS_DEB_ENTER, "%s(" fmt "):%d\n", __FUNCTION__, ## args, __LINE__); | ||
58 | #define lbs_deb_leave(grp) \ | ||
59 | LBS_DEB_LL(grp | LBS_DEB_LEAVE, "%s():%d leave\n", __FUNCTION__, __LINE__); | ||
60 | #define lbs_deb_leave_args(grp, fmt, args...) \ | ||
61 | LBS_DEB_LL(grp | LBS_DEB_LEAVE, "%s():%d leave, " fmt "\n", \ | ||
62 | __FUNCTION__, __LINE__, ##args); | ||
63 | #define lbs_deb_main(fmt, args...) LBS_DEB_LL(LBS_DEB_MAIN, fmt, ##args) | ||
64 | #define lbs_deb_net(fmt, args...) LBS_DEB_LL(LBS_DEB_NET, fmt, ##args) | ||
65 | #define lbs_deb_mesh(fmt, args...) LBS_DEB_LL(LBS_DEB_MESH, fmt, ##args) | ||
66 | #define lbs_deb_wext(fmt, args...) LBS_DEB_LL(LBS_DEB_WEXT, fmt, ##args) | ||
67 | #define lbs_deb_ioctl(fmt, args...) LBS_DEB_LL(LBS_DEB_IOCTL, fmt, ##args) | ||
68 | #define lbs_deb_scan(fmt, args...) LBS_DEB_LL(LBS_DEB_SCAN, fmt, ##args) | ||
69 | #define lbs_deb_assoc(fmt, args...) LBS_DEB_LL(LBS_DEB_ASSOC, fmt, ##args) | ||
70 | #define lbs_deb_join(fmt, args...) LBS_DEB_LL(LBS_DEB_JOIN, fmt, ##args) | ||
71 | #define lbs_deb_11d(fmt, args...) LBS_DEB_LL(LBS_DEB_11D, fmt, ##args) | ||
72 | #define lbs_deb_debugfs(fmt, args...) LBS_DEB_LL(LBS_DEB_DEBUGFS, fmt, ##args) | ||
73 | #define lbs_deb_ethtool(fmt, args...) LBS_DEB_LL(LBS_DEB_ETHTOOL, fmt, ##args) | ||
74 | #define lbs_deb_host(fmt, args...) LBS_DEB_LL(LBS_DEB_HOST, fmt, ##args) | ||
75 | #define lbs_deb_cmd(fmt, args...) LBS_DEB_LL(LBS_DEB_CMD, fmt, ##args) | ||
76 | #define lbs_deb_rx(fmt, args...) LBS_DEB_LL(LBS_DEB_RX, fmt, ##args) | ||
77 | #define lbs_deb_tx(fmt, args...) LBS_DEB_LL(LBS_DEB_TX, fmt, ##args) | ||
78 | #define lbs_deb_fw(fmt, args...) LBS_DEB_LL(LBS_DEB_FW, fmt, ##args) | ||
79 | #define lbs_deb_usb(fmt, args...) LBS_DEB_LL(LBS_DEB_USB, fmt, ##args) | ||
80 | #define lbs_deb_usbd(dev, fmt, args...) LBS_DEB_LL(LBS_DEB_USB, "%s:" fmt, (dev)->bus_id, ##args) | ||
81 | #define lbs_deb_cs(fmt, args...) LBS_DEB_LL(LBS_DEB_CS, fmt, ##args) | ||
82 | #define lbs_deb_thread(fmt, args...) LBS_DEB_LL(LBS_DEB_THREAD, fmt, ##args) | ||
18 | 83 | ||
19 | #define lbs_pr_info(format, args...) \ | 84 | #define lbs_pr_info(format, args...) \ |
20 | printk(KERN_INFO DRV_NAME": " format, ## args) | 85 | printk(KERN_INFO DRV_NAME": " format, ## args) |
@@ -24,37 +89,25 @@ extern unsigned int libertas_debug; | |||
24 | printk(KERN_ALERT DRV_NAME": " format, ## args) | 89 | printk(KERN_ALERT DRV_NAME": " format, ## args) |
25 | 90 | ||
26 | #ifdef DEBUG | 91 | #ifdef DEBUG |
27 | #define lbs_pr_debug(level, format, args...) \ | ||
28 | do { if (libertas_debug >= level) \ | ||
29 | printk(KERN_INFO DRV_NAME": " format, ##args); } while (0) | ||
30 | #define lbs_dev_dbg(level, device, format, args...) \ | ||
31 | lbs_pr_debug(level, "%s: " format, \ | ||
32 | (device)->bus_id , ## args) | ||
33 | |||
34 | static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len) | 92 | static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len) |
35 | { | 93 | { |
36 | int i = 0; | 94 | int i = 0; |
37 | 95 | ||
38 | if (!libertas_debug) | 96 | if (!(libertas_debug & LBS_DEB_HEX)) |
39 | return; | 97 | return; |
40 | 98 | ||
41 | printk(KERN_DEBUG "%s: ", prompt); | 99 | printk(KERN_DEBUG "%s: ", prompt); |
42 | for (i = 1; i <= len; i++) { | 100 | for (i = 1; i <= len; i++) { |
43 | printk(KERN_DEBUG "%02x ", (u8) * buf); | 101 | printk("%02x ", (u8) * buf); |
44 | buf++; | 102 | buf++; |
45 | } | 103 | } |
46 | printk("\n"); | 104 | printk("\n"); |
47 | } | 105 | } |
48 | #else | 106 | #else |
49 | #define lbs_pr_debug(level, format, args...) do {} while (0) | ||
50 | #define lbs_dev_dbg(level, device, format, args...) do {} while (0) | ||
51 | #define lbs_dbg_hex(x,y,z) do {} while (0) | 107 | #define lbs_dbg_hex(x,y,z) do {} while (0) |
52 | #endif | 108 | #endif |
53 | 109 | ||
54 | #define ENTER() lbs_pr_debug(1, "Enter: %s, %s:%i\n", \ | 110 | |
55 | __FUNCTION__, __FILE__, __LINE__) | ||
56 | #define LEAVE() lbs_pr_debug(1, "Leave: %s, %s:%i\n", \ | ||
57 | __FUNCTION__, __FILE__, __LINE__) | ||
58 | 111 | ||
59 | /** Buffer Constants */ | 112 | /** Buffer Constants */ |
60 | 113 | ||
@@ -74,7 +127,6 @@ static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len) | |||
74 | #define MRVDRV_NUM_OF_CMD_BUFFER 10 | 127 | #define MRVDRV_NUM_OF_CMD_BUFFER 10 |
75 | #define MRVDRV_SIZE_OF_CMD_BUFFER (2 * 1024) | 128 | #define MRVDRV_SIZE_OF_CMD_BUFFER (2 * 1024) |
76 | #define MRVDRV_MAX_CHANNEL_SIZE 14 | 129 | #define MRVDRV_MAX_CHANNEL_SIZE 14 |
77 | #define MRVDRV_MAX_BSSID_LIST 64 | ||
78 | #define MRVDRV_ASSOCIATION_TIME_OUT 255 | 130 | #define MRVDRV_ASSOCIATION_TIME_OUT 255 |
79 | #define MRVDRV_SNAP_HEADER_LEN 8 | 131 | #define MRVDRV_SNAP_HEADER_LEN 8 |
80 | 132 | ||
@@ -104,6 +156,13 @@ static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len) | |||
104 | #define MRVDRV_MAX_BEACON_INTERVAL 1000 | 156 | #define MRVDRV_MAX_BEACON_INTERVAL 1000 |
105 | #define MRVDRV_BEACON_INTERVAL 100 | 157 | #define MRVDRV_BEACON_INTERVAL 100 |
106 | 158 | ||
159 | /** INT status Bit Definition*/ | ||
160 | #define his_cmddnldrdy 0x01 | ||
161 | #define his_cardevent 0x02 | ||
162 | #define his_cmdupldrdy 0x04 | ||
163 | |||
164 | #define SBI_EVENT_CAUSE_SHIFT 3 | ||
165 | |||
107 | /** TxPD status */ | 166 | /** TxPD status */ |
108 | 167 | ||
109 | /* Station firmware use TxPD status field to report final Tx transmit | 168 | /* Station firmware use TxPD status field to report final Tx transmit |
@@ -205,8 +264,6 @@ typedef struct _wlan_adapter wlan_adapter; | |||
205 | extern const char libertas_driver_version[]; | 264 | extern const char libertas_driver_version[]; |
206 | extern u16 libertas_region_code_to_index[MRVDRV_MAX_REGION_CODE]; | 265 | extern u16 libertas_region_code_to_index[MRVDRV_MAX_REGION_CODE]; |
207 | 266 | ||
208 | extern u8 libertas_wlan_data_rates[WLAN_SUPPORTED_RATES]; | ||
209 | |||
210 | extern u8 libertas_supported_rates[G_SUPPORTED_RATES]; | 267 | extern u8 libertas_supported_rates[G_SUPPORTED_RATES]; |
211 | 268 | ||
212 | extern u8 libertas_adhoc_rates_g[G_SUPPORTED_RATES]; | 269 | extern u8 libertas_adhoc_rates_g[G_SUPPORTED_RATES]; |
@@ -316,6 +373,8 @@ enum SNMP_MIB_VALUE_e { | |||
316 | /* Default values for fwt commands. */ | 373 | /* Default values for fwt commands. */ |
317 | #define FWT_DEFAULT_METRIC 0 | 374 | #define FWT_DEFAULT_METRIC 0 |
318 | #define FWT_DEFAULT_DIR 1 | 375 | #define FWT_DEFAULT_DIR 1 |
376 | /* Default Rate, 11Mbps */ | ||
377 | #define FWT_DEFAULT_RATE 3 | ||
319 | #define FWT_DEFAULT_SSN 0xffffffff | 378 | #define FWT_DEFAULT_SSN 0xffffffff |
320 | #define FWT_DEFAULT_DSN 0 | 379 | #define FWT_DEFAULT_DSN 0 |
321 | #define FWT_DEFAULT_HOPCOUNT 0 | 380 | #define FWT_DEFAULT_HOPCOUNT 0 |
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index e8b9020f9bd6..785192b884bc 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h | |||
@@ -63,11 +63,11 @@ struct wlan_802_11_security { | |||
63 | 63 | ||
64 | /** Current Basic Service Set State Structure */ | 64 | /** Current Basic Service Set State Structure */ |
65 | struct current_bss_params { | 65 | struct current_bss_params { |
66 | struct bss_descriptor bssdescriptor; | ||
67 | /** bssid */ | 66 | /** bssid */ |
68 | u8 bssid[ETH_ALEN]; | 67 | u8 bssid[ETH_ALEN]; |
69 | /** ssid */ | 68 | /** ssid */ |
70 | struct WLAN_802_11_SSID ssid; | 69 | u8 ssid[IW_ESSID_MAX_SIZE + 1]; |
70 | u8 ssid_len; | ||
71 | 71 | ||
72 | /** band */ | 72 | /** band */ |
73 | u8 band; | 73 | u8 band; |
@@ -89,31 +89,6 @@ struct sleep_params { | |||
89 | u16 sp_reserved; | 89 | u16 sp_reserved; |
90 | }; | 90 | }; |
91 | 91 | ||
92 | /** Data structure for the Marvell WLAN device */ | ||
93 | typedef struct _wlan_dev { | ||
94 | /** device name */ | ||
95 | char name[DEV_NAME_LEN]; | ||
96 | /** card pointer */ | ||
97 | void *card; | ||
98 | /** IO port */ | ||
99 | u32 ioport; | ||
100 | /** Upload received */ | ||
101 | u32 upld_rcv; | ||
102 | /** Upload type */ | ||
103 | u32 upld_typ; | ||
104 | /** Upload length */ | ||
105 | u32 upld_len; | ||
106 | /** netdev pointer */ | ||
107 | struct net_device *netdev; | ||
108 | /* Upload buffer */ | ||
109 | u8 upld_buf[WLAN_UPLD_SIZE]; | ||
110 | /* Download sent: | ||
111 | bit0 1/0=data_sent/data_tx_done, | ||
112 | bit1 1/0=cmd_sent/cmd_tx_done, | ||
113 | all other bits reserved 0 */ | ||
114 | u8 dnld_sent; | ||
115 | } wlan_dev_t, *pwlan_dev_t; | ||
116 | |||
117 | /* Mesh statistics */ | 92 | /* Mesh statistics */ |
118 | struct wlan_mesh_stats { | 93 | struct wlan_mesh_stats { |
119 | u32 fwd_bcast_cnt; /* Fwd: Broadcast counter */ | 94 | u32 fwd_bcast_cnt; /* Fwd: Broadcast counter */ |
@@ -123,6 +98,7 @@ struct wlan_mesh_stats { | |||
123 | u32 fwd_drop_noroute; /* Fwd: No route to Destination */ | 98 | u32 fwd_drop_noroute; /* Fwd: No route to Destination */ |
124 | u32 fwd_drop_nobuf; /* Fwd: Run out of internal buffers */ | 99 | u32 fwd_drop_nobuf; /* Fwd: Run out of internal buffers */ |
125 | u32 drop_blind; /* Rx: Dropped by blinding table */ | 100 | u32 drop_blind; /* Rx: Dropped by blinding table */ |
101 | u32 tx_failed_cnt; /* Tx: Failed transmissions */ | ||
126 | }; | 102 | }; |
127 | 103 | ||
128 | /** Private structure for the MV device */ | 104 | /** Private structure for the MV device */ |
@@ -131,8 +107,11 @@ struct _wlan_private { | |||
131 | int mesh_open; | 107 | int mesh_open; |
132 | int infra_open; | 108 | int infra_open; |
133 | 109 | ||
110 | char name[DEV_NAME_LEN]; | ||
111 | |||
112 | void *card; | ||
134 | wlan_adapter *adapter; | 113 | wlan_adapter *adapter; |
135 | wlan_dev_t wlan_dev; | 114 | struct net_device *dev; |
136 | 115 | ||
137 | struct net_device_stats stats; | 116 | struct net_device_stats stats; |
138 | struct net_device *mesh_dev ; /* Virtual device */ | 117 | struct net_device *mesh_dev ; /* Virtual device */ |
@@ -153,6 +132,16 @@ struct _wlan_private { | |||
153 | u32 bbp_offset; | 132 | u32 bbp_offset; |
154 | u32 rf_offset; | 133 | u32 rf_offset; |
155 | 134 | ||
135 | /** Upload length */ | ||
136 | u32 upld_len; | ||
137 | /* Upload buffer */ | ||
138 | u8 upld_buf[WLAN_UPLD_SIZE]; | ||
139 | /* Download sent: | ||
140 | bit0 1/0=data_sent/data_tx_done, | ||
141 | bit1 1/0=cmd_sent/cmd_tx_done, | ||
142 | all other bits reserved 0 */ | ||
143 | u8 dnld_sent; | ||
144 | |||
156 | const struct firmware *firmware; | 145 | const struct firmware *firmware; |
157 | struct device *hotplug_device; | 146 | struct device *hotplug_device; |
158 | 147 | ||
@@ -161,6 +150,15 @@ struct _wlan_private { | |||
161 | 150 | ||
162 | struct delayed_work assoc_work; | 151 | struct delayed_work assoc_work; |
163 | struct workqueue_struct *assoc_thread; | 152 | struct workqueue_struct *assoc_thread; |
153 | struct work_struct sync_channel; | ||
154 | |||
155 | /** Hardware access */ | ||
156 | int (*hw_register_dev) (wlan_private * priv); | ||
157 | int (*hw_unregister_dev) (wlan_private *); | ||
158 | int (*hw_prog_firmware) (wlan_private *); | ||
159 | int (*hw_host_to_card) (wlan_private * priv, u8 type, u8 * payload, u16 nb); | ||
160 | int (*hw_get_int_status) (wlan_private * priv, u8 *); | ||
161 | int (*hw_read_event_cause) (wlan_private *); | ||
164 | }; | 162 | }; |
165 | 163 | ||
166 | /** Association request | 164 | /** Association request |
@@ -171,18 +169,21 @@ struct _wlan_private { | |||
171 | struct assoc_request { | 169 | struct assoc_request { |
172 | #define ASSOC_FLAG_SSID 1 | 170 | #define ASSOC_FLAG_SSID 1 |
173 | #define ASSOC_FLAG_CHANNEL 2 | 171 | #define ASSOC_FLAG_CHANNEL 2 |
174 | #define ASSOC_FLAG_MODE 3 | 172 | #define ASSOC_FLAG_BAND 3 |
175 | #define ASSOC_FLAG_BSSID 4 | 173 | #define ASSOC_FLAG_MODE 4 |
176 | #define ASSOC_FLAG_WEP_KEYS 5 | 174 | #define ASSOC_FLAG_BSSID 5 |
177 | #define ASSOC_FLAG_WEP_TX_KEYIDX 6 | 175 | #define ASSOC_FLAG_WEP_KEYS 6 |
178 | #define ASSOC_FLAG_WPA_MCAST_KEY 7 | 176 | #define ASSOC_FLAG_WEP_TX_KEYIDX 7 |
179 | #define ASSOC_FLAG_WPA_UCAST_KEY 8 | 177 | #define ASSOC_FLAG_WPA_MCAST_KEY 8 |
180 | #define ASSOC_FLAG_SECINFO 9 | 178 | #define ASSOC_FLAG_WPA_UCAST_KEY 9 |
181 | #define ASSOC_FLAG_WPA_IE 10 | 179 | #define ASSOC_FLAG_SECINFO 10 |
180 | #define ASSOC_FLAG_WPA_IE 11 | ||
182 | unsigned long flags; | 181 | unsigned long flags; |
183 | 182 | ||
184 | struct WLAN_802_11_SSID ssid; | 183 | u8 ssid[IW_ESSID_MAX_SIZE + 1]; |
184 | u8 ssid_len; | ||
185 | u8 channel; | 185 | u8 channel; |
186 | u8 band; | ||
186 | u8 mode; | 187 | u8 mode; |
187 | u8 bssid[ETH_ALEN]; | 188 | u8 bssid[ETH_ALEN]; |
188 | 189 | ||
@@ -199,12 +200,15 @@ struct assoc_request { | |||
199 | /** WPA Information Elements*/ | 200 | /** WPA Information Elements*/ |
200 | u8 wpa_ie[MAX_WPA_IE_LEN]; | 201 | u8 wpa_ie[MAX_WPA_IE_LEN]; |
201 | u8 wpa_ie_len; | 202 | u8 wpa_ie_len; |
203 | |||
204 | /* BSS to associate with for infrastructure of Ad-Hoc join */ | ||
205 | struct bss_descriptor bss; | ||
202 | }; | 206 | }; |
203 | 207 | ||
204 | /** Wlan adapter data structure*/ | 208 | /** Wlan adapter data structure*/ |
205 | struct _wlan_adapter { | 209 | struct _wlan_adapter { |
206 | /** STATUS variables */ | 210 | /** STATUS variables */ |
207 | u32 fwreleasenumber; | 211 | u8 fwreleasenumber[4]; |
208 | u32 fwcapinfo; | 212 | u32 fwcapinfo; |
209 | /* protected with big lock */ | 213 | /* protected with big lock */ |
210 | 214 | ||
@@ -255,13 +259,14 @@ struct _wlan_adapter { | |||
255 | /* IW_MODE_* */ | 259 | /* IW_MODE_* */ |
256 | u8 mode; | 260 | u8 mode; |
257 | 261 | ||
258 | struct bss_descriptor *pattemptedbssdesc; | 262 | u8 prev_ssid[IW_ESSID_MAX_SIZE + 1]; |
259 | 263 | u8 prev_ssid_len; | |
260 | struct WLAN_802_11_SSID previousssid; | 264 | u8 prev_bssid[ETH_ALEN]; |
261 | u8 previousbssid[ETH_ALEN]; | ||
262 | 265 | ||
263 | struct bss_descriptor *scantable; | 266 | /* Scan results list */ |
264 | u32 numinscantable; | 267 | struct list_head network_list; |
268 | struct list_head network_free_list; | ||
269 | struct bss_descriptor *networks; | ||
265 | 270 | ||
266 | u8 scantype; | 271 | u8 scantype; |
267 | u32 scanmode; | 272 | u32 scanmode; |
@@ -288,7 +293,6 @@ struct _wlan_adapter { | |||
288 | u32 txantenna; | 293 | u32 txantenna; |
289 | u32 rxantenna; | 294 | u32 rxantenna; |
290 | 295 | ||
291 | u8 adhocchannel; | ||
292 | u32 fragthsd; | 296 | u32 fragthsd; |
293 | u32 rtsthsd; | 297 | u32 rtsthsd; |
294 | 298 | ||
@@ -324,7 +328,8 @@ struct _wlan_adapter { | |||
324 | u16 locallisteninterval; | 328 | u16 locallisteninterval; |
325 | u16 nullpktinterval; | 329 | u16 nullpktinterval; |
326 | 330 | ||
327 | struct assoc_request * assoc_req; | 331 | struct assoc_request * pending_assoc_req; |
332 | struct assoc_request * in_progress_assoc_req; | ||
328 | 333 | ||
329 | /** Encryption parameter */ | 334 | /** Encryption parameter */ |
330 | struct wlan_802_11_security secinfo; | 335 | struct wlan_802_11_security secinfo; |
@@ -396,6 +401,8 @@ struct _wlan_adapter { | |||
396 | u32 radiomode; | 401 | u32 radiomode; |
397 | u32 debugmode; | 402 | u32 debugmode; |
398 | u8 fw_ready; | 403 | u8 fw_ready; |
404 | |||
405 | u8 last_scanned_channel; | ||
399 | }; | 406 | }; |
400 | 407 | ||
401 | #endif /* _WLAN_DEV_H_ */ | 408 | #endif /* _WLAN_DEV_H_ */ |
diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c index 0064de542963..96f1974685d4 100644 --- a/drivers/net/wireless/libertas/ethtool.c +++ b/drivers/net/wireless/libertas/ethtool.c | |||
@@ -1,10 +1,8 @@ | |||
1 | |||
2 | #include <linux/netdevice.h> | 1 | #include <linux/netdevice.h> |
3 | #include <linux/ethtool.h> | 2 | #include <linux/ethtool.h> |
4 | #include <linux/delay.h> | 3 | #include <linux/delay.h> |
5 | 4 | ||
6 | #include "host.h" | 5 | #include "host.h" |
7 | #include "sbi.h" | ||
8 | #include "decl.h" | 6 | #include "decl.h" |
9 | #include "defs.h" | 7 | #include "defs.h" |
10 | #include "dev.h" | 8 | #include "dev.h" |
@@ -17,7 +15,8 @@ static const char * mesh_stat_strings[]= { | |||
17 | "drop_no_buffers", | 15 | "drop_no_buffers", |
18 | "fwded_unicast_cnt", | 16 | "fwded_unicast_cnt", |
19 | "fwded_bcast_cnt", | 17 | "fwded_bcast_cnt", |
20 | "drop_blind_table" | 18 | "drop_blind_table", |
19 | "tx_failed_cnt" | ||
21 | }; | 20 | }; |
22 | 21 | ||
23 | static void libertas_ethtool_get_drvinfo(struct net_device *dev, | 22 | static void libertas_ethtool_get_drvinfo(struct net_device *dev, |
@@ -69,7 +68,7 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev, | |||
69 | 68 | ||
70 | /* +14 is for action, offset, and NOB in | 69 | /* +14 is for action, offset, and NOB in |
71 | * response */ | 70 | * response */ |
72 | lbs_pr_debug(1, "action:%d offset: %x NOB: %02x\n", | 71 | lbs_deb_ethtool("action:%d offset: %x NOB: %02x\n", |
73 | regctrl.action, regctrl.offset, regctrl.NOB); | 72 | regctrl.action, regctrl.offset, regctrl.NOB); |
74 | 73 | ||
75 | ret = libertas_prepare_and_send_command(priv, | 74 | ret = libertas_prepare_and_send_command(priv, |
@@ -81,8 +80,7 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev, | |||
81 | if (ret) { | 80 | if (ret) { |
82 | if (adapter->prdeeprom) | 81 | if (adapter->prdeeprom) |
83 | kfree(adapter->prdeeprom); | 82 | kfree(adapter->prdeeprom); |
84 | LEAVE(); | 83 | goto done; |
85 | return ret; | ||
86 | } | 84 | } |
87 | 85 | ||
88 | mdelay(10); | 86 | mdelay(10); |
@@ -101,7 +99,11 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev, | |||
101 | kfree(adapter->prdeeprom); | 99 | kfree(adapter->prdeeprom); |
102 | // mutex_unlock(&priv->mutex); | 100 | // mutex_unlock(&priv->mutex); |
103 | 101 | ||
104 | return 0; | 102 | ret = 0; |
103 | |||
104 | done: | ||
105 | lbs_deb_enter_args(LBS_DEB_ETHTOOL, "ret %d", ret); | ||
106 | return ret; | ||
105 | } | 107 | } |
106 | 108 | ||
107 | static void libertas_ethtool_get_stats(struct net_device * dev, | 109 | static void libertas_ethtool_get_stats(struct net_device * dev, |
@@ -109,7 +111,7 @@ static void libertas_ethtool_get_stats(struct net_device * dev, | |||
109 | { | 111 | { |
110 | wlan_private *priv = dev->priv; | 112 | wlan_private *priv = dev->priv; |
111 | 113 | ||
112 | ENTER(); | 114 | lbs_deb_enter(LBS_DEB_ETHTOOL); |
113 | 115 | ||
114 | stats->cmd = ETHTOOL_GSTATS; | 116 | stats->cmd = ETHTOOL_GSTATS; |
115 | BUG_ON(stats->n_stats != MESH_STATS_NUM); | 117 | BUG_ON(stats->n_stats != MESH_STATS_NUM); |
@@ -121,8 +123,9 @@ static void libertas_ethtool_get_stats(struct net_device * dev, | |||
121 | data[4] = priv->mstats.fwd_unicast_cnt; | 123 | data[4] = priv->mstats.fwd_unicast_cnt; |
122 | data[5] = priv->mstats.fwd_bcast_cnt; | 124 | data[5] = priv->mstats.fwd_bcast_cnt; |
123 | data[6] = priv->mstats.drop_blind; | 125 | data[6] = priv->mstats.drop_blind; |
126 | data[7] = priv->mstats.tx_failed_cnt; | ||
124 | 127 | ||
125 | LEAVE(); | 128 | lbs_deb_enter(LBS_DEB_ETHTOOL); |
126 | } | 129 | } |
127 | 130 | ||
128 | static int libertas_ethtool_get_stats_count(struct net_device * dev) | 131 | static int libertas_ethtool_get_stats_count(struct net_device * dev) |
@@ -131,27 +134,32 @@ static int libertas_ethtool_get_stats_count(struct net_device * dev) | |||
131 | wlan_private *priv = dev->priv; | 134 | wlan_private *priv = dev->priv; |
132 | struct cmd_ds_mesh_access mesh_access; | 135 | struct cmd_ds_mesh_access mesh_access; |
133 | 136 | ||
134 | ENTER(); | 137 | lbs_deb_enter(LBS_DEB_ETHTOOL); |
138 | |||
135 | /* Get Mesh Statistics */ | 139 | /* Get Mesh Statistics */ |
136 | ret = libertas_prepare_and_send_command(priv, | 140 | ret = libertas_prepare_and_send_command(priv, |
137 | cmd_mesh_access, cmd_act_mesh_get_stats, | 141 | cmd_mesh_access, cmd_act_mesh_get_stats, |
138 | cmd_option_waitforrsp, 0, &mesh_access); | 142 | cmd_option_waitforrsp, 0, &mesh_access); |
139 | 143 | ||
140 | if (ret) { | 144 | if (ret) { |
141 | LEAVE(); | 145 | ret = 0; |
142 | return 0; | 146 | goto done; |
143 | } | 147 | } |
144 | 148 | ||
145 | priv->mstats.fwd_drop_rbt = mesh_access.data[0]; | 149 | priv->mstats.fwd_drop_rbt = le32_to_cpu(mesh_access.data[0]); |
146 | priv->mstats.fwd_drop_ttl = mesh_access.data[1]; | 150 | priv->mstats.fwd_drop_ttl = le32_to_cpu(mesh_access.data[1]); |
147 | priv->mstats.fwd_drop_noroute = mesh_access.data[2]; | 151 | priv->mstats.fwd_drop_noroute = le32_to_cpu(mesh_access.data[2]); |
148 | priv->mstats.fwd_drop_nobuf = mesh_access.data[3]; | 152 | priv->mstats.fwd_drop_nobuf = le32_to_cpu(mesh_access.data[3]); |
149 | priv->mstats.fwd_unicast_cnt = mesh_access.data[4]; | 153 | priv->mstats.fwd_unicast_cnt = le32_to_cpu(mesh_access.data[4]); |
150 | priv->mstats.fwd_bcast_cnt = mesh_access.data[5]; | 154 | priv->mstats.fwd_bcast_cnt = le32_to_cpu(mesh_access.data[5]); |
151 | priv->mstats.drop_blind = mesh_access.data[6]; | 155 | priv->mstats.drop_blind = le32_to_cpu(mesh_access.data[6]); |
156 | priv->mstats.tx_failed_cnt = le32_to_cpu(mesh_access.data[7]); | ||
152 | 157 | ||
153 | LEAVE(); | 158 | ret = MESH_STATS_NUM; |
154 | return MESH_STATS_NUM; | 159 | |
160 | done: | ||
161 | lbs_deb_enter_args(LBS_DEB_ETHTOOL, "ret %d", ret); | ||
162 | return ret; | ||
155 | } | 163 | } |
156 | 164 | ||
157 | static void libertas_ethtool_get_strings (struct net_device * dev, | 165 | static void libertas_ethtool_get_strings (struct net_device * dev, |
@@ -160,7 +168,8 @@ static void libertas_ethtool_get_strings (struct net_device * dev, | |||
160 | { | 168 | { |
161 | int i; | 169 | int i; |
162 | 170 | ||
163 | ENTER(); | 171 | lbs_deb_enter(LBS_DEB_ETHTOOL); |
172 | |||
164 | switch (stringset) { | 173 | switch (stringset) { |
165 | case ETH_SS_STATS: | 174 | case ETH_SS_STATS: |
166 | for (i=0; i < MESH_STATS_NUM; i++) { | 175 | for (i=0; i < MESH_STATS_NUM; i++) { |
@@ -170,7 +179,7 @@ static void libertas_ethtool_get_strings (struct net_device * dev, | |||
170 | } | 179 | } |
171 | break; | 180 | break; |
172 | } | 181 | } |
173 | LEAVE(); | 182 | lbs_deb_enter(LBS_DEB_ETHTOOL); |
174 | } | 183 | } |
175 | 184 | ||
176 | struct ethtool_ops libertas_ethtool_ops = { | 185 | struct ethtool_ops libertas_ethtool_ops = { |
diff --git a/drivers/net/wireless/libertas/fw.c b/drivers/net/wireless/libertas/fw.c index 5c63c9b1659c..2dc84ff7a54a 100644 --- a/drivers/net/wireless/libertas/fw.c +++ b/drivers/net/wireless/libertas/fw.c | |||
@@ -1,28 +1,15 @@ | |||
1 | /** | 1 | /** |
2 | * This file contains the initialization for FW and HW | 2 | * This file contains the initialization for FW and HW |
3 | */ | 3 | */ |
4 | #include <linux/module.h> | ||
5 | #include <linux/moduleparam.h> | ||
6 | |||
7 | #include <linux/vmalloc.h> | ||
8 | #include <linux/firmware.h> | 4 | #include <linux/firmware.h> |
9 | #include <linux/version.h> | ||
10 | 5 | ||
11 | #include "host.h" | 6 | #include "host.h" |
12 | #include "sbi.h" | ||
13 | #include "defs.h" | 7 | #include "defs.h" |
14 | #include "decl.h" | 8 | #include "decl.h" |
15 | #include "dev.h" | 9 | #include "dev.h" |
16 | #include "fw.h" | ||
17 | #include "wext.h" | 10 | #include "wext.h" |
18 | #include "if_usb.h" | 11 | #include "if_usb.h" |
19 | 12 | ||
20 | char *libertas_fw_name = NULL; | ||
21 | module_param_named(fw_name, libertas_fw_name, charp, 0644); | ||
22 | |||
23 | unsigned int libertas_debug = 0; | ||
24 | module_param(libertas_debug, int, 0); | ||
25 | |||
26 | /** | 13 | /** |
27 | * @brief This function checks the validity of Boot2/FW image. | 14 | * @brief This function checks the validity of Boot2/FW image. |
28 | * | 15 | * |
@@ -32,7 +19,7 @@ module_param(libertas_debug, int, 0); | |||
32 | */ | 19 | */ |
33 | static int check_fwfile_format(u8 *data, u32 totlen) | 20 | static int check_fwfile_format(u8 *data, u32 totlen) |
34 | { | 21 | { |
35 | u8 bincmd, exit; | 22 | u32 bincmd, exit; |
36 | u32 blksize, offset, len; | 23 | u32 blksize, offset, len; |
37 | int ret; | 24 | int ret; |
38 | 25 | ||
@@ -40,8 +27,10 @@ static int check_fwfile_format(u8 *data, u32 totlen) | |||
40 | exit = len = 0; | 27 | exit = len = 0; |
41 | 28 | ||
42 | do { | 29 | do { |
43 | bincmd = *data; | 30 | struct fwheader *fwh = (void *)data; |
44 | blksize = *(u32*)(data + offsetof(struct fwheader, datalength)); | 31 | |
32 | bincmd = le32_to_cpu(fwh->dnldcmd); | ||
33 | blksize = le32_to_cpu(fwh->datalength); | ||
45 | switch (bincmd) { | 34 | switch (bincmd) { |
46 | case FW_HAS_DATA_TO_RECV: | 35 | case FW_HAS_DATA_TO_RECV: |
47 | offset = sizeof(struct fwheader) + blksize; | 36 | offset = sizeof(struct fwheader) + blksize; |
@@ -61,9 +50,9 @@ static int check_fwfile_format(u8 *data, u32 totlen) | |||
61 | } while (!exit); | 50 | } while (!exit); |
62 | 51 | ||
63 | if (ret) | 52 | if (ret) |
64 | lbs_pr_err("bin file format check FAIL...\n"); | 53 | lbs_pr_err("firmware file format check FAIL\n"); |
65 | else | 54 | else |
66 | lbs_pr_debug(1, "bin file format check PASS...\n"); | 55 | lbs_deb_fw("firmware file format check PASS\n"); |
67 | 56 | ||
68 | return ret; | 57 | return ret; |
69 | } | 58 | } |
@@ -76,32 +65,31 @@ static int check_fwfile_format(u8 *data, u32 totlen) | |||
76 | * @param priv A pointer to wlan_private structure | 65 | * @param priv A pointer to wlan_private structure |
77 | * @return 0 or -1 | 66 | * @return 0 or -1 |
78 | */ | 67 | */ |
79 | static int wlan_setup_station_hw(wlan_private * priv) | 68 | static int wlan_setup_station_hw(wlan_private * priv, char *fw_name) |
80 | { | 69 | { |
81 | int ret = -1; | 70 | int ret = -1; |
82 | wlan_adapter *adapter = priv->adapter; | 71 | wlan_adapter *adapter = priv->adapter; |
83 | 72 | ||
84 | ENTER(); | 73 | lbs_deb_enter(LBS_DEB_FW); |
85 | 74 | ||
86 | if ((ret = request_firmware(&priv->firmware, libertas_fw_name, | 75 | if ((ret = request_firmware(&priv->firmware, fw_name, |
87 | priv->hotplug_device)) < 0) { | 76 | priv->hotplug_device)) < 0) { |
88 | lbs_pr_err("request_firmware() failed, error code = %#x\n", | 77 | lbs_pr_err("request_firmware() failed with %#x\n", ret); |
89 | ret); | 78 | lbs_pr_err("firmware %s not found\n", fw_name); |
90 | lbs_pr_err("%s not found in /lib/firmware\n", libertas_fw_name); | ||
91 | goto done; | 79 | goto done; |
92 | } | 80 | } |
93 | 81 | ||
94 | if(check_fwfile_format(priv->firmware->data, priv->firmware->size)) { | 82 | if (check_fwfile_format(priv->firmware->data, priv->firmware->size)) { |
95 | release_firmware(priv->firmware); | 83 | release_firmware(priv->firmware); |
96 | goto done; | 84 | goto done; |
97 | } | 85 | } |
98 | 86 | ||
99 | ret = libertas_sbi_prog_firmware(priv); | 87 | ret = priv->hw_prog_firmware(priv); |
100 | 88 | ||
101 | release_firmware(priv->firmware); | 89 | release_firmware(priv->firmware); |
102 | 90 | ||
103 | if (ret) { | 91 | if (ret) { |
104 | lbs_pr_debug(1, "Bootloader in invalid state!\n"); | 92 | lbs_deb_fw("bootloader in invalid state\n"); |
105 | ret = -1; | 93 | ret = -1; |
106 | goto done; | 94 | goto done; |
107 | } | 95 | } |
@@ -133,28 +121,24 @@ static int wlan_setup_station_hw(wlan_private * priv) | |||
133 | 121 | ||
134 | ret = 0; | 122 | ret = 0; |
135 | done: | 123 | done: |
136 | LEAVE(); | 124 | lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret); |
137 | 125 | return ret; | |
138 | return (ret); | ||
139 | } | 126 | } |
140 | 127 | ||
141 | static int wlan_allocate_adapter(wlan_private * priv) | 128 | static int wlan_allocate_adapter(wlan_private * priv) |
142 | { | 129 | { |
143 | u32 ulbufsize; | 130 | size_t bufsize; |
144 | wlan_adapter *adapter = priv->adapter; | 131 | wlan_adapter *adapter = priv->adapter; |
145 | 132 | ||
146 | struct bss_descriptor *ptempscantable; | ||
147 | |||
148 | /* Allocate buffer to store the BSSID list */ | 133 | /* Allocate buffer to store the BSSID list */ |
149 | ulbufsize = sizeof(struct bss_descriptor) * MRVDRV_MAX_BSSID_LIST; | 134 | bufsize = MAX_NETWORK_COUNT * sizeof(struct bss_descriptor); |
150 | if (!(ptempscantable = kmalloc(ulbufsize, GFP_KERNEL))) { | 135 | adapter->networks = kzalloc(bufsize, GFP_KERNEL); |
136 | if (!adapter->networks) { | ||
137 | lbs_pr_err("Out of memory allocating beacons\n"); | ||
151 | libertas_free_adapter(priv); | 138 | libertas_free_adapter(priv); |
152 | return -1; | 139 | return -ENOMEM; |
153 | } | 140 | } |
154 | 141 | ||
155 | adapter->scantable = ptempscantable; | ||
156 | memset(adapter->scantable, 0, ulbufsize); | ||
157 | |||
158 | /* Allocate the command buffers */ | 142 | /* Allocate the command buffers */ |
159 | libertas_allocate_cmd_buffer(priv); | 143 | libertas_allocate_cmd_buffer(priv); |
160 | 144 | ||
@@ -202,15 +186,23 @@ static void wlan_init_adapter(wlan_private * priv) | |||
202 | adapter->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; | 186 | adapter->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; |
203 | adapter->mode = IW_MODE_INFRA; | 187 | adapter->mode = IW_MODE_INFRA; |
204 | 188 | ||
205 | adapter->assoc_req = NULL; | 189 | adapter->pending_assoc_req = NULL; |
190 | adapter->in_progress_assoc_req = NULL; | ||
191 | |||
192 | /* Initialize scan result lists */ | ||
193 | INIT_LIST_HEAD(&adapter->network_free_list); | ||
194 | INIT_LIST_HEAD(&adapter->network_list); | ||
195 | for (i = 0; i < MAX_NETWORK_COUNT; i++) { | ||
196 | list_add_tail(&adapter->networks[i].list, | ||
197 | &adapter->network_free_list); | ||
198 | } | ||
206 | 199 | ||
207 | adapter->numinscantable = 0; | ||
208 | adapter->pattemptedbssdesc = NULL; | ||
209 | mutex_init(&adapter->lock); | 200 | mutex_init(&adapter->lock); |
210 | 201 | ||
211 | adapter->prescan = 1; | 202 | adapter->prescan = 1; |
212 | 203 | ||
213 | memset(&adapter->curbssparams, 0, sizeof(adapter->curbssparams)); | 204 | memset(&adapter->curbssparams, 0, sizeof(adapter->curbssparams)); |
205 | adapter->curbssparams.channel = DEFAULT_AD_HOC_CHANNEL; | ||
214 | 206 | ||
215 | /* PnP and power profile */ | 207 | /* PnP and power profile */ |
216 | adapter->surpriseremoved = 0; | 208 | adapter->surpriseremoved = 0; |
@@ -230,8 +222,6 @@ static void wlan_init_adapter(wlan_private * priv) | |||
230 | memset(&adapter->capinfo, 0, sizeof(adapter->capinfo)); | 222 | memset(&adapter->capinfo, 0, sizeof(adapter->capinfo)); |
231 | adapter->capinfo.shortpreamble = SHORT_PREAMBLE_ALLOWED; | 223 | adapter->capinfo.shortpreamble = SHORT_PREAMBLE_ALLOWED; |
232 | 224 | ||
233 | adapter->adhocchannel = DEFAULT_AD_HOC_CHANNEL; | ||
234 | |||
235 | adapter->psmode = wlan802_11powermodecam; | 225 | adapter->psmode = wlan802_11powermodecam; |
236 | adapter->multipledtim = MRVDRV_DEFAULT_MULTIPLE_DTIM; | 226 | adapter->multipledtim = MRVDRV_DEFAULT_MULTIPLE_DTIM; |
237 | 227 | ||
@@ -259,12 +249,12 @@ static void wlan_init_adapter(wlan_private * priv) | |||
259 | 249 | ||
260 | static void command_timer_fn(unsigned long data); | 250 | static void command_timer_fn(unsigned long data); |
261 | 251 | ||
262 | int libertas_init_fw(wlan_private * priv) | 252 | int libertas_init_fw(wlan_private * priv, char *fw_name) |
263 | { | 253 | { |
264 | int ret = -1; | 254 | int ret = -1; |
265 | wlan_adapter *adapter = priv->adapter; | 255 | wlan_adapter *adapter = priv->adapter; |
266 | 256 | ||
267 | ENTER(); | 257 | lbs_deb_enter(LBS_DEB_FW); |
268 | 258 | ||
269 | /* Allocate adapter structure */ | 259 | /* Allocate adapter structure */ |
270 | if ((ret = wlan_allocate_adapter(priv)) != 0) | 260 | if ((ret = wlan_allocate_adapter(priv)) != 0) |
@@ -278,7 +268,7 @@ int libertas_init_fw(wlan_private * priv) | |||
278 | (unsigned long)priv); | 268 | (unsigned long)priv); |
279 | 269 | ||
280 | /* download fimrware etc. */ | 270 | /* download fimrware etc. */ |
281 | if ((ret = wlan_setup_station_hw(priv)) != 0) { | 271 | if ((ret = wlan_setup_station_hw(priv, fw_name)) != 0) { |
282 | del_timer_sync(&adapter->command_timer); | 272 | del_timer_sync(&adapter->command_timer); |
283 | goto done; | 273 | goto done; |
284 | } | 274 | } |
@@ -288,7 +278,7 @@ int libertas_init_fw(wlan_private * priv) | |||
288 | 278 | ||
289 | ret = 0; | 279 | ret = 0; |
290 | done: | 280 | done: |
291 | LEAVE(); | 281 | lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret); |
292 | return ret; | 282 | return ret; |
293 | } | 283 | } |
294 | 284 | ||
@@ -297,25 +287,22 @@ void libertas_free_adapter(wlan_private * priv) | |||
297 | wlan_adapter *adapter = priv->adapter; | 287 | wlan_adapter *adapter = priv->adapter; |
298 | 288 | ||
299 | if (!adapter) { | 289 | if (!adapter) { |
300 | lbs_pr_debug(1, "Why double free adapter?:)\n"); | 290 | lbs_deb_fw("why double free adapter?\n"); |
301 | return; | 291 | return; |
302 | } | 292 | } |
303 | 293 | ||
304 | lbs_pr_debug(1, "Free command buffer\n"); | 294 | lbs_deb_fw("free command buffer\n"); |
305 | libertas_free_cmd_buffer(priv); | 295 | libertas_free_cmd_buffer(priv); |
306 | 296 | ||
307 | lbs_pr_debug(1, "Free commandTimer\n"); | 297 | lbs_deb_fw("free command_timer\n"); |
308 | del_timer(&adapter->command_timer); | 298 | del_timer(&adapter->command_timer); |
309 | 299 | ||
310 | lbs_pr_debug(1, "Free scantable\n"); | 300 | lbs_deb_fw("free scan results table\n"); |
311 | if (adapter->scantable) { | 301 | kfree(adapter->networks); |
312 | kfree(adapter->scantable); | 302 | adapter->networks = NULL; |
313 | adapter->scantable = NULL; | ||
314 | } | ||
315 | |||
316 | lbs_pr_debug(1, "Free adapter\n"); | ||
317 | 303 | ||
318 | /* Free the adapter object itself */ | 304 | /* Free the adapter object itself */ |
305 | lbs_deb_fw("free adapter\n"); | ||
319 | kfree(adapter); | 306 | kfree(adapter); |
320 | priv->adapter = NULL; | 307 | priv->adapter = NULL; |
321 | } | 308 | } |
@@ -334,17 +321,17 @@ static void command_timer_fn(unsigned long data) | |||
334 | 321 | ||
335 | ptempnode = adapter->cur_cmd; | 322 | ptempnode = adapter->cur_cmd; |
336 | if (ptempnode == NULL) { | 323 | if (ptempnode == NULL) { |
337 | lbs_pr_debug(1, "PTempnode Empty\n"); | 324 | lbs_deb_fw("ptempnode empty\n"); |
338 | return; | 325 | return; |
339 | } | 326 | } |
340 | 327 | ||
341 | cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr; | 328 | cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr; |
342 | if (!cmd) { | 329 | if (!cmd) { |
343 | lbs_pr_debug(1, "cmd is NULL\n"); | 330 | lbs_deb_fw("cmd is NULL\n"); |
344 | return; | 331 | return; |
345 | } | 332 | } |
346 | 333 | ||
347 | lbs_pr_info("command_timer_fn fired (%x)\n", cmd->command); | 334 | lbs_deb_fw("command_timer_fn fired, cmd %x\n", cmd->command); |
348 | 335 | ||
349 | if (!adapter->fw_ready) | 336 | if (!adapter->fw_ready) |
350 | return; | 337 | return; |
@@ -353,7 +340,7 @@ static void command_timer_fn(unsigned long data) | |||
353 | adapter->cur_cmd = NULL; | 340 | adapter->cur_cmd = NULL; |
354 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 341 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
355 | 342 | ||
356 | lbs_pr_debug(1, "Re-sending same command as it timeout...!\n"); | 343 | lbs_deb_fw("re-sending same command because of timeout\n"); |
357 | libertas_queue_cmd(adapter, ptempnode, 0); | 344 | libertas_queue_cmd(adapter, ptempnode, 0); |
358 | 345 | ||
359 | wake_up_interruptible(&priv->mainthread.waitq); | 346 | wake_up_interruptible(&priv->mainthread.waitq); |
diff --git a/drivers/net/wireless/libertas/fw.h b/drivers/net/wireless/libertas/fw.h deleted file mode 100644 index 1f9ae267a9e0..000000000000 --- a/drivers/net/wireless/libertas/fw.h +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | /** | ||
2 | * This header file contains FW interface related definitions. | ||
3 | */ | ||
4 | #ifndef _WLAN_FW_H_ | ||
5 | #define _WLAN_FW_H_ | ||
6 | |||
7 | #ifndef DEV_NAME_LEN | ||
8 | #define DEV_NAME_LEN 32 | ||
9 | #endif | ||
10 | |||
11 | int libertas_init_fw(wlan_private * priv); | ||
12 | |||
13 | #endif /* _WLAN_FW_H_ */ | ||
diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h index c0faaecaf5be..7509cc10af3c 100644 --- a/drivers/net/wireless/libertas/host.h +++ b/drivers/net/wireless/libertas/host.h | |||
@@ -99,11 +99,11 @@ | |||
99 | #define cmd_bt_access 0x0087 | 99 | #define cmd_bt_access 0x0087 |
100 | #define cmd_ret_bt_access 0x8087 | 100 | #define cmd_ret_bt_access 0x8087 |
101 | 101 | ||
102 | #define cmd_fwt_access 0x0088 | 102 | #define cmd_fwt_access 0x0095 |
103 | #define cmd_ret_fwt_access 0x8088 | 103 | #define cmd_ret_fwt_access 0x8095 |
104 | 104 | ||
105 | #define cmd_mesh_access 0x0090 | 105 | #define cmd_mesh_access 0x009b |
106 | #define cmd_ret_mesh_access 0x8090 | 106 | #define cmd_ret_mesh_access 0x809b |
107 | 107 | ||
108 | /* For the IEEE Power Save */ | 108 | /* For the IEEE Power Save */ |
109 | #define cmd_subcmd_enter_ps 0x0030 | 109 | #define cmd_subcmd_enter_ps 0x0030 |
@@ -287,7 +287,9 @@ enum cmd_bt_access_opts { | |||
287 | cmd_act_bt_access_add = 5, | 287 | cmd_act_bt_access_add = 5, |
288 | cmd_act_bt_access_del, | 288 | cmd_act_bt_access_del, |
289 | cmd_act_bt_access_list, | 289 | cmd_act_bt_access_list, |
290 | cmd_act_bt_access_reset | 290 | cmd_act_bt_access_reset, |
291 | cmd_act_bt_access_set_invert, | ||
292 | cmd_act_bt_access_get_invert | ||
291 | }; | 293 | }; |
292 | 294 | ||
293 | /* Define action or option for cmd_fwt_access */ | 295 | /* Define action or option for cmd_fwt_access */ |
@@ -308,8 +310,8 @@ enum cmd_mesh_access_opts { | |||
308 | cmd_act_mesh_get_ttl = 1, | 310 | cmd_act_mesh_get_ttl = 1, |
309 | cmd_act_mesh_set_ttl, | 311 | cmd_act_mesh_set_ttl, |
310 | cmd_act_mesh_get_stats, | 312 | cmd_act_mesh_get_stats, |
311 | cmd_act_mesh_get_mpp, | 313 | cmd_act_mesh_get_anycast, |
312 | cmd_act_mesh_set_mpp, | 314 | cmd_act_mesh_set_anycast, |
313 | }; | 315 | }; |
314 | 316 | ||
315 | /** Card Event definition */ | 317 | /** Card Event definition */ |
@@ -334,5 +336,6 @@ enum cmd_mesh_access_opts { | |||
334 | #define MACREG_INT_CODE_MAX_FAIL 0x0000001b | 336 | #define MACREG_INT_CODE_MAX_FAIL 0x0000001b |
335 | #define MACREG_INT_CODE_RSSI_HIGH 0x0000001c | 337 | #define MACREG_INT_CODE_RSSI_HIGH 0x0000001c |
336 | #define MACREG_INT_CODE_SNR_HIGH 0x0000001d | 338 | #define MACREG_INT_CODE_SNR_HIGH 0x0000001d |
339 | #define MACREG_INT_CODE_MESH_AUTO_STARTED 0x00000023 | ||
337 | 340 | ||
338 | #endif /* _HOST_H_ */ | 341 | #endif /* _HOST_H_ */ |
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index f239e5d2435b..3acf93988125 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h | |||
@@ -14,12 +14,12 @@ | |||
14 | /* TxPD descriptor */ | 14 | /* TxPD descriptor */ |
15 | struct txpd { | 15 | struct txpd { |
16 | /* Current Tx packet status */ | 16 | /* Current Tx packet status */ |
17 | u32 tx_status; | 17 | __le32 tx_status; |
18 | /* Tx control */ | 18 | /* Tx control */ |
19 | u32 tx_control; | 19 | __le32 tx_control; |
20 | u32 tx_packet_location; | 20 | __le32 tx_packet_location; |
21 | /* Tx packet length */ | 21 | /* Tx packet length */ |
22 | u16 tx_packet_length; | 22 | __le16 tx_packet_length; |
23 | /* First 2 byte of destination MAC address */ | 23 | /* First 2 byte of destination MAC address */ |
24 | u8 tx_dest_addr_high[2]; | 24 | u8 tx_dest_addr_high[2]; |
25 | /* Last 4 byte of destination MAC address */ | 25 | /* Last 4 byte of destination MAC address */ |
@@ -37,7 +37,7 @@ struct txpd { | |||
37 | /* RxPD Descriptor */ | 37 | /* RxPD Descriptor */ |
38 | struct rxpd { | 38 | struct rxpd { |
39 | /* Current Rx packet status */ | 39 | /* Current Rx packet status */ |
40 | u16 status; | 40 | __le16 status; |
41 | 41 | ||
42 | /* SNR */ | 42 | /* SNR */ |
43 | u8 snr; | 43 | u8 snr; |
@@ -46,7 +46,7 @@ struct rxpd { | |||
46 | u8 rx_control; | 46 | u8 rx_control; |
47 | 47 | ||
48 | /* Pkt length */ | 48 | /* Pkt length */ |
49 | u16 pkt_len; | 49 | __le16 pkt_len; |
50 | 50 | ||
51 | /* Noise Floor */ | 51 | /* Noise Floor */ |
52 | u8 nf; | 52 | u8 nf; |
@@ -55,10 +55,10 @@ struct rxpd { | |||
55 | u8 rx_rate; | 55 | u8 rx_rate; |
56 | 56 | ||
57 | /* Pkt addr */ | 57 | /* Pkt addr */ |
58 | u32 pkt_ptr; | 58 | __le32 pkt_ptr; |
59 | 59 | ||
60 | /* Next Rx RxPD addr */ | 60 | /* Next Rx RxPD addr */ |
61 | u32 next_rxpd_ptr; | 61 | __le32 next_rxpd_ptr; |
62 | 62 | ||
63 | /* Pkt Priority */ | 63 | /* Pkt Priority */ |
64 | u8 priority; | 64 | u8 priority; |
@@ -89,30 +89,17 @@ struct cmd_ctrl_node { | |||
89 | * is determined from the keylength field. | 89 | * is determined from the keylength field. |
90 | */ | 90 | */ |
91 | struct WLAN_802_11_KEY { | 91 | struct WLAN_802_11_KEY { |
92 | u32 len; | 92 | __le32 len; |
93 | u32 flags; /* KEY_INFO_* from wlan_defs.h */ | 93 | __le32 flags; /* KEY_INFO_* from wlan_defs.h */ |
94 | u8 key[MRVL_MAX_KEY_WPA_KEY_LENGTH]; | 94 | u8 key[MRVL_MAX_KEY_WPA_KEY_LENGTH]; |
95 | u16 type; /* KEY_TYPE_* from wlan_defs.h */ | 95 | __le16 type; /* KEY_TYPE_* from wlan_defs.h */ |
96 | }; | 96 | }; |
97 | 97 | ||
98 | struct IE_WPA { | 98 | struct IE_WPA { |
99 | u8 elementid; | 99 | u8 elementid; |
100 | u8 len; | 100 | u8 len; |
101 | u8 oui[4]; | 101 | u8 oui[4]; |
102 | u16 version; | 102 | __le16 version; |
103 | }; | ||
104 | |||
105 | struct WLAN_802_11_SSID { | ||
106 | /* SSID length */ | ||
107 | u32 ssidlength; | ||
108 | |||
109 | /* SSID information field */ | ||
110 | u8 ssid[IW_ESSID_MAX_SIZE]; | ||
111 | }; | ||
112 | |||
113 | struct WPA_SUPPLICANT { | ||
114 | u8 wpa_ie[256]; | ||
115 | u8 wpa_ie_len; | ||
116 | }; | 103 | }; |
117 | 104 | ||
118 | /* wlan_offset_value */ | 105 | /* wlan_offset_value */ |
@@ -122,9 +109,9 @@ struct wlan_offset_value { | |||
122 | }; | 109 | }; |
123 | 110 | ||
124 | struct WLAN_802_11_FIXED_IEs { | 111 | struct WLAN_802_11_FIXED_IEs { |
125 | u8 timestamp[8]; | 112 | __le64 timestamp; |
126 | u16 beaconinterval; | 113 | __le16 beaconinterval; |
127 | u16 capabilities; | 114 | u16 capabilities; /* Actually struct ieeetypes_capinfo */ |
128 | }; | 115 | }; |
129 | 116 | ||
130 | struct WLAN_802_11_VARIABLE_IEs { | 117 | struct WLAN_802_11_VARIABLE_IEs { |
@@ -136,10 +123,10 @@ struct WLAN_802_11_VARIABLE_IEs { | |||
136 | /* Define general data structure */ | 123 | /* Define general data structure */ |
137 | /* cmd_DS_GEN */ | 124 | /* cmd_DS_GEN */ |
138 | struct cmd_ds_gen { | 125 | struct cmd_ds_gen { |
139 | u16 command; | 126 | __le16 command; |
140 | u16 size; | 127 | __le16 size; |
141 | u16 seqnum; | 128 | __le16 seqnum; |
142 | u16 result; | 129 | __le16 result; |
143 | }; | 130 | }; |
144 | 131 | ||
145 | #define S_DS_GEN sizeof(struct cmd_ds_gen) | 132 | #define S_DS_GEN sizeof(struct cmd_ds_gen) |
@@ -149,44 +136,44 @@ struct cmd_ds_gen { | |||
149 | */ | 136 | */ |
150 | struct cmd_ds_get_hw_spec { | 137 | struct cmd_ds_get_hw_spec { |
151 | /* HW Interface version number */ | 138 | /* HW Interface version number */ |
152 | u16 hwifversion; | 139 | __le16 hwifversion; |
153 | /* HW version number */ | 140 | /* HW version number */ |
154 | u16 version; | 141 | __le16 version; |
155 | /* Max number of TxPD FW can handle */ | 142 | /* Max number of TxPD FW can handle */ |
156 | u16 nr_txpd; | 143 | __le16 nr_txpd; |
157 | /* Max no of Multicast address */ | 144 | /* Max no of Multicast address */ |
158 | u16 nr_mcast_adr; | 145 | __le16 nr_mcast_adr; |
159 | /* MAC address */ | 146 | /* MAC address */ |
160 | u8 permanentaddr[6]; | 147 | u8 permanentaddr[6]; |
161 | 148 | ||
162 | /* region Code */ | 149 | /* region Code */ |
163 | u16 regioncode; | 150 | __le16 regioncode; |
164 | 151 | ||
165 | /* Number of antenna used */ | 152 | /* Number of antenna used */ |
166 | u16 nr_antenna; | 153 | __le16 nr_antenna; |
167 | 154 | ||
168 | /* FW release number, example 0x1234=1.2.3.4 */ | 155 | /* FW release number, example 1,2,3,4 = 3.2.1p4 */ |
169 | u32 fwreleasenumber; | 156 | u8 fwreleasenumber[4]; |
170 | 157 | ||
171 | /* Base Address of TxPD queue */ | 158 | /* Base Address of TxPD queue */ |
172 | u32 wcb_base; | 159 | __le32 wcb_base; |
173 | /* Read Pointer of RxPd queue */ | 160 | /* Read Pointer of RxPd queue */ |
174 | u32 rxpd_rdptr; | 161 | __le32 rxpd_rdptr; |
175 | 162 | ||
176 | /* Write Pointer of RxPd queue */ | 163 | /* Write Pointer of RxPd queue */ |
177 | u32 rxpd_wrptr; | 164 | __le32 rxpd_wrptr; |
178 | 165 | ||
179 | /*FW/HW capability */ | 166 | /*FW/HW capability */ |
180 | u32 fwcapinfo; | 167 | __le32 fwcapinfo; |
181 | } __attribute__ ((packed)); | 168 | } __attribute__ ((packed)); |
182 | 169 | ||
183 | struct cmd_ds_802_11_reset { | 170 | struct cmd_ds_802_11_reset { |
184 | u16 action; | 171 | __le16 action; |
185 | }; | 172 | }; |
186 | 173 | ||
187 | struct cmd_ds_802_11_subscribe_event { | 174 | struct cmd_ds_802_11_subscribe_event { |
188 | u16 action; | 175 | __le16 action; |
189 | u16 events; | 176 | __le16 events; |
190 | }; | 177 | }; |
191 | 178 | ||
192 | /* | 179 | /* |
@@ -205,35 +192,35 @@ struct cmd_ds_802_11_scan { | |||
205 | }; | 192 | }; |
206 | 193 | ||
207 | struct cmd_ds_802_11_scan_rsp { | 194 | struct cmd_ds_802_11_scan_rsp { |
208 | u16 bssdescriptsize; | 195 | __le16 bssdescriptsize; |
209 | u8 nr_sets; | 196 | u8 nr_sets; |
210 | u8 bssdesc_and_tlvbuffer[1]; | 197 | u8 bssdesc_and_tlvbuffer[1]; |
211 | }; | 198 | }; |
212 | 199 | ||
213 | struct cmd_ds_802_11_get_log { | 200 | struct cmd_ds_802_11_get_log { |
214 | u32 mcasttxframe; | 201 | __le32 mcasttxframe; |
215 | u32 failed; | 202 | __le32 failed; |
216 | u32 retry; | 203 | __le32 retry; |
217 | u32 multiretry; | 204 | __le32 multiretry; |
218 | u32 framedup; | 205 | __le32 framedup; |
219 | u32 rtssuccess; | 206 | __le32 rtssuccess; |
220 | u32 rtsfailure; | 207 | __le32 rtsfailure; |
221 | u32 ackfailure; | 208 | __le32 ackfailure; |
222 | u32 rxfrag; | 209 | __le32 rxfrag; |
223 | u32 mcastrxframe; | 210 | __le32 mcastrxframe; |
224 | u32 fcserror; | 211 | __le32 fcserror; |
225 | u32 txframe; | 212 | __le32 txframe; |
226 | u32 wepundecryptable; | 213 | __le32 wepundecryptable; |
227 | }; | 214 | }; |
228 | 215 | ||
229 | struct cmd_ds_mac_control { | 216 | struct cmd_ds_mac_control { |
230 | u16 action; | 217 | __le16 action; |
231 | u16 reserved; | 218 | __le16 reserved; |
232 | }; | 219 | }; |
233 | 220 | ||
234 | struct cmd_ds_mac_multicast_adr { | 221 | struct cmd_ds_mac_multicast_adr { |
235 | u16 action; | 222 | __le16 action; |
236 | u16 nr_of_adrs; | 223 | __le16 nr_of_adrs; |
237 | u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE]; | 224 | u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE]; |
238 | }; | 225 | }; |
239 | 226 | ||
@@ -245,14 +232,14 @@ struct cmd_ds_802_11_authenticate { | |||
245 | 232 | ||
246 | struct cmd_ds_802_11_deauthenticate { | 233 | struct cmd_ds_802_11_deauthenticate { |
247 | u8 macaddr[6]; | 234 | u8 macaddr[6]; |
248 | u16 reasoncode; | 235 | __le16 reasoncode; |
249 | }; | 236 | }; |
250 | 237 | ||
251 | struct cmd_ds_802_11_associate { | 238 | struct cmd_ds_802_11_associate { |
252 | u8 peerstaaddr[6]; | 239 | u8 peerstaaddr[6]; |
253 | struct ieeetypes_capinfo capinfo; | 240 | struct ieeetypes_capinfo capinfo; |
254 | u16 listeninterval; | 241 | __le16 listeninterval; |
255 | u16 bcnperiod; | 242 | __le16 bcnperiod; |
256 | u8 dtimperiod; | 243 | u8 dtimperiod; |
257 | 244 | ||
258 | #if 0 | 245 | #if 0 |
@@ -265,7 +252,7 @@ struct cmd_ds_802_11_associate { | |||
265 | 252 | ||
266 | struct cmd_ds_802_11_disassociate { | 253 | struct cmd_ds_802_11_disassociate { |
267 | u8 destmacaddr[6]; | 254 | u8 destmacaddr[6]; |
268 | u16 reasoncode; | 255 | __le16 reasoncode; |
269 | }; | 256 | }; |
270 | 257 | ||
271 | struct cmd_ds_802_11_associate_rsp { | 258 | struct cmd_ds_802_11_associate_rsp { |
@@ -279,10 +266,10 @@ struct cmd_ds_802_11_ad_hoc_result { | |||
279 | 266 | ||
280 | struct cmd_ds_802_11_set_wep { | 267 | struct cmd_ds_802_11_set_wep { |
281 | /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */ | 268 | /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */ |
282 | u16 action; | 269 | __le16 action; |
283 | 270 | ||
284 | /* key Index selected for Tx */ | 271 | /* key Index selected for Tx */ |
285 | u16 keyindex; | 272 | __le16 keyindex; |
286 | 273 | ||
287 | /* 40, 128bit or TXWEP */ | 274 | /* 40, 128bit or TXWEP */ |
288 | u8 keytype[4]; | 275 | u8 keytype[4]; |
@@ -290,96 +277,96 @@ struct cmd_ds_802_11_set_wep { | |||
290 | }; | 277 | }; |
291 | 278 | ||
292 | struct cmd_ds_802_3_get_stat { | 279 | struct cmd_ds_802_3_get_stat { |
293 | u32 xmitok; | 280 | __le32 xmitok; |
294 | u32 rcvok; | 281 | __le32 rcvok; |
295 | u32 xmiterror; | 282 | __le32 xmiterror; |
296 | u32 rcverror; | 283 | __le32 rcverror; |
297 | u32 rcvnobuffer; | 284 | __le32 rcvnobuffer; |
298 | u32 rcvcrcerror; | 285 | __le32 rcvcrcerror; |
299 | }; | 286 | }; |
300 | 287 | ||
301 | struct cmd_ds_802_11_get_stat { | 288 | struct cmd_ds_802_11_get_stat { |
302 | u32 txfragmentcnt; | 289 | __le32 txfragmentcnt; |
303 | u32 mcasttxframecnt; | 290 | __le32 mcasttxframecnt; |
304 | u32 failedcnt; | 291 | __le32 failedcnt; |
305 | u32 retrycnt; | 292 | __le32 retrycnt; |
306 | u32 Multipleretrycnt; | 293 | __le32 Multipleretrycnt; |
307 | u32 rtssuccesscnt; | 294 | __le32 rtssuccesscnt; |
308 | u32 rtsfailurecnt; | 295 | __le32 rtsfailurecnt; |
309 | u32 ackfailurecnt; | 296 | __le32 ackfailurecnt; |
310 | u32 frameduplicatecnt; | 297 | __le32 frameduplicatecnt; |
311 | u32 rxfragmentcnt; | 298 | __le32 rxfragmentcnt; |
312 | u32 mcastrxframecnt; | 299 | __le32 mcastrxframecnt; |
313 | u32 fcserrorcnt; | 300 | __le32 fcserrorcnt; |
314 | u32 bcasttxframecnt; | 301 | __le32 bcasttxframecnt; |
315 | u32 bcastrxframecnt; | 302 | __le32 bcastrxframecnt; |
316 | u32 txbeacon; | 303 | __le32 txbeacon; |
317 | u32 rxbeacon; | 304 | __le32 rxbeacon; |
318 | u32 wepundecryptable; | 305 | __le32 wepundecryptable; |
319 | }; | 306 | }; |
320 | 307 | ||
321 | struct cmd_ds_802_11_snmp_mib { | 308 | struct cmd_ds_802_11_snmp_mib { |
322 | u16 querytype; | 309 | __le16 querytype; |
323 | u16 oid; | 310 | __le16 oid; |
324 | u16 bufsize; | 311 | __le16 bufsize; |
325 | u8 value[128]; | 312 | u8 value[128]; |
326 | }; | 313 | }; |
327 | 314 | ||
328 | struct cmd_ds_mac_reg_map { | 315 | struct cmd_ds_mac_reg_map { |
329 | u16 buffersize; | 316 | __le16 buffersize; |
330 | u8 regmap[128]; | 317 | u8 regmap[128]; |
331 | u16 reserved; | 318 | __le16 reserved; |
332 | }; | 319 | }; |
333 | 320 | ||
334 | struct cmd_ds_bbp_reg_map { | 321 | struct cmd_ds_bbp_reg_map { |
335 | u16 buffersize; | 322 | __le16 buffersize; |
336 | u8 regmap[128]; | 323 | u8 regmap[128]; |
337 | u16 reserved; | 324 | __le16 reserved; |
338 | }; | 325 | }; |
339 | 326 | ||
340 | struct cmd_ds_rf_reg_map { | 327 | struct cmd_ds_rf_reg_map { |
341 | u16 buffersize; | 328 | __le16 buffersize; |
342 | u8 regmap[64]; | 329 | u8 regmap[64]; |
343 | u16 reserved; | 330 | __le16 reserved; |
344 | }; | 331 | }; |
345 | 332 | ||
346 | struct cmd_ds_mac_reg_access { | 333 | struct cmd_ds_mac_reg_access { |
347 | u16 action; | 334 | __le16 action; |
348 | u16 offset; | 335 | __le16 offset; |
349 | u32 value; | 336 | __le32 value; |
350 | }; | 337 | }; |
351 | 338 | ||
352 | struct cmd_ds_bbp_reg_access { | 339 | struct cmd_ds_bbp_reg_access { |
353 | u16 action; | 340 | __le16 action; |
354 | u16 offset; | 341 | __le16 offset; |
355 | u8 value; | 342 | u8 value; |
356 | u8 reserved[3]; | 343 | u8 reserved[3]; |
357 | }; | 344 | }; |
358 | 345 | ||
359 | struct cmd_ds_rf_reg_access { | 346 | struct cmd_ds_rf_reg_access { |
360 | u16 action; | 347 | __le16 action; |
361 | u16 offset; | 348 | __le16 offset; |
362 | u8 value; | 349 | u8 value; |
363 | u8 reserved[3]; | 350 | u8 reserved[3]; |
364 | }; | 351 | }; |
365 | 352 | ||
366 | struct cmd_ds_802_11_radio_control { | 353 | struct cmd_ds_802_11_radio_control { |
367 | u16 action; | 354 | __le16 action; |
368 | u16 control; | 355 | __le16 control; |
369 | }; | 356 | }; |
370 | 357 | ||
371 | struct cmd_ds_802_11_sleep_params { | 358 | struct cmd_ds_802_11_sleep_params { |
372 | /* ACT_GET/ACT_SET */ | 359 | /* ACT_GET/ACT_SET */ |
373 | u16 action; | 360 | __le16 action; |
374 | 361 | ||
375 | /* Sleep clock error in ppm */ | 362 | /* Sleep clock error in ppm */ |
376 | u16 error; | 363 | __le16 error; |
377 | 364 | ||
378 | /* Wakeup offset in usec */ | 365 | /* Wakeup offset in usec */ |
379 | u16 offset; | 366 | __le16 offset; |
380 | 367 | ||
381 | /* Clock stabilization time in usec */ | 368 | /* Clock stabilization time in usec */ |
382 | u16 stabletime; | 369 | __le16 stabletime; |
383 | 370 | ||
384 | /* control periodic calibration */ | 371 | /* control periodic calibration */ |
385 | u8 calcontrol; | 372 | u8 calcontrol; |
@@ -388,100 +375,100 @@ struct cmd_ds_802_11_sleep_params { | |||
388 | u8 externalsleepclk; | 375 | u8 externalsleepclk; |
389 | 376 | ||
390 | /* reserved field, should be set to zero */ | 377 | /* reserved field, should be set to zero */ |
391 | u16 reserved; | 378 | __le16 reserved; |
392 | }; | 379 | }; |
393 | 380 | ||
394 | struct cmd_ds_802_11_inactivity_timeout { | 381 | struct cmd_ds_802_11_inactivity_timeout { |
395 | /* ACT_GET/ACT_SET */ | 382 | /* ACT_GET/ACT_SET */ |
396 | u16 action; | 383 | __le16 action; |
397 | 384 | ||
398 | /* Inactivity timeout in msec */ | 385 | /* Inactivity timeout in msec */ |
399 | u16 timeout; | 386 | __le16 timeout; |
400 | }; | 387 | }; |
401 | 388 | ||
402 | struct cmd_ds_802_11_rf_channel { | 389 | struct cmd_ds_802_11_rf_channel { |
403 | u16 action; | 390 | __le16 action; |
404 | u16 currentchannel; | 391 | __le16 currentchannel; |
405 | u16 rftype; | 392 | __le16 rftype; |
406 | u16 reserved; | 393 | __le16 reserved; |
407 | u8 channellist[32]; | 394 | u8 channellist[32]; |
408 | }; | 395 | }; |
409 | 396 | ||
410 | struct cmd_ds_802_11_rssi { | 397 | struct cmd_ds_802_11_rssi { |
411 | /* weighting factor */ | 398 | /* weighting factor */ |
412 | u16 N; | 399 | __le16 N; |
413 | 400 | ||
414 | u16 reserved_0; | 401 | __le16 reserved_0; |
415 | u16 reserved_1; | 402 | __le16 reserved_1; |
416 | u16 reserved_2; | 403 | __le16 reserved_2; |
417 | }; | 404 | }; |
418 | 405 | ||
419 | struct cmd_ds_802_11_rssi_rsp { | 406 | struct cmd_ds_802_11_rssi_rsp { |
420 | u16 SNR; | 407 | __le16 SNR; |
421 | u16 noisefloor; | 408 | __le16 noisefloor; |
422 | u16 avgSNR; | 409 | __le16 avgSNR; |
423 | u16 avgnoisefloor; | 410 | __le16 avgnoisefloor; |
424 | }; | 411 | }; |
425 | 412 | ||
426 | struct cmd_ds_802_11_mac_address { | 413 | struct cmd_ds_802_11_mac_address { |
427 | u16 action; | 414 | __le16 action; |
428 | u8 macadd[ETH_ALEN]; | 415 | u8 macadd[ETH_ALEN]; |
429 | }; | 416 | }; |
430 | 417 | ||
431 | struct cmd_ds_802_11_rf_tx_power { | 418 | struct cmd_ds_802_11_rf_tx_power { |
432 | u16 action; | 419 | __le16 action; |
433 | u16 currentlevel; | 420 | __le16 currentlevel; |
434 | }; | 421 | }; |
435 | 422 | ||
436 | struct cmd_ds_802_11_rf_antenna { | 423 | struct cmd_ds_802_11_rf_antenna { |
437 | u16 action; | 424 | __le16 action; |
438 | 425 | ||
439 | /* Number of antennas or 0xffff(diversity) */ | 426 | /* Number of antennas or 0xffff(diversity) */ |
440 | u16 antennamode; | 427 | __le16 antennamode; |
441 | 428 | ||
442 | }; | 429 | }; |
443 | 430 | ||
444 | struct cmd_ds_802_11_ps_mode { | 431 | struct cmd_ds_802_11_ps_mode { |
445 | u16 action; | 432 | __le16 action; |
446 | u16 nullpktinterval; | 433 | __le16 nullpktinterval; |
447 | u16 multipledtim; | 434 | __le16 multipledtim; |
448 | u16 reserved; | 435 | __le16 reserved; |
449 | u16 locallisteninterval; | 436 | __le16 locallisteninterval; |
450 | }; | 437 | }; |
451 | 438 | ||
452 | struct PS_CMD_ConfirmSleep { | 439 | struct PS_CMD_ConfirmSleep { |
453 | u16 command; | 440 | __le16 command; |
454 | u16 size; | 441 | __le16 size; |
455 | u16 seqnum; | 442 | __le16 seqnum; |
456 | u16 result; | 443 | __le16 result; |
457 | 444 | ||
458 | u16 action; | 445 | __le16 action; |
459 | u16 reserved1; | 446 | __le16 reserved1; |
460 | u16 multipledtim; | 447 | __le16 multipledtim; |
461 | u16 reserved; | 448 | __le16 reserved; |
462 | u16 locallisteninterval; | 449 | __le16 locallisteninterval; |
463 | }; | 450 | }; |
464 | 451 | ||
465 | struct cmd_ds_802_11_data_rate { | 452 | struct cmd_ds_802_11_data_rate { |
466 | u16 action; | 453 | __le16 action; |
467 | u16 reserverd; | 454 | __le16 reserverd; |
468 | u8 datarate[G_SUPPORTED_RATES]; | 455 | u8 datarate[G_SUPPORTED_RATES]; |
469 | }; | 456 | }; |
470 | 457 | ||
471 | struct cmd_ds_802_11_rate_adapt_rateset { | 458 | struct cmd_ds_802_11_rate_adapt_rateset { |
472 | u16 action; | 459 | __le16 action; |
473 | u16 enablehwauto; | 460 | __le16 enablehwauto; |
474 | u16 bitmap; | 461 | __le16 bitmap; |
475 | }; | 462 | }; |
476 | 463 | ||
477 | struct cmd_ds_802_11_ad_hoc_start { | 464 | struct cmd_ds_802_11_ad_hoc_start { |
478 | u8 SSID[IW_ESSID_MAX_SIZE]; | 465 | u8 SSID[IW_ESSID_MAX_SIZE]; |
479 | u8 bsstype; | 466 | u8 bsstype; |
480 | u16 beaconperiod; | 467 | __le16 beaconperiod; |
481 | u8 dtimperiod; | 468 | u8 dtimperiod; |
482 | union IEEEtypes_ssparamset ssparamset; | 469 | union IEEEtypes_ssparamset ssparamset; |
483 | union ieeetypes_phyparamset phyparamset; | 470 | union ieeetypes_phyparamset phyparamset; |
484 | u16 probedelay; | 471 | __le16 probedelay; |
485 | struct ieeetypes_capinfo cap; | 472 | struct ieeetypes_capinfo cap; |
486 | u8 datarate[G_SUPPORTED_RATES]; | 473 | u8 datarate[G_SUPPORTED_RATES]; |
487 | u8 tlv_memory_size_pad[100]; | 474 | u8 tlv_memory_size_pad[100]; |
@@ -491,10 +478,10 @@ struct adhoc_bssdesc { | |||
491 | u8 BSSID[6]; | 478 | u8 BSSID[6]; |
492 | u8 SSID[32]; | 479 | u8 SSID[32]; |
493 | u8 bsstype; | 480 | u8 bsstype; |
494 | u16 beaconperiod; | 481 | __le16 beaconperiod; |
495 | u8 dtimperiod; | 482 | u8 dtimperiod; |
496 | u8 timestamp[8]; | 483 | __le64 timestamp; |
497 | u8 localtime[8]; | 484 | __le64 localtime; |
498 | union ieeetypes_phyparamset phyparamset; | 485 | union ieeetypes_phyparamset phyparamset; |
499 | union IEEEtypes_ssparamset ssparamset; | 486 | union IEEEtypes_ssparamset ssparamset; |
500 | struct ieeetypes_capinfo cap; | 487 | struct ieeetypes_capinfo cap; |
@@ -508,52 +495,52 @@ struct adhoc_bssdesc { | |||
508 | 495 | ||
509 | struct cmd_ds_802_11_ad_hoc_join { | 496 | struct cmd_ds_802_11_ad_hoc_join { |
510 | struct adhoc_bssdesc bssdescriptor; | 497 | struct adhoc_bssdesc bssdescriptor; |
511 | u16 failtimeout; | 498 | __le16 failtimeout; |
512 | u16 probedelay; | 499 | __le16 probedelay; |
513 | 500 | ||
514 | } __attribute__ ((packed)); | 501 | } __attribute__ ((packed)); |
515 | 502 | ||
516 | struct cmd_ds_802_11_enable_rsn { | 503 | struct cmd_ds_802_11_enable_rsn { |
517 | u16 action; | 504 | __le16 action; |
518 | u16 enable; | 505 | __le16 enable; |
519 | }; | 506 | }; |
520 | 507 | ||
521 | struct MrvlIEtype_keyParamSet { | 508 | struct MrvlIEtype_keyParamSet { |
522 | /* type ID */ | 509 | /* type ID */ |
523 | u16 type; | 510 | __le16 type; |
524 | 511 | ||
525 | /* length of Payload */ | 512 | /* length of Payload */ |
526 | u16 length; | 513 | __le16 length; |
527 | 514 | ||
528 | /* type of key: WEP=0, TKIP=1, AES=2 */ | 515 | /* type of key: WEP=0, TKIP=1, AES=2 */ |
529 | u16 keytypeid; | 516 | __le16 keytypeid; |
530 | 517 | ||
531 | /* key control Info specific to a keytypeid */ | 518 | /* key control Info specific to a keytypeid */ |
532 | u16 keyinfo; | 519 | __le16 keyinfo; |
533 | 520 | ||
534 | /* length of key */ | 521 | /* length of key */ |
535 | u16 keylen; | 522 | __le16 keylen; |
536 | 523 | ||
537 | /* key material of size keylen */ | 524 | /* key material of size keylen */ |
538 | u8 key[32]; | 525 | u8 key[32]; |
539 | }; | 526 | }; |
540 | 527 | ||
541 | struct cmd_ds_802_11_key_material { | 528 | struct cmd_ds_802_11_key_material { |
542 | u16 action; | 529 | __le16 action; |
543 | struct MrvlIEtype_keyParamSet keyParamSet[2]; | 530 | struct MrvlIEtype_keyParamSet keyParamSet[2]; |
544 | } __attribute__ ((packed)); | 531 | } __attribute__ ((packed)); |
545 | 532 | ||
546 | struct cmd_ds_802_11_eeprom_access { | 533 | struct cmd_ds_802_11_eeprom_access { |
547 | u16 action; | 534 | __le16 action; |
548 | 535 | ||
549 | /* multiple 4 */ | 536 | /* multiple 4 */ |
550 | u16 offset; | 537 | __le16 offset; |
551 | u16 bytecount; | 538 | __le16 bytecount; |
552 | u8 value; | 539 | u8 value; |
553 | } __attribute__ ((packed)); | 540 | } __attribute__ ((packed)); |
554 | 541 | ||
555 | struct cmd_ds_802_11_tpc_cfg { | 542 | struct cmd_ds_802_11_tpc_cfg { |
556 | u16 action; | 543 | __le16 action; |
557 | u8 enable; | 544 | u8 enable; |
558 | s8 P0; | 545 | s8 P0; |
559 | s8 P1; | 546 | s8 P1; |
@@ -562,13 +549,13 @@ struct cmd_ds_802_11_tpc_cfg { | |||
562 | } __attribute__ ((packed)); | 549 | } __attribute__ ((packed)); |
563 | 550 | ||
564 | struct cmd_ds_802_11_led_ctrl { | 551 | struct cmd_ds_802_11_led_ctrl { |
565 | u16 action; | 552 | __le16 action; |
566 | u16 numled; | 553 | __le16 numled; |
567 | u8 data[256]; | 554 | u8 data[256]; |
568 | } __attribute__ ((packed)); | 555 | } __attribute__ ((packed)); |
569 | 556 | ||
570 | struct cmd_ds_802_11_pwr_cfg { | 557 | struct cmd_ds_802_11_pwr_cfg { |
571 | u16 action; | 558 | __le16 action; |
572 | u8 enable; | 559 | u8 enable; |
573 | s8 PA_P0; | 560 | s8 PA_P0; |
574 | s8 PA_P1; | 561 | s8 PA_P1; |
@@ -576,21 +563,21 @@ struct cmd_ds_802_11_pwr_cfg { | |||
576 | } __attribute__ ((packed)); | 563 | } __attribute__ ((packed)); |
577 | 564 | ||
578 | struct cmd_ds_802_11_afc { | 565 | struct cmd_ds_802_11_afc { |
579 | u16 afc_auto; | 566 | __le16 afc_auto; |
580 | union { | 567 | union { |
581 | struct { | 568 | struct { |
582 | u16 threshold; | 569 | __le16 threshold; |
583 | u16 period; | 570 | __le16 period; |
584 | }; | 571 | }; |
585 | struct { | 572 | struct { |
586 | s16 timing_offset; | 573 | __le16 timing_offset; /* signed */ |
587 | s16 carrier_offset; | 574 | __le16 carrier_offset; /* signed */ |
588 | }; | 575 | }; |
589 | }; | 576 | }; |
590 | } __attribute__ ((packed)); | 577 | } __attribute__ ((packed)); |
591 | 578 | ||
592 | struct cmd_tx_rate_query { | 579 | struct cmd_tx_rate_query { |
593 | u16 txrate; | 580 | __le16 txrate; |
594 | } __attribute__ ((packed)); | 581 | } __attribute__ ((packed)); |
595 | 582 | ||
596 | struct cmd_ds_get_tsf { | 583 | struct cmd_ds_get_tsf { |
@@ -598,41 +585,46 @@ struct cmd_ds_get_tsf { | |||
598 | } __attribute__ ((packed)); | 585 | } __attribute__ ((packed)); |
599 | 586 | ||
600 | struct cmd_ds_bt_access { | 587 | struct cmd_ds_bt_access { |
601 | u16 action; | 588 | __le16 action; |
602 | u32 id; | 589 | __le32 id; |
603 | u8 addr1[ETH_ALEN]; | 590 | u8 addr1[ETH_ALEN]; |
604 | u8 addr2[ETH_ALEN]; | 591 | u8 addr2[ETH_ALEN]; |
605 | } __attribute__ ((packed)); | 592 | } __attribute__ ((packed)); |
606 | 593 | ||
607 | struct cmd_ds_fwt_access { | 594 | struct cmd_ds_fwt_access { |
608 | u16 action; | 595 | __le16 action; |
609 | u32 id; | 596 | __le32 id; |
597 | u8 valid; | ||
610 | u8 da[ETH_ALEN]; | 598 | u8 da[ETH_ALEN]; |
611 | u8 dir; | 599 | u8 dir; |
612 | u8 ra[ETH_ALEN]; | 600 | u8 ra[ETH_ALEN]; |
613 | u32 ssn; | 601 | __le32 ssn; |
614 | u32 dsn; | 602 | __le32 dsn; |
615 | u32 metric; | 603 | __le32 metric; |
604 | u8 rate; | ||
616 | u8 hopcount; | 605 | u8 hopcount; |
617 | u8 ttl; | 606 | u8 ttl; |
618 | u32 expiration; | 607 | __le32 expiration; |
619 | u8 sleepmode; | 608 | u8 sleepmode; |
620 | u32 snr; | 609 | __le32 snr; |
621 | u32 references; | 610 | __le32 references; |
611 | u8 prec[ETH_ALEN]; | ||
622 | } __attribute__ ((packed)); | 612 | } __attribute__ ((packed)); |
623 | 613 | ||
624 | #define MESH_STATS_NUM 7 | ||
625 | struct cmd_ds_mesh_access { | 614 | struct cmd_ds_mesh_access { |
626 | u16 action; | 615 | __le16 action; |
627 | u32 data[MESH_STATS_NUM + 1]; /* last position reserved */ | 616 | __le32 data[32]; /* last position reserved */ |
628 | } __attribute__ ((packed)); | 617 | } __attribute__ ((packed)); |
629 | 618 | ||
619 | /* Number of stats counters returned by the firmware */ | ||
620 | #define MESH_STATS_NUM 8 | ||
621 | |||
630 | struct cmd_ds_command { | 622 | struct cmd_ds_command { |
631 | /* command header */ | 623 | /* command header */ |
632 | u16 command; | 624 | __le16 command; |
633 | u16 size; | 625 | __le16 size; |
634 | u16 seqnum; | 626 | __le16 seqnum; |
635 | u16 result; | 627 | __le16 result; |
636 | 628 | ||
637 | /* command Body */ | 629 | /* command Body */ |
638 | union { | 630 | union { |
diff --git a/drivers/net/wireless/libertas/if_bootcmd.c b/drivers/net/wireless/libertas/if_bootcmd.c index 567000c3e87b..8bca306ffad9 100644 --- a/drivers/net/wireless/libertas/if_bootcmd.c +++ b/drivers/net/wireless/libertas/if_bootcmd.c | |||
@@ -8,6 +8,8 @@ | |||
8 | #include <linux/netdevice.h> | 8 | #include <linux/netdevice.h> |
9 | #include <linux/usb.h> | 9 | #include <linux/usb.h> |
10 | 10 | ||
11 | #define DRV_NAME "usb8xxx" | ||
12 | |||
11 | #include "defs.h" | 13 | #include "defs.h" |
12 | #include "dev.h" | 14 | #include "dev.h" |
13 | #include "if_usb.h" | 15 | #include "if_usb.h" |
@@ -20,12 +22,12 @@ | |||
20 | */ | 22 | */ |
21 | int if_usb_issue_boot_command(wlan_private *priv, int ivalue) | 23 | int if_usb_issue_boot_command(wlan_private *priv, int ivalue) |
22 | { | 24 | { |
23 | struct usb_card_rec *cardp = priv->wlan_dev.card; | 25 | struct usb_card_rec *cardp = priv->card; |
24 | struct bootcmdstr sbootcmd; | 26 | struct bootcmdstr sbootcmd; |
25 | int i; | 27 | int i; |
26 | 28 | ||
27 | /* Prepare command */ | 29 | /* Prepare command */ |
28 | sbootcmd.u32magicnumber = BOOT_CMD_MAGIC_NUMBER; | 30 | sbootcmd.u32magicnumber = cpu_to_le32(BOOT_CMD_MAGIC_NUMBER); |
29 | sbootcmd.u8cmd_tag = ivalue; | 31 | sbootcmd.u8cmd_tag = ivalue; |
30 | for (i=0; i<11; i++) | 32 | for (i=0; i<11; i++) |
31 | sbootcmd.au8dumy[i]=0x00; | 33 | sbootcmd.au8dumy[i]=0x00; |
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index ae6f72a6cdf3..998317571ec2 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c | |||
@@ -2,12 +2,15 @@ | |||
2 | * This file contains functions used in USB interface module. | 2 | * This file contains functions used in USB interface module. |
3 | */ | 3 | */ |
4 | #include <linux/delay.h> | 4 | #include <linux/delay.h> |
5 | #include <linux/moduleparam.h> | ||
5 | #include <linux/firmware.h> | 6 | #include <linux/firmware.h> |
6 | #include <linux/netdevice.h> | 7 | #include <linux/netdevice.h> |
8 | #include <linux/list.h> | ||
7 | #include <linux/usb.h> | 9 | #include <linux/usb.h> |
8 | 10 | ||
11 | #define DRV_NAME "usb8xxx" | ||
12 | |||
9 | #include "host.h" | 13 | #include "host.h" |
10 | #include "sbi.h" | ||
11 | #include "decl.h" | 14 | #include "decl.h" |
12 | #include "defs.h" | 15 | #include "defs.h" |
13 | #include "dev.h" | 16 | #include "dev.h" |
@@ -16,15 +19,24 @@ | |||
16 | #define MESSAGE_HEADER_LEN 4 | 19 | #define MESSAGE_HEADER_LEN 4 |
17 | 20 | ||
18 | static const char usbdriver_name[] = "usb8xxx"; | 21 | static const char usbdriver_name[] = "usb8xxx"; |
22 | static u8 *default_fw_name = "usb8388.bin"; | ||
23 | |||
24 | char *libertas_fw_name = NULL; | ||
25 | module_param_named(fw_name, libertas_fw_name, charp, 0644); | ||
26 | |||
27 | /* | ||
28 | * We need to send a RESET command to all USB devices before | ||
29 | * we tear down the USB connection. Otherwise we would not | ||
30 | * be able to re-init device the device if the module gets | ||
31 | * loaded again. This is a list of all initialized USB devices, | ||
32 | * for the reset code see if_usb_reset_device() | ||
33 | */ | ||
34 | static LIST_HEAD(usb_devices); | ||
19 | 35 | ||
20 | static struct usb_device_id if_usb_table[] = { | 36 | static struct usb_device_id if_usb_table[] = { |
21 | /* Enter the device signature inside */ | 37 | /* Enter the device signature inside */ |
22 | { | 38 | { USB_DEVICE(0x1286, 0x2001) }, |
23 | USB_DEVICE(USB8388_VID_1, USB8388_PID_1), | 39 | { USB_DEVICE(0x05a3, 0x8388) }, |
24 | }, | ||
25 | { | ||
26 | USB_DEVICE(USB8388_VID_2, USB8388_PID_2), | ||
27 | }, | ||
28 | {} /* Terminating entry */ | 40 | {} /* Terminating entry */ |
29 | }; | 41 | }; |
30 | 42 | ||
@@ -32,6 +44,13 @@ MODULE_DEVICE_TABLE(usb, if_usb_table); | |||
32 | 44 | ||
33 | static void if_usb_receive(struct urb *urb); | 45 | static void if_usb_receive(struct urb *urb); |
34 | static void if_usb_receive_fwload(struct urb *urb); | 46 | static void if_usb_receive_fwload(struct urb *urb); |
47 | static int if_usb_reset_device(wlan_private *priv); | ||
48 | static int if_usb_register_dev(wlan_private * priv); | ||
49 | static int if_usb_unregister_dev(wlan_private *); | ||
50 | static int if_usb_prog_firmware(wlan_private *); | ||
51 | static int if_usb_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb); | ||
52 | static int if_usb_get_int_status(wlan_private * priv, u8 *); | ||
53 | static int if_usb_read_event_cause(wlan_private *); | ||
35 | 54 | ||
36 | /** | 55 | /** |
37 | * @brief call back function to handle the status of the URB | 56 | * @brief call back function to handle the status of the URB |
@@ -42,23 +61,27 @@ static void if_usb_write_bulk_callback(struct urb *urb) | |||
42 | { | 61 | { |
43 | wlan_private *priv = (wlan_private *) (urb->context); | 62 | wlan_private *priv = (wlan_private *) (urb->context); |
44 | wlan_adapter *adapter = priv->adapter; | 63 | wlan_adapter *adapter = priv->adapter; |
45 | struct net_device *dev = priv->wlan_dev.netdev; | 64 | struct net_device *dev = priv->dev; |
46 | 65 | ||
47 | /* handle the transmission complete validations */ | 66 | /* handle the transmission complete validations */ |
48 | 67 | ||
49 | if (urb->status != 0) { | 68 | if (urb->status != 0) { |
50 | /* print the failure status number for debug */ | 69 | /* print the failure status number for debug */ |
51 | lbs_pr_info("URB in failure status\n"); | 70 | lbs_pr_info("URB in failure status: %d\n", urb->status); |
52 | } else { | 71 | } else { |
53 | lbs_dev_dbg(2, &urb->dev->dev, "URB status is successfull\n"); | 72 | /* |
54 | lbs_dev_dbg(2, &urb->dev->dev, "Actual length transmitted %d\n", | 73 | lbs_deb_usbd(&urb->dev->dev, "URB status is successfull\n"); |
74 | lbs_deb_usbd(&urb->dev->dev, "Actual length transmitted %d\n", | ||
55 | urb->actual_length); | 75 | urb->actual_length); |
56 | priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED; | 76 | */ |
77 | priv->dnld_sent = DNLD_RES_RECEIVED; | ||
57 | /* Wake main thread if commands are pending */ | 78 | /* Wake main thread if commands are pending */ |
58 | if (!adapter->cur_cmd) | 79 | if (!adapter->cur_cmd) |
59 | wake_up_interruptible(&priv->mainthread.waitq); | 80 | wake_up_interruptible(&priv->mainthread.waitq); |
60 | if ((adapter->connect_status == libertas_connected)) | 81 | if ((adapter->connect_status == libertas_connected)) { |
61 | netif_wake_queue(dev); | 82 | netif_wake_queue(dev); |
83 | netif_wake_queue(priv->mesh_dev); | ||
84 | } | ||
62 | } | 85 | } |
63 | 86 | ||
64 | return; | 87 | return; |
@@ -71,7 +94,7 @@ static void if_usb_write_bulk_callback(struct urb *urb) | |||
71 | */ | 94 | */ |
72 | void if_usb_free(struct usb_card_rec *cardp) | 95 | void if_usb_free(struct usb_card_rec *cardp) |
73 | { | 96 | { |
74 | ENTER(); | 97 | lbs_deb_enter(LBS_DEB_USB); |
75 | 98 | ||
76 | /* Unlink tx & rx urb */ | 99 | /* Unlink tx & rx urb */ |
77 | usb_kill_urb(cardp->tx_urb); | 100 | usb_kill_urb(cardp->tx_urb); |
@@ -86,8 +109,7 @@ void if_usb_free(struct usb_card_rec *cardp) | |||
86 | kfree(cardp->bulk_out_buffer); | 109 | kfree(cardp->bulk_out_buffer); |
87 | cardp->bulk_out_buffer = NULL; | 110 | cardp->bulk_out_buffer = NULL; |
88 | 111 | ||
89 | LEAVE(); | 112 | lbs_deb_leave(LBS_DEB_USB); |
90 | return; | ||
91 | } | 113 | } |
92 | 114 | ||
93 | /** | 115 | /** |
@@ -102,27 +124,27 @@ static int if_usb_probe(struct usb_interface *intf, | |||
102 | struct usb_device *udev; | 124 | struct usb_device *udev; |
103 | struct usb_host_interface *iface_desc; | 125 | struct usb_host_interface *iface_desc; |
104 | struct usb_endpoint_descriptor *endpoint; | 126 | struct usb_endpoint_descriptor *endpoint; |
105 | wlan_private *pwlanpriv; | 127 | wlan_private *priv; |
106 | struct usb_card_rec *usb_cardp; | 128 | struct usb_card_rec *cardp; |
107 | int i; | 129 | int i; |
108 | 130 | ||
109 | udev = interface_to_usbdev(intf); | 131 | udev = interface_to_usbdev(intf); |
110 | 132 | ||
111 | usb_cardp = kzalloc(sizeof(struct usb_card_rec), GFP_KERNEL); | 133 | cardp = kzalloc(sizeof(struct usb_card_rec), GFP_KERNEL); |
112 | if (!usb_cardp) { | 134 | if (!cardp) { |
113 | lbs_pr_err("Out of memory allocating private data.\n"); | 135 | lbs_pr_err("Out of memory allocating private data.\n"); |
114 | goto error; | 136 | goto error; |
115 | } | 137 | } |
116 | 138 | ||
117 | usb_cardp->udev = udev; | 139 | cardp->udev = udev; |
118 | iface_desc = intf->cur_altsetting; | 140 | iface_desc = intf->cur_altsetting; |
119 | 141 | ||
120 | lbs_dev_dbg(1, &udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X" | 142 | lbs_deb_usbd(&udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X" |
121 | " bDeviceSubClass = 0x%X, bDeviceProtocol = 0x%X\n", | 143 | " bDeviceSubClass = 0x%X, bDeviceProtocol = 0x%X\n", |
122 | udev->descriptor.bcdUSB, | 144 | le16_to_cpu(udev->descriptor.bcdUSB), |
123 | udev->descriptor.bDeviceClass, | 145 | udev->descriptor.bDeviceClass, |
124 | udev->descriptor.bDeviceSubClass, | 146 | udev->descriptor.bDeviceSubClass, |
125 | udev->descriptor.bDeviceProtocol); | 147 | udev->descriptor.bDeviceProtocol); |
126 | 148 | ||
127 | for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { | 149 | for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { |
128 | endpoint = &iface_desc->endpoint[i].desc; | 150 | endpoint = &iface_desc->endpoint[i].desc; |
@@ -130,23 +152,21 @@ static int if_usb_probe(struct usb_interface *intf, | |||
130 | && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | 152 | && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == |
131 | USB_ENDPOINT_XFER_BULK)) { | 153 | USB_ENDPOINT_XFER_BULK)) { |
132 | /* we found a bulk in endpoint */ | 154 | /* we found a bulk in endpoint */ |
133 | lbs_dev_dbg(1, &udev->dev, "Bulk in size is %d\n", | 155 | lbs_deb_usbd(&udev->dev, "Bulk in size is %d\n", |
134 | endpoint->wMaxPacketSize); | 156 | le16_to_cpu(endpoint->wMaxPacketSize)); |
135 | if (! | 157 | if (!(cardp->rx_urb = usb_alloc_urb(0, GFP_KERNEL))) { |
136 | (usb_cardp->rx_urb = | 158 | lbs_deb_usbd(&udev->dev, |
137 | usb_alloc_urb(0, GFP_KERNEL))) { | ||
138 | lbs_dev_dbg(1, &udev->dev, | ||
139 | "Rx URB allocation failed\n"); | 159 | "Rx URB allocation failed\n"); |
140 | goto dealloc; | 160 | goto dealloc; |
141 | } | 161 | } |
142 | usb_cardp->rx_urb_recall = 0; | 162 | cardp->rx_urb_recall = 0; |
143 | 163 | ||
144 | usb_cardp->bulk_in_size = | 164 | cardp->bulk_in_size = |
145 | endpoint->wMaxPacketSize; | 165 | le16_to_cpu(endpoint->wMaxPacketSize); |
146 | usb_cardp->bulk_in_endpointAddr = | 166 | cardp->bulk_in_endpointAddr = |
147 | (endpoint-> | 167 | (endpoint-> |
148 | bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); | 168 | bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); |
149 | lbs_dev_dbg(1, &udev->dev, "in_endpoint = %d\n", | 169 | lbs_deb_usbd(&udev->dev, "in_endpoint = %d\n", |
150 | endpoint->bEndpointAddress); | 170 | endpoint->bEndpointAddress); |
151 | } | 171 | } |
152 | 172 | ||
@@ -156,55 +176,63 @@ static int if_usb_probe(struct usb_interface *intf, | |||
156 | && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | 176 | && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == |
157 | USB_ENDPOINT_XFER_BULK)) { | 177 | USB_ENDPOINT_XFER_BULK)) { |
158 | /* We found bulk out endpoint */ | 178 | /* We found bulk out endpoint */ |
159 | if (! | 179 | if (!(cardp->tx_urb = usb_alloc_urb(0, GFP_KERNEL))) { |
160 | (usb_cardp->tx_urb = | 180 | lbs_deb_usbd(&udev->dev, |
161 | usb_alloc_urb(0, GFP_KERNEL))) { | ||
162 | lbs_dev_dbg(1,&udev->dev, | ||
163 | "Tx URB allocation failed\n"); | 181 | "Tx URB allocation failed\n"); |
164 | goto dealloc; | 182 | goto dealloc; |
165 | } | 183 | } |
166 | 184 | ||
167 | usb_cardp->bulk_out_size = | 185 | cardp->bulk_out_size = |
168 | endpoint->wMaxPacketSize; | 186 | le16_to_cpu(endpoint->wMaxPacketSize); |
169 | lbs_dev_dbg(1, &udev->dev, | 187 | lbs_deb_usbd(&udev->dev, |
170 | "Bulk out size is %d\n", | 188 | "Bulk out size is %d\n", |
171 | endpoint->wMaxPacketSize); | 189 | le16_to_cpu(endpoint->wMaxPacketSize)); |
172 | usb_cardp->bulk_out_endpointAddr = | 190 | cardp->bulk_out_endpointAddr = |
173 | endpoint->bEndpointAddress; | 191 | endpoint->bEndpointAddress; |
174 | lbs_dev_dbg(1, &udev->dev, "out_endpoint = %d\n", | 192 | lbs_deb_usbd(&udev->dev, "out_endpoint = %d\n", |
175 | endpoint->bEndpointAddress); | 193 | endpoint->bEndpointAddress); |
176 | usb_cardp->bulk_out_buffer = | 194 | cardp->bulk_out_buffer = |
177 | kmalloc(MRVDRV_ETH_TX_PACKET_BUFFER_SIZE, | 195 | kmalloc(MRVDRV_ETH_TX_PACKET_BUFFER_SIZE, |
178 | GFP_KERNEL); | 196 | GFP_KERNEL); |
179 | 197 | ||
180 | if (!usb_cardp->bulk_out_buffer) { | 198 | if (!cardp->bulk_out_buffer) { |
181 | lbs_dev_dbg(1, &udev->dev, | 199 | lbs_deb_usbd(&udev->dev, |
182 | "Could not allocate buffer\n"); | 200 | "Could not allocate buffer\n"); |
183 | goto dealloc; | 201 | goto dealloc; |
184 | } | 202 | } |
185 | } | 203 | } |
186 | } | 204 | } |
187 | 205 | ||
188 | 206 | if (!(priv = libertas_add_card(cardp, &udev->dev))) | |
189 | /* At this point wlan_add_card() will be called. Don't worry | ||
190 | * about keeping pwlanpriv around since it will be set on our | ||
191 | * usb device data in -> add() -> libertas_sbi_register_dev(). | ||
192 | */ | ||
193 | if (!(pwlanpriv = wlan_add_card(usb_cardp))) | ||
194 | goto dealloc; | 207 | goto dealloc; |
195 | 208 | ||
209 | if (libertas_add_mesh(priv, &udev->dev)) | ||
210 | goto err_add_mesh; | ||
211 | |||
212 | priv->hw_register_dev = if_usb_register_dev; | ||
213 | priv->hw_unregister_dev = if_usb_unregister_dev; | ||
214 | priv->hw_prog_firmware = if_usb_prog_firmware; | ||
215 | priv->hw_host_to_card = if_usb_host_to_card; | ||
216 | priv->hw_get_int_status = if_usb_get_int_status; | ||
217 | priv->hw_read_event_cause = if_usb_read_event_cause; | ||
218 | |||
219 | if (libertas_activate_card(priv, libertas_fw_name)) | ||
220 | goto err_activate_card; | ||
221 | |||
222 | list_add_tail(&cardp->list, &usb_devices); | ||
223 | |||
196 | usb_get_dev(udev); | 224 | usb_get_dev(udev); |
197 | usb_set_intfdata(intf, usb_cardp); | 225 | usb_set_intfdata(intf, cardp); |
198 | 226 | ||
199 | /* | ||
200 | * return card structure, which can be got back in the | ||
201 | * diconnect function as the ptr | ||
202 | * argument. | ||
203 | */ | ||
204 | return 0; | 227 | return 0; |
205 | 228 | ||
229 | err_activate_card: | ||
230 | libertas_remove_mesh(priv); | ||
231 | err_add_mesh: | ||
232 | free_netdev(priv->dev); | ||
233 | kfree(priv->adapter); | ||
206 | dealloc: | 234 | dealloc: |
207 | if_usb_free(usb_cardp); | 235 | if_usb_free(cardp); |
208 | 236 | ||
209 | error: | 237 | error: |
210 | return -ENOMEM; | 238 | return -ENOMEM; |
@@ -212,8 +240,7 @@ error: | |||
212 | 240 | ||
213 | /** | 241 | /** |
214 | * @brief free resource and cleanup | 242 | * @brief free resource and cleanup |
215 | * @param udev pointer to usb_device | 243 | * @param intf USB interface structure |
216 | * @param ptr pointer to usb_cardp | ||
217 | * @return N/A | 244 | * @return N/A |
218 | */ | 245 | */ |
219 | static void if_usb_disconnect(struct usb_interface *intf) | 246 | static void if_usb_disconnect(struct usb_interface *intf) |
@@ -229,9 +256,12 @@ static void if_usb_disconnect(struct usb_interface *intf) | |||
229 | */ | 256 | */ |
230 | adapter->surpriseremoved = 1; | 257 | adapter->surpriseremoved = 1; |
231 | 258 | ||
259 | list_del(&cardp->list); | ||
260 | |||
232 | /* card is removed and we can call wlan_remove_card */ | 261 | /* card is removed and we can call wlan_remove_card */ |
233 | lbs_dev_dbg(1, &cardp->udev->dev, "call remove card\n"); | 262 | lbs_deb_usbd(&cardp->udev->dev, "call remove card\n"); |
234 | wlan_remove_card(cardp); | 263 | libertas_remove_mesh(priv); |
264 | libertas_remove_card(priv); | ||
235 | 265 | ||
236 | /* Unlink and free urb */ | 266 | /* Unlink and free urb */ |
237 | if_usb_free(cardp); | 267 | if_usb_free(cardp); |
@@ -249,7 +279,7 @@ static void if_usb_disconnect(struct usb_interface *intf) | |||
249 | */ | 279 | */ |
250 | static int if_prog_firmware(wlan_private * priv) | 280 | static int if_prog_firmware(wlan_private * priv) |
251 | { | 281 | { |
252 | struct usb_card_rec *cardp = priv->wlan_dev.card; | 282 | struct usb_card_rec *cardp = priv->card; |
253 | struct FWData *fwdata; | 283 | struct FWData *fwdata; |
254 | struct fwheader *fwheader; | 284 | struct fwheader *fwheader; |
255 | u8 *firmware = priv->firmware->data; | 285 | u8 *firmware = priv->firmware->data; |
@@ -266,8 +296,10 @@ static int if_prog_firmware(wlan_private * priv) | |||
266 | cardp->fwseqnum = cardp->lastseqnum - 1; | 296 | cardp->fwseqnum = cardp->lastseqnum - 1; |
267 | } | 297 | } |
268 | 298 | ||
269 | lbs_dev_dbg(2, &cardp->udev->dev, "totalbytes = %d\n", | 299 | /* |
300 | lbs_deb_usbd(&cardp->udev->dev, "totalbytes = %d\n", | ||
270 | cardp->totalbytes); | 301 | cardp->totalbytes); |
302 | */ | ||
271 | 303 | ||
272 | memcpy(fwheader, &firmware[cardp->totalbytes], | 304 | memcpy(fwheader, &firmware[cardp->totalbytes], |
273 | sizeof(struct fwheader)); | 305 | sizeof(struct fwheader)); |
@@ -275,40 +307,48 @@ static int if_prog_firmware(wlan_private * priv) | |||
275 | cardp->fwlastblksent = cardp->totalbytes; | 307 | cardp->fwlastblksent = cardp->totalbytes; |
276 | cardp->totalbytes += sizeof(struct fwheader); | 308 | cardp->totalbytes += sizeof(struct fwheader); |
277 | 309 | ||
278 | lbs_dev_dbg(2, &cardp->udev->dev,"Copy Data\n"); | 310 | /* lbs_deb_usbd(&cardp->udev->dev,"Copy Data\n"); */ |
279 | memcpy(fwdata->data, &firmware[cardp->totalbytes], | 311 | memcpy(fwdata->data, &firmware[cardp->totalbytes], |
280 | fwdata->fwheader.datalength); | 312 | le32_to_cpu(fwdata->fwheader.datalength)); |
281 | 313 | ||
282 | lbs_dev_dbg(2, &cardp->udev->dev, | 314 | /* |
283 | "Data length = %d\n", fwdata->fwheader.datalength); | 315 | lbs_deb_usbd(&cardp->udev->dev, |
316 | "Data length = %d\n", le32_to_cpu(fwdata->fwheader.datalength)); | ||
317 | */ | ||
284 | 318 | ||
285 | cardp->fwseqnum = cardp->fwseqnum + 1; | 319 | cardp->fwseqnum = cardp->fwseqnum + 1; |
286 | 320 | ||
287 | fwdata->seqnum = cardp->fwseqnum; | 321 | fwdata->seqnum = cpu_to_le32(cardp->fwseqnum); |
288 | cardp->lastseqnum = fwdata->seqnum; | 322 | cardp->lastseqnum = cardp->fwseqnum; |
289 | cardp->totalbytes += fwdata->fwheader.datalength; | 323 | cardp->totalbytes += le32_to_cpu(fwdata->fwheader.datalength); |
290 | 324 | ||
291 | if (fwheader->dnldcmd == FW_HAS_DATA_TO_RECV) { | 325 | if (fwheader->dnldcmd == cpu_to_le32(FW_HAS_DATA_TO_RECV)) { |
292 | lbs_dev_dbg(2, &cardp->udev->dev, "There is data to follow\n"); | 326 | /* |
293 | lbs_dev_dbg(2, &cardp->udev->dev, | 327 | lbs_deb_usbd(&cardp->udev->dev, "There are data to follow\n"); |
328 | lbs_deb_usbd(&cardp->udev->dev, | ||
294 | "seqnum = %d totalbytes = %d\n", cardp->fwseqnum, | 329 | "seqnum = %d totalbytes = %d\n", cardp->fwseqnum, |
295 | cardp->totalbytes); | 330 | cardp->totalbytes); |
331 | */ | ||
296 | memcpy(cardp->bulk_out_buffer, fwheader, FW_DATA_XMIT_SIZE); | 332 | memcpy(cardp->bulk_out_buffer, fwheader, FW_DATA_XMIT_SIZE); |
297 | usb_tx_block(priv, cardp->bulk_out_buffer, FW_DATA_XMIT_SIZE); | 333 | usb_tx_block(priv, cardp->bulk_out_buffer, FW_DATA_XMIT_SIZE); |
298 | 334 | ||
299 | } else if (fwdata->fwheader.dnldcmd == FW_HAS_LAST_BLOCK) { | 335 | } else if (fwdata->fwheader.dnldcmd == cpu_to_le32(FW_HAS_LAST_BLOCK)) { |
300 | lbs_dev_dbg(2, &cardp->udev->dev, | 336 | /* |
337 | lbs_deb_usbd(&cardp->udev->dev, | ||
301 | "Host has finished FW downloading\n"); | 338 | "Host has finished FW downloading\n"); |
302 | lbs_dev_dbg(2, &cardp->udev->dev, | 339 | lbs_deb_usbd(&cardp->udev->dev, |
303 | "Donwloading FW JUMP BLOCK\n"); | 340 | "Donwloading FW JUMP BLOCK\n"); |
341 | */ | ||
304 | memcpy(cardp->bulk_out_buffer, fwheader, FW_DATA_XMIT_SIZE); | 342 | memcpy(cardp->bulk_out_buffer, fwheader, FW_DATA_XMIT_SIZE); |
305 | usb_tx_block(priv, cardp->bulk_out_buffer, FW_DATA_XMIT_SIZE); | 343 | usb_tx_block(priv, cardp->bulk_out_buffer, FW_DATA_XMIT_SIZE); |
306 | cardp->fwfinalblk = 1; | 344 | cardp->fwfinalblk = 1; |
307 | } | 345 | } |
308 | 346 | ||
309 | lbs_dev_dbg(2, &cardp->udev->dev, | 347 | /* |
348 | lbs_deb_usbd(&cardp->udev->dev, | ||
310 | "The firmware download is done size is %d\n", | 349 | "The firmware download is done size is %d\n", |
311 | cardp->totalbytes); | 350 | cardp->totalbytes); |
351 | */ | ||
312 | 352 | ||
313 | kfree(fwdata); | 353 | kfree(fwdata); |
314 | 354 | ||
@@ -318,14 +358,19 @@ static int if_prog_firmware(wlan_private * priv) | |||
318 | static int libertas_do_reset(wlan_private *priv) | 358 | static int libertas_do_reset(wlan_private *priv) |
319 | { | 359 | { |
320 | int ret; | 360 | int ret; |
321 | struct usb_card_rec *cardp = priv->wlan_dev.card; | 361 | struct usb_card_rec *cardp = priv->card; |
362 | |||
363 | lbs_deb_enter(LBS_DEB_USB); | ||
322 | 364 | ||
323 | ret = usb_reset_device(cardp->udev); | 365 | ret = usb_reset_device(cardp->udev); |
324 | if (!ret) { | 366 | if (!ret) { |
325 | msleep(10); | 367 | msleep(10); |
326 | reset_device(priv); | 368 | if_usb_reset_device(priv); |
327 | msleep(10); | 369 | msleep(10); |
328 | } | 370 | } |
371 | |||
372 | lbs_deb_leave_args(LBS_DEB_USB, "ret %d", ret); | ||
373 | |||
329 | return ret; | 374 | return ret; |
330 | } | 375 | } |
331 | 376 | ||
@@ -339,12 +384,12 @@ static int libertas_do_reset(wlan_private *priv) | |||
339 | int usb_tx_block(wlan_private * priv, u8 * payload, u16 nb) | 384 | int usb_tx_block(wlan_private * priv, u8 * payload, u16 nb) |
340 | { | 385 | { |
341 | /* pointer to card structure */ | 386 | /* pointer to card structure */ |
342 | struct usb_card_rec *cardp = priv->wlan_dev.card; | 387 | struct usb_card_rec *cardp = priv->card; |
343 | int ret = -1; | 388 | int ret = -1; |
344 | 389 | ||
345 | /* check if device is removed */ | 390 | /* check if device is removed */ |
346 | if (priv->adapter->surpriseremoved) { | 391 | if (priv->adapter->surpriseremoved) { |
347 | lbs_dev_dbg(1, &cardp->udev->dev, "Device removed\n"); | 392 | lbs_deb_usbd(&cardp->udev->dev, "Device removed\n"); |
348 | goto tx_ret; | 393 | goto tx_ret; |
349 | } | 394 | } |
350 | 395 | ||
@@ -357,10 +402,10 @@ int usb_tx_block(wlan_private * priv, u8 * payload, u16 nb) | |||
357 | 402 | ||
358 | if ((ret = usb_submit_urb(cardp->tx_urb, GFP_ATOMIC))) { | 403 | if ((ret = usb_submit_urb(cardp->tx_urb, GFP_ATOMIC))) { |
359 | /* transfer failed */ | 404 | /* transfer failed */ |
360 | lbs_dev_dbg(1, &cardp->udev->dev, "usb_submit_urb failed\n"); | 405 | lbs_deb_usbd(&cardp->udev->dev, "usb_submit_urb failed\n"); |
361 | ret = -1; | 406 | ret = -1; |
362 | } else { | 407 | } else { |
363 | lbs_dev_dbg(2, &cardp->udev->dev, "usb_submit_urb success\n"); | 408 | /* lbs_deb_usbd(&cardp->udev->dev, "usb_submit_urb success\n"); */ |
364 | ret = 0; | 409 | ret = 0; |
365 | } | 410 | } |
366 | 411 | ||
@@ -372,7 +417,7 @@ static int __if_usb_submit_rx_urb(wlan_private * priv, | |||
372 | void (*callbackfn) | 417 | void (*callbackfn) |
373 | (struct urb *urb)) | 418 | (struct urb *urb)) |
374 | { | 419 | { |
375 | struct usb_card_rec *cardp = priv->wlan_dev.card; | 420 | struct usb_card_rec *cardp = priv->card; |
376 | struct sk_buff *skb; | 421 | struct sk_buff *skb; |
377 | struct read_cb_info *rinfo = &cardp->rinfo; | 422 | struct read_cb_info *rinfo = &cardp->rinfo; |
378 | int ret = -1; | 423 | int ret = -1; |
@@ -394,13 +439,13 @@ static int __if_usb_submit_rx_urb(wlan_private * priv, | |||
394 | 439 | ||
395 | cardp->rx_urb->transfer_flags |= URB_ZERO_PACKET; | 440 | cardp->rx_urb->transfer_flags |= URB_ZERO_PACKET; |
396 | 441 | ||
397 | lbs_dev_dbg(2, &cardp->udev->dev, "Pointer for rx_urb %p\n", cardp->rx_urb); | 442 | /* lbs_deb_usbd(&cardp->udev->dev, "Pointer for rx_urb %p\n", cardp->rx_urb); */ |
398 | if ((ret = usb_submit_urb(cardp->rx_urb, GFP_ATOMIC))) { | 443 | if ((ret = usb_submit_urb(cardp->rx_urb, GFP_ATOMIC))) { |
399 | /* handle failure conditions */ | 444 | /* handle failure conditions */ |
400 | lbs_dev_dbg(1, &cardp->udev->dev, "Submit Rx URB failed\n"); | 445 | lbs_deb_usbd(&cardp->udev->dev, "Submit Rx URB failed\n"); |
401 | ret = -1; | 446 | ret = -1; |
402 | } else { | 447 | } else { |
403 | lbs_dev_dbg(2, &cardp->udev->dev, "Submit Rx URB success\n"); | 448 | /* lbs_deb_usbd(&cardp->udev->dev, "Submit Rx URB success\n"); */ |
404 | ret = 0; | 449 | ret = 0; |
405 | } | 450 | } |
406 | 451 | ||
@@ -423,12 +468,12 @@ static void if_usb_receive_fwload(struct urb *urb) | |||
423 | struct read_cb_info *rinfo = (struct read_cb_info *)urb->context; | 468 | struct read_cb_info *rinfo = (struct read_cb_info *)urb->context; |
424 | wlan_private *priv = rinfo->priv; | 469 | wlan_private *priv = rinfo->priv; |
425 | struct sk_buff *skb = rinfo->skb; | 470 | struct sk_buff *skb = rinfo->skb; |
426 | struct usb_card_rec *cardp = (struct usb_card_rec *)priv->wlan_dev.card; | 471 | struct usb_card_rec *cardp = (struct usb_card_rec *)priv->card; |
427 | struct fwsyncheader *syncfwheader; | 472 | struct fwsyncheader *syncfwheader; |
428 | struct bootcmdrespStr bootcmdresp; | 473 | struct bootcmdrespStr bootcmdresp; |
429 | 474 | ||
430 | if (urb->status) { | 475 | if (urb->status) { |
431 | lbs_dev_dbg(1, &cardp->udev->dev, | 476 | lbs_deb_usbd(&cardp->udev->dev, |
432 | "URB status is failed during fw load\n"); | 477 | "URB status is failed during fw load\n"); |
433 | kfree_skb(skb); | 478 | kfree_skb(skb); |
434 | return; | 479 | return; |
@@ -437,18 +482,18 @@ static void if_usb_receive_fwload(struct urb *urb) | |||
437 | if (cardp->bootcmdresp == 0) { | 482 | if (cardp->bootcmdresp == 0) { |
438 | memcpy (&bootcmdresp, skb->data + IPFIELD_ALIGN_OFFSET, | 483 | memcpy (&bootcmdresp, skb->data + IPFIELD_ALIGN_OFFSET, |
439 | sizeof(bootcmdresp)); | 484 | sizeof(bootcmdresp)); |
440 | if (cardp->udev->descriptor.bcdDevice < 0x3106) { | 485 | if (le16_to_cpu(cardp->udev->descriptor.bcdDevice) < 0x3106) { |
441 | kfree_skb(skb); | 486 | kfree_skb(skb); |
442 | if_usb_submit_rx_urb_fwload(priv); | 487 | if_usb_submit_rx_urb_fwload(priv); |
443 | cardp->bootcmdresp = 1; | 488 | cardp->bootcmdresp = 1; |
444 | lbs_dev_dbg(1, &cardp->udev->dev, | 489 | lbs_deb_usbd(&cardp->udev->dev, |
445 | "Received valid boot command response\n"); | 490 | "Received valid boot command response\n"); |
446 | return; | 491 | return; |
447 | } | 492 | } |
448 | if (bootcmdresp.u32magicnumber != BOOT_CMD_MAGIC_NUMBER) { | 493 | if (bootcmdresp.u32magicnumber != cpu_to_le32(BOOT_CMD_MAGIC_NUMBER)) { |
449 | lbs_pr_info( | 494 | lbs_pr_info( |
450 | "boot cmd response wrong magic number (0x%x)\n", | 495 | "boot cmd response wrong magic number (0x%x)\n", |
451 | bootcmdresp.u32magicnumber); | 496 | le32_to_cpu(bootcmdresp.u32magicnumber)); |
452 | } else if (bootcmdresp.u8cmd_tag != BOOT_CMD_FW_BY_USB) { | 497 | } else if (bootcmdresp.u8cmd_tag != BOOT_CMD_FW_BY_USB) { |
453 | lbs_pr_info( | 498 | lbs_pr_info( |
454 | "boot cmd response cmd_tag error (%d)\n", | 499 | "boot cmd response cmd_tag error (%d)\n", |
@@ -459,7 +504,7 @@ static void if_usb_receive_fwload(struct urb *urb) | |||
459 | bootcmdresp.u8result); | 504 | bootcmdresp.u8result); |
460 | } else { | 505 | } else { |
461 | cardp->bootcmdresp = 1; | 506 | cardp->bootcmdresp = 1; |
462 | lbs_dev_dbg(1, &cardp->udev->dev, | 507 | lbs_deb_usbd(&cardp->udev->dev, |
463 | "Received valid boot command response\n"); | 508 | "Received valid boot command response\n"); |
464 | } | 509 | } |
465 | kfree_skb(skb); | 510 | kfree_skb(skb); |
@@ -469,7 +514,7 @@ static void if_usb_receive_fwload(struct urb *urb) | |||
469 | 514 | ||
470 | syncfwheader = kmalloc(sizeof(struct fwsyncheader), GFP_ATOMIC); | 515 | syncfwheader = kmalloc(sizeof(struct fwsyncheader), GFP_ATOMIC); |
471 | if (!syncfwheader) { | 516 | if (!syncfwheader) { |
472 | lbs_dev_dbg(1, &cardp->udev->dev, "Failure to allocate syncfwheader\n"); | 517 | lbs_deb_usbd(&cardp->udev->dev, "Failure to allocate syncfwheader\n"); |
473 | kfree_skb(skb); | 518 | kfree_skb(skb); |
474 | return; | 519 | return; |
475 | } | 520 | } |
@@ -478,14 +523,16 @@ static void if_usb_receive_fwload(struct urb *urb) | |||
478 | sizeof(struct fwsyncheader)); | 523 | sizeof(struct fwsyncheader)); |
479 | 524 | ||
480 | if (!syncfwheader->cmd) { | 525 | if (!syncfwheader->cmd) { |
481 | lbs_dev_dbg(2, &cardp->udev->dev, | 526 | /* |
527 | lbs_deb_usbd(&cardp->udev->dev, | ||
482 | "FW received Blk with correct CRC\n"); | 528 | "FW received Blk with correct CRC\n"); |
483 | lbs_dev_dbg(2, &cardp->udev->dev, | 529 | lbs_deb_usbd(&cardp->udev->dev, |
484 | "FW received Blk seqnum = %d\n", | 530 | "FW received Blk seqnum = %d\n", |
485 | syncfwheader->seqnum); | 531 | syncfwheader->seqnum); |
532 | */ | ||
486 | cardp->CRC_OK = 1; | 533 | cardp->CRC_OK = 1; |
487 | } else { | 534 | } else { |
488 | lbs_dev_dbg(1, &cardp->udev->dev, | 535 | lbs_deb_usbd(&cardp->udev->dev, |
489 | "FW received Blk with CRC error\n"); | 536 | "FW received Blk with CRC error\n"); |
490 | cardp->CRC_OK = 0; | 537 | cardp->CRC_OK = 0; |
491 | } | 538 | } |
@@ -515,7 +562,7 @@ static inline void process_cmdtypedata(int recvlength, struct sk_buff *skb, | |||
515 | { | 562 | { |
516 | if (recvlength > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE + | 563 | if (recvlength > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE + |
517 | MESSAGE_HEADER_LEN || recvlength < MRVDRV_MIN_PKT_LEN) { | 564 | MESSAGE_HEADER_LEN || recvlength < MRVDRV_MIN_PKT_LEN) { |
518 | lbs_dev_dbg(1, &cardp->udev->dev, | 565 | lbs_deb_usbd(&cardp->udev->dev, |
519 | "Packet length is Invalid\n"); | 566 | "Packet length is Invalid\n"); |
520 | kfree_skb(skb); | 567 | kfree_skb(skb); |
521 | return; | 568 | return; |
@@ -525,7 +572,7 @@ static inline void process_cmdtypedata(int recvlength, struct sk_buff *skb, | |||
525 | skb_put(skb, recvlength); | 572 | skb_put(skb, recvlength); |
526 | skb_pull(skb, MESSAGE_HEADER_LEN); | 573 | skb_pull(skb, MESSAGE_HEADER_LEN); |
527 | libertas_process_rxed_packet(priv, skb); | 574 | libertas_process_rxed_packet(priv, skb); |
528 | priv->wlan_dev.upld_len = (recvlength - MESSAGE_HEADER_LEN); | 575 | priv->upld_len = (recvlength - MESSAGE_HEADER_LEN); |
529 | } | 576 | } |
530 | 577 | ||
531 | static inline void process_cmdrequest(int recvlength, u8 *recvbuff, | 578 | static inline void process_cmdrequest(int recvlength, u8 *recvbuff, |
@@ -535,7 +582,7 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff, | |||
535 | { | 582 | { |
536 | u8 *cmdbuf; | 583 | u8 *cmdbuf; |
537 | if (recvlength > MRVDRV_SIZE_OF_CMD_BUFFER) { | 584 | if (recvlength > MRVDRV_SIZE_OF_CMD_BUFFER) { |
538 | lbs_dev_dbg(1, &cardp->udev->dev, | 585 | lbs_deb_usbd(&cardp->udev->dev, |
539 | "The receive buffer is too large\n"); | 586 | "The receive buffer is too large\n"); |
540 | kfree_skb(skb); | 587 | kfree_skb(skb); |
541 | return; | 588 | return; |
@@ -548,21 +595,21 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff, | |||
548 | /* take care of cur_cmd = NULL case by reading the | 595 | /* take care of cur_cmd = NULL case by reading the |
549 | * data to clear the interrupt */ | 596 | * data to clear the interrupt */ |
550 | if (!priv->adapter->cur_cmd) { | 597 | if (!priv->adapter->cur_cmd) { |
551 | cmdbuf = priv->wlan_dev.upld_buf; | 598 | cmdbuf = priv->upld_buf; |
552 | priv->adapter->hisregcpy &= ~his_cmdupldrdy; | 599 | priv->adapter->hisregcpy &= ~his_cmdupldrdy; |
553 | } else | 600 | } else |
554 | cmdbuf = priv->adapter->cur_cmd->bufvirtualaddr; | 601 | cmdbuf = priv->adapter->cur_cmd->bufvirtualaddr; |
555 | 602 | ||
556 | cardp->usb_int_cause |= his_cmdupldrdy; | 603 | cardp->usb_int_cause |= his_cmdupldrdy; |
557 | priv->wlan_dev.upld_len = (recvlength - MESSAGE_HEADER_LEN); | 604 | priv->upld_len = (recvlength - MESSAGE_HEADER_LEN); |
558 | memcpy(cmdbuf, recvbuff + MESSAGE_HEADER_LEN, | 605 | memcpy(cmdbuf, recvbuff + MESSAGE_HEADER_LEN, |
559 | priv->wlan_dev.upld_len); | 606 | priv->upld_len); |
560 | 607 | ||
561 | kfree_skb(skb); | 608 | kfree_skb(skb); |
562 | libertas_interrupt(priv->wlan_dev.netdev); | 609 | libertas_interrupt(priv->dev); |
563 | spin_unlock(&priv->adapter->driver_lock); | 610 | spin_unlock(&priv->adapter->driver_lock); |
564 | 611 | ||
565 | lbs_dev_dbg(1, &cardp->udev->dev, | 612 | lbs_deb_usbd(&cardp->udev->dev, |
566 | "Wake up main thread to handle cmd response\n"); | 613 | "Wake up main thread to handle cmd response\n"); |
567 | 614 | ||
568 | return; | 615 | return; |
@@ -580,17 +627,17 @@ static void if_usb_receive(struct urb *urb) | |||
580 | struct read_cb_info *rinfo = (struct read_cb_info *)urb->context; | 627 | struct read_cb_info *rinfo = (struct read_cb_info *)urb->context; |
581 | wlan_private *priv = rinfo->priv; | 628 | wlan_private *priv = rinfo->priv; |
582 | struct sk_buff *skb = rinfo->skb; | 629 | struct sk_buff *skb = rinfo->skb; |
583 | struct usb_card_rec *cardp = (struct usb_card_rec *)priv->wlan_dev.card; | 630 | struct usb_card_rec *cardp = (struct usb_card_rec *)priv->card; |
584 | 631 | ||
585 | int recvlength = urb->actual_length; | 632 | int recvlength = urb->actual_length; |
586 | u8 *recvbuff = NULL; | 633 | u8 *recvbuff = NULL; |
587 | u32 recvtype; | 634 | u32 recvtype; |
588 | 635 | ||
589 | ENTER(); | 636 | lbs_deb_enter(LBS_DEB_USB); |
590 | 637 | ||
591 | if (recvlength) { | 638 | if (recvlength) { |
592 | if (urb->status) { | 639 | if (urb->status) { |
593 | lbs_dev_dbg(1, &cardp->udev->dev, | 640 | lbs_deb_usbd(&cardp->udev->dev, |
594 | "URB status is failed\n"); | 641 | "URB status is failed\n"); |
595 | kfree_skb(skb); | 642 | kfree_skb(skb); |
596 | goto setup_for_next; | 643 | goto setup_for_next; |
@@ -598,12 +645,12 @@ static void if_usb_receive(struct urb *urb) | |||
598 | 645 | ||
599 | recvbuff = skb->data + IPFIELD_ALIGN_OFFSET; | 646 | recvbuff = skb->data + IPFIELD_ALIGN_OFFSET; |
600 | memcpy(&recvtype, recvbuff, sizeof(u32)); | 647 | memcpy(&recvtype, recvbuff, sizeof(u32)); |
601 | lbs_dev_dbg(1, &cardp->udev->dev, | 648 | lbs_deb_usbd(&cardp->udev->dev, |
602 | "Recv length = 0x%x\n", recvlength); | 649 | "Recv length = 0x%x\n", recvlength); |
603 | lbs_dev_dbg(1, &cardp->udev->dev, | 650 | lbs_deb_usbd(&cardp->udev->dev, |
604 | "Receive type = 0x%X\n", recvtype); | 651 | "Receive type = 0x%X\n", recvtype); |
605 | recvtype = le32_to_cpu(recvtype); | 652 | recvtype = le32_to_cpu(recvtype); |
606 | lbs_dev_dbg(1, &cardp->udev->dev, | 653 | lbs_deb_usbd(&cardp->udev->dev, |
607 | "Receive type after = 0x%X\n", recvtype); | 654 | "Receive type after = 0x%X\n", recvtype); |
608 | } else if (urb->status) | 655 | } else if (urb->status) |
609 | goto rx_exit; | 656 | goto rx_exit; |
@@ -621,18 +668,18 @@ static void if_usb_receive(struct urb *urb) | |||
621 | case CMD_TYPE_INDICATION: | 668 | case CMD_TYPE_INDICATION: |
622 | /* Event cause handling */ | 669 | /* Event cause handling */ |
623 | spin_lock(&priv->adapter->driver_lock); | 670 | spin_lock(&priv->adapter->driver_lock); |
624 | cardp->usb_event_cause = *(u32 *) (recvbuff + MESSAGE_HEADER_LEN); | 671 | cardp->usb_event_cause = le32_to_cpu(*(__le32 *) (recvbuff + MESSAGE_HEADER_LEN)); |
625 | lbs_dev_dbg(1, &cardp->udev->dev,"**EVENT** 0x%X\n", | 672 | lbs_deb_usbd(&cardp->udev->dev,"**EVENT** 0x%X\n", |
626 | cardp->usb_event_cause); | 673 | cardp->usb_event_cause); |
627 | if (cardp->usb_event_cause & 0xffff0000) { | 674 | if (cardp->usb_event_cause & 0xffff0000) { |
628 | libertas_send_tx_feedback(priv); | 675 | libertas_send_tx_feedback(priv); |
629 | spin_unlock(&priv->adapter->driver_lock); | 676 | spin_unlock(&priv->adapter->driver_lock); |
630 | break; | 677 | break; |
631 | } | 678 | } |
632 | cardp->usb_event_cause = le32_to_cpu(cardp->usb_event_cause) << 3; | 679 | cardp->usb_event_cause <<= 3; |
633 | cardp->usb_int_cause |= his_cardevent; | 680 | cardp->usb_int_cause |= his_cardevent; |
634 | kfree_skb(skb); | 681 | kfree_skb(skb); |
635 | libertas_interrupt(priv->wlan_dev.netdev); | 682 | libertas_interrupt(priv->dev); |
636 | spin_unlock(&priv->adapter->driver_lock); | 683 | spin_unlock(&priv->adapter->driver_lock); |
637 | goto rx_exit; | 684 | goto rx_exit; |
638 | default: | 685 | default: |
@@ -643,8 +690,7 @@ static void if_usb_receive(struct urb *urb) | |||
643 | setup_for_next: | 690 | setup_for_next: |
644 | if_usb_submit_rx_urb(priv); | 691 | if_usb_submit_rx_urb(priv); |
645 | rx_exit: | 692 | rx_exit: |
646 | LEAVE(); | 693 | lbs_deb_leave(LBS_DEB_USB); |
647 | return; | ||
648 | } | 694 | } |
649 | 695 | ||
650 | /** | 696 | /** |
@@ -655,24 +701,24 @@ rx_exit: | |||
655 | * @param len number of bytes | 701 | * @param len number of bytes |
656 | * @return 0 or -1 | 702 | * @return 0 or -1 |
657 | */ | 703 | */ |
658 | int libertas_sbi_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb) | 704 | static int if_usb_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb) |
659 | { | 705 | { |
660 | int ret = -1; | 706 | int ret = -1; |
661 | u32 tmp; | 707 | u32 tmp; |
662 | struct usb_card_rec *cardp = (struct usb_card_rec *)priv->wlan_dev.card; | 708 | struct usb_card_rec *cardp = (struct usb_card_rec *)priv->card; |
663 | 709 | ||
664 | lbs_dev_dbg(1, &cardp->udev->dev,"*** type = %u\n", type); | 710 | lbs_deb_usbd(&cardp->udev->dev,"*** type = %u\n", type); |
665 | lbs_dev_dbg(1, &cardp->udev->dev,"size after = %d\n", nb); | 711 | lbs_deb_usbd(&cardp->udev->dev,"size after = %d\n", nb); |
666 | 712 | ||
667 | if (type == MVMS_CMD) { | 713 | if (type == MVMS_CMD) { |
668 | tmp = cpu_to_le32(CMD_TYPE_REQUEST); | 714 | tmp = cpu_to_le32(CMD_TYPE_REQUEST); |
669 | priv->wlan_dev.dnld_sent = DNLD_CMD_SENT; | 715 | priv->dnld_sent = DNLD_CMD_SENT; |
670 | memcpy(cardp->bulk_out_buffer, (u8 *) & tmp, | 716 | memcpy(cardp->bulk_out_buffer, (u8 *) & tmp, |
671 | MESSAGE_HEADER_LEN); | 717 | MESSAGE_HEADER_LEN); |
672 | 718 | ||
673 | } else { | 719 | } else { |
674 | tmp = cpu_to_le32(CMD_TYPE_DATA); | 720 | tmp = cpu_to_le32(CMD_TYPE_DATA); |
675 | priv->wlan_dev.dnld_sent = DNLD_DATA_SENT; | 721 | priv->dnld_sent = DNLD_DATA_SENT; |
676 | memcpy(cardp->bulk_out_buffer, (u8 *) & tmp, | 722 | memcpy(cardp->bulk_out_buffer, (u8 *) & tmp, |
677 | MESSAGE_HEADER_LEN); | 723 | MESSAGE_HEADER_LEN); |
678 | } | 724 | } |
@@ -686,39 +732,41 @@ int libertas_sbi_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb | |||
686 | } | 732 | } |
687 | 733 | ||
688 | /* called with adapter->driver_lock held */ | 734 | /* called with adapter->driver_lock held */ |
689 | int libertas_sbi_get_int_status(wlan_private * priv, u8 * ireg) | 735 | static int if_usb_get_int_status(wlan_private * priv, u8 * ireg) |
690 | { | 736 | { |
691 | struct usb_card_rec *cardp = priv->wlan_dev.card; | 737 | struct usb_card_rec *cardp = priv->card; |
692 | 738 | ||
693 | *ireg = cardp->usb_int_cause; | 739 | *ireg = cardp->usb_int_cause; |
694 | cardp->usb_int_cause = 0; | 740 | cardp->usb_int_cause = 0; |
695 | 741 | ||
696 | lbs_dev_dbg(1, &cardp->udev->dev,"Int cause is 0x%X\n", *ireg); | 742 | lbs_deb_usbd(&cardp->udev->dev,"Int cause is 0x%X\n", *ireg); |
697 | 743 | ||
698 | return 0; | 744 | return 0; |
699 | } | 745 | } |
700 | 746 | ||
701 | int libertas_sbi_read_event_cause(wlan_private * priv) | 747 | static int if_usb_read_event_cause(wlan_private * priv) |
702 | { | 748 | { |
703 | struct usb_card_rec *cardp = priv->wlan_dev.card; | 749 | struct usb_card_rec *cardp = priv->card; |
704 | priv->adapter->eventcause = cardp->usb_event_cause; | 750 | priv->adapter->eventcause = cardp->usb_event_cause; |
705 | /* Re-submit rx urb here to avoid event lost issue */ | 751 | /* Re-submit rx urb here to avoid event lost issue */ |
706 | if_usb_submit_rx_urb(priv); | 752 | if_usb_submit_rx_urb(priv); |
707 | return 0; | 753 | return 0; |
708 | } | 754 | } |
709 | 755 | ||
710 | int reset_device(wlan_private *priv) | 756 | static int if_usb_reset_device(wlan_private *priv) |
711 | { | 757 | { |
712 | int ret; | 758 | int ret; |
713 | 759 | ||
760 | lbs_deb_enter(LBS_DEB_USB); | ||
714 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_reset, | 761 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_reset, |
715 | cmd_act_halt, 0, 0, NULL); | 762 | cmd_act_halt, 0, 0, NULL); |
716 | msleep_interruptible(10); | 763 | msleep_interruptible(10); |
717 | 764 | ||
765 | lbs_deb_leave_args(LBS_DEB_USB, "ret %d", ret); | ||
718 | return ret; | 766 | return ret; |
719 | } | 767 | } |
720 | 768 | ||
721 | int libertas_sbi_unregister_dev(wlan_private * priv) | 769 | static int if_usb_unregister_dev(wlan_private * priv) |
722 | { | 770 | { |
723 | int ret = 0; | 771 | int ret = 0; |
724 | 772 | ||
@@ -727,7 +775,7 @@ int libertas_sbi_unregister_dev(wlan_private * priv) | |||
727 | * again. | 775 | * again. |
728 | */ | 776 | */ |
729 | if (priv) | 777 | if (priv) |
730 | reset_device(priv); | 778 | if_usb_reset_device(priv); |
731 | 779 | ||
732 | return ret; | 780 | return ret; |
733 | } | 781 | } |
@@ -738,42 +786,41 @@ int libertas_sbi_unregister_dev(wlan_private * priv) | |||
738 | * @param priv pointer to wlan_private | 786 | * @param priv pointer to wlan_private |
739 | * @return 0 or -1 | 787 | * @return 0 or -1 |
740 | */ | 788 | */ |
741 | int libertas_sbi_register_dev(wlan_private * priv) | 789 | static int if_usb_register_dev(wlan_private * priv) |
742 | { | 790 | { |
791 | struct usb_card_rec *cardp = (struct usb_card_rec *)priv->card; | ||
743 | 792 | ||
744 | struct usb_card_rec *cardp = (struct usb_card_rec *)priv->wlan_dev.card; | 793 | lbs_deb_enter(LBS_DEB_USB); |
745 | ENTER(); | ||
746 | 794 | ||
747 | cardp->priv = priv; | 795 | cardp->priv = priv; |
748 | cardp->eth_dev = priv->wlan_dev.netdev; | 796 | cardp->eth_dev = priv->dev; |
749 | priv->hotplug_device = &(cardp->udev->dev); | 797 | priv->hotplug_device = &(cardp->udev->dev); |
750 | 798 | ||
751 | SET_NETDEV_DEV(cardp->eth_dev, &(cardp->udev->dev)); | 799 | lbs_deb_usbd(&cardp->udev->dev, "udev pointer is at %p\n", |
752 | |||
753 | lbs_dev_dbg(1, &cardp->udev->dev, "udev pointer is at %p\n", | ||
754 | cardp->udev); | 800 | cardp->udev); |
755 | 801 | ||
756 | LEAVE(); | 802 | lbs_deb_leave(LBS_DEB_USB); |
757 | return 0; | 803 | return 0; |
758 | } | 804 | } |
759 | 805 | ||
760 | 806 | ||
761 | 807 | ||
762 | int libertas_sbi_prog_firmware(wlan_private * priv) | 808 | static int if_usb_prog_firmware(wlan_private * priv) |
763 | { | 809 | { |
764 | struct usb_card_rec *cardp = priv->wlan_dev.card; | 810 | struct usb_card_rec *cardp = priv->card; |
765 | int i = 0; | 811 | int i = 0; |
766 | static int reset_count = 10; | 812 | static int reset_count = 10; |
813 | int ret = 0; | ||
767 | 814 | ||
768 | ENTER(); | 815 | lbs_deb_enter(LBS_DEB_USB); |
769 | 816 | ||
770 | cardp->rinfo.priv = priv; | 817 | cardp->rinfo.priv = priv; |
771 | 818 | ||
772 | restart: | 819 | restart: |
773 | if (if_usb_submit_rx_urb_fwload(priv) < 0) { | 820 | if (if_usb_submit_rx_urb_fwload(priv) < 0) { |
774 | lbs_dev_dbg(1, &cardp->udev->dev, "URB submission is failed\n"); | 821 | lbs_deb_usbd(&cardp->udev->dev, "URB submission is failed\n"); |
775 | LEAVE(); | 822 | ret = -1; |
776 | return -1; | 823 | goto done; |
777 | } | 824 | } |
778 | 825 | ||
779 | cardp->bootcmdresp = 0; | 826 | cardp->bootcmdresp = 0; |
@@ -811,7 +858,7 @@ restart: | |||
811 | if_prog_firmware(priv); | 858 | if_prog_firmware(priv); |
812 | 859 | ||
813 | do { | 860 | do { |
814 | lbs_dev_dbg(1, &cardp->udev->dev,"Wlan sched timeout\n"); | 861 | lbs_deb_usbd(&cardp->udev->dev,"Wlan sched timeout\n"); |
815 | i++; | 862 | i++; |
816 | msleep_interruptible(100); | 863 | msleep_interruptible(100); |
817 | if (priv->adapter->surpriseremoved || i >= 20) | 864 | if (priv->adapter->surpriseremoved || i >= 20) |
@@ -826,8 +873,8 @@ restart: | |||
826 | } | 873 | } |
827 | 874 | ||
828 | lbs_pr_info("FW download failure, time = %d ms\n", i * 100); | 875 | lbs_pr_info("FW download failure, time = %d ms\n", i * 100); |
829 | LEAVE(); | 876 | ret = -1; |
830 | return -1; | 877 | goto done; |
831 | } | 878 | } |
832 | 879 | ||
833 | if_usb_submit_rx_urb(priv); | 880 | if_usb_submit_rx_urb(priv); |
@@ -837,32 +884,10 @@ restart: | |||
837 | 884 | ||
838 | priv->adapter->fw_ready = 1; | 885 | priv->adapter->fw_ready = 1; |
839 | 886 | ||
840 | LEAVE(); | 887 | done: |
841 | return 0; | 888 | lbs_deb_leave_args(LBS_DEB_USB, "ret %d", ret); |
842 | } | 889 | return ret; |
843 | |||
844 | /** | ||
845 | * @brief Given a usb_card_rec return its wlan_private | ||
846 | * @param card pointer to a usb_card_rec | ||
847 | * @return pointer to wlan_private | ||
848 | */ | ||
849 | wlan_private *libertas_sbi_get_priv(void *card) | ||
850 | { | ||
851 | struct usb_card_rec *cardp = card; | ||
852 | return cardp->priv; | ||
853 | } | ||
854 | |||
855 | #ifdef ENABLE_PM | ||
856 | int libertas_sbi_suspend(wlan_private * priv) | ||
857 | { | ||
858 | return 0; | ||
859 | } | ||
860 | |||
861 | int libertas_sbi_resume(wlan_private * priv) | ||
862 | { | ||
863 | return 0; | ||
864 | } | 890 | } |
865 | #endif | ||
866 | 891 | ||
867 | #ifdef CONFIG_PM | 892 | #ifdef CONFIG_PM |
868 | static int if_usb_suspend(struct usb_interface *intf, pm_message_t message) | 893 | static int if_usb_suspend(struct usb_interface *intf, pm_message_t message) |
@@ -870,12 +895,13 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message) | |||
870 | struct usb_card_rec *cardp = usb_get_intfdata(intf); | 895 | struct usb_card_rec *cardp = usb_get_intfdata(intf); |
871 | wlan_private *priv = cardp->priv; | 896 | wlan_private *priv = cardp->priv; |
872 | 897 | ||
873 | ENTER(); | 898 | lbs_deb_enter(LBS_DEB_USB); |
874 | 899 | ||
875 | if (priv->adapter->psstate != PS_STATE_FULL_POWER) | 900 | if (priv->adapter->psstate != PS_STATE_FULL_POWER) |
876 | return -1; | 901 | return -1; |
877 | 902 | ||
878 | netif_device_detach(cardp->eth_dev); | 903 | netif_device_detach(cardp->eth_dev); |
904 | netif_device_detach(priv->mesh_dev); | ||
879 | 905 | ||
880 | /* Unlink tx & rx urb */ | 906 | /* Unlink tx & rx urb */ |
881 | usb_kill_urb(cardp->tx_urb); | 907 | usb_kill_urb(cardp->tx_urb); |
@@ -883,23 +909,25 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message) | |||
883 | 909 | ||
884 | cardp->rx_urb_recall = 1; | 910 | cardp->rx_urb_recall = 1; |
885 | 911 | ||
886 | LEAVE(); | 912 | lbs_deb_leave(LBS_DEB_USB); |
887 | return 0; | 913 | return 0; |
888 | } | 914 | } |
889 | 915 | ||
890 | static int if_usb_resume(struct usb_interface *intf) | 916 | static int if_usb_resume(struct usb_interface *intf) |
891 | { | 917 | { |
892 | struct usb_card_rec *cardp = usb_get_intfdata(intf); | 918 | struct usb_card_rec *cardp = usb_get_intfdata(intf); |
919 | wlan_private *priv = cardp->priv; | ||
893 | 920 | ||
894 | ENTER(); | 921 | lbs_deb_enter(LBS_DEB_USB); |
895 | 922 | ||
896 | cardp->rx_urb_recall = 0; | 923 | cardp->rx_urb_recall = 0; |
897 | 924 | ||
898 | if_usb_submit_rx_urb(cardp->priv); | 925 | if_usb_submit_rx_urb(cardp->priv); |
899 | 926 | ||
900 | netif_device_attach(cardp->eth_dev); | 927 | netif_device_attach(cardp->eth_dev); |
928 | netif_device_attach(priv->mesh_dev); | ||
901 | 929 | ||
902 | LEAVE(); | 930 | lbs_deb_leave(LBS_DEB_USB); |
903 | return 0; | 931 | return 0; |
904 | } | 932 | } |
905 | #else | 933 | #else |
@@ -920,32 +948,40 @@ static struct usb_driver if_usb_driver = { | |||
920 | .resume = if_usb_resume, | 948 | .resume = if_usb_resume, |
921 | }; | 949 | }; |
922 | 950 | ||
923 | /** | 951 | static int if_usb_init_module(void) |
924 | * @brief This function registers driver. | ||
925 | * @param add pointer to add_card callback function | ||
926 | * @param remove pointer to remove card callback function | ||
927 | * @param arg pointer to call back function parameter | ||
928 | * @return dummy success variable | ||
929 | */ | ||
930 | int libertas_sbi_register(void) | ||
931 | { | 952 | { |
932 | /* | 953 | int ret = 0; |
933 | * API registers the Marvell USB driver | ||
934 | * to the USB system | ||
935 | */ | ||
936 | usb_register(&if_usb_driver); | ||
937 | 954 | ||
938 | /* Return success to wlan layer */ | 955 | lbs_deb_enter(LBS_DEB_MAIN); |
939 | return 0; | 956 | |
957 | if (libertas_fw_name == NULL) { | ||
958 | libertas_fw_name = default_fw_name; | ||
959 | } | ||
960 | |||
961 | ret = usb_register(&if_usb_driver); | ||
962 | |||
963 | lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret); | ||
964 | return ret; | ||
940 | } | 965 | } |
941 | 966 | ||
942 | /** | 967 | static void if_usb_exit_module(void) |
943 | * @brief This function removes usb driver. | ||
944 | * @return N/A | ||
945 | */ | ||
946 | void libertas_sbi_unregister(void) | ||
947 | { | 968 | { |
969 | struct usb_card_rec *cardp, *cardp_temp; | ||
970 | |||
971 | lbs_deb_enter(LBS_DEB_MAIN); | ||
972 | |||
973 | list_for_each_entry_safe(cardp, cardp_temp, &usb_devices, list) | ||
974 | if_usb_reset_device((wlan_private *) cardp->priv); | ||
975 | |||
948 | /* API unregisters the driver from USB subsystem */ | 976 | /* API unregisters the driver from USB subsystem */ |
949 | usb_deregister(&if_usb_driver); | 977 | usb_deregister(&if_usb_driver); |
950 | return; | 978 | |
979 | lbs_deb_leave(LBS_DEB_MAIN); | ||
951 | } | 980 | } |
981 | |||
982 | module_init(if_usb_init_module); | ||
983 | module_exit(if_usb_exit_module); | ||
984 | |||
985 | MODULE_DESCRIPTION("8388 USB WLAN Driver"); | ||
986 | MODULE_AUTHOR("Marvell International Ltd."); | ||
987 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/net/wireless/libertas/if_usb.h b/drivers/net/wireless/libertas/if_usb.h index 170dfe6809f5..156bb485e1a6 100644 --- a/drivers/net/wireless/libertas/if_usb.h +++ b/drivers/net/wireless/libertas/if_usb.h | |||
@@ -1,3 +1,8 @@ | |||
1 | #ifndef _LIBERTAS_IF_USB_H | ||
2 | #define _LIBERTAS_IF_USB_H | ||
3 | |||
4 | #include <linux/list.h> | ||
5 | |||
1 | /** | 6 | /** |
2 | * This file contains definition for USB interface. | 7 | * This file contains definition for USB interface. |
3 | */ | 8 | */ |
@@ -7,11 +12,6 @@ | |||
7 | 12 | ||
8 | #define IPFIELD_ALIGN_OFFSET 2 | 13 | #define IPFIELD_ALIGN_OFFSET 2 |
9 | 14 | ||
10 | #define USB8388_VID_1 0x1286 | ||
11 | #define USB8388_PID_1 0x2001 | ||
12 | #define USB8388_VID_2 0x05a3 | ||
13 | #define USB8388_PID_2 0x8388 | ||
14 | |||
15 | #define BOOT_CMD_FW_BY_USB 0x01 | 15 | #define BOOT_CMD_FW_BY_USB 0x01 |
16 | #define BOOT_CMD_FW_IN_EEPROM 0x02 | 16 | #define BOOT_CMD_FW_IN_EEPROM 0x02 |
17 | #define BOOT_CMD_UPDATE_BOOT2 0x03 | 17 | #define BOOT_CMD_UPDATE_BOOT2 0x03 |
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | struct bootcmdstr | 21 | struct bootcmdstr |
22 | { | 22 | { |
23 | u32 u32magicnumber; | 23 | __le32 u32magicnumber; |
24 | u8 u8cmd_tag; | 24 | u8 u8cmd_tag; |
25 | u8 au8dumy[11]; | 25 | u8 au8dumy[11]; |
26 | }; | 26 | }; |
@@ -30,7 +30,7 @@ struct bootcmdstr | |||
30 | 30 | ||
31 | struct bootcmdrespStr | 31 | struct bootcmdrespStr |
32 | { | 32 | { |
33 | u32 u32magicnumber; | 33 | __le32 u32magicnumber; |
34 | u8 u8cmd_tag; | 34 | u8 u8cmd_tag; |
35 | u8 u8result; | 35 | u8 u8result; |
36 | u8 au8dumy[2]; | 36 | u8 au8dumy[2]; |
@@ -44,6 +44,7 @@ struct read_cb_info { | |||
44 | 44 | ||
45 | /** USB card description structure*/ | 45 | /** USB card description structure*/ |
46 | struct usb_card_rec { | 46 | struct usb_card_rec { |
47 | struct list_head list; | ||
47 | struct net_device *eth_dev; | 48 | struct net_device *eth_dev; |
48 | struct usb_device *udev; | 49 | struct usb_device *udev; |
49 | struct urb *rx_urb, *tx_urb; | 50 | struct urb *rx_urb, *tx_urb; |
@@ -75,33 +76,34 @@ struct usb_card_rec { | |||
75 | 76 | ||
76 | /** fwheader */ | 77 | /** fwheader */ |
77 | struct fwheader { | 78 | struct fwheader { |
78 | u32 dnldcmd; | 79 | __le32 dnldcmd; |
79 | u32 baseaddr; | 80 | __le32 baseaddr; |
80 | u32 datalength; | 81 | __le32 datalength; |
81 | u32 CRC; | 82 | __le32 CRC; |
82 | }; | 83 | }; |
83 | 84 | ||
84 | #define FW_MAX_DATA_BLK_SIZE 600 | 85 | #define FW_MAX_DATA_BLK_SIZE 600 |
85 | /** FWData */ | 86 | /** FWData */ |
86 | struct FWData { | 87 | struct FWData { |
87 | struct fwheader fwheader; | 88 | struct fwheader fwheader; |
88 | u32 seqnum; | 89 | __le32 seqnum; |
89 | u8 data[FW_MAX_DATA_BLK_SIZE]; | 90 | u8 data[FW_MAX_DATA_BLK_SIZE]; |
90 | }; | 91 | }; |
91 | 92 | ||
92 | /** fwsyncheader */ | 93 | /** fwsyncheader */ |
93 | struct fwsyncheader { | 94 | struct fwsyncheader { |
94 | u32 cmd; | 95 | __le32 cmd; |
95 | u32 seqnum; | 96 | __le32 seqnum; |
96 | }; | 97 | }; |
97 | 98 | ||
98 | #define FW_HAS_DATA_TO_RECV 0x00000001 | 99 | #define FW_HAS_DATA_TO_RECV 0x00000001 |
99 | #define FW_HAS_LAST_BLOCK 0x00000004 | 100 | #define FW_HAS_LAST_BLOCK 0x00000004 |
100 | 101 | ||
101 | #define FW_DATA_XMIT_SIZE \ | 102 | #define FW_DATA_XMIT_SIZE \ |
102 | sizeof(struct fwheader) + fwdata->fwheader.datalength + sizeof(u32) | 103 | sizeof(struct fwheader) + le32_to_cpu(fwdata->fwheader.datalength) + sizeof(u32) |
103 | 104 | ||
104 | int usb_tx_block(wlan_private *priv, u8 *payload, u16 nb); | 105 | int usb_tx_block(wlan_private *priv, u8 *payload, u16 nb); |
105 | void if_usb_free(struct usb_card_rec *cardp); | 106 | void if_usb_free(struct usb_card_rec *cardp); |
106 | int if_usb_issue_boot_command(wlan_private *priv, int ivalue); | 107 | int if_usb_issue_boot_command(wlan_private *priv, int ivalue); |
107 | 108 | ||
109 | #endif | ||
diff --git a/drivers/net/wireless/libertas/ioctl.c b/drivers/net/wireless/libertas/ioctl.c index a8f76c358992..f41081585564 100644 --- a/drivers/net/wireless/libertas/ioctl.c +++ b/drivers/net/wireless/libertas/ioctl.c | |||
@@ -30,6 +30,7 @@ | |||
30 | static int wlan_set_region(wlan_private * priv, u16 region_code) | 30 | static int wlan_set_region(wlan_private * priv, u16 region_code) |
31 | { | 31 | { |
32 | int i; | 32 | int i; |
33 | int ret = 0; | ||
33 | 34 | ||
34 | for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) { | 35 | for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) { |
35 | // use the region code to search for the index | 36 | // use the region code to search for the index |
@@ -42,17 +43,18 @@ static int wlan_set_region(wlan_private * priv, u16 region_code) | |||
42 | 43 | ||
43 | // if it's unidentified region code | 44 | // if it's unidentified region code |
44 | if (i >= MRVDRV_MAX_REGION_CODE) { | 45 | if (i >= MRVDRV_MAX_REGION_CODE) { |
45 | lbs_pr_debug(1, "region Code not identified\n"); | 46 | lbs_deb_ioctl("region Code not identified\n"); |
46 | LEAVE(); | 47 | ret = -1; |
47 | return -1; | 48 | goto done; |
48 | } | 49 | } |
49 | 50 | ||
50 | if (libertas_set_regiontable(priv, priv->adapter->regioncode, 0)) { | 51 | if (libertas_set_regiontable(priv, priv->adapter->regioncode, 0)) { |
51 | LEAVE(); | 52 | ret = -EINVAL; |
52 | return -EINVAL; | ||
53 | } | 53 | } |
54 | 54 | ||
55 | return 0; | 55 | done: |
56 | lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret); | ||
57 | return ret; | ||
56 | } | 58 | } |
57 | 59 | ||
58 | static inline int hex2int(char c) | 60 | static inline int hex2int(char c) |
@@ -125,8 +127,10 @@ static int wlan_bt_add_ioctl(wlan_private * priv, struct ifreq *req) | |||
125 | char ethaddrs_str[18]; | 127 | char ethaddrs_str[18]; |
126 | char *pos; | 128 | char *pos; |
127 | u8 ethaddr[ETH_ALEN]; | 129 | u8 ethaddr[ETH_ALEN]; |
130 | int ret; | ||
131 | |||
132 | lbs_deb_enter(LBS_DEB_IOCTL); | ||
128 | 133 | ||
129 | ENTER(); | ||
130 | if (copy_from_user(ethaddrs_str, wrq->u.data.pointer, | 134 | if (copy_from_user(ethaddrs_str, wrq->u.data.pointer, |
131 | sizeof(ethaddrs_str))) | 135 | sizeof(ethaddrs_str))) |
132 | return -EFAULT; | 136 | return -EFAULT; |
@@ -136,11 +140,12 @@ static int wlan_bt_add_ioctl(wlan_private * priv, struct ifreq *req) | |||
136 | return -EINVAL; | 140 | return -EINVAL; |
137 | } | 141 | } |
138 | 142 | ||
139 | lbs_pr_debug(1, "BT: adding %s\n", ethaddrs_str); | 143 | lbs_deb_ioctl("BT: adding %s\n", ethaddrs_str); |
140 | LEAVE(); | 144 | ret = libertas_prepare_and_send_command(priv, cmd_bt_access, |
141 | return (libertas_prepare_and_send_command(priv, cmd_bt_access, | ||
142 | cmd_act_bt_access_add, | 145 | cmd_act_bt_access_add, |
143 | cmd_option_waitforrsp, 0, ethaddr)); | 146 | cmd_option_waitforrsp, 0, ethaddr); |
147 | lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret); | ||
148 | return ret; | ||
144 | } | 149 | } |
145 | 150 | ||
146 | /** | 151 | /** |
@@ -156,7 +161,8 @@ static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req) | |||
156 | u8 ethaddr[ETH_ALEN]; | 161 | u8 ethaddr[ETH_ALEN]; |
157 | char *pos; | 162 | char *pos; |
158 | 163 | ||
159 | ENTER(); | 164 | lbs_deb_enter(LBS_DEB_IOCTL); |
165 | |||
160 | if (copy_from_user(ethaddrs_str, wrq->u.data.pointer, | 166 | if (copy_from_user(ethaddrs_str, wrq->u.data.pointer, |
161 | sizeof(ethaddrs_str))) | 167 | sizeof(ethaddrs_str))) |
162 | return -EFAULT; | 168 | return -EFAULT; |
@@ -166,13 +172,14 @@ static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req) | |||
166 | return -EINVAL; | 172 | return -EINVAL; |
167 | } | 173 | } |
168 | 174 | ||
169 | lbs_pr_debug(1, "BT: deleting %s\n", ethaddrs_str); | 175 | lbs_deb_ioctl("BT: deleting %s\n", ethaddrs_str); |
170 | 176 | ||
171 | return (libertas_prepare_and_send_command(priv, | 177 | return (libertas_prepare_and_send_command(priv, |
172 | cmd_bt_access, | 178 | cmd_bt_access, |
173 | cmd_act_bt_access_del, | 179 | cmd_act_bt_access_del, |
174 | cmd_option_waitforrsp, 0, ethaddr)); | 180 | cmd_option_waitforrsp, 0, ethaddr)); |
175 | LEAVE(); | 181 | |
182 | lbs_deb_leave(LBS_DEB_IOCTL); | ||
176 | return 0; | 183 | return 0; |
177 | } | 184 | } |
178 | 185 | ||
@@ -183,7 +190,7 @@ static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req) | |||
183 | */ | 190 | */ |
184 | static int wlan_bt_reset_ioctl(wlan_private * priv) | 191 | static int wlan_bt_reset_ioctl(wlan_private * priv) |
185 | { | 192 | { |
186 | ENTER(); | 193 | lbs_deb_enter(LBS_DEB_IOCTL); |
187 | 194 | ||
188 | lbs_pr_alert( "BT: resetting\n"); | 195 | lbs_pr_alert( "BT: resetting\n"); |
189 | 196 | ||
@@ -192,7 +199,7 @@ static int wlan_bt_reset_ioctl(wlan_private * priv) | |||
192 | cmd_act_bt_access_reset, | 199 | cmd_act_bt_access_reset, |
193 | cmd_option_waitforrsp, 0, NULL)); | 200 | cmd_option_waitforrsp, 0, NULL)); |
194 | 201 | ||
195 | LEAVE(); | 202 | lbs_deb_leave(LBS_DEB_IOCTL); |
196 | return 0; | 203 | return 0; |
197 | } | 204 | } |
198 | 205 | ||
@@ -209,17 +216,17 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req) | |||
209 | struct iwreq *wrq = (struct iwreq *)req; | 216 | struct iwreq *wrq = (struct iwreq *)req; |
210 | /* used to pass id and store the bt entry returned by the FW */ | 217 | /* used to pass id and store the bt entry returned by the FW */ |
211 | union { | 218 | union { |
212 | int id; | 219 | u32 id; |
213 | char addr1addr2[2 * ETH_ALEN]; | 220 | char addr1addr2[2 * ETH_ALEN]; |
214 | } param; | 221 | } param; |
215 | static char outstr[64]; | 222 | static char outstr[64]; |
216 | char *pbuf = outstr; | 223 | char *pbuf = outstr; |
217 | int ret; | 224 | int ret; |
218 | 225 | ||
219 | ENTER(); | 226 | lbs_deb_enter(LBS_DEB_IOCTL); |
220 | 227 | ||
221 | if (copy_from_user(outstr, wrq->u.data.pointer, sizeof(outstr))) { | 228 | if (copy_from_user(outstr, wrq->u.data.pointer, sizeof(outstr))) { |
222 | lbs_pr_debug(1, "Copy from user failed\n"); | 229 | lbs_deb_ioctl("Copy from user failed\n"); |
223 | return -1; | 230 | return -1; |
224 | } | 231 | } |
225 | param.id = simple_strtoul(outstr, NULL, 10); | 232 | param.id = simple_strtoul(outstr, NULL, 10); |
@@ -234,7 +241,7 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req) | |||
234 | if (ret == 0) { | 241 | if (ret == 0) { |
235 | addr1 = param.addr1addr2; | 242 | addr1 = param.addr1addr2; |
236 | 243 | ||
237 | pos = sprintf(pbuf, "ignoring traffic from "); | 244 | pos = sprintf(pbuf, "BT includes node "); |
238 | pbuf += pos; | 245 | pbuf += pos; |
239 | pos = eth_addr2str(addr1, pbuf); | 246 | pos = eth_addr2str(addr1, pbuf); |
240 | pbuf += pos; | 247 | pbuf += pos; |
@@ -246,11 +253,70 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req) | |||
246 | wrq->u.data.length = strlen(outstr); | 253 | wrq->u.data.length = strlen(outstr); |
247 | if (copy_to_user(wrq->u.data.pointer, (char *)outstr, | 254 | if (copy_to_user(wrq->u.data.pointer, (char *)outstr, |
248 | wrq->u.data.length)) { | 255 | wrq->u.data.length)) { |
249 | lbs_pr_debug(1, "BT_LIST: Copy to user failed!\n"); | 256 | lbs_deb_ioctl("BT_LIST: Copy to user failed!\n"); |
250 | return -EFAULT; | 257 | return -EFAULT; |
251 | } | 258 | } |
252 | 259 | ||
253 | LEAVE(); | 260 | lbs_deb_leave(LBS_DEB_IOCTL); |
261 | return 0 ; | ||
262 | } | ||
263 | |||
264 | /** | ||
265 | * @brief Sets inverted state of blacklist (non-zero if inverted) | ||
266 | * @param priv A pointer to wlan_private structure | ||
267 | * @param req A pointer to ifreq structure | ||
268 | * @return 0 --success, otherwise fail | ||
269 | */ | ||
270 | static int wlan_bt_set_invert_ioctl(wlan_private * priv, struct ifreq *req) | ||
271 | { | ||
272 | int ret; | ||
273 | struct iwreq *wrq = (struct iwreq *)req; | ||
274 | union { | ||
275 | u32 id; | ||
276 | char addr1addr2[2 * ETH_ALEN]; | ||
277 | } param; | ||
278 | |||
279 | lbs_deb_enter(LBS_DEB_IOCTL); | ||
280 | |||
281 | param.id = SUBCMD_DATA(wrq) ; | ||
282 | ret = libertas_prepare_and_send_command(priv, cmd_bt_access, | ||
283 | cmd_act_bt_access_set_invert, | ||
284 | cmd_option_waitforrsp, 0, | ||
285 | (char *)¶m); | ||
286 | if (ret != 0) | ||
287 | return -EFAULT; | ||
288 | lbs_deb_leave(LBS_DEB_IOCTL); | ||
289 | return 0; | ||
290 | } | ||
291 | |||
292 | /** | ||
293 | * @brief Gets inverted state of blacklist (non-zero if inverted) | ||
294 | * @param priv A pointer to wlan_private structure | ||
295 | * @param req A pointer to ifreq structure | ||
296 | * @return 0 --success, otherwise fail | ||
297 | */ | ||
298 | static int wlan_bt_get_invert_ioctl(wlan_private * priv, struct ifreq *req) | ||
299 | { | ||
300 | struct iwreq *wrq = (struct iwreq *)req; | ||
301 | int ret; | ||
302 | union { | ||
303 | u32 id; | ||
304 | char addr1addr2[2 * ETH_ALEN]; | ||
305 | } param; | ||
306 | |||
307 | lbs_deb_enter(LBS_DEB_IOCTL); | ||
308 | |||
309 | ret = libertas_prepare_and_send_command(priv, cmd_bt_access, | ||
310 | cmd_act_bt_access_get_invert, | ||
311 | cmd_option_waitforrsp, 0, | ||
312 | (char *)¶m); | ||
313 | |||
314 | if (ret == 0) | ||
315 | wrq->u.param.value = le32_to_cpu(param.id); | ||
316 | else | ||
317 | return -EFAULT; | ||
318 | |||
319 | lbs_deb_leave(LBS_DEB_IOCTL); | ||
254 | return 0; | 320 | return 0; |
255 | } | 321 | } |
256 | 322 | ||
@@ -278,8 +344,10 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req) | |||
278 | char in_str[128]; | 344 | char in_str[128]; |
279 | static struct cmd_ds_fwt_access fwt_access; | 345 | static struct cmd_ds_fwt_access fwt_access; |
280 | char *ptr; | 346 | char *ptr; |
347 | int ret; | ||
348 | |||
349 | lbs_deb_enter(LBS_DEB_IOCTL); | ||
281 | 350 | ||
282 | ENTER(); | ||
283 | if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) | 351 | if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) |
284 | return -EFAULT; | 352 | return -EFAULT; |
285 | 353 | ||
@@ -297,7 +365,7 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req) | |||
297 | fwt_access.metric = | 365 | fwt_access.metric = |
298 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); | 366 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); |
299 | else | 367 | else |
300 | fwt_access.metric = FWT_DEFAULT_METRIC; | 368 | fwt_access.metric = cpu_to_le32(FWT_DEFAULT_METRIC); |
301 | 369 | ||
302 | if ((ptr = next_param(ptr))) | 370 | if ((ptr = next_param(ptr))) |
303 | fwt_access.dir = (u8)simple_strtoul(ptr, &ptr, 10); | 371 | fwt_access.dir = (u8)simple_strtoul(ptr, &ptr, 10); |
@@ -305,16 +373,21 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req) | |||
305 | fwt_access.dir = FWT_DEFAULT_DIR; | 373 | fwt_access.dir = FWT_DEFAULT_DIR; |
306 | 374 | ||
307 | if ((ptr = next_param(ptr))) | 375 | if ((ptr = next_param(ptr))) |
376 | fwt_access.rate = (u8) simple_strtoul(ptr, &ptr, 10); | ||
377 | else | ||
378 | fwt_access.rate = FWT_DEFAULT_RATE; | ||
379 | |||
380 | if ((ptr = next_param(ptr))) | ||
308 | fwt_access.ssn = | 381 | fwt_access.ssn = |
309 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); | 382 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); |
310 | else | 383 | else |
311 | fwt_access.ssn = FWT_DEFAULT_SSN; | 384 | fwt_access.ssn = cpu_to_le32(FWT_DEFAULT_SSN); |
312 | 385 | ||
313 | if ((ptr = next_param(ptr))) | 386 | if ((ptr = next_param(ptr))) |
314 | fwt_access.dsn = | 387 | fwt_access.dsn = |
315 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); | 388 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); |
316 | else | 389 | else |
317 | fwt_access.dsn = FWT_DEFAULT_DSN; | 390 | fwt_access.dsn = cpu_to_le32(FWT_DEFAULT_DSN); |
318 | 391 | ||
319 | if ((ptr = next_param(ptr))) | 392 | if ((ptr = next_param(ptr))) |
320 | fwt_access.hopcount = simple_strtoul(ptr, &ptr, 10); | 393 | fwt_access.hopcount = simple_strtoul(ptr, &ptr, 10); |
@@ -330,7 +403,7 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req) | |||
330 | fwt_access.expiration = | 403 | fwt_access.expiration = |
331 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); | 404 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); |
332 | else | 405 | else |
333 | fwt_access.expiration = FWT_DEFAULT_EXPIRATION; | 406 | fwt_access.expiration = cpu_to_le32(FWT_DEFAULT_EXPIRATION); |
334 | 407 | ||
335 | if ((ptr = next_param(ptr))) | 408 | if ((ptr = next_param(ptr))) |
336 | fwt_access.sleepmode = (u8)simple_strtoul(ptr, &ptr, 10); | 409 | fwt_access.sleepmode = (u8)simple_strtoul(ptr, &ptr, 10); |
@@ -341,27 +414,29 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req) | |||
341 | fwt_access.snr = | 414 | fwt_access.snr = |
342 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); | 415 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); |
343 | else | 416 | else |
344 | fwt_access.snr = FWT_DEFAULT_SNR; | 417 | fwt_access.snr = cpu_to_le32(FWT_DEFAULT_SNR); |
345 | 418 | ||
346 | #ifdef DEBUG | 419 | #ifdef DEBUG |
347 | { | 420 | { |
348 | char ethaddr1_str[18], ethaddr2_str[18]; | 421 | char ethaddr1_str[18], ethaddr2_str[18]; |
349 | eth_addr2str(fwt_access.da, ethaddr1_str); | 422 | eth_addr2str(fwt_access.da, ethaddr1_str); |
350 | eth_addr2str(fwt_access.ra, ethaddr2_str); | 423 | eth_addr2str(fwt_access.ra, ethaddr2_str); |
351 | lbs_pr_debug(1, "FWT_ADD: adding (da:%s,%i,ra:%s)\n", ethaddr1_str, | 424 | lbs_deb_ioctl("FWT_ADD: adding (da:%s,%i,ra:%s)\n", ethaddr1_str, |
352 | fwt_access.dir, ethaddr2_str); | 425 | fwt_access.dir, ethaddr2_str); |
353 | lbs_pr_debug(1, "FWT_ADD: ssn:%u dsn:%u met:%u hop:%u ttl:%u exp:%u slp:%u snr:%u\n", | 426 | lbs_deb_ioctl("FWT_ADD: ssn:%u dsn:%u met:%u hop:%u ttl:%u exp:%u slp:%u snr:%u\n", |
354 | fwt_access.ssn, fwt_access.dsn, fwt_access.metric, | 427 | fwt_access.ssn, fwt_access.dsn, fwt_access.metric, |
355 | fwt_access.hopcount, fwt_access.ttl, fwt_access.expiration, | 428 | fwt_access.hopcount, fwt_access.ttl, fwt_access.expiration, |
356 | fwt_access.sleepmode, fwt_access.snr); | 429 | fwt_access.sleepmode, fwt_access.snr); |
357 | } | 430 | } |
358 | #endif | 431 | #endif |
359 | 432 | ||
360 | LEAVE(); | 433 | ret = libertas_prepare_and_send_command(priv, cmd_fwt_access, |
361 | return (libertas_prepare_and_send_command(priv, cmd_fwt_access, | 434 | cmd_act_fwt_access_add, |
362 | cmd_act_fwt_access_add, | 435 | cmd_option_waitforrsp, 0, |
363 | cmd_option_waitforrsp, 0, | 436 | (void *)&fwt_access); |
364 | (void *)&fwt_access)); | 437 | |
438 | lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret); | ||
439 | return ret; | ||
365 | } | 440 | } |
366 | 441 | ||
367 | /** | 442 | /** |
@@ -376,8 +451,10 @@ static int wlan_fwt_del_ioctl(wlan_private * priv, struct ifreq *req) | |||
376 | char in_str[64]; | 451 | char in_str[64]; |
377 | static struct cmd_ds_fwt_access fwt_access; | 452 | static struct cmd_ds_fwt_access fwt_access; |
378 | char *ptr; | 453 | char *ptr; |
454 | int ret; | ||
455 | |||
456 | lbs_deb_enter(LBS_DEB_IOCTL); | ||
379 | 457 | ||
380 | ENTER(); | ||
381 | if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) | 458 | if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) |
382 | return -EFAULT; | 459 | return -EFAULT; |
383 | 460 | ||
@@ -399,20 +476,21 @@ static int wlan_fwt_del_ioctl(wlan_private * priv, struct ifreq *req) | |||
399 | #ifdef DEBUG | 476 | #ifdef DEBUG |
400 | { | 477 | { |
401 | char ethaddr1_str[18], ethaddr2_str[18]; | 478 | char ethaddr1_str[18], ethaddr2_str[18]; |
402 | lbs_pr_debug(1, "FWT_DEL: line is %s\n", in_str); | 479 | lbs_deb_ioctl("FWT_DEL: line is %s\n", in_str); |
403 | eth_addr2str(fwt_access.da, ethaddr1_str); | 480 | eth_addr2str(fwt_access.da, ethaddr1_str); |
404 | eth_addr2str(fwt_access.ra, ethaddr2_str); | 481 | eth_addr2str(fwt_access.ra, ethaddr2_str); |
405 | lbs_pr_debug(1, "FWT_DEL: removing (da:%s,ra:%s,dir:%d)\n", ethaddr1_str, | 482 | lbs_deb_ioctl("FWT_DEL: removing (da:%s,ra:%s,dir:%d)\n", ethaddr1_str, |
406 | ethaddr2_str, fwt_access.dir); | 483 | ethaddr2_str, fwt_access.dir); |
407 | } | 484 | } |
408 | #endif | 485 | #endif |
409 | 486 | ||
410 | LEAVE(); | 487 | ret = libertas_prepare_and_send_command(priv, |
411 | return (libertas_prepare_and_send_command(priv, | 488 | cmd_fwt_access, |
412 | cmd_fwt_access, | 489 | cmd_act_fwt_access_del, |
413 | cmd_act_fwt_access_del, | 490 | cmd_option_waitforrsp, 0, |
414 | cmd_option_waitforrsp, 0, | 491 | (void *)&fwt_access); |
415 | (void *)&fwt_access)); | 492 | lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret); |
493 | return ret; | ||
416 | } | 494 | } |
417 | 495 | ||
418 | 496 | ||
@@ -427,15 +505,18 @@ static void print_route(struct cmd_ds_fwt_access fwt_access, char *buf) | |||
427 | buf += eth_addr2str(fwt_access.da, buf); | 505 | buf += eth_addr2str(fwt_access.da, buf); |
428 | buf += sprintf(buf, " "); | 506 | buf += sprintf(buf, " "); |
429 | buf += eth_addr2str(fwt_access.ra, buf); | 507 | buf += eth_addr2str(fwt_access.ra, buf); |
508 | buf += sprintf(buf, " %u", fwt_access.valid); | ||
430 | buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.metric)); | 509 | buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.metric)); |
431 | buf += sprintf(buf, " %u", fwt_access.dir); | 510 | buf += sprintf(buf, " %u", fwt_access.dir); |
511 | buf += sprintf(buf, " %u", fwt_access.rate); | ||
432 | buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.ssn)); | 512 | buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.ssn)); |
433 | buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.dsn)); | 513 | buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.dsn)); |
434 | buf += sprintf(buf, " %u", fwt_access.hopcount); | 514 | buf += sprintf(buf, " %u", fwt_access.hopcount); |
435 | buf += sprintf(buf, " %u", fwt_access.ttl); | 515 | buf += sprintf(buf, " %u", fwt_access.ttl); |
436 | buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.expiration)); | 516 | buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.expiration)); |
437 | buf += sprintf(buf, " %u", fwt_access.sleepmode); | 517 | buf += sprintf(buf, " %u", fwt_access.sleepmode); |
438 | buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.snr)); | 518 | buf += sprintf(buf, " %u ", le32_to_cpu(fwt_access.snr)); |
519 | buf += eth_addr2str(fwt_access.prec, buf); | ||
439 | } | 520 | } |
440 | 521 | ||
441 | /** | 522 | /** |
@@ -453,7 +534,8 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req) | |||
453 | static char out_str[128]; | 534 | static char out_str[128]; |
454 | int ret; | 535 | int ret; |
455 | 536 | ||
456 | ENTER(); | 537 | lbs_deb_enter(LBS_DEB_IOCTL); |
538 | |||
457 | if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) | 539 | if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) |
458 | return -EFAULT; | 540 | return -EFAULT; |
459 | 541 | ||
@@ -465,9 +547,9 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req) | |||
465 | #ifdef DEBUG | 547 | #ifdef DEBUG |
466 | { | 548 | { |
467 | char ethaddr1_str[18]; | 549 | char ethaddr1_str[18]; |
468 | lbs_pr_debug(1, "FWT_LOOKUP: line is %s\n", in_str); | 550 | lbs_deb_ioctl("FWT_LOOKUP: line is %s\n", in_str); |
469 | eth_addr2str(fwt_access.da, ethaddr1_str); | 551 | eth_addr2str(fwt_access.da, ethaddr1_str); |
470 | lbs_pr_debug(1, "FWT_LOOKUP: looking for (da:%s)\n", ethaddr1_str); | 552 | lbs_deb_ioctl("FWT_LOOKUP: looking for (da:%s)\n", ethaddr1_str); |
471 | } | 553 | } |
472 | #endif | 554 | #endif |
473 | 555 | ||
@@ -485,11 +567,11 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req) | |||
485 | wrq->u.data.length = strlen(out_str); | 567 | wrq->u.data.length = strlen(out_str); |
486 | if (copy_to_user(wrq->u.data.pointer, (char *)out_str, | 568 | if (copy_to_user(wrq->u.data.pointer, (char *)out_str, |
487 | wrq->u.data.length)) { | 569 | wrq->u.data.length)) { |
488 | lbs_pr_debug(1, "FWT_LOOKUP: Copy to user failed!\n"); | 570 | lbs_deb_ioctl("FWT_LOOKUP: Copy to user failed!\n"); |
489 | return -EFAULT; | 571 | return -EFAULT; |
490 | } | 572 | } |
491 | 573 | ||
492 | LEAVE(); | 574 | lbs_deb_leave(LBS_DEB_IOCTL); |
493 | return 0; | 575 | return 0; |
494 | } | 576 | } |
495 | 577 | ||
@@ -500,7 +582,7 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req) | |||
500 | */ | 582 | */ |
501 | static int wlan_fwt_reset_ioctl(wlan_private * priv) | 583 | static int wlan_fwt_reset_ioctl(wlan_private * priv) |
502 | { | 584 | { |
503 | lbs_pr_debug(1, "FWT: resetting\n"); | 585 | lbs_deb_ioctl("FWT: resetting\n"); |
504 | 586 | ||
505 | return (libertas_prepare_and_send_command(priv, | 587 | return (libertas_prepare_and_send_command(priv, |
506 | cmd_fwt_access, | 588 | cmd_fwt_access, |
@@ -522,18 +604,21 @@ static int wlan_fwt_list_ioctl(wlan_private * priv, struct ifreq *req) | |||
522 | char *ptr = in_str; | 604 | char *ptr = in_str; |
523 | static char out_str[128]; | 605 | static char out_str[128]; |
524 | char *pbuf = out_str; | 606 | char *pbuf = out_str; |
525 | int ret; | 607 | int ret = 0; |
526 | 608 | ||
527 | ENTER(); | 609 | lbs_deb_enter(LBS_DEB_IOCTL); |
528 | if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) | 610 | |
529 | return -EFAULT; | 611 | if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) { |
612 | ret = -EFAULT; | ||
613 | goto out; | ||
614 | } | ||
530 | 615 | ||
531 | fwt_access.id = cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); | 616 | fwt_access.id = cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); |
532 | 617 | ||
533 | #ifdef DEBUG | 618 | #ifdef DEBUG |
534 | { | 619 | { |
535 | lbs_pr_debug(1, "FWT_LIST: line is %s\n", in_str); | 620 | lbs_deb_ioctl("FWT_LIST: line is %s\n", in_str); |
536 | lbs_pr_debug(1, "FWT_LIST: listing id:%i\n", le32_to_cpu(fwt_access.id)); | 621 | lbs_deb_ioctl("FWT_LIST: listing id:%i\n", le32_to_cpu(fwt_access.id)); |
537 | } | 622 | } |
538 | #endif | 623 | #endif |
539 | 624 | ||
@@ -549,12 +634,16 @@ static int wlan_fwt_list_ioctl(wlan_private * priv, struct ifreq *req) | |||
549 | wrq->u.data.length = strlen(out_str); | 634 | wrq->u.data.length = strlen(out_str); |
550 | if (copy_to_user(wrq->u.data.pointer, (char *)out_str, | 635 | if (copy_to_user(wrq->u.data.pointer, (char *)out_str, |
551 | wrq->u.data.length)) { | 636 | wrq->u.data.length)) { |
552 | lbs_pr_debug(1, "FWT_LIST: Copy to user failed!\n"); | 637 | lbs_deb_ioctl("FWT_LIST: Copy to user failed!\n"); |
553 | return -EFAULT; | 638 | ret = -EFAULT; |
639 | goto out; | ||
554 | } | 640 | } |
555 | 641 | ||
556 | LEAVE(); | 642 | ret = 0; |
557 | return 0; | 643 | |
644 | out: | ||
645 | lbs_deb_leave(LBS_DEB_IOCTL); | ||
646 | return ret; | ||
558 | } | 647 | } |
559 | 648 | ||
560 | /** | 649 | /** |
@@ -573,7 +662,8 @@ static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req) | |||
573 | char *pbuf = out_str; | 662 | char *pbuf = out_str; |
574 | int ret; | 663 | int ret; |
575 | 664 | ||
576 | ENTER(); | 665 | lbs_deb_enter(LBS_DEB_IOCTL); |
666 | |||
577 | if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) | 667 | if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) |
578 | return -EFAULT; | 668 | return -EFAULT; |
579 | 669 | ||
@@ -581,8 +671,8 @@ static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req) | |||
581 | 671 | ||
582 | #ifdef DEBUG | 672 | #ifdef DEBUG |
583 | { | 673 | { |
584 | lbs_pr_debug(1, "FWT_LIST_ROUTE: line is %s\n", in_str); | 674 | lbs_deb_ioctl("FWT_LIST_ROUTE: line is %s\n", in_str); |
585 | lbs_pr_debug(1, "FWT_LIST_ROUTE: listing id:%i\n", le32_to_cpu(fwt_access.id)); | 675 | lbs_deb_ioctl("FWT_LIST_ROUTE: listing id:%i\n", le32_to_cpu(fwt_access.id)); |
586 | } | 676 | } |
587 | #endif | 677 | #endif |
588 | 678 | ||
@@ -591,28 +681,18 @@ static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req) | |||
591 | cmd_option_waitforrsp, 0, (void *)&fwt_access); | 681 | cmd_option_waitforrsp, 0, (void *)&fwt_access); |
592 | 682 | ||
593 | if (ret == 0) { | 683 | if (ret == 0) { |
594 | pbuf += sprintf(pbuf, " "); | 684 | print_route(fwt_access, pbuf); |
595 | pbuf += eth_addr2str(fwt_access.da, pbuf); | ||
596 | pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.metric)); | ||
597 | pbuf += sprintf(pbuf, " %u", fwt_access.dir); | ||
598 | /* note that the firmware returns the nid in the id field */ | ||
599 | pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.id)); | ||
600 | pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.ssn)); | ||
601 | pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.dsn)); | ||
602 | pbuf += sprintf(pbuf, " hop %u", fwt_access.hopcount); | ||
603 | pbuf += sprintf(pbuf, " ttl %u", fwt_access.ttl); | ||
604 | pbuf += sprintf(pbuf, " %u", le32_to_cpu(fwt_access.expiration)); | ||
605 | } else | 685 | } else |
606 | pbuf += sprintf(pbuf, " (null)"); | 686 | pbuf += sprintf(pbuf, " (null)"); |
607 | 687 | ||
608 | wrq->u.data.length = strlen(out_str); | 688 | wrq->u.data.length = strlen(out_str); |
609 | if (copy_to_user(wrq->u.data.pointer, (char *)out_str, | 689 | if (copy_to_user(wrq->u.data.pointer, (char *)out_str, |
610 | wrq->u.data.length)) { | 690 | wrq->u.data.length)) { |
611 | lbs_pr_debug(1, "FWT_LIST_ROUTE: Copy to user failed!\n"); | 691 | lbs_deb_ioctl("FWT_LIST_ROUTE: Copy to user failed!\n"); |
612 | return -EFAULT; | 692 | return -EFAULT; |
613 | } | 693 | } |
614 | 694 | ||
615 | LEAVE(); | 695 | lbs_deb_leave(LBS_DEB_IOCTL); |
616 | return 0; | 696 | return 0; |
617 | } | 697 | } |
618 | 698 | ||
@@ -632,7 +712,8 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req) | |||
632 | char *pbuf = out_str; | 712 | char *pbuf = out_str; |
633 | int ret; | 713 | int ret; |
634 | 714 | ||
635 | ENTER(); | 715 | lbs_deb_enter(LBS_DEB_IOCTL); |
716 | |||
636 | if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) | 717 | if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) |
637 | return -EFAULT; | 718 | return -EFAULT; |
638 | 719 | ||
@@ -641,8 +722,8 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req) | |||
641 | 722 | ||
642 | #ifdef DEBUG | 723 | #ifdef DEBUG |
643 | { | 724 | { |
644 | lbs_pr_debug(1, "FWT_LIST_NEIGHBOR: line is %s\n", in_str); | 725 | lbs_deb_ioctl("FWT_LIST_NEIGHBOR: line is %s\n", in_str); |
645 | lbs_pr_debug(1, "FWT_LIST_NEIGHBOR: listing id:%i\n", le32_to_cpu(fwt_access.id)); | 726 | lbs_deb_ioctl("FWT_LIST_NEIGHBOR: listing id:%i\n", le32_to_cpu(fwt_access.id)); |
646 | } | 727 | } |
647 | #endif | 728 | #endif |
648 | 729 | ||
@@ -663,11 +744,11 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req) | |||
663 | wrq->u.data.length = strlen(out_str); | 744 | wrq->u.data.length = strlen(out_str); |
664 | if (copy_to_user(wrq->u.data.pointer, (char *)out_str, | 745 | if (copy_to_user(wrq->u.data.pointer, (char *)out_str, |
665 | wrq->u.data.length)) { | 746 | wrq->u.data.length)) { |
666 | lbs_pr_debug(1, "FWT_LIST_NEIGHBOR: Copy to user failed!\n"); | 747 | lbs_deb_ioctl("FWT_LIST_NEIGHBOR: Copy to user failed!\n"); |
667 | return -EFAULT; | 748 | return -EFAULT; |
668 | } | 749 | } |
669 | 750 | ||
670 | LEAVE(); | 751 | lbs_deb_leave(LBS_DEB_IOCTL); |
671 | return 0; | 752 | return 0; |
672 | } | 753 | } |
673 | 754 | ||
@@ -684,9 +765,9 @@ static int wlan_fwt_cleanup_ioctl(wlan_private * priv, struct ifreq *req) | |||
684 | static struct cmd_ds_fwt_access fwt_access; | 765 | static struct cmd_ds_fwt_access fwt_access; |
685 | int ret; | 766 | int ret; |
686 | 767 | ||
687 | ENTER(); | 768 | lbs_deb_enter(LBS_DEB_IOCTL); |
688 | 769 | ||
689 | lbs_pr_debug(1, "FWT: cleaning up\n"); | 770 | lbs_deb_ioctl("FWT: cleaning up\n"); |
690 | 771 | ||
691 | memset(&fwt_access, 0, sizeof(fwt_access)); | 772 | memset(&fwt_access, 0, sizeof(fwt_access)); |
692 | 773 | ||
@@ -700,7 +781,7 @@ static int wlan_fwt_cleanup_ioctl(wlan_private * priv, struct ifreq *req) | |||
700 | else | 781 | else |
701 | return -EFAULT; | 782 | return -EFAULT; |
702 | 783 | ||
703 | LEAVE(); | 784 | lbs_deb_leave(LBS_DEB_IOCTL); |
704 | return 0; | 785 | return 0; |
705 | } | 786 | } |
706 | 787 | ||
@@ -716,9 +797,9 @@ static int wlan_fwt_time_ioctl(wlan_private * priv, struct ifreq *req) | |||
716 | static struct cmd_ds_fwt_access fwt_access; | 797 | static struct cmd_ds_fwt_access fwt_access; |
717 | int ret; | 798 | int ret; |
718 | 799 | ||
719 | ENTER(); | 800 | lbs_deb_enter(LBS_DEB_IOCTL); |
720 | 801 | ||
721 | lbs_pr_debug(1, "FWT: getting time\n"); | 802 | lbs_deb_ioctl("FWT: getting time\n"); |
722 | 803 | ||
723 | memset(&fwt_access, 0, sizeof(fwt_access)); | 804 | memset(&fwt_access, 0, sizeof(fwt_access)); |
724 | 805 | ||
@@ -732,7 +813,7 @@ static int wlan_fwt_time_ioctl(wlan_private * priv, struct ifreq *req) | |||
732 | else | 813 | else |
733 | return -EFAULT; | 814 | return -EFAULT; |
734 | 815 | ||
735 | LEAVE(); | 816 | lbs_deb_leave(LBS_DEB_IOCTL); |
736 | return 0; | 817 | return 0; |
737 | } | 818 | } |
738 | 819 | ||
@@ -748,7 +829,7 @@ static int wlan_mesh_get_ttl_ioctl(wlan_private * priv, struct ifreq *req) | |||
748 | struct cmd_ds_mesh_access mesh_access; | 829 | struct cmd_ds_mesh_access mesh_access; |
749 | int ret; | 830 | int ret; |
750 | 831 | ||
751 | ENTER(); | 832 | lbs_deb_enter(LBS_DEB_IOCTL); |
752 | 833 | ||
753 | memset(&mesh_access, 0, sizeof(mesh_access)); | 834 | memset(&mesh_access, 0, sizeof(mesh_access)); |
754 | 835 | ||
@@ -762,7 +843,7 @@ static int wlan_mesh_get_ttl_ioctl(wlan_private * priv, struct ifreq *req) | |||
762 | else | 843 | else |
763 | return -EFAULT; | 844 | return -EFAULT; |
764 | 845 | ||
765 | LEAVE(); | 846 | lbs_deb_leave(LBS_DEB_IOCTL); |
766 | return 0; | 847 | return 0; |
767 | } | 848 | } |
768 | 849 | ||
@@ -777,13 +858,13 @@ static int wlan_mesh_set_ttl_ioctl(wlan_private * priv, int ttl) | |||
777 | struct cmd_ds_mesh_access mesh_access; | 858 | struct cmd_ds_mesh_access mesh_access; |
778 | int ret; | 859 | int ret; |
779 | 860 | ||
780 | ENTER(); | 861 | lbs_deb_enter(LBS_DEB_IOCTL); |
781 | 862 | ||
782 | if( (ttl > 0xff) || (ttl < 0) ) | 863 | if( (ttl > 0xff) || (ttl < 0) ) |
783 | return -EINVAL; | 864 | return -EINVAL; |
784 | 865 | ||
785 | memset(&mesh_access, 0, sizeof(mesh_access)); | 866 | memset(&mesh_access, 0, sizeof(mesh_access)); |
786 | mesh_access.data[0] = ttl; | 867 | mesh_access.data[0] = cpu_to_le32(ttl); |
787 | 868 | ||
788 | ret = libertas_prepare_and_send_command(priv, cmd_mesh_access, | 869 | ret = libertas_prepare_and_send_command(priv, cmd_mesh_access, |
789 | cmd_act_mesh_set_ttl, | 870 | cmd_act_mesh_set_ttl, |
@@ -793,7 +874,7 @@ static int wlan_mesh_set_ttl_ioctl(wlan_private * priv, int ttl) | |||
793 | if (ret != 0) | 874 | if (ret != 0) |
794 | ret = -EFAULT; | 875 | ret = -EFAULT; |
795 | 876 | ||
796 | LEAVE(); | 877 | lbs_deb_leave(LBS_DEB_IOCTL); |
797 | return ret; | 878 | return ret; |
798 | } | 879 | } |
799 | 880 | ||
@@ -815,9 +896,9 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) | |||
815 | wlan_adapter *adapter = priv->adapter; | 896 | wlan_adapter *adapter = priv->adapter; |
816 | struct iwreq *wrq = (struct iwreq *)req; | 897 | struct iwreq *wrq = (struct iwreq *)req; |
817 | 898 | ||
818 | ENTER(); | 899 | lbs_deb_enter(LBS_DEB_IOCTL); |
819 | 900 | ||
820 | lbs_pr_debug(1, "libertas_do_ioctl: ioctl cmd = 0x%x\n", cmd); | 901 | lbs_deb_ioctl("libertas_do_ioctl: ioctl cmd = 0x%x\n", cmd); |
821 | switch (cmd) { | 902 | switch (cmd) { |
822 | case WLAN_SETNONE_GETNONE: /* set WPA mode on/off ioctl #20 */ | 903 | case WLAN_SETNONE_GETNONE: /* set WPA mode on/off ioctl #20 */ |
823 | switch (wrq->u.data.flags) { | 904 | switch (wrq->u.data.flags) { |
@@ -848,6 +929,10 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) | |||
848 | ret = wlan_mesh_set_ttl_ioctl(priv, idata); | 929 | ret = wlan_mesh_set_ttl_ioctl(priv, idata); |
849 | break; | 930 | break; |
850 | 931 | ||
932 | case WLAN_SUBCMD_BT_SET_INVERT: | ||
933 | ret = wlan_bt_set_invert_ioctl(priv, req); | ||
934 | break ; | ||
935 | |||
851 | default: | 936 | default: |
852 | ret = -EOPNOTSUPP; | 937 | ret = -EOPNOTSUPP; |
853 | break; | 938 | break; |
@@ -905,6 +990,10 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) | |||
905 | ret = wlan_mesh_get_ttl_ioctl(priv, req); | 990 | ret = wlan_mesh_get_ttl_ioctl(priv, req); |
906 | break; | 991 | break; |
907 | 992 | ||
993 | case WLAN_SUBCMD_BT_GET_INVERT: | ||
994 | ret = wlan_bt_get_invert_ioctl(priv, req); | ||
995 | break ; | ||
996 | |||
908 | default: | 997 | default: |
909 | ret = -EOPNOTSUPP; | 998 | ret = -EOPNOTSUPP; |
910 | 999 | ||
@@ -937,7 +1026,7 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) | |||
937 | (data, wrq->u.data.pointer, | 1026 | (data, wrq->u.data.pointer, |
938 | sizeof(int) * | 1027 | sizeof(int) * |
939 | wrq->u.data.length)) { | 1028 | wrq->u.data.length)) { |
940 | lbs_pr_debug(1, | 1029 | lbs_deb_ioctl( |
941 | "Copy from user failed\n"); | 1030 | "Copy from user failed\n"); |
942 | return -EFAULT; | 1031 | return -EFAULT; |
943 | } | 1032 | } |
@@ -970,7 +1059,7 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) | |||
970 | if (copy_to_user(wrq->u.data.pointer, data, | 1059 | if (copy_to_user(wrq->u.data.pointer, data, |
971 | sizeof(int) * | 1060 | sizeof(int) * |
972 | gpio->header.len)) { | 1061 | gpio->header.len)) { |
973 | lbs_pr_debug(1, "Copy to user failed\n"); | 1062 | lbs_deb_ioctl("Copy to user failed\n"); |
974 | return -EFAULT; | 1063 | return -EFAULT; |
975 | } | 1064 | } |
976 | 1065 | ||
@@ -984,7 +1073,8 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) | |||
984 | ret = -EINVAL; | 1073 | ret = -EINVAL; |
985 | break; | 1074 | break; |
986 | } | 1075 | } |
987 | LEAVE(); | 1076 | |
1077 | lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret); | ||
988 | return ret; | 1078 | return ret; |
989 | } | 1079 | } |
990 | 1080 | ||
diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c index d4926b83e145..78ac3064a0bd 100644 --- a/drivers/net/wireless/libertas/join.c +++ b/drivers/net/wireless/libertas/join.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/netdevice.h> | 7 | #include <linux/netdevice.h> |
8 | #include <linux/if_arp.h> | 8 | #include <linux/if_arp.h> |
9 | #include <linux/wireless.h> | 9 | #include <linux/wireless.h> |
10 | #include <linux/etherdevice.h> | ||
10 | 11 | ||
11 | #include <net/iw_handler.h> | 12 | #include <net/iw_handler.h> |
12 | 13 | ||
@@ -14,6 +15,7 @@ | |||
14 | #include "decl.h" | 15 | #include "decl.h" |
15 | #include "join.h" | 16 | #include "join.h" |
16 | #include "dev.h" | 17 | #include "dev.h" |
18 | #include "assoc.h" | ||
17 | 19 | ||
18 | #define AD_HOC_CAP_PRIVACY_ON 1 | 20 | #define AD_HOC_CAP_PRIVACY_ON 1 |
19 | 21 | ||
@@ -60,7 +62,7 @@ static int get_common_rates(wlan_adapter * adapter, u8 * rate1, | |||
60 | lbs_dbg_hex("rate1 (AP) rates:", tmp, sizeof(tmp)); | 62 | lbs_dbg_hex("rate1 (AP) rates:", tmp, sizeof(tmp)); |
61 | lbs_dbg_hex("rate2 (Card) rates:", rate2, rate2_size); | 63 | lbs_dbg_hex("rate2 (Card) rates:", rate2, rate2_size); |
62 | lbs_dbg_hex("Common rates:", ptr, rate1_size); | 64 | lbs_dbg_hex("Common rates:", ptr, rate1_size); |
63 | lbs_pr_debug(1, "Tx datarate is set to 0x%X\n", adapter->datarate); | 65 | lbs_deb_join("Tx datarate is set to 0x%X\n", adapter->datarate); |
64 | 66 | ||
65 | if (!adapter->is_datarate_auto) { | 67 | if (!adapter->is_datarate_auto) { |
66 | while (*ptr) { | 68 | while (*ptr) { |
@@ -104,24 +106,22 @@ int libertas_send_deauth(wlan_private * priv) | |||
104 | * | 106 | * |
105 | * @return 0-success, otherwise fail | 107 | * @return 0-success, otherwise fail |
106 | */ | 108 | */ |
107 | int wlan_associate(wlan_private * priv, struct bss_descriptor * pbssdesc) | 109 | int wlan_associate(wlan_private * priv, struct assoc_request * assoc_req) |
108 | { | 110 | { |
109 | wlan_adapter *adapter = priv->adapter; | 111 | wlan_adapter *adapter = priv->adapter; |
110 | int ret; | 112 | int ret; |
111 | 113 | ||
112 | ENTER(); | 114 | lbs_deb_enter(LBS_DEB_JOIN); |
113 | 115 | ||
114 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_authenticate, | 116 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_authenticate, |
115 | 0, cmd_option_waitforrsp, | 117 | 0, cmd_option_waitforrsp, |
116 | 0, pbssdesc->macaddress); | 118 | 0, assoc_req->bss.bssid); |
117 | 119 | ||
118 | if (ret) { | 120 | if (ret) |
119 | LEAVE(); | 121 | goto done; |
120 | return ret; | ||
121 | } | ||
122 | 122 | ||
123 | /* set preamble to firmware */ | 123 | /* set preamble to firmware */ |
124 | if (adapter->capinfo.shortpreamble && pbssdesc->cap.shortpreamble) | 124 | if (adapter->capinfo.shortpreamble && assoc_req->bss.cap.shortpreamble) |
125 | adapter->preamble = cmd_type_short_preamble; | 125 | adapter->preamble = cmd_type_short_preamble; |
126 | else | 126 | else |
127 | adapter->preamble = cmd_type_long_preamble; | 127 | adapter->preamble = cmd_type_long_preamble; |
@@ -129,9 +129,10 @@ int wlan_associate(wlan_private * priv, struct bss_descriptor * pbssdesc) | |||
129 | libertas_set_radio_control(priv); | 129 | libertas_set_radio_control(priv); |
130 | 130 | ||
131 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_associate, | 131 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_associate, |
132 | 0, cmd_option_waitforrsp, 0, pbssdesc); | 132 | 0, cmd_option_waitforrsp, 0, assoc_req); |
133 | 133 | ||
134 | LEAVE(); | 134 | done: |
135 | lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); | ||
135 | return ret; | 136 | return ret; |
136 | } | 137 | } |
137 | 138 | ||
@@ -142,7 +143,7 @@ int wlan_associate(wlan_private * priv, struct bss_descriptor * pbssdesc) | |||
142 | * @param adhocssid The ssid of the Adhoc Network | 143 | * @param adhocssid The ssid of the Adhoc Network |
143 | * @return 0--success, -1--fail | 144 | * @return 0--success, -1--fail |
144 | */ | 145 | */ |
145 | int libertas_start_adhoc_network(wlan_private * priv, struct WLAN_802_11_SSID *adhocssid) | 146 | int libertas_start_adhoc_network(wlan_private * priv, struct assoc_request * assoc_req) |
146 | { | 147 | { |
147 | wlan_adapter *adapter = priv->adapter; | 148 | wlan_adapter *adapter = priv->adapter; |
148 | int ret = 0; | 149 | int ret = 0; |
@@ -150,22 +151,20 @@ int libertas_start_adhoc_network(wlan_private * priv, struct WLAN_802_11_SSID *a | |||
150 | adapter->adhoccreate = 1; | 151 | adapter->adhoccreate = 1; |
151 | 152 | ||
152 | if (!adapter->capinfo.shortpreamble) { | 153 | if (!adapter->capinfo.shortpreamble) { |
153 | lbs_pr_debug(1, "AdhocStart: Long preamble\n"); | 154 | lbs_deb_join("AdhocStart: Long preamble\n"); |
154 | adapter->preamble = cmd_type_long_preamble; | 155 | adapter->preamble = cmd_type_long_preamble; |
155 | } else { | 156 | } else { |
156 | lbs_pr_debug(1, "AdhocStart: Short preamble\n"); | 157 | lbs_deb_join("AdhocStart: Short preamble\n"); |
157 | adapter->preamble = cmd_type_short_preamble; | 158 | adapter->preamble = cmd_type_short_preamble; |
158 | } | 159 | } |
159 | 160 | ||
160 | libertas_set_radio_control(priv); | 161 | libertas_set_radio_control(priv); |
161 | 162 | ||
162 | lbs_pr_debug(1, "Adhoc channel = %d\n", adapter->adhocchannel); | 163 | lbs_deb_join("AdhocStart: channel = %d\n", assoc_req->channel); |
163 | lbs_pr_debug(1, "curbssparams.channel = %d\n", | 164 | lbs_deb_join("AdhocStart: band = %d\n", assoc_req->band); |
164 | adapter->curbssparams.channel); | ||
165 | lbs_pr_debug(1, "curbssparams.band = %d\n", adapter->curbssparams.band); | ||
166 | 165 | ||
167 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_ad_hoc_start, | 166 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_ad_hoc_start, |
168 | 0, cmd_option_waitforrsp, 0, adhocssid); | 167 | 0, cmd_option_waitforrsp, 0, assoc_req); |
169 | 168 | ||
170 | return ret; | 169 | return ret; |
171 | } | 170 | } |
@@ -179,52 +178,53 @@ int libertas_start_adhoc_network(wlan_private * priv, struct WLAN_802_11_SSID *a | |||
179 | * | 178 | * |
180 | * @return 0--success, -1--fail | 179 | * @return 0--success, -1--fail |
181 | */ | 180 | */ |
182 | int libertas_join_adhoc_network(wlan_private * priv, struct bss_descriptor * pbssdesc) | 181 | int libertas_join_adhoc_network(wlan_private * priv, struct assoc_request * assoc_req) |
183 | { | 182 | { |
184 | wlan_adapter *adapter = priv->adapter; | 183 | wlan_adapter *adapter = priv->adapter; |
184 | struct bss_descriptor * bss = &assoc_req->bss; | ||
185 | int ret = 0; | 185 | int ret = 0; |
186 | 186 | ||
187 | lbs_pr_debug(1, "libertas_join_adhoc_network: CurBss.ssid =%s\n", | 187 | lbs_deb_join("%s: Current SSID '%s', ssid length %u\n", |
188 | adapter->curbssparams.ssid.ssid); | 188 | __func__, |
189 | lbs_pr_debug(1, "libertas_join_adhoc_network: CurBss.ssid_len =%u\n", | 189 | escape_essid(adapter->curbssparams.ssid, |
190 | adapter->curbssparams.ssid.ssidlength); | 190 | adapter->curbssparams.ssid_len), |
191 | lbs_pr_debug(1, "libertas_join_adhoc_network: ssid =%s\n", pbssdesc->ssid.ssid); | 191 | adapter->curbssparams.ssid_len); |
192 | lbs_pr_debug(1, "libertas_join_adhoc_network: ssid len =%u\n", | 192 | lbs_deb_join("%s: requested ssid '%s', ssid length %u\n", |
193 | pbssdesc->ssid.ssidlength); | 193 | __func__, escape_essid(bss->ssid, bss->ssid_len), |
194 | bss->ssid_len); | ||
194 | 195 | ||
195 | /* check if the requested SSID is already joined */ | 196 | /* check if the requested SSID is already joined */ |
196 | if (adapter->curbssparams.ssid.ssidlength | 197 | if (adapter->curbssparams.ssid_len |
197 | && !libertas_SSID_cmp(&pbssdesc->ssid, &adapter->curbssparams.ssid) | 198 | && !libertas_ssid_cmp(adapter->curbssparams.ssid, |
199 | adapter->curbssparams.ssid_len, | ||
200 | bss->ssid, bss->ssid_len) | ||
198 | && (adapter->mode == IW_MODE_ADHOC)) { | 201 | && (adapter->mode == IW_MODE_ADHOC)) { |
199 | 202 | lbs_deb_join( | |
200 | lbs_pr_debug(1, | ||
201 | "ADHOC_J_CMD: New ad-hoc SSID is the same as current, " | 203 | "ADHOC_J_CMD: New ad-hoc SSID is the same as current, " |
202 | "not attempting to re-join"); | 204 | "not attempting to re-join"); |
203 | |||
204 | return -1; | 205 | return -1; |
205 | } | 206 | } |
206 | 207 | ||
207 | /*Use shortpreamble only when both creator and card supports | 208 | /*Use shortpreamble only when both creator and card supports |
208 | short preamble */ | 209 | short preamble */ |
209 | if (!pbssdesc->cap.shortpreamble || !adapter->capinfo.shortpreamble) { | 210 | if (!bss->cap.shortpreamble || !adapter->capinfo.shortpreamble) { |
210 | lbs_pr_debug(1, "AdhocJoin: Long preamble\n"); | 211 | lbs_deb_join("AdhocJoin: Long preamble\n"); |
211 | adapter->preamble = cmd_type_long_preamble; | 212 | adapter->preamble = cmd_type_long_preamble; |
212 | } else { | 213 | } else { |
213 | lbs_pr_debug(1, "AdhocJoin: Short preamble\n"); | 214 | lbs_deb_join("AdhocJoin: Short preamble\n"); |
214 | adapter->preamble = cmd_type_short_preamble; | 215 | adapter->preamble = cmd_type_short_preamble; |
215 | } | 216 | } |
216 | 217 | ||
217 | libertas_set_radio_control(priv); | 218 | libertas_set_radio_control(priv); |
218 | 219 | ||
219 | lbs_pr_debug(1, "curbssparams.channel = %d\n", | 220 | lbs_deb_join("AdhocJoin: channel = %d\n", assoc_req->channel); |
220 | adapter->curbssparams.channel); | 221 | lbs_deb_join("AdhocJoin: band = %c\n", assoc_req->band); |
221 | lbs_pr_debug(1, "curbssparams.band = %c\n", adapter->curbssparams.band); | ||
222 | 222 | ||
223 | adapter->adhoccreate = 0; | 223 | adapter->adhoccreate = 0; |
224 | 224 | ||
225 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_ad_hoc_join, | 225 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_ad_hoc_join, |
226 | 0, cmd_option_waitforrsp, | 226 | 0, cmd_option_waitforrsp, |
227 | OID_802_11_SSID, pbssdesc); | 227 | OID_802_11_SSID, assoc_req); |
228 | 228 | ||
229 | return ret; | 229 | return ret; |
230 | } | 230 | } |
@@ -265,6 +265,8 @@ int libertas_cmd_80211_authenticate(wlan_private * priv, | |||
265 | int ret = -1; | 265 | int ret = -1; |
266 | u8 *bssid = pdata_buf; | 266 | u8 *bssid = pdata_buf; |
267 | 267 | ||
268 | lbs_deb_enter(LBS_DEB_JOIN); | ||
269 | |||
268 | cmd->command = cpu_to_le16(cmd_802_11_authenticate); | 270 | cmd->command = cpu_to_le16(cmd_802_11_authenticate); |
269 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_authenticate) | 271 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_authenticate) |
270 | + S_DS_GEN); | 272 | + S_DS_GEN); |
@@ -281,18 +283,19 @@ int libertas_cmd_80211_authenticate(wlan_private * priv, | |||
281 | pauthenticate->authtype = 0x80; | 283 | pauthenticate->authtype = 0x80; |
282 | break; | 284 | break; |
283 | default: | 285 | default: |
284 | lbs_pr_debug(1, "AUTH_CMD: invalid auth alg 0x%X\n", | 286 | lbs_deb_join("AUTH_CMD: invalid auth alg 0x%X\n", |
285 | adapter->secinfo.auth_mode); | 287 | adapter->secinfo.auth_mode); |
286 | goto out; | 288 | goto out; |
287 | } | 289 | } |
288 | 290 | ||
289 | memcpy(pauthenticate->macaddr, bssid, ETH_ALEN); | 291 | memcpy(pauthenticate->macaddr, bssid, ETH_ALEN); |
290 | 292 | ||
291 | lbs_pr_debug(1, "AUTH_CMD: Bssid is : %x:%x:%x:%x:%x:%x\n", | 293 | lbs_deb_join("AUTH_CMD: BSSID is : " MAC_FMT " auth=0x%X\n", |
292 | bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5]); | 294 | MAC_ARG(bssid), pauthenticate->authtype); |
293 | ret = 0; | 295 | ret = 0; |
294 | 296 | ||
295 | out: | 297 | out: |
298 | lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); | ||
296 | return ret; | 299 | return ret; |
297 | } | 300 | } |
298 | 301 | ||
@@ -302,22 +305,20 @@ int libertas_cmd_80211_deauthenticate(wlan_private * priv, | |||
302 | wlan_adapter *adapter = priv->adapter; | 305 | wlan_adapter *adapter = priv->adapter; |
303 | struct cmd_ds_802_11_deauthenticate *dauth = &cmd->params.deauth; | 306 | struct cmd_ds_802_11_deauthenticate *dauth = &cmd->params.deauth; |
304 | 307 | ||
305 | ENTER(); | 308 | lbs_deb_enter(LBS_DEB_JOIN); |
306 | 309 | ||
307 | cmd->command = cpu_to_le16(cmd_802_11_deauthenticate); | 310 | cmd->command = cpu_to_le16(cmd_802_11_deauthenticate); |
308 | cmd->size = | 311 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_deauthenticate) + |
309 | cpu_to_le16(sizeof(struct cmd_ds_802_11_deauthenticate) + | ||
310 | S_DS_GEN); | 312 | S_DS_GEN); |
311 | 313 | ||
312 | /* set AP MAC address */ | 314 | /* set AP MAC address */ |
313 | memmove(dauth->macaddr, adapter->curbssparams.bssid, | 315 | memmove(dauth->macaddr, adapter->curbssparams.bssid, ETH_ALEN); |
314 | ETH_ALEN); | ||
315 | 316 | ||
316 | /* Reason code 3 = Station is leaving */ | 317 | /* Reason code 3 = Station is leaving */ |
317 | #define REASON_CODE_STA_LEAVING 3 | 318 | #define REASON_CODE_STA_LEAVING 3 |
318 | dauth->reasoncode = cpu_to_le16(REASON_CODE_STA_LEAVING); | 319 | dauth->reasoncode = cpu_to_le16(REASON_CODE_STA_LEAVING); |
319 | 320 | ||
320 | LEAVE(); | 321 | lbs_deb_leave(LBS_DEB_JOIN); |
321 | return 0; | 322 | return 0; |
322 | } | 323 | } |
323 | 324 | ||
@@ -327,20 +328,20 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
327 | wlan_adapter *adapter = priv->adapter; | 328 | wlan_adapter *adapter = priv->adapter; |
328 | struct cmd_ds_802_11_associate *passo = &cmd->params.associate; | 329 | struct cmd_ds_802_11_associate *passo = &cmd->params.associate; |
329 | int ret = 0; | 330 | int ret = 0; |
330 | struct bss_descriptor *pbssdesc; | 331 | struct assoc_request * assoc_req = pdata_buf; |
332 | struct bss_descriptor * bss = &assoc_req->bss; | ||
331 | u8 *card_rates; | 333 | u8 *card_rates; |
332 | u8 *pos; | 334 | u8 *pos; |
333 | int card_rates_size; | 335 | int card_rates_size; |
334 | u16 tmpcap; | 336 | u16 tmpcap, tmplen; |
335 | struct mrvlietypes_ssidparamset *ssid; | 337 | struct mrvlietypes_ssidparamset *ssid; |
336 | struct mrvlietypes_phyparamset *phy; | 338 | struct mrvlietypes_phyparamset *phy; |
337 | struct mrvlietypes_ssparamset *ss; | 339 | struct mrvlietypes_ssparamset *ss; |
338 | struct mrvlietypes_ratesparamset *rates; | 340 | struct mrvlietypes_ratesparamset *rates; |
339 | struct mrvlietypes_rsnparamset *rsn; | 341 | struct mrvlietypes_rsnparamset *rsn; |
340 | 342 | ||
341 | ENTER(); | 343 | lbs_deb_enter(LBS_DEB_JOIN); |
342 | 344 | ||
343 | pbssdesc = pdata_buf; | ||
344 | pos = (u8 *) passo; | 345 | pos = (u8 *) passo; |
345 | 346 | ||
346 | if (!adapter) { | 347 | if (!adapter) { |
@@ -350,15 +351,11 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
350 | 351 | ||
351 | cmd->command = cpu_to_le16(cmd_802_11_associate); | 352 | cmd->command = cpu_to_le16(cmd_802_11_associate); |
352 | 353 | ||
353 | /* Save so we know which BSS Desc to use in the response handler */ | 354 | memcpy(passo->peerstaaddr, bss->bssid, sizeof(passo->peerstaaddr)); |
354 | adapter->pattemptedbssdesc = pbssdesc; | ||
355 | |||
356 | memcpy(passo->peerstaaddr, | ||
357 | pbssdesc->macaddress, sizeof(passo->peerstaaddr)); | ||
358 | pos += sizeof(passo->peerstaaddr); | 355 | pos += sizeof(passo->peerstaaddr); |
359 | 356 | ||
360 | /* set the listen interval */ | 357 | /* set the listen interval */ |
361 | passo->listeninterval = adapter->listeninterval; | 358 | passo->listeninterval = cpu_to_le16(adapter->listeninterval); |
362 | 359 | ||
363 | pos += sizeof(passo->capinfo); | 360 | pos += sizeof(passo->capinfo); |
364 | pos += sizeof(passo->listeninterval); | 361 | pos += sizeof(passo->listeninterval); |
@@ -367,30 +364,30 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
367 | 364 | ||
368 | ssid = (struct mrvlietypes_ssidparamset *) pos; | 365 | ssid = (struct mrvlietypes_ssidparamset *) pos; |
369 | ssid->header.type = cpu_to_le16(TLV_TYPE_SSID); | 366 | ssid->header.type = cpu_to_le16(TLV_TYPE_SSID); |
370 | ssid->header.len = pbssdesc->ssid.ssidlength; | 367 | tmplen = bss->ssid_len; |
371 | memcpy(ssid->ssid, pbssdesc->ssid.ssid, ssid->header.len); | 368 | ssid->header.len = cpu_to_le16(tmplen); |
372 | pos += sizeof(ssid->header) + ssid->header.len; | 369 | memcpy(ssid->ssid, bss->ssid, tmplen); |
373 | ssid->header.len = cpu_to_le16(ssid->header.len); | 370 | pos += sizeof(ssid->header) + tmplen; |
374 | 371 | ||
375 | phy = (struct mrvlietypes_phyparamset *) pos; | 372 | phy = (struct mrvlietypes_phyparamset *) pos; |
376 | phy->header.type = cpu_to_le16(TLV_TYPE_PHY_DS); | 373 | phy->header.type = cpu_to_le16(TLV_TYPE_PHY_DS); |
377 | phy->header.len = sizeof(phy->fh_ds.dsparamset); | 374 | tmplen = sizeof(phy->fh_ds.dsparamset); |
375 | phy->header.len = cpu_to_le16(tmplen); | ||
378 | memcpy(&phy->fh_ds.dsparamset, | 376 | memcpy(&phy->fh_ds.dsparamset, |
379 | &pbssdesc->phyparamset.dsparamset.currentchan, | 377 | &bss->phyparamset.dsparamset.currentchan, |
380 | sizeof(phy->fh_ds.dsparamset)); | 378 | tmplen); |
381 | pos += sizeof(phy->header) + phy->header.len; | 379 | pos += sizeof(phy->header) + tmplen; |
382 | phy->header.len = cpu_to_le16(phy->header.len); | ||
383 | 380 | ||
384 | ss = (struct mrvlietypes_ssparamset *) pos; | 381 | ss = (struct mrvlietypes_ssparamset *) pos; |
385 | ss->header.type = cpu_to_le16(TLV_TYPE_CF); | 382 | ss->header.type = cpu_to_le16(TLV_TYPE_CF); |
386 | ss->header.len = sizeof(ss->cf_ibss.cfparamset); | 383 | tmplen = sizeof(ss->cf_ibss.cfparamset); |
387 | pos += sizeof(ss->header) + ss->header.len; | 384 | ss->header.len = cpu_to_le16(tmplen); |
388 | ss->header.len = cpu_to_le16(ss->header.len); | 385 | pos += sizeof(ss->header) + tmplen; |
389 | 386 | ||
390 | rates = (struct mrvlietypes_ratesparamset *) pos; | 387 | rates = (struct mrvlietypes_ratesparamset *) pos; |
391 | rates->header.type = cpu_to_le16(TLV_TYPE_RATES); | 388 | rates->header.type = cpu_to_le16(TLV_TYPE_RATES); |
392 | 389 | ||
393 | memcpy(&rates->rates, &pbssdesc->libertas_supported_rates, WLAN_SUPPORTED_RATES); | 390 | memcpy(&rates->rates, &bss->libertas_supported_rates, WLAN_SUPPORTED_RATES); |
394 | 391 | ||
395 | card_rates = libertas_supported_rates; | 392 | card_rates = libertas_supported_rates; |
396 | card_rates_size = sizeof(libertas_supported_rates); | 393 | card_rates_size = sizeof(libertas_supported_rates); |
@@ -401,41 +398,42 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
401 | goto done; | 398 | goto done; |
402 | } | 399 | } |
403 | 400 | ||
404 | rates->header.len = min_t(size_t, strlen(rates->rates), WLAN_SUPPORTED_RATES); | 401 | tmplen = min_t(size_t, strlen(rates->rates), WLAN_SUPPORTED_RATES); |
405 | adapter->curbssparams.numofrates = rates->header.len; | 402 | adapter->curbssparams.numofrates = tmplen; |
406 | 403 | ||
407 | pos += sizeof(rates->header) + rates->header.len; | 404 | pos += sizeof(rates->header) + tmplen; |
408 | rates->header.len = cpu_to_le16(rates->header.len); | 405 | rates->header.len = cpu_to_le16(tmplen); |
409 | 406 | ||
410 | if (adapter->secinfo.WPAenabled || adapter->secinfo.WPA2enabled) { | 407 | if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { |
411 | rsn = (struct mrvlietypes_rsnparamset *) pos; | 408 | rsn = (struct mrvlietypes_rsnparamset *) pos; |
412 | rsn->header.type = (u16) adapter->wpa_ie[0]; /* WPA_IE or WPA2_IE */ | 409 | /* WPA_IE or WPA2_IE */ |
413 | rsn->header.type = cpu_to_le16(rsn->header.type); | 410 | rsn->header.type = cpu_to_le16((u16) assoc_req->wpa_ie[0]); |
414 | rsn->header.len = (u16) adapter->wpa_ie[1]; | 411 | tmplen = (u16) assoc_req->wpa_ie[1]; |
415 | memcpy(rsn->rsnie, &adapter->wpa_ie[2], rsn->header.len); | 412 | rsn->header.len = cpu_to_le16(tmplen); |
413 | memcpy(rsn->rsnie, &assoc_req->wpa_ie[2], tmplen); | ||
416 | lbs_dbg_hex("ASSOC_CMD: RSN IE", (u8 *) rsn, | 414 | lbs_dbg_hex("ASSOC_CMD: RSN IE", (u8 *) rsn, |
417 | sizeof(rsn->header) + rsn->header.len); | 415 | sizeof(rsn->header) + tmplen); |
418 | pos += sizeof(rsn->header) + rsn->header.len; | 416 | pos += sizeof(rsn->header) + tmplen; |
419 | rsn->header.len = cpu_to_le16(rsn->header.len); | ||
420 | } | 417 | } |
421 | 418 | ||
422 | /* update curbssparams */ | 419 | /* update curbssparams */ |
423 | adapter->curbssparams.channel = | 420 | adapter->curbssparams.channel = bss->phyparamset.dsparamset.currentchan; |
424 | (pbssdesc->phyparamset.dsparamset.currentchan); | ||
425 | 421 | ||
426 | /* Copy the infra. association rates into Current BSS state structure */ | 422 | /* Copy the infra. association rates into Current BSS state structure */ |
427 | memcpy(&adapter->curbssparams.datarates, &rates->rates, | 423 | memcpy(&adapter->curbssparams.datarates, &rates->rates, |
428 | min_t(size_t, sizeof(adapter->curbssparams.datarates), rates->header.len)); | 424 | min_t(size_t, sizeof(adapter->curbssparams.datarates), |
425 | cpu_to_le16(rates->header.len))); | ||
429 | 426 | ||
430 | lbs_pr_debug(1, "ASSOC_CMD: rates->header.len = %d\n", rates->header.len); | 427 | lbs_deb_join("ASSOC_CMD: rates->header.len = %d\n", |
428 | cpu_to_le16(rates->header.len)); | ||
431 | 429 | ||
432 | /* set IBSS field */ | 430 | /* set IBSS field */ |
433 | if (pbssdesc->mode == IW_MODE_INFRA) { | 431 | if (bss->mode == IW_MODE_INFRA) { |
434 | #define CAPINFO_ESS_MODE 1 | 432 | #define CAPINFO_ESS_MODE 1 |
435 | passo->capinfo.ess = CAPINFO_ESS_MODE; | 433 | passo->capinfo.ess = CAPINFO_ESS_MODE; |
436 | } | 434 | } |
437 | 435 | ||
438 | if (libertas_parse_dnld_countryinfo_11d(priv)) { | 436 | if (libertas_parse_dnld_countryinfo_11d(priv, bss)) { |
439 | ret = -1; | 437 | ret = -1; |
440 | goto done; | 438 | goto done; |
441 | } | 439 | } |
@@ -443,31 +441,28 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
443 | cmd->size = cpu_to_le16((u16) (pos - (u8 *) passo) + S_DS_GEN); | 441 | cmd->size = cpu_to_le16((u16) (pos - (u8 *) passo) + S_DS_GEN); |
444 | 442 | ||
445 | /* set the capability info at last */ | 443 | /* set the capability info at last */ |
446 | memcpy(&tmpcap, &pbssdesc->cap, sizeof(passo->capinfo)); | 444 | memcpy(&tmpcap, &bss->cap, sizeof(passo->capinfo)); |
447 | tmpcap &= CAPINFO_MASK; | 445 | tmpcap &= CAPINFO_MASK; |
448 | lbs_pr_debug(1, "ASSOC_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", | 446 | lbs_deb_join("ASSOC_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", |
449 | tmpcap, CAPINFO_MASK); | 447 | tmpcap, CAPINFO_MASK); |
450 | tmpcap = cpu_to_le16(tmpcap); | ||
451 | memcpy(&passo->capinfo, &tmpcap, sizeof(passo->capinfo)); | 448 | memcpy(&passo->capinfo, &tmpcap, sizeof(passo->capinfo)); |
452 | 449 | ||
453 | done: | 450 | done: |
454 | LEAVE(); | 451 | lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); |
455 | return ret; | 452 | return ret; |
456 | } | 453 | } |
457 | 454 | ||
458 | int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | 455 | int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, |
459 | struct cmd_ds_command *cmd, void *pssid) | 456 | struct cmd_ds_command *cmd, void *pdata_buf) |
460 | { | 457 | { |
461 | wlan_adapter *adapter = priv->adapter; | 458 | wlan_adapter *adapter = priv->adapter; |
462 | struct cmd_ds_802_11_ad_hoc_start *adhs = &cmd->params.ads; | 459 | struct cmd_ds_802_11_ad_hoc_start *adhs = &cmd->params.ads; |
463 | int ret = 0; | 460 | int ret = 0; |
464 | int cmdappendsize = 0; | 461 | int cmdappendsize = 0; |
465 | int i; | 462 | int i; |
466 | u16 tmpcap; | 463 | struct assoc_request * assoc_req = pdata_buf; |
467 | struct bss_descriptor *pbssdesc; | ||
468 | struct WLAN_802_11_SSID *ssid = pssid; | ||
469 | 464 | ||
470 | ENTER(); | 465 | lbs_deb_enter(LBS_DEB_JOIN); |
471 | 466 | ||
472 | if (!adapter) { | 467 | if (!adapter) { |
473 | ret = -1; | 468 | ret = -1; |
@@ -476,9 +471,6 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | |||
476 | 471 | ||
477 | cmd->command = cpu_to_le16(cmd_802_11_ad_hoc_start); | 472 | cmd->command = cpu_to_le16(cmd_802_11_ad_hoc_start); |
478 | 473 | ||
479 | pbssdesc = &adapter->curbssparams.bssdescriptor; | ||
480 | adapter->pattemptedbssdesc = pbssdesc; | ||
481 | |||
482 | /* | 474 | /* |
483 | * Fill in the parameters for 2 data structures: | 475 | * Fill in the parameters for 2 data structures: |
484 | * 1. cmd_ds_802_11_ad_hoc_start command | 476 | * 1. cmd_ds_802_11_ad_hoc_start command |
@@ -492,20 +484,16 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | |||
492 | */ | 484 | */ |
493 | 485 | ||
494 | memset(adhs->SSID, 0, IW_ESSID_MAX_SIZE); | 486 | memset(adhs->SSID, 0, IW_ESSID_MAX_SIZE); |
487 | memcpy(adhs->SSID, assoc_req->ssid, assoc_req->ssid_len); | ||
495 | 488 | ||
496 | memcpy(adhs->SSID, ssid->ssid, ssid->ssidlength); | 489 | lbs_deb_join("ADHOC_S_CMD: SSID '%s', ssid length %u\n", |
497 | 490 | escape_essid(assoc_req->ssid, assoc_req->ssid_len), | |
498 | lbs_pr_debug(1, "ADHOC_S_CMD: SSID = %s\n", adhs->SSID); | 491 | assoc_req->ssid_len); |
499 | |||
500 | memset(pbssdesc->ssid.ssid, 0, IW_ESSID_MAX_SIZE); | ||
501 | memcpy(pbssdesc->ssid.ssid, ssid->ssid, ssid->ssidlength); | ||
502 | |||
503 | pbssdesc->ssid.ssidlength = ssid->ssidlength; | ||
504 | 492 | ||
505 | /* set the BSS type */ | 493 | /* set the BSS type */ |
506 | adhs->bsstype = cmd_bss_type_ibss; | 494 | adhs->bsstype = cmd_bss_type_ibss; |
507 | pbssdesc->mode = IW_MODE_ADHOC; | 495 | adapter->mode = IW_MODE_ADHOC; |
508 | adhs->beaconperiod = adapter->beaconperiod; | 496 | adhs->beaconperiod = cpu_to_le16(adapter->beaconperiod); |
509 | 497 | ||
510 | /* set Physical param set */ | 498 | /* set Physical param set */ |
511 | #define DS_PARA_IE_ID 3 | 499 | #define DS_PARA_IE_ID 3 |
@@ -514,18 +502,12 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | |||
514 | adhs->phyparamset.dsparamset.elementid = DS_PARA_IE_ID; | 502 | adhs->phyparamset.dsparamset.elementid = DS_PARA_IE_ID; |
515 | adhs->phyparamset.dsparamset.len = DS_PARA_IE_LEN; | 503 | adhs->phyparamset.dsparamset.len = DS_PARA_IE_LEN; |
516 | 504 | ||
517 | WARN_ON(!adapter->adhocchannel); | 505 | WARN_ON(!assoc_req->channel); |
518 | 506 | ||
519 | lbs_pr_debug(1, "ADHOC_S_CMD: Creating ADHOC on channel %d\n", | 507 | lbs_deb_join("ADHOC_S_CMD: Creating ADHOC on channel %d\n", |
520 | adapter->adhocchannel); | 508 | assoc_req->channel); |
521 | 509 | ||
522 | adapter->curbssparams.channel = adapter->adhocchannel; | 510 | adhs->phyparamset.dsparamset.currentchan = assoc_req->channel; |
523 | |||
524 | pbssdesc->channel = adapter->adhocchannel; | ||
525 | adhs->phyparamset.dsparamset.currentchan = adapter->adhocchannel; | ||
526 | |||
527 | memcpy(&pbssdesc->phyparamset, | ||
528 | &adhs->phyparamset, sizeof(union ieeetypes_phyparamset)); | ||
529 | 511 | ||
530 | /* set IBSS param set */ | 512 | /* set IBSS param set */ |
531 | #define IBSS_PARA_IE_ID 6 | 513 | #define IBSS_PARA_IE_ID 6 |
@@ -533,26 +515,21 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | |||
533 | 515 | ||
534 | adhs->ssparamset.ibssparamset.elementid = IBSS_PARA_IE_ID; | 516 | adhs->ssparamset.ibssparamset.elementid = IBSS_PARA_IE_ID; |
535 | adhs->ssparamset.ibssparamset.len = IBSS_PARA_IE_LEN; | 517 | adhs->ssparamset.ibssparamset.len = IBSS_PARA_IE_LEN; |
536 | adhs->ssparamset.ibssparamset.atimwindow = adapter->atimwindow; | 518 | adhs->ssparamset.ibssparamset.atimwindow = cpu_to_le16(adapter->atimwindow); |
537 | memcpy(&pbssdesc->ssparamset, | ||
538 | &adhs->ssparamset, sizeof(union IEEEtypes_ssparamset)); | ||
539 | 519 | ||
540 | /* set capability info */ | 520 | /* set capability info */ |
541 | adhs->cap.ess = 0; | 521 | adhs->cap.ess = 0; |
542 | adhs->cap.ibss = 1; | 522 | adhs->cap.ibss = 1; |
543 | pbssdesc->cap.ibss = 1; | ||
544 | 523 | ||
545 | /* probedelay */ | 524 | /* probedelay */ |
546 | adhs->probedelay = cpu_to_le16(cmd_scan_probe_delay_time); | 525 | adhs->probedelay = cpu_to_le16(cmd_scan_probe_delay_time); |
547 | 526 | ||
548 | /* set up privacy in adapter->scantable[i] */ | 527 | /* set up privacy in adapter->scantable[i] */ |
549 | if (adapter->secinfo.wep_enabled) { | 528 | if (assoc_req->secinfo.wep_enabled) { |
550 | lbs_pr_debug(1, "ADHOC_S_CMD: WEP enabled, setting privacy on\n"); | 529 | lbs_deb_join("ADHOC_S_CMD: WEP enabled, setting privacy on\n"); |
551 | pbssdesc->privacy = wlan802_11privfilter8021xWEP; | ||
552 | adhs->cap.privacy = AD_HOC_CAP_PRIVACY_ON; | 530 | adhs->cap.privacy = AD_HOC_CAP_PRIVACY_ON; |
553 | } else { | 531 | } else { |
554 | lbs_pr_debug(1, "ADHOC_S_CMD: WEP disabled, setting privacy off\n"); | 532 | lbs_deb_join("ADHOC_S_CMD: WEP disabled, setting privacy off\n"); |
555 | pbssdesc->privacy = wlan802_11privfilteracceptall; | ||
556 | } | 533 | } |
557 | 534 | ||
558 | memset(adhs->datarate, 0, sizeof(adhs->datarate)); | 535 | memset(adhs->datarate, 0, sizeof(adhs->datarate)); |
@@ -574,29 +551,24 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | |||
574 | memcpy(&adapter->curbssparams.datarates, | 551 | memcpy(&adapter->curbssparams.datarates, |
575 | &adhs->datarate, adapter->curbssparams.numofrates); | 552 | &adhs->datarate, adapter->curbssparams.numofrates); |
576 | 553 | ||
577 | lbs_pr_debug(1, "ADHOC_S_CMD: rates=%02x %02x %02x %02x \n", | 554 | lbs_deb_join("ADHOC_S_CMD: rates=%02x %02x %02x %02x \n", |
578 | adhs->datarate[0], adhs->datarate[1], | 555 | adhs->datarate[0], adhs->datarate[1], |
579 | adhs->datarate[2], adhs->datarate[3]); | 556 | adhs->datarate[2], adhs->datarate[3]); |
580 | 557 | ||
581 | lbs_pr_debug(1, "ADHOC_S_CMD: AD HOC Start command is ready\n"); | 558 | lbs_deb_join("ADHOC_S_CMD: AD HOC Start command is ready\n"); |
582 | 559 | ||
583 | if (libertas_create_dnld_countryinfo_11d(priv)) { | 560 | if (libertas_create_dnld_countryinfo_11d(priv)) { |
584 | lbs_pr_debug(1, "ADHOC_S_CMD: dnld_countryinfo_11d failed\n"); | 561 | lbs_deb_join("ADHOC_S_CMD: dnld_countryinfo_11d failed\n"); |
585 | ret = -1; | 562 | ret = -1; |
586 | goto done; | 563 | goto done; |
587 | } | 564 | } |
588 | 565 | ||
589 | cmd->size = | 566 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_start) + |
590 | cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_start) | 567 | S_DS_GEN + cmdappendsize); |
591 | + S_DS_GEN + cmdappendsize); | ||
592 | |||
593 | memcpy(&tmpcap, &adhs->cap, sizeof(u16)); | ||
594 | tmpcap = cpu_to_le16(tmpcap); | ||
595 | memcpy(&adhs->cap, &tmpcap, sizeof(u16)); | ||
596 | 568 | ||
597 | ret = 0; | 569 | ret = 0; |
598 | done: | 570 | done: |
599 | LEAVE(); | 571 | lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); |
600 | return ret; | 572 | return ret; |
601 | } | 573 | } |
602 | 574 | ||
@@ -614,7 +586,8 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, | |||
614 | { | 586 | { |
615 | wlan_adapter *adapter = priv->adapter; | 587 | wlan_adapter *adapter = priv->adapter; |
616 | struct cmd_ds_802_11_ad_hoc_join *padhocjoin = &cmd->params.adj; | 588 | struct cmd_ds_802_11_ad_hoc_join *padhocjoin = &cmd->params.adj; |
617 | struct bss_descriptor *pbssdesc = pdata_buf; | 589 | struct assoc_request * assoc_req = pdata_buf; |
590 | struct bss_descriptor *bss = &assoc_req->bss; | ||
618 | int cmdappendsize = 0; | 591 | int cmdappendsize = 0; |
619 | int ret = 0; | 592 | int ret = 0; |
620 | u8 *card_rates; | 593 | u8 *card_rates; |
@@ -622,70 +595,59 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, | |||
622 | u16 tmpcap; | 595 | u16 tmpcap; |
623 | int i; | 596 | int i; |
624 | 597 | ||
625 | ENTER(); | 598 | lbs_deb_enter(LBS_DEB_JOIN); |
626 | |||
627 | adapter->pattemptedbssdesc = pbssdesc; | ||
628 | 599 | ||
629 | cmd->command = cpu_to_le16(cmd_802_11_ad_hoc_join); | 600 | cmd->command = cpu_to_le16(cmd_802_11_ad_hoc_join); |
630 | 601 | ||
631 | padhocjoin->bssdescriptor.bsstype = cmd_bss_type_ibss; | 602 | padhocjoin->bssdescriptor.bsstype = cmd_bss_type_ibss; |
632 | 603 | ||
633 | padhocjoin->bssdescriptor.beaconperiod = pbssdesc->beaconperiod; | 604 | padhocjoin->bssdescriptor.beaconperiod = cpu_to_le16(bss->beaconperiod); |
634 | |||
635 | memcpy(&padhocjoin->bssdescriptor.BSSID, | ||
636 | &pbssdesc->macaddress, ETH_ALEN); | ||
637 | 605 | ||
638 | memcpy(&padhocjoin->bssdescriptor.SSID, | 606 | memcpy(&padhocjoin->bssdescriptor.BSSID, &bss->bssid, ETH_ALEN); |
639 | &pbssdesc->ssid.ssid, pbssdesc->ssid.ssidlength); | 607 | memcpy(&padhocjoin->bssdescriptor.SSID, &bss->ssid, bss->ssid_len); |
640 | 608 | ||
641 | memcpy(&padhocjoin->bssdescriptor.phyparamset, | 609 | memcpy(&padhocjoin->bssdescriptor.phyparamset, |
642 | &pbssdesc->phyparamset, sizeof(union ieeetypes_phyparamset)); | 610 | &bss->phyparamset, sizeof(union ieeetypes_phyparamset)); |
643 | 611 | ||
644 | memcpy(&padhocjoin->bssdescriptor.ssparamset, | 612 | memcpy(&padhocjoin->bssdescriptor.ssparamset, |
645 | &pbssdesc->ssparamset, sizeof(union IEEEtypes_ssparamset)); | 613 | &bss->ssparamset, sizeof(union IEEEtypes_ssparamset)); |
646 | 614 | ||
647 | memcpy(&tmpcap, &pbssdesc->cap, sizeof(struct ieeetypes_capinfo)); | 615 | memcpy(&tmpcap, &bss->cap, sizeof(struct ieeetypes_capinfo)); |
648 | tmpcap &= CAPINFO_MASK; | 616 | tmpcap &= CAPINFO_MASK; |
649 | 617 | ||
650 | lbs_pr_debug(1, "ADHOC_J_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", | 618 | lbs_deb_join("ADHOC_J_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", |
651 | tmpcap, CAPINFO_MASK); | 619 | tmpcap, CAPINFO_MASK); |
652 | memcpy(&padhocjoin->bssdescriptor.cap, &tmpcap, | 620 | memcpy(&padhocjoin->bssdescriptor.cap, &tmpcap, |
653 | sizeof(struct ieeetypes_capinfo)); | 621 | sizeof(struct ieeetypes_capinfo)); |
654 | 622 | ||
655 | /* information on BSSID descriptor passed to FW */ | 623 | /* information on BSSID descriptor passed to FW */ |
656 | lbs_pr_debug(1, | 624 | lbs_deb_join( |
657 | "ADHOC_J_CMD: BSSID = %2x-%2x-%2x-%2x-%2x-%2x, SSID = %s\n", | 625 | "ADHOC_J_CMD: BSSID = " MAC_FMT ", SSID = '%s'\n", |
658 | padhocjoin->bssdescriptor.BSSID[0], | 626 | MAC_ARG(padhocjoin->bssdescriptor.BSSID), |
659 | padhocjoin->bssdescriptor.BSSID[1], | ||
660 | padhocjoin->bssdescriptor.BSSID[2], | ||
661 | padhocjoin->bssdescriptor.BSSID[3], | ||
662 | padhocjoin->bssdescriptor.BSSID[4], | ||
663 | padhocjoin->bssdescriptor.BSSID[5], | ||
664 | padhocjoin->bssdescriptor.SSID); | 627 | padhocjoin->bssdescriptor.SSID); |
665 | 628 | ||
666 | /* failtimeout */ | 629 | /* failtimeout */ |
667 | padhocjoin->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT); | 630 | padhocjoin->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT); |
668 | 631 | ||
669 | /* probedelay */ | 632 | /* probedelay */ |
670 | padhocjoin->probedelay = | 633 | padhocjoin->probedelay = cpu_to_le16(cmd_scan_probe_delay_time); |
671 | cpu_to_le16(cmd_scan_probe_delay_time); | ||
672 | 634 | ||
673 | /* Copy Data rates from the rates recorded in scan response */ | 635 | /* Copy Data rates from the rates recorded in scan response */ |
674 | memset(padhocjoin->bssdescriptor.datarates, 0, | 636 | memset(padhocjoin->bssdescriptor.datarates, 0, |
675 | sizeof(padhocjoin->bssdescriptor.datarates)); | 637 | sizeof(padhocjoin->bssdescriptor.datarates)); |
676 | memcpy(padhocjoin->bssdescriptor.datarates, pbssdesc->datarates, | 638 | memcpy(padhocjoin->bssdescriptor.datarates, bss->datarates, |
677 | min(sizeof(padhocjoin->bssdescriptor.datarates), | 639 | min(sizeof(padhocjoin->bssdescriptor.datarates), |
678 | sizeof(pbssdesc->datarates))); | 640 | sizeof(bss->datarates))); |
679 | 641 | ||
680 | card_rates = libertas_supported_rates; | 642 | card_rates = libertas_supported_rates; |
681 | card_rates_size = sizeof(libertas_supported_rates); | 643 | card_rates_size = sizeof(libertas_supported_rates); |
682 | 644 | ||
683 | adapter->curbssparams.channel = pbssdesc->channel; | 645 | adapter->curbssparams.channel = bss->channel; |
684 | 646 | ||
685 | if (get_common_rates(adapter, padhocjoin->bssdescriptor.datarates, | 647 | if (get_common_rates(adapter, padhocjoin->bssdescriptor.datarates, |
686 | sizeof(padhocjoin->bssdescriptor.datarates), | 648 | sizeof(padhocjoin->bssdescriptor.datarates), |
687 | card_rates, card_rates_size)) { | 649 | card_rates, card_rates_size)) { |
688 | lbs_pr_debug(1, "ADHOC_J_CMD: get_common_rates returns error.\n"); | 650 | lbs_deb_join("ADHOC_J_CMD: get_common_rates returns error.\n"); |
689 | ret = -1; | 651 | ret = -1; |
690 | goto done; | 652 | goto done; |
691 | } | 653 | } |
@@ -704,17 +666,17 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, | |||
704 | adapter->curbssparams.numofrates); | 666 | adapter->curbssparams.numofrates); |
705 | 667 | ||
706 | padhocjoin->bssdescriptor.ssparamset.ibssparamset.atimwindow = | 668 | padhocjoin->bssdescriptor.ssparamset.ibssparamset.atimwindow = |
707 | cpu_to_le16(pbssdesc->atimwindow); | 669 | cpu_to_le16(bss->atimwindow); |
708 | 670 | ||
709 | if (adapter->secinfo.wep_enabled) { | 671 | if (assoc_req->secinfo.wep_enabled) { |
710 | padhocjoin->bssdescriptor.cap.privacy = AD_HOC_CAP_PRIVACY_ON; | 672 | padhocjoin->bssdescriptor.cap.privacy = AD_HOC_CAP_PRIVACY_ON; |
711 | } | 673 | } |
712 | 674 | ||
713 | if (adapter->psmode == wlan802_11powermodemax_psp) { | 675 | if (adapter->psmode == wlan802_11powermodemax_psp) { |
714 | /* wake up first */ | 676 | /* wake up first */ |
715 | enum WLAN_802_11_POWER_MODE Localpsmode; | 677 | __le32 Localpsmode; |
716 | 678 | ||
717 | Localpsmode = wlan802_11powermodecam; | 679 | Localpsmode = cpu_to_le32(wlan802_11powermodecam); |
718 | ret = libertas_prepare_and_send_command(priv, | 680 | ret = libertas_prepare_and_send_command(priv, |
719 | cmd_802_11_ps_mode, | 681 | cmd_802_11_ps_mode, |
720 | cmd_act_set, | 682 | cmd_act_set, |
@@ -726,24 +688,16 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, | |||
726 | } | 688 | } |
727 | } | 689 | } |
728 | 690 | ||
729 | if (libertas_parse_dnld_countryinfo_11d(priv)) { | 691 | if (libertas_parse_dnld_countryinfo_11d(priv, bss)) { |
730 | ret = -1; | 692 | ret = -1; |
731 | goto done; | 693 | goto done; |
732 | } | 694 | } |
733 | 695 | ||
734 | cmd->size = | 696 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_join) + |
735 | cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_join) | 697 | S_DS_GEN + cmdappendsize); |
736 | + S_DS_GEN + cmdappendsize); | ||
737 | |||
738 | memcpy(&tmpcap, &padhocjoin->bssdescriptor.cap, | ||
739 | sizeof(struct ieeetypes_capinfo)); | ||
740 | tmpcap = cpu_to_le16(tmpcap); | ||
741 | |||
742 | memcpy(&padhocjoin->bssdescriptor.cap, | ||
743 | &tmpcap, sizeof(struct ieeetypes_capinfo)); | ||
744 | 698 | ||
745 | done: | 699 | done: |
746 | LEAVE(); | 700 | lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); |
747 | return ret; | 701 | return ret; |
748 | } | 702 | } |
749 | 703 | ||
@@ -754,19 +708,24 @@ int libertas_ret_80211_associate(wlan_private * priv, | |||
754 | int ret = 0; | 708 | int ret = 0; |
755 | union iwreq_data wrqu; | 709 | union iwreq_data wrqu; |
756 | struct ieeetypes_assocrsp *passocrsp; | 710 | struct ieeetypes_assocrsp *passocrsp; |
757 | struct bss_descriptor *pbssdesc; | 711 | struct bss_descriptor * bss; |
758 | 712 | ||
759 | ENTER(); | 713 | lbs_deb_enter(LBS_DEB_JOIN); |
760 | 714 | ||
761 | passocrsp = (struct ieeetypes_assocrsp *) & resp->params; | 715 | if (!adapter->in_progress_assoc_req) { |
716 | lbs_deb_join("ASSOC_RESP: no in-progress association request\n"); | ||
717 | ret = -1; | ||
718 | goto done; | ||
719 | } | ||
720 | bss = &adapter->in_progress_assoc_req->bss; | ||
762 | 721 | ||
763 | if (passocrsp->statuscode) { | 722 | passocrsp = (struct ieeetypes_assocrsp *) & resp->params; |
764 | 723 | ||
724 | if (le16_to_cpu(passocrsp->statuscode)) { | ||
765 | libertas_mac_event_disconnected(priv); | 725 | libertas_mac_event_disconnected(priv); |
766 | 726 | ||
767 | lbs_pr_debug(1, | 727 | lbs_deb_join("ASSOC_RESP: Association failed, status code = %d\n", |
768 | "ASSOC_RESP: Association failed, status code = %d\n", | 728 | le16_to_cpu(passocrsp->statuscode)); |
769 | passocrsp->statuscode); | ||
770 | 729 | ||
771 | ret = -1; | 730 | ret = -1; |
772 | goto done; | 731 | goto done; |
@@ -778,24 +737,15 @@ int libertas_ret_80211_associate(wlan_private * priv, | |||
778 | /* Send a Media Connected event, according to the Spec */ | 737 | /* Send a Media Connected event, according to the Spec */ |
779 | adapter->connect_status = libertas_connected; | 738 | adapter->connect_status = libertas_connected; |
780 | 739 | ||
781 | /* Set the attempted BSSID Index to current */ | 740 | lbs_deb_join("ASSOC_RESP: assocated to '%s'\n", |
782 | pbssdesc = adapter->pattemptedbssdesc; | 741 | escape_essid(bss->ssid, bss->ssid_len)); |
783 | |||
784 | lbs_pr_debug(1, "ASSOC_RESP: %s\n", pbssdesc->ssid.ssid); | ||
785 | 742 | ||
786 | /* Set the new SSID to current SSID */ | 743 | /* Update current SSID and BSSID */ |
787 | memcpy(&adapter->curbssparams.ssid, | 744 | memcpy(&adapter->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE); |
788 | &pbssdesc->ssid, sizeof(struct WLAN_802_11_SSID)); | 745 | adapter->curbssparams.ssid_len = bss->ssid_len; |
789 | 746 | memcpy(adapter->curbssparams.bssid, bss->bssid, ETH_ALEN); | |
790 | /* Set the new BSSID (AP's MAC address) to current BSSID */ | ||
791 | memcpy(adapter->curbssparams.bssid, | ||
792 | pbssdesc->macaddress, ETH_ALEN); | ||
793 | |||
794 | /* Make a copy of current BSSID descriptor */ | ||
795 | memcpy(&adapter->curbssparams.bssdescriptor, | ||
796 | pbssdesc, sizeof(struct bss_descriptor)); | ||
797 | 747 | ||
798 | lbs_pr_debug(1, "ASSOC_RESP: currentpacketfilter is %x\n", | 748 | lbs_deb_join("ASSOC_RESP: currentpacketfilter is %x\n", |
799 | adapter->currentpacketfilter); | 749 | adapter->currentpacketfilter); |
800 | 750 | ||
801 | adapter->SNR[TYPE_RXPD][TYPE_AVG] = 0; | 751 | adapter->SNR[TYPE_RXPD][TYPE_AVG] = 0; |
@@ -806,28 +756,31 @@ int libertas_ret_80211_associate(wlan_private * priv, | |||
806 | adapter->nextSNRNF = 0; | 756 | adapter->nextSNRNF = 0; |
807 | adapter->numSNRNF = 0; | 757 | adapter->numSNRNF = 0; |
808 | 758 | ||
809 | netif_carrier_on(priv->wlan_dev.netdev); | 759 | netif_carrier_on(priv->dev); |
810 | netif_wake_queue(priv->wlan_dev.netdev); | 760 | netif_wake_queue(priv->dev); |
811 | 761 | ||
812 | lbs_pr_debug(1, "ASSOC_RESP: Associated \n"); | 762 | netif_carrier_on(priv->mesh_dev); |
763 | netif_wake_queue(priv->mesh_dev); | ||
764 | |||
765 | lbs_deb_join("ASSOC_RESP: Associated \n"); | ||
813 | 766 | ||
814 | memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN); | 767 | memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN); |
815 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; | 768 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
816 | wireless_send_event(priv->wlan_dev.netdev, SIOCGIWAP, &wrqu, NULL); | 769 | wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); |
817 | 770 | ||
818 | done: | 771 | done: |
819 | LEAVE(); | 772 | lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); |
820 | return ret; | 773 | return ret; |
821 | } | 774 | } |
822 | 775 | ||
823 | int libertas_ret_80211_disassociate(wlan_private * priv, | 776 | int libertas_ret_80211_disassociate(wlan_private * priv, |
824 | struct cmd_ds_command *resp) | 777 | struct cmd_ds_command *resp) |
825 | { | 778 | { |
826 | ENTER(); | 779 | lbs_deb_enter(LBS_DEB_JOIN); |
827 | 780 | ||
828 | libertas_mac_event_disconnected(priv); | 781 | libertas_mac_event_disconnected(priv); |
829 | 782 | ||
830 | LEAVE(); | 783 | lbs_deb_leave(LBS_DEB_JOIN); |
831 | return 0; | 784 | return 0; |
832 | } | 785 | } |
833 | 786 | ||
@@ -840,90 +793,85 @@ int libertas_ret_80211_ad_hoc_start(wlan_private * priv, | |||
840 | u16 result = le16_to_cpu(resp->result); | 793 | u16 result = le16_to_cpu(resp->result); |
841 | struct cmd_ds_802_11_ad_hoc_result *padhocresult; | 794 | struct cmd_ds_802_11_ad_hoc_result *padhocresult; |
842 | union iwreq_data wrqu; | 795 | union iwreq_data wrqu; |
843 | struct bss_descriptor *pbssdesc; | 796 | struct bss_descriptor *bss; |
844 | 797 | ||
845 | ENTER(); | 798 | lbs_deb_enter(LBS_DEB_JOIN); |
846 | 799 | ||
847 | padhocresult = &resp->params.result; | 800 | padhocresult = &resp->params.result; |
848 | 801 | ||
849 | lbs_pr_debug(1, "ADHOC_S_RESP: size = %d\n", le16_to_cpu(resp->size)); | 802 | lbs_deb_join("ADHOC_RESP: size = %d\n", le16_to_cpu(resp->size)); |
850 | lbs_pr_debug(1, "ADHOC_S_RESP: command = %x\n", command); | 803 | lbs_deb_join("ADHOC_RESP: command = %x\n", command); |
851 | lbs_pr_debug(1, "ADHOC_S_RESP: result = %x\n", result); | 804 | lbs_deb_join("ADHOC_RESP: result = %x\n", result); |
852 | 805 | ||
853 | pbssdesc = adapter->pattemptedbssdesc; | 806 | if (!adapter->in_progress_assoc_req) { |
807 | lbs_deb_join("ADHOC_RESP: no in-progress association request\n"); | ||
808 | ret = -1; | ||
809 | goto done; | ||
810 | } | ||
811 | bss = &adapter->in_progress_assoc_req->bss; | ||
854 | 812 | ||
855 | /* | 813 | /* |
856 | * Join result code 0 --> SUCCESS | 814 | * Join result code 0 --> SUCCESS |
857 | */ | 815 | */ |
858 | if (result) { | 816 | if (result) { |
859 | lbs_pr_debug(1, "ADHOC_RESP failed\n"); | 817 | lbs_deb_join("ADHOC_RESP: failed\n"); |
860 | if (adapter->connect_status == libertas_connected) { | 818 | if (adapter->connect_status == libertas_connected) { |
861 | libertas_mac_event_disconnected(priv); | 819 | libertas_mac_event_disconnected(priv); |
862 | } | 820 | } |
863 | 821 | ret = -1; | |
864 | memset(&adapter->curbssparams.bssdescriptor, | 822 | goto done; |
865 | 0x00, sizeof(adapter->curbssparams.bssdescriptor)); | ||
866 | |||
867 | LEAVE(); | ||
868 | return -1; | ||
869 | } | 823 | } |
870 | 824 | ||
871 | /* | 825 | /* |
872 | * Now the join cmd should be successful | 826 | * Now the join cmd should be successful |
873 | * If BSSID has changed use SSID to compare instead of BSSID | 827 | * If BSSID has changed use SSID to compare instead of BSSID |
874 | */ | 828 | */ |
875 | lbs_pr_debug(1, "ADHOC_J_RESP %s\n", pbssdesc->ssid.ssid); | 829 | lbs_deb_join("ADHOC_RESP: associated to '%s'\n", |
830 | escape_essid(bss->ssid, bss->ssid_len)); | ||
876 | 831 | ||
877 | /* Send a Media Connected event, according to the Spec */ | 832 | /* Send a Media Connected event, according to the Spec */ |
878 | adapter->connect_status = libertas_connected; | 833 | adapter->connect_status = libertas_connected; |
879 | 834 | ||
880 | if (command == cmd_ret_802_11_ad_hoc_start) { | 835 | if (command == cmd_ret_802_11_ad_hoc_start) { |
881 | /* Update the created network descriptor with the new BSSID */ | 836 | /* Update the created network descriptor with the new BSSID */ |
882 | memcpy(pbssdesc->macaddress, | 837 | memcpy(bss->bssid, padhocresult->BSSID, ETH_ALEN); |
883 | padhocresult->BSSID, ETH_ALEN); | ||
884 | } else { | ||
885 | |||
886 | /* Make a copy of current BSSID descriptor, only needed for join since | ||
887 | * the current descriptor is already being used for adhoc start | ||
888 | */ | ||
889 | memmove(&adapter->curbssparams.bssdescriptor, | ||
890 | pbssdesc, sizeof(struct bss_descriptor)); | ||
891 | } | 838 | } |
892 | 839 | ||
893 | /* Set the BSSID from the joined/started descriptor */ | 840 | /* Set the BSSID from the joined/started descriptor */ |
894 | memcpy(&adapter->curbssparams.bssid, | 841 | memcpy(&adapter->curbssparams.bssid, bss->bssid, ETH_ALEN); |
895 | pbssdesc->macaddress, ETH_ALEN); | ||
896 | 842 | ||
897 | /* Set the new SSID to current SSID */ | 843 | /* Set the new SSID to current SSID */ |
898 | memcpy(&adapter->curbssparams.ssid, | 844 | memcpy(&adapter->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE); |
899 | &pbssdesc->ssid, sizeof(struct WLAN_802_11_SSID)); | 845 | adapter->curbssparams.ssid_len = bss->ssid_len; |
900 | 846 | ||
901 | netif_carrier_on(priv->wlan_dev.netdev); | 847 | netif_carrier_on(priv->dev); |
902 | netif_wake_queue(priv->wlan_dev.netdev); | 848 | netif_wake_queue(priv->dev); |
849 | |||
850 | netif_carrier_on(priv->mesh_dev); | ||
851 | netif_wake_queue(priv->mesh_dev); | ||
903 | 852 | ||
904 | memset(&wrqu, 0, sizeof(wrqu)); | 853 | memset(&wrqu, 0, sizeof(wrqu)); |
905 | memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN); | 854 | memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN); |
906 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; | 855 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
907 | wireless_send_event(priv->wlan_dev.netdev, SIOCGIWAP, &wrqu, NULL); | 856 | wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); |
908 | 857 | ||
909 | lbs_pr_debug(1, "ADHOC_RESP: - Joined/Started Ad Hoc\n"); | 858 | lbs_deb_join("ADHOC_RESP: - Joined/Started Ad Hoc\n"); |
910 | lbs_pr_debug(1, "ADHOC_RESP: channel = %d\n", adapter->adhocchannel); | 859 | lbs_deb_join("ADHOC_RESP: channel = %d\n", adapter->curbssparams.channel); |
911 | lbs_pr_debug(1, "ADHOC_RESP: BSSID = %02x:%02x:%02x:%02x:%02x:%02x\n", | 860 | lbs_deb_join("ADHOC_RESP: BSSID = " MAC_FMT "\n", |
912 | padhocresult->BSSID[0], padhocresult->BSSID[1], | 861 | MAC_ARG(padhocresult->BSSID)); |
913 | padhocresult->BSSID[2], padhocresult->BSSID[3], | ||
914 | padhocresult->BSSID[4], padhocresult->BSSID[5]); | ||
915 | 862 | ||
916 | LEAVE(); | 863 | done: |
864 | lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); | ||
917 | return ret; | 865 | return ret; |
918 | } | 866 | } |
919 | 867 | ||
920 | int libertas_ret_80211_ad_hoc_stop(wlan_private * priv, | 868 | int libertas_ret_80211_ad_hoc_stop(wlan_private * priv, |
921 | struct cmd_ds_command *resp) | 869 | struct cmd_ds_command *resp) |
922 | { | 870 | { |
923 | ENTER(); | 871 | lbs_deb_enter(LBS_DEB_JOIN); |
924 | 872 | ||
925 | libertas_mac_event_disconnected(priv); | 873 | libertas_mac_event_disconnected(priv); |
926 | 874 | ||
927 | LEAVE(); | 875 | lbs_deb_leave(LBS_DEB_JOIN); |
928 | return 0; | 876 | return 0; |
929 | } | 877 | } |
diff --git a/drivers/net/wireless/libertas/join.h b/drivers/net/wireless/libertas/join.h index 115f5a8ba346..d522630ff8cf 100644 --- a/drivers/net/wireless/libertas/join.h +++ b/drivers/net/wireless/libertas/join.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #define _WLAN_JOIN_H | 9 | #define _WLAN_JOIN_H |
10 | 10 | ||
11 | #include "defs.h" | 11 | #include "defs.h" |
12 | #include "dev.h" | ||
12 | 13 | ||
13 | struct cmd_ds_command; | 14 | struct cmd_ds_command; |
14 | extern int libertas_cmd_80211_authenticate(wlan_private * priv, | 15 | extern int libertas_cmd_80211_authenticate(wlan_private * priv, |
@@ -21,7 +22,7 @@ extern int libertas_cmd_80211_ad_hoc_stop(wlan_private * priv, | |||
21 | struct cmd_ds_command *cmd); | 22 | struct cmd_ds_command *cmd); |
22 | extern int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | 23 | extern int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, |
23 | struct cmd_ds_command *cmd, | 24 | struct cmd_ds_command *cmd, |
24 | void *pssid); | 25 | void *pdata_buf); |
25 | extern int libertas_cmd_80211_deauthenticate(wlan_private * priv, | 26 | extern int libertas_cmd_80211_deauthenticate(wlan_private * priv, |
26 | struct cmd_ds_command *cmd); | 27 | struct cmd_ds_command *cmd); |
27 | extern int libertas_cmd_80211_associate(wlan_private * priv, | 28 | extern int libertas_cmd_80211_associate(wlan_private * priv, |
@@ -39,12 +40,10 @@ extern int libertas_ret_80211_associate(wlan_private * priv, | |||
39 | 40 | ||
40 | extern int libertas_reassociation_thread(void *data); | 41 | extern int libertas_reassociation_thread(void *data); |
41 | 42 | ||
42 | struct WLAN_802_11_SSID; | ||
43 | struct bss_descriptor; | ||
44 | |||
45 | extern int libertas_start_adhoc_network(wlan_private * priv, | 43 | extern int libertas_start_adhoc_network(wlan_private * priv, |
46 | struct WLAN_802_11_SSID *adhocssid); | 44 | struct assoc_request * assoc_req); |
47 | extern int libertas_join_adhoc_network(wlan_private * priv, struct bss_descriptor *pbssdesc); | 45 | extern int libertas_join_adhoc_network(wlan_private * priv, |
46 | struct assoc_request * assoc_req); | ||
48 | extern int libertas_stop_adhoc_network(wlan_private * priv); | 47 | extern int libertas_stop_adhoc_network(wlan_private * priv); |
49 | 48 | ||
50 | extern int libertas_send_deauthentication(wlan_private * priv); | 49 | extern int libertas_send_deauthentication(wlan_private * priv); |
@@ -52,6 +51,6 @@ extern int libertas_send_deauth(wlan_private * priv); | |||
52 | 51 | ||
53 | extern int libertas_do_adhocstop_ioctl(wlan_private * priv); | 52 | extern int libertas_do_adhocstop_ioctl(wlan_private * priv); |
54 | 53 | ||
55 | int wlan_associate(wlan_private * priv, struct bss_descriptor * pbssdesc); | 54 | int wlan_associate(wlan_private * priv, struct assoc_request * assoc_req); |
56 | 55 | ||
57 | #endif | 56 | #endif |
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index b9b25ce65919..623ab4b16973 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * thread etc.. | 4 | * thread etc.. |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/moduleparam.h> | ||
7 | #include <linux/delay.h> | 8 | #include <linux/delay.h> |
8 | #include <linux/freezer.h> | 9 | #include <linux/freezer.h> |
9 | #include <linux/etherdevice.h> | 10 | #include <linux/etherdevice.h> |
@@ -11,26 +12,28 @@ | |||
11 | #include <linux/if_arp.h> | 12 | #include <linux/if_arp.h> |
12 | 13 | ||
13 | #include <net/iw_handler.h> | 14 | #include <net/iw_handler.h> |
15 | #include <net/ieee80211.h> | ||
14 | 16 | ||
15 | #include "host.h" | 17 | #include "host.h" |
16 | #include "sbi.h" | ||
17 | #include "decl.h" | 18 | #include "decl.h" |
18 | #include "dev.h" | 19 | #include "dev.h" |
19 | #include "fw.h" | ||
20 | #include "wext.h" | 20 | #include "wext.h" |
21 | #include "debugfs.h" | 21 | #include "debugfs.h" |
22 | #include "assoc.h" | 22 | #include "assoc.h" |
23 | 23 | ||
24 | #define DRIVER_RELEASE_VERSION "320.p0" | 24 | #define DRIVER_RELEASE_VERSION "322.p0" |
25 | const char libertas_driver_version[] = "COMM-USB8388-" DRIVER_RELEASE_VERSION | 25 | const char libertas_driver_version[] = "COMM-USB8388-" DRIVER_RELEASE_VERSION |
26 | #ifdef DEBUG | 26 | #ifdef DEBUG |
27 | "-dbg" | 27 | "-dbg" |
28 | #endif | 28 | #endif |
29 | ""; | 29 | ""; |
30 | 30 | ||
31 | #ifdef ENABLE_PM | 31 | |
32 | static struct pm_dev *wlan_pm_dev = NULL; | 32 | /* Module parameters */ |
33 | #endif | 33 | unsigned int libertas_debug = 0; |
34 | module_param(libertas_debug, int, 0644); | ||
35 | EXPORT_SYMBOL_GPL(libertas_debug); | ||
36 | |||
34 | 37 | ||
35 | #define WLAN_TX_PWR_DEFAULT 20 /*100mW */ | 38 | #define WLAN_TX_PWR_DEFAULT 20 /*100mW */ |
36 | #define WLAN_TX_PWR_US_DEFAULT 20 /*100mW */ | 39 | #define WLAN_TX_PWR_US_DEFAULT 20 /*100mW */ |
@@ -146,14 +149,6 @@ static struct region_cfp_table region_cfp_table[] = { | |||
146 | }; | 149 | }; |
147 | 150 | ||
148 | /** | 151 | /** |
149 | * the rates supported by the card | ||
150 | */ | ||
151 | u8 libertas_wlan_data_rates[WLAN_SUPPORTED_RATES] = | ||
152 | { 0x02, 0x04, 0x0B, 0x16, 0x00, 0x0C, 0x12, | ||
153 | 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x00 | ||
154 | }; | ||
155 | |||
156 | /** | ||
157 | * the rates supported | 152 | * the rates supported |
158 | */ | 153 | */ |
159 | u8 libertas_supported_rates[G_SUPPORTED_RATES] = | 154 | u8 libertas_supported_rates[G_SUPPORTED_RATES] = |
@@ -173,66 +168,55 @@ u8 libertas_adhoc_rates_g[G_SUPPORTED_RATES] = | |||
173 | u8 libertas_adhoc_rates_b[4] = { 0x82, 0x84, 0x8b, 0x96 }; | 168 | u8 libertas_adhoc_rates_b[4] = { 0x82, 0x84, 0x8b, 0x96 }; |
174 | 169 | ||
175 | /** | 170 | /** |
176 | * the global variable of a pointer to wlan_private | ||
177 | * structure variable | ||
178 | */ | ||
179 | static wlan_private *wlanpriv = NULL; | ||
180 | |||
181 | #define MAX_DEVS 5 | ||
182 | static struct net_device *libertas_devs[MAX_DEVS]; | ||
183 | static int libertas_found = 0; | ||
184 | |||
185 | /** | ||
186 | * the table to keep region code | 171 | * the table to keep region code |
187 | */ | 172 | */ |
188 | u16 libertas_region_code_to_index[MRVDRV_MAX_REGION_CODE] = | 173 | u16 libertas_region_code_to_index[MRVDRV_MAX_REGION_CODE] = |
189 | { 0x10, 0x20, 0x30, 0x31, 0x32, 0x40 }; | 174 | { 0x10, 0x20, 0x30, 0x31, 0x32, 0x40 }; |
190 | 175 | ||
191 | static u8 *default_fw_name = "usb8388.bin"; | ||
192 | |||
193 | /** | 176 | /** |
194 | * Attributes exported through sysfs | 177 | * Attributes exported through sysfs |
195 | */ | 178 | */ |
196 | 179 | ||
197 | /** | 180 | /** |
198 | * @brief Get function for sysfs attribute libertas_mpp | 181 | * @brief Get function for sysfs attribute anycast_mask |
199 | */ | 182 | */ |
200 | static ssize_t libertas_mpp_get(struct device * dev, | 183 | static ssize_t libertas_anycast_get(struct device * dev, |
201 | struct device_attribute *attr, char * buf) { | 184 | struct device_attribute *attr, char * buf) { |
202 | struct cmd_ds_mesh_access mesh_access; | 185 | struct cmd_ds_mesh_access mesh_access; |
203 | 186 | ||
204 | memset(&mesh_access, 0, sizeof(mesh_access)); | 187 | memset(&mesh_access, 0, sizeof(mesh_access)); |
205 | libertas_prepare_and_send_command(to_net_dev(dev)->priv, | 188 | libertas_prepare_and_send_command(to_net_dev(dev)->priv, |
206 | cmd_mesh_access, | 189 | cmd_mesh_access, |
207 | cmd_act_mesh_get_mpp, | 190 | cmd_act_mesh_get_anycast, |
208 | cmd_option_waitforrsp, 0, (void *)&mesh_access); | 191 | cmd_option_waitforrsp, 0, (void *)&mesh_access); |
209 | 192 | ||
210 | return snprintf(buf, 3, "%d\n", mesh_access.data[0]); | 193 | return snprintf(buf, 12, "0x%X\n", le32_to_cpu(mesh_access.data[0])); |
211 | } | 194 | } |
212 | 195 | ||
213 | /** | 196 | /** |
214 | * @brief Set function for sysfs attribute libertas_mpp | 197 | * @brief Set function for sysfs attribute anycast_mask |
215 | */ | 198 | */ |
216 | static ssize_t libertas_mpp_set(struct device * dev, | 199 | static ssize_t libertas_anycast_set(struct device * dev, |
217 | struct device_attribute *attr, const char * buf, size_t count) { | 200 | struct device_attribute *attr, const char * buf, size_t count) { |
218 | struct cmd_ds_mesh_access mesh_access; | 201 | struct cmd_ds_mesh_access mesh_access; |
219 | 202 | uint32_t datum; | |
220 | 203 | ||
221 | memset(&mesh_access, 0, sizeof(mesh_access)); | 204 | memset(&mesh_access, 0, sizeof(mesh_access)); |
222 | sscanf(buf, "%d", &(mesh_access.data[0])); | 205 | sscanf(buf, "%x", &datum); |
206 | mesh_access.data[0] = cpu_to_le32(datum); | ||
207 | |||
223 | libertas_prepare_and_send_command((to_net_dev(dev))->priv, | 208 | libertas_prepare_and_send_command((to_net_dev(dev))->priv, |
224 | cmd_mesh_access, | 209 | cmd_mesh_access, |
225 | cmd_act_mesh_set_mpp, | 210 | cmd_act_mesh_set_anycast, |
226 | cmd_option_waitforrsp, 0, (void *)&mesh_access); | 211 | cmd_option_waitforrsp, 0, (void *)&mesh_access); |
227 | return strlen(buf); | 212 | return strlen(buf); |
228 | } | 213 | } |
229 | 214 | ||
230 | /** | 215 | /** |
231 | * libertas_mpp attribute to be exported per mshX interface | 216 | * anycast_mask attribute to be exported per mshX interface |
232 | * through sysfs (/sys/class/net/mshX/libertas-mpp) | 217 | * through sysfs (/sys/class/net/mshX/anycast_mask) |
233 | */ | 218 | */ |
234 | static DEVICE_ATTR(libertas_mpp, 0644, libertas_mpp_get, | 219 | static DEVICE_ATTR(anycast_mask, 0644, libertas_anycast_get, libertas_anycast_set); |
235 | libertas_mpp_set ); | ||
236 | 220 | ||
237 | /** | 221 | /** |
238 | * @brief Check if the device can be open and wait if necessary. | 222 | * @brief Check if the device can be open and wait if necessary. |
@@ -245,7 +229,8 @@ static DEVICE_ATTR(libertas_mpp, 0644, libertas_mpp_get, | |||
245 | * function to work around the issue. | 229 | * function to work around the issue. |
246 | * | 230 | * |
247 | */ | 231 | */ |
248 | static int pre_open_check(struct net_device *dev) { | 232 | static int pre_open_check(struct net_device *dev) |
233 | { | ||
249 | wlan_private *priv = (wlan_private *) dev->priv; | 234 | wlan_private *priv = (wlan_private *) dev->priv; |
250 | wlan_adapter *adapter = priv->adapter; | 235 | wlan_adapter *adapter = priv->adapter; |
251 | int i = 0; | 236 | int i = 0; |
@@ -255,8 +240,7 @@ static int pre_open_check(struct net_device *dev) { | |||
255 | msleep_interruptible(100); | 240 | msleep_interruptible(100); |
256 | } | 241 | } |
257 | if (!adapter->fw_ready) { | 242 | if (!adapter->fw_ready) { |
258 | lbs_pr_info("FW not ready, pre_open_check() return failure\n"); | 243 | lbs_pr_err("firmware not ready\n"); |
259 | LEAVE(); | ||
260 | return -1; | 244 | return -1; |
261 | } | 245 | } |
262 | 246 | ||
@@ -274,17 +258,19 @@ static int wlan_dev_open(struct net_device *dev) | |||
274 | wlan_private *priv = (wlan_private *) dev->priv; | 258 | wlan_private *priv = (wlan_private *) dev->priv; |
275 | wlan_adapter *adapter = priv->adapter; | 259 | wlan_adapter *adapter = priv->adapter; |
276 | 260 | ||
277 | ENTER(); | 261 | lbs_deb_enter(LBS_DEB_NET); |
278 | |||
279 | 262 | ||
280 | priv->open = 1; | 263 | priv->open = 1; |
281 | 264 | ||
282 | if (adapter->connect_status == libertas_connected) { | 265 | if (adapter->connect_status == libertas_connected) { |
283 | netif_carrier_on(priv->wlan_dev.netdev); | 266 | netif_carrier_on(priv->dev); |
284 | } else | 267 | netif_carrier_on(priv->mesh_dev); |
285 | netif_carrier_off(priv->wlan_dev.netdev); | 268 | } else { |
269 | netif_carrier_off(priv->dev); | ||
270 | netif_carrier_off(priv->mesh_dev); | ||
271 | } | ||
286 | 272 | ||
287 | LEAVE(); | 273 | lbs_deb_leave(LBS_DEB_NET); |
288 | return 0; | 274 | return 0; |
289 | } | 275 | } |
290 | /** | 276 | /** |
@@ -297,12 +283,12 @@ static int mesh_open(struct net_device *dev) | |||
297 | { | 283 | { |
298 | wlan_private *priv = (wlan_private *) dev->priv ; | 284 | wlan_private *priv = (wlan_private *) dev->priv ; |
299 | 285 | ||
300 | if(pre_open_check(dev) == -1) | 286 | if (pre_open_check(dev) == -1) |
301 | return -1; | 287 | return -1; |
302 | priv->mesh_open = 1 ; | 288 | priv->mesh_open = 1 ; |
303 | netif_start_queue(priv->mesh_dev); | 289 | netif_wake_queue(priv->mesh_dev); |
304 | if (priv->infra_open == 0) | 290 | if (priv->infra_open == 0) |
305 | return wlan_dev_open(priv->wlan_dev.netdev) ; | 291 | return wlan_dev_open(priv->dev) ; |
306 | return 0; | 292 | return 0; |
307 | } | 293 | } |
308 | 294 | ||
@@ -319,9 +305,9 @@ static int wlan_open(struct net_device *dev) | |||
319 | if(pre_open_check(dev) == -1) | 305 | if(pre_open_check(dev) == -1) |
320 | return -1; | 306 | return -1; |
321 | priv->infra_open = 1 ; | 307 | priv->infra_open = 1 ; |
322 | netif_wake_queue(priv->wlan_dev.netdev); | 308 | netif_wake_queue(priv->dev); |
323 | if (priv->open == 0) | 309 | if (priv->open == 0) |
324 | return wlan_dev_open(priv->wlan_dev.netdev) ; | 310 | return wlan_dev_open(priv->dev) ; |
325 | return 0; | 311 | return 0; |
326 | } | 312 | } |
327 | 313 | ||
@@ -329,12 +315,12 @@ static int wlan_dev_close(struct net_device *dev) | |||
329 | { | 315 | { |
330 | wlan_private *priv = dev->priv; | 316 | wlan_private *priv = dev->priv; |
331 | 317 | ||
332 | ENTER(); | 318 | lbs_deb_enter(LBS_DEB_NET); |
333 | 319 | ||
334 | netif_carrier_off(priv->wlan_dev.netdev); | 320 | netif_carrier_off(priv->dev); |
335 | priv->open = 0; | 321 | priv->open = 0; |
336 | 322 | ||
337 | LEAVE(); | 323 | lbs_deb_leave(LBS_DEB_NET); |
338 | return 0; | 324 | return 0; |
339 | } | 325 | } |
340 | 326 | ||
@@ -351,7 +337,7 @@ static int mesh_close(struct net_device *dev) | |||
351 | priv->mesh_open = 0; | 337 | priv->mesh_open = 0; |
352 | netif_stop_queue(priv->mesh_dev); | 338 | netif_stop_queue(priv->mesh_dev); |
353 | if (priv->infra_open == 0) | 339 | if (priv->infra_open == 0) |
354 | return wlan_dev_close( ((wlan_private *) dev->priv)->wlan_dev.netdev) ; | 340 | return wlan_dev_close(dev); |
355 | else | 341 | else |
356 | return 0; | 342 | return 0; |
357 | } | 343 | } |
@@ -362,147 +348,38 @@ static int mesh_close(struct net_device *dev) | |||
362 | * @param dev A pointer to net_device structure | 348 | * @param dev A pointer to net_device structure |
363 | * @return 0 | 349 | * @return 0 |
364 | */ | 350 | */ |
365 | static int wlan_close(struct net_device *dev) { | 351 | static int wlan_close(struct net_device *dev) |
352 | { | ||
366 | wlan_private *priv = (wlan_private *) dev->priv; | 353 | wlan_private *priv = (wlan_private *) dev->priv; |
367 | 354 | ||
368 | netif_stop_queue(priv->wlan_dev.netdev); | 355 | netif_stop_queue(dev); |
369 | priv->infra_open = 0; | 356 | priv->infra_open = 0; |
370 | if (priv->mesh_open == 0) | 357 | if (priv->mesh_open == 0) |
371 | return wlan_dev_close( ((wlan_private *) dev->priv)->wlan_dev.netdev) ; | 358 | return wlan_dev_close(dev); |
372 | else | 359 | else |
373 | return 0; | 360 | return 0; |
374 | } | 361 | } |
375 | 362 | ||
376 | 363 | ||
377 | #ifdef ENABLE_PM | ||
378 | |||
379 | /** | ||
380 | * @brief This function is a callback function. it is called by | ||
381 | * kernel to enter or exit power saving mode. | ||
382 | * | ||
383 | * @param pmdev A pointer to pm_dev | ||
384 | * @param pmreq pm_request_t | ||
385 | * @param pmdata A pointer to pmdata | ||
386 | * @return 0 or -1 | ||
387 | */ | ||
388 | static int wlan_pm_callback(struct pm_dev *pmdev, pm_request_t pmreq, | ||
389 | void *pmdata) | ||
390 | { | ||
391 | wlan_private *priv = wlanpriv; | ||
392 | wlan_adapter *adapter = priv->adapter; | ||
393 | struct net_device *dev = priv->wlan_dev.netdev; | ||
394 | |||
395 | lbs_pr_debug(1, "WPRM_PM_CALLBACK: pmreq = %d.\n", pmreq); | ||
396 | |||
397 | switch (pmreq) { | ||
398 | case PM_SUSPEND: | ||
399 | lbs_pr_debug(1, "WPRM_PM_CALLBACK: enter PM_SUSPEND.\n"); | ||
400 | |||
401 | /* in associated mode */ | ||
402 | if (adapter->connect_status == libertas_connected) { | ||
403 | if ((adapter->psstate != PS_STATE_SLEEP) | ||
404 | ) { | ||
405 | lbs_pr_debug(1, | ||
406 | "wlan_pm_callback: can't enter sleep mode\n"); | ||
407 | return -1; | ||
408 | } else { | ||
409 | |||
410 | /* | ||
411 | * Detach the network interface | ||
412 | * if the network is running | ||
413 | */ | ||
414 | if (netif_running(dev)) { | ||
415 | netif_device_detach(dev); | ||
416 | lbs_pr_debug(1, | ||
417 | "netif_device_detach().\n"); | ||
418 | } | ||
419 | libertas_sbi_suspend(priv); | ||
420 | } | ||
421 | break; | ||
422 | } | ||
423 | |||
424 | /* in non associated mode */ | ||
425 | |||
426 | /* | ||
427 | * Detach the network interface | ||
428 | * if the network is running | ||
429 | */ | ||
430 | if (netif_running(dev)) | ||
431 | netif_device_detach(dev); | ||
432 | |||
433 | /* | ||
434 | * Storing and restoring of the regs be taken care | ||
435 | * at the driver rest will be done at wlan driver | ||
436 | * this makes driver independent of the card | ||
437 | */ | ||
438 | |||
439 | libertas_sbi_suspend(priv); | ||
440 | |||
441 | break; | ||
442 | |||
443 | case PM_RESUME: | ||
444 | /* in associated mode */ | ||
445 | if (adapter->connect_status == libertas_connected) { | ||
446 | { | ||
447 | /* | ||
448 | * Bring the inteface up first | ||
449 | * This case should not happen still ... | ||
450 | */ | ||
451 | libertas_sbi_resume(priv); | ||
452 | |||
453 | /* | ||
454 | * Attach the network interface | ||
455 | * if the network is running | ||
456 | */ | ||
457 | if (netif_running(dev)) { | ||
458 | netif_device_attach(dev); | ||
459 | lbs_pr_debug(1, | ||
460 | "after netif_device_attach().\n"); | ||
461 | } | ||
462 | lbs_pr_debug(1, | ||
463 | "After netif attach, in associated mode.\n"); | ||
464 | } | ||
465 | break; | ||
466 | } | ||
467 | |||
468 | /* in non associated mode */ | ||
469 | |||
470 | /* | ||
471 | * Bring the inteface up first | ||
472 | * This case should not happen still ... | ||
473 | */ | ||
474 | |||
475 | libertas_sbi_resume(priv); | ||
476 | |||
477 | if (netif_running(dev)) | ||
478 | netif_device_attach(dev); | ||
479 | |||
480 | lbs_pr_debug(1, "after netif attach, in NON associated mode.\n"); | ||
481 | break; | ||
482 | } | ||
483 | |||
484 | return 0; | ||
485 | } | ||
486 | #endif /* ENABLE_PM */ | ||
487 | |||
488 | static int wlan_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | 364 | static int wlan_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) |
489 | { | 365 | { |
490 | int ret = 0; | 366 | int ret = 0; |
491 | wlan_private *priv = dev->priv; | 367 | wlan_private *priv = dev->priv; |
492 | 368 | ||
493 | ENTER(); | 369 | lbs_deb_enter(LBS_DEB_NET); |
494 | 370 | ||
495 | if (priv->wlan_dev.dnld_sent || priv->adapter->TxLockFlag) { | 371 | if (priv->dnld_sent || priv->adapter->TxLockFlag) { |
496 | priv->stats.tx_dropped++; | 372 | priv->stats.tx_dropped++; |
497 | goto done; | 373 | goto done; |
498 | } | 374 | } |
499 | 375 | ||
500 | netif_stop_queue(priv->wlan_dev.netdev); | 376 | netif_stop_queue(priv->dev); |
377 | netif_stop_queue(priv->mesh_dev); | ||
501 | 378 | ||
502 | if (libertas_process_tx(priv, skb) == 0) | 379 | if (libertas_process_tx(priv, skb) == 0) |
503 | dev->trans_start = jiffies; | 380 | dev->trans_start = jiffies; |
504 | done: | 381 | done: |
505 | LEAVE(); | 382 | lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); |
506 | return ret; | 383 | return ret; |
507 | } | 384 | } |
508 | 385 | ||
@@ -513,33 +390,43 @@ done: | |||
513 | static int mesh_pre_start_xmit(struct sk_buff *skb, struct net_device *dev) | 390 | static int mesh_pre_start_xmit(struct sk_buff *skb, struct net_device *dev) |
514 | { | 391 | { |
515 | wlan_private *priv = dev->priv; | 392 | wlan_private *priv = dev->priv; |
516 | ENTER(); | 393 | int ret; |
394 | |||
395 | lbs_deb_enter(LBS_DEB_MESH); | ||
396 | |||
517 | SET_MESH_FRAME(skb); | 397 | SET_MESH_FRAME(skb); |
518 | LEAVE(); | ||
519 | 398 | ||
520 | return wlan_hard_start_xmit(skb, priv->wlan_dev.netdev); | 399 | ret = wlan_hard_start_xmit(skb, priv->dev); |
400 | lbs_deb_leave_args(LBS_DEB_MESH, "ret %d", ret); | ||
401 | return ret; | ||
521 | } | 402 | } |
522 | 403 | ||
523 | /** | 404 | /** |
524 | * @brief Mark non-mesh packets and handover them to wlan_hard_start_xmit | 405 | * @brief Mark non-mesh packets and handover them to wlan_hard_start_xmit |
525 | * | 406 | * |
526 | */ | 407 | */ |
527 | static int wlan_pre_start_xmit(struct sk_buff *skb, struct net_device *dev) { | 408 | static int wlan_pre_start_xmit(struct sk_buff *skb, struct net_device *dev) |
528 | ENTER(); | 409 | { |
410 | int ret; | ||
411 | |||
412 | lbs_deb_enter(LBS_DEB_NET); | ||
413 | |||
529 | UNSET_MESH_FRAME(skb); | 414 | UNSET_MESH_FRAME(skb); |
530 | LEAVE(); | 415 | |
531 | return wlan_hard_start_xmit(skb, dev); | 416 | ret = wlan_hard_start_xmit(skb, dev); |
417 | lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); | ||
418 | return ret; | ||
532 | } | 419 | } |
533 | 420 | ||
534 | static void wlan_tx_timeout(struct net_device *dev) | 421 | static void wlan_tx_timeout(struct net_device *dev) |
535 | { | 422 | { |
536 | wlan_private *priv = (wlan_private *) dev->priv; | 423 | wlan_private *priv = (wlan_private *) dev->priv; |
537 | 424 | ||
538 | ENTER(); | 425 | lbs_deb_enter(LBS_DEB_TX); |
539 | 426 | ||
540 | lbs_pr_err("tx watch dog timeout!\n"); | 427 | lbs_pr_err("tx watch dog timeout\n"); |
541 | 428 | ||
542 | priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED; | 429 | priv->dnld_sent = DNLD_RES_RECEIVED; |
543 | dev->trans_start = jiffies; | 430 | dev->trans_start = jiffies; |
544 | 431 | ||
545 | if (priv->adapter->currenttxskb) { | 432 | if (priv->adapter->currenttxskb) { |
@@ -550,10 +437,12 @@ static void wlan_tx_timeout(struct net_device *dev) | |||
550 | libertas_send_tx_feedback(priv); | 437 | libertas_send_tx_feedback(priv); |
551 | } else | 438 | } else |
552 | wake_up_interruptible(&priv->mainthread.waitq); | 439 | wake_up_interruptible(&priv->mainthread.waitq); |
553 | } else if (priv->adapter->connect_status == libertas_connected) | 440 | } else if (priv->adapter->connect_status == libertas_connected) { |
554 | netif_wake_queue(priv->wlan_dev.netdev); | 441 | netif_wake_queue(priv->dev); |
442 | netif_wake_queue(priv->mesh_dev); | ||
443 | } | ||
555 | 444 | ||
556 | LEAVE(); | 445 | lbs_deb_leave(LBS_DEB_TX); |
557 | } | 446 | } |
558 | 447 | ||
559 | /** | 448 | /** |
@@ -576,7 +465,10 @@ static int wlan_set_mac_address(struct net_device *dev, void *addr) | |||
576 | wlan_adapter *adapter = priv->adapter; | 465 | wlan_adapter *adapter = priv->adapter; |
577 | struct sockaddr *phwaddr = addr; | 466 | struct sockaddr *phwaddr = addr; |
578 | 467 | ||
579 | ENTER(); | 468 | lbs_deb_enter(LBS_DEB_NET); |
469 | |||
470 | /* In case it was called from the mesh device */ | ||
471 | dev = priv->dev ; | ||
580 | 472 | ||
581 | memset(adapter->current_addr, 0, ETH_ALEN); | 473 | memset(adapter->current_addr, 0, ETH_ALEN); |
582 | 474 | ||
@@ -591,17 +483,18 @@ static int wlan_set_mac_address(struct net_device *dev, void *addr) | |||
591 | cmd_option_waitforrsp, 0, NULL); | 483 | cmd_option_waitforrsp, 0, NULL); |
592 | 484 | ||
593 | if (ret) { | 485 | if (ret) { |
594 | lbs_pr_debug(1, "set mac address failed.\n"); | 486 | lbs_deb_net("set MAC address failed\n"); |
595 | ret = -1; | 487 | ret = -1; |
596 | goto done; | 488 | goto done; |
597 | } | 489 | } |
598 | 490 | ||
599 | lbs_dbg_hex("adapter->macaddr:", adapter->current_addr, ETH_ALEN); | 491 | lbs_dbg_hex("adapter->macaddr:", adapter->current_addr, ETH_ALEN); |
600 | memcpy(dev->dev_addr, adapter->current_addr, ETH_ALEN); | 492 | memcpy(dev->dev_addr, adapter->current_addr, ETH_ALEN); |
601 | memcpy(((wlan_private *) dev->priv)->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN); | 493 | if (priv->mesh_dev) |
494 | memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN); | ||
602 | 495 | ||
603 | done: | 496 | done: |
604 | LEAVE(); | 497 | lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); |
605 | return ret; | 498 | return ret; |
606 | } | 499 | } |
607 | 500 | ||
@@ -626,12 +519,12 @@ static void wlan_set_multicast_list(struct net_device *dev) | |||
626 | wlan_adapter *adapter = priv->adapter; | 519 | wlan_adapter *adapter = priv->adapter; |
627 | int oldpacketfilter; | 520 | int oldpacketfilter; |
628 | 521 | ||
629 | ENTER(); | 522 | lbs_deb_enter(LBS_DEB_NET); |
630 | 523 | ||
631 | oldpacketfilter = adapter->currentpacketfilter; | 524 | oldpacketfilter = adapter->currentpacketfilter; |
632 | 525 | ||
633 | if (dev->flags & IFF_PROMISC) { | 526 | if (dev->flags & IFF_PROMISC) { |
634 | lbs_pr_debug(1, "enable Promiscuous mode\n"); | 527 | lbs_deb_net("enable promiscuous mode\n"); |
635 | adapter->currentpacketfilter |= | 528 | adapter->currentpacketfilter |= |
636 | cmd_act_mac_promiscuous_enable; | 529 | cmd_act_mac_promiscuous_enable; |
637 | adapter->currentpacketfilter &= | 530 | adapter->currentpacketfilter &= |
@@ -644,7 +537,7 @@ static void wlan_set_multicast_list(struct net_device *dev) | |||
644 | 537 | ||
645 | if (dev->flags & IFF_ALLMULTI || dev->mc_count > | 538 | if (dev->flags & IFF_ALLMULTI || dev->mc_count > |
646 | MRVDRV_MAX_MULTICAST_LIST_SIZE) { | 539 | MRVDRV_MAX_MULTICAST_LIST_SIZE) { |
647 | lbs_pr_debug(1, "Enabling All Multicast!\n"); | 540 | lbs_deb_net( "enabling all multicast\n"); |
648 | adapter->currentpacketfilter |= | 541 | adapter->currentpacketfilter |= |
649 | cmd_act_mac_all_multicast_enable; | 542 | cmd_act_mac_all_multicast_enable; |
650 | adapter->currentpacketfilter &= | 543 | adapter->currentpacketfilter &= |
@@ -654,8 +547,8 @@ static void wlan_set_multicast_list(struct net_device *dev) | |||
654 | ~cmd_act_mac_all_multicast_enable; | 547 | ~cmd_act_mac_all_multicast_enable; |
655 | 548 | ||
656 | if (!dev->mc_count) { | 549 | if (!dev->mc_count) { |
657 | lbs_pr_debug(1, "No multicast addresses - " | 550 | lbs_deb_net("no multicast addresses, " |
658 | "disabling multicast!\n"); | 551 | "disabling multicast\n"); |
659 | adapter->currentpacketfilter &= | 552 | adapter->currentpacketfilter &= |
660 | ~cmd_act_mac_multicast_enable; | 553 | ~cmd_act_mac_multicast_enable; |
661 | } else { | 554 | } else { |
@@ -667,12 +560,12 @@ static void wlan_set_multicast_list(struct net_device *dev) | |||
667 | adapter->nr_of_multicastmacaddr = | 560 | adapter->nr_of_multicastmacaddr = |
668 | wlan_copy_multicast_address(adapter, dev); | 561 | wlan_copy_multicast_address(adapter, dev); |
669 | 562 | ||
670 | lbs_pr_debug(1, "Multicast addresses: %d\n", | 563 | lbs_deb_net("multicast addresses: %d\n", |
671 | dev->mc_count); | 564 | dev->mc_count); |
672 | 565 | ||
673 | for (i = 0; i < dev->mc_count; i++) { | 566 | for (i = 0; i < dev->mc_count; i++) { |
674 | lbs_pr_debug(1, "Multicast address %d:" | 567 | lbs_deb_net("Multicast address %d:" |
675 | "%x %x %x %x %x %x\n", i, | 568 | MAC_FMT "\n", i, |
676 | adapter->multicastlist[i][0], | 569 | adapter->multicastlist[i][0], |
677 | adapter->multicastlist[i][1], | 570 | adapter->multicastlist[i][1], |
678 | adapter->multicastlist[i][2], | 571 | adapter->multicastlist[i][2], |
@@ -680,7 +573,7 @@ static void wlan_set_multicast_list(struct net_device *dev) | |||
680 | adapter->multicastlist[i][4], | 573 | adapter->multicastlist[i][4], |
681 | adapter->multicastlist[i][5]); | 574 | adapter->multicastlist[i][5]); |
682 | } | 575 | } |
683 | /* set multicast addresses to firmware */ | 576 | /* send multicast addresses to firmware */ |
684 | libertas_prepare_and_send_command(priv, | 577 | libertas_prepare_and_send_command(priv, |
685 | cmd_mac_multicast_adr, | 578 | cmd_mac_multicast_adr, |
686 | cmd_act_set, 0, 0, | 579 | cmd_act_set, 0, 0, |
@@ -693,13 +586,13 @@ static void wlan_set_multicast_list(struct net_device *dev) | |||
693 | libertas_set_mac_packet_filter(priv); | 586 | libertas_set_mac_packet_filter(priv); |
694 | } | 587 | } |
695 | 588 | ||
696 | LEAVE(); | 589 | lbs_deb_leave(LBS_DEB_NET); |
697 | } | 590 | } |
698 | 591 | ||
699 | /** | 592 | /** |
700 | * @brief This function hanldes the major job in WLAN driver. | 593 | * @brief This function handles the major jobs in the WLAN driver. |
701 | * it handles the event generated by firmware, rx data received | 594 | * It handles all events generated by firmware, RX data received |
702 | * from firmware and tx data sent from kernel. | 595 | * from firmware and TX data sent from kernel. |
703 | * | 596 | * |
704 | * @param data A pointer to wlan_thread structure | 597 | * @param data A pointer to wlan_thread structure |
705 | * @return 0 | 598 | * @return 0 |
@@ -712,26 +605,26 @@ static int wlan_service_main_thread(void *data) | |||
712 | wait_queue_t wait; | 605 | wait_queue_t wait; |
713 | u8 ireg = 0; | 606 | u8 ireg = 0; |
714 | 607 | ||
715 | ENTER(); | 608 | lbs_deb_enter(LBS_DEB_THREAD); |
716 | 609 | ||
717 | wlan_activate_thread(thread); | 610 | wlan_activate_thread(thread); |
718 | 611 | ||
719 | init_waitqueue_entry(&wait, current); | 612 | init_waitqueue_entry(&wait, current); |
720 | 613 | ||
721 | for (;;) { | 614 | for (;;) { |
722 | lbs_pr_debug(1, "main-thread 111: intcounter=%d " | 615 | lbs_deb_thread( "main-thread 111: intcounter=%d " |
723 | "currenttxskb=%p dnld_sent=%d\n", | 616 | "currenttxskb=%p dnld_sent=%d\n", |
724 | adapter->intcounter, | 617 | adapter->intcounter, |
725 | adapter->currenttxskb, priv->wlan_dev.dnld_sent); | 618 | adapter->currenttxskb, priv->dnld_sent); |
726 | 619 | ||
727 | add_wait_queue(&thread->waitq, &wait); | 620 | add_wait_queue(&thread->waitq, &wait); |
728 | set_current_state(TASK_INTERRUPTIBLE); | 621 | set_current_state(TASK_INTERRUPTIBLE); |
729 | spin_lock_irq(&adapter->driver_lock); | 622 | spin_lock_irq(&adapter->driver_lock); |
730 | if ((adapter->psstate == PS_STATE_SLEEP) || | 623 | if ((adapter->psstate == PS_STATE_SLEEP) || |
731 | (!adapter->intcounter | 624 | (!adapter->intcounter |
732 | && (priv->wlan_dev.dnld_sent || adapter->cur_cmd || | 625 | && (priv->dnld_sent || adapter->cur_cmd || |
733 | list_empty(&adapter->cmdpendingq)))) { | 626 | list_empty(&adapter->cmdpendingq)))) { |
734 | lbs_pr_debug(1, | 627 | lbs_deb_thread( |
735 | "main-thread sleeping... Conn=%d IntC=%d PS_mode=%d PS_State=%d\n", | 628 | "main-thread sleeping... Conn=%d IntC=%d PS_mode=%d PS_State=%d\n", |
736 | adapter->connect_status, adapter->intcounter, | 629 | adapter->connect_status, adapter->intcounter, |
737 | adapter->psmode, adapter->psstate); | 630 | adapter->psmode, adapter->psstate); |
@@ -741,23 +634,23 @@ static int wlan_service_main_thread(void *data) | |||
741 | spin_unlock_irq(&adapter->driver_lock); | 634 | spin_unlock_irq(&adapter->driver_lock); |
742 | 635 | ||
743 | 636 | ||
744 | lbs_pr_debug(1, | 637 | lbs_deb_thread( |
745 | "main-thread 222 (waking up): intcounter=%d currenttxskb=%p " | 638 | "main-thread 222 (waking up): intcounter=%d currenttxskb=%p " |
746 | "dnld_sent=%d\n", adapter->intcounter, | 639 | "dnld_sent=%d\n", adapter->intcounter, |
747 | adapter->currenttxskb, priv->wlan_dev.dnld_sent); | 640 | adapter->currenttxskb, priv->dnld_sent); |
748 | 641 | ||
749 | set_current_state(TASK_RUNNING); | 642 | set_current_state(TASK_RUNNING); |
750 | remove_wait_queue(&thread->waitq, &wait); | 643 | remove_wait_queue(&thread->waitq, &wait); |
751 | try_to_freeze(); | 644 | try_to_freeze(); |
752 | 645 | ||
753 | lbs_pr_debug(1, "main-thread 333: intcounter=%d currenttxskb=%p " | 646 | lbs_deb_thread("main-thread 333: intcounter=%d currenttxskb=%p " |
754 | "dnld_sent=%d\n", | 647 | "dnld_sent=%d\n", |
755 | adapter->intcounter, | 648 | adapter->intcounter, |
756 | adapter->currenttxskb, priv->wlan_dev.dnld_sent); | 649 | adapter->currenttxskb, priv->dnld_sent); |
757 | 650 | ||
758 | if (kthread_should_stop() | 651 | if (kthread_should_stop() |
759 | || adapter->surpriseremoved) { | 652 | || adapter->surpriseremoved) { |
760 | lbs_pr_debug(1, | 653 | lbs_deb_thread( |
761 | "main-thread: break from main thread: surpriseremoved=0x%x\n", | 654 | "main-thread: break from main thread: surpriseremoved=0x%x\n", |
762 | adapter->surpriseremoved); | 655 | adapter->surpriseremoved); |
763 | break; | 656 | break; |
@@ -768,10 +661,10 @@ static int wlan_service_main_thread(void *data) | |||
768 | if (adapter->intcounter) { | 661 | if (adapter->intcounter) { |
769 | u8 int_status; | 662 | u8 int_status; |
770 | adapter->intcounter = 0; | 663 | adapter->intcounter = 0; |
771 | int_status = libertas_sbi_get_int_status(priv, &ireg); | 664 | int_status = priv->hw_get_int_status(priv, &ireg); |
772 | 665 | ||
773 | if (int_status) { | 666 | if (int_status) { |
774 | lbs_pr_debug(1, | 667 | lbs_deb_thread( |
775 | "main-thread: reading HOST_INT_STATUS_REG failed\n"); | 668 | "main-thread: reading HOST_INT_STATUS_REG failed\n"); |
776 | spin_unlock_irq(&adapter->driver_lock); | 669 | spin_unlock_irq(&adapter->driver_lock); |
777 | continue; | 670 | continue; |
@@ -779,14 +672,14 @@ static int wlan_service_main_thread(void *data) | |||
779 | adapter->hisregcpy |= ireg; | 672 | adapter->hisregcpy |= ireg; |
780 | } | 673 | } |
781 | 674 | ||
782 | lbs_pr_debug(1, "main-thread 444: intcounter=%d currenttxskb=%p " | 675 | lbs_deb_thread("main-thread 444: intcounter=%d currenttxskb=%p " |
783 | "dnld_sent=%d\n", | 676 | "dnld_sent=%d\n", |
784 | adapter->intcounter, | 677 | adapter->intcounter, |
785 | adapter->currenttxskb, priv->wlan_dev.dnld_sent); | 678 | adapter->currenttxskb, priv->dnld_sent); |
786 | 679 | ||
787 | /* command response? */ | 680 | /* command response? */ |
788 | if (adapter->hisregcpy & his_cmdupldrdy) { | 681 | if (adapter->hisregcpy & his_cmdupldrdy) { |
789 | lbs_pr_debug(1, "main-thread: cmd response ready.\n"); | 682 | lbs_deb_thread("main-thread: cmd response ready\n"); |
790 | 683 | ||
791 | adapter->hisregcpy &= ~his_cmdupldrdy; | 684 | adapter->hisregcpy &= ~his_cmdupldrdy; |
792 | spin_unlock_irq(&adapter->driver_lock); | 685 | spin_unlock_irq(&adapter->driver_lock); |
@@ -796,13 +689,13 @@ static int wlan_service_main_thread(void *data) | |||
796 | 689 | ||
797 | /* Any Card Event */ | 690 | /* Any Card Event */ |
798 | if (adapter->hisregcpy & his_cardevent) { | 691 | if (adapter->hisregcpy & his_cardevent) { |
799 | lbs_pr_debug(1, "main-thread: Card Event Activity.\n"); | 692 | lbs_deb_thread("main-thread: Card Event Activity\n"); |
800 | 693 | ||
801 | adapter->hisregcpy &= ~his_cardevent; | 694 | adapter->hisregcpy &= ~his_cardevent; |
802 | 695 | ||
803 | if (libertas_sbi_read_event_cause(priv)) { | 696 | if (priv->hw_read_event_cause(priv)) { |
804 | lbs_pr_alert( | 697 | lbs_pr_alert( |
805 | "main-thread: libertas_sbi_read_event_cause failed.\n"); | 698 | "main-thread: hw_read_event_cause failed\n"); |
806 | spin_unlock_irq(&adapter->driver_lock); | 699 | spin_unlock_irq(&adapter->driver_lock); |
807 | continue; | 700 | continue; |
808 | } | 701 | } |
@@ -813,15 +706,15 @@ static int wlan_service_main_thread(void *data) | |||
813 | 706 | ||
814 | /* Check if we need to confirm Sleep Request received previously */ | 707 | /* Check if we need to confirm Sleep Request received previously */ |
815 | if (adapter->psstate == PS_STATE_PRE_SLEEP) { | 708 | if (adapter->psstate == PS_STATE_PRE_SLEEP) { |
816 | if (!priv->wlan_dev.dnld_sent && !adapter->cur_cmd) { | 709 | if (!priv->dnld_sent && !adapter->cur_cmd) { |
817 | if (adapter->connect_status == | 710 | if (adapter->connect_status == |
818 | libertas_connected) { | 711 | libertas_connected) { |
819 | lbs_pr_debug(1, | 712 | lbs_deb_thread( |
820 | "main_thread: PRE_SLEEP--intcounter=%d currenttxskb=%p " | 713 | "main_thread: PRE_SLEEP--intcounter=%d currenttxskb=%p " |
821 | "dnld_sent=%d cur_cmd=%p, confirm now\n", | 714 | "dnld_sent=%d cur_cmd=%p, confirm now\n", |
822 | adapter->intcounter, | 715 | adapter->intcounter, |
823 | adapter->currenttxskb, | 716 | adapter->currenttxskb, |
824 | priv->wlan_dev.dnld_sent, | 717 | priv->dnld_sent, |
825 | adapter->cur_cmd); | 718 | adapter->cur_cmd); |
826 | 719 | ||
827 | libertas_ps_confirm_sleep(priv, | 720 | libertas_ps_confirm_sleep(priv, |
@@ -847,7 +740,7 @@ static int wlan_service_main_thread(void *data) | |||
847 | continue; | 740 | continue; |
848 | 741 | ||
849 | /* Execute the next command */ | 742 | /* Execute the next command */ |
850 | if (!priv->wlan_dev.dnld_sent && !priv->adapter->cur_cmd) | 743 | if (!priv->dnld_sent && !priv->adapter->cur_cmd) |
851 | libertas_execute_next_command(priv); | 744 | libertas_execute_next_command(priv); |
852 | 745 | ||
853 | /* Wake-up command waiters which can't sleep in | 746 | /* Wake-up command waiters which can't sleep in |
@@ -864,7 +757,7 @@ static int wlan_service_main_thread(void *data) | |||
864 | wake_up_all(&adapter->cmd_pending); | 757 | wake_up_all(&adapter->cmd_pending); |
865 | wlan_deactivate_thread(thread); | 758 | wlan_deactivate_thread(thread); |
866 | 759 | ||
867 | LEAVE(); | 760 | lbs_deb_leave(LBS_DEB_THREAD); |
868 | return 0; | 761 | return 0; |
869 | } | 762 | } |
870 | 763 | ||
@@ -875,49 +768,32 @@ static int wlan_service_main_thread(void *data) | |||
875 | * @param card A pointer to card | 768 | * @param card A pointer to card |
876 | * @return A pointer to wlan_private structure | 769 | * @return A pointer to wlan_private structure |
877 | */ | 770 | */ |
878 | wlan_private *wlan_add_card(void *card) | 771 | wlan_private *libertas_add_card(void *card, struct device *dmdev) |
879 | { | 772 | { |
880 | struct net_device *dev = NULL; | 773 | struct net_device *dev = NULL; |
881 | struct net_device *mesh_dev = NULL; | ||
882 | wlan_private *priv = NULL; | 774 | wlan_private *priv = NULL; |
883 | 775 | ||
884 | ENTER(); | 776 | lbs_deb_enter(LBS_DEB_NET); |
885 | 777 | ||
886 | /* Allocate an Ethernet device and register it */ | 778 | /* Allocate an Ethernet device and register it */ |
887 | if (!(dev = alloc_etherdev(sizeof(wlan_private)))) { | 779 | if (!(dev = alloc_etherdev(sizeof(wlan_private)))) { |
888 | lbs_pr_alert( "Init ethernet device failed!\n"); | 780 | lbs_pr_err("init ethX device failed\n"); |
889 | return NULL; | 781 | return NULL; |
890 | } | 782 | } |
891 | |||
892 | priv = dev->priv; | 783 | priv = dev->priv; |
893 | 784 | ||
894 | /* allocate buffer for wlan_adapter */ | 785 | /* allocate buffer for wlan_adapter */ |
895 | if (!(priv->adapter = kmalloc(sizeof(wlan_adapter), GFP_KERNEL))) { | 786 | if (!(priv->adapter = kzalloc(sizeof(wlan_adapter), GFP_KERNEL))) { |
896 | lbs_pr_alert( "Allocate buffer for wlan_adapter failed!\n"); | 787 | lbs_pr_err("allocate buffer for wlan_adapter failed\n"); |
897 | goto err_kmalloc; | 788 | goto err_kzalloc; |
898 | } | ||
899 | |||
900 | /* Allocate a virtual mesh device */ | ||
901 | if (!(mesh_dev = alloc_netdev(0, "msh%d", ether_setup))) { | ||
902 | lbs_pr_debug(1, "Init ethernet device failed!\n"); | ||
903 | return NULL; | ||
904 | } | 789 | } |
905 | 790 | ||
906 | /* Both intervaces share the priv structure */ | 791 | priv->dev = dev; |
907 | mesh_dev->priv = priv; | 792 | priv->card = card; |
908 | |||
909 | /* init wlan_adapter */ | ||
910 | memset(priv->adapter, 0, sizeof(wlan_adapter)); | ||
911 | |||
912 | priv->wlan_dev.netdev = dev; | ||
913 | priv->wlan_dev.card = card; | ||
914 | priv->mesh_open = 0; | 793 | priv->mesh_open = 0; |
915 | priv->infra_open = 0; | 794 | priv->infra_open = 0; |
916 | priv->mesh_dev = mesh_dev; | ||
917 | wlanpriv = priv; | ||
918 | 795 | ||
919 | SET_MODULE_OWNER(dev); | 796 | SET_MODULE_OWNER(dev); |
920 | SET_MODULE_OWNER(mesh_dev); | ||
921 | 797 | ||
922 | /* Setup the OS Interface to our functions */ | 798 | /* Setup the OS Interface to our functions */ |
923 | dev->open = wlan_open; | 799 | dev->open = wlan_open; |
@@ -925,116 +801,172 @@ wlan_private *wlan_add_card(void *card) | |||
925 | dev->stop = wlan_close; | 801 | dev->stop = wlan_close; |
926 | dev->do_ioctl = libertas_do_ioctl; | 802 | dev->do_ioctl = libertas_do_ioctl; |
927 | dev->set_mac_address = wlan_set_mac_address; | 803 | dev->set_mac_address = wlan_set_mac_address; |
928 | mesh_dev->open = mesh_open; | ||
929 | mesh_dev->hard_start_xmit = mesh_pre_start_xmit; | ||
930 | mesh_dev->stop = mesh_close; | ||
931 | mesh_dev->do_ioctl = libertas_do_ioctl; | ||
932 | memcpy(mesh_dev->dev_addr, wlanpriv->wlan_dev.netdev->dev_addr, | ||
933 | sizeof(wlanpriv->wlan_dev.netdev->dev_addr)); | ||
934 | |||
935 | #define WLAN_WATCHDOG_TIMEOUT (5 * HZ) | ||
936 | |||
937 | dev->tx_timeout = wlan_tx_timeout; | 804 | dev->tx_timeout = wlan_tx_timeout; |
938 | dev->get_stats = wlan_get_stats; | 805 | dev->get_stats = wlan_get_stats; |
939 | dev->watchdog_timeo = WLAN_WATCHDOG_TIMEOUT; | 806 | dev->watchdog_timeo = 5 * HZ; |
940 | dev->ethtool_ops = &libertas_ethtool_ops; | 807 | dev->ethtool_ops = &libertas_ethtool_ops; |
941 | mesh_dev->get_stats = wlan_get_stats; | ||
942 | mesh_dev->ethtool_ops = &libertas_ethtool_ops; | ||
943 | |||
944 | #ifdef WIRELESS_EXT | 808 | #ifdef WIRELESS_EXT |
945 | dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def; | 809 | dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def; |
946 | mesh_dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def; | ||
947 | #endif | 810 | #endif |
948 | #define NETIF_F_DYNALLOC 16 | 811 | #define NETIF_F_DYNALLOC 16 |
949 | dev->features |= NETIF_F_DYNALLOC; | 812 | dev->features |= NETIF_F_DYNALLOC; |
950 | dev->flags |= IFF_BROADCAST | IFF_MULTICAST; | 813 | dev->flags |= IFF_BROADCAST | IFF_MULTICAST; |
951 | dev->set_multicast_list = wlan_set_multicast_list; | 814 | dev->set_multicast_list = wlan_set_multicast_list; |
952 | 815 | ||
816 | SET_NETDEV_DEV(dev, dmdev); | ||
817 | |||
953 | INIT_LIST_HEAD(&priv->adapter->cmdfreeq); | 818 | INIT_LIST_HEAD(&priv->adapter->cmdfreeq); |
954 | INIT_LIST_HEAD(&priv->adapter->cmdpendingq); | 819 | INIT_LIST_HEAD(&priv->adapter->cmdpendingq); |
955 | 820 | ||
956 | spin_lock_init(&priv->adapter->driver_lock); | 821 | spin_lock_init(&priv->adapter->driver_lock); |
957 | init_waitqueue_head(&priv->adapter->cmd_pending); | 822 | init_waitqueue_head(&priv->adapter->cmd_pending); |
958 | priv->adapter->nr_cmd_pending = 0; | 823 | priv->adapter->nr_cmd_pending = 0; |
824 | goto done; | ||
959 | 825 | ||
960 | lbs_pr_debug(1, "Starting kthread...\n"); | 826 | err_kzalloc: |
827 | free_netdev(dev); | ||
828 | priv = NULL; | ||
829 | done: | ||
830 | lbs_deb_leave_args(LBS_DEB_NET, "priv %p", priv); | ||
831 | return priv; | ||
832 | } | ||
833 | EXPORT_SYMBOL_GPL(libertas_add_card); | ||
834 | |||
835 | int libertas_activate_card(wlan_private *priv, char *fw_name) | ||
836 | { | ||
837 | struct net_device *dev = priv->dev; | ||
838 | int ret = -1; | ||
839 | |||
840 | lbs_deb_enter(LBS_DEB_MAIN); | ||
841 | |||
842 | lbs_deb_thread("Starting kthread...\n"); | ||
961 | priv->mainthread.priv = priv; | 843 | priv->mainthread.priv = priv; |
962 | wlan_create_thread(wlan_service_main_thread, | 844 | wlan_create_thread(wlan_service_main_thread, |
963 | &priv->mainthread, "wlan_main_service"); | 845 | &priv->mainthread, "wlan_main_service"); |
964 | 846 | ||
965 | priv->assoc_thread = | 847 | priv->assoc_thread = |
966 | create_singlethread_workqueue("libertas_assoc"); | 848 | create_singlethread_workqueue("libertas_assoc"); |
967 | INIT_DELAYED_WORK(&priv->assoc_work, wlan_association_worker); | 849 | INIT_DELAYED_WORK(&priv->assoc_work, libertas_association_worker); |
850 | INIT_WORK(&priv->sync_channel, libertas_sync_channel); | ||
968 | 851 | ||
969 | /* | 852 | /* |
970 | * Register the device. Fillup the private data structure with | 853 | * Register the device. Fillup the private data structure with |
971 | * relevant information from the card and request for the required | 854 | * relevant information from the card and request for the required |
972 | * IRQ. | 855 | * IRQ. |
973 | */ | 856 | */ |
974 | if (libertas_sbi_register_dev(priv) < 0) { | 857 | if (priv->hw_register_dev(priv) < 0) { |
975 | lbs_pr_info("failed to register wlan device!\n"); | 858 | lbs_pr_err("failed to register WLAN device\n"); |
976 | goto err_registerdev; | 859 | goto err_registerdev; |
977 | } | 860 | } |
978 | 861 | ||
979 | /* init FW and HW */ | 862 | /* init FW and HW */ |
980 | if (libertas_init_fw(priv)) { | 863 | if (fw_name && libertas_init_fw(priv, fw_name)) { |
981 | lbs_pr_debug(1, "Firmware Init failed\n"); | 864 | lbs_pr_err("firmware init failed\n"); |
982 | goto err_registerdev; | 865 | goto err_registerdev; |
983 | } | 866 | } |
984 | 867 | ||
985 | if (register_netdev(dev)) { | 868 | if (register_netdev(dev)) { |
986 | lbs_pr_err("Cannot register network device!\n"); | 869 | lbs_pr_err("cannot register ethX device\n"); |
987 | goto err_init_fw; | ||
988 | } | ||
989 | |||
990 | /* Register virtual mesh interface */ | ||
991 | if (register_netdev(mesh_dev)) { | ||
992 | lbs_pr_info("Cannot register mesh virtual interface!\n"); | ||
993 | goto err_init_fw; | 870 | goto err_init_fw; |
994 | } | 871 | } |
995 | 872 | ||
996 | lbs_pr_info("%s: Marvell Wlan 802.11 adapter ", dev->name); | 873 | lbs_pr_info("%s: Marvell WLAN 802.11 adapter\n", dev->name); |
997 | 874 | ||
998 | libertas_debugfs_init_one(priv, dev); | 875 | libertas_debugfs_init_one(priv, dev); |
999 | 876 | ||
1000 | if (libertas_found == MAX_DEVS) | 877 | ret = 0; |
1001 | goto err_init_fw; | 878 | goto done; |
1002 | libertas_devs[libertas_found] = dev; | ||
1003 | libertas_found++; | ||
1004 | #ifdef ENABLE_PM | ||
1005 | if (!(wlan_pm_dev = pm_register(PM_UNKNOWN_DEV, 0, wlan_pm_callback))) | ||
1006 | lbs_pr_alert( "failed to register PM callback\n"); | ||
1007 | #endif | ||
1008 | if (device_create_file(&(mesh_dev->dev), &dev_attr_libertas_mpp)) | ||
1009 | goto err_create_file; | ||
1010 | |||
1011 | LEAVE(); | ||
1012 | return priv; | ||
1013 | 879 | ||
1014 | err_create_file: | ||
1015 | device_remove_file(&(mesh_dev->dev), &dev_attr_libertas_mpp); | ||
1016 | err_init_fw: | 880 | err_init_fw: |
1017 | libertas_sbi_unregister_dev(priv); | 881 | priv->hw_unregister_dev(priv); |
1018 | err_registerdev: | 882 | err_registerdev: |
1019 | destroy_workqueue(priv->assoc_thread); | 883 | destroy_workqueue(priv->assoc_thread); |
1020 | /* Stop the thread servicing the interrupts */ | 884 | /* Stop the thread servicing the interrupts */ |
1021 | wake_up_interruptible(&priv->mainthread.waitq); | 885 | wake_up_interruptible(&priv->mainthread.waitq); |
1022 | wlan_terminate_thread(&priv->mainthread); | 886 | wlan_terminate_thread(&priv->mainthread); |
1023 | kfree(priv->adapter); | 887 | done: |
1024 | err_kmalloc: | 888 | lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); |
1025 | free_netdev(dev); | 889 | return ret; |
890 | } | ||
891 | EXPORT_SYMBOL_GPL(libertas_activate_card); | ||
892 | |||
893 | |||
894 | /** | ||
895 | * @brief This function adds mshX interface | ||
896 | * | ||
897 | * @param priv A pointer to the wlan_private structure | ||
898 | * @return 0 if successful, -X otherwise | ||
899 | */ | ||
900 | int libertas_add_mesh(wlan_private *priv, struct device *dev) | ||
901 | { | ||
902 | struct net_device *mesh_dev = NULL; | ||
903 | int ret = 0; | ||
904 | |||
905 | lbs_deb_enter(LBS_DEB_MESH); | ||
906 | |||
907 | /* Allocate a virtual mesh device */ | ||
908 | if (!(mesh_dev = alloc_netdev(0, "msh%d", ether_setup))) { | ||
909 | lbs_deb_mesh("init mshX device failed\n"); | ||
910 | ret = -ENOMEM; | ||
911 | goto done; | ||
912 | } | ||
913 | mesh_dev->priv = priv; | ||
914 | priv->mesh_dev = mesh_dev; | ||
915 | |||
916 | SET_MODULE_OWNER(mesh_dev); | ||
917 | |||
918 | mesh_dev->open = mesh_open; | ||
919 | mesh_dev->hard_start_xmit = mesh_pre_start_xmit; | ||
920 | mesh_dev->stop = mesh_close; | ||
921 | mesh_dev->do_ioctl = libertas_do_ioctl; | ||
922 | mesh_dev->get_stats = wlan_get_stats; | ||
923 | mesh_dev->set_mac_address = wlan_set_mac_address; | ||
924 | mesh_dev->ethtool_ops = &libertas_ethtool_ops; | ||
925 | memcpy(mesh_dev->dev_addr, priv->dev->dev_addr, | ||
926 | sizeof(priv->dev->dev_addr)); | ||
927 | |||
928 | SET_NETDEV_DEV(priv->mesh_dev, dev); | ||
929 | |||
930 | #ifdef WIRELESS_EXT | ||
931 | mesh_dev->wireless_handlers = (struct iw_handler_def *)&mesh_handler_def; | ||
932 | #endif | ||
933 | #define NETIF_F_DYNALLOC 16 | ||
934 | |||
935 | /* Register virtual mesh interface */ | ||
936 | ret = register_netdev(mesh_dev); | ||
937 | if (ret) { | ||
938 | lbs_pr_err("cannot register mshX virtual interface\n"); | ||
939 | goto err_free; | ||
940 | } | ||
941 | |||
942 | ret = device_create_file(&(mesh_dev->dev), &dev_attr_anycast_mask); | ||
943 | if (ret) | ||
944 | goto err_unregister; | ||
945 | |||
946 | /* Everything successful */ | ||
947 | ret = 0; | ||
948 | goto done; | ||
949 | |||
950 | |||
951 | err_unregister: | ||
952 | unregister_netdev(mesh_dev); | ||
953 | |||
954 | err_free: | ||
1026 | free_netdev(mesh_dev); | 955 | free_netdev(mesh_dev); |
1027 | wlanpriv = NULL; | ||
1028 | 956 | ||
1029 | LEAVE(); | 957 | done: |
1030 | return NULL; | 958 | lbs_deb_leave_args(LBS_DEB_MESH, "ret %d", ret); |
959 | return ret; | ||
1031 | } | 960 | } |
961 | EXPORT_SYMBOL_GPL(libertas_add_mesh); | ||
1032 | 962 | ||
1033 | static void wake_pending_cmdnodes(wlan_private *priv) | 963 | static void wake_pending_cmdnodes(wlan_private *priv) |
1034 | { | 964 | { |
1035 | struct cmd_ctrl_node *cmdnode; | 965 | struct cmd_ctrl_node *cmdnode; |
1036 | unsigned long flags; | 966 | unsigned long flags; |
1037 | 967 | ||
968 | lbs_deb_enter(LBS_DEB_CMD); | ||
969 | |||
1038 | spin_lock_irqsave(&priv->adapter->driver_lock, flags); | 970 | spin_lock_irqsave(&priv->adapter->driver_lock, flags); |
1039 | list_for_each_entry(cmdnode, &priv->adapter->cmdpendingq, list) { | 971 | list_for_each_entry(cmdnode, &priv->adapter->cmdpendingq, list) { |
1040 | cmdnode->cmdwaitqwoken = 1; | 972 | cmdnode->cmdwaitqwoken = 1; |
@@ -1044,40 +976,29 @@ static void wake_pending_cmdnodes(wlan_private *priv) | |||
1044 | } | 976 | } |
1045 | 977 | ||
1046 | 978 | ||
1047 | int wlan_remove_card(void *card) | 979 | int libertas_remove_card(wlan_private *priv) |
1048 | { | 980 | { |
1049 | wlan_private *priv = libertas_sbi_get_priv(card); | ||
1050 | wlan_adapter *adapter; | 981 | wlan_adapter *adapter; |
1051 | struct net_device *dev; | 982 | struct net_device *dev; |
1052 | struct net_device *mesh_dev; | ||
1053 | union iwreq_data wrqu; | 983 | union iwreq_data wrqu; |
1054 | int i; | ||
1055 | 984 | ||
1056 | ENTER(); | 985 | lbs_deb_enter(LBS_DEB_NET); |
1057 | 986 | ||
1058 | if (!priv) { | 987 | if (!priv) |
1059 | LEAVE(); | 988 | goto out; |
1060 | return 0; | ||
1061 | } | ||
1062 | 989 | ||
1063 | adapter = priv->adapter; | 990 | adapter = priv->adapter; |
1064 | 991 | ||
1065 | if (!adapter) { | 992 | if (!adapter) |
1066 | LEAVE(); | 993 | goto out; |
1067 | return 0; | ||
1068 | } | ||
1069 | 994 | ||
1070 | dev = priv->wlan_dev.netdev; | 995 | dev = priv->dev; |
1071 | mesh_dev = priv->mesh_dev; | ||
1072 | 996 | ||
1073 | netif_stop_queue(mesh_dev); | 997 | netif_stop_queue(priv->dev); |
1074 | netif_stop_queue(priv->wlan_dev.netdev); | 998 | netif_carrier_off(priv->dev); |
1075 | netif_carrier_off(priv->wlan_dev.netdev); | ||
1076 | 999 | ||
1077 | wake_pending_cmdnodes(priv); | 1000 | wake_pending_cmdnodes(priv); |
1078 | 1001 | ||
1079 | device_remove_file(&(mesh_dev->dev), &dev_attr_libertas_mpp); | ||
1080 | unregister_netdev(mesh_dev); | ||
1081 | unregister_netdev(dev); | 1002 | unregister_netdev(dev); |
1082 | 1003 | ||
1083 | cancel_delayed_work(&priv->assoc_work); | 1004 | cancel_delayed_work(&priv->assoc_work); |
@@ -1090,11 +1011,7 @@ int wlan_remove_card(void *card) | |||
1090 | 1011 | ||
1091 | memset(wrqu.ap_addr.sa_data, 0xaa, ETH_ALEN); | 1012 | memset(wrqu.ap_addr.sa_data, 0xaa, ETH_ALEN); |
1092 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; | 1013 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
1093 | wireless_send_event(priv->wlan_dev.netdev, SIOCGIWAP, &wrqu, NULL); | 1014 | wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); |
1094 | |||
1095 | #ifdef ENABLE_PM | ||
1096 | pm_unregister(wlan_pm_dev); | ||
1097 | #endif | ||
1098 | 1015 | ||
1099 | adapter->surpriseremoved = 1; | 1016 | adapter->surpriseremoved = 1; |
1100 | 1017 | ||
@@ -1103,28 +1020,45 @@ int wlan_remove_card(void *card) | |||
1103 | 1020 | ||
1104 | libertas_debugfs_remove_one(priv); | 1021 | libertas_debugfs_remove_one(priv); |
1105 | 1022 | ||
1106 | lbs_pr_debug(1, "Free adapter\n"); | 1023 | lbs_deb_net("free adapter\n"); |
1107 | libertas_free_adapter(priv); | 1024 | libertas_free_adapter(priv); |
1108 | 1025 | ||
1109 | for (i = 0; i<libertas_found; i++) { | 1026 | lbs_deb_net("unregister finish\n"); |
1110 | if (libertas_devs[i]==priv->wlan_dev.netdev) { | 1027 | |
1111 | libertas_devs[i] = libertas_devs[--libertas_found]; | 1028 | priv->dev = NULL; |
1112 | libertas_devs[libertas_found] = NULL ; | 1029 | free_netdev(dev); |
1113 | break ; | 1030 | |
1114 | } | 1031 | out: |
1115 | } | 1032 | lbs_deb_leave(LBS_DEB_NET); |
1033 | return 0; | ||
1034 | } | ||
1035 | EXPORT_SYMBOL_GPL(libertas_remove_card); | ||
1036 | |||
1037 | |||
1038 | void libertas_remove_mesh(wlan_private *priv) | ||
1039 | { | ||
1040 | struct net_device *mesh_dev; | ||
1041 | |||
1042 | lbs_deb_enter(LBS_DEB_NET); | ||
1043 | |||
1044 | if (!priv) | ||
1045 | goto out; | ||
1046 | |||
1047 | mesh_dev = priv->mesh_dev; | ||
1048 | |||
1049 | netif_stop_queue(mesh_dev); | ||
1050 | netif_carrier_off(priv->mesh_dev); | ||
1116 | 1051 | ||
1117 | lbs_pr_debug(1, "Unregister finish\n"); | 1052 | device_remove_file(&(mesh_dev->dev), &dev_attr_anycast_mask); |
1053 | unregister_netdev(mesh_dev); | ||
1118 | 1054 | ||
1119 | priv->wlan_dev.netdev = NULL; | ||
1120 | priv->mesh_dev = NULL ; | 1055 | priv->mesh_dev = NULL ; |
1121 | free_netdev(mesh_dev); | 1056 | free_netdev(mesh_dev); |
1122 | free_netdev(dev); | ||
1123 | wlanpriv = NULL; | ||
1124 | 1057 | ||
1125 | LEAVE(); | 1058 | out: |
1126 | return 0; | 1059 | lbs_deb_leave(LBS_DEB_NET); |
1127 | } | 1060 | } |
1061 | EXPORT_SYMBOL_GPL(libertas_remove_mesh); | ||
1128 | 1062 | ||
1129 | /** | 1063 | /** |
1130 | * @brief This function finds the CFP in | 1064 | * @brief This function finds the CFP in |
@@ -1139,33 +1073,34 @@ struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band, int *c | |||
1139 | { | 1073 | { |
1140 | int i, end; | 1074 | int i, end; |
1141 | 1075 | ||
1142 | ENTER(); | 1076 | lbs_deb_enter(LBS_DEB_MAIN); |
1143 | 1077 | ||
1144 | end = sizeof(region_cfp_table)/sizeof(struct region_cfp_table); | 1078 | end = sizeof(region_cfp_table)/sizeof(struct region_cfp_table); |
1145 | 1079 | ||
1146 | for (i = 0; i < end ; i++) { | 1080 | for (i = 0; i < end ; i++) { |
1147 | lbs_pr_debug(1, "region_cfp_table[i].region=%d\n", | 1081 | lbs_deb_main("region_cfp_table[i].region=%d\n", |
1148 | region_cfp_table[i].region); | 1082 | region_cfp_table[i].region); |
1149 | if (region_cfp_table[i].region == region) { | 1083 | if (region_cfp_table[i].region == region) { |
1150 | *cfp_no = region_cfp_table[i].cfp_no_BG; | 1084 | *cfp_no = region_cfp_table[i].cfp_no_BG; |
1151 | LEAVE(); | 1085 | lbs_deb_leave(LBS_DEB_MAIN); |
1152 | return region_cfp_table[i].cfp_BG; | 1086 | return region_cfp_table[i].cfp_BG; |
1153 | } | 1087 | } |
1154 | } | 1088 | } |
1155 | 1089 | ||
1156 | LEAVE(); | 1090 | lbs_deb_leave_args(LBS_DEB_MAIN, "ret NULL"); |
1157 | return NULL; | 1091 | return NULL; |
1158 | } | 1092 | } |
1159 | 1093 | ||
1160 | int libertas_set_regiontable(wlan_private * priv, u8 region, u8 band) | 1094 | int libertas_set_regiontable(wlan_private * priv, u8 region, u8 band) |
1161 | { | 1095 | { |
1162 | wlan_adapter *adapter = priv->adapter; | 1096 | wlan_adapter *adapter = priv->adapter; |
1097 | int ret = 0; | ||
1163 | int i = 0; | 1098 | int i = 0; |
1164 | 1099 | ||
1165 | struct chan_freq_power *cfp; | 1100 | struct chan_freq_power *cfp; |
1166 | int cfp_no; | 1101 | int cfp_no; |
1167 | 1102 | ||
1168 | ENTER(); | 1103 | lbs_deb_enter(LBS_DEB_MAIN); |
1169 | 1104 | ||
1170 | memset(adapter->region_channel, 0, sizeof(adapter->region_channel)); | 1105 | memset(adapter->region_channel, 0, sizeof(adapter->region_channel)); |
1171 | 1106 | ||
@@ -1175,17 +1110,19 @@ int libertas_set_regiontable(wlan_private * priv, u8 region, u8 band) | |||
1175 | adapter->region_channel[i].nrcfp = cfp_no; | 1110 | adapter->region_channel[i].nrcfp = cfp_no; |
1176 | adapter->region_channel[i].CFP = cfp; | 1111 | adapter->region_channel[i].CFP = cfp; |
1177 | } else { | 1112 | } else { |
1178 | lbs_pr_debug(1, "wrong region code %#x in band B-G\n", | 1113 | lbs_deb_main("wrong region code %#x in band B/G\n", |
1179 | region); | 1114 | region); |
1180 | return -1; | 1115 | ret = -1; |
1116 | goto out; | ||
1181 | } | 1117 | } |
1182 | adapter->region_channel[i].valid = 1; | 1118 | adapter->region_channel[i].valid = 1; |
1183 | adapter->region_channel[i].region = region; | 1119 | adapter->region_channel[i].region = region; |
1184 | adapter->region_channel[i].band = band; | 1120 | adapter->region_channel[i].band = band; |
1185 | i++; | 1121 | i++; |
1186 | } | 1122 | } |
1187 | LEAVE(); | 1123 | out: |
1188 | return 0; | 1124 | lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret); |
1125 | return ret; | ||
1189 | } | 1126 | } |
1190 | 1127 | ||
1191 | /** | 1128 | /** |
@@ -1200,9 +1137,9 @@ void libertas_interrupt(struct net_device *dev) | |||
1200 | { | 1137 | { |
1201 | wlan_private *priv = dev->priv; | 1138 | wlan_private *priv = dev->priv; |
1202 | 1139 | ||
1203 | ENTER(); | 1140 | lbs_deb_enter(LBS_DEB_THREAD); |
1204 | 1141 | ||
1205 | lbs_pr_debug(1, "libertas_interrupt: intcounter=%d\n", | 1142 | lbs_deb_thread("libertas_interrupt: intcounter=%d\n", |
1206 | priv->adapter->intcounter); | 1143 | priv->adapter->intcounter); |
1207 | 1144 | ||
1208 | priv->adapter->intcounter++; | 1145 | priv->adapter->intcounter++; |
@@ -1210,56 +1147,35 @@ void libertas_interrupt(struct net_device *dev) | |||
1210 | if (priv->adapter->psstate == PS_STATE_SLEEP) { | 1147 | if (priv->adapter->psstate == PS_STATE_SLEEP) { |
1211 | priv->adapter->psstate = PS_STATE_AWAKE; | 1148 | priv->adapter->psstate = PS_STATE_AWAKE; |
1212 | netif_wake_queue(dev); | 1149 | netif_wake_queue(dev); |
1150 | netif_wake_queue(priv->mesh_dev); | ||
1213 | } | 1151 | } |
1214 | 1152 | ||
1215 | wake_up_interruptible(&priv->mainthread.waitq); | 1153 | wake_up_interruptible(&priv->mainthread.waitq); |
1216 | 1154 | ||
1217 | LEAVE(); | 1155 | lbs_deb_leave(LBS_DEB_THREAD); |
1218 | } | 1156 | } |
1157 | EXPORT_SYMBOL_GPL(libertas_interrupt); | ||
1219 | 1158 | ||
1220 | static int wlan_init_module(void) | 1159 | static int libertas_init_module(void) |
1221 | { | 1160 | { |
1222 | int ret = 0; | 1161 | lbs_deb_enter(LBS_DEB_MAIN); |
1223 | |||
1224 | ENTER(); | ||
1225 | |||
1226 | if (libertas_fw_name == NULL) { | ||
1227 | libertas_fw_name = default_fw_name; | ||
1228 | } | ||
1229 | |||
1230 | libertas_debugfs_init(); | 1162 | libertas_debugfs_init(); |
1231 | 1163 | lbs_deb_leave(LBS_DEB_MAIN); | |
1232 | if (libertas_sbi_register()) { | 1164 | return 0; |
1233 | ret = -1; | ||
1234 | libertas_debugfs_remove(); | ||
1235 | goto done; | ||
1236 | } | ||
1237 | |||
1238 | done: | ||
1239 | LEAVE(); | ||
1240 | return ret; | ||
1241 | } | 1165 | } |
1242 | 1166 | ||
1243 | static void wlan_cleanup_module(void) | 1167 | static void libertas_exit_module(void) |
1244 | { | 1168 | { |
1245 | int i; | 1169 | lbs_deb_enter(LBS_DEB_MAIN); |
1246 | |||
1247 | ENTER(); | ||
1248 | |||
1249 | for (i = 0; i<libertas_found; i++) { | ||
1250 | wlan_private *priv = libertas_devs[i]->priv; | ||
1251 | reset_device(priv); | ||
1252 | } | ||
1253 | 1170 | ||
1254 | libertas_sbi_unregister(); | ||
1255 | libertas_debugfs_remove(); | 1171 | libertas_debugfs_remove(); |
1256 | 1172 | ||
1257 | LEAVE(); | 1173 | lbs_deb_leave(LBS_DEB_MAIN); |
1258 | } | 1174 | } |
1259 | 1175 | ||
1260 | module_init(wlan_init_module); | 1176 | module_init(libertas_init_module); |
1261 | module_exit(wlan_cleanup_module); | 1177 | module_exit(libertas_exit_module); |
1262 | 1178 | ||
1263 | MODULE_DESCRIPTION("M-WLAN Driver"); | 1179 | MODULE_DESCRIPTION("Libertas WLAN Driver Library"); |
1264 | MODULE_AUTHOR("Marvell International Ltd."); | 1180 | MODULE_AUTHOR("Marvell International Ltd."); |
1265 | MODULE_LICENSE("GPL"); | 1181 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c index 96619a32951b..88d9d2d787d5 100644 --- a/drivers/net/wireless/libertas/rx.c +++ b/drivers/net/wireless/libertas/rx.c | |||
@@ -106,10 +106,10 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd) | |||
106 | { | 106 | { |
107 | wlan_adapter *adapter = priv->adapter; | 107 | wlan_adapter *adapter = priv->adapter; |
108 | 108 | ||
109 | ENTER(); | 109 | lbs_deb_enter(LBS_DEB_RX); |
110 | 110 | ||
111 | lbs_pr_debug(1, "rxpd: SNR = %d, NF = %d\n", p_rx_pd->snr, p_rx_pd->nf); | 111 | lbs_deb_rx("rxpd: SNR %d, NF %d\n", p_rx_pd->snr, p_rx_pd->nf); |
112 | lbs_pr_debug(1, "Before computing SNR: SNR- avg = %d, NF-avg = %d\n", | 112 | lbs_deb_rx("before computing SNR: SNR-avg = %d, NF-avg = %d\n", |
113 | adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, | 113 | adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, |
114 | adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); | 114 | adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); |
115 | 115 | ||
@@ -121,7 +121,7 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd) | |||
121 | 121 | ||
122 | adapter->SNR[TYPE_RXPD][TYPE_AVG] = wlan_getavgsnr(priv) * AVG_SCALE; | 122 | adapter->SNR[TYPE_RXPD][TYPE_AVG] = wlan_getavgsnr(priv) * AVG_SCALE; |
123 | adapter->NF[TYPE_RXPD][TYPE_AVG] = wlan_getavgnf(priv) * AVG_SCALE; | 123 | adapter->NF[TYPE_RXPD][TYPE_AVG] = wlan_getavgnf(priv) * AVG_SCALE; |
124 | lbs_pr_debug(1, "After computing SNR: SNR-avg = %d, NF-avg = %d\n", | 124 | lbs_deb_rx("after computing SNR: SNR-avg = %d, NF-avg = %d\n", |
125 | adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, | 125 | adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, |
126 | adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); | 126 | adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); |
127 | 127 | ||
@@ -133,18 +133,17 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd) | |||
133 | CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, | 133 | CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, |
134 | adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); | 134 | adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); |
135 | 135 | ||
136 | LEAVE(); | 136 | lbs_deb_leave(LBS_DEB_RX); |
137 | } | 137 | } |
138 | 138 | ||
139 | void libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb) | 139 | void libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb) |
140 | { | 140 | { |
141 | lbs_pr_debug(1, "skb->data=%p\n", skb->data); | 141 | lbs_deb_rx("skb->data %p\n", skb->data); |
142 | 142 | ||
143 | if(IS_MESH_FRAME(skb)) | 143 | if (priv->mesh_dev && IS_MESH_FRAME(skb)) |
144 | skb->dev = priv->mesh_dev; | 144 | skb->protocol = eth_type_trans(skb, priv->mesh_dev); |
145 | else | 145 | else |
146 | skb->dev = priv->wlan_dev.netdev; | 146 | skb->protocol = eth_type_trans(skb, priv->dev); |
147 | skb->protocol = eth_type_trans(skb, priv->wlan_dev.netdev); | ||
148 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 147 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
149 | 148 | ||
150 | netif_rx(skb); | 149 | netif_rx(skb); |
@@ -171,7 +170,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb) | |||
171 | 170 | ||
172 | const u8 rfc1042_eth_hdr[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; | 171 | const u8 rfc1042_eth_hdr[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; |
173 | 172 | ||
174 | ENTER(); | 173 | lbs_deb_enter(LBS_DEB_RX); |
175 | 174 | ||
176 | if (priv->adapter->debugmode & MRVDRV_DEBUG_RX_PATH) | 175 | if (priv->adapter->debugmode & MRVDRV_DEBUG_RX_PATH) |
177 | lbs_dbg_hex("RX packet: ", skb->data, | 176 | lbs_dbg_hex("RX packet: ", skb->data, |
@@ -191,7 +190,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb) | |||
191 | min_t(unsigned int, skb->len, 100)); | 190 | min_t(unsigned int, skb->len, 100)); |
192 | 191 | ||
193 | if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) { | 192 | if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) { |
194 | lbs_pr_debug(1, "RX error: FRAME RECEIVED WITH BAD LENGTH\n"); | 193 | lbs_deb_rx("rx err: frame received with bad length\n"); |
195 | priv->stats.rx_length_errors++; | 194 | priv->stats.rx_length_errors++; |
196 | ret = 0; | 195 | ret = 0; |
197 | goto done; | 196 | goto done; |
@@ -200,15 +199,15 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb) | |||
200 | /* | 199 | /* |
201 | * Check rxpd status and update 802.3 stat, | 200 | * Check rxpd status and update 802.3 stat, |
202 | */ | 201 | */ |
203 | if (!(p_rx_pd->status & MRVDRV_RXPD_STATUS_OK)) { | 202 | if (!(p_rx_pd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) { |
204 | lbs_pr_debug(1, "RX error: frame received with bad status\n"); | 203 | lbs_deb_rx("rx err: frame received with bad status\n"); |
205 | lbs_pr_alert("rxpd Not OK\n"); | 204 | lbs_pr_alert("rxpd not ok\n"); |
206 | priv->stats.rx_errors++; | 205 | priv->stats.rx_errors++; |
207 | ret = 0; | 206 | ret = 0; |
208 | goto done; | 207 | goto done; |
209 | } | 208 | } |
210 | 209 | ||
211 | lbs_pr_debug(1, "RX Data: skb->len - sizeof(RxPd) = %d - %zd = %zd\n", | 210 | lbs_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n", |
212 | skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd)); | 211 | skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd)); |
213 | 212 | ||
214 | lbs_dbg_hex("RX Data: Dest", p_rx_pkt->eth803_hdr.dest_addr, | 213 | lbs_dbg_hex("RX Data: Dest", p_rx_pkt->eth803_hdr.dest_addr, |
@@ -266,7 +265,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb) | |||
266 | 265 | ||
267 | wlan_compute_rssi(priv, p_rx_pd); | 266 | wlan_compute_rssi(priv, p_rx_pd); |
268 | 267 | ||
269 | lbs_pr_debug(1, "RX Data: size of actual packet = %d\n", skb->len); | 268 | lbs_deb_rx("rx data: size of actual packet %d\n", skb->len); |
270 | priv->stats.rx_bytes += skb->len; | 269 | priv->stats.rx_bytes += skb->len; |
271 | priv->stats.rx_packets++; | 270 | priv->stats.rx_packets++; |
272 | 271 | ||
@@ -274,10 +273,10 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb) | |||
274 | 273 | ||
275 | ret = 0; | 274 | ret = 0; |
276 | done: | 275 | done: |
277 | LEAVE(); | 276 | lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret); |
278 | |||
279 | return ret; | 277 | return ret; |
280 | } | 278 | } |
279 | EXPORT_SYMBOL_GPL(libertas_process_rxed_packet); | ||
281 | 280 | ||
282 | /** | 281 | /** |
283 | * @brief This function converts Tx/Rx rates from the Marvell WLAN format | 282 | * @brief This function converts Tx/Rx rates from the Marvell WLAN format |
@@ -314,7 +313,7 @@ static u8 convert_mv_rate_to_radiotap(u8 rate) | |||
314 | case 11: /* 54 Mbps */ | 313 | case 11: /* 54 Mbps */ |
315 | return 108; | 314 | return 108; |
316 | } | 315 | } |
317 | lbs_pr_alert( "Invalid Marvell WLAN rate (%i)\n", rate); | 316 | lbs_pr_alert("Invalid Marvell WLAN rate %i\n", rate); |
318 | return 0; | 317 | return 0; |
319 | } | 318 | } |
320 | 319 | ||
@@ -336,7 +335,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb) | |||
336 | struct rx_radiotap_hdr radiotap_hdr; | 335 | struct rx_radiotap_hdr radiotap_hdr; |
337 | struct rx_radiotap_hdr *pradiotap_hdr; | 336 | struct rx_radiotap_hdr *pradiotap_hdr; |
338 | 337 | ||
339 | ENTER(); | 338 | lbs_deb_enter(LBS_DEB_RX); |
340 | 339 | ||
341 | p_rx_pkt = (struct rx80211packethdr *) skb->data; | 340 | p_rx_pkt = (struct rx80211packethdr *) skb->data; |
342 | prxpd = &p_rx_pkt->rx_pd; | 341 | prxpd = &p_rx_pkt->rx_pd; |
@@ -344,7 +343,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb) | |||
344 | // lbs_dbg_hex("RX Data: Before chop rxpd", skb->data, min(skb->len, 100)); | 343 | // lbs_dbg_hex("RX Data: Before chop rxpd", skb->data, min(skb->len, 100)); |
345 | 344 | ||
346 | if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) { | 345 | if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) { |
347 | lbs_pr_debug(1, "RX error: FRAME RECEIVED WITH BAD LENGTH\n"); | 346 | lbs_deb_rx("rx err: frame received wit bad length\n"); |
348 | priv->stats.rx_length_errors++; | 347 | priv->stats.rx_length_errors++; |
349 | ret = 0; | 348 | ret = 0; |
350 | goto done; | 349 | goto done; |
@@ -353,12 +352,12 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb) | |||
353 | /* | 352 | /* |
354 | * Check rxpd status and update 802.3 stat, | 353 | * Check rxpd status and update 802.3 stat, |
355 | */ | 354 | */ |
356 | if (!(prxpd->status & MRVDRV_RXPD_STATUS_OK)) { | 355 | if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) { |
357 | //lbs_pr_debug(1, "RX error: frame received with bad status\n"); | 356 | //lbs_deb_rx("rx err: frame received with bad status\n"); |
358 | priv->stats.rx_errors++; | 357 | priv->stats.rx_errors++; |
359 | } | 358 | } |
360 | 359 | ||
361 | lbs_pr_debug(1, "RX Data: skb->len - sizeof(RxPd) = %d - %zd = %zd\n", | 360 | lbs_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n", |
362 | skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd)); | 361 | skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd)); |
363 | 362 | ||
364 | /* create the exported radio header */ | 363 | /* create the exported radio header */ |
@@ -386,7 +385,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb) | |||
386 | /* XXX must check no carryout */ | 385 | /* XXX must check no carryout */ |
387 | radiotap_hdr.antsignal = prxpd->snr + prxpd->nf; | 386 | radiotap_hdr.antsignal = prxpd->snr + prxpd->nf; |
388 | radiotap_hdr.rx_flags = 0; | 387 | radiotap_hdr.rx_flags = 0; |
389 | if (!(prxpd->status & MRVDRV_RXPD_STATUS_OK)) | 388 | if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) |
390 | radiotap_hdr.rx_flags |= IEEE80211_RADIOTAP_F_RX_BADFCS; | 389 | radiotap_hdr.rx_flags |= IEEE80211_RADIOTAP_F_RX_BADFCS; |
391 | //memset(radiotap_hdr.pad, 0x11, IEEE80211_RADIOTAP_HDRLEN - 18); | 390 | //memset(radiotap_hdr.pad, 0x11, IEEE80211_RADIOTAP_HDRLEN - 18); |
392 | 391 | ||
@@ -399,7 +398,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb) | |||
399 | if ((skb_headroom(skb) < sizeof(struct rx_radiotap_hdr)) && | 398 | if ((skb_headroom(skb) < sizeof(struct rx_radiotap_hdr)) && |
400 | pskb_expand_head(skb, sizeof(struct rx_radiotap_hdr), 0, | 399 | pskb_expand_head(skb, sizeof(struct rx_radiotap_hdr), 0, |
401 | GFP_ATOMIC)) { | 400 | GFP_ATOMIC)) { |
402 | lbs_pr_alert( "%s: couldn't pskb_expand_head\n", | 401 | lbs_pr_alert("%s: couldn't pskb_expand_head\n", |
403 | __func__); | 402 | __func__); |
404 | } | 403 | } |
405 | 404 | ||
@@ -414,7 +413,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb) | |||
414 | 413 | ||
415 | default: | 414 | default: |
416 | /* unknown header */ | 415 | /* unknown header */ |
417 | lbs_pr_alert( "Unknown radiomode (%i)\n", | 416 | lbs_pr_alert("Unknown radiomode %i\n", |
418 | priv->adapter->radiomode); | 417 | priv->adapter->radiomode); |
419 | /* don't export any header */ | 418 | /* don't export any header */ |
420 | /* chop the rxpd */ | 419 | /* chop the rxpd */ |
@@ -431,15 +430,16 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb) | |||
431 | 430 | ||
432 | wlan_compute_rssi(priv, prxpd); | 431 | wlan_compute_rssi(priv, prxpd); |
433 | 432 | ||
434 | lbs_pr_debug(1, "RX Data: size of actual packet = %d\n", skb->len); | 433 | lbs_deb_rx("rx data: size of actual packet %d\n", skb->len); |
435 | priv->stats.rx_bytes += skb->len; | 434 | priv->stats.rx_bytes += skb->len; |
436 | priv->stats.rx_packets++; | 435 | priv->stats.rx_packets++; |
437 | 436 | ||
438 | libertas_upload_rx_packet(priv, skb); | 437 | libertas_upload_rx_packet(priv, skb); |
439 | 438 | ||
440 | ret = 0; | 439 | ret = 0; |
441 | done: | ||
442 | LEAVE(); | ||
443 | 440 | ||
444 | return (ret); | 441 | done: |
442 | skb->protocol = __constant_htons(0x0019); /* ETH_P_80211_RAW */ | ||
443 | lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret); | ||
444 | return ret; | ||
445 | } | 445 | } |
diff --git a/drivers/net/wireless/libertas/sbi.h b/drivers/net/wireless/libertas/sbi.h deleted file mode 100644 index 59d3a59ccef0..000000000000 --- a/drivers/net/wireless/libertas/sbi.h +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /** | ||
2 | * This file contains IF layer definitions. | ||
3 | */ | ||
4 | |||
5 | #ifndef _SBI_H_ | ||
6 | #define _SBI_H_ | ||
7 | |||
8 | #include <linux/interrupt.h> | ||
9 | |||
10 | #include "defs.h" | ||
11 | |||
12 | /** INT status Bit Definition*/ | ||
13 | #define his_cmddnldrdy 0x01 | ||
14 | #define his_cardevent 0x02 | ||
15 | #define his_cmdupldrdy 0x04 | ||
16 | |||
17 | #ifndef DEV_NAME_LEN | ||
18 | #define DEV_NAME_LEN 32 | ||
19 | #endif | ||
20 | |||
21 | #define SBI_EVENT_CAUSE_SHIFT 3 | ||
22 | |||
23 | /* Probe and Check if the card is present*/ | ||
24 | int libertas_sbi_register_dev(wlan_private * priv); | ||
25 | int libertas_sbi_unregister_dev(wlan_private *); | ||
26 | int libertas_sbi_get_int_status(wlan_private * priv, u8 *); | ||
27 | int libertas_sbi_register(void); | ||
28 | void libertas_sbi_unregister(void); | ||
29 | int libertas_sbi_prog_firmware(wlan_private *); | ||
30 | |||
31 | int libertas_sbi_read_event_cause(wlan_private *); | ||
32 | int libertas_sbi_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb); | ||
33 | wlan_private *libertas_sbi_get_priv(void *card); | ||
34 | |||
35 | #ifdef ENABLE_PM | ||
36 | int libertas_sbi_suspend(wlan_private *); | ||
37 | int libertas_sbi_resume(wlan_private *); | ||
38 | #endif | ||
39 | |||
40 | #endif /* _SBI_H */ | ||
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index 3c0b1a2a1727..606af50fa09b 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/if.h> | 8 | #include <linux/if.h> |
9 | #include <linux/netdevice.h> | 9 | #include <linux/netdevice.h> |
10 | #include <linux/wireless.h> | 10 | #include <linux/wireless.h> |
11 | #include <linux/etherdevice.h> | ||
11 | 12 | ||
12 | #include <net/ieee80211.h> | 13 | #include <net/ieee80211.h> |
13 | #include <net/iw_handler.h> | 14 | #include <net/iw_handler.h> |
@@ -58,12 +59,82 @@ | |||
58 | //! Scan time specified in the channel TLV for each channel for active scans | 59 | //! Scan time specified in the channel TLV for each channel for active scans |
59 | #define MRVDRV_ACTIVE_SCAN_CHAN_TIME 100 | 60 | #define MRVDRV_ACTIVE_SCAN_CHAN_TIME 100 |
60 | 61 | ||
61 | //! Macro to enable/disable SSID checking before storing a scan table | 62 | static const u8 zeromac[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; |
62 | #ifdef DISCARD_BAD_SSID | 63 | static const u8 bcastmac[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; |
63 | #define CHECK_SSID_IS_VALID(x) ssid_valid(&bssidEntry.ssid) | 64 | |
64 | #else | 65 | static inline void clear_bss_descriptor (struct bss_descriptor * bss) |
65 | #define CHECK_SSID_IS_VALID(x) 1 | 66 | { |
66 | #endif | 67 | /* Don't blow away ->list, just BSS data */ |
68 | memset(bss, 0, offsetof(struct bss_descriptor, list)); | ||
69 | } | ||
70 | |||
71 | static inline int match_bss_no_security(struct wlan_802_11_security * secinfo, | ||
72 | struct bss_descriptor * match_bss) | ||
73 | { | ||
74 | if ( !secinfo->wep_enabled | ||
75 | && !secinfo->WPAenabled | ||
76 | && !secinfo->WPA2enabled | ||
77 | && match_bss->wpa_ie[0] != WPA_IE | ||
78 | && match_bss->rsn_ie[0] != WPA2_IE | ||
79 | && !match_bss->privacy) { | ||
80 | return 1; | ||
81 | } | ||
82 | return 0; | ||
83 | } | ||
84 | |||
85 | static inline int match_bss_static_wep(struct wlan_802_11_security * secinfo, | ||
86 | struct bss_descriptor * match_bss) | ||
87 | { | ||
88 | if ( secinfo->wep_enabled | ||
89 | && !secinfo->WPAenabled | ||
90 | && !secinfo->WPA2enabled | ||
91 | && match_bss->privacy) { | ||
92 | return 1; | ||
93 | } | ||
94 | return 0; | ||
95 | } | ||
96 | |||
97 | static inline int match_bss_wpa(struct wlan_802_11_security * secinfo, | ||
98 | struct bss_descriptor * match_bss) | ||
99 | { | ||
100 | if ( !secinfo->wep_enabled | ||
101 | && secinfo->WPAenabled | ||
102 | && (match_bss->wpa_ie[0] == WPA_IE) | ||
103 | /* privacy bit may NOT be set in some APs like LinkSys WRT54G | ||
104 | && bss->privacy */ | ||
105 | ) { | ||
106 | return 1; | ||
107 | } | ||
108 | return 0; | ||
109 | } | ||
110 | |||
111 | static inline int match_bss_wpa2(struct wlan_802_11_security * secinfo, | ||
112 | struct bss_descriptor * match_bss) | ||
113 | { | ||
114 | if ( !secinfo->wep_enabled | ||
115 | && secinfo->WPA2enabled | ||
116 | && (match_bss->rsn_ie[0] == WPA2_IE) | ||
117 | /* privacy bit may NOT be set in some APs like LinkSys WRT54G | ||
118 | && bss->privacy */ | ||
119 | ) { | ||
120 | return 1; | ||
121 | } | ||
122 | return 0; | ||
123 | } | ||
124 | |||
125 | static inline int match_bss_dynamic_wep(struct wlan_802_11_security * secinfo, | ||
126 | struct bss_descriptor * match_bss) | ||
127 | { | ||
128 | if ( !secinfo->wep_enabled | ||
129 | && !secinfo->WPAenabled | ||
130 | && !secinfo->WPA2enabled | ||
131 | && (match_bss->wpa_ie[0] != WPA_IE) | ||
132 | && (match_bss->rsn_ie[0] != WPA2_IE) | ||
133 | && match_bss->privacy) { | ||
134 | return 1; | ||
135 | } | ||
136 | return 0; | ||
137 | } | ||
67 | 138 | ||
68 | /** | 139 | /** |
69 | * @brief Check if a scanned network compatible with the driver settings | 140 | * @brief Check if a scanned network compatible with the driver settings |
@@ -84,123 +155,63 @@ | |||
84 | * | 155 | * |
85 | * @return Index in scantable, or error code if negative | 156 | * @return Index in scantable, or error code if negative |
86 | */ | 157 | */ |
87 | static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode) | 158 | static int is_network_compatible(wlan_adapter * adapter, |
159 | struct bss_descriptor * bss, u8 mode) | ||
88 | { | 160 | { |
89 | ENTER(); | 161 | int matched = 0; |
90 | 162 | ||
91 | if (adapter->scantable[index].mode == mode) { | 163 | lbs_deb_enter(LBS_DEB_ASSOC); |
92 | if ( !adapter->secinfo.wep_enabled | 164 | |
93 | && !adapter->secinfo.WPAenabled | 165 | if (bss->mode != mode) |
94 | && !adapter->secinfo.WPA2enabled | 166 | goto done; |
95 | && adapter->scantable[index].wpa_ie[0] != WPA_IE | 167 | |
96 | && adapter->scantable[index].rsn_ie[0] != WPA2_IE | 168 | if ((matched = match_bss_no_security(&adapter->secinfo, bss))) { |
97 | && !adapter->scantable[index].privacy) { | 169 | goto done; |
98 | /* no security */ | 170 | } else if ((matched = match_bss_static_wep(&adapter->secinfo, bss))) { |
99 | LEAVE(); | 171 | goto done; |
100 | return index; | 172 | } else if ((matched = match_bss_wpa(&adapter->secinfo, bss))) { |
101 | } else if ( adapter->secinfo.wep_enabled | 173 | lbs_deb_scan( |
102 | && !adapter->secinfo.WPAenabled | 174 | "is_network_compatible() WPA: wpa_ie=%#x " |
103 | && !adapter->secinfo.WPA2enabled | 175 | "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s " |
104 | && adapter->scantable[index].privacy) { | 176 | "privacy=%#x\n", bss->wpa_ie[0], bss->rsn_ie[0], |
105 | /* static WEP enabled */ | ||
106 | LEAVE(); | ||
107 | return index; | ||
108 | } else if ( !adapter->secinfo.wep_enabled | ||
109 | && adapter->secinfo.WPAenabled | ||
110 | && !adapter->secinfo.WPA2enabled | ||
111 | && (adapter->scantable[index].wpa_ie[0] == WPA_IE) | ||
112 | /* privacy bit may NOT be set in some APs like LinkSys WRT54G | ||
113 | && adapter->scantable[index].privacy */ | ||
114 | ) { | ||
115 | /* WPA enabled */ | ||
116 | lbs_pr_debug(1, | ||
117 | "is_network_compatible() WPA: index=%d wpa_ie=%#x " | ||
118 | "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s " | ||
119 | "privacy=%#x\n", index, | ||
120 | adapter->scantable[index].wpa_ie[0], | ||
121 | adapter->scantable[index].rsn_ie[0], | ||
122 | adapter->secinfo.wep_enabled ? "e" : "d", | ||
123 | adapter->secinfo.WPAenabled ? "e" : "d", | ||
124 | adapter->secinfo.WPA2enabled ? "e" : "d", | ||
125 | adapter->scantable[index].privacy); | ||
126 | LEAVE(); | ||
127 | return index; | ||
128 | } else if ( !adapter->secinfo.wep_enabled | ||
129 | && !adapter->secinfo.WPAenabled | ||
130 | && adapter->secinfo.WPA2enabled | ||
131 | && (adapter->scantable[index].rsn_ie[0] == WPA2_IE) | ||
132 | /* privacy bit may NOT be set in some APs like LinkSys WRT54G | ||
133 | && adapter->scantable[index].privacy */ | ||
134 | ) { | ||
135 | /* WPA2 enabled */ | ||
136 | lbs_pr_debug(1, | ||
137 | "is_network_compatible() WPA2: index=%d wpa_ie=%#x " | ||
138 | "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s " | ||
139 | "privacy=%#x\n", index, | ||
140 | adapter->scantable[index].wpa_ie[0], | ||
141 | adapter->scantable[index].rsn_ie[0], | ||
142 | adapter->secinfo.wep_enabled ? "e" : "d", | ||
143 | adapter->secinfo.WPAenabled ? "e" : "d", | ||
144 | adapter->secinfo.WPA2enabled ? "e" : "d", | ||
145 | adapter->scantable[index].privacy); | ||
146 | LEAVE(); | ||
147 | return index; | ||
148 | } else if ( !adapter->secinfo.wep_enabled | ||
149 | && !adapter->secinfo.WPAenabled | ||
150 | && !adapter->secinfo.WPA2enabled | ||
151 | && (adapter->scantable[index].wpa_ie[0] != WPA_IE) | ||
152 | && (adapter->scantable[index].rsn_ie[0] != WPA2_IE) | ||
153 | && adapter->scantable[index].privacy) { | ||
154 | /* dynamic WEP enabled */ | ||
155 | lbs_pr_debug(1, | ||
156 | "is_network_compatible() dynamic WEP: index=%d " | ||
157 | "wpa_ie=%#x wpa2_ie=%#x privacy=%#x\n", | ||
158 | index, | ||
159 | adapter->scantable[index].wpa_ie[0], | ||
160 | adapter->scantable[index].rsn_ie[0], | ||
161 | adapter->scantable[index].privacy); | ||
162 | LEAVE(); | ||
163 | return index; | ||
164 | } | ||
165 | |||
166 | /* security doesn't match */ | ||
167 | lbs_pr_debug(1, | ||
168 | "is_network_compatible() FAILED: index=%d wpa_ie=%#x " | ||
169 | "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s privacy=%#x\n", | ||
170 | index, | ||
171 | adapter->scantable[index].wpa_ie[0], | ||
172 | adapter->scantable[index].rsn_ie[0], | ||
173 | adapter->secinfo.wep_enabled ? "e" : "d", | 177 | adapter->secinfo.wep_enabled ? "e" : "d", |
174 | adapter->secinfo.WPAenabled ? "e" : "d", | 178 | adapter->secinfo.WPAenabled ? "e" : "d", |
175 | adapter->secinfo.WPA2enabled ? "e" : "d", | 179 | adapter->secinfo.WPA2enabled ? "e" : "d", |
176 | adapter->scantable[index].privacy); | 180 | bss->privacy); |
177 | LEAVE(); | 181 | goto done; |
178 | return -ECONNREFUSED; | 182 | } else if ((matched = match_bss_wpa2(&adapter->secinfo, bss))) { |
179 | } | 183 | lbs_deb_scan( |
180 | 184 | "is_network_compatible() WPA2: wpa_ie=%#x " | |
181 | /* mode doesn't match */ | 185 | "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s " |
182 | LEAVE(); | 186 | "privacy=%#x\n", bss->wpa_ie[0], bss->rsn_ie[0], |
183 | return -ENETUNREACH; | 187 | adapter->secinfo.wep_enabled ? "e" : "d", |
184 | } | 188 | adapter->secinfo.WPAenabled ? "e" : "d", |
185 | 189 | adapter->secinfo.WPA2enabled ? "e" : "d", | |
186 | /** | 190 | bss->privacy); |
187 | * @brief This function validates a SSID as being able to be printed | 191 | goto done; |
188 | * | 192 | } else if ((matched = match_bss_dynamic_wep(&adapter->secinfo, bss))) { |
189 | * @param pssid SSID structure to validate | 193 | lbs_deb_scan( |
190 | * | 194 | "is_network_compatible() dynamic WEP: " |
191 | * @return TRUE or FALSE | 195 | "wpa_ie=%#x wpa2_ie=%#x privacy=%#x\n", |
192 | */ | 196 | bss->wpa_ie[0], |
193 | static u8 ssid_valid(struct WLAN_802_11_SSID *pssid) | 197 | bss->rsn_ie[0], |
194 | { | 198 | bss->privacy); |
195 | int ssididx; | 199 | goto done; |
196 | |||
197 | for (ssididx = 0; ssididx < pssid->ssidlength; ssididx++) { | ||
198 | if (!isprint(pssid->ssid[ssididx])) { | ||
199 | return 0; | ||
200 | } | ||
201 | } | 200 | } |
202 | 201 | ||
203 | return 1; | 202 | /* bss security settings don't match those configured on card */ |
203 | lbs_deb_scan( | ||
204 | "is_network_compatible() FAILED: wpa_ie=%#x " | ||
205 | "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s privacy=%#x\n", | ||
206 | bss->wpa_ie[0], bss->rsn_ie[0], | ||
207 | adapter->secinfo.wep_enabled ? "e" : "d", | ||
208 | adapter->secinfo.WPAenabled ? "e" : "d", | ||
209 | adapter->secinfo.WPA2enabled ? "e" : "d", | ||
210 | bss->privacy); | ||
211 | |||
212 | done: | ||
213 | lbs_deb_leave(LBS_DEB_SCAN); | ||
214 | return matched; | ||
204 | } | 215 | } |
205 | 216 | ||
206 | /** | 217 | /** |
@@ -220,44 +231,19 @@ static u8 ssid_valid(struct WLAN_802_11_SSID *pssid) | |||
220 | static void wlan_scan_process_results(wlan_private * priv) | 231 | static void wlan_scan_process_results(wlan_private * priv) |
221 | { | 232 | { |
222 | wlan_adapter *adapter = priv->adapter; | 233 | wlan_adapter *adapter = priv->adapter; |
223 | int foundcurrent; | 234 | struct bss_descriptor * iter_bss; |
224 | int i; | 235 | int i = 0; |
225 | |||
226 | foundcurrent = 0; | ||
227 | |||
228 | if (adapter->connect_status == libertas_connected) { | ||
229 | /* try to find the current BSSID in the new scan list */ | ||
230 | for (i = 0; i < adapter->numinscantable; i++) { | ||
231 | if (!libertas_SSID_cmp(&adapter->scantable[i].ssid, | ||
232 | &adapter->curbssparams.ssid) && | ||
233 | !memcmp(adapter->curbssparams.bssid, | ||
234 | adapter->scantable[i].macaddress, | ||
235 | ETH_ALEN)) { | ||
236 | foundcurrent = 1; | ||
237 | } | ||
238 | } | ||
239 | 236 | ||
240 | if (foundcurrent) { | 237 | if (adapter->connect_status == libertas_connected) |
241 | /* Make a copy of current BSSID descriptor */ | 238 | return; |
242 | memcpy(&adapter->curbssparams.bssdescriptor, | ||
243 | &adapter->scantable[i], | ||
244 | sizeof(adapter->curbssparams.bssdescriptor)); | ||
245 | } | ||
246 | } | ||
247 | 239 | ||
248 | for (i = 0; i < adapter->numinscantable; i++) { | 240 | mutex_lock(&adapter->lock); |
249 | lbs_pr_debug(1, "Scan:(%02d) %02x:%02x:%02x:%02x:%02x:%02x, " | 241 | list_for_each_entry (iter_bss, &adapter->network_list, list) { |
250 | "RSSI[%03d], SSID[%s]\n", | 242 | lbs_deb_scan("Scan:(%02d) " MAC_FMT ", RSSI[%03d], SSID[%s]\n", |
251 | i, | 243 | i++, MAC_ARG(iter_bss->bssid), (s32) iter_bss->rssi, |
252 | adapter->scantable[i].macaddress[0], | 244 | escape_essid(iter_bss->ssid, iter_bss->ssid_len)); |
253 | adapter->scantable[i].macaddress[1], | ||
254 | adapter->scantable[i].macaddress[2], | ||
255 | adapter->scantable[i].macaddress[3], | ||
256 | adapter->scantable[i].macaddress[4], | ||
257 | adapter->scantable[i].macaddress[5], | ||
258 | (s32) adapter->scantable[i].rssi, | ||
259 | adapter->scantable[i].ssid.ssid); | ||
260 | } | 245 | } |
246 | mutex_unlock(&adapter->lock); | ||
261 | } | 247 | } |
262 | 248 | ||
263 | /** | 249 | /** |
@@ -338,14 +324,12 @@ static void wlan_scan_create_channel_list(wlan_private * priv, | |||
338 | 324 | ||
339 | if (scantype == cmd_scan_type_passive) { | 325 | if (scantype == cmd_scan_type_passive) { |
340 | scanchanlist[chanidx].maxscantime = | 326 | scanchanlist[chanidx].maxscantime = |
341 | cpu_to_le16 | 327 | cpu_to_le16(MRVDRV_PASSIVE_SCAN_CHAN_TIME); |
342 | (MRVDRV_PASSIVE_SCAN_CHAN_TIME); | ||
343 | scanchanlist[chanidx].chanscanmode.passivescan = | 328 | scanchanlist[chanidx].chanscanmode.passivescan = |
344 | 1; | 329 | 1; |
345 | } else { | 330 | } else { |
346 | scanchanlist[chanidx].maxscantime = | 331 | scanchanlist[chanidx].maxscantime = |
347 | cpu_to_le16 | 332 | cpu_to_le16(MRVDRV_ACTIVE_SCAN_CHAN_TIME); |
348 | (MRVDRV_ACTIVE_SCAN_CHAN_TIME); | ||
349 | scanchanlist[chanidx].chanscanmode.passivescan = | 333 | scanchanlist[chanidx].chanscanmode.passivescan = |
350 | 0; | 334 | 0; |
351 | } | 335 | } |
@@ -408,13 +392,11 @@ wlan_scan_setup_scan_config(wlan_private * priv, | |||
408 | u8 * pscancurrentonly) | 392 | u8 * pscancurrentonly) |
409 | { | 393 | { |
410 | wlan_adapter *adapter = priv->adapter; | 394 | wlan_adapter *adapter = priv->adapter; |
411 | const u8 zeromac[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 }; | ||
412 | struct mrvlietypes_numprobes *pnumprobestlv; | 395 | struct mrvlietypes_numprobes *pnumprobestlv; |
413 | struct mrvlietypes_ssidparamset *pssidtlv; | 396 | struct mrvlietypes_ssidparamset *pssidtlv; |
414 | struct wlan_scan_cmd_config * pscancfgout = NULL; | 397 | struct wlan_scan_cmd_config * pscancfgout = NULL; |
415 | u8 *ptlvpos; | 398 | u8 *ptlvpos; |
416 | u16 numprobes; | 399 | u16 numprobes; |
417 | u16 ssidlen; | ||
418 | int chanidx; | 400 | int chanidx; |
419 | int scantype; | 401 | int scantype; |
420 | int scandur; | 402 | int scandur; |
@@ -471,21 +453,18 @@ wlan_scan_setup_scan_config(wlan_private * priv, | |||
471 | * Set the BSSID filter to the incoming configuration, | 453 | * Set the BSSID filter to the incoming configuration, |
472 | * if non-zero. If not set, it will remain disabled (all zeros). | 454 | * if non-zero. If not set, it will remain disabled (all zeros). |
473 | */ | 455 | */ |
474 | memcpy(pscancfgout->specificBSSID, | 456 | memcpy(pscancfgout->bssid, puserscanin->bssid, |
475 | puserscanin->specificBSSID, | 457 | sizeof(pscancfgout->bssid)); |
476 | sizeof(pscancfgout->specificBSSID)); | ||
477 | |||
478 | ssidlen = strlen(puserscanin->specificSSID); | ||
479 | 458 | ||
480 | if (ssidlen) { | 459 | if (puserscanin->ssid_len) { |
481 | pssidtlv = | 460 | pssidtlv = |
482 | (struct mrvlietypes_ssidparamset *) pscancfgout-> | 461 | (struct mrvlietypes_ssidparamset *) pscancfgout-> |
483 | tlvbuffer; | 462 | tlvbuffer; |
484 | pssidtlv->header.type = cpu_to_le16(TLV_TYPE_SSID); | 463 | pssidtlv->header.type = cpu_to_le16(TLV_TYPE_SSID); |
485 | pssidtlv->header.len = cpu_to_le16(ssidlen); | 464 | pssidtlv->header.len = cpu_to_le16(puserscanin->ssid_len); |
486 | memcpy(pssidtlv->ssid, puserscanin->specificSSID, | 465 | memcpy(pssidtlv->ssid, puserscanin->ssid, |
487 | ssidlen); | 466 | puserscanin->ssid_len); |
488 | ptlvpos += sizeof(pssidtlv->header) + ssidlen; | 467 | ptlvpos += sizeof(pssidtlv->header) + puserscanin->ssid_len; |
489 | } | 468 | } |
490 | 469 | ||
491 | /* | 470 | /* |
@@ -494,8 +473,8 @@ wlan_scan_setup_scan_config(wlan_private * priv, | |||
494 | * scan results. That is not an issue with an SSID or BSSID | 473 | * scan results. That is not an issue with an SSID or BSSID |
495 | * filter applied to the scan results in the firmware. | 474 | * filter applied to the scan results in the firmware. |
496 | */ | 475 | */ |
497 | if (ssidlen || (memcmp(pscancfgout->specificBSSID, | 476 | if ( puserscanin->ssid_len |
498 | &zeromac, sizeof(zeromac)) != 0)) { | 477 | || (compare_ether_addr(pscancfgout->bssid, &zeromac[0]) != 0)) { |
499 | *pmaxchanperscan = MRVDRV_MAX_CHANNELS_PER_SCAN; | 478 | *pmaxchanperscan = MRVDRV_MAX_CHANNELS_PER_SCAN; |
500 | *pfilteredscan = 1; | 479 | *pfilteredscan = 1; |
501 | } | 480 | } |
@@ -507,16 +486,11 @@ wlan_scan_setup_scan_config(wlan_private * priv, | |||
507 | /* If the input config or adapter has the number of Probes set, add tlv */ | 486 | /* If the input config or adapter has the number of Probes set, add tlv */ |
508 | if (numprobes) { | 487 | if (numprobes) { |
509 | pnumprobestlv = (struct mrvlietypes_numprobes *) ptlvpos; | 488 | pnumprobestlv = (struct mrvlietypes_numprobes *) ptlvpos; |
510 | pnumprobestlv->header.type = | 489 | pnumprobestlv->header.type = cpu_to_le16(TLV_TYPE_NUMPROBES); |
511 | cpu_to_le16(TLV_TYPE_NUMPROBES); | 490 | pnumprobestlv->header.len = cpu_to_le16(2); |
512 | pnumprobestlv->header.len = sizeof(pnumprobestlv->numprobes); | ||
513 | pnumprobestlv->numprobes = cpu_to_le16(numprobes); | 491 | pnumprobestlv->numprobes = cpu_to_le16(numprobes); |
514 | 492 | ||
515 | ptlvpos += | 493 | ptlvpos += sizeof(*pnumprobestlv); |
516 | sizeof(pnumprobestlv->header) + pnumprobestlv->header.len; | ||
517 | |||
518 | pnumprobestlv->header.len = | ||
519 | cpu_to_le16(pnumprobestlv->header.len); | ||
520 | } | 494 | } |
521 | 495 | ||
522 | /* | 496 | /* |
@@ -529,7 +503,7 @@ wlan_scan_setup_scan_config(wlan_private * priv, | |||
529 | 503 | ||
530 | if (puserscanin && puserscanin->chanlist[0].channumber) { | 504 | if (puserscanin && puserscanin->chanlist[0].channumber) { |
531 | 505 | ||
532 | lbs_pr_debug(1, "Scan: Using supplied channel list\n"); | 506 | lbs_deb_scan("Scan: Using supplied channel list\n"); |
533 | 507 | ||
534 | for (chanidx = 0; | 508 | for (chanidx = 0; |
535 | chanidx < WLAN_IOCTL_USER_SCAN_CHAN_MAX | 509 | chanidx < WLAN_IOCTL_USER_SCAN_CHAN_MAX |
@@ -573,11 +547,11 @@ wlan_scan_setup_scan_config(wlan_private * priv, | |||
573 | == | 547 | == |
574 | priv->adapter->curbssparams.channel)) { | 548 | priv->adapter->curbssparams.channel)) { |
575 | *pscancurrentonly = 1; | 549 | *pscancurrentonly = 1; |
576 | lbs_pr_debug(1, "Scan: Scanning current channel only"); | 550 | lbs_deb_scan("Scan: Scanning current channel only"); |
577 | } | 551 | } |
578 | 552 | ||
579 | } else { | 553 | } else { |
580 | lbs_pr_debug(1, "Scan: Creating full region channel list\n"); | 554 | lbs_deb_scan("Scan: Creating full region channel list\n"); |
581 | wlan_scan_create_channel_list(priv, pscanchanlist, | 555 | wlan_scan_create_channel_list(priv, pscanchanlist, |
582 | *pfilteredscan); | 556 | *pfilteredscan); |
583 | } | 557 | } |
@@ -613,7 +587,9 @@ static int wlan_scan_channel_list(wlan_private * priv, | |||
613 | u8 filteredscan, | 587 | u8 filteredscan, |
614 | struct wlan_scan_cmd_config * pscancfgout, | 588 | struct wlan_scan_cmd_config * pscancfgout, |
615 | struct mrvlietypes_chanlistparamset * pchantlvout, | 589 | struct mrvlietypes_chanlistparamset * pchantlvout, |
616 | struct chanscanparamset * pscanchanlist) | 590 | struct chanscanparamset * pscanchanlist, |
591 | const struct wlan_ioctl_user_scan_cfg * puserscanin, | ||
592 | int full_scan) | ||
617 | { | 593 | { |
618 | struct chanscanparamset *ptmpchan; | 594 | struct chanscanparamset *ptmpchan; |
619 | struct chanscanparamset *pstartchan; | 595 | struct chanscanparamset *pstartchan; |
@@ -621,11 +597,13 @@ static int wlan_scan_channel_list(wlan_private * priv, | |||
621 | int doneearly; | 597 | int doneearly; |
622 | int tlvidx; | 598 | int tlvidx; |
623 | int ret = 0; | 599 | int ret = 0; |
600 | int scanned = 0; | ||
601 | union iwreq_data wrqu; | ||
624 | 602 | ||
625 | ENTER(); | 603 | lbs_deb_enter(LBS_DEB_ASSOC); |
626 | 604 | ||
627 | if (pscancfgout == 0 || pchantlvout == 0 || pscanchanlist == 0) { | 605 | if (pscancfgout == 0 || pchantlvout == 0 || pscanchanlist == 0) { |
628 | lbs_pr_debug(1, "Scan: Null detect: %p, %p, %p\n", | 606 | lbs_deb_scan("Scan: Null detect: %p, %p, %p\n", |
629 | pscancfgout, pchantlvout, pscanchanlist); | 607 | pscancfgout, pchantlvout, pscanchanlist); |
630 | return -1; | 608 | return -1; |
631 | } | 609 | } |
@@ -635,6 +613,9 @@ static int wlan_scan_channel_list(wlan_private * priv, | |||
635 | /* Set the temp channel struct pointer to the start of the desired list */ | 613 | /* Set the temp channel struct pointer to the start of the desired list */ |
636 | ptmpchan = pscanchanlist; | 614 | ptmpchan = pscanchanlist; |
637 | 615 | ||
616 | if (priv->adapter->last_scanned_channel && !puserscanin) | ||
617 | ptmpchan += priv->adapter->last_scanned_channel; | ||
618 | |||
638 | /* Loop through the desired channel list, sending a new firmware scan | 619 | /* Loop through the desired channel list, sending a new firmware scan |
639 | * commands for each maxchanperscan channels (or for 1,6,11 individually | 620 | * commands for each maxchanperscan channels (or for 1,6,11 individually |
640 | * if configured accordingly) | 621 | * if configured accordingly) |
@@ -654,9 +635,9 @@ static int wlan_scan_channel_list(wlan_private * priv, | |||
654 | * - doneearly is set (controlling individual scanning of 1,6,11) | 635 | * - doneearly is set (controlling individual scanning of 1,6,11) |
655 | */ | 636 | */ |
656 | while (tlvidx < maxchanperscan && ptmpchan->channumber | 637 | while (tlvidx < maxchanperscan && ptmpchan->channumber |
657 | && !doneearly) { | 638 | && !doneearly && scanned < 2) { |
658 | 639 | ||
659 | lbs_pr_debug(1, | 640 | lbs_deb_scan( |
660 | "Scan: Chan(%3d), Radio(%d), mode(%d,%d), Dur(%d)\n", | 641 | "Scan: Chan(%3d), Radio(%d), mode(%d,%d), Dur(%d)\n", |
661 | ptmpchan->channumber, ptmpchan->radiotype, | 642 | ptmpchan->channumber, ptmpchan->radiotype, |
662 | ptmpchan->chanscanmode.passivescan, | 643 | ptmpchan->chanscanmode.passivescan, |
@@ -668,8 +649,11 @@ static int wlan_scan_channel_list(wlan_private * priv, | |||
668 | ptmpchan, sizeof(pchantlvout->chanscanparam)); | 649 | ptmpchan, sizeof(pchantlvout->chanscanparam)); |
669 | 650 | ||
670 | /* Increment the TLV header length by the size appended */ | 651 | /* Increment the TLV header length by the size appended */ |
671 | pchantlvout->header.len += | 652 | /* Ew, it would be _so_ nice if we could just declare the |
672 | sizeof(pchantlvout->chanscanparam); | 653 | variable little-endian and let GCC handle it for us */ |
654 | pchantlvout->header.len = | ||
655 | cpu_to_le16(le16_to_cpu(pchantlvout->header.len) + | ||
656 | sizeof(pchantlvout->chanscanparam)); | ||
673 | 657 | ||
674 | /* | 658 | /* |
675 | * The tlv buffer length is set to the number of bytes of the | 659 | * The tlv buffer length is set to the number of bytes of the |
@@ -683,7 +667,7 @@ static int wlan_scan_channel_list(wlan_private * priv, | |||
683 | /* Add the size of the channel tlv header and the data length */ | 667 | /* Add the size of the channel tlv header and the data length */ |
684 | pscancfgout->tlvbufferlen += | 668 | pscancfgout->tlvbufferlen += |
685 | (sizeof(pchantlvout->header) | 669 | (sizeof(pchantlvout->header) |
686 | + pchantlvout->header.len); | 670 | + le16_to_cpu(pchantlvout->header.len)); |
687 | 671 | ||
688 | /* Increment the index to the channel tlv we are constructing */ | 672 | /* Increment the index to the channel tlv we are constructing */ |
689 | tlvidx++; | 673 | tlvidx++; |
@@ -701,6 +685,7 @@ static int wlan_scan_channel_list(wlan_private * priv, | |||
701 | 685 | ||
702 | /* Increment the tmp pointer to the next channel to be scanned */ | 686 | /* Increment the tmp pointer to the next channel to be scanned */ |
703 | ptmpchan++; | 687 | ptmpchan++; |
688 | scanned++; | ||
704 | 689 | ||
705 | /* Stop the loop if the *next* channel is in the 1,6,11 set. | 690 | /* Stop the loop if the *next* channel is in the 1,6,11 set. |
706 | * This will cause it to be the only channel scanned on the next | 691 | * This will cause it to be the only channel scanned on the next |
@@ -716,12 +701,71 @@ static int wlan_scan_channel_list(wlan_private * priv, | |||
716 | /* Send the scan command to the firmware with the specified cfg */ | 701 | /* Send the scan command to the firmware with the specified cfg */ |
717 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_scan, 0, | 702 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_scan, 0, |
718 | 0, 0, pscancfgout); | 703 | 0, 0, pscancfgout); |
704 | if (scanned >= 2 && !full_scan) { | ||
705 | ret = 0; | ||
706 | goto done; | ||
707 | } | ||
708 | scanned = 0; | ||
719 | } | 709 | } |
720 | 710 | ||
721 | LEAVE(); | 711 | done: |
712 | priv->adapter->last_scanned_channel = ptmpchan->channumber; | ||
713 | |||
714 | /* Tell userspace the scan table has been updated */ | ||
715 | memset(&wrqu, 0, sizeof(union iwreq_data)); | ||
716 | wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL); | ||
717 | |||
718 | lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret); | ||
722 | return ret; | 719 | return ret; |
723 | } | 720 | } |
724 | 721 | ||
722 | static void | ||
723 | clear_selected_scan_list_entries(wlan_adapter * adapter, | ||
724 | const struct wlan_ioctl_user_scan_cfg * scan_cfg) | ||
725 | { | ||
726 | struct bss_descriptor * bss; | ||
727 | struct bss_descriptor * safe; | ||
728 | u32 clear_ssid_flag = 0, clear_bssid_flag = 0; | ||
729 | |||
730 | if (!scan_cfg) | ||
731 | return; | ||
732 | |||
733 | if (scan_cfg->clear_ssid && scan_cfg->ssid_len) | ||
734 | clear_ssid_flag = 1; | ||
735 | |||
736 | if (scan_cfg->clear_bssid | ||
737 | && (compare_ether_addr(scan_cfg->bssid, &zeromac[0]) != 0) | ||
738 | && (compare_ether_addr(scan_cfg->bssid, &bcastmac[0]) != 0)) { | ||
739 | clear_bssid_flag = 1; | ||
740 | } | ||
741 | |||
742 | if (!clear_ssid_flag && !clear_bssid_flag) | ||
743 | return; | ||
744 | |||
745 | mutex_lock(&adapter->lock); | ||
746 | list_for_each_entry_safe (bss, safe, &adapter->network_list, list) { | ||
747 | u32 clear = 0; | ||
748 | |||
749 | /* Check for an SSID match */ | ||
750 | if ( clear_ssid_flag | ||
751 | && (bss->ssid_len == scan_cfg->ssid_len) | ||
752 | && !memcmp(bss->ssid, scan_cfg->ssid, bss->ssid_len)) | ||
753 | clear = 1; | ||
754 | |||
755 | /* Check for a BSSID match */ | ||
756 | if ( clear_bssid_flag | ||
757 | && !compare_ether_addr(bss->bssid, scan_cfg->bssid)) | ||
758 | clear = 1; | ||
759 | |||
760 | if (clear) { | ||
761 | list_move_tail (&bss->list, &adapter->network_free_list); | ||
762 | clear_bss_descriptor(bss); | ||
763 | } | ||
764 | } | ||
765 | mutex_unlock(&adapter->lock); | ||
766 | } | ||
767 | |||
768 | |||
725 | /** | 769 | /** |
726 | * @brief Internal function used to start a scan based on an input config | 770 | * @brief Internal function used to start a scan based on an input config |
727 | * | 771 | * |
@@ -736,19 +780,19 @@ static int wlan_scan_channel_list(wlan_private * priv, | |||
736 | * @return 0 or < 0 if error | 780 | * @return 0 or < 0 if error |
737 | */ | 781 | */ |
738 | int wlan_scan_networks(wlan_private * priv, | 782 | int wlan_scan_networks(wlan_private * priv, |
739 | const struct wlan_ioctl_user_scan_cfg * puserscanin) | 783 | const struct wlan_ioctl_user_scan_cfg * puserscanin, |
784 | int full_scan) | ||
740 | { | 785 | { |
741 | wlan_adapter *adapter = priv->adapter; | 786 | wlan_adapter * adapter = priv->adapter; |
742 | struct mrvlietypes_chanlistparamset *pchantlvout; | 787 | struct mrvlietypes_chanlistparamset *pchantlvout; |
743 | struct chanscanparamset * scan_chan_list = NULL; | 788 | struct chanscanparamset * scan_chan_list = NULL; |
744 | struct wlan_scan_cmd_config * scan_cfg = NULL; | 789 | struct wlan_scan_cmd_config * scan_cfg = NULL; |
745 | u8 keeppreviousscan; | ||
746 | u8 filteredscan; | 790 | u8 filteredscan; |
747 | u8 scancurrentchanonly; | 791 | u8 scancurrentchanonly; |
748 | int maxchanperscan; | 792 | int maxchanperscan; |
749 | int ret; | 793 | int ret; |
750 | 794 | ||
751 | ENTER(); | 795 | lbs_deb_enter(LBS_DEB_ASSOC); |
752 | 796 | ||
753 | scan_chan_list = kzalloc(sizeof(struct chanscanparamset) * | 797 | scan_chan_list = kzalloc(sizeof(struct chanscanparamset) * |
754 | WLAN_IOCTL_USER_SCAN_CHAN_MAX, GFP_KERNEL); | 798 | WLAN_IOCTL_USER_SCAN_CHAN_MAX, GFP_KERNEL); |
@@ -769,22 +813,14 @@ int wlan_scan_networks(wlan_private * priv, | |||
769 | goto out; | 813 | goto out; |
770 | } | 814 | } |
771 | 815 | ||
772 | keeppreviousscan = 0; | 816 | clear_selected_scan_list_entries(adapter, puserscanin); |
773 | |||
774 | if (puserscanin) { | ||
775 | keeppreviousscan = puserscanin->keeppreviousscan; | ||
776 | } | ||
777 | |||
778 | if (!keeppreviousscan) { | ||
779 | memset(adapter->scantable, 0x00, | ||
780 | sizeof(struct bss_descriptor) * MRVDRV_MAX_BSSID_LIST); | ||
781 | adapter->numinscantable = 0; | ||
782 | } | ||
783 | 817 | ||
784 | /* Keep the data path active if we are only scanning our current channel */ | 818 | /* Keep the data path active if we are only scanning our current channel */ |
785 | if (!scancurrentchanonly) { | 819 | if (!scancurrentchanonly) { |
786 | netif_stop_queue(priv->wlan_dev.netdev); | 820 | netif_stop_queue(priv->dev); |
787 | netif_carrier_off(priv->wlan_dev.netdev); | 821 | netif_carrier_off(priv->dev); |
822 | netif_stop_queue(priv->mesh_dev); | ||
823 | netif_carrier_off(priv->mesh_dev); | ||
788 | } | 824 | } |
789 | 825 | ||
790 | ret = wlan_scan_channel_list(priv, | 826 | ret = wlan_scan_channel_list(priv, |
@@ -792,7 +828,9 @@ int wlan_scan_networks(wlan_private * priv, | |||
792 | filteredscan, | 828 | filteredscan, |
793 | scan_cfg, | 829 | scan_cfg, |
794 | pchantlvout, | 830 | pchantlvout, |
795 | scan_chan_list); | 831 | scan_chan_list, |
832 | puserscanin, | ||
833 | full_scan); | ||
796 | 834 | ||
797 | /* Process the resulting scan table: | 835 | /* Process the resulting scan table: |
798 | * - Remove any bad ssids | 836 | * - Remove any bad ssids |
@@ -801,8 +839,10 @@ int wlan_scan_networks(wlan_private * priv, | |||
801 | wlan_scan_process_results(priv); | 839 | wlan_scan_process_results(priv); |
802 | 840 | ||
803 | if (priv->adapter->connect_status == libertas_connected) { | 841 | if (priv->adapter->connect_status == libertas_connected) { |
804 | netif_carrier_on(priv->wlan_dev.netdev); | 842 | netif_carrier_on(priv->dev); |
805 | netif_wake_queue(priv->wlan_dev.netdev); | 843 | netif_wake_queue(priv->dev); |
844 | netif_carrier_on(priv->mesh_dev); | ||
845 | netif_wake_queue(priv->mesh_dev); | ||
806 | } | 846 | } |
807 | 847 | ||
808 | out: | 848 | out: |
@@ -812,7 +852,7 @@ out: | |||
812 | if (scan_chan_list) | 852 | if (scan_chan_list) |
813 | kfree(scan_chan_list); | 853 | kfree(scan_chan_list); |
814 | 854 | ||
815 | LEAVE(); | 855 | lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret); |
816 | return ret; | 856 | return ret; |
817 | } | 857 | } |
818 | 858 | ||
@@ -843,7 +883,7 @@ void wlan_ret_802_11_scan_get_tlv_ptrs(struct mrvlietypes_data * ptlv, | |||
843 | tlvbufleft = tlvbufsize; | 883 | tlvbufleft = tlvbufsize; |
844 | *ptsftlv = NULL; | 884 | *ptsftlv = NULL; |
845 | 885 | ||
846 | lbs_pr_debug(1, "SCAN_RESP: tlvbufsize = %d\n", tlvbufsize); | 886 | lbs_deb_scan("SCAN_RESP: tlvbufsize = %d\n", tlvbufsize); |
847 | lbs_dbg_hex("SCAN_RESP: TLV Buf", (u8 *) ptlv, tlvbufsize); | 887 | lbs_dbg_hex("SCAN_RESP: TLV Buf", (u8 *) ptlv, tlvbufsize); |
848 | 888 | ||
849 | while (tlvbufleft >= sizeof(struct mrvlietypesheader)) { | 889 | while (tlvbufleft >= sizeof(struct mrvlietypesheader)) { |
@@ -856,7 +896,7 @@ void wlan_ret_802_11_scan_get_tlv_ptrs(struct mrvlietypes_data * ptlv, | |||
856 | break; | 896 | break; |
857 | 897 | ||
858 | default: | 898 | default: |
859 | lbs_pr_debug(1, "SCAN_RESP: Unhandled TLV = %d\n", | 899 | lbs_deb_scan("SCAN_RESP: Unhandled TLV = %d\n", |
860 | tlvtype); | 900 | tlvtype); |
861 | /* Give up, this seems corrupted */ | 901 | /* Give up, this seems corrupted */ |
862 | return; | 902 | return; |
@@ -875,12 +915,12 @@ void wlan_ret_802_11_scan_get_tlv_ptrs(struct mrvlietypes_data * ptlv, | |||
875 | * response or beacon from the scan command. Record information as needed | 915 | * response or beacon from the scan command. Record information as needed |
876 | * in the scan table struct bss_descriptor for that entry. | 916 | * in the scan table struct bss_descriptor for that entry. |
877 | * | 917 | * |
878 | * @param pBSSIDEntry Output parameter: Pointer to the BSS Entry | 918 | * @param bss Output parameter: Pointer to the BSS Entry |
879 | * | 919 | * |
880 | * @return 0 or -1 | 920 | * @return 0 or -1 |
881 | */ | 921 | */ |
882 | static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry, | 922 | static int libertas_process_bss(struct bss_descriptor * bss, |
883 | u8 ** pbeaconinfo, int *bytesleft) | 923 | u8 ** pbeaconinfo, int *bytesleft) |
884 | { | 924 | { |
885 | enum ieeetypes_elementid elemID; | 925 | enum ieeetypes_elementid elemID; |
886 | struct ieeetypes_fhparamset *pFH; | 926 | struct ieeetypes_fhparamset *pFH; |
@@ -897,13 +937,14 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry, | |||
897 | u16 beaconsize; | 937 | u16 beaconsize; |
898 | u8 founddatarateie; | 938 | u8 founddatarateie; |
899 | int bytesleftforcurrentbeacon; | 939 | int bytesleftforcurrentbeacon; |
940 | int ret; | ||
900 | 941 | ||
901 | struct IE_WPA *pIe; | 942 | struct IE_WPA *pIe; |
902 | const u8 oui01[4] = { 0x00, 0x50, 0xf2, 0x01 }; | 943 | const u8 oui01[4] = { 0x00, 0x50, 0xf2, 0x01 }; |
903 | 944 | ||
904 | struct ieeetypes_countryinfoset *pcountryinfo; | 945 | struct ieeetypes_countryinfoset *pcountryinfo; |
905 | 946 | ||
906 | ENTER(); | 947 | lbs_deb_enter(LBS_DEB_ASSOC); |
907 | 948 | ||
908 | founddatarateie = 0; | 949 | founddatarateie = 0; |
909 | ratesize = 0; | 950 | ratesize = 0; |
@@ -911,8 +952,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry, | |||
911 | 952 | ||
912 | if (*bytesleft >= sizeof(beaconsize)) { | 953 | if (*bytesleft >= sizeof(beaconsize)) { |
913 | /* Extract & convert beacon size from the command buffer */ | 954 | /* Extract & convert beacon size from the command buffer */ |
914 | memcpy(&beaconsize, *pbeaconinfo, sizeof(beaconsize)); | 955 | beaconsize = le16_to_cpup((void *)*pbeaconinfo); |
915 | beaconsize = le16_to_cpu(beaconsize); | ||
916 | *bytesleft -= sizeof(beaconsize); | 956 | *bytesleft -= sizeof(beaconsize); |
917 | *pbeaconinfo += sizeof(beaconsize); | 957 | *pbeaconinfo += sizeof(beaconsize); |
918 | } | 958 | } |
@@ -934,17 +974,14 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry, | |||
934 | 974 | ||
935 | bytesleftforcurrentbeacon = beaconsize; | 975 | bytesleftforcurrentbeacon = beaconsize; |
936 | 976 | ||
937 | memcpy(pBSSEntry->macaddress, pcurrentptr, ETH_ALEN); | 977 | memcpy(bss->bssid, pcurrentptr, ETH_ALEN); |
938 | lbs_pr_debug(1, "InterpretIE: AP MAC Addr-%x:%x:%x:%x:%x:%x\n", | 978 | lbs_deb_scan("process_bss: AP BSSID " MAC_FMT "\n", MAC_ARG(bss->bssid)); |
939 | pBSSEntry->macaddress[0], pBSSEntry->macaddress[1], | ||
940 | pBSSEntry->macaddress[2], pBSSEntry->macaddress[3], | ||
941 | pBSSEntry->macaddress[4], pBSSEntry->macaddress[5]); | ||
942 | 979 | ||
943 | pcurrentptr += ETH_ALEN; | 980 | pcurrentptr += ETH_ALEN; |
944 | bytesleftforcurrentbeacon -= ETH_ALEN; | 981 | bytesleftforcurrentbeacon -= ETH_ALEN; |
945 | 982 | ||
946 | if (bytesleftforcurrentbeacon < 12) { | 983 | if (bytesleftforcurrentbeacon < 12) { |
947 | lbs_pr_debug(1, "InterpretIE: Not enough bytes left\n"); | 984 | lbs_deb_scan("process_bss: Not enough bytes left\n"); |
948 | return -1; | 985 | return -1; |
949 | } | 986 | } |
950 | 987 | ||
@@ -954,51 +991,48 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry, | |||
954 | */ | 991 | */ |
955 | 992 | ||
956 | /* RSSI is 1 byte long */ | 993 | /* RSSI is 1 byte long */ |
957 | pBSSEntry->rssi = le32_to_cpu((long)(*pcurrentptr)); | 994 | bss->rssi = *pcurrentptr; |
958 | lbs_pr_debug(1, "InterpretIE: RSSI=%02X\n", *pcurrentptr); | 995 | lbs_deb_scan("process_bss: RSSI=%02X\n", *pcurrentptr); |
959 | pcurrentptr += 1; | 996 | pcurrentptr += 1; |
960 | bytesleftforcurrentbeacon -= 1; | 997 | bytesleftforcurrentbeacon -= 1; |
961 | 998 | ||
962 | /* time stamp is 8 bytes long */ | 999 | /* time stamp is 8 bytes long */ |
963 | memcpy(fixedie.timestamp, pcurrentptr, 8); | 1000 | fixedie.timestamp = bss->timestamp = le64_to_cpup((void *)pcurrentptr); |
964 | memcpy(pBSSEntry->timestamp, pcurrentptr, 8); | ||
965 | pcurrentptr += 8; | 1001 | pcurrentptr += 8; |
966 | bytesleftforcurrentbeacon -= 8; | 1002 | bytesleftforcurrentbeacon -= 8; |
967 | 1003 | ||
968 | /* beacon interval is 2 bytes long */ | 1004 | /* beacon interval is 2 bytes long */ |
969 | memcpy(&fixedie.beaconinterval, pcurrentptr, 2); | 1005 | fixedie.beaconinterval = bss->beaconperiod = le16_to_cpup((void *)pcurrentptr); |
970 | pBSSEntry->beaconperiod = le16_to_cpu(fixedie.beaconinterval); | ||
971 | pcurrentptr += 2; | 1006 | pcurrentptr += 2; |
972 | bytesleftforcurrentbeacon -= 2; | 1007 | bytesleftforcurrentbeacon -= 2; |
973 | 1008 | ||
974 | /* capability information is 2 bytes long */ | 1009 | /* capability information is 2 bytes long */ |
975 | memcpy(&fixedie.capabilities, pcurrentptr, 2); | 1010 | memcpy(&fixedie.capabilities, pcurrentptr, 2); |
976 | lbs_pr_debug(1, "InterpretIE: fixedie.capabilities=0x%X\n", | 1011 | lbs_deb_scan("process_bss: fixedie.capabilities=0x%X\n", |
977 | fixedie.capabilities); | 1012 | fixedie.capabilities); |
978 | fixedie.capabilities = le16_to_cpu(fixedie.capabilities); | ||
979 | pcap = (struct ieeetypes_capinfo *) & fixedie.capabilities; | 1013 | pcap = (struct ieeetypes_capinfo *) & fixedie.capabilities; |
980 | memcpy(&pBSSEntry->cap, pcap, sizeof(struct ieeetypes_capinfo)); | 1014 | memcpy(&bss->cap, pcap, sizeof(struct ieeetypes_capinfo)); |
981 | pcurrentptr += 2; | 1015 | pcurrentptr += 2; |
982 | bytesleftforcurrentbeacon -= 2; | 1016 | bytesleftforcurrentbeacon -= 2; |
983 | 1017 | ||
984 | /* rest of the current buffer are IE's */ | 1018 | /* rest of the current buffer are IE's */ |
985 | lbs_pr_debug(1, "InterpretIE: IElength for this AP = %d\n", | 1019 | lbs_deb_scan("process_bss: IE length for this AP = %d\n", |
986 | bytesleftforcurrentbeacon); | 1020 | bytesleftforcurrentbeacon); |
987 | 1021 | ||
988 | lbs_dbg_hex("InterpretIE: IE info", (u8 *) pcurrentptr, | 1022 | lbs_dbg_hex("process_bss: IE info", (u8 *) pcurrentptr, |
989 | bytesleftforcurrentbeacon); | 1023 | bytesleftforcurrentbeacon); |
990 | 1024 | ||
991 | if (pcap->privacy) { | 1025 | if (pcap->privacy) { |
992 | lbs_pr_debug(1, "InterpretIE: AP WEP enabled\n"); | 1026 | lbs_deb_scan("process_bss: AP WEP enabled\n"); |
993 | pBSSEntry->privacy = wlan802_11privfilter8021xWEP; | 1027 | bss->privacy = wlan802_11privfilter8021xWEP; |
994 | } else { | 1028 | } else { |
995 | pBSSEntry->privacy = wlan802_11privfilteracceptall; | 1029 | bss->privacy = wlan802_11privfilteracceptall; |
996 | } | 1030 | } |
997 | 1031 | ||
998 | if (pcap->ibss == 1) { | 1032 | if (pcap->ibss == 1) { |
999 | pBSSEntry->mode = IW_MODE_ADHOC; | 1033 | bss->mode = IW_MODE_ADHOC; |
1000 | } else { | 1034 | } else { |
1001 | pBSSEntry->mode = IW_MODE_INFRA; | 1035 | bss->mode = IW_MODE_INFRA; |
1002 | } | 1036 | } |
1003 | 1037 | ||
1004 | /* process variable IE */ | 1038 | /* process variable IE */ |
@@ -1007,94 +1041,83 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry, | |||
1007 | elemlen = *((u8 *) pcurrentptr + 1); | 1041 | elemlen = *((u8 *) pcurrentptr + 1); |
1008 | 1042 | ||
1009 | if (bytesleftforcurrentbeacon < elemlen) { | 1043 | if (bytesleftforcurrentbeacon < elemlen) { |
1010 | lbs_pr_debug(1, "InterpretIE: error in processing IE, " | 1044 | lbs_deb_scan("process_bss: error in processing IE, " |
1011 | "bytes left < IE length\n"); | 1045 | "bytes left < IE length\n"); |
1012 | bytesleftforcurrentbeacon = 0; | 1046 | bytesleftforcurrentbeacon = 0; |
1013 | continue; | 1047 | continue; |
1014 | } | 1048 | } |
1015 | 1049 | ||
1016 | switch (elemID) { | 1050 | switch (elemID) { |
1017 | |||
1018 | case SSID: | 1051 | case SSID: |
1019 | pBSSEntry->ssid.ssidlength = elemlen; | 1052 | bss->ssid_len = elemlen; |
1020 | memcpy(pBSSEntry->ssid.ssid, (pcurrentptr + 2), | 1053 | memcpy(bss->ssid, (pcurrentptr + 2), elemlen); |
1021 | elemlen); | 1054 | lbs_deb_scan("ssid '%s', ssid length %u\n", |
1022 | lbs_pr_debug(1, "ssid: %32s", pBSSEntry->ssid.ssid); | 1055 | escape_essid(bss->ssid, bss->ssid_len), |
1056 | bss->ssid_len); | ||
1023 | break; | 1057 | break; |
1024 | 1058 | ||
1025 | case SUPPORTED_RATES: | 1059 | case SUPPORTED_RATES: |
1026 | memcpy(pBSSEntry->datarates, (pcurrentptr + 2), | 1060 | memcpy(bss->datarates, (pcurrentptr + 2), elemlen); |
1027 | elemlen); | 1061 | memmove(bss->libertas_supported_rates, (pcurrentptr + 2), |
1028 | memmove(pBSSEntry->libertas_supported_rates, (pcurrentptr + 2), | ||
1029 | elemlen); | 1062 | elemlen); |
1030 | ratesize = elemlen; | 1063 | ratesize = elemlen; |
1031 | founddatarateie = 1; | 1064 | founddatarateie = 1; |
1032 | break; | 1065 | break; |
1033 | 1066 | ||
1034 | case EXTRA_IE: | 1067 | case EXTRA_IE: |
1035 | lbs_pr_debug(1, "InterpretIE: EXTRA_IE Found!\n"); | 1068 | lbs_deb_scan("process_bss: EXTRA_IE Found!\n"); |
1036 | pBSSEntry->extra_ie = 1; | ||
1037 | break; | 1069 | break; |
1038 | 1070 | ||
1039 | case FH_PARAM_SET: | 1071 | case FH_PARAM_SET: |
1040 | pFH = (struct ieeetypes_fhparamset *) pcurrentptr; | 1072 | pFH = (struct ieeetypes_fhparamset *) pcurrentptr; |
1041 | memmove(&pBSSEntry->phyparamset.fhparamset, pFH, | 1073 | memmove(&bss->phyparamset.fhparamset, pFH, |
1042 | sizeof(struct ieeetypes_fhparamset)); | 1074 | sizeof(struct ieeetypes_fhparamset)); |
1043 | pBSSEntry->phyparamset.fhparamset.dwelltime | 1075 | #if 0 /* I think we can store these LE */ |
1044 | = | 1076 | bss->phyparamset.fhparamset.dwelltime |
1045 | le16_to_cpu(pBSSEntry->phyparamset.fhparamset. | 1077 | = le16_to_cpu(bss->phyparamset.fhparamset.dwelltime); |
1046 | dwelltime); | 1078 | #endif |
1047 | break; | 1079 | break; |
1048 | 1080 | ||
1049 | case DS_PARAM_SET: | 1081 | case DS_PARAM_SET: |
1050 | pDS = (struct ieeetypes_dsparamset *) pcurrentptr; | 1082 | pDS = (struct ieeetypes_dsparamset *) pcurrentptr; |
1051 | 1083 | bss->channel = pDS->currentchan; | |
1052 | pBSSEntry->channel = pDS->currentchan; | 1084 | memcpy(&bss->phyparamset.dsparamset, pDS, |
1053 | |||
1054 | memcpy(&pBSSEntry->phyparamset.dsparamset, pDS, | ||
1055 | sizeof(struct ieeetypes_dsparamset)); | 1085 | sizeof(struct ieeetypes_dsparamset)); |
1056 | break; | 1086 | break; |
1057 | 1087 | ||
1058 | case CF_PARAM_SET: | 1088 | case CF_PARAM_SET: |
1059 | pCF = (struct ieeetypes_cfparamset *) pcurrentptr; | 1089 | pCF = (struct ieeetypes_cfparamset *) pcurrentptr; |
1060 | 1090 | memcpy(&bss->ssparamset.cfparamset, pCF, | |
1061 | memcpy(&pBSSEntry->ssparamset.cfparamset, pCF, | ||
1062 | sizeof(struct ieeetypes_cfparamset)); | 1091 | sizeof(struct ieeetypes_cfparamset)); |
1063 | break; | 1092 | break; |
1064 | 1093 | ||
1065 | case IBSS_PARAM_SET: | 1094 | case IBSS_PARAM_SET: |
1066 | pibss = (struct ieeetypes_ibssparamset *) pcurrentptr; | 1095 | pibss = (struct ieeetypes_ibssparamset *) pcurrentptr; |
1067 | pBSSEntry->atimwindow = | 1096 | bss->atimwindow = le32_to_cpu(pibss->atimwindow); |
1068 | le32_to_cpu(pibss->atimwindow); | 1097 | memmove(&bss->ssparamset.ibssparamset, pibss, |
1069 | |||
1070 | memmove(&pBSSEntry->ssparamset.ibssparamset, pibss, | ||
1071 | sizeof(struct ieeetypes_ibssparamset)); | 1098 | sizeof(struct ieeetypes_ibssparamset)); |
1072 | 1099 | #if 0 | |
1073 | pBSSEntry->ssparamset.ibssparamset.atimwindow | 1100 | bss->ssparamset.ibssparamset.atimwindow |
1074 | = | 1101 | = le16_to_cpu(bss->ssparamset.ibssparamset.atimwindow); |
1075 | le16_to_cpu(pBSSEntry->ssparamset.ibssparamset. | 1102 | #endif |
1076 | atimwindow); | ||
1077 | break; | 1103 | break; |
1078 | 1104 | ||
1079 | /* Handle Country Info IE */ | 1105 | /* Handle Country Info IE */ |
1080 | case COUNTRY_INFO: | 1106 | case COUNTRY_INFO: |
1081 | pcountryinfo = | 1107 | pcountryinfo = (struct ieeetypes_countryinfoset *) pcurrentptr; |
1082 | (struct ieeetypes_countryinfoset *) pcurrentptr; | 1108 | if (pcountryinfo->len < sizeof(pcountryinfo->countrycode) |
1083 | |||
1084 | if (pcountryinfo->len < | ||
1085 | sizeof(pcountryinfo->countrycode) | ||
1086 | || pcountryinfo->len > 254) { | 1109 | || pcountryinfo->len > 254) { |
1087 | lbs_pr_debug(1, "InterpretIE: 11D- Err " | 1110 | lbs_deb_scan("process_bss: 11D- Err " |
1088 | "CountryInfo len =%d min=%zd max=254\n", | 1111 | "CountryInfo len =%d min=%zd max=254\n", |
1089 | pcountryinfo->len, | 1112 | pcountryinfo->len, |
1090 | sizeof(pcountryinfo->countrycode)); | 1113 | sizeof(pcountryinfo->countrycode)); |
1091 | LEAVE(); | 1114 | ret = -1; |
1092 | return -1; | 1115 | goto done; |
1093 | } | 1116 | } |
1094 | 1117 | ||
1095 | memcpy(&pBSSEntry->countryinfo, | 1118 | memcpy(&bss->countryinfo, |
1096 | pcountryinfo, pcountryinfo->len + 2); | 1119 | pcountryinfo, pcountryinfo->len + 2); |
1097 | lbs_dbg_hex("InterpretIE: 11D- CountryInfo:", | 1120 | lbs_dbg_hex("process_bss: 11D- CountryInfo:", |
1098 | (u8 *) pcountryinfo, | 1121 | (u8 *) pcountryinfo, |
1099 | (u32) (pcountryinfo->len + 2)); | 1122 | (u32) (pcountryinfo->len + 2)); |
1100 | break; | 1123 | break; |
@@ -1114,12 +1137,10 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry, | |||
1114 | bytestocopy = elemlen; | 1137 | bytestocopy = elemlen; |
1115 | } | 1138 | } |
1116 | 1139 | ||
1117 | pRate = (u8 *) pBSSEntry->datarates; | 1140 | pRate = (u8 *) bss->datarates; |
1118 | pRate += ratesize; | 1141 | pRate += ratesize; |
1119 | memmove(pRate, (pcurrentptr + 2), bytestocopy); | 1142 | memmove(pRate, (pcurrentptr + 2), bytestocopy); |
1120 | 1143 | pRate = (u8 *) bss->libertas_supported_rates; | |
1121 | pRate = (u8 *) pBSSEntry->libertas_supported_rates; | ||
1122 | |||
1123 | pRate += ratesize; | 1144 | pRate += ratesize; |
1124 | memmove(pRate, (pcurrentptr + 2), bytestocopy); | 1145 | memmove(pRate, (pcurrentptr + 2), bytestocopy); |
1125 | } | 1146 | } |
@@ -1132,24 +1153,17 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry, | |||
1132 | if (memcmp(pIe->oui, oui01, sizeof(oui01))) | 1153 | if (memcmp(pIe->oui, oui01, sizeof(oui01))) |
1133 | break; | 1154 | break; |
1134 | 1155 | ||
1135 | pBSSEntry->wpa_ie_len = min_t(size_t, | 1156 | bss->wpa_ie_len = min(elemlen + IE_ID_LEN_FIELDS_BYTES, |
1136 | elemlen + IE_ID_LEN_FIELDS_BYTES, | 1157 | MAX_WPA_IE_LEN); |
1137 | sizeof(pBSSEntry->wpa_ie)); | 1158 | memcpy(bss->wpa_ie, pcurrentptr, bss->wpa_ie_len); |
1138 | memcpy(pBSSEntry->wpa_ie, pcurrentptr, | 1159 | lbs_dbg_hex("process_bss: WPA IE", bss->wpa_ie, elemlen); |
1139 | pBSSEntry->wpa_ie_len); | ||
1140 | lbs_dbg_hex("InterpretIE: Resp WPA_IE", | ||
1141 | pBSSEntry->wpa_ie, elemlen); | ||
1142 | break; | 1160 | break; |
1143 | case WPA2_IE: | 1161 | case WPA2_IE: |
1144 | pIe = (struct IE_WPA *)pcurrentptr; | 1162 | pIe = (struct IE_WPA *)pcurrentptr; |
1145 | 1163 | bss->rsn_ie_len = min(elemlen + IE_ID_LEN_FIELDS_BYTES, | |
1146 | pBSSEntry->rsn_ie_len = min_t(size_t, | 1164 | MAX_WPA_IE_LEN); |
1147 | elemlen + IE_ID_LEN_FIELDS_BYTES, | 1165 | memcpy(bss->rsn_ie, pcurrentptr, bss->rsn_ie_len); |
1148 | sizeof(pBSSEntry->rsn_ie)); | 1166 | lbs_dbg_hex("process_bss: RSN_IE", bss->rsn_ie, elemlen); |
1149 | memcpy(pBSSEntry->rsn_ie, pcurrentptr, | ||
1150 | pBSSEntry->rsn_ie_len); | ||
1151 | lbs_dbg_hex("InterpretIE: Resp WPA2_IE", | ||
1152 | pBSSEntry->rsn_ie, elemlen); | ||
1153 | break; | 1167 | break; |
1154 | case TIM: | 1168 | case TIM: |
1155 | break; | 1169 | break; |
@@ -1165,7 +1179,14 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry, | |||
1165 | 1179 | ||
1166 | } /* while (bytesleftforcurrentbeacon > 2) */ | 1180 | } /* while (bytesleftforcurrentbeacon > 2) */ |
1167 | 1181 | ||
1168 | return 0; | 1182 | /* Timestamp */ |
1183 | bss->last_scanned = jiffies; | ||
1184 | |||
1185 | ret = 0; | ||
1186 | |||
1187 | done: | ||
1188 | lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret); | ||
1189 | return ret; | ||
1169 | } | 1190 | } |
1170 | 1191 | ||
1171 | /** | 1192 | /** |
@@ -1176,15 +1197,12 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry, | |||
1176 | * | 1197 | * |
1177 | * @return 0--ssid is same, otherwise is different | 1198 | * @return 0--ssid is same, otherwise is different |
1178 | */ | 1199 | */ |
1179 | int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, struct WLAN_802_11_SSID *ssid2) | 1200 | int libertas_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len) |
1180 | { | 1201 | { |
1181 | if (!ssid1 || !ssid2) | 1202 | if (ssid1_len != ssid2_len) |
1182 | return -1; | ||
1183 | |||
1184 | if (ssid1->ssidlength != ssid2->ssidlength) | ||
1185 | return -1; | 1203 | return -1; |
1186 | 1204 | ||
1187 | return memcmp(ssid1->ssid, ssid2->ssid, ssid1->ssidlength); | 1205 | return memcmp(ssid1, ssid2, ssid1_len); |
1188 | } | 1206 | } |
1189 | 1207 | ||
1190 | /** | 1208 | /** |
@@ -1196,38 +1214,41 @@ int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, struct WLAN_802_11_SSID *s | |||
1196 | * | 1214 | * |
1197 | * @return index in BSSID list, or error return code (< 0) | 1215 | * @return index in BSSID list, or error return code (< 0) |
1198 | */ | 1216 | */ |
1199 | int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, u8 mode) | 1217 | struct bss_descriptor * libertas_find_bssid_in_list(wlan_adapter * adapter, |
1218 | u8 * bssid, u8 mode) | ||
1200 | { | 1219 | { |
1201 | int ret = -ENETUNREACH; | 1220 | struct bss_descriptor * iter_bss; |
1202 | int i; | 1221 | struct bss_descriptor * found_bss = NULL; |
1203 | 1222 | ||
1204 | if (!bssid) | 1223 | if (!bssid) |
1205 | return -EFAULT; | 1224 | return NULL; |
1206 | 1225 | ||
1207 | lbs_pr_debug(1, "FindBSSID: Num of BSSIDs = %d\n", | 1226 | lbs_dbg_hex("libertas_find_BSSID_in_list: looking for ", |
1208 | adapter->numinscantable); | 1227 | bssid, ETH_ALEN); |
1209 | 1228 | ||
1210 | /* Look through the scan table for a compatible match. The ret return | 1229 | /* Look through the scan table for a compatible match. The loop will |
1211 | * variable will be equal to the index in the scan table (greater | 1230 | * continue past a matched bssid that is not compatible in case there |
1212 | * than zero) if the network is compatible. The loop will continue | 1231 | * is an AP with multiple SSIDs assigned to the same BSSID |
1213 | * past a matched bssid that is not compatible in case there is an | ||
1214 | * AP with multiple SSIDs assigned to the same BSSID | ||
1215 | */ | 1232 | */ |
1216 | for (i = 0; ret < 0 && i < adapter->numinscantable; i++) { | 1233 | mutex_lock(&adapter->lock); |
1217 | if (!memcmp(adapter->scantable[i].macaddress, bssid, ETH_ALEN)) { | 1234 | list_for_each_entry (iter_bss, &adapter->network_list, list) { |
1218 | switch (mode) { | 1235 | if (compare_ether_addr(iter_bss->bssid, bssid)) |
1219 | case IW_MODE_INFRA: | 1236 | continue; /* bssid doesn't match */ |
1220 | case IW_MODE_ADHOC: | 1237 | switch (mode) { |
1221 | ret = is_network_compatible(adapter, i, mode); | 1238 | case IW_MODE_INFRA: |
1222 | break; | 1239 | case IW_MODE_ADHOC: |
1223 | default: | 1240 | if (!is_network_compatible(adapter, iter_bss, mode)) |
1224 | ret = i; | ||
1225 | break; | 1241 | break; |
1226 | } | 1242 | found_bss = iter_bss; |
1243 | break; | ||
1244 | default: | ||
1245 | found_bss = iter_bss; | ||
1246 | break; | ||
1227 | } | 1247 | } |
1228 | } | 1248 | } |
1249 | mutex_unlock(&adapter->lock); | ||
1229 | 1250 | ||
1230 | return ret; | 1251 | return found_bss; |
1231 | } | 1252 | } |
1232 | 1253 | ||
1233 | /** | 1254 | /** |
@@ -1240,61 +1261,60 @@ int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, u8 mode) | |||
1240 | * | 1261 | * |
1241 | * @return index in BSSID list | 1262 | * @return index in BSSID list |
1242 | */ | 1263 | */ |
1243 | int libertas_find_SSID_in_list(wlan_adapter * adapter, | 1264 | struct bss_descriptor * libertas_find_ssid_in_list(wlan_adapter * adapter, |
1244 | struct WLAN_802_11_SSID *ssid, u8 * bssid, u8 mode) | 1265 | u8 *ssid, u8 ssid_len, u8 * bssid, u8 mode, |
1266 | int channel) | ||
1245 | { | 1267 | { |
1246 | int net = -ENETUNREACH; | ||
1247 | u8 bestrssi = 0; | 1268 | u8 bestrssi = 0; |
1248 | int i; | 1269 | struct bss_descriptor * iter_bss = NULL; |
1249 | int j; | 1270 | struct bss_descriptor * found_bss = NULL; |
1271 | struct bss_descriptor * tmp_oldest = NULL; | ||
1250 | 1272 | ||
1251 | lbs_pr_debug(1, "Num of Entries in Table = %d\n", adapter->numinscantable); | 1273 | mutex_lock(&adapter->lock); |
1252 | 1274 | ||
1253 | for (i = 0; i < adapter->numinscantable; i++) { | 1275 | list_for_each_entry (iter_bss, &adapter->network_list, list) { |
1254 | if (!libertas_SSID_cmp(&adapter->scantable[i].ssid, ssid) && | 1276 | if ( !tmp_oldest |
1255 | (!bssid || | 1277 | || (iter_bss->last_scanned < tmp_oldest->last_scanned)) |
1256 | !memcmp(adapter->scantable[i]. | 1278 | tmp_oldest = iter_bss; |
1257 | macaddress, bssid, ETH_ALEN))) { | 1279 | |
1258 | switch (mode) { | 1280 | if (libertas_ssid_cmp(iter_bss->ssid, iter_bss->ssid_len, |
1259 | case IW_MODE_INFRA: | 1281 | ssid, ssid_len) != 0) |
1260 | case IW_MODE_ADHOC: | 1282 | continue; /* ssid doesn't match */ |
1261 | j = is_network_compatible(adapter, i, mode); | 1283 | if (bssid && compare_ether_addr(iter_bss->bssid, bssid) != 0) |
1262 | 1284 | continue; /* bssid doesn't match */ | |
1263 | if (j >= 0) { | 1285 | if ((channel > 0) && (iter_bss->channel != channel)) |
1264 | if (bssid) { | 1286 | continue; /* channel doesn't match */ |
1265 | return i; | 1287 | |
1266 | } | 1288 | switch (mode) { |
1267 | 1289 | case IW_MODE_INFRA: | |
1268 | if (SCAN_RSSI | 1290 | case IW_MODE_ADHOC: |
1269 | (adapter->scantable[i].rssi) | 1291 | if (!is_network_compatible(adapter, iter_bss, mode)) |
1270 | > bestrssi) { | ||
1271 | bestrssi = | ||
1272 | SCAN_RSSI(adapter-> | ||
1273 | scantable[i]. | ||
1274 | rssi); | ||
1275 | net = i; | ||
1276 | } | ||
1277 | } else { | ||
1278 | if (net == -ENETUNREACH) { | ||
1279 | net = j; | ||
1280 | } | ||
1281 | } | ||
1282 | break; | ||
1283 | case IW_MODE_AUTO: | ||
1284 | default: | ||
1285 | if (SCAN_RSSI(adapter->scantable[i].rssi) | ||
1286 | > bestrssi) { | ||
1287 | bestrssi = | ||
1288 | SCAN_RSSI(adapter->scantable[i]. | ||
1289 | rssi); | ||
1290 | net = i; | ||
1291 | } | ||
1292 | break; | 1292 | break; |
1293 | |||
1294 | if (bssid) { | ||
1295 | /* Found requested BSSID */ | ||
1296 | found_bss = iter_bss; | ||
1297 | goto out; | ||
1298 | } | ||
1299 | |||
1300 | if (SCAN_RSSI(iter_bss->rssi) > bestrssi) { | ||
1301 | bestrssi = SCAN_RSSI(iter_bss->rssi); | ||
1302 | found_bss = iter_bss; | ||
1293 | } | 1303 | } |
1304 | break; | ||
1305 | case IW_MODE_AUTO: | ||
1306 | default: | ||
1307 | if (SCAN_RSSI(iter_bss->rssi) > bestrssi) { | ||
1308 | bestrssi = SCAN_RSSI(iter_bss->rssi); | ||
1309 | found_bss = iter_bss; | ||
1310 | } | ||
1311 | break; | ||
1294 | } | 1312 | } |
1295 | } | 1313 | } |
1296 | 1314 | ||
1297 | return net; | 1315 | out: |
1316 | mutex_unlock(&adapter->lock); | ||
1317 | return found_bss; | ||
1298 | } | 1318 | } |
1299 | 1319 | ||
1300 | /** | 1320 | /** |
@@ -1307,43 +1327,38 @@ int libertas_find_SSID_in_list(wlan_adapter * adapter, | |||
1307 | * | 1327 | * |
1308 | * @return index in BSSID list | 1328 | * @return index in BSSID list |
1309 | */ | 1329 | */ |
1310 | int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode) | 1330 | struct bss_descriptor * libertas_find_best_ssid_in_list(wlan_adapter * adapter, |
1331 | u8 mode) | ||
1311 | { | 1332 | { |
1312 | int bestnet = -ENETUNREACH; | ||
1313 | u8 bestrssi = 0; | 1333 | u8 bestrssi = 0; |
1314 | int i; | 1334 | struct bss_descriptor * iter_bss; |
1335 | struct bss_descriptor * best_bss = NULL; | ||
1315 | 1336 | ||
1316 | ENTER(); | 1337 | mutex_lock(&adapter->lock); |
1317 | 1338 | ||
1318 | lbs_pr_debug(1, "Num of BSSIDs = %d\n", adapter->numinscantable); | 1339 | list_for_each_entry (iter_bss, &adapter->network_list, list) { |
1319 | |||
1320 | for (i = 0; i < adapter->numinscantable; i++) { | ||
1321 | switch (mode) { | 1340 | switch (mode) { |
1322 | case IW_MODE_INFRA: | 1341 | case IW_MODE_INFRA: |
1323 | case IW_MODE_ADHOC: | 1342 | case IW_MODE_ADHOC: |
1324 | if (is_network_compatible(adapter, i, mode) >= 0) { | 1343 | if (!is_network_compatible(adapter, iter_bss, mode)) |
1325 | if (SCAN_RSSI(adapter->scantable[i].rssi) > | 1344 | break; |
1326 | bestrssi) { | 1345 | if (SCAN_RSSI(iter_bss->rssi) <= bestrssi) |
1327 | bestrssi = | 1346 | break; |
1328 | SCAN_RSSI(adapter->scantable[i]. | 1347 | bestrssi = SCAN_RSSI(iter_bss->rssi); |
1329 | rssi); | 1348 | best_bss = iter_bss; |
1330 | bestnet = i; | ||
1331 | } | ||
1332 | } | ||
1333 | break; | 1349 | break; |
1334 | case IW_MODE_AUTO: | 1350 | case IW_MODE_AUTO: |
1335 | default: | 1351 | default: |
1336 | if (SCAN_RSSI(adapter->scantable[i].rssi) > bestrssi) { | 1352 | if (SCAN_RSSI(iter_bss->rssi) <= bestrssi) |
1337 | bestrssi = | 1353 | break; |
1338 | SCAN_RSSI(adapter->scantable[i].rssi); | 1354 | bestrssi = SCAN_RSSI(iter_bss->rssi); |
1339 | bestnet = i; | 1355 | best_bss = iter_bss; |
1340 | } | ||
1341 | break; | 1356 | break; |
1342 | } | 1357 | } |
1343 | } | 1358 | } |
1344 | 1359 | ||
1345 | LEAVE(); | 1360 | mutex_unlock(&adapter->lock); |
1346 | return bestnet; | 1361 | return best_bss; |
1347 | } | 1362 | } |
1348 | 1363 | ||
1349 | /** | 1364 | /** |
@@ -1354,41 +1369,30 @@ int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode) | |||
1354 | * | 1369 | * |
1355 | * @return 0--success, otherwise--fail | 1370 | * @return 0--success, otherwise--fail |
1356 | */ | 1371 | */ |
1357 | int libertas_find_best_network_SSID(wlan_private * priv, | 1372 | int libertas_find_best_network_ssid(wlan_private * priv, |
1358 | struct WLAN_802_11_SSID *pSSID, | 1373 | u8 *out_ssid, u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode) |
1359 | u8 preferred_mode, u8 *out_mode) | ||
1360 | { | 1374 | { |
1361 | wlan_adapter *adapter = priv->adapter; | 1375 | wlan_adapter *adapter = priv->adapter; |
1362 | int ret = 0; | 1376 | int ret = -1; |
1363 | struct bss_descriptor *preqbssid; | 1377 | struct bss_descriptor * found; |
1364 | int i; | ||
1365 | 1378 | ||
1366 | ENTER(); | 1379 | lbs_deb_enter(LBS_DEB_ASSOC); |
1367 | 1380 | ||
1368 | memset(pSSID, 0, sizeof(struct WLAN_802_11_SSID)); | 1381 | wlan_scan_networks(priv, NULL, 1); |
1369 | |||
1370 | wlan_scan_networks(priv, NULL); | ||
1371 | if (adapter->surpriseremoved) | 1382 | if (adapter->surpriseremoved) |
1372 | return -1; | 1383 | return -1; |
1373 | wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending); | ||
1374 | 1384 | ||
1375 | i = libertas_find_best_SSID_in_list(adapter, preferred_mode); | 1385 | wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending); |
1376 | if (i < 0) { | ||
1377 | ret = -1; | ||
1378 | goto out; | ||
1379 | } | ||
1380 | |||
1381 | preqbssid = &adapter->scantable[i]; | ||
1382 | memcpy(pSSID, &preqbssid->ssid, | ||
1383 | sizeof(struct WLAN_802_11_SSID)); | ||
1384 | *out_mode = preqbssid->mode; | ||
1385 | 1386 | ||
1386 | if (!pSSID->ssidlength) { | 1387 | found = libertas_find_best_ssid_in_list(adapter, preferred_mode); |
1387 | ret = -1; | 1388 | if (found && (found->ssid_len > 0)) { |
1389 | memcpy(out_ssid, &found->ssid, IW_ESSID_MAX_SIZE); | ||
1390 | *out_ssid_len = found->ssid_len; | ||
1391 | *out_mode = found->mode; | ||
1392 | ret = 0; | ||
1388 | } | 1393 | } |
1389 | 1394 | ||
1390 | out: | 1395 | lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret); |
1391 | LEAVE(); | ||
1392 | return ret; | 1396 | return ret; |
1393 | } | 1397 | } |
1394 | 1398 | ||
@@ -1407,20 +1411,15 @@ int libertas_set_scan(struct net_device *dev, struct iw_request_info *info, | |||
1407 | { | 1411 | { |
1408 | wlan_private *priv = dev->priv; | 1412 | wlan_private *priv = dev->priv; |
1409 | wlan_adapter *adapter = priv->adapter; | 1413 | wlan_adapter *adapter = priv->adapter; |
1410 | union iwreq_data wrqu; | ||
1411 | 1414 | ||
1412 | ENTER(); | 1415 | lbs_deb_enter(LBS_DEB_SCAN); |
1413 | 1416 | ||
1414 | if (!wlan_scan_networks(priv, NULL)) { | 1417 | wlan_scan_networks(priv, NULL, 0); |
1415 | memset(&wrqu, 0, sizeof(union iwreq_data)); | ||
1416 | wireless_send_event(priv->wlan_dev.netdev, SIOCGIWSCAN, &wrqu, | ||
1417 | NULL); | ||
1418 | } | ||
1419 | 1418 | ||
1420 | if (adapter->surpriseremoved) | 1419 | if (adapter->surpriseremoved) |
1421 | return -1; | 1420 | return -1; |
1422 | 1421 | ||
1423 | LEAVE(); | 1422 | lbs_deb_leave(LBS_DEB_SCAN); |
1424 | return 0; | 1423 | return 0; |
1425 | } | 1424 | } |
1426 | 1425 | ||
@@ -1433,32 +1432,31 @@ int libertas_set_scan(struct net_device *dev, struct iw_request_info *info, | |||
1433 | * | 1432 | * |
1434 | * @return 0-success, otherwise fail | 1433 | * @return 0-success, otherwise fail |
1435 | */ | 1434 | */ |
1436 | int libertas_send_specific_SSID_scan(wlan_private * priv, | 1435 | int libertas_send_specific_ssid_scan(wlan_private * priv, |
1437 | struct WLAN_802_11_SSID *prequestedssid, | 1436 | u8 *ssid, u8 ssid_len, u8 clear_ssid) |
1438 | u8 keeppreviousscan) | ||
1439 | { | 1437 | { |
1440 | wlan_adapter *adapter = priv->adapter; | 1438 | wlan_adapter *adapter = priv->adapter; |
1441 | struct wlan_ioctl_user_scan_cfg scancfg; | 1439 | struct wlan_ioctl_user_scan_cfg scancfg; |
1440 | int ret = 0; | ||
1442 | 1441 | ||
1443 | ENTER(); | 1442 | lbs_deb_enter(LBS_DEB_ASSOC); |
1444 | 1443 | ||
1445 | if (prequestedssid == NULL) { | 1444 | if (!ssid_len) |
1446 | return -1; | 1445 | goto out; |
1447 | } | ||
1448 | 1446 | ||
1449 | memset(&scancfg, 0x00, sizeof(scancfg)); | 1447 | memset(&scancfg, 0x00, sizeof(scancfg)); |
1448 | memcpy(scancfg.ssid, ssid, ssid_len); | ||
1449 | scancfg.ssid_len = ssid_len; | ||
1450 | scancfg.clear_ssid = clear_ssid; | ||
1450 | 1451 | ||
1451 | memcpy(scancfg.specificSSID, prequestedssid->ssid, | 1452 | wlan_scan_networks(priv, &scancfg, 1); |
1452 | prequestedssid->ssidlength); | ||
1453 | scancfg.keeppreviousscan = keeppreviousscan; | ||
1454 | |||
1455 | wlan_scan_networks(priv, &scancfg); | ||
1456 | if (adapter->surpriseremoved) | 1453 | if (adapter->surpriseremoved) |
1457 | return -1; | 1454 | return -1; |
1458 | wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending); | 1455 | wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending); |
1459 | 1456 | ||
1460 | LEAVE(); | 1457 | out: |
1461 | return 0; | 1458 | lbs_deb_leave(LBS_DEB_ASSOC); |
1459 | return ret; | ||
1462 | } | 1460 | } |
1463 | 1461 | ||
1464 | /** | 1462 | /** |
@@ -1470,304 +1468,235 @@ int libertas_send_specific_SSID_scan(wlan_private * priv, | |||
1470 | * | 1468 | * |
1471 | * @return 0-success, otherwise fail | 1469 | * @return 0-success, otherwise fail |
1472 | */ | 1470 | */ |
1473 | int libertas_send_specific_BSSID_scan(wlan_private * priv, u8 * bssid, u8 keeppreviousscan) | 1471 | int libertas_send_specific_bssid_scan(wlan_private * priv, u8 * bssid, u8 clear_bssid) |
1474 | { | 1472 | { |
1475 | struct wlan_ioctl_user_scan_cfg scancfg; | 1473 | struct wlan_ioctl_user_scan_cfg scancfg; |
1476 | 1474 | ||
1477 | ENTER(); | 1475 | lbs_deb_enter(LBS_DEB_ASSOC); |
1478 | 1476 | ||
1479 | if (bssid == NULL) { | 1477 | if (bssid == NULL) |
1480 | return -1; | 1478 | goto out; |
1481 | } | ||
1482 | 1479 | ||
1483 | memset(&scancfg, 0x00, sizeof(scancfg)); | 1480 | memset(&scancfg, 0x00, sizeof(scancfg)); |
1484 | memcpy(scancfg.specificBSSID, bssid, sizeof(scancfg.specificBSSID)); | 1481 | memcpy(scancfg.bssid, bssid, ETH_ALEN); |
1485 | scancfg.keeppreviousscan = keeppreviousscan; | 1482 | scancfg.clear_bssid = clear_bssid; |
1486 | 1483 | ||
1487 | wlan_scan_networks(priv, &scancfg); | 1484 | wlan_scan_networks(priv, &scancfg, 1); |
1488 | if (priv->adapter->surpriseremoved) | 1485 | if (priv->adapter->surpriseremoved) |
1489 | return -1; | 1486 | return -1; |
1490 | wait_event_interruptible(priv->adapter->cmd_pending, | 1487 | wait_event_interruptible(priv->adapter->cmd_pending, |
1491 | !priv->adapter->nr_cmd_pending); | 1488 | !priv->adapter->nr_cmd_pending); |
1492 | 1489 | ||
1493 | LEAVE(); | 1490 | out: |
1491 | lbs_deb_leave(LBS_DEB_ASSOC); | ||
1494 | return 0; | 1492 | return 0; |
1495 | } | 1493 | } |
1496 | 1494 | ||
1497 | /** | 1495 | static inline char *libertas_translate_scan(wlan_private *priv, |
1498 | * @brief Retrieve the scan table entries via wireless tools IOCTL call | 1496 | char *start, char *stop, |
1499 | * | 1497 | struct bss_descriptor *bss) |
1500 | * @param dev A pointer to net_device structure | ||
1501 | * @param info A pointer to iw_request_info structure | ||
1502 | * @param dwrq A pointer to iw_point structure | ||
1503 | * @param extra A pointer to extra data buf | ||
1504 | * | ||
1505 | * @return 0 --success, otherwise fail | ||
1506 | */ | ||
1507 | int libertas_get_scan(struct net_device *dev, struct iw_request_info *info, | ||
1508 | struct iw_point *dwrq, char *extra) | ||
1509 | { | 1498 | { |
1510 | wlan_private *priv = dev->priv; | ||
1511 | wlan_adapter *adapter = priv->adapter; | 1499 | wlan_adapter *adapter = priv->adapter; |
1512 | int ret = 0; | ||
1513 | char *current_ev = extra; | ||
1514 | char *end_buf = extra + IW_SCAN_MAX_DATA; | ||
1515 | struct chan_freq_power *cfp; | 1500 | struct chan_freq_power *cfp; |
1516 | struct bss_descriptor *pscantable; | ||
1517 | char *current_val; /* For rates */ | 1501 | char *current_val; /* For rates */ |
1518 | struct iw_event iwe; /* Temporary buffer */ | 1502 | struct iw_event iwe; /* Temporary buffer */ |
1519 | int i; | ||
1520 | int j; | 1503 | int j; |
1521 | int rate; | ||
1522 | #define PERFECT_RSSI ((u8)50) | 1504 | #define PERFECT_RSSI ((u8)50) |
1523 | #define WORST_RSSI ((u8)0) | 1505 | #define WORST_RSSI ((u8)0) |
1524 | #define RSSI_DIFF ((u8)(PERFECT_RSSI - WORST_RSSI)) | 1506 | #define RSSI_DIFF ((u8)(PERFECT_RSSI - WORST_RSSI)) |
1525 | u8 rssi; | 1507 | u8 rssi; |
1526 | 1508 | ||
1527 | u8 buf[16 + 256 * 2]; | 1509 | cfp = libertas_find_cfp_by_band_and_channel(adapter, 0, bss->channel); |
1528 | u8 *ptr; | 1510 | if (!cfp) { |
1529 | 1511 | lbs_deb_scan("Invalid channel number %d\n", bss->channel); | |
1530 | ENTER(); | 1512 | return NULL; |
1531 | 1513 | } | |
1532 | /* | ||
1533 | * if there's either commands in the queue or one being | ||
1534 | * processed return -EAGAIN for iwlist to retry later. | ||
1535 | */ | ||
1536 | if (adapter->nr_cmd_pending) | ||
1537 | return -EAGAIN; | ||
1538 | |||
1539 | if (adapter->connect_status == libertas_connected) | ||
1540 | lbs_pr_debug(1, "Current ssid: %32s\n", | ||
1541 | adapter->curbssparams.ssid.ssid); | ||
1542 | 1514 | ||
1543 | lbs_pr_debug(1, "Scan: Get: numinscantable = %d\n", | 1515 | /* First entry *MUST* be the AP BSSID */ |
1544 | adapter->numinscantable); | 1516 | iwe.cmd = SIOCGIWAP; |
1517 | iwe.u.ap_addr.sa_family = ARPHRD_ETHER; | ||
1518 | memcpy(iwe.u.ap_addr.sa_data, &bss->bssid, ETH_ALEN); | ||
1519 | start = iwe_stream_add_event(start, stop, &iwe, IW_EV_ADDR_LEN); | ||
1520 | |||
1521 | /* SSID */ | ||
1522 | iwe.cmd = SIOCGIWESSID; | ||
1523 | iwe.u.data.flags = 1; | ||
1524 | iwe.u.data.length = min((u32) bss->ssid_len, (u32) IW_ESSID_MAX_SIZE); | ||
1525 | start = iwe_stream_add_point(start, stop, &iwe, bss->ssid); | ||
1526 | |||
1527 | /* Mode */ | ||
1528 | iwe.cmd = SIOCGIWMODE; | ||
1529 | iwe.u.mode = bss->mode; | ||
1530 | start = iwe_stream_add_event(start, stop, &iwe, IW_EV_UINT_LEN); | ||
1531 | |||
1532 | /* Frequency */ | ||
1533 | iwe.cmd = SIOCGIWFREQ; | ||
1534 | iwe.u.freq.m = (long)cfp->freq * 100000; | ||
1535 | iwe.u.freq.e = 1; | ||
1536 | start = iwe_stream_add_event(start, stop, &iwe, IW_EV_FREQ_LEN); | ||
1537 | |||
1538 | /* Add quality statistics */ | ||
1539 | iwe.cmd = IWEVQUAL; | ||
1540 | iwe.u.qual.updated = IW_QUAL_ALL_UPDATED; | ||
1541 | iwe.u.qual.level = SCAN_RSSI(bss->rssi); | ||
1542 | |||
1543 | rssi = iwe.u.qual.level - MRVDRV_NF_DEFAULT_SCAN_VALUE; | ||
1544 | iwe.u.qual.qual = | ||
1545 | (100 * RSSI_DIFF * RSSI_DIFF - (PERFECT_RSSI - rssi) * | ||
1546 | (15 * (RSSI_DIFF) + 62 * (PERFECT_RSSI - rssi))) / | ||
1547 | (RSSI_DIFF * RSSI_DIFF); | ||
1548 | if (iwe.u.qual.qual > 100) | ||
1549 | iwe.u.qual.qual = 100; | ||
1550 | |||
1551 | if (adapter->NF[TYPE_BEACON][TYPE_NOAVG] == 0) { | ||
1552 | iwe.u.qual.noise = MRVDRV_NF_DEFAULT_SCAN_VALUE; | ||
1553 | } else { | ||
1554 | iwe.u.qual.noise = | ||
1555 | CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]); | ||
1556 | } | ||
1545 | 1557 | ||
1546 | /* The old API using SIOCGIWAPLIST had a hard limit of IW_MAX_AP. | 1558 | /* Locally created ad-hoc BSSs won't have beacons if this is the |
1547 | * The new API using SIOCGIWSCAN is only limited by buffer size | 1559 | * only station in the adhoc network; so get signal strength |
1548 | * WE-14 -> WE-16 the buffer is limited to IW_SCAN_MAX_DATA bytes | 1560 | * from receive statistics. |
1549 | * which is 4096. | ||
1550 | */ | 1561 | */ |
1551 | for (i = 0; i < adapter->numinscantable; i++) { | 1562 | if ((adapter->mode == IW_MODE_ADHOC) |
1552 | if ((current_ev + MAX_SCAN_CELL_SIZE) >= end_buf) { | 1563 | && adapter->adhoccreate |
1553 | lbs_pr_debug(1, "i=%d break out: current_ev=%p end_buf=%p " | 1564 | && !libertas_ssid_cmp(adapter->curbssparams.ssid, |
1554 | "MAX_SCAN_CELL_SIZE=%zd\n", | 1565 | adapter->curbssparams.ssid_len, |
1555 | i, current_ev, end_buf, MAX_SCAN_CELL_SIZE); | 1566 | bss->ssid, bss->ssid_len)) { |
1556 | break; | 1567 | int snr, nf; |
1557 | } | 1568 | snr = adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE; |
1558 | 1569 | nf = adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE; | |
1559 | pscantable = &adapter->scantable[i]; | 1570 | iwe.u.qual.level = CAL_RSSI(snr, nf); |
1560 | 1571 | } | |
1561 | lbs_pr_debug(1, "i=%d ssid: %32s\n", i, pscantable->ssid.ssid); | 1572 | start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN); |
1562 | |||
1563 | cfp = | ||
1564 | libertas_find_cfp_by_band_and_channel(adapter, 0, | ||
1565 | pscantable->channel); | ||
1566 | if (!cfp) { | ||
1567 | lbs_pr_debug(1, "Invalid channel number %d\n", | ||
1568 | pscantable->channel); | ||
1569 | continue; | ||
1570 | } | ||
1571 | |||
1572 | if (!ssid_valid(&adapter->scantable[i].ssid)) { | ||
1573 | continue; | ||
1574 | } | ||
1575 | |||
1576 | /* First entry *MUST* be the AP MAC address */ | ||
1577 | iwe.cmd = SIOCGIWAP; | ||
1578 | iwe.u.ap_addr.sa_family = ARPHRD_ETHER; | ||
1579 | memcpy(iwe.u.ap_addr.sa_data, | ||
1580 | &adapter->scantable[i].macaddress, ETH_ALEN); | ||
1581 | |||
1582 | iwe.len = IW_EV_ADDR_LEN; | ||
1583 | current_ev = | ||
1584 | iwe_stream_add_event(current_ev, end_buf, &iwe, iwe.len); | ||
1585 | |||
1586 | //Add the ESSID | ||
1587 | iwe.u.data.length = adapter->scantable[i].ssid.ssidlength; | ||
1588 | |||
1589 | if (iwe.u.data.length > 32) { | ||
1590 | iwe.u.data.length = 32; | ||
1591 | } | ||
1592 | |||
1593 | iwe.cmd = SIOCGIWESSID; | ||
1594 | iwe.u.data.flags = 1; | ||
1595 | iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; | ||
1596 | current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, | ||
1597 | adapter->scantable[i].ssid. | ||
1598 | ssid); | ||
1599 | |||
1600 | //Add mode | ||
1601 | iwe.cmd = SIOCGIWMODE; | ||
1602 | iwe.u.mode = adapter->scantable[i].mode; | ||
1603 | iwe.len = IW_EV_UINT_LEN; | ||
1604 | current_ev = | ||
1605 | iwe_stream_add_event(current_ev, end_buf, &iwe, iwe.len); | ||
1606 | |||
1607 | //frequency | ||
1608 | iwe.cmd = SIOCGIWFREQ; | ||
1609 | iwe.u.freq.m = (long)cfp->freq * 100000; | ||
1610 | iwe.u.freq.e = 1; | ||
1611 | iwe.len = IW_EV_FREQ_LEN; | ||
1612 | current_ev = | ||
1613 | iwe_stream_add_event(current_ev, end_buf, &iwe, iwe.len); | ||
1614 | |||
1615 | /* Add quality statistics */ | ||
1616 | iwe.cmd = IWEVQUAL; | ||
1617 | iwe.u.qual.updated = IW_QUAL_ALL_UPDATED; | ||
1618 | iwe.u.qual.level = SCAN_RSSI(adapter->scantable[i].rssi); | ||
1619 | |||
1620 | rssi = iwe.u.qual.level - MRVDRV_NF_DEFAULT_SCAN_VALUE; | ||
1621 | iwe.u.qual.qual = | ||
1622 | (100 * RSSI_DIFF * RSSI_DIFF - (PERFECT_RSSI - rssi) * | ||
1623 | (15 * (RSSI_DIFF) + 62 * (PERFECT_RSSI - rssi))) / | ||
1624 | (RSSI_DIFF * RSSI_DIFF); | ||
1625 | if (iwe.u.qual.qual > 100) | ||
1626 | iwe.u.qual.qual = 100; | ||
1627 | else if (iwe.u.qual.qual < 1) | ||
1628 | iwe.u.qual.qual = 0; | ||
1629 | |||
1630 | if (adapter->NF[TYPE_BEACON][TYPE_NOAVG] == 0) { | ||
1631 | iwe.u.qual.noise = MRVDRV_NF_DEFAULT_SCAN_VALUE; | ||
1632 | } else { | ||
1633 | iwe.u.qual.noise = | ||
1634 | CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]); | ||
1635 | } | ||
1636 | if ((adapter->mode == IW_MODE_ADHOC) && | ||
1637 | !libertas_SSID_cmp(&adapter->curbssparams.ssid, | ||
1638 | &adapter->scantable[i].ssid) | ||
1639 | && adapter->adhoccreate) { | ||
1640 | ret = libertas_prepare_and_send_command(priv, | ||
1641 | cmd_802_11_rssi, | ||
1642 | 0, | ||
1643 | cmd_option_waitforrsp, | ||
1644 | 0, NULL); | ||
1645 | |||
1646 | if (!ret) { | ||
1647 | iwe.u.qual.level = | ||
1648 | CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_AVG] / | ||
1649 | AVG_SCALE, | ||
1650 | adapter->NF[TYPE_RXPD][TYPE_AVG] / | ||
1651 | AVG_SCALE); | ||
1652 | } | ||
1653 | } | ||
1654 | iwe.len = IW_EV_QUAL_LEN; | ||
1655 | current_ev = | ||
1656 | iwe_stream_add_event(current_ev, end_buf, &iwe, iwe.len); | ||
1657 | |||
1658 | /* Add encryption capability */ | ||
1659 | iwe.cmd = SIOCGIWENCODE; | ||
1660 | if (adapter->scantable[i].privacy) { | ||
1661 | iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; | ||
1662 | } else { | ||
1663 | iwe.u.data.flags = IW_ENCODE_DISABLED; | ||
1664 | } | ||
1665 | iwe.u.data.length = 0; | ||
1666 | iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; | ||
1667 | current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, | ||
1668 | adapter->scantable->ssid. | ||
1669 | ssid); | ||
1670 | 1573 | ||
1671 | current_val = current_ev + IW_EV_LCP_LEN; | 1574 | /* Add encryption capability */ |
1575 | iwe.cmd = SIOCGIWENCODE; | ||
1576 | if (bss->privacy) { | ||
1577 | iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; | ||
1578 | } else { | ||
1579 | iwe.u.data.flags = IW_ENCODE_DISABLED; | ||
1580 | } | ||
1581 | iwe.u.data.length = 0; | ||
1582 | start = iwe_stream_add_point(start, stop, &iwe, bss->ssid); | ||
1672 | 1583 | ||
1673 | iwe.cmd = SIOCGIWRATE; | 1584 | current_val = start + IW_EV_LCP_LEN; |
1674 | 1585 | ||
1675 | iwe.u.bitrate.fixed = 0; | 1586 | iwe.cmd = SIOCGIWRATE; |
1676 | iwe.u.bitrate.disabled = 0; | 1587 | iwe.u.bitrate.fixed = 0; |
1677 | iwe.u.bitrate.value = 0; | 1588 | iwe.u.bitrate.disabled = 0; |
1589 | iwe.u.bitrate.value = 0; | ||
1678 | 1590 | ||
1591 | for (j = 0; j < sizeof(bss->libertas_supported_rates); j++) { | ||
1592 | u8 rate = bss->libertas_supported_rates[j]; | ||
1593 | if (rate == 0) | ||
1594 | break; /* no more rates */ | ||
1679 | /* Bit rate given in 500 kb/s units (+ 0x80) */ | 1595 | /* Bit rate given in 500 kb/s units (+ 0x80) */ |
1680 | for (j = 0; j < sizeof(adapter->scantable[i].libertas_supported_rates); | 1596 | iwe.u.bitrate.value = (rate & 0x7f) * 500000; |
1681 | j++) { | 1597 | current_val = iwe_stream_add_value(start, current_val, |
1682 | if (adapter->scantable[i].libertas_supported_rates[j] == 0) { | 1598 | stop, &iwe, IW_EV_PARAM_LEN); |
1683 | break; | 1599 | } |
1684 | } | 1600 | if ((bss->mode == IW_MODE_ADHOC) |
1685 | rate = | 1601 | && !libertas_ssid_cmp(adapter->curbssparams.ssid, |
1686 | (adapter->scantable[i].libertas_supported_rates[j] & 0x7F) * | 1602 | adapter->curbssparams.ssid_len, |
1687 | 500000; | 1603 | bss->ssid, bss->ssid_len) |
1688 | if (rate > iwe.u.bitrate.value) { | 1604 | && adapter->adhoccreate) { |
1689 | iwe.u.bitrate.value = rate; | 1605 | iwe.u.bitrate.value = 22 * 500000; |
1690 | } | 1606 | current_val = iwe_stream_add_value(start, current_val, |
1691 | 1607 | stop, &iwe, IW_EV_PARAM_LEN); | |
1692 | iwe.u.bitrate.value = | 1608 | } |
1693 | (adapter->scantable[i].libertas_supported_rates[j] | 1609 | /* Check if we added any event */ |
1694 | & 0x7f) * 500000; | 1610 | if((current_val - start) > IW_EV_LCP_LEN) |
1695 | iwe.len = IW_EV_PARAM_LEN; | 1611 | start = current_val; |
1696 | current_ev = | 1612 | |
1697 | iwe_stream_add_value(current_ev, current_val, | 1613 | memset(&iwe, 0, sizeof(iwe)); |
1698 | end_buf, &iwe, iwe.len); | 1614 | if (bss->wpa_ie_len) { |
1615 | char buf[MAX_WPA_IE_LEN]; | ||
1616 | memcpy(buf, bss->wpa_ie, bss->wpa_ie_len); | ||
1617 | iwe.cmd = IWEVGENIE; | ||
1618 | iwe.u.data.length = bss->wpa_ie_len; | ||
1619 | start = iwe_stream_add_point(start, stop, &iwe, buf); | ||
1620 | } | ||
1699 | 1621 | ||
1700 | } | 1622 | memset(&iwe, 0, sizeof(iwe)); |
1701 | if ((adapter->scantable[i].mode == IW_MODE_ADHOC) | 1623 | if (bss->rsn_ie_len) { |
1702 | && !libertas_SSID_cmp(&adapter->curbssparams.ssid, | 1624 | char buf[MAX_WPA_IE_LEN]; |
1703 | &adapter->scantable[i].ssid) | 1625 | memcpy(buf, bss->rsn_ie, bss->rsn_ie_len); |
1704 | && adapter->adhoccreate) { | 1626 | iwe.cmd = IWEVGENIE; |
1705 | iwe.u.bitrate.value = 22 * 500000; | 1627 | iwe.u.data.length = bss->rsn_ie_len; |
1706 | } | 1628 | start = iwe_stream_add_point(start, stop, &iwe, buf); |
1707 | iwe.len = IW_EV_PARAM_LEN; | 1629 | } |
1708 | current_ev = | ||
1709 | iwe_stream_add_value(current_ev, current_val, end_buf, &iwe, | ||
1710 | iwe.len); | ||
1711 | |||
1712 | /* Add new value to event */ | ||
1713 | current_val = current_ev + IW_EV_LCP_LEN; | ||
1714 | |||
1715 | if (adapter->scantable[i].rsn_ie[0] == WPA2_IE) { | ||
1716 | memset(&iwe, 0, sizeof(iwe)); | ||
1717 | memset(buf, 0, sizeof(buf)); | ||
1718 | memcpy(buf, adapter->scantable[i].rsn_ie, | ||
1719 | adapter->scantable[i].rsn_ie_len); | ||
1720 | iwe.cmd = IWEVGENIE; | ||
1721 | iwe.u.data.length = adapter->scantable[i].rsn_ie_len; | ||
1722 | iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; | ||
1723 | current_ev = iwe_stream_add_point(current_ev, end_buf, | ||
1724 | &iwe, buf); | ||
1725 | } | ||
1726 | if (adapter->scantable[i].wpa_ie[0] == WPA_IE) { | ||
1727 | memset(&iwe, 0, sizeof(iwe)); | ||
1728 | memset(buf, 0, sizeof(buf)); | ||
1729 | memcpy(buf, adapter->scantable[i].wpa_ie, | ||
1730 | adapter->scantable[i].wpa_ie_len); | ||
1731 | iwe.cmd = IWEVGENIE; | ||
1732 | iwe.u.data.length = adapter->scantable[i].wpa_ie_len; | ||
1733 | iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; | ||
1734 | current_ev = iwe_stream_add_point(current_ev, end_buf, | ||
1735 | &iwe, buf); | ||
1736 | } | ||
1737 | 1630 | ||
1631 | return start; | ||
1632 | } | ||
1738 | 1633 | ||
1739 | if (adapter->scantable[i].extra_ie != 0) { | 1634 | /** |
1740 | memset(&iwe, 0, sizeof(iwe)); | 1635 | * @brief Retrieve the scan table entries via wireless tools IOCTL call |
1741 | memset(buf, 0, sizeof(buf)); | 1636 | * |
1742 | ptr = buf; | 1637 | * @param dev A pointer to net_device structure |
1743 | ptr += sprintf(ptr, "extra_ie"); | 1638 | * @param info A pointer to iw_request_info structure |
1744 | iwe.u.data.length = strlen(buf); | 1639 | * @param dwrq A pointer to iw_point structure |
1640 | * @param extra A pointer to extra data buf | ||
1641 | * | ||
1642 | * @return 0 --success, otherwise fail | ||
1643 | */ | ||
1644 | int libertas_get_scan(struct net_device *dev, struct iw_request_info *info, | ||
1645 | struct iw_point *dwrq, char *extra) | ||
1646 | { | ||
1647 | #define SCAN_ITEM_SIZE 128 | ||
1648 | wlan_private *priv = dev->priv; | ||
1649 | wlan_adapter *adapter = priv->adapter; | ||
1650 | int err = 0; | ||
1651 | char *ev = extra; | ||
1652 | char *stop = ev + dwrq->length; | ||
1653 | struct bss_descriptor * iter_bss; | ||
1654 | struct bss_descriptor * safe; | ||
1655 | |||
1656 | lbs_deb_enter(LBS_DEB_ASSOC); | ||
1657 | |||
1658 | /* If we've got an uncompleted scan, schedule the next part */ | ||
1659 | if (!adapter->nr_cmd_pending && adapter->last_scanned_channel) | ||
1660 | wlan_scan_networks(priv, NULL, 0); | ||
1661 | |||
1662 | /* Update RSSI if current BSS is a locally created ad-hoc BSS */ | ||
1663 | if ((adapter->mode == IW_MODE_ADHOC) && adapter->adhoccreate) { | ||
1664 | libertas_prepare_and_send_command(priv, cmd_802_11_rssi, 0, | ||
1665 | cmd_option_waitforrsp, 0, NULL); | ||
1666 | } | ||
1745 | 1667 | ||
1746 | lbs_pr_debug(1, "iwe.u.data.length %d\n", | 1668 | mutex_lock(&adapter->lock); |
1747 | iwe.u.data.length); | 1669 | list_for_each_entry_safe (iter_bss, safe, &adapter->network_list, list) { |
1748 | lbs_pr_debug(1, "BUF: %s \n", buf); | 1670 | char * next_ev; |
1671 | unsigned long stale_time; | ||
1749 | 1672 | ||
1750 | iwe.cmd = IWEVCUSTOM; | 1673 | if (stop - ev < SCAN_ITEM_SIZE) { |
1751 | iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; | 1674 | err = -E2BIG; |
1752 | current_ev = | 1675 | break; |
1753 | iwe_stream_add_point(current_ev, end_buf, &iwe, | ||
1754 | buf); | ||
1755 | } | 1676 | } |
1756 | 1677 | ||
1757 | current_val = current_ev + IW_EV_LCP_LEN; | 1678 | /* Prune old an old scan result */ |
1679 | stale_time = iter_bss->last_scanned + DEFAULT_MAX_SCAN_AGE; | ||
1680 | if (time_after(jiffies, stale_time)) { | ||
1681 | list_move_tail (&iter_bss->list, | ||
1682 | &adapter->network_free_list); | ||
1683 | clear_bss_descriptor(iter_bss); | ||
1684 | continue; | ||
1685 | } | ||
1758 | 1686 | ||
1759 | /* | 1687 | /* Translate to WE format this entry */ |
1760 | * Check if we added any event | 1688 | next_ev = libertas_translate_scan(priv, ev, stop, iter_bss); |
1761 | */ | 1689 | if (next_ev == NULL) |
1762 | if ((current_val - current_ev) > IW_EV_LCP_LEN) | 1690 | continue; |
1763 | current_ev = current_val; | 1691 | ev = next_ev; |
1764 | } | 1692 | } |
1693 | mutex_unlock(&adapter->lock); | ||
1765 | 1694 | ||
1766 | dwrq->length = (current_ev - extra); | 1695 | dwrq->length = (ev - extra); |
1767 | dwrq->flags = 0; | 1696 | dwrq->flags = 0; |
1768 | 1697 | ||
1769 | LEAVE(); | 1698 | lbs_deb_leave(LBS_DEB_ASSOC); |
1770 | return 0; | 1699 | return err; |
1771 | } | 1700 | } |
1772 | 1701 | ||
1773 | /** | 1702 | /** |
@@ -1796,13 +1725,13 @@ int libertas_cmd_80211_scan(wlan_private * priv, | |||
1796 | struct cmd_ds_802_11_scan *pscan = &cmd->params.scan; | 1725 | struct cmd_ds_802_11_scan *pscan = &cmd->params.scan; |
1797 | struct wlan_scan_cmd_config *pscancfg; | 1726 | struct wlan_scan_cmd_config *pscancfg; |
1798 | 1727 | ||
1799 | ENTER(); | 1728 | lbs_deb_enter(LBS_DEB_ASSOC); |
1800 | 1729 | ||
1801 | pscancfg = pdata_buf; | 1730 | pscancfg = pdata_buf; |
1802 | 1731 | ||
1803 | /* Set fixed field variables in scan command */ | 1732 | /* Set fixed field variables in scan command */ |
1804 | pscan->bsstype = pscancfg->bsstype; | 1733 | pscan->bsstype = pscancfg->bsstype; |
1805 | memcpy(pscan->BSSID, pscancfg->specificBSSID, sizeof(pscan->BSSID)); | 1734 | memcpy(pscan->BSSID, pscancfg->bssid, sizeof(pscan->BSSID)); |
1806 | memcpy(pscan->tlvbuffer, pscancfg->tlvbuffer, pscancfg->tlvbufferlen); | 1735 | memcpy(pscan->tlvbuffer, pscancfg->tlvbuffer, pscancfg->tlvbufferlen); |
1807 | 1736 | ||
1808 | cmd->command = cpu_to_le16(cmd_802_11_scan); | 1737 | cmd->command = cpu_to_le16(cmd_802_11_scan); |
@@ -1812,12 +1741,26 @@ int libertas_cmd_80211_scan(wlan_private * priv, | |||
1812 | + sizeof(pscan->BSSID) | 1741 | + sizeof(pscan->BSSID) |
1813 | + pscancfg->tlvbufferlen + S_DS_GEN); | 1742 | + pscancfg->tlvbufferlen + S_DS_GEN); |
1814 | 1743 | ||
1815 | lbs_pr_debug(1, "SCAN_CMD: command=%x, size=%x, seqnum=%x\n", | 1744 | lbs_deb_scan("SCAN_CMD: command=%x, size=%x, seqnum=%x\n", |
1816 | cmd->command, cmd->size, cmd->seqnum); | 1745 | le16_to_cpu(cmd->command), le16_to_cpu(cmd->size), |
1817 | LEAVE(); | 1746 | le16_to_cpu(cmd->seqnum)); |
1747 | |||
1748 | lbs_deb_leave(LBS_DEB_ASSOC); | ||
1818 | return 0; | 1749 | return 0; |
1819 | } | 1750 | } |
1820 | 1751 | ||
1752 | static inline int is_same_network(struct bss_descriptor *src, | ||
1753 | struct bss_descriptor *dst) | ||
1754 | { | ||
1755 | /* A network is only a duplicate if the channel, BSSID, and ESSID | ||
1756 | * all match. We treat all <hidden> with the same BSSID and channel | ||
1757 | * as one network */ | ||
1758 | return ((src->ssid_len == dst->ssid_len) && | ||
1759 | (src->channel == dst->channel) && | ||
1760 | !compare_ether_addr(src->bssid, dst->bssid) && | ||
1761 | !memcmp(src->ssid, dst->ssid, src->ssid_len)); | ||
1762 | } | ||
1763 | |||
1821 | /** | 1764 | /** |
1822 | * @brief This function handles the command response of scan | 1765 | * @brief This function handles the command response of scan |
1823 | * | 1766 | * |
@@ -1846,38 +1789,45 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp) | |||
1846 | { | 1789 | { |
1847 | wlan_adapter *adapter = priv->adapter; | 1790 | wlan_adapter *adapter = priv->adapter; |
1848 | struct cmd_ds_802_11_scan_rsp *pscan; | 1791 | struct cmd_ds_802_11_scan_rsp *pscan; |
1849 | struct bss_descriptor newbssentry; | ||
1850 | struct mrvlietypes_data *ptlv; | 1792 | struct mrvlietypes_data *ptlv; |
1851 | struct mrvlietypes_tsftimestamp *ptsftlv; | 1793 | struct mrvlietypes_tsftimestamp *ptsftlv; |
1794 | struct bss_descriptor * iter_bss; | ||
1795 | struct bss_descriptor * safe; | ||
1852 | u8 *pbssinfo; | 1796 | u8 *pbssinfo; |
1853 | u16 scanrespsize; | 1797 | u16 scanrespsize; |
1854 | int bytesleft; | 1798 | int bytesleft; |
1855 | int numintable; | ||
1856 | int bssIdx; | ||
1857 | int idx; | 1799 | int idx; |
1858 | int tlvbufsize; | 1800 | int tlvbufsize; |
1859 | u64 tsfval; | 1801 | int ret; |
1860 | 1802 | ||
1861 | ENTER(); | 1803 | lbs_deb_enter(LBS_DEB_ASSOC); |
1804 | |||
1805 | /* Prune old entries from scan table */ | ||
1806 | list_for_each_entry_safe (iter_bss, safe, &adapter->network_list, list) { | ||
1807 | unsigned long stale_time = iter_bss->last_scanned + DEFAULT_MAX_SCAN_AGE; | ||
1808 | if (time_before(jiffies, stale_time)) | ||
1809 | continue; | ||
1810 | list_move_tail (&iter_bss->list, &adapter->network_free_list); | ||
1811 | clear_bss_descriptor(iter_bss); | ||
1812 | } | ||
1862 | 1813 | ||
1863 | pscan = &resp->params.scanresp; | 1814 | pscan = &resp->params.scanresp; |
1864 | 1815 | ||
1865 | if (pscan->nr_sets > MRVDRV_MAX_BSSID_LIST) { | 1816 | if (pscan->nr_sets > MAX_NETWORK_COUNT) { |
1866 | lbs_pr_debug(1, | 1817 | lbs_deb_scan( |
1867 | "SCAN_RESP: Invalid number of AP returned (%d)!!\n", | 1818 | "SCAN_RESP: too many scan results (%d, max %d)!!\n", |
1868 | pscan->nr_sets); | 1819 | pscan->nr_sets, MAX_NETWORK_COUNT); |
1869 | LEAVE(); | 1820 | ret = -1; |
1870 | return -1; | 1821 | goto done; |
1871 | } | 1822 | } |
1872 | 1823 | ||
1873 | bytesleft = le16_to_cpu(pscan->bssdescriptsize); | 1824 | bytesleft = le16_to_cpu(pscan->bssdescriptsize); |
1874 | lbs_pr_debug(1, "SCAN_RESP: bssdescriptsize %d\n", bytesleft); | 1825 | lbs_deb_scan("SCAN_RESP: bssdescriptsize %d\n", bytesleft); |
1875 | 1826 | ||
1876 | scanrespsize = le16_to_cpu(resp->size); | 1827 | scanrespsize = le16_to_cpu(resp->size); |
1877 | lbs_pr_debug(1, "SCAN_RESP: returned %d AP before parsing\n", | 1828 | lbs_deb_scan("SCAN_RESP: returned %d AP before parsing\n", |
1878 | pscan->nr_sets); | 1829 | pscan->nr_sets); |
1879 | 1830 | ||
1880 | numintable = adapter->numinscantable; | ||
1881 | pbssinfo = pscan->bssdesc_and_tlvbuffer; | 1831 | pbssinfo = pscan->bssdesc_and_tlvbuffer; |
1882 | 1832 | ||
1883 | /* The size of the TLV buffer is equal to the entire command response | 1833 | /* The size of the TLV buffer is equal to the entire command response |
@@ -1901,105 +1851,68 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp) | |||
1901 | * or as an addition at the end of the table | 1851 | * or as an addition at the end of the table |
1902 | */ | 1852 | */ |
1903 | for (idx = 0; idx < pscan->nr_sets && bytesleft; idx++) { | 1853 | for (idx = 0; idx < pscan->nr_sets && bytesleft; idx++) { |
1904 | /* Zero out the newbssentry we are about to store info in */ | 1854 | struct bss_descriptor new; |
1905 | memset(&newbssentry, 0x00, sizeof(newbssentry)); | 1855 | struct bss_descriptor * found = NULL; |
1856 | struct bss_descriptor * oldest = NULL; | ||
1906 | 1857 | ||
1907 | /* Process the data fields and IEs returned for this BSS */ | 1858 | /* Process the data fields and IEs returned for this BSS */ |
1908 | if ((InterpretBSSDescriptionWithIE(&newbssentry, | 1859 | memset(&new, 0, sizeof (struct bss_descriptor)); |
1909 | &pbssinfo, | 1860 | if (libertas_process_bss(&new, &pbssinfo, &bytesleft) != 0) { |
1910 | &bytesleft) == | 1861 | /* error parsing the scan response, skipped */ |
1911 | 0) | 1862 | lbs_deb_scan("SCAN_RESP: process_bss returned ERROR\n"); |
1912 | && CHECK_SSID_IS_VALID(&newbssentry.ssid)) { | 1863 | continue; |
1913 | 1864 | } | |
1914 | lbs_pr_debug(1, | ||
1915 | "SCAN_RESP: BSSID = %02x:%02x:%02x:%02x:%02x:%02x\n", | ||
1916 | newbssentry.macaddress[0], | ||
1917 | newbssentry.macaddress[1], | ||
1918 | newbssentry.macaddress[2], | ||
1919 | newbssentry.macaddress[3], | ||
1920 | newbssentry.macaddress[4], | ||
1921 | newbssentry.macaddress[5]); | ||
1922 | |||
1923 | /* | ||
1924 | * Search the scan table for the same bssid | ||
1925 | */ | ||
1926 | for (bssIdx = 0; bssIdx < numintable; bssIdx++) { | ||
1927 | if (memcmp(newbssentry.macaddress, | ||
1928 | adapter->scantable[bssIdx]. | ||
1929 | macaddress, | ||
1930 | sizeof(newbssentry.macaddress)) == | ||
1931 | 0) { | ||
1932 | /* | ||
1933 | * If the SSID matches as well, it is a duplicate of | ||
1934 | * this entry. Keep the bssIdx set to this | ||
1935 | * entry so we replace the old contents in the table | ||
1936 | */ | ||
1937 | if ((newbssentry.ssid.ssidlength == | ||
1938 | adapter->scantable[bssIdx].ssid. | ||
1939 | ssidlength) | ||
1940 | && | ||
1941 | (memcmp | ||
1942 | (newbssentry.ssid.ssid, | ||
1943 | adapter->scantable[bssIdx].ssid. | ||
1944 | ssid, | ||
1945 | newbssentry.ssid.ssidlength) == | ||
1946 | 0)) { | ||
1947 | lbs_pr_debug(1, | ||
1948 | "SCAN_RESP: Duplicate of index: %d\n", | ||
1949 | bssIdx); | ||
1950 | break; | ||
1951 | } | ||
1952 | } | ||
1953 | } | ||
1954 | /* | ||
1955 | * If the bssIdx is equal to the number of entries in the table, | ||
1956 | * the new entry was not a duplicate; append it to the scan | ||
1957 | * table | ||
1958 | */ | ||
1959 | if (bssIdx == numintable) { | ||
1960 | /* Range check the bssIdx, keep it limited to the last entry */ | ||
1961 | if (bssIdx == MRVDRV_MAX_BSSID_LIST) { | ||
1962 | bssIdx--; | ||
1963 | } else { | ||
1964 | numintable++; | ||
1965 | } | ||
1966 | } | ||
1967 | |||
1968 | /* | ||
1969 | * If the TSF TLV was appended to the scan results, save the | ||
1970 | * this entries TSF value in the networktsf field. The | ||
1971 | * networktsf is the firmware's TSF value at the time the | ||
1972 | * beacon or probe response was received. | ||
1973 | */ | ||
1974 | if (ptsftlv) { | ||
1975 | memcpy(&tsfval, &ptsftlv->tsftable[idx], | ||
1976 | sizeof(tsfval)); | ||
1977 | tsfval = le64_to_cpu(tsfval); | ||
1978 | 1865 | ||
1979 | memcpy(&newbssentry.networktsf, | 1866 | /* Try to find this bss in the scan table */ |
1980 | &tsfval, sizeof(newbssentry.networktsf)); | 1867 | list_for_each_entry (iter_bss, &adapter->network_list, list) { |
1868 | if (is_same_network(iter_bss, &new)) { | ||
1869 | found = iter_bss; | ||
1870 | break; | ||
1981 | } | 1871 | } |
1982 | 1872 | ||
1983 | /* Copy the locally created newbssentry to the scan table */ | 1873 | if ((oldest == NULL) || |
1984 | memcpy(&adapter->scantable[bssIdx], | 1874 | (iter_bss->last_scanned < oldest->last_scanned)) |
1985 | &newbssentry, | 1875 | oldest = iter_bss; |
1986 | sizeof(adapter->scantable[bssIdx])); | 1876 | } |
1987 | 1877 | ||
1878 | if (found) { | ||
1879 | /* found, clear it */ | ||
1880 | clear_bss_descriptor(found); | ||
1881 | } else if (!list_empty(&adapter->network_free_list)) { | ||
1882 | /* Pull one from the free list */ | ||
1883 | found = list_entry(adapter->network_free_list.next, | ||
1884 | struct bss_descriptor, list); | ||
1885 | list_move_tail(&found->list, &adapter->network_list); | ||
1886 | } else if (oldest) { | ||
1887 | /* If there are no more slots, expire the oldest */ | ||
1888 | found = oldest; | ||
1889 | clear_bss_descriptor(found); | ||
1890 | list_move_tail(&found->list, &adapter->network_list); | ||
1988 | } else { | 1891 | } else { |
1892 | continue; | ||
1893 | } | ||
1894 | |||
1895 | lbs_deb_scan("SCAN_RESP: BSSID = " MAC_FMT "\n", | ||
1896 | new.bssid[0], new.bssid[1], new.bssid[2], | ||
1897 | new.bssid[3], new.bssid[4], new.bssid[5]); | ||
1989 | 1898 | ||
1990 | /* error parsing/interpreting the scan response, skipped */ | 1899 | /* |
1991 | lbs_pr_debug(1, "SCAN_RESP: " | 1900 | * If the TSF TLV was appended to the scan results, save the |
1992 | "InterpretBSSDescriptionWithIE returned ERROR\n"); | 1901 | * this entries TSF value in the networktsf field. The |
1902 | * networktsf is the firmware's TSF value at the time the | ||
1903 | * beacon or probe response was received. | ||
1904 | */ | ||
1905 | if (ptsftlv) { | ||
1906 | new.networktsf = le64_to_cpup(&ptsftlv->tsftable[idx]); | ||
1993 | } | 1907 | } |
1994 | } | ||
1995 | 1908 | ||
1996 | lbs_pr_debug(1, "SCAN_RESP: Scanned %2d APs, %d valid, %d total\n", | 1909 | /* Copy the locally created newbssentry to the scan table */ |
1997 | pscan->nr_sets, numintable - adapter->numinscantable, | 1910 | memcpy(found, &new, offsetof(struct bss_descriptor, list)); |
1998 | numintable); | 1911 | } |
1999 | 1912 | ||
2000 | /* Update the total number of BSSIDs in the scan table */ | 1913 | ret = 0; |
2001 | adapter->numinscantable = numintable; | ||
2002 | 1914 | ||
2003 | LEAVE(); | 1915 | done: |
2004 | return 0; | 1916 | lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret); |
1917 | return ret; | ||
2005 | } | 1918 | } |
diff --git a/drivers/net/wireless/libertas/scan.h b/drivers/net/wireless/libertas/scan.h index 405f4f0fe575..bd019e5ff1eb 100644 --- a/drivers/net/wireless/libertas/scan.h +++ b/drivers/net/wireless/libertas/scan.h | |||
@@ -51,7 +51,7 @@ struct wlan_scan_cmd_config { | |||
51 | /** | 51 | /** |
52 | * @brief Specific BSSID used to filter scan results in the firmware | 52 | * @brief Specific BSSID used to filter scan results in the firmware |
53 | */ | 53 | */ |
54 | u8 specificBSSID[ETH_ALEN]; | 54 | u8 bssid[ETH_ALEN]; |
55 | 55 | ||
56 | /** | 56 | /** |
57 | * @brief length of TLVs sent in command starting at tlvBuffer | 57 | * @brief length of TLVs sent in command starting at tlvBuffer |
@@ -91,15 +91,6 @@ struct wlan_ioctl_user_scan_chan { | |||
91 | * @sa libertas_set_user_scan_ioctl | 91 | * @sa libertas_set_user_scan_ioctl |
92 | */ | 92 | */ |
93 | struct wlan_ioctl_user_scan_cfg { | 93 | struct wlan_ioctl_user_scan_cfg { |
94 | |||
95 | /** | ||
96 | * @brief Flag set to keep the previous scan table intact | ||
97 | * | ||
98 | * If set, the scan results will accumulate, replacing any previous | ||
99 | * matched entries for a BSS with the new scan data | ||
100 | */ | ||
101 | u8 keeppreviousscan; //!< Do not erase the existing scan results | ||
102 | |||
103 | /** | 94 | /** |
104 | * @brief BSS type to be sent in the firmware command | 95 | * @brief BSS type to be sent in the firmware command |
105 | * | 96 | * |
@@ -117,15 +108,22 @@ struct wlan_ioctl_user_scan_cfg { | |||
117 | */ | 108 | */ |
118 | u8 numprobes; | 109 | u8 numprobes; |
119 | 110 | ||
120 | /** | 111 | /** |
121 | * @brief BSSID filter sent in the firmware command to limit the results | 112 | * @brief BSSID filter sent in the firmware command to limit the results |
122 | */ | 113 | */ |
123 | u8 specificBSSID[ETH_ALEN]; | 114 | u8 bssid[ETH_ALEN]; |
124 | 115 | ||
125 | /** | 116 | /* Clear existing scan results matching this BSSID */ |
126 | * @brief SSID filter sent in the firmware command to limit the results | 117 | u8 clear_bssid; |
127 | */ | 118 | |
128 | char specificSSID[IW_ESSID_MAX_SIZE + 1]; | 119 | /** |
120 | * @brief SSID filter sent in the firmware command to limit the results | ||
121 | */ | ||
122 | char ssid[IW_ESSID_MAX_SIZE]; | ||
123 | u8 ssid_len; | ||
124 | |||
125 | /* Clear existing scan results matching this SSID */ | ||
126 | u8 clear_ssid; | ||
129 | 127 | ||
130 | /** | 128 | /** |
131 | * @brief Variable number (fixed maximum) of channels to scan up | 129 | * @brief Variable number (fixed maximum) of channels to scan up |
@@ -137,9 +135,10 @@ struct wlan_ioctl_user_scan_cfg { | |||
137 | * @brief Structure used to store information for each beacon/probe response | 135 | * @brief Structure used to store information for each beacon/probe response |
138 | */ | 136 | */ |
139 | struct bss_descriptor { | 137 | struct bss_descriptor { |
140 | u8 macaddress[ETH_ALEN]; | 138 | u8 bssid[ETH_ALEN]; |
141 | 139 | ||
142 | struct WLAN_802_11_SSID ssid; | 140 | u8 ssid[IW_ESSID_MAX_SIZE + 1]; |
141 | u8 ssid_len; | ||
143 | 142 | ||
144 | /* WEP encryption requirement */ | 143 | /* WEP encryption requirement */ |
145 | u32 privacy; | 144 | u32 privacy; |
@@ -156,15 +155,15 @@ struct bss_descriptor { | |||
156 | u8 mode; | 155 | u8 mode; |
157 | u8 libertas_supported_rates[WLAN_SUPPORTED_RATES]; | 156 | u8 libertas_supported_rates[WLAN_SUPPORTED_RATES]; |
158 | 157 | ||
159 | int extra_ie; | 158 | __le64 timestamp; //!< TSF value included in the beacon/probe response |
159 | unsigned long last_scanned; | ||
160 | 160 | ||
161 | u8 timestamp[8]; //!< TSF value included in the beacon/probe response | ||
162 | union ieeetypes_phyparamset phyparamset; | 161 | union ieeetypes_phyparamset phyparamset; |
163 | union IEEEtypes_ssparamset ssparamset; | 162 | union IEEEtypes_ssparamset ssparamset; |
164 | struct ieeetypes_capinfo cap; | 163 | struct ieeetypes_capinfo cap; |
165 | u8 datarates[WLAN_SUPPORTED_RATES]; | 164 | u8 datarates[WLAN_SUPPORTED_RATES]; |
166 | 165 | ||
167 | __le64 networktsf; //!< TSF timestamp from the current firmware TSF | 166 | u64 networktsf; //!< TSF timestamp from the current firmware TSF |
168 | 167 | ||
169 | struct ieeetypes_countryinfofullset countryinfo; | 168 | struct ieeetypes_countryinfofullset countryinfo; |
170 | 169 | ||
@@ -172,24 +171,29 @@ struct bss_descriptor { | |||
172 | size_t wpa_ie_len; | 171 | size_t wpa_ie_len; |
173 | u8 rsn_ie[MAX_WPA_IE_LEN]; | 172 | u8 rsn_ie[MAX_WPA_IE_LEN]; |
174 | size_t rsn_ie_len; | 173 | size_t rsn_ie_len; |
174 | |||
175 | struct list_head list; | ||
175 | }; | 176 | }; |
176 | 177 | ||
177 | extern int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, | 178 | extern int libertas_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len); |
178 | struct WLAN_802_11_SSID *ssid2); | 179 | |
179 | extern int libertas_find_SSID_in_list(wlan_adapter * adapter, struct WLAN_802_11_SSID *ssid, | 180 | struct bss_descriptor * libertas_find_ssid_in_list(wlan_adapter * adapter, |
180 | u8 * bssid, u8 mode); | 181 | u8 *ssid, u8 ssid_len, u8 * bssid, u8 mode, |
181 | int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode); | 182 | int channel); |
182 | extern int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, u8 mode); | 183 | |
184 | struct bss_descriptor * libertas_find_best_ssid_in_list(wlan_adapter * adapter, | ||
185 | u8 mode); | ||
186 | |||
187 | extern struct bss_descriptor * libertas_find_bssid_in_list(wlan_adapter * adapter, | ||
188 | u8 * bssid, u8 mode); | ||
183 | 189 | ||
184 | int libertas_find_best_network_SSID(wlan_private * priv, | 190 | int libertas_find_best_network_ssid(wlan_private * priv, u8 *out_ssid, |
185 | struct WLAN_802_11_SSID *pSSID, | 191 | u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode); |
186 | u8 preferred_mode, u8 *out_mode); | ||
187 | 192 | ||
188 | extern int libertas_send_specific_SSID_scan(wlan_private * priv, | 193 | extern int libertas_send_specific_ssid_scan(wlan_private * priv, u8 *ssid, |
189 | struct WLAN_802_11_SSID *prequestedssid, | 194 | u8 ssid_len, u8 clear_ssid); |
190 | u8 keeppreviousscan); | 195 | extern int libertas_send_specific_bssid_scan(wlan_private * priv, |
191 | extern int libertas_send_specific_BSSID_scan(wlan_private * priv, | 196 | u8 * bssid, u8 clear_bssid); |
192 | u8 * bssid, u8 keeppreviousscan); | ||
193 | 197 | ||
194 | extern int libertas_cmd_80211_scan(wlan_private * priv, | 198 | extern int libertas_cmd_80211_scan(wlan_private * priv, |
195 | struct cmd_ds_command *cmd, | 199 | struct cmd_ds_command *cmd, |
@@ -199,7 +203,8 @@ extern int libertas_ret_80211_scan(wlan_private * priv, | |||
199 | struct cmd_ds_command *resp); | 203 | struct cmd_ds_command *resp); |
200 | 204 | ||
201 | int wlan_scan_networks(wlan_private * priv, | 205 | int wlan_scan_networks(wlan_private * priv, |
202 | const struct wlan_ioctl_user_scan_cfg * puserscanin); | 206 | const struct wlan_ioctl_user_scan_cfg * puserscanin, |
207 | int full_scan); | ||
203 | 208 | ||
204 | struct ifreq; | 209 | struct ifreq; |
205 | 210 | ||
diff --git a/drivers/net/wireless/libertas/thread.h b/drivers/net/wireless/libertas/thread.h index 207b8a6cc33d..b1f34d92ff3e 100644 --- a/drivers/net/wireless/libertas/thread.h +++ b/drivers/net/wireless/libertas/thread.h | |||
@@ -21,11 +21,11 @@ static inline void wlan_activate_thread(struct wlan_thread * thr) | |||
21 | 21 | ||
22 | static inline void wlan_deactivate_thread(struct wlan_thread * thr) | 22 | static inline void wlan_deactivate_thread(struct wlan_thread * thr) |
23 | { | 23 | { |
24 | ENTER(); | 24 | lbs_deb_enter(LBS_DEB_THREAD); |
25 | 25 | ||
26 | thr->pid = 0; | 26 | thr->pid = 0; |
27 | 27 | ||
28 | LEAVE(); | 28 | lbs_deb_leave(LBS_DEB_THREAD); |
29 | } | 29 | } |
30 | 30 | ||
31 | static inline void wlan_create_thread(int (*wlanfunc) (void *), | 31 | static inline void wlan_create_thread(int (*wlanfunc) (void *), |
@@ -36,7 +36,7 @@ static inline void wlan_create_thread(int (*wlanfunc) (void *), | |||
36 | 36 | ||
37 | static inline int wlan_terminate_thread(struct wlan_thread * thr) | 37 | static inline int wlan_terminate_thread(struct wlan_thread * thr) |
38 | { | 38 | { |
39 | ENTER(); | 39 | lbs_deb_enter(LBS_DEB_THREAD); |
40 | 40 | ||
41 | /* Check if the thread is active or not */ | 41 | /* Check if the thread is active or not */ |
42 | if (!thr->pid) { | 42 | if (!thr->pid) { |
@@ -45,7 +45,7 @@ static inline int wlan_terminate_thread(struct wlan_thread * thr) | |||
45 | } | 45 | } |
46 | kthread_stop(thr->task); | 46 | kthread_stop(thr->task); |
47 | 47 | ||
48 | LEAVE(); | 48 | lbs_deb_leave(LBS_DEB_THREAD); |
49 | return 0; | 49 | return 0; |
50 | } | 50 | } |
51 | 51 | ||
diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c index d4b13478c9a7..17c437635a00 100644 --- a/drivers/net/wireless/libertas/tx.c +++ b/drivers/net/wireless/libertas/tx.c | |||
@@ -5,7 +5,6 @@ | |||
5 | 5 | ||
6 | #include "hostcmd.h" | 6 | #include "hostcmd.h" |
7 | #include "radiotap.h" | 7 | #include "radiotap.h" |
8 | #include "sbi.h" | ||
9 | #include "decl.h" | 8 | #include "decl.h" |
10 | #include "defs.h" | 9 | #include "defs.h" |
11 | #include "dev.h" | 10 | #include "dev.h" |
@@ -68,7 +67,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb) | |||
68 | u32 new_rate; | 67 | u32 new_rate; |
69 | u8 *ptr = priv->adapter->tmptxbuf; | 68 | u8 *ptr = priv->adapter->tmptxbuf; |
70 | 69 | ||
71 | ENTER(); | 70 | lbs_deb_enter(LBS_DEB_TX); |
72 | 71 | ||
73 | if (priv->adapter->surpriseremoved) | 72 | if (priv->adapter->surpriseremoved) |
74 | return -1; | 73 | return -1; |
@@ -78,7 +77,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb) | |||
78 | min_t(unsigned int, skb->len, 100)); | 77 | min_t(unsigned int, skb->len, 100)); |
79 | 78 | ||
80 | if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) { | 79 | if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) { |
81 | lbs_pr_debug(1, "Tx error: Bad skb length %d : %zd\n", | 80 | lbs_deb_tx("tx err: skb length %d 0 or > %zd\n", |
82 | skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE); | 81 | skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE); |
83 | ret = -1; | 82 | ret = -1; |
84 | goto done; | 83 | goto done; |
@@ -86,13 +85,13 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb) | |||
86 | 85 | ||
87 | memset(plocaltxpd, 0, sizeof(struct txpd)); | 86 | memset(plocaltxpd, 0, sizeof(struct txpd)); |
88 | 87 | ||
89 | plocaltxpd->tx_packet_length = skb->len; | 88 | plocaltxpd->tx_packet_length = cpu_to_le16(skb->len); |
90 | 89 | ||
91 | /* offset of actual data */ | 90 | /* offset of actual data */ |
92 | plocaltxpd->tx_packet_location = sizeof(struct txpd); | 91 | plocaltxpd->tx_packet_location = cpu_to_le32(sizeof(struct txpd)); |
93 | 92 | ||
94 | /* TxCtrl set by user or default */ | 93 | /* TxCtrl set by user or default */ |
95 | plocaltxpd->tx_control = adapter->pkttxctrl; | 94 | plocaltxpd->tx_control = cpu_to_le32(adapter->pkttxctrl); |
96 | 95 | ||
97 | p802x_hdr = skb->data; | 96 | p802x_hdr = skb->data; |
98 | if (priv->adapter->radiomode == WLAN_RADIOMODE_RADIOTAP) { | 97 | if (priv->adapter->radiomode == WLAN_RADIOMODE_RADIOTAP) { |
@@ -103,15 +102,16 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb) | |||
103 | /* set txpd fields from the radiotap header */ | 102 | /* set txpd fields from the radiotap header */ |
104 | new_rate = convert_radiotap_rate_to_mv(pradiotap_hdr->rate); | 103 | new_rate = convert_radiotap_rate_to_mv(pradiotap_hdr->rate); |
105 | if (new_rate != 0) { | 104 | if (new_rate != 0) { |
106 | /* erase tx_control[4:0] */ | 105 | /* use new tx_control[4:0] */ |
107 | plocaltxpd->tx_control &= ~0x1f; | 106 | new_rate |= (adapter->pkttxctrl & ~0x1f); |
108 | /* write new tx_control[4:0] */ | 107 | plocaltxpd->tx_control = cpu_to_le32(new_rate); |
109 | plocaltxpd->tx_control |= new_rate; | ||
110 | } | 108 | } |
111 | 109 | ||
112 | /* skip the radiotap header */ | 110 | /* skip the radiotap header */ |
113 | p802x_hdr += sizeof(struct tx_radiotap_hdr); | 111 | p802x_hdr += sizeof(struct tx_radiotap_hdr); |
114 | plocaltxpd->tx_packet_length -= sizeof(struct tx_radiotap_hdr); | 112 | plocaltxpd->tx_packet_length = |
113 | cpu_to_le16(le16_to_cpu(plocaltxpd->tx_packet_length) | ||
114 | - sizeof(struct tx_radiotap_hdr)); | ||
115 | 115 | ||
116 | } | 116 | } |
117 | /* copy destination address from 802.3 or 802.11 header */ | 117 | /* copy destination address from 802.3 or 802.11 header */ |
@@ -123,28 +123,28 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb) | |||
123 | lbs_dbg_hex("txpd", (u8 *) plocaltxpd, sizeof(struct txpd)); | 123 | lbs_dbg_hex("txpd", (u8 *) plocaltxpd, sizeof(struct txpd)); |
124 | 124 | ||
125 | if (IS_MESH_FRAME(skb)) { | 125 | if (IS_MESH_FRAME(skb)) { |
126 | plocaltxpd->tx_control |= TxPD_MESH_FRAME; | 126 | plocaltxpd->tx_control |= cpu_to_le32(TxPD_MESH_FRAME); |
127 | } | 127 | } |
128 | 128 | ||
129 | memcpy(ptr, plocaltxpd, sizeof(struct txpd)); | 129 | memcpy(ptr, plocaltxpd, sizeof(struct txpd)); |
130 | 130 | ||
131 | ptr += sizeof(struct txpd); | 131 | ptr += sizeof(struct txpd); |
132 | 132 | ||
133 | lbs_dbg_hex("Tx Data", (u8 *) p802x_hdr, plocaltxpd->tx_packet_length); | 133 | lbs_dbg_hex("Tx Data", (u8 *) p802x_hdr, le16_to_cpu(plocaltxpd->tx_packet_length)); |
134 | memcpy(ptr, p802x_hdr, plocaltxpd->tx_packet_length); | 134 | memcpy(ptr, p802x_hdr, le16_to_cpu(plocaltxpd->tx_packet_length)); |
135 | ret = libertas_sbi_host_to_card(priv, MVMS_DAT, | 135 | ret = priv->hw_host_to_card(priv, MVMS_DAT, |
136 | priv->adapter->tmptxbuf, | 136 | priv->adapter->tmptxbuf, |
137 | plocaltxpd->tx_packet_length + | 137 | le16_to_cpu(plocaltxpd->tx_packet_length) + |
138 | sizeof(struct txpd)); | 138 | sizeof(struct txpd)); |
139 | 139 | ||
140 | if (ret) { | 140 | if (ret) { |
141 | lbs_pr_debug(1, "Tx error: libertas_sbi_host_to_card failed: 0x%X\n", ret); | 141 | lbs_deb_tx("tx err: hw_host_to_card returned 0x%X\n", ret); |
142 | goto done; | 142 | goto done; |
143 | } | 143 | } |
144 | 144 | ||
145 | lbs_pr_debug(1, "SendSinglePacket succeeds\n"); | 145 | lbs_deb_tx("SendSinglePacket succeeds\n"); |
146 | 146 | ||
147 | done: | 147 | done: |
148 | if (!ret) { | 148 | if (!ret) { |
149 | priv->stats.tx_packets++; | 149 | priv->stats.tx_packets++; |
150 | priv->stats.tx_bytes += skb->len; | 150 | priv->stats.tx_bytes += skb->len; |
@@ -158,7 +158,8 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb) | |||
158 | received from FW */ | 158 | received from FW */ |
159 | skb_orphan(skb); | 159 | skb_orphan(skb); |
160 | /* stop processing outgoing pkts */ | 160 | /* stop processing outgoing pkts */ |
161 | netif_stop_queue(priv->wlan_dev.netdev); | 161 | netif_stop_queue(priv->dev); |
162 | netif_stop_queue(priv->mesh_dev); | ||
162 | /* freeze any packets already in our queues */ | 163 | /* freeze any packets already in our queues */ |
163 | priv->adapter->TxLockFlag = 1; | 164 | priv->adapter->TxLockFlag = 1; |
164 | } else { | 165 | } else { |
@@ -166,7 +167,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb) | |||
166 | priv->adapter->currenttxskb = NULL; | 167 | priv->adapter->currenttxskb = NULL; |
167 | } | 168 | } |
168 | 169 | ||
169 | LEAVE(); | 170 | lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret); |
170 | return ret; | 171 | return ret; |
171 | } | 172 | } |
172 | 173 | ||
@@ -195,10 +196,13 @@ static void wlan_tx_queue(wlan_private *priv, struct sk_buff *skb) | |||
195 | 196 | ||
196 | WARN_ON(priv->adapter->tx_queue_idx >= NR_TX_QUEUE); | 197 | WARN_ON(priv->adapter->tx_queue_idx >= NR_TX_QUEUE); |
197 | adapter->tx_queue_ps[adapter->tx_queue_idx++] = skb; | 198 | adapter->tx_queue_ps[adapter->tx_queue_idx++] = skb; |
198 | if (adapter->tx_queue_idx == NR_TX_QUEUE) | 199 | if (adapter->tx_queue_idx == NR_TX_QUEUE) { |
199 | netif_stop_queue(priv->wlan_dev.netdev); | 200 | netif_stop_queue(priv->dev); |
200 | else | 201 | netif_stop_queue(priv->mesh_dev); |
201 | netif_start_queue(priv->wlan_dev.netdev); | 202 | } else { |
203 | netif_start_queue(priv->dev); | ||
204 | netif_start_queue(priv->mesh_dev); | ||
205 | } | ||
202 | 206 | ||
203 | spin_unlock(&adapter->txqueue_lock); | 207 | spin_unlock(&adapter->txqueue_lock); |
204 | } | 208 | } |
@@ -214,13 +218,12 @@ int libertas_process_tx(wlan_private * priv, struct sk_buff *skb) | |||
214 | { | 218 | { |
215 | int ret = -1; | 219 | int ret = -1; |
216 | 220 | ||
217 | ENTER(); | 221 | lbs_deb_enter(LBS_DEB_TX); |
218 | |||
219 | lbs_dbg_hex("TX Data", skb->data, min_t(unsigned int, skb->len, 100)); | 222 | lbs_dbg_hex("TX Data", skb->data, min_t(unsigned int, skb->len, 100)); |
220 | 223 | ||
221 | if (priv->wlan_dev.dnld_sent) { | 224 | if (priv->dnld_sent) { |
222 | lbs_pr_alert( "TX error: dnld_sent = %d, not sending\n", | 225 | lbs_pr_alert( "TX error: dnld_sent = %d, not sending\n", |
223 | priv->wlan_dev.dnld_sent); | 226 | priv->dnld_sent); |
224 | goto done; | 227 | goto done; |
225 | } | 228 | } |
226 | 229 | ||
@@ -234,7 +237,7 @@ int libertas_process_tx(wlan_private * priv, struct sk_buff *skb) | |||
234 | 237 | ||
235 | ret = SendSinglePacket(priv, skb); | 238 | ret = SendSinglePacket(priv, skb); |
236 | done: | 239 | done: |
237 | LEAVE(); | 240 | lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret); |
238 | return ret; | 241 | return ret; |
239 | } | 242 | } |
240 | 243 | ||
@@ -280,6 +283,9 @@ void libertas_send_tx_feedback(wlan_private * priv) | |||
280 | libertas_upload_rx_packet(priv, adapter->currenttxskb); | 283 | libertas_upload_rx_packet(priv, adapter->currenttxskb); |
281 | adapter->currenttxskb = NULL; | 284 | adapter->currenttxskb = NULL; |
282 | priv->adapter->TxLockFlag = 0; | 285 | priv->adapter->TxLockFlag = 0; |
283 | if (priv->adapter->connect_status == libertas_connected) | 286 | if (priv->adapter->connect_status == libertas_connected) { |
284 | netif_wake_queue(priv->wlan_dev.netdev); | 287 | netif_wake_queue(priv->dev); |
288 | netif_wake_queue(priv->mesh_dev); | ||
289 | } | ||
285 | } | 290 | } |
291 | EXPORT_SYMBOL_GPL(libertas_send_tx_feedback); | ||
diff --git a/drivers/net/wireless/libertas/types.h b/drivers/net/wireless/libertas/types.h index 09d62f8b1a16..028e2f3b53d6 100644 --- a/drivers/net/wireless/libertas/types.h +++ b/drivers/net/wireless/libertas/types.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #define _WLAN_TYPES_ | 5 | #define _WLAN_TYPES_ |
6 | 6 | ||
7 | #include <linux/if_ether.h> | 7 | #include <linux/if_ether.h> |
8 | #include <asm/byteorder.h> | ||
8 | 9 | ||
9 | /** IEEE type definitions */ | 10 | /** IEEE type definitions */ |
10 | enum ieeetypes_elementid { | 11 | enum ieeetypes_elementid { |
@@ -29,9 +30,30 @@ enum ieeetypes_elementid { | |||
29 | EXTRA_IE = 133, | 30 | EXTRA_IE = 133, |
30 | } __attribute__ ((packed)); | 31 | } __attribute__ ((packed)); |
31 | 32 | ||
33 | #ifdef __BIG_ENDIAN | ||
32 | #define CAPINFO_MASK (~(0xda00)) | 34 | #define CAPINFO_MASK (~(0xda00)) |
35 | #else | ||
36 | #define CAPINFO_MASK (~(0x00da)) | ||
37 | #endif | ||
33 | 38 | ||
34 | struct ieeetypes_capinfo { | 39 | struct ieeetypes_capinfo { |
40 | #ifdef __BIG_ENDIAN_BITFIELD | ||
41 | u8 chanagility:1; | ||
42 | u8 pbcc:1; | ||
43 | u8 shortpreamble:1; | ||
44 | u8 privacy:1; | ||
45 | u8 cfpollrqst:1; | ||
46 | u8 cfpollable:1; | ||
47 | u8 ibss:1; | ||
48 | u8 ess:1; | ||
49 | u8 rsrvd1:2; | ||
50 | u8 dsssofdm:1; | ||
51 | u8 rsvrd2:1; | ||
52 | u8 apsd:1; | ||
53 | u8 shortslottime:1; | ||
54 | u8 rsrvd3:1; | ||
55 | u8 spectrummgmt:1; | ||
56 | #else | ||
35 | u8 ess:1; | 57 | u8 ess:1; |
36 | u8 ibss:1; | 58 | u8 ibss:1; |
37 | u8 cfpollable:1; | 59 | u8 cfpollable:1; |
@@ -47,6 +69,7 @@ struct ieeetypes_capinfo { | |||
47 | u8 rsvrd2:1; | 69 | u8 rsvrd2:1; |
48 | u8 dsssofdm:1; | 70 | u8 dsssofdm:1; |
49 | u8 rsrvd1:2; | 71 | u8 rsrvd1:2; |
72 | #endif | ||
50 | } __attribute__ ((packed)); | 73 | } __attribute__ ((packed)); |
51 | 74 | ||
52 | struct ieeetypes_cfparamset { | 75 | struct ieeetypes_cfparamset { |
@@ -54,15 +77,15 @@ struct ieeetypes_cfparamset { | |||
54 | u8 len; | 77 | u8 len; |
55 | u8 cfpcnt; | 78 | u8 cfpcnt; |
56 | u8 cfpperiod; | 79 | u8 cfpperiod; |
57 | u16 cfpmaxduration; | 80 | __le16 cfpmaxduration; |
58 | u16 cfpdurationremaining; | 81 | __le16 cfpdurationremaining; |
59 | } __attribute__ ((packed)); | 82 | } __attribute__ ((packed)); |
60 | 83 | ||
61 | 84 | ||
62 | struct ieeetypes_ibssparamset { | 85 | struct ieeetypes_ibssparamset { |
63 | u8 elementid; | 86 | u8 elementid; |
64 | u8 len; | 87 | u8 len; |
65 | u16 atimwindow; | 88 | __le16 atimwindow; |
66 | } __attribute__ ((packed)); | 89 | } __attribute__ ((packed)); |
67 | 90 | ||
68 | union IEEEtypes_ssparamset { | 91 | union IEEEtypes_ssparamset { |
@@ -73,7 +96,7 @@ union IEEEtypes_ssparamset { | |||
73 | struct ieeetypes_fhparamset { | 96 | struct ieeetypes_fhparamset { |
74 | u8 elementid; | 97 | u8 elementid; |
75 | u8 len; | 98 | u8 len; |
76 | u16 dwelltime; | 99 | __le16 dwelltime; |
77 | u8 hopset; | 100 | u8 hopset; |
78 | u8 hoppattern; | 101 | u8 hoppattern; |
79 | u8 hopindex; | 102 | u8 hopindex; |
@@ -92,8 +115,8 @@ union ieeetypes_phyparamset { | |||
92 | 115 | ||
93 | struct ieeetypes_assocrsp { | 116 | struct ieeetypes_assocrsp { |
94 | struct ieeetypes_capinfo capability; | 117 | struct ieeetypes_capinfo capability; |
95 | u16 statuscode; | 118 | __le16 statuscode; |
96 | u16 aid; | 119 | __le16 aid; |
97 | u8 iebuffer[1]; | 120 | u8 iebuffer[1]; |
98 | } __attribute__ ((packed)); | 121 | } __attribute__ ((packed)); |
99 | 122 | ||
@@ -138,8 +161,8 @@ struct ieeetypes_assocrsp { | |||
138 | 161 | ||
139 | /** TLV related data structures*/ | 162 | /** TLV related data structures*/ |
140 | struct mrvlietypesheader { | 163 | struct mrvlietypesheader { |
141 | u16 type; | 164 | __le16 type; |
142 | u16 len; | 165 | __le16 len; |
143 | } __attribute__ ((packed)); | 166 | } __attribute__ ((packed)); |
144 | 167 | ||
145 | struct mrvlietypes_data { | 168 | struct mrvlietypes_data { |
@@ -164,17 +187,23 @@ struct mrvlietypes_wildcardssidparamset { | |||
164 | } __attribute__ ((packed)); | 187 | } __attribute__ ((packed)); |
165 | 188 | ||
166 | struct chanscanmode { | 189 | struct chanscanmode { |
190 | #ifdef __BIG_ENDIAN_BITFIELD | ||
191 | u8 reserved_2_7:6; | ||
192 | u8 disablechanfilt:1; | ||
193 | u8 passivescan:1; | ||
194 | #else | ||
167 | u8 passivescan:1; | 195 | u8 passivescan:1; |
168 | u8 disablechanfilt:1; | 196 | u8 disablechanfilt:1; |
169 | u8 reserved_2_7:6; | 197 | u8 reserved_2_7:6; |
198 | #endif | ||
170 | } __attribute__ ((packed)); | 199 | } __attribute__ ((packed)); |
171 | 200 | ||
172 | struct chanscanparamset { | 201 | struct chanscanparamset { |
173 | u8 radiotype; | 202 | u8 radiotype; |
174 | u8 channumber; | 203 | u8 channumber; |
175 | struct chanscanmode chanscanmode; | 204 | struct chanscanmode chanscanmode; |
176 | u16 minscantime; | 205 | __le16 minscantime; |
177 | u16 maxscantime; | 206 | __le16 maxscantime; |
178 | } __attribute__ ((packed)); | 207 | } __attribute__ ((packed)); |
179 | 208 | ||
180 | struct mrvlietypes_chanlistparamset { | 209 | struct mrvlietypes_chanlistparamset { |
@@ -185,12 +214,12 @@ struct mrvlietypes_chanlistparamset { | |||
185 | struct cfparamset { | 214 | struct cfparamset { |
186 | u8 cfpcnt; | 215 | u8 cfpcnt; |
187 | u8 cfpperiod; | 216 | u8 cfpperiod; |
188 | u16 cfpmaxduration; | 217 | __le16 cfpmaxduration; |
189 | u16 cfpdurationremaining; | 218 | __le16 cfpdurationremaining; |
190 | } __attribute__ ((packed)); | 219 | } __attribute__ ((packed)); |
191 | 220 | ||
192 | struct ibssparamset { | 221 | struct ibssparamset { |
193 | u16 atimwindow; | 222 | __le16 atimwindow; |
194 | } __attribute__ ((packed)); | 223 | } __attribute__ ((packed)); |
195 | 224 | ||
196 | struct mrvlietypes_ssparamset { | 225 | struct mrvlietypes_ssparamset { |
@@ -202,7 +231,7 @@ struct mrvlietypes_ssparamset { | |||
202 | } __attribute__ ((packed)); | 231 | } __attribute__ ((packed)); |
203 | 232 | ||
204 | struct fhparamset { | 233 | struct fhparamset { |
205 | u16 dwelltime; | 234 | __le16 dwelltime; |
206 | u8 hopset; | 235 | u8 hopset; |
207 | u8 hoppattern; | 236 | u8 hoppattern; |
208 | u8 hopindex; | 237 | u8 hopindex; |
@@ -263,17 +292,17 @@ struct mrvlietypes_beaconsmissed { | |||
263 | 292 | ||
264 | struct mrvlietypes_numprobes { | 293 | struct mrvlietypes_numprobes { |
265 | struct mrvlietypesheader header; | 294 | struct mrvlietypesheader header; |
266 | u16 numprobes; | 295 | __le16 numprobes; |
267 | } __attribute__ ((packed)); | 296 | } __attribute__ ((packed)); |
268 | 297 | ||
269 | struct mrvlietypes_bcastprobe { | 298 | struct mrvlietypes_bcastprobe { |
270 | struct mrvlietypesheader header; | 299 | struct mrvlietypesheader header; |
271 | u16 bcastprobe; | 300 | __le16 bcastprobe; |
272 | } __attribute__ ((packed)); | 301 | } __attribute__ ((packed)); |
273 | 302 | ||
274 | struct mrvlietypes_numssidprobe { | 303 | struct mrvlietypes_numssidprobe { |
275 | struct mrvlietypesheader header; | 304 | struct mrvlietypesheader header; |
276 | u16 numssidprobe; | 305 | __le16 numssidprobe; |
277 | } __attribute__ ((packed)); | 306 | } __attribute__ ((packed)); |
278 | 307 | ||
279 | struct led_pin { | 308 | struct led_pin { |
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index 69f52b6e59c8..8939251a2f4c 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c | |||
@@ -22,6 +22,14 @@ | |||
22 | 22 | ||
23 | 23 | ||
24 | /** | 24 | /** |
25 | * the rates supported by the card | ||
26 | */ | ||
27 | static u8 libertas_wlan_data_rates[WLAN_SUPPORTED_RATES] = | ||
28 | { 0x02, 0x04, 0x0B, 0x16, 0x00, 0x0C, 0x12, | ||
29 | 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x00 | ||
30 | }; | ||
31 | |||
32 | /** | ||
25 | * @brief Convert mw value to dbm value | 33 | * @brief Convert mw value to dbm value |
26 | * | 34 | * |
27 | * @param mw the value of mw | 35 | * @param mw the value of mw |
@@ -102,8 +110,8 @@ struct chan_freq_power *libertas_find_cfp_by_band_and_channel(wlan_adapter * ada | |||
102 | } | 110 | } |
103 | 111 | ||
104 | if (!cfp && channel) | 112 | if (!cfp && channel) |
105 | lbs_pr_debug(1, "libertas_find_cfp_by_band_and_channel(): cannot find " | 113 | lbs_deb_wext("libertas_find_cfp_by_band_and_channel: can't find " |
106 | "cfp by band %d & channel %d\n", band, channel); | 114 | "cfp by band %d / channel %d\n", band, channel); |
107 | 115 | ||
108 | return cfp; | 116 | return cfp; |
109 | } | 117 | } |
@@ -143,113 +151,12 @@ static struct chan_freq_power *find_cfp_by_band_and_freq(wlan_adapter * adapter, | |||
143 | } | 151 | } |
144 | 152 | ||
145 | if (!cfp && freq) | 153 | if (!cfp && freq) |
146 | lbs_pr_debug(1, "find_cfp_by_band_and_freql(): cannot find cfp by " | 154 | lbs_deb_wext("find_cfp_by_band_and_freql: can't find cfp by " |
147 | "band %d & freq %d\n", band, freq); | 155 | "band %d / freq %d\n", band, freq); |
148 | 156 | ||
149 | return cfp; | 157 | return cfp; |
150 | } | 158 | } |
151 | 159 | ||
152 | static int updatecurrentchannel(wlan_private * priv) | ||
153 | { | ||
154 | int ret; | ||
155 | |||
156 | /* | ||
157 | ** the channel in f/w could be out of sync, get the current channel | ||
158 | */ | ||
159 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_rf_channel, | ||
160 | cmd_opt_802_11_rf_channel_get, | ||
161 | cmd_option_waitforrsp, 0, NULL); | ||
162 | |||
163 | lbs_pr_debug(1, "Current channel = %d\n", | ||
164 | priv->adapter->curbssparams.channel); | ||
165 | |||
166 | return ret; | ||
167 | } | ||
168 | |||
169 | static int setcurrentchannel(wlan_private * priv, int channel) | ||
170 | { | ||
171 | lbs_pr_debug(1, "Set channel = %d\n", channel); | ||
172 | |||
173 | /* | ||
174 | ** Current channel is not set to adhocchannel requested, set channel | ||
175 | */ | ||
176 | return (libertas_prepare_and_send_command(priv, cmd_802_11_rf_channel, | ||
177 | cmd_opt_802_11_rf_channel_set, | ||
178 | cmd_option_waitforrsp, 0, &channel)); | ||
179 | } | ||
180 | |||
181 | static int changeadhocchannel(wlan_private * priv, int channel) | ||
182 | { | ||
183 | int ret = 0; | ||
184 | wlan_adapter *adapter = priv->adapter; | ||
185 | |||
186 | adapter->adhocchannel = channel; | ||
187 | |||
188 | updatecurrentchannel(priv); | ||
189 | |||
190 | if (adapter->curbssparams.channel == adapter->adhocchannel) { | ||
191 | /* adhocchannel is set to the current channel already */ | ||
192 | LEAVE(); | ||
193 | return 0; | ||
194 | } | ||
195 | |||
196 | lbs_pr_debug(1, "Updating channel from %d to %d\n", | ||
197 | adapter->curbssparams.channel, adapter->adhocchannel); | ||
198 | |||
199 | setcurrentchannel(priv, adapter->adhocchannel); | ||
200 | |||
201 | updatecurrentchannel(priv); | ||
202 | |||
203 | if (adapter->curbssparams.channel != adapter->adhocchannel) { | ||
204 | lbs_pr_debug(1, "failed to updated channel to %d, channel = %d\n", | ||
205 | adapter->adhocchannel, adapter->curbssparams.channel); | ||
206 | LEAVE(); | ||
207 | return -1; | ||
208 | } | ||
209 | |||
210 | if (adapter->connect_status == libertas_connected) { | ||
211 | int i; | ||
212 | struct WLAN_802_11_SSID curadhocssid; | ||
213 | |||
214 | lbs_pr_debug(1, "channel Changed while in an IBSS\n"); | ||
215 | |||
216 | /* Copy the current ssid */ | ||
217 | memcpy(&curadhocssid, &adapter->curbssparams.ssid, | ||
218 | sizeof(struct WLAN_802_11_SSID)); | ||
219 | |||
220 | /* Exit Adhoc mode */ | ||
221 | lbs_pr_debug(1, "In changeadhocchannel(): Sending Adhoc Stop\n"); | ||
222 | ret = libertas_stop_adhoc_network(priv); | ||
223 | |||
224 | if (ret) { | ||
225 | LEAVE(); | ||
226 | return ret; | ||
227 | } | ||
228 | /* Scan for the network, do not save previous results. Stale | ||
229 | * scan data will cause us to join a non-existant adhoc network | ||
230 | */ | ||
231 | libertas_send_specific_SSID_scan(priv, &curadhocssid, 0); | ||
232 | |||
233 | // find out the BSSID that matches the current SSID | ||
234 | i = libertas_find_SSID_in_list(adapter, &curadhocssid, NULL, | ||
235 | IW_MODE_ADHOC); | ||
236 | |||
237 | if (i >= 0) { | ||
238 | lbs_pr_debug(1, "SSID found at %d in List," | ||
239 | "so join\n", i); | ||
240 | libertas_join_adhoc_network(priv, &adapter->scantable[i]); | ||
241 | } else { | ||
242 | // else send START command | ||
243 | lbs_pr_debug(1, "SSID not found in list, " | ||
244 | "so creating adhoc with ssid = %s\n", | ||
245 | curadhocssid.ssid); | ||
246 | libertas_start_adhoc_network(priv, &curadhocssid); | ||
247 | } // end of else (START command) | ||
248 | } | ||
249 | |||
250 | LEAVE(); | ||
251 | return 0; | ||
252 | } | ||
253 | 160 | ||
254 | /** | 161 | /** |
255 | * @brief Set Radio On/OFF | 162 | * @brief Set Radio On/OFF |
@@ -263,10 +170,10 @@ int wlan_radio_ioctl(wlan_private * priv, u8 option) | |||
263 | int ret = 0; | 170 | int ret = 0; |
264 | wlan_adapter *adapter = priv->adapter; | 171 | wlan_adapter *adapter = priv->adapter; |
265 | 172 | ||
266 | ENTER(); | 173 | lbs_deb_enter(LBS_DEB_WEXT); |
267 | 174 | ||
268 | if (adapter->radioon != option) { | 175 | if (adapter->radioon != option) { |
269 | lbs_pr_debug(1, "Switching %s the Radio\n", option ? "On" : "Off"); | 176 | lbs_deb_wext("switching radio %s\n", option ? "on" : "off"); |
270 | adapter->radioon = option; | 177 | adapter->radioon = option; |
271 | 178 | ||
272 | ret = libertas_prepare_and_send_command(priv, | 179 | ret = libertas_prepare_and_send_command(priv, |
@@ -275,7 +182,7 @@ int wlan_radio_ioctl(wlan_private * priv, u8 option) | |||
275 | cmd_option_waitforrsp, 0, NULL); | 182 | cmd_option_waitforrsp, 0, NULL); |
276 | } | 183 | } |
277 | 184 | ||
278 | LEAVE(); | 185 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
279 | return ret; | 186 | return ret; |
280 | } | 187 | } |
281 | 188 | ||
@@ -312,15 +219,15 @@ static int get_active_data_rates(wlan_adapter * adapter, | |||
312 | { | 219 | { |
313 | int k = 0; | 220 | int k = 0; |
314 | 221 | ||
315 | ENTER(); | 222 | lbs_deb_enter(LBS_DEB_WEXT); |
316 | 223 | ||
317 | if (adapter->connect_status != libertas_connected) { | 224 | if (adapter->connect_status != libertas_connected) { |
318 | if (adapter->mode == IW_MODE_INFRA) { | 225 | if (adapter->mode == IW_MODE_INFRA) { |
319 | lbs_pr_debug(1, "Infra\n"); | 226 | lbs_deb_wext("infra\n"); |
320 | k = copyrates(rates, k, libertas_supported_rates, | 227 | k = copyrates(rates, k, libertas_supported_rates, |
321 | sizeof(libertas_supported_rates)); | 228 | sizeof(libertas_supported_rates)); |
322 | } else { | 229 | } else { |
323 | lbs_pr_debug(1, "Adhoc G\n"); | 230 | lbs_deb_wext("Adhoc G\n"); |
324 | k = copyrates(rates, k, libertas_adhoc_rates_g, | 231 | k = copyrates(rates, k, libertas_adhoc_rates_g, |
325 | sizeof(libertas_adhoc_rates_g)); | 232 | sizeof(libertas_adhoc_rates_g)); |
326 | } | 233 | } |
@@ -329,8 +236,7 @@ static int get_active_data_rates(wlan_adapter * adapter, | |||
329 | adapter->curbssparams.numofrates); | 236 | adapter->curbssparams.numofrates); |
330 | } | 237 | } |
331 | 238 | ||
332 | LEAVE(); | 239 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", k); |
333 | |||
334 | return k; | 240 | return k; |
335 | } | 241 | } |
336 | 242 | ||
@@ -342,7 +248,7 @@ static int wlan_get_name(struct net_device *dev, struct iw_request_info *info, | |||
342 | char mrvl[6] = { "MRVL-" }; | 248 | char mrvl[6] = { "MRVL-" }; |
343 | int cnt; | 249 | int cnt; |
344 | 250 | ||
345 | ENTER(); | 251 | lbs_deb_enter(LBS_DEB_WEXT); |
346 | 252 | ||
347 | strcpy(cwrq, mrvl); | 253 | strcpy(cwrq, mrvl); |
348 | 254 | ||
@@ -360,8 +266,7 @@ static int wlan_get_name(struct net_device *dev, struct iw_request_info *info, | |||
360 | } | 266 | } |
361 | *cwrq = '\0'; | 267 | *cwrq = '\0'; |
362 | 268 | ||
363 | LEAVE(); | 269 | lbs_deb_leave(LBS_DEB_WEXT); |
364 | |||
365 | return 0; | 270 | return 0; |
366 | } | 271 | } |
367 | 272 | ||
@@ -372,14 +277,14 @@ static int wlan_get_freq(struct net_device *dev, struct iw_request_info *info, | |||
372 | wlan_adapter *adapter = priv->adapter; | 277 | wlan_adapter *adapter = priv->adapter; |
373 | struct chan_freq_power *cfp; | 278 | struct chan_freq_power *cfp; |
374 | 279 | ||
375 | ENTER(); | 280 | lbs_deb_enter(LBS_DEB_WEXT); |
376 | 281 | ||
377 | cfp = libertas_find_cfp_by_band_and_channel(adapter, 0, | 282 | cfp = libertas_find_cfp_by_band_and_channel(adapter, 0, |
378 | adapter->curbssparams.channel); | 283 | adapter->curbssparams.channel); |
379 | 284 | ||
380 | if (!cfp) { | 285 | if (!cfp) { |
381 | if (adapter->curbssparams.channel) | 286 | if (adapter->curbssparams.channel) |
382 | lbs_pr_debug(1, "Invalid channel=%d\n", | 287 | lbs_deb_wext("invalid channel %d\n", |
383 | adapter->curbssparams.channel); | 288 | adapter->curbssparams.channel); |
384 | return -EINVAL; | 289 | return -EINVAL; |
385 | } | 290 | } |
@@ -387,9 +292,8 @@ static int wlan_get_freq(struct net_device *dev, struct iw_request_info *info, | |||
387 | fwrq->m = (long)cfp->freq * 100000; | 292 | fwrq->m = (long)cfp->freq * 100000; |
388 | fwrq->e = 1; | 293 | fwrq->e = 1; |
389 | 294 | ||
390 | lbs_pr_debug(1, "freq=%u\n", fwrq->m); | 295 | lbs_deb_wext("freq %u\n", fwrq->m); |
391 | 296 | lbs_deb_leave(LBS_DEB_WEXT); | |
392 | LEAVE(); | ||
393 | return 0; | 297 | return 0; |
394 | } | 298 | } |
395 | 299 | ||
@@ -399,7 +303,7 @@ static int wlan_get_wap(struct net_device *dev, struct iw_request_info *info, | |||
399 | wlan_private *priv = dev->priv; | 303 | wlan_private *priv = dev->priv; |
400 | wlan_adapter *adapter = priv->adapter; | 304 | wlan_adapter *adapter = priv->adapter; |
401 | 305 | ||
402 | ENTER(); | 306 | lbs_deb_enter(LBS_DEB_WEXT); |
403 | 307 | ||
404 | if (adapter->connect_status == libertas_connected) { | 308 | if (adapter->connect_status == libertas_connected) { |
405 | memcpy(awrq->sa_data, adapter->curbssparams.bssid, ETH_ALEN); | 309 | memcpy(awrq->sa_data, adapter->curbssparams.bssid, ETH_ALEN); |
@@ -408,7 +312,7 @@ static int wlan_get_wap(struct net_device *dev, struct iw_request_info *info, | |||
408 | } | 312 | } |
409 | awrq->sa_family = ARPHRD_ETHER; | 313 | awrq->sa_family = ARPHRD_ETHER; |
410 | 314 | ||
411 | LEAVE(); | 315 | lbs_deb_leave(LBS_DEB_WEXT); |
412 | return 0; | 316 | return 0; |
413 | } | 317 | } |
414 | 318 | ||
@@ -418,7 +322,7 @@ static int wlan_set_nick(struct net_device *dev, struct iw_request_info *info, | |||
418 | wlan_private *priv = dev->priv; | 322 | wlan_private *priv = dev->priv; |
419 | wlan_adapter *adapter = priv->adapter; | 323 | wlan_adapter *adapter = priv->adapter; |
420 | 324 | ||
421 | ENTER(); | 325 | lbs_deb_enter(LBS_DEB_WEXT); |
422 | 326 | ||
423 | /* | 327 | /* |
424 | * Check the size of the string | 328 | * Check the size of the string |
@@ -433,7 +337,7 @@ static int wlan_set_nick(struct net_device *dev, struct iw_request_info *info, | |||
433 | memcpy(adapter->nodename, extra, dwrq->length); | 337 | memcpy(adapter->nodename, extra, dwrq->length); |
434 | mutex_unlock(&adapter->lock); | 338 | mutex_unlock(&adapter->lock); |
435 | 339 | ||
436 | LEAVE(); | 340 | lbs_deb_leave(LBS_DEB_WEXT); |
437 | return 0; | 341 | return 0; |
438 | } | 342 | } |
439 | 343 | ||
@@ -443,7 +347,7 @@ static int wlan_get_nick(struct net_device *dev, struct iw_request_info *info, | |||
443 | wlan_private *priv = dev->priv; | 347 | wlan_private *priv = dev->priv; |
444 | wlan_adapter *adapter = priv->adapter; | 348 | wlan_adapter *adapter = priv->adapter; |
445 | 349 | ||
446 | ENTER(); | 350 | lbs_deb_enter(LBS_DEB_WEXT); |
447 | 351 | ||
448 | /* | 352 | /* |
449 | * Get the Nick Name saved | 353 | * Get the Nick Name saved |
@@ -464,19 +368,43 @@ static int wlan_get_nick(struct net_device *dev, struct iw_request_info *info, | |||
464 | */ | 368 | */ |
465 | dwrq->length = strlen(extra) + 1; | 369 | dwrq->length = strlen(extra) + 1; |
466 | 370 | ||
467 | LEAVE(); | 371 | lbs_deb_leave(LBS_DEB_WEXT); |
468 | return 0; | 372 | return 0; |
469 | } | 373 | } |
470 | 374 | ||
375 | static int mesh_get_nick(struct net_device *dev, struct iw_request_info *info, | ||
376 | struct iw_point *dwrq, char *extra) | ||
377 | { | ||
378 | wlan_private *priv = dev->priv; | ||
379 | wlan_adapter *adapter = priv->adapter; | ||
380 | |||
381 | lbs_deb_enter(LBS_DEB_WEXT); | ||
382 | |||
383 | /* Use nickname to indicate that mesh is on */ | ||
384 | |||
385 | if (adapter->connect_status == libertas_connected) { | ||
386 | strncpy(extra, "Mesh", 12); | ||
387 | extra[12] = '\0'; | ||
388 | dwrq->length = strlen(extra) + 1; | ||
389 | } | ||
390 | |||
391 | else { | ||
392 | extra[0] = '\0'; | ||
393 | dwrq->length = 1 ; | ||
394 | } | ||
395 | |||
396 | lbs_deb_leave(LBS_DEB_WEXT); | ||
397 | return 0; | ||
398 | } | ||
471 | static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info, | 399 | static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info, |
472 | struct iw_param *vwrq, char *extra) | 400 | struct iw_param *vwrq, char *extra) |
473 | { | 401 | { |
474 | int ret = 0; | 402 | int ret = 0; |
475 | wlan_private *priv = dev->priv; | 403 | wlan_private *priv = dev->priv; |
476 | wlan_adapter *adapter = priv->adapter; | 404 | wlan_adapter *adapter = priv->adapter; |
477 | int rthr = vwrq->value; | 405 | u32 rthr = vwrq->value; |
478 | 406 | ||
479 | ENTER(); | 407 | lbs_deb_enter(LBS_DEB_WEXT); |
480 | 408 | ||
481 | if (vwrq->disabled) { | 409 | if (vwrq->disabled) { |
482 | adapter->rtsthsd = rthr = MRVDRV_RTS_MAX_VALUE; | 410 | adapter->rtsthsd = rthr = MRVDRV_RTS_MAX_VALUE; |
@@ -490,7 +418,7 @@ static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info, | |||
490 | cmd_act_set, cmd_option_waitforrsp, | 418 | cmd_act_set, cmd_option_waitforrsp, |
491 | OID_802_11_RTS_THRESHOLD, &rthr); | 419 | OID_802_11_RTS_THRESHOLD, &rthr); |
492 | 420 | ||
493 | LEAVE(); | 421 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
494 | return ret; | 422 | return ret; |
495 | } | 423 | } |
496 | 424 | ||
@@ -501,35 +429,34 @@ static int wlan_get_rts(struct net_device *dev, struct iw_request_info *info, | |||
501 | wlan_private *priv = dev->priv; | 429 | wlan_private *priv = dev->priv; |
502 | wlan_adapter *adapter = priv->adapter; | 430 | wlan_adapter *adapter = priv->adapter; |
503 | 431 | ||
504 | ENTER(); | 432 | lbs_deb_enter(LBS_DEB_WEXT); |
505 | 433 | ||
506 | adapter->rtsthsd = 0; | 434 | adapter->rtsthsd = 0; |
507 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib, | 435 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib, |
508 | cmd_act_get, cmd_option_waitforrsp, | 436 | cmd_act_get, cmd_option_waitforrsp, |
509 | OID_802_11_RTS_THRESHOLD, NULL); | 437 | OID_802_11_RTS_THRESHOLD, NULL); |
510 | if (ret) { | 438 | if (ret) |
511 | LEAVE(); | 439 | goto out; |
512 | return ret; | ||
513 | } | ||
514 | 440 | ||
515 | vwrq->value = adapter->rtsthsd; | 441 | vwrq->value = adapter->rtsthsd; |
516 | vwrq->disabled = ((vwrq->value < MRVDRV_RTS_MIN_VALUE) | 442 | vwrq->disabled = ((vwrq->value < MRVDRV_RTS_MIN_VALUE) |
517 | || (vwrq->value > MRVDRV_RTS_MAX_VALUE)); | 443 | || (vwrq->value > MRVDRV_RTS_MAX_VALUE)); |
518 | vwrq->fixed = 1; | 444 | vwrq->fixed = 1; |
519 | 445 | ||
520 | LEAVE(); | 446 | out: |
521 | return 0; | 447 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
448 | return ret; | ||
522 | } | 449 | } |
523 | 450 | ||
524 | static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info, | 451 | static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info, |
525 | struct iw_param *vwrq, char *extra) | 452 | struct iw_param *vwrq, char *extra) |
526 | { | 453 | { |
527 | int ret = 0; | 454 | int ret = 0; |
528 | int fthr = vwrq->value; | 455 | u32 fthr = vwrq->value; |
529 | wlan_private *priv = dev->priv; | 456 | wlan_private *priv = dev->priv; |
530 | wlan_adapter *adapter = priv->adapter; | 457 | wlan_adapter *adapter = priv->adapter; |
531 | 458 | ||
532 | ENTER(); | 459 | lbs_deb_enter(LBS_DEB_WEXT); |
533 | 460 | ||
534 | if (vwrq->disabled) { | 461 | if (vwrq->disabled) { |
535 | adapter->fragthsd = fthr = MRVDRV_FRAG_MAX_VALUE; | 462 | adapter->fragthsd = fthr = MRVDRV_FRAG_MAX_VALUE; |
@@ -543,7 +470,8 @@ static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info, | |||
543 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib, | 470 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib, |
544 | cmd_act_set, cmd_option_waitforrsp, | 471 | cmd_act_set, cmd_option_waitforrsp, |
545 | OID_802_11_FRAGMENTATION_THRESHOLD, &fthr); | 472 | OID_802_11_FRAGMENTATION_THRESHOLD, &fthr); |
546 | LEAVE(); | 473 | |
474 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); | ||
547 | return ret; | 475 | return ret; |
548 | } | 476 | } |
549 | 477 | ||
@@ -554,24 +482,23 @@ static int wlan_get_frag(struct net_device *dev, struct iw_request_info *info, | |||
554 | wlan_private *priv = dev->priv; | 482 | wlan_private *priv = dev->priv; |
555 | wlan_adapter *adapter = priv->adapter; | 483 | wlan_adapter *adapter = priv->adapter; |
556 | 484 | ||
557 | ENTER(); | 485 | lbs_deb_enter(LBS_DEB_WEXT); |
558 | 486 | ||
559 | adapter->fragthsd = 0; | 487 | adapter->fragthsd = 0; |
560 | ret = libertas_prepare_and_send_command(priv, | 488 | ret = libertas_prepare_and_send_command(priv, |
561 | cmd_802_11_snmp_mib, | 489 | cmd_802_11_snmp_mib, |
562 | cmd_act_get, cmd_option_waitforrsp, | 490 | cmd_act_get, cmd_option_waitforrsp, |
563 | OID_802_11_FRAGMENTATION_THRESHOLD, NULL); | 491 | OID_802_11_FRAGMENTATION_THRESHOLD, NULL); |
564 | if (ret) { | 492 | if (ret) |
565 | LEAVE(); | 493 | goto out; |
566 | return ret; | ||
567 | } | ||
568 | 494 | ||
569 | vwrq->value = adapter->fragthsd; | 495 | vwrq->value = adapter->fragthsd; |
570 | vwrq->disabled = ((vwrq->value < MRVDRV_FRAG_MIN_VALUE) | 496 | vwrq->disabled = ((vwrq->value < MRVDRV_FRAG_MIN_VALUE) |
571 | || (vwrq->value > MRVDRV_FRAG_MAX_VALUE)); | 497 | || (vwrq->value > MRVDRV_FRAG_MAX_VALUE)); |
572 | vwrq->fixed = 1; | 498 | vwrq->fixed = 1; |
573 | 499 | ||
574 | LEAVE(); | 500 | out: |
501 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); | ||
575 | return ret; | 502 | return ret; |
576 | } | 503 | } |
577 | 504 | ||
@@ -581,11 +508,23 @@ static int wlan_get_mode(struct net_device *dev, | |||
581 | wlan_private *priv = dev->priv; | 508 | wlan_private *priv = dev->priv; |
582 | wlan_adapter *adapter = priv->adapter; | 509 | wlan_adapter *adapter = priv->adapter; |
583 | 510 | ||
584 | ENTER(); | 511 | lbs_deb_enter(LBS_DEB_WEXT); |
585 | 512 | ||
586 | *uwrq = adapter->mode; | 513 | *uwrq = adapter->mode; |
587 | 514 | ||
588 | LEAVE(); | 515 | lbs_deb_leave(LBS_DEB_WEXT); |
516 | return 0; | ||
517 | } | ||
518 | |||
519 | static int mesh_wlan_get_mode(struct net_device *dev, | ||
520 | struct iw_request_info *info, u32 * uwrq, | ||
521 | char *extra) | ||
522 | { | ||
523 | lbs_deb_enter(LBS_DEB_WEXT); | ||
524 | |||
525 | *uwrq = IW_MODE_REPEAT ; | ||
526 | |||
527 | lbs_deb_leave(LBS_DEB_WEXT); | ||
589 | return 0; | 528 | return 0; |
590 | } | 529 | } |
591 | 530 | ||
@@ -597,19 +536,17 @@ static int wlan_get_txpow(struct net_device *dev, | |||
597 | wlan_private *priv = dev->priv; | 536 | wlan_private *priv = dev->priv; |
598 | wlan_adapter *adapter = priv->adapter; | 537 | wlan_adapter *adapter = priv->adapter; |
599 | 538 | ||
600 | ENTER(); | 539 | lbs_deb_enter(LBS_DEB_WEXT); |
601 | 540 | ||
602 | ret = libertas_prepare_and_send_command(priv, | 541 | ret = libertas_prepare_and_send_command(priv, |
603 | cmd_802_11_rf_tx_power, | 542 | cmd_802_11_rf_tx_power, |
604 | cmd_act_tx_power_opt_get, | 543 | cmd_act_tx_power_opt_get, |
605 | cmd_option_waitforrsp, 0, NULL); | 544 | cmd_option_waitforrsp, 0, NULL); |
606 | 545 | ||
607 | if (ret) { | 546 | if (ret) |
608 | LEAVE(); | 547 | goto out; |
609 | return ret; | ||
610 | } | ||
611 | 548 | ||
612 | lbs_pr_debug(1, "TXPOWER GET %d dbm.\n", adapter->txpowerlevel); | 549 | lbs_deb_wext("tx power level %d dbm\n", adapter->txpowerlevel); |
613 | vwrq->value = adapter->txpowerlevel; | 550 | vwrq->value = adapter->txpowerlevel; |
614 | vwrq->fixed = 1; | 551 | vwrq->fixed = 1; |
615 | if (adapter->radioon) { | 552 | if (adapter->radioon) { |
@@ -619,8 +556,9 @@ static int wlan_get_txpow(struct net_device *dev, | |||
619 | vwrq->disabled = 1; | 556 | vwrq->disabled = 1; |
620 | } | 557 | } |
621 | 558 | ||
622 | LEAVE(); | 559 | out: |
623 | return 0; | 560 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
561 | return ret; | ||
624 | } | 562 | } |
625 | 563 | ||
626 | static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info, | 564 | static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info, |
@@ -630,7 +568,7 @@ static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info, | |||
630 | wlan_private *priv = dev->priv; | 568 | wlan_private *priv = dev->priv; |
631 | wlan_adapter *adapter = priv->adapter; | 569 | wlan_adapter *adapter = priv->adapter; |
632 | 570 | ||
633 | ENTER(); | 571 | lbs_deb_enter(LBS_DEB_WEXT); |
634 | 572 | ||
635 | if (vwrq->flags == IW_RETRY_LIMIT) { | 573 | if (vwrq->flags == IW_RETRY_LIMIT) { |
636 | /* The MAC has a 4-bit Total_Tx_Count register | 574 | /* The MAC has a 4-bit Total_Tx_Count register |
@@ -648,16 +586,15 @@ static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info, | |||
648 | cmd_option_waitforrsp, | 586 | cmd_option_waitforrsp, |
649 | OID_802_11_TX_RETRYCOUNT, NULL); | 587 | OID_802_11_TX_RETRYCOUNT, NULL); |
650 | 588 | ||
651 | if (ret) { | 589 | if (ret) |
652 | LEAVE(); | 590 | goto out; |
653 | return ret; | ||
654 | } | ||
655 | } else { | 591 | } else { |
656 | return -EOPNOTSUPP; | 592 | return -EOPNOTSUPP; |
657 | } | 593 | } |
658 | 594 | ||
659 | LEAVE(); | 595 | out: |
660 | return 0; | 596 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
597 | return ret; | ||
661 | } | 598 | } |
662 | 599 | ||
663 | static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info, | 600 | static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info, |
@@ -667,16 +604,16 @@ static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info, | |||
667 | wlan_adapter *adapter = priv->adapter; | 604 | wlan_adapter *adapter = priv->adapter; |
668 | int ret = 0; | 605 | int ret = 0; |
669 | 606 | ||
670 | ENTER(); | 607 | lbs_deb_enter(LBS_DEB_WEXT); |
608 | |||
671 | adapter->txretrycount = 0; | 609 | adapter->txretrycount = 0; |
672 | ret = libertas_prepare_and_send_command(priv, | 610 | ret = libertas_prepare_and_send_command(priv, |
673 | cmd_802_11_snmp_mib, | 611 | cmd_802_11_snmp_mib, |
674 | cmd_act_get, cmd_option_waitforrsp, | 612 | cmd_act_get, cmd_option_waitforrsp, |
675 | OID_802_11_TX_RETRYCOUNT, NULL); | 613 | OID_802_11_TX_RETRYCOUNT, NULL); |
676 | if (ret) { | 614 | if (ret) |
677 | LEAVE(); | 615 | goto out; |
678 | return ret; | 616 | |
679 | } | ||
680 | vwrq->disabled = 0; | 617 | vwrq->disabled = 0; |
681 | if (!vwrq->flags) { | 618 | if (!vwrq->flags) { |
682 | vwrq->flags = IW_RETRY_LIMIT; | 619 | vwrq->flags = IW_RETRY_LIMIT; |
@@ -684,8 +621,9 @@ static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info, | |||
684 | vwrq->value = adapter->txretrycount - 1; | 621 | vwrq->value = adapter->txretrycount - 1; |
685 | } | 622 | } |
686 | 623 | ||
687 | LEAVE(); | 624 | out: |
688 | return 0; | 625 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
626 | return ret; | ||
689 | } | 627 | } |
690 | 628 | ||
691 | static inline void sort_channels(struct iw_freq *freq, int num) | 629 | static inline void sort_channels(struct iw_freq *freq, int num) |
@@ -739,7 +677,7 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info, | |||
739 | 677 | ||
740 | u8 flag = 0; | 678 | u8 flag = 0; |
741 | 679 | ||
742 | ENTER(); | 680 | lbs_deb_enter(LBS_DEB_WEXT); |
743 | 681 | ||
744 | dwrq->length = sizeof(struct iw_range); | 682 | dwrq->length = sizeof(struct iw_range); |
745 | memset(range, 0, sizeof(struct iw_range)); | 683 | memset(range, 0, sizeof(struct iw_range)); |
@@ -755,7 +693,7 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info, | |||
755 | range->bitrate[i] = (rates[i] & 0x7f) * 500000; | 693 | range->bitrate[i] = (rates[i] & 0x7f) * 500000; |
756 | } | 694 | } |
757 | range->num_bitrates = i; | 695 | range->num_bitrates = i; |
758 | lbs_pr_debug(1, "IW_MAX_BITRATES=%d num_bitrates=%d\n", IW_MAX_BITRATES, | 696 | lbs_deb_wext("IW_MAX_BITRATES %d, num_bitrates %d\n", IW_MAX_BITRATES, |
759 | range->num_bitrates); | 697 | range->num_bitrates); |
760 | 698 | ||
761 | range->num_frequency = 0; | 699 | range->num_frequency = 0; |
@@ -768,18 +706,17 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info, | |||
768 | &adapter->parsed_region_chan; | 706 | &adapter->parsed_region_chan; |
769 | 707 | ||
770 | if (parsed_region_chan == NULL) { | 708 | if (parsed_region_chan == NULL) { |
771 | lbs_pr_debug(1, "11D:parsed_region_chan is NULL\n"); | 709 | lbs_deb_wext("11d: parsed_region_chan is NULL\n"); |
772 | LEAVE(); | 710 | goto out; |
773 | return 0; | ||
774 | } | 711 | } |
775 | band = parsed_region_chan->band; | 712 | band = parsed_region_chan->band; |
776 | lbs_pr_debug(1, "band=%d NoOfChan=%d\n", band, | 713 | lbs_deb_wext("band %d, nr_char %d\n", band, |
777 | parsed_region_chan->nr_chan); | 714 | parsed_region_chan->nr_chan); |
778 | 715 | ||
779 | for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES) | 716 | for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES) |
780 | && (i < parsed_region_chan->nr_chan); i++) { | 717 | && (i < parsed_region_chan->nr_chan); i++) { |
781 | chan_no = parsed_region_chan->chanpwr[i].chan; | 718 | chan_no = parsed_region_chan->chanpwr[i].chan; |
782 | lbs_pr_debug(1, "chan_no=%d\n", chan_no); | 719 | lbs_deb_wext("chan_no %d\n", chan_no); |
783 | range->freq[range->num_frequency].i = (long)chan_no; | 720 | range->freq[range->num_frequency].i = (long)chan_no; |
784 | range->freq[range->num_frequency].m = | 721 | range->freq[range->num_frequency].m = |
785 | (long)libertas_chan_2_freq(chan_no, band) * 100000; | 722 | (long)libertas_chan_2_freq(chan_no, band) * 100000; |
@@ -808,7 +745,7 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info, | |||
808 | } | 745 | } |
809 | } | 746 | } |
810 | 747 | ||
811 | lbs_pr_debug(1, "IW_MAX_FREQUENCIES=%d num_frequency=%d\n", | 748 | lbs_deb_wext("IW_MAX_FREQUENCIES %d, num_frequency %d\n", |
812 | IW_MAX_FREQUENCIES, range->num_frequency); | 749 | IW_MAX_FREQUENCIES, range->num_frequency); |
813 | 750 | ||
814 | range->num_channels = range->num_frequency; | 751 | range->num_channels = range->num_frequency; |
@@ -903,7 +840,8 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info, | |||
903 | | IW_ENC_CAPA_CIPHER_CCMP; | 840 | | IW_ENC_CAPA_CIPHER_CCMP; |
904 | } | 841 | } |
905 | 842 | ||
906 | LEAVE(); | 843 | out: |
844 | lbs_deb_leave(LBS_DEB_WEXT); | ||
907 | return 0; | 845 | return 0; |
908 | } | 846 | } |
909 | 847 | ||
@@ -913,7 +851,7 @@ static int wlan_set_power(struct net_device *dev, struct iw_request_info *info, | |||
913 | wlan_private *priv = dev->priv; | 851 | wlan_private *priv = dev->priv; |
914 | wlan_adapter *adapter = priv->adapter; | 852 | wlan_adapter *adapter = priv->adapter; |
915 | 853 | ||
916 | ENTER(); | 854 | lbs_deb_enter(LBS_DEB_WEXT); |
917 | 855 | ||
918 | /* PS is currently supported only in Infrastructure mode | 856 | /* PS is currently supported only in Infrastructure mode |
919 | * Remove this check if it is to be supported in IBSS mode also | 857 | * Remove this check if it is to be supported in IBSS mode also |
@@ -929,11 +867,11 @@ static int wlan_set_power(struct net_device *dev, struct iw_request_info *info, | |||
929 | } | 867 | } |
930 | 868 | ||
931 | if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { | 869 | if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { |
932 | lbs_pr_debug(1, | 870 | lbs_deb_wext( |
933 | "Setting power timeout command is not supported\n"); | 871 | "setting power timeout is not supported\n"); |
934 | return -EINVAL; | 872 | return -EINVAL; |
935 | } else if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) { | 873 | } else if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) { |
936 | lbs_pr_debug(1, "Setting power period command is not supported\n"); | 874 | lbs_deb_wext("setting power period not supported\n"); |
937 | return -EINVAL; | 875 | return -EINVAL; |
938 | } | 876 | } |
939 | 877 | ||
@@ -947,7 +885,7 @@ static int wlan_set_power(struct net_device *dev, struct iw_request_info *info, | |||
947 | libertas_ps_sleep(priv, cmd_option_waitforrsp); | 885 | libertas_ps_sleep(priv, cmd_option_waitforrsp); |
948 | } | 886 | } |
949 | 887 | ||
950 | LEAVE(); | 888 | lbs_deb_leave(LBS_DEB_WEXT); |
951 | return 0; | 889 | return 0; |
952 | } | 890 | } |
953 | 891 | ||
@@ -958,19 +896,20 @@ static int wlan_get_power(struct net_device *dev, struct iw_request_info *info, | |||
958 | wlan_adapter *adapter = priv->adapter; | 896 | wlan_adapter *adapter = priv->adapter; |
959 | int mode; | 897 | int mode; |
960 | 898 | ||
961 | ENTER(); | 899 | lbs_deb_enter(LBS_DEB_WEXT); |
962 | 900 | ||
963 | mode = adapter->psmode; | 901 | mode = adapter->psmode; |
964 | 902 | ||
965 | if ((vwrq->disabled = (mode == wlan802_11powermodecam)) | 903 | if ((vwrq->disabled = (mode == wlan802_11powermodecam)) |
966 | || adapter->connect_status == libertas_disconnected) { | 904 | || adapter->connect_status == libertas_disconnected) |
967 | LEAVE(); | 905 | { |
968 | return 0; | 906 | goto out; |
969 | } | 907 | } |
970 | 908 | ||
971 | vwrq->value = 0; | 909 | vwrq->value = 0; |
972 | 910 | ||
973 | LEAVE(); | 911 | out: |
912 | lbs_deb_leave(LBS_DEB_WEXT); | ||
974 | return 0; | 913 | return 0; |
975 | } | 914 | } |
976 | 915 | ||
@@ -1063,6 +1002,16 @@ static const struct iw_priv_args wlan_private_args[] = { | |||
1063 | IW_PRIV_TYPE_CHAR | 128, | 1002 | IW_PRIV_TYPE_CHAR | 128, |
1064 | IW_PRIV_TYPE_CHAR | 128, | 1003 | IW_PRIV_TYPE_CHAR | 128, |
1065 | "bt_list"}, | 1004 | "bt_list"}, |
1005 | { | ||
1006 | WLAN_SUBCMD_BT_SET_INVERT, | ||
1007 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, | ||
1008 | IW_PRIV_TYPE_NONE, | ||
1009 | "bt_set_invert"}, | ||
1010 | { | ||
1011 | WLAN_SUBCMD_BT_GET_INVERT, | ||
1012 | IW_PRIV_TYPE_NONE, | ||
1013 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, | ||
1014 | "bt_get_invert"}, | ||
1066 | /* FWT Management */ | 1015 | /* FWT Management */ |
1067 | { | 1016 | { |
1068 | WLAN_SUBCMD_FWT_ADD, | 1017 | WLAN_SUBCMD_FWT_ADD, |
@@ -1125,7 +1074,7 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev) | |||
1125 | u8 rssi; | 1074 | u8 rssi; |
1126 | u32 tx_retries; | 1075 | u32 tx_retries; |
1127 | 1076 | ||
1128 | ENTER(); | 1077 | lbs_deb_enter(LBS_DEB_WEXT); |
1129 | 1078 | ||
1130 | priv->wstats.status = adapter->mode; | 1079 | priv->wstats.status = adapter->mode; |
1131 | 1080 | ||
@@ -1145,8 +1094,8 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev) | |||
1145 | CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]); | 1094 | CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]); |
1146 | } | 1095 | } |
1147 | 1096 | ||
1148 | lbs_pr_debug(1, "Signal Level = %#x\n", priv->wstats.qual.level); | 1097 | lbs_deb_wext("signal level %#x\n", priv->wstats.qual.level); |
1149 | lbs_pr_debug(1, "Noise = %#x\n", priv->wstats.qual.noise); | 1098 | lbs_deb_wext("noise %#x\n", priv->wstats.qual.noise); |
1150 | 1099 | ||
1151 | rssi = priv->wstats.qual.level - priv->wstats.qual.noise; | 1100 | rssi = priv->wstats.qual.level - priv->wstats.qual.noise; |
1152 | if (rssi < 15) | 1101 | if (rssi < 15) |
@@ -1166,7 +1115,7 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev) | |||
1166 | /* Quality by TX errors */ | 1115 | /* Quality by TX errors */ |
1167 | priv->wstats.discard.retries = priv->stats.tx_errors; | 1116 | priv->wstats.discard.retries = priv->stats.tx_errors; |
1168 | 1117 | ||
1169 | tx_retries = adapter->logmsg.retry; | 1118 | tx_retries = le16_to_cpu(adapter->logmsg.retry); |
1170 | 1119 | ||
1171 | if (tx_retries > 75) | 1120 | if (tx_retries > 75) |
1172 | tx_qual = (90 - tx_retries) * POOR / 15; | 1121 | tx_qual = (90 - tx_retries) * POOR / 15; |
@@ -1182,10 +1131,10 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev) | |||
1182 | (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; | 1131 | (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; |
1183 | quality = min(quality, tx_qual); | 1132 | quality = min(quality, tx_qual); |
1184 | 1133 | ||
1185 | priv->wstats.discard.code = adapter->logmsg.wepundecryptable; | 1134 | priv->wstats.discard.code = le16_to_cpu(adapter->logmsg.wepundecryptable); |
1186 | priv->wstats.discard.fragment = adapter->logmsg.fcserror; | 1135 | priv->wstats.discard.fragment = le16_to_cpu(adapter->logmsg.rxfrag); |
1187 | priv->wstats.discard.retries = tx_retries; | 1136 | priv->wstats.discard.retries = tx_retries; |
1188 | priv->wstats.discard.misc = adapter->logmsg.ackfailure; | 1137 | priv->wstats.discard.misc = le16_to_cpu(adapter->logmsg.ackfailure); |
1189 | 1138 | ||
1190 | /* Calculate quality */ | 1139 | /* Calculate quality */ |
1191 | priv->wstats.qual.qual = max(quality, (u32)100); | 1140 | priv->wstats.qual.qual = max(quality, (u32)100); |
@@ -1209,7 +1158,7 @@ out: | |||
1209 | IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; | 1158 | IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; |
1210 | } | 1159 | } |
1211 | 1160 | ||
1212 | LEAVE (); | 1161 | lbs_deb_leave(LBS_DEB_WEXT); |
1213 | return &priv->wstats; | 1162 | return &priv->wstats; |
1214 | 1163 | ||
1215 | 1164 | ||
@@ -1218,81 +1167,59 @@ out: | |||
1218 | static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info, | 1167 | static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info, |
1219 | struct iw_freq *fwrq, char *extra) | 1168 | struct iw_freq *fwrq, char *extra) |
1220 | { | 1169 | { |
1221 | int ret = 0; | 1170 | int ret = -EINVAL; |
1222 | wlan_private *priv = dev->priv; | 1171 | wlan_private *priv = dev->priv; |
1223 | wlan_adapter *adapter = priv->adapter; | 1172 | wlan_adapter *adapter = priv->adapter; |
1224 | int rc = -EINPROGRESS; /* Call commit handler */ | ||
1225 | struct chan_freq_power *cfp; | 1173 | struct chan_freq_power *cfp; |
1174 | struct assoc_request * assoc_req; | ||
1226 | 1175 | ||
1227 | ENTER(); | 1176 | lbs_deb_enter(LBS_DEB_WEXT); |
1228 | 1177 | ||
1229 | /* | 1178 | mutex_lock(&adapter->lock); |
1230 | * If setting by frequency, convert to a channel | 1179 | assoc_req = wlan_get_association_request(adapter); |
1231 | */ | 1180 | if (!assoc_req) { |
1232 | if (fwrq->e == 1) { | 1181 | ret = -ENOMEM; |
1182 | goto out; | ||
1183 | } | ||
1233 | 1184 | ||
1185 | /* If setting by frequency, convert to a channel */ | ||
1186 | if (fwrq->e == 1) { | ||
1234 | long f = fwrq->m / 100000; | 1187 | long f = fwrq->m / 100000; |
1235 | int c = 0; | ||
1236 | 1188 | ||
1237 | cfp = find_cfp_by_band_and_freq(adapter, 0, f); | 1189 | cfp = find_cfp_by_band_and_freq(adapter, 0, f); |
1238 | if (!cfp) { | 1190 | if (!cfp) { |
1239 | lbs_pr_debug(1, "Invalid freq=%ld\n", f); | 1191 | lbs_deb_wext("invalid freq %ld\n", f); |
1240 | return -EINVAL; | 1192 | goto out; |
1241 | } | 1193 | } |
1242 | 1194 | ||
1243 | c = (int)cfp->channel; | ||
1244 | |||
1245 | if (c < 0) | ||
1246 | return -EINVAL; | ||
1247 | |||
1248 | fwrq->e = 0; | 1195 | fwrq->e = 0; |
1249 | fwrq->m = c; | 1196 | fwrq->m = (int) cfp->channel; |
1250 | } | 1197 | } |
1251 | 1198 | ||
1252 | /* | 1199 | /* Setting by channel number */ |
1253 | * Setting by channel number | ||
1254 | */ | ||
1255 | if (fwrq->m > 1000 || fwrq->e > 0) { | 1200 | if (fwrq->m > 1000 || fwrq->e > 0) { |
1256 | rc = -EOPNOTSUPP; | 1201 | goto out; |
1257 | } else { | 1202 | } |
1258 | int channel = fwrq->m; | ||
1259 | 1203 | ||
1260 | cfp = libertas_find_cfp_by_band_and_channel(adapter, 0, channel); | 1204 | cfp = libertas_find_cfp_by_band_and_channel(adapter, 0, fwrq->m); |
1261 | if (!cfp) { | 1205 | if (!cfp) { |
1262 | rc = -EINVAL; | 1206 | goto out; |
1263 | } else { | 1207 | } |
1264 | if (adapter->mode == IW_MODE_ADHOC) { | 1208 | |
1265 | rc = changeadhocchannel(priv, channel); | 1209 | assoc_req->channel = fwrq->m; |
1266 | /* If station is WEP enabled, send the | 1210 | ret = 0; |
1267 | * command to set WEP in firmware | 1211 | |
1268 | */ | 1212 | out: |
1269 | if (adapter->secinfo.wep_enabled) { | 1213 | if (ret == 0) { |
1270 | lbs_pr_debug(1, "set_freq: WEP enabled\n"); | 1214 | set_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags); |
1271 | ret = libertas_prepare_and_send_command(priv, | 1215 | wlan_postpone_association_work(priv); |
1272 | cmd_802_11_set_wep, | 1216 | } else { |
1273 | cmd_act_add, | 1217 | wlan_cancel_association_work(priv); |
1274 | cmd_option_waitforrsp, | ||
1275 | 0, | ||
1276 | NULL); | ||
1277 | |||
1278 | if (ret) { | ||
1279 | LEAVE(); | ||
1280 | return ret; | ||
1281 | } | ||
1282 | |||
1283 | adapter->currentpacketfilter |= | ||
1284 | cmd_act_mac_wep_enable; | ||
1285 | |||
1286 | libertas_set_mac_packet_filter(priv); | ||
1287 | } | ||
1288 | } else { | ||
1289 | rc = -EOPNOTSUPP; | ||
1290 | } | ||
1291 | } | ||
1292 | } | 1218 | } |
1219 | mutex_unlock(&adapter->lock); | ||
1293 | 1220 | ||
1294 | LEAVE(); | 1221 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
1295 | return rc; | 1222 | return ret; |
1296 | } | 1223 | } |
1297 | 1224 | ||
1298 | /** | 1225 | /** |
@@ -1338,9 +1265,9 @@ static int wlan_set_rate(struct net_device *dev, struct iw_request_info *info, | |||
1338 | u8 rates[WLAN_SUPPORTED_RATES]; | 1265 | u8 rates[WLAN_SUPPORTED_RATES]; |
1339 | u8 *rate; | 1266 | u8 *rate; |
1340 | 1267 | ||
1341 | ENTER(); | 1268 | lbs_deb_enter(LBS_DEB_WEXT); |
1342 | 1269 | ||
1343 | lbs_pr_debug(1, "Vwrq->value = %d\n", vwrq->value); | 1270 | lbs_deb_wext("vwrq->value %d\n", vwrq->value); |
1344 | 1271 | ||
1345 | if (vwrq->value == -1) { | 1272 | if (vwrq->value == -1) { |
1346 | action = cmd_act_set_tx_auto; // Auto | 1273 | action = cmd_act_set_tx_auto; // Auto |
@@ -1357,15 +1284,15 @@ static int wlan_set_rate(struct net_device *dev, struct iw_request_info *info, | |||
1357 | get_active_data_rates(adapter, rates); | 1284 | get_active_data_rates(adapter, rates); |
1358 | rate = rates; | 1285 | rate = rates; |
1359 | while (*rate) { | 1286 | while (*rate) { |
1360 | lbs_pr_debug(1, "Rate=0x%X Wanted=0x%X\n", *rate, | 1287 | lbs_deb_wext("rate=0x%X, wanted data_rate 0x%X\n", *rate, |
1361 | data_rate); | 1288 | data_rate); |
1362 | if ((*rate & 0x7f) == (data_rate & 0x7f)) | 1289 | if ((*rate & 0x7f) == (data_rate & 0x7f)) |
1363 | break; | 1290 | break; |
1364 | rate++; | 1291 | rate++; |
1365 | } | 1292 | } |
1366 | if (!*rate) { | 1293 | if (!*rate) { |
1367 | lbs_pr_alert( "The fixed data rate 0x%X is out " | 1294 | lbs_pr_alert("fixed data rate 0x%X out " |
1368 | "of range.\n", data_rate); | 1295 | "of range\n", data_rate); |
1369 | return -EINVAL; | 1296 | return -EINVAL; |
1370 | } | 1297 | } |
1371 | 1298 | ||
@@ -1377,7 +1304,7 @@ static int wlan_set_rate(struct net_device *dev, struct iw_request_info *info, | |||
1377 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_data_rate, | 1304 | ret = libertas_prepare_and_send_command(priv, cmd_802_11_data_rate, |
1378 | action, cmd_option_waitforrsp, 0, NULL); | 1305 | action, cmd_option_waitforrsp, 0, NULL); |
1379 | 1306 | ||
1380 | LEAVE(); | 1307 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
1381 | return ret; | 1308 | return ret; |
1382 | } | 1309 | } |
1383 | 1310 | ||
@@ -1387,7 +1314,7 @@ static int wlan_get_rate(struct net_device *dev, struct iw_request_info *info, | |||
1387 | wlan_private *priv = dev->priv; | 1314 | wlan_private *priv = dev->priv; |
1388 | wlan_adapter *adapter = priv->adapter; | 1315 | wlan_adapter *adapter = priv->adapter; |
1389 | 1316 | ||
1390 | ENTER(); | 1317 | lbs_deb_enter(LBS_DEB_WEXT); |
1391 | 1318 | ||
1392 | if (adapter->is_datarate_auto) { | 1319 | if (adapter->is_datarate_auto) { |
1393 | vwrq->fixed = 0; | 1320 | vwrq->fixed = 0; |
@@ -1397,7 +1324,7 @@ static int wlan_get_rate(struct net_device *dev, struct iw_request_info *info, | |||
1397 | 1324 | ||
1398 | vwrq->value = adapter->datarate * 500000; | 1325 | vwrq->value = adapter->datarate * 500000; |
1399 | 1326 | ||
1400 | LEAVE(); | 1327 | lbs_deb_leave(LBS_DEB_WEXT); |
1401 | return 0; | 1328 | return 0; |
1402 | } | 1329 | } |
1403 | 1330 | ||
@@ -1409,12 +1336,12 @@ static int wlan_set_mode(struct net_device *dev, | |||
1409 | wlan_adapter *adapter = priv->adapter; | 1336 | wlan_adapter *adapter = priv->adapter; |
1410 | struct assoc_request * assoc_req; | 1337 | struct assoc_request * assoc_req; |
1411 | 1338 | ||
1412 | ENTER(); | 1339 | lbs_deb_enter(LBS_DEB_WEXT); |
1413 | 1340 | ||
1414 | if ( (*uwrq != IW_MODE_ADHOC) | 1341 | if ( (*uwrq != IW_MODE_ADHOC) |
1415 | && (*uwrq != IW_MODE_INFRA) | 1342 | && (*uwrq != IW_MODE_INFRA) |
1416 | && (*uwrq != IW_MODE_AUTO)) { | 1343 | && (*uwrq != IW_MODE_AUTO)) { |
1417 | lbs_pr_debug(1, "Invalid mode: 0x%x\n", *uwrq); | 1344 | lbs_deb_wext("Invalid mode: 0x%x\n", *uwrq); |
1418 | ret = -EINVAL; | 1345 | ret = -EINVAL; |
1419 | goto out; | 1346 | goto out; |
1420 | } | 1347 | } |
@@ -1428,12 +1355,12 @@ static int wlan_set_mode(struct net_device *dev, | |||
1428 | assoc_req->mode = *uwrq; | 1355 | assoc_req->mode = *uwrq; |
1429 | set_bit(ASSOC_FLAG_MODE, &assoc_req->flags); | 1356 | set_bit(ASSOC_FLAG_MODE, &assoc_req->flags); |
1430 | wlan_postpone_association_work(priv); | 1357 | wlan_postpone_association_work(priv); |
1431 | lbs_pr_debug(1, "Switching to mode: 0x%x\n", *uwrq); | 1358 | lbs_deb_wext("Switching to mode: 0x%x\n", *uwrq); |
1432 | } | 1359 | } |
1433 | mutex_unlock(&adapter->lock); | 1360 | mutex_unlock(&adapter->lock); |
1434 | 1361 | ||
1435 | out: | 1362 | out: |
1436 | LEAVE(); | 1363 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
1437 | return ret; | 1364 | return ret; |
1438 | } | 1365 | } |
1439 | 1366 | ||
@@ -1455,9 +1382,9 @@ static int wlan_get_encode(struct net_device *dev, | |||
1455 | wlan_adapter *adapter = priv->adapter; | 1382 | wlan_adapter *adapter = priv->adapter; |
1456 | int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; | 1383 | int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; |
1457 | 1384 | ||
1458 | ENTER(); | 1385 | lbs_deb_enter(LBS_DEB_WEXT); |
1459 | 1386 | ||
1460 | lbs_pr_debug(1, "flags=0x%x index=%d length=%d wep_tx_keyidx=%d\n", | 1387 | lbs_deb_wext("flags 0x%x, index %d, length %d, wep_tx_keyidx %d\n", |
1461 | dwrq->flags, index, dwrq->length, adapter->wep_tx_keyidx); | 1388 | dwrq->flags, index, dwrq->length, adapter->wep_tx_keyidx); |
1462 | 1389 | ||
1463 | dwrq->flags = 0; | 1390 | dwrq->flags = 0; |
@@ -1513,13 +1440,13 @@ static int wlan_get_encode(struct net_device *dev, | |||
1513 | 1440 | ||
1514 | dwrq->flags |= IW_ENCODE_NOKEY; | 1441 | dwrq->flags |= IW_ENCODE_NOKEY; |
1515 | 1442 | ||
1516 | lbs_pr_debug(1, "key:%02x:%02x:%02x:%02x:%02x:%02x keylen=%d\n", | 1443 | lbs_deb_wext("key: " MAC_FMT ", keylen %d\n", |
1517 | extra[0], extra[1], extra[2], | 1444 | extra[0], extra[1], extra[2], |
1518 | extra[3], extra[4], extra[5], dwrq->length); | 1445 | extra[3], extra[4], extra[5], dwrq->length); |
1519 | 1446 | ||
1520 | lbs_pr_debug(1, "Return flags=0x%x\n", dwrq->flags); | 1447 | lbs_deb_wext("return flags 0x%x\n", dwrq->flags); |
1521 | 1448 | ||
1522 | LEAVE(); | 1449 | lbs_deb_leave(LBS_DEB_WEXT); |
1523 | return 0; | 1450 | return 0; |
1524 | } | 1451 | } |
1525 | 1452 | ||
@@ -1539,20 +1466,21 @@ static int wlan_set_wep_key(struct assoc_request *assoc_req, | |||
1539 | u16 index, | 1466 | u16 index, |
1540 | int set_tx_key) | 1467 | int set_tx_key) |
1541 | { | 1468 | { |
1469 | int ret = 0; | ||
1542 | struct WLAN_802_11_KEY *pkey; | 1470 | struct WLAN_802_11_KEY *pkey; |
1543 | 1471 | ||
1544 | ENTER(); | 1472 | lbs_deb_enter(LBS_DEB_WEXT); |
1545 | 1473 | ||
1546 | /* Paranoid validation of key index */ | 1474 | /* Paranoid validation of key index */ |
1547 | if (index > 3) { | 1475 | if (index > 3) { |
1548 | LEAVE(); | 1476 | ret = -EINVAL; |
1549 | return -EINVAL; | 1477 | goto out; |
1550 | } | 1478 | } |
1551 | 1479 | ||
1552 | /* validate max key length */ | 1480 | /* validate max key length */ |
1553 | if (key_length > KEY_LEN_WEP_104) { | 1481 | if (key_length > KEY_LEN_WEP_104) { |
1554 | LEAVE(); | 1482 | ret = -EINVAL; |
1555 | return -EINVAL; | 1483 | goto out; |
1556 | } | 1484 | } |
1557 | 1485 | ||
1558 | pkey = &assoc_req->wep_keys[index]; | 1486 | pkey = &assoc_req->wep_keys[index]; |
@@ -1570,17 +1498,18 @@ static int wlan_set_wep_key(struct assoc_request *assoc_req, | |||
1570 | if (set_tx_key) { | 1498 | if (set_tx_key) { |
1571 | /* Ensure the chosen key is valid */ | 1499 | /* Ensure the chosen key is valid */ |
1572 | if (!pkey->len) { | 1500 | if (!pkey->len) { |
1573 | lbs_pr_debug(1, "key not set, so cannot enable it\n"); | 1501 | lbs_deb_wext("key not set, so cannot enable it\n"); |
1574 | LEAVE(); | 1502 | ret = -EINVAL; |
1575 | return -EINVAL; | 1503 | goto out; |
1576 | } | 1504 | } |
1577 | assoc_req->wep_tx_keyidx = index; | 1505 | assoc_req->wep_tx_keyidx = index; |
1578 | } | 1506 | } |
1579 | 1507 | ||
1580 | assoc_req->secinfo.wep_enabled = 1; | 1508 | assoc_req->secinfo.wep_enabled = 1; |
1581 | 1509 | ||
1582 | LEAVE(); | 1510 | out: |
1583 | return 0; | 1511 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
1512 | return ret; | ||
1584 | } | 1513 | } |
1585 | 1514 | ||
1586 | static int validate_key_index(u16 def_index, u16 raw_index, | 1515 | static int validate_key_index(u16 def_index, u16 raw_index, |
@@ -1605,6 +1534,8 @@ static void disable_wep(struct assoc_request *assoc_req) | |||
1605 | { | 1534 | { |
1606 | int i; | 1535 | int i; |
1607 | 1536 | ||
1537 | lbs_deb_enter(LBS_DEB_WEXT); | ||
1538 | |||
1608 | /* Set Open System auth mode */ | 1539 | /* Set Open System auth mode */ |
1609 | assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; | 1540 | assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; |
1610 | 1541 | ||
@@ -1615,6 +1546,27 @@ static void disable_wep(struct assoc_request *assoc_req) | |||
1615 | 1546 | ||
1616 | set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags); | 1547 | set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags); |
1617 | set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags); | 1548 | set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags); |
1549 | |||
1550 | lbs_deb_leave(LBS_DEB_WEXT); | ||
1551 | } | ||
1552 | |||
1553 | static void disable_wpa(struct assoc_request *assoc_req) | ||
1554 | { | ||
1555 | lbs_deb_enter(LBS_DEB_WEXT); | ||
1556 | |||
1557 | memset(&assoc_req->wpa_mcast_key, 0, sizeof (struct WLAN_802_11_KEY)); | ||
1558 | assoc_req->wpa_mcast_key.flags = KEY_INFO_WPA_MCAST; | ||
1559 | set_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags); | ||
1560 | |||
1561 | memset(&assoc_req->wpa_unicast_key, 0, sizeof (struct WLAN_802_11_KEY)); | ||
1562 | assoc_req->wpa_unicast_key.flags = KEY_INFO_WPA_UNICAST; | ||
1563 | set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags); | ||
1564 | |||
1565 | assoc_req->secinfo.WPAenabled = 0; | ||
1566 | assoc_req->secinfo.WPA2enabled = 0; | ||
1567 | set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags); | ||
1568 | |||
1569 | lbs_deb_leave(LBS_DEB_WEXT); | ||
1618 | } | 1570 | } |
1619 | 1571 | ||
1620 | /** | 1572 | /** |
@@ -1636,7 +1588,7 @@ static int wlan_set_encode(struct net_device *dev, | |||
1636 | struct assoc_request * assoc_req; | 1588 | struct assoc_request * assoc_req; |
1637 | u16 is_default = 0, index = 0, set_tx_key = 0; | 1589 | u16 is_default = 0, index = 0, set_tx_key = 0; |
1638 | 1590 | ||
1639 | ENTER(); | 1591 | lbs_deb_enter(LBS_DEB_WEXT); |
1640 | 1592 | ||
1641 | mutex_lock(&adapter->lock); | 1593 | mutex_lock(&adapter->lock); |
1642 | assoc_req = wlan_get_association_request(adapter); | 1594 | assoc_req = wlan_get_association_request(adapter); |
@@ -1647,6 +1599,7 @@ static int wlan_set_encode(struct net_device *dev, | |||
1647 | 1599 | ||
1648 | if (dwrq->flags & IW_ENCODE_DISABLED) { | 1600 | if (dwrq->flags & IW_ENCODE_DISABLED) { |
1649 | disable_wep (assoc_req); | 1601 | disable_wep (assoc_req); |
1602 | disable_wpa (assoc_req); | ||
1650 | goto out; | 1603 | goto out; |
1651 | } | 1604 | } |
1652 | 1605 | ||
@@ -1688,7 +1641,7 @@ out: | |||
1688 | } | 1641 | } |
1689 | mutex_unlock(&adapter->lock); | 1642 | mutex_unlock(&adapter->lock); |
1690 | 1643 | ||
1691 | LEAVE(); | 1644 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
1692 | return ret; | 1645 | return ret; |
1693 | } | 1646 | } |
1694 | 1647 | ||
@@ -1712,7 +1665,7 @@ static int wlan_get_encodeext(struct net_device *dev, | |||
1712 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; | 1665 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; |
1713 | int index, max_key_len; | 1666 | int index, max_key_len; |
1714 | 1667 | ||
1715 | ENTER(); | 1668 | lbs_deb_enter(LBS_DEB_WEXT); |
1716 | 1669 | ||
1717 | max_key_len = dwrq->length - sizeof(*ext); | 1670 | max_key_len = dwrq->length - sizeof(*ext); |
1718 | if (max_key_len < 0) | 1671 | if (max_key_len < 0) |
@@ -1748,6 +1701,7 @@ static int wlan_get_encodeext(struct net_device *dev, | |||
1748 | if ( adapter->secinfo.wep_enabled | 1701 | if ( adapter->secinfo.wep_enabled |
1749 | && !adapter->secinfo.WPAenabled | 1702 | && !adapter->secinfo.WPAenabled |
1750 | && !adapter->secinfo.WPA2enabled) { | 1703 | && !adapter->secinfo.WPA2enabled) { |
1704 | /* WEP */ | ||
1751 | ext->alg = IW_ENCODE_ALG_WEP; | 1705 | ext->alg = IW_ENCODE_ALG_WEP; |
1752 | ext->key_len = adapter->wep_keys[index].len; | 1706 | ext->key_len = adapter->wep_keys[index].len; |
1753 | key = &adapter->wep_keys[index].key[0]; | 1707 | key = &adapter->wep_keys[index].key[0]; |
@@ -1755,8 +1709,27 @@ static int wlan_get_encodeext(struct net_device *dev, | |||
1755 | && (adapter->secinfo.WPAenabled || | 1709 | && (adapter->secinfo.WPAenabled || |
1756 | adapter->secinfo.WPA2enabled)) { | 1710 | adapter->secinfo.WPA2enabled)) { |
1757 | /* WPA */ | 1711 | /* WPA */ |
1758 | ext->alg = IW_ENCODE_ALG_TKIP; | 1712 | struct WLAN_802_11_KEY * pkey = NULL; |
1759 | ext->key_len = 0; | 1713 | |
1714 | if ( adapter->wpa_mcast_key.len | ||
1715 | && (adapter->wpa_mcast_key.flags & KEY_INFO_WPA_ENABLED)) | ||
1716 | pkey = &adapter->wpa_mcast_key; | ||
1717 | else if ( adapter->wpa_unicast_key.len | ||
1718 | && (adapter->wpa_unicast_key.flags & KEY_INFO_WPA_ENABLED)) | ||
1719 | pkey = &adapter->wpa_unicast_key; | ||
1720 | |||
1721 | if (pkey) { | ||
1722 | if (pkey->type == KEY_TYPE_ID_AES) { | ||
1723 | ext->alg = IW_ENCODE_ALG_CCMP; | ||
1724 | } else { | ||
1725 | ext->alg = IW_ENCODE_ALG_TKIP; | ||
1726 | } | ||
1727 | ext->key_len = pkey->len; | ||
1728 | key = &pkey->key[0]; | ||
1729 | } else { | ||
1730 | ext->alg = IW_ENCODE_ALG_TKIP; | ||
1731 | ext->key_len = 0; | ||
1732 | } | ||
1760 | } else { | 1733 | } else { |
1761 | goto out; | 1734 | goto out; |
1762 | } | 1735 | } |
@@ -1775,7 +1748,7 @@ static int wlan_get_encodeext(struct net_device *dev, | |||
1775 | ret = 0; | 1748 | ret = 0; |
1776 | 1749 | ||
1777 | out: | 1750 | out: |
1778 | LEAVE(); | 1751 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
1779 | return ret; | 1752 | return ret; |
1780 | } | 1753 | } |
1781 | 1754 | ||
@@ -1800,7 +1773,7 @@ static int wlan_set_encodeext(struct net_device *dev, | |||
1800 | int alg = ext->alg; | 1773 | int alg = ext->alg; |
1801 | struct assoc_request * assoc_req; | 1774 | struct assoc_request * assoc_req; |
1802 | 1775 | ||
1803 | ENTER(); | 1776 | lbs_deb_enter(LBS_DEB_WEXT); |
1804 | 1777 | ||
1805 | mutex_lock(&adapter->lock); | 1778 | mutex_lock(&adapter->lock); |
1806 | assoc_req = wlan_get_association_request(adapter); | 1779 | assoc_req = wlan_get_association_request(adapter); |
@@ -1811,6 +1784,7 @@ static int wlan_set_encodeext(struct net_device *dev, | |||
1811 | 1784 | ||
1812 | if ((alg == IW_ENCODE_ALG_NONE) || (dwrq->flags & IW_ENCODE_DISABLED)) { | 1785 | if ((alg == IW_ENCODE_ALG_NONE) || (dwrq->flags & IW_ENCODE_DISABLED)) { |
1813 | disable_wep (assoc_req); | 1786 | disable_wep (assoc_req); |
1787 | disable_wpa (assoc_req); | ||
1814 | } else if (alg == IW_ENCODE_ALG_WEP) { | 1788 | } else if (alg == IW_ENCODE_ALG_WEP) { |
1815 | u16 is_default = 0, index, set_tx_key = 0; | 1789 | u16 is_default = 0, index, set_tx_key = 0; |
1816 | 1790 | ||
@@ -1846,7 +1820,6 @@ static int wlan_set_encodeext(struct net_device *dev, | |||
1846 | set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags); | 1820 | set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags); |
1847 | if (set_tx_key) | 1821 | if (set_tx_key) |
1848 | set_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags); | 1822 | set_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags); |
1849 | |||
1850 | } else if ((alg == IW_ENCODE_ALG_TKIP) || (alg == IW_ENCODE_ALG_CCMP)) { | 1823 | } else if ((alg == IW_ENCODE_ALG_TKIP) || (alg == IW_ENCODE_ALG_CCMP)) { |
1851 | struct WLAN_802_11_KEY * pkey; | 1824 | struct WLAN_802_11_KEY * pkey; |
1852 | 1825 | ||
@@ -1855,36 +1828,43 @@ static int wlan_set_encodeext(struct net_device *dev, | |||
1855 | && (ext->key_len != KEY_LEN_WPA_TKIP)) | 1828 | && (ext->key_len != KEY_LEN_WPA_TKIP)) |
1856 | || ((alg == IW_ENCODE_ALG_CCMP) | 1829 | || ((alg == IW_ENCODE_ALG_CCMP) |
1857 | && (ext->key_len != KEY_LEN_WPA_AES))) { | 1830 | && (ext->key_len != KEY_LEN_WPA_AES))) { |
1858 | lbs_pr_debug(1, "Invalid size %d for key of alg" | 1831 | lbs_deb_wext("invalid size %d for key of alg" |
1859 | "type %d.\n", | 1832 | "type %d\n", |
1860 | ext->key_len, | 1833 | ext->key_len, |
1861 | alg); | 1834 | alg); |
1862 | ret = -EINVAL; | 1835 | ret = -EINVAL; |
1863 | goto out; | 1836 | goto out; |
1864 | } | 1837 | } |
1865 | 1838 | ||
1866 | if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) | 1839 | if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { |
1867 | pkey = &assoc_req->wpa_mcast_key; | 1840 | pkey = &assoc_req->wpa_mcast_key; |
1868 | else | 1841 | set_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags); |
1842 | } else { | ||
1869 | pkey = &assoc_req->wpa_unicast_key; | 1843 | pkey = &assoc_req->wpa_unicast_key; |
1844 | set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags); | ||
1845 | } | ||
1870 | 1846 | ||
1871 | memset(pkey, 0, sizeof (struct WLAN_802_11_KEY)); | 1847 | memset(pkey, 0, sizeof (struct WLAN_802_11_KEY)); |
1872 | memcpy(pkey->key, ext->key, ext->key_len); | 1848 | memcpy(pkey->key, ext->key, ext->key_len); |
1873 | pkey->len = ext->key_len; | 1849 | pkey->len = ext->key_len; |
1874 | pkey->flags = KEY_INFO_WPA_ENABLED; | 1850 | if (pkey->len) |
1851 | pkey->flags |= KEY_INFO_WPA_ENABLED; | ||
1875 | 1852 | ||
1853 | /* Do this after zeroing key structure */ | ||
1876 | if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { | 1854 | if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { |
1877 | pkey->flags |= KEY_INFO_WPA_MCAST; | 1855 | pkey->flags |= KEY_INFO_WPA_MCAST; |
1878 | set_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags); | ||
1879 | } else { | 1856 | } else { |
1880 | pkey->flags |= KEY_INFO_WPA_UNICAST; | 1857 | pkey->flags |= KEY_INFO_WPA_UNICAST; |
1881 | set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags); | ||
1882 | } | 1858 | } |
1883 | 1859 | ||
1884 | if (alg == IW_ENCODE_ALG_TKIP) | 1860 | if (alg == IW_ENCODE_ALG_TKIP) { |
1885 | pkey->type = KEY_TYPE_ID_TKIP; | 1861 | pkey->type = KEY_TYPE_ID_TKIP; |
1886 | else if (alg == IW_ENCODE_ALG_CCMP) | 1862 | } else if (alg == IW_ENCODE_ALG_CCMP) { |
1887 | pkey->type = KEY_TYPE_ID_AES; | 1863 | pkey->type = KEY_TYPE_ID_AES; |
1864 | } else { | ||
1865 | ret = -EINVAL; | ||
1866 | goto out; | ||
1867 | } | ||
1888 | 1868 | ||
1889 | /* If WPA isn't enabled yet, do that now */ | 1869 | /* If WPA isn't enabled yet, do that now */ |
1890 | if ( assoc_req->secinfo.WPAenabled == 0 | 1870 | if ( assoc_req->secinfo.WPAenabled == 0 |
@@ -1905,7 +1885,7 @@ out: | |||
1905 | } | 1885 | } |
1906 | mutex_unlock(&adapter->lock); | 1886 | mutex_unlock(&adapter->lock); |
1907 | 1887 | ||
1908 | LEAVE(); | 1888 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
1909 | return ret; | 1889 | return ret; |
1910 | } | 1890 | } |
1911 | 1891 | ||
@@ -1920,7 +1900,7 @@ static int wlan_set_genie(struct net_device *dev, | |||
1920 | int ret = 0; | 1900 | int ret = 0; |
1921 | struct assoc_request * assoc_req; | 1901 | struct assoc_request * assoc_req; |
1922 | 1902 | ||
1923 | ENTER(); | 1903 | lbs_deb_enter(LBS_DEB_WEXT); |
1924 | 1904 | ||
1925 | mutex_lock(&adapter->lock); | 1905 | mutex_lock(&adapter->lock); |
1926 | assoc_req = wlan_get_association_request(adapter); | 1906 | assoc_req = wlan_get_association_request(adapter); |
@@ -1952,7 +1932,7 @@ out: | |||
1952 | } | 1932 | } |
1953 | mutex_unlock(&adapter->lock); | 1933 | mutex_unlock(&adapter->lock); |
1954 | 1934 | ||
1955 | LEAVE(); | 1935 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
1956 | return ret; | 1936 | return ret; |
1957 | } | 1937 | } |
1958 | 1938 | ||
@@ -1961,27 +1941,28 @@ static int wlan_get_genie(struct net_device *dev, | |||
1961 | struct iw_point *dwrq, | 1941 | struct iw_point *dwrq, |
1962 | char *extra) | 1942 | char *extra) |
1963 | { | 1943 | { |
1944 | int ret = 0; | ||
1964 | wlan_private *priv = dev->priv; | 1945 | wlan_private *priv = dev->priv; |
1965 | wlan_adapter *adapter = priv->adapter; | 1946 | wlan_adapter *adapter = priv->adapter; |
1966 | 1947 | ||
1967 | ENTER(); | 1948 | lbs_deb_enter(LBS_DEB_WEXT); |
1968 | 1949 | ||
1969 | if (adapter->wpa_ie_len == 0) { | 1950 | if (adapter->wpa_ie_len == 0) { |
1970 | dwrq->length = 0; | 1951 | dwrq->length = 0; |
1971 | LEAVE(); | 1952 | goto out; |
1972 | return 0; | ||
1973 | } | 1953 | } |
1974 | 1954 | ||
1975 | if (dwrq->length < adapter->wpa_ie_len) { | 1955 | if (dwrq->length < adapter->wpa_ie_len) { |
1976 | LEAVE(); | 1956 | ret = -E2BIG; |
1977 | return -E2BIG; | 1957 | goto out; |
1978 | } | 1958 | } |
1979 | 1959 | ||
1980 | dwrq->length = adapter->wpa_ie_len; | 1960 | dwrq->length = adapter->wpa_ie_len; |
1981 | memcpy(extra, &adapter->wpa_ie[0], adapter->wpa_ie_len); | 1961 | memcpy(extra, &adapter->wpa_ie[0], adapter->wpa_ie_len); |
1982 | 1962 | ||
1983 | LEAVE(); | 1963 | out: |
1984 | return 0; | 1964 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
1965 | return ret; | ||
1985 | } | 1966 | } |
1986 | 1967 | ||
1987 | 1968 | ||
@@ -1996,7 +1977,7 @@ static int wlan_set_auth(struct net_device *dev, | |||
1996 | int ret = 0; | 1977 | int ret = 0; |
1997 | int updated = 0; | 1978 | int updated = 0; |
1998 | 1979 | ||
1999 | ENTER(); | 1980 | lbs_deb_enter(LBS_DEB_WEXT); |
2000 | 1981 | ||
2001 | mutex_lock(&adapter->lock); | 1982 | mutex_lock(&adapter->lock); |
2002 | assoc_req = wlan_get_association_request(adapter); | 1983 | assoc_req = wlan_get_association_request(adapter); |
@@ -2010,6 +1991,7 @@ static int wlan_set_auth(struct net_device *dev, | |||
2010 | case IW_AUTH_CIPHER_PAIRWISE: | 1991 | case IW_AUTH_CIPHER_PAIRWISE: |
2011 | case IW_AUTH_CIPHER_GROUP: | 1992 | case IW_AUTH_CIPHER_GROUP: |
2012 | case IW_AUTH_KEY_MGMT: | 1993 | case IW_AUTH_KEY_MGMT: |
1994 | case IW_AUTH_DROP_UNENCRYPTED: | ||
2013 | /* | 1995 | /* |
2014 | * libertas does not use these parameters | 1996 | * libertas does not use these parameters |
2015 | */ | 1997 | */ |
@@ -2019,6 +2001,7 @@ static int wlan_set_auth(struct net_device *dev, | |||
2019 | if (dwrq->value & IW_AUTH_WPA_VERSION_DISABLED) { | 2001 | if (dwrq->value & IW_AUTH_WPA_VERSION_DISABLED) { |
2020 | assoc_req->secinfo.WPAenabled = 0; | 2002 | assoc_req->secinfo.WPAenabled = 0; |
2021 | assoc_req->secinfo.WPA2enabled = 0; | 2003 | assoc_req->secinfo.WPA2enabled = 0; |
2004 | disable_wpa (assoc_req); | ||
2022 | } | 2005 | } |
2023 | if (dwrq->value & IW_AUTH_WPA_VERSION_WPA) { | 2006 | if (dwrq->value & IW_AUTH_WPA_VERSION_WPA) { |
2024 | assoc_req->secinfo.WPAenabled = 1; | 2007 | assoc_req->secinfo.WPAenabled = 1; |
@@ -2033,17 +2016,6 @@ static int wlan_set_auth(struct net_device *dev, | |||
2033 | updated = 1; | 2016 | updated = 1; |
2034 | break; | 2017 | break; |
2035 | 2018 | ||
2036 | case IW_AUTH_DROP_UNENCRYPTED: | ||
2037 | if (dwrq->value) { | ||
2038 | adapter->currentpacketfilter |= | ||
2039 | cmd_act_mac_strict_protection_enable; | ||
2040 | } else { | ||
2041 | adapter->currentpacketfilter &= | ||
2042 | ~cmd_act_mac_strict_protection_enable; | ||
2043 | } | ||
2044 | updated = 1; | ||
2045 | break; | ||
2046 | |||
2047 | case IW_AUTH_80211_AUTH_ALG: | 2019 | case IW_AUTH_80211_AUTH_ALG: |
2048 | if (dwrq->value & IW_AUTH_ALG_SHARED_KEY) { | 2020 | if (dwrq->value & IW_AUTH_ALG_SHARED_KEY) { |
2049 | assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY; | 2021 | assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY; |
@@ -2069,6 +2041,7 @@ static int wlan_set_auth(struct net_device *dev, | |||
2069 | } else { | 2041 | } else { |
2070 | assoc_req->secinfo.WPAenabled = 0; | 2042 | assoc_req->secinfo.WPAenabled = 0; |
2071 | assoc_req->secinfo.WPA2enabled = 0; | 2043 | assoc_req->secinfo.WPA2enabled = 0; |
2044 | disable_wpa (assoc_req); | ||
2072 | } | 2045 | } |
2073 | updated = 1; | 2046 | updated = 1; |
2074 | break; | 2047 | break; |
@@ -2088,7 +2061,7 @@ out: | |||
2088 | } | 2061 | } |
2089 | mutex_unlock(&adapter->lock); | 2062 | mutex_unlock(&adapter->lock); |
2090 | 2063 | ||
2091 | LEAVE(); | 2064 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
2092 | return ret; | 2065 | return ret; |
2093 | } | 2066 | } |
2094 | 2067 | ||
@@ -2097,10 +2070,11 @@ static int wlan_get_auth(struct net_device *dev, | |||
2097 | struct iw_param *dwrq, | 2070 | struct iw_param *dwrq, |
2098 | char *extra) | 2071 | char *extra) |
2099 | { | 2072 | { |
2073 | int ret = 0; | ||
2100 | wlan_private *priv = dev->priv; | 2074 | wlan_private *priv = dev->priv; |
2101 | wlan_adapter *adapter = priv->adapter; | 2075 | wlan_adapter *adapter = priv->adapter; |
2102 | 2076 | ||
2103 | ENTER(); | 2077 | lbs_deb_enter(LBS_DEB_WEXT); |
2104 | 2078 | ||
2105 | switch (dwrq->flags & IW_AUTH_INDEX) { | 2079 | switch (dwrq->flags & IW_AUTH_INDEX) { |
2106 | case IW_AUTH_WPA_VERSION: | 2080 | case IW_AUTH_WPA_VERSION: |
@@ -2113,13 +2087,6 @@ static int wlan_get_auth(struct net_device *dev, | |||
2113 | dwrq->value |= IW_AUTH_WPA_VERSION_DISABLED; | 2087 | dwrq->value |= IW_AUTH_WPA_VERSION_DISABLED; |
2114 | break; | 2088 | break; |
2115 | 2089 | ||
2116 | case IW_AUTH_DROP_UNENCRYPTED: | ||
2117 | dwrq->value = 0; | ||
2118 | if (adapter->currentpacketfilter & | ||
2119 | cmd_act_mac_strict_protection_enable) | ||
2120 | dwrq->value = 1; | ||
2121 | break; | ||
2122 | |||
2123 | case IW_AUTH_80211_AUTH_ALG: | 2090 | case IW_AUTH_80211_AUTH_ALG: |
2124 | dwrq->value = adapter->secinfo.auth_mode; | 2091 | dwrq->value = adapter->secinfo.auth_mode; |
2125 | break; | 2092 | break; |
@@ -2130,12 +2097,11 @@ static int wlan_get_auth(struct net_device *dev, | |||
2130 | break; | 2097 | break; |
2131 | 2098 | ||
2132 | default: | 2099 | default: |
2133 | LEAVE(); | 2100 | ret = -EOPNOTSUPP; |
2134 | return -EOPNOTSUPP; | ||
2135 | } | 2101 | } |
2136 | 2102 | ||
2137 | LEAVE(); | 2103 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
2138 | return 0; | 2104 | return ret; |
2139 | } | 2105 | } |
2140 | 2106 | ||
2141 | 2107 | ||
@@ -2148,7 +2114,7 @@ static int wlan_set_txpow(struct net_device *dev, struct iw_request_info *info, | |||
2148 | 2114 | ||
2149 | u16 dbm; | 2115 | u16 dbm; |
2150 | 2116 | ||
2151 | ENTER(); | 2117 | lbs_deb_enter(LBS_DEB_WEXT); |
2152 | 2118 | ||
2153 | if (vwrq->disabled) { | 2119 | if (vwrq->disabled) { |
2154 | wlan_radio_ioctl(priv, RADIO_OFF); | 2120 | wlan_radio_ioctl(priv, RADIO_OFF); |
@@ -2169,14 +2135,14 @@ static int wlan_set_txpow(struct net_device *dev, struct iw_request_info *info, | |||
2169 | if (vwrq->fixed == 0) | 2135 | if (vwrq->fixed == 0) |
2170 | dbm = 0xffff; | 2136 | dbm = 0xffff; |
2171 | 2137 | ||
2172 | lbs_pr_debug(1, "<1>TXPOWER SET %d dbm.\n", dbm); | 2138 | lbs_deb_wext("txpower set %d dbm\n", dbm); |
2173 | 2139 | ||
2174 | ret = libertas_prepare_and_send_command(priv, | 2140 | ret = libertas_prepare_and_send_command(priv, |
2175 | cmd_802_11_rf_tx_power, | 2141 | cmd_802_11_rf_tx_power, |
2176 | cmd_act_tx_power_opt_set_low, | 2142 | cmd_act_tx_power_opt_set_low, |
2177 | cmd_option_waitforrsp, 0, (void *)&dbm); | 2143 | cmd_option_waitforrsp, 0, (void *)&dbm); |
2178 | 2144 | ||
2179 | LEAVE(); | 2145 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
2180 | return ret; | 2146 | return ret; |
2181 | } | 2147 | } |
2182 | 2148 | ||
@@ -2186,7 +2152,8 @@ static int wlan_get_essid(struct net_device *dev, struct iw_request_info *info, | |||
2186 | wlan_private *priv = dev->priv; | 2152 | wlan_private *priv = dev->priv; |
2187 | wlan_adapter *adapter = priv->adapter; | 2153 | wlan_adapter *adapter = priv->adapter; |
2188 | 2154 | ||
2189 | ENTER(); | 2155 | lbs_deb_enter(LBS_DEB_WEXT); |
2156 | |||
2190 | /* | 2157 | /* |
2191 | * Note : if dwrq->flags != 0, we should get the relevant SSID from | 2158 | * Note : if dwrq->flags != 0, we should get the relevant SSID from |
2192 | * the SSID list... | 2159 | * the SSID list... |
@@ -2196,12 +2163,12 @@ static int wlan_get_essid(struct net_device *dev, struct iw_request_info *info, | |||
2196 | * Get the current SSID | 2163 | * Get the current SSID |
2197 | */ | 2164 | */ |
2198 | if (adapter->connect_status == libertas_connected) { | 2165 | if (adapter->connect_status == libertas_connected) { |
2199 | memcpy(extra, adapter->curbssparams.ssid.ssid, | 2166 | memcpy(extra, adapter->curbssparams.ssid, |
2200 | adapter->curbssparams.ssid.ssidlength); | 2167 | adapter->curbssparams.ssid_len); |
2201 | extra[adapter->curbssparams.ssid.ssidlength] = '\0'; | 2168 | extra[adapter->curbssparams.ssid_len] = '\0'; |
2202 | } else { | 2169 | } else { |
2203 | memset(extra, 0, 32); | 2170 | memset(extra, 0, 32); |
2204 | extra[adapter->curbssparams.ssid.ssidlength] = '\0'; | 2171 | extra[adapter->curbssparams.ssid_len] = '\0'; |
2205 | } | 2172 | } |
2206 | /* | 2173 | /* |
2207 | * If none, we may want to get the one that was set | 2174 | * If none, we may want to get the one that was set |
@@ -2209,14 +2176,14 @@ static int wlan_get_essid(struct net_device *dev, struct iw_request_info *info, | |||
2209 | 2176 | ||
2210 | /* To make the driver backward compatible with WPA supplicant v0.2.4 */ | 2177 | /* To make the driver backward compatible with WPA supplicant v0.2.4 */ |
2211 | if (dwrq->length == 32) /* check with WPA supplicant buffer size */ | 2178 | if (dwrq->length == 32) /* check with WPA supplicant buffer size */ |
2212 | dwrq->length = min_t(size_t, adapter->curbssparams.ssid.ssidlength, | 2179 | dwrq->length = min_t(size_t, adapter->curbssparams.ssid_len, |
2213 | IW_ESSID_MAX_SIZE); | 2180 | IW_ESSID_MAX_SIZE); |
2214 | else | 2181 | else |
2215 | dwrq->length = adapter->curbssparams.ssid.ssidlength + 1; | 2182 | dwrq->length = adapter->curbssparams.ssid_len + 1; |
2216 | 2183 | ||
2217 | dwrq->flags = 1; /* active */ | 2184 | dwrq->flags = 1; /* active */ |
2218 | 2185 | ||
2219 | LEAVE(); | 2186 | lbs_deb_leave(LBS_DEB_WEXT); |
2220 | return 0; | 2187 | return 0; |
2221 | } | 2188 | } |
2222 | 2189 | ||
@@ -2226,38 +2193,43 @@ static int wlan_set_essid(struct net_device *dev, struct iw_request_info *info, | |||
2226 | wlan_private *priv = dev->priv; | 2193 | wlan_private *priv = dev->priv; |
2227 | wlan_adapter *adapter = priv->adapter; | 2194 | wlan_adapter *adapter = priv->adapter; |
2228 | int ret = 0; | 2195 | int ret = 0; |
2229 | struct WLAN_802_11_SSID ssid; | 2196 | u8 ssid[IW_ESSID_MAX_SIZE]; |
2197 | u8 ssid_len = 0; | ||
2230 | struct assoc_request * assoc_req; | 2198 | struct assoc_request * assoc_req; |
2231 | int ssid_len = dwrq->length; | 2199 | int in_ssid_len = dwrq->length; |
2232 | 2200 | ||
2233 | ENTER(); | 2201 | lbs_deb_enter(LBS_DEB_WEXT); |
2234 | 2202 | ||
2235 | /* | 2203 | /* |
2236 | * WE-20 and earlier NULL pad the end of the SSID and increment | 2204 | * WE-20 and earlier NULL pad the end of the SSID and increment |
2237 | * SSID length so it can be used like a string. WE-21 and later don't, | 2205 | * SSID length so it can be used like a string. WE-21 and later don't, |
2238 | * but some userspace tools aren't able to cope with the change. | 2206 | * but some userspace tools aren't able to cope with the change. |
2239 | */ | 2207 | */ |
2240 | if ((ssid_len > 0) && (extra[ssid_len - 1] == '\0')) | 2208 | if ((in_ssid_len > 0) && (extra[in_ssid_len - 1] == '\0')) |
2241 | ssid_len--; | 2209 | in_ssid_len--; |
2242 | 2210 | ||
2243 | /* Check the size of the string */ | 2211 | /* Check the size of the string */ |
2244 | if (ssid_len > IW_ESSID_MAX_SIZE) { | 2212 | if (in_ssid_len > IW_ESSID_MAX_SIZE) { |
2245 | ret = -E2BIG; | 2213 | ret = -E2BIG; |
2246 | goto out; | 2214 | goto out; |
2247 | } | 2215 | } |
2248 | 2216 | ||
2249 | memset(&ssid, 0, sizeof(struct WLAN_802_11_SSID)); | 2217 | memset(&ssid, 0, sizeof(ssid)); |
2250 | 2218 | ||
2251 | if (!dwrq->flags || !ssid_len) { | 2219 | if (!dwrq->flags || !in_ssid_len) { |
2252 | /* "any" SSID requested; leave SSID blank */ | 2220 | /* "any" SSID requested; leave SSID blank */ |
2253 | } else { | 2221 | } else { |
2254 | /* Specific SSID requested */ | 2222 | /* Specific SSID requested */ |
2255 | memcpy(&ssid.ssid, extra, ssid_len); | 2223 | memcpy(&ssid, extra, in_ssid_len); |
2256 | ssid.ssidlength = ssid_len; | 2224 | ssid_len = in_ssid_len; |
2257 | } | 2225 | } |
2258 | 2226 | ||
2259 | lbs_pr_debug(1, "Requested new SSID = %s\n", | 2227 | if (!ssid_len) { |
2260 | (ssid.ssidlength > 0) ? (char *)ssid.ssid : "any"); | 2228 | lbs_deb_wext("requested any SSID\n"); |
2229 | } else { | ||
2230 | lbs_deb_wext("requested SSID '%s'\n", | ||
2231 | escape_essid(ssid, ssid_len)); | ||
2232 | } | ||
2261 | 2233 | ||
2262 | out: | 2234 | out: |
2263 | mutex_lock(&adapter->lock); | 2235 | mutex_lock(&adapter->lock); |
@@ -2268,7 +2240,8 @@ out: | |||
2268 | ret = -ENOMEM; | 2240 | ret = -ENOMEM; |
2269 | } else { | 2241 | } else { |
2270 | /* Copy the SSID to the association request */ | 2242 | /* Copy the SSID to the association request */ |
2271 | memcpy(&assoc_req->ssid, &ssid, sizeof(struct WLAN_802_11_SSID)); | 2243 | memcpy(&assoc_req->ssid, &ssid, IW_ESSID_MAX_SIZE); |
2244 | assoc_req->ssid_len = ssid_len; | ||
2272 | set_bit(ASSOC_FLAG_SSID, &assoc_req->flags); | 2245 | set_bit(ASSOC_FLAG_SSID, &assoc_req->flags); |
2273 | wlan_postpone_association_work(priv); | 2246 | wlan_postpone_association_work(priv); |
2274 | } | 2247 | } |
@@ -2281,7 +2254,7 @@ out: | |||
2281 | 2254 | ||
2282 | mutex_unlock(&adapter->lock); | 2255 | mutex_unlock(&adapter->lock); |
2283 | 2256 | ||
2284 | LEAVE(); | 2257 | lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); |
2285 | return ret; | 2258 | return ret; |
2286 | } | 2259 | } |
2287 | 2260 | ||
@@ -2302,12 +2275,12 @@ static int wlan_set_wap(struct net_device *dev, struct iw_request_info *info, | |||
2302 | struct assoc_request * assoc_req; | 2275 | struct assoc_request * assoc_req; |
2303 | int ret = 0; | 2276 | int ret = 0; |
2304 | 2277 | ||
2305 | ENTER(); | 2278 | lbs_deb_enter(LBS_DEB_WEXT); |
2306 | 2279 | ||
2307 | if (awrq->sa_family != ARPHRD_ETHER) | 2280 | if (awrq->sa_family != ARPHRD_ETHER) |
2308 | return -EINVAL; | 2281 | return -EINVAL; |
2309 | 2282 | ||
2310 | lbs_pr_debug(1, "ASSOC: WAP: sa_data: " MAC_FMT "\n", MAC_ARG(awrq->sa_data)); | 2283 | lbs_deb_wext("ASSOC: WAP: sa_data " MAC_FMT "\n", MAC_ARG(awrq->sa_data)); |
2311 | 2284 | ||
2312 | mutex_lock(&adapter->lock); | 2285 | mutex_lock(&adapter->lock); |
2313 | 2286 | ||
@@ -2330,22 +2303,23 @@ static int wlan_set_wap(struct net_device *dev, struct iw_request_info *info, | |||
2330 | 2303 | ||
2331 | void libertas_get_fwversion(wlan_adapter * adapter, char *fwversion, int maxlen) | 2304 | void libertas_get_fwversion(wlan_adapter * adapter, char *fwversion, int maxlen) |
2332 | { | 2305 | { |
2333 | union { | ||
2334 | u32 l; | ||
2335 | u8 c[4]; | ||
2336 | } ver; | ||
2337 | char fwver[32]; | 2306 | char fwver[32]; |
2338 | 2307 | ||
2339 | mutex_lock(&adapter->lock); | 2308 | mutex_lock(&adapter->lock); |
2340 | ver.l = adapter->fwreleasenumber; | ||
2341 | mutex_unlock(&adapter->lock); | ||
2342 | 2309 | ||
2343 | if (ver.c[3] == 0) | 2310 | if (adapter->fwreleasenumber[3] == 0) |
2344 | sprintf(fwver, "%u.%u.%u", ver.c[2], ver.c[1], ver.c[0]); | 2311 | sprintf(fwver, "%u.%u.%u", |
2312 | adapter->fwreleasenumber[2], | ||
2313 | adapter->fwreleasenumber[1], | ||
2314 | adapter->fwreleasenumber[0]); | ||
2345 | else | 2315 | else |
2346 | sprintf(fwver, "%u.%u.%u.p%u", | 2316 | sprintf(fwver, "%u.%u.%u.p%u", |
2347 | ver.c[2], ver.c[1], ver.c[0], ver.c[3]); | 2317 | adapter->fwreleasenumber[2], |
2318 | adapter->fwreleasenumber[1], | ||
2319 | adapter->fwreleasenumber[0], | ||
2320 | adapter->fwreleasenumber[3]); | ||
2348 | 2321 | ||
2322 | mutex_unlock(&adapter->lock); | ||
2349 | snprintf(fwversion, maxlen, fwver); | 2323 | snprintf(fwversion, maxlen, fwver); |
2350 | } | 2324 | } |
2351 | 2325 | ||
@@ -2411,6 +2385,63 @@ static const iw_handler wlan_handler[] = { | |||
2411 | (iw_handler) NULL, /* SIOCSIWPMKSA */ | 2385 | (iw_handler) NULL, /* SIOCSIWPMKSA */ |
2412 | }; | 2386 | }; |
2413 | 2387 | ||
2388 | static const iw_handler mesh_wlan_handler[] = { | ||
2389 | (iw_handler) NULL, /* SIOCSIWCOMMIT */ | ||
2390 | (iw_handler) wlan_get_name, /* SIOCGIWNAME */ | ||
2391 | (iw_handler) NULL, /* SIOCSIWNWID */ | ||
2392 | (iw_handler) NULL, /* SIOCGIWNWID */ | ||
2393 | (iw_handler) wlan_set_freq, /* SIOCSIWFREQ */ | ||
2394 | (iw_handler) wlan_get_freq, /* SIOCGIWFREQ */ | ||
2395 | (iw_handler) NULL, /* SIOCSIWMODE */ | ||
2396 | (iw_handler) mesh_wlan_get_mode, /* SIOCGIWMODE */ | ||
2397 | (iw_handler) NULL, /* SIOCSIWSENS */ | ||
2398 | (iw_handler) NULL, /* SIOCGIWSENS */ | ||
2399 | (iw_handler) NULL, /* SIOCSIWRANGE */ | ||
2400 | (iw_handler) wlan_get_range, /* SIOCGIWRANGE */ | ||
2401 | (iw_handler) NULL, /* SIOCSIWPRIV */ | ||
2402 | (iw_handler) NULL, /* SIOCGIWPRIV */ | ||
2403 | (iw_handler) NULL, /* SIOCSIWSTATS */ | ||
2404 | (iw_handler) NULL, /* SIOCGIWSTATS */ | ||
2405 | iw_handler_set_spy, /* SIOCSIWSPY */ | ||
2406 | iw_handler_get_spy, /* SIOCGIWSPY */ | ||
2407 | iw_handler_set_thrspy, /* SIOCSIWTHRSPY */ | ||
2408 | iw_handler_get_thrspy, /* SIOCGIWTHRSPY */ | ||
2409 | (iw_handler) NULL, /* SIOCSIWAP */ | ||
2410 | (iw_handler) NULL, /* SIOCGIWAP */ | ||
2411 | (iw_handler) NULL, /* SIOCSIWMLME */ | ||
2412 | (iw_handler) NULL, /* SIOCGIWAPLIST - deprecated */ | ||
2413 | (iw_handler) libertas_set_scan, /* SIOCSIWSCAN */ | ||
2414 | (iw_handler) libertas_get_scan, /* SIOCGIWSCAN */ | ||
2415 | (iw_handler) NULL, /* SIOCSIWESSID */ | ||
2416 | (iw_handler) NULL, /* SIOCGIWESSID */ | ||
2417 | (iw_handler) NULL, /* SIOCSIWNICKN */ | ||
2418 | (iw_handler) mesh_get_nick, /* SIOCGIWNICKN */ | ||
2419 | (iw_handler) NULL, /* -- hole -- */ | ||
2420 | (iw_handler) NULL, /* -- hole -- */ | ||
2421 | (iw_handler) wlan_set_rate, /* SIOCSIWRATE */ | ||
2422 | (iw_handler) wlan_get_rate, /* SIOCGIWRATE */ | ||
2423 | (iw_handler) wlan_set_rts, /* SIOCSIWRTS */ | ||
2424 | (iw_handler) wlan_get_rts, /* SIOCGIWRTS */ | ||
2425 | (iw_handler) wlan_set_frag, /* SIOCSIWFRAG */ | ||
2426 | (iw_handler) wlan_get_frag, /* SIOCGIWFRAG */ | ||
2427 | (iw_handler) wlan_set_txpow, /* SIOCSIWTXPOW */ | ||
2428 | (iw_handler) wlan_get_txpow, /* SIOCGIWTXPOW */ | ||
2429 | (iw_handler) wlan_set_retry, /* SIOCSIWRETRY */ | ||
2430 | (iw_handler) wlan_get_retry, /* SIOCGIWRETRY */ | ||
2431 | (iw_handler) wlan_set_encode, /* SIOCSIWENCODE */ | ||
2432 | (iw_handler) wlan_get_encode, /* SIOCGIWENCODE */ | ||
2433 | (iw_handler) wlan_set_power, /* SIOCSIWPOWER */ | ||
2434 | (iw_handler) wlan_get_power, /* SIOCGIWPOWER */ | ||
2435 | (iw_handler) NULL, /* -- hole -- */ | ||
2436 | (iw_handler) NULL, /* -- hole -- */ | ||
2437 | (iw_handler) wlan_set_genie, /* SIOCSIWGENIE */ | ||
2438 | (iw_handler) wlan_get_genie, /* SIOCGIWGENIE */ | ||
2439 | (iw_handler) wlan_set_auth, /* SIOCSIWAUTH */ | ||
2440 | (iw_handler) wlan_get_auth, /* SIOCGIWAUTH */ | ||
2441 | (iw_handler) wlan_set_encodeext,/* SIOCSIWENCODEEXT */ | ||
2442 | (iw_handler) wlan_get_encodeext,/* SIOCGIWENCODEEXT */ | ||
2443 | (iw_handler) NULL, /* SIOCSIWPMKSA */ | ||
2444 | }; | ||
2414 | struct iw_handler_def libertas_handler_def = { | 2445 | struct iw_handler_def libertas_handler_def = { |
2415 | .num_standard = sizeof(wlan_handler) / sizeof(iw_handler), | 2446 | .num_standard = sizeof(wlan_handler) / sizeof(iw_handler), |
2416 | .num_private = sizeof(wlan_private_handler) / sizeof(iw_handler), | 2447 | .num_private = sizeof(wlan_private_handler) / sizeof(iw_handler), |
@@ -2421,3 +2452,14 @@ struct iw_handler_def libertas_handler_def = { | |||
2421 | .private_args = (struct iw_priv_args *)wlan_private_args, | 2452 | .private_args = (struct iw_priv_args *)wlan_private_args, |
2422 | .get_wireless_stats = wlan_get_wireless_stats, | 2453 | .get_wireless_stats = wlan_get_wireless_stats, |
2423 | }; | 2454 | }; |
2455 | |||
2456 | struct iw_handler_def mesh_handler_def = { | ||
2457 | .num_standard = sizeof(mesh_wlan_handler) / sizeof(iw_handler), | ||
2458 | .num_private = sizeof(wlan_private_handler) / sizeof(iw_handler), | ||
2459 | .num_private_args = sizeof(wlan_private_args) / | ||
2460 | sizeof(struct iw_priv_args), | ||
2461 | .standard = (iw_handler *) mesh_wlan_handler, | ||
2462 | .private = (iw_handler *) wlan_private_handler, | ||
2463 | .private_args = (struct iw_priv_args *)wlan_private_args, | ||
2464 | .get_wireless_stats = wlan_get_wireless_stats, | ||
2465 | }; | ||
diff --git a/drivers/net/wireless/libertas/wext.h b/drivers/net/wireless/libertas/wext.h index 15cfaaf0797f..d555056b25b7 100644 --- a/drivers/net/wireless/libertas/wext.h +++ b/drivers/net/wireless/libertas/wext.h | |||
@@ -20,21 +20,23 @@ | |||
20 | #define WLAN_SUBCMD_FWT_CLEANUP 15 | 20 | #define WLAN_SUBCMD_FWT_CLEANUP 15 |
21 | #define WLAN_SUBCMD_FWT_TIME 16 | 21 | #define WLAN_SUBCMD_FWT_TIME 16 |
22 | #define WLAN_SUBCMD_MESH_GET_TTL 17 | 22 | #define WLAN_SUBCMD_MESH_GET_TTL 17 |
23 | #define WLAN_SUBCMD_BT_GET_INVERT 18 | ||
23 | 24 | ||
24 | #define WLAN_SETONEINT_GETNONE (WLANIOCTL + 24) | 25 | #define WLAN_SETONEINT_GETNONE (WLANIOCTL + 24) |
25 | #define WLANSETREGION 8 | 26 | #define WLANSETREGION 8 |
26 | #define WLAN_SUBCMD_MESH_SET_TTL 18 | 27 | #define WLAN_SUBCMD_MESH_SET_TTL 18 |
28 | #define WLAN_SUBCMD_BT_SET_INVERT 19 | ||
27 | 29 | ||
28 | #define WLAN_SET128CHAR_GET128CHAR (WLANIOCTL + 25) | 30 | #define WLAN_SET128CHAR_GET128CHAR (WLANIOCTL + 25) |
29 | #define WLAN_SUBCMD_BT_ADD 18 | 31 | #define WLAN_SUBCMD_BT_ADD 18 |
30 | #define WLAN_SUBCMD_BT_DEL 19 | 32 | #define WLAN_SUBCMD_BT_DEL 19 |
31 | #define WLAN_SUBCMD_BT_LIST 20 | 33 | #define WLAN_SUBCMD_BT_LIST 20 |
32 | #define WLAN_SUBCMD_FWT_ADD 21 | 34 | #define WLAN_SUBCMD_FWT_ADD 21 |
33 | #define WLAN_SUBCMD_FWT_DEL 22 | 35 | #define WLAN_SUBCMD_FWT_DEL 22 |
34 | #define WLAN_SUBCMD_FWT_LOOKUP 23 | 36 | #define WLAN_SUBCMD_FWT_LOOKUP 23 |
35 | #define WLAN_SUBCMD_FWT_LIST_NEIGHBOR 24 | 37 | #define WLAN_SUBCMD_FWT_LIST_NEIGHBOR 24 |
36 | #define WLAN_SUBCMD_FWT_LIST 25 | 38 | #define WLAN_SUBCMD_FWT_LIST 25 |
37 | #define WLAN_SUBCMD_FWT_LIST_ROUTE 26 | 39 | #define WLAN_SUBCMD_FWT_LIST_ROUTE 26 |
38 | 40 | ||
39 | #define WLAN_SET_GET_SIXTEEN_INT (WLANIOCTL + 29) | 41 | #define WLAN_SET_GET_SIXTEEN_INT (WLANIOCTL + 29) |
40 | #define WLAN_LED_GPIO_CTRL 5 | 42 | #define WLAN_LED_GPIO_CTRL 5 |
@@ -56,6 +58,7 @@ struct wlan_ioctl_regrdwr { | |||
56 | }; | 58 | }; |
57 | 59 | ||
58 | extern struct iw_handler_def libertas_handler_def; | 60 | extern struct iw_handler_def libertas_handler_def; |
61 | extern struct iw_handler_def mesh_handler_def; | ||
59 | int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int i); | 62 | int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int i); |
60 | int wlan_radio_ioctl(wlan_private * priv, u8 option); | 63 | int wlan_radio_ioctl(wlan_private * priv, u8 option); |
61 | 64 | ||