summarylogtreecommitdiffstats
path: root/0003-wifi.patch
blob: 587d799ea1422301738db9f1c5063c91234d9cae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 05dca3e..59c2fcc 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -807,13 +807,6 @@ static const struct usb_device_id	products[] = {
 	.driver_info = 0,
 },

-/* Microsoft Surface 3 dock (based on Realtek RTL8153) */
-{
-	USB_DEVICE_AND_INTERFACE_INFO(MICROSOFT_VENDOR_ID, 0x07c6, USB_CLASS_COMM,
-			USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
-	.driver_info = 0,
-},
-
 	/* TP-LINK UE300 USB 3.0 Ethernet Adapters (based on Realtek RTL8153) */
 {
 	USB_DEVICE_AND_INTERFACE_INFO(TPLINK_VENDOR_ID, 0x0601, USB_CLASS_COMM,
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index d51d9ab..b94ebe9 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -5310,7 +5310,6 @@ static const struct usb_device_id rtl8152_table[] = {
 	{REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8152)},
 	{REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8153)},
 	{REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07ab)},
-	{REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07c6)},
 	{REALTEK_USB_DEVICE(VENDOR_ID_SAMSUNG, 0xa101)},
 	{REALTEK_USB_DEVICE(VENDOR_ID_LENOVO,  0x304f)},
 	{REALTEK_USB_DEVICE(VENDOR_ID_LENOVO,  0x3062)},
diff --git a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c
index 042a1d0..fc9041f 100644
--- a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c
+++ b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c
@@ -200,8 +200,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,

 	do {
 		/* Check if AMSDU can accommodate this MSDU */
-		if ((skb_aggr->len + skb_src->len + LLC_SNAP_LEN) >
-		    adapter->tx_buf_size)
+		if (skb_tailroom(skb_aggr) < (skb_src->len + LLC_SNAP_LEN))
 			break;

 		skb_src = skb_dequeue(&pra_list->skb_head);
diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 32c5074..33a7325 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -2503,6 +2503,7 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
 	struct ieee80211_channel *chan;
 	struct ieee_types_header *ie;
 	struct mwifiex_user_scan_cfg *user_scan_cfg;
+	u8 mac_addr[ETH_ALEN];

 	mwifiex_dbg(priv->adapter, CMD,
 		    "info: received scan request on %s\n", dev->name);
@@ -2529,15 +2530,10 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
 	priv->scan_request = request;

 	if (request->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) {
-		ether_addr_copy(priv->random_mac, request->mac_addr);
-		for (i = 0; i < ETH_ALEN; i++) {
-			priv->random_mac[i] &= request->mac_addr_mask[i];
-			priv->random_mac[i] |= get_random_int() &
-					       ~(request->mac_addr_mask[i]);
-		}
-		ether_addr_copy(user_scan_cfg->random_mac, priv->random_mac);
-	} else {
-		eth_zero_addr(priv->random_mac);
+		get_random_mask_addr(mac_addr, request->mac_addr,
+				     request->mac_addr_mask);
+		ether_addr_copy(request->mac_addr, mac_addr);
+		ether_addr_copy(user_scan_cfg->random_mac, mac_addr);
 	}

 	user_scan_cfg->num_ssids = request->n_ssids;
diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h
index a76bd79..a34de85 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.h
+++ b/drivers/net/wireless/marvell/mwifiex/main.h
@@ -680,7 +680,6 @@ struct mwifiex_private {
 	struct mwifiex_user_scan_chan hidden_chan[MWIFIEX_USER_SCAN_CHAN_MAX];
 	u8 assoc_resp_ht_param;
 	bool ht_param_present;
-	u8 random_mac[ETH_ALEN];
 };


diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
index cd31494..3f2a881 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
@@ -1729,6 +1729,16 @@ static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter)
 	}

 	rx_len = get_unaligned_le16(skb->data);
+
+
+	if (rx_len == 0) {
+		mwifiex_dbg(adapter, ERROR,
+				    "0 byte cmdrsp\n");
+		mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE,
+					   PCI_DMA_FROMDEVICE);
+		return 0;
+	}
+
 	skb_put(skb, MWIFIEX_UPLD_SIZE - skb->len);
 	skb_trim(skb, rx_len);

diff --git a/drivers/net/wireless/marvell/mwifiex/scan.c b/drivers/net/wireless/marvell/mwifiex/scan.c
index c9d41ed..cddf412 100644
--- a/drivers/net/wireless/marvell/mwifiex/scan.c
+++ b/drivers/net/wireless/marvell/mwifiex/scan.c
@@ -1948,7 +1948,8 @@ mwifiex_active_scan_req_for_passive_chan(struct mwifiex_private *priv)

 	adapter->active_scan_triggered = true;
 	if (priv->scan_request->flags & NL80211_SCAN_FLAG_RANDOM_ADDR)
-		ether_addr_copy(user_scan_cfg->random_mac, priv->random_mac);
+		ether_addr_copy(user_scan_cfg->random_mac,
+				priv->scan_request->mac_addr);
 	user_scan_cfg->num_ssids = priv->scan_request->n_ssids;
 	user_scan_cfg->ssid_list = priv->scan_request->ssids;

diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
index fb09014..db03c6b 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
@@ -2336,8 +2336,8 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
 				return -1;
 		}

