0007-wifi.patch 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. From 2a01efb959a43a387dab97223bcccfe6be4e582f Mon Sep 17 00:00:00 2001
  2. From: qzed <qzed@users.noreply.github.com>
  3. Date: Wed, 18 Sep 2019 03:18:25 +0200
  4. Subject: [PATCH 7/9] 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 | 10 +++++++---
  15. drivers/net/wireless/marvell/mwifiex/usb.c | 2 ++
  16. scripts/leaking_addresses.pl | 0
  17. 11 files changed, 47 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 088612438530..4386e657dfdb 100644
  21. --- a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c
  22. +++ b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c
  23. @@ -198,8 +198,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 d89684168500..1545bae9d6cf 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 e8788c35a453..82d25b3ca914 100644
  47. --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c
  48. +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
  49. @@ -1004,6 +1004,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. @@ -1011,11 +1012,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. @@ -1578,6 +1579,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 a9657ae6d782..ba99d84a31ef 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,16 +172,18 @@ 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. spin_lock_bh(&adapter->rx_proc_lock);
  108. if (adapter->rx_processing) {
  109. + adapter->more_rx_task_flag = true;
  110. spin_unlock_bh(&adapter->rx_proc_lock);
  111. } else {
  112. spin_unlock_bh(&adapter->rx_proc_lock);
  113. queue_work(adapter->rx_workqueue, &adapter->rx_work);
  114. }
  115. }
  116. +EXPORT_SYMBOL_GPL(mwifiex_queue_rx_work);
  117. static int mwifiex_process_rx(struct mwifiex_adapter *adapter)
  118. {
  119. @@ -189,6 +192,7 @@ static int mwifiex_process_rx(struct mwifiex_adapter *adapter)
  120. spin_lock_bh(&adapter->rx_proc_lock);
  121. if (adapter->rx_processing || adapter->rx_locked) {
  122. + adapter->more_rx_task_flag = true;
  123. spin_unlock_bh(&adapter->rx_proc_lock);
  124. goto exit_rx_proc;
  125. } else {
  126. @@ -196,6 +200,7 @@ static int mwifiex_process_rx(struct mwifiex_adapter *adapter)
  127. spin_unlock_bh(&adapter->rx_proc_lock);
  128. }
  129. +rx_process_start:
  130. /* Check for Rx data */
  131. while ((skb = skb_dequeue(&adapter->rx_data_q))) {
  132. atomic_dec(&adapter->rx_pending);
  133. @@ -217,6 +222,11 @@ static int mwifiex_process_rx(struct mwifiex_adapter *adapter)
  134. }
  135. }
  136. spin_lock_bh(&adapter->rx_proc_lock);
  137. + if (adapter->more_rx_task_flag) {
  138. + adapter->more_rx_task_flag = false;
  139. + spin_unlock_bh(&adapter->rx_proc_lock);
  140. + goto rx_process_start;
  141. + }
  142. adapter->rx_processing = false;
  143. spin_unlock_bh(&adapter->rx_proc_lock);
  144. @@ -280,11 +290,10 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter)
  145. mwifiex_process_hs_config(adapter);
  146. if (adapter->if_ops.process_int_status)
  147. adapter->if_ops.process_int_status(adapter);
  148. + if (adapter->rx_work_enabled && adapter->data_received)
  149. + mwifiex_queue_rx_work(adapter);
  150. }
  151. - if (adapter->rx_work_enabled && adapter->data_received)
  152. - mwifiex_queue_rx_work(adapter);
  153. -
  154. /* Need to wake up the card ? */
  155. if ((adapter->ps_state == PS_STATE_SLEEP) &&
  156. (adapter->pm_wakeup_card_req &&
  157. diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h
  158. index 095837fba300..5dca5c25c601 100644
  159. --- a/drivers/net/wireless/marvell/mwifiex/main.h
  160. +++ b/drivers/net/wireless/marvell/mwifiex/main.h
  161. @@ -909,6 +909,7 @@ struct mwifiex_adapter {
  162. spinlock_t main_proc_lock;
  163. u32 mwifiex_processing;
  164. u8 more_task_flag;
  165. + u8 more_rx_task_flag;
  166. u16 tx_buf_size;
  167. u16 curr_tx_buf_size;
  168. /* sdio single port rx aggregation capability */
  169. @@ -1695,6 +1696,7 @@ void mwifiex_upload_device_dump(struct mwifiex_adapter *adapter);
  170. void *mwifiex_alloc_dma_align_buf(int rx_len, gfp_t flags);
  171. void mwifiex_fw_dump_event(struct mwifiex_private *priv);
  172. void mwifiex_queue_main_work(struct mwifiex_adapter *adapter);
  173. +void mwifiex_queue_rx_work(struct mwifiex_adapter *adapter);
  174. int mwifiex_get_wakeup_reason(struct mwifiex_private *priv, u16 action,
  175. int cmd_type,
  176. struct mwifiex_ds_wakeup_reason *wakeup_reason);
  177. diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
  178. index b54f73e3d508..32502f443b9a 100644
  179. --- a/drivers/net/wireless/marvell/mwifiex/pcie.c
  180. +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
  181. @@ -1743,6 +1743,15 @@ static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter)
  182. }
  183. rx_len = get_unaligned_le16(skb->data);
  184. +
  185. + if (rx_len == 0) {
  186. + mwifiex_dbg(adapter, ERROR,
  187. + "0 byte cmdrsp\n");
  188. + mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE,
  189. + PCI_DMA_FROMDEVICE);
  190. + return 0;
  191. + }
  192. +
  193. skb_put(skb, MWIFIEX_UPLD_SIZE - skb->len);
  194. skb_trim(skb, rx_len);
  195. diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
  196. index 4ed10cf82f9a..485360e8534b 100644
  197. --- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
  198. +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
  199. @@ -30,8 +30,8 @@ static bool drcs;
  200. module_param(drcs, bool, 0644);
  201. MODULE_PARM_DESC(drcs, "multi-channel operation:1, single-channel operation:0");
  202. -static bool disable_auto_ds;
  203. -module_param(disable_auto_ds, bool, 0);
  204. +static bool disable_auto_ds = 1;
  205. +module_param(disable_auto_ds, bool, 0644);
  206. MODULE_PARM_DESC(disable_auto_ds,
  207. "deepsleep enabled=0(default), deepsleep disabled=1");
  208. /*
  209. diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
  210. index 20c206da0631..0e58da83417c 100644
  211. --- a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
  212. +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
  213. @@ -47,9 +47,13 @@ mwifiex_process_cmdresp_error(struct mwifiex_private *priv,
  214. struct mwifiex_adapter *adapter = priv->adapter;
  215. struct host_cmd_ds_802_11_ps_mode_enh *pm;
  216. - mwifiex_dbg(adapter, ERROR,
  217. - "CMD_RESP: cmd %#x error, result=%#x\n",
  218. - resp->command, resp->result);
  219. + if (resp->command == 271 && resp->result == 2) {
  220. + // ignore this command as the firmware does not support it
  221. + } else {
  222. + mwifiex_dbg(adapter, ERROR,
  223. + "CMD_RESP: cmd %#x error, result=%#x\n",
  224. + resp->command, resp->result);
  225. + }
  226. if (adapter->curr_cmd->wait_q_enabled)
  227. adapter->cmd_wait_q.status = -1;
  228. diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c
  229. index c2365eeb7016..0a219ba378dd 100644
  230. --- a/drivers/net/wireless/marvell/mwifiex/usb.c
  231. +++ b/drivers/net/wireless/marvell/mwifiex/usb.c
  232. @@ -144,6 +144,8 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter,
  233. skb_queue_tail(&adapter->rx_data_q, skb);
  234. adapter->data_received = true;
  235. atomic_inc(&adapter->rx_pending);
  236. + if (adapter->rx_work_enabled)
  237. + mwifiex_queue_rx_work(adapter);
  238. break;
  239. default:
  240. mwifiex_dbg(adapter, ERROR,
  241. diff --git a/scripts/leaking_addresses.pl b/scripts/leaking_addresses.pl
  242. old mode 100755
  243. new mode 100644
  244. --
  245. 2.23.0