mirror of https://gitee.com/openkylin/linux.git
rsi: remove unnecessary check for 802.11 management packet
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> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
parent
6abdf2c193
commit
dff80fc5fe
|
@ -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;
|
||||
|
@ -410,38 +409,31 @@ static int rsi_mgmt_pkt_to_core(struct rsi_common *common,
|
|||
u8 pad_bytes = msg[4];
|
||||
struct sk_buff *skb;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
skb = dev_alloc_skb(msg_len);
|
||||
if (!skb) {
|
||||
rsi_dbg(ERR_ZONE, "%s: Failed to allocate skb\n",
|
||||
__func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
skb_put_data(skb,
|
||||
(u8 *)(msg + FRAME_DESC_SZ + pad_bytes),
|
||||
msg_len);
|
||||
|
||||
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__);
|
||||
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)
|
||||
return -ENOMEM;
|
||||
|
||||
skb_put_data(skb,
|
||||
(u8 *)(msg + FRAME_DESC_SZ + pad_bytes),
|
||||
msg_len);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -1641,8 +1633,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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue