qcacmn: Add radiotap_num_to_freq() for correct Channel frequency
Function added to convert given channel number to correct channel frequency using the Channel center frequency and populate it correctly inside the radiotap header Change-Id: Iea2a9ee7d496b2aa0dbf8d6741a32d2dbfa3503d CRs-fixed: 2637424
This commit is contained in:

committed by
nshrivas

parent
4b45241915
commit
1f9ff8a62c
@@ -465,6 +465,57 @@ static inline void hal_get_radiotap_he_gi_ltf(uint16_t *he_gi, uint16_t *he_ltf)
|
||||
}
|
||||
}
|
||||
|
||||
/* channel number to freq conversion */
|
||||
#define CHANNEL_NUM_14 14
|
||||
#define CHANNEL_NUM_15 15
|
||||
#define CHANNEL_NUM_27 27
|
||||
#define CHANNEL_NUM_35 35
|
||||
#define CHANNEL_NUM_182 182
|
||||
#define CHANNEL_NUM_197 197
|
||||
#define CHANNEL_FREQ_2484 2484
|
||||
#define CHANNEL_FREQ_2407 2407
|
||||
#define CHANNEL_FREQ_2512 2512
|
||||
#define CHANNEL_FREQ_5000 5000
|
||||
#define CHANNEL_FREQ_5940 5940
|
||||
#define CHANNEL_FREQ_4000 4000
|
||||
#define CHANNEL_FREQ_5150 5150
|
||||
#define FREQ_MULTIPLIER_CONST_5MHZ 5
|
||||
#define FREQ_MULTIPLIER_CONST_20MHZ 20
|
||||
/**
|
||||
* hal_rx_radiotap_num_to_freq() - Get frequency from chan number
|
||||
* @chan_num - Input channel number
|
||||
* @center_freq - Input Channel Center frequency
|
||||
*
|
||||
* Return - Channel frequency in Mhz
|
||||
*/
|
||||
static uint16_t
|
||||
hal_rx_radiotap_num_to_freq(uint16_t chan_num, qdf_freq_t center_freq)
|
||||
{
|
||||
if (center_freq < CHANNEL_FREQ_5940) {
|
||||
if (chan_num == CHANNEL_NUM_14)
|
||||
return CHANNEL_FREQ_2484;
|
||||
if (chan_num < CHANNEL_NUM_14)
|
||||
return CHANNEL_FREQ_2407 +
|
||||
(chan_num * FREQ_MULTIPLIER_CONST_5MHZ);
|
||||
|
||||
if (chan_num < CHANNEL_NUM_27)
|
||||
return CHANNEL_FREQ_2512 +
|
||||
((chan_num - CHANNEL_NUM_15) *
|
||||
FREQ_MULTIPLIER_CONST_20MHZ);
|
||||
|
||||
if (chan_num > CHANNEL_NUM_182 &&
|
||||
chan_num < CHANNEL_NUM_197)
|
||||
return ((chan_num * FREQ_MULTIPLIER_CONST_5MHZ) +
|
||||
CHANNEL_FREQ_4000);
|
||||
|
||||
return CHANNEL_FREQ_5000 +
|
||||
(chan_num * FREQ_MULTIPLIER_CONST_5MHZ);
|
||||
} else {
|
||||
return CHANNEL_FREQ_5940 +
|
||||
(chan_num * FREQ_MULTIPLIER_CONST_5MHZ);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* hal_rx_status_get_tlv_info() - process receive info TLV
|
||||
* @rx_tlv_hdr: pointer to TLV header
|
||||
@@ -515,6 +566,13 @@ hal_rx_status_get_tlv_info_generic(void *rx_tlv_hdr, void *ppduinfo,
|
||||
ppdu_info->rx_status.chan_freq =
|
||||
(HAL_RX_GET(rx_tlv, RX_PPDU_START_1,
|
||||
SW_PHY_META_DATA) & 0xFFFF0000)>>16;
|
||||
if (ppdu_info->rx_status.chan_num &&
|
||||
ppdu_info->rx_status.chan_freq) {
|
||||
ppdu_info->rx_status.chan_freq =
|
||||
hal_rx_radiotap_num_to_freq(
|
||||
ppdu_info->rx_status.chan_num,
|
||||
ppdu_info->rx_status.chan_freq);
|
||||
}
|
||||
ppdu_info->com_info.ppdu_timestamp =
|
||||
HAL_RX_GET(rx_tlv, RX_PPDU_START_2,
|
||||
PPDU_START_TIMESTAMP);
|
||||
|
Reference in New Issue
Block a user