diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2010-01-12 07:50:36 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-01-12 14:21:21 -0500 |
commit | aa21d0f69a5ca28d33f584b8952cca154115fd26 (patch) | |
tree | 12660a87f2c2f3a16387f8b92a9b41ef45d905d8 /drivers/net/wireless/mwl8k.c | |
parent | f57ca9c1af3c1e30a40ad99d75940176d8c3ff3a (diff) |
mwl8k: post per-vif firmware commands as per-vif commands
SET_BEACON, SET_MAC_ADDR, BSS_START and SET_NEW_STN are the currently
supported firmware commands that are actually per-vif commands. Use
mwl8k_post_pervif_cmd() for these commands, so that the macid of the
vif they operate on gets passed down into the firmware.
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 | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c index ea39ef64defe..d8cf43853de1 100644 --- a/drivers/net/wireless/mwl8k.c +++ b/drivers/net/wireless/mwl8k.c | |||
@@ -294,7 +294,7 @@ static const struct ieee80211_rate mwl8k_rates_50[] = { | |||
294 | #define MWL8K_CMD_RADIO_CONTROL 0x001c | 294 | #define MWL8K_CMD_RADIO_CONTROL 0x001c |
295 | #define MWL8K_CMD_RF_TX_POWER 0x001e | 295 | #define MWL8K_CMD_RF_TX_POWER 0x001e |
296 | #define MWL8K_CMD_RF_ANTENNA 0x0020 | 296 | #define MWL8K_CMD_RF_ANTENNA 0x0020 |
297 | #define MWL8K_CMD_SET_BEACON 0x0100 | 297 | #define MWL8K_CMD_SET_BEACON 0x0100 /* per-vif */ |
298 | #define MWL8K_CMD_SET_PRE_SCAN 0x0107 | 298 | #define MWL8K_CMD_SET_PRE_SCAN 0x0107 |
299 | #define MWL8K_CMD_SET_POST_SCAN 0x0108 | 299 | #define MWL8K_CMD_SET_POST_SCAN 0x0108 |
300 | #define MWL8K_CMD_SET_RF_CHANNEL 0x010a | 300 | #define MWL8K_CMD_SET_RF_CHANNEL 0x010a |
@@ -308,10 +308,10 @@ static const struct ieee80211_rate mwl8k_rates_50[] = { | |||
308 | #define MWL8K_CMD_MIMO_CONFIG 0x0125 | 308 | #define MWL8K_CMD_MIMO_CONFIG 0x0125 |
309 | #define MWL8K_CMD_USE_FIXED_RATE 0x0126 | 309 | #define MWL8K_CMD_USE_FIXED_RATE 0x0126 |
310 | #define MWL8K_CMD_ENABLE_SNIFFER 0x0150 | 310 | #define MWL8K_CMD_ENABLE_SNIFFER 0x0150 |
311 | #define MWL8K_CMD_SET_MAC_ADDR 0x0202 | 311 | #define MWL8K_CMD_SET_MAC_ADDR 0x0202 /* per-vif */ |
312 | #define MWL8K_CMD_SET_RATEADAPT_MODE 0x0203 | 312 | #define MWL8K_CMD_SET_RATEADAPT_MODE 0x0203 |
313 | #define MWL8K_CMD_BSS_START 0x1100 | 313 | #define MWL8K_CMD_BSS_START 0x1100 /* per-vif */ |
314 | #define MWL8K_CMD_SET_NEW_STN 0x1111 | 314 | #define MWL8K_CMD_SET_NEW_STN 0x1111 /* per-vif */ |
315 | #define MWL8K_CMD_UPDATE_STADB 0x1123 | 315 | #define MWL8K_CMD_UPDATE_STADB 0x1123 |
316 | 316 | ||
317 | static const char *mwl8k_cmd_name(u16 cmd, char *buf, int bufsize) | 317 | static const char *mwl8k_cmd_name(u16 cmd, char *buf, int bufsize) |
@@ -2156,7 +2156,8 @@ struct mwl8k_cmd_set_beacon { | |||
2156 | __u8 beacon[0]; | 2156 | __u8 beacon[0]; |
2157 | }; | 2157 | }; |
2158 | 2158 | ||
2159 | static int mwl8k_cmd_set_beacon(struct ieee80211_hw *hw, u8 *beacon, int len) | 2159 | static int mwl8k_cmd_set_beacon(struct ieee80211_hw *hw, |
2160 | struct ieee80211_vif *vif, u8 *beacon, int len) | ||
2160 | { | 2161 | { |
2161 | struct mwl8k_cmd_set_beacon *cmd; | 2162 | struct mwl8k_cmd_set_beacon *cmd; |
2162 | int rc; | 2163 | int rc; |
@@ -2170,7 +2171,7 @@ static int mwl8k_cmd_set_beacon(struct ieee80211_hw *hw, u8 *beacon, int len) | |||
2170 | cmd->beacon_len = cpu_to_le16(len); | 2171 | cmd->beacon_len = cpu_to_le16(len); |
2171 | memcpy(cmd->beacon, beacon, len); | 2172 | memcpy(cmd->beacon, beacon, len); |
2172 | 2173 | ||
2173 | rc = mwl8k_post_cmd(hw, &cmd->header); | 2174 | rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); |
2174 | kfree(cmd); | 2175 | kfree(cmd); |
2175 | 2176 | ||
2176 | return rc; | 2177 | return rc; |
@@ -2761,7 +2762,8 @@ struct mwl8k_cmd_set_mac_addr { | |||
2761 | #define MWL8K_MAC_TYPE_PRIMARY_CLIENT 0 | 2762 | #define MWL8K_MAC_TYPE_PRIMARY_CLIENT 0 |
2762 | #define MWL8K_MAC_TYPE_PRIMARY_AP 2 | 2763 | #define MWL8K_MAC_TYPE_PRIMARY_AP 2 |
2763 | 2764 | ||
2764 | static int mwl8k_cmd_set_mac_addr(struct ieee80211_hw *hw, u8 *mac) | 2765 | static int mwl8k_cmd_set_mac_addr(struct ieee80211_hw *hw, |
2766 | struct ieee80211_vif *vif, u8 *mac) | ||
2765 | { | 2767 | { |
2766 | struct mwl8k_priv *priv = hw->priv; | 2768 | struct mwl8k_priv *priv = hw->priv; |
2767 | struct mwl8k_cmd_set_mac_addr *cmd; | 2769 | struct mwl8k_cmd_set_mac_addr *cmd; |
@@ -2780,7 +2782,7 @@ static int mwl8k_cmd_set_mac_addr(struct ieee80211_hw *hw, u8 *mac) | |||
2780 | memcpy(cmd->mac_addr, mac, ETH_ALEN); | 2782 | memcpy(cmd->mac_addr, mac, ETH_ALEN); |
2781 | } | 2783 | } |
2782 | 2784 | ||
2783 | rc = mwl8k_post_cmd(hw, &cmd->header); | 2785 | rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); |
2784 | kfree(cmd); | 2786 | kfree(cmd); |
2785 | 2787 | ||
2786 | return rc; | 2788 | return rc; |
@@ -2823,7 +2825,8 @@ struct mwl8k_cmd_bss_start { | |||
2823 | __le32 enable; | 2825 | __le32 enable; |
2824 | } __attribute__((packed)); | 2826 | } __attribute__((packed)); |
2825 | 2827 | ||
2826 | static int mwl8k_cmd_bss_start(struct ieee80211_hw *hw, int enable) | 2828 | static int mwl8k_cmd_bss_start(struct ieee80211_hw *hw, |
2829 | struct ieee80211_vif *vif, int enable) | ||
2827 | { | 2830 | { |
2828 | struct mwl8k_cmd_bss_start *cmd; | 2831 | struct mwl8k_cmd_bss_start *cmd; |
2829 | int rc; | 2832 | int rc; |
@@ -2836,7 +2839,7 @@ static int mwl8k_cmd_bss_start(struct ieee80211_hw *hw, int enable) | |||
2836 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); | 2839 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); |
2837 | cmd->enable = cpu_to_le32(enable); | 2840 | cmd->enable = cpu_to_le32(enable); |
2838 | 2841 | ||
2839 | rc = mwl8k_post_cmd(hw, &cmd->header); | 2842 | rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); |
2840 | kfree(cmd); | 2843 | kfree(cmd); |
2841 | 2844 | ||
2842 | return rc; | 2845 | return rc; |
@@ -2904,7 +2907,7 @@ static int mwl8k_cmd_set_new_stn_add(struct ieee80211_hw *hw, | |||
2904 | cmd->is_qos_sta = 1; | 2907 | cmd->is_qos_sta = 1; |
2905 | } | 2908 | } |
2906 | 2909 | ||
2907 | rc = mwl8k_post_cmd(hw, &cmd->header); | 2910 | rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); |
2908 | kfree(cmd); | 2911 | kfree(cmd); |
2909 | 2912 | ||
2910 | return rc; | 2913 | return rc; |
@@ -2924,7 +2927,7 @@ static int mwl8k_cmd_set_new_stn_add_self(struct ieee80211_hw *hw, | |||
2924 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); | 2927 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); |
2925 | memcpy(cmd->mac_addr, vif->addr, ETH_ALEN); | 2928 | memcpy(cmd->mac_addr, vif->addr, ETH_ALEN); |
2926 | 2929 | ||
2927 | rc = mwl8k_post_cmd(hw, &cmd->header); | 2930 | rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); |
2928 | kfree(cmd); | 2931 | kfree(cmd); |
2929 | 2932 | ||
2930 | return rc; | 2933 | return rc; |
@@ -2945,7 +2948,7 @@ static int mwl8k_cmd_set_new_stn_del(struct ieee80211_hw *hw, | |||
2945 | memcpy(cmd->mac_addr, addr, ETH_ALEN); | 2948 | memcpy(cmd->mac_addr, addr, ETH_ALEN); |
2946 | cmd->action = cpu_to_le16(MWL8K_STA_ACTION_REMOVE); | 2949 | cmd->action = cpu_to_le16(MWL8K_STA_ACTION_REMOVE); |
2947 | 2950 | ||
2948 | rc = mwl8k_post_cmd(hw, &cmd->header); | 2951 | rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); |
2949 | kfree(cmd); | 2952 | kfree(cmd); |
2950 | 2953 | ||
2951 | return rc; | 2954 | return rc; |
@@ -3287,12 +3290,6 @@ static int mwl8k_add_interface(struct ieee80211_hw *hw, | |||
3287 | return -EINVAL; | 3290 | return -EINVAL; |
3288 | } | 3291 | } |
3289 | 3292 | ||
3290 | /* Set the mac address. */ | ||
3291 | mwl8k_cmd_set_mac_addr(hw, vif->addr); | ||
3292 | |||
3293 | if (priv->ap_fw) | ||
3294 | mwl8k_cmd_set_new_stn_add_self(hw, vif); | ||
3295 | |||
3296 | /* Setup driver private area. */ | 3293 | /* Setup driver private area. */ |
3297 | mwl8k_vif = MWL8K_VIF(vif); | 3294 | mwl8k_vif = MWL8K_VIF(vif); |
3298 | memset(mwl8k_vif, 0, sizeof(*mwl8k_vif)); | 3295 | memset(mwl8k_vif, 0, sizeof(*mwl8k_vif)); |
@@ -3300,6 +3297,12 @@ static int mwl8k_add_interface(struct ieee80211_hw *hw, | |||
3300 | mwl8k_vif->macid = 0; | 3297 | mwl8k_vif->macid = 0; |
3301 | mwl8k_vif->seqno = 0; | 3298 | mwl8k_vif->seqno = 0; |
3302 | 3299 | ||
3300 | /* Set the mac address. */ | ||
3301 | mwl8k_cmd_set_mac_addr(hw, vif, vif->addr); | ||
3302 | |||
3303 | if (priv->ap_fw) | ||
3304 | mwl8k_cmd_set_new_stn_add_self(hw, vif); | ||
3305 | |||
3303 | list_add_tail(&mwl8k_vif->list, &priv->vif_list); | 3306 | list_add_tail(&mwl8k_vif->list, &priv->vif_list); |
3304 | 3307 | ||
3305 | return 0; | 3308 | return 0; |
@@ -3314,7 +3317,7 @@ static void mwl8k_remove_interface(struct ieee80211_hw *hw, | |||
3314 | if (priv->ap_fw) | 3317 | if (priv->ap_fw) |
3315 | mwl8k_cmd_set_new_stn_del(hw, vif, vif->addr); | 3318 | mwl8k_cmd_set_new_stn_del(hw, vif, vif->addr); |
3316 | 3319 | ||
3317 | mwl8k_cmd_set_mac_addr(hw, "\x00\x00\x00\x00\x00\x00"); | 3320 | mwl8k_cmd_set_mac_addr(hw, vif, "\x00\x00\x00\x00\x00\x00"); |
3318 | 3321 | ||
3319 | list_del(&mwl8k_vif->list); | 3322 | list_del(&mwl8k_vif->list); |
3320 | } | 3323 | } |
@@ -3492,13 +3495,13 @@ mwl8k_bss_info_changed_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
3492 | 3495 | ||
3493 | skb = ieee80211_beacon_get(hw, vif); | 3496 | skb = ieee80211_beacon_get(hw, vif); |
3494 | if (skb != NULL) { | 3497 | if (skb != NULL) { |
3495 | mwl8k_cmd_set_beacon(hw, skb->data, skb->len); | 3498 | mwl8k_cmd_set_beacon(hw, vif, skb->data, skb->len); |
3496 | kfree_skb(skb); | 3499 | kfree_skb(skb); |
3497 | } | 3500 | } |
3498 | } | 3501 | } |
3499 | 3502 | ||
3500 | if (changed & BSS_CHANGED_BEACON_ENABLED) | 3503 | if (changed & BSS_CHANGED_BEACON_ENABLED) |
3501 | mwl8k_cmd_bss_start(hw, info->enable_beacon); | 3504 | mwl8k_cmd_bss_start(hw, vif, info->enable_beacon); |
3502 | 3505 | ||
3503 | out: | 3506 | out: |
3504 | mwl8k_fw_unlock(hw); | 3507 | mwl8k_fw_unlock(hw); |
@@ -4112,7 +4115,7 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev, | |||
4112 | } | 4115 | } |
4113 | 4116 | ||
4114 | /* Clear MAC address */ | 4117 | /* Clear MAC address */ |
4115 | rc = mwl8k_cmd_set_mac_addr(hw, "\x00\x00\x00\x00\x00\x00"); | 4118 | rc = mwl8k_cmd_set_mac_addr(hw, NULL, "\x00\x00\x00\x00\x00\x00"); |
4116 | if (rc) { | 4119 | if (rc) { |
4117 | printk(KERN_ERR "%s: Cannot clear MAC address\n", | 4120 | printk(KERN_ERR "%s: Cannot clear MAC address\n", |
4118 | wiphy_name(hw->wiphy)); | 4121 | wiphy_name(hw->wiphy)); |