740
741
742
743
744 spin_unlock_irqrestore(&priv->sta_lock, flags);
745 return 0;
746 }
747
748 if (priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET) {
749 IWL_WARNING("Removing wrong key %d 0x%x\n",
750 keyconf->keyidx, key_flags);
751 spin_unlock_irqrestore(&priv->sta_lock, flags);
752 return 0;
753 }
754
755 if (!test_and_clear_bit(priv->stations[sta_id].sta.key.key_offset,
756 &priv->ucode_key_table))
757 IWL_ERROR("index %d not used in uCode key table.\n",
758 priv->stations[sta_id].sta.key.key_offset);
759 memset(&priv->stations[sta_id].keyinfo, 0,
760 sizeof(struct iwl_hw_key));
761 memset(&priv->stations[sta_id].sta.key, 0,
762 sizeof(struct iwl4965_keyinfo));
763 priv->stations[sta_id].sta.key.key_flags =
764 STA_KEY_FLG_NO_ENC | STA_KEY_FLG_INVALID;
765 priv->stations[sta_id].sta.key.key_offset = WEP_INVALID_OFFSET;
766 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
767 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
768
769 ret = iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
770 spin_unlock_irqrestore(&priv->sta_lock, flags);
771 return ret;
772}
773EXPORT_SYMBOL(iwl_remove_dynamic_key);
774
775int iwl_set_dynamic_key(struct iwl_priv *priv,
776 struct ieee80211_key_conf *keyconf, u8 sta_id)
777{
778 int ret;
779
780 priv->key_mapping_key++;