aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwifiex
diff options
context:
space:
mode:
authorAvinash Patil <patila@marvell.com>2014-11-13 11:24:17 -0500
committerJohn W. Linville <linville@tuxdriver.com>2014-11-17 15:32:15 -0500
commit72e5aa8d2a6dd9313fc0877ed9eb43398d18ac13 (patch)
tree5ef164da8360b9d63566b73bbbe03a13d0007262 /drivers/net/wireless/mwifiex
parent9927baa3c7244b1f80582fc7360a7662bcb648ba (diff)
mwifiex: support for parsing TDLS discovery frames
This patch adds support for parsing TDLS discovery frames. After parsing, we update peer RSSI information. Signed-off-by: Avinash Patil <patila@marvell.com> Signed-off-by: Cathy Luo <cluo@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex')
-rw-r--r--drivers/net/wireless/mwifiex/util.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/net/wireless/mwifiex/util.c b/drivers/net/wireless/mwifiex/util.c
index ec79c49de097..a113ef8f0b8b 100644
--- a/drivers/net/wireless/mwifiex/util.c
+++ b/drivers/net/wireless/mwifiex/util.c
@@ -141,6 +141,38 @@ int mwifiex_get_debug_info(struct mwifiex_private *priv,
141 return 0; 141 return 0;
142} 142}
143 143
144static int
145mwifiex_parse_mgmt_packet(struct mwifiex_private *priv, u8 *payload, u16 len,
146 struct rxpd *rx_pd)
147{
148 u16 stype;
149 u8 category, action_code;
150 struct ieee80211_hdr *ieee_hdr = (void *)payload;
151
152 stype = (cpu_to_le16(ieee_hdr->frame_control) & IEEE80211_FCTL_STYPE);
153
154 switch (stype) {
155 case IEEE80211_STYPE_ACTION:
156 category = *(payload + sizeof(struct ieee80211_hdr));
157 action_code = *(payload + sizeof(struct ieee80211_hdr) + 1);
158 if (category == WLAN_CATEGORY_PUBLIC &&
159 action_code == WLAN_PUB_ACTION_TDLS_DISCOVER_RES) {
160 dev_dbg(priv->adapter->dev,
161 "TDLS discovery response %pM nf=%d, snr=%d\n",
162 ieee_hdr->addr2, rx_pd->nf, rx_pd->snr);
163 mwifiex_auto_tdls_update_peer_signal(priv,
164 ieee_hdr->addr2,
165 rx_pd->snr,
166 rx_pd->nf);
167 }
168 break;
169 default:
170 dev_dbg(priv->adapter->dev,
171 "unknown mgmt frame subytpe %#x\n", stype);
172 }
173
174 return 0;
175}
144/* 176/*
145 * This function processes the received management packet and send it 177 * This function processes the received management packet and send it
146 * to the kernel. 178 * to the kernel.
@@ -151,6 +183,7 @@ mwifiex_process_mgmt_packet(struct mwifiex_private *priv,
151{ 183{
152 struct rxpd *rx_pd; 184 struct rxpd *rx_pd;
153 u16 pkt_len; 185 u16 pkt_len;
186 struct ieee80211_hdr *ieee_hdr;
154 187
155 if (!skb) 188 if (!skb)
156 return -1; 189 return -1;
@@ -162,6 +195,11 @@ mwifiex_process_mgmt_packet(struct mwifiex_private *priv,
162 195
163 pkt_len = le16_to_cpu(rx_pd->rx_pkt_length); 196 pkt_len = le16_to_cpu(rx_pd->rx_pkt_length);
164 197
198 ieee_hdr = (void *)skb->data;
199 if (ieee80211_is_mgmt(ieee_hdr->frame_control)) {
200 mwifiex_parse_mgmt_packet(priv, (u8 *)ieee_hdr,
201 pkt_len, rx_pd);
202 }
165 /* Remove address4 */ 203 /* Remove address4 */
166 memmove(skb->data + sizeof(struct ieee80211_hdr_3addr), 204 memmove(skb->data + sizeof(struct ieee80211_hdr_3addr),
167 skb->data + sizeof(struct ieee80211_hdr), 205 skb->data + sizeof(struct ieee80211_hdr),