diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2009-07-16 08:00:45 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-08-20 11:38:04 -0400 |
commit | ce9e2e1b8433c8795459a259ee87bc4e424e7c50 (patch) | |
tree | 7fd933e6da666aa648549c5d4129792bf6a87559 /drivers/net/wireless/mwl8k.c | |
parent | ff45fc60ad583f45ecf10a41f7dbecf78519bcc1 (diff) |
mwl8k: various coding style cleanups
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwl8k.c')
-rw-r--r-- | drivers/net/wireless/mwl8k.c | 130 |
1 files changed, 57 insertions, 73 deletions
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c index 682b82071a0b..a2eeba17d37d 100644 --- a/drivers/net/wireless/mwl8k.c +++ b/drivers/net/wireless/mwl8k.c | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/net/wireless/mwl8k.c driver for Marvell TOPDOG 802.11 Wireless cards | 2 | * drivers/net/wireless/mwl8k.c |
3 | * Driver for Marvell TOPDOG 802.11 Wireless cards | ||
3 | * | 4 | * |
4 | * Copyright (C) 2008 Marvell Semiconductor Inc. | 5 | * Copyright (C) 2008 Marvell Semiconductor Inc. |
5 | * | 6 | * |
@@ -40,12 +41,12 @@ MODULE_DEVICE_TABLE(pci, mwl8k_table); | |||
40 | 41 | ||
41 | /* Register definitions */ | 42 | /* Register definitions */ |
42 | #define MWL8K_HIU_GEN_PTR 0x00000c10 | 43 | #define MWL8K_HIU_GEN_PTR 0x00000c10 |
43 | #define MWL8K_MODE_STA 0x0000005a | 44 | #define MWL8K_MODE_STA 0x0000005a |
44 | #define MWL8K_MODE_AP 0x000000a5 | 45 | #define MWL8K_MODE_AP 0x000000a5 |
45 | #define MWL8K_HIU_INT_CODE 0x00000c14 | 46 | #define MWL8K_HIU_INT_CODE 0x00000c14 |
46 | #define MWL8K_FWSTA_READY 0xf0f1f2f4 | 47 | #define MWL8K_FWSTA_READY 0xf0f1f2f4 |
47 | #define MWL8K_FWAP_READY 0xf1f2f4a5 | 48 | #define MWL8K_FWAP_READY 0xf1f2f4a5 |
48 | #define MWL8K_INT_CODE_CMD_FINISHED 0x00000005 | 49 | #define MWL8K_INT_CODE_CMD_FINISHED 0x00000005 |
49 | #define MWL8K_HIU_SCRATCH 0x00000c40 | 50 | #define MWL8K_HIU_SCRATCH 0x00000c40 |
50 | 51 | ||
51 | /* Host->device communications */ | 52 | /* Host->device communications */ |
@@ -54,10 +55,10 @@ MODULE_DEVICE_TABLE(pci, mwl8k_table); | |||
54 | #define MWL8K_HIU_H2A_INTERRUPT_MASK 0x00000c20 | 55 | #define MWL8K_HIU_H2A_INTERRUPT_MASK 0x00000c20 |
55 | #define MWL8K_HIU_H2A_INTERRUPT_CLEAR_SEL 0x00000c24 | 56 | #define MWL8K_HIU_H2A_INTERRUPT_CLEAR_SEL 0x00000c24 |
56 | #define MWL8K_HIU_H2A_INTERRUPT_STATUS_MASK 0x00000c28 | 57 | #define MWL8K_HIU_H2A_INTERRUPT_STATUS_MASK 0x00000c28 |
57 | #define MWL8K_H2A_INT_DUMMY (1 << 20) | 58 | #define MWL8K_H2A_INT_DUMMY (1 << 20) |
58 | #define MWL8K_H2A_INT_RESET (1 << 15) | 59 | #define MWL8K_H2A_INT_RESET (1 << 15) |
59 | #define MWL8K_H2A_INT_DOORBELL (1 << 1) | 60 | #define MWL8K_H2A_INT_DOORBELL (1 << 1) |
60 | #define MWL8K_H2A_INT_PPA_READY (1 << 0) | 61 | #define MWL8K_H2A_INT_PPA_READY (1 << 0) |
61 | 62 | ||
62 | /* Device->host communications */ | 63 | /* Device->host communications */ |
63 | #define MWL8K_HIU_A2H_INTERRUPT_EVENTS 0x00000c2c | 64 | #define MWL8K_HIU_A2H_INTERRUPT_EVENTS 0x00000c2c |
@@ -65,16 +66,16 @@ MODULE_DEVICE_TABLE(pci, mwl8k_table); | |||
65 | #define MWL8K_HIU_A2H_INTERRUPT_MASK 0x00000c34 | 66 | #define MWL8K_HIU_A2H_INTERRUPT_MASK 0x00000c34 |
66 | #define MWL8K_HIU_A2H_INTERRUPT_CLEAR_SEL 0x00000c38 | 67 | #define MWL8K_HIU_A2H_INTERRUPT_CLEAR_SEL 0x00000c38 |
67 | #define MWL8K_HIU_A2H_INTERRUPT_STATUS_MASK 0x00000c3c | 68 | #define MWL8K_HIU_A2H_INTERRUPT_STATUS_MASK 0x00000c3c |
68 | #define MWL8K_A2H_INT_DUMMY (1 << 20) | 69 | #define MWL8K_A2H_INT_DUMMY (1 << 20) |
69 | #define MWL8K_A2H_INT_CHNL_SWITCHED (1 << 11) | 70 | #define MWL8K_A2H_INT_CHNL_SWITCHED (1 << 11) |
70 | #define MWL8K_A2H_INT_QUEUE_EMPTY (1 << 10) | 71 | #define MWL8K_A2H_INT_QUEUE_EMPTY (1 << 10) |
71 | #define MWL8K_A2H_INT_RADAR_DETECT (1 << 7) | 72 | #define MWL8K_A2H_INT_RADAR_DETECT (1 << 7) |
72 | #define MWL8K_A2H_INT_RADIO_ON (1 << 6) | 73 | #define MWL8K_A2H_INT_RADIO_ON (1 << 6) |
73 | #define MWL8K_A2H_INT_RADIO_OFF (1 << 5) | 74 | #define MWL8K_A2H_INT_RADIO_OFF (1 << 5) |
74 | #define MWL8K_A2H_INT_MAC_EVENT (1 << 3) | 75 | #define MWL8K_A2H_INT_MAC_EVENT (1 << 3) |
75 | #define MWL8K_A2H_INT_OPC_DONE (1 << 2) | 76 | #define MWL8K_A2H_INT_OPC_DONE (1 << 2) |
76 | #define MWL8K_A2H_INT_RX_READY (1 << 1) | 77 | #define MWL8K_A2H_INT_RX_READY (1 << 1) |
77 | #define MWL8K_A2H_INT_TX_DONE (1 << 0) | 78 | #define MWL8K_A2H_INT_TX_DONE (1 << 0) |
78 | 79 | ||
79 | #define MWL8K_A2H_EVENTS (MWL8K_A2H_INT_DUMMY | \ | 80 | #define MWL8K_A2H_EVENTS (MWL8K_A2H_INT_DUMMY | \ |
80 | MWL8K_A2H_INT_CHNL_SWITCHED | \ | 81 | MWL8K_A2H_INT_CHNL_SWITCHED | \ |
@@ -331,7 +332,7 @@ static const char *mwl8k_cmd_name(u16 cmd, char *buf, int bufsize) | |||
331 | snprintf(buf, bufsize, "%s", #x);\ | 332 | snprintf(buf, bufsize, "%s", #x);\ |
332 | return buf;\ | 333 | return buf;\ |
333 | } while (0) | 334 | } while (0) |
334 | switch (cmd & (~0x8000)) { | 335 | switch (cmd & ~0x8000) { |
335 | MWL8K_CMDNAME(CODE_DNLD); | 336 | MWL8K_CMDNAME(CODE_DNLD); |
336 | MWL8K_CMDNAME(GET_HW_SPEC); | 337 | MWL8K_CMDNAME(GET_HW_SPEC); |
337 | MWL8K_CMDNAME(MAC_MULTICAST_ADR); | 338 | MWL8K_CMDNAME(MAC_MULTICAST_ADR); |
@@ -1078,8 +1079,7 @@ static int mwl8k_txq_init(struct ieee80211_hw *hw, int index) | |||
1078 | int size; | 1079 | int size; |
1079 | int i; | 1080 | int i; |
1080 | 1081 | ||
1081 | memset(&txq->tx_stats, 0, | 1082 | memset(&txq->tx_stats, 0, sizeof(struct ieee80211_tx_queue_stats)); |
1082 | sizeof(struct ieee80211_tx_queue_stats)); | ||
1083 | txq->tx_stats.limit = MWL8K_TX_DESCS; | 1083 | txq->tx_stats.limit = MWL8K_TX_DESCS; |
1084 | txq->tx_head = 0; | 1084 | txq->tx_head = 0; |
1085 | txq->tx_tail = 0; | 1085 | txq->tx_tail = 0; |
@@ -1181,10 +1181,10 @@ static int mwl8k_scan_tx_ring(struct mwl8k_priv *priv, | |||
1181 | 1181 | ||
1182 | static int mwl8k_tx_wait_empty(struct ieee80211_hw *hw, u32 delay_ms) | 1182 | static int mwl8k_tx_wait_empty(struct ieee80211_hw *hw, u32 delay_ms) |
1183 | { | 1183 | { |
1184 | u32 count = 0; | ||
1185 | unsigned long timeout = 0; | ||
1186 | struct mwl8k_priv *priv = hw->priv; | 1184 | struct mwl8k_priv *priv = hw->priv; |
1187 | DECLARE_COMPLETION_ONSTACK(cmd_wait); | 1185 | DECLARE_COMPLETION_ONSTACK(cmd_wait); |
1186 | u32 count; | ||
1187 | unsigned long timeout; | ||
1188 | 1188 | ||
1189 | might_sleep(); | 1189 | might_sleep(); |
1190 | 1190 | ||
@@ -1219,7 +1219,7 @@ static int mwl8k_tx_wait_empty(struct ieee80211_hw *hw, u32 delay_ms) | |||
1219 | __func__, __LINE__, delay_ms, count, newcount); | 1219 | __func__, __LINE__, delay_ms, count, newcount); |
1220 | 1220 | ||
1221 | mwl8k_scan_tx_ring(priv, txinfo, 4); | 1221 | mwl8k_scan_tx_ring(priv, txinfo, 4); |
1222 | for (index = 0 ; index < 4; index++) | 1222 | for (index = 0; index < 4; index++) |
1223 | printk(KERN_ERR | 1223 | printk(KERN_ERR |
1224 | "TXQ:%u L:%u H:%u T:%u FW:%u DRV:%u U:%u\n", | 1224 | "TXQ:%u L:%u H:%u T:%u FW:%u DRV:%u U:%u\n", |
1225 | index, | 1225 | index, |
@@ -1229,6 +1229,7 @@ static int mwl8k_tx_wait_empty(struct ieee80211_hw *hw, u32 delay_ms) | |||
1229 | txinfo[index].fw_owned, | 1229 | txinfo[index].fw_owned, |
1230 | txinfo[index].drv_owned, | 1230 | txinfo[index].drv_owned, |
1231 | txinfo[index].unused); | 1231 | txinfo[index].unused); |
1232 | |||
1232 | return -ETIMEDOUT; | 1233 | return -ETIMEDOUT; |
1233 | } | 1234 | } |
1234 | 1235 | ||
@@ -1251,7 +1252,7 @@ static void mwl8k_txq_reclaim(struct ieee80211_hw *hw, int index, int force) | |||
1251 | int rc; | 1252 | int rc; |
1252 | struct mwl8k_tx_desc *tx_desc; | 1253 | struct mwl8k_tx_desc *tx_desc; |
1253 | unsigned long addr; | 1254 | unsigned long addr; |
1254 | size_t size; | 1255 | int size; |
1255 | struct sk_buff *skb; | 1256 | struct sk_buff *skb; |
1256 | struct ieee80211_tx_info *info; | 1257 | struct ieee80211_tx_info *info; |
1257 | u32 status; | 1258 | u32 status; |
@@ -1275,7 +1276,7 @@ static void mwl8k_txq_reclaim(struct ieee80211_hw *hw, int index, int force) | |||
1275 | priv->pending_tx_pkts--; | 1276 | priv->pending_tx_pkts--; |
1276 | 1277 | ||
1277 | addr = le32_to_cpu(tx_desc->pkt_phys_addr); | 1278 | addr = le32_to_cpu(tx_desc->pkt_phys_addr); |
1278 | size = (u32)(le16_to_cpu(tx_desc->pkt_len)); | 1279 | size = le16_to_cpu(tx_desc->pkt_len); |
1279 | skb = txq->tx_skb[tx].skb; | 1280 | skb = txq->tx_skb[tx].skb; |
1280 | txq->tx_skb[tx].skb = NULL; | 1281 | txq->tx_skb[tx].skb = NULL; |
1281 | 1282 | ||
@@ -1312,12 +1313,8 @@ static void mwl8k_txq_reclaim(struct ieee80211_hw *hw, int index, int force) | |||
1312 | 1313 | ||
1313 | info = IEEE80211_SKB_CB(skb); | 1314 | info = IEEE80211_SKB_CB(skb); |
1314 | ieee80211_tx_info_clear_status(info); | 1315 | ieee80211_tx_info_clear_status(info); |
1315 | 1316 | if (MWL8K_TXD_SUCCESS(status)) | |
1316 | /* Convert firmware status stuff into tx_status */ | ||
1317 | if (MWL8K_TXD_SUCCESS(status)) { | ||
1318 | /* Transmit OK */ | ||
1319 | info->flags |= IEEE80211_TX_STAT_ACK; | 1317 | info->flags |= IEEE80211_TX_STAT_ACK; |
1320 | } | ||
1321 | 1318 | ||
1322 | ieee80211_tx_status_irqsafe(hw, skb); | 1319 | ieee80211_tx_status_irqsafe(hw, skb); |
1323 | 1320 | ||
@@ -1522,7 +1519,6 @@ static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt *cmd) | |||
1522 | dma_addr_t dma_addr; | 1519 | dma_addr_t dma_addr; |
1523 | unsigned int dma_size; | 1520 | unsigned int dma_size; |
1524 | int rc; | 1521 | int rc; |
1525 | u16 __iomem *result; | ||
1526 | unsigned long timeout = 0; | 1522 | unsigned long timeout = 0; |
1527 | u8 buf[32]; | 1523 | u8 buf[32]; |
1528 | 1524 | ||
@@ -1551,7 +1547,6 @@ static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt *cmd) | |||
1551 | pci_unmap_single(priv->pdev, dma_addr, dma_size, | 1547 | pci_unmap_single(priv->pdev, dma_addr, dma_size, |
1552 | PCI_DMA_BIDIRECTIONAL); | 1548 | PCI_DMA_BIDIRECTIONAL); |
1553 | 1549 | ||
1554 | result = &cmd->result; | ||
1555 | if (!timeout) { | 1550 | if (!timeout) { |
1556 | spin_lock_irq(&priv->fw_lock); | 1551 | spin_lock_irq(&priv->fw_lock); |
1557 | priv->hostcmd_wait = NULL; | 1552 | priv->hostcmd_wait = NULL; |
@@ -1562,12 +1557,12 @@ static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt *cmd) | |||
1562 | MWL8K_CMD_TIMEOUT_MS); | 1557 | MWL8K_CMD_TIMEOUT_MS); |
1563 | rc = -ETIMEDOUT; | 1558 | rc = -ETIMEDOUT; |
1564 | } else { | 1559 | } else { |
1565 | rc = *result ? -EINVAL : 0; | 1560 | rc = cmd->result ? -EINVAL : 0; |
1566 | if (rc) | 1561 | if (rc) |
1567 | printk(KERN_ERR "%s: Command %s error 0x%x\n", | 1562 | printk(KERN_ERR "%s: Command %s error 0x%x\n", |
1568 | priv->name, | 1563 | priv->name, |
1569 | mwl8k_cmd_name(cmd->code, buf, sizeof(buf)), | 1564 | mwl8k_cmd_name(cmd->code, buf, sizeof(buf)), |
1570 | *result); | 1565 | cmd->result); |
1571 | } | 1566 | } |
1572 | 1567 | ||
1573 | return rc; | 1568 | return rc; |
@@ -1638,10 +1633,11 @@ struct mwl8k_cmd_mac_multicast_adr { | |||
1638 | struct mwl8k_cmd_pkt header; | 1633 | struct mwl8k_cmd_pkt header; |
1639 | __le16 action; | 1634 | __le16 action; |
1640 | __le16 numaddr; | 1635 | __le16 numaddr; |
1641 | __u8 addr[1][ETH_ALEN]; | 1636 | __u8 addr[0][ETH_ALEN]; |
1642 | }; | 1637 | }; |
1643 | 1638 | ||
1644 | #define MWL8K_ENABLE_RX_MULTICAST 0x000F | 1639 | #define MWL8K_ENABLE_RX_MULTICAST 0x000F |
1640 | |||
1645 | static int mwl8k_cmd_mac_multicast_adr(struct ieee80211_hw *hw, | 1641 | static int mwl8k_cmd_mac_multicast_adr(struct ieee80211_hw *hw, |
1646 | int mc_count, | 1642 | int mc_count, |
1647 | struct dev_addr_list *mclist) | 1643 | struct dev_addr_list *mclist) |
@@ -1649,7 +1645,8 @@ static int mwl8k_cmd_mac_multicast_adr(struct ieee80211_hw *hw, | |||
1649 | struct mwl8k_cmd_mac_multicast_adr *cmd; | 1645 | struct mwl8k_cmd_mac_multicast_adr *cmd; |
1650 | int index = 0; | 1646 | int index = 0; |
1651 | int rc; | 1647 | int rc; |
1652 | int size = sizeof(*cmd) + ((mc_count - 1) * ETH_ALEN); | 1648 | int size = sizeof(*cmd) + mc_count * ETH_ALEN; |
1649 | |||
1653 | cmd = kzalloc(size, GFP_KERNEL); | 1650 | cmd = kzalloc(size, GFP_KERNEL); |
1654 | if (cmd == NULL) | 1651 | if (cmd == NULL) |
1655 | return -ENOMEM; | 1652 | return -ENOMEM; |
@@ -1658,13 +1655,13 @@ static int mwl8k_cmd_mac_multicast_adr(struct ieee80211_hw *hw, | |||
1658 | cmd->header.length = cpu_to_le16(size); | 1655 | cmd->header.length = cpu_to_le16(size); |
1659 | cmd->action = cpu_to_le16(MWL8K_ENABLE_RX_MULTICAST); | 1656 | cmd->action = cpu_to_le16(MWL8K_ENABLE_RX_MULTICAST); |
1660 | cmd->numaddr = cpu_to_le16(mc_count); | 1657 | cmd->numaddr = cpu_to_le16(mc_count); |
1661 | while ((index < mc_count) && mclist) { | 1658 | |
1659 | while (index < mc_count && mclist) { | ||
1662 | if (mclist->da_addrlen != ETH_ALEN) { | 1660 | if (mclist->da_addrlen != ETH_ALEN) { |
1663 | rc = -EINVAL; | 1661 | rc = -EINVAL; |
1664 | goto mwl8k_cmd_mac_multicast_adr_exit; | 1662 | goto mwl8k_cmd_mac_multicast_adr_exit; |
1665 | } | 1663 | } |
1666 | memcpy(cmd->addr[index], mclist->da_addr, ETH_ALEN); | 1664 | memcpy(cmd->addr[index++], mclist->da_addr, ETH_ALEN); |
1667 | index++; | ||
1668 | mclist = mclist->next; | 1665 | mclist = mclist->next; |
1669 | } | 1666 | } |
1670 | 1667 | ||
@@ -1846,7 +1843,7 @@ struct mwl8k_cmd_set_post_scan { | |||
1846 | } __attribute__((packed)); | 1843 | } __attribute__((packed)); |
1847 | 1844 | ||
1848 | static int | 1845 | static int |
1849 | mwl8k_cmd_set_post_scan(struct ieee80211_hw *hw, __u8 mac[ETH_ALEN]) | 1846 | mwl8k_cmd_set_post_scan(struct ieee80211_hw *hw, __u8 *mac) |
1850 | { | 1847 | { |
1851 | struct mwl8k_cmd_set_post_scan *cmd; | 1848 | struct mwl8k_cmd_set_post_scan *cmd; |
1852 | int rc; | 1849 | int rc; |
@@ -1980,7 +1977,7 @@ static int mwl8k_enable_sniffer(struct ieee80211_hw *hw, bool enable) | |||
1980 | 1977 | ||
1981 | cmd->header.code = cpu_to_le16(MWL8K_CMD_ENABLE_SNIFFER); | 1978 | cmd->header.code = cpu_to_le16(MWL8K_CMD_ENABLE_SNIFFER); |
1982 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); | 1979 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); |
1983 | cmd->action = enable ? cpu_to_le32((u32)MWL8K_CMD_SET) : 0; | 1980 | cmd->action = cpu_to_le32(!!enable); |
1984 | 1981 | ||
1985 | rc = mwl8k_post_cmd(hw, &cmd->header); | 1982 | rc = mwl8k_post_cmd(hw, &cmd->header); |
1986 | kfree(cmd); | 1983 | kfree(cmd); |
@@ -1989,7 +1986,7 @@ static int mwl8k_enable_sniffer(struct ieee80211_hw *hw, bool enable) | |||
1989 | } | 1986 | } |
1990 | 1987 | ||
1991 | /* | 1988 | /* |
1992 | * CMD_SET_RATE_ADAPT_MODE. | 1989 | * CMD_SET_RATEADAPT_MODE. |
1993 | */ | 1990 | */ |
1994 | struct mwl8k_cmd_set_rate_adapt_mode { | 1991 | struct mwl8k_cmd_set_rate_adapt_mode { |
1995 | struct mwl8k_cmd_pkt header; | 1992 | struct mwl8k_cmd_pkt header; |
@@ -2117,22 +2114,18 @@ mwl8k_set_edca_params(struct ieee80211_hw *hw, __u8 qnum, | |||
2117 | __u8 aifs, __u16 txop) | 2114 | __u8 aifs, __u16 txop) |
2118 | { | 2115 | { |
2119 | struct mwl8k_cmd_set_edca_params *cmd; | 2116 | struct mwl8k_cmd_set_edca_params *cmd; |
2120 | u32 log_cw_min, log_cw_max; | ||
2121 | int rc; | 2117 | int rc; |
2122 | 2118 | ||
2123 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); | 2119 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); |
2124 | if (cmd == NULL) | 2120 | if (cmd == NULL) |
2125 | return -ENOMEM; | 2121 | return -ENOMEM; |
2126 | 2122 | ||
2127 | log_cw_min = ilog2(cw_min+1); | ||
2128 | log_cw_max = ilog2(cw_max+1); | ||
2129 | cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_EDCA_PARAMS); | 2123 | cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_EDCA_PARAMS); |
2130 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); | 2124 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); |
2131 | |||
2132 | cmd->action = cpu_to_le16(MWL8K_SET_EDCA_ALL); | 2125 | cmd->action = cpu_to_le16(MWL8K_SET_EDCA_ALL); |
2133 | cmd->txop = cpu_to_le16(txop); | 2126 | cmd->txop = cpu_to_le16(txop); |
2134 | cmd->log_cw_max = (u8)log_cw_max; | 2127 | cmd->log_cw_max = (u8)ilog2(cw_max + 1); |
2135 | cmd->log_cw_min = (u8)log_cw_min; | 2128 | cmd->log_cw_min = (u8)ilog2(cw_min + 1); |
2136 | cmd->aifs = aifs; | 2129 | cmd->aifs = aifs; |
2137 | cmd->txq = qnum; | 2130 | cmd->txq = qnum; |
2138 | 2131 | ||
@@ -2173,11 +2166,7 @@ static int mwl8k_finalize_join(struct ieee80211_hw *hw, void *frame, | |||
2173 | 2166 | ||
2174 | cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_FINALIZE_JOIN); | 2167 | cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_FINALIZE_JOIN); |
2175 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); | 2168 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); |
2176 | 2169 | cmd->sleep_interval = cpu_to_le32(dtim ? dtim : 1); | |
2177 | if (dtim) | ||
2178 | cmd->sleep_interval = cpu_to_le32(dtim); | ||
2179 | else | ||
2180 | cmd->sleep_interval = cpu_to_le32(1); | ||
2181 | 2170 | ||
2182 | hdrlen = ieee80211_hdrlen(payload->frame_control); | 2171 | hdrlen = ieee80211_hdrlen(payload->frame_control); |
2183 | 2172 | ||
@@ -2189,8 +2178,8 @@ static int mwl8k_finalize_join(struct ieee80211_hw *hw, void *frame, | |||
2189 | "sent to firmware. Sz=%u MAX=%u\n", __func__, | 2178 | "sent to firmware. Sz=%u MAX=%u\n", __func__, |
2190 | payload_len, MWL8K_FJ_BEACON_MAXLEN); | 2179 | payload_len, MWL8K_FJ_BEACON_MAXLEN); |
2191 | 2180 | ||
2192 | payload_len = payload_len > MWL8K_FJ_BEACON_MAXLEN ? | 2181 | if (payload_len > MWL8K_FJ_BEACON_MAXLEN) |
2193 | MWL8K_FJ_BEACON_MAXLEN : payload_len; | 2182 | payload_len = MWL8K_FJ_BEACON_MAXLEN; |
2194 | 2183 | ||
2195 | if (payload && payload_len) | 2184 | if (payload && payload_len) |
2196 | memcpy(cmd->beacon_data, &payload->u.beacon, payload_len); | 2185 | memcpy(cmd->beacon_data, &payload->u.beacon, payload_len); |
@@ -2250,7 +2239,7 @@ static int mwl8k_cmd_update_sta_db(struct ieee80211_hw *hw, | |||
2250 | peer_info->amsdu_enabled = 0; | 2239 | peer_info->amsdu_enabled = 0; |
2251 | 2240 | ||
2252 | rates = peer_info->legacy_rates; | 2241 | rates = peer_info->legacy_rates; |
2253 | for (count = 0 ; count < mv_vif->legacy_nrates; count++) | 2242 | for (count = 0; count < mv_vif->legacy_nrates; count++) |
2254 | rates[count] = bitrates[count].hw_value; | 2243 | rates[count] = bitrates[count].hw_value; |
2255 | 2244 | ||
2256 | rc = mwl8k_post_cmd(hw, &cmd->header); | 2245 | rc = mwl8k_post_cmd(hw, &cmd->header); |
@@ -2313,8 +2302,6 @@ static int mwl8k_cmd_set_aid(struct ieee80211_hw *hw, | |||
2313 | 2302 | ||
2314 | memcpy(cmd->bssid, mv_vif->bssid, ETH_ALEN); | 2303 | memcpy(cmd->bssid, mv_vif->bssid, ETH_ALEN); |
2315 | 2304 | ||
2316 | prot_mode = MWL8K_FRAME_PROT_DISABLED; | ||
2317 | |||
2318 | if (info->use_cts_prot) { | 2305 | if (info->use_cts_prot) { |
2319 | prot_mode = MWL8K_FRAME_PROT_11G; | 2306 | prot_mode = MWL8K_FRAME_PROT_11G; |
2320 | } else { | 2307 | } else { |
@@ -2331,7 +2318,6 @@ static int mwl8k_cmd_set_aid(struct ieee80211_hw *hw, | |||
2331 | break; | 2318 | break; |
2332 | } | 2319 | } |
2333 | } | 2320 | } |
2334 | |||
2335 | cmd->protection_mode = cpu_to_le16(prot_mode); | 2321 | cmd->protection_mode = cpu_to_le16(prot_mode); |
2336 | 2322 | ||
2337 | for (count = 0; count < mv_vif->legacy_nrates; count++) | 2323 | for (count = 0; count < mv_vif->legacy_nrates; count++) |
@@ -2934,7 +2920,7 @@ static int mwl8k_add_interface(struct ieee80211_hw *hw, | |||
2934 | mwl8k_vif->priv = priv; | 2920 | mwl8k_vif->priv = priv; |
2935 | 2921 | ||
2936 | /* Setup initial PHY parameters */ | 2922 | /* Setup initial PHY parameters */ |
2937 | memcpy(mwl8k_vif->legacy_rates , | 2923 | memcpy(mwl8k_vif->legacy_rates, |
2938 | priv->rates, sizeof(mwl8k_vif->legacy_rates)); | 2924 | priv->rates, sizeof(mwl8k_vif->legacy_rates)); |
2939 | mwl8k_vif->legacy_nrates = ARRAY_SIZE(priv->rates); | 2925 | mwl8k_vif->legacy_nrates = ARRAY_SIZE(priv->rates); |
2940 | 2926 | ||
@@ -3171,8 +3157,9 @@ static int mwl8k_configure_filter_wt(struct work_struct *wt) | |||
3171 | if (rc) | 3157 | if (rc) |
3172 | goto mwl8k_configure_filter_exit; | 3158 | goto mwl8k_configure_filter_exit; |
3173 | if (mc_count) { | 3159 | if (mc_count) { |
3174 | mc_count = mc_count < priv->num_mcaddrs ? | 3160 | if (mc_count > priv->num_mcaddrs) |
3175 | mc_count : priv->num_mcaddrs; | 3161 | mc_count = priv->num_mcaddrs; |
3162 | |||
3176 | rc = mwl8k_cmd_mac_multicast_adr(hw, mc_count, mclist); | 3163 | rc = mwl8k_cmd_mac_multicast_adr(hw, mc_count, mclist); |
3177 | if (rc) | 3164 | if (rc) |
3178 | printk(KERN_ERR | 3165 | printk(KERN_ERR |
@@ -3411,12 +3398,9 @@ static void mwl8k_tx_reclaim_handler(unsigned long data) | |||
3411 | for (i = 0; i < MWL8K_TX_QUEUES; i++) | 3398 | for (i = 0; i < MWL8K_TX_QUEUES; i++) |
3412 | mwl8k_txq_reclaim(hw, i, 0); | 3399 | mwl8k_txq_reclaim(hw, i, 0); |
3413 | 3400 | ||
3414 | if (priv->tx_wait != NULL) { | 3401 | if (priv->tx_wait != NULL && mwl8k_txq_busy(priv) == 0) { |
3415 | int count = mwl8k_txq_busy(priv); | 3402 | complete(priv->tx_wait); |
3416 | if (count == 0) { | 3403 | priv->tx_wait = NULL; |
3417 | complete(priv->tx_wait); | ||
3418 | priv->tx_wait = NULL; | ||
3419 | } | ||
3420 | } | 3404 | } |
3421 | spin_unlock_bh(&priv->tx_lock); | 3405 | spin_unlock_bh(&priv->tx_lock); |
3422 | } | 3406 | } |
@@ -3426,7 +3410,7 @@ static void mwl8k_finalize_join_worker(struct work_struct *work) | |||
3426 | struct mwl8k_priv *priv = | 3410 | struct mwl8k_priv *priv = |
3427 | container_of(work, struct mwl8k_priv, finalize_join_worker); | 3411 | container_of(work, struct mwl8k_priv, finalize_join_worker); |
3428 | struct sk_buff *skb = priv->beacon_skb; | 3412 | struct sk_buff *skb = priv->beacon_skb; |
3429 | u8 dtim = (MWL8K_VIF(priv->vif))->bss_info.dtim_period; | 3413 | u8 dtim = MWL8K_VIF(priv->vif)->bss_info.dtim_period; |
3430 | 3414 | ||
3431 | mwl8k_finalize_join(priv->hw, skb->data, skb->len, dtim); | 3415 | mwl8k_finalize_join(priv->hw, skb->data, skb->len, dtim); |
3432 | dev_kfree_skb(skb); | 3416 | dev_kfree_skb(skb); |
@@ -3513,7 +3497,7 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev, | |||
3513 | BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_MONITOR); | 3497 | BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_MONITOR); |
3514 | 3498 | ||
3515 | /* Set rssi and noise values to dBm */ | 3499 | /* Set rssi and noise values to dBm */ |
3516 | hw->flags |= (IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_NOISE_DBM); | 3500 | hw->flags |= IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_NOISE_DBM; |
3517 | hw->vif_data_size = sizeof(struct mwl8k_vif); | 3501 | hw->vif_data_size = sizeof(struct mwl8k_vif); |
3518 | priv->vif = NULL; | 3502 | priv->vif = NULL; |
3519 | 3503 | ||