Re: What is ieee80211com.ic_max_nnodes?

2022-07-12 Thread Stefan Sperling
On Mon, Jul 11, 2022 at 03:13:58PM -0400, Farhan Khan wrote:
> On Mon, Jul 11, 2022, at 2:24 PM, Stefan Sperling wrote:
> Thank you so much for your prompt reply!
> 
> > 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.
> 
> Can you please show me where that limit is set to 7 or 8?

Sorry, my memories of what happened here were flaky.

There used to be a limit on max_nnodes as described above. But this was
lifted because it was also enforced in client mode (so the driver could
not scan for more than 8 APs at a time).
See this commit:
https://github.com/openbsd/src/commit/dd463f29c687b46f3b8f379c8ee269693223931a

> > 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.
> > 
> 
> As this paragraph says, rather than 7 or 8, sc->kc_entries is 128.
> And lastly, how is ic_max_nnodes used by the net80211 stack?

It limits the amount of new allocations in ieee80211_alloc_node_helper().



Re: What is ieee80211com.ic_max_nnodes?

2022-07-11 Thread Farhan Khan
On Mon, Jul 11, 2022, at 2:24 PM, Stefan Sperling wrote:
Thank you so much for your prompt reply!

> 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.

Can you please show me where that limit is set to 7 or 8?

> 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.
> 

As this paragraph says, rather than 7 or 8, sc->kc_entries is 128.
And lastly, how is ic_max_nnodes used by the net80211 stack?

Thank you!
--
Farhan Khan
PGP Fingerprint: 1312 89CE 663E 1EB2 179C 1C83 C41D 2281 F8DA C0DE



Re: What is ieee80211com.ic_max_nnodes?

2022-07-11 Thread Stefan Sperling
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.



What is ieee80211com.ic_max_nnodes?

2022-07-11 Thread Farhan Khan
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!
--
Farhan Khan
PGP Fingerprint: 1312 89CE 663E 1EB2 179C 1C83 C41D 2281 F8DA C0DE