driver-ops.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * This program is free software; you can redistribute it and/or modify
  3. * it under the terms of the GNU General Public License version 2 as
  4. * published by the Free Software Foundation.
  5. */
  6. #include <net/mac80211.h>
  7. #include "ieee80211_i.h"
  8. #include "trace.h"
  9. #include "driver-ops.h"
  10. __must_check
  11. int drv_sta_state(struct ieee80211_local *local,
  12. struct ieee80211_sub_if_data *sdata,
  13. struct sta_info *sta,
  14. enum ieee80211_sta_state old_state,
  15. enum ieee80211_sta_state new_state)
  16. {
  17. int ret = 0;
  18. might_sleep();
  19. sdata = get_bss_sdata(sdata);
  20. if (!check_sdata_in_driver(sdata))
  21. return -EIO;
  22. trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state);
  23. if (local->ops->sta_state) {
  24. ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta,
  25. old_state, new_state);
  26. } else if (old_state == IEEE80211_STA_AUTH &&
  27. new_state == IEEE80211_STA_ASSOC) {
  28. ret = drv_sta_add(local, sdata, &sta->sta);
  29. if (ret == 0)
  30. sta->uploaded = true;
  31. } else if (old_state == IEEE80211_STA_ASSOC &&
  32. new_state == IEEE80211_STA_AUTH) {
  33. drv_sta_remove(local, sdata, &sta->sta);
  34. }
  35. trace_drv_return_int(local, ret);
  36. return ret;
  37. }