303-ath9k-Use-sta_state-callback.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. From: Sujith Manoharan <[email protected]>
  2. Date: Fri, 17 Oct 2014 07:40:08 +0530
  3. Subject: [PATCH] ath9k: Use sta_state() callback
  4. Instead of using the sta_add()/sta_remove() callbacks,
  5. use the sta_state() callback since this gives
  6. more fine-grained control.
  7. Signed-off-by: Sujith Manoharan <[email protected]>
  8. ---
  9. --- a/drivers/net/wireless/ath/ath9k/main.c
  10. +++ b/drivers/net/wireless/ath/ath9k/main.c
  11. @@ -1547,6 +1547,31 @@ static int ath9k_sta_remove(struct ieee8
  12. return 0;
  13. }
  14. +static int ath9k_sta_state(struct ieee80211_hw *hw,
  15. + struct ieee80211_vif *vif,
  16. + struct ieee80211_sta *sta,
  17. + enum ieee80211_sta_state old_state,
  18. + enum ieee80211_sta_state new_state)
  19. +{
  20. + struct ath_softc *sc = hw->priv;
  21. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  22. + int ret = 0;
  23. +
  24. + if (old_state == IEEE80211_STA_AUTH &&
  25. + new_state == IEEE80211_STA_ASSOC) {
  26. + ret = ath9k_sta_add(hw, vif, sta);
  27. + ath_dbg(common, CONFIG,
  28. + "Add station: %pM\n", sta->addr);
  29. + } else if (old_state == IEEE80211_STA_ASSOC &&
  30. + new_state == IEEE80211_STA_AUTH) {
  31. + ret = ath9k_sta_remove(hw, vif, sta);
  32. + ath_dbg(common, CONFIG,
  33. + "Remove station: %pM\n", sta->addr);
  34. + }
  35. +
  36. + return ret;
  37. +}
  38. +
  39. static void ath9k_sta_set_tx_filter(struct ath_hw *ah,
  40. struct ath_node *an,
  41. bool set)
  42. @@ -2471,8 +2496,7 @@ struct ieee80211_ops ath9k_ops = {
  43. .remove_interface = ath9k_remove_interface,
  44. .config = ath9k_config,
  45. .configure_filter = ath9k_configure_filter,
  46. - .sta_add = ath9k_sta_add,
  47. - .sta_remove = ath9k_sta_remove,
  48. + .sta_state = ath9k_sta_state,
  49. .sta_notify = ath9k_sta_notify,
  50. .conf_tx = ath9k_conf_tx,
  51. .bss_info_changed = ath9k_bss_info_changed,