* [PATCH v2 1/2] station: start roam on beacon loss event
@ 2023-11-07 14:11 James Prestwood
2023-11-07 14:11 ` [PATCH v2 2/2] netdev: handle/send " James Prestwood
2023-11-07 15:45 ` [PATCH v2 1/2] station: start roam on " Denis Kenzior
0 siblings, 2 replies; 3+ messages in thread
From: James Prestwood @ 2023-11-07 14:11 UTC (permalink / raw)
To: iwd; +Cc: James Prestwood
Beacon loss handling was removed in the past because it was
determined that this even always resulted in a disconnect. This
was short sighted and not always true. The default kernel behavior
waits for 7 lost beacons before emitting this event, then sends
either a few nullfuncs or probe requests to the BSS to determine
if its really gone. If these come back successfully the connection
will remain alive. This can give IWD some time to roam in some
cases so we should be handling this event.
Since beacon loss indicates a very poor connection the roam scan
is delayed by a few seconds in order to give the kernel a chance
to send the nullfuncs/probes or receive more beacons. This may
result in a disconnect, but it would have happened anyways.
Attempting a roam mainly handles the case when the connection can
be maintained after beacon loss, but is still poor.
---
src/netdev.h | 1 +
src/station.c | 18 ++++++++++++++++++
2 files changed, 19 insertions(+)
v2:
* Delay the roam to give the kernel a chance to salvage the
connection
FYI, I did attempt to add back the beacon loss test without much
luck. Blocking beacons with hwsim did not result in a beacon loss
event which may have been one of the reasons it was removed in the
first place. Even blocking _all_ frames doesn't result in an event
but instead just a local disconnect.
After looking more into it I see that actually only a few drivers
even use ieee80211_beacon_loss/ieee80211_connection_loss:
iwlwifi,wl1251,intersil,mt76,wfx,ath10/11k,wcn36xx
Every other driver likely disconnects rather than attempts to
handle beacon loss. So probably for the majority of users this
actually didn't matter, but for these drivers it does make sense
to handle the event.
diff --git a/src/netdev.h b/src/netdev.h
index 73d38c32..f27130f1 100644
--- a/src/netdev.h
+++ b/src/netdev.h
@@ -51,6 +51,7 @@ enum netdev_event {
NETDEV_EVENT_RSSI_LEVEL_NOTIFY,
NETDEV_EVENT_PACKET_LOSS_NOTIFY,
NETDEV_EVENT_FT_ROAMED,
+ NETDEV_EVENT_BEACON_LOSS_NOTIFY,
};
enum netdev_watch_event {
diff --git a/src/station.c b/src/station.c
index 5a202ebd..c3f26b5a 100644
--- a/src/station.c
+++ b/src/station.c
@@ -3370,6 +3370,21 @@ static void station_packets_lost(struct station *station, uint32_t num_pkts)
station_start_roam(station);
}
+static void station_beacon_lost(struct station *station)
+{
+ l_debug("Beacon lost event");
+
+ if (station_cannot_roam(station))
+ return;
+
+ station_debug_event(station, "beacon-loss-roam");
+
+ if (station->roam_trigger_timeout)
+ return;
+
+ station_roam_timeout_rearm(station, LOSS_ROAM_RATE_LIMIT);
+}
+
static void station_netdev_event(struct netdev *netdev, enum netdev_event event,
void *event_data, void *user_data)
{
@@ -3414,6 +3429,9 @@ static void station_netdev_event(struct netdev *netdev, enum netdev_event event,
station_roamed(station);
break;
+ case NETDEV_EVENT_BEACON_LOSS_NOTIFY:
+ station_beacon_lost(station);
+ break;
}
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH v2 2/2] netdev: handle/send beacon loss event
2023-11-07 14:11 [PATCH v2 1/2] station: start roam on beacon loss event James Prestwood
@ 2023-11-07 14:11 ` James Prestwood
2023-11-07 15:45 ` [PATCH v2 1/2] station: start roam on " Denis Kenzior
1 sibling, 0 replies; 3+ messages in thread
From: James Prestwood @ 2023-11-07 14:11 UTC (permalink / raw)
To: iwd; +Cc: James Prestwood
---
src/netdev.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/netdev.c b/src/netdev.c
index 56c6ebd2..86712658 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -1054,6 +1054,7 @@ static void netdev_cqm_event(struct l_genl_msg *msg, struct netdev *netdev)
uint32_t *rssi_event = NULL;
int32_t *rssi_val = NULL;
uint32_t *pkt_event = NULL;
+ bool beacon_loss = false;
if (!l_genl_attr_init(&attr, msg))
return;
@@ -1081,7 +1082,7 @@ static void netdev_cqm_event(struct l_genl_msg *msg, struct netdev *netdev)
break;
case NL80211_ATTR_CQM_BEACON_LOSS_EVENT:
- l_debug("Beacon lost event");
+ beacon_loss = true;
break;
case NL80211_ATTR_CQM_RSSI_LEVEL:
@@ -1111,6 +1112,9 @@ static void netdev_cqm_event(struct l_genl_msg *msg, struct netdev *netdev)
} else if (pkt_event && netdev->event_filter)
netdev->event_filter(netdev, NETDEV_EVENT_PACKET_LOSS_NOTIFY,
pkt_event, netdev->user_data);
+ else if (beacon_loss && netdev->event_filter)
+ netdev->event_filter(netdev, NETDEV_EVENT_BEACON_LOSS_NOTIFY,
+ NULL, netdev->user_data);
}
static void netdev_rekey_offload_event(struct l_genl_msg *msg,
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2 1/2] station: start roam on beacon loss event
2023-11-07 14:11 [PATCH v2 1/2] station: start roam on beacon loss event James Prestwood
2023-11-07 14:11 ` [PATCH v2 2/2] netdev: handle/send " James Prestwood
@ 2023-11-07 15:45 ` Denis Kenzior
1 sibling, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2023-11-07 15:45 UTC (permalink / raw)
To: James Prestwood, iwd
Hi James,
On 11/7/23 08:11, James Prestwood wrote:
> Beacon loss handling was removed in the past because it was
> determined that this even always resulted in a disconnect. This
> was short sighted and not always true. The default kernel behavior
> waits for 7 lost beacons before emitting this event, then sends
> either a few nullfuncs or probe requests to the BSS to determine
> if its really gone. If these come back successfully the connection
> will remain alive. This can give IWD some time to roam in some
> cases so we should be handling this event.
>
> Since beacon loss indicates a very poor connection the roam scan
> is delayed by a few seconds in order to give the kernel a chance
> to send the nullfuncs/probes or receive more beacons. This may
> result in a disconnect, but it would have happened anyways.
> Attempting a roam mainly handles the case when the connection can
> be maintained after beacon loss, but is still poor.
> ---
> src/netdev.h | 1 +
> src/station.c | 18 ++++++++++++++++++
> 2 files changed, 19 insertions(+)
>
> v2:
> * Delay the roam to give the kernel a chance to salvage the
> connection
>
> FYI, I did attempt to add back the beacon loss test without much
> luck. Blocking beacons with hwsim did not result in a beacon loss
> event which may have been one of the reasons it was removed in the
> first place. Even blocking _all_ frames doesn't result in an event
> but instead just a local disconnect.
Good info, thanks for doing this. Guess we'll have to rely on manual testing
for this feature. :(
>
> After looking more into it I see that actually only a few drivers
> even use ieee80211_beacon_loss/ieee80211_connection_loss:
>
> iwlwifi,wl1251,intersil,mt76,wfx,ath10/11k,wcn36xx
>
> Every other driver likely disconnects rather than attempts to
> handle beacon loss. So probably for the majority of users this
> actually didn't matter, but for these drivers it does make sense
> to handle the event.
>
All applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-07 15:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-07 14:11 [PATCH v2 1/2] station: start roam on beacon loss event James Prestwood
2023-11-07 14:11 ` [PATCH v2 2/2] netdev: handle/send " James Prestwood
2023-11-07 15:45 ` [PATCH v2 1/2] station: start roam on " Denis Kenzior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox