/* ========================================================================== Description: Set Wireless Mode for MBSS Return: TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ INT RT_CfgSetMbssWirelessMode(RTMP_ADAPTER *pAd, PSTRING arg) { INT cfg_mode; UCHAR wmode; RTMP_CHIP_CAP *pChipCap = &pAd->chipCap; cfg_mode = simple_strtol(arg, 0, 10); wmode = cfgmode_2_wmode((UCHAR)cfg_mode); if ((wmode == WMODE_INVALID) || (!wmode_valid(pAd, wmode))) { DBGPRINT(RT_DEBUG_ERROR, ("%s(): Invalid wireless mode(%d, wmode=0x%x), ChipCap(%s)\n", __FUNCTION__, cfg_mode, wmode, BAND_STR[pAd->chipCap.phy_caps & 0x3])); return FALSE; } if (WMODE_CAP_5G(wmode) && WMODE_CAP_2G(wmode)) { DBGPRINT(RT_DEBUG_ERROR, ("AP cannot support 2.4G/5G band mxied mode!\n")); return FALSE; } #if defined(MT76x2) && defined(DOT11_VHT_AC) if (pChipCap->ac_off_mode && WMODE_CAP_AC(wmode)) { DBGPRINT(RT_DEBUG_ERROR, ("it doesn't support VHT AC!\n")); wmode &= ~(WMODE_AC); } #endif /* MT76x2 */ if (pAd->ApCfg.BssidNum > 1) { /* pAd->CommonCfg.PhyMode = maximum capability of all MBSS */ if (wmode_band_equal(pAd->CommonCfg.PhyMode, wmode) == TRUE) { wmode = RT_CfgMbssWirelessModeMaxGet(pAd); DBGPRINT(RT_DEBUG_TRACE, ("mbss> Maximum phy mode = %d!\n", wmode)); } else { UINT32 IdBss; /* replace all phy mode with the one with different band */ DBGPRINT(RT_DEBUG_TRACE, ("mbss> Different band with the current one!\n")); DBGPRINT(RT_DEBUG_TRACE, ("mbss> Reset band of all BSS to the new one!\n")); for(IdBss=0; IdBss<pAd->ApCfg.BssidNum; IdBss++) pAd->ApCfg.MBSSID[IdBss].wdev.PhyMode = wmode; } } pAd->CommonCfg.PhyMode = wmode; pAd->CommonCfg.cfg_wmode = wmode; return TRUE; }
/* ========================================================================== Description: Set Wireless Mode Return: TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ INT RT_CfgSetWirelessMode(RTMP_ADAPTER *pAd, PSTRING arg) { LONG cfg_mode; UCHAR wmode, *mode_str; cfg_mode = simple_strtol(arg, 0, 10); /* check if chip support 5G band when WirelessMode is 5G band */ wmode = cfgmode_2_wmode((UCHAR)cfg_mode); if ((wmode == WMODE_INVALID) || (!wmode_valid_and_correct(pAd, &wmode))) { DBGPRINT(RT_DEBUG_ERROR, ("%s(): Invalid wireless mode(%ld), ChipCap(%s)\n", __FUNCTION__, cfg_mode, BAND_STR[pAd->chipCap.phy_caps & 0x3])); return FALSE; } if (wmode_band_equal(pAd->CommonCfg.PhyMode, wmode) == TRUE) DBGPRINT(RT_DEBUG_OFF, ("wmode_band_equal(): Band Equal!\n")); else DBGPRINT(RT_DEBUG_OFF, ("wmode_band_equal(): Band Not Equal!\n")); pAd->CommonCfg.PhyMode = wmode; pAd->CommonCfg.cfg_wmode = wmode; mode_str = wmode_2_str(wmode); if (mode_str) { DBGPRINT(RT_DEBUG_TRACE, ("%s(): Set WMODE=%s(0x%x)\n", __FUNCTION__, mode_str, wmode)); os_free_mem(NULL, mode_str); } return TRUE; }
/* ========================================================================== Description: Set Wireless Mode Return: TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ INT RT_CfgSetWirelessMode(RTMP_ADAPTER *pAd, PSTRING arg) { LONG cfg_mode; UCHAR wmode, *mode_str; RTMP_CHIP_CAP *pChipCap = &pAd->chipCap; cfg_mode = simple_strtol(arg, 0, 10); /* check if chip support 5G band when WirelessMode is 5G band */ wmode = cfgmode_2_wmode((UCHAR)cfg_mode); if ((wmode == WMODE_INVALID) || (!wmode_valid(pAd, wmode))) { DBGPRINT(RT_DEBUG_ERROR, ("%s(): Invalid wireless mode(%ld, wmode=0x%x), ChipCap(%s)\n", __FUNCTION__, cfg_mode, wmode, BAND_STR[pAd->chipCap.phy_caps & 0x3])); return FALSE; } #if defined(MT76x2) && defined(DOT11_VHT_AC) if (pChipCap->ac_off_mode && WMODE_CAP_AC(wmode)) { DBGPRINT(RT_DEBUG_ERROR, ("it doesn't support VHT AC!\n")); wmode &= ~(WMODE_AC); } #endif /* MT76x2 */ if (wmode_band_equal(pAd->CommonCfg.PhyMode, wmode) == TRUE) DBGPRINT(RT_DEBUG_OFF, ("wmode_band_equal(): Band Equal!\n")); else DBGPRINT(RT_DEBUG_OFF, ("wmode_band_equal(): Band Not Equal!\n")); pAd->CommonCfg.PhyMode = wmode; pAd->CommonCfg.cfg_wmode = wmode; mode_str = wmode_2_str(wmode); if (mode_str) { DBGPRINT(RT_DEBUG_TRACE, ("%s(): Set WMODE=%s(0x%x)\n", __FUNCTION__, mode_str, wmode)); os_free_mem(NULL, mode_str); } return TRUE; }