aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/sta_info.h
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-02-25 10:27:47 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-03-06 15:30:47 -0500
commit73651ee6396c499ccb59ebc84c9274db01ed026d (patch)
tree1d59027cbdaec732f3e1378770cbf7b42b48cd70 /net/mac80211/sta_info.h
parentd0709a65181beb787ef3f58cfe45536a2bb254c8 (diff)
mac80211: split sta_info_add
sta_info_add() has two functions: allocating a station info structure and inserting it into the hash table/list. Splitting these two functions allows allocating with GFP_KERNEL in many places instead of GFP_ATOMIC which is now required by the RCU protection. Additionally, in many places RCU protection is now no longer needed at all because between sta_info_alloc() and sta_info_insert() the caller owns the structure. This fixes a few race conditions with setting initial flags and similar, but not all (see comments in ieee80211_sta.c and cfg.c). More documentation on the existing races will be in a follow-up patch. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/sta_info.h')
-rw-r--r--net/mac80211/sta_info.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 787124c253af..3f788228eeff 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -283,12 +283,19 @@ struct sta_info *sta_info_get(struct ieee80211_local *local, u8 *addr);
283struct sta_info *sta_info_get_by_idx(struct ieee80211_local *local, int idx, 283struct sta_info *sta_info_get_by_idx(struct ieee80211_local *local, int idx,
284 struct net_device *dev); 284 struct net_device *dev);
285/* 285/*
286 * Add a new STA info, must be under RCU read lock 286 * Create a new STA info, caller owns returned structure
287 * because otherwise the returned reference isn't 287 * until sta_info_insert().
288 * necessarily valid long enough.
289 */ 288 */
290struct sta_info *sta_info_add(struct ieee80211_sub_if_data *sdata, 289struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
291 u8 *addr); 290 u8 *addr, gfp_t gfp);
291/*
292 * Insert STA info into hash table/list, returns zero or a
293 * -EEXIST if (if the same MAC address is already present).
294 *
295 * Calling this without RCU protection makes the caller
296 * relinquish its reference to @sta.
297 */
298int sta_info_insert(struct sta_info *sta);
292/* 299/*
293 * Unlink a STA info from the hash table/list. 300 * Unlink a STA info from the hash table/list.
294 * This can NULL the STA pointer if somebody else 301 * This can NULL the STA pointer if somebody else