aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennert Buytenhek <buytenh@wantstofly.org>2009-11-30 12:11:44 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-12-07 16:51:19 -0500
commit140eb5e2c1978622d7cd979d59a1c0586fe3bbdb (patch)
tree9e43ece949bc8f421ef863d2e9223c2198275613
parent0b5351a8e86292dfac1ca1451deaadb416a33cb8 (diff)
mwl8k: fix UPDATE_STADB command struct legacy_rates array length
There exist 12 802.11b/g rates, but mwl8k supports two additional (non-standard) rates, and includes those rates in rate bitmasks and in its internal rate table that hardware rate indices index. Commit "mwl8k: report rate and other information for received frames" added one of the nonstandard rates to the mwl8k_rates table to make the OFDM rates in the table line up with the rate indices that are reported in the receive descriptor (so that we can just simply copy the receive descriptor rate index into ieee80211_rx_status::rate_idx) and bumped MWL8K_IEEE_LEGACY_DATA_RATES from 12 to 13, but this screwed up the UPDATE_STADB command struct layout, as it also uses that define, for its legacy_rates array. To avoid having to convert rate indices and legacy rate bitmaps (e.g. ieee80211_bss_conf::basic_rates) between the 12-rate mac80211 format and the 14-rate mwl8k format, we'll report all 14 rates in our wiphy's band, but filter out the nonstandard ones e.g. in the case of the UPDATE_STADB command which only accepts 12 rates. In the commands that accept 14 rates (SET_AID, SET_RATE), replace the use of the MWL8K_RATE_INDEX_MAX_ARRAY define in the command struct by the constant 14, to make it clearer that these commands accept 14 rates. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/mwl8k.c51
1 files changed, 13 insertions, 38 deletions
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c
index f93eddda9c0f..0251b6144f57 100644
--- a/drivers/net/wireless/mwl8k.c
+++ b/drivers/net/wireless/mwl8k.c
@@ -184,7 +184,7 @@ struct mwl8k_priv {
184 /* PHY parameters */ 184 /* PHY parameters */
185 struct ieee80211_supported_band band; 185 struct ieee80211_supported_band band;
186 struct ieee80211_channel channels[14]; 186 struct ieee80211_channel channels[14];
187 struct ieee80211_rate rates[13]; 187 struct ieee80211_rate rates[14];
188 188
189 bool radio_on; 189 bool radio_on;
190 bool radio_short_preamble; 190 bool radio_short_preamble;
@@ -220,15 +220,6 @@ struct mwl8k_vif {
220 u8 bssid[ETH_ALEN]; 220 u8 bssid[ETH_ALEN];
221 u8 mac_addr[ETH_ALEN]; 221 u8 mac_addr[ETH_ALEN];
222 222
223 /*
224 * Subset of supported legacy rates.
225 * Intersection of AP and STA supported rates.
226 */
227 struct ieee80211_rate legacy_rates[13];
228
229 /* number of supported legacy rates */
230 u8 legacy_nrates;
231
232 /* Index into station database.Returned by update_sta_db call */ 223 /* Index into station database.Returned by update_sta_db call */
233 u8 peer_id; 224 u8 peer_id;
234 225
@@ -266,6 +257,11 @@ static const struct ieee80211_rate mwl8k_rates[] = {
266 { .bitrate = 360, .hw_value = 72, }, 257 { .bitrate = 360, .hw_value = 72, },
267 { .bitrate = 480, .hw_value = 96, }, 258 { .bitrate = 480, .hw_value = 96, },
268 { .bitrate = 540, .hw_value = 108, }, 259 { .bitrate = 540, .hw_value = 108, },
260 { .bitrate = 720, .hw_value = 144, },
261};
262
263static const u8 mwl8k_rateids[12] = {
264 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108,
269}; 265};
270 266
271/* Set or get info from Firmware */ 267/* Set or get info from Firmware */
@@ -633,8 +629,6 @@ struct ewc_ht_info {
633/* Peer Entry flags - used to define the type of the peer node */ 629/* Peer Entry flags - used to define the type of the peer node */
634#define MWL8K_PEER_TYPE_ACCESSPOINT 2 630#define MWL8K_PEER_TYPE_ACCESSPOINT 2
635 631
636#define MWL8K_IEEE_LEGACY_DATA_RATES 13
637
638struct peer_capability_info { 632struct peer_capability_info {
639 /* Peer type - AP vs. STA. */ 633 /* Peer type - AP vs. STA. */
640 __u8 peer_type; 634 __u8 peer_type;
@@ -651,7 +645,7 @@ struct peer_capability_info {
651 struct ewc_ht_info ewc_info; 645 struct ewc_ht_info ewc_info;
652 646
653 /* Legacy rate table. Intersection of our rates and peer rates. */ 647 /* Legacy rate table. Intersection of our rates and peer rates. */
654 __u8 legacy_rates[MWL8K_IEEE_LEGACY_DATA_RATES]; 648 __u8 legacy_rates[12];
655 649
656 /* HT rate table. Intersection of our rates and peer rates. */ 650 /* HT rate table. Intersection of our rates and peer rates. */
657 __u8 ht_rates[16]; 651 __u8 ht_rates[16];
@@ -2514,9 +2508,7 @@ static int mwl8k_cmd_update_sta_db(struct ieee80211_hw *hw,
2514 struct ieee80211_bss_conf *info = &mv_vif->bss_info; 2508 struct ieee80211_bss_conf *info = &mv_vif->bss_info;
2515 struct mwl8k_cmd_update_sta_db *cmd; 2509 struct mwl8k_cmd_update_sta_db *cmd;
2516 struct peer_capability_info *peer_info; 2510 struct peer_capability_info *peer_info;
2517 struct ieee80211_rate *bitrates = mv_vif->legacy_rates;
2518 int rc; 2511 int rc;
2519 __u8 count, *rates;
2520 2512
2521 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); 2513 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
2522 if (cmd == NULL) 2514 if (cmd == NULL)
@@ -2535,13 +2527,11 @@ static int mwl8k_cmd_update_sta_db(struct ieee80211_hw *hw,
2535 /* Build peer_info block */ 2527 /* Build peer_info block */
2536 peer_info->peer_type = MWL8K_PEER_TYPE_ACCESSPOINT; 2528 peer_info->peer_type = MWL8K_PEER_TYPE_ACCESSPOINT;
2537 peer_info->basic_caps = cpu_to_le16(info->assoc_capability); 2529 peer_info->basic_caps = cpu_to_le16(info->assoc_capability);
2530 memcpy(peer_info->legacy_rates, mwl8k_rateids,
2531 sizeof(mwl8k_rateids));
2538 peer_info->interop = 1; 2532 peer_info->interop = 1;
2539 peer_info->amsdu_enabled = 0; 2533 peer_info->amsdu_enabled = 0;
2540 2534
2541 rates = peer_info->legacy_rates;
2542 for (count = 0; count < mv_vif->legacy_nrates; count++)
2543 rates[count] = bitrates[count].hw_value;
2544
2545 rc = mwl8k_post_cmd(hw, &cmd->header); 2535 rc = mwl8k_post_cmd(hw, &cmd->header);
2546 if (rc == 0) 2536 if (rc == 0)
2547 mv_vif->peer_id = peer_info->station_id; 2537 mv_vif->peer_id = peer_info->station_id;
@@ -2564,8 +2554,6 @@ static int mwl8k_cmd_update_sta_db(struct ieee80211_hw *hw,
2564/* 2554/*
2565 * CMD_SET_AID. 2555 * CMD_SET_AID.
2566 */ 2556 */
2567#define MWL8K_RATE_INDEX_MAX_ARRAY 14
2568
2569#define MWL8K_FRAME_PROT_DISABLED 0x00 2557#define MWL8K_FRAME_PROT_DISABLED 0x00
2570#define MWL8K_FRAME_PROT_11G 0x07 2558#define MWL8K_FRAME_PROT_11G 0x07
2571#define MWL8K_FRAME_PROT_11N_HT_40MHZ_ONLY 0x02 2559#define MWL8K_FRAME_PROT_11N_HT_40MHZ_ONLY 0x02
@@ -2578,7 +2566,7 @@ struct mwl8k_cmd_update_set_aid {
2578 /* AP's MAC address (BSSID) */ 2566 /* AP's MAC address (BSSID) */
2579 __u8 bssid[ETH_ALEN]; 2567 __u8 bssid[ETH_ALEN];
2580 __le16 protection_mode; 2568 __le16 protection_mode;
2581 __u8 supp_rates[MWL8K_RATE_INDEX_MAX_ARRAY]; 2569 __u8 supp_rates[14];
2582} __attribute__((packed)); 2570} __attribute__((packed));
2583 2571
2584static int mwl8k_cmd_set_aid(struct ieee80211_hw *hw, 2572static int mwl8k_cmd_set_aid(struct ieee80211_hw *hw,
@@ -2587,8 +2575,6 @@ static int mwl8k_cmd_set_aid(struct ieee80211_hw *hw,
2587 struct mwl8k_vif *mv_vif = MWL8K_VIF(vif); 2575 struct mwl8k_vif *mv_vif = MWL8K_VIF(vif);
2588 struct ieee80211_bss_conf *info = &mv_vif->bss_info; 2576 struct ieee80211_bss_conf *info = &mv_vif->bss_info;
2589 struct mwl8k_cmd_update_set_aid *cmd; 2577 struct mwl8k_cmd_update_set_aid *cmd;
2590 struct ieee80211_rate *bitrates = mv_vif->legacy_rates;
2591 int count;
2592 u16 prot_mode; 2578 u16 prot_mode;
2593 int rc; 2579 int rc;
2594 2580
@@ -2620,8 +2606,7 @@ static int mwl8k_cmd_set_aid(struct ieee80211_hw *hw,
2620 } 2606 }
2621 cmd->protection_mode = cpu_to_le16(prot_mode); 2607 cmd->protection_mode = cpu_to_le16(prot_mode);
2622 2608
2623 for (count = 0; count < mv_vif->legacy_nrates; count++) 2609 memcpy(cmd->supp_rates, mwl8k_rateids, sizeof(mwl8k_rateids));
2624 cmd->supp_rates[count] = bitrates[count].hw_value;
2625 2610
2626 rc = mwl8k_post_cmd(hw, &cmd->header); 2611 rc = mwl8k_post_cmd(hw, &cmd->header);
2627 kfree(cmd); 2612 kfree(cmd);
@@ -2634,7 +2619,7 @@ static int mwl8k_cmd_set_aid(struct ieee80211_hw *hw,
2634 */ 2619 */
2635struct mwl8k_cmd_update_rateset { 2620struct mwl8k_cmd_update_rateset {
2636 struct mwl8k_cmd_pkt header; 2621 struct mwl8k_cmd_pkt header;
2637 __u8 legacy_rates[MWL8K_RATE_INDEX_MAX_ARRAY]; 2622 __u8 legacy_rates[14];
2638 2623
2639 /* Bitmap for supported MCS codes. */ 2624 /* Bitmap for supported MCS codes. */
2640 __u8 mcs_set[16]; 2625 __u8 mcs_set[16];
@@ -2644,10 +2629,7 @@ struct mwl8k_cmd_update_rateset {
2644static int mwl8k_update_rateset(struct ieee80211_hw *hw, 2629static int mwl8k_update_rateset(struct ieee80211_hw *hw,
2645 struct ieee80211_vif *vif) 2630 struct ieee80211_vif *vif)
2646{ 2631{
2647 struct mwl8k_vif *mv_vif = MWL8K_VIF(vif);
2648 struct mwl8k_cmd_update_rateset *cmd; 2632 struct mwl8k_cmd_update_rateset *cmd;
2649 struct ieee80211_rate *bitrates = mv_vif->legacy_rates;
2650 int count;
2651 int rc; 2633 int rc;
2652 2634
2653 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); 2635 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
@@ -2656,9 +2638,7 @@ static int mwl8k_update_rateset(struct ieee80211_hw *hw,
2656 2638
2657 cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_RATE); 2639 cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_RATE);
2658 cmd->header.length = cpu_to_le16(sizeof(*cmd)); 2640 cmd->header.length = cpu_to_le16(sizeof(*cmd));
2659 2641 memcpy(cmd->legacy_rates, mwl8k_rateids, sizeof(mwl8k_rateids));
2660 for (count = 0; count < mv_vif->legacy_nrates; count++)
2661 cmd->legacy_rates[count] = bitrates[count].hw_value;
2662 2642
2663 rc = mwl8k_post_cmd(hw, &cmd->header); 2643 rc = mwl8k_post_cmd(hw, &cmd->header);
2664 kfree(cmd); 2644 kfree(cmd);
@@ -2931,11 +2911,6 @@ static int mwl8k_add_interface(struct ieee80211_hw *hw,
2931 /* Back pointer to parent config block */ 2911 /* Back pointer to parent config block */
2932 mwl8k_vif->priv = priv; 2912 mwl8k_vif->priv = priv;
2933 2913
2934 /* Setup initial PHY parameters */
2935 memcpy(mwl8k_vif->legacy_rates,
2936 priv->rates, sizeof(mwl8k_vif->legacy_rates));
2937 mwl8k_vif->legacy_nrates = ARRAY_SIZE(priv->rates);
2938
2939 /* Set Initial sequence number to zero */ 2914 /* Set Initial sequence number to zero */
2940 mwl8k_vif->seqno = 0; 2915 mwl8k_vif->seqno = 0;
2941 2916