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.

Dependency Surface

Detected Declarations

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

Implementation Notes