aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath10k/wmi.c
diff options
context:
space:
mode:
authorMichal Kazior <michal.kazior@tieto.com>2015-03-30 02:51:56 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2015-03-30 08:09:46 -0400
commit01cebe1c50d43a79de1ee48bd9917c9fbbd3901d (patch)
tree42a3b5ab2f6736ab4fd42a661965605016761456 /drivers/net/wireless/ath/ath10k/wmi.c
parent5528e032702be937acdfe8c6395461e0e8acaa85 (diff)
ath10k: deduplicate bitrate to rate idx conversion
It's possible to derive rate index from bitrate without any additional mapping structures/logic. This should have little to none impact on performance since this is only done for management frames and the previous approach wasn't particularly optimized. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath10k/wmi.c')
-rw-r--r--drivers/net/wireless/ath/ath10k/wmi.c62
1 files changed, 4 insertions, 58 deletions
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index ae6a038f04ab..4778031b8635 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1352,63 +1352,6 @@ static inline enum ieee80211_band phy_mode_to_band(u32 phy_mode)
1352 return band; 1352 return band;
1353} 1353}
1354 1354
1355static inline u8 get_rate_idx(u32 rate, enum ieee80211_band band)
1356{
1357 u8 rate_idx = 0;
1358
1359 /* rate in Kbps */
1360 switch (rate) {
1361 case 1000:
1362 rate_idx = 0;
1363 break;
1364 case 2000:
1365 rate_idx = 1;
1366 break;
1367 case 5500:
1368 rate_idx = 2;
1369 break;
1370 case 11000:
1371 rate_idx = 3;
1372 break;
1373 case 6000:
1374 rate_idx = 4;
1375 break;
1376 case 9000:
1377 rate_idx = 5;
1378 break;
1379 case 12000:
1380 rate_idx = 6;
1381 break;
1382 case 18000:
1383 rate_idx = 7;
1384 break;
1385 case 24000:
1386 rate_idx = 8;
1387 break;
1388 case 36000:
1389 rate_idx = 9;
1390 break;
1391 case 48000:
1392 rate_idx = 10;
1393 break;
1394 case 54000:
1395 rate_idx = 11;
1396 break;
1397 default:
1398 break;
1399 }
1400
1401 if (band == IEEE80211_BAND_5GHZ) {
1402 if (rate_idx > 3)
1403 /* Omit CCK rates */
1404 rate_idx -= 4;
1405 else
1406 rate_idx = 0;
1407 }
1408
1409 return rate_idx;
1410}
1411
1412/* If keys are configured, HW decrypts all frames 1355/* If keys are configured, HW decrypts all frames
1413 * with protected bit set. Mark such frames as decrypted. 1356 * with protected bit set. Mark such frames as decrypted.
1414 */ 1357 */
@@ -1490,6 +1433,7 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)
1490 struct wmi_mgmt_rx_ev_arg arg = {}; 1433 struct wmi_mgmt_rx_ev_arg arg = {};
1491 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); 1434 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
1492 struct ieee80211_hdr *hdr; 1435 struct ieee80211_hdr *hdr;
1436 struct ieee80211_supported_band *sband;
1493 u32 rx_status; 1437 u32 rx_status;
1494 u32 channel; 1438 u32 channel;
1495 u32 phy_mode; 1439 u32 phy_mode;
@@ -1560,9 +1504,11 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)
1560 if (phy_mode == MODE_11B && status->band == IEEE80211_BAND_5GHZ) 1504 if (phy_mode == MODE_11B && status->band == IEEE80211_BAND_5GHZ)
1561 ath10k_dbg(ar, ATH10K_DBG_MGMT, "wmi mgmt rx 11b (CCK) on 5GHz\n"); 1505 ath10k_dbg(ar, ATH10K_DBG_MGMT, "wmi mgmt rx 11b (CCK) on 5GHz\n");
1562 1506
1507 sband = &ar->mac.sbands[status->band];
1508
1563 status->freq = ieee80211_channel_to_frequency(channel, status->band); 1509 status->freq = ieee80211_channel_to_frequency(channel, status->band);
1564 status->signal = snr + ATH10K_DEFAULT_NOISE_FLOOR; 1510 status->signal = snr + ATH10K_DEFAULT_NOISE_FLOOR;
1565 status->rate_idx = get_rate_idx(rate, status->band); 1511 status->rate_idx = ath10k_mac_bitrate_to_idx(sband, rate / 100);
1566 1512
1567 hdr = (struct ieee80211_hdr *)skb->data; 1513 hdr = (struct ieee80211_hdr *)skb->data;
1568 fc = le16_to_cpu(hdr->frame_control); 1514 fc = le16_to_cpu(hdr->frame_control);