summarylogtreecommitdiffstats
path: root/0002-surface-wifi.patch
blob: 3c293b543b066f2b07899c41b27bde600f4b00ed (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
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ a/drivers/net/wireless/mwifiex/cfg80211.c
@@ -394,6 +394,8 @@ mwifiex_cfg80211_set_power_mgmt(struct wiphy *wiphy,
 			    "info: ignore timeout value for IEEE Power Save\n");

 	ps_mode = enabled;
+mwifiex_dbg(priv->adapter, ERROR, "jpw: hacking ps_mode to false\n");
+	ps_mode = 0;

 	return mwifiex_drv_set_power(priv, &ps_mode);
 }
--- a/drivers/net/wireless/mwifiex/pcie.c
+++ a/drivers/net/wireless/mwifiex/pcie.c
@@ -428,6 +428,8 @@ static int mwifiex_pm_wakeup_card_complete(struct mwifiex_adapter *adapter)
  */
 static int mwifiex_pcie_disable_host_int(struct mwifiex_adapter *adapter)
 {
+//	mwifiex_dbg(adapter, ERROR,
+//				    "disable_host_int");
 	if (mwifiex_pcie_ok_to_access_hw(adapter)) {
 		if (mwifiex_write_reg(adapter, PCIE_HOST_INT_MASK,
 				      0x00000000)) {
@@ -436,6 +438,9 @@ static int mwifiex_pcie_disable_host_int(struct mwifiex_adapter *adapter)
 			return -1;
 		}
 	}
+	else
+		mwifiex_dbg(adapter, ERROR,
+			    "Did NOT really disable host interrupt.\n");

 	return 0;
 }
@@ -448,6 +453,8 @@ static int mwifiex_pcie_disable_host_int(struct mwifiex_adapter *adapter)
  */
 static int mwifiex_pcie_enable_host_int(struct mwifiex_adapter *adapter)
 {
+//	mwifiex_dbg(adapter, ERROR,
+//				    "enable_host_int");
 	if (mwifiex_pcie_ok_to_access_hw(adapter)) {
 		/* Simply write the mask to the register */
 		if (mwifiex_write_reg(adapter, PCIE_HOST_INT_MASK,
@@ -1600,6 +1607,9 @@ static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter)

 	mwifiex_dbg(adapter, CMD,
 		    "info: Rx CMD Response\n");
+//	mwifiex_dbg(adapter, ERROR,
+//		    "jpw: %s skb %p, skb->len %d, skb->data_len %d, skb->head %p, skb->data %p, skb->tail %d, skb->end %d\n",
+//                  __func__, skb, skb->len, skb->data_len, skb->head, skb->data, skb->tail, skb->end);

 	mwifiex_unmap_pci_memory(adapter, skb, PCI_DMA_FROMDEVICE);

@@ -1612,6 +1622,14 @@ static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter)

 	pkt_len = *((__le16 *)skb->data);
 	rx_len = le16_to_cpu(pkt_len);
+	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_trim(skb, rx_len);
 	skb_pull(skb, INTF_HEADER_LEN);

@@ -1678,6 +1696,9 @@ static int mwifiex_pcie_cmdrsp_complete(struct mwifiex_adapter *adapter,
 	struct pcie_service_card *card = adapter->card;

 	if (skb) {
+//	mwifiex_dbg(adapter, ERROR,
+//		    "jpw: %s skb %p, skb->len %d, skb->data_len %d, skb->head %p, skb->data %p, skb->tail %d, skb->end %d\n",
+//                   __func__, skb, skb->len, skb->data_len, skb->head, skb->data, skb->tail, skb->end);
 		card->cmdrsp_buf = skb;
 		skb_push(card->cmdrsp_buf, INTF_HEADER_LEN);
 		if (mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE,
@@ -2195,6 +2216,7 @@ static int mwifiex_process_pcie_int(struct mwifiex_adapter *adapter)
 	pcie_ireg = adapter->int_status;
 	adapter->int_status = 0;
 	spin_unlock_irqrestore(&adapter->int_lock, flags);
+	mwifiex_dbg(adapter, INTR, "popped ireg: 0x%08x\n", pcie_ireg);

 	while (pcie_ireg & HOST_INTR_MASK) {
 		if (pcie_ireg & HOST_INTR_DNLD_DONE) {
@@ -2234,7 +2256,7 @@ static int mwifiex_process_pcie_int(struct mwifiex_adapter *adapter)
 			if (ret)
 				return ret;
 		}
-
+#if defined(JPW_EXPERIMENT_1)
 		if (mwifiex_pcie_ok_to_access_hw(adapter)) {
 			if (mwifiex_read_reg(adapter, PCIE_HOST_INT_STATUS,
 					     &pcie_ireg)) {
@@ -2254,6 +2276,7 @@ static int mwifiex_process_pcie_int(struct mwifiex_adapter *adapter)
 			}

 		}
+#endif
 	}
 	mwifiex_dbg(adapter, INTR,
 		    "info: cmd_sent=%d data_sent=%d\n",
--- a/drivers/net/wireless/mwifiex/sta_cmd.c
+++ a/drivers/net/wireless/mwifiex/sta_cmd.c
@@ -2237,7 +2237,7 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
 		if (ret)
 			return -1;

-		if (priv->bss_type != MWIFIEX_BSS_TYPE_UAP) {
+		if (0 && priv->bss_type != MWIFIEX_BSS_TYPE_UAP) {
 			/* Enable IEEE PS by default */
 			priv->adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_PSP;
 			ret = mwifiex_send_cmd(priv,
@@ -2300,7 +2300,7 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
 	if (ret)
 		return -1;

-	if (!disable_auto_ds &&
+	if (0 && !disable_auto_ds &&
 	    first_sta && priv->adapter->iface_type != MWIFIEX_USB &&
 	    priv->bss_type != MWIFIEX_BSS_TYPE_UAP) {
 		/* Enable auto deep sleep */
--- a/drivers/net/wireless/mwifiex/util.c
+++ a/drivers/net/wireless/mwifiex/util.c
@@ -406,8 +406,11 @@ mwifiex_process_mgmt_packet(struct mwifiex_private *priv,
 	u16 pkt_len;
 	struct ieee80211_hdr *ieee_hdr;

-	if (!skb)
+	if (!skb) {
+		mwifiex_dbg(priv->adapter, ERROR,
+			    "no skb");
 		return -1;
+	}

 	if (!priv->mgmt_frame_mask ||
 	    priv->wdev.iftype == NL80211_IFTYPE_UNSPECIFIED) {