[WCNCR00152564] softap: apply cfg80211 setting for P2PGO
[Description]
Change P2PGO bandwidth, secondary channel offset,
channel center frequency segment 0/1
config from cfg80211
refer commit 60c48051cf8e ("[WCNCR00145892] softap:
add BW/SCO/S0/S1 config from cfg80211")
Unit Test:
1. Test p2p GO/softap successful link and ping
with BW/SCO/S0/S1 setting from wifi.cfg and cfg80211.
Change-Id: Ib58232c34d97100194703520cec2360e32f50358
Feature:softap
Signed-off-by: Litien Chang <litien.chang@mediatek.com>
CR-Id: WCNCR00152564
diff --git a/mgmt/cnm.c b/mgmt/cnm.c
index 59931ab..6ebb334 100644
--- a/mgmt/cnm.c
+++ b/mgmt/cnm.c
@@ -926,14 +926,14 @@
if (ucMaxBandwidth > prAdapter->rWifiVar.ucStaBandwidth)
ucMaxBandwidth = prAdapter->rWifiVar.ucStaBandwidth;
} else if (IS_BSS_P2P(prBssInfo)) {
- /* AP mode */
- if (p2pFuncIsAPMode(prAdapter->rWifiVar.prP2PConnSettings[prBssInfo->u4PrivateData])) {
-
- prP2pRoleFsmInfo = p2pFuncGetRoleByBssIdx(prAdapter, ucBssIndex);
- if (!prAdapter->rWifiVar.ucApChnlDefFromCfg && prP2pRoleFsmInfo) {
- prP2pConnReqInfo = &(prP2pRoleFsmInfo->rConnReqInfo);
- ucMaxBandwidth = prP2pConnReqInfo->eChnlBw;
- } else {
+ prP2pRoleFsmInfo = p2pFuncGetRoleByBssIdx(prAdapter, ucBssIndex);
+ if (!prAdapter->rWifiVar.ucApChnlDefFromCfg && prP2pRoleFsmInfo
+ && prBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT) {
+ prP2pConnReqInfo = &(prP2pRoleFsmInfo->rConnReqInfo);
+ ucMaxBandwidth = prP2pConnReqInfo->eChnlBw;
+ } else {
+ /* AP mode */
+ if (p2pFuncIsAPMode(prAdapter->rWifiVar.prP2PConnSettings[prBssInfo->u4PrivateData])) {
if (prBssInfo->eBand == BAND_2G4)
ucMaxBandwidth = prAdapter->rWifiVar.ucAp2gBandwidth;
else
@@ -942,14 +942,16 @@
if (ucMaxBandwidth > prAdapter->rWifiVar.ucApBandwidth)
ucMaxBandwidth = prAdapter->rWifiVar.ucApBandwidth;
}
+ /* P2P mode */
+ else {
+ if (prBssInfo->eBand == BAND_2G4)
+ ucMaxBandwidth = prAdapter->rWifiVar.ucP2p2gBandwidth;
+ else
+ ucMaxBandwidth = prAdapter->rWifiVar.ucP2p5gBandwidth;
+ }
+
}
- /* P2P mode */
- else {
- if (prBssInfo->eBand == BAND_2G4)
- ucMaxBandwidth = prAdapter->rWifiVar.ucP2p2gBandwidth;
- else
- ucMaxBandwidth = prAdapter->rWifiVar.ucP2p5gBandwidth;
- }
+
}
return ucMaxBandwidth;
diff --git a/mgmt/p2p_role_fsm.c b/mgmt/p2p_role_fsm.c
index 3f25764..a7b96dd 100644
--- a/mgmt/p2p_role_fsm.c
+++ b/mgmt/p2p_role_fsm.c
@@ -866,7 +866,8 @@
prP2pConnReqInfo->eConnRequest = P2P_CONNECTION_TYPE_PURE_AP;
/* Overwrite AP channel */
- if (prAdapter->rWifiVar.ucApChannel) {
+ if (prAdapter->rWifiVar.ucApChannel &&
+ prAdapter->rWifiVar.ucApChnlDefFromCfg) {
prP2pConnReqInfo->rChannelInfo.ucChannelNum = prAdapter->rWifiVar.ucApChannel;
if (prAdapter->rWifiVar.ucApChannel <= 14)
diff --git a/os/linux/gl_p2p_cfg80211.c b/os/linux/gl_p2p_cfg80211.c
index 3f5ffaf..d3a82b3 100644
--- a/os/linux/gl_p2p_cfg80211.c
+++ b/os/linux/gl_p2p_cfg80211.c
@@ -1208,6 +1208,7 @@
prWifiVar = &prAdapter->rWifiVar;
if ((prWifiVar->ucApChannel != 0) &&
+ (prWifiVar->ucApChnlDefFromCfg != 0) &&
(prWifiVar->ucApChannel != rRfChnlInfo.ucChannelNum)) {
rRfChnlInfo.ucChannelNum = prWifiVar->ucApChannel;
rRfChnlInfo.eBand =