mt_wifi: fix shortgi for HTTRANSMIT_SETTING struct for HE phy mode

luci-app-mtk: fix stainfo GI for HE phy mode
This commit is contained in:
hanwckf
2023-08-25 12:07:07 +08:00
parent e3667d1125
commit bf8be02de8
4 changed files with 66 additions and 6 deletions

View File

@@ -281,11 +281,11 @@ local chipname
//TxRate
td_cell = tr_row.insertCell(-1);
td_cell.innerHTML = sta_list[i].TxRate + "Mbps," + sta_list[i].Bw+ "MHz" + "<br>" + sta_list[i].PhyMode + ", " + sta_list[i].Mcs + ", " + sta_list[i].Gi + "GI";
td_cell.innerHTML = sta_list[i].TxRate + "Mbps," + sta_list[i].Bw+ "MHz" + "<br>" + sta_list[i].PhyMode + ", " + sta_list[i].Mcs + ", " + sta_list[i].Gi;
//RxRate
td_cell = tr_row.insertCell(-1);
td_cell.innerHTML = sta_list[i].RxRate + "Mbps," + sta_list[i].LastBw + "MHz" + "<br>" + sta_list[i].LastPhyMode + ", " + sta_list[i].LastMcs + ", " + sta_list[i].LastGi + "GI";
td_cell.innerHTML = sta_list[i].RxRate + "Mbps," + sta_list[i].LastBw + "MHz" + "<br>" + sta_list[i].LastPhyMode + ", " + sta_list[i].LastMcs + ", " + sta_list[i].LastGi;
td_cell = tr_row.insertCell(-1);
td_cell.innerHTML = sta_list[i].Hr + ":" + sta_list[i].Min + ":" + sta_list[i].Sec;

View File

@@ -358,7 +358,18 @@ int StaInfo(lua_State *L)
}
//TX SGI
snprintf(tmpBuff, sizeof(tmpBuff), "%c", TxRate.field.ShortGI ? 'S': 'L');
if (TxRate.field.MODE < MODE_HTMIX) {
snprintf(tmpBuff, sizeof(tmpBuff), "%s", "LGI");
} else if (TxRate.field.MODE >= MODE_HE) {
if (TxRate.field.ShortGI == 0)
snprintf(tmpBuff, sizeof(tmpBuff), "%s", "SGI");
else if (TxRate.field.ShortGI == 1)
snprintf(tmpBuff, sizeof(tmpBuff), "%s", "MGI");
else if (TxRate.field.ShortGI == 2)
snprintf(tmpBuff, sizeof(tmpBuff), "%s", "LGI");
} else {
snprintf(tmpBuff, sizeof(tmpBuff), "%s", TxRate.field.ShortGI ? "SGI" : "LGI");
}
lua_pushstring(L, tmpBuff);
lua_setfield(L, -2, "Gi");
@@ -461,7 +472,18 @@ int StaInfo(lua_State *L)
lua_setfield(L, -2, "LastBw");
}
snprintf(tmpBuff, sizeof(tmpBuff), "%c", RxRate.field.ShortGI ? 'S': 'L');
if (RxRate.field.MODE < MODE_HTMIX) {
snprintf(tmpBuff, sizeof(tmpBuff), "%s", "LGI");
} else if (RxRate.field.MODE >= MODE_HE) {
if (RxRate.field.ShortGI == 0)
snprintf(tmpBuff, sizeof(tmpBuff), "%s", "SGI");
else if (RxRate.field.ShortGI == 1)
snprintf(tmpBuff, sizeof(tmpBuff), "%s", "MGI");
else if (RxRate.field.ShortGI == 2)
snprintf(tmpBuff, sizeof(tmpBuff), "%s", "LGI");
} else {
snprintf(tmpBuff, sizeof(tmpBuff), "%s", RxRate.field.ShortGI ? "SGI" : "LGI");
}
lua_pushstring(L, tmpBuff);
lua_setfield(L, -2, "LastGi");

View File

@@ -19,7 +19,7 @@ typedef union _HTTRANSMIT_SETTING_FIX {
USHORT MCS:6;
USHORT ldpc:1;
USHORT BW:2;
USHORT ShortGI:1;
USHORT ShortGI:2;
USHORT STBC:1;
USHORT eTxBF:1;
USHORT iTxBF:1;
@@ -126,4 +126,4 @@ void getRate(HTTRANSMIT_SETTING_FIX HTSetting, ULONG *fLastTxRxRate);
void get_rate_he(UINT8 mcs, UINT8 bw, UINT8 nss, UINT8 dcm, ULONG *last_tx_rate);
UINT32 cck_to_mcs(UINT32 mcs);
#endif
#endif

View File

@@ -0,0 +1,38 @@
--- a/mt_wifi/embedded/common/cmm_info.c 2023-08-25 11:12:38.595484902 +0800
+++ b/mt_wifi/embedded/common/cmm_info.c 2023-08-25 11:14:03.403925229 +0800
@@ -6995,7 +6995,7 @@ typedef union _HTTRANSMIT_SETTING_FIX {
USHORT iTxBF:1;
USHORT eTxBF:1;
USHORT STBC:1; /* only support in HT/VHT mode with MCS0~7 */
- USHORT ShortGI:1; /* TBD: need to extend to 2 bits for HE GI */
+ USHORT ShortGI:2;
USHORT BW:2; /* channel bandwidth 20MHz/40/80 MHz */
USHORT ldpc:1;
USHORT MCS:6; /* MCS */
@@ -7005,7 +7005,7 @@ typedef union _HTTRANSMIT_SETTING_FIX {
USHORT MCS:6;
USHORT ldpc:1;
USHORT BW:2;
- USHORT ShortGI:1;
+ USHORT ShortGI:2;
USHORT STBC:1;
USHORT eTxBF:1;
USHORT iTxBF:1;
@@ -7059,7 +7059,7 @@ UINT32 RTMPGetLastTxRate_fix(PRTMP_ADAPT
lastTxRate.field.MODE = phy_mode;
lastTxRate.field.BW = rTxStatResult.rEntryTxRate.BW;
lastTxRate.field.ldpc = rTxStatResult.rEntryTxRate.ldpc ? 1 : 0;
- lastTxRate.field.ShortGI = rTxStatResult.rEntryTxRate.ShortGI ? 1 : 0;
+ lastTxRate.field.ShortGI = rTxStatResult.rEntryTxRate.ShortGI & 0x3;
lastTxRate.field.STBC = rTxStatResult.rEntryTxRate.STBC;
if (lastTxRate.field.MODE >= MODE_VHT)
@@ -7088,7 +7088,7 @@ UINT32 RTMPGetLastRxRate(PRTMP_ADAPTER p
lastRxRate.field.MODE = rRxStatResult.u1RxMode;
lastRxRate.field.BW = rRxStatResult.u1BW;
lastRxRate.field.ldpc = rRxStatResult.u1Coding;
- lastRxRate.field.ShortGI = rRxStatResult.u1Gi ? 1 : 0;
+ lastRxRate.field.ShortGI = rRxStatResult.u1Gi & 0x3;
lastRxRate.field.STBC = rRxStatResult.u1Stbc;
if (lastRxRate.field.MODE >= MODE_VHT)