aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/iwmc3200wifi/commands.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/drivers/net/wireless/iwmc3200wifi/commands.c b/drivers/net/wireless/iwmc3200wifi/commands.c
index 6b3626013fd2..f0c8acdb71a4 100644
--- a/drivers/net/wireless/iwmc3200wifi/commands.c
+++ b/drivers/net/wireless/iwmc3200wifi/commands.c
@@ -526,19 +526,6 @@ int iwm_read_mac(struct iwm_priv *iwm, u8 *mac)
526 return 0; 526 return 0;
527} 527}
528 528
529int iwm_set_tx_key(struct iwm_priv *iwm, u8 key_idx)
530{
531 struct iwm_umac_tx_key_id tx_key_id;
532
533 tx_key_id.hdr.oid = UMAC_WIFI_IF_CMD_GLOBAL_TX_KEY_ID;
534 tx_key_id.hdr.buf_size = cpu_to_le16(sizeof(struct iwm_umac_tx_key_id) -
535 sizeof(struct iwm_umac_wifi_if));
536
537 tx_key_id.key_idx = key_idx;
538
539 return iwm_send_wifi_if_cmd(iwm, &tx_key_id, sizeof(tx_key_id), 1);
540}
541
542static int iwm_check_profile(struct iwm_priv *iwm) 529static int iwm_check_profile(struct iwm_priv *iwm)
543{ 530{
544 if (!iwm->umac_profile_active) 531 if (!iwm->umac_profile_active)
@@ -572,6 +559,32 @@ static int iwm_check_profile(struct iwm_priv *iwm)
572 return 0; 559 return 0;
573} 560}
574 561
562int iwm_set_tx_key(struct iwm_priv *iwm, u8 key_idx)
563{
564 struct iwm_umac_tx_key_id tx_key_id;
565 int ret;
566
567 ret = iwm_check_profile(iwm);
568 if (ret < 0)
569 return ret;
570
571 /* UMAC only allows to set default key for WEP and auth type is
572 * NOT 802.1X or RSNA. */
573 if ((iwm->umac_profile->sec.ucast_cipher != UMAC_CIPHER_TYPE_WEP_40 &&
574 iwm->umac_profile->sec.ucast_cipher != UMAC_CIPHER_TYPE_WEP_104) ||
575 iwm->umac_profile->sec.auth_type == UMAC_AUTH_TYPE_8021X ||
576 iwm->umac_profile->sec.auth_type == UMAC_AUTH_TYPE_RSNA_PSK)
577 return 0;
578
579 tx_key_id.hdr.oid = UMAC_WIFI_IF_CMD_GLOBAL_TX_KEY_ID;
580 tx_key_id.hdr.buf_size = cpu_to_le16(sizeof(struct iwm_umac_tx_key_id) -
581 sizeof(struct iwm_umac_wifi_if));
582
583 tx_key_id.key_idx = key_idx;
584
585 return iwm_send_wifi_if_cmd(iwm, &tx_key_id, sizeof(tx_key_id), 1);
586}
587
575int iwm_set_key(struct iwm_priv *iwm, bool remove, struct iwm_key *key) 588int iwm_set_key(struct iwm_priv *iwm, bool remove, struct iwm_key *key)
576{ 589{
577 int ret = 0; 590 int ret = 0;