diff options
author | Sven Eckelmann <sven@open-mesh.com> | 2013-01-23 14:12:39 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-01-30 15:06:42 -0500 |
commit | 4ab0b0aa57a794ce299b0192e924379d7353beef (patch) | |
tree | d4d26f83abeed0596abdc5c1918af66c29da81a9 /drivers/net/wireless/ath/ath9k/recv.c | |
parent | 3a325565c7fa0ba7fd1e319c5fd07665a092fb89 (diff) |
ath9k: Update spectral scan output data
The sample data received through the spectral scan can be either in big or
little endian byteorder. This information isn't stored in the output file.
Therefore it is not possible for the analyzer software to find the correct byte
order.
It is relative common to get the data from a low end AP in big endian mode and
transfer it to another computer in little endian mode to analyze it. Therefore,
it would be better to store it in network (big endian) byte order.
The extension of the 8 bit bins for each bin to 16 bit is not necessary. This
operation can be done in userspace or on a different machine. Instead the
max_exp defining the amount of shifting required for each bin is exported to
userspace.
The change of the output format requires a change of the type in the sample
tlv to allow the userspace program to correctly detect the bin format.
Reported-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
[siwu@hrz.tu-chemnitz.de: squashed patches, update commit message, rebase, fix endianess bug]
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/recv.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/recv.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index 13ee37bcdb7d..2af6f19d2d2a 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -1035,7 +1035,7 @@ static int ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr, | |||
1035 | struct ath_radar_info *radar_info; | 1035 | struct ath_radar_info *radar_info; |
1036 | struct ath_ht20_mag_info *mag_info; | 1036 | struct ath_ht20_mag_info *mag_info; |
1037 | int len = rs->rs_datalen; | 1037 | int len = rs->rs_datalen; |
1038 | int i, dc_pos; | 1038 | int dc_pos; |
1039 | 1039 | ||
1040 | /* AR9280 and before report via ATH9K_PHYERR_RADAR, AR93xx and newer | 1040 | /* AR9280 and before report via ATH9K_PHYERR_RADAR, AR93xx and newer |
1041 | * via ATH9K_PHYERR_SPECTRAL. Haven't seen ATH9K_PHYERR_FALSE_RADAR_EXT | 1041 | * via ATH9K_PHYERR_SPECTRAL. Haven't seen ATH9K_PHYERR_FALSE_RADAR_EXT |
@@ -1064,8 +1064,9 @@ static int ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr, | |||
1064 | 1064 | ||
1065 | fft_sample.tlv.type = ATH_FFT_SAMPLE_HT20; | 1065 | fft_sample.tlv.type = ATH_FFT_SAMPLE_HT20; |
1066 | fft_sample.tlv.length = sizeof(fft_sample) - sizeof(fft_sample.tlv); | 1066 | fft_sample.tlv.length = sizeof(fft_sample) - sizeof(fft_sample.tlv); |
1067 | fft_sample.tlv.length = __cpu_to_be16(fft_sample.tlv.length); | ||
1067 | 1068 | ||
1068 | fft_sample.freq = ah->curchan->chan->center_freq; | 1069 | fft_sample.freq = __cpu_to_be16(ah->curchan->chan->center_freq); |
1069 | fft_sample.rssi = fix_rssi_inv_only(rs->rs_rssi_ctl0); | 1070 | fft_sample.rssi = fix_rssi_inv_only(rs->rs_rssi_ctl0); |
1070 | fft_sample.noise = ah->noise; | 1071 | fft_sample.noise = ah->noise; |
1071 | 1072 | ||
@@ -1105,14 +1106,15 @@ static int ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr, | |||
1105 | /* mag data is at the end of the frame, in front of radar_info */ | 1106 | /* mag data is at the end of the frame, in front of radar_info */ |
1106 | mag_info = ((struct ath_ht20_mag_info *)radar_info) - 1; | 1107 | mag_info = ((struct ath_ht20_mag_info *)radar_info) - 1; |
1107 | 1108 | ||
1108 | /* Apply exponent and grab further auxiliary information. */ | 1109 | /* copy raw bins without scaling them */ |
1109 | for (i = 0; i < SPECTRAL_HT20_NUM_BINS; i++) | 1110 | memcpy(fft_sample.data, bins, SPECTRAL_HT20_NUM_BINS); |
1110 | fft_sample.data[i] = bins[i] << mag_info->max_exp; | 1111 | fft_sample.max_exp = mag_info->max_exp & 0xf; |
1111 | 1112 | ||
1112 | fft_sample.max_magnitude = spectral_max_magnitude(mag_info->all_bins); | 1113 | fft_sample.max_magnitude = spectral_max_magnitude(mag_info->all_bins); |
1114 | fft_sample.max_magnitude = __cpu_to_be16(fft_sample.max_magnitude); | ||
1113 | fft_sample.max_index = spectral_max_index(mag_info->all_bins); | 1115 | fft_sample.max_index = spectral_max_index(mag_info->all_bins); |
1114 | fft_sample.bitmap_weight = spectral_bitmap_weight(mag_info->all_bins); | 1116 | fft_sample.bitmap_weight = spectral_bitmap_weight(mag_info->all_bins); |
1115 | fft_sample.tsf = tsf; | 1117 | fft_sample.tsf = __cpu_to_be64(tsf); |
1116 | 1118 | ||
1117 | ath_debug_send_fft_sample(sc, &fft_sample.tlv); | 1119 | ath_debug_send_fft_sample(sc, &fft_sample.tlv); |
1118 | return 1; | 1120 | return 1; |