aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwifiex/sta_cmd.c
diff options
context:
space:
mode:
authorYogesh Ashok Powar <yogeshp@marvell.com>2011-04-06 19:46:56 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-04-12 16:57:35 -0400
commit6a35a0ac5771fa962c45926678d1f194cbc98c4e (patch)
tree888cc79ebc18b52ead4804a0f1bd332bfd561ee3 /drivers/net/wireless/mwifiex/sta_cmd.c
parent18bf965702058f5f8039e6a46bb5ebaa18d38ebd (diff)
mwifiex: use common keyinfo bitmap for different key types
Instead of having separate key information definitions for each type of key, a common key information bitmap is used. Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex/sta_cmd.c')
-rw-r--r--drivers/net/wireless/mwifiex/sta_cmd.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/net/wireless/mwifiex/sta_cmd.c b/drivers/net/wireless/mwifiex/sta_cmd.c
index 6fff26153e26..19de6524d428 100644
--- a/drivers/net/wireless/mwifiex/sta_cmd.c
+++ b/drivers/net/wireless/mwifiex/sta_cmd.c
@@ -500,9 +500,8 @@ mwifiex_set_keyparamset_wep(struct mwifiex_private *priv,
500 key_param_set->key_type_id = 500 key_param_set->key_type_id =
501 cpu_to_le16(KEY_TYPE_ID_WEP); 501 cpu_to_le16(KEY_TYPE_ID_WEP);
502 key_param_set->key_info = 502 key_param_set->key_info =
503 cpu_to_le16(KEY_INFO_WEP_ENABLED | 503 cpu_to_le16(KEY_ENABLED | KEY_UNICAST |
504 KEY_INFO_WEP_UNICAST | 504 KEY_MCAST);
505 KEY_INFO_WEP_MCAST);
506 key_param_set->key_len = 505 key_param_set->key_len =
507 cpu_to_le16(priv->wep_key[i].key_length); 506 cpu_to_le16(priv->wep_key[i].key_length);
508 /* Set WEP key index */ 507 /* Set WEP key index */
@@ -589,10 +588,10 @@ static int mwifiex_cmd_802_11_key_material(struct mwifiex_private *priv,
589 cpu_to_le16(KEY_TYPE_ID_WAPI); 588 cpu_to_le16(KEY_TYPE_ID_WAPI);
590 if (cmd_oid == KEY_INFO_ENABLED) 589 if (cmd_oid == KEY_INFO_ENABLED)
591 key_material->key_param_set.key_info = 590 key_material->key_param_set.key_info =
592 cpu_to_le16(KEY_INFO_WAPI_ENABLED); 591 cpu_to_le16(KEY_ENABLED);
593 else 592 else
594 key_material->key_param_set.key_info = 593 key_material->key_param_set.key_info =
595 cpu_to_le16(!KEY_INFO_WAPI_ENABLED); 594 cpu_to_le16(!KEY_ENABLED);
596 595
597 key_material->key_param_set.key[0] = enc_key->key_index; 596 key_material->key_param_set.key[0] = enc_key->key_index;
598 if (!priv->sec_info.wapi_key_on) 597 if (!priv->sec_info.wapi_key_on)
@@ -604,10 +603,10 @@ static int mwifiex_cmd_802_11_key_material(struct mwifiex_private *priv,
604 if (0 != memcmp(enc_key->mac_addr, bc_mac, sizeof(bc_mac))) { 603 if (0 != memcmp(enc_key->mac_addr, bc_mac, sizeof(bc_mac))) {
605 /* WAPI pairwise key: unicast */ 604 /* WAPI pairwise key: unicast */
606 key_material->key_param_set.key_info |= 605 key_material->key_param_set.key_info |=
607 cpu_to_le16(KEY_INFO_WAPI_UNICAST); 606 cpu_to_le16(KEY_UNICAST);
608 } else { /* WAPI group key: multicast */ 607 } else { /* WAPI group key: multicast */
609 key_material->key_param_set.key_info |= 608 key_material->key_param_set.key_info |=
610 cpu_to_le16(KEY_INFO_WAPI_MCAST); 609 cpu_to_le16(KEY_MCAST);
611 priv->sec_info.wapi_key_on = true; 610 priv->sec_info.wapi_key_on = true;
612 } 611 }
613 612
@@ -634,32 +633,32 @@ static int mwifiex_cmd_802_11_key_material(struct mwifiex_private *priv,
634 cpu_to_le16(KEY_TYPE_ID_AES); 633 cpu_to_le16(KEY_TYPE_ID_AES);
635 if (cmd_oid == KEY_INFO_ENABLED) 634 if (cmd_oid == KEY_INFO_ENABLED)
636 key_material->key_param_set.key_info = 635 key_material->key_param_set.key_info =
637 cpu_to_le16(KEY_INFO_AES_ENABLED); 636 cpu_to_le16(KEY_ENABLED);
638 else 637 else
639 key_material->key_param_set.key_info = 638 key_material->key_param_set.key_info =
640 cpu_to_le16(!KEY_INFO_AES_ENABLED); 639 cpu_to_le16(!KEY_ENABLED);
641 640
642 if (enc_key->key_index & MWIFIEX_KEY_INDEX_UNICAST) 641 if (enc_key->key_index & MWIFIEX_KEY_INDEX_UNICAST)
643 /* AES pairwise key: unicast */ 642 /* AES pairwise key: unicast */
644 key_material->key_param_set.key_info |= 643 key_material->key_param_set.key_info |=
645 cpu_to_le16(KEY_INFO_AES_UNICAST); 644 cpu_to_le16(KEY_UNICAST);
646 else /* AES group key: multicast */ 645 else /* AES group key: multicast */
647 key_material->key_param_set.key_info |= 646 key_material->key_param_set.key_info |=
648 cpu_to_le16(KEY_INFO_AES_MCAST); 647 cpu_to_le16(KEY_MCAST);
649 } else if (enc_key->key_len == WLAN_KEY_LEN_TKIP) { 648 } else if (enc_key->key_len == WLAN_KEY_LEN_TKIP) {
650 dev_dbg(priv->adapter->dev, "cmd: WPA_TKIP\n"); 649 dev_dbg(priv->adapter->dev, "cmd: WPA_TKIP\n");
651 key_material->key_param_set.key_type_id = 650 key_material->key_param_set.key_type_id =
652 cpu_to_le16(KEY_TYPE_ID_TKIP); 651 cpu_to_le16(KEY_TYPE_ID_TKIP);
653 key_material->key_param_set.key_info = 652 key_material->key_param_set.key_info =
654 cpu_to_le16(KEY_INFO_TKIP_ENABLED); 653 cpu_to_le16(KEY_ENABLED);
655 654
656 if (enc_key->key_index & MWIFIEX_KEY_INDEX_UNICAST) 655 if (enc_key->key_index & MWIFIEX_KEY_INDEX_UNICAST)
657 /* TKIP pairwise key: unicast */ 656 /* TKIP pairwise key: unicast */
658 key_material->key_param_set.key_info |= 657 key_material->key_param_set.key_info |=
659 cpu_to_le16(KEY_INFO_TKIP_UNICAST); 658 cpu_to_le16(KEY_UNICAST);
660 else /* TKIP group key: multicast */ 659 else /* TKIP group key: multicast */
661 key_material->key_param_set.key_info |= 660 key_material->key_param_set.key_info |=
662 cpu_to_le16(KEY_INFO_TKIP_MCAST); 661 cpu_to_le16(KEY_MCAST);
663 } 662 }
664 663
665 if (key_material->key_param_set.key_type_id) { 664 if (key_material->key_param_set.key_type_id) {