aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwifiex
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/mwifiex')
-rw-r--r--drivers/net/wireless/mwifiex/11ac.c2
-rw-r--r--drivers/net/wireless/mwifiex/11ac.h2
-rw-r--r--drivers/net/wireless/mwifiex/11h.c2
-rw-r--r--drivers/net/wireless/mwifiex/11n.c2
-rw-r--r--drivers/net/wireless/mwifiex/11n.h2
-rw-r--r--drivers/net/wireless/mwifiex/11n_aggr.c2
-rw-r--r--drivers/net/wireless/mwifiex/11n_aggr.h2
-rw-r--r--drivers/net/wireless/mwifiex/11n_rxreorder.c2
-rw-r--r--drivers/net/wireless/mwifiex/11n_rxreorder.h2
-rw-r--r--drivers/net/wireless/mwifiex/Makefile2
-rw-r--r--drivers/net/wireless/mwifiex/README32
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c55
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.h2
-rw-r--r--drivers/net/wireless/mwifiex/cfp.c2
-rw-r--r--drivers/net/wireless/mwifiex/cmdevt.c30
-rw-r--r--drivers/net/wireless/mwifiex/debugfs.c95
-rw-r--r--drivers/net/wireless/mwifiex/decl.h2
-rw-r--r--drivers/net/wireless/mwifiex/ethtool.c85
-rw-r--r--drivers/net/wireless/mwifiex/fw.h2
-rw-r--r--drivers/net/wireless/mwifiex/ie.c2
-rw-r--r--drivers/net/wireless/mwifiex/init.c15
-rw-r--r--drivers/net/wireless/mwifiex/ioctl.h2
-rw-r--r--drivers/net/wireless/mwifiex/join.c2
-rw-r--r--drivers/net/wireless/mwifiex/main.c8
-rw-r--r--drivers/net/wireless/mwifiex/main.h34
-rw-r--r--drivers/net/wireless/mwifiex/pcie.c195
-rw-r--r--drivers/net/wireless/mwifiex/pcie.h12
-rw-r--r--drivers/net/wireless/mwifiex/scan.c2
-rw-r--r--drivers/net/wireless/mwifiex/sdio.c240
-rw-r--r--drivers/net/wireless/mwifiex/sdio.h14
-rw-r--r--drivers/net/wireless/mwifiex/sta_cmd.c2
-rw-r--r--drivers/net/wireless/mwifiex/sta_cmdresp.c2
-rw-r--r--drivers/net/wireless/mwifiex/sta_event.c2
-rw-r--r--drivers/net/wireless/mwifiex/sta_ioctl.c8
-rw-r--r--drivers/net/wireless/mwifiex/sta_rx.c2
-rw-r--r--drivers/net/wireless/mwifiex/sta_tx.c2
-rw-r--r--drivers/net/wireless/mwifiex/tdls.c8
-rw-r--r--drivers/net/wireless/mwifiex/txrx.c2
-rw-r--r--drivers/net/wireless/mwifiex/uap_cmd.c2
-rw-r--r--drivers/net/wireless/mwifiex/uap_event.c2
-rw-r--r--drivers/net/wireless/mwifiex/uap_txrx.c6
-rw-r--r--drivers/net/wireless/mwifiex/usb.c2
-rw-r--r--drivers/net/wireless/mwifiex/usb.h2
-rw-r--r--drivers/net/wireless/mwifiex/util.c2
-rw-r--r--drivers/net/wireless/mwifiex/util.h2
-rw-r--r--drivers/net/wireless/mwifiex/wmm.c11
-rw-r--r--drivers/net/wireless/mwifiex/wmm.h2
47 files changed, 787 insertions, 123 deletions
diff --git a/drivers/net/wireless/mwifiex/11ac.c b/drivers/net/wireless/mwifiex/11ac.c
index 706831df1fa2..59d23fb2365f 100644
--- a/drivers/net/wireless/mwifiex/11ac.c
+++ b/drivers/net/wireless/mwifiex/11ac.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: 802.11ac 2 * Marvell Wireless LAN device driver: 802.11ac
3 * 3 *
4 * Copyright (C) 2013, Marvell International Ltd. 4 * Copyright (C) 2013-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/11ac.h b/drivers/net/wireless/mwifiex/11ac.h
index 0b02cb6cfcb4..1ca92c7a8a4a 100644
--- a/drivers/net/wireless/mwifiex/11ac.h
+++ b/drivers/net/wireless/mwifiex/11ac.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: 802.11ac 2 * Marvell Wireless LAN device driver: 802.11ac
3 * 3 *
4 * Copyright (C) 2013, Marvell International Ltd. 4 * Copyright (C) 2013-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/11h.c b/drivers/net/wireless/mwifiex/11h.c
index e76b0db4e3e6..2668e83afbb6 100644
--- a/drivers/net/wireless/mwifiex/11h.c
+++ b/drivers/net/wireless/mwifiex/11h.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: 802.11h 2 * Marvell Wireless LAN device driver: 802.11h
3 * 3 *
4 * Copyright (C) 2013, Marvell International Ltd. 4 * Copyright (C) 2013-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/11n.c b/drivers/net/wireless/mwifiex/11n.c
index e1c2f67ae85e..9d6d8d9f01e3 100644
--- a/drivers/net/wireless/mwifiex/11n.c
+++ b/drivers/net/wireless/mwifiex/11n.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: 802.11n 2 * Marvell Wireless LAN device driver: 802.11n
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/11n.h b/drivers/net/wireless/mwifiex/11n.h
index 0b73fa08f5d4..2ee268b632be 100644
--- a/drivers/net/wireless/mwifiex/11n.h
+++ b/drivers/net/wireless/mwifiex/11n.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: 802.11n 2 * Marvell Wireless LAN device driver: 802.11n
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/11n_aggr.c b/drivers/net/wireless/mwifiex/11n_aggr.c
index fe0f66f73507..8720a3d3c755 100644
--- a/drivers/net/wireless/mwifiex/11n_aggr.c
+++ b/drivers/net/wireless/mwifiex/11n_aggr.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: 802.11n Aggregation 2 * Marvell Wireless LAN device driver: 802.11n Aggregation
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/11n_aggr.h b/drivers/net/wireless/mwifiex/11n_aggr.h
index 892098d6a696..0cd2a3eb6c17 100644
--- a/drivers/net/wireless/mwifiex/11n_aggr.h
+++ b/drivers/net/wireless/mwifiex/11n_aggr.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: 802.11n Aggregation 2 * Marvell Wireless LAN device driver: 802.11n Aggregation
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.c b/drivers/net/wireless/mwifiex/11n_rxreorder.c
index 0c3571f830b0..b22bae3d1205 100644
--- a/drivers/net/wireless/mwifiex/11n_rxreorder.c
+++ b/drivers/net/wireless/mwifiex/11n_rxreorder.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: 802.11n RX Re-ordering 2 * Marvell Wireless LAN device driver: 802.11n RX Re-ordering
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.h b/drivers/net/wireless/mwifiex/11n_rxreorder.h
index 0fc76e4a60f8..3a87bb0e3a62 100644
--- a/drivers/net/wireless/mwifiex/11n_rxreorder.h
+++ b/drivers/net/wireless/mwifiex/11n_rxreorder.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: 802.11n RX Re-ordering 2 * Marvell Wireless LAN device driver: 802.11n RX Re-ordering
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/Makefile b/drivers/net/wireless/mwifiex/Makefile
index 2aa208ffbe23..9487d728ac20 100644
--- a/drivers/net/wireless/mwifiex/Makefile
+++ b/drivers/net/wireless/mwifiex/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# Copyright (C) 2011, Marvell International Ltd. 2# Copyright (C) 2011-2014, Marvell International Ltd.
3# 3#
4# This software file (the "File") is distributed by Marvell International 4# This software file (the "File") is distributed by Marvell International
5# Ltd. under the terms of the GNU General Public License Version 2, June 1991 5# Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/README b/drivers/net/wireless/mwifiex/README
index 3b55ce5690a5..31928caeeed2 100644
--- a/drivers/net/wireless/mwifiex/README
+++ b/drivers/net/wireless/mwifiex/README
@@ -1,4 +1,4 @@
1# Copyright (C) 2011, Marvell International Ltd. 1# Copyright (C) 2011-2014, Marvell International Ltd.
2# 2#
3# This software file (the "File") is distributed by Marvell International 3# This software file (the "File") is distributed by Marvell International
4# Ltd. under the terms of the GNU General Public License Version 2, June 1991 4# Ltd. under the terms of the GNU General Public License Version 2, June 1991
@@ -194,6 +194,36 @@ rdeeprom
194 Example: 194 Example:
195 echo "0 20" > rdeeprom : Read 20 bytes of EEPROM data from offset 0 195 echo "0 20" > rdeeprom : Read 20 bytes of EEPROM data from offset 0
196 196
197hscfg
198 This command is used to debug/simulate host sleep feature using
199 different configuration parameters.
200
201 Usage:
202 echo "<condition> [GPIO# [gap]]]" > hscfg
203 cat hscfg
204
205 where the parameters are,
206 <condition>: bit 0 = 1 -- broadcast data
207 bit 1 = 1 -- unicast data
208 bit 2 = 1 -- mac event
209 bit 3 = 1 -- multicast data
210 [GPIO#]: pin number of GPIO used to wakeup the host.
211 GPIO pin# (e.g. 0-7) or 0xff (interface, e.g. SDIO
212 will be used instead).
213 [gap]: the gap in milliseconds between wakeup signal and
214 wakeup event or 0xff for special setting (host
215 acknowledge required) when GPIO is used to wakeup host.
216
217 Examples:
218 echo "-1" > hscfg : Cancel host sleep mode
219 echo "3" > hscfg : Broadcast and unicast data;
220 Use GPIO and gap set previously
221 echo "2 3" > hscfg : Unicast data and GPIO 3;
222 Use gap set previously
223 echo "2 1 160" > hscfg : Unicast data, GPIO 1 and gap 160 ms
224 echo "2 1 0xff" > hscfg : Unicast data, GPIO 1; Wait for host
225 to ack before sending wakeup event
226
197getlog 227getlog
198 This command is used to get the statistics available in the station. 228 This command is used to get the statistics available in the station.
199 Usage: 229 Usage:
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index b511613bba2d..6af135fa99f7 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: CFG80211 2 * Marvell Wireless LAN device driver: CFG80211
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
@@ -42,36 +42,6 @@ static const struct ieee80211_iface_combination mwifiex_iface_comb_ap_sta = {
42 .beacon_int_infra_match = true, 42 .beacon_int_infra_match = true,
43}; 43};
44 44
45static const struct ieee80211_regdomain mwifiex_world_regdom_custom = {
46 .n_reg_rules = 7,
47 .alpha2 = "99",
48 .reg_rules = {
49 /* Channel 1 - 11 */
50 REG_RULE(2412-10, 2462+10, 40, 3, 20, 0),
51 /* Channel 12 - 13 */
52 REG_RULE(2467-10, 2472+10, 20, 3, 20,
53 NL80211_RRF_NO_IR),
54 /* Channel 14 */
55 REG_RULE(2484-10, 2484+10, 20, 3, 20,
56 NL80211_RRF_NO_IR |
57 NL80211_RRF_NO_OFDM),
58 /* Channel 36 - 48 */
59 REG_RULE(5180-10, 5240+10, 40, 3, 20,
60 NL80211_RRF_NO_IR),
61 /* Channel 149 - 165 */
62 REG_RULE(5745-10, 5825+10, 40, 3, 20,
63 NL80211_RRF_NO_IR),
64 /* Channel 52 - 64 */
65 REG_RULE(5260-10, 5320+10, 40, 3, 30,
66 NL80211_RRF_NO_IR |
67 NL80211_RRF_DFS),
68 /* Channel 100 - 140 */
69 REG_RULE(5500-10, 5700+10, 40, 3, 30,
70 NL80211_RRF_NO_IR |
71 NL80211_RRF_DFS),
72 }
73};
74
75/* 45/*
76 * This function maps the nl802.11 channel type into driver channel type. 46 * This function maps the nl802.11 channel type into driver channel type.
77 * 47 *
@@ -151,7 +121,6 @@ mwifiex_form_mgmt_frame(struct sk_buff *skb, const u8 *buf, size_t len)
151 u8 addr[ETH_ALEN] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; 121 u8 addr[ETH_ALEN] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
152 u16 pkt_len; 122 u16 pkt_len;
153 u32 tx_control = 0, pkt_type = PKT_TYPE_MGMT; 123 u32 tx_control = 0, pkt_type = PKT_TYPE_MGMT;
154 struct timeval tv;
155 124
156 pkt_len = len + ETH_ALEN; 125 pkt_len = len + ETH_ALEN;
157 126
@@ -173,8 +142,7 @@ mwifiex_form_mgmt_frame(struct sk_buff *skb, const u8 *buf, size_t len)
173 len - sizeof(struct ieee80211_hdr_3addr)); 142 len - sizeof(struct ieee80211_hdr_3addr));
174 143
175 skb->priority = LOW_PRIO_TID; 144 skb->priority = LOW_PRIO_TID;
176 do_gettimeofday(&tv); 145 __net_timestamp(skb);
177 skb->tstamp = timeval_to_ktime(tv);
178 146
179 return 0; 147 return 0;
180} 148}
@@ -2484,6 +2452,16 @@ static int mwifiex_cfg80211_suspend(struct wiphy *wiphy,
2484 mef_entry->filter[filt_num].filt_type = TYPE_EQ; 2452 mef_entry->filter[filt_num].filt_type = TYPE_EQ;
2485 if (filt_num) 2453 if (filt_num)
2486 mef_entry->filter[filt_num].filt_action = TYPE_OR; 2454 mef_entry->filter[filt_num].filt_action = TYPE_OR;
2455
2456 filt_num++;
2457 mef_entry->filter[filt_num].repeat = 16;
2458 memcpy(mef_entry->filter[filt_num].byte_seq, priv->curr_addr,
2459 ETH_ALEN);
2460 mef_entry->filter[filt_num].byte_seq[MWIFIEX_MEF_MAX_BYTESEQ] =
2461 ETH_ALEN;
2462 mef_entry->filter[filt_num].offset = 56;
2463 mef_entry->filter[filt_num].filt_type = TYPE_EQ;
2464 mef_entry->filter[filt_num].filt_action = TYPE_OR;
2487 } 2465 }
2488 2466
2489 if (!mef_cfg.criteria) 2467 if (!mef_cfg.criteria)
@@ -2632,7 +2610,8 @@ static int
2632mwifiex_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, 2610mwifiex_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
2633 const u8 *peer, u8 action_code, u8 dialog_token, 2611 const u8 *peer, u8 action_code, u8 dialog_token,
2634 u16 status_code, u32 peer_capability, 2612 u16 status_code, u32 peer_capability,
2635 const u8 *extra_ies, size_t extra_ies_len) 2613 bool initiator, const u8 *extra_ies,
2614 size_t extra_ies_len)
2636{ 2615{
2637 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); 2616 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
2638 int ret; 2617 int ret;
@@ -2917,12 +2896,6 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
2917 wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS | 2896 wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
2918 WIPHY_FLAG_TDLS_EXTERNAL_SETUP; 2897 WIPHY_FLAG_TDLS_EXTERNAL_SETUP;
2919 2898
2920 wiphy->regulatory_flags |=
2921 REGULATORY_CUSTOM_REG |
2922 REGULATORY_STRICT_REG;
2923
2924 wiphy_apply_custom_regulatory(wiphy, &mwifiex_world_regdom_custom);
2925
2926#ifdef CONFIG_PM 2899#ifdef CONFIG_PM
2927 wiphy->wowlan = &mwifiex_wowlan_support; 2900 wiphy->wowlan = &mwifiex_wowlan_support;
2928#endif 2901#endif
diff --git a/drivers/net/wireless/mwifiex/cfg80211.h b/drivers/net/wireless/mwifiex/cfg80211.h
index c5848934f111..908367857d58 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.h
+++ b/drivers/net/wireless/mwifiex/cfg80211.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: CFG80211 2 * Marvell Wireless LAN device driver: CFG80211
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/cfp.c b/drivers/net/wireless/mwifiex/cfp.c
index 0ddec3d4b059..b8242eb2be6f 100644
--- a/drivers/net/wireless/mwifiex/cfp.c
+++ b/drivers/net/wireless/mwifiex/cfp.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: Channel, Frequence and Power 2 * Marvell Wireless LAN device driver: Channel, Frequence and Power
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c
index c161141f6c39..5899eee87fb1 100644
--- a/drivers/net/wireless/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/mwifiex/cmdevt.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: commands and events 2 * Marvell Wireless LAN device driver: commands and events
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
@@ -273,6 +273,7 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter)
273 (struct mwifiex_opt_sleep_confirm *) 273 (struct mwifiex_opt_sleep_confirm *)
274 adapter->sleep_cfm->data; 274 adapter->sleep_cfm->data;
275 struct sk_buff *sleep_cfm_tmp; 275 struct sk_buff *sleep_cfm_tmp;
276 struct timeval ts;
276 __le32 tmp; 277 __le32 tmp;
277 278
278 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); 279 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
@@ -283,6 +284,14 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter)
283 (adapter->seq_num, priv->bss_num, 284 (adapter->seq_num, priv->bss_num,
284 priv->bss_type))); 285 priv->bss_type)));
285 286
287 do_gettimeofday(&ts);
288 dev_dbg(adapter->dev,
289 "cmd: DNLD_CMD: (%lu.%lu): %#x, act %#x, len %d, seqno %#x\n",
290 ts.tv_sec, ts.tv_usec, le16_to_cpu(sleep_cfm_buf->command),
291 le16_to_cpu(sleep_cfm_buf->action),
292 le16_to_cpu(sleep_cfm_buf->size),
293 le16_to_cpu(sleep_cfm_buf->seq_num));
294
286 if (adapter->iface_type == MWIFIEX_USB) { 295 if (adapter->iface_type == MWIFIEX_USB) {
287 sleep_cfm_tmp = 296 sleep_cfm_tmp =
288 dev_alloc_skb(sizeof(struct mwifiex_opt_sleep_confirm) 297 dev_alloc_skb(sizeof(struct mwifiex_opt_sleep_confirm)
@@ -458,11 +467,10 @@ int mwifiex_process_event(struct mwifiex_adapter *adapter)
458 rx_info->bss_type = priv->bss_type; 467 rx_info->bss_type = priv->bss_type;
459 } 468 }
460 469
461 if (eventcause != EVENT_PS_SLEEP && eventcause != EVENT_PS_AWAKE) { 470 do_gettimeofday(&tstamp);
462 do_gettimeofday(&tstamp); 471 dev_dbg(adapter->dev, "EVENT: %lu.%lu: cause: %#x\n",
463 dev_dbg(adapter->dev, "event: %lu.%lu: cause: %#x\n", 472 tstamp.tv_sec, tstamp.tv_usec, eventcause);
464 tstamp.tv_sec, tstamp.tv_usec, eventcause); 473 if (eventcause == EVENT_PS_SLEEP || eventcause == EVENT_PS_AWAKE) {
465 } else {
466 /* Handle PS_SLEEP/AWAKE events on STA */ 474 /* Handle PS_SLEEP/AWAKE events on STA */
467 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA); 475 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA);
468 if (!priv) 476 if (!priv)
@@ -961,6 +969,9 @@ mwifiex_cmd_timeout_func(unsigned long function_context)
961 if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) 969 if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING)
962 mwifiex_init_fw_complete(adapter); 970 mwifiex_init_fw_complete(adapter);
963 971
972 if (adapter->if_ops.fw_dump)
973 adapter->if_ops.fw_dump(adapter);
974
964 if (adapter->if_ops.card_reset) 975 if (adapter->if_ops.card_reset)
965 adapter->if_ops.card_reset(adapter); 976 adapter->if_ops.card_reset(adapter);
966} 977}
@@ -1226,12 +1237,19 @@ mwifiex_process_sleep_confirm_resp(struct mwifiex_adapter *adapter,
1226 uint16_t result = le16_to_cpu(cmd->result); 1237 uint16_t result = le16_to_cpu(cmd->result);
1227 uint16_t command = le16_to_cpu(cmd->command); 1238 uint16_t command = le16_to_cpu(cmd->command);
1228 uint16_t seq_num = le16_to_cpu(cmd->seq_num); 1239 uint16_t seq_num = le16_to_cpu(cmd->seq_num);
1240 struct timeval ts;
1229 1241
1230 if (!upld_len) { 1242 if (!upld_len) {
1231 dev_err(adapter->dev, "%s: cmd size is 0\n", __func__); 1243 dev_err(adapter->dev, "%s: cmd size is 0\n", __func__);
1232 return; 1244 return;
1233 } 1245 }
1234 1246
1247 do_gettimeofday(&ts);
1248 dev_dbg(adapter->dev,
1249 "cmd: CMD_RESP: (%lu.%lu): 0x%x, result %d, len %d, seqno 0x%x\n",
1250 ts.tv_sec, ts.tv_usec, command, result, le16_to_cpu(cmd->size),
1251 seq_num);
1252
1235 /* Get BSS number and corresponding priv */ 1253 /* Get BSS number and corresponding priv */
1236 priv = mwifiex_get_priv_by_id(adapter, HostCmd_GET_BSS_NO(seq_num), 1254 priv = mwifiex_get_priv_by_id(adapter, HostCmd_GET_BSS_NO(seq_num),
1237 HostCmd_GET_BSS_TYPE(seq_num)); 1255 HostCmd_GET_BSS_TYPE(seq_num));
diff --git a/drivers/net/wireless/mwifiex/debugfs.c b/drivers/net/wireless/mwifiex/debugfs.c
index 7b419bbcd544..2713f7acd35e 100644
--- a/drivers/net/wireless/mwifiex/debugfs.c
+++ b/drivers/net/wireless/mwifiex/debugfs.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: debugfs 2 * Marvell Wireless LAN device driver: debugfs
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
@@ -692,6 +692,97 @@ done:
692 return ret; 692 return ret;
693} 693}
694 694
695/* Proc hscfg file write handler
696 * This function can be used to configure the host sleep parameters.
697 */
698static ssize_t
699mwifiex_hscfg_write(struct file *file, const char __user *ubuf,
700 size_t count, loff_t *ppos)
701{
702 struct mwifiex_private *priv = (void *)file->private_data;
703 unsigned long addr = get_zeroed_page(GFP_KERNEL);
704 char *buf = (char *)addr;
705 size_t buf_size = min_t(size_t, count, PAGE_SIZE - 1);
706 int ret, arg_num;
707 struct mwifiex_ds_hs_cfg hscfg;
708 int conditions = HS_CFG_COND_DEF;
709 u32 gpio = HS_CFG_GPIO_DEF, gap = HS_CFG_GAP_DEF;
710
711 if (!buf)
712 return -ENOMEM;
713
714 if (copy_from_user(buf, ubuf, buf_size)) {
715 ret = -EFAULT;
716 goto done;
717 }
718
719 arg_num = sscanf(buf, "%d %x %x", &conditions, &gpio, &gap);
720
721 memset(&hscfg, 0, sizeof(struct mwifiex_ds_hs_cfg));
722
723 if (arg_num > 3) {
724 dev_err(priv->adapter->dev, "Too many arguments\n");
725 ret = -EINVAL;
726 goto done;
727 }
728
729 if (arg_num >= 1 && arg_num < 3)
730 mwifiex_set_hs_params(priv, HostCmd_ACT_GEN_GET,
731 MWIFIEX_SYNC_CMD, &hscfg);
732
733 if (arg_num) {
734 if (conditions == HS_CFG_CANCEL) {
735 mwifiex_cancel_hs(priv, MWIFIEX_ASYNC_CMD);
736 ret = count;
737 goto done;
738 }
739 hscfg.conditions = conditions;
740 }
741 if (arg_num >= 2)
742 hscfg.gpio = gpio;
743 if (arg_num == 3)
744 hscfg.gap = gap;
745
746 hscfg.is_invoke_hostcmd = false;
747 mwifiex_set_hs_params(priv, HostCmd_ACT_GEN_SET,
748 MWIFIEX_SYNC_CMD, &hscfg);
749
750 mwifiex_enable_hs(priv->adapter);
751 priv->adapter->hs_enabling = false;
752 ret = count;
753done:
754 free_page(addr);
755 return ret;
756}
757
758/* Proc hscfg file read handler
759 * This function can be used to read host sleep configuration
760 * parameters from driver.
761 */
762static ssize_t
763mwifiex_hscfg_read(struct file *file, char __user *ubuf,
764 size_t count, loff_t *ppos)
765{
766 struct mwifiex_private *priv = (void *)file->private_data;
767 unsigned long addr = get_zeroed_page(GFP_KERNEL);
768 char *buf = (char *)addr;
769 int pos, ret;
770 struct mwifiex_ds_hs_cfg hscfg;
771
772 if (!buf)
773 return -ENOMEM;
774
775 mwifiex_set_hs_params(priv, HostCmd_ACT_GEN_GET,
776 MWIFIEX_SYNC_CMD, &hscfg);
777
778 pos = snprintf(buf, PAGE_SIZE, "%u 0x%x 0x%x\n", hscfg.conditions,
779 hscfg.gpio, hscfg.gap);
780
781 ret = simple_read_from_buffer(ubuf, count, ppos, buf, pos);
782
783 free_page(addr);
784 return ret;
785}
695 786
696#define MWIFIEX_DFS_ADD_FILE(name) do { \ 787#define MWIFIEX_DFS_ADD_FILE(name) do { \
697 if (!debugfs_create_file(#name, 0644, priv->dfs_dev_dir, \ 788 if (!debugfs_create_file(#name, 0644, priv->dfs_dev_dir, \
@@ -725,6 +816,7 @@ MWIFIEX_DFS_FILE_READ_OPS(getlog);
725MWIFIEX_DFS_FILE_READ_OPS(fw_dump); 816MWIFIEX_DFS_FILE_READ_OPS(fw_dump);
726MWIFIEX_DFS_FILE_OPS(regrdwr); 817MWIFIEX_DFS_FILE_OPS(regrdwr);
727MWIFIEX_DFS_FILE_OPS(rdeeprom); 818MWIFIEX_DFS_FILE_OPS(rdeeprom);
819MWIFIEX_DFS_FILE_OPS(hscfg);
728 820
729/* 821/*
730 * This function creates the debug FS directory structure and the files. 822 * This function creates the debug FS directory structure and the files.
@@ -747,6 +839,7 @@ mwifiex_dev_debugfs_init(struct mwifiex_private *priv)
747 MWIFIEX_DFS_ADD_FILE(regrdwr); 839 MWIFIEX_DFS_ADD_FILE(regrdwr);
748 MWIFIEX_DFS_ADD_FILE(rdeeprom); 840 MWIFIEX_DFS_ADD_FILE(rdeeprom);
749 MWIFIEX_DFS_ADD_FILE(fw_dump); 841 MWIFIEX_DFS_ADD_FILE(fw_dump);
842 MWIFIEX_DFS_ADD_FILE(hscfg);
750} 843}
751 844
752/* 845/*
diff --git a/drivers/net/wireless/mwifiex/decl.h b/drivers/net/wireless/mwifiex/decl.h
index 38da6ff6f416..0e03fe39fc35 100644
--- a/drivers/net/wireless/mwifiex/decl.h
+++ b/drivers/net/wireless/mwifiex/decl.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: generic data structures and APIs 2 * Marvell Wireless LAN device driver: generic data structures and APIs
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/ethtool.c b/drivers/net/wireless/mwifiex/ethtool.c
index bfb39908b2c6..04e56b5fc535 100644
--- a/drivers/net/wireless/mwifiex/ethtool.c
+++ b/drivers/net/wireless/mwifiex/ethtool.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: ethtool 2 * Marvell Wireless LAN device driver: ethtool
3 * 3 *
4 * Copyright (C) 2013, Marvell International Ltd. 4 * Copyright (C) 2013-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
@@ -64,7 +64,90 @@ static int mwifiex_ethtool_set_wol(struct net_device *dev,
64 return 0; 64 return 0;
65} 65}
66 66
67static int
68mwifiex_get_dump_flag(struct net_device *dev, struct ethtool_dump *dump)
69{
70 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
71 struct mwifiex_adapter *adapter = priv->adapter;
72 struct memory_type_mapping *entry;
73
74 if (!adapter->if_ops.fw_dump)
75 return -ENOTSUPP;
76
77 dump->flag = adapter->curr_mem_idx;
78 dump->version = 1;
79 if (adapter->curr_mem_idx != MWIFIEX_FW_DUMP_IDX) {
80 entry = &adapter->mem_type_mapping_tbl[adapter->curr_mem_idx];
81 dump->len = entry->mem_size;
82 } else {
83 dump->len = 0;
84 }
85
86 return 0;
87}
88
89static int
90mwifiex_get_dump_data(struct net_device *dev, struct ethtool_dump *dump,
91 void *buffer)
92{
93 u8 *p = buffer;
94 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
95 struct mwifiex_adapter *adapter = priv->adapter;
96 struct memory_type_mapping *entry;
97
98 if (!adapter->if_ops.fw_dump)
99 return -ENOTSUPP;
100
101 if (adapter->curr_mem_idx == MWIFIEX_FW_DUMP_IDX) {
102 dev_err(adapter->dev, "firmware dump in progress!!\n");
103 return -EBUSY;
104 }
105
106 entry = &adapter->mem_type_mapping_tbl[adapter->curr_mem_idx];
107
108 if (!entry->mem_ptr)
109 return -EFAULT;
110
111 memcpy(p, entry->mem_ptr, entry->mem_size);
112
113 entry->mem_size = 0;
114 vfree(entry->mem_ptr);
115 entry->mem_ptr = NULL;
116
117 return 0;
118}
119
120static int mwifiex_set_dump(struct net_device *dev, struct ethtool_dump *val)
121{
122 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
123 struct mwifiex_adapter *adapter = priv->adapter;
124
125 if (!adapter->if_ops.fw_dump)
126 return -ENOTSUPP;
127
128 if (adapter->curr_mem_idx == MWIFIEX_FW_DUMP_IDX) {
129 dev_err(adapter->dev, "firmware dump in progress!!\n");
130 return -EBUSY;
131 }
132
133 if (val->flag == MWIFIEX_FW_DUMP_IDX) {
134 adapter->curr_mem_idx = val->flag;
135 adapter->if_ops.fw_dump(adapter);
136 return 0;
137 }
138
139 if (val->flag < 0 || val->flag >= adapter->num_mem_types)
140 return -EINVAL;
141
142 adapter->curr_mem_idx = val->flag;
143
144 return 0;
145}
146
67const struct ethtool_ops mwifiex_ethtool_ops = { 147const struct ethtool_ops mwifiex_ethtool_ops = {
68 .get_wol = mwifiex_ethtool_get_wol, 148 .get_wol = mwifiex_ethtool_get_wol,
69 .set_wol = mwifiex_ethtool_set_wol, 149 .set_wol = mwifiex_ethtool_set_wol,
150 .get_dump_flag = mwifiex_get_dump_flag,
151 .get_dump_data = mwifiex_get_dump_data,
152 .set_dump = mwifiex_set_dump,
70}; 153};
diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h
index 3175dd04834b..5561573452bb 100644
--- a/drivers/net/wireless/mwifiex/fw.h
+++ b/drivers/net/wireless/mwifiex/fw.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: Firmware specific macros & structures 2 * Marvell Wireless LAN device driver: Firmware specific macros & structures
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/ie.c b/drivers/net/wireless/mwifiex/ie.c
index 3bf3d58bbc02..b933794758b7 100644
--- a/drivers/net/wireless/mwifiex/ie.c
+++ b/drivers/net/wireless/mwifiex/ie.c
@@ -2,7 +2,7 @@
2 * Marvell Wireless LAN device driver: management IE handling- setting and 2 * Marvell Wireless LAN device driver: management IE handling- setting and
3 * deleting IE. 3 * deleting IE.
4 * 4 *
5 * Copyright (C) 2012, Marvell International Ltd. 5 * Copyright (C) 2012-2014, Marvell International Ltd.
6 * 6 *
7 * This software file (the "File") is distributed by Marvell International 7 * This software file (the "File") is distributed by Marvell International
8 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 8 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c
index 4ecd0b208ac6..269a277d0a2e 100644
--- a/drivers/net/wireless/mwifiex/init.c
+++ b/drivers/net/wireless/mwifiex/init.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: HW/FW Initialization 2 * Marvell Wireless LAN device driver: HW/FW Initialization
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
@@ -382,6 +382,8 @@ static void mwifiex_free_lock_list(struct mwifiex_adapter *adapter)
382static void 382static void
383mwifiex_adapter_cleanup(struct mwifiex_adapter *adapter) 383mwifiex_adapter_cleanup(struct mwifiex_adapter *adapter)
384{ 384{
385 int idx;
386
385 if (!adapter) { 387 if (!adapter) {
386 pr_err("%s: adapter is NULL\n", __func__); 388 pr_err("%s: adapter is NULL\n", __func__);
387 return; 389 return;
@@ -396,7 +398,16 @@ mwifiex_adapter_cleanup(struct mwifiex_adapter *adapter)
396 dev_dbg(adapter->dev, "info: free cmd buffer\n"); 398 dev_dbg(adapter->dev, "info: free cmd buffer\n");
397 mwifiex_free_cmd_buffer(adapter); 399 mwifiex_free_cmd_buffer(adapter);
398 400
399 dev_dbg(adapter->dev, "info: free scan table\n"); 401 for (idx = 0; idx < adapter->num_mem_types; idx++) {
402 struct memory_type_mapping *entry =
403 &adapter->mem_type_mapping_tbl[idx];
404
405 if (entry->mem_ptr) {
406 vfree(entry->mem_ptr);
407 entry->mem_ptr = NULL;
408 }
409 entry->mem_size = 0;
410 }
400 411
401 if (adapter->sleep_cfm) 412 if (adapter->sleep_cfm)
402 dev_kfree_skb_any(adapter->sleep_cfm); 413 dev_kfree_skb_any(adapter->sleep_cfm);
diff --git a/drivers/net/wireless/mwifiex/ioctl.h b/drivers/net/wireless/mwifiex/ioctl.h
index 1b576722671d..0847f3e07ab7 100644
--- a/drivers/net/wireless/mwifiex/ioctl.h
+++ b/drivers/net/wireless/mwifiex/ioctl.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: ioctl data structures & APIs 2 * Marvell Wireless LAN device driver: ioctl data structures & APIs
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c
index 89dc62a467f4..fc135649b85f 100644
--- a/drivers/net/wireless/mwifiex/join.c
+++ b/drivers/net/wireless/mwifiex/join.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: association and ad-hoc start/join 2 * Marvell Wireless LAN device driver: association and ad-hoc start/join
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c
index e91cd0fa5ca8..3e5194fb0b0f 100644
--- a/drivers/net/wireless/mwifiex/main.c
+++ b/drivers/net/wireless/mwifiex/main.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: major functions 2 * Marvell Wireless LAN device driver: major functions
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
@@ -609,7 +609,6 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
609 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); 609 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
610 struct sk_buff *new_skb; 610 struct sk_buff *new_skb;
611 struct mwifiex_txinfo *tx_info; 611 struct mwifiex_txinfo *tx_info;
612 struct timeval tv;
613 612
614 dev_dbg(priv->adapter->dev, "data: %lu BSS(%d-%d): Data <= kernel\n", 613 dev_dbg(priv->adapter->dev, "data: %lu BSS(%d-%d): Data <= kernel\n",
615 jiffies, priv->bss_type, priv->bss_num); 614 jiffies, priv->bss_type, priv->bss_num);
@@ -657,8 +656,7 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
657 * firmware for aggregate delay calculation for stats and 656 * firmware for aggregate delay calculation for stats and
658 * MSDU lifetime expiry. 657 * MSDU lifetime expiry.
659 */ 658 */
660 do_gettimeofday(&tv); 659 __net_timestamp(skb);
661 skb->tstamp = timeval_to_ktime(tv);
662 660
663 mwifiex_queue_tx_pkt(priv, skb); 661 mwifiex_queue_tx_pkt(priv, skb);
664 662
@@ -882,6 +880,8 @@ mwifiex_add_card(void *card, struct semaphore *sem,
882 goto err_kmalloc; 880 goto err_kmalloc;
883 881
884 INIT_WORK(&adapter->main_work, mwifiex_main_work_queue); 882 INIT_WORK(&adapter->main_work, mwifiex_main_work_queue);
883 if (adapter->if_ops.iface_work)
884 INIT_WORK(&adapter->iface_work, adapter->if_ops.iface_work);
885 885
886 /* Register the device. Fill up the private data structure with relevant 886 /* Register the device. Fill up the private data structure with relevant
887 information from the card. */ 887 information from the card. */
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index 1398afa84064..a2733b1e63f9 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: major data structures and prototypes 2 * Marvell Wireless LAN device driver: major data structures and prototypes
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
@@ -30,6 +30,7 @@
30#include <linux/etherdevice.h> 30#include <linux/etherdevice.h>
31#include <net/sock.h> 31#include <net/sock.h>
32#include <net/lib80211.h> 32#include <net/lib80211.h>
33#include <linux/vmalloc.h>
33#include <linux/firmware.h> 34#include <linux/firmware.h>
34#include <linux/ctype.h> 35#include <linux/ctype.h>
35#include <linux/of.h> 36#include <linux/of.h>
@@ -410,6 +411,29 @@ struct mwifiex_roc_cfg {
410 struct ieee80211_channel chan; 411 struct ieee80211_channel chan;
411}; 412};
412 413
414#define MWIFIEX_FW_DUMP_IDX 0xff
415#define FW_DUMP_MAX_NAME_LEN 8
416#define FW_DUMP_HOST_READY 0xEE
417#define FW_DUMP_DONE 0xFF
418
419struct memory_type_mapping {
420 u8 mem_name[FW_DUMP_MAX_NAME_LEN];
421 u8 *mem_ptr;
422 u32 mem_size;
423 u8 done_flag;
424};
425
426enum rdwr_status {
427 RDWR_STATUS_SUCCESS = 0,
428 RDWR_STATUS_FAILURE = 1,
429 RDWR_STATUS_DONE = 2
430};
431
432enum mwifiex_iface_work_flags {
433 MWIFIEX_IFACE_WORK_FW_DUMP,
434 MWIFIEX_IFACE_WORK_CARD_RESET,
435};
436
413struct mwifiex_adapter; 437struct mwifiex_adapter;
414struct mwifiex_private; 438struct mwifiex_private;
415 439
@@ -674,6 +698,7 @@ struct mwifiex_if_ops {
674 void (*card_reset) (struct mwifiex_adapter *); 698 void (*card_reset) (struct mwifiex_adapter *);
675 void (*fw_dump)(struct mwifiex_adapter *); 699 void (*fw_dump)(struct mwifiex_adapter *);
676 int (*clean_pcie_ring) (struct mwifiex_adapter *adapter); 700 int (*clean_pcie_ring) (struct mwifiex_adapter *adapter);
701 void (*iface_work)(struct work_struct *work);
677}; 702};
678 703
679struct mwifiex_adapter { 704struct mwifiex_adapter {
@@ -809,6 +834,11 @@ struct mwifiex_adapter {
809 bool ext_scan; 834 bool ext_scan;
810 u8 fw_api_ver; 835 u8 fw_api_ver;
811 u8 fw_key_api_major_ver, fw_key_api_minor_ver; 836 u8 fw_key_api_major_ver, fw_key_api_minor_ver;
837 struct work_struct iface_work;
838 unsigned long iface_work_flags;
839 struct memory_type_mapping *mem_type_mapping_tbl;
840 u8 num_mem_types;
841 u8 curr_mem_idx;
812}; 842};
813 843
814int mwifiex_init_lock_list(struct mwifiex_adapter *adapter); 844int mwifiex_init_lock_list(struct mwifiex_adapter *adapter);
@@ -890,6 +920,8 @@ int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv,
890void mwifiex_process_hs_config(struct mwifiex_adapter *adapter); 920void mwifiex_process_hs_config(struct mwifiex_adapter *adapter);
891void mwifiex_hs_activated_event(struct mwifiex_private *priv, 921void mwifiex_hs_activated_event(struct mwifiex_private *priv,
892 u8 activated); 922 u8 activated);
923int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action,
924 int cmd_type, struct mwifiex_ds_hs_cfg *hs_cfg);
893int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private *priv, 925int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private *priv,
894 struct host_cmd_ds_command *resp); 926 struct host_cmd_ds_command *resp);
895int mwifiex_process_rx_packet(struct mwifiex_private *priv, 927int mwifiex_process_rx_packet(struct mwifiex_private *priv,
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c
index 2cc9b6fca490..5f7afffdd34e 100644
--- a/drivers/net/wireless/mwifiex/pcie.c
+++ b/drivers/net/wireless/mwifiex/pcie.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: PCIE specific handling 2 * Marvell Wireless LAN device driver: PCIE specific handling
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
@@ -37,6 +37,13 @@ static struct mwifiex_if_ops pcie_ops;
37 37
38static struct semaphore add_remove_card_sem; 38static struct semaphore add_remove_card_sem;
39 39
40static struct memory_type_mapping mem_type_mapping_tbl[] = {
41 {"ITCM", NULL, 0, 0xF0},
42 {"DTCM", NULL, 0, 0xF1},
43 {"SQRAM", NULL, 0, 0xF2},
44 {"IRAM", NULL, 0, 0xF3},
45};
46
40static int 47static int
41mwifiex_map_pci_memory(struct mwifiex_adapter *adapter, struct sk_buff *skb, 48mwifiex_map_pci_memory(struct mwifiex_adapter *adapter, struct sk_buff *skb,
42 size_t size, int flags) 49 size_t size, int flags)
@@ -192,6 +199,7 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev,
192 card->pcie.reg = data->reg; 199 card->pcie.reg = data->reg;
193 card->pcie.blksz_fw_dl = data->blksz_fw_dl; 200 card->pcie.blksz_fw_dl = data->blksz_fw_dl;
194 card->pcie.tx_buf_size = data->tx_buf_size; 201 card->pcie.tx_buf_size = data->tx_buf_size;
202 card->pcie.supports_fw_dump = data->supports_fw_dump;
195 } 203 }
196 204
197 if (mwifiex_add_card(card, &add_remove_card_sem, &pcie_ops, 205 if (mwifiex_add_card(card, &add_remove_card_sem, &pcie_ops,
@@ -221,6 +229,8 @@ static void mwifiex_pcie_remove(struct pci_dev *pdev)
221 if (!adapter || !adapter->priv_num) 229 if (!adapter || !adapter->priv_num)
222 return; 230 return;
223 231
232 cancel_work_sync(&adapter->iface_work);
233
224 if (user_rmmod) { 234 if (user_rmmod) {
225#ifdef CONFIG_PM_SLEEP 235#ifdef CONFIG_PM_SLEEP
226 if (adapter->is_suspended) 236 if (adapter->is_suspended)
@@ -307,6 +317,17 @@ static int mwifiex_read_reg(struct mwifiex_adapter *adapter, int reg, u32 *data)
307 return 0; 317 return 0;
308} 318}
309 319
320/* This function reads u8 data from PCIE card register. */
321static int mwifiex_read_reg_byte(struct mwifiex_adapter *adapter,
322 int reg, u8 *data)
323{
324 struct pcie_service_card *card = adapter->card;
325
326 *data = ioread8(card->pci_mmap1 + reg);
327
328 return 0;
329}
330
310/* 331/*
311 * This function adds delay loop to ensure FW is awake before proceeding. 332 * This function adds delay loop to ensure FW is awake before proceeding.
312 */ 333 */
@@ -2173,6 +2194,174 @@ static int mwifiex_pcie_host_to_card(struct mwifiex_adapter *adapter, u8 type,
2173 return 0; 2194 return 0;
2174} 2195}
2175 2196
2197/* This function read/write firmware */
2198static enum rdwr_status
2199mwifiex_pcie_rdwr_firmware(struct mwifiex_adapter *adapter, u8 doneflag)
2200{
2201 int ret, tries;
2202 u8 ctrl_data;
2203 struct pcie_service_card *card = adapter->card;
2204 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg;
2205
2206 ret = mwifiex_write_reg(adapter, reg->fw_dump_ctrl, FW_DUMP_HOST_READY);
2207 if (ret) {
2208 dev_err(adapter->dev, "PCIE write err\n");
2209 return RDWR_STATUS_FAILURE;
2210 }
2211
2212 for (tries = 0; tries < MAX_POLL_TRIES; tries++) {
2213 mwifiex_read_reg_byte(adapter, reg->fw_dump_ctrl, &ctrl_data);
2214 if (ctrl_data == FW_DUMP_DONE)
2215 return RDWR_STATUS_SUCCESS;
2216 if (doneflag && ctrl_data == doneflag)
2217 return RDWR_STATUS_DONE;
2218 if (ctrl_data != FW_DUMP_HOST_READY) {
2219 dev_info(adapter->dev,
2220 "The ctrl reg was changed, re-try again!\n");
2221 mwifiex_write_reg(adapter, reg->fw_dump_ctrl,
2222 FW_DUMP_HOST_READY);
2223 if (ret) {
2224 dev_err(adapter->dev, "PCIE write err\n");
2225 return RDWR_STATUS_FAILURE;
2226 }
2227 }
2228 usleep_range(100, 200);
2229 }
2230
2231 dev_err(adapter->dev, "Fail to pull ctrl_data\n");
2232 return RDWR_STATUS_FAILURE;
2233}
2234
2235/* This function dump firmware memory to file */
2236static void mwifiex_pcie_fw_dump_work(struct mwifiex_adapter *adapter)
2237{
2238 struct pcie_service_card *card = adapter->card;
2239 const struct mwifiex_pcie_card_reg *creg = card->pcie.reg;
2240 unsigned int reg, reg_start, reg_end;
2241 struct timeval t;
2242 u8 *dbg_ptr, *end_ptr, dump_num, idx, i, read_reg, doneflag = 0;
2243 enum rdwr_status stat;
2244 u32 memory_size;
2245 static char *env[] = { "DRIVER=mwifiex_pcie", "EVENT=fw_dump", NULL };
2246
2247 if (!card->pcie.supports_fw_dump)
2248 return;
2249
2250 for (idx = 0; idx < ARRAY_SIZE(mem_type_mapping_tbl); idx++) {
2251 struct memory_type_mapping *entry = &mem_type_mapping_tbl[idx];
2252
2253 if (entry->mem_ptr) {
2254 vfree(entry->mem_ptr);
2255 entry->mem_ptr = NULL;
2256 }
2257 entry->mem_size = 0;
2258 }
2259
2260 do_gettimeofday(&t);
2261 dev_info(adapter->dev, "== mwifiex firmware dump start: %u.%06u ==\n",
2262 (u32)t.tv_sec, (u32)t.tv_usec);
2263
2264 /* Read the number of the memories which will dump */
2265 stat = mwifiex_pcie_rdwr_firmware(adapter, doneflag);
2266 if (stat == RDWR_STATUS_FAILURE)
2267 goto done;
2268
2269 reg = creg->fw_dump_start;
2270 mwifiex_read_reg_byte(adapter, reg, &dump_num);
2271
2272 /* Read the length of every memory which will dump */
2273 for (idx = 0; idx < dump_num; idx++) {
2274 struct memory_type_mapping *entry = &mem_type_mapping_tbl[idx];
2275
2276 stat = mwifiex_pcie_rdwr_firmware(adapter, doneflag);
2277 if (stat == RDWR_STATUS_FAILURE)
2278 goto done;
2279
2280 memory_size = 0;
2281 reg = creg->fw_dump_start;
2282 for (i = 0; i < 4; i++) {
2283 mwifiex_read_reg_byte(adapter, reg, &read_reg);
2284 memory_size |= (read_reg << (i * 8));
2285 reg++;
2286 }
2287
2288 if (memory_size == 0) {
2289 dev_info(adapter->dev, "Firmware dump Finished!\n");
2290 break;
2291 }
2292
2293 dev_info(adapter->dev,
2294 "%s_SIZE=0x%x\n", entry->mem_name, memory_size);
2295 entry->mem_ptr = vmalloc(memory_size + 1);
2296 entry->mem_size = memory_size;
2297 if (!entry->mem_ptr) {
2298 dev_err(adapter->dev,
2299 "Vmalloc %s failed\n", entry->mem_name);
2300 goto done;
2301 }
2302 dbg_ptr = entry->mem_ptr;
2303 end_ptr = dbg_ptr + memory_size;
2304
2305 doneflag = entry->done_flag;
2306 do_gettimeofday(&t);
2307 dev_info(adapter->dev, "Start %s output %u.%06u, please wait...\n",
2308 entry->mem_name, (u32)t.tv_sec, (u32)t.tv_usec);
2309
2310 do {
2311 stat = mwifiex_pcie_rdwr_firmware(adapter, doneflag);
2312 if (RDWR_STATUS_FAILURE == stat)
2313 goto done;
2314
2315 reg_start = creg->fw_dump_start;
2316 reg_end = creg->fw_dump_end;
2317 for (reg = reg_start; reg <= reg_end; reg++) {
2318 mwifiex_read_reg_byte(adapter, reg, dbg_ptr);
2319 if (dbg_ptr < end_ptr)
2320 dbg_ptr++;
2321 else
2322 dev_err(adapter->dev,
2323 "Allocated buf not enough\n");
2324 }
2325
2326 if (stat != RDWR_STATUS_DONE)
2327 continue;
2328
2329 dev_info(adapter->dev, "%s done: size=0x%tx\n",
2330 entry->mem_name, dbg_ptr - entry->mem_ptr);
2331 break;
2332 } while (true);
2333 }
2334 do_gettimeofday(&t);
2335 dev_info(adapter->dev, "== mwifiex firmware dump end: %u.%06u ==\n",
2336 (u32)t.tv_sec, (u32)t.tv_usec);
2337
2338 kobject_uevent_env(&adapter->wiphy->dev.kobj, KOBJ_CHANGE, env);
2339
2340done:
2341 adapter->curr_mem_idx = 0;
2342}
2343
2344static void mwifiex_pcie_work(struct work_struct *work)
2345{
2346 struct mwifiex_adapter *adapter =
2347 container_of(work, struct mwifiex_adapter, iface_work);
2348
2349 if (test_and_clear_bit(MWIFIEX_IFACE_WORK_FW_DUMP,
2350 &adapter->iface_work_flags))
2351 mwifiex_pcie_fw_dump_work(adapter);
2352}
2353
2354/* This function dumps FW information */
2355static void mwifiex_pcie_fw_dump(struct mwifiex_adapter *adapter)
2356{
2357 if (test_bit(MWIFIEX_IFACE_WORK_FW_DUMP, &adapter->iface_work_flags))
2358 return;
2359
2360 set_bit(MWIFIEX_IFACE_WORK_FW_DUMP, &adapter->iface_work_flags);
2361
2362 schedule_work(&adapter->iface_work);
2363}
2364
2176/* 2365/*
2177 * This function initializes the PCI-E host memory space, WCB rings, etc. 2366 * This function initializes the PCI-E host memory space, WCB rings, etc.
2178 * 2367 *
@@ -2342,6 +2531,8 @@ static int mwifiex_register_dev(struct mwifiex_adapter *adapter)
2342 2531
2343 adapter->dev = &pdev->dev; 2532 adapter->dev = &pdev->dev;
2344 adapter->tx_buf_size = card->pcie.tx_buf_size; 2533 adapter->tx_buf_size = card->pcie.tx_buf_size;
2534 adapter->mem_type_mapping_tbl = mem_type_mapping_tbl;
2535 adapter->num_mem_types = ARRAY_SIZE(mem_type_mapping_tbl);
2345 strcpy(adapter->fw_name, card->pcie.firmware); 2536 strcpy(adapter->fw_name, card->pcie.firmware);
2346 2537
2347 return 0; 2538 return 0;
@@ -2394,6 +2585,8 @@ static struct mwifiex_if_ops pcie_ops = {
2394 .cleanup_mpa_buf = NULL, 2585 .cleanup_mpa_buf = NULL,
2395 .init_fw_port = mwifiex_pcie_init_fw_port, 2586 .init_fw_port = mwifiex_pcie_init_fw_port,
2396 .clean_pcie_ring = mwifiex_clean_pcie_ring_buf, 2587 .clean_pcie_ring = mwifiex_clean_pcie_ring_buf,
2588 .fw_dump = mwifiex_pcie_fw_dump,
2589 .iface_work = mwifiex_pcie_work,
2397}; 2590};
2398 2591
2399/* 2592/*
diff --git a/drivers/net/wireless/mwifiex/pcie.h b/drivers/net/wireless/mwifiex/pcie.h
index e8ec561f8a64..a1a8fd3bc1be 100644
--- a/drivers/net/wireless/mwifiex/pcie.h
+++ b/drivers/net/wireless/mwifiex/pcie.h
@@ -3,7 +3,7 @@
3 * @brief This file contains definitions for PCI-E interface. 3 * @brief This file contains definitions for PCI-E interface.
4 * driver. 4 * driver.
5 * 5 *
6 * Copyright (C) 2011, Marvell International Ltd. 6 * Copyright (C) 2011-2014, Marvell International Ltd.
7 * 7 *
8 * This software file (the "File") is distributed by Marvell International 8 * This software file (the "File") is distributed by Marvell International
9 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 9 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
@@ -129,6 +129,9 @@ struct mwifiex_pcie_card_reg {
129 u32 ring_tx_start_ptr; 129 u32 ring_tx_start_ptr;
130 u8 pfu_enabled; 130 u8 pfu_enabled;
131 u8 sleep_cookie; 131 u8 sleep_cookie;
132 u16 fw_dump_ctrl;
133 u16 fw_dump_start;
134 u16 fw_dump_end;
132}; 135};
133 136
134static const struct mwifiex_pcie_card_reg mwifiex_reg_8766 = { 137static const struct mwifiex_pcie_card_reg mwifiex_reg_8766 = {
@@ -191,6 +194,9 @@ static const struct mwifiex_pcie_card_reg mwifiex_reg_8897 = {
191 .ring_tx_start_ptr = MWIFIEX_BD_FLAG_TX_START_PTR, 194 .ring_tx_start_ptr = MWIFIEX_BD_FLAG_TX_START_PTR,
192 .pfu_enabled = 1, 195 .pfu_enabled = 1,
193 .sleep_cookie = 0, 196 .sleep_cookie = 0,
197 .fw_dump_ctrl = 0xcf4,
198 .fw_dump_start = 0xcf8,
199 .fw_dump_end = 0xcff
194}; 200};
195 201
196struct mwifiex_pcie_device { 202struct mwifiex_pcie_device {
@@ -198,6 +204,7 @@ struct mwifiex_pcie_device {
198 const struct mwifiex_pcie_card_reg *reg; 204 const struct mwifiex_pcie_card_reg *reg;
199 u16 blksz_fw_dl; 205 u16 blksz_fw_dl;
200 u16 tx_buf_size; 206 u16 tx_buf_size;
207 bool supports_fw_dump;
201}; 208};
202 209
203static const struct mwifiex_pcie_device mwifiex_pcie8766 = { 210static const struct mwifiex_pcie_device mwifiex_pcie8766 = {
@@ -205,6 +212,7 @@ static const struct mwifiex_pcie_device mwifiex_pcie8766 = {
205 .reg = &mwifiex_reg_8766, 212 .reg = &mwifiex_reg_8766,
206 .blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD, 213 .blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD,
207 .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K, 214 .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K,
215 .supports_fw_dump = false,
208}; 216};
209 217
210static const struct mwifiex_pcie_device mwifiex_pcie8897 = { 218static const struct mwifiex_pcie_device mwifiex_pcie8897 = {
@@ -212,6 +220,7 @@ static const struct mwifiex_pcie_device mwifiex_pcie8897 = {
212 .reg = &mwifiex_reg_8897, 220 .reg = &mwifiex_reg_8897,
213 .blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD, 221 .blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD,
214 .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K, 222 .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K,
223 .supports_fw_dump = true,
215}; 224};
216 225
217struct mwifiex_evt_buf_desc { 226struct mwifiex_evt_buf_desc {
@@ -322,4 +331,5 @@ mwifiex_pcie_txbd_not_full(struct pcie_service_card *card)
322 331
323 return 0; 332 return 0;
324} 333}
334
325#endif /* _MWIFIEX_PCIE_H */ 335#endif /* _MWIFIEX_PCIE_H */
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index 45c5b3450cf5..dee717a19ddb 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: scan ioctl and command handling 2 * Marvell Wireless LAN device driver: scan ioctl and command handling
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c
index 4ce3d7b33991..1da04a086bd9 100644
--- a/drivers/net/wireless/mwifiex/sdio.c
+++ b/drivers/net/wireless/mwifiex/sdio.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: SDIO specific handling 2 * Marvell Wireless LAN device driver: SDIO specific handling
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
@@ -50,6 +50,24 @@ static struct mwifiex_if_ops sdio_ops;
50 50
51static struct semaphore add_remove_card_sem; 51static struct semaphore add_remove_card_sem;
52 52
53static struct memory_type_mapping mem_type_mapping_tbl[] = {
54 {"ITCM", NULL, 0, 0xF0},
55 {"DTCM", NULL, 0, 0xF1},
56 {"SQRAM", NULL, 0, 0xF2},
57 {"APU", NULL, 0, 0xF3},
58 {"CIU", NULL, 0, 0xF4},
59 {"ICU", NULL, 0, 0xF5},
60 {"MAC", NULL, 0, 0xF6},
61 {"EXT7", NULL, 0, 0xF7},
62 {"EXT8", NULL, 0, 0xF8},
63 {"EXT9", NULL, 0, 0xF9},
64 {"EXT10", NULL, 0, 0xFA},
65 {"EXT11", NULL, 0, 0xFB},
66 {"EXT12", NULL, 0, 0xFC},
67 {"EXT13", NULL, 0, 0xFD},
68 {"EXTLAST", NULL, 0, 0xFE},
69};
70
53/* 71/*
54 * SDIO probe. 72 * SDIO probe.
55 * 73 *
@@ -87,6 +105,7 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
87 card->tx_buf_size = data->tx_buf_size; 105 card->tx_buf_size = data->tx_buf_size;
88 card->mp_tx_agg_buf_size = data->mp_tx_agg_buf_size; 106 card->mp_tx_agg_buf_size = data->mp_tx_agg_buf_size;
89 card->mp_rx_agg_buf_size = data->mp_rx_agg_buf_size; 107 card->mp_rx_agg_buf_size = data->mp_rx_agg_buf_size;
108 card->supports_fw_dump = data->supports_fw_dump;
90 } 109 }
91 110
92 sdio_claim_host(func); 111 sdio_claim_host(func);
@@ -179,6 +198,8 @@ mwifiex_sdio_remove(struct sdio_func *func)
179 if (!adapter || !adapter->priv_num) 198 if (!adapter || !adapter->priv_num)
180 return; 199 return;
181 200
201 cancel_work_sync(&adapter->iface_work);
202
182 if (user_rmmod) { 203 if (user_rmmod) {
183 if (adapter->is_suspended) 204 if (adapter->is_suspended)
184 mwifiex_sdio_resume(adapter->dev); 205 mwifiex_sdio_resume(adapter->dev);
@@ -1777,6 +1798,8 @@ static int mwifiex_register_dev(struct mwifiex_adapter *adapter)
1777 adapter->dev = &func->dev; 1798 adapter->dev = &func->dev;
1778 1799
1779 strcpy(adapter->fw_name, card->firmware); 1800 strcpy(adapter->fw_name, card->firmware);
1801 adapter->mem_type_mapping_tbl = mem_type_mapping_tbl;
1802 adapter->num_mem_types = ARRAY_SIZE(mem_type_mapping_tbl);
1780 1803
1781 return 0; 1804 return 0;
1782} 1805}
@@ -1914,10 +1937,10 @@ mwifiex_update_mp_end_port(struct mwifiex_adapter *adapter, u16 port)
1914 port, card->mp_data_port_mask); 1937 port, card->mp_data_port_mask);
1915} 1938}
1916 1939
1917static struct mmc_host *reset_host; 1940static void mwifiex_sdio_card_reset_work(struct mwifiex_adapter *adapter)
1918static void sdio_card_reset_worker(struct work_struct *work)
1919{ 1941{
1920 struct mmc_host *target = reset_host; 1942 struct sdio_mmc_card *card = adapter->card;
1943 struct mmc_host *target = card->func->card->host;
1921 1944
1922 /* The actual reset operation must be run outside of driver thread. 1945 /* The actual reset operation must be run outside of driver thread.
1923 * This is because mmc_remove_host() will cause the device to be 1946 * This is because mmc_remove_host() will cause the device to be
@@ -1933,15 +1956,213 @@ static void sdio_card_reset_worker(struct work_struct *work)
1933 mdelay(20); 1956 mdelay(20);
1934 mmc_add_host(target); 1957 mmc_add_host(target);
1935} 1958}
1936static DECLARE_WORK(card_reset_work, sdio_card_reset_worker); 1959
1960/* This function read/write firmware */
1961static enum
1962rdwr_status mwifiex_sdio_rdwr_firmware(struct mwifiex_adapter *adapter,
1963 u8 doneflag)
1964{
1965 struct sdio_mmc_card *card = adapter->card;
1966 int ret, tries;
1967 u8 ctrl_data = 0;
1968
1969 sdio_writeb(card->func, FW_DUMP_HOST_READY, card->reg->fw_dump_ctrl,
1970 &ret);
1971 if (ret) {
1972 dev_err(adapter->dev, "SDIO Write ERR\n");
1973 return RDWR_STATUS_FAILURE;
1974 }
1975 for (tries = 0; tries < MAX_POLL_TRIES; tries++) {
1976 ctrl_data = sdio_readb(card->func, card->reg->fw_dump_ctrl,
1977 &ret);
1978 if (ret) {
1979 dev_err(adapter->dev, "SDIO read err\n");
1980 return RDWR_STATUS_FAILURE;
1981 }
1982 if (ctrl_data == FW_DUMP_DONE)
1983 break;
1984 if (doneflag && ctrl_data == doneflag)
1985 return RDWR_STATUS_DONE;
1986 if (ctrl_data != FW_DUMP_HOST_READY) {
1987 dev_info(adapter->dev,
1988 "The ctrl reg was changed, re-try again!\n");
1989 sdio_writeb(card->func, FW_DUMP_HOST_READY,
1990 card->reg->fw_dump_ctrl, &ret);
1991 if (ret) {
1992 dev_err(adapter->dev, "SDIO write err\n");
1993 return RDWR_STATUS_FAILURE;
1994 }
1995 }
1996 usleep_range(100, 200);
1997 }
1998 if (ctrl_data == FW_DUMP_HOST_READY) {
1999 dev_err(adapter->dev, "Fail to pull ctrl_data\n");
2000 return RDWR_STATUS_FAILURE;
2001 }
2002
2003 return RDWR_STATUS_SUCCESS;
2004}
2005
2006/* This function dump firmware memory to file */
2007static void mwifiex_sdio_fw_dump_work(struct work_struct *work)
2008{
2009 struct mwifiex_adapter *adapter =
2010 container_of(work, struct mwifiex_adapter, iface_work);
2011 struct sdio_mmc_card *card = adapter->card;
2012 int ret = 0;
2013 unsigned int reg, reg_start, reg_end;
2014 u8 *dbg_ptr, *end_ptr, dump_num, idx, i, read_reg, doneflag = 0;
2015 struct timeval t;
2016 enum rdwr_status stat;
2017 u32 memory_size;
2018 static char *env[] = { "DRIVER=mwifiex_sdio", "EVENT=fw_dump", NULL };
2019
2020 if (!card->supports_fw_dump)
2021 return;
2022
2023 for (idx = 0; idx < ARRAY_SIZE(mem_type_mapping_tbl); idx++) {
2024 struct memory_type_mapping *entry = &mem_type_mapping_tbl[idx];
2025
2026 if (entry->mem_ptr) {
2027 vfree(entry->mem_ptr);
2028 entry->mem_ptr = NULL;
2029 }
2030 entry->mem_size = 0;
2031 }
2032
2033 mwifiex_pm_wakeup_card(adapter);
2034 sdio_claim_host(card->func);
2035
2036 do_gettimeofday(&t);
2037 dev_info(adapter->dev, "== mwifiex firmware dump start: %u.%06u ==\n",
2038 (u32)t.tv_sec, (u32)t.tv_usec);
2039
2040 stat = mwifiex_sdio_rdwr_firmware(adapter, doneflag);
2041 if (stat == RDWR_STATUS_FAILURE)
2042 goto done;
2043
2044 reg = card->reg->fw_dump_start;
2045 /* Read the number of the memories which will dump */
2046 dump_num = sdio_readb(card->func, reg, &ret);
2047 if (ret) {
2048 dev_err(adapter->dev, "SDIO read memory length err\n");
2049 goto done;
2050 }
2051
2052 /* Read the length of every memory which will dump */
2053 for (idx = 0; idx < dump_num; idx++) {
2054 struct memory_type_mapping *entry = &mem_type_mapping_tbl[idx];
2055
2056 stat = mwifiex_sdio_rdwr_firmware(adapter, doneflag);
2057 if (stat == RDWR_STATUS_FAILURE)
2058 goto done;
2059
2060 memory_size = 0;
2061 reg = card->reg->fw_dump_start;
2062 for (i = 0; i < 4; i++) {
2063 read_reg = sdio_readb(card->func, reg, &ret);
2064 if (ret) {
2065 dev_err(adapter->dev, "SDIO read err\n");
2066 goto done;
2067 }
2068 memory_size |= (read_reg << i*8);
2069 reg++;
2070 }
2071
2072 if (memory_size == 0) {
2073 dev_info(adapter->dev, "Firmware dump Finished!\n");
2074 break;
2075 }
2076
2077 dev_info(adapter->dev,
2078 "%s_SIZE=0x%x\n", entry->mem_name, memory_size);
2079 entry->mem_ptr = vmalloc(memory_size + 1);
2080 entry->mem_size = memory_size;
2081 if (!entry->mem_ptr) {
2082 dev_err(adapter->dev, "Vmalloc %s failed\n",
2083 entry->mem_name);
2084 goto done;
2085 }
2086 dbg_ptr = entry->mem_ptr;
2087 end_ptr = dbg_ptr + memory_size;
2088
2089 doneflag = entry->done_flag;
2090 do_gettimeofday(&t);
2091 dev_info(adapter->dev, "Start %s output %u.%06u, please wait...\n",
2092 entry->mem_name, (u32)t.tv_sec, (u32)t.tv_usec);
2093
2094 do {
2095 stat = mwifiex_sdio_rdwr_firmware(adapter, doneflag);
2096 if (stat == RDWR_STATUS_FAILURE)
2097 goto done;
2098
2099 reg_start = card->reg->fw_dump_start;
2100 reg_end = card->reg->fw_dump_end;
2101 for (reg = reg_start; reg <= reg_end; reg++) {
2102 *dbg_ptr = sdio_readb(card->func, reg, &ret);
2103 if (ret) {
2104 dev_err(adapter->dev,
2105 "SDIO read err\n");
2106 goto done;
2107 }
2108 if (dbg_ptr < end_ptr)
2109 dbg_ptr++;
2110 else
2111 dev_err(adapter->dev,
2112 "Allocated buf not enough\n");
2113 }
2114
2115 if (stat != RDWR_STATUS_DONE)
2116 continue;
2117
2118 dev_info(adapter->dev, "%s done: size=0x%tx\n",
2119 entry->mem_name, dbg_ptr - entry->mem_ptr);
2120 break;
2121 } while (1);
2122 }
2123 do_gettimeofday(&t);
2124 dev_info(adapter->dev, "== mwifiex firmware dump end: %u.%06u ==\n",
2125 (u32)t.tv_sec, (u32)t.tv_usec);
2126
2127 kobject_uevent_env(&adapter->wiphy->dev.kobj, KOBJ_CHANGE, env);
2128
2129done:
2130 sdio_release_host(card->func);
2131 adapter->curr_mem_idx = 0;
2132}
2133
2134static void mwifiex_sdio_work(struct work_struct *work)
2135{
2136 struct mwifiex_adapter *adapter =
2137 container_of(work, struct mwifiex_adapter, iface_work);
2138
2139 if (test_and_clear_bit(MWIFIEX_IFACE_WORK_CARD_RESET,
2140 &adapter->iface_work_flags))
2141 mwifiex_sdio_card_reset_work(adapter);
2142 if (test_and_clear_bit(MWIFIEX_IFACE_WORK_FW_DUMP,
2143 &adapter->iface_work_flags))
2144 mwifiex_sdio_fw_dump_work(work);
2145}
1937 2146
1938/* This function resets the card */ 2147/* This function resets the card */
1939static void mwifiex_sdio_card_reset(struct mwifiex_adapter *adapter) 2148static void mwifiex_sdio_card_reset(struct mwifiex_adapter *adapter)
1940{ 2149{
1941 struct sdio_mmc_card *card = adapter->card; 2150 if (test_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &adapter->iface_work_flags))
2151 return;
2152
2153 set_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &adapter->iface_work_flags);
2154
2155 schedule_work(&adapter->iface_work);
2156}
2157
2158/* This function dumps FW information */
2159static void mwifiex_sdio_fw_dump(struct mwifiex_adapter *adapter)
2160{
2161 if (test_bit(MWIFIEX_IFACE_WORK_FW_DUMP, &adapter->iface_work_flags))
2162 return;
1942 2163
1943 reset_host = card->func->card->host; 2164 set_bit(MWIFIEX_IFACE_WORK_FW_DUMP, &adapter->iface_work_flags);
1944 schedule_work(&card_reset_work); 2165 schedule_work(&adapter->iface_work);
1945} 2166}
1946 2167
1947static struct mwifiex_if_ops sdio_ops = { 2168static struct mwifiex_if_ops sdio_ops = {
@@ -1964,6 +2185,8 @@ static struct mwifiex_if_ops sdio_ops = {
1964 .cmdrsp_complete = mwifiex_sdio_cmdrsp_complete, 2185 .cmdrsp_complete = mwifiex_sdio_cmdrsp_complete,
1965 .event_complete = mwifiex_sdio_event_complete, 2186 .event_complete = mwifiex_sdio_event_complete,
1966 .card_reset = mwifiex_sdio_card_reset, 2187 .card_reset = mwifiex_sdio_card_reset,
2188 .iface_work = mwifiex_sdio_work,
2189 .fw_dump = mwifiex_sdio_fw_dump,
1967}; 2190};
1968 2191
1969/* 2192/*
@@ -2001,7 +2224,6 @@ mwifiex_sdio_cleanup_module(void)
2001 /* Set the flag as user is removing this module. */ 2224 /* Set the flag as user is removing this module. */
2002 user_rmmod = 1; 2225 user_rmmod = 1;
2003 2226
2004 cancel_work_sync(&card_reset_work);
2005 sdio_unregister_driver(&mwifiex_sdio); 2227 sdio_unregister_driver(&mwifiex_sdio);
2006} 2228}
2007 2229
diff --git a/drivers/net/wireless/mwifiex/sdio.h b/drivers/net/wireless/mwifiex/sdio.h
index 6eea30b43ed7..6b8835ec88f1 100644
--- a/drivers/net/wireless/mwifiex/sdio.h
+++ b/drivers/net/wireless/mwifiex/sdio.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: SDIO specific definitions 2 * Marvell Wireless LAN device driver: SDIO specific definitions
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
@@ -219,6 +219,9 @@ struct mwifiex_sdio_card_reg {
219 u8 rd_len_p0_l; 219 u8 rd_len_p0_l;
220 u8 rd_len_p0_u; 220 u8 rd_len_p0_u;
221 u8 card_misc_cfg_reg; 221 u8 card_misc_cfg_reg;
222 u8 fw_dump_ctrl;
223 u8 fw_dump_start;
224 u8 fw_dump_end;
222}; 225};
223 226
224struct sdio_mmc_card { 227struct sdio_mmc_card {
@@ -231,6 +234,7 @@ struct sdio_mmc_card {
231 u8 mp_agg_pkt_limit; 234 u8 mp_agg_pkt_limit;
232 bool supports_sdio_new_mode; 235 bool supports_sdio_new_mode;
233 bool has_control_mask; 236 bool has_control_mask;
237 bool supports_fw_dump;
234 u16 tx_buf_size; 238 u16 tx_buf_size;
235 u32 mp_tx_agg_buf_size; 239 u32 mp_tx_agg_buf_size;
236 u32 mp_rx_agg_buf_size; 240 u32 mp_rx_agg_buf_size;
@@ -257,6 +261,7 @@ struct mwifiex_sdio_device {
257 u8 mp_agg_pkt_limit; 261 u8 mp_agg_pkt_limit;
258 bool supports_sdio_new_mode; 262 bool supports_sdio_new_mode;
259 bool has_control_mask; 263 bool has_control_mask;
264 bool supports_fw_dump;
260 u16 tx_buf_size; 265 u16 tx_buf_size;
261 u32 mp_tx_agg_buf_size; 266 u32 mp_tx_agg_buf_size;
262 u32 mp_rx_agg_buf_size; 267 u32 mp_rx_agg_buf_size;
@@ -307,6 +312,9 @@ static const struct mwifiex_sdio_card_reg mwifiex_reg_sd8897 = {
307 .rd_len_p0_l = 0x0c, 312 .rd_len_p0_l = 0x0c,
308 .rd_len_p0_u = 0x0d, 313 .rd_len_p0_u = 0x0d,
309 .card_misc_cfg_reg = 0xcc, 314 .card_misc_cfg_reg = 0xcc,
315 .fw_dump_ctrl = 0xe2,
316 .fw_dump_start = 0xe3,
317 .fw_dump_end = 0xea,
310}; 318};
311 319
312static const struct mwifiex_sdio_device mwifiex_sdio_sd8786 = { 320static const struct mwifiex_sdio_device mwifiex_sdio_sd8786 = {
@@ -319,6 +327,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8786 = {
319 .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K, 327 .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K,
320 .mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K, 328 .mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K,
321 .mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K, 329 .mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K,
330 .supports_fw_dump = false,
322}; 331};
323 332
324static const struct mwifiex_sdio_device mwifiex_sdio_sd8787 = { 333static const struct mwifiex_sdio_device mwifiex_sdio_sd8787 = {
@@ -331,6 +340,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8787 = {
331 .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K, 340 .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K,
332 .mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K, 341 .mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K,
333 .mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K, 342 .mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K,
343 .supports_fw_dump = false,
334}; 344};
335 345
336static const struct mwifiex_sdio_device mwifiex_sdio_sd8797 = { 346static const struct mwifiex_sdio_device mwifiex_sdio_sd8797 = {
@@ -343,6 +353,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8797 = {
343 .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K, 353 .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K,
344 .mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K, 354 .mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K,
345 .mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K, 355 .mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K,
356 .supports_fw_dump = false,
346}; 357};
347 358
348static const struct mwifiex_sdio_device mwifiex_sdio_sd8897 = { 359static const struct mwifiex_sdio_device mwifiex_sdio_sd8897 = {
@@ -355,6 +366,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8897 = {
355 .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K, 366 .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K,
356 .mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_32K, 367 .mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_32K,
357 .mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_32K, 368 .mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_32K,
369 .supports_fw_dump = true,
358}; 370};
359 371
360/* 372/*
diff --git a/drivers/net/wireless/mwifiex/sta_cmd.c b/drivers/net/wireless/mwifiex/sta_cmd.c
index 88202ce0c139..0f077aaadab6 100644
--- a/drivers/net/wireless/mwifiex/sta_cmd.c
+++ b/drivers/net/wireless/mwifiex/sta_cmd.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: station command handling 2 * Marvell Wireless LAN device driver: station command handling
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c
index 577f2979ed8f..822357b7b0bb 100644
--- a/drivers/net/wireless/mwifiex/sta_cmdresp.c
+++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: station command response handling 2 * Marvell Wireless LAN device driver: station command response handling
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/sta_event.c b/drivers/net/wireless/mwifiex/sta_event.c
index f6395ef11a72..f1c240eca0cd 100644
--- a/drivers/net/wireless/mwifiex/sta_event.c
+++ b/drivers/net/wireless/mwifiex/sta_event.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: station event handling 2 * Marvell Wireless LAN device driver: station event handling
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
index 536c14aa71f3..1a03d4d8b418 100644
--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: functions for station ioctl 2 * Marvell Wireless LAN device driver: functions for station ioctl
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
@@ -26,7 +26,7 @@
26#include "11n.h" 26#include "11n.h"
27#include "cfg80211.h" 27#include "cfg80211.h"
28 28
29static int disconnect_on_suspend = 1; 29static int disconnect_on_suspend;
30module_param(disconnect_on_suspend, int, 0644); 30module_param(disconnect_on_suspend, int, 0644);
31 31
32/* 32/*
@@ -389,8 +389,8 @@ done:
389 * This function prepares the correct firmware command and 389 * This function prepares the correct firmware command and
390 * issues it. 390 * issues it.
391 */ 391 */
392static int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action, 392int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action,
393 int cmd_type, struct mwifiex_ds_hs_cfg *hs_cfg) 393 int cmd_type, struct mwifiex_ds_hs_cfg *hs_cfg)
394 394
395{ 395{
396 struct mwifiex_adapter *adapter = priv->adapter; 396 struct mwifiex_adapter *adapter = priv->adapter;
diff --git a/drivers/net/wireless/mwifiex/sta_rx.c b/drivers/net/wireless/mwifiex/sta_rx.c
index 8b639d7fe6df..9ceb1dbe34c5 100644
--- a/drivers/net/wireless/mwifiex/sta_rx.c
+++ b/drivers/net/wireless/mwifiex/sta_rx.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: station RX data handling 2 * Marvell Wireless LAN device driver: station RX data handling
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/sta_tx.c b/drivers/net/wireless/mwifiex/sta_tx.c
index 70eb863c7249..dab7b33c54be 100644
--- a/drivers/net/wireless/mwifiex/sta_tx.c
+++ b/drivers/net/wireless/mwifiex/sta_tx.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: station TX data handling 2 * Marvell Wireless LAN device driver: station TX data handling
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/tdls.c b/drivers/net/wireless/mwifiex/tdls.c
index 0e88364e0c67..a414161c6064 100644
--- a/drivers/net/wireless/mwifiex/tdls.c
+++ b/drivers/net/wireless/mwifiex/tdls.c
@@ -530,7 +530,6 @@ int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, const u8 *peer,
530{ 530{
531 struct sk_buff *skb; 531 struct sk_buff *skb;
532 struct mwifiex_txinfo *tx_info; 532 struct mwifiex_txinfo *tx_info;
533 struct timeval tv;
534 int ret; 533 int ret;
535 u16 skb_len; 534 u16 skb_len;
536 535
@@ -609,8 +608,7 @@ int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, const u8 *peer,
609 tx_info->bss_num = priv->bss_num; 608 tx_info->bss_num = priv->bss_num;
610 tx_info->bss_type = priv->bss_type; 609 tx_info->bss_type = priv->bss_type;
611 610
612 do_gettimeofday(&tv); 611 __net_timestamp(skb);
613 skb->tstamp = timeval_to_ktime(tv);
614 mwifiex_queue_tx_pkt(priv, skb); 612 mwifiex_queue_tx_pkt(priv, skb);
615 613
616 return 0; 614 return 0;
@@ -703,7 +701,6 @@ int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv, const u8 *peer,
703{ 701{
704 struct sk_buff *skb; 702 struct sk_buff *skb;
705 struct mwifiex_txinfo *tx_info; 703 struct mwifiex_txinfo *tx_info;
706 struct timeval tv;
707 u8 *pos; 704 u8 *pos;
708 u32 pkt_type, tx_control; 705 u32 pkt_type, tx_control;
709 u16 pkt_len, skb_len; 706 u16 pkt_len, skb_len;
@@ -769,8 +766,7 @@ int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv, const u8 *peer,
769 pkt_len = skb->len - MWIFIEX_MGMT_FRAME_HEADER_SIZE - sizeof(pkt_len); 766 pkt_len = skb->len - MWIFIEX_MGMT_FRAME_HEADER_SIZE - sizeof(pkt_len);
770 memcpy(skb->data + MWIFIEX_MGMT_FRAME_HEADER_SIZE, &pkt_len, 767 memcpy(skb->data + MWIFIEX_MGMT_FRAME_HEADER_SIZE, &pkt_len,
771 sizeof(pkt_len)); 768 sizeof(pkt_len));
772 do_gettimeofday(&tv); 769 __net_timestamp(skb);
773 skb->tstamp = timeval_to_ktime(tv);
774 mwifiex_queue_tx_pkt(priv, skb); 770 mwifiex_queue_tx_pkt(priv, skb);
775 771
776 return 0; 772 return 0;
diff --git a/drivers/net/wireless/mwifiex/txrx.c b/drivers/net/wireless/mwifiex/txrx.c
index fd7e5b9b4581..96a2126cc44b 100644
--- a/drivers/net/wireless/mwifiex/txrx.c
+++ b/drivers/net/wireless/mwifiex/txrx.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: generic TX/RX data handling 2 * Marvell Wireless LAN device driver: generic TX/RX data handling
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/uap_cmd.c b/drivers/net/wireless/mwifiex/uap_cmd.c
index 32643555dd2a..300bab438011 100644
--- a/drivers/net/wireless/mwifiex/uap_cmd.c
+++ b/drivers/net/wireless/mwifiex/uap_cmd.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: AP specific command handling 2 * Marvell Wireless LAN device driver: AP specific command handling
3 * 3 *
4 * Copyright (C) 2012, Marvell International Ltd. 4 * Copyright (C) 2012-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/uap_event.c b/drivers/net/wireless/mwifiex/uap_event.c
index 92e77a398ecf..7c2b97660a03 100644
--- a/drivers/net/wireless/mwifiex/uap_event.c
+++ b/drivers/net/wireless/mwifiex/uap_event.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: AP event handling 2 * Marvell Wireless LAN device driver: AP event handling
3 * 3 *
4 * Copyright (C) 2012, Marvell International Ltd. 4 * Copyright (C) 2012-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/uap_txrx.c b/drivers/net/wireless/mwifiex/uap_txrx.c
index b0601b91cc4f..ec7309d096ab 100644
--- a/drivers/net/wireless/mwifiex/uap_txrx.c
+++ b/drivers/net/wireless/mwifiex/uap_txrx.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: AP TX and RX data handling 2 * Marvell Wireless LAN device driver: AP TX and RX data handling
3 * 3 *
4 * Copyright (C) 2012, Marvell International Ltd. 4 * Copyright (C) 2012-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
@@ -96,7 +96,6 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv,
96 struct sk_buff *new_skb; 96 struct sk_buff *new_skb;
97 struct mwifiex_txinfo *tx_info; 97 struct mwifiex_txinfo *tx_info;
98 int hdr_chop; 98 int hdr_chop;
99 struct timeval tv;
100 struct ethhdr *p_ethhdr; 99 struct ethhdr *p_ethhdr;
101 100
102 uap_rx_pd = (struct uap_rxpd *)(skb->data); 101 uap_rx_pd = (struct uap_rxpd *)(skb->data);
@@ -193,8 +192,7 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv,
193 tx_info->pkt_len = skb->len; 192 tx_info->pkt_len = skb->len;
194 } 193 }
195 194
196 do_gettimeofday(&tv); 195 __net_timestamp(skb);
197 skb->tstamp = timeval_to_ktime(tv);
198 mwifiex_wmm_add_buf_txqueue(priv, skb); 196 mwifiex_wmm_add_buf_txqueue(priv, skb);
199 atomic_inc(&adapter->tx_pending); 197 atomic_inc(&adapter->tx_pending);
200 atomic_inc(&adapter->pending_bridged_pkts); 198 atomic_inc(&adapter->pending_bridged_pkts);
diff --git a/drivers/net/wireless/mwifiex/usb.c b/drivers/net/wireless/mwifiex/usb.c
index a8ce8130cfae..7118a18b91ba 100644
--- a/drivers/net/wireless/mwifiex/usb.c
+++ b/drivers/net/wireless/mwifiex/usb.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: USB specific handling 2 * Marvell Wireless LAN device driver: USB specific handling
3 * 3 *
4 * Copyright (C) 2012, Marvell International Ltd. 4 * Copyright (C) 2012-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/usb.h b/drivers/net/wireless/mwifiex/usb.h
index 15b73d12e998..4c41c2a193c5 100644
--- a/drivers/net/wireless/mwifiex/usb.h
+++ b/drivers/net/wireless/mwifiex/usb.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * This file contains definitions for mwifiex USB interface driver. 2 * This file contains definitions for mwifiex USB interface driver.
3 * 3 *
4 * Copyright (C) 2012, Marvell International Ltd. 4 * Copyright (C) 2012-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/util.c b/drivers/net/wireless/mwifiex/util.c
index 6da5abf52e61..cee028321a9a 100644
--- a/drivers/net/wireless/mwifiex/util.c
+++ b/drivers/net/wireless/mwifiex/util.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: utility functions 2 * Marvell Wireless LAN device driver: utility functions
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/util.h b/drivers/net/wireless/mwifiex/util.h
index caadb3737b9e..40296cb4a3f1 100644
--- a/drivers/net/wireless/mwifiex/util.h
+++ b/drivers/net/wireless/mwifiex/util.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: utility functions 2 * Marvell Wireless LAN device driver: utility functions
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c
index d3671d009f6c..94c98a86ebbe 100644
--- a/drivers/net/wireless/mwifiex/wmm.c
+++ b/drivers/net/wireless/mwifiex/wmm.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: WMM 2 * Marvell Wireless LAN device driver: WMM
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
@@ -878,15 +878,8 @@ u8
878mwifiex_wmm_compute_drv_pkt_delay(struct mwifiex_private *priv, 878mwifiex_wmm_compute_drv_pkt_delay(struct mwifiex_private *priv,
879 const struct sk_buff *skb) 879 const struct sk_buff *skb)
880{ 880{
881 u32 queue_delay = ktime_to_ms(net_timedelta(skb->tstamp));
881 u8 ret_val; 882 u8 ret_val;
882 struct timeval out_tstamp, in_tstamp;
883 u32 queue_delay;
884
885 do_gettimeofday(&out_tstamp);
886 in_tstamp = ktime_to_timeval(skb->tstamp);
887
888 queue_delay = (out_tstamp.tv_sec - in_tstamp.tv_sec) * 1000;
889 queue_delay += (out_tstamp.tv_usec - in_tstamp.tv_usec) / 1000;
890 883
891 /* 884 /*
892 * Queue delay is passed as a uint8 in units of 2ms (ms shifted 885 * Queue delay is passed as a uint8 in units of 2ms (ms shifted
diff --git a/drivers/net/wireless/mwifiex/wmm.h b/drivers/net/wireless/mwifiex/wmm.h
index eca56e371a57..569bd73f33c5 100644
--- a/drivers/net/wireless/mwifiex/wmm.h
+++ b/drivers/net/wireless/mwifiex/wmm.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Marvell Wireless LAN device driver: WMM 2 * Marvell Wireless LAN device driver: WMM
3 * 3 *
4 * Copyright (C) 2011, Marvell International Ltd. 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5 * 5 *
6 * This software file (the "File") is distributed by Marvell International 6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991