Date: Tue, 15 Apr 2025 13:35:59 -0700 From: Adrian Chadd <adrian@freebsd.org> To: Farhan Khan <farhan@farhan.codes> Cc: freebsd-wireless <freebsd-wireless@freebsd.org> Subject: Re: Understanding ieee80211com channel members Message-ID: <CAJ-VmomxAKTQThpuaDZYF_%2Bt89Gnmfapm8j1rwxf%2B8B2-SzGpQ@mail.gmail.com> In-Reply-To: <93720323-d53f-45d9-b94a-d3f5bd5e03cb@app.fastmail.com>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] On Sun, 13 Apr 2025 at 12:17, Farhan Khan <farhan@farhan.codes> wrote: > Hi all, > > I am doing some research on how channels work on net80211 with a focus on > how OpenBSD (and NetBSD/Illumos) differ from FreeBSD's stack. Keeping the > question simple, I'm having trouble understanding how channel members in > the ieee80211com structure map to each other: > > FreeBSD has: > * ieee80211com -> ic_curchan > * ieee80211com -> ic_bsschan > > OpenBSD has: > * ieee80211com -> ic_ibss_chan > > Three Questions: > > 1) Is FreeBSD's ic_bsschan the same as OpenBSD's ic_ibss_chan? > I don't know what ic_ibsschan is. ic_bsschan can be viewed as "this is channel I'd like the BSS to operate on." it can be _ANYC. > > * Is there an equivalent in OpenBSD to FreeBSD's ic_curchan? Or is the > "current state" tracked different in OpenBSD? (ie, optional, in the softc). I've no idea. FreeBSD's ic_curchan is the current channel for the NIC when it's a software driven NIC. I added support a few years ago to start supporting the idea of a different channel per VAP, since some firmware NICs let you set different channels per VAP and the firmware time slices. For now, just use ic_curchan for "the current channel we're operating on". > > 2) What level of maintenance of ic_curchan does the driver do? Is it upon a > channel change? Or do we let net80211 handle that? OpenBSD's code seems to > do this idiom a lot, which I understand as updating the current state > (could be wrong): > c = ic->ic_bss->ni_chan = ic->ic_ibss_chan; > > In FreeBSD - the driver shouldn't ever be updating ic_curchan. net80211 takes care of updating ic_curchan, ic_bsschan, vap->iv_des_chan (the VAP version of ic_bsschan), it makes decisions about what channel(s) to choose during scanning, monitor mode, association, operation, etc. It takes care of updating vap->iv_bss node, and the ni->ni_chan (channel config for the given node.) Drivers never set the channel config themselves, they only consume them. > 3) Were any channel members or mechanisms migrated to the VAP layer? If > so, which? I'm migrating increasing numbers of them from global to per VAP, because as I said, plenty of firmware NICs now support different configs and channels per VAP and the firmware sorts it out. Eg, the slot time config, the WME/QoS config are both now per-VAP, but there's a global set maintained of the intersection of them all, for NICs that don't have firmware APIs taking care of them for you. I think you'll need to look in ieee80211.c and ieee80211_node.c for some more of them, I don't remember off hand and I'm not on a FreeBSD device right now to look them up. > > (I apologize for a semi-OpenBSD question, but I figured it was close enough > on topic) > > It's ok, I'm sorry I missed this! -adrian > Thank you, > -- > Farhan Khan > PGP Fingerprint: 1312 89CE 663E 1EB2 179C 1C83 C41D 2281 F8DA C0DE > > > [-- Attachment #2 --] <div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Sun, 13 Apr 2025 at 12:17, Farhan Khan <farhan@farhan.codes> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi all,<br> <br> I am doing some research on how channels work on net80211 with a focus on how OpenBSD (and NetBSD/Illumos) differ from FreeBSD's stack. Keeping the question simple, I'm having trouble understanding how channel members in the ieee80211com structure map to each other:<br> <br> FreeBSD has:<br> * ieee80211com -> ic_curchan<br> * ieee80211com -> ic_bsschan<br> <br> OpenBSD has:<br> * ieee80211com -> ic_ibss_chan<br> <br> Three Questions:<br> <br> 1) Is FreeBSD's ic_bsschan the same as OpenBSD's ic_ibss_chan?<br></blockquote><div><br></div><div>I don't know what ic_ibsschan is.</div><div><br></div><div>ic_bsschan can be viewed as "this is channel I'd like the BSS to operate on." it can be _ANYC.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br> * Is there an equivalent in OpenBSD to FreeBSD's ic_curchan? Or is the "current state" tracked different in OpenBSD? (ie, optional, in the softc).</blockquote><div><br></div><div>I've no idea. FreeBSD's ic_curchan is the current channel for the NIC when it's a software driven NIC. I added support a few years ago to start supporting the idea of a different channel per VAP, since some firmware NICs let you set different channels per VAP and the firmware time slices.</div><div><br></div><div>For now, just use ic_curchan for "the current channel we're operating on".</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> 2) What level of maintenance of ic_curchan does the driver do? Is it upon a channel change? Or do we let net80211 handle that? OpenBSD's code seems to do this idiom a lot, which I understand as updating the current state (could be wrong):<br> c = ic->ic_bss->ni_chan = ic->ic_ibss_chan;<br> <br></blockquote><div><br></div><div>In FreeBSD - the driver shouldn't ever be updating ic_curchan. net80211 takes care of updating ic_curchan, ic_bsschan, vap->iv_des_chan (the VAP version of ic_bsschan), it makes decisions about what channel(s) to choose during scanning, monitor mode, association, operation, etc. It takes care of updating vap->iv_bss node, and the ni->ni_chan (channel config for the given node.) Drivers never set the channel config themselves, they only consume them. </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> 3) Were any channel members or mechanisms migrated to the VAP layer? If so, which?</blockquote><div><br></div><div>I'm migrating increasing numbers of them from global to per VAP, because as I said, plenty of firmware NICs now support different configs and channels per VAP and the firmware sorts it out.</div><div><br></div><div>Eg, the slot time config, the WME/QoS config are both now per-VAP, but there's a global set maintained of the intersection of them all, for NICs that don't have firmware APIs taking care of them for you.</div><div>I think you'll need to look in ieee80211.c and ieee80211_node.c for some more of them, I don't remember off hand and I'm not on a FreeBSD device right now to look them up.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> (I apologize for a semi-OpenBSD question, but I figured it was close enough on topic)<br> <br></blockquote><div><br></div><div>It's ok, I'm sorry I missed this!</div><div><br></div><div><br></div><div><br></div><div><br></div><div>-adrian</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> Thank you,<br> --<br> Farhan Khan<br> PGP Fingerprint: 1312 89CE 663E 1EB2 179C 1C83 C41D 2281 F8DA C0DE<br> <br> <br> </blockquote></div></div>home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-VmomxAKTQThpuaDZYF_%2Bt89Gnmfapm8j1rwxf%2B8B2-SzGpQ>
