1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>STA information lifetime rules</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="The 802.11 subsystems &#8211; for kernel developers"><link rel="up" href="sta-info.html" title="Chapter&#160;22.&#160;Station info handling"><link rel="prev" href="API-enum-ieee80211-sta-info-flags.html" title="enum ieee80211_sta_info_flags"><link rel="next" href="aggregation-internals.html" title="Chapter&#160;23.&#160;Aggregation"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">STA information lifetime rules</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-enum-ieee80211-sta-info-flags.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;22.&#160;Station info handling</th><td width="20%" align="right">&#160;<a accesskey="n" href="aggregation-internals.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp1114510356"></a>STA information lifetime rules</h2></div></div></div><p>
2   </p><p>
3   STA info structures (<span class="structname">struct sta_info</span>) are managed in a hash table
4   for faster lookup and a list for iteration. They are managed using
5   RCU, i.e. access to the list and hash table is protected by RCU.
6   </p><p>
7   Upon allocating a STA info structure with <code class="function">sta_info_alloc</code>, the caller
8   owns that structure. It must then insert it into the hash table using
9   either <code class="function">sta_info_insert</code> or <code class="function">sta_info_insert_rcu</code>; only in the latter
10   case (which acquires an rcu read section but must not be called from
11   within one) will the pointer still be valid after the call. Note that
12   the caller may not do much with the STA info before inserting it, in
13   particular, it may not start any mesh peer link management or add
14   encryption keys.
15   </p><p>
16   When the insertion fails (<code class="function">sta_info_insert</code>) returns non-zero), the
17   structure will have been freed by <code class="function">sta_info_insert</code>!
18   </p><p>
19   Station entries are added by mac80211 when you establish a link with a
20   peer. This means different things for the different type of interfaces
21   we support. For a regular station this mean we add the AP sta when we
22   receive an association response from the AP. For IBSS this occurs when
23   get to know about a peer on the same IBSS. For WDS we add the sta for
24   the peer immediately upon device open. When using AP mode we add stations
25   for each respective station upon request from userspace through nl80211.
26   </p><p>
27   In order to remove a STA info structure, various sta_info_destroy_*()
28   calls are available.
29   </p><p>
30   There is no concept of ownership on a STA entry, each structure is
31   owned by the global hash table/list until it is removed. All users of
32   the structure need to be RCU protected so that the structure won't be
33   freed before they are done using it.
34</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-enum-ieee80211-sta-info-flags.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="sta-info.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="aggregation-internals.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">enum ieee80211_sta_info_flags</span>&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;Chapter&#160;23.&#160;Aggregation</td></tr></table></div></body></html>
35