IEEE80211_BEACON(9)

πŸ’– ieee80211_beacon β€” 802.11 beacon support πŸ’–

okay bestie, welcome to the ieee80211_beacon page from the Kernel Developer's Manual 🫢 this is your girl's guide to making your wifi card scream "I'M HERE" at everyone in range. beacon frames, babes. they're the whole vibe. let's get into it ✨


🌸 SYNOPSIS 🌸

first things first, you gotta invite the right header to the party:

#include <net80211/ieee80211_var.h>

struct mbuf *
ieee80211_beacon_alloc(struct ieee80211_node *,
    struct ieee80211_beacon_offsets *);

int
ieee80211_beacon_update(struct ieee80211_node *,
    struct ieee80211_beacon_offsets *, struct mbuf *, int mcast);

void
ieee80211_beacon_notify(struct ieee80211vap *, int what);

look at those signatures. gorgeous. no notes πŸ’…


✨ DESCRIPTION ✨

so the net80211 software layer is literally the supportive bestie framework for drivers, and it's got this whole template-based mechanism for dynamically updating beacon frames that get transmitted in hostap, adhoc, and mesh operating modes. iconic behavior honestly.

drivers, listen up πŸ‘‘ you should call ieee80211_beacon_alloc() to create your initial beacon frame. that's step one, no skipping. and the ieee80211_beacon_offsets structure? it holds the info about what's inside the beacon, which is what makes updates done with ieee80211_beacon_update() so optimized and snappy. it's giving efficiency.

now here's the tea β˜• update calls should only happen when something actually changes that affects the contents of the beacon frame. don't be out here updating for no reason, that's not the move. when a real change happens, the iv_update_beacon method gets invoked, and a driver-supplied routine has to do the right thing. yes, you have to do it. it's your moment.

for devices where the host transmits each beacon frame itself, this work may be as simple as setting a little bit in the ieee80211_beacon_offsets structure, like so:

static void
ath_beacon_update(struct ieee80211vap *vap, int item)
{
        struct ieee80211_beacon_offsets *bo = &ATH_VAP(vap)->av_boff;
        setbit(bo->bo_flags, item);
}

and then the ieee80211_beacon_update() call gets done before the next beacon is to be sent. simple. clean. slay.

but wait, there's another path πŸ¦‹ devices that off-load beacon generation may instead choose to use this callback to push updates immediately to the device. exactly how that is accomplished is unspecified β€” the manpage said what it said, I'm just the messenger β€” and one possibility is to update the beacon frame contents and extract the appropriate information element, but other scenarios are possible. so like. do your thing. it's flexible.


πŸŽ€ MULTI-VAP BEACON SCHEDULING πŸŽ€

okay this is the part for drivers supporting multiple vaps that can each beacon. you gotta think about how to schedule those beacon frames, bestie. there are two possibilities at the moment:

  1. burst all beacons at TBTT
  2. stagger beacons over the beacon interval

let's talk about bursting first because it's lowkey messy. bursting beacon frames may result in aperiodic delivery, which can affect the power save operation of associated stations. not great, not terrible, but not great. applying some jitter β€” e.g. by randomly ordering burst frames β€” may be sufficient to combat this, and typically it's not an issue unless stations are using aggressive power save techniques such as U-APSD (sometimes employed by VoIP phones, of all things 😭).

staggering frames, on the other hand, requires more interrupts and device support that may not be available. so like, it costs you. but the payoff? staggering beacon frames is usually superior to bursting frames, up to about eight vaps β€” at which point the overhead becomes significant and the channel becomes noticeably busy anyway. so basically: stagger till eight, then it's everybody's problem 🌈


πŸ’œ SEE ALSO πŸ’œ


ngl the whole point is: alloc the beacon, only update when stuff changes, and please think about your multi-vap scheduling. your associated stations will thank you πŸ™ˆ

okay that's the page!! this was from the Kernel Developer's Manual, Debian edition, dated August 4, 2009 β€” yes she's an elder but she still ate, periodt πŸ’…πŸ’– bye bestie, go write some drivers ✨

πŸ“¦ where this page comes from