Skip to content

Commit 19966ea

Browse files
Update dynamic auto MCS selection logic to align with reference table
- Adjust MCS indices 24 to 31 to match spec table's modulation (BPSK to 64-QAM) and coding rates (1/2 to 5/6). - Revise signal strength thresholds (-45 to -75 dBm) to reflect realistic SNR requirements for each modulation scheme. - Preserve random signal generation logic using rand_int_smooth. - Ensure consistency with the reference table's structure and parameters.
1 parent ee69f9e commit 19966ea

File tree

1 file changed

+33
-15
lines changed

1 file changed

+33
-15
lines changed

vwifi.c

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,7 +1436,6 @@ static int vwifi_get_station(struct wiphy *wiphy,
14361436
* https://semfionetworks.com/blog/mcs-table-updated-with-80211ax-data-rates/
14371437
* IEEE 802.11n : https://zh.wikipedia.org/zh-tw/IEEE_802.11n
14381438
*/
1439-
14401439
/* Check vif->manual_mcs_set to use vif->manual_mcs if set;
14411440
* Assign modulation string for manual MCS ; else auto change based
14421441
* on signal strength
@@ -1489,15 +1488,31 @@ static int vwifi_get_station(struct wiphy *wiphy,
14891488
pr_info("vwifi: Station %pM using manual MCS %d (%s, %s)\n", mac,
14901489
mcs_index, modulation, coding_rate);
14911490
} else {
1492-
if (sinfo->signal > -50) {
1491+
if (sinfo->signal > -45) {
14931492
mcs_index = 31;
14941493
modulation = "64-QAM";
14951494
coding_rate = "5/6";
1496-
} else if (sinfo->signal > -70 && sinfo->signal <= -50) {
1495+
} else if (sinfo->signal > -50 && sinfo->signal <= -45) {
1496+
mcs_index = 30;
1497+
modulation = "64-QAM";
1498+
coding_rate = "3/4";
1499+
} else if (sinfo->signal > -55 && sinfo->signal <= -50) {
1500+
mcs_index = 29;
1501+
modulation = "64-QAM";
1502+
coding_rate = "2/3";
1503+
} else if (sinfo->signal > -60 && sinfo->signal <= -55) {
14971504
mcs_index = 28;
14981505
modulation = "16-QAM";
14991506
coding_rate = "3/4";
1500-
} else if (sinfo->signal > -90 && sinfo->signal <= -70) {
1507+
} else if (sinfo->signal > -65 && sinfo->signal <= -60) {
1508+
mcs_index = 27;
1509+
modulation = "16-QAM";
1510+
coding_rate = "1/2";
1511+
} else if (sinfo->signal > -70 && sinfo->signal <= -65) {
1512+
mcs_index = 26;
1513+
modulation = "QPSK";
1514+
coding_rate = "3/4";
1515+
} else if (sinfo->signal > -75 && sinfo->signal <= -70) {
15011516
mcs_index = 25;
15021517
modulation = "QPSK";
15031518
coding_rate = "1/2";
@@ -2328,23 +2343,26 @@ static struct cfg80211_ops vwifi_cfg_ops = {
23282343
};
23292344

23302345
/* Macro for defining 2GHZ channel array */
2331-
#define CHAN_2GHZ(channel, freq) \
2332-
{ \
2333-
.band = NL80211_BAND_2GHZ, .hw_value = (channel), \
2334-
.center_freq = (freq), \
2346+
#define CHAN_2GHZ(channel, freq) \
2347+
{ \
2348+
.band = NL80211_BAND_2GHZ, \
2349+
.hw_value = (channel), \
2350+
.center_freq = (freq), \
23352351
}
23362352

23372353
/* Macro for defining 5GHZ channel array */
2338-
#define CHAN_5GHZ(channel) \
2339-
{ \
2340-
.band = NL80211_BAND_5GHZ, .hw_value = (channel), \
2341-
.center_freq = 5000 + (5 * (channel)), \
2354+
#define CHAN_5GHZ(channel) \
2355+
{ \
2356+
.band = NL80211_BAND_5GHZ, \
2357+
.hw_value = (channel), \
2358+
.center_freq = 5000 + (5 * (channel)), \
23422359
}
23432360

23442361
/* Macro for defining rate table */
2345-
#define RATE_ENT(_rate, _hw_value) \
2346-
{ \
2347-
.bitrate = (_rate), .hw_value = (_hw_value), \
2362+
#define RATE_ENT(_rate, _hw_value) \
2363+
{ \
2364+
.bitrate = (_rate), \
2365+
.hw_value = (_hw_value), \
23482366
}
23492367

23502368
/* Array of "supported" channels in 2GHz band. It is required for wiphy. */

0 commit comments

Comments
 (0)