net/mac80211/sta_info.c

Source file repositories/reference/linux-study-clean/net/mac80211/sta_info.c

File Facts

System
Linux kernel
Corpus path
net/mac80211/sta_info.c
Extension
.c
Size
107681 bytes
Lines
3821
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

struct sta_link_alloc {
	struct link_sta_info info;
	struct ieee80211_link_sta sta;
	struct rcu_head rcu_head;
};

static const struct rhashtable_params sta_rht_params = {
	.nelem_hint = 3, /* start small */
	.automatic_shrinking = true,
	.head_offset = offsetof(struct sta_info, hash_node),
	.key_offset = offsetof(struct sta_info, addr),
	.key_len = ETH_ALEN,
	.max_size = CONFIG_MAC80211_STA_HASH_MAX_SIZE,
};

static const struct rhashtable_params link_sta_rht_params = {
	.nelem_hint = 3, /* start small */
	.automatic_shrinking = true,
	.head_offset = offsetof(struct link_sta_info, link_hash_node),
	.key_offset = offsetof(struct link_sta_info, addr),
	.key_len = ETH_ALEN,
	.max_size = CONFIG_MAC80211_STA_HASH_MAX_SIZE,
};

static int sta_info_hash_del(struct ieee80211_local *local,
			     struct sta_info *sta)
{
	return rhltable_remove(&local->sta_hash, &sta->hash_node,
			       sta_rht_params);
}

static int link_sta_info_hash_add(struct ieee80211_local *local,
				  struct link_sta_info *link_sta)
{
	lockdep_assert_wiphy(local->hw.wiphy);

	return rhltable_insert(&local->link_sta_hash,
			       &link_sta->link_hash_node, link_sta_rht_params);
}

static int link_sta_info_hash_del(struct ieee80211_local *local,
				  struct link_sta_info *link_sta)
{
	lockdep_assert_wiphy(local->hw.wiphy);

	return rhltable_remove(&local->link_sta_hash,
			       &link_sta->link_hash_node, link_sta_rht_params);
}

void ieee80211_purge_sta_txqs(struct sta_info *sta)
{
	struct ieee80211_local *local = sta->sdata->local;
	int i;

	for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
		struct txq_info *txqi;

		if (!sta->sta.txq[i])
			continue;

		txqi = to_txq_info(sta->sta.txq[i]);

		ieee80211_txq_purge(local, txqi);
	}
}

static void __cleanup_single_sta(struct sta_info *sta)
{
	int ac, i;
	struct tid_ampdu_tx *tid_tx;
	struct ieee80211_sub_if_data *sdata = sta->sdata;
	struct ieee80211_local *local = sdata->local;
	struct ps_data *ps;

	if (test_sta_flag(sta, WLAN_STA_PS_STA) ||
	    test_sta_flag(sta, WLAN_STA_PS_DRIVER) ||
	    test_sta_flag(sta, WLAN_STA_PS_DELIVER)) {
		if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||
		    sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
			ps = &sdata->bss->ps;
		else if (ieee80211_vif_is_mesh(&sdata->vif))
			ps = &sdata->u.mesh.ps;
		else
			return;

		clear_sta_flag(sta, WLAN_STA_PS_STA);
		clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
		clear_sta_flag(sta, WLAN_STA_PS_DELIVER);

		atomic_dec(&ps->num_sta_ps);

Annotation

Implementation Notes