@@ -1346,6 +1346,7 @@ static int vwifi_get_station(struct wiphy *wiphy,
1346
1346
struct station_info * sinfo )
1347
1347
{
1348
1348
struct vwifi_vif * vif = ndev_get_vwifi_vif (dev );
1349
+
1349
1350
bool found_sta = false;
1350
1351
switch (dev -> ieee80211_ptr -> iftype ) {
1351
1352
case NL80211_IFTYPE_AP :;
@@ -1403,8 +1404,6 @@ static int vwifi_get_station(struct wiphy *wiphy,
1403
1404
sinfo -> tx_failed = vif -> stats .tx_dropped ;
1404
1405
sinfo -> tx_bytes = vif -> stats .tx_bytes ;
1405
1406
sinfo -> rx_bytes = vif -> stats .rx_bytes ;
1406
-
1407
-
1408
1407
/* Log byte counters for debugging */
1409
1408
pr_info (
1410
1409
"vwifi: Station %pM tx_bytes %llu, rx_bytes %llu, tx_packets %u, "
@@ -1435,55 +1434,78 @@ static int vwifi_get_station(struct wiphy *wiphy,
1435
1434
* https://semfionetworks.com/blog/mcs-table-updated-with-80211ax-data-rates/
1436
1435
* IEEE 802.11n : https://zh.wikipedia.org/zh-tw/IEEE_802.11n
1437
1436
*/
1438
-
1439
-
1440
-
1441
1437
/* Checks vif->manual_mcs_set to use vif->manual_mcs if set;
1442
- * Assigns modulation string for manual MCS ; else auto change based
1438
+ * Assign modulation string for manual MCS ; else auto change based
1443
1439
* on signal strength
1444
1440
*/
1445
1441
int mcs_index ;
1446
1442
const char * modulation ;
1443
+ const char * coding_rate ;
1447
1444
if (vif -> manual_mcs_set ) {
1448
1445
mcs_index = vif -> manual_mcs ;
1449
1446
switch (mcs_index ) {
1450
- case 7 :
1447
+ case 24 :
1451
1448
modulation = "BPSK" ;
1449
+ coding_rate = "1/2" ;
1450
+ break ;
1451
+ case 25 :
1452
+ modulation = "QPSK" ;
1453
+ coding_rate = "1/2" ;
1452
1454
break ;
1453
- case 15 :
1455
+ case 26 :
1454
1456
modulation = "QPSK" ;
1457
+ coding_rate = "3/4" ;
1458
+ break ;
1459
+ case 27 :
1460
+ modulation = "16-QAM" ;
1461
+ coding_rate = "1/2" ;
1455
1462
break ;
1456
- case 23 :
1463
+ case 28 :
1457
1464
modulation = "16-QAM" ;
1465
+ coding_rate = "3/4" ;
1466
+ break ;
1467
+ case 29 :
1468
+ modulation = "64-QAM" ;
1469
+ coding_rate = "2/3" ;
1470
+ break ;
1471
+ case 30 :
1472
+ modulation = "64-QAM" ;
1473
+ coding_rate = "3/4" ;
1458
1474
break ;
1459
1475
case 31 :
1460
1476
modulation = "64-QAM" ;
1477
+ coding_rate = "5/6" ;
1461
1478
break ;
1462
1479
default :
1463
- modulation = "Unknown" ;
1480
+ pr_err ("vwifi: Unsupported MCS index %d\n" , mcs_index );
1481
+ mcs_index = 24 ; /* Default to lowest 4-stream MCS */
1482
+ modulation = "BPSK" ;
1483
+ coding_rate = "1/2" ;
1464
1484
break ;
1465
1485
}
1466
- pr_info ("vwifi: Station %pM using manual MCS %d (%s)\n" , mac , mcs_index ,
1467
- modulation );
1486
+ pr_info ("vwifi: Station %pM using manual MCS %d (%s, %s )\n" , mac ,
1487
+ mcs_index , modulation , coding_rate );
1468
1488
} else {
1469
1489
if (sinfo -> signal > -50 ) {
1470
1490
mcs_index = 31 ;
1471
1491
modulation = "64-QAM" ;
1492
+ coding_rate = "5/6" ;
1472
1493
} else if (sinfo -> signal > -70 && sinfo -> signal <= -50 ) {
1473
- mcs_index = 23 ;
1494
+ mcs_index = 28 ;
1474
1495
modulation = "16-QAM" ;
1496
+ coding_rate = "3/4" ;
1475
1497
} else if (sinfo -> signal > -90 && sinfo -> signal <= -70 ) {
1476
- mcs_index = 15 ;
1498
+ mcs_index = 25 ;
1477
1499
modulation = "QPSK" ;
1500
+ coding_rate = "1/2" ;
1478
1501
} else {
1479
- mcs_index = 7 ;
1502
+ mcs_index = 24 ;
1480
1503
modulation = "BPSK" ;
1504
+ coding_rate = "1/2" ;
1481
1505
}
1482
- pr_info (
1483
- "vwifi: Station %pM signal %d dBm, using modulation %s (MCS %d)\n" ,
1484
- mac , sinfo -> signal , modulation , mcs_index );
1506
+ pr_info ("vwifi: Station %pM signal %d dBm, using MCS %d (%s, %s)\n" ,
1507
+ mac , sinfo -> signal , mcs_index , modulation , coding_rate );
1485
1508
}
1486
-
1487
1509
/* Configure RX and TX rates */
1488
1510
sinfo -> rxrate .flags = RATE_INFO_FLAGS_MCS ;
1489
1511
sinfo -> rxrate .mcs = mcs_index ;
@@ -1498,9 +1520,9 @@ static int vwifi_get_station(struct wiphy *wiphy,
1498
1520
/* Log rate configuration for verification */
1499
1521
pr_info ("vwifi: Station %pM txrate MCS %d, rxrate MCS %d\n" , mac ,
1500
1522
sinfo -> txrate .mcs , sinfo -> rxrate .mcs );
1501
-
1502
1523
return 0 ;
1503
1524
}
1525
+
1504
1526
/* dump station callback -- resume dump at index @idx */
1505
1527
static int vwifi_dump_station (struct wiphy * wiphy ,
1506
1528
struct net_device * dev ,
@@ -2262,8 +2284,8 @@ static int vwifi_set_bitrate_mask(struct wiphy *wiphy,
2262
2284
return - EINVAL ;
2263
2285
}
2264
2286
2265
- if ( mcs_index != 7 && mcs_index != 15 && mcs_index != 23 &&
2266
- mcs_index != 31 ) {
2287
+ /* Restrict to supported 4-stream MCS indices 24–31 */
2288
+ if ( mcs_index < 24 || mcs_index > 31 ) {
2267
2289
pr_err ("vwifi: Unsupported MCS index %d\n" , mcs_index );
2268
2290
return - EINVAL ;
2269
2291
}
@@ -2316,15 +2338,14 @@ static struct cfg80211_ops vwifi_cfg_ops = {
2316
2338
.center_freq = 5000 + (5 * (channel)), \
2317
2339
}
2318
2340
2319
-
2320
2341
/* Macro for defining rate table */
2321
2342
#define RATE_ENT (_rate , _hw_value ) \
2322
2343
{ \
2323
2344
.bitrate = (_rate), .hw_value = (_hw_value), \
2324
2345
}
2325
2346
2326
2347
/* Array of "supported" channels in 2GHz band. It is required for wiphy. */
2327
- static struct ieee80211_channel vwifi_supported_channels_2ghz [] = {
2348
+ static const struct ieee80211_channel vwifi_supported_channels_2ghz [] = {
2328
2349
CHAN_2GHZ (1 , 2412 ), CHAN_2GHZ (2 , 2417 ), CHAN_2GHZ (3 , 2422 ),
2329
2350
CHAN_2GHZ (4 , 2427 ), CHAN_2GHZ (5 , 2432 ), CHAN_2GHZ (6 , 2437 ),
2330
2351
CHAN_2GHZ (7 , 2442 ), CHAN_2GHZ (8 , 2447 ), CHAN_2GHZ (9 , 2452 ),
@@ -2347,13 +2368,14 @@ static const struct ieee80211_channel vwifi_supported_channels_5ghz[] = {
2347
2368
/* Array of supported rates, required to support those next rates
2348
2369
* for 2GHz and 5GHz band.
2349
2370
*/
2350
- static struct ieee80211_rate vwifi_supported_rates [] = {
2371
+ static const struct ieee80211_rate vwifi_supported_rates [] = {
2351
2372
RATE_ENT (10 , 0x1 ), RATE_ENT (20 , 0x2 ), RATE_ENT (55 , 0x4 ),
2352
2373
RATE_ENT (110 , 0x8 ), RATE_ENT (60 , 0x10 ), RATE_ENT (90 , 0x20 ),
2353
2374
RATE_ENT (120 , 0x40 ), RATE_ENT (180 , 0x80 ), RATE_ENT (240 , 0x100 ),
2354
2375
RATE_ENT (360 , 0x200 ), RATE_ENT (480 , 0x400 ), RATE_ENT (540 , 0x800 ),
2355
2376
};
2356
2377
2378
+ /* Describes supported band of 2GHz. */
2357
2379
static struct ieee80211_supported_band nf_band_2ghz = {
2358
2380
.band = NL80211_BAND_2GHZ ,
2359
2381
.channels = vwifi_supported_channels_2ghz ,
0 commit comments