Commit 2dbaf751 authored by Stone Piao's avatar Stone Piao Committed by John W. Linville

mwifiex: report received management frames to cfg80211

Process the management frames received from firmware and report
them to cfg80211.
Signed-off-by: default avatarStone Piao <piaoyun@marvell.com>
Signed-off-by: default avatarKiran Divekar <dkiran@marvell.com>
Signed-off-by: default avatarKevin Gan <ganhy@marvell.com>
Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 3cec6870
...@@ -94,6 +94,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { ...@@ -94,6 +94,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {
}; };
#define CAL_SNR(RSSI, NF) ((s16)((s16)(RSSI)-(s16)(NF))) #define CAL_SNR(RSSI, NF) ((s16)((s16)(RSSI)-(s16)(NF)))
#define CAL_RSSI(SNR, NF) ((s16)((s16)(SNR)+(s16)(NF)))
#define UAP_BSS_PARAMS_I 0 #define UAP_BSS_PARAMS_I 0
#define UAP_CUSTOM_IE_I 1 #define UAP_CUSTOM_IE_I 1
......
...@@ -214,6 +214,7 @@ static int mwifiex_init_priv(struct mwifiex_private *priv) ...@@ -214,6 +214,7 @@ static int mwifiex_init_priv(struct mwifiex_private *priv)
priv->wps_ie = NULL; priv->wps_ie = NULL;
priv->wps_ie_len = 0; priv->wps_ie_len = 0;
priv->ap_11n_enabled = 0; priv->ap_11n_enabled = 0;
priv->mgmt_rx_freq = 2437;
priv->scan_block = false; priv->scan_block = false;
......
...@@ -497,6 +497,7 @@ struct mwifiex_private { ...@@ -497,6 +497,7 @@ struct mwifiex_private {
struct timer_list scan_delay_timer; struct timer_list scan_delay_timer;
u8 ap_11n_enabled; u8 ap_11n_enabled;
u32 mgmt_frame_mask; u32 mgmt_frame_mask;
u32 mgmt_rx_freq;
}; };
enum mwifiex_ba_status { enum mwifiex_ba_status {
...@@ -741,6 +742,9 @@ int mwifiex_dnld_fw(struct mwifiex_adapter *, struct mwifiex_fw_image *); ...@@ -741,6 +742,9 @@ int mwifiex_dnld_fw(struct mwifiex_adapter *, struct mwifiex_fw_image *);
int mwifiex_recv_packet(struct mwifiex_adapter *, struct sk_buff *skb); int mwifiex_recv_packet(struct mwifiex_adapter *, struct sk_buff *skb);
int mwifiex_process_mgmt_packet(struct mwifiex_adapter *adapter,
struct sk_buff *skb);
int mwifiex_process_event(struct mwifiex_adapter *adapter); int mwifiex_process_event(struct mwifiex_adapter *adapter);
int mwifiex_complete_cmd(struct mwifiex_adapter *adapter, int mwifiex_complete_cmd(struct mwifiex_adapter *adapter,
......
...@@ -174,6 +174,12 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_adapter *adapter, ...@@ -174,6 +174,12 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_adapter *adapter,
dev_err(adapter->dev, "Rx of A-MSDU failed"); dev_err(adapter->dev, "Rx of A-MSDU failed");
} }
return 0; return 0;
} else if (rx_pkt_type == PKT_TYPE_MGMT) {
ret = mwifiex_process_mgmt_packet(adapter, skb);
if (ret)
dev_err(adapter->dev, "Rx of mgmt packet failed");
dev_kfree_skb_any(skb);
return ret;
} }
/* /*
......
...@@ -217,6 +217,12 @@ int mwifiex_process_uap_rx_packet(struct mwifiex_adapter *adapter, ...@@ -217,6 +217,12 @@ int mwifiex_process_uap_rx_packet(struct mwifiex_adapter *adapter,
} }
return 0; return 0;
} else if (rx_pkt_type == PKT_TYPE_MGMT) {
ret = mwifiex_process_mgmt_packet(adapter, skb);
if (ret)
dev_err(adapter->dev, "Rx of mgmt packet failed");
dev_kfree_skb_any(skb);
return ret;
} }
memcpy(ta, rx_pkt_hdr->eth803_hdr.h_source, ETH_ALEN); memcpy(ta, rx_pkt_hdr->eth803_hdr.h_source, ETH_ALEN);
......
...@@ -141,6 +141,46 @@ int mwifiex_get_debug_info(struct mwifiex_private *priv, ...@@ -141,6 +141,46 @@ int mwifiex_get_debug_info(struct mwifiex_private *priv,
return 0; return 0;
} }
/*
* This function processes the received management packet and send it
* to the kernel.
*/
int
mwifiex_process_mgmt_packet(struct mwifiex_adapter *adapter,
struct sk_buff *skb)
{
struct rxpd *rx_pd;
struct mwifiex_private *priv;
u16 pkt_len;
if (!skb)
return -1;
rx_pd = (struct rxpd *)skb->data;
priv = mwifiex_get_priv_by_id(adapter, rx_pd->bss_num, rx_pd->bss_type);
if (!priv)
return -1;
skb_pull(skb, le16_to_cpu(rx_pd->rx_pkt_offset));
skb_pull(skb, sizeof(pkt_len));
pkt_len = le16_to_cpu(rx_pd->rx_pkt_length);
/* Remove address4 */
memmove(skb->data + sizeof(struct ieee80211_hdr_3addr),
skb->data + sizeof(struct ieee80211_hdr),
pkt_len - sizeof(struct ieee80211_hdr));
pkt_len -= ETH_ALEN + sizeof(pkt_len);
rx_pd->rx_pkt_length = cpu_to_le16(pkt_len);
cfg80211_rx_mgmt(priv->wdev, priv->mgmt_rx_freq,
CAL_RSSI(rx_pd->snr, rx_pd->nf),
skb->data, pkt_len, GFP_ATOMIC);
return 0;
}
/* /*
* This function processes the received packet before sending it to the * This function processes the received packet before sending it to the
* kernel. * kernel.
......
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