aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath6kl/wmi.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2011-09-19 12:15:05 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2011-09-22 03:07:59 -0400
commit82e14f56f7408cb13c47eef9fd6922f22e88109a (patch)
tree2900a4037c8fd4cd33a2097b0fb3b88ac8a5962e /drivers/net/wireless/ath/ath6kl/wmi.c
parent457fb0415a887b6389854b850e9815cf0ec44178 (diff)
ath6kl: Remove unnecessary bssinfo event header conversion
There is no point in unconditionally converting the bssinfo header to the old version since only the new header is being used and the driver can as well read the values from it when needed. Leaving out the conversion saves some extra memory copying. In addition, use the calculated "rssi" value snr - 95 dBm to get the proper value in cfg80211 BSS table (i.e., something that more or less matches with the value used in STA info). Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath6kl/wmi.c')
-rw-r--r--drivers/net/wireless/ath/ath6kl/wmi.c37
1 files changed, 9 insertions, 28 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c
index 3ade9a17c0eb..72cf78c1ca6a 100644
--- a/drivers/net/wireless/ath/ath6kl/wmi.c
+++ b/drivers/net/wireless/ath/ath6kl/wmi.c
@@ -381,25 +381,6 @@ int ath6kl_wmi_dot3_2_dix(struct sk_buff *skb)
381 return 0; 381 return 0;
382} 382}
383 383
384static void ath6kl_wmi_convert_bssinfo_hdr2_to_hdr(struct sk_buff *skb,
385 u8 *datap)
386{
387 struct wmi_bss_info_hdr2 bih2;
388 struct wmi_bss_info_hdr *bih;
389
390 memcpy(&bih2, datap, sizeof(struct wmi_bss_info_hdr2));
391
392 skb_push(skb, 4);
393 bih = (struct wmi_bss_info_hdr *) skb->data;
394
395 bih->ch = bih2.ch;
396 bih->frame_type = bih2.frame_type;
397 bih->snr = bih2.snr;
398 bih->rssi = a_cpu_to_sle16(bih2.snr - 95);
399 bih->ie_mask = cpu_to_le32(le16_to_cpu(bih2.ie_mask));
400 memcpy(bih->bssid, bih2.bssid, ETH_ALEN);
401}
402
403static int ath6kl_wmi_tx_complete_event_rx(u8 *datap, int len) 384static int ath6kl_wmi_tx_complete_event_rx(u8 *datap, int len)
404{ 385{
405 struct tx_complete_msg_v1 *msg_v1; 386 struct tx_complete_msg_v1 *msg_v1;
@@ -912,24 +893,24 @@ static int ath6kl_wmi_tkip_micerr_event_rx(struct wmi *wmi, u8 *datap, int len)
912 893
913static int ath6kl_wmi_bssinfo_event_rx(struct wmi *wmi, u8 *datap, int len) 894static int ath6kl_wmi_bssinfo_event_rx(struct wmi *wmi, u8 *datap, int len)
914{ 895{
915 struct wmi_bss_info_hdr *bih; 896 struct wmi_bss_info_hdr2 *bih;
916 u8 *buf; 897 u8 *buf;
917 struct ieee80211_channel *channel; 898 struct ieee80211_channel *channel;
918 struct ath6kl *ar = wmi->parent_dev; 899 struct ath6kl *ar = wmi->parent_dev;
919 struct ieee80211_mgmt *mgmt; 900 struct ieee80211_mgmt *mgmt;
920 struct cfg80211_bss *bss; 901 struct cfg80211_bss *bss;
921 902
922 if (len <= sizeof(struct wmi_bss_info_hdr)) 903 if (len <= sizeof(struct wmi_bss_info_hdr2))
923 return -EINVAL; 904 return -EINVAL;
924 905
925 bih = (struct wmi_bss_info_hdr *) datap; 906 bih = (struct wmi_bss_info_hdr2 *) datap;
926 buf = datap + sizeof(struct wmi_bss_info_hdr); 907 buf = datap + sizeof(struct wmi_bss_info_hdr2);
927 len -= sizeof(struct wmi_bss_info_hdr); 908 len -= sizeof(struct wmi_bss_info_hdr2);
928 909
929 ath6kl_dbg(ATH6KL_DBG_WMI, 910 ath6kl_dbg(ATH6KL_DBG_WMI,
930 "bss info evt - ch %u, snr %d, rssi %d, bssid \"%pM\" " 911 "bss info evt - ch %u, snr %d, rssi %d, bssid \"%pM\" "
931 "frame_type=%d\n", 912 "frame_type=%d\n",
932 bih->ch, bih->snr, a_sle16_to_cpu(bih->rssi), bih->bssid, 913 bih->ch, bih->snr, bih->snr - 95, bih->bssid,
933 bih->frame_type); 914 bih->frame_type);
934 915
935 if (bih->frame_type != BEACON_FTYPE && 916 if (bih->frame_type != BEACON_FTYPE &&
@@ -973,7 +954,8 @@ static int ath6kl_wmi_bssinfo_event_rx(struct wmi *wmi, u8 *datap, int len)
973 memcpy(&mgmt->u.beacon, buf, len); 954 memcpy(&mgmt->u.beacon, buf, len);
974 955
975 bss = cfg80211_inform_bss_frame(ar->wdev->wiphy, channel, mgmt, 956 bss = cfg80211_inform_bss_frame(ar->wdev->wiphy, channel, mgmt,
976 24 + len, bih->snr * 100, GFP_ATOMIC); 957 24 + len, (bih->snr - 95) * 100,
958 GFP_ATOMIC);
977 kfree(mgmt); 959 kfree(mgmt);
978 if (bss == NULL) 960 if (bss == NULL)
979 return -ENOMEM; 961 return -ENOMEM;
@@ -2859,8 +2841,7 @@ int ath6kl_wmi_control_rx(struct wmi *wmi, struct sk_buff *skb)
2859 break; 2841 break;
2860 case WMI_BSSINFO_EVENTID: 2842 case WMI_BSSINFO_EVENTID:
2861 ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_BSSINFO_EVENTID\n"); 2843 ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_BSSINFO_EVENTID\n");
2862 ath6kl_wmi_convert_bssinfo_hdr2_to_hdr(skb, datap); 2844 ret = ath6kl_wmi_bssinfo_event_rx(wmi, datap, len);
2863 ret = ath6kl_wmi_bssinfo_event_rx(wmi, skb->data, skb->len);
2864 break; 2845 break;
2865 case WMI_REGDOMAIN_EVENTID: 2846 case WMI_REGDOMAIN_EVENTID:
2866 ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_REGDOMAIN_EVENTID\n"); 2847 ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_REGDOMAIN_EVENTID\n");