Commit a84faab0 authored by Prameela Rani Garnepudi's avatar Prameela Rani Garnepudi Committed by Kalle Valo

rsi: update set_key command frame

TX command frame set_key is modified to use common descriptor
structure.
Signed-off-by: default avatarPrameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: default avatarAmitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent de1d1813
...@@ -709,39 +709,39 @@ int rsi_hal_load_key(struct rsi_common *common, ...@@ -709,39 +709,39 @@ int rsi_hal_load_key(struct rsi_common *common,
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
struct rsi_set_key *set_key; struct rsi_set_key *set_key;
u16 key_descriptor = 0; u16 key_descriptor = 0;
u16 frame_len = sizeof(struct rsi_set_key);
rsi_dbg(MGMT_TX_ZONE, "%s: Sending load key frame\n", __func__); rsi_dbg(MGMT_TX_ZONE, "%s: Sending load key frame\n", __func__);
skb = dev_alloc_skb(sizeof(struct rsi_set_key)); skb = dev_alloc_skb(frame_len);
if (!skb) { if (!skb) {
rsi_dbg(ERR_ZONE, "%s: Failed in allocation of skb\n", rsi_dbg(ERR_ZONE, "%s: Failed in allocation of skb\n",
__func__); __func__);
return -ENOMEM; return -ENOMEM;
} }
memset(skb->data, 0, sizeof(struct rsi_set_key)); memset(skb->data, 0, frame_len);
set_key = (struct rsi_set_key *)skb->data; set_key = (struct rsi_set_key *)skb->data;
if ((cipher == WLAN_CIPHER_SUITE_WEP40) || if ((cipher == WLAN_CIPHER_SUITE_WEP40) ||
(cipher == WLAN_CIPHER_SUITE_WEP104)) { (cipher == WLAN_CIPHER_SUITE_WEP104)) {
key_len += 1; key_len += 1;
key_descriptor |= BIT(2); key_descriptor |= RSI_WEP_KEY;
if (key_len >= 13) if (key_len >= 13)
key_descriptor |= BIT(3); key_descriptor |= RSI_WEP_KEY_104;
} else if (cipher != KEY_TYPE_CLEAR) { } else if (cipher != KEY_TYPE_CLEAR) {
key_descriptor |= BIT(4); key_descriptor |= RSI_CIPHER_WPA;
if (key_type == RSI_PAIRWISE_KEY) if (key_type == RSI_PAIRWISE_KEY)
key_id = 0; key_id = 0;
if (cipher == WLAN_CIPHER_SUITE_TKIP) if (cipher == WLAN_CIPHER_SUITE_TKIP)
key_descriptor |= BIT(5); key_descriptor |= RSI_CIPHER_TKIP;
} }
key_descriptor |= (key_type | BIT(13) | (key_id << 14)); key_descriptor |= (key_type | RSI_PROTECT_DATA_FRAMES | (key_id << 14));
set_key->desc_word[0] = cpu_to_le16((sizeof(struct rsi_set_key) - rsi_set_len_qno(&set_key->desc_dword0.len_qno,
FRAME_DESC_SZ) | (frame_len - FRAME_DESC_SZ), RSI_WIFI_MGMT_Q);
(RSI_WIFI_MGMT_Q << 12)); set_key->desc_dword0.frame_type = SET_KEY_REQ;
set_key->desc_word[1] = cpu_to_le16(SET_KEY_REQ); set_key->key_desc = cpu_to_le16(key_descriptor);
set_key->desc_word[4] = cpu_to_le16(key_descriptor);
if ((cipher == WLAN_CIPHER_SUITE_WEP40) || if ((cipher == WLAN_CIPHER_SUITE_WEP40) ||
(cipher == WLAN_CIPHER_SUITE_WEP104)) { (cipher == WLAN_CIPHER_SUITE_WEP104)) {
...@@ -755,7 +755,7 @@ int rsi_hal_load_key(struct rsi_common *common, ...@@ -755,7 +755,7 @@ int rsi_hal_load_key(struct rsi_common *common,
memcpy(set_key->tx_mic_key, &data[16], 8); memcpy(set_key->tx_mic_key, &data[16], 8);
memcpy(set_key->rx_mic_key, &data[24], 8); memcpy(set_key->rx_mic_key, &data[24], 8);
skb_put(skb, sizeof(struct rsi_set_key)); skb_put(skb, frame_len);
return rsi_send_internal_mgmt_frame(common, skb); return rsi_send_internal_mgmt_frame(common, skb);
} }
......
...@@ -348,8 +348,22 @@ struct rsi_vap_caps { ...@@ -348,8 +348,22 @@ struct rsi_vap_caps {
__le16 beacon_miss_threshold; __le16 beacon_miss_threshold;
} __packed; } __packed;
/* Key descriptor flags */
#define RSI_KEY_TYPE_BROADCAST BIT(1)
#define RSI_WEP_KEY BIT(2)
#define RSI_WEP_KEY_104 BIT(3)
#define RSI_CIPHER_WPA BIT(4)
#define RSI_CIPHER_TKIP BIT(5)
#define RSI_PROTECT_DATA_FRAMES BIT(13)
#define RSI_KEY_ID_MASK 0xC0
#define RSI_KEY_ID_OFFSET 14
struct rsi_set_key { struct rsi_set_key {
__le16 desc_word[8]; struct rsi_cmd_desc_dword0 desc_dword0;
struct rsi_cmd_desc_dword1 desc_dword1;
__le16 key_desc;
__le32 bpn;
u8 sta_id;
u8 vap_id;
u8 key[4][32]; u8 key[4][32];
u8 tx_mic_key[8]; u8 tx_mic_key[8];
u8 rx_mic_key[8]; u8 rx_mic_key[8];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment