diff options
author | Helmut Schaa <helmut.schaa@googlemail.com> | 2011-09-08 08:36:04 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-09-14 13:56:54 -0400 |
commit | b4943d8113500ee783072ba2ba7506ad76df3726 (patch) | |
tree | f32733c7d60c45f885b637dce4a8b1beb9a16d24 | |
parent | 183255235aadefd5a987021346e7aee2cbe721eb (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>
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00.h | 22 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00dev.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00mac.c | 33 |
3 files changed, 60 insertions, 0 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index d454ec8f5c6f..3b71d792bbf5 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -512,6 +512,19 @@ struct rt2x00intf_conf { | |||
512 | }; | 512 | }; |
513 | 513 | ||
514 | /* | 514 | /* |
515 | * Private structure for storing STA details | ||
516 | * wcid: Wireless Client ID | ||
517 | */ | ||
518 | struct rt2x00_sta { | ||
519 | int wcid; | ||
520 | }; | ||
521 | |||
522 | static inline struct rt2x00_sta* sta_to_rt2x00_sta(struct ieee80211_sta *sta) | ||
523 | { | ||
524 | return (struct rt2x00_sta *)sta->drv_priv; | ||
525 | } | ||
526 | |||
527 | /* | ||
515 | * rt2x00lib callback functions. | 528 | * rt2x00lib callback functions. |
516 | */ | 529 | */ |
517 | struct rt2x00lib_ops { | 530 | struct rt2x00lib_ops { |
@@ -620,6 +633,11 @@ struct rt2x00lib_ops { | |||
620 | void (*config) (struct rt2x00_dev *rt2x00dev, | 633 | void (*config) (struct rt2x00_dev *rt2x00dev, |
621 | struct rt2x00lib_conf *libconf, | 634 | struct rt2x00lib_conf *libconf, |
622 | const unsigned int changed_flags); | 635 | const unsigned int changed_flags); |
636 | int (*sta_add) (struct rt2x00_dev *rt2x00dev, | ||
637 | struct ieee80211_vif *vif, | ||
638 | struct ieee80211_sta *sta); | ||
639 | int (*sta_remove) (struct rt2x00_dev *rt2x00dev, | ||
640 | int wcid); | ||
623 | }; | 641 | }; |
624 | 642 | ||
625 | /* | 643 | /* |
@@ -1267,6 +1285,10 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
1267 | #else | 1285 | #else |
1268 | #define rt2x00mac_set_key NULL | 1286 | #define rt2x00mac_set_key NULL |
1269 | #endif /* CONFIG_RT2X00_LIB_CRYPTO */ | 1287 | #endif /* CONFIG_RT2X00_LIB_CRYPTO */ |
1288 | int rt2x00mac_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | ||
1289 | struct ieee80211_sta *sta); | ||
1290 | int rt2x00mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | ||
1291 | struct ieee80211_sta *sta); | ||
1270 | void rt2x00mac_sw_scan_start(struct ieee80211_hw *hw); | 1292 | void rt2x00mac_sw_scan_start(struct ieee80211_hw *hw); |
1271 | void rt2x00mac_sw_scan_complete(struct ieee80211_hw *hw); | 1293 | void rt2x00mac_sw_scan_complete(struct ieee80211_hw *hw); |
1272 | int rt2x00mac_get_stats(struct ieee80211_hw *hw, | 1294 | int rt2x00mac_get_stats(struct ieee80211_hw *hw, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 634b084a6527..e1fb2a8569be 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -931,6 +931,11 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
931 | rt2x00dev->hw->extra_tx_headroom += RT2X00_ALIGN_SIZE; | 931 | rt2x00dev->hw->extra_tx_headroom += RT2X00_ALIGN_SIZE; |
932 | 932 | ||
933 | /* | 933 | /* |
934 | * Tell mac80211 about the size of our private STA structure. | ||
935 | */ | ||
936 | rt2x00dev->hw->sta_data_size = sizeof(struct rt2x00_sta); | ||
937 | |||
938 | /* | ||
934 | * Allocate tx status FIFO for driver use. | 939 | * Allocate tx status FIFO for driver use. |
935 | */ | 940 | */ |
936 | if (test_bit(REQUIRE_TXSTATUS_FIFO, &rt2x00dev->cap_flags)) { | 941 | if (test_bit(REQUIRE_TXSTATUS_FIFO, &rt2x00dev->cap_flags)) { |
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, | |||
552 | EXPORT_SYMBOL_GPL(rt2x00mac_set_key); | 552 | EXPORT_SYMBOL_GPL(rt2x00mac_set_key); |
553 | #endif /* CONFIG_RT2X00_LIB_CRYPTO */ | 553 | #endif /* CONFIG_RT2X00_LIB_CRYPTO */ |
554 | 554 | ||
555 | int 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 | } | ||
570 | EXPORT_SYMBOL_GPL(rt2x00mac_sta_add); | ||
571 | |||
572 | int 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 | } | ||
586 | EXPORT_SYMBOL_GPL(rt2x00mac_sta_remove); | ||
587 | |||
555 | void rt2x00mac_sw_scan_start(struct ieee80211_hw *hw) | 588 | void rt2x00mac_sw_scan_start(struct ieee80211_hw *hw) |
556 | { | 589 | { |
557 | struct rt2x00_dev *rt2x00dev = hw->priv; | 590 | struct rt2x00_dev *rt2x00dev = hw->priv; |