Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iwinfo and mt_wifi add CentralCh Width support #364

Open
wants to merge 6 commits into
base: openwrt-21.02
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

1 change: 1 addition & 0 deletions package/mtk/drivers/mt_wifi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ PKG_KCONFIG:= \
WEXT_PRIV \
WDS_SUPPORT \
MBSS_SUPPORT \
CUSTOMER_VENDOR_IE_SUPPORT \
APCLI_SUPPORT \
APCLI_CERT_SUPPORT \
APCLI_CONNECTION_TRIAL \
Expand Down
6 changes: 6 additions & 0 deletions package/mtk/drivers/mt_wifi/config.in
Original file line number Diff line number Diff line change
Expand Up @@ -1365,6 +1365,12 @@ config MTK_WNM_SUPPORT
depends on MTK_MT_AP_SUPPORT
default n

config MTK_CUSTOMER_VENDOR_IE_SUPPORT
bool "Customer Vendor IE support"
depends on MTK_MT_AP_SUPPORT
# depends on CHIP_MT7663E
default y

config MTK_INTERWORKING
bool "802.11u Interworking"
depends on MTK_MT_AP_SUPPORT
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
--- a/mt_wifi/embedded/include/oid.h
+++ b/mt_wifi/embedded/include/oid.h
@@ -2140,6 +2140,9 @@
#endif /* CONFIG_6G_SUPPORT && BSSMGR_CROSS_MODULE_SUPPORT */
#define OID_802_11_BSS_MGMT_MSG 0x0977

+#define OID_802_11_GET_CENTRAL_CHAN1 0x0978
+#define OID_802_11_GET_CENTRAL_CHAN2 0x0979
+
#ifdef MT_DFS_SUPPORT
#define OID_DFS_ZERO_WAIT 0x0985
#ifdef DFS_ZEROWAIT_SUPPORT
--- a/mt_wifi/embedded/ap/ap_cfg.c
+++ b/mt_wifi/embedded/ap/ap_cfg.c
@@ -12944,6 +12944,70 @@ case OID_802_11_BW:
MTWF_DBG(pAd, DBG_CAT_CFG, DBG_SUBCAT_ALL, DBG_LVL_ERROR, "Invalid wdev for cmd %d\n", cmd);
break;
}
+ case OID_802_11_GET_CENTRAL_CHAN1:
+ {
+ struct wifi_dev *wdev = get_wdev_by_ioctl_idx_and_iftype(pAd, pObj->ioctl_if, pObj->ioctl_if_type);
+ UCHAR ext_cha = wlan_config_get_ext_cha(wdev);
+ UCHAR bw = wlan_operate_get_bw(wdev);
+ UINT8 prim_ch = wdev->channel;
+ UINT8 cent_ch_1 = wlan_operate_get_cen_ch_1(wdev);
+ UINT8 CenCh1 = 0;
+
+ switch (bw) {
+ case BW_20:
+ CenCh1 = prim_ch;
+ break;
+ case BW_40:
+ if ((prim_ch > 2) && (ext_cha == EXTCHA_BELOW)) {
+ if (prim_ch == 14)
+ CenCh1 = prim_ch - 1;
+ else
+ CenCh1 = prim_ch - 2;
+ }
+ else if (ext_cha == EXTCHA_ABOVE)
+ CenCh1 = prim_ch + 2;
+ break;
+ case BW_80:
+ case BW_8080:
+ CenCh1 = cent_ch_1;
+ break;
+ case BW_160:
+ CenCh1 = GET_BW160_PRIM80_CENT(prim_ch, cent_ch_1);
+ break;
+ default:
+ CenCh1 = cent_ch_1;
+ break;
+ }
+
+ MTWF_PRINT("%s : CentralCh1 = %d\n", __func__, CenCh1);
+
+ wrq->u.data.length = sizeof(CenCh1);
+ Status = copy_to_user(wrq->u.data.pointer, &CenCh1, wrq->u.data.length);
+ MTWF_DBG(pAd, DBG_CAT_CFG, DBG_SUBCAT_ALL, DBG_LVL_INFO,
+ "Query::OID_802_11_GET_CENTRAL_CHAN1 CentralCh1 = %d\n", CenCh1);
+ break;
+ }
+ case OID_802_11_GET_CENTRAL_CHAN2:
+ {
+ struct wifi_dev *wdev = get_wdev_by_ioctl_idx_and_iftype(pAd, pObj->ioctl_if, pObj->ioctl_if_type);
+ UCHAR bw = wlan_operate_get_bw(wdev);
+ UINT8 cent_ch_1 = wlan_operate_get_cen_ch_1(wdev);
+ UINT8 cent_ch_2 = wlan_operate_get_cen_ch_2(wdev);
+ UINT8 CenCh2 = 0;
+
+ if (bw == BW_160)
+ CenCh2 = cent_ch_1;
+ else
+ CenCh2 = cent_ch_2;
+
+ MTWF_PRINT("%s : CentralCh2 = %d\n", __func__, CenCh2);
+
+ wrq->u.data.length = sizeof(CenCh2);
+ Status = copy_to_user(wrq->u.data.pointer, &CenCh2, wrq->u.data.length);
+ MTWF_DBG(pAd, DBG_CAT_CFG, DBG_SUBCAT_ALL, DBG_LVL_INFO,
+ "Query::OID_802_11_GET_CENTRAL_CHAN2 CentralCh2 = %d\n", CenCh2);
+ break;
+ }
case OID_802_11_EXTENSION_CHANNEL:
{
UCHAR ext_cha;
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
--- a/mt_wifi/embedded/common/cmm_info.c
+++ b/mt_wifi/embedded/common/cmm_info.c
@@ -6487,12 +6487,8 @@ RTMP_STRING *GetAuthMode(CHAR auth)
3.) UI needs to prepare at least 4096bytes to get the results
==========================================================================
*/
-#define LINE_LEN (4+4+33+20+23+8+9+11+7+3+8+10+8) /* No+Channel+SSID+Bssid+Security+RSSI+Signal+WiressMode+ExtCh+NetworkType+LEN+BcnRept+MWDSCap*/
#ifdef CUSTOMER_VENDOR_IE_SUPPORT
-#ifdef CUSTOMER_MAXBITRATE_SUPPORT
-#define LINE_LEN (4+4+33+20+33+9+11+7+3+10+8+8)
-/* Channel+LEN+SSID+Bssid+Security+Signal+WiressMode+ExtCh+NetworkType*/
-#endif
+#define LINE_LEN (4+4+4+5+33+20+23+8+9+11+7+3+8+9+8+8+8) /* No+Channel+CentralChannel+SecCentralChannel+SSID+Bssid+Security+RSSI+Signal+WiressMode+ExtCh+NetworkType+ht_ch_bandwidth+vht_ch_bandwidth+LEN+BcnRept+MWDSCap*/
#endif
#ifdef CONFIG_STA_SUPPORT
#ifdef WSC_STA_SUPPORT
@@ -6523,6 +6519,20 @@ VOID RTMPCommSiteSurveyData(
MTWF_DBG(NULL, DBG_CAT_AP, DBG_SUBCAT_ALL, DBG_LVL_ERROR, "Snprintf failed!\n");
return;
}
+ /*CentralChannel*/
+ LeftBufSize = MsgLen - strlen(msg);
+ ret = snprintf(msg + strlen(msg), LeftBufSize, "%-4d", pBss->CentralChannel);
+ if (os_snprintf_error(LeftBufSize, ret)) {
+ MTWF_DBG(NULL, DBG_CAT_AP, DBG_SUBCAT_ALL, DBG_LVL_ERROR, "Snprintf failed!\n");
+ return;
+ }
+ /*SecCentralChannel*/
+ LeftBufSize = MsgLen - strlen(msg);
+ ret = snprintf(msg + strlen(msg), LeftBufSize, "%-5d", pBss->SecCentralChannel);
+ if (os_snprintf_error(LeftBufSize, ret)) {
+ MTWF_DBG(NULL, DBG_CAT_AP, DBG_SUBCAT_ALL, DBG_LVL_ERROR, "Snprintf failed!\n");
+ return;
+ }
/*SSID*/
NdisZeroMemory(Ssid, (MAX_LEN_OF_SSID + 1));

