aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00mac.c
diff options
context:
space:
mode:
authorHelmut Schaa <helmut.schaa@googlemail.com>2011-09-08 08:36:04 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-09-14 13:56:54 -0400
commitb4943d8113500ee783072ba2ba7506ad76df3726 (patch)
treef32733c7d60c45f885b637dce4a8b1beb9a16d24 /drivers/net/wireless/rt2x00/rt2x00mac.c
parent183255235aadefd5a987021346e7aee2cbe721eb (diff)
rt2x00: Introduce sta_add/remove callbacks
This implements a basic sta_add and sta_remove callback. Introduce a new structure rt2x00_sta and ask mac80211 to allocate it as private part of its ieee80211_sta. rt2x00_sta only contains the WCID for now. The sta_add callback allows the driver to assign a WCID to a station that is currently being added. The same wcid is also passed to the sta_remove callback one mac80211 removes this STA. Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com> Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00mac.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index 9db9378820bf..6a03f93e92ac 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -552,6 +552,39 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
552EXPORT_SYMBOL_GPL(rt2x00mac_set_key); 552EXPORT_SYMBOL_GPL(rt2x00mac_set_key);
553#endif /* CONFIG_RT2X00_LIB_CRYPTO */ 553#endif /* CONFIG_RT2X00_LIB_CRYPTO */
554 554
555int rt2x00mac_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
556 struct ieee80211_sta *sta)
557{
558 struct rt2x00_dev *rt2x00dev = hw->priv;
559 struct rt2x00_sta *sta_priv = sta_to_rt2x00_sta(sta);
560
561 /*
562 * If there's no space left in the device table store
563 * -1 as wcid but tell mac80211 everything went ok.
564 */
565 if (rt2x00dev->ops->lib->sta_add(rt2x00dev, vif, sta))
566 sta_priv->wcid = -1;
567
568 return 0;
569}
570EXPORT_SYMBOL_GPL(rt2x00mac_sta_add);
571
572int rt2x00mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
573 struct ieee80211_sta *sta)
574{
575 struct rt2x00_dev *rt2x00dev = hw->priv;
576 struct rt2x00_sta *sta_priv = sta_to_rt2x00_sta(sta);
577
578 /*
579 * If we never sent the STA to the device no need to clean it up.
580 */
581 if (sta_priv->wcid < 0)
582 return 0;
583
584 return rt2x00dev->ops->lib->sta_remove(rt2x00dev, sta_priv->wcid);
585}
586EXPORT_SYMBOL_GPL(rt2x00mac_sta_remove);
587
555void rt2x00mac_sw_scan_start(struct ieee80211_hw *hw) 588void rt2x00mac_sw_scan_start(struct ieee80211_hw *hw)
556{ 589{
557 struct rt2x00_dev *rt2x00dev = hw->priv; 590 struct rt2x00_dev *rt2x00dev = hw->priv;