diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2009-11-30 12:31:33 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-12-28 16:31:24 -0500 |
commit | 55489b6ed6801a42636fc3d4594b77dda9c409f2 (patch) | |
tree | 06313f683a00baafa96c078303e135795d70e52e /drivers/net/wireless/mwl8k.c | |
parent | ea1e4b842049fcc4741096538114871a74859314 (diff) |
mwl8k: firmware command code cleanup
Sort firmware commands by command code, get rid of the 802_11 substring
in all command names, and make sure that the command functions match the
firmware command names.
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 | 647 |
1 files changed, 323 insertions, 324 deletions
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c index 59d49159cf2a..b543defdde8a 100644 --- a/drivers/net/wireless/mwl8k.c +++ b/drivers/net/wireless/mwl8k.c | |||
@@ -221,7 +221,7 @@ struct mwl8k_vif { | |||
221 | u8 bssid[ETH_ALEN]; | 221 | u8 bssid[ETH_ALEN]; |
222 | u8 mac_addr[ETH_ALEN]; | 222 | u8 mac_addr[ETH_ALEN]; |
223 | 223 | ||
224 | /* Index into station database.Returned by update_sta_db call */ | 224 | /* Index into station database. Returned by UPDATE_STADB. */ |
225 | u8 peer_id; | 225 | u8 peer_id; |
226 | 226 | ||
227 | /* Non AMPDU sequence number assigned by driver */ | 227 | /* Non AMPDU sequence number assigned by driver */ |
@@ -1897,9 +1897,9 @@ __mwl8k_cmd_mac_multicast_adr(struct ieee80211_hw *hw, int allmulti, | |||
1897 | } | 1897 | } |
1898 | 1898 | ||
1899 | /* | 1899 | /* |
1900 | * CMD_802_11_GET_STAT. | 1900 | * CMD_GET_STAT. |
1901 | */ | 1901 | */ |
1902 | struct mwl8k_cmd_802_11_get_stat { | 1902 | struct mwl8k_cmd_get_stat { |
1903 | struct mwl8k_cmd_pkt header; | 1903 | struct mwl8k_cmd_pkt header; |
1904 | __le32 stats[64]; | 1904 | __le32 stats[64]; |
1905 | } __attribute__((packed)); | 1905 | } __attribute__((packed)); |
@@ -1909,10 +1909,10 @@ struct mwl8k_cmd_802_11_get_stat { | |||
1909 | #define MWL8K_STAT_FCS_ERROR 24 | 1909 | #define MWL8K_STAT_FCS_ERROR 24 |
1910 | #define MWL8K_STAT_RTS_SUCCESS 11 | 1910 | #define MWL8K_STAT_RTS_SUCCESS 11 |
1911 | 1911 | ||
1912 | static int mwl8k_cmd_802_11_get_stat(struct ieee80211_hw *hw, | 1912 | static int mwl8k_cmd_get_stat(struct ieee80211_hw *hw, |
1913 | struct ieee80211_low_level_stats *stats) | 1913 | struct ieee80211_low_level_stats *stats) |
1914 | { | 1914 | { |
1915 | struct mwl8k_cmd_802_11_get_stat *cmd; | 1915 | struct mwl8k_cmd_get_stat *cmd; |
1916 | int rc; | 1916 | int rc; |
1917 | 1917 | ||
1918 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); | 1918 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); |
@@ -1939,9 +1939,9 @@ static int mwl8k_cmd_802_11_get_stat(struct ieee80211_hw *hw, | |||
1939 | } | 1939 | } |
1940 | 1940 | ||
1941 | /* | 1941 | /* |
1942 | * CMD_802_11_RADIO_CONTROL. | 1942 | * CMD_RADIO_CONTROL. |
1943 | */ | 1943 | */ |
1944 | struct mwl8k_cmd_802_11_radio_control { | 1944 | struct mwl8k_cmd_radio_control { |
1945 | struct mwl8k_cmd_pkt header; | 1945 | struct mwl8k_cmd_pkt header; |
1946 | __le16 action; | 1946 | __le16 action; |
1947 | __le16 control; | 1947 | __le16 control; |
@@ -1949,10 +1949,10 @@ struct mwl8k_cmd_802_11_radio_control { | |||
1949 | } __attribute__((packed)); | 1949 | } __attribute__((packed)); |
1950 | 1950 | ||
1951 | static int | 1951 | static int |
1952 | mwl8k_cmd_802_11_radio_control(struct ieee80211_hw *hw, bool enable, bool force) | 1952 | mwl8k_cmd_radio_control(struct ieee80211_hw *hw, bool enable, bool force) |
1953 | { | 1953 | { |
1954 | struct mwl8k_priv *priv = hw->priv; | 1954 | struct mwl8k_priv *priv = hw->priv; |
1955 | struct mwl8k_cmd_802_11_radio_control *cmd; | 1955 | struct mwl8k_cmd_radio_control *cmd; |
1956 | int rc; | 1956 | int rc; |
1957 | 1957 | ||
1958 | if (enable == priv->radio_on && !force) | 1958 | if (enable == priv->radio_on && !force) |
@@ -1977,14 +1977,14 @@ mwl8k_cmd_802_11_radio_control(struct ieee80211_hw *hw, bool enable, bool force) | |||
1977 | return rc; | 1977 | return rc; |
1978 | } | 1978 | } |
1979 | 1979 | ||
1980 | static int mwl8k_cmd_802_11_radio_disable(struct ieee80211_hw *hw) | 1980 | static int mwl8k_cmd_radio_disable(struct ieee80211_hw *hw) |
1981 | { | 1981 | { |
1982 | return mwl8k_cmd_802_11_radio_control(hw, 0, 0); | 1982 | return mwl8k_cmd_radio_control(hw, 0, 0); |
1983 | } | 1983 | } |
1984 | 1984 | ||
1985 | static int mwl8k_cmd_802_11_radio_enable(struct ieee80211_hw *hw) | 1985 | static int mwl8k_cmd_radio_enable(struct ieee80211_hw *hw) |
1986 | { | 1986 | { |
1987 | return mwl8k_cmd_802_11_radio_control(hw, 1, 0); | 1987 | return mwl8k_cmd_radio_control(hw, 1, 0); |
1988 | } | 1988 | } |
1989 | 1989 | ||
1990 | static int | 1990 | static int |
@@ -1998,15 +1998,15 @@ mwl8k_set_radio_preamble(struct ieee80211_hw *hw, bool short_preamble) | |||
1998 | 1998 | ||
1999 | priv->radio_short_preamble = short_preamble; | 1999 | priv->radio_short_preamble = short_preamble; |
2000 | 2000 | ||
2001 | return mwl8k_cmd_802_11_radio_control(hw, 1, 1); | 2001 | return mwl8k_cmd_radio_control(hw, 1, 1); |
2002 | } | 2002 | } |
2003 | 2003 | ||
2004 | /* | 2004 | /* |
2005 | * CMD_802_11_RF_TX_POWER. | 2005 | * CMD_RF_TX_POWER. |
2006 | */ | 2006 | */ |
2007 | #define MWL8K_TX_POWER_LEVEL_TOTAL 8 | 2007 | #define MWL8K_TX_POWER_LEVEL_TOTAL 8 |
2008 | 2008 | ||
2009 | struct mwl8k_cmd_802_11_rf_tx_power { | 2009 | struct mwl8k_cmd_rf_tx_power { |
2010 | struct mwl8k_cmd_pkt header; | 2010 | struct mwl8k_cmd_pkt header; |
2011 | __le16 action; | 2011 | __le16 action; |
2012 | __le16 support_level; | 2012 | __le16 support_level; |
@@ -2015,9 +2015,9 @@ struct mwl8k_cmd_802_11_rf_tx_power { | |||
2015 | __le16 power_level_list[MWL8K_TX_POWER_LEVEL_TOTAL]; | 2015 | __le16 power_level_list[MWL8K_TX_POWER_LEVEL_TOTAL]; |
2016 | } __attribute__((packed)); | 2016 | } __attribute__((packed)); |
2017 | 2017 | ||
2018 | static int mwl8k_cmd_802_11_rf_tx_power(struct ieee80211_hw *hw, int dBm) | 2018 | static int mwl8k_cmd_rf_tx_power(struct ieee80211_hw *hw, int dBm) |
2019 | { | 2019 | { |
2020 | struct mwl8k_cmd_802_11_rf_tx_power *cmd; | 2020 | struct mwl8k_cmd_rf_tx_power *cmd; |
2021 | int rc; | 2021 | int rc; |
2022 | 2022 | ||
2023 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); | 2023 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); |
@@ -2159,85 +2159,61 @@ static int mwl8k_cmd_set_rf_channel(struct ieee80211_hw *hw, | |||
2159 | } | 2159 | } |
2160 | 2160 | ||
2161 | /* | 2161 | /* |
2162 | * CMD_SET_SLOT. | 2162 | * CMD_SET_AID. |
2163 | */ | 2163 | */ |
2164 | struct mwl8k_cmd_set_slot { | 2164 | #define MWL8K_FRAME_PROT_DISABLED 0x00 |
2165 | struct mwl8k_cmd_pkt header; | 2165 | #define MWL8K_FRAME_PROT_11G 0x07 |
2166 | __le16 action; | 2166 | #define MWL8K_FRAME_PROT_11N_HT_40MHZ_ONLY 0x02 |
2167 | __u8 short_slot; | 2167 | #define MWL8K_FRAME_PROT_11N_HT_ALL 0x06 |
2168 | } __attribute__((packed)); | ||
2169 | |||
2170 | static int mwl8k_cmd_set_slot(struct ieee80211_hw *hw, bool short_slot_time) | ||
2171 | { | ||
2172 | struct mwl8k_cmd_set_slot *cmd; | ||
2173 | int rc; | ||
2174 | |||
2175 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); | ||
2176 | if (cmd == NULL) | ||
2177 | return -ENOMEM; | ||
2178 | |||
2179 | cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_SLOT); | ||
2180 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); | ||
2181 | cmd->action = cpu_to_le16(MWL8K_CMD_SET); | ||
2182 | cmd->short_slot = short_slot_time; | ||
2183 | |||
2184 | rc = mwl8k_post_cmd(hw, &cmd->header); | ||
2185 | kfree(cmd); | ||
2186 | 2168 | ||
2187 | return rc; | 2169 | struct mwl8k_cmd_update_set_aid { |
2188 | } | 2170 | struct mwl8k_cmd_pkt header; |
2171 | __le16 aid; | ||
2189 | 2172 | ||
2190 | /* | 2173 | /* AP's MAC address (BSSID) */ |
2191 | * CMD_MIMO_CONFIG. | 2174 | __u8 bssid[ETH_ALEN]; |
2192 | */ | 2175 | __le16 protection_mode; |
2193 | struct mwl8k_cmd_mimo_config { | 2176 | __u8 supp_rates[14]; |
2194 | struct mwl8k_cmd_pkt header; | ||
2195 | __le32 action; | ||
2196 | __u8 rx_antenna_map; | ||
2197 | __u8 tx_antenna_map; | ||
2198 | } __attribute__((packed)); | 2177 | } __attribute__((packed)); |
2199 | 2178 | ||
2200 | static int mwl8k_cmd_mimo_config(struct ieee80211_hw *hw, __u8 rx, __u8 tx) | 2179 | static int |
2180 | mwl8k_cmd_set_aid(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | ||
2201 | { | 2181 | { |
2202 | struct mwl8k_cmd_mimo_config *cmd; | 2182 | struct mwl8k_vif *mv_vif = MWL8K_VIF(vif); |
2183 | struct ieee80211_bss_conf *info = &mv_vif->bss_info; | ||
2184 | struct mwl8k_cmd_update_set_aid *cmd; | ||
2185 | u16 prot_mode; | ||
2203 | int rc; | 2186 | int rc; |
2204 | 2187 | ||
2205 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); | 2188 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); |
2206 | if (cmd == NULL) | 2189 | if (cmd == NULL) |
2207 | return -ENOMEM; | 2190 | return -ENOMEM; |
2208 | 2191 | ||
2209 | cmd->header.code = cpu_to_le16(MWL8K_CMD_MIMO_CONFIG); | 2192 | cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_AID); |
2210 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); | 2193 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); |
2211 | cmd->action = cpu_to_le32((u32)MWL8K_CMD_SET); | 2194 | cmd->aid = cpu_to_le16(info->aid); |
2212 | cmd->rx_antenna_map = rx; | ||
2213 | cmd->tx_antenna_map = tx; | ||
2214 | |||
2215 | rc = mwl8k_post_cmd(hw, &cmd->header); | ||
2216 | kfree(cmd); | ||
2217 | |||
2218 | return rc; | ||
2219 | } | ||
2220 | |||
2221 | /* | ||
2222 | * CMD_ENABLE_SNIFFER. | ||
2223 | */ | ||
2224 | struct mwl8k_cmd_enable_sniffer { | ||
2225 | struct mwl8k_cmd_pkt header; | ||
2226 | __le32 action; | ||
2227 | } __attribute__((packed)); | ||
2228 | 2195 | ||
2229 | static int mwl8k_enable_sniffer(struct ieee80211_hw *hw, bool enable) | 2196 | memcpy(cmd->bssid, mv_vif->bssid, ETH_ALEN); |
2230 | { | ||
2231 | struct mwl8k_cmd_enable_sniffer *cmd; | ||
2232 | int rc; | ||
2233 | 2197 | ||
2234 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); | 2198 | if (info->use_cts_prot) { |
2235 | if (cmd == NULL) | 2199 | prot_mode = MWL8K_FRAME_PROT_11G; |
2236 | return -ENOMEM; | 2200 | } else { |
2201 | switch (info->ht_operation_mode & | ||
2202 | IEEE80211_HT_OP_MODE_PROTECTION) { | ||
2203 | case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ: | ||
2204 | prot_mode = MWL8K_FRAME_PROT_11N_HT_40MHZ_ONLY; | ||
2205 | break; | ||
2206 | case IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED: | ||
2207 | prot_mode = MWL8K_FRAME_PROT_11N_HT_ALL; | ||
2208 | break; | ||
2209 | default: | ||
2210 | prot_mode = MWL8K_FRAME_PROT_DISABLED; | ||
2211 | break; | ||
2212 | } | ||
2213 | } | ||
2214 | cmd->protection_mode = cpu_to_le16(prot_mode); | ||
2237 | 2215 | ||
2238 | cmd->header.code = cpu_to_le16(MWL8K_CMD_ENABLE_SNIFFER); | 2216 | memcpy(cmd->supp_rates, mwl8k_rateids, sizeof(mwl8k_rateids)); |
2239 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); | ||
2240 | cmd->action = cpu_to_le32(!!enable); | ||
2241 | 2217 | ||
2242 | rc = mwl8k_post_cmd(hw, &cmd->header); | 2218 | rc = mwl8k_post_cmd(hw, &cmd->header); |
2243 | kfree(cmd); | 2219 | kfree(cmd); |
@@ -2246,37 +2222,30 @@ static int mwl8k_enable_sniffer(struct ieee80211_hw *hw, bool enable) | |||
2246 | } | 2222 | } |
2247 | 2223 | ||
2248 | /* | 2224 | /* |
2249 | * CMD_SET_MAC_ADDR. | 2225 | * CMD_SET_RATE. |
2250 | */ | 2226 | */ |
2251 | struct mwl8k_cmd_set_mac_addr { | 2227 | struct mwl8k_cmd_set_rate { |
2252 | struct mwl8k_cmd_pkt header; | 2228 | struct mwl8k_cmd_pkt header; |
2253 | union { | 2229 | __u8 legacy_rates[14]; |
2254 | struct { | 2230 | |
2255 | __le16 mac_type; | 2231 | /* Bitmap for supported MCS codes. */ |
2256 | __u8 mac_addr[ETH_ALEN]; | 2232 | __u8 mcs_set[16]; |
2257 | } mbss; | 2233 | __u8 reserved[16]; |
2258 | __u8 mac_addr[ETH_ALEN]; | ||
2259 | }; | ||
2260 | } __attribute__((packed)); | 2234 | } __attribute__((packed)); |
2261 | 2235 | ||
2262 | static int mwl8k_set_mac_addr(struct ieee80211_hw *hw, u8 *mac) | 2236 | static int |
2237 | mwl8k_cmd_set_rate(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | ||
2263 | { | 2238 | { |
2264 | struct mwl8k_priv *priv = hw->priv; | 2239 | struct mwl8k_cmd_set_rate *cmd; |
2265 | struct mwl8k_cmd_set_mac_addr *cmd; | ||
2266 | int rc; | 2240 | int rc; |
2267 | 2241 | ||
2268 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); | 2242 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); |
2269 | if (cmd == NULL) | 2243 | if (cmd == NULL) |
2270 | return -ENOMEM; | 2244 | return -ENOMEM; |
2271 | 2245 | ||
2272 | cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_MAC_ADDR); | 2246 | cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_RATE); |
2273 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); | 2247 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); |
2274 | if (priv->ap_fw) { | 2248 | memcpy(cmd->legacy_rates, mwl8k_rateids, sizeof(mwl8k_rateids)); |
2275 | cmd->mbss.mac_type = 0; | ||
2276 | memcpy(cmd->mbss.mac_addr, mac, ETH_ALEN); | ||
2277 | } else { | ||
2278 | memcpy(cmd->mac_addr, mac, ETH_ALEN); | ||
2279 | } | ||
2280 | 2249 | ||
2281 | rc = mwl8k_post_cmd(hw, &cmd->header); | 2250 | rc = mwl8k_post_cmd(hw, &cmd->header); |
2282 | kfree(cmd); | 2251 | kfree(cmd); |
@@ -2284,29 +2253,40 @@ static int mwl8k_set_mac_addr(struct ieee80211_hw *hw, u8 *mac) | |||
2284 | return rc; | 2253 | return rc; |
2285 | } | 2254 | } |
2286 | 2255 | ||
2287 | |||
2288 | /* | 2256 | /* |
2289 | * CMD_SET_RATEADAPT_MODE. | 2257 | * CMD_FINALIZE_JOIN. |
2290 | */ | 2258 | */ |
2291 | struct mwl8k_cmd_set_rate_adapt_mode { | 2259 | #define MWL8K_FJ_BEACON_MAXLEN 128 |
2260 | |||
2261 | struct mwl8k_cmd_finalize_join { | ||
2292 | struct mwl8k_cmd_pkt header; | 2262 | struct mwl8k_cmd_pkt header; |
2293 | __le16 action; | 2263 | __le32 sleep_interval; /* Number of beacon periods to sleep */ |
2294 | __le16 mode; | 2264 | __u8 beacon_data[MWL8K_FJ_BEACON_MAXLEN]; |
2295 | } __attribute__((packed)); | 2265 | } __attribute__((packed)); |
2296 | 2266 | ||
2297 | static int mwl8k_cmd_setrateadaptmode(struct ieee80211_hw *hw, __u16 mode) | 2267 | static int mwl8k_cmd_finalize_join(struct ieee80211_hw *hw, void *frame, |
2268 | int framelen, int dtim) | ||
2298 | { | 2269 | { |
2299 | struct mwl8k_cmd_set_rate_adapt_mode *cmd; | 2270 | struct mwl8k_cmd_finalize_join *cmd; |
2271 | struct ieee80211_mgmt *payload = frame; | ||
2272 | int payload_len; | ||
2300 | int rc; | 2273 | int rc; |
2301 | 2274 | ||
2302 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); | 2275 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); |
2303 | if (cmd == NULL) | 2276 | if (cmd == NULL) |
2304 | return -ENOMEM; | 2277 | return -ENOMEM; |
2305 | 2278 | ||
2306 | cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_RATEADAPT_MODE); | 2279 | cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_FINALIZE_JOIN); |
2307 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); | 2280 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); |
2308 | cmd->action = cpu_to_le16(MWL8K_CMD_SET); | 2281 | cmd->sleep_interval = cpu_to_le32(dtim ? dtim : 1); |
2309 | cmd->mode = cpu_to_le16(mode); | 2282 | |
2283 | payload_len = framelen - ieee80211_hdrlen(payload->frame_control); | ||
2284 | if (payload_len < 0) | ||
2285 | payload_len = 0; | ||
2286 | else if (payload_len > MWL8K_FJ_BEACON_MAXLEN) | ||
2287 | payload_len = MWL8K_FJ_BEACON_MAXLEN; | ||
2288 | |||
2289 | memcpy(cmd->beacon_data, &payload->u.beacon, payload_len); | ||
2310 | 2290 | ||
2311 | rc = mwl8k_post_cmd(hw, &cmd->header); | 2291 | rc = mwl8k_post_cmd(hw, &cmd->header); |
2312 | kfree(cmd); | 2292 | kfree(cmd); |
@@ -2315,59 +2295,57 @@ static int mwl8k_cmd_setrateadaptmode(struct ieee80211_hw *hw, __u16 mode) | |||
2315 | } | 2295 | } |
2316 | 2296 | ||
2317 | /* | 2297 | /* |
2318 | * CMD_SET_WMM_MODE. | 2298 | * CMD_SET_RTS_THRESHOLD. |
2319 | */ | 2299 | */ |
2320 | struct mwl8k_cmd_set_wmm { | 2300 | struct mwl8k_cmd_set_rts_threshold { |
2321 | struct mwl8k_cmd_pkt header; | 2301 | struct mwl8k_cmd_pkt header; |
2322 | __le16 action; | 2302 | __le16 action; |
2303 | __le16 threshold; | ||
2323 | } __attribute__((packed)); | 2304 | } __attribute__((packed)); |
2324 | 2305 | ||
2325 | static int mwl8k_set_wmm(struct ieee80211_hw *hw, bool enable) | 2306 | static int mwl8k_cmd_set_rts_threshold(struct ieee80211_hw *hw, |
2307 | u16 action, u16 threshold) | ||
2326 | { | 2308 | { |
2327 | struct mwl8k_priv *priv = hw->priv; | 2309 | struct mwl8k_cmd_set_rts_threshold *cmd; |
2328 | struct mwl8k_cmd_set_wmm *cmd; | ||
2329 | int rc; | 2310 | int rc; |
2330 | 2311 | ||
2331 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); | 2312 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); |
2332 | if (cmd == NULL) | 2313 | if (cmd == NULL) |
2333 | return -ENOMEM; | 2314 | return -ENOMEM; |
2334 | 2315 | ||
2335 | cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_WMM_MODE); | 2316 | cmd->header.code = cpu_to_le16(MWL8K_CMD_RTS_THRESHOLD); |
2336 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); | 2317 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); |
2337 | cmd->action = cpu_to_le16(!!enable); | 2318 | cmd->action = cpu_to_le16(action); |
2319 | cmd->threshold = cpu_to_le16(threshold); | ||
2338 | 2320 | ||
2339 | rc = mwl8k_post_cmd(hw, &cmd->header); | 2321 | rc = mwl8k_post_cmd(hw, &cmd->header); |
2340 | kfree(cmd); | 2322 | kfree(cmd); |
2341 | 2323 | ||
2342 | if (!rc) | ||
2343 | priv->wmm_enabled = enable; | ||
2344 | |||
2345 | return rc; | 2324 | return rc; |
2346 | } | 2325 | } |
2347 | 2326 | ||
2348 | /* | 2327 | /* |
2349 | * CMD_SET_RTS_THRESHOLD. | 2328 | * CMD_SET_SLOT. |
2350 | */ | 2329 | */ |
2351 | struct mwl8k_cmd_rts_threshold { | 2330 | struct mwl8k_cmd_set_slot { |
2352 | struct mwl8k_cmd_pkt header; | 2331 | struct mwl8k_cmd_pkt header; |
2353 | __le16 action; | 2332 | __le16 action; |
2354 | __le16 threshold; | 2333 | __u8 short_slot; |
2355 | } __attribute__((packed)); | 2334 | } __attribute__((packed)); |
2356 | 2335 | ||
2357 | static int mwl8k_rts_threshold(struct ieee80211_hw *hw, | 2336 | static int mwl8k_cmd_set_slot(struct ieee80211_hw *hw, bool short_slot_time) |
2358 | u16 action, u16 threshold) | ||
2359 | { | 2337 | { |
2360 | struct mwl8k_cmd_rts_threshold *cmd; | 2338 | struct mwl8k_cmd_set_slot *cmd; |
2361 | int rc; | 2339 | int rc; |
2362 | 2340 | ||
2363 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); | 2341 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); |
2364 | if (cmd == NULL) | 2342 | if (cmd == NULL) |
2365 | return -ENOMEM; | 2343 | return -ENOMEM; |
2366 | 2344 | ||
2367 | cmd->header.code = cpu_to_le16(MWL8K_CMD_RTS_THRESHOLD); | 2345 | cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_SLOT); |
2368 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); | 2346 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); |
2369 | cmd->action = cpu_to_le16(action); | 2347 | cmd->action = cpu_to_le16(MWL8K_CMD_SET); |
2370 | cmd->threshold = cpu_to_le16(threshold); | 2348 | cmd->short_slot = short_slot_time; |
2371 | 2349 | ||
2372 | rc = mwl8k_post_cmd(hw, &cmd->header); | 2350 | rc = mwl8k_post_cmd(hw, &cmd->header); |
2373 | kfree(cmd); | 2351 | kfree(cmd); |
@@ -2426,9 +2404,9 @@ struct mwl8k_cmd_set_edca_params { | |||
2426 | MWL8K_SET_EDCA_AIFS) | 2404 | MWL8K_SET_EDCA_AIFS) |
2427 | 2405 | ||
2428 | static int | 2406 | static int |
2429 | mwl8k_set_edca_params(struct ieee80211_hw *hw, __u8 qnum, | 2407 | mwl8k_cmd_set_edca_params(struct ieee80211_hw *hw, __u8 qnum, |
2430 | __u16 cw_min, __u16 cw_max, | 2408 | __u16 cw_min, __u16 cw_max, |
2431 | __u8 aifs, __u16 txop) | 2409 | __u8 aifs, __u16 txop) |
2432 | { | 2410 | { |
2433 | struct mwl8k_priv *priv = hw->priv; | 2411 | struct mwl8k_priv *priv = hw->priv; |
2434 | struct mwl8k_cmd_set_edca_params *cmd; | 2412 | struct mwl8k_cmd_set_edca_params *cmd; |
@@ -2467,202 +2445,60 @@ mwl8k_set_edca_params(struct ieee80211_hw *hw, __u8 qnum, | |||
2467 | } | 2445 | } |
2468 | 2446 | ||
2469 | /* | 2447 | /* |
2470 | * CMD_FINALIZE_JOIN. | 2448 | * CMD_SET_WMM_MODE. |
2471 | */ | 2449 | */ |
2472 | #define MWL8K_FJ_BEACON_MAXLEN 128 | 2450 | struct mwl8k_cmd_set_wmm_mode { |
2473 | |||
2474 | struct mwl8k_cmd_finalize_join { | ||
2475 | struct mwl8k_cmd_pkt header; | 2451 | struct mwl8k_cmd_pkt header; |
2476 | __le32 sleep_interval; /* Number of beacon periods to sleep */ | 2452 | __le16 action; |
2477 | __u8 beacon_data[MWL8K_FJ_BEACON_MAXLEN]; | ||
2478 | } __attribute__((packed)); | 2453 | } __attribute__((packed)); |
2479 | 2454 | ||
2480 | static int mwl8k_finalize_join(struct ieee80211_hw *hw, void *frame, | 2455 | static int mwl8k_cmd_set_wmm_mode(struct ieee80211_hw *hw, bool enable) |
2481 | int framelen, int dtim) | ||
2482 | { | 2456 | { |
2483 | struct mwl8k_cmd_finalize_join *cmd; | 2457 | struct mwl8k_priv *priv = hw->priv; |
2484 | struct ieee80211_mgmt *payload = frame; | 2458 | struct mwl8k_cmd_set_wmm_mode *cmd; |
2485 | int payload_len; | ||
2486 | int rc; | 2459 | int rc; |
2487 | 2460 | ||
2488 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); | 2461 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); |
2489 | if (cmd == NULL) | 2462 | if (cmd == NULL) |
2490 | return -ENOMEM; | 2463 | return -ENOMEM; |
2491 | 2464 | ||
2492 | cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_FINALIZE_JOIN); | 2465 | cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_WMM_MODE); |
2493 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); | 2466 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); |
2494 | cmd->sleep_interval = cpu_to_le32(dtim ? dtim : 1); | 2467 | cmd->action = cpu_to_le16(!!enable); |
2495 | |||
2496 | payload_len = framelen - ieee80211_hdrlen(payload->frame_control); | ||
2497 | if (payload_len < 0) | ||
2498 | payload_len = 0; | ||
2499 | else if (payload_len > MWL8K_FJ_BEACON_MAXLEN) | ||
2500 | payload_len = MWL8K_FJ_BEACON_MAXLEN; | ||
2501 | |||
2502 | memcpy(cmd->beacon_data, &payload->u.beacon, payload_len); | ||
2503 | 2468 | ||
2504 | rc = mwl8k_post_cmd(hw, &cmd->header); | 2469 | rc = mwl8k_post_cmd(hw, &cmd->header); |
2505 | kfree(cmd); | 2470 | kfree(cmd); |
2506 | 2471 | ||
2507 | return rc; | 2472 | if (!rc) |
2508 | } | 2473 | priv->wmm_enabled = enable; |
2509 | |||
2510 | /* | ||
2511 | * CMD_UPDATE_STADB. | ||
2512 | */ | ||
2513 | struct mwl8k_cmd_update_sta_db { | ||
2514 | struct mwl8k_cmd_pkt header; | ||
2515 | |||
2516 | /* See STADB_ACTION_TYPE */ | ||
2517 | __le32 action; | ||
2518 | |||
2519 | /* Peer MAC address */ | ||
2520 | __u8 peer_addr[ETH_ALEN]; | ||
2521 | |||
2522 | __le32 reserved; | ||
2523 | |||
2524 | /* Peer info - valid during add/update. */ | ||
2525 | struct peer_capability_info peer_info; | ||
2526 | } __attribute__((packed)); | ||
2527 | |||
2528 | static int mwl8k_cmd_update_sta_db(struct ieee80211_hw *hw, | ||
2529 | struct ieee80211_vif *vif, __u32 action) | ||
2530 | { | ||
2531 | struct mwl8k_vif *mv_vif = MWL8K_VIF(vif); | ||
2532 | struct ieee80211_bss_conf *info = &mv_vif->bss_info; | ||
2533 | struct mwl8k_cmd_update_sta_db *cmd; | ||
2534 | struct peer_capability_info *peer_info; | ||
2535 | int rc; | ||
2536 | |||
2537 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); | ||
2538 | if (cmd == NULL) | ||
2539 | return -ENOMEM; | ||
2540 | |||
2541 | cmd->header.code = cpu_to_le16(MWL8K_CMD_UPDATE_STADB); | ||
2542 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); | ||
2543 | |||
2544 | cmd->action = cpu_to_le32(action); | ||
2545 | peer_info = &cmd->peer_info; | ||
2546 | memcpy(cmd->peer_addr, mv_vif->bssid, ETH_ALEN); | ||
2547 | |||
2548 | switch (action) { | ||
2549 | case MWL8K_STA_DB_ADD_ENTRY: | ||
2550 | case MWL8K_STA_DB_MODIFY_ENTRY: | ||
2551 | /* Build peer_info block */ | ||
2552 | peer_info->peer_type = MWL8K_PEER_TYPE_ACCESSPOINT; | ||
2553 | peer_info->basic_caps = cpu_to_le16(info->assoc_capability); | ||
2554 | memcpy(peer_info->legacy_rates, mwl8k_rateids, | ||
2555 | sizeof(mwl8k_rateids)); | ||
2556 | peer_info->interop = 1; | ||
2557 | peer_info->amsdu_enabled = 0; | ||
2558 | |||
2559 | rc = mwl8k_post_cmd(hw, &cmd->header); | ||
2560 | if (rc == 0) | ||
2561 | mv_vif->peer_id = peer_info->station_id; | ||
2562 | |||
2563 | break; | ||
2564 | |||
2565 | case MWL8K_STA_DB_DEL_ENTRY: | ||
2566 | case MWL8K_STA_DB_FLUSH: | ||
2567 | default: | ||
2568 | rc = mwl8k_post_cmd(hw, &cmd->header); | ||
2569 | if (rc == 0) | ||
2570 | mv_vif->peer_id = 0; | ||
2571 | break; | ||
2572 | } | ||
2573 | kfree(cmd); | ||
2574 | |||
2575 | return rc; | ||
2576 | } | ||
2577 | |||
2578 | /* | ||
2579 | * CMD_SET_AID. | ||
2580 | */ | ||
2581 | #define MWL8K_FRAME_PROT_DISABLED 0x00 | ||
2582 | #define MWL8K_FRAME_PROT_11G 0x07 | ||
2583 | #define MWL8K_FRAME_PROT_11N_HT_40MHZ_ONLY 0x02 | ||
2584 | #define MWL8K_FRAME_PROT_11N_HT_ALL 0x06 | ||
2585 | |||
2586 | struct mwl8k_cmd_update_set_aid { | ||
2587 | struct mwl8k_cmd_pkt header; | ||
2588 | __le16 aid; | ||
2589 | |||
2590 | /* AP's MAC address (BSSID) */ | ||
2591 | __u8 bssid[ETH_ALEN]; | ||
2592 | __le16 protection_mode; | ||
2593 | __u8 supp_rates[14]; | ||
2594 | } __attribute__((packed)); | ||
2595 | |||
2596 | static int mwl8k_cmd_set_aid(struct ieee80211_hw *hw, | ||
2597 | struct ieee80211_vif *vif) | ||
2598 | { | ||
2599 | struct mwl8k_vif *mv_vif = MWL8K_VIF(vif); | ||
2600 | struct ieee80211_bss_conf *info = &mv_vif->bss_info; | ||
2601 | struct mwl8k_cmd_update_set_aid *cmd; | ||
2602 | u16 prot_mode; | ||
2603 | int rc; | ||
2604 | |||
2605 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); | ||
2606 | if (cmd == NULL) | ||
2607 | return -ENOMEM; | ||
2608 | |||
2609 | cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_AID); | ||
2610 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); | ||
2611 | cmd->aid = cpu_to_le16(info->aid); | ||
2612 | |||
2613 | memcpy(cmd->bssid, mv_vif->bssid, ETH_ALEN); | ||
2614 | |||
2615 | if (info->use_cts_prot) { | ||
2616 | prot_mode = MWL8K_FRAME_PROT_11G; | ||
2617 | } else { | ||
2618 | switch (info->ht_operation_mode & | ||
2619 | IEEE80211_HT_OP_MODE_PROTECTION) { | ||
2620 | case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ: | ||
2621 | prot_mode = MWL8K_FRAME_PROT_11N_HT_40MHZ_ONLY; | ||
2622 | break; | ||
2623 | case IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED: | ||
2624 | prot_mode = MWL8K_FRAME_PROT_11N_HT_ALL; | ||
2625 | break; | ||
2626 | default: | ||
2627 | prot_mode = MWL8K_FRAME_PROT_DISABLED; | ||
2628 | break; | ||
2629 | } | ||
2630 | } | ||
2631 | cmd->protection_mode = cpu_to_le16(prot_mode); | ||
2632 | |||
2633 | memcpy(cmd->supp_rates, mwl8k_rateids, sizeof(mwl8k_rateids)); | ||
2634 | |||
2635 | rc = mwl8k_post_cmd(hw, &cmd->header); | ||
2636 | kfree(cmd); | ||
2637 | 2474 | ||
2638 | return rc; | 2475 | return rc; |
2639 | } | 2476 | } |
2640 | 2477 | ||
2641 | /* | 2478 | /* |
2642 | * CMD_SET_RATE. | 2479 | * CMD_MIMO_CONFIG. |
2643 | */ | 2480 | */ |
2644 | struct mwl8k_cmd_update_rateset { | 2481 | struct mwl8k_cmd_mimo_config { |
2645 | struct mwl8k_cmd_pkt header; | 2482 | struct mwl8k_cmd_pkt header; |
2646 | __u8 legacy_rates[14]; | 2483 | __le32 action; |
2647 | 2484 | __u8 rx_antenna_map; | |
2648 | /* Bitmap for supported MCS codes. */ | 2485 | __u8 tx_antenna_map; |
2649 | __u8 mcs_set[16]; | ||
2650 | __u8 reserved[16]; | ||
2651 | } __attribute__((packed)); | 2486 | } __attribute__((packed)); |
2652 | 2487 | ||
2653 | static int mwl8k_update_rateset(struct ieee80211_hw *hw, | 2488 | static int mwl8k_cmd_mimo_config(struct ieee80211_hw *hw, __u8 rx, __u8 tx) |
2654 | struct ieee80211_vif *vif) | ||
2655 | { | 2489 | { |
2656 | struct mwl8k_cmd_update_rateset *cmd; | 2490 | struct mwl8k_cmd_mimo_config *cmd; |
2657 | int rc; | 2491 | int rc; |
2658 | 2492 | ||
2659 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); | 2493 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); |
2660 | if (cmd == NULL) | 2494 | if (cmd == NULL) |
2661 | return -ENOMEM; | 2495 | return -ENOMEM; |
2662 | 2496 | ||
2663 | cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_RATE); | 2497 | cmd->header.code = cpu_to_le16(MWL8K_CMD_MIMO_CONFIG); |
2664 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); | 2498 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); |
2665 | memcpy(cmd->legacy_rates, mwl8k_rateids, sizeof(mwl8k_rateids)); | 2499 | cmd->action = cpu_to_le32((u32)MWL8K_CMD_SET); |
2500 | cmd->rx_antenna_map = rx; | ||
2501 | cmd->tx_antenna_map = tx; | ||
2666 | 2502 | ||
2667 | rc = mwl8k_post_cmd(hw, &cmd->header); | 2503 | rc = mwl8k_post_cmd(hw, &cmd->header); |
2668 | kfree(cmd); | 2504 | kfree(cmd); |
@@ -2755,6 +2591,169 @@ static int mwl8k_cmd_use_fixed_rate(struct ieee80211_hw *hw, | |||
2755 | return rc; | 2591 | return rc; |
2756 | } | 2592 | } |
2757 | 2593 | ||
2594 | /* | ||
2595 | * CMD_ENABLE_SNIFFER. | ||
2596 | */ | ||
2597 | struct mwl8k_cmd_enable_sniffer { | ||
2598 | struct mwl8k_cmd_pkt header; | ||
2599 | __le32 action; | ||
2600 | } __attribute__((packed)); | ||
2601 | |||
2602 | static int mwl8k_cmd_enable_sniffer(struct ieee80211_hw *hw, bool enable) | ||
2603 | { | ||
2604 | struct mwl8k_cmd_enable_sniffer *cmd; | ||
2605 | int rc; | ||
2606 | |||
2607 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); | ||
2608 | if (cmd == NULL) | ||
2609 | return -ENOMEM; | ||
2610 | |||
2611 | cmd->header.code = cpu_to_le16(MWL8K_CMD_ENABLE_SNIFFER); | ||
2612 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); | ||
2613 | cmd->action = cpu_to_le32(!!enable); | ||
2614 | |||
2615 | rc = mwl8k_post_cmd(hw, &cmd->header); | ||
2616 | kfree(cmd); | ||
2617 | |||
2618 | return rc; | ||
2619 | } | ||
2620 | |||
2621 | /* | ||
2622 | * CMD_SET_MAC_ADDR. | ||
2623 | */ | ||
2624 | struct mwl8k_cmd_set_mac_addr { | ||
2625 | struct mwl8k_cmd_pkt header; | ||
2626 | union { | ||
2627 | struct { | ||
2628 | __le16 mac_type; | ||
2629 | __u8 mac_addr[ETH_ALEN]; | ||
2630 | } mbss; | ||
2631 | __u8 mac_addr[ETH_ALEN]; | ||
2632 | }; | ||
2633 | } __attribute__((packed)); | ||
2634 | |||
2635 | static int mwl8k_cmd_set_mac_addr(struct ieee80211_hw *hw, u8 *mac) | ||
2636 | { | ||
2637 | struct mwl8k_priv *priv = hw->priv; | ||
2638 | struct mwl8k_cmd_set_mac_addr *cmd; | ||
2639 | int rc; | ||
2640 | |||
2641 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); | ||
2642 | if (cmd == NULL) | ||
2643 | return -ENOMEM; | ||
2644 | |||
2645 | cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_MAC_ADDR); | ||
2646 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); | ||
2647 | if (priv->ap_fw) { | ||
2648 | cmd->mbss.mac_type = 0; | ||
2649 | memcpy(cmd->mbss.mac_addr, mac, ETH_ALEN); | ||
2650 | } else { | ||
2651 | memcpy(cmd->mac_addr, mac, ETH_ALEN); | ||
2652 | } | ||
2653 | |||
2654 | rc = mwl8k_post_cmd(hw, &cmd->header); | ||
2655 | kfree(cmd); | ||
2656 | |||
2657 | return rc; | ||
2658 | } | ||
2659 | |||
2660 | /* | ||
2661 | * CMD_SET_RATEADAPT_MODE. | ||
2662 | */ | ||
2663 | struct mwl8k_cmd_set_rate_adapt_mode { | ||
2664 | struct mwl8k_cmd_pkt header; | ||
2665 | __le16 action; | ||
2666 | __le16 mode; | ||
2667 | } __attribute__((packed)); | ||
2668 | |||
2669 | static int mwl8k_cmd_set_rateadapt_mode(struct ieee80211_hw *hw, __u16 mode) | ||
2670 | { | ||
2671 | struct mwl8k_cmd_set_rate_adapt_mode *cmd; | ||
2672 | int rc; | ||
2673 | |||
2674 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); | ||
2675 | if (cmd == NULL) | ||
2676 | return -ENOMEM; | ||
2677 | |||
2678 | cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_RATEADAPT_MODE); | ||
2679 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); | ||
2680 | cmd->action = cpu_to_le16(MWL8K_CMD_SET); | ||
2681 | cmd->mode = cpu_to_le16(mode); | ||
2682 | |||
2683 | rc = mwl8k_post_cmd(hw, &cmd->header); | ||
2684 | kfree(cmd); | ||
2685 | |||
2686 | return rc; | ||
2687 | } | ||
2688 | |||
2689 | /* | ||
2690 | * CMD_UPDATE_STADB. | ||
2691 | */ | ||
2692 | struct mwl8k_cmd_update_stadb { | ||
2693 | struct mwl8k_cmd_pkt header; | ||
2694 | |||
2695 | /* See STADB_ACTION_TYPE */ | ||
2696 | __le32 action; | ||
2697 | |||
2698 | /* Peer MAC address */ | ||
2699 | __u8 peer_addr[ETH_ALEN]; | ||
2700 | |||
2701 | __le32 reserved; | ||
2702 | |||
2703 | /* Peer info - valid during add/update. */ | ||
2704 | struct peer_capability_info peer_info; | ||
2705 | } __attribute__((packed)); | ||
2706 | |||
2707 | static int mwl8k_cmd_update_stadb(struct ieee80211_hw *hw, | ||
2708 | struct ieee80211_vif *vif, __u32 action) | ||
2709 | { | ||
2710 | struct mwl8k_vif *mv_vif = MWL8K_VIF(vif); | ||
2711 | struct ieee80211_bss_conf *info = &mv_vif->bss_info; | ||
2712 | struct mwl8k_cmd_update_stadb *cmd; | ||
2713 | struct peer_capability_info *peer_info; | ||
2714 | int rc; | ||
2715 | |||
2716 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); | ||
2717 | if (cmd == NULL) | ||
2718 | return -ENOMEM; | ||
2719 | |||
2720 | cmd->header.code = cpu_to_le16(MWL8K_CMD_UPDATE_STADB); | ||
2721 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); | ||
2722 | |||
2723 | cmd->action = cpu_to_le32(action); | ||
2724 | peer_info = &cmd->peer_info; | ||
2725 | memcpy(cmd->peer_addr, mv_vif->bssid, ETH_ALEN); | ||
2726 | |||
2727 | switch (action) { | ||
2728 | case MWL8K_STA_DB_ADD_ENTRY: | ||
2729 | case MWL8K_STA_DB_MODIFY_ENTRY: | ||
2730 | /* Build peer_info block */ | ||
2731 | peer_info->peer_type = MWL8K_PEER_TYPE_ACCESSPOINT; | ||
2732 | peer_info->basic_caps = cpu_to_le16(info->assoc_capability); | ||
2733 | memcpy(peer_info->legacy_rates, mwl8k_rateids, | ||
2734 | sizeof(mwl8k_rateids)); | ||
2735 | peer_info->interop = 1; | ||
2736 | peer_info->amsdu_enabled = 0; | ||
2737 | |||
2738 | rc = mwl8k_post_cmd(hw, &cmd->header); | ||
2739 | if (rc == 0) | ||
2740 | mv_vif->peer_id = peer_info->station_id; | ||
2741 | |||
2742 | break; | ||
2743 | |||
2744 | case MWL8K_STA_DB_DEL_ENTRY: | ||
2745 | case MWL8K_STA_DB_FLUSH: | ||
2746 | default: | ||
2747 | rc = mwl8k_post_cmd(hw, &cmd->header); | ||
2748 | if (rc == 0) | ||
2749 | mv_vif->peer_id = 0; | ||
2750 | break; | ||
2751 | } | ||
2752 | kfree(cmd); | ||
2753 | |||
2754 | return rc; | ||
2755 | } | ||
2756 | |||
2758 | 2757 | ||
2759 | /* | 2758 | /* |
2760 | * Interrupt handling. | 2759 | * Interrupt handling. |
@@ -2836,11 +2835,11 @@ static int mwl8k_start(struct ieee80211_hw *hw) | |||
2836 | 2835 | ||
2837 | rc = mwl8k_fw_lock(hw); | 2836 | rc = mwl8k_fw_lock(hw); |
2838 | if (!rc) { | 2837 | if (!rc) { |
2839 | rc = mwl8k_cmd_802_11_radio_enable(hw); | 2838 | rc = mwl8k_cmd_radio_enable(hw); |
2840 | 2839 | ||
2841 | if (!priv->ap_fw) { | 2840 | if (!priv->ap_fw) { |
2842 | if (!rc) | 2841 | if (!rc) |
2843 | rc = mwl8k_enable_sniffer(hw, 0); | 2842 | rc = mwl8k_cmd_enable_sniffer(hw, 0); |
2844 | 2843 | ||
2845 | if (!rc) | 2844 | if (!rc) |
2846 | rc = mwl8k_cmd_set_pre_scan(hw); | 2845 | rc = mwl8k_cmd_set_pre_scan(hw); |
@@ -2851,10 +2850,10 @@ static int mwl8k_start(struct ieee80211_hw *hw) | |||
2851 | } | 2850 | } |
2852 | 2851 | ||
2853 | if (!rc) | 2852 | if (!rc) |
2854 | rc = mwl8k_cmd_setrateadaptmode(hw, 0); | 2853 | rc = mwl8k_cmd_set_rateadapt_mode(hw, 0); |
2855 | 2854 | ||
2856 | if (!rc) | 2855 | if (!rc) |
2857 | rc = mwl8k_set_wmm(hw, 0); | 2856 | rc = mwl8k_cmd_set_wmm_mode(hw, 0); |
2858 | 2857 | ||
2859 | mwl8k_fw_unlock(hw); | 2858 | mwl8k_fw_unlock(hw); |
2860 | } | 2859 | } |
@@ -2873,7 +2872,7 @@ static void mwl8k_stop(struct ieee80211_hw *hw) | |||
2873 | struct mwl8k_priv *priv = hw->priv; | 2872 | struct mwl8k_priv *priv = hw->priv; |
2874 | int i; | 2873 | int i; |
2875 | 2874 | ||
2876 | mwl8k_cmd_802_11_radio_disable(hw); | 2875 | mwl8k_cmd_radio_disable(hw); |
2877 | 2876 | ||
2878 | ieee80211_stop_queues(hw); | 2877 | ieee80211_stop_queues(hw); |
2879 | 2878 | ||
@@ -2929,7 +2928,7 @@ static int mwl8k_add_interface(struct ieee80211_hw *hw, | |||
2929 | memset(mwl8k_vif, 0, sizeof(*mwl8k_vif)); | 2928 | memset(mwl8k_vif, 0, sizeof(*mwl8k_vif)); |
2930 | 2929 | ||
2931 | /* Set and save the mac address */ | 2930 | /* Set and save the mac address */ |
2932 | mwl8k_set_mac_addr(hw, conf->mac_addr); | 2931 | mwl8k_cmd_set_mac_addr(hw, conf->mac_addr); |
2933 | memcpy(mwl8k_vif->mac_addr, conf->mac_addr, ETH_ALEN); | 2932 | memcpy(mwl8k_vif->mac_addr, conf->mac_addr, ETH_ALEN); |
2934 | 2933 | ||
2935 | /* Back pointer to parent config block */ | 2934 | /* Back pointer to parent config block */ |
@@ -2952,7 +2951,7 @@ static void mwl8k_remove_interface(struct ieee80211_hw *hw, | |||
2952 | if (priv->vif == NULL) | 2951 | if (priv->vif == NULL) |
2953 | return; | 2952 | return; |
2954 | 2953 | ||
2955 | mwl8k_set_mac_addr(hw, "\x00\x00\x00\x00\x00\x00"); | 2954 | mwl8k_cmd_set_mac_addr(hw, "\x00\x00\x00\x00\x00\x00"); |
2956 | 2955 | ||
2957 | priv->vif = NULL; | 2956 | priv->vif = NULL; |
2958 | } | 2957 | } |
@@ -2964,7 +2963,7 @@ static int mwl8k_config(struct ieee80211_hw *hw, u32 changed) | |||
2964 | int rc; | 2963 | int rc; |
2965 | 2964 | ||
2966 | if (conf->flags & IEEE80211_CONF_IDLE) { | 2965 | if (conf->flags & IEEE80211_CONF_IDLE) { |
2967 | mwl8k_cmd_802_11_radio_disable(hw); | 2966 | mwl8k_cmd_radio_disable(hw); |
2968 | priv->current_channel = NULL; | 2967 | priv->current_channel = NULL; |
2969 | return 0; | 2968 | return 0; |
2970 | } | 2969 | } |
@@ -2973,7 +2972,7 @@ static int mwl8k_config(struct ieee80211_hw *hw, u32 changed) | |||
2973 | if (rc) | 2972 | if (rc) |
2974 | return rc; | 2973 | return rc; |
2975 | 2974 | ||
2976 | rc = mwl8k_cmd_802_11_radio_enable(hw); | 2975 | rc = mwl8k_cmd_radio_enable(hw); |
2977 | if (rc) | 2976 | if (rc) |
2978 | goto out; | 2977 | goto out; |
2979 | 2978 | ||
@@ -2985,7 +2984,7 @@ static int mwl8k_config(struct ieee80211_hw *hw, u32 changed) | |||
2985 | 2984 | ||
2986 | if (conf->power_level > 18) | 2985 | if (conf->power_level > 18) |
2987 | conf->power_level = 18; | 2986 | conf->power_level = 18; |
2988 | rc = mwl8k_cmd_802_11_rf_tx_power(hw, conf->power_level); | 2987 | rc = mwl8k_cmd_rf_tx_power(hw, conf->power_level); |
2989 | if (rc) | 2988 | if (rc) |
2990 | goto out; | 2989 | goto out; |
2991 | 2990 | ||
@@ -3028,7 +3027,7 @@ static void mwl8k_bss_info_changed(struct ieee80211_hw *hw, | |||
3028 | memcpy(mwl8k_vif->bssid, info->bssid, ETH_ALEN); | 3027 | memcpy(mwl8k_vif->bssid, info->bssid, ETH_ALEN); |
3029 | 3028 | ||
3030 | /* Install rates */ | 3029 | /* Install rates */ |
3031 | rc = mwl8k_update_rateset(hw, vif); | 3030 | rc = mwl8k_cmd_set_rate(hw, vif); |
3032 | if (rc) | 3031 | if (rc) |
3033 | goto out; | 3032 | goto out; |
3034 | 3033 | ||
@@ -3049,7 +3048,7 @@ static void mwl8k_bss_info_changed(struct ieee80211_hw *hw, | |||
3049 | goto out; | 3048 | goto out; |
3050 | 3049 | ||
3051 | /* Update peer rate info */ | 3050 | /* Update peer rate info */ |
3052 | rc = mwl8k_cmd_update_sta_db(hw, vif, | 3051 | rc = mwl8k_cmd_update_stadb(hw, vif, |
3053 | MWL8K_STA_DB_MODIFY_ENTRY); | 3052 | MWL8K_STA_DB_MODIFY_ENTRY); |
3054 | if (rc) | 3053 | if (rc) |
3055 | goto out; | 3054 | goto out; |
@@ -3066,7 +3065,7 @@ static void mwl8k_bss_info_changed(struct ieee80211_hw *hw, | |||
3066 | memcpy(priv->capture_bssid, mwl8k_vif->bssid, ETH_ALEN); | 3065 | memcpy(priv->capture_bssid, mwl8k_vif->bssid, ETH_ALEN); |
3067 | priv->capture_beacon = true; | 3066 | priv->capture_beacon = true; |
3068 | } else { | 3067 | } else { |
3069 | rc = mwl8k_cmd_update_sta_db(hw, vif, MWL8K_STA_DB_DEL_ENTRY); | 3068 | rc = mwl8k_cmd_update_stadb(hw, vif, MWL8K_STA_DB_DEL_ENTRY); |
3070 | memset(&mwl8k_vif->bss_info, 0, | 3069 | memset(&mwl8k_vif->bss_info, 0, |
3071 | sizeof(struct ieee80211_bss_conf)); | 3070 | sizeof(struct ieee80211_bss_conf)); |
3072 | memset(mwl8k_vif->bssid, 0, ETH_ALEN); | 3071 | memset(mwl8k_vif->bssid, 0, ETH_ALEN); |
@@ -3114,7 +3113,7 @@ mwl8k_configure_filter_sniffer(struct ieee80211_hw *hw, | |||
3114 | } | 3113 | } |
3115 | 3114 | ||
3116 | if (!priv->sniffer_enabled) { | 3115 | if (!priv->sniffer_enabled) { |
3117 | if (mwl8k_enable_sniffer(hw, 1)) | 3116 | if (mwl8k_cmd_enable_sniffer(hw, 1)) |
3118 | return 0; | 3117 | return 0; |
3119 | priv->sniffer_enabled = true; | 3118 | priv->sniffer_enabled = true; |
3120 | } | 3119 | } |
@@ -3161,7 +3160,7 @@ static void mwl8k_configure_filter(struct ieee80211_hw *hw, | |||
3161 | return; | 3160 | return; |
3162 | 3161 | ||
3163 | if (priv->sniffer_enabled) { | 3162 | if (priv->sniffer_enabled) { |
3164 | mwl8k_enable_sniffer(hw, 0); | 3163 | mwl8k_cmd_enable_sniffer(hw, 0); |
3165 | priv->sniffer_enabled = false; | 3164 | priv->sniffer_enabled = false; |
3166 | } | 3165 | } |
3167 | 3166 | ||
@@ -3211,7 +3210,7 @@ static void mwl8k_configure_filter(struct ieee80211_hw *hw, | |||
3211 | 3210 | ||
3212 | static int mwl8k_set_rts_threshold(struct ieee80211_hw *hw, u32 value) | 3211 | static int mwl8k_set_rts_threshold(struct ieee80211_hw *hw, u32 value) |
3213 | { | 3212 | { |
3214 | return mwl8k_rts_threshold(hw, MWL8K_CMD_SET, value); | 3213 | return mwl8k_cmd_set_rts_threshold(hw, MWL8K_CMD_SET, value); |
3215 | } | 3214 | } |
3216 | 3215 | ||
3217 | static int mwl8k_conf_tx(struct ieee80211_hw *hw, u16 queue, | 3216 | static int mwl8k_conf_tx(struct ieee80211_hw *hw, u16 queue, |
@@ -3223,14 +3222,14 @@ static int mwl8k_conf_tx(struct ieee80211_hw *hw, u16 queue, | |||
3223 | rc = mwl8k_fw_lock(hw); | 3222 | rc = mwl8k_fw_lock(hw); |
3224 | if (!rc) { | 3223 | if (!rc) { |
3225 | if (!priv->wmm_enabled) | 3224 | if (!priv->wmm_enabled) |
3226 | rc = mwl8k_set_wmm(hw, 1); | 3225 | rc = mwl8k_cmd_set_wmm_mode(hw, 1); |
3227 | 3226 | ||
3228 | if (!rc) | 3227 | if (!rc) |
3229 | rc = mwl8k_set_edca_params(hw, queue, | 3228 | rc = mwl8k_cmd_set_edca_params(hw, queue, |
3230 | params->cw_min, | 3229 | params->cw_min, |
3231 | params->cw_max, | 3230 | params->cw_max, |
3232 | params->aifs, | 3231 | params->aifs, |
3233 | params->txop); | 3232 | params->txop); |
3234 | 3233 | ||
3235 | mwl8k_fw_unlock(hw); | 3234 | mwl8k_fw_unlock(hw); |
3236 | } | 3235 | } |
@@ -3259,7 +3258,7 @@ static int mwl8k_get_tx_stats(struct ieee80211_hw *hw, | |||
3259 | static int mwl8k_get_stats(struct ieee80211_hw *hw, | 3258 | static int mwl8k_get_stats(struct ieee80211_hw *hw, |
3260 | struct ieee80211_low_level_stats *stats) | 3259 | struct ieee80211_low_level_stats *stats) |
3261 | { | 3260 | { |
3262 | return mwl8k_cmd_802_11_get_stat(hw, stats); | 3261 | return mwl8k_cmd_get_stat(hw, stats); |
3263 | } | 3262 | } |
3264 | 3263 | ||
3265 | static const struct ieee80211_ops mwl8k_ops = { | 3264 | static const struct ieee80211_ops mwl8k_ops = { |
@@ -3302,7 +3301,7 @@ static void mwl8k_finalize_join_worker(struct work_struct *work) | |||
3302 | struct sk_buff *skb = priv->beacon_skb; | 3301 | struct sk_buff *skb = priv->beacon_skb; |
3303 | u8 dtim = MWL8K_VIF(priv->vif)->bss_info.dtim_period; | 3302 | u8 dtim = MWL8K_VIF(priv->vif)->bss_info.dtim_period; |
3304 | 3303 | ||
3305 | mwl8k_finalize_join(priv->hw, skb->data, skb->len, dtim); | 3304 | mwl8k_cmd_finalize_join(priv->hw, skb->data, skb->len, dtim); |
3306 | dev_kfree_skb(skb); | 3305 | dev_kfree_skb(skb); |
3307 | 3306 | ||
3308 | priv->beacon_skb = NULL; | 3307 | priv->beacon_skb = NULL; |
@@ -3531,14 +3530,14 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev, | |||
3531 | } | 3530 | } |
3532 | 3531 | ||
3533 | /* Turn radio off */ | 3532 | /* Turn radio off */ |
3534 | rc = mwl8k_cmd_802_11_radio_disable(hw); | 3533 | rc = mwl8k_cmd_radio_disable(hw); |
3535 | if (rc) { | 3534 | if (rc) { |
3536 | printk(KERN_ERR "%s: Cannot disable\n", wiphy_name(hw->wiphy)); | 3535 | printk(KERN_ERR "%s: Cannot disable\n", wiphy_name(hw->wiphy)); |
3537 | goto err_stop_firmware; | 3536 | goto err_stop_firmware; |
3538 | } | 3537 | } |
3539 | 3538 | ||
3540 | /* Clear MAC address */ | 3539 | /* Clear MAC address */ |
3541 | rc = mwl8k_set_mac_addr(hw, "\x00\x00\x00\x00\x00\x00"); | 3540 | rc = mwl8k_cmd_set_mac_addr(hw, "\x00\x00\x00\x00\x00\x00"); |
3542 | if (rc) { | 3541 | if (rc) { |
3543 | printk(KERN_ERR "%s: Cannot clear MAC address\n", | 3542 | printk(KERN_ERR "%s: Cannot clear MAC address\n", |
3544 | wiphy_name(hw->wiphy)); | 3543 | wiphy_name(hw->wiphy)); |