Hi all,

I am trying to understand parts of the net80211 subsystem and currently looking 
through ic->ic_parent. Please confirm my understanding of how ieee80211com's 
ic_parent handler is implemented by various drivers.

When is ic_parent run:
* This function is called when the device goes up or down. From user-space, 
this would be like running `ifconfig wlan0 up` or `ifconfig wlan0 down`. The 
parent is the function `parent_updown`.

Early Exit condition:
* There is a detach if-condition that quickly exits. The exact check for this 
is different per driver (sc->sc_detached or sc->sc_flags), but the code checks 
that a flag is set in the detach handler. This step prevents trying to 
start/stop a VAP after the device was detached.

Bringing the device up or down:
* If the number of running vaps, as tracked by ic->ic_nrunning, is greater than 
0 (meaning at least 1 VAP is up), then:
** There is another if-condition that if the device isn't running at all, then 
start all VAPs. This is done by ieee80211_start_all().
** Otherwise, stop all VAPS. With rtwn_parent (sys/dev/rtwn/if_rtwn.c) it runs 
a TAILQ_FOREACH on each VAP and runs ieee80211_stop_locked on each VAP. Other 
drivers seem to do this slightly differently, such as rum_parent 
(sys/dev/usb/wlan/if_rum.c) it seems to only stop 1 VAP, which suggests to me 
that this device cannot support multiple VAPs
* If no VAPs are running, then we stop the device.

Is this accurate?

What I'm confused about is:
If this function is invoked when you run `ifconfig wlan0 up`, it seems that you 
specify a specific VAP, while all VAPs are simultaneously brought online rather 
than a single VAP. So its all or none?
* ic->ic_parent puts the device up or down based on flags (sc_nrunning or 
sc_flags), but when are those flags updated in this process?

Sorry for the multi-part question and thank you in advance!

- Farhan


Reply via email to