All of lore.kernel.org
 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 <amitkarwar@gmail.com>,
	Prameela Rani Garnepudi <prameela.j04cs@gmail.com>,
	Amitkumar Karwar <amit.karwar@redpinesignals.com>
Subject: [PATCH 04/17] rsi: remove unnecessary check for 802.11 management packet
Date: Fri, 23 Jun 2017 19:37:23 +0530	[thread overview]
Message-ID: <1498226856-6305-5-git-send-email-amit.karwar@redpinesignals.com> (raw)
In-Reply-To: <1498226856-6305-1-git-send-email-amit.karwar@redpinesignals.com>

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

The function rsi_mgmt_pkt_to_core() is for passing the 802.11
management frames to mac80211. So, it is unnecessary to check
again for the frame type 802.11 management in this function.
It can be checked before passing to this function.

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 | 56 ++++++++++++++-------------------
 1 file changed, 24 insertions(+), 32 deletions(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_mgmt.c b/drivers/net/wireless/rsi/rsi_91x_mgmt.c
index 77cb36a..c73007d 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mgmt.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mgmt.c
@@ -401,8 +401,7 @@ static int rsi_load_radio_caps(struct rsi_common *common)
  */
 static int rsi_mgmt_pkt_to_core(struct rsi_common *common,
 				u8 *msg,
-				s32 msg_len,
-				u8 type)
+				s32 msg_len)
 {
 	struct rsi_hw *adapter = common->priv;
 	struct ieee80211_tx_info *info;
@@ -412,41 +411,32 @@ static int rsi_mgmt_pkt_to_core(struct rsi_common *common,
 	struct sk_buff *skb;
 	char *buffer;
 
-	if (type == RX_DOT11_MGMT) {
-		if (!adapter->sc_nvifs)
-			return -ENOLINK;
+	if (!adapter->sc_nvifs)
+		return -ENOLINK;
 
-		msg_len -= pad_bytes;
-		if (msg_len <= 0) {
-			rsi_dbg(MGMT_RX_ZONE,
-				"%s: Invalid rx msg of len = %d\n",
-				__func__, msg_len);
-			return -EINVAL;
-		}
+	msg_len -= pad_bytes;
+	if (msg_len <= 0) {
+		rsi_dbg(MGMT_RX_ZONE,
+			"%s: Invalid rx msg of len = %d\n",
+			__func__, msg_len);
+		return -EINVAL;
+	}
 
-		skb = dev_alloc_skb(msg_len);
-		if (!skb) {
-			rsi_dbg(ERR_ZONE, "%s: Failed to allocate skb\n",
-				__func__);
-			return -ENOMEM;
-		}
+	skb = dev_alloc_skb(msg_len);
+	if (!skb)
+		return -ENOMEM;
 
-		buffer = skb_put(skb, msg_len);
+	buffer = skb_put(skb, msg_len);
 
-		memcpy(buffer,
-		       (u8 *)(msg +  FRAME_DESC_SZ + pad_bytes),
-		       msg_len);
+	memcpy(buffer, (u8 *)(msg +  FRAME_DESC_SZ + pad_bytes), msg_len);
 
-		pkt_recv = buffer[0];
+	pkt_recv = buffer[0];
 
-		info = IEEE80211_SKB_CB(skb);
-		rx_params = (struct skb_info *)info->driver_data;
-		rx_params->rssi = rsi_get_rssi(msg);
-		rx_params->channel = rsi_get_channel(msg);
-		rsi_indicate_pkt_to_os(common, skb);
-	} else {
-		rsi_dbg(MGMT_TX_ZONE, "%s: Internal Packet\n", __func__);
-	}
+	info = IEEE80211_SKB_CB(skb);
+	rx_params = (struct skb_info *)info->driver_data;
+	rx_params->rssi = rsi_get_rssi(msg);
+	rx_params->channel = rsi_get_channel(msg);
+	rsi_indicate_pkt_to_os(common, skb);
 
 	return 0;
 }
@@ -1647,8 +1637,10 @@ int rsi_mgmt_pkt_recv(struct rsi_common *common, u8 *msg)
 			rsi_dbg(FSM_ZONE, "%s: Probe confirm received\n",
 				__func__);
 		}
+	} else if (msg_type == RX_DOT11_MGMT) {
+		return rsi_mgmt_pkt_to_core(common, msg, msg_len);
 	} else {
-		return rsi_mgmt_pkt_to_core(common, msg, msg_len, msg_type);
+		rsi_dbg(INFO_ZONE, "Received packet type: 0x%x\n", msg_type);
 	}
 	return 0;
 }
-- 
2.7.4

  parent reply	other threads:[~2017-06-23 14:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-23 14:07 [PATCH 00/17] rsi: station enhancements Amitkumar Karwar
2017-06-23 14:07 ` [PATCH 01/17] rsi: add common structures needed for command packets Amitkumar Karwar
2017-06-23 14:07 ` [PATCH 02/17] rsi: immediate wakeup bit and priority for TX " Amitkumar Karwar
2017-06-23 14:07 ` [PATCH 03/17] rsi: Update in tx command frame radio capabilities Amitkumar Karwar
2017-06-23 14:07 ` Amitkumar Karwar [this message]
2017-06-23 14:07 ` [PATCH 05/17] rsi: Update peer notify command frame Amitkumar Karwar
2017-06-23 14:07 ` [PATCH 06/17] rsi: Update aggregation parameters " Amitkumar Karwar
2017-06-23 14:07 ` [PATCH 07/17] rsi: Update baseband RF programming frame Amitkumar Karwar
2017-06-23 14:07 ` [PATCH 08/17] rsi: update set_channel command frame Amitkumar Karwar
2017-06-23 14:07 ` [PATCH 09/17] rsi: update vap capabilities " Amitkumar Karwar
2017-06-23 14:07 ` [PATCH 10/17] rsi: update set_key " Amitkumar Karwar
2017-06-23 14:07 ` [PATCH 11/17] rsi: set_key enhancements Amitkumar Karwar
2017-06-23 14:07 ` [PATCH 12/17] rsi: update autorate request command frame Amitkumar Karwar
2017-06-23 14:07 ` [PATCH 13/17] rsi: block/unblock data queues as per connection status Amitkumar Karwar
2017-06-23 14:07 ` [PATCH 14/17] rsi: update tx command frame block/unblock data Amitkumar Karwar
2017-06-23 14:07 ` [PATCH 15/17] rsi: Remove internal header from Tx status skb Amitkumar Karwar
2017-06-23 14:07 ` [PATCH 16/17] rsi: Send rx filter frame to device when interface is down Amitkumar Karwar
2017-06-23 14:07 ` [PATCH 17/17] rsi: regulatory enhancements Amitkumar Karwar
2017-06-27 14:26 ` [PATCH 00/17] rsi: station enhancements Kalle Valo
2017-06-28  6:31   ` 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=1498226856-6305-5-git-send-email-amit.karwar@redpinesignals.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.