-		mwifiex_send_cmd(priv, HostCmd_CMD_CHAN_REGION_CFG,
-				 HostCmd_ACT_GEN_GET, 0, NULL, true);
+		//mwifiex_send_cmd(priv, HostCmd_CMD_CHAN_REGION_CFG,
+		//		 HostCmd_ACT_GEN_GET, 0, NULL, true);
 	}

 	/* get tx rate */
diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
index 0fba5b1..4e1687f 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
@@ -48,9 +48,14 @@ mwifiex_process_cmdresp_error(struct mwifiex_private *priv,
 	struct host_cmd_ds_802_11_ps_mode_enh *pm;
 	unsigned long flags;

-	mwifiex_dbg(adapter, ERROR,
-		    "CMD_RESP: cmd %#x error, result=%#x\n",
-		    resp->command, resp->result);
+	if (resp->command == 271 && resp->result == 2){
+		// ignore this command as the firmware does not support it
+	}
+	else {
+		mwifiex_dbg(adapter, ERROR,
+				"CMD_RESP: cmd %#x error, result=%#x\n",
+				resp->command, resp->result);
+	}

 	if (adapter->curr_cmd->wait_q_enabled)
 		adapter->cmd_wait_q.status = -1;
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index 3dd05a0..ab32ef1 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -690,6 +690,11 @@ void __cfg80211_connect_result(struct net_device *dev,
 		return;
 	}

+	if (WARN_ON(!wdev->ssid_len)) {
+		cfg80211_put_bss(wdev->wiphy, cr->bss);
+		return;
+	}
+
 	nl80211_send_connect_result(wiphy_to_rdev(wdev->wiphy), dev, cr,
 				    GFP_KERNEL);

@@ -1062,7 +1067,7 @@ int cfg80211_connect(struct cfg80211_registered_device *rdev,
 	/*
 	 * If we have an ssid_len, we're trying to connect or are
 	 * already connected, so reject a new SSID unless it's the
-	 * same (which is the case for re-association.)
+	 * same (which is the case for Re-Association.
 	 */
 	if (wdev->ssid_len &&
 	    (wdev->ssid_len != connect->ssid_len ||
diff --git b/net/wireless/sme.c.rej b/net/wireless/sme.c.rej
new file mode 100644
index 0000000..e78d68c
--- /dev/null
+++ b/net/wireless/sme.c.rej
@@ -0,0 +1,82 @@
+--- net/wireless/sme.c
++++ net/wireless/sme.c
+@@ -522,11 +522,6 @@ static int cfg80211_sme_connect(struct wireless_dev *wdev,
+ 		return -EOPNOTSUPP;
+
+ 	if (wdev->current_bss) {
+-		if (!prev_bssid)
+-			return -EALREADY;
+-		if (prev_bssid &&
+-		    !ether_addr_equal(prev_bssid, wdev->current_bss->pub.bssid))
+-			return -ENOTCONN;
+ 		cfg80211_unhold_bss(wdev->current_bss);
+ 		cfg80211_put_bss(wdev->wiphy, &wdev->current_bss->pub);
+ 		wdev->current_bss = NULL;
+@@ -1063,11 +1058,35 @@ int cfg80211_connect(struct cfg80211_registered_device *rdev,
+
+ 	ASSERT_WDEV_LOCK(wdev);
+
+-	if (WARN_ON(wdev->connect_keys)) {
+-		kzfree(wdev->connect_keys);
+-		wdev->connect_keys = NULL;
++	/*
++	 * If we have an ssid_len, we're trying to connect or are
++	 * already connected, so reject a new SSID unless it's the
++	 * same (which is the case for re-association.)
++	 */
++	if (wdev->ssid_len &&
++	    (wdev->ssid_len != connect->ssid_len ||
++	     memcmp(wdev->ssid, connect->ssid, wdev->ssid_len)))
++		return -EALREADY;
++
++	/*
++	 * If connected, reject (re-)association unless prev_bssid
++	 * matches the current BSSID.
++	 */
++	if (wdev->current_bss) {
++		if (!prev_bssid)
++			return -EALREADY;
++		if (!ether_addr_equal(prev_bssid, wdev->current_bss->pub.bssid))
++			return -ENOTCONN;
+ 	}
+
++	/*
++	 * Reject if we're in the process of connecting with WEP,
++	 * this case isn't very interesting and trying to handle
++	 * it would make the code much more complex.
++	 */
++	if (wdev->connect_keys)
++		return -EINPROGRESS;
++
+ 	cfg80211_oper_and_ht_capa(&connect->ht_capa_mask,
+ 				  rdev->wiphy.ht_capa_mod_mask);
+
+@@ -1118,7 +1137,12 @@ int cfg80211_connect(struct cfg80211_registered_device *rdev,
+
+ 	if (err) {
+ 		wdev->connect_keys = NULL;
+-		wdev->ssid_len = 0;
++		/*
++		 * This could be reassoc getting refused, don't clear
++		 * ssid_len in that case.
++		 */
++		if (!wdev->current_bss)
++			wdev->ssid_len = 0;
+ 		return err;
+ 	}
+
+@@ -1145,6 +1169,14 @@ int cfg80211_disconnect(struct cfg80211_registered_device *rdev,
+ 	else if (wdev->ssid_len)
+ 		err = rdev_disconnect(rdev, dev, reason);
+
++	/*
++	 * Clear ssid_len unless we actually were fully connected,
++	 * in which case cfg80211_disconnected() will take care of
++	 * this later.
++	 */
++	if (!wdev->current_bss)
++		wdev->ssid_len = 0;
++
+ 	return err;
+ }
+