linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amitkumar Karwar <amitkarwar@gmail.com>
To: Kalle Valo <kvalo@codeaurora.org>
Cc: linux-wireless@vger.kernel.org,
	Amitkumar Karwar <amit.karwar@redpinesignals.com>,
	Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Subject: [v2 10/17] rsi: update set_key command frame
Date: Mon, 10 Jul 2017 18:10:41 +0530	[thread overview]
Message-ID: <1499690448-9956-11-git-send-email-amitkarwar@gmail.com> (raw)
In-Reply-To: <1499690448-9956-1-git-send-email-amitkarwar@gmail.com>

From: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>

TX command frame set_key is modified to use common descriptor
structure.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
---
 drivers/net/wireless/rsi/rsi_91x_mgmt.c | 26 +++++++++++++-------------
 drivers/net/wireless/rsi/rsi_mgmt.h     | 16 +++++++++++++++-
 2 files changed, 28 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_mgmt.c b/drivers/net/wireless/rsi/rsi_91x_mgmt.c
index 3ce1f71..9395d6d 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mgmt.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mgmt.c
@@ -709,39 +709,39 @@ int rsi_hal_load_key(struct rsi_common *common,
 	struct sk_buff *skb = NULL;
 	struct rsi_set_key *set_key;
 	u16 key_descriptor = 0;
+	u16 frame_len = sizeof(struct rsi_set_key);
 
 	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) {
 		rsi_dbg(ERR_ZONE, "%s: Failed in allocation of skb\n",
 			__func__);
 		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;
 
 	if ((cipher == WLAN_CIPHER_SUITE_WEP40) ||
 	    (cipher == WLAN_CIPHER_SUITE_WEP104)) {
 		key_len += 1;
-		key_descriptor |= BIT(2);
+		key_descriptor |= RSI_WEP_KEY;
 		if (key_len >= 13)
-			key_descriptor |= BIT(3);
+			key_descriptor |= RSI_WEP_KEY_104;
 	} else if (cipher != KEY_TYPE_CLEAR) {
-		key_descriptor |= BIT(4);
+		key_descriptor |= RSI_CIPHER_WPA;
 		if (key_type == RSI_PAIRWISE_KEY)
 			key_id = 0;
 		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) -
-					    FRAME_DESC_SZ) |
-					    (RSI_WIFI_MGMT_Q << 12));
-	set_key->desc_word[1] = cpu_to_le16(SET_KEY_REQ);
-	set_key->desc_word[4] = cpu_to_le16(key_descriptor);
+	rsi_set_len_qno(&set_key->desc_dword0.len_qno,
+			(frame_len - FRAME_DESC_SZ), RSI_WIFI_MGMT_Q);
+	set_key->desc_dword0.frame_type = SET_KEY_REQ;
+	set_key->key_desc = cpu_to_le16(key_descriptor);
 
 	if ((cipher == WLAN_CIPHER_SUITE_WEP40) ||
 	    (cipher == WLAN_CIPHER_SUITE_WEP104)) {
@@ -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->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);
 }
diff --git a/drivers/net/wireless/rsi/rsi_mgmt.h b/drivers/net/wireless/rsi/rsi_mgmt.h
index fcde44e..5df64d3 100644
--- a/drivers/net/wireless/rsi/rsi_mgmt.h
+++ b/drivers/net/wireless/rsi/rsi_mgmt.h
@@ -348,8 +348,22 @@ struct rsi_vap_caps {
 	__le16 beacon_miss_threshold;
 } __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 {
-	__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 tx_mic_key[8];
 	u8 rx_mic_key[8];
-- 
2.7.4

  parent reply	other threads:[~2017-07-10 12:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-10 12:40 [v2 00/17] rsi: station enhancements Amitkumar Karwar
2017-07-10 12:40 ` [v2 01/17] rsi: add common structures needed for command packets Amitkumar Karwar
2017-07-28 14:27   ` [v2,01/17] " Kalle Valo
2017-07-10 12:40 ` [v2 02/17] rsi: immediate wakeup bit and priority for TX " Amitkumar Karwar
2017-07-10 12:40 ` [v2 03/17] rsi: Update in tx command frame radio capabilities Amitkumar Karwar
2017-07-10 12:40 ` [v2 04/17] rsi: remove unnecessary check for 802.11 management packet Amitkumar Karwar
2017-07-10 12:40 ` [v2 05/17] rsi: Update peer notify command frame Amitkumar Karwar
2017-07-10 12:40 ` [v2 06/17] rsi: Update aggregation parameters " Amitkumar Karwar
2017-07-10 12:40 ` [v2 07/17] rsi: Update baseband RF programming frame Amitkumar Karwar
2017-07-10 12:40 ` [v2 08/17] rsi: update set_channel command frame Amitkumar Karwar
2017-07-10 12:40 ` [v2 09/17] rsi: update vap capabilities " Amitkumar Karwar
2017-07-10 12:40 ` Amitkumar Karwar [this message]
2017-07-10 12:40 ` [v2 11/17] rsi: set_key enhancements Amitkumar Karwar
2017-07-10 12:40 ` [v2 12/17] rsi: update autorate request command frame Amitkumar Karwar
2017-07-10 12:40 ` [v2 13/17] rsi: block/unblock data queues as per connection status Amitkumar Karwar
2017-07-10 12:40 ` [v2 14/17] rsi: update tx command frame block/unblock data Amitkumar Karwar
2017-07-10 12:40 ` [v2 15/17] rsi: Remove internal header from Tx status skb Amitkumar Karwar
2017-07-10 12:40 ` [v2 16/17] rsi: Send rx filter frame to device when interface is down Amitkumar Karwar
2017-07-10 12:40 ` [v2 17/17] rsi: regulatory enhancements Amitkumar Karwar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1499690448-9956-11-git-send-email-amitkarwar@gmail.com \
    --to=amitkarwar@gmail.com \
    --cc=amit.karwar@redpinesignals.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=prameela.j04cs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).