forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
....@@ -1,10 +1,10 @@
11 /*
2
- * Marvell Wireless LAN device driver: station command handling
2
+ * NXP Wireless LAN device driver: station command handling
33 *
4
- * Copyright (C) 2011-2014, Marvell International Ltd.
4
+ * Copyright 2011-2020 NXP
55 *
6
- * This software file (the "File") is distributed by Marvell International
7
- * Ltd. under the terms of the GNU General Public License Version 2, June 1991
6
+ * This software file (the "File") is distributed by NXP
7
+ * under the terms of the GNU General Public License Version 2, June 1991
88 * (the "License"). You may use, redistribute and/or modify this File in
99 * accordance with the terms and conditions of the License, a copy of which
1010 * is available by writing to the Free Software Foundation, Inc.,
....@@ -853,43 +853,36 @@
853853 memset(&key_material->key_param_set, 0,
854854 sizeof(struct mwifiex_ie_type_key_param_set));
855855 if (enc_key->is_wapi_key) {
856
- mwifiex_dbg(priv->adapter, INFO, "info: Set WAPI Key\n");
857
- key_material->key_param_set.key_type_id =
858
- cpu_to_le16(KEY_TYPE_ID_WAPI);
859
- if (cmd_oid == KEY_INFO_ENABLED)
860
- key_material->key_param_set.key_info =
861
- cpu_to_le16(KEY_ENABLED);
862
- else
863
- key_material->key_param_set.key_info =
864
- cpu_to_le16(!KEY_ENABLED);
856
+ struct mwifiex_ie_type_key_param_set *set;
865857
866
- key_material->key_param_set.key[0] = enc_key->key_index;
858
+ mwifiex_dbg(priv->adapter, INFO, "info: Set WAPI Key\n");
859
+ set = &key_material->key_param_set;
860
+ set->key_type_id = cpu_to_le16(KEY_TYPE_ID_WAPI);
861
+ if (cmd_oid == KEY_INFO_ENABLED)
862
+ set->key_info = cpu_to_le16(KEY_ENABLED);
863
+ else
864
+ set->key_info = cpu_to_le16(!KEY_ENABLED);
865
+
866
+ set->key[0] = enc_key->key_index;
867867 if (!priv->sec_info.wapi_key_on)
868
- key_material->key_param_set.key[1] = 1;
868
+ set->key[1] = 1;
869869 else
870870 /* set 0 when re-key */
871
- key_material->key_param_set.key[1] = 0;
871
+ set->key[1] = 0;
872872
873873 if (!is_broadcast_ether_addr(enc_key->mac_addr)) {
874874 /* WAPI pairwise key: unicast */
875
- key_material->key_param_set.key_info |=
876
- cpu_to_le16(KEY_UNICAST);
875
+ set->key_info |= cpu_to_le16(KEY_UNICAST);
877876 } else { /* WAPI group key: multicast */
878
- key_material->key_param_set.key_info |=
879
- cpu_to_le16(KEY_MCAST);
877
+ set->key_info |= cpu_to_le16(KEY_MCAST);
880878 priv->sec_info.wapi_key_on = true;
881879 }
882880
883
- key_material->key_param_set.type =
884
- cpu_to_le16(TLV_TYPE_KEY_MATERIAL);
885
- key_material->key_param_set.key_len =
886
- cpu_to_le16(WAPI_KEY_LEN);
887
- memcpy(&key_material->key_param_set.key[2],
888
- enc_key->key_material, enc_key->key_len);
889
- memcpy(&key_material->key_param_set.key[2 + enc_key->key_len],
890
- enc_key->pn, PN_LEN);
891
- key_material->key_param_set.length =
892
- cpu_to_le16(WAPI_KEY_LEN + KEYPARAMSET_FIXED_LEN);
881
+ set->type = cpu_to_le16(TLV_TYPE_KEY_MATERIAL);
882
+ set->key_len = cpu_to_le16(WAPI_KEY_LEN);
883
+ memcpy(&set->key[2], enc_key->key_material, enc_key->key_len);
884
+ memcpy(&set->key[2 + enc_key->key_len], enc_key->pn, PN_LEN);
885
+ set->length = cpu_to_le16(WAPI_KEY_LEN + KEYPARAMSET_FIXED_LEN);
893886
894887 key_param_len = (WAPI_KEY_LEN + KEYPARAMSET_FIXED_LEN) +
895888 sizeof(struct mwifiex_ie_types_header);
....@@ -1730,7 +1723,7 @@
17301723 default:
17311724 mwifiex_dbg(priv->adapter, ERROR,
17321725 "Unknown TDLS configuration\n");
1733
- return -ENOTSUPP;
1726
+ return -EOPNOTSUPP;
17341727 }
17351728
17361729 le16_unaligned_add_cpu(&cmd->size, len);
....@@ -1856,7 +1849,7 @@
18561849 break;
18571850 default:
18581851 mwifiex_dbg(priv->adapter, ERROR, "Unknown TDLS operation\n");
1859
- return -ENOTSUPP;
1852
+ return -EOPNOTSUPP;
18601853 }
18611854
18621855 le16_unaligned_add_cpu(&cmd->size, config_len);