diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2010-01-08 12:30:16 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-01-12 14:02:09 -0500 |
commit | b71ed2c6ce8b5c3782ed70d67dc9adbd7ed07684 (patch) | |
tree | 0b5b9f80f103f1a0f5b3ee2bb14e5f2f6f6be488 /drivers/net/wireless/mwl8k.c | |
parent | 62abd3cfb2f1a0ab1963ac4c4087c477da6b1f2a (diff) |
mwl8k: simplify mwl8k_cmd_use_fixed_rate()
As we always use the auto rate adaptation feature and never pass in
a rate table, USE_FIXED_RATE can be simplified somewhat. While we're
at it, rename it to *_sta, as this is the STA version of the command.
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 | 88 |
1 files changed, 22 insertions, 66 deletions
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c index 8f5f7c9f75f7..20e7cf2e266c 100644 --- a/drivers/net/wireless/mwl8k.c +++ b/drivers/net/wireless/mwl8k.c | |||
@@ -2482,49 +2482,30 @@ static int mwl8k_cmd_mimo_config(struct ieee80211_hw *hw, __u8 rx, __u8 tx) | |||
2482 | } | 2482 | } |
2483 | 2483 | ||
2484 | /* | 2484 | /* |
2485 | * CMD_USE_FIXED_RATE. | 2485 | * CMD_USE_FIXED_RATE (STA version). |
2486 | */ | 2486 | */ |
2487 | #define MWL8K_RATE_TABLE_SIZE 8 | 2487 | struct mwl8k_cmd_use_fixed_rate_sta { |
2488 | #define MWL8K_UCAST_RATE 0 | 2488 | struct mwl8k_cmd_pkt header; |
2489 | #define MWL8K_USE_AUTO_RATE 0x0002 | 2489 | __le32 action; |
2490 | 2490 | __le32 allow_rate_drop; | |
2491 | struct mwl8k_rate_entry { | 2491 | __le32 num_rates; |
2492 | /* Set to 1 if HT rate, 0 if legacy. */ | 2492 | struct { |
2493 | __le32 is_ht_rate; | 2493 | __le32 is_ht_rate; |
2494 | 2494 | __le32 enable_retry; | |
2495 | /* Set to 1 to use retry_count field. */ | 2495 | __le32 rate; |
2496 | __le32 enable_retry; | 2496 | __le32 retry_count; |
2497 | 2497 | } rate_entry[8]; | |
2498 | /* Specified legacy rate or MCS. */ | 2498 | __le32 rate_type; |
2499 | __le32 rate; | 2499 | __le32 reserved1; |
2500 | 2500 | __le32 reserved2; | |
2501 | /* Number of allowed retries. */ | ||
2502 | __le32 retry_count; | ||
2503 | } __attribute__((packed)); | ||
2504 | |||
2505 | struct mwl8k_rate_table { | ||
2506 | /* 1 to allow specified rate and below */ | ||
2507 | __le32 allow_rate_drop; | ||
2508 | __le32 num_rates; | ||
2509 | struct mwl8k_rate_entry rate_entry[MWL8K_RATE_TABLE_SIZE]; | ||
2510 | } __attribute__((packed)); | 2501 | } __attribute__((packed)); |
2511 | 2502 | ||
2512 | struct mwl8k_cmd_use_fixed_rate { | 2503 | #define MWL8K_USE_AUTO_RATE 0x0002 |
2513 | struct mwl8k_cmd_pkt header; | 2504 | #define MWL8K_UCAST_RATE 0 |
2514 | __le32 action; | ||
2515 | struct mwl8k_rate_table rate_table; | ||
2516 | |||
2517 | /* Unicast, Broadcast or Multicast */ | ||
2518 | __le32 rate_type; | ||
2519 | __le32 reserved1; | ||
2520 | __le32 reserved2; | ||
2521 | } __attribute__((packed)); | ||
2522 | 2505 | ||
2523 | static int mwl8k_cmd_use_fixed_rate(struct ieee80211_hw *hw, | 2506 | static int mwl8k_cmd_use_fixed_rate_sta(struct ieee80211_hw *hw) |
2524 | u32 action, u32 rate_type, struct mwl8k_rate_table *rate_table) | ||
2525 | { | 2507 | { |
2526 | struct mwl8k_cmd_use_fixed_rate *cmd; | 2508 | struct mwl8k_cmd_use_fixed_rate_sta *cmd; |
2527 | int count; | ||
2528 | int rc; | 2509 | int rc; |
2529 | 2510 | ||
2530 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); | 2511 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); |
@@ -2533,32 +2514,8 @@ static int mwl8k_cmd_use_fixed_rate(struct ieee80211_hw *hw, | |||
2533 | 2514 | ||
2534 | cmd->header.code = cpu_to_le16(MWL8K_CMD_USE_FIXED_RATE); | 2515 | cmd->header.code = cpu_to_le16(MWL8K_CMD_USE_FIXED_RATE); |
2535 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); | 2516 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); |
2536 | 2517 | cmd->action = cpu_to_le32(MWL8K_USE_AUTO_RATE); | |
2537 | cmd->action = cpu_to_le32(action); | 2518 | cmd->rate_type = cpu_to_le32(MWL8K_UCAST_RATE); |
2538 | cmd->rate_type = cpu_to_le32(rate_type); | ||
2539 | |||
2540 | if (rate_table != NULL) { | ||
2541 | /* | ||
2542 | * Copy over each field manually so that endian | ||
2543 | * conversion can be done. | ||
2544 | */ | ||
2545 | cmd->rate_table.allow_rate_drop = | ||
2546 | cpu_to_le32(rate_table->allow_rate_drop); | ||
2547 | cmd->rate_table.num_rates = | ||
2548 | cpu_to_le32(rate_table->num_rates); | ||
2549 | |||
2550 | for (count = 0; count < rate_table->num_rates; count++) { | ||
2551 | struct mwl8k_rate_entry *dst = | ||
2552 | &cmd->rate_table.rate_entry[count]; | ||
2553 | struct mwl8k_rate_entry *src = | ||
2554 | &rate_table->rate_entry[count]; | ||
2555 | |||
2556 | dst->is_ht_rate = cpu_to_le32(src->is_ht_rate); | ||
2557 | dst->enable_retry = cpu_to_le32(src->enable_retry); | ||
2558 | dst->rate = cpu_to_le32(src->rate); | ||
2559 | dst->retry_count = cpu_to_le32(src->retry_count); | ||
2560 | } | ||
2561 | } | ||
2562 | 2519 | ||
2563 | rc = mwl8k_post_cmd(hw, &cmd->header); | 2520 | rc = mwl8k_post_cmd(hw, &cmd->header); |
2564 | kfree(cmd); | 2521 | kfree(cmd); |
@@ -3062,8 +3019,7 @@ static void mwl8k_bss_info_changed(struct ieee80211_hw *hw, | |||
3062 | if (rc) | 3019 | if (rc) |
3063 | goto out; | 3020 | goto out; |
3064 | 3021 | ||
3065 | rc = mwl8k_cmd_use_fixed_rate(hw, MWL8K_USE_AUTO_RATE, | 3022 | rc = mwl8k_cmd_use_fixed_rate_sta(hw); |
3066 | MWL8K_UCAST_RATE, NULL); | ||
3067 | if (rc) | 3023 | if (rc) |
3068 | goto out; | 3024 | goto out; |
3069 | } | 3025 | } |