0008-wifi.patch 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. From 3dba15603a8fd4eb99f5abf3e569bae6affa4d8a Mon Sep 17 00:00:00 2001
  2. From: Maximilian Luz <luzmaximilian@gmail.com>
  3. Date: Fri, 26 Jul 2019 04:46:16 +0200
  4. Subject: [PATCH 08/12] wifi
  5. ---
  6. drivers/net/wireless/marvell/mwifiex/11n_aggr.c | 3 +--
  7. drivers/net/wireless/marvell/mwifiex/cfg80211.c | 5 ++++-
  8. drivers/net/wireless/marvell/mwifiex/cmdevt.c | 10 ++++++----
  9. drivers/net/wireless/marvell/mwifiex/fw.h | 1 +
  10. drivers/net/wireless/marvell/mwifiex/main.c | 17 +++++++++++++----
  11. drivers/net/wireless/marvell/mwifiex/main.h | 2 ++
  12. drivers/net/wireless/marvell/mwifiex/pcie.c | 9 +++++++++
  13. drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 4 ++--
  14. .../net/wireless/marvell/mwifiex/sta_cmdresp.c | 11 ++++++++---
  15. drivers/net/wireless/marvell/mwifiex/usb.c | 2 ++
  16. scripts/leaking_addresses.pl | 0
  17. 11 files changed, 48 insertions(+), 16 deletions(-)
  18. mode change 100755 => 100644 scripts/leaking_addresses.pl
  19. diff --git a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c
  20. index 042a1d07f686..fc9041f58e9f 100644
  21. --- a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c
  22. +++ b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c
  23. @@ -200,8 +200,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
  24. do {
  25. /* Check if AMSDU can accommodate this MSDU */
  26. - if ((skb_aggr->len + skb_src->len + LLC_SNAP_LEN) >
  27. - adapter->tx_buf_size)
  28. + if (skb_tailroom(skb_aggr) < (skb_src->len + LLC_SNAP_LEN))
  29. break;
  30. skb_src = skb_dequeue(&pra_list->skb_head);
  31. diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
  32. index e11a4bb67172..c3461a203deb 100644
  33. --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
  34. +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
  35. @@ -437,7 +437,10 @@ mwifiex_cfg80211_set_power_mgmt(struct wiphy *wiphy,
  36. mwifiex_dbg(priv->adapter, INFO,
  37. "info: ignore timeout value for IEEE Power Save\n");
  38. - ps_mode = enabled;
  39. + //ps_mode = enabled;
  40. +
  41. + mwifiex_dbg(priv->adapter, INFO, "overriding ps_mode to false\n");
  42. + ps_mode = 0;
  43. return mwifiex_drv_set_power(priv, &ps_mode);
  44. }
  45. diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
  46. index 8c35441fd9b7..71872139931e 100644
  47. --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c
  48. +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
  49. @@ -1006,6 +1006,7 @@ mwifiex_cmd_timeout_func(struct timer_list *t)
  50. if (cmd_node->wait_q_enabled) {
  51. adapter->cmd_wait_q.status = -ETIMEDOUT;
  52. mwifiex_cancel_pending_ioctl(adapter);
  53. + adapter->cmd_sent = false;
  54. }
  55. }
  56. if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) {
  57. @@ -1013,11 +1014,11 @@ mwifiex_cmd_timeout_func(struct timer_list *t)
  58. return;
  59. }
  60. - if (adapter->if_ops.device_dump)
  61. - adapter->if_ops.device_dump(adapter);
  62. + //if (adapter->if_ops.device_dump)
  63. + // adapter->if_ops.device_dump(adapter);
  64. - if (adapter->if_ops.card_reset)
  65. - adapter->if_ops.card_reset(adapter);
  66. + //if (adapter->if_ops.card_reset)
  67. + // adapter->if_ops.card_reset(adapter);
  68. }
  69. void
  70. @@ -1583,6 +1584,7 @@ int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv,
  71. adapter->key_api_minor_ver);
  72. break;
  73. case FW_API_VER_ID:
  74. + case FW_KEY_API_VER_ID:
  75. adapter->fw_api_ver =
  76. api_rev->major_ver;
  77. mwifiex_dbg(adapter, INFO,
  78. diff --git a/drivers/net/wireless/marvell/mwifiex/fw.h b/drivers/net/wireless/marvell/mwifiex/fw.h
  79. index 1fb76d2f5d3f..fb32379da99d 100644
  80. --- a/drivers/net/wireless/marvell/mwifiex/fw.h
  81. +++ b/drivers/net/wireless/marvell/mwifiex/fw.h
  82. @@ -1052,6 +1052,7 @@ struct host_cmd_ds_802_11_ps_mode_enh {
  83. enum API_VER_ID {
  84. KEY_API_VER_ID = 1,
  85. FW_API_VER_ID = 2,
  86. + FW_KEY_API_VER_ID = 4,
  87. };
  88. struct hw_spec_api_rev {
  89. diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c
  90. index f6da8edab7f1..51a65f26206b 100644
  91. --- a/drivers/net/wireless/marvell/mwifiex/main.c
  92. +++ b/drivers/net/wireless/marvell/mwifiex/main.c
  93. @@ -163,6 +163,7 @@ void mwifiex_queue_main_work(struct mwifiex_adapter *adapter)
  94. spin_lock_irqsave(&adapter->main_proc_lock, flags);
  95. if (adapter->mwifiex_processing) {
  96. adapter->more_task_flag = true;
  97. + adapter->more_rx_task_flag = true;
  98. spin_unlock_irqrestore(&adapter->main_proc_lock, flags);
  99. } else {
  100. spin_unlock_irqrestore(&adapter->main_proc_lock, flags);
  101. @@ -171,18 +172,20 @@ void mwifiex_queue_main_work(struct mwifiex_adapter *adapter)
  102. }
  103. EXPORT_SYMBOL_GPL(mwifiex_queue_main_work);
  104. -static void mwifiex_queue_rx_work(struct mwifiex_adapter *adapter)
  105. +void mwifiex_queue_rx_work(struct mwifiex_adapter *adapter)
  106. {
  107. unsigned long flags;
  108. spin_lock_irqsave(&adapter->rx_proc_lock, flags);
  109. if (adapter->rx_processing) {
  110. + adapter->more_rx_task_flag = true;
  111. spin_unlock_irqrestore(&adapter->rx_proc_lock, flags);
  112. } else {
  113. spin_unlock_irqrestore(&adapter->rx_proc_lock, flags);
  114. queue_work(adapter->rx_workqueue, &adapter->rx_work);
  115. }
  116. }
  117. +EXPORT_SYMBOL_GPL(mwifiex_queue_rx_work);
  118. static int mwifiex_process_rx(struct mwifiex_adapter *adapter)
  119. {
  120. @@ -192,6 +195,7 @@ static int mwifiex_process_rx(struct mwifiex_adapter *adapter)
  121. spin_lock_irqsave(&adapter->rx_proc_lock, flags);
  122. if (adapter->rx_processing || adapter->rx_locked) {
  123. + adapter->more_rx_task_flag = true;
  124. spin_unlock_irqrestore(&adapter->rx_proc_lock, flags);
  125. goto exit_rx_proc;
  126. } else {
  127. @@ -199,6 +203,7 @@ static int mwifiex_process_rx(struct mwifiex_adapter *adapter)
  128. spin_unlock_irqrestore(&adapter->rx_proc_lock, flags);
  129. }
  130. +rx_process_start:
  131. /* Check for Rx data */
  132. while ((skb = skb_dequeue(&adapter->rx_data_q))) {
  133. atomic_dec(&adapter->rx_pending);
  134. @@ -220,6 +225,11 @@ static int mwifiex_process_rx(struct mwifiex_adapter *adapter)
  135. }
  136. }
  137. spin_lock_irqsave(&adapter->rx_proc_lock, flags);
  138. + if (adapter->more_rx_task_flag) {
  139. + adapter->more_rx_task_flag = false;
  140. + spin_unlock_irqrestore(&adapter->rx_proc_lock, flags);
  141. + goto rx_process_start;
  142. + }
  143. adapter->rx_processing = false;
  144. spin_unlock_irqrestore(&adapter->rx_proc_lock, flags);
  145. @@ -283,11 +293,10 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter)
  146. mwifiex_process_hs_config(adapter);
  147. if (adapter->if_ops.process_int_status)
  148. adapter->if_ops.process_int_status(adapter);
  149. + if (adapter->rx_work_enabled && adapter->data_received)
  150. + mwifiex_queue_rx_work(adapter);
  151. }
  152. - if (adapter->rx_work_enabled && adapter->data_received)
  153. - mwifiex_queue_rx_work(adapter);
  154. -
  155. /* Need to wake up the card ? */
  156. if ((adapter->ps_state == PS_STATE_SLEEP) &&
  157. (adapter->pm_wakeup_card_req &&
  158. diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h
  159. index e39bb5c42c9a..8ec3275dad6d 100644
  160. --- a/drivers/net/wireless/marvell/mwifiex/main.h
  161. +++ b/drivers/net/wireless/marvell/mwifiex/main.h
  162. @@ -909,6 +909,7 @@ struct mwifiex_adapter {
  163. spinlock_t main_proc_lock;
  164. u32 mwifiex_processing;
  165. u8 more_task_flag;
  166. + u8 more_rx_task_flag;
  167. u16 tx_buf_size;
  168. u16 curr_tx_buf_size;
  169. /* sdio single port rx aggregation capability */
  170. @@ -1695,6 +1696,7 @@ void mwifiex_upload_device_dump(struct mwifiex_adapter *adapter);
  171. void *mwifiex_alloc_dma_align_buf(int rx_len, gfp_t flags);
  172. void mwifiex_fw_dump_event(struct mwifiex_private *priv);
  173. void mwifiex_queue_main_work(struct mwifiex_adapter *adapter);
  174. +void mwifiex_queue_rx_work(struct mwifiex_adapter *adapter);
  175. int mwifiex_get_wakeup_reason(struct mwifiex_private *priv, u16 action,
  176. int cmd_type,
  177. struct mwifiex_ds_wakeup_reason *wakeup_reason);
  178. diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
  179. index 3fe81b2a929a..6e734a83e6bf 100644
  180. --- a/drivers/net/wireless/marvell/mwifiex/pcie.c
  181. +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
  182. @@ -1743,6 +1743,15 @@ static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter)
  183. }
  184. rx_len = get_unaligned_le16(skb->data);
  185. +
  186. + if (rx_len == 0) {
  187. + mwifiex_dbg(adapter, ERROR,
  188. + "0 byte cmdrsp\n");
  189. + mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE,
  190. + PCI_DMA_FROMDEVICE);
  191. + return 0;
  192. + }
  193. +
  194. skb_put(skb, MWIFIEX_UPLD_SIZE - skb->len);
  195. skb_trim(skb, rx_len);
  196. diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
  197. index 4ed10cf82f9a..485360e8534b 100644
  198. --- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
  199. +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
  200. @@ -30,8 +30,8 @@ static bool drcs;
  201. module_param(drcs, bool, 0644);
  202. MODULE_PARM_DESC(drcs, "multi-channel operation:1, single-channel operation:0");
  203. -static bool disable_auto_ds;
  204. -module_param(disable_auto_ds, bool, 0);
  205. +static bool disable_auto_ds = 1;
  206. +module_param(disable_auto_ds, bool, 0644);
  207. MODULE_PARM_DESC(disable_auto_ds,
  208. "deepsleep enabled=0(default), deepsleep disabled=1");
  209. /*
  210. diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
  211. index 24b33e20e7a9..51d0f34625e1 100644
  212. --- a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
  213. +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
  214. @@ -48,9 +48,14 @@ mwifiex_process_cmdresp_error(struct mwifiex_private *priv,
  215. struct host_cmd_ds_802_11_ps_mode_enh *pm;
  216. unsigned long flags;
  217. - mwifiex_dbg(adapter, ERROR,
  218. - "CMD_RESP: cmd %#x error, result=%#x\n",
  219. - resp->command, resp->result);
  220. + if (resp->command == 271 && resp->result == 2){
  221. + // ignore this command as the firmware does not support it
  222. + }
  223. + else {
  224. + mwifiex_dbg(adapter, ERROR,
  225. + "CMD_RESP: cmd %#x error, result=%#x\n",
  226. + resp->command, resp->result);
  227. + }
  228. if (adapter->curr_cmd->wait_q_enabled)
  229. adapter->cmd_wait_q.status = -1;
  230. diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c
  231. index d445acc4786b..ae8e60cc17cb 100644
  232. --- a/drivers/net/wireless/marvell/mwifiex/usb.c
  233. +++ b/drivers/net/wireless/marvell/mwifiex/usb.c
  234. @@ -144,6 +144,8 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter,
  235. skb_queue_tail(&adapter->rx_data_q, skb);
  236. adapter->data_received = true;
  237. atomic_inc(&adapter->rx_pending);
  238. + if (adapter->rx_work_enabled)
  239. + mwifiex_queue_rx_work(adapter);
  240. break;
  241. default:
  242. mwifiex_dbg(adapter, ERROR,
  243. diff --git a/scripts/leaking_addresses.pl b/scripts/leaking_addresses.pl
  244. old mode 100755
  245. new mode 100644
  246. --
  247. 2.23.0