On Mon, Jul 11, 2022 at 11:32:12AM -0400, Farhan Khan wrote: > Hi all, > > I am reading through the athn(4) driver and see a reference to > ieee80211com.ic_max_nnodes here > (http://bxr.su/OpenBSD/sys/dev/ic/athn.c#294). What is this variable? The > comment immediately above says "In HostAP mode, the number of STAs that we > can handle...". What does "handle" this mean in this context? What is it used > for? > > Broader question: I am trying to identify what the FreeBSD equivalent of this > is, but that exact question might be out of scope of this email list. > > Preliminary Research: > * Looking through the code, I see that it is used only by athn(4) and rtwn(4). > * The ieee80211 subsystem assigns it to ieee80211_cache_size aka > IEEE80211_CACHE_SIZE (512) by default. So does the athn driver. > * The variable is consumed in sys/net80211/ieee80211_node.c in the functions > ieee80211_alloc_node_helper ieee80211_clean_nodes, but I do not these > functions (yet). > * NetBSD seems to call the the variable ic_max_aid, but I could be mistaken. > Their wi(4), rtwn(4) and rt(4) drivers uses it. > > Thanks!
It is the maximum allowed number of entries in ic_tree. struct ieee80211_tree ic_tree; int ic_nnodes; /* length of ic_nnodes */ int ic_max_nnodes; /* max length of ic_nnodes */ This tree represents our view of all other the wlan devices we can see and potentially interact with. (The comments say 'length' because at some point in time, ic_tree was a list instead of a tree; someone forgot to update/remove these comments when that change was made.) Nodes in this tree are keyed on MAC address, and correspond to a "station" in 802.11 standard terminology. In client mode, max nodes says how many APs can show up in scan results. In AP mode, max nodes effectively sets a limit on how many clients can be connected concurrently. Because athn(4) USB firmware has an internal limit of 8 stations in its station table, and one entry is reserved for other use, the USB device can only serve 7 clients at a time. In the line of code you linked to, a similar cap is applied based on the number of pairwise WPA key slots available in hardware. This should be larger than the USB device limit, since the driver queries the device for this limit and caps it at 128.