Post by @rqm

On #OpenBSD when connected to the WiFi mesh at home (eero) and move from room to room the connection gets dropped. My workaround is to do a card reset (ifconfing up / down / netstart) and let it reassociate but is there a "proper" solution this? (card is `bwfm`) Same SSID broadcasted by many BSSID's, both 2.4 and 5ghz.

Replying to @rqm
Stefan Sperling
@stsp @bsd.network

@rqm It looks like the device can send roaming events (BWFM_E_ROAM) but the driver ignores them and doesn't enable this feature.

Replying to @stsp@bsd.network

@stsp@bsd.network I had a glance at the drivers in Linux and BSD and this is way beyond me. I see you worked on roaming stuff in qw{z,x} recently; would it be possible to lift into bwfm whatever you implemented? Or is the behaviour / code just too different?

Replying to @rqm
Stefan Sperling
@stsp @bsd.network

@rqm it is entirely different because the broadcom devices run their own WiFi stack internally. The net80211 code is barely involved

Replying to @stsp@bsd.network
Stefan Sperling
@stsp @bsd.network
Public en edited

@rqm What you probably need to do is go into bwfm_rx_event_cb() and add cases for BWFM_E_ROAM_PREP and BWFM_E_ROAM (see bwfmreg.h for where these macros come from).

I guess these events are letting the driver know which AP / channel the device has switched to. Linux updates its wifi-stack data structures in bcrmfmac/cfg80211.c:brcmf_bss_roaming_done() by reading info from the E_ROAM device event data structure.

Another piece of the puzzle is making sure that such events get generated. Linux seems to be doing this in brcmf_dongle_roam() (in the same file) by setting the "bcn_timeout" device parameter to a magic value named something_ROAM_ON in their code. In bwfm we don't set this parameter yet, at least I cannot find it with a simple grep.

Not sure if this is the complete picture. If you can get to the point where you see an event fire in a printf, you're basically done with the hardest part already.

Replying to @stsp@bsd.network
Stefan Sperling
@stsp @bsd.network

@rqm There is also a "roam_off" parameter being set to "on" or "off" just a few lines below the "bcn_timeout" one.

Replying to @stsp@bsd.network
Stefan Sperling
@stsp @bsd.network
Public en edited

@rqm This device just takes commands as strings, like a shell. Can't be that hard?

Replying to @stsp@bsd.network

@stsp@bsd.network Looking at the code I am wondering whether adding BWFM_E_ROAMING to the _E_DEAUTH/E_DISASSOC fallthrough might be a simple hack? Let it start scanning?

Replying to @rqm
Stefan Sperling
@stsp @bsd.network

@rqm It would work as a proof of concept of processing the roaming event. Avoiding the scan loop is the end goal because that way the link stays up and connections don't die.

Replying to @stsp@bsd.network
Stefan Sperling
@stsp @bsd.network

@rqm In case it helps, here is a port of the function which enables roaming on Linux which you can drop into bwfm.c as a starting point: liam.stsp.name/files/bwfm_dong

Replying to @stsp@bsd.network

@stsp@bsd.network Here's where I got to. Kernel build fails tho because of something complaining in pipex.o. (I am fetching -current from cvs as I'm on -current).

https://git.sr.ht/~rqm/bwfm-hack/tree/main/item/bwfm.diff