Commit c2f471f9 authored by David S. Miller's avatar David S. Miller

Merge tag 'wireless-drivers-next-for-davem-2015-01-02' of...

Merge tag 'wireless-drivers-next-for-davem-2015-01-02' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next

Changes:

* ath9k: enable Transmit Power Control (TPC) for ar9003 chips

* rtlwifi: cleanup and updates from the vendor driver

* rsi: fix memory leak related to firmware image

* ath: parameter fix for FCC DFS pattern
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 3adc0bec 354f473e
...@@ -1115,6 +1115,75 @@ static const struct file_operations fops_ackto = { ...@@ -1115,6 +1115,75 @@ static const struct file_operations fops_ackto = {
}; };
#endif #endif
static ssize_t read_file_tpc(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath_softc *sc = file->private_data;
struct ath_hw *ah = sc->sc_ah;
unsigned int len = 0, size = 32;
ssize_t retval;
char *buf;
buf = kzalloc(size, GFP_KERNEL);
if (!buf)
return -ENOMEM;
len += scnprintf(buf + len, size - len, "%s\n",
ah->tpc_enabled ? "ENABLED" : "DISABLED");
if (len > size)
len = size;
retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
kfree(buf);
return retval;
}
static ssize_t write_file_tpc(struct file *file, const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath_softc *sc = file->private_data;
struct ath_hw *ah = sc->sc_ah;
unsigned long val;
char buf[32];
ssize_t len;
bool tpc_enabled;
if (!AR_SREV_9300_20_OR_LATER(ah)) {
/* ar9002 does not support TPC for the moment */
return -EOPNOTSUPP;
}
len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
return -EFAULT;
buf[len] = '\0';
if (kstrtoul(buf, 0, &val))
return -EINVAL;
if (val < 0 || val > 1)
return -EINVAL;
tpc_enabled = !!val;
if (tpc_enabled != ah->tpc_enabled) {
ah->tpc_enabled = tpc_enabled;
ath9k_hw_set_txpowerlimit(ah, sc->cur_chan->txpower, false);
}
return count;
}
static const struct file_operations fops_tpc = {
.read = read_file_tpc,
.write = write_file_tpc,
.open = simple_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
};
/* Ethtool support for get-stats */ /* Ethtool support for get-stats */
#define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO" #define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO"
...@@ -1324,6 +1393,8 @@ int ath9k_init_debug(struct ath_hw *ah) ...@@ -1324,6 +1393,8 @@ int ath9k_init_debug(struct ath_hw *ah)
debugfs_create_file("ack_to", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, debugfs_create_file("ack_to", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
sc, &fops_ackto); sc, &fops_ackto);
#endif #endif
debugfs_create_file("tpc", S_IRUSR | S_IWUSR,
sc->debug.debugfs_phy, sc, &fops_tpc);
return 0; return 0;
} }
...@@ -422,6 +422,9 @@ static void ath9k_hw_init_defaults(struct ath_hw *ah) ...@@ -422,6 +422,9 @@ static void ath9k_hw_init_defaults(struct ath_hw *ah)
ah->power_mode = ATH9K_PM_UNDEFINED; ah->power_mode = ATH9K_PM_UNDEFINED;
ah->htc_reset_init = true; ah->htc_reset_init = true;
/* ar9002 does not support TPC for the moment */
ah->tpc_enabled = !!AR_SREV_9300_20_OR_LATER(ah);
ah->ani_function = ATH9K_ANI_ALL; ah->ani_function = ATH9K_ANI_ALL;
if (!AR_SREV_9300_20_OR_LATER(ah)) if (!AR_SREV_9300_20_OR_LATER(ah))
ah->ani_function &= ~ATH9K_ANI_MRC_CCK; ah->ani_function &= ~ATH9K_ANI_MRC_CCK;
......
...@@ -1106,7 +1106,7 @@ static u8 ath_get_rate_txpower(struct ath_softc *sc, struct ath_buf *bf, ...@@ -1106,7 +1106,7 @@ static u8 ath_get_rate_txpower(struct ath_softc *sc, struct ath_buf *bf,
return MAX_RATE_POWER; return MAX_RATE_POWER;
if (!AR_SREV_9300_20_OR_LATER(ah)) { if (!AR_SREV_9300_20_OR_LATER(ah)) {
/* ar9002 is not sipported for the moment */ /* ar9002 does not support TPC for the moment */
return MAX_RATE_POWER; return MAX_RATE_POWER;
} }
......
...@@ -86,7 +86,7 @@ static const struct radar_detector_specs fcc_radar_ref_types[] = { ...@@ -86,7 +86,7 @@ static const struct radar_detector_specs fcc_radar_ref_types[] = {
FCC_PATTERN(1, 0, 5, 150, 230, 1, 23), FCC_PATTERN(1, 0, 5, 150, 230, 1, 23),
FCC_PATTERN(2, 6, 10, 200, 500, 1, 16), FCC_PATTERN(2, 6, 10, 200, 500, 1, 16),
FCC_PATTERN(3, 11, 20, 200, 500, 1, 12), FCC_PATTERN(3, 11, 20, 200, 500, 1, 12),
FCC_PATTERN(4, 50, 100, 1000, 2000, 1, 20), FCC_PATTERN(4, 50, 100, 1000, 2000, 1, 1),
FCC_PATTERN(5, 0, 1, 333, 333, 1, 9), FCC_PATTERN(5, 0, 1, 333, 333, 1, 9),
}; };
......
...@@ -172,7 +172,6 @@ static int rsi_load_ta_instructions(struct rsi_common *common) ...@@ -172,7 +172,6 @@ static int rsi_load_ta_instructions(struct rsi_common *common)
(struct rsi_91x_sdiodev *)adapter->rsi_dev; (struct rsi_91x_sdiodev *)adapter->rsi_dev;
u32 len; u32 len;
u32 num_blocks; u32 num_blocks;
const u8 *fw;
const struct firmware *fw_entry = NULL; const struct firmware *fw_entry = NULL;
u32 block_size = dev->tx_blk_size; u32 block_size = dev->tx_blk_size;
int status = 0; int status = 0;
...@@ -201,7 +200,6 @@ static int rsi_load_ta_instructions(struct rsi_common *common) ...@@ -201,7 +200,6 @@ static int rsi_load_ta_instructions(struct rsi_common *common)
return status; return status;
} }
fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);
len = fw_entry->size; len = fw_entry->size;
if (len % 4) if (len % 4)
...@@ -212,7 +210,7 @@ static int rsi_load_ta_instructions(struct rsi_common *common) ...@@ -212,7 +210,7 @@ static int rsi_load_ta_instructions(struct rsi_common *common)
rsi_dbg(INIT_ZONE, "%s: Instruction size:%d\n", __func__, len); rsi_dbg(INIT_ZONE, "%s: Instruction size:%d\n", __func__, len);
rsi_dbg(INIT_ZONE, "%s: num blocks: %d\n", __func__, num_blocks); rsi_dbg(INIT_ZONE, "%s: num blocks: %d\n", __func__, num_blocks);
status = rsi_copy_to_card(common, fw, len, num_blocks); status = rsi_copy_to_card(common, fw_entry->data, len, num_blocks);
release_firmware(fw_entry); release_firmware(fw_entry);
return status; return status;
} }
......
...@@ -867,63 +867,135 @@ static u8 _rtl_get_highest_n_rate(struct ieee80211_hw *hw, ...@@ -867,63 +867,135 @@ static u8 _rtl_get_highest_n_rate(struct ieee80211_hw *hw,
* *
* B/G rate: * B/G rate:
* (rx_status->flag & RX_FLAG_HT) = 0, * (rx_status->flag & RX_FLAG_HT) = 0,
* DESC92_RATE1M-->DESC92_RATE54M ==> idx is 0-->11, * DESC_RATE1M-->DESC_RATE54M ==> idx is 0-->11,
* *
* N rate: * N rate:
* (rx_status->flag & RX_FLAG_HT) = 1, * (rx_status->flag & RX_FLAG_HT) = 1,
* DESC92_RATEMCS0-->DESC92_RATEMCS15 ==> idx is 0-->15 * DESC_RATEMCS0-->DESC_RATEMCS15 ==> idx is 0-->15
* *
* 5G band:rx_status->band == IEEE80211_BAND_5GHZ * 5G band:rx_status->band == IEEE80211_BAND_5GHZ
* A rate: * A rate:
* (rx_status->flag & RX_FLAG_HT) = 0, * (rx_status->flag & RX_FLAG_HT) = 0,
* DESC92_RATE6M-->DESC92_RATE54M ==> idx is 0-->7, * DESC_RATE6M-->DESC_RATE54M ==> idx is 0-->7,
* *
* N rate: * N rate:
* (rx_status->flag & RX_FLAG_HT) = 1, * (rx_status->flag & RX_FLAG_HT) = 1,
* DESC92_RATEMCS0-->DESC92_RATEMCS15 ==> idx is 0-->15 * DESC_RATEMCS0-->DESC_RATEMCS15 ==> idx is 0-->15
*
* VHT rates:
* DESC_RATEVHT1SS_MCS0-->DESC_RATEVHT1SS_MCS9 ==> idx is 0-->9
* DESC_RATEVHT2SS_MCS0-->DESC_RATEVHT2SS_MCS9 ==> idx is 0-->9
*/ */
int rtlwifi_rate_mapping(struct ieee80211_hw *hw, int rtlwifi_rate_mapping(struct ieee80211_hw *hw, bool isht, bool isvht,
bool isht, u8 desc_rate, bool first_ampdu) u8 desc_rate)
{ {
int rate_idx; int rate_idx;
if (isvht) {
switch (desc_rate) {
case DESC_RATEVHT1SS_MCS0:
rate_idx = 0;
break;
case DESC_RATEVHT1SS_MCS1:
rate_idx = 1;
break;
case DESC_RATEVHT1SS_MCS2:
rate_idx = 2;
break;
case DESC_RATEVHT1SS_MCS3:
rate_idx = 3;
break;
case DESC_RATEVHT1SS_MCS4:
rate_idx = 4;
break;
case DESC_RATEVHT1SS_MCS5:
rate_idx = 5;
break;
case DESC_RATEVHT1SS_MCS6:
rate_idx = 6;
break;
case DESC_RATEVHT1SS_MCS7:
rate_idx = 7;
break;
case DESC_RATEVHT1SS_MCS8:
rate_idx = 8;
break;
case DESC_RATEVHT1SS_MCS9:
rate_idx = 9;
break;
case DESC_RATEVHT2SS_MCS0:
rate_idx = 0;
break;
case DESC_RATEVHT2SS_MCS1:
rate_idx = 1;
break;
case DESC_RATEVHT2SS_MCS2:
rate_idx = 2;
break;
case DESC_RATEVHT2SS_MCS3:
rate_idx = 3;
break;
case DESC_RATEVHT2SS_MCS4:
rate_idx = 4;
break;
case DESC_RATEVHT2SS_MCS5:
rate_idx = 5;
break;
case DESC_RATEVHT2SS_MCS6:
rate_idx = 6;
break;
case DESC_RATEVHT2SS_MCS7:
rate_idx = 7;
break;
case DESC_RATEVHT2SS_MCS8:
rate_idx = 8;
break;
case DESC_RATEVHT2SS_MCS9:
rate_idx = 9;
break;
default:
rate_idx = 0;
break;
}
return rate_idx;
}
if (false == isht) { if (false == isht) {
if (IEEE80211_BAND_2GHZ == hw->conf.chandef.chan->band) { if (IEEE80211_BAND_2GHZ == hw->conf.chandef.chan->band) {
switch (desc_rate) { switch (desc_rate) {
case DESC92_RATE1M: case DESC_RATE1M:
rate_idx = 0; rate_idx = 0;
break; break;
case DESC92_RATE2M: case DESC_RATE2M:
rate_idx = 1; rate_idx = 1;
break; break;
case DESC92_RATE5_5M: case DESC_RATE5_5M:
rate_idx = 2; rate_idx = 2;
break; break;
case DESC92_RATE11M: case DESC_RATE11M:
rate_idx = 3; rate_idx = 3;
break; break;
case DESC92_RATE6M: case DESC_RATE6M:
rate_idx = 4; rate_idx = 4;
break; break;
case DESC92_RATE9M: case DESC_RATE9M:
rate_idx = 5; rate_idx = 5;
break; break;
case DESC92_RATE12M: case DESC_RATE12M:
rate_idx = 6; rate_idx = 6;
break; break;
case DESC92_RATE18M: case DESC_RATE18M:
rate_idx = 7; rate_idx = 7;
break; break;
case DESC92_RATE24M: case DESC_RATE24M:
rate_idx = 8; rate_idx = 8;
break; break;
case DESC92_RATE36M: case DESC_RATE36M:
rate_idx = 9; rate_idx = 9;
break; break;
case DESC92_RATE48M: case DESC_RATE48M:
rate_idx = 10; rate_idx = 10;
break; break;
case DESC92_RATE54M: case DESC_RATE54M:
rate_idx = 11; rate_idx = 11;
break; break;
default: default:
...@@ -932,28 +1004,28 @@ int rtlwifi_rate_mapping(struct ieee80211_hw *hw, ...@@ -932,28 +1004,28 @@ int rtlwifi_rate_mapping(struct ieee80211_hw *hw,
} }
} else { } else {
switch (desc_rate) { switch (desc_rate) {
case DESC92_RATE6M: case DESC_RATE6M:
rate_idx = 0; rate_idx = 0;
break; break;
case DESC92_RATE9M: case DESC_RATE9M:
rate_idx = 1; rate_idx = 1;
break; break;
case DESC92_RATE12M: case DESC_RATE12M:
rate_idx = 2; rate_idx = 2;
break; break;
case DESC92_RATE18M: case DESC_RATE18M:
rate_idx = 3; rate_idx = 3;
break; break;
case DESC92_RATE24M: case DESC_RATE24M:
rate_idx = 4; rate_idx = 4;
break; break;
case DESC92_RATE36M: case DESC_RATE36M:
rate_idx = 5; rate_idx = 5;
break; break;
case DESC92_RATE48M: case DESC_RATE48M:
rate_idx = 6; rate_idx = 6;
break; break;
case DESC92_RATE54M: case DESC_RATE54M:
rate_idx = 7; rate_idx = 7;
break; break;
default: default:
...@@ -963,52 +1035,52 @@ int rtlwifi_rate_mapping(struct ieee80211_hw *hw, ...@@ -963,52 +1035,52 @@ int rtlwifi_rate_mapping(struct ieee80211_hw *hw,
} }
} else { } else {
switch (desc_rate) { switch (desc_rate) {
case DESC92_RATEMCS0: case DESC_RATEMCS0:
rate_idx = 0; rate_idx = 0;
break; break;
case DESC92_RATEMCS1: case DESC_RATEMCS1:
rate_idx = 1; rate_idx = 1;
break; break;
case DESC92_RATEMCS2: case DESC_RATEMCS2:
rate_idx = 2; rate_idx = 2;
break; break;
case DESC92_RATEMCS3: case DESC_RATEMCS3:
rate_idx = 3; rate_idx = 3;
break; break;
case DESC92_RATEMCS4: case DESC_RATEMCS4:
rate_idx = 4; rate_idx = 4;
break; break;
case DESC92_RATEMCS5: case DESC_RATEMCS5:
rate_idx = 5; rate_idx = 5;
break; break;
case DESC92_RATEMCS6: case DESC_RATEMCS6:
rate_idx = 6; rate_idx = 6;
break; break;
case DESC92_RATEMCS7: case DESC_RATEMCS7:
rate_idx = 7; rate_idx = 7;
break; break;
case DESC92_RATEMCS8: case DESC_RATEMCS8:
rate_idx = 8; rate_idx = 8;
break; break;
case DESC92_RATEMCS9: case DESC_RATEMCS9:
rate_idx = 9; rate_idx = 9;
break; break;
case DESC92_RATEMCS10: case DESC_RATEMCS10:
rate_idx = 10; rate_idx = 10;
break; break;
case DESC92_RATEMCS11: case DESC_RATEMCS11:
rate_idx = 11; rate_idx = 11;
break; break;
case DESC92_RATEMCS12: case DESC_RATEMCS12:
rate_idx = 12; rate_idx = 12;
break; break;
case DESC92_RATEMCS13: case DESC_RATEMCS13:
rate_idx = 13; rate_idx = 13;
break; break;
case DESC92_RATEMCS14: case DESC_RATEMCS14:
rate_idx = 14; rate_idx = 14;
break; break;
case DESC92_RATEMCS15: case DESC_RATEMCS15:
rate_idx = 15; rate_idx = 15;
break; break;
default: default:
......
...@@ -123,8 +123,8 @@ void rtl_watch_dog_timer_callback(unsigned long data); ...@@ -123,8 +123,8 @@ void rtl_watch_dog_timer_callback(unsigned long data);
void rtl_deinit_deferred_work(struct ieee80211_hw *hw); void rtl_deinit_deferred_work(struct ieee80211_hw *hw);
bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx); bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx);
int rtlwifi_rate_mapping(struct ieee80211_hw *hw, int rtlwifi_rate_mapping(struct ieee80211_hw *hw, bool isht,
bool isht, u8 desc_rate, bool first_ampdu); bool isvht, u8 desc_rate);
bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb); bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb);
u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx); u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx);
......
...@@ -95,7 +95,8 @@ void rtl_bb_delay(struct ieee80211_hw *hw, u32 addr, u32 data) ...@@ -95,7 +95,8 @@ void rtl_bb_delay(struct ieee80211_hw *hw, u32 addr, u32 data)
} }
EXPORT_SYMBOL(rtl_bb_delay); EXPORT_SYMBOL(rtl_bb_delay);
void rtl_fw_cb(const struct firmware *firmware, void *context) static void rtl_fw_do_work(const struct firmware *firmware, void *context,
bool is_wow)
{ {
struct ieee80211_hw *hw = context; struct ieee80211_hw *hw = context;
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
...@@ -125,12 +126,31 @@ void rtl_fw_cb(const struct firmware *firmware, void *context) ...@@ -125,12 +126,31 @@ void rtl_fw_cb(const struct firmware *firmware, void *context)
release_firmware(firmware); release_firmware(firmware);
return; return;
} }
memcpy(rtlpriv->rtlhal.pfirmware, firmware->data, firmware->size); if (!is_wow) {
memcpy(rtlpriv->rtlhal.pfirmware, firmware->data,
firmware->size);
rtlpriv->rtlhal.fwsize = firmware->size;
} else {
memcpy(rtlpriv->rtlhal.wowlan_firmware, firmware->data,
firmware->size);
rtlpriv->rtlhal.wowlan_fwsize = firmware->size;
}
rtlpriv->rtlhal.fwsize = firmware->size; rtlpriv->rtlhal.fwsize = firmware->size;
release_firmware(firmware); release_firmware(firmware);
} }
void rtl_fw_cb(const struct firmware *firmware, void *context)
{
rtl_fw_do_work(firmware, context, false);
}
EXPORT_SYMBOL(rtl_fw_cb); EXPORT_SYMBOL(rtl_fw_cb);
void rtl_wowlan_fw_cb(const struct firmware *firmware, void *context)
{
rtl_fw_do_work(firmware, context, true);
}
EXPORT_SYMBOL(rtl_wowlan_fw_cb);
/*mutex for start & stop is must here. */ /*mutex for start & stop is must here. */
static int rtl_op_start(struct ieee80211_hw *hw) static int rtl_op_start(struct ieee80211_hw *hw)
{ {
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
extern const struct ieee80211_ops rtl_ops; extern const struct ieee80211_ops rtl_ops;
void rtl_fw_cb(const struct firmware *firmware, void *context); void rtl_fw_cb(const struct firmware *firmware, void *context);
void rtl_wowlan_fw_cb(const struct firmware *firmware, void *context);
void rtl_addr_delay(u32 addr); void rtl_addr_delay(u32 addr);
void rtl_rfreg_delay(struct ieee80211_hw *hw, enum radio_path rfpath, u32 addr, void rtl_rfreg_delay(struct ieee80211_hw *hw, enum radio_path rfpath, u32 addr,
u32 mask, u32 data); u32 mask, u32 data);
......
...@@ -47,164 +47,6 @@ static u8 _rtl88ee_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue) ...@@ -47,164 +47,6 @@ static u8 _rtl88ee_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue)
return skb->priority; return skb->priority;
} }
/* mac80211's rate_idx is like this:
*
* 2.4G band:rx_status->band == IEEE80211_BAND_2GHZ
*
* B/G rate:
* (rx_status->flag & RX_FLAG_HT) = 0,
* DESC92C_RATE1M-->DESC92C_RATE54M ==> idx is 0-->11,
*
* N rate:
* (rx_status->flag & RX_FLAG_HT) = 1,
* DESC92C_RATEMCS0-->DESC92C_RATEMCS15 ==> idx is 0-->15
*
* 5G band:rx_status->band == IEEE80211_BAND_5GHZ
* A rate:
* (rx_status->flag & RX_FLAG_HT) = 0,
* DESC92C_RATE6M-->DESC92C_RATE54M ==> idx is 0-->7,
*
* N rate:
* (rx_status->flag & RX_FLAG_HT) = 1,
* DESC92C_RATEMCS0-->DESC92C_RATEMCS15 ==> idx is 0-->15
*/
static int _rtl88ee_rate_mapping(struct ieee80211_hw *hw,
bool isht, u8 desc_rate)
{
int rate_idx;
if (!isht) {
if (IEEE80211_BAND_2GHZ == hw->conf.chandef.chan->band) {
switch (desc_rate) {
case DESC92C_RATE1M:
rate_idx = 0;
break;
case DESC92C_RATE2M:
rate_idx = 1;
break;
case DESC92C_RATE5_5M:
rate_idx = 2;
break;
case DESC92C_RATE11M:
rate_idx = 3;
break;
case DESC92C_RATE6M:
rate_idx = 4;
break;
case DESC92C_RATE9M:
rate_idx = 5;
break;
case DESC92C_RATE12M:
rate_idx = 6;
break;
case DESC92C_RATE18M:
rate_idx = 7;
break;
case DESC92C_RATE24M:
rate_idx = 8;
break;
case DESC92C_RATE36M:
rate_idx = 9;
break;
case DESC92C_RATE48M:
rate_idx = 10;
break;
case DESC92C_RATE54M:
rate_idx = 11;
break;
default:
rate_idx = 0;
break;
}
} else {
switch (desc_rate) {
case DESC92C_RATE6M:
rate_idx = 0;
break;
case DESC92C_RATE9M:
rate_idx = 1;
break;
case DESC92C_RATE12M:
rate_idx = 2;
break;
case DESC92C_RATE18M:
rate_idx = 3;
break;
case DESC92C_RATE24M:
rate_idx = 4;
break;
case DESC92C_RATE36M:
rate_idx = 5;
break;
case DESC92C_RATE48M:
rate_idx = 6;
break;
case DESC92C_RATE54M:
rate_idx = 7;
break;
default:
rate_idx = 0;
break;
}
}
} else {
switch (desc_rate) {
case DESC92C_RATEMCS0:
rate_idx = 0;
break;
case DESC92C_RATEMCS1:
rate_idx = 1;
break;
case DESC92C_RATEMCS2:
rate_idx = 2;
break;
case DESC92C_RATEMCS3:
rate_idx = 3;
break;
case DESC92C_RATEMCS4:
rate_idx = 4;
break;
case DESC92C_RATEMCS5:
rate_idx = 5;
break;
case DESC92C_RATEMCS6:
rate_idx = 6;
break;
case DESC92C_RATEMCS7:
rate_idx = 7;
break;
case DESC92C_RATEMCS8:
rate_idx = 8;
break;
case DESC92C_RATEMCS9:
rate_idx = 9;
break;
case DESC92C_RATEMCS10:
rate_idx = 10;
break;
case DESC92C_RATEMCS11:
rate_idx = 11;
break;
case DESC92C_RATEMCS12:
rate_idx = 12;
break;
case DESC92C_RATEMCS13:
rate_idx = 13;
break;
case DESC92C_RATEMCS14:
rate_idx = 14;
break;
case DESC92C_RATEMCS15:
rate_idx = 15;
break;
default:
rate_idx = 0;
break;
}
}
return rate_idx;
}
static void _rtl88ee_query_rxphystatus(struct ieee80211_hw *hw, static void _rtl88ee_query_rxphystatus(struct ieee80211_hw *hw,
struct rtl_stats *pstatus, u8 *pdesc, struct rtl_stats *pstatus, u8 *pdesc,
struct rx_fwinfo_88e *p_drvinfo, struct rx_fwinfo_88e *p_drvinfo,
...@@ -630,8 +472,8 @@ bool rtl88ee_rx_query_desc(struct ieee80211_hw *hw, ...@@ -630,8 +472,8 @@ bool rtl88ee_rx_query_desc(struct ieee80211_hw *hw,
* are use (RX_FLAG_HT) * are use (RX_FLAG_HT)
* Notice: this is diff with windows define * Notice: this is diff with windows define
*/ */
rx_status->rate_idx = _rtl88ee_rate_mapping(hw, rx_status->rate_idx = rtlwifi_rate_mapping(hw, status->is_ht,
status->is_ht, status->rate); false, status->rate);
rx_status->mactime = status->timestamp_low; rx_status->mactime = status->timestamp_low;
if (phystatus == true) { if (phystatus == true) {
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#define FW_8192C_POLLING_DELAY 5 #define FW_8192C_POLLING_DELAY 5
#define FW_8192C_POLLING_TIMEOUT_COUNT 100 #define FW_8192C_POLLING_TIMEOUT_COUNT 100
#define NORMAL_CHIP BIT(4) #define NORMAL_CHIP BIT(4)
#define H2C_92C_KEEP_ALIVE_CTRL 48
#define IS_FW_HEADER_EXIST(_pfwhdr) \ #define IS_FW_HEADER_EXIST(_pfwhdr) \
((le16_to_cpu(_pfwhdr->signature)&0xFFF0) == 0x92C0 ||\ ((le16_to_cpu(_pfwhdr->signature)&0xFFF0) == 0x92C0 ||\
......
...@@ -544,8 +544,13 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) ...@@ -544,8 +544,13 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
(u8 *)(&fw_current_inps)); (u8 *)(&fw_current_inps));
} }
break; } break; }
case HW_VAR_KEEP_ALIVE: case HW_VAR_KEEP_ALIVE: {
break; u8 array[2];
array[0] = 0xff;
array[1] = *((u8 *)val);
rtl92c_fill_h2c_cmd(hw, H2C_92C_KEEP_ALIVE_CTRL, 2, array);
break; }
default: default:
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
"switch case %d not processed\n", variable); "switch case %d not processed\n", variable);
...@@ -1156,47 +1161,35 @@ static int _rtl92ce_set_media_status(struct ieee80211_hw *hw, ...@@ -1156,47 +1161,35 @@ static int _rtl92ce_set_media_status(struct ieee80211_hw *hw,
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
u8 bt_msr = rtl_read_byte(rtlpriv, MSR); u8 bt_msr = rtl_read_byte(rtlpriv, MSR);
enum led_ctl_mode ledaction = LED_CTL_NO_LINK; enum led_ctl_mode ledaction = LED_CTL_NO_LINK;
bt_msr &= 0xfc; u8 mode = MSR_NOLINK;
if (type == NL80211_IFTYPE_UNSPECIFIED || bt_msr &= 0xfc;
type == NL80211_IFTYPE_STATION) {
_rtl92ce_stop_tx_beacon(hw);
_rtl92ce_enable_bcn_sub_func(hw);
} else if (type == NL80211_IFTYPE_ADHOC || type == NL80211_IFTYPE_AP ||
type == NL80211_IFTYPE_MESH_POINT) {
_rtl92ce_resume_tx_beacon(hw);
_rtl92ce_disable_bcn_sub_func(hw);
} else {
RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
"Set HW_VAR_MEDIA_STATUS: No such media status(%x)\n",
type);
}
switch (type) { switch (type) {
case NL80211_IFTYPE_UNSPECIFIED: case NL80211_IFTYPE_UNSPECIFIED:
bt_msr |= MSR_NOLINK; mode = MSR_NOLINK;
ledaction = LED_CTL_LINK;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"Set Network type to NO LINK!\n"); "Set Network type to NO LINK!\n");
break; break;
case NL80211_IFTYPE_ADHOC: case NL80211_IFTYPE_ADHOC:
bt_msr |= MSR_ADHOC; mode = MSR_ADHOC;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"Set Network type to Ad Hoc!\n"); "Set Network type to Ad Hoc!\n");
break; break;
case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_STATION:
bt_msr |= MSR_INFRA; mode = MSR_INFRA;
ledaction = LED_CTL_LINK; ledaction = LED_CTL_LINK;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"Set Network type to STA!\n"); "Set Network type to STA!\n");
break; break;
case NL80211_IFTYPE_AP: case NL80211_IFTYPE_AP:
bt_msr |= MSR_AP; mode = MSR_AP;
ledaction = LED_CTL_LINK;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"Set Network type to AP!\n"); "Set Network type to AP!\n");
break; break;
case NL80211_IFTYPE_MESH_POINT: case NL80211_IFTYPE_MESH_POINT:
bt_msr |= MSR_ADHOC; mode = MSR_ADHOC;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"Set Network type to Mesh Point!\n"); "Set Network type to Mesh Point!\n");
break; break;
...@@ -1207,9 +1200,32 @@ static int _rtl92ce_set_media_status(struct ieee80211_hw *hw, ...@@ -1207,9 +1200,32 @@ static int _rtl92ce_set_media_status(struct ieee80211_hw *hw,
} }
rtl_write_byte(rtlpriv, (MSR), bt_msr); /* MSR_INFRA == Link in infrastructure network;
* MSR_ADHOC == Link in ad hoc network;
* Therefore, check link state is necessary.
*
* MSR_AP == AP mode; link state does not matter here.
*/
if (mode != MSR_AP &&
rtlpriv->mac80211.link_state < MAC80211_LINKED) {
mode = MSR_NOLINK;
ledaction = LED_CTL_NO_LINK;
}
if (mode == MSR_NOLINK || mode == MSR_INFRA) {
_rtl92ce_stop_tx_beacon(hw);
_rtl92ce_enable_bcn_sub_func(hw);
} else if (mode == MSR_ADHOC || mode == MSR_AP) {
_rtl92ce_resume_tx_beacon(hw);
_rtl92ce_disable_bcn_sub_func(hw);
} else {
RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
"Set HW_VAR_MEDIA_STATUS: No such media status(%x).\n",
mode);
}
rtl_write_byte(rtlpriv, MSR, bt_msr | mode);
rtlpriv->cfg->ops->led_control(hw, ledaction); rtlpriv->cfg->ops->led_control(hw, ledaction);
if ((bt_msr & MSR_MASK) == MSR_AP) if (mode == MSR_AP)
rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x00); rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x00);
else else
rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x66); rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x66);
...@@ -1833,7 +1849,6 @@ static void rtl92ce_update_hal_rate_table(struct ieee80211_hw *hw, ...@@ -1833,7 +1849,6 @@ static void rtl92ce_update_hal_rate_table(struct ieee80211_hw *hw,
u32 ratr_value; u32 ratr_value;
u8 ratr_index = 0; u8 ratr_index = 0;
u8 nmode = mac->ht_enable; u8 nmode = mac->ht_enable;
u8 mimo_ps = IEEE80211_SMPS_OFF;
u16 shortgi_rate; u16 shortgi_rate;
u32 tmp_ratr_value; u32 tmp_ratr_value;
u8 curtxbw_40mhz = mac->bw_40; u8 curtxbw_40mhz = mac->bw_40;
...@@ -1842,6 +1857,7 @@ static void rtl92ce_update_hal_rate_table(struct ieee80211_hw *hw, ...@@ -1842,6 +1857,7 @@ static void rtl92ce_update_hal_rate_table(struct ieee80211_hw *hw,
u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ? u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ?
1 : 0; 1 : 0;
enum wireless_mode wirelessmode = mac->mode; enum wireless_mode wirelessmode = mac->mode;
u32 ratr_mask;
if (rtlhal->current_bandtype == BAND_ON_5G) if (rtlhal->current_bandtype == BAND_ON_5G)
ratr_value = sta->supp_rates[1] << 4; ratr_value = sta->supp_rates[1] << 4;
...@@ -1865,19 +1881,13 @@ static void rtl92ce_update_hal_rate_table(struct ieee80211_hw *hw, ...@@ -1865,19 +1881,13 @@ static void rtl92ce_update_hal_rate_table(struct ieee80211_hw *hw,
case WIRELESS_MODE_N_24G: case WIRELESS_MODE_N_24G:
case WIRELESS_MODE_N_5G: case WIRELESS_MODE_N_5G:
nmode = 1; nmode = 1;
if (mimo_ps == IEEE80211_SMPS_STATIC) { if (get_rf_type(rtlphy) == RF_1T2R ||
ratr_value &= 0x0007F005; get_rf_type(rtlphy) == RF_1T1R)
} else { ratr_mask = 0x000ff005;
u32 ratr_mask; else
ratr_mask = 0x0f0ff005;
if (get_rf_type(rtlphy) == RF_1T2R ||
get_rf_type(rtlphy) == RF_1T1R)
ratr_mask = 0x000ff005;
else
ratr_mask = 0x0f0ff005;
ratr_value &= ratr_mask; ratr_value &= ratr_mask;
}
break; break;
default: default:
if (rtlphy->rf_type == RF_1T2R) if (rtlphy->rf_type == RF_1T2R)
...@@ -1930,17 +1940,16 @@ static void rtl92ce_update_hal_rate_mask(struct ieee80211_hw *hw, ...@@ -1930,17 +1940,16 @@ static void rtl92ce_update_hal_rate_mask(struct ieee80211_hw *hw,
struct rtl_sta_info *sta_entry = NULL; struct rtl_sta_info *sta_entry = NULL;
u32 ratr_bitmap; u32 ratr_bitmap;
u8 ratr_index; u8 ratr_index;
u8 curtxbw_40mhz = (sta->bandwidth >= IEEE80211_STA_RX_BW_40) ? 1 : 0; u8 curtxbw_40mhz = (sta->ht_cap.cap &
u8 curshortgi_40mhz = curtxbw_40mhz && IEEE80211_HT_CAP_SUP_WIDTH_20_40) ? 1 : 0;
(sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ? u8 curshortgi_40mhz = (sta->ht_cap.cap &
1 : 0; IEEE80211_HT_CAP_SGI_40) ? 1 : 0;
u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ? u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ?
1 : 0; 1 : 0;
enum wireless_mode wirelessmode = 0; enum wireless_mode wirelessmode = 0;
bool shortgi = false; bool shortgi = false;
u8 rate_mask[5]; u8 rate_mask[5];
u8 macid = 0; u8 macid = 0;
u8 mimo_ps = IEEE80211_SMPS_OFF;
sta_entry = (struct rtl_sta_info *) sta->drv_priv; sta_entry = (struct rtl_sta_info *) sta->drv_priv;
wirelessmode = sta_entry->wireless_mode; wirelessmode = sta_entry->wireless_mode;
...@@ -1985,47 +1994,38 @@ static void rtl92ce_update_hal_rate_mask(struct ieee80211_hw *hw, ...@@ -1985,47 +1994,38 @@ static void rtl92ce_update_hal_rate_mask(struct ieee80211_hw *hw,
case WIRELESS_MODE_N_5G: case WIRELESS_MODE_N_5G:
ratr_index = RATR_INX_WIRELESS_NGB; ratr_index = RATR_INX_WIRELESS_NGB;
if (mimo_ps == IEEE80211_SMPS_STATIC) { if (rtlphy->rf_type == RF_1T2R ||
if (rssi_level == 1) rtlphy->rf_type == RF_1T1R) {
ratr_bitmap &= 0x00070000; if (curtxbw_40mhz) {
else if (rssi_level == 2) if (rssi_level == 1)
ratr_bitmap &= 0x0007f000; ratr_bitmap &= 0x000f0000;
else else if (rssi_level == 2)
ratr_bitmap &= 0x0007f005; ratr_bitmap &= 0x000ff000;
else
ratr_bitmap &= 0x000ff015;
} else {
if (rssi_level == 1)
ratr_bitmap &= 0x000f0000;
else if (rssi_level == 2)
ratr_bitmap &= 0x000ff000;
else
ratr_bitmap &= 0x000ff005;
}
} else { } else {
if (rtlphy->rf_type == RF_1T2R || if (curtxbw_40mhz) {
rtlphy->rf_type == RF_1T1R) { if (rssi_level == 1)
if (curtxbw_40mhz) { ratr_bitmap &= 0x0f0f0000;
if (rssi_level == 1) else if (rssi_level == 2)
ratr_bitmap &= 0x000f0000; ratr_bitmap &= 0x0f0ff000;
else if (rssi_level == 2) else
ratr_bitmap &= 0x000ff000; ratr_bitmap &= 0x0f0ff015;
else
ratr_bitmap &= 0x000ff015;
} else {
if (rssi_level == 1)
ratr_bitmap &= 0x000f0000;
else if (rssi_level == 2)
ratr_bitmap &= 0x000ff000;
else
ratr_bitmap &= 0x000ff005;
}
} else { } else {
if (curtxbw_40mhz) { if (rssi_level == 1)
if (rssi_level == 1) ratr_bitmap &= 0x0f0f0000;
ratr_bitmap &= 0x0f0f0000; else if (rssi_level == 2)
else if (rssi_level == 2) ratr_bitmap &= 0x0f0ff000;
ratr_bitmap &= 0x0f0ff000; else
else ratr_bitmap &= 0x0f0ff005;
ratr_bitmap &= 0x0f0ff015;
} else {
if (rssi_level == 1)
ratr_bitmap &= 0x0f0f0000;
else if (rssi_level == 2)
ratr_bitmap &= 0x0f0ff000;
else
ratr_bitmap &= 0x0f0ff005;
}
} }
} }
...@@ -2058,9 +2058,6 @@ static void rtl92ce_update_hal_rate_mask(struct ieee80211_hw *hw, ...@@ -2058,9 +2058,6 @@ static void rtl92ce_update_hal_rate_mask(struct ieee80211_hw *hw,
"Rate_index:%x, ratr_val:%x, %5phC\n", "Rate_index:%x, ratr_val:%x, %5phC\n",
ratr_index, ratr_bitmap, rate_mask); ratr_index, ratr_bitmap, rate_mask);
rtl92c_fill_h2c_cmd(hw, H2C_RA_MASK, 5, rate_mask); rtl92c_fill_h2c_cmd(hw, H2C_RA_MASK, 5, rate_mask);
if (macid != 0)
sta_entry->ratr_index = ratr_index;
} }
void rtl92ce_update_hal_rate_tbl(struct ieee80211_hw *hw, void rtl92ce_update_hal_rate_tbl(struct ieee80211_hw *hw,
......
...@@ -518,11 +518,12 @@ static bool _rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw, ...@@ -518,11 +518,12 @@ static bool _rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw,
} }
case ERFSLEEP:{ case ERFSLEEP:{
if (ppsc->rfpwr_state == ERFOFF) if (ppsc->rfpwr_state == ERFOFF)
return false; break;
for (queue_id = 0, i = 0; for (queue_id = 0, i = 0;
queue_id < RTL_PCI_MAX_TX_QUEUE_COUNT;) { queue_id < RTL_PCI_MAX_TX_QUEUE_COUNT;) {
ring = &pcipriv->dev.tx_ring[queue_id]; ring = &pcipriv->dev.tx_ring[queue_id];
if (skb_queue_len(&ring->queue) == 0) { if (queue_id == BEACON_QUEUE ||
skb_queue_len(&ring->queue) == 0) {
queue_id++; queue_id++;
continue; continue;
} else { } else {
......
...@@ -334,21 +334,21 @@ static struct rtl_hal_cfg rtl92ce_hal_cfg = { ...@@ -334,21 +334,21 @@ static struct rtl_hal_cfg rtl92ce_hal_cfg = {
.maps[RTL_IMR_ROK] = IMR_ROK, .maps[RTL_IMR_ROK] = IMR_ROK,
.maps[RTL_IBSS_INT_MASKS] = (IMR_BCNINT | IMR_TBDOK | IMR_TBDER), .maps[RTL_IBSS_INT_MASKS] = (IMR_BCNINT | IMR_TBDOK | IMR_TBDER),
.maps[RTL_RC_CCK_RATE1M] = DESC92_RATE1M, .maps[RTL_RC_CCK_RATE1M] = DESC_RATE1M,
.maps[RTL_RC_CCK_RATE2M] = DESC92_RATE2M, .maps[RTL_RC_CCK_RATE2M] = DESC_RATE2M,
.maps[RTL_RC_CCK_RATE5_5M] = DESC92_RATE5_5M, .maps[RTL_RC_CCK_RATE5_5M] = DESC_RATE5_5M,
.maps[RTL_RC_CCK_RATE11M] = DESC92_RATE11M, .maps[RTL_RC_CCK_RATE11M] = DESC_RATE11M,
.maps[RTL_RC_OFDM_RATE6M] = DESC92_RATE6M, .maps[RTL_RC_OFDM_RATE6M] = DESC_RATE6M,
.maps[RTL_RC_OFDM_RATE9M] = DESC92_RATE9M, .maps[RTL_RC_OFDM_RATE9M] = DESC_RATE9M,
.maps[RTL_RC_OFDM_RATE12M] = DESC92_RATE12M, .maps[RTL_RC_OFDM_RATE12M] = DESC_RATE12M,
.maps[RTL_RC_OFDM_RATE18M] = DESC92_RATE18M, .maps[RTL_RC_OFDM_RATE18M] = DESC_RATE18M,
.maps[RTL_RC_OFDM_RATE24M] = DESC92_RATE24M, .maps[RTL_RC_OFDM_RATE24M] = DESC_RATE24M,
.maps[RTL_RC_OFDM_RATE36M] = DESC92_RATE36M, .maps[RTL_RC_OFDM_RATE36M] = DESC_RATE36M,
.maps[RTL_RC_OFDM_RATE48M] = DESC92_RATE48M, .maps[RTL_RC_OFDM_RATE48M] = DESC_RATE48M,
.maps[RTL_RC_OFDM_RATE54M] = DESC92_RATE54M, .maps[RTL_RC_OFDM_RATE54M] = DESC_RATE54M,
.maps[RTL_RC_HT_RATEMCS7] = DESC92_RATEMCS7, .maps[RTL_RC_HT_RATEMCS7] = DESC_RATEMCS7,
.maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15, .maps[RTL_RC_HT_RATEMCS15] = DESC_RATEMCS15,
}; };
static const struct pci_device_id rtl92ce_pci_ids[] = { static const struct pci_device_id rtl92ce_pci_ids[] = {
......
...@@ -257,8 +257,8 @@ static void _rtl92ce_query_rxphystatus(struct ieee80211_hw *hw, ...@@ -257,8 +257,8 @@ static void _rtl92ce_query_rxphystatus(struct ieee80211_hw *hw,
pstats->recvsignalpower = rx_pwr_all; pstats->recvsignalpower = rx_pwr_all;
/* (3)EVM of HT rate */ /* (3)EVM of HT rate */
if (pstats->is_ht && pstats->rate >= DESC92_RATEMCS8 && if (pstats->is_ht && pstats->rate >= DESC_RATEMCS8 &&
pstats->rate <= DESC92_RATEMCS15) pstats->rate <= DESC_RATEMCS15)
max_spatial_stream = 2; max_spatial_stream = 2;
else else
max_spatial_stream = 1; max_spatial_stream = 1;
...@@ -400,9 +400,8 @@ bool rtl92ce_rx_query_desc(struct ieee80211_hw *hw, ...@@ -400,9 +400,8 @@ bool rtl92ce_rx_query_desc(struct ieee80211_hw *hw,
* are use (RX_FLAG_HT) * are use (RX_FLAG_HT)
* Notice: this is diff with windows define * Notice: this is diff with windows define
*/ */
rx_status->rate_idx = rtlwifi_rate_mapping(hw, rx_status->rate_idx = rtlwifi_rate_mapping(hw, stats->is_ht,
stats->is_ht, stats->rate, false, stats->rate);
stats->isfirst_ampdu);
rx_status->mactime = stats->timestamp_low; rx_status->mactime = stats->timestamp_low;
if (phystatus) { if (phystatus) {
...@@ -501,7 +500,7 @@ void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw, ...@@ -501,7 +500,7 @@ void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw,
SET_TX_DESC_RTS_BW(pdesc, 0); SET_TX_DESC_RTS_BW(pdesc, 0);
SET_TX_DESC_RTS_SC(pdesc, tcb_desc->rts_sc); SET_TX_DESC_RTS_SC(pdesc, tcb_desc->rts_sc);
SET_TX_DESC_RTS_SHORT(pdesc, SET_TX_DESC_RTS_SHORT(pdesc,
((tcb_desc->rts_rate <= DESC92_RATE54M) ? ((tcb_desc->rts_rate <= DESC_RATE54M) ?
(tcb_desc->rts_use_shortpreamble ? 1 : 0) (tcb_desc->rts_use_shortpreamble ? 1 : 0)
: (tcb_desc->rts_use_shortgi ? 1 : 0))); : (tcb_desc->rts_use_shortgi ? 1 : 0)));
...@@ -624,7 +623,7 @@ void rtl92ce_tx_fill_cmddesc(struct ieee80211_hw *hw, ...@@ -624,7 +623,7 @@ void rtl92ce_tx_fill_cmddesc(struct ieee80211_hw *hw,
if (firstseg) if (firstseg)
SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN); SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN);
SET_TX_DESC_TX_RATE(pdesc, DESC92_RATE1M); SET_TX_DESC_TX_RATE(pdesc, DESC_RATE1M);
SET_TX_DESC_SEQ(pdesc, 0); SET_TX_DESC_SEQ(pdesc, 0);
......
...@@ -880,8 +880,8 @@ static void _rtl92c_query_rxphystatus(struct ieee80211_hw *hw, ...@@ -880,8 +880,8 @@ static void _rtl92c_query_rxphystatus(struct ieee80211_hw *hw,
pstats->rxpower = rx_pwr_all; pstats->rxpower = rx_pwr_all;
pstats->recvsignalpower = rx_pwr_all; pstats->recvsignalpower = rx_pwr_all;
if (GET_RX_DESC_RX_MCS(pdesc) && if (GET_RX_DESC_RX_MCS(pdesc) &&
GET_RX_DESC_RX_MCS(pdesc) >= DESC92_RATEMCS8 && GET_RX_DESC_RX_MCS(pdesc) >= DESC_RATEMCS8 &&
GET_RX_DESC_RX_MCS(pdesc) <= DESC92_RATEMCS15) GET_RX_DESC_RX_MCS(pdesc) <= DESC_RATEMCS15)
max_spatial_stream = 2; max_spatial_stream = 2;
else else
max_spatial_stream = 1; max_spatial_stream = 1;
......
...@@ -257,20 +257,20 @@ static struct rtl_hal_cfg rtl92cu_hal_cfg = { ...@@ -257,20 +257,20 @@ static struct rtl_hal_cfg rtl92cu_hal_cfg = {
.maps[RTL_IMR_ROK] = IMR_ROK, .maps[RTL_IMR_ROK] = IMR_ROK,
.maps[RTL_IBSS_INT_MASKS] = (IMR_BCNINT | IMR_TBDOK | IMR_TBDER), .maps[RTL_IBSS_INT_MASKS] = (IMR_BCNINT | IMR_TBDOK | IMR_TBDER),
.maps[RTL_RC_CCK_RATE1M] = DESC92_RATE1M, .maps[RTL_RC_CCK_RATE1M] = DESC_RATE1M,
.maps[RTL_RC_CCK_RATE2M] = DESC92_RATE2M, .maps[RTL_RC_CCK_RATE2M] = DESC_RATE2M,
.maps[RTL_RC_CCK_RATE5_5M] = DESC92_RATE5_5M, .maps[RTL_RC_CCK_RATE5_5M] = DESC_RATE5_5M,
.maps[RTL_RC_CCK_RATE11M] = DESC92_RATE11M, .maps[RTL_RC_CCK_RATE11M] = DESC_RATE11M,
.maps[RTL_RC_OFDM_RATE6M] = DESC92_RATE6M, .maps[RTL_RC_OFDM_RATE6M] = DESC_RATE6M,
.maps[RTL_RC_OFDM_RATE9M] = DESC92_RATE9M, .maps[RTL_RC_OFDM_RATE9M] = DESC_RATE9M,
.maps[RTL_RC_OFDM_RATE12M] = DESC92_RATE12M, .maps[RTL_RC_OFDM_RATE12M] = DESC_RATE12M,
.maps[RTL_RC_OFDM_RATE18M] = DESC92_RATE18M, .maps[RTL_RC_OFDM_RATE18M] = DESC_RATE18M,
.maps[RTL_RC_OFDM_RATE24M] = DESC92_RATE24M, .maps[RTL_RC_OFDM_RATE24M] = DESC_RATE24M,
.maps[RTL_RC_OFDM_RATE36M] = DESC92_RATE36M, .maps[RTL_RC_OFDM_RATE36M] = DESC_RATE36M,
.maps[RTL_RC_OFDM_RATE48M] = DESC92_RATE48M, .maps[RTL_RC_OFDM_RATE48M] = DESC_RATE48M,
.maps[RTL_RC_OFDM_RATE54M] = DESC92_RATE54M, .maps[RTL_RC_OFDM_RATE54M] = DESC_RATE54M,
.maps[RTL_RC_HT_RATEMCS7] = DESC92_RATEMCS7, .maps[RTL_RC_HT_RATEMCS7] = DESC_RATEMCS7,
.maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15, .maps[RTL_RC_HT_RATEMCS15] = DESC_RATEMCS15,
}; };
#define USB_VENDER_ID_REALTEK 0x0bda #define USB_VENDER_ID_REALTEK 0x0bda
......
...@@ -325,6 +325,7 @@ bool rtl92cu_rx_query_desc(struct ieee80211_hw *hw, ...@@ -325,6 +325,7 @@ bool rtl92cu_rx_query_desc(struct ieee80211_hw *hw,
&& (GET_RX_DESC_FAGGR(pdesc) == 1)); && (GET_RX_DESC_FAGGR(pdesc) == 1));
stats->timestamp_low = GET_RX_DESC_TSFL(pdesc); stats->timestamp_low = GET_RX_DESC_TSFL(pdesc);
stats->rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(pdesc); stats->rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(pdesc);
stats->is_ht = (bool)GET_RX_DESC_RX_HT(pdesc);
rx_status->freq = hw->conf.chandef.chan->center_freq; rx_status->freq = hw->conf.chandef.chan->center_freq;
rx_status->band = hw->conf.chandef.chan->band; rx_status->band = hw->conf.chandef.chan->band;
if (GET_RX_DESC_CRC32(pdesc)) if (GET_RX_DESC_CRC32(pdesc))
...@@ -338,10 +339,8 @@ bool rtl92cu_rx_query_desc(struct ieee80211_hw *hw, ...@@ -338,10 +339,8 @@ bool rtl92cu_rx_query_desc(struct ieee80211_hw *hw,
rx_status->flag |= RX_FLAG_MACTIME_START; rx_status->flag |= RX_FLAG_MACTIME_START;
if (stats->decrypted) if (stats->decrypted)
rx_status->flag |= RX_FLAG_DECRYPTED; rx_status->flag |= RX_FLAG_DECRYPTED;
rx_status->rate_idx = rtlwifi_rate_mapping(hw, rx_status->rate_idx = rtlwifi_rate_mapping(hw, stats->is_ht,
(bool)GET_RX_DESC_RX_HT(pdesc), false, stats->rate);
(u8)GET_RX_DESC_RX_MCS(pdesc),
(bool)GET_RX_DESC_PAGGR(pdesc));
rx_status->mactime = GET_RX_DESC_TSFL(pdesc); rx_status->mactime = GET_RX_DESC_TSFL(pdesc);
if (phystatus) { if (phystatus) {
p_drvinfo = (struct rx_fwinfo_92c *)(skb->data + p_drvinfo = (struct rx_fwinfo_92c *)(skb->data +
...@@ -393,6 +392,7 @@ static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb) ...@@ -393,6 +392,7 @@ static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb)
&& (GET_RX_DESC_FAGGR(rxdesc) == 1)); && (GET_RX_DESC_FAGGR(rxdesc) == 1));
stats.timestamp_low = GET_RX_DESC_TSFL(rxdesc); stats.timestamp_low = GET_RX_DESC_TSFL(rxdesc);
stats.rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(rxdesc); stats.rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(rxdesc);
stats.is_ht = (bool)GET_RX_DESC_RX_HT(rxdesc);
/* TODO: is center_freq changed when doing scan? */ /* TODO: is center_freq changed when doing scan? */
/* TODO: Shall we add protection or just skip those two step? */ /* TODO: Shall we add protection or just skip those two step? */
rx_status->freq = hw->conf.chandef.chan->center_freq; rx_status->freq = hw->conf.chandef.chan->center_freq;
...@@ -406,10 +406,8 @@ static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb) ...@@ -406,10 +406,8 @@ static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb)
if (GET_RX_DESC_RX_HT(rxdesc)) if (GET_RX_DESC_RX_HT(rxdesc))
rx_status->flag |= RX_FLAG_HT; rx_status->flag |= RX_FLAG_HT;
/* Data rate */ /* Data rate */
rx_status->rate_idx = rtlwifi_rate_mapping(hw, rx_status->rate_idx = rtlwifi_rate_mapping(hw, stats.is_ht,
(bool)GET_RX_DESC_RX_HT(rxdesc), false, stats.rate);
(u8)GET_RX_DESC_RX_MCS(rxdesc),
(bool)GET_RX_DESC_PAGGR(rxdesc));
/* There is a phy status after this rx descriptor. */ /* There is a phy status after this rx descriptor. */
if (GET_RX_DESC_PHY_STATUS(rxdesc)) { if (GET_RX_DESC_PHY_STATUS(rxdesc)) {
p_drvinfo = (struct rx_fwinfo_92c *)(rxdesc + RTL_RX_DESC_SIZE); p_drvinfo = (struct rx_fwinfo_92c *)(rxdesc + RTL_RX_DESC_SIZE);
...@@ -545,7 +543,7 @@ void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw, ...@@ -545,7 +543,7 @@ void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw,
SET_TX_DESC_RTS_BW(txdesc, 0); SET_TX_DESC_RTS_BW(txdesc, 0);
SET_TX_DESC_RTS_SC(txdesc, tcb_desc->rts_sc); SET_TX_DESC_RTS_SC(txdesc, tcb_desc->rts_sc);
SET_TX_DESC_RTS_SHORT(txdesc, SET_TX_DESC_RTS_SHORT(txdesc,
((tcb_desc->rts_rate <= DESC92_RATE54M) ? ((tcb_desc->rts_rate <= DESC_RATE54M) ?
(tcb_desc->rts_use_shortpreamble ? 1 : 0) (tcb_desc->rts_use_shortpreamble ? 1 : 0)
: (tcb_desc->rts_use_shortgi ? 1 : 0))); : (tcb_desc->rts_use_shortgi ? 1 : 0)));
if (mac->bw_40) { if (mac->bw_40) {
...@@ -644,7 +642,7 @@ void rtl92cu_fill_fake_txdesc(struct ieee80211_hw *hw, u8 * pDesc, ...@@ -644,7 +642,7 @@ void rtl92cu_fill_fake_txdesc(struct ieee80211_hw *hw, u8 * pDesc,
} }
SET_TX_DESC_USE_RATE(pDesc, 1); /* use data rate which is set by Sw */ SET_TX_DESC_USE_RATE(pDesc, 1); /* use data rate which is set by Sw */
SET_TX_DESC_OWN(pDesc, 1); SET_TX_DESC_OWN(pDesc, 1);
SET_TX_DESC_TX_RATE(pDesc, DESC92_RATE1M); SET_TX_DESC_TX_RATE(pDesc, DESC_RATE1M);
_rtl_tx_desc_checksum(pDesc); _rtl_tx_desc_checksum(pDesc);
} }
...@@ -660,7 +658,7 @@ void rtl92cu_tx_fill_cmddesc(struct ieee80211_hw *hw, ...@@ -660,7 +658,7 @@ void rtl92cu_tx_fill_cmddesc(struct ieee80211_hw *hw,
memset((void *)pdesc, 0, RTL_TX_HEADER_SIZE); memset((void *)pdesc, 0, RTL_TX_HEADER_SIZE);
if (firstseg) if (firstseg)
SET_TX_DESC_OFFSET(pdesc, RTL_TX_HEADER_SIZE); SET_TX_DESC_OFFSET(pdesc, RTL_TX_HEADER_SIZE);
SET_TX_DESC_TX_RATE(pdesc, DESC92_RATE1M); SET_TX_DESC_TX_RATE(pdesc, DESC_RATE1M);
SET_TX_DESC_SEQ(pdesc, 0); SET_TX_DESC_SEQ(pdesc, 0);
SET_TX_DESC_LINIP(pdesc, 0); SET_TX_DESC_LINIP(pdesc, 0);
SET_TX_DESC_QUEUE_SEL(pdesc, fw_queue); SET_TX_DESC_QUEUE_SEL(pdesc, fw_queue);
......
...@@ -540,23 +540,6 @@ void rtl92d_fill_h2c_cmd(struct ieee80211_hw *hw, ...@@ -540,23 +540,6 @@ void rtl92d_fill_h2c_cmd(struct ieee80211_hw *hw,
return; return;
} }
void rtl92d_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
u8 u1_h2c_set_pwrmode[3] = { 0 };
struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, "FW LPS mode = %d\n", mode);
SET_H2CCMD_PWRMODE_PARM_MODE(u1_h2c_set_pwrmode, mode);
SET_H2CCMD_PWRMODE_PARM_SMART_PS(u1_h2c_set_pwrmode, 1);
SET_H2CCMD_PWRMODE_PARM_BCN_PASS_TIME(u1_h2c_set_pwrmode,
ppsc->reg_max_lps_awakeintvl);
RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
"rtl92d_set_fw_rsvdpagepkt(): u1_h2c_set_pwrmode",
u1_h2c_set_pwrmode, 3);
rtl92d_fill_h2c_cmd(hw, H2C_SETPWRMODE, 3, u1_h2c_set_pwrmode);
}
static bool _rtl92d_cmd_send_packet(struct ieee80211_hw *hw, static bool _rtl92d_cmd_send_packet(struct ieee80211_hw *hw,
struct sk_buff *skb) struct sk_buff *skb)
{ {
......
...@@ -136,7 +136,6 @@ int rtl92d_download_fw(struct ieee80211_hw *hw); ...@@ -136,7 +136,6 @@ int rtl92d_download_fw(struct ieee80211_hw *hw);
void rtl92d_fill_h2c_cmd(struct ieee80211_hw *hw, u8 element_id, void rtl92d_fill_h2c_cmd(struct ieee80211_hw *hw, u8 element_id,
u32 cmd_len, u8 *p_cmdbuffer); u32 cmd_len, u8 *p_cmdbuffer);
void rtl92d_firmware_selfreset(struct ieee80211_hw *hw); void rtl92d_firmware_selfreset(struct ieee80211_hw *hw);
void rtl92d_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode);
void rtl92d_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished); void rtl92d_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished);
void rtl92d_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus); void rtl92d_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus);
......
...@@ -337,21 +337,21 @@ static struct rtl_hal_cfg rtl92de_hal_cfg = { ...@@ -337,21 +337,21 @@ static struct rtl_hal_cfg rtl92de_hal_cfg = {
.maps[RTL_IMR_ROK] = IMR_ROK, .maps[RTL_IMR_ROK] = IMR_ROK,
.maps[RTL_IBSS_INT_MASKS] = (IMR_BCNINT | IMR_TBDOK | IMR_TBDER), .maps[RTL_IBSS_INT_MASKS] = (IMR_BCNINT | IMR_TBDOK | IMR_TBDER),
.maps[RTL_RC_CCK_RATE1M] = DESC92_RATE1M, .maps[RTL_RC_CCK_RATE1M] = DESC_RATE1M,
.maps[RTL_RC_CCK_RATE2M] = DESC92_RATE2M, .maps[RTL_RC_CCK_RATE2M] = DESC_RATE2M,
.maps[RTL_RC_CCK_RATE5_5M] = DESC92_RATE5_5M, .maps[RTL_RC_CCK_RATE5_5M] = DESC_RATE5_5M,
.maps[RTL_RC_CCK_RATE11M] = DESC92_RATE11M, .maps[RTL_RC_CCK_RATE11M] = DESC_RATE11M,
.maps[RTL_RC_OFDM_RATE6M] = DESC92_RATE6M, .maps[RTL_RC_OFDM_RATE6M] = DESC_RATE6M,
.maps[RTL_RC_OFDM_RATE9M] = DESC92_RATE9M, .maps[RTL_RC_OFDM_RATE9M] = DESC_RATE9M,
.maps[RTL_RC_OFDM_RATE12M] = DESC92_RATE12M, .maps[RTL_RC_OFDM_RATE12M] = DESC_RATE12M,
.maps[RTL_RC_OFDM_RATE18M] = DESC92_RATE18M, .maps[RTL_RC_OFDM_RATE18M] = DESC_RATE18M,
.maps[RTL_RC_OFDM_RATE24M] = DESC92_RATE24M, .maps[RTL_RC_OFDM_RATE24M] = DESC_RATE24M,
.maps[RTL_RC_OFDM_RATE36M] = DESC92_RATE36M, .maps[RTL_RC_OFDM_RATE36M] = DESC_RATE36M,
.maps[RTL_RC_OFDM_RATE48M] = DESC92_RATE48M, .maps[RTL_RC_OFDM_RATE48M] = DESC_RATE48M,
.maps[RTL_RC_OFDM_RATE54M] = DESC92_RATE54M, .maps[RTL_RC_OFDM_RATE54M] = DESC_RATE54M,
.maps[RTL_RC_HT_RATEMCS7] = DESC92_RATEMCS7, .maps[RTL_RC_HT_RATEMCS7] = DESC_RATEMCS7,
.maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15, .maps[RTL_RC_HT_RATEMCS15] = DESC_RATEMCS15,
}; };
static struct pci_device_id rtl92de_pci_ids[] = { static struct pci_device_id rtl92de_pci_ids[] = {
......
...@@ -235,8 +235,8 @@ static void _rtl92de_query_rxphystatus(struct ieee80211_hw *hw, ...@@ -235,8 +235,8 @@ static void _rtl92de_query_rxphystatus(struct ieee80211_hw *hw,
pstats->rx_pwdb_all = pwdb_all; pstats->rx_pwdb_all = pwdb_all;
pstats->rxpower = rx_pwr_all; pstats->rxpower = rx_pwr_all;
pstats->recvsignalpower = rx_pwr_all; pstats->recvsignalpower = rx_pwr_all;
if (pdesc->rxht && pdesc->rxmcs >= DESC92_RATEMCS8 && if (pdesc->rxht && pdesc->rxmcs >= DESC_RATEMCS8 &&
pdesc->rxmcs <= DESC92_RATEMCS15) pdesc->rxmcs <= DESC_RATEMCS15)
max_spatial_stream = 2; max_spatial_stream = 2;
else else
max_spatial_stream = 1; max_spatial_stream = 1;
...@@ -499,6 +499,7 @@ bool rtl92de_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats, ...@@ -499,6 +499,7 @@ bool rtl92de_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats,
&& (GET_RX_DESC_FAGGR(pdesc) == 1)); && (GET_RX_DESC_FAGGR(pdesc) == 1));
stats->timestamp_low = GET_RX_DESC_TSFL(pdesc); stats->timestamp_low = GET_RX_DESC_TSFL(pdesc);
stats->rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(pdesc); stats->rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(pdesc);
stats->is_ht = (bool)GET_RX_DESC_RXHT(pdesc);
rx_status->freq = hw->conf.chandef.chan->center_freq; rx_status->freq = hw->conf.chandef.chan->center_freq;
rx_status->band = hw->conf.chandef.chan->band; rx_status->band = hw->conf.chandef.chan->band;
if (GET_RX_DESC_CRC32(pdesc)) if (GET_RX_DESC_CRC32(pdesc))
...@@ -512,10 +513,8 @@ bool rtl92de_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats, ...@@ -512,10 +513,8 @@ bool rtl92de_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats,
rx_status->flag |= RX_FLAG_MACTIME_START; rx_status->flag |= RX_FLAG_MACTIME_START;
if (stats->decrypted) if (stats->decrypted)
rx_status->flag |= RX_FLAG_DECRYPTED; rx_status->flag |= RX_FLAG_DECRYPTED;
rx_status->rate_idx = rtlwifi_rate_mapping(hw, rx_status->rate_idx = rtlwifi_rate_mapping(hw, stats->is_ht,
(bool)GET_RX_DESC_RXHT(pdesc), false, stats->rate);
(u8)GET_RX_DESC_RXMCS(pdesc),
(bool)GET_RX_DESC_PAGGR(pdesc));
rx_status->mactime = GET_RX_DESC_TSFL(pdesc); rx_status->mactime = GET_RX_DESC_TSFL(pdesc);
if (phystatus) { if (phystatus) {
p_drvinfo = (struct rx_fwinfo_92d *)(skb->data + p_drvinfo = (struct rx_fwinfo_92d *)(skb->data +
...@@ -612,14 +611,14 @@ void rtl92de_tx_fill_desc(struct ieee80211_hw *hw, ...@@ -612,14 +611,14 @@ void rtl92de_tx_fill_desc(struct ieee80211_hw *hw,
} }
/* 5G have no CCK rate */ /* 5G have no CCK rate */
if (rtlhal->current_bandtype == BAND_ON_5G) if (rtlhal->current_bandtype == BAND_ON_5G)
if (ptcb_desc->hw_rate < DESC92_RATE6M) if (ptcb_desc->hw_rate < DESC_RATE6M)
ptcb_desc->hw_rate = DESC92_RATE6M; ptcb_desc->hw_rate = DESC_RATE6M;
SET_TX_DESC_TX_RATE(pdesc, ptcb_desc->hw_rate); SET_TX_DESC_TX_RATE(pdesc, ptcb_desc->hw_rate);
if (ptcb_desc->use_shortgi || ptcb_desc->use_shortpreamble) if (ptcb_desc->use_shortgi || ptcb_desc->use_shortpreamble)
SET_TX_DESC_DATA_SHORTGI(pdesc, 1); SET_TX_DESC_DATA_SHORTGI(pdesc, 1);
if (rtlhal->macphymode == DUALMAC_DUALPHY && if (rtlhal->macphymode == DUALMAC_DUALPHY &&
ptcb_desc->hw_rate == DESC92_RATEMCS7) ptcb_desc->hw_rate == DESC_RATEMCS7)
SET_TX_DESC_DATA_SHORTGI(pdesc, 1); SET_TX_DESC_DATA_SHORTGI(pdesc, 1);
if (info->flags & IEEE80211_TX_CTL_AMPDU) { if (info->flags & IEEE80211_TX_CTL_AMPDU) {
...@@ -635,13 +634,13 @@ void rtl92de_tx_fill_desc(struct ieee80211_hw *hw, ...@@ -635,13 +634,13 @@ void rtl92de_tx_fill_desc(struct ieee80211_hw *hw,
SET_TX_DESC_RTS_STBC(pdesc, ((ptcb_desc->rts_stbc) ? 1 : 0)); SET_TX_DESC_RTS_STBC(pdesc, ((ptcb_desc->rts_stbc) ? 1 : 0));
/* 5G have no CCK rate */ /* 5G have no CCK rate */
if (rtlhal->current_bandtype == BAND_ON_5G) if (rtlhal->current_bandtype == BAND_ON_5G)
if (ptcb_desc->rts_rate < DESC92_RATE6M) if (ptcb_desc->rts_rate < DESC_RATE6M)
ptcb_desc->rts_rate = DESC92_RATE6M; ptcb_desc->rts_rate = DESC_RATE6M;
SET_TX_DESC_RTS_RATE(pdesc, ptcb_desc->rts_rate); SET_TX_DESC_RTS_RATE(pdesc, ptcb_desc->rts_rate);
SET_TX_DESC_RTS_BW(pdesc, 0); SET_TX_DESC_RTS_BW(pdesc, 0);
SET_TX_DESC_RTS_SC(pdesc, ptcb_desc->rts_sc); SET_TX_DESC_RTS_SC(pdesc, ptcb_desc->rts_sc);
SET_TX_DESC_RTS_SHORT(pdesc, ((ptcb_desc->rts_rate <= SET_TX_DESC_RTS_SHORT(pdesc, ((ptcb_desc->rts_rate <=
DESC92_RATE54M) ? DESC_RATE54M) ?
(ptcb_desc->rts_use_shortpreamble ? 1 : 0) : (ptcb_desc->rts_use_shortpreamble ? 1 : 0) :
(ptcb_desc->rts_use_shortgi ? 1 : 0))); (ptcb_desc->rts_use_shortgi ? 1 : 0)));
if (bw_40) { if (bw_40) {
...@@ -756,9 +755,9 @@ void rtl92de_tx_fill_cmddesc(struct ieee80211_hw *hw, ...@@ -756,9 +755,9 @@ void rtl92de_tx_fill_cmddesc(struct ieee80211_hw *hw,
* The braces are needed no matter what checkpatch says * The braces are needed no matter what checkpatch says
*/ */
if (rtlhal->current_bandtype == BAND_ON_5G) { if (rtlhal->current_bandtype == BAND_ON_5G) {
SET_TX_DESC_TX_RATE(pdesc, DESC92_RATE6M); SET_TX_DESC_TX_RATE(pdesc, DESC_RATE6M);
} else { } else {
SET_TX_DESC_TX_RATE(pdesc, DESC92_RATE1M); SET_TX_DESC_TX_RATE(pdesc, DESC_RATE1M);
} }
SET_TX_DESC_SEQ(pdesc, 0); SET_TX_DESC_SEQ(pdesc, 0);
SET_TX_DESC_LINIP(pdesc, 0); SET_TX_DESC_LINIP(pdesc, 0);
......
...@@ -47,164 +47,6 @@ static u8 _rtl92ee_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue) ...@@ -47,164 +47,6 @@ static u8 _rtl92ee_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue)
return skb->priority; return skb->priority;
} }
/* mac80211's rate_idx is like this:
*
* 2.4G band:rx_status->band == IEEE80211_BAND_2GHZ
*
* B/G rate:
* (rx_status->flag & RX_FLAG_HT) = 0,
* DESC92C_RATE1M-->DESC92C_RATE54M ==> idx is 0-->11,
*
* N rate:
* (rx_status->flag & RX_FLAG_HT) = 1,
* DESC92C_RATEMCS0-->DESC92C_RATEMCS15 ==> idx is 0-->15
*
* 5G band:rx_status->band == IEEE80211_BAND_5GHZ
* A rate:
* (rx_status->flag & RX_FLAG_HT) = 0,
* DESC92C_RATE6M-->DESC92C_RATE54M ==> idx is 0-->7,
*
* N rate:
* (rx_status->flag & RX_FLAG_HT) = 1,
* DESC92C_RATEMCS0-->DESC92C_RATEMCS15 ==> idx is 0-->15
*/
static int _rtl92ee_rate_mapping(struct ieee80211_hw *hw,
bool isht, u8 desc_rate)
{
int rate_idx;
if (!isht) {
if (IEEE80211_BAND_2GHZ == hw->conf.chandef.chan->band) {
switch (desc_rate) {
case DESC92C_RATE1M:
rate_idx = 0;
break;
case DESC92C_RATE2M:
rate_idx = 1;
break;
case DESC92C_RATE5_5M:
rate_idx = 2;
break;
case DESC92C_RATE11M:
rate_idx = 3;
break;
case DESC92C_RATE6M:
rate_idx = 4;
break;
case DESC92C_RATE9M:
rate_idx = 5;
break;
case DESC92C_RATE12M:
rate_idx = 6;
break;
case DESC92C_RATE18M:
rate_idx = 7;
break;
case DESC92C_RATE24M:
rate_idx = 8;
break;
case DESC92C_RATE36M:
rate_idx = 9;
break;
case DESC92C_RATE48M:
rate_idx = 10;
break;
case DESC92C_RATE54M:
rate_idx = 11;
break;
default:
rate_idx = 0;
break;
}
} else {
switch (desc_rate) {
case DESC92C_RATE6M:
rate_idx = 0;
break;
case DESC92C_RATE9M:
rate_idx = 1;
break;
case DESC92C_RATE12M:
rate_idx = 2;
break;
case DESC92C_RATE18M:
rate_idx = 3;
break;
case DESC92C_RATE24M:
rate_idx = 4;
break;
case DESC92C_RATE36M:
rate_idx = 5;
break;
case DESC92C_RATE48M:
rate_idx = 6;
break;
case DESC92C_RATE54M:
rate_idx = 7;
break;
default:
rate_idx = 0;
break;
}
}
} else {
switch (desc_rate) {
case DESC92C_RATEMCS0:
rate_idx = 0;
break;
case DESC92C_RATEMCS1:
rate_idx = 1;
break;
case DESC92C_RATEMCS2:
rate_idx = 2;
break;
case DESC92C_RATEMCS3:
rate_idx = 3;
break;
case DESC92C_RATEMCS4:
rate_idx = 4;
break;
case DESC92C_RATEMCS5:
rate_idx = 5;
break;
case DESC92C_RATEMCS6:
rate_idx = 6;
break;
case DESC92C_RATEMCS7:
rate_idx = 7;
break;
case DESC92C_RATEMCS8:
rate_idx = 8;
break;
case DESC92C_RATEMCS9:
rate_idx = 9;
break;
case DESC92C_RATEMCS10:
rate_idx = 10;
break;
case DESC92C_RATEMCS11:
rate_idx = 11;
break;
case DESC92C_RATEMCS12:
rate_idx = 12;
break;
case DESC92C_RATEMCS13:
rate_idx = 13;
break;
case DESC92C_RATEMCS14:
rate_idx = 14;
break;
case DESC92C_RATEMCS15:
rate_idx = 15;
break;
default:
rate_idx = 0;
break;
}
}
return rate_idx;
}
static void _rtl92ee_query_rxphystatus(struct ieee80211_hw *hw, static void _rtl92ee_query_rxphystatus(struct ieee80211_hw *hw,
struct rtl_stats *pstatus, u8 *pdesc, struct rtl_stats *pstatus, u8 *pdesc,
struct rx_fwinfo *p_drvinfo, struct rx_fwinfo *p_drvinfo,
...@@ -345,8 +187,8 @@ static void _rtl92ee_query_rxphystatus(struct ieee80211_hw *hw, ...@@ -345,8 +187,8 @@ static void _rtl92ee_query_rxphystatus(struct ieee80211_hw *hw,
pstatus->recvsignalpower = rx_pwr_all; pstatus->recvsignalpower = rx_pwr_all;
/* (3)EVM of HT rate */ /* (3)EVM of HT rate */
if (pstatus->rate >= DESC92C_RATEMCS8 && if (pstatus->rate >= DESC_RATEMCS8 &&
pstatus->rate <= DESC92C_RATEMCS15) pstatus->rate <= DESC_RATEMCS15)
max_spatial_stream = 2; max_spatial_stream = 2;
else else
max_spatial_stream = 1; max_spatial_stream = 1;
...@@ -576,9 +418,8 @@ bool rtl92ee_rx_query_desc(struct ieee80211_hw *hw, ...@@ -576,9 +418,8 @@ bool rtl92ee_rx_query_desc(struct ieee80211_hw *hw,
* are use (RX_FLAG_HT) * are use (RX_FLAG_HT)
* Notice: this is diff with windows define * Notice: this is diff with windows define
*/ */
rx_status->rate_idx = _rtl92ee_rate_mapping(hw, rx_status->rate_idx = rtlwifi_rate_mapping(hw, status->is_ht,
status->is_ht, false, status->rate);
status->rate);
rx_status->mactime = status->timestamp_low; rx_status->mactime = status->timestamp_low;
if (phystatus) { if (phystatus) {
...@@ -710,27 +551,6 @@ static u16 get_desc_addr_fr_q_idx(u16 queue_index) ...@@ -710,27 +551,6 @@ static u16 get_desc_addr_fr_q_idx(u16 queue_index)
return desc_address; return desc_address;
} }
void rtl92ee_get_available_desc(struct ieee80211_hw *hw, u8 q_idx)
{
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
struct rtl_priv *rtlpriv = rtl_priv(hw);
u16 point_diff = 0;
u16 current_tx_read_point = 0, current_tx_write_point = 0;
u32 tmp_4byte;
tmp_4byte = rtl_read_dword(rtlpriv,
get_desc_addr_fr_q_idx(q_idx));
current_tx_read_point = (u16)((tmp_4byte >> 16) & 0x0fff);
current_tx_write_point = (u16)((tmp_4byte) & 0x0fff);
point_diff = ((current_tx_read_point > current_tx_write_point) ?
(current_tx_read_point - current_tx_write_point) :
(TX_DESC_NUM_92E - current_tx_write_point +
current_tx_read_point));
rtlpci->tx_ring[q_idx].avl_desc = point_diff;
}
void rtl92ee_pre_fill_tx_bd_desc(struct ieee80211_hw *hw, void rtl92ee_pre_fill_tx_bd_desc(struct ieee80211_hw *hw,
u8 *tx_bd_desc, u8 *desc, u8 queue_index, u8 *tx_bd_desc, u8 *desc, u8 queue_index,
struct sk_buff *skb, dma_addr_t addr) struct sk_buff *skb, dma_addr_t addr)
...@@ -901,13 +721,13 @@ void rtl92ee_tx_fill_desc(struct ieee80211_hw *hw, ...@@ -901,13 +721,13 @@ void rtl92ee_tx_fill_desc(struct ieee80211_hw *hw,
} else { } else {
if (rtlpriv->ra.is_special_data) { if (rtlpriv->ra.is_special_data) {
ptcb_desc->use_driver_rate = true; ptcb_desc->use_driver_rate = true;
SET_TX_DESC_TX_RATE(pdesc, DESC92C_RATE11M); SET_TX_DESC_TX_RATE(pdesc, DESC_RATE11M);
} else { } else {
ptcb_desc->use_driver_rate = false; ptcb_desc->use_driver_rate = false;
} }
} }
if (ptcb_desc->hw_rate > DESC92C_RATEMCS0) if (ptcb_desc->hw_rate > DESC_RATEMCS0)
short_gi = (ptcb_desc->use_shortgi) ? 1 : 0; short_gi = (ptcb_desc->use_shortgi) ? 1 : 0;
else else
short_gi = (ptcb_desc->use_shortpreamble) ? 1 : 0; short_gi = (ptcb_desc->use_shortpreamble) ? 1 : 0;
...@@ -927,7 +747,7 @@ void rtl92ee_tx_fill_desc(struct ieee80211_hw *hw, ...@@ -927,7 +747,7 @@ void rtl92ee_tx_fill_desc(struct ieee80211_hw *hw,
SET_TX_DESC_RTS_RATE(pdesc, ptcb_desc->rts_rate); SET_TX_DESC_RTS_RATE(pdesc, ptcb_desc->rts_rate);
SET_TX_DESC_RTS_SC(pdesc, ptcb_desc->rts_sc); SET_TX_DESC_RTS_SC(pdesc, ptcb_desc->rts_sc);
SET_TX_DESC_RTS_SHORT(pdesc, SET_TX_DESC_RTS_SHORT(pdesc,
((ptcb_desc->rts_rate <= DESC92C_RATE54M) ? ((ptcb_desc->rts_rate <= DESC_RATE54M) ?
(ptcb_desc->rts_use_shortpreamble ? 1 : 0) : (ptcb_desc->rts_use_shortpreamble ? 1 : 0) :
(ptcb_desc->rts_use_shortgi ? 1 : 0))); (ptcb_desc->rts_use_shortgi ? 1 : 0)));
...@@ -1038,7 +858,7 @@ void rtl92ee_tx_fill_cmddesc(struct ieee80211_hw *hw, ...@@ -1038,7 +858,7 @@ void rtl92ee_tx_fill_cmddesc(struct ieee80211_hw *hw,
if (firstseg) if (firstseg)
SET_TX_DESC_OFFSET(pdesc, txdesc_len); SET_TX_DESC_OFFSET(pdesc, txdesc_len);
SET_TX_DESC_TX_RATE(pdesc, DESC92C_RATE1M); SET_TX_DESC_TX_RATE(pdesc, DESC_RATE1M);
SET_TX_DESC_SEQ(pdesc, 0); SET_TX_DESC_SEQ(pdesc, 0);
......
...@@ -591,10 +591,10 @@ do { \ ...@@ -591,10 +591,10 @@ do { \
} while (0) } while (0)
#define RTL92EE_RX_HAL_IS_CCK_RATE(rxmcs)\ #define RTL92EE_RX_HAL_IS_CCK_RATE(rxmcs)\
(rxmcs == DESC92C_RATE1M ||\ (rxmcs == DESC_RATE1M ||\
rxmcs == DESC92C_RATE2M ||\ rxmcs == DESC_RATE2M ||\
rxmcs == DESC92C_RATE5_5M ||\ rxmcs == DESC_RATE5_5M ||\
rxmcs == DESC92C_RATE11M) rxmcs == DESC_RATE11M)
#define IS_LITTLE_ENDIAN 1 #define IS_LITTLE_ENDIAN 1
...@@ -829,7 +829,6 @@ void rtl92ee_rx_check_dma_ok(struct ieee80211_hw *hw, u8 *header_desc, ...@@ -829,7 +829,6 @@ void rtl92ee_rx_check_dma_ok(struct ieee80211_hw *hw, u8 *header_desc,
u8 queue_index); u8 queue_index);
u16 rtl92ee_rx_desc_buff_remained_cnt(struct ieee80211_hw *hw, u16 rtl92ee_rx_desc_buff_remained_cnt(struct ieee80211_hw *hw,
u8 queue_index); u8 queue_index);
void rtl92ee_get_available_desc(struct ieee80211_hw *hw, u8 queue_index);
void rtl92ee_pre_fill_tx_bd_desc(struct ieee80211_hw *hw, void rtl92ee_pre_fill_tx_bd_desc(struct ieee80211_hw *hw,
u8 *tx_bd_desc, u8 *desc, u8 queue_index, u8 *tx_bd_desc, u8 *desc, u8 queue_index,
struct sk_buff *skb, dma_addr_t addr); struct sk_buff *skb, dma_addr_t addr);
......
...@@ -450,10 +450,10 @@ ...@@ -450,10 +450,10 @@
SHIFT_AND_MASK_LE(__pdesc + 24, 0, 32) SHIFT_AND_MASK_LE(__pdesc + 24, 0, 32)
#define SE_RX_HAL_IS_CCK_RATE(_pdesc)\ #define SE_RX_HAL_IS_CCK_RATE(_pdesc)\
(GET_RX_STATUS_DESC_RX_MCS(_pdesc) == DESC92_RATE1M || \ (GET_RX_STATUS_DESC_RX_MCS(_pdesc) == DESC_RATE1M || \
GET_RX_STATUS_DESC_RX_MCS(_pdesc) == DESC92_RATE2M || \ GET_RX_STATUS_DESC_RX_MCS(_pdesc) == DESC_RATE2M || \
GET_RX_STATUS_DESC_RX_MCS(_pdesc) == DESC92_RATE5_5M ||\ GET_RX_STATUS_DESC_RX_MCS(_pdesc) == DESC_RATE5_5M ||\
GET_RX_STATUS_DESC_RX_MCS(_pdesc) == DESC92_RATE11M) GET_RX_STATUS_DESC_RX_MCS(_pdesc) == DESC_RATE11M)
enum rf_optype { enum rf_optype {
RF_OP_BY_SW_3WIRE = 0, RF_OP_BY_SW_3WIRE = 0,
......
...@@ -383,21 +383,21 @@ static struct rtl_hal_cfg rtl92se_hal_cfg = { ...@@ -383,21 +383,21 @@ static struct rtl_hal_cfg rtl92se_hal_cfg = {
.maps[RTL_IMR_ROK] = IMR_ROK, .maps[RTL_IMR_ROK] = IMR_ROK,
.maps[RTL_IBSS_INT_MASKS] = (IMR_BCNINT | IMR_TBDOK | IMR_TBDER), .maps[RTL_IBSS_INT_MASKS] = (IMR_BCNINT | IMR_TBDOK | IMR_TBDER),
.maps[RTL_RC_CCK_RATE1M] = DESC92_RATE1M, .maps[RTL_RC_CCK_RATE1M] = DESC_RATE1M,
.maps[RTL_RC_CCK_RATE2M] = DESC92_RATE2M, .maps[RTL_RC_CCK_RATE2M] = DESC_RATE2M,
.maps[RTL_RC_CCK_RATE5_5M] = DESC92_RATE5_5M, .maps[RTL_RC_CCK_RATE5_5M] = DESC_RATE5_5M,
.maps[RTL_RC_CCK_RATE11M] = DESC92_RATE11M, .maps[RTL_RC_CCK_RATE11M] = DESC_RATE11M,
.maps[RTL_RC_OFDM_RATE6M] = DESC92_RATE6M, .maps[RTL_RC_OFDM_RATE6M] = DESC_RATE6M,
.maps[RTL_RC_OFDM_RATE9M] = DESC92_RATE9M, .maps[RTL_RC_OFDM_RATE9M] = DESC_RATE9M,
.maps[RTL_RC_OFDM_RATE12M] = DESC92_RATE12M, .maps[RTL_RC_OFDM_RATE12M] = DESC_RATE12M,
.maps[RTL_RC_OFDM_RATE18M] = DESC92_RATE18M, .maps[RTL_RC_OFDM_RATE18M] = DESC_RATE18M,
.maps[RTL_RC_OFDM_RATE24M] = DESC92_RATE24M, .maps[RTL_RC_OFDM_RATE24M] = DESC_RATE24M,
.maps[RTL_RC_OFDM_RATE36M] = DESC92_RATE36M, .maps[RTL_RC_OFDM_RATE36M] = DESC_RATE36M,
.maps[RTL_RC_OFDM_RATE48M] = DESC92_RATE48M, .maps[RTL_RC_OFDM_RATE48M] = DESC_RATE48M,
.maps[RTL_RC_OFDM_RATE54M] = DESC92_RATE54M, .maps[RTL_RC_OFDM_RATE54M] = DESC_RATE54M,
.maps[RTL_RC_HT_RATEMCS7] = DESC92_RATEMCS7, .maps[RTL_RC_HT_RATEMCS7] = DESC_RATEMCS7,
.maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15, .maps[RTL_RC_HT_RATEMCS15] = DESC_RATEMCS15,
}; };
static struct pci_device_id rtl92se_pci_ids[] = { static struct pci_device_id rtl92se_pci_ids[] = {
......
...@@ -191,8 +191,8 @@ static void _rtl92se_query_rxphystatus(struct ieee80211_hw *hw, ...@@ -191,8 +191,8 @@ static void _rtl92se_query_rxphystatus(struct ieee80211_hw *hw,
pstats->rxpower = rx_pwr_all; pstats->rxpower = rx_pwr_all;
pstats->recvsignalpower = rx_pwr_all; pstats->recvsignalpower = rx_pwr_all;
if (pstats->is_ht && pstats->rate >= DESC92_RATEMCS8 && if (pstats->is_ht && pstats->rate >= DESC_RATEMCS8 &&
pstats->rate <= DESC92_RATEMCS15) pstats->rate <= DESC_RATEMCS15)
max_spatial_stream = 2; max_spatial_stream = 2;
else else
max_spatial_stream = 1; max_spatial_stream = 1;
...@@ -264,7 +264,6 @@ bool rtl92se_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats, ...@@ -264,7 +264,6 @@ bool rtl92se_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats,
struct rx_fwinfo *p_drvinfo; struct rx_fwinfo *p_drvinfo;
u32 phystatus = (u32)GET_RX_STATUS_DESC_PHY_STATUS(pdesc); u32 phystatus = (u32)GET_RX_STATUS_DESC_PHY_STATUS(pdesc);
struct ieee80211_hdr *hdr; struct ieee80211_hdr *hdr;
bool first_ampdu = false;
stats->length = (u16)GET_RX_STATUS_DESC_PKT_LEN(pdesc); stats->length = (u16)GET_RX_STATUS_DESC_PKT_LEN(pdesc);
stats->rx_drvinfo_size = (u8)GET_RX_STATUS_DESC_DRVINFO_SIZE(pdesc) * 8; stats->rx_drvinfo_size = (u8)GET_RX_STATUS_DESC_DRVINFO_SIZE(pdesc) * 8;
...@@ -319,8 +318,8 @@ bool rtl92se_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats, ...@@ -319,8 +318,8 @@ bool rtl92se_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats,
rx_status->flag |= RX_FLAG_DECRYPTED; rx_status->flag |= RX_FLAG_DECRYPTED;
} }
rx_status->rate_idx = rtlwifi_rate_mapping(hw, rx_status->rate_idx = rtlwifi_rate_mapping(hw, stats->is_ht,
stats->is_ht, stats->rate, first_ampdu); false, stats->rate);
rx_status->mactime = stats->timestamp_low; rx_status->mactime = stats->timestamp_low;
if (phystatus) { if (phystatus) {
...@@ -394,14 +393,14 @@ void rtl92se_tx_fill_desc(struct ieee80211_hw *hw, ...@@ -394,14 +393,14 @@ void rtl92se_tx_fill_desc(struct ieee80211_hw *hw,
SET_TX_DESC_RSVD_MACID(pdesc, reserved_macid); SET_TX_DESC_RSVD_MACID(pdesc, reserved_macid);
SET_TX_DESC_TXHT(pdesc, ((ptcb_desc->hw_rate >= SET_TX_DESC_TXHT(pdesc, ((ptcb_desc->hw_rate >=
DESC92_RATEMCS0) ? 1 : 0)); DESC_RATEMCS0) ? 1 : 0));
if (rtlhal->version == VERSION_8192S_ACUT) { if (rtlhal->version == VERSION_8192S_ACUT) {
if (ptcb_desc->hw_rate == DESC92_RATE1M || if (ptcb_desc->hw_rate == DESC_RATE1M ||
ptcb_desc->hw_rate == DESC92_RATE2M || ptcb_desc->hw_rate == DESC_RATE2M ||
ptcb_desc->hw_rate == DESC92_RATE5_5M || ptcb_desc->hw_rate == DESC_RATE5_5M ||
ptcb_desc->hw_rate == DESC92_RATE11M) { ptcb_desc->hw_rate == DESC_RATE11M) {
ptcb_desc->hw_rate = DESC92_RATE12M; ptcb_desc->hw_rate = DESC_RATE12M;
} }
} }
...@@ -430,7 +429,7 @@ void rtl92se_tx_fill_desc(struct ieee80211_hw *hw, ...@@ -430,7 +429,7 @@ void rtl92se_tx_fill_desc(struct ieee80211_hw *hw,
SET_TX_DESC_RTS_BANDWIDTH(pdesc, 0); SET_TX_DESC_RTS_BANDWIDTH(pdesc, 0);
SET_TX_DESC_RTS_SUB_CARRIER(pdesc, ptcb_desc->rts_sc); SET_TX_DESC_RTS_SUB_CARRIER(pdesc, ptcb_desc->rts_sc);
SET_TX_DESC_RTS_SHORT(pdesc, ((ptcb_desc->rts_rate <= SET_TX_DESC_RTS_SHORT(pdesc, ((ptcb_desc->rts_rate <=
DESC92_RATE54M) ? DESC_RATE54M) ?
(ptcb_desc->rts_use_shortpreamble ? 1 : 0) (ptcb_desc->rts_use_shortpreamble ? 1 : 0)
: (ptcb_desc->rts_use_shortgi ? 1 : 0))); : (ptcb_desc->rts_use_shortgi ? 1 : 0)));
......
...@@ -45,164 +45,6 @@ static u8 _rtl8723e_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue) ...@@ -45,164 +45,6 @@ static u8 _rtl8723e_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue)
return skb->priority; return skb->priority;
} }
/* mac80211's rate_idx is like this:
*
* 2.4G band:rx_status->band == IEEE80211_BAND_2GHZ
*
* B/G rate:
* (rx_status->flag & RX_FLAG_HT) = 0,
* DESC92C_RATE1M-->DESC92C_RATE54M ==> idx is 0-->11,
*
* N rate:
* (rx_status->flag & RX_FLAG_HT) = 1,
* DESC92C_RATEMCS0-->DESC92C_RATEMCS15 ==> idx is 0-->15
*
* 5G band:rx_status->band == IEEE80211_BAND_5GHZ
* A rate:
* (rx_status->flag & RX_FLAG_HT) = 0,
* DESC92C_RATE6M-->DESC92C_RATE54M ==> idx is 0-->7,
*
* N rate:
* (rx_status->flag & RX_FLAG_HT) = 1,
* DESC92C_RATEMCS0-->DESC92C_RATEMCS15 ==> idx is 0-->15
*/
static int _rtl8723e_rate_mapping(struct ieee80211_hw *hw,
bool isht, u8 desc_rate)
{
int rate_idx;
if (!isht) {
if (IEEE80211_BAND_2GHZ == hw->conf.chandef.chan->band) {
switch (desc_rate) {
case DESC92C_RATE1M:
rate_idx = 0;
break;
case DESC92C_RATE2M:
rate_idx = 1;
break;
case DESC92C_RATE5_5M:
rate_idx = 2;
break;
case DESC92C_RATE11M:
rate_idx = 3;
break;
case DESC92C_RATE6M:
rate_idx = 4;
break;
case DESC92C_RATE9M:
rate_idx = 5;
break;
case DESC92C_RATE12M:
rate_idx = 6;
break;
case DESC92C_RATE18M:
rate_idx = 7;
break;
case DESC92C_RATE24M:
rate_idx = 8;
break;
case DESC92C_RATE36M:
rate_idx = 9;
break;
case DESC92C_RATE48M:
rate_idx = 10;
break;
case DESC92C_RATE54M:
rate_idx = 11;
break;
default:
rate_idx = 0;
break;
}
} else {
switch (desc_rate) {
case DESC92C_RATE6M:
rate_idx = 0;
break;
case DESC92C_RATE9M:
rate_idx = 1;
break;
case DESC92C_RATE12M:
rate_idx = 2;
break;
case DESC92C_RATE18M:
rate_idx = 3;
break;
case DESC92C_RATE24M:
rate_idx = 4;
break;
case DESC92C_RATE36M:
rate_idx = 5;
break;
case DESC92C_RATE48M:
rate_idx = 6;
break;
case DESC92C_RATE54M:
rate_idx = 7;
break;
default:
rate_idx = 0;
break;
}
}
} else {
switch (desc_rate) {
case DESC92C_RATEMCS0:
rate_idx = 0;
break;
case DESC92C_RATEMCS1:
rate_idx = 1;
break;
case DESC92C_RATEMCS2:
rate_idx = 2;
break;
case DESC92C_RATEMCS3:
rate_idx = 3;
break;
case DESC92C_RATEMCS4:
rate_idx = 4;
break;
case DESC92C_RATEMCS5:
rate_idx = 5;
break;
case DESC92C_RATEMCS6:
rate_idx = 6;
break;
case DESC92C_RATEMCS7:
rate_idx = 7;
break;
case DESC92C_RATEMCS8:
rate_idx = 8;
break;
case DESC92C_RATEMCS9:
rate_idx = 9;
break;
case DESC92C_RATEMCS10:
rate_idx = 10;
break;
case DESC92C_RATEMCS11:
rate_idx = 11;
break;
case DESC92C_RATEMCS12:
rate_idx = 12;
break;
case DESC92C_RATEMCS13:
rate_idx = 13;
break;
case DESC92C_RATEMCS14:
rate_idx = 14;
break;
case DESC92C_RATEMCS15:
rate_idx = 15;
break;
default:
rate_idx = 0;
break;
}
}
return rate_idx;
}
static void _rtl8723e_query_rxphystatus(struct ieee80211_hw *hw, static void _rtl8723e_query_rxphystatus(struct ieee80211_hw *hw,
struct rtl_stats *pstatus, u8 *pdesc, struct rtl_stats *pstatus, u8 *pdesc,
struct rx_fwinfo_8723e *p_drvinfo, struct rx_fwinfo_8723e *p_drvinfo,
...@@ -503,8 +345,8 @@ bool rtl8723e_rx_query_desc(struct ieee80211_hw *hw, ...@@ -503,8 +345,8 @@ bool rtl8723e_rx_query_desc(struct ieee80211_hw *hw,
* are use (RX_FLAG_HT) * are use (RX_FLAG_HT)
* Notice: this is diff with windows define * Notice: this is diff with windows define
*/ */
rx_status->rate_idx = _rtl8723e_rate_mapping(hw, rx_status->rate_idx = rtlwifi_rate_mapping(hw, status->is_ht,
status->is_ht, status->rate); false, status->rate);
rx_status->mactime = status->timestamp_low; rx_status->mactime = status->timestamp_low;
if (phystatus == true) { if (phystatus == true) {
......
...@@ -874,31 +874,6 @@ void rtl8723be_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw) ...@@ -874,31 +874,6 @@ void rtl8723be_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw)
ROFDM0_RXDETECTOR3, rtlphy->framesync); ROFDM0_RXDETECTOR3, rtlphy->framesync);
} }
void rtl8723be_phy_get_txpower_level(struct ieee80211_hw *hw, long *powerlevel)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_phy *rtlphy = &rtlpriv->phy;
u8 txpwr_level;
long txpwr_dbm;
txpwr_level = rtlphy->cur_cck_txpwridx;
txpwr_dbm = rtl8723_phy_txpwr_idx_to_dbm(hw, WIRELESS_MODE_B,
txpwr_level);
txpwr_level = rtlphy->cur_ofdm24g_txpwridx;
if (rtl8723_phy_txpwr_idx_to_dbm(hw, WIRELESS_MODE_G, txpwr_level) >
txpwr_dbm)
txpwr_dbm =
rtl8723_phy_txpwr_idx_to_dbm(hw, WIRELESS_MODE_G,
txpwr_level);
txpwr_level = rtlphy->cur_ofdm24g_txpwridx;
if (rtl8723_phy_txpwr_idx_to_dbm(hw, WIRELESS_MODE_N_24G,
txpwr_level) > txpwr_dbm)
txpwr_dbm =
rtl8723_phy_txpwr_idx_to_dbm(hw, WIRELESS_MODE_N_24G,
txpwr_level);
*powerlevel = txpwr_dbm;
}
static u8 _rtl8723be_phy_get_ratesection_intxpower_byrate(enum radio_path path, static u8 _rtl8723be_phy_get_ratesection_intxpower_byrate(enum radio_path path,
u8 rate) u8 rate)
{ {
......
...@@ -114,8 +114,6 @@ bool rtl8723be_phy_mac_config(struct ieee80211_hw *hw); ...@@ -114,8 +114,6 @@ bool rtl8723be_phy_mac_config(struct ieee80211_hw *hw);
bool rtl8723be_phy_bb_config(struct ieee80211_hw *hw); bool rtl8723be_phy_bb_config(struct ieee80211_hw *hw);
bool rtl8723be_phy_rf_config(struct ieee80211_hw *hw); bool rtl8723be_phy_rf_config(struct ieee80211_hw *hw);
void rtl8723be_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw); void rtl8723be_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw);
void rtl8723be_phy_get_txpower_level(struct ieee80211_hw *hw,
long *powerlevel);
void rtl8723be_phy_set_txpower_level(struct ieee80211_hw *hw, void rtl8723be_phy_set_txpower_level(struct ieee80211_hw *hw,
u8 channel); u8 channel);
void rtl8723be_phy_scan_operation_backup(struct ieee80211_hw *hw, void rtl8723be_phy_scan_operation_backup(struct ieee80211_hw *hw,
......
...@@ -47,164 +47,6 @@ static u8 _rtl8723be_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue) ...@@ -47,164 +47,6 @@ static u8 _rtl8723be_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue)
return skb->priority; return skb->priority;
} }
/* mac80211's rate_idx is like this:
*
* 2.4G band:rx_status->band == IEEE80211_BAND_2GHZ
*
* B/G rate:
* (rx_status->flag & RX_FLAG_HT) = 0,
* DESC92C_RATE1M-->DESC92C_RATE54M ==> idx is 0-->11,
*
* N rate:
* (rx_status->flag & RX_FLAG_HT) = 1,
* DESC92C_RATEMCS0-->DESC92C_RATEMCS15 ==> idx is 0-->15
*
* 5G band:rx_status->band == IEEE80211_BAND_5GHZ
* A rate:
* (rx_status->flag & RX_FLAG_HT) = 0,
* DESC92C_RATE6M-->DESC92C_RATE54M ==> idx is 0-->7,
*
* N rate:
* (rx_status->flag & RX_FLAG_HT) = 1,
* DESC92C_RATEMCS0-->DESC92C_RATEMCS15 ==> idx is 0-->15
*/
static int _rtl8723be_rate_mapping(struct ieee80211_hw *hw,
bool isht, u8 desc_rate)
{
int rate_idx;
if (!isht) {
if (IEEE80211_BAND_2GHZ == hw->conf.chandef.chan->band) {
switch (desc_rate) {
case DESC92C_RATE1M:
rate_idx = 0;
break;
case DESC92C_RATE2M:
rate_idx = 1;
break;
case DESC92C_RATE5_5M:
rate_idx = 2;
break;
case DESC92C_RATE11M:
rate_idx = 3;
break;
case DESC92C_RATE6M:
rate_idx = 4;
break;
case DESC92C_RATE9M:
rate_idx = 5;
break;
case DESC92C_RATE12M:
rate_idx = 6;
break;
case DESC92C_RATE18M:
rate_idx = 7;
break;
case DESC92C_RATE24M:
rate_idx = 8;
break;
case DESC92C_RATE36M:
rate_idx = 9;
break;
case DESC92C_RATE48M:
rate_idx = 10;
break;
case DESC92C_RATE54M:
rate_idx = 11;
break;
default:
rate_idx = 0;
break;
}
} else {
switch (desc_rate) {
case DESC92C_RATE6M:
rate_idx = 0;
break;
case DESC92C_RATE9M:
rate_idx = 1;
break;
case DESC92C_RATE12M:
rate_idx = 2;
break;
case DESC92C_RATE18M:
rate_idx = 3;
break;
case DESC92C_RATE24M:
rate_idx = 4;
break;
case DESC92C_RATE36M:
rate_idx = 5;
break;
case DESC92C_RATE48M:
rate_idx = 6;
break;
case DESC92C_RATE54M:
rate_idx = 7;
break;
default:
rate_idx = 0;
break;
}
}
} else {
switch (desc_rate) {
case DESC92C_RATEMCS0:
rate_idx = 0;
break;
case DESC92C_RATEMCS1:
rate_idx = 1;
break;
case DESC92C_RATEMCS2:
rate_idx = 2;
break;
case DESC92C_RATEMCS3:
rate_idx = 3;
break;
case DESC92C_RATEMCS4:
rate_idx = 4;
break;
case DESC92C_RATEMCS5:
rate_idx = 5;
break;
case DESC92C_RATEMCS6:
rate_idx = 6;
break;
case DESC92C_RATEMCS7:
rate_idx = 7;
break;
case DESC92C_RATEMCS8:
rate_idx = 8;
break;
case DESC92C_RATEMCS9:
rate_idx = 9;
break;
case DESC92C_RATEMCS10:
rate_idx = 10;
break;
case DESC92C_RATEMCS11:
rate_idx = 11;
break;
case DESC92C_RATEMCS12:
rate_idx = 12;
break;
case DESC92C_RATEMCS13:
rate_idx = 13;
break;
case DESC92C_RATEMCS14:
rate_idx = 14;
break;
case DESC92C_RATEMCS15:
rate_idx = 15;
break;
default:
rate_idx = 0;
break;
}
}
return rate_idx;
}
static void _rtl8723be_query_rxphystatus(struct ieee80211_hw *hw, static void _rtl8723be_query_rxphystatus(struct ieee80211_hw *hw,
struct rtl_stats *pstatus, u8 *pdesc, struct rtl_stats *pstatus, u8 *pdesc,
struct rx_fwinfo_8723be *p_drvinfo, struct rx_fwinfo_8723be *p_drvinfo,
...@@ -558,8 +400,8 @@ bool rtl8723be_rx_query_desc(struct ieee80211_hw *hw, ...@@ -558,8 +400,8 @@ bool rtl8723be_rx_query_desc(struct ieee80211_hw *hw,
* supported rates or MCS index if HT rates * supported rates or MCS index if HT rates
* are use (RX_FLAG_HT) * are use (RX_FLAG_HT)
*/ */
rx_status->rate_idx = _rtl8723be_rate_mapping(hw, status->is_ht, rx_status->rate_idx = rtlwifi_rate_mapping(hw, status->is_ht,
status->rate); false, status->rate);
rx_status->mactime = status->timestamp_low; rx_status->mactime = status->timestamp_low;
if (phystatus) { if (phystatus) {
......
...@@ -373,60 +373,6 @@ enum rtl_desc_qsel { ...@@ -373,60 +373,6 @@ enum rtl_desc_qsel {
QSLT_CMD = 0x13, QSLT_CMD = 0x13,
}; };
enum rtl_desc8821ae_rate {
DESC_RATE1M = 0x00,
DESC_RATE2M = 0x01,
DESC_RATE5_5M = 0x02,
DESC_RATE11M = 0x03,
DESC_RATE6M = 0x04,
DESC_RATE9M = 0x05,
DESC_RATE12M = 0x06,
DESC_RATE18M = 0x07,
DESC_RATE24M = 0x08,
DESC_RATE36M = 0x09,
DESC_RATE48M = 0x0a,
DESC_RATE54M = 0x0b,
DESC_RATEMCS0 = 0x0c,
DESC_RATEMCS1 = 0x0d,
DESC_RATEMCS2 = 0x0e,
DESC_RATEMCS3 = 0x0f,
DESC_RATEMCS4 = 0x10,
DESC_RATEMCS5 = 0x11,
DESC_RATEMCS6 = 0x12,
DESC_RATEMCS7 = 0x13,
DESC_RATEMCS8 = 0x14,
DESC_RATEMCS9 = 0x15,
DESC_RATEMCS10 = 0x16,
DESC_RATEMCS11 = 0x17,
DESC_RATEMCS12 = 0x18,
DESC_RATEMCS13 = 0x19,
DESC_RATEMCS14 = 0x1a,
DESC_RATEMCS15 = 0x1b,
DESC_RATEVHT1SS_MCS0 = 0x2c,
DESC_RATEVHT1SS_MCS1 = 0x2d,
DESC_RATEVHT1SS_MCS2 = 0x2e,
DESC_RATEVHT1SS_MCS3 = 0x2f,
DESC_RATEVHT1SS_MCS4 = 0x30,
DESC_RATEVHT1SS_MCS5 = 0x31,
DESC_RATEVHT1SS_MCS6 = 0x32,
DESC_RATEVHT1SS_MCS7 = 0x33,
DESC_RATEVHT1SS_MCS8 = 0x34,
DESC_RATEVHT1SS_MCS9 = 0x35,
DESC_RATEVHT2SS_MCS0 = 0x36,
DESC_RATEVHT2SS_MCS1 = 0x37,
DESC_RATEVHT2SS_MCS2 = 0x38,
DESC_RATEVHT2SS_MCS3 = 0x39,
DESC_RATEVHT2SS_MCS4 = 0x3a,
DESC_RATEVHT2SS_MCS5 = 0x3b,
DESC_RATEVHT2SS_MCS6 = 0x3c,
DESC_RATEVHT2SS_MCS7 = 0x3d,
DESC_RATEVHT2SS_MCS8 = 0x3e,
DESC_RATEVHT2SS_MCS9 = 0x3f,
};
enum rx_packet_type { enum rx_packet_type {
NORMAL_RX, NORMAL_RX,
TX_REPORT1, TX_REPORT1,
......
...@@ -93,9 +93,9 @@ ...@@ -93,9 +93,9 @@
#define RTL8812_TRANS_CARDEMU_TO_SUS \ #define RTL8812_TRANS_CARDEMU_TO_SUS \
{0x0042, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,\ {0x0042, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,\
PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xF0, 0xcc}, \ PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xF0, 0xc0}, \
{0x0042, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,\ {0x0042, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,\
PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xF0, 0xEC}, \ PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xF0, 0xE0}, \
{0x0043, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\ {0x0043, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\
PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x07 \ PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x07 \
/* gpio11 input mode, gpio10~8 output mode */}, \ /* gpio11 input mode, gpio10~8 output mode */}, \
......
...@@ -85,52 +85,6 @@ static void rtl8821ae_init_aspm_vars(struct ieee80211_hw *hw) ...@@ -85,52 +85,6 @@ static void rtl8821ae_init_aspm_vars(struct ieee80211_hw *hw)
rtlpci->const_support_pciaspm = 1; rtlpci->const_support_pciaspm = 1;
} }
static void load_wowlan_fw(struct rtl_priv *rtlpriv)
{
/* callback routine to load wowlan firmware after main fw has
* been loaded
*/
const struct firmware *wowlan_firmware;
char *fw_name = NULL;
int err;
/* for wowlan firmware buf */
rtlpriv->rtlhal.wowlan_firmware = vzalloc(0x8000);
if (!rtlpriv->rtlhal.wowlan_firmware) {
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
"Can't alloc buffer for wowlan fw.\n");
return;
}
if (rtlpriv->rtlhal.hw_type == HARDWARE_TYPE_RTL8821AE)
fw_name = "rtlwifi/rtl8821aefw_wowlan.bin";
else
fw_name = "rtlwifi/rtl8812aefw_wowlan.bin";
err = request_firmware(&wowlan_firmware, fw_name, rtlpriv->io.dev);
if (err) {
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
"Failed to request wowlan firmware!\n");
goto error;
}
if (wowlan_firmware->size > 0x8000) {
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
"Wowlan Firmware is too big!\n");
goto error;
}
memcpy(rtlpriv->rtlhal.wowlan_firmware, wowlan_firmware->data,
wowlan_firmware->size);
rtlpriv->rtlhal.wowlan_fwsize = wowlan_firmware->size;
release_firmware(wowlan_firmware);
RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "WOWLAN FirmwareDownload OK\n");
return;
error:
release_firmware(wowlan_firmware);
vfree(rtlpriv->rtlhal.wowlan_firmware);
}
/*InitializeVariables8812E*/ /*InitializeVariables8812E*/
int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw) int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw)
{ {
...@@ -231,7 +185,6 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw) ...@@ -231,7 +185,6 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw)
else if (rtlpriv->psc.reg_fwctrl_lps == 3) else if (rtlpriv->psc.reg_fwctrl_lps == 3)
rtlpriv->psc.fwctrl_psmode = FW_PS_DTIM_MODE; rtlpriv->psc.fwctrl_psmode = FW_PS_DTIM_MODE;
rtlpriv->rtl_fw_second_cb = load_wowlan_fw;
/* for firmware buf */ /* for firmware buf */
rtlpriv->rtlhal.pfirmware = vzalloc(0x8000); rtlpriv->rtlhal.pfirmware = vzalloc(0x8000);
if (!rtlpriv->rtlhal.pfirmware) { if (!rtlpriv->rtlhal.pfirmware) {
...@@ -239,20 +192,41 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw) ...@@ -239,20 +192,41 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw)
"Can't alloc buffer for fw.\n"); "Can't alloc buffer for fw.\n");
return 1; return 1;
} }
rtlpriv->rtlhal.wowlan_firmware = vzalloc(0x8000);
if (!rtlpriv->rtlhal.wowlan_firmware) {
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
"Can't alloc buffer for wowlan fw.\n");
return 1;
}
if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) {
rtlpriv->cfg->fw_name = "rtlwifi/rtl8812aefw.bin"; rtlpriv->cfg->fw_name = "rtlwifi/rtl8812aefw.bin";
else rtlpriv->cfg->wowlan_fw_name = "rtlwifi/rtl8812aefw_wowlan.bin";
} else {
rtlpriv->cfg->fw_name = "rtlwifi/rtl8821aefw.bin"; rtlpriv->cfg->fw_name = "rtlwifi/rtl8821aefw.bin";
rtlpriv->cfg->wowlan_fw_name = "rtlwifi/rtl8821aefw_wowlan.bin";
}
rtlpriv->max_fw_size = 0x8000; rtlpriv->max_fw_size = 0x8000;
/*load normal firmware*/
pr_info("Using firmware %s\n", rtlpriv->cfg->fw_name); pr_info("Using firmware %s\n", rtlpriv->cfg->fw_name);
err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name, err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name,
rtlpriv->io.dev, GFP_KERNEL, hw, rtlpriv->io.dev, GFP_KERNEL, hw,
rtl_fw_cb); rtl_fw_cb);
if (err) { if (err) {
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
"Failed to request firmware!\n"); "Failed to request normal firmware!\n");
return 1;
}
/*load wowlan firmware*/
pr_info("Using firmware %s\n", rtlpriv->cfg->wowlan_fw_name);
err = request_firmware_nowait(THIS_MODULE, 1,
rtlpriv->cfg->wowlan_fw_name,
rtlpriv->io.dev, GFP_KERNEL, hw,
rtl_wowlan_fw_cb);
if (err) {
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
"Failed to request wowlan firmware!\n");
return 1; return 1;
} }
return 0; return 0;
......
...@@ -48,232 +48,6 @@ static u8 _rtl8821ae_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue) ...@@ -48,232 +48,6 @@ static u8 _rtl8821ae_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue)
return skb->priority; return skb->priority;
} }
/* mac80211's rate_idx is like this:
*
* 2.4G band:rx_status->band == IEEE80211_BAND_2GHZ
*
* B/G rate:
* (rx_status->flag & RX_FLAG_HT) = 0,
* DESC_RATE1M-->DESC_RATE54M ==> idx is 0-->11,
*
* N rate:
* (rx_status->flag & RX_FLAG_HT) = 1,
* DESC_RATEMCS0-->DESC_RATEMCS15 ==> idx is 0-->15
*
* 5G band:rx_status->band == IEEE80211_BAND_5GHZ
* A rate:
* (rx_status->flag & RX_FLAG_HT) = 0,
* DESC_RATE6M-->DESC_RATE54M ==> idx is 0-->7,
*
* N rate:
* (rx_status->flag & RX_FLAG_HT) = 1,
* DESC_RATEMCS0-->DESC_RATEMCS15 ==> idx is 0-->15
*/
static int _rtl8821ae_rate_mapping(struct ieee80211_hw *hw,
bool isht, bool isvht, u8 desc_rate)
{
int rate_idx;
if (!isht) {
if (IEEE80211_BAND_2GHZ == hw->conf.chandef.chan->band) {
switch (desc_rate) {
case DESC_RATE1M:
rate_idx = 0;
break;
case DESC_RATE2M:
rate_idx = 1;
break;
case DESC_RATE5_5M:
rate_idx = 2;
break;
case DESC_RATE11M:
rate_idx = 3;
break;
case DESC_RATE6M:
rate_idx = 4;
break;
case DESC_RATE9M:
rate_idx = 5;
break;
case DESC_RATE12M:
rate_idx = 6;
break;
case DESC_RATE18M:
rate_idx = 7;
break;
case DESC_RATE24M:
rate_idx = 8;
break;
case DESC_RATE36M:
rate_idx = 9;
break;
case DESC_RATE48M:
rate_idx = 10;
break;
case DESC_RATE54M:
rate_idx = 11;
break;
default:
rate_idx = 0;
break;
}
} else {
switch (desc_rate) {
case DESC_RATE6M:
rate_idx = 0;
break;
case DESC_RATE9M:
rate_idx = 1;
break;
case DESC_RATE12M:
rate_idx = 2;
break;
case DESC_RATE18M:
rate_idx = 3;
break;
case DESC_RATE24M:
rate_idx = 4;
break;
case DESC_RATE36M:
rate_idx = 5;
break;
case DESC_RATE48M:
rate_idx = 6;
break;
case DESC_RATE54M:
rate_idx = 7;
break;
default:
rate_idx = 0;
break;
}
}
} else {
switch (desc_rate) {
case DESC_RATEMCS0:
rate_idx = 0;
break;
case DESC_RATEMCS1:
rate_idx = 1;
break;
case DESC_RATEMCS2:
rate_idx = 2;
break;
case DESC_RATEMCS3:
rate_idx = 3;
break;
case DESC_RATEMCS4:
rate_idx = 4;
break;
case DESC_RATEMCS5:
rate_idx = 5;
break;
case DESC_RATEMCS6:
rate_idx = 6;
break;
case DESC_RATEMCS7:
rate_idx = 7;
break;
case DESC_RATEMCS8:
rate_idx = 8;
break;
case DESC_RATEMCS9:
rate_idx = 9;
break;
case DESC_RATEMCS10:
rate_idx = 10;
break;
case DESC_RATEMCS11:
rate_idx = 11;
break;
case DESC_RATEMCS12:
rate_idx = 12;
break;
case DESC_RATEMCS13:
rate_idx = 13;
break;
case DESC_RATEMCS14:
rate_idx = 14;
break;
case DESC_RATEMCS15:
rate_idx = 15;
break;
default:
rate_idx = 0;
break;
}
}
if (isvht) {
switch (desc_rate) {
case DESC_RATEVHT1SS_MCS0:
rate_idx = 0;
break;
case DESC_RATEVHT1SS_MCS1:
rate_idx = 1;
break;
case DESC_RATEVHT1SS_MCS2:
rate_idx = 2;
break;
case DESC_RATEVHT1SS_MCS3:
rate_idx = 3;
break;
case DESC_RATEVHT1SS_MCS4:
rate_idx = 4;
break;
case DESC_RATEVHT1SS_MCS5:
rate_idx = 5;
break;
case DESC_RATEVHT1SS_MCS6:
rate_idx = 6;
break;
case DESC_RATEVHT1SS_MCS7:
rate_idx = 7;
break;
case DESC_RATEVHT1SS_MCS8:
rate_idx = 8;
break;
case DESC_RATEVHT1SS_MCS9:
rate_idx = 9;
break;
case DESC_RATEVHT2SS_MCS0:
rate_idx = 0;
break;
case DESC_RATEVHT2SS_MCS1:
rate_idx = 1;
break;
case DESC_RATEVHT2SS_MCS2:
rate_idx = 2;
break;
case DESC_RATEVHT2SS_MCS3:
rate_idx = 3;
break;
case DESC_RATEVHT2SS_MCS4:
rate_idx = 4;
break;
case DESC_RATEVHT2SS_MCS5:
rate_idx = 5;
break;
case DESC_RATEVHT2SS_MCS6:
rate_idx = 6;
break;
case DESC_RATEVHT2SS_MCS7:
rate_idx = 7;
break;
case DESC_RATEVHT2SS_MCS8:
rate_idx = 8;
break;
case DESC_RATEVHT2SS_MCS9:
rate_idx = 9;
break;
default:
rate_idx = 0;
break;
}
}
return rate_idx;
}
static u16 odm_cfo(char value) static u16 odm_cfo(char value)
{ {
int ret_val; int ret_val;
...@@ -766,9 +540,9 @@ bool rtl8821ae_rx_query_desc(struct ieee80211_hw *hw, ...@@ -766,9 +540,9 @@ bool rtl8821ae_rx_query_desc(struct ieee80211_hw *hw,
* supported rates or MCS index if HT rates * supported rates or MCS index if HT rates
* are use (RX_FLAG_HT) * are use (RX_FLAG_HT)
*/ */
rx_status->rate_idx = rx_status->rate_idx = rtlwifi_rate_mapping(hw, status->is_ht,
_rtl8821ae_rate_mapping(hw, status->is_ht, status->is_vht,
status->is_vht, status->rate); status->rate);
rx_status->mactime = status->timestamp_low; rx_status->mactime = status->timestamp_low;
if (phystatus) { if (phystatus) {
......
...@@ -331,10 +331,10 @@ enum hardware_type { ...@@ -331,10 +331,10 @@ enum hardware_type {
(IS_HARDWARE_TYPE_8723E(rtlhal) || IS_HARDWARE_TYPE_8723U(rtlhal)) (IS_HARDWARE_TYPE_8723E(rtlhal) || IS_HARDWARE_TYPE_8723U(rtlhal))
#define RX_HAL_IS_CCK_RATE(rxmcs) \ #define RX_HAL_IS_CCK_RATE(rxmcs) \
((rxmcs) == DESC92_RATE1M || \ ((rxmcs) == DESC_RATE1M || \
(rxmcs) == DESC92_RATE2M || \ (rxmcs) == DESC_RATE2M || \
(rxmcs) == DESC92_RATE5_5M || \ (rxmcs) == DESC_RATE5_5M || \
(rxmcs) == DESC92_RATE11M) (rxmcs) == DESC_RATE11M)
enum scan_operation_backup_opt { enum scan_operation_backup_opt {
SCAN_OPT_BACKUP = 0, SCAN_OPT_BACKUP = 0,
...@@ -579,38 +579,59 @@ enum rtl_hal_state { ...@@ -579,38 +579,59 @@ enum rtl_hal_state {
}; };
enum rtl_desc92_rate { enum rtl_desc92_rate {
DESC92_RATE1M = 0x00, DESC_RATE1M = 0x00,
DESC92_RATE2M = 0x01, DESC_RATE2M = 0x01,
DESC92_RATE5_5M = 0x02, DESC_RATE5_5M = 0x02,
DESC92_RATE11M = 0x03, DESC_RATE11M = 0x03,
DESC92_RATE6M = 0x04, DESC_RATE6M = 0x04,
DESC92_RATE9M = 0x05, DESC_RATE9M = 0x05,
DESC92_RATE12M = 0x06, DESC_RATE12M = 0x06,
DESC92_RATE18M = 0x07, DESC_RATE18M = 0x07,
DESC92_RATE24M = 0x08, DESC_RATE24M = 0x08,
DESC92_RATE36M = 0x09, DESC_RATE36M = 0x09,
DESC92_RATE48M = 0x0a, DESC_RATE48M = 0x0a,
DESC92_RATE54M = 0x0b, DESC_RATE54M = 0x0b,
DESC92_RATEMCS0 = 0x0c, DESC_RATEMCS0 = 0x0c,
DESC92_RATEMCS1 = 0x0d, DESC_RATEMCS1 = 0x0d,
DESC92_RATEMCS2 = 0x0e, DESC_RATEMCS2 = 0x0e,
DESC92_RATEMCS3 = 0x0f, DESC_RATEMCS3 = 0x0f,
DESC92_RATEMCS4 = 0x10, DESC_RATEMCS4 = 0x10,
DESC92_RATEMCS5 = 0x11, DESC_RATEMCS5 = 0x11,
DESC92_RATEMCS6 = 0x12, DESC_RATEMCS6 = 0x12,
DESC92_RATEMCS7 = 0x13, DESC_RATEMCS7 = 0x13,
DESC92_RATEMCS8 = 0x14, DESC_RATEMCS8 = 0x14,
DESC92_RATEMCS9 = 0x15, DESC_RATEMCS9 = 0x15,
DESC92_RATEMCS10 = 0x16, DESC_RATEMCS10 = 0x16,
DESC92_RATEMCS11 = 0x17, DESC_RATEMCS11 = 0x17,
DESC92_RATEMCS12 = 0x18, DESC_RATEMCS12 = 0x18,
DESC92_RATEMCS13 = 0x19, DESC_RATEMCS13 = 0x19,
DESC92_RATEMCS14 = 0x1a, DESC_RATEMCS14 = 0x1a,
DESC92_RATEMCS15 = 0x1b, DESC_RATEMCS15 = 0x1b,
DESC92_RATEMCS15_SG = 0x1c, DESC_RATEMCS15_SG = 0x1c,
DESC92_RATEMCS32 = 0x20, DESC_RATEMCS32 = 0x20,
DESC_RATEVHT1SS_MCS0 = 0x2c,
DESC_RATEVHT1SS_MCS1 = 0x2d,
DESC_RATEVHT1SS_MCS2 = 0x2e,
DESC_RATEVHT1SS_MCS3 = 0x2f,
DESC_RATEVHT1SS_MCS4 = 0x30,
DESC_RATEVHT1SS_MCS5 = 0x31,
DESC_RATEVHT1SS_MCS6 = 0x32,
DESC_RATEVHT1SS_MCS7 = 0x33,
DESC_RATEVHT1SS_MCS8 = 0x34,
DESC_RATEVHT1SS_MCS9 = 0x35,
DESC_RATEVHT2SS_MCS0 = 0x36,
DESC_RATEVHT2SS_MCS1 = 0x37,
DESC_RATEVHT2SS_MCS2 = 0x38,
DESC_RATEVHT2SS_MCS3 = 0x39,
DESC_RATEVHT2SS_MCS4 = 0x3a,
DESC_RATEVHT2SS_MCS5 = 0x3b,
DESC_RATEVHT2SS_MCS6 = 0x3c,
DESC_RATEVHT2SS_MCS7 = 0x3d,
DESC_RATEVHT2SS_MCS8 = 0x3e,
DESC_RATEVHT2SS_MCS9 = 0x3f,
}; };
enum rtl_var_map { enum rtl_var_map {
...@@ -2242,6 +2263,7 @@ struct rtl_hal_cfg { ...@@ -2242,6 +2263,7 @@ struct rtl_hal_cfg {
char *name; char *name;
char *fw_name; char *fw_name;
char *alt_fw_name; char *alt_fw_name;
char *wowlan_fw_name;
struct rtl_hal_ops *ops; struct rtl_hal_ops *ops;
struct rtl_mod_params *mod_params; struct rtl_mod_params *mod_params;
struct rtl_hal_usbint_cfg *usb_interface_cfg; struct rtl_hal_usbint_cfg *usb_interface_cfg;
...@@ -2518,8 +2540,6 @@ struct proxim { ...@@ -2518,8 +2540,6 @@ struct proxim {
struct rtl_priv { struct rtl_priv {
struct ieee80211_hw *hw; struct ieee80211_hw *hw;
/* Used to load a second firmware */
void (*rtl_fw_second_cb)(struct rtl_priv *rtlpriv);
struct completion firmware_loading_complete; struct completion firmware_loading_complete;
struct list_head list; struct list_head list;
struct rtl_priv *buddy_priv; struct rtl_priv *buddy_priv;
......
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