Page MenuHomeFreeBSD

net80211: add macros for testing if a channel is defined / channel is "any channel"
Needs ReviewPublic

Authored by adrian on Sat, Dec 21, 8:31 PM.
Referenced Files
Unknown Object (File)
Wed, Jan 1, 5:18 AM
Unknown Object (File)
Tue, Dec 31, 5:05 AM
Unknown Object (File)
Mon, Dec 30, 3:58 AM
Unknown Object (File)
Sun, Dec 29, 5:29 AM
Unknown Object (File)
Sat, Dec 28, 4:14 AM
Unknown Object (File)
Fri, Dec 27, 6:00 AM
Unknown Object (File)
Thu, Dec 26, 2:04 AM
Unknown Object (File)
Wed, Dec 25, 11:13 AM

Details

Reviewers
None
Group Reviewers
wireless
Summary
  • A channel being defined is currently "channel is not null". APIs can return a NULL channel if there's no channel available to match some criteria.
  • A channel being defined as "any channel" is NOT NULL and a magic value (0xffff). Deferencing this is obviously bad.

We should be hiding the inner workings of the channel represent /
contents from consumers, and this will let us lay the groundwork
for further detailed checks in the channel macros (ie, avoid
NULL / ANYC dereferencing.)

  • create a macros that returns true if the channel is defined (IEEE80211_IS_CHAN_DEFINED())
  • create a macro that return true if the channel is the "any channel" (IEEE80211_IS_CHAN_ANYC())
  • Convert a couple of places (dfs, vht) over to use the new macros as a test.

This is mostly a test and request for feedback before the rest
of the net80211 stack / drivers are converted.
magic ANYC values, and it's a

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 61299
Build 58183: arc lint + arc unit

Event Timeline

oops, renaming/refactoring issue!

This looks reasonable.
I cannot judge if it is technically correct though, as I lack background knowledge.

I replied to wireless@ for this. Also it really doesn't belong into this stack of changes.

Ok, so where do you want to take this? Find all the places in the tree and replace them, just do net80211 and leave the drivers? Just add the macros and let someone else do them all in a go?

Also the IEEE80211_IS_CHAN_ANY() according to https://lists.freebsd.org/archives/freebsd-wireless/2025-January/002700.html