Sophie

Sophie

distrib > CentOS > 6 > i386 > by-pkgid > 2c51d8eb79f8810ada971ee8c30ce1e5 > files > 2509

kernel-doc-2.6.32-71.14.1.el6.noarch.rpm

<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><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.75.2" /><link rel="home" href="index.html" title="The mac80211 subsystem for kernel developers" /><link rel="up" href="ch17.html" title="Chapter&#160;17.&#160;Station info handling" /><link rel="prev" href="re45.html" title="enum ieee80211_sta_info_flags" /><link rel="next" href="ch18.html" title="Chapter&#160;18.&#160;Synchronisation" /></head><body><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="re45.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;17.&#160;Station info handling</th><td width="20%" align="right">&#160;<a accesskey="n" href="ch18.html">Next</a></td></tr></table><hr /></div><div class="sect1" title="STA information lifetime rules"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id2713582"></a>STA information lifetime rules</h2></div></div></div><p>
   </p><p>
   STA info structures (<span class="structname">struct sta_info</span>) are managed in a hash table
   for faster lookup and a list for iteration. They are managed using
   RCU, i.e. access to the list and hash table is protected by RCU.
   </p><p>
   Upon allocating a STA info structure with <code class="function">sta_info_alloc</code>, the caller owns
   that structure. It must then either destroy it using <code class="function">sta_info_destroy</code>
   (which is pretty useless) or insert it into the hash table using
   <code class="function">sta_info_insert</code> which demotes the reference from ownership to a regular
   RCU-protected reference; if the function is called without protection by an
   RCU critical section the reference is instantly invalidated. Note that the
   caller may not do much with the STA info before inserting it, in particular,
   it may not start any mesh peer link management or add encryption keys.
   </p><p>
   When the insertion fails (<code class="function">sta_info_insert</code>) returns non-zero), the
   structure will have been freed by <code class="function">sta_info_insert</code>!
   </p><p>
   sta entries are added by mac80211 when you establish a link with a
   peer. This means different things for the different type of interfaces
   we support. For a regular station this mean we add the AP sta when we
   receive an assocation response from the AP. For IBSS this occurs when
   we receive a probe response or a beacon from target IBSS network. For
   WDS we add the sta for the peer imediately upon device open. When using
   AP mode we add stations for each respective station upon request from
   userspace through nl80211.
   </p><p>
   Because there are debugfs entries for each station, and adding those
   must be able to sleep, it is also possible to <span class="quote">&#8220;<span class="quote">pin</span>&#8221;</span> a station entry,
   that means it can be removed from the hash table but not be freed.
   See the comment in <code class="function">__sta_info_unlink</code> for more information, this is
   an internal capability only.
   </p><p>
   In order to remove a STA info structure, the caller needs to first
   unlink it (<code class="function">sta_info_unlink</code>) from the list and hash tables and
   then destroy it; <code class="function">sta_info_destroy</code> will wait for an RCU grace period
   to elapse before actually freeing it. Due to the pinning and the
   possibility of multiple callers trying to remove the same STA info at
   the same time, <code class="function">sta_info_unlink</code> can clear the STA info pointer it is
   passed to indicate that the STA info is owned by somebody else now.
   </p><p>
   If <code class="function">sta_info_unlink</code> did not clear the pointer then the caller owns
   the STA info structure now and is responsible of destroying it with
   a call to <code class="function">sta_info_destroy</code>.
   </p><p>
   In all other cases, there is no concept of ownership on a STA entry,
   each structure is owned by the global hash table/list until it is
   removed. All users of the structure need to be RCU protected so that
   the structure won't be freed before they are done using it.
</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="re45.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="ch17.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="ch18.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span>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;18.&#160;Synchronisation</td></tr></table></div></body></html>