aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2011-11-10 09:55:16 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-11-11 12:32:54 -0500
commit76b2933111afe5a04e342040436a90c31c7661d4 (patch)
treecf9a87c086a229c88da4eb12df2ab8ba06f0017e
parentba4c531984d480dff554e2ccb442958052482773 (diff)
iwlwifi: move station functions to mac80211
The station related mac80211 callback functions should belong to _mac80211 Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-sta.c68
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.h7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-mac80211.c71
3 files changed, 71 insertions, 75 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
index 1b112dfbce7..901fd9485d7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
@@ -829,28 +829,6 @@ int iwl_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
829 return ret; 829 return ret;
830} 830}
831 831
832int iwlagn_mac_sta_remove(struct ieee80211_hw *hw,
833 struct ieee80211_vif *vif,
834 struct ieee80211_sta *sta)
835{
836 struct iwl_priv *priv = hw->priv;
837 struct iwl_station_priv *sta_priv = (void *)sta->drv_priv;
838 int ret;
839
840 IWL_DEBUG_MAC80211(priv, "enter: received request to remove "
841 "station %pM\n", sta->addr);
842 mutex_lock(&priv->shrd->mutex);
843 IWL_DEBUG_INFO(priv, "proceeding to remove station %pM\n",
844 sta->addr);
845 ret = iwl_remove_station(priv, sta_priv->sta_id, sta->addr);
846 if (ret)
847 IWL_DEBUG_QUIET_RFKILL(priv, "Error removing station %pM\n",
848 sta->addr);
849 mutex_unlock(&priv->shrd->mutex);
850 IWL_DEBUG_MAC80211(priv, "leave\n");
851
852 return ret;
853}
854 832
855void iwl_sta_fill_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, 833void iwl_sta_fill_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
856 u8 sta_id, struct iwl_link_quality_cmd *link_cmd) 834 u8 sta_id, struct iwl_link_quality_cmd *link_cmd)
@@ -1468,20 +1446,7 @@ int iwl_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta,
1468 return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); 1446 return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC);
1469} 1447}
1470 1448
1471static void iwl_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id)
1472{
1473 unsigned long flags;
1474
1475 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
1476 priv->stations[sta_id].sta.station_flags &= ~STA_FLG_PWR_SAVE_MSK;
1477 priv->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK;
1478 priv->stations[sta_id].sta.sta.modify_mask = 0;
1479 priv->stations[sta_id].sta.sleep_tx_count = 0;
1480 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
1481 iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
1482 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
1483 1449
1484}
1485 1450
1486void iwl_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt) 1451void iwl_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt)
1487{ 1452{
@@ -1498,36 +1463,3 @@ void iwl_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt)
1498 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags); 1463 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
1499 1464
1500} 1465}
1501
1502void iwlagn_mac_sta_notify(struct ieee80211_hw *hw,
1503 struct ieee80211_vif *vif,
1504 enum sta_notify_cmd cmd,
1505 struct ieee80211_sta *sta)
1506{
1507 struct iwl_priv *priv = hw->priv;
1508 struct iwl_station_priv *sta_priv = (void *)sta->drv_priv;
1509 int sta_id;
1510
1511 IWL_DEBUG_MAC80211(priv, "enter\n");
1512
1513 switch (cmd) {
1514 case STA_NOTIFY_SLEEP:
1515 WARN_ON(!sta_priv->client);
1516 sta_priv->asleep = true;
1517 if (atomic_read(&sta_priv->pending_frames) > 0)
1518 ieee80211_sta_block_awake(hw, sta, true);
1519 break;
1520 case STA_NOTIFY_AWAKE:
1521 WARN_ON(!sta_priv->client);
1522 if (!sta_priv->asleep)
1523 break;
1524 sta_priv->asleep = false;
1525 sta_id = iwl_sta_id(sta);
1526 if (sta_id != IWL_INVALID_STATION)
1527 iwl_sta_modify_ps_wake(priv, sta_id);
1528 break;
1529 default:
1530 break;
1531 }
1532 IWL_DEBUG_MAC80211(priv, "leave\n");
1533}
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h
index 72af9334559..d325132849f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.h
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.h
@@ -210,9 +210,6 @@ int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
210 struct ieee80211_sta *sta, u8 *sta_id_r); 210 struct ieee80211_sta *sta, u8 *sta_id_r);
211int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id, 211int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id,
212 const u8 *addr); 212 const u8 *addr);
213int iwlagn_mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
214 struct ieee80211_sta *sta);
215
216u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, 213u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
217 const u8 *addr, bool is_ap, struct ieee80211_sta *sta); 214 const u8 *addr, bool is_ap, struct ieee80211_sta *sta);
218 215
@@ -330,10 +327,6 @@ void iwl_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt);
330int iwl_update_bcast_station(struct iwl_priv *priv, 327int iwl_update_bcast_station(struct iwl_priv *priv,
331 struct iwl_rxon_context *ctx); 328 struct iwl_rxon_context *ctx);
332int iwl_update_bcast_stations(struct iwl_priv *priv); 329int iwl_update_bcast_stations(struct iwl_priv *priv);
333void iwlagn_mac_sta_notify(struct ieee80211_hw *hw,
334 struct ieee80211_vif *vif,
335 enum sta_notify_cmd cmd,
336 struct ieee80211_sta *sta);
337 330
338/* rate */ 331/* rate */
339static inline u32 iwl_ant_idx_to_flags(u8 ant_idx) 332static inline u32 iwl_ant_idx_to_flags(u8 ant_idx)
diff --git a/drivers/net/wireless/iwlwifi/iwl-mac80211.c b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
index 6df08bb63ff..b46702c3471 100644
--- a/drivers/net/wireless/iwlwifi/iwl-mac80211.c
+++ b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
@@ -1847,6 +1847,77 @@ static int iwlagn_mac_hw_scan(struct ieee80211_hw *hw,
1847 return ret; 1847 return ret;
1848} 1848}
1849 1849
1850static int iwlagn_mac_sta_remove(struct ieee80211_hw *hw,
1851 struct ieee80211_vif *vif,
1852 struct ieee80211_sta *sta)
1853{
1854 struct iwl_priv *priv = hw->priv;
1855 struct iwl_station_priv *sta_priv = (void *)sta->drv_priv;
1856 int ret;
1857
1858 IWL_DEBUG_MAC80211(priv, "enter: received request to remove "
1859 "station %pM\n", sta->addr);
1860 mutex_lock(&priv->shrd->mutex);
1861 IWL_DEBUG_INFO(priv, "proceeding to remove station %pM\n",
1862 sta->addr);
1863 ret = iwl_remove_station(priv, sta_priv->sta_id, sta->addr);
1864 if (ret)
1865 IWL_DEBUG_QUIET_RFKILL(priv, "Error removing station %pM\n",
1866 sta->addr);
1867 mutex_unlock(&priv->shrd->mutex);
1868 IWL_DEBUG_MAC80211(priv, "leave\n");
1869
1870 return ret;
1871}
1872
1873static void iwl_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id)
1874{
1875 unsigned long flags;
1876
1877 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
1878 priv->stations[sta_id].sta.station_flags &= ~STA_FLG_PWR_SAVE_MSK;
1879 priv->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK;
1880 priv->stations[sta_id].sta.sta.modify_mask = 0;
1881 priv->stations[sta_id].sta.sleep_tx_count = 0;
1882 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
1883 iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
1884 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
1885
1886}
1887
1888static void iwlagn_mac_sta_notify(struct ieee80211_hw *hw,
1889 struct ieee80211_vif *vif,
1890 enum sta_notify_cmd cmd,
1891 struct ieee80211_sta *sta)
1892{
1893 struct iwl_priv *priv = hw->priv;
1894 struct iwl_station_priv *sta_priv = (void *)sta->drv_priv;
1895 int sta_id;
1896
1897 IWL_DEBUG_MAC80211(priv, "enter\n");
1898
1899 switch (cmd) {
1900 case STA_NOTIFY_SLEEP:
1901 WARN_ON(!sta_priv->client);
1902 sta_priv->asleep = true;
1903 if (atomic_read(&sta_priv->pending_frames) > 0)
1904 ieee80211_sta_block_awake(hw, sta, true);
1905 break;
1906 case STA_NOTIFY_AWAKE:
1907 WARN_ON(!sta_priv->client);
1908 if (!sta_priv->asleep)
1909 break;
1910 sta_priv->asleep = false;
1911 sta_id = iwl_sta_id(sta);
1912 if (sta_id != IWL_INVALID_STATION)
1913 iwl_sta_modify_ps_wake(priv, sta_id);
1914 break;
1915 default:
1916 break;
1917 }
1918 IWL_DEBUG_MAC80211(priv, "leave\n");
1919}
1920
1850struct ieee80211_ops iwlagn_hw_ops = { 1921struct ieee80211_ops iwlagn_hw_ops = {
1851 .tx = iwlagn_mac_tx, 1922 .tx = iwlagn_mac_tx,
1852 .start = iwlagn_mac_start, 1923 .start = iwlagn_mac_start,