net/mac80211/led.c
Source file repositories/reference/linux-study-clean/net/mac80211/led.c
File Facts
- System
- Linux kernel
- Corpus path
net/mac80211/led.c- Extension
.c- Size
- 9843 bytes
- Lines
- 378
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/if.hlinux/slab.hlinux/export.hled.h
Detected Declarations
function ieee80211_led_assocfunction ieee80211_led_radiofunction ieee80211_alloc_led_namesfunction ieee80211_free_led_namesfunction ieee80211_tx_led_activatefunction ieee80211_tx_led_deactivatefunction ieee80211_rx_led_activatefunction ieee80211_rx_led_deactivatefunction ieee80211_assoc_led_activatefunction ieee80211_assoc_led_deactivatefunction ieee80211_radio_led_activatefunction ieee80211_radio_led_deactivatefunction ieee80211_tpt_led_activatefunction ieee80211_tpt_led_deactivatefunction ieee80211_led_initfunction ieee80211_led_exitfunction tpt_trig_trafficfunction tpt_trig_timerfunction __ieee80211_create_tpt_led_triggerfunction ieee80211_start_tpt_led_trigfunction ieee80211_stop_tpt_led_trigfunction ieee80211_mod_tpt_led_trigexport __ieee80211_get_radio_led_nameexport __ieee80211_get_assoc_led_nameexport __ieee80211_get_tx_led_nameexport __ieee80211_get_rx_led_nameexport __ieee80211_create_tpt_led_trigger
Annotated Snippet
if (led_trigger_register(&local->tpt_led)) {
kfree(local->tpt_led_trigger);
local->tpt_led_trigger = NULL;
}
}
}
void ieee80211_led_exit(struct ieee80211_local *local)
{
if (local->radio_led.name)
led_trigger_unregister(&local->radio_led);
if (local->assoc_led.name)
led_trigger_unregister(&local->assoc_led);
if (local->tx_led.name)
led_trigger_unregister(&local->tx_led);
if (local->rx_led.name)
led_trigger_unregister(&local->rx_led);
if (local->tpt_led_trigger) {
led_trigger_unregister(&local->tpt_led);
kfree(local->tpt_led_trigger);
}
}
const char *__ieee80211_get_radio_led_name(struct ieee80211_hw *hw)
{
struct ieee80211_local *local = hw_to_local(hw);
return local->radio_led.name;
}
EXPORT_SYMBOL(__ieee80211_get_radio_led_name);
const char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw)
{
struct ieee80211_local *local = hw_to_local(hw);
return local->assoc_led.name;
}
EXPORT_SYMBOL(__ieee80211_get_assoc_led_name);
const char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw)
{
struct ieee80211_local *local = hw_to_local(hw);
return local->tx_led.name;
}
EXPORT_SYMBOL(__ieee80211_get_tx_led_name);
const char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw)
{
struct ieee80211_local *local = hw_to_local(hw);
return local->rx_led.name;
}
EXPORT_SYMBOL(__ieee80211_get_rx_led_name);
static unsigned long tpt_trig_traffic(struct ieee80211_local *local,
struct tpt_led_trigger *tpt_trig)
{
unsigned long traffic, delta;
traffic = tpt_trig->tx_bytes + tpt_trig->rx_bytes;
delta = traffic - tpt_trig->prev_traffic;
tpt_trig->prev_traffic = traffic;
return DIV_ROUND_UP(delta, 1024 / 8);
}
static void tpt_trig_timer(struct timer_list *t)
{
struct tpt_led_trigger *tpt_trig = timer_container_of(tpt_trig, t,
timer);
struct ieee80211_local *local = tpt_trig->local;
unsigned long on, off, tpt;
int i;
if (!tpt_trig->running)
return;
mod_timer(&tpt_trig->timer, round_jiffies(jiffies + HZ));
tpt = tpt_trig_traffic(local, tpt_trig);
/* default to just solid on */
on = 1;
off = 0;
for (i = tpt_trig->blink_table_len - 1; i >= 0; i--) {
if (tpt_trig->blink_table[i].throughput < 0 ||
tpt > tpt_trig->blink_table[i].throughput) {
Annotation
- Immediate include surface: `linux/if.h`, `linux/slab.h`, `linux/export.h`, `led.h`.
- Detected declarations: `function ieee80211_led_assoc`, `function ieee80211_led_radio`, `function ieee80211_alloc_led_names`, `function ieee80211_free_led_names`, `function ieee80211_tx_led_activate`, `function ieee80211_tx_led_deactivate`, `function ieee80211_rx_led_activate`, `function ieee80211_rx_led_deactivate`, `function ieee80211_assoc_led_activate`, `function ieee80211_assoc_led_deactivate`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.