/* For every mcs_rate line, the first 8 bytes are for stream 1x1, * and all 16 bytes are for stream 2x2.
*/ staticconst u16 mcs_rate[4][16] = { /* LGI 40M */
{ 0x1b, 0x36, 0x51, 0x6c, 0xa2, 0xd8, 0xf3, 0x10e,
0x36, 0x6c, 0xa2, 0xd8, 0x144, 0x1b0, 0x1e6, 0x21c },
/* NSS2 note: the value in the table is 2 multiplier of the actual rate */ staticconst u16 ac_mcs_rate_nss2[8][10] = { /* LG 160M */
{ 0xEA, 0x1D4, 0x2BE, 0x3A8, 0x57C, 0x750, 0x83A,
0x924, 0xAF8, 0xC30 },
/* This function converts integer code to region string */ const u8 *mwifiex_11d_code_2_region(u8 code)
{
u8 i;
/* Look for code in mapping table */ for (i = 0; i < ARRAY_SIZE(region_code_mapping_t); i++) if (region_code_mapping_t[i].code == code) return region_code_mapping_t[i].region;
return NULL;
}
/* * This function maps an index in supported rates table into * the corresponding data rate.
*/
u32 mwifiex_index_to_acs_data_rate(struct mwifiex_private *priv,
u8 index, u8 ht_info)
{
u32 rate = 0;
u8 mcs_index = 0;
u8 bw = 0;
u8 gi = 0;
/* This function maps an index in supported rates table into * the corresponding data rate.
*/
u32 mwifiex_index_to_data_rate(struct mwifiex_private *priv,
u8 index, u8 ht_info)
{
u32 mcs_num_supp =
(priv->adapter->user_dev_mcs_support == HT_STREAM_2X2) ? 16 : 8;
u32 rate;
if (priv->adapter->is_hw_11ac_capable) return mwifiex_index_to_acs_data_rate(priv, index, ht_info);
/* * This function returns the current active data rates. * * The result may vary depending upon connection status.
*/
u32 mwifiex_get_active_data_rates(struct mwifiex_private *priv, u8 *rates)
{ if (!priv->media_connected) return mwifiex_get_supported_rates(priv, rates); else return mwifiex_copy_rates(rates, 0,
priv->curr_bss_params.data_rates,
priv->curr_bss_params.num_of_rates);
}
/* * This function locates the Channel-Frequency-Power triplet based upon * band and channel/frequency parameters.
*/ struct mwifiex_chan_freq_power *
mwifiex_get_cfp(struct mwifiex_private *priv, u8 band, u16 channel, u32 freq)
{ struct mwifiex_chan_freq_power *cfp = NULL; struct ieee80211_supported_band *sband; struct ieee80211_channel *ch = NULL; int i;
/* * This function checks if the data rate is set to auto.
*/
u8
mwifiex_is_rate_auto(struct mwifiex_private *priv)
{
u32 i; int rate_num = 0;
for (i = 0; i < ARRAY_SIZE(priv->bitmap_rates); i++) if (priv->bitmap_rates[i])
rate_num++;
if (rate_num > 1) returntrue; else returnfalse;
}
/* This function gets the supported data rates from bitmask inside * cfg80211_scan_request.
*/
u32 mwifiex_get_rates_from_cfg80211(struct mwifiex_private *priv,
u8 *rates, u8 radio_type)
{ struct wiphy *wiphy = priv->adapter->wiphy; struct cfg80211_scan_request *request = priv->scan_request;
u32 num_rates, rate_mask; struct ieee80211_supported_band *sband; int i;
if (radio_type) {
sband = wiphy->bands[NL80211_BAND_5GHZ]; if (WARN_ON_ONCE(!sband)) return 0;
rate_mask = request->rates[NL80211_BAND_5GHZ];
} else {
sband = wiphy->bands[NL80211_BAND_2GHZ]; if (WARN_ON_ONCE(!sband)) return 0;
rate_mask = request->rates[NL80211_BAND_2GHZ];
}
num_rates = 0; for (i = 0; i < sband->n_bitrates; i++) { if ((BIT(i) & rate_mask) == 0) continue; /* skip rate */
rates[num_rates++] = (u8)(sband->bitrates[i].bitrate / 5);
}
return num_rates;
}
/* This function gets the supported data rates. The function works in * both Ad-Hoc and infra mode by printing the band and returning the * data rates.
*/
u32 mwifiex_get_supported_rates(struct mwifiex_private *priv, u8 *rates)
{
u32 k = 0; struct mwifiex_adapter *adapter = priv->adapter;
if (priv->bss_mode == NL80211_IFTYPE_STATION ||
priv->bss_mode == NL80211_IFTYPE_P2P_CLIENT) { switch (adapter->config_bands) { case BAND_B:
mwifiex_dbg(adapter, INFO, "info: infra band=%d\t" "supported_rates_b\n",
adapter->config_bands);
k = mwifiex_copy_rates(rates, k, supported_rates_b, sizeof(supported_rates_b)); break; case BAND_G: case BAND_G | BAND_GN:
mwifiex_dbg(adapter, INFO, "info: infra band=%d\t" "supported_rates_g\n",
adapter->config_bands);
k = mwifiex_copy_rates(rates, k, supported_rates_g, sizeof(supported_rates_g)); break; case BAND_B | BAND_G: case BAND_A | BAND_B | BAND_G: case BAND_A | BAND_B: case BAND_A | BAND_B | BAND_G | BAND_GN | BAND_AN: case BAND_A | BAND_B | BAND_G | BAND_GN | BAND_AN | BAND_AAC: case BAND_B | BAND_G | BAND_GN:
mwifiex_dbg(adapter, INFO, "info: infra band=%d\t" "supported_rates_bg\n",
adapter->config_bands);
k = mwifiex_copy_rates(rates, k, supported_rates_bg, sizeof(supported_rates_bg)); break; case BAND_A: case BAND_A | BAND_G:
mwifiex_dbg(adapter, INFO, "info: infra band=%d\t" "supported_rates_a\n",
adapter->config_bands);
k = mwifiex_copy_rates(rates, k, supported_rates_a, sizeof(supported_rates_a)); break; case BAND_AN: case BAND_A | BAND_AN: case BAND_A | BAND_AN | BAND_AAC: case BAND_A | BAND_G | BAND_AN | BAND_GN: case BAND_A | BAND_G | BAND_AN | BAND_GN | BAND_AAC:
mwifiex_dbg(adapter, INFO, "info: infra band=%d\t" "supported_rates_a\n",
adapter->config_bands);
k = mwifiex_copy_rates(rates, k, supported_rates_a, sizeof(supported_rates_a)); break; case BAND_GN:
mwifiex_dbg(adapter, INFO, "info: infra band=%d\t" "supported_rates_n\n",
adapter->config_bands);
k = mwifiex_copy_rates(rates, k, supported_rates_n, sizeof(supported_rates_n)); break;
}
} else { /* Ad-hoc mode */ switch (adapter->adhoc_start_band) { case BAND_B:
mwifiex_dbg(adapter, INFO, "info: adhoc B\n");
k = mwifiex_copy_rates(rates, k, adhoc_rates_b, sizeof(adhoc_rates_b)); break; case BAND_G: case BAND_G | BAND_GN:
mwifiex_dbg(adapter, INFO, "info: adhoc G only\n");
k = mwifiex_copy_rates(rates, k, adhoc_rates_g, sizeof(adhoc_rates_g)); break; case BAND_B | BAND_G: case BAND_B | BAND_G | BAND_GN:
mwifiex_dbg(adapter, INFO, "info: adhoc BG\n");
k = mwifiex_copy_rates(rates, k, adhoc_rates_bg, sizeof(adhoc_rates_bg)); break; case BAND_A: case BAND_A | BAND_AN:
mwifiex_dbg(adapter, INFO, "info: adhoc A\n");
k = mwifiex_copy_rates(rates, k, adhoc_rates_a, sizeof(adhoc_rates_a)); break;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.