WifiConnectionManager: Scan timer reconfig connect

When the Wifi network is enabled the connection
manager will trigger a network scan without a
profile to use. If there is a connected network
or attempting a connection, the scan will
interrupt and break the connection.

Fix - The Wifi Connection Manager will register
the scan on timer tick but will not set the timer.
This timer will only be set when the user enters or
selects a profile for connection in the BIOS menu.
If the user does not select a profile there is no
need to start a scan timer. Additionally the scan
on timer tick will check for a profile to connect
and if no profile found then cancel the timer and
exit. When the driver loads it will check for a
profile and if one is found then the scan timer
will be set. If no profile is found then the
driver will not set the scan timer and will
not attempt to scan. This will prevent the
driver from scanning and breaking a connection
if the user does not select a profile.

Signed-off-by: Zachary Clark-Williams <zachary.clark-williams@intel.com>
This commit is contained in:
Zachary Clark-Williams
2025-05-05 09:45:52 -07:00
committed by mergify[bot]
parent 6e2c030d76
commit 8b274d7f21
3 changed files with 35 additions and 6 deletions

View File

@@ -260,7 +260,7 @@ WifiMgrDxeDriverBindingStart (
WiFiProfileSyncProtocol->GetProfile (Nic->ConnectPendingNetwork, Nic->MacAddress);
if (Nic->ConnectPendingNetwork != NULL) {
Status = WifiMgrConnectToNetwork (Nic, Nic->ConnectPendingNetwork);
if (!EFI_ERROR (Status)) {
if (EFI_ERROR (Status)) {
goto ERROR1;
}
@@ -293,9 +293,18 @@ WifiMgrDxeDriverBindingStart (
goto ERROR2;
}
Status = gBS->SetTimer (Nic->TickTimer, TimerPeriodic, EFI_TIMER_PERIOD_MILLISECONDS (500));
if (EFI_ERROR (Status)) {
goto ERROR3;
//
// Connect to profile from last boot if available
//
if ((Nic->CurrentOperateNetwork != NULL) && Nic->CurrentOperateNetwork->IsAvailable) {
Status = gBS->SetTimer (
Nic->TickTimer,
TimerPeriodic,
EFI_TIMER_PERIOD_MILLISECONDS (500)
);
if (EFI_ERROR (Status)) {
goto ERROR3;
}
}
Nic->ConnectState = WifiMgrDisconnected;

View File

@@ -1662,6 +1662,11 @@ WifiMgrDxeHiiConfigAccessCallback (
Private->CurrentNic->HasDisconnectPendingNetwork = TRUE;
}
Status = gBS->SetTimer (Private->CurrentNic->TickTimer, TimerPeriodic, EFI_TIMER_PERIOD_MILLISECONDS (500));
if (EFI_ERROR (Status)) {
gBS->CloseEvent (Private->CurrentNic->TickTimer);
}
break;
case KEY_ENROLL_CA_CERT_CONNECT_NETWORK:
@@ -1913,6 +1918,11 @@ WifiMgrDxeHiiConfigAccessCallback (
}
}
Status = gBS->SetTimer (Private->CurrentNic->TickTimer, TimerPeriodic, EFI_TIMER_PERIOD_MILLISECONDS (500));
if (EFI_ERROR (Status)) {
gBS->CloseEvent (Private->CurrentNic->TickTimer);
}
break;
}
} else if (Action == EFI_BROWSER_ACTION_CHANGED) {

View File

@@ -1177,6 +1177,7 @@ WifiMgrOnConnectFinished (
}
ConfigToken->Nic->ConnectState = WifiMgrConnectedToAp;
gBS->SetTimer (ConfigToken->Nic->TickTimer, TimerCancel, 0);
WifiMgrUpdateConnectMessage (ConfigToken->Nic, TRUE, NULL);
Exit:
@@ -1489,6 +1490,12 @@ WifiMgrOnTimerTick (
}
Nic = (WIFI_MGR_DEVICE_DATA *)Context;
if (Nic->ConnectPendingNetwork == NULL) {
DEBUG ((DEBUG_VERBOSE, "[WiFi Connection Manager] No profile for connection, no scan triggered!\n"));
gBS->SetTimer (Nic->TickTimer, TimerCancel, 0);
return;
}
NET_CHECK_SIGNATURE (Nic, WIFI_MGR_DEVICE_DATA_SIGNATURE);
Status = WifiMgrGetLinkState (Nic, &LinkState);
@@ -1506,8 +1513,11 @@ WifiMgrOnTimerTick (
}
Nic->ScanTickTime++;
if ((((Nic->ScanTickTime > WIFI_SCAN_FREQUENCY) && (Nic->ConnectState != WifiMgrConnectedToAp)) ||
Nic->OneTimeScanRequest) && (Nic->ScanState == WifiMgrScanFinished))
if ((((Nic->ScanTickTime > WIFI_SCAN_FREQUENCY) &&
((Nic->ConnectState != WifiMgrConnectedToAp) &&
(Nic->ConnectState != WifiMgrConnectingToAp))) ||
Nic->OneTimeScanRequest) &&
(Nic->ScanState == WifiMgrScanFinished))
{
Nic->OneTimeScanRequest = FALSE;
Nic->ScanTickTime = 0;