diff options
author | Shengzhen Li <szli@marvell.com> | 2015-02-11 12:42:24 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2015-02-27 03:08:40 -0500 |
commit | 04c7b363c9f7b05cb1bb94e14afbdd3661f9dd61 (patch) | |
tree | e7cfc11ba436f407c1d6488d1fafe8c54f679efc /drivers/net/wireless/mwifiex | |
parent | 8a1959beca2b58dc0173ef42eb60476637e86ff9 (diff) |
mwifiex: more_task flag for main_process
This patch handles a corner case where TX packet would remain in
driver queue till next packet comes in.
Here is sequence:
1. TX packet is queued via hard_start_xmit and main_work is queued
2. SDIO interrupt comes in which directly call mwifiex_main_process.
This starts executing main superloop.
3. Now work from step1 is scheduled but at first check itself it sees
mwifiex_processing is set and exits.
4. Now if superloop from step2 has passed TX processing part of superloop
this packet would remain in queue until next packet/command/SDIO interrupt
arrives and queues main_work.
This patch fixes this corner case by defining more_task flag which is set when
mwifiex_processing is found to be true. At end of superloop we again check if
more_task flag is set and if set, execute superloop again.
Signed-off-by: Shengzhen Li <szli@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/mwifiex')
-rw-r--r-- | drivers/net/wireless/mwifiex/main.c | 16 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/main.h | 1 |
2 files changed, 10 insertions, 7 deletions
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c index 7e74b4fccddd..74488aba92bd 100644 --- a/drivers/net/wireless/mwifiex/main.c +++ b/drivers/net/wireless/mwifiex/main.c | |||
@@ -190,14 +190,16 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter) | |||
190 | 190 | ||
191 | /* Check if already processing */ | 191 | /* Check if already processing */ |
192 | if (adapter->mwifiex_processing) { | 192 | if (adapter->mwifiex_processing) { |
193 | adapter->more_task_flag = true; | ||
193 | spin_unlock_irqrestore(&adapter->main_proc_lock, flags); | 194 | spin_unlock_irqrestore(&adapter->main_proc_lock, flags); |
194 | goto exit_main_proc; | 195 | goto exit_main_proc; |
195 | } else { | 196 | } else { |
196 | adapter->mwifiex_processing = true; | 197 | adapter->mwifiex_processing = true; |
197 | spin_unlock_irqrestore(&adapter->main_proc_lock, flags); | ||
198 | } | 198 | } |
199 | process_start: | 199 | process_start: |
200 | do { | 200 | do { |
201 | adapter->more_task_flag = false; | ||
202 | spin_unlock_irqrestore(&adapter->main_proc_lock, flags); | ||
201 | if ((adapter->hw_status == MWIFIEX_HW_STATUS_CLOSING) || | 203 | if ((adapter->hw_status == MWIFIEX_HW_STATUS_CLOSING) || |
202 | (adapter->hw_status == MWIFIEX_HW_STATUS_NOT_READY)) | 204 | (adapter->hw_status == MWIFIEX_HW_STATUS_NOT_READY)) |
203 | break; | 205 | break; |
@@ -238,6 +240,7 @@ process_start: | |||
238 | adapter->pm_wakeup_fw_try = true; | 240 | adapter->pm_wakeup_fw_try = true; |
239 | mod_timer(&adapter->wakeup_timer, jiffies + (HZ*3)); | 241 | mod_timer(&adapter->wakeup_timer, jiffies + (HZ*3)); |
240 | adapter->if_ops.wakeup(adapter); | 242 | adapter->if_ops.wakeup(adapter); |
243 | spin_lock_irqsave(&adapter->main_proc_lock, flags); | ||
241 | continue; | 244 | continue; |
242 | } | 245 | } |
243 | 246 | ||
@@ -295,8 +298,10 @@ process_start: | |||
295 | if ((adapter->ps_state == PS_STATE_SLEEP) || | 298 | if ((adapter->ps_state == PS_STATE_SLEEP) || |
296 | (adapter->ps_state == PS_STATE_PRE_SLEEP) || | 299 | (adapter->ps_state == PS_STATE_PRE_SLEEP) || |
297 | (adapter->ps_state == PS_STATE_SLEEP_CFM) || | 300 | (adapter->ps_state == PS_STATE_SLEEP_CFM) || |
298 | adapter->tx_lock_flag) | 301 | adapter->tx_lock_flag){ |
302 | spin_lock_irqsave(&adapter->main_proc_lock, flags); | ||
299 | continue; | 303 | continue; |
304 | } | ||
300 | 305 | ||
301 | if (!adapter->cmd_sent && !adapter->curr_cmd) { | 306 | if (!adapter->cmd_sent && !adapter->curr_cmd) { |
302 | if (mwifiex_exec_next_cmd(adapter) == -1) { | 307 | if (mwifiex_exec_next_cmd(adapter) == -1) { |
@@ -330,15 +335,12 @@ process_start: | |||
330 | } | 335 | } |
331 | break; | 336 | break; |
332 | } | 337 | } |
338 | spin_lock_irqsave(&adapter->main_proc_lock, flags); | ||
333 | } while (true); | 339 | } while (true); |
334 | 340 | ||
335 | spin_lock_irqsave(&adapter->main_proc_lock, flags); | 341 | spin_lock_irqsave(&adapter->main_proc_lock, flags); |
336 | if (!adapter->delay_main_work && | 342 | if (adapter->more_task_flag) |
337 | (adapter->int_status || IS_CARD_RX_RCVD(adapter))) { | ||
338 | spin_unlock_irqrestore(&adapter->main_proc_lock, flags); | ||
339 | goto process_start; | 343 | goto process_start; |
340 | } | ||
341 | |||
342 | adapter->mwifiex_processing = false; | 344 | adapter->mwifiex_processing = false; |
343 | spin_unlock_irqrestore(&adapter->main_proc_lock, flags); | 345 | spin_unlock_irqrestore(&adapter->main_proc_lock, flags); |
344 | 346 | ||
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index f0a6af179af0..2089a3084043 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -774,6 +774,7 @@ struct mwifiex_adapter { | |||
774 | /* spin lock for main process */ | 774 | /* spin lock for main process */ |
775 | spinlock_t main_proc_lock; | 775 | spinlock_t main_proc_lock; |
776 | u32 mwifiex_processing; | 776 | u32 mwifiex_processing; |
777 | u8 more_task_flag; | ||
777 | u16 tx_buf_size; | 778 | u16 tx_buf_size; |
778 | u16 curr_tx_buf_size; | 779 | u16 curr_tx_buf_size; |
779 | u32 ioport; | 780 | u32 ioport; |