Lines Matching refs:priv

37 static int iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id)  in iwl_sta_ucode_activate()  argument
39 lockdep_assert_held(&priv->sta_lock); in iwl_sta_ucode_activate()
42 IWL_ERR(priv, "invalid sta_id %u\n", sta_id); in iwl_sta_ucode_activate()
45 if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) in iwl_sta_ucode_activate()
46 IWL_ERR(priv, "ACTIVATE a non DRIVER active station id %u " in iwl_sta_ucode_activate()
48 sta_id, priv->stations[sta_id].sta.sta.addr); in iwl_sta_ucode_activate()
50 if (priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE) { in iwl_sta_ucode_activate()
51 IWL_DEBUG_ASSOC(priv, in iwl_sta_ucode_activate()
54 sta_id, priv->stations[sta_id].sta.sta.addr); in iwl_sta_ucode_activate()
56 priv->stations[sta_id].used |= IWL_STA_UCODE_ACTIVE; in iwl_sta_ucode_activate()
57 IWL_DEBUG_ASSOC(priv, "Added STA id %u addr %pM to uCode\n", in iwl_sta_ucode_activate()
58 sta_id, priv->stations[sta_id].sta.sta.addr); in iwl_sta_ucode_activate()
63 static void iwl_process_add_sta_resp(struct iwl_priv *priv, in iwl_process_add_sta_resp() argument
68 IWL_DEBUG_INFO(priv, "Processing response for adding station\n"); in iwl_process_add_sta_resp()
70 spin_lock_bh(&priv->sta_lock); in iwl_process_add_sta_resp()
74 IWL_DEBUG_INFO(priv, "REPLY_ADD_STA PASSED\n"); in iwl_process_add_sta_resp()
77 IWL_ERR(priv, "Adding station failed, no room in table.\n"); in iwl_process_add_sta_resp()
80 IWL_ERR(priv, in iwl_process_add_sta_resp()
84 IWL_ERR(priv, "Attempting to modify non-existing station\n"); in iwl_process_add_sta_resp()
87 IWL_DEBUG_ASSOC(priv, "Received REPLY_ADD_STA:(0x%08X)\n", in iwl_process_add_sta_resp()
92 spin_unlock_bh(&priv->sta_lock); in iwl_process_add_sta_resp()
95 void iwl_add_sta_callback(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb) in iwl_add_sta_callback() argument
99 iwl_process_add_sta_resp(priv, pkt); in iwl_add_sta_callback()
102 int iwl_send_add_sta(struct iwl_priv *priv, in iwl_send_add_sta() argument
116 IWL_DEBUG_INFO(priv, "Adding sta %u (%pM) %ssynchronously\n", in iwl_send_add_sta()
124 ret = iwl_dvm_send_cmd(priv, &cmd); in iwl_send_add_sta()
134 spin_lock_bh(&priv->sta_lock); in iwl_send_add_sta()
135 ret = iwl_sta_ucode_activate(priv, sta_id); in iwl_send_add_sta()
136 spin_unlock_bh(&priv->sta_lock); in iwl_send_add_sta()
146 bool iwl_is_ht40_tx_allowed(struct iwl_priv *priv, in iwl_is_ht40_tx_allowed() argument
154 if (priv->disable_ht40) in iwl_is_ht40_tx_allowed()
165 static void iwl_sta_calc_ht_flags(struct iwl_priv *priv, in iwl_sta_calc_ht_flags() argument
182 IWL_DEBUG_INFO(priv, "STA %pM SM PS mode: %s\n", in iwl_sta_calc_ht_flags()
199 IWL_WARN(priv, "Invalid MIMO PS mode %d\n", sta->smps_mode); in iwl_sta_calc_ht_flags()
209 if (iwl_is_ht40_tx_allowed(priv, ctx, sta)) in iwl_sta_calc_ht_flags()
213 int iwl_sta_update_ht(struct iwl_priv *priv, struct iwl_rxon_context *ctx, in iwl_sta_update_ht() argument
223 iwl_sta_calc_ht_flags(priv, sta, ctx, &flags, &mask); in iwl_sta_update_ht()
225 spin_lock_bh(&priv->sta_lock); in iwl_sta_update_ht()
226 priv->stations[sta_id].sta.station_flags &= ~mask; in iwl_sta_update_ht()
227 priv->stations[sta_id].sta.station_flags |= flags; in iwl_sta_update_ht()
228 spin_unlock_bh(&priv->sta_lock); in iwl_sta_update_ht()
236 return iwl_send_add_sta(priv, &cmd, 0); in iwl_sta_update_ht()
239 static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index, in iwl_set_ht_add_station() argument
245 iwl_sta_calc_ht_flags(priv, sta, ctx, &flags, &mask); in iwl_set_ht_add_station()
247 lockdep_assert_held(&priv->sta_lock); in iwl_set_ht_add_station()
248 priv->stations[index].sta.station_flags &= ~mask; in iwl_set_ht_add_station()
249 priv->stations[index].sta.station_flags |= flags; in iwl_set_ht_add_station()
257 u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, in iwl_prep_station() argument
270 if (ether_addr_equal(priv->stations[i].sta.sta.addr, in iwl_prep_station()
276 if (!priv->stations[i].used && in iwl_prep_station()
293 if (priv->stations[sta_id].used & IWL_STA_UCODE_INPROGRESS) { in iwl_prep_station()
294 IWL_DEBUG_INFO(priv, "STA %d already in process of being " in iwl_prep_station()
299 if ((priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE) && in iwl_prep_station()
300 (priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE) && in iwl_prep_station()
301 ether_addr_equal(priv->stations[sta_id].sta.sta.addr, addr)) { in iwl_prep_station()
302 IWL_DEBUG_ASSOC(priv, "STA %d (%pM) already added, not " in iwl_prep_station()
307 station = &priv->stations[sta_id]; in iwl_prep_station()
309 IWL_DEBUG_ASSOC(priv, "Add STA to driver ID %d: %pM\n", in iwl_prep_station()
311 priv->num_stations++; in iwl_prep_station()
333 iwl_set_ht_add_station(priv, sta_id, sta, ctx); in iwl_prep_station()
344 int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx, in iwl_add_station_common() argument
353 spin_lock_bh(&priv->sta_lock); in iwl_add_station_common()
354 sta_id = iwl_prep_station(priv, ctx, addr, is_ap, sta); in iwl_add_station_common()
356 IWL_ERR(priv, "Unable to prepare station %pM for addition\n", in iwl_add_station_common()
358 spin_unlock_bh(&priv->sta_lock); in iwl_add_station_common()
367 if (priv->stations[sta_id].used & IWL_STA_UCODE_INPROGRESS) { in iwl_add_station_common()
368 IWL_DEBUG_INFO(priv, "STA %d already in process of being " in iwl_add_station_common()
370 spin_unlock_bh(&priv->sta_lock); in iwl_add_station_common()
374 if ((priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE) && in iwl_add_station_common()
375 (priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) { in iwl_add_station_common()
376 IWL_DEBUG_ASSOC(priv, "STA %d (%pM) already added, not " in iwl_add_station_common()
378 spin_unlock_bh(&priv->sta_lock); in iwl_add_station_common()
382 priv->stations[sta_id].used |= IWL_STA_UCODE_INPROGRESS; in iwl_add_station_common()
383 memcpy(&sta_cmd, &priv->stations[sta_id].sta, in iwl_add_station_common()
385 spin_unlock_bh(&priv->sta_lock); in iwl_add_station_common()
388 ret = iwl_send_add_sta(priv, &sta_cmd, 0); in iwl_add_station_common()
390 spin_lock_bh(&priv->sta_lock); in iwl_add_station_common()
391 IWL_ERR(priv, "Adding station %pM failed.\n", in iwl_add_station_common()
392 priv->stations[sta_id].sta.sta.addr); in iwl_add_station_common()
393 priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; in iwl_add_station_common()
394 priv->stations[sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; in iwl_add_station_common()
395 spin_unlock_bh(&priv->sta_lock); in iwl_add_station_common()
404 static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, u8 sta_id) in iwl_sta_ucode_deactivate() argument
406 lockdep_assert_held(&priv->sta_lock); in iwl_sta_ucode_deactivate()
409 if ((priv->stations[sta_id].used & in iwl_sta_ucode_deactivate()
412 IWL_ERR(priv, "removed non active STA %u\n", sta_id); in iwl_sta_ucode_deactivate()
414 priv->stations[sta_id].used &= ~IWL_STA_UCODE_ACTIVE; in iwl_sta_ucode_deactivate()
416 memset(&priv->stations[sta_id], 0, sizeof(struct iwl_station_entry)); in iwl_sta_ucode_deactivate()
417 IWL_DEBUG_ASSOC(priv, "Removed STA %u\n", sta_id); in iwl_sta_ucode_deactivate()
420 static int iwl_send_remove_station(struct iwl_priv *priv, in iwl_send_remove_station() argument
441 ret = iwl_dvm_send_cmd(priv, &cmd); in iwl_send_remove_station()
452 spin_lock_bh(&priv->sta_lock); in iwl_send_remove_station()
453 iwl_sta_ucode_deactivate(priv, sta_id); in iwl_send_remove_station()
454 spin_unlock_bh(&priv->sta_lock); in iwl_send_remove_station()
456 IWL_DEBUG_ASSOC(priv, "REPLY_REMOVE_STA PASSED\n"); in iwl_send_remove_station()
460 IWL_ERR(priv, "REPLY_REMOVE_STA failed\n"); in iwl_send_remove_station()
472 int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id, in iwl_remove_station() argument
477 if (!iwl_is_ready(priv)) { in iwl_remove_station()
478 IWL_DEBUG_INFO(priv, in iwl_remove_station()
489 IWL_DEBUG_ASSOC(priv, "Removing STA from driver:%d %pM\n", in iwl_remove_station()
495 spin_lock_bh(&priv->sta_lock); in iwl_remove_station()
497 if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) { in iwl_remove_station()
498 IWL_DEBUG_INFO(priv, "Removing %pM but non DRIVER active\n", in iwl_remove_station()
503 if (!(priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) { in iwl_remove_station()
504 IWL_DEBUG_INFO(priv, "Removing %pM but non UCODE active\n", in iwl_remove_station()
509 if (priv->stations[sta_id].used & IWL_STA_LOCAL) { in iwl_remove_station()
510 kfree(priv->stations[sta_id].lq); in iwl_remove_station()
511 priv->stations[sta_id].lq = NULL; in iwl_remove_station()
515 memset(&priv->tid_data[sta_id][tid], 0, in iwl_remove_station()
516 sizeof(priv->tid_data[sta_id][tid])); in iwl_remove_station()
518 priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; in iwl_remove_station()
520 priv->num_stations--; in iwl_remove_station()
522 if (WARN_ON(priv->num_stations < 0)) in iwl_remove_station()
523 priv->num_stations = 0; in iwl_remove_station()
525 spin_unlock_bh(&priv->sta_lock); in iwl_remove_station()
527 return iwl_send_remove_station(priv, addr, sta_id, false); in iwl_remove_station()
529 spin_unlock_bh(&priv->sta_lock); in iwl_remove_station()
533 void iwl_deactivate_station(struct iwl_priv *priv, const u8 sta_id, in iwl_deactivate_station() argument
538 if (!iwl_is_ready(priv)) { in iwl_deactivate_station()
539 IWL_DEBUG_INFO(priv, in iwl_deactivate_station()
545 IWL_DEBUG_ASSOC(priv, "Deactivating STA: %pM (%d)\n", addr, sta_id); in iwl_deactivate_station()
550 spin_lock_bh(&priv->sta_lock); in iwl_deactivate_station()
552 WARN_ON_ONCE(!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)); in iwl_deactivate_station()
555 memset(&priv->tid_data[sta_id][tid], 0, in iwl_deactivate_station()
556 sizeof(priv->tid_data[sta_id][tid])); in iwl_deactivate_station()
558 priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; in iwl_deactivate_station()
559 priv->stations[sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; in iwl_deactivate_station()
561 priv->num_stations--; in iwl_deactivate_station()
563 if (WARN_ON_ONCE(priv->num_stations < 0)) in iwl_deactivate_station()
564 priv->num_stations = 0; in iwl_deactivate_station()
566 spin_unlock_bh(&priv->sta_lock); in iwl_deactivate_station()
569 static void iwl_sta_fill_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, in iwl_sta_fill_lq() argument
576 lockdep_assert_held(&priv->mutex); in iwl_sta_fill_lq()
582 if (priv->band == IEEE80211_BAND_5GHZ) in iwl_sta_fill_lq()
592 rate_flags |= first_antenna(priv->nvm_data->valid_tx_ant) << in iwl_sta_fill_lq()
599 first_antenna(priv->nvm_data->valid_tx_ant); in iwl_sta_fill_lq()
602 priv->nvm_data->valid_tx_ant & in iwl_sta_fill_lq()
603 ~first_antenna(priv->nvm_data->valid_tx_ant); in iwl_sta_fill_lq()
606 } else if (num_of_ant(priv->nvm_data->valid_tx_ant) == 2) { in iwl_sta_fill_lq()
608 priv->nvm_data->valid_tx_ant; in iwl_sta_fill_lq()
627 void iwl_clear_ucode_stations(struct iwl_priv *priv, in iwl_clear_ucode_stations() argument
633 IWL_DEBUG_INFO(priv, "Clearing ucode stations in driver\n"); in iwl_clear_ucode_stations()
635 spin_lock_bh(&priv->sta_lock); in iwl_clear_ucode_stations()
637 if (ctx && ctx->ctxid != priv->stations[i].ctxid) in iwl_clear_ucode_stations()
640 if (priv->stations[i].used & IWL_STA_UCODE_ACTIVE) { in iwl_clear_ucode_stations()
641 IWL_DEBUG_INFO(priv, in iwl_clear_ucode_stations()
643 priv->stations[i].used &= ~IWL_STA_UCODE_ACTIVE; in iwl_clear_ucode_stations()
647 spin_unlock_bh(&priv->sta_lock); in iwl_clear_ucode_stations()
650 IWL_DEBUG_INFO(priv, in iwl_clear_ucode_stations()
662 void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx) in iwl_restore_stations() argument
672 if (!iwl_is_ready(priv)) { in iwl_restore_stations()
673 IWL_DEBUG_INFO(priv, in iwl_restore_stations()
678 IWL_DEBUG_ASSOC(priv, "Restoring all known stations ... start.\n"); in iwl_restore_stations()
679 spin_lock_bh(&priv->sta_lock); in iwl_restore_stations()
681 if (ctx->ctxid != priv->stations[i].ctxid) in iwl_restore_stations()
683 if ((priv->stations[i].used & IWL_STA_DRIVER_ACTIVE) && in iwl_restore_stations()
684 !(priv->stations[i].used & IWL_STA_UCODE_ACTIVE)) { in iwl_restore_stations()
685 IWL_DEBUG_ASSOC(priv, "Restoring sta %pM\n", in iwl_restore_stations()
686 priv->stations[i].sta.sta.addr); in iwl_restore_stations()
687 priv->stations[i].sta.mode = 0; in iwl_restore_stations()
688 priv->stations[i].used |= IWL_STA_UCODE_INPROGRESS; in iwl_restore_stations()
694 if ((priv->stations[i].used & IWL_STA_UCODE_INPROGRESS)) { in iwl_restore_stations()
695 memcpy(&sta_cmd, &priv->stations[i].sta, in iwl_restore_stations()
698 if (priv->stations[i].lq) { in iwl_restore_stations()
699 if (priv->wowlan) in iwl_restore_stations()
700 iwl_sta_fill_lq(priv, ctx, i, &lq); in iwl_restore_stations()
702 memcpy(&lq, priv->stations[i].lq, in iwl_restore_stations()
708 spin_unlock_bh(&priv->sta_lock); in iwl_restore_stations()
709 ret = iwl_send_add_sta(priv, &sta_cmd, 0); in iwl_restore_stations()
711 spin_lock_bh(&priv->sta_lock); in iwl_restore_stations()
712 IWL_ERR(priv, "Adding station %pM failed.\n", in iwl_restore_stations()
713 priv->stations[i].sta.sta.addr); in iwl_restore_stations()
714 priv->stations[i].used &= in iwl_restore_stations()
716 priv->stations[i].used &= in iwl_restore_stations()
725 iwl_send_lq_cmd(priv, ctx, &lq, 0, true); in iwl_restore_stations()
726 spin_lock_bh(&priv->sta_lock); in iwl_restore_stations()
727 priv->stations[i].used &= ~IWL_STA_UCODE_INPROGRESS; in iwl_restore_stations()
731 spin_unlock_bh(&priv->sta_lock); in iwl_restore_stations()
733 IWL_DEBUG_INFO(priv, "Restoring all known stations .... " in iwl_restore_stations()
736 IWL_DEBUG_INFO(priv, "Restoring all known stations .... " in iwl_restore_stations()
740 int iwl_get_free_ucode_key_offset(struct iwl_priv *priv) in iwl_get_free_ucode_key_offset() argument
744 for (i = 0; i < priv->sta_key_max_num; i++) in iwl_get_free_ucode_key_offset()
745 if (!test_and_set_bit(i, &priv->ucode_key_table)) in iwl_get_free_ucode_key_offset()
751 void iwl_dealloc_bcast_stations(struct iwl_priv *priv) in iwl_dealloc_bcast_stations() argument
755 spin_lock_bh(&priv->sta_lock); in iwl_dealloc_bcast_stations()
757 if (!(priv->stations[i].used & IWL_STA_BCAST)) in iwl_dealloc_bcast_stations()
760 priv->stations[i].used &= ~IWL_STA_UCODE_ACTIVE; in iwl_dealloc_bcast_stations()
761 priv->num_stations--; in iwl_dealloc_bcast_stations()
762 if (WARN_ON(priv->num_stations < 0)) in iwl_dealloc_bcast_stations()
763 priv->num_stations = 0; in iwl_dealloc_bcast_stations()
764 kfree(priv->stations[i].lq); in iwl_dealloc_bcast_stations()
765 priv->stations[i].lq = NULL; in iwl_dealloc_bcast_stations()
767 spin_unlock_bh(&priv->sta_lock); in iwl_dealloc_bcast_stations()
771 static void iwl_dump_lq_cmd(struct iwl_priv *priv, in iwl_dump_lq_cmd() argument
775 IWL_DEBUG_RATE(priv, "lq station id 0x%x\n", lq->sta_id); in iwl_dump_lq_cmd()
776 IWL_DEBUG_RATE(priv, "lq ant 0x%X 0x%X\n", in iwl_dump_lq_cmd()
781 IWL_DEBUG_RATE(priv, "lq index %d 0x%X\n", in iwl_dump_lq_cmd()
785 static inline void iwl_dump_lq_cmd(struct iwl_priv *priv, in iwl_dump_lq_cmd() argument
802 static bool is_lq_table_valid(struct iwl_priv *priv, in is_lq_table_valid() argument
811 IWL_DEBUG_INFO(priv, "Channel %u is not an HT channel\n", in is_lq_table_valid()
816 IWL_DEBUG_INFO(priv, in is_lq_table_valid()
835 int iwl_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx, in iwl_send_lq_cmd() argument
850 spin_lock_bh(&priv->sta_lock); in iwl_send_lq_cmd()
851 if (!(priv->stations[lq->sta_id].used & IWL_STA_DRIVER_ACTIVE)) { in iwl_send_lq_cmd()
852 spin_unlock_bh(&priv->sta_lock); in iwl_send_lq_cmd()
855 spin_unlock_bh(&priv->sta_lock); in iwl_send_lq_cmd()
857 iwl_dump_lq_cmd(priv, lq); in iwl_send_lq_cmd()
861 if (is_lq_table_valid(priv, ctx, lq)) in iwl_send_lq_cmd()
862 ret = iwl_dvm_send_cmd(priv, &cmd); in iwl_send_lq_cmd()
870 IWL_DEBUG_INFO(priv, "init LQ command complete, " in iwl_send_lq_cmd()
873 spin_lock_bh(&priv->sta_lock); in iwl_send_lq_cmd()
874 priv->stations[lq->sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; in iwl_send_lq_cmd()
875 spin_unlock_bh(&priv->sta_lock); in iwl_send_lq_cmd()
882 iwl_sta_alloc_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, in iwl_sta_alloc_lq() argument
889 IWL_ERR(priv, "Unable to allocate memory for LQ cmd.\n"); in iwl_sta_alloc_lq()
893 iwl_sta_fill_lq(priv, ctx, sta_id, link_cmd); in iwl_sta_alloc_lq()
903 int iwlagn_add_bssid_station(struct iwl_priv *priv, in iwlagn_add_bssid_station() argument
914 ret = iwl_add_station_common(priv, ctx, addr, 0, NULL, &sta_id); in iwlagn_add_bssid_station()
916 IWL_ERR(priv, "Unable to add station %pM\n", addr); in iwlagn_add_bssid_station()
923 spin_lock_bh(&priv->sta_lock); in iwlagn_add_bssid_station()
924 priv->stations[sta_id].used |= IWL_STA_LOCAL; in iwlagn_add_bssid_station()
925 spin_unlock_bh(&priv->sta_lock); in iwlagn_add_bssid_station()
928 link_cmd = iwl_sta_alloc_lq(priv, ctx, sta_id); in iwlagn_add_bssid_station()
930 IWL_ERR(priv, in iwlagn_add_bssid_station()
936 ret = iwl_send_lq_cmd(priv, ctx, link_cmd, 0, true); in iwlagn_add_bssid_station()
938 IWL_ERR(priv, "Link quality command failed (%d)\n", ret); in iwlagn_add_bssid_station()
940 spin_lock_bh(&priv->sta_lock); in iwlagn_add_bssid_station()
941 priv->stations[sta_id].lq = link_cmd; in iwlagn_add_bssid_station()
942 spin_unlock_bh(&priv->sta_lock); in iwlagn_add_bssid_station()
955 static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, in iwl_send_static_wepkey_cmd() argument
996 return iwl_dvm_send_cmd(priv, &cmd); in iwl_send_static_wepkey_cmd()
1001 int iwl_restore_default_wep_keys(struct iwl_priv *priv, in iwl_restore_default_wep_keys() argument
1004 lockdep_assert_held(&priv->mutex); in iwl_restore_default_wep_keys()
1006 return iwl_send_static_wepkey_cmd(priv, ctx, false); in iwl_restore_default_wep_keys()
1009 int iwl_remove_default_wep_key(struct iwl_priv *priv, in iwl_remove_default_wep_key() argument
1015 lockdep_assert_held(&priv->mutex); in iwl_remove_default_wep_key()
1017 IWL_DEBUG_WEP(priv, "Removing default WEP key: idx=%d\n", in iwl_remove_default_wep_key()
1021 if (iwl_is_rfkill(priv)) { in iwl_remove_default_wep_key()
1022 IWL_DEBUG_WEP(priv, in iwl_remove_default_wep_key()
1027 ret = iwl_send_static_wepkey_cmd(priv, ctx, 1); in iwl_remove_default_wep_key()
1028 IWL_DEBUG_WEP(priv, "Remove default WEP key: idx=%d ret=%d\n", in iwl_remove_default_wep_key()
1034 int iwl_set_default_wep_key(struct iwl_priv *priv, in iwl_set_default_wep_key() argument
1040 lockdep_assert_held(&priv->mutex); in iwl_set_default_wep_key()
1044 IWL_DEBUG_WEP(priv, in iwl_set_default_wep_key()
1055 ret = iwl_send_static_wepkey_cmd(priv, ctx, false); in iwl_set_default_wep_key()
1056 IWL_DEBUG_WEP(priv, "Set default WEP key: len=%d idx=%d ret=%d\n", in iwl_set_default_wep_key()
1077 static u8 iwlagn_key_sta_id(struct iwl_priv *priv, in iwlagn_key_sta_id() argument
1097 static int iwlagn_send_sta_key(struct iwl_priv *priv, in iwlagn_send_sta_key() argument
1106 spin_lock_bh(&priv->sta_lock); in iwlagn_send_sta_key()
1107 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(sta_cmd)); in iwlagn_send_sta_key()
1108 spin_unlock_bh(&priv->sta_lock); in iwlagn_send_sta_key()
1147 return iwl_send_add_sta(priv, &sta_cmd, cmd_flags); in iwlagn_send_sta_key()
1150 void iwl_update_tkip_key(struct iwl_priv *priv, in iwl_update_tkip_key() argument
1155 u8 sta_id = iwlagn_key_sta_id(priv, vif, sta); in iwl_update_tkip_key()
1160 if (iwl_scan_cancel(priv)) { in iwl_update_tkip_key()
1166 iwlagn_send_sta_key(priv, keyconf, sta_id, in iwl_update_tkip_key()
1170 int iwl_remove_dynamic_key(struct iwl_priv *priv, in iwl_remove_dynamic_key() argument
1176 u8 sta_id = iwlagn_key_sta_id(priv, ctx->vif, sta); in iwl_remove_dynamic_key()
1183 spin_lock_bh(&priv->sta_lock); in iwl_remove_dynamic_key()
1184 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(sta_cmd)); in iwl_remove_dynamic_key()
1185 if (!(priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) in iwl_remove_dynamic_key()
1187 spin_unlock_bh(&priv->sta_lock); in iwl_remove_dynamic_key()
1192 lockdep_assert_held(&priv->mutex); in iwl_remove_dynamic_key()
1196 IWL_DEBUG_WEP(priv, "Remove dynamic key: idx=%d sta=%d\n", in iwl_remove_dynamic_key()
1199 if (!test_and_clear_bit(keyconf->hw_key_idx, &priv->ucode_key_table)) in iwl_remove_dynamic_key()
1200 IWL_ERR(priv, "offset %d not used in uCode key table.\n", in iwl_remove_dynamic_key()
1215 return iwl_send_add_sta(priv, &sta_cmd, 0); in iwl_remove_dynamic_key()
1218 int iwl_set_dynamic_key(struct iwl_priv *priv, in iwl_set_dynamic_key() argument
1226 u8 sta_id = iwlagn_key_sta_id(priv, ctx->vif, sta); in iwl_set_dynamic_key()
1232 lockdep_assert_held(&priv->mutex); in iwl_set_dynamic_key()
1234 keyconf->hw_key_idx = iwl_get_free_ucode_key_offset(priv); in iwl_set_dynamic_key()
1250 ret = iwlagn_send_sta_key(priv, keyconf, sta_id, in iwl_set_dynamic_key()
1256 ret = iwlagn_send_sta_key(priv, keyconf, sta_id, in iwl_set_dynamic_key()
1260 IWL_ERR(priv, "Unknown cipher %x\n", keyconf->cipher); in iwl_set_dynamic_key()
1266 clear_bit(keyconf->hw_key_idx, &priv->ucode_key_table); in iwl_set_dynamic_key()
1269 IWL_DEBUG_WEP(priv, "Set dynamic key: cipher=%x len=%d idx=%d sta=%pM ret=%d\n", in iwl_set_dynamic_key()
1283 int iwlagn_alloc_bcast_station(struct iwl_priv *priv, in iwlagn_alloc_bcast_station() argument
1289 spin_lock_bh(&priv->sta_lock); in iwlagn_alloc_bcast_station()
1290 sta_id = iwl_prep_station(priv, ctx, iwl_bcast_addr, false, NULL); in iwlagn_alloc_bcast_station()
1292 IWL_ERR(priv, "Unable to prepare broadcast station\n"); in iwlagn_alloc_bcast_station()
1293 spin_unlock_bh(&priv->sta_lock); in iwlagn_alloc_bcast_station()
1298 priv->stations[sta_id].used |= IWL_STA_DRIVER_ACTIVE; in iwlagn_alloc_bcast_station()
1299 priv->stations[sta_id].used |= IWL_STA_BCAST; in iwlagn_alloc_bcast_station()
1300 spin_unlock_bh(&priv->sta_lock); in iwlagn_alloc_bcast_station()
1302 link_cmd = iwl_sta_alloc_lq(priv, ctx, sta_id); in iwlagn_alloc_bcast_station()
1304 IWL_ERR(priv, in iwlagn_alloc_bcast_station()
1309 spin_lock_bh(&priv->sta_lock); in iwlagn_alloc_bcast_station()
1310 priv->stations[sta_id].lq = link_cmd; in iwlagn_alloc_bcast_station()
1311 spin_unlock_bh(&priv->sta_lock); in iwlagn_alloc_bcast_station()
1322 int iwl_update_bcast_station(struct iwl_priv *priv, in iwl_update_bcast_station() argument
1328 link_cmd = iwl_sta_alloc_lq(priv, ctx, sta_id); in iwl_update_bcast_station()
1330 IWL_ERR(priv, "Unable to initialize rate scaling for bcast station.\n"); in iwl_update_bcast_station()
1334 spin_lock_bh(&priv->sta_lock); in iwl_update_bcast_station()
1335 if (priv->stations[sta_id].lq) in iwl_update_bcast_station()
1336 kfree(priv->stations[sta_id].lq); in iwl_update_bcast_station()
1338 IWL_DEBUG_INFO(priv, "Bcast station rate scaling has not been initialized yet.\n"); in iwl_update_bcast_station()
1339 priv->stations[sta_id].lq = link_cmd; in iwl_update_bcast_station()
1340 spin_unlock_bh(&priv->sta_lock); in iwl_update_bcast_station()
1345 int iwl_update_bcast_stations(struct iwl_priv *priv) in iwl_update_bcast_stations() argument
1350 for_each_context(priv, ctx) { in iwl_update_bcast_stations()
1351 ret = iwl_update_bcast_station(priv, ctx); in iwl_update_bcast_stations()
1362 int iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid) in iwl_sta_tx_modify_enable_tid() argument
1366 lockdep_assert_held(&priv->mutex); in iwl_sta_tx_modify_enable_tid()
1369 spin_lock_bh(&priv->sta_lock); in iwl_sta_tx_modify_enable_tid()
1370 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_TID_DISABLE_TX; in iwl_sta_tx_modify_enable_tid()
1371 priv->stations[sta_id].sta.tid_disable_tx &= cpu_to_le16(~(1 << tid)); in iwl_sta_tx_modify_enable_tid()
1372 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; in iwl_sta_tx_modify_enable_tid()
1373 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); in iwl_sta_tx_modify_enable_tid()
1374 spin_unlock_bh(&priv->sta_lock); in iwl_sta_tx_modify_enable_tid()
1376 return iwl_send_add_sta(priv, &sta_cmd, 0); in iwl_sta_tx_modify_enable_tid()
1379 int iwl_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta, in iwl_sta_rx_agg_start() argument
1385 lockdep_assert_held(&priv->mutex); in iwl_sta_rx_agg_start()
1391 spin_lock_bh(&priv->sta_lock); in iwl_sta_rx_agg_start()
1392 priv->stations[sta_id].sta.station_flags_msk = 0; in iwl_sta_rx_agg_start()
1393 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_ADDBA_TID_MSK; in iwl_sta_rx_agg_start()
1394 priv->stations[sta_id].sta.add_immediate_ba_tid = (u8)tid; in iwl_sta_rx_agg_start()
1395 priv->stations[sta_id].sta.add_immediate_ba_ssn = cpu_to_le16(ssn); in iwl_sta_rx_agg_start()
1396 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; in iwl_sta_rx_agg_start()
1397 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); in iwl_sta_rx_agg_start()
1398 spin_unlock_bh(&priv->sta_lock); in iwl_sta_rx_agg_start()
1400 return iwl_send_add_sta(priv, &sta_cmd, 0); in iwl_sta_rx_agg_start()
1403 int iwl_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta, in iwl_sta_rx_agg_stop() argument
1409 lockdep_assert_held(&priv->mutex); in iwl_sta_rx_agg_stop()
1413 IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid); in iwl_sta_rx_agg_stop()
1417 spin_lock_bh(&priv->sta_lock); in iwl_sta_rx_agg_stop()
1418 priv->stations[sta_id].sta.station_flags_msk = 0; in iwl_sta_rx_agg_stop()
1419 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_DELBA_TID_MSK; in iwl_sta_rx_agg_stop()
1420 priv->stations[sta_id].sta.remove_immediate_ba_tid = (u8)tid; in iwl_sta_rx_agg_stop()
1421 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; in iwl_sta_rx_agg_stop()
1422 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); in iwl_sta_rx_agg_stop()
1423 spin_unlock_bh(&priv->sta_lock); in iwl_sta_rx_agg_stop()
1425 return iwl_send_add_sta(priv, &sta_cmd, 0); in iwl_sta_rx_agg_stop()
1430 void iwl_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt) in iwl_sta_modify_sleep_tx_count() argument
1441 iwl_send_add_sta(priv, &cmd, CMD_ASYNC); in iwl_sta_modify_sleep_tx_count()