@@ -6737,6 +6747,22 @@ VOID RTMPCommSiteSurveyData(
}
}

+ /* ht_ch_bandwidth */
+ LeftBufSize = MsgLen - strlen(msg);
+ ret = snprintf(msg + strlen(msg), LeftBufSize, " %-8d", pBss->CustomerBssEntry.ht_ch_bandwidth);
+ if (os_snprintf_error(LeftBufSize, ret)) {
+ MTWF_DBG(NULL, DBG_CAT_AP, DBG_SUBCAT_ALL, DBG_LVL_ERROR, "Snprintf failed!\n");
+ return;
+ }
+
+ /* vht_ch_bandwidth */
+ LeftBufSize = MsgLen - strlen(msg);
+ ret = snprintf(msg + strlen(msg), LeftBufSize, " %-9d", pBss->CustomerBssEntry.vht_ch_bandwidth);
+ if (os_snprintf_error(LeftBufSize, ret)) {
+ MTWF_DBG(NULL, DBG_CAT_AP, DBG_SUBCAT_ALL, DBG_LVL_ERROR, "Snprintf failed!\n");
+ return;
+ }
+
/* SSID Length */
LeftBufSize = MsgLen - strlen(msg);
ret = snprintf(msg + strlen(msg), LeftBufSize, " %-8d", pBss->SsidLen);
@@ -6913,8 +6939,8 @@ VOID RTMPIoctlGetSiteSurvey(
#else
LeftBufSize = TotalLen - strlen(msg);

- Status = snprintf(msg + strlen(msg), LeftBufSize, "%-4s%-4s%-33s%-20s%-23s%-8s%-9s%-11s%-7s%-3s%-8s\n",
- "No", "Ch", "SSID", "BSSID", "Security", "Rssi", "Siganl(%)", "W-Mode", " ExtCH", " NT", " SSID_Len");
+ Status = snprintf(msg + strlen(msg), LeftBufSize, "%-4s%-4s%-4s%-5s%-33s%-20s%-23s%-8s%-9s%-11s%-7s%-3s%-8s%-9s%-8s\n",
+ "No", "Ch", "CCh", "SCCh", "SSID", "BSSID", "Security", "Rssi", "Siganl(%)", "W-Mode", " ExtCH", " NT", " HT_Width", " VHT_Width", " SSID_Len");

if (os_snprintf_error(LeftBufSize, Status)) {
MTWF_DBG(pAdapter, DBG_CAT_CFG, DBG_SUBCAT_ALL, DBG_LVL_ERROR, "Snprintf failed!\n");
@@ -6930,7 +6956,7 @@ VOID RTMPIoctlGetSiteSurvey(
}
#endif /* WSC_INCLUDED */
LeftBufSize = TotalLen - strlen(msg);
- Status = snprintf(msg + strlen(msg) - 1, LeftBufSize, "%-10s\n", " BcnRept");
+ Status = snprintf(msg + strlen(msg) - 1, LeftBufSize, "%-8s\n", " BcnRept");
if (os_snprintf_error(LeftBufSize, Status)) {
MTWF_DBG(pAdapter, DBG_CAT_CFG, DBG_SUBCAT_ALL, DBG_LVL_ERROR, "Snprintf failed!\n");
goto ERROR;
@@ -6981,7 +7007,8 @@ VOID RTMPIoctlGetSiteSurvey(
if (pBss->Channel == 0)
break;

- if ((strlen(msg) + max_len) >= BufLen)
+ /* get_site_survey cant get more scan result */
+ if ((strlen(msg) + max_len) >= TotalLen)
break;

/*No*/
@@ -7032,39 +7059,39 @@ VOID RTMPIoctlGetSiteSurvey(
}
} else {
LeftBufSize = TotalLen - strlen(msg);
- Status = snprintf(msg + strlen(msg), LeftBufSize, "%-5s", " ");
+ Status = snprintf(msg + strlen(msg), LeftBufSize, "%-5s", " NULL");
if (os_snprintf_error(LeftBufSize, Status)) {
MTWF_DBG(pAdapter, DBG_CAT_CFG, DBG_SUBCAT_ALL, DBG_LVL_ERROR, "Snprintf failed!\n");
goto ERROR;
}
}

#endif /* WSC_INCLUDED */
#ifndef MWDS
LeftBufSize = TotalLen - strlen(msg);
- Status = snprintf(msg + strlen(msg), LeftBufSize, "%-7s\n", pBss->FromBcnReport ? " YES" : " NO");
+ Status = snprintf(msg + strlen(msg), LeftBufSize, "%-8s\n", pBss->FromBcnReport ? " YES" : " NO");
if (os_snprintf_error(LeftBufSize, Status)) {
MTWF_DBG(pAdapter, DBG_CAT_CFG, DBG_SUBCAT_ALL, DBG_LVL_ERROR, "Snprintf failed!\n");
goto ERROR;
}
#else
LeftBufSize = TotalLen - strlen(msg);
- Status = snprintf(msg + strlen(msg), LeftBufSize, "%-7s", pBss->FromBcnReport ? " YES" : " NO");
+ Status = snprintf(msg + strlen(msg), LeftBufSize, "%-8s", pBss->FromBcnReport ? " YES" : " NO");
if (os_snprintf_error(LeftBufSize, Status)) {
MTWF_DBG(pAdapter, DBG_CAT_CFG, DBG_SUBCAT_ALL, DBG_LVL_ERROR, "Snprintf failed!\n");
goto ERROR;
}

if (pBss->bSupportMWDS) {
LeftBufSize = TotalLen - strlen(msg);
- Status = snprintf(msg + strlen(msg), LeftBufSize, "%-4s\n", " YES");
+ Status = snprintf(msg + strlen(msg), LeftBufSize, "%-8s\n", " YES");
if (os_snprintf_error(LeftBufSize, Status)) {
MTWF_DBG(pAdapter, DBG_CAT_CFG, DBG_SUBCAT_ALL, DBG_LVL_ERROR, "Snprintf failed!\n");
goto ERROR;
}
} else {
LeftBufSize = TotalLen - strlen(msg);
- Status = snprintf(msg + strlen(msg), LeftBufSize, "%-4s\n", " NO");
+ Status = snprintf(msg + strlen(msg), LeftBufSize, "%-8s\n", " NO");
if (os_snprintf_error(LeftBufSize, Status)) {
MTWF_DBG(pAdapter, DBG_CAT_CFG, DBG_SUBCAT_ALL, DBG_LVL_ERROR, "Snprintf failed!\n");
goto ERROR;
--- a/mt_wifi/os/linux/ap_ioctl.c
+++ b/mt_wifi/os/linux/ap_ioctl.c
@@ -482,7 +482,7 @@ struct iw_priv_args ap_priv_tab[] = {
},
{
RTPRIV_IOCTL_GSITESURVEY,
- IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | 1024,
+ IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK,
"get_site_survey"
},
{
Loading