Commit b71ed2c6 authored by Lennert Buytenhek's avatar Lennert Buytenhek Committed by John W. Linville

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: default avatarLennert Buytenhek <buytenh@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 62abd3cf
...@@ -2482,49 +2482,30 @@ static int mwl8k_cmd_mimo_config(struct ieee80211_hw *hw, __u8 rx, __u8 tx) ...@@ -2482,49 +2482,30 @@ static int mwl8k_cmd_mimo_config(struct ieee80211_hw *hw, __u8 rx, __u8 tx)
} }
/* /*
* CMD_USE_FIXED_RATE. * CMD_USE_FIXED_RATE (STA version).
*/ */
#define MWL8K_RATE_TABLE_SIZE 8 struct mwl8k_cmd_use_fixed_rate_sta {
#define MWL8K_UCAST_RATE 0 struct mwl8k_cmd_pkt header;
#define MWL8K_USE_AUTO_RATE 0x0002 __le32 action;
__le32 allow_rate_drop;
struct mwl8k_rate_entry { __le32 num_rates;
/* Set to 1 if HT rate, 0 if legacy. */ struct {
__le32 is_ht_rate; __le32 is_ht_rate;
/* Set to 1 to use retry_count field. */
__le32 enable_retry; __le32 enable_retry;
/* Specified legacy rate or MCS. */
__le32 rate; __le32 rate;
/* Number of allowed retries. */
__le32 retry_count; __le32 retry_count;
} __attribute__((packed)); } rate_entry[8];
struct mwl8k_rate_table {
/* 1 to allow specified rate and below */
__le32 allow_rate_drop;
__le32 num_rates;
struct mwl8k_rate_entry rate_entry[MWL8K_RATE_TABLE_SIZE];
} __attribute__((packed));
struct mwl8k_cmd_use_fixed_rate {
struct mwl8k_cmd_pkt header;
__le32 action;
struct mwl8k_rate_table rate_table;
/* Unicast, Broadcast or Multicast */
__le32 rate_type; __le32 rate_type;
__le32 reserved1; __le32 reserved1;
__le32 reserved2; __le32 reserved2;
} __attribute__((packed)); } __attribute__((packed));
static int mwl8k_cmd_use_fixed_rate(struct ieee80211_hw *hw, #define MWL8K_USE_AUTO_RATE 0x0002
u32 action, u32 rate_type, struct mwl8k_rate_table *rate_table) #define MWL8K_UCAST_RATE 0
static int mwl8k_cmd_use_fixed_rate_sta(struct ieee80211_hw *hw)
{ {
struct mwl8k_cmd_use_fixed_rate *cmd; struct mwl8k_cmd_use_fixed_rate_sta *cmd;
int count;
int rc; int rc;
cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
...@@ -2533,32 +2514,8 @@ static int mwl8k_cmd_use_fixed_rate(struct ieee80211_hw *hw, ...@@ -2533,32 +2514,8 @@ static int mwl8k_cmd_use_fixed_rate(struct ieee80211_hw *hw,
cmd->header.code = cpu_to_le16(MWL8K_CMD_USE_FIXED_RATE); cmd->header.code = cpu_to_le16(MWL8K_CMD_USE_FIXED_RATE);
cmd->header.length = cpu_to_le16(sizeof(*cmd)); cmd->header.length = cpu_to_le16(sizeof(*cmd));
cmd->action = cpu_to_le32(MWL8K_USE_AUTO_RATE);
cmd->action = cpu_to_le32(action); cmd->rate_type = cpu_to_le32(MWL8K_UCAST_RATE);
cmd->rate_type = cpu_to_le32(rate_type);
if (rate_table != NULL) {
/*
* Copy over each field manually so that endian
* conversion can be done.
*/
cmd->rate_table.allow_rate_drop =
cpu_to_le32(rate_table->allow_rate_drop);
cmd->rate_table.num_rates =
cpu_to_le32(rate_table->num_rates);
for (count = 0; count < rate_table->num_rates; count++) {
struct mwl8k_rate_entry *dst =
&cmd->rate_table.rate_entry[count];
struct mwl8k_rate_entry *src =
&rate_table->rate_entry[count];
dst->is_ht_rate = cpu_to_le32(src->is_ht_rate);
dst->enable_retry = cpu_to_le32(src->enable_retry);
dst->rate = cpu_to_le32(src->rate);
dst->retry_count = cpu_to_le32(src->retry_count);
}
}
rc = mwl8k_post_cmd(hw, &cmd->header); rc = mwl8k_post_cmd(hw, &cmd->header);
kfree(cmd); kfree(cmd);
...@@ -3062,8 +3019,7 @@ static void mwl8k_bss_info_changed(struct ieee80211_hw *hw, ...@@ -3062,8 +3019,7 @@ static void mwl8k_bss_info_changed(struct ieee80211_hw *hw,
if (rc) if (rc)
goto out; goto out;
rc = mwl8k_cmd_use_fixed_rate(hw, MWL8K_USE_AUTO_RATE, rc = mwl8k_cmd_use_fixed_rate_sta(hw);
MWL8K_UCAST_RATE, NULL);
if (rc) if (rc)
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment