backport from wireless-drivers-next, replacing some existing patches in our tree (marked with '=' are those which were already present): f483039cf51a rt2x00: use simple_read_from_buffer() =5c656c71b1bf rt2800: move usb specific txdone/txstatus routines to rt2800lib =0b0d556e0ebb rt2800mmio: use txdone/txstatus routines from lib =5022efb50f62 rt2x00: do not check for txstatus timeout every time on tasklet =adf26a356f13 rt2x00: use different txstatus timeouts when flushing =0240564430c0 rt2800: flush and txstatus rework for rt2800mmio 6eba8fd22352 rt2x00: rt2400pci: mark expected switch fall-through 10bb92217747 rt2x00: rt2500pci: mark expected switch fall-through 916e6bbcfcff rt2x00: rt2800lib: mark expected switch fall-throughs 641dd8068ecb rt2x00: rt61pci: mark expected switch fall-through 750afb08ca71 cross-tree: phase out dma_zalloc_coherent() =c2e28ef7711f rt2x00: reduce tx power to nominal level on RT6352 a4296994eb80 rt2x00: Work around a firmware bug with shared keys 2587791d5758 rt2x00: no need to check return value of debugfs_create functions pending on linux-wireless: rt2x00: remove unneeded check rt2x00: remove confusing AGC register rt2800: enable TX_PIN_CFG_LNA_PE_ bits per band rt2800: enable TX_PIN_CFG_RFRX_EN only for MT7620 rt2800: comment and simplify AGC init for RT6352 rt2x00: do not print error when queue is full rt2800: partially restore old mmio txstatus behaviour rt2800: new flush implementation for SoC devices rt2800: move txstatus pending routine rt2800mmio: fetch tx status changes rt2800mmio: use timer and work for handling tx statuses timeouts rt2x00: remove last_nostatus_check rt2x00: remove not used entry field rt2x00mmio: remove legacy comment While at it also rename some existing patches now that there are separate folders with patches for each driver to make things a bit nicer to handle. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
		
			
				
	
	
		
			113 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			113 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| From adf26a356f132e35093585521ea3e36cd185af83 Mon Sep 17 00:00:00 2001
 | |
| From: Stanislaw Gruszka <sgruszka@redhat.com>
 | |
| Date: Wed, 26 Sep 2018 12:24:56 +0200
 | |
| Subject: [PATCH 05/28] rt2x00: use different txstatus timeouts when flushing
 | |
| 
 | |
| Use different tx status timeouts for normal operation and when flushing.
 | |
| This increase timeout to 2s for normal operation as when there are bad
 | |
| radio conditions and frames are reposted many times device can not provide
 | |
| the status for quite long. With new timeout we can still get valid status
 | |
| on such bad conditions.
 | |
| 
 | |
| Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
 | |
| Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
 | |
| ---
 | |
|  .../net/wireless/ralink/rt2x00/rt2800lib.c    | 31 +++++++++++++------
 | |
|  drivers/net/wireless/ralink/rt2x00/rt2x00.h   |  1 +
 | |
|  .../net/wireless/ralink/rt2x00/rt2x00mac.c    |  4 +++
 | |
|  3 files changed, 26 insertions(+), 10 deletions(-)
 | |
| 
 | |
| --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 | |
| +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
 | |
| @@ -1137,36 +1137,47 @@ void rt2800_txdone(struct rt2x00_dev *rt
 | |
|  }
 | |
|  EXPORT_SYMBOL_GPL(rt2800_txdone);
 | |
|  
 | |
| -static inline bool rt2800_entry_txstatus_timeout(struct queue_entry *entry)
 | |
| +static inline bool rt2800_entry_txstatus_timeout(struct rt2x00_dev *rt2x00dev,
 | |
| +						 struct queue_entry *entry)
 | |
|  {
 | |
| -	bool tout;
 | |
| +	bool ret;
 | |
| +	unsigned long tout;
 | |
|  
 | |
|  	if (!test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags))
 | |
|  		return false;
 | |
|  
 | |
| -	tout = time_after(jiffies, entry->last_action + msecs_to_jiffies(500));
 | |
| -	if (unlikely(tout))
 | |
| +	if (test_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags))
 | |
| +		tout = msecs_to_jiffies(100);
 | |
| +	else
 | |
| +		tout = msecs_to_jiffies(2000);
 | |
| +
 | |
| +	ret = time_after(jiffies, entry->last_action + tout);
 | |
| +	if (unlikely(ret))
 | |
|  		rt2x00_dbg(entry->queue->rt2x00dev,
 | |
|  			   "TX status timeout for entry %d in queue %d\n",
 | |
|  			   entry->entry_idx, entry->queue->qid);
 | |
| -	return tout;
 | |
| -
 | |
| +	return ret;
 | |
|  }
 | |
|  
 | |
|  bool rt2800_txstatus_timeout(struct rt2x00_dev *rt2x00dev)
 | |
|  {
 | |
|  	struct data_queue *queue;
 | |
|  	struct queue_entry *entry;
 | |
| +	unsigned long tout;
 | |
| +
 | |
| +	if (test_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags))
 | |
| +		tout = msecs_to_jiffies(50);
 | |
| +	else
 | |
| +		tout = msecs_to_jiffies(1000);
 | |
|  
 | |
| -	if (time_before(jiffies,
 | |
| -			rt2x00dev->last_nostatus_check + msecs_to_jiffies(500)))
 | |
| +	if (time_before(jiffies, rt2x00dev->last_nostatus_check + tout))
 | |
|  		return false;
 | |
|  
 | |
|  	rt2x00dev->last_nostatus_check = jiffies;
 | |
|  
 | |
|  	tx_queue_for_each(rt2x00dev, queue) {
 | |
|  		entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
 | |
| -		if (rt2800_entry_txstatus_timeout(entry))
 | |
| +		if (rt2800_entry_txstatus_timeout(rt2x00dev, entry))
 | |
|  			return true;
 | |
|  	}
 | |
|  
 | |
| @@ -1195,7 +1206,7 @@ void rt2800_txdone_nostatus(struct rt2x0
 | |
|  				break;
 | |
|  
 | |
|  			if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags) ||
 | |
| -			    rt2800_entry_txstatus_timeout(entry))
 | |
| +			    rt2800_entry_txstatus_timeout(rt2x00dev, entry))
 | |
|  				rt2x00lib_txdone_noinfo(entry, TXDONE_FAILURE);
 | |
|  			else
 | |
|  				break;
 | |
| --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
 | |
| +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
 | |
| @@ -665,6 +665,7 @@ enum rt2x00_state_flags {
 | |
|  	DEVICE_STATE_STARTED,
 | |
|  	DEVICE_STATE_ENABLED_RADIO,
 | |
|  	DEVICE_STATE_SCANNING,
 | |
| +	DEVICE_STATE_FLUSHING,
 | |
|  
 | |
|  	/*
 | |
|  	 * Driver configuration
 | |
| --- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
 | |
| +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
 | |
| @@ -720,8 +720,12 @@ void rt2x00mac_flush(struct ieee80211_hw
 | |
|  	if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
 | |
|  		return;
 | |
|  
 | |
| +	set_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags);
 | |
| +
 | |
|  	tx_queue_for_each(rt2x00dev, queue)
 | |
|  		rt2x00queue_flush_queue(queue, drop);
 | |
| +
 | |
| +	clear_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags);
 | |
|  }
 | |
|  EXPORT_SYMBOL_GPL(rt2x00mac_flush);
 | |
|  
 |