diff options
| author | 2018-08-28 09:58:03 -0700 | |
|---|---|---|
| committer | 2018-08-28 09:58:03 -0700 | |
| commit | ea4d65f14f6aaa53e379b93c5544245ef081b3e7 (patch) | |
| tree | a15485f4f1cf547a52b31fa8e16e14b9579b7200 /drivers/net/wireless/ath/ath9k | |
| parent | arm: dts: am4372: setup rtc as system-power-controller (diff) | |
| parent | ARM: dts: Fix file permission for am335x-osd3358-sm-red.dts (diff) | |
| download | wireguard-linux-ea4d65f14f6aaa53e379b93c5544245ef081b3e7.tar.xz wireguard-linux-ea4d65f14f6aaa53e379b93c5544245ef081b3e7.zip  | |
Merge branch 'perm-fix' into omap-for-v4.19/fixes-v2
Diffstat (limited to '')
| -rw-r--r-- | drivers/net/wireless/ath/ath9k/ahb.c | 1 | ||||
| -rw-r--r-- | drivers/net/wireless/ath/ath9k/ar5008_phy.c | 2 | ||||
| -rw-r--r-- | drivers/net/wireless/ath/ath9k/ar9002_calib.c | 6 | ||||
| -rw-r--r-- | drivers/net/wireless/ath/ath9k/ar9002_phy.c | 1 | ||||
| -rw-r--r-- | drivers/net/wireless/ath/ath9k/ar9003_phy.c | 2 | ||||
| -rw-r--r-- | drivers/net/wireless/ath/ath9k/ath9k.h | 4 | ||||
| -rw-r--r-- | drivers/net/wireless/ath/ath9k/channel.c | 14 | ||||
| -rw-r--r-- | drivers/net/wireless/ath/ath9k/debug.c | 2 | ||||
| -rw-r--r-- | drivers/net/wireless/ath/ath9k/hif_usb.c | 7 | ||||
| -rw-r--r-- | drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 9 | ||||
| -rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.c | 19 | ||||
| -rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.h | 2 | ||||
| -rw-r--r-- | drivers/net/wireless/ath/ath9k/main.c | 5 | ||||
| -rw-r--r-- | drivers/net/wireless/ath/ath9k/pci.c | 1 | ||||
| -rw-r--r-- | drivers/net/wireless/ath/ath9k/wmi.c | 11 | ||||
| -rw-r--r-- | drivers/net/wireless/ath/ath9k/xmit.c | 67 | 
16 files changed, 94 insertions, 59 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ahb.c b/drivers/net/wireless/ath/ath9k/ahb.c index 2bd982c3a479..63019c3de034 100644 --- a/drivers/net/wireless/ath/ath9k/ahb.c +++ b/drivers/net/wireless/ath/ath9k/ahb.c @@ -19,6 +19,7 @@  #include <linux/nl80211.h>  #include <linux/platform_device.h>  #include <linux/module.h> +#include <linux/mod_devicetable.h>  #include "ath9k.h"  static const struct platform_device_id ath9k_platform_id_table[] = { diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c index 7922550c2159..ef2dd68d3f77 100644 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c @@ -583,12 +583,14 @@ static void ar5008_hw_init_chain_masks(struct ath_hw *ah)  	case 0x5:  		REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP,  			    AR_PHY_SWAP_ALT_CHAIN); +		/* fall through */  	case 0x3:  		if (ah->hw_version.macVersion == AR_SREV_REVISION_5416_10) {  			REG_WRITE(ah, AR_PHY_RX_CHAINMASK, 0x7);  			REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, 0x7);  			break;  		} +		/* else: fall through */  	case 0x1:  	case 0x2:  	case 0x7: diff --git a/drivers/net/wireless/ath/ath9k/ar9002_calib.c b/drivers/net/wireless/ath/ath9k/ar9002_calib.c index 50fcd343c41a..fd9db8ca99d7 100644 --- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c +++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c @@ -676,10 +676,10 @@ static int ar9002_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,  			return 0;  		ah->cal_list_curr = currCal = currCal->calNext; -		if (currCal->calState == CAL_WAITING) { +		if (currCal->calState == CAL_WAITING)  			ath9k_hw_reset_calibration(ah, currCal); -			return 0; -		} + +		return 0;  	}  	/* Do NF cal only at longer intervals */ diff --git a/drivers/net/wireless/ath/ath9k/ar9002_phy.c b/drivers/net/wireless/ath/ath9k/ar9002_phy.c index 61a9b85045d2..713291881208 100644 --- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c @@ -119,6 +119,7 @@ static int ar9002_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan)  				aModeRefSel = 2;  			if (aModeRefSel)  				break; +			/* else: fall through */  		case 1:  		default:  			aModeRefSel = 0; diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index fe5102ca5010..98c5f524a360 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c @@ -1800,6 +1800,8 @@ static void ar9003_hw_spectral_scan_config(struct ath_hw *ah,  static void ar9003_hw_spectral_scan_trigger(struct ath_hw *ah)  { +	REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, +		    AR_PHY_SPECTRAL_SCAN_ENABLE);  	/* Activate spectral scan */  	REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN,  		    AR_PHY_SPECTRAL_SCAN_ACTIVE); diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index ef0de4f1312c..21ba20981a80 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h @@ -342,7 +342,7 @@ struct ath_chanctx {  	struct ath_beacon_config beacon;  	struct ath9k_hw_cal_data caldata; -	struct timespec tsf_ts; +	struct timespec64 tsf_ts;  	u64 tsf_val;  	u32 last_beacon; @@ -1021,7 +1021,7 @@ struct ath_softc {  	struct ath_offchannel offchannel;  	struct ath_chanctx *next_chan;  	struct completion go_beacon; -	struct timespec last_event_time; +	struct timespec64 last_event_time;  #endif  	unsigned long driver_data; diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c index 1b05b5d7a038..fd61ae4782b6 100644 --- a/drivers/net/wireless/ath/ath9k/channel.c +++ b/drivers/net/wireless/ath/ath9k/channel.c @@ -233,9 +233,9 @@ static const char *chanctx_state_string(enum ath_chanctx_state state)  static u32 chanctx_event_delta(struct ath_softc *sc)  {  	u64 ms; -	struct timespec ts, *old; +	struct timespec64 ts, *old; -	getrawmonotonic(&ts); +	ktime_get_raw_ts64(&ts);  	old = &sc->last_event_time;  	ms = ts.tv_sec * 1000 + ts.tv_nsec / 1000000;  	ms -= old->tv_sec * 1000 + old->tv_nsec / 1000000; @@ -334,7 +334,7 @@ ath_chanctx_get_next(struct ath_softc *sc, struct ath_chanctx *ctx)  static void ath_chanctx_adjust_tbtt_delta(struct ath_softc *sc)  {  	struct ath_chanctx *prev, *cur; -	struct timespec ts; +	struct timespec64 ts;  	u32 cur_tsf, prev_tsf, beacon_int;  	s32 offset; @@ -346,7 +346,7 @@ static void ath_chanctx_adjust_tbtt_delta(struct ath_softc *sc)  	if (!prev->switch_after_beacon)  		return; -	getrawmonotonic(&ts); +	ktime_get_raw_ts64(&ts);  	cur_tsf = (u32) cur->tsf_val +  		  ath9k_hw_get_tsf_offset(&cur->tsf_ts, &ts); @@ -1230,7 +1230,7 @@ void ath_chanctx_set_next(struct ath_softc *sc, bool force)  {  	struct ath_common *common = ath9k_hw_common(sc->sc_ah);  	struct ath_chanctx *old_ctx; -	struct timespec ts; +	struct timespec64 ts;  	bool measure_time = false;  	bool send_ps = false;  	bool queues_stopped = false; @@ -1260,7 +1260,7 @@ void ath_chanctx_set_next(struct ath_softc *sc, bool force)  		spin_unlock_bh(&sc->chan_lock);  		if (sc->next_chan == &sc->offchannel.chan) { -			getrawmonotonic(&ts); +			ktime_get_raw_ts64(&ts);  			measure_time = true;  		} @@ -1277,7 +1277,7 @@ void ath_chanctx_set_next(struct ath_softc *sc, bool force)  		spin_lock_bh(&sc->chan_lock);  		if (sc->cur_chan != &sc->offchannel.chan) { -			getrawmonotonic(&sc->cur_chan->tsf_ts); +			ktime_get_raw_ts64(&sc->cur_chan->tsf_ts);  			sc->cur_chan->tsf_val = ath9k_hw_gettsf64(sc->sc_ah);  		}  	} diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index f685843a2ff3..0a6eb8a8c1ed 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c @@ -538,7 +538,7 @@ static int read_file_interrupt(struct seq_file *file, void *data)  	if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) {  		PR_IS("RXLP", rxlp);  		PR_IS("RXHP", rxhp); -		PR_IS("WATHDOG", bb_watchdog); +		PR_IS("WATCHDOG", bb_watchdog);  	} else {  		PR_IS("RX", rxok);  	} diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index cb0eef13af1c..fb649d85b8fc 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c @@ -138,6 +138,7 @@ static void hif_usb_mgmt_cb(struct urb *urb)  {  	struct cmd_buf *cmd = (struct cmd_buf *)urb->context;  	struct hif_device_usb *hif_dev; +	unsigned long flags;  	bool txok = true;  	if (!cmd || !cmd->skb || !cmd->hif_dev) @@ -158,14 +159,14 @@ static void hif_usb_mgmt_cb(struct urb *urb)  		 * If the URBs are being flushed, no need to complete  		 * this packet.  		 */ -		spin_lock(&hif_dev->tx.tx_lock); +		spin_lock_irqsave(&hif_dev->tx.tx_lock, flags);  		if (hif_dev->tx.flags & HIF_USB_TX_FLUSH) { -			spin_unlock(&hif_dev->tx.tx_lock); +			spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);  			dev_kfree_skb_any(cmd->skb);  			kfree(cmd);  			return;  		} -		spin_unlock(&hif_dev->tx.tx_lock); +		spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);  		break;  	default: diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c index 585736a837ed..799010ed04e0 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c @@ -1107,25 +1107,26 @@ void ath9k_htc_rxep(void *drv_priv, struct sk_buff *skb,  	struct ath_hw *ah = priv->ah;  	struct ath_common *common = ath9k_hw_common(ah);  	struct ath9k_htc_rxbuf *rxbuf = NULL, *tmp_buf = NULL; +	unsigned long flags; -	spin_lock(&priv->rx.rxbuflock); +	spin_lock_irqsave(&priv->rx.rxbuflock, flags);  	list_for_each_entry(tmp_buf, &priv->rx.rxbuf, list) {  		if (!tmp_buf->in_process) {  			rxbuf = tmp_buf;  			break;  		}  	} -	spin_unlock(&priv->rx.rxbuflock); +	spin_unlock_irqrestore(&priv->rx.rxbuflock, flags);  	if (rxbuf == NULL) {  		ath_dbg(common, ANY, "No free RX buffer\n");  		goto err;  	} -	spin_lock(&priv->rx.rxbuflock); +	spin_lock_irqsave(&priv->rx.rxbuflock, flags);  	rxbuf->skb = skb;  	rxbuf->in_process = true; -	spin_unlock(&priv->rx.rxbuflock); +	spin_unlock_irqrestore(&priv->rx.rxbuflock, flags);  	tasklet_schedule(&priv->rx_tasklet);  	return; diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index e60bea4604e4..bb319f22761f 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c @@ -496,7 +496,7 @@ static void ath9k_hw_init_macaddr(struct ath_hw *ah)  	ath_err(common, "eeprom contains invalid mac address: %pM\n",  		common->macaddr); -	random_ether_addr(common->macaddr); +	eth_random_addr(common->macaddr);  	ath_err(common, "random mac address will be used: %pM\n",  		common->macaddr); @@ -1835,13 +1835,13 @@ fail:  	return -EINVAL;  } -u32 ath9k_hw_get_tsf_offset(struct timespec *last, struct timespec *cur) +u32 ath9k_hw_get_tsf_offset(struct timespec64 *last, struct timespec64 *cur)  { -	struct timespec ts; +	struct timespec64 ts;  	s64 usec;  	if (!cur) { -		getrawmonotonic(&ts); +		ktime_get_raw_ts64(&ts);  		cur = &ts;  	} @@ -1859,7 +1859,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,  	u32 saveLedState;  	u32 saveDefAntenna;  	u32 macStaId1; -	struct timespec tsf_ts; +	struct timespec64 tsf_ts;  	u32 tsf_offset;  	u64 tsf = 0;  	int r; @@ -1905,7 +1905,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,  	macStaId1 = REG_READ(ah, AR_STA_ID1) & AR_STA_ID1_BASE_RATE_11B;  	/* Save TSF before chip reset, a cold reset clears it */ -	getrawmonotonic(&tsf_ts); +	ktime_get_raw_ts64(&tsf_ts);  	tsf = ath9k_hw_gettsf64(ah);  	saveLedState = REG_READ(ah, AR_CFG_LED) & @@ -2942,16 +2942,19 @@ void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan,  	struct ath_regulatory *reg = ath9k_hw_regulatory(ah);  	struct ieee80211_channel *channel;  	int chan_pwr, new_pwr; +	u16 ctl = NO_CTL;  	if (!chan)  		return; +	if (!test) +		ctl = ath9k_regd_get_ctl(reg, chan); +  	channel = chan->chan;  	chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER);  	new_pwr = min_t(int, chan_pwr, reg->power_limit); -	ah->eep_ops->set_txpower(ah, chan, -				 ath9k_regd_get_ctl(reg, chan), +	ah->eep_ops->set_txpower(ah, chan, ctl,  				 get_antenna_gain(ah, chan), new_pwr, test);  } diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index 9804a24a2dc0..68956cdc8c9a 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h @@ -1060,7 +1060,7 @@ u32 ath9k_hw_gettsf32(struct ath_hw *ah);  u64 ath9k_hw_gettsf64(struct ath_hw *ah);  void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64);  void ath9k_hw_reset_tsf(struct ath_hw *ah); -u32 ath9k_hw_get_tsf_offset(struct timespec *last, struct timespec *cur); +u32 ath9k_hw_get_tsf_offset(struct timespec64 *last, struct timespec64 *cur);  void ath9k_hw_set_tsfadjust(struct ath_hw *ah, bool set);  void ath9k_hw_init_global_settings(struct ath_hw *ah);  u32 ar9003_get_pll_sqsum_dvc(struct ath_hw *ah); diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index b6663c80e7dd..1049773378f2 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c @@ -1865,7 +1865,7 @@ static void ath9k_set_tsf(struct ieee80211_hw *hw,  	mutex_lock(&sc->mutex);  	ath9k_ps_wakeup(sc);  	tsf -= le64_to_cpu(avp->tsf_adjust); -	getrawmonotonic(&avp->chanctx->tsf_ts); +	ktime_get_raw_ts64(&avp->chanctx->tsf_ts);  	if (sc->cur_chan == avp->chanctx)  		ath9k_hw_settsf64(sc->sc_ah, tsf);  	avp->chanctx->tsf_val = tsf; @@ -1881,7 +1881,7 @@ static void ath9k_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)  	mutex_lock(&sc->mutex);  	ath9k_ps_wakeup(sc); -	getrawmonotonic(&avp->chanctx->tsf_ts); +	ktime_get_raw_ts64(&avp->chanctx->tsf_ts);  	if (sc->cur_chan == avp->chanctx)  		ath9k_hw_reset_tsf(sc->sc_ah);  	avp->chanctx->tsf_val = 0; @@ -1928,6 +1928,7 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,  	case IEEE80211_AMPDU_TX_STOP_FLUSH:  	case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:  		flush = true; +		/* fall through */  	case IEEE80211_AMPDU_TX_STOP_CONT:  		ath9k_ps_wakeup(sc);  		ath_tx_aggr_stop(sc, sta, tid); diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c index 645f0fbd9179..92b2dd396436 100644 --- a/drivers/net/wireless/ath/ath9k/pci.c +++ b/drivers/net/wireless/ath/ath9k/pci.c @@ -18,7 +18,6 @@  #include <linux/nl80211.h>  #include <linux/pci.h> -#include <linux/pci-aspm.h>  #include <linux/module.h>  #include "ath9k.h" diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c index b0b5579b7560..d1f6710ca63b 100644 --- a/drivers/net/wireless/ath/ath9k/wmi.c +++ b/drivers/net/wireless/ath/ath9k/wmi.c @@ -209,6 +209,7 @@ static void ath9k_wmi_ctrl_rx(void *priv, struct sk_buff *skb,  {  	struct wmi *wmi = priv;  	struct wmi_cmd_hdr *hdr; +	unsigned long flags;  	u16 cmd_id;  	if (unlikely(wmi->stopped)) @@ -218,20 +219,20 @@ static void ath9k_wmi_ctrl_rx(void *priv, struct sk_buff *skb,  	cmd_id = be16_to_cpu(hdr->command_id);  	if (cmd_id & 0x1000) { -		spin_lock(&wmi->wmi_lock); +		spin_lock_irqsave(&wmi->wmi_lock, flags);  		__skb_queue_tail(&wmi->wmi_event_queue, skb); -		spin_unlock(&wmi->wmi_lock); +		spin_unlock_irqrestore(&wmi->wmi_lock, flags);  		tasklet_schedule(&wmi->wmi_event_tasklet);  		return;  	}  	/* Check if there has been a timeout. */ -	spin_lock(&wmi->wmi_lock); +	spin_lock_irqsave(&wmi->wmi_lock, flags);  	if (be16_to_cpu(hdr->seq_no) != wmi->last_seq_id) { -		spin_unlock(&wmi->wmi_lock); +		spin_unlock_irqrestore(&wmi->wmi_lock, flags);  		goto free_skb;  	} -	spin_unlock(&wmi->wmi_lock); +	spin_unlock_irqrestore(&wmi->wmi_lock, flags);  	/* WMI command response */  	ath9k_wmi_rsp_callback(wmi, skb); diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 7fdb152be0bb..43b6c8508e49 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c @@ -62,7 +62,7 @@ static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf,  			     struct ath_tx_status *ts, int nframes, int nbad,  			     int txok);  static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid, -			      int seqno); +			      struct ath_buf *bf);  static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,  					   struct ath_txq *txq,  					   struct ath_atx_tid *tid, @@ -86,7 +86,8 @@ static void ath_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)  	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);  	struct ieee80211_sta *sta = info->status.status_driver_data[0]; -	if (info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS) { +	if (info->flags & (IEEE80211_TX_CTL_REQ_TX_STATUS | +			   IEEE80211_TX_STATUS_EOSP)) {  		ieee80211_tx_status(hw, skb);  		return;  	} @@ -295,7 +296,7 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)  		}  		if (fi->baw_tracked) { -			ath_tx_update_baw(sc, tid, bf->bf_state.seqno); +			ath_tx_update_baw(sc, tid, bf);  			sendbar = true;  		} @@ -311,10 +312,15 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)  }  static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid, -			      int seqno) +			      struct ath_buf *bf)  { +	struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu); +	u16 seqno = bf->bf_state.seqno;  	int index, cindex; +	if (!fi->baw_tracked) +		return; +  	index  = ATH_BA_INDEX(tid->seq_start, seqno);  	cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1); @@ -335,6 +341,9 @@ static void ath_tx_addto_baw(struct ath_softc *sc, struct ath_atx_tid *tid,  	u16 seqno = bf->bf_state.seqno;  	int index, cindex; +	if (fi->baw_tracked) +		return; +  	index  = ATH_BA_INDEX(tid->seq_start, seqno);  	cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1);  	__set_bit(cindex, tid->tx_buf); @@ -611,7 +620,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,  			 * complete the acked-ones/xretried ones; update  			 * block-ack window  			 */ -			ath_tx_update_baw(sc, tid, seqno); +			ath_tx_update_baw(sc, tid, bf);  			if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) {  				memcpy(tx_info->control.rates, rates, sizeof(rates)); @@ -641,7 +650,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,  				 * run out of tx buf.  				 */  				if (!tbf) { -					ath_tx_update_baw(sc, tid, seqno); +					ath_tx_update_baw(sc, tid, bf);  					ath_tx_complete_buf(sc, bf, txq,  							    &bf_head, NULL, ts, @@ -969,7 +978,8 @@ ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq,  		bf->bf_lastbf = bf;  		tx_info = IEEE80211_SKB_CB(skb); -		tx_info->flags &= ~IEEE80211_TX_CTL_CLEAR_PS_FILT; +		tx_info->flags &= ~(IEEE80211_TX_CTL_CLEAR_PS_FILT | +				    IEEE80211_TX_STATUS_EOSP);  		/*  		 * No aggregation session is running, but there may be frames @@ -1009,11 +1019,14 @@ ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq,  			INIT_LIST_HEAD(&bf_head);  			list_add(&bf->list, &bf_head); -			ath_tx_update_baw(sc, tid, seqno); +			ath_tx_update_baw(sc, tid, bf);  			ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);  			continue;  		} +		if (bf_isampdu(bf)) +			ath_tx_addto_baw(sc, tid, bf); +  		return bf;  	} @@ -1071,8 +1084,6 @@ ath_tx_form_aggr(struct ath_softc *sc, struct ath_txq *txq,  		bf->bf_next = NULL;  		/* link buffers of this frame to the aggregate */ -		if (!fi->baw_tracked) -			ath_tx_addto_baw(sc, tid, bf);  		bf->bf_state.ndelim = ndelim;  		list_add_tail(&bf->list, bf_q); @@ -1659,6 +1670,22 @@ void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an)  	}  } + +static void +ath9k_set_moredata(struct ath_softc *sc, struct ath_buf *bf, bool val) +{ +	struct ieee80211_hdr *hdr; +	u16 mask = cpu_to_le16(IEEE80211_FCTL_MOREDATA); +	u16 mask_val = mask * val; + +	hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data; +	if ((hdr->frame_control & mask) != mask_val) { +		hdr->frame_control = (hdr->frame_control & ~mask) | mask_val; +		dma_sync_single_for_device(sc->dev, bf->bf_buf_addr, +			sizeof(*hdr), DMA_TO_DEVICE); +	} +} +  void ath9k_release_buffered_frames(struct ieee80211_hw *hw,  				   struct ieee80211_sta *sta,  				   u16 tids, int nframes, @@ -1689,12 +1716,11 @@ void ath9k_release_buffered_frames(struct ieee80211_hw *hw,  			if (!bf)  				break; +			ath9k_set_moredata(sc, bf, true);  			list_add_tail(&bf->list, &bf_q);  			ath_set_rates(tid->an->vif, tid->an->sta, bf); -			if (bf_isampdu(bf)) { -				ath_tx_addto_baw(sc, tid, bf); +			if (bf_isampdu(bf))  				bf->bf_state.bf_type &= ~BUF_AGGR; -			}  			if (bf_tail)  				bf_tail->bf_next = bf; @@ -1712,6 +1738,9 @@ void ath9k_release_buffered_frames(struct ieee80211_hw *hw,  	if (list_empty(&bf_q))  		return; +	if (!more_data) +		ath9k_set_moredata(sc, bf_tail, false); +  	info = IEEE80211_SKB_CB(bf_tail->bf_mpdu);  	info->flags |= IEEE80211_TX_STATUS_EOSP; @@ -2407,7 +2436,6 @@ void ath_tx_cabq(struct ieee80211_hw *hw, struct ieee80211_vif *vif,  		.txq = sc->beacon.cabq  	};  	struct ath_tx_info info = {}; -	struct ieee80211_hdr *hdr;  	struct ath_buf *bf_tail = NULL;  	struct ath_buf *bf;  	LIST_HEAD(bf_q); @@ -2451,15 +2479,10 @@ void ath_tx_cabq(struct ieee80211_hw *hw, struct ieee80211_vif *vif,  	if (list_empty(&bf_q))  		return; -	bf = list_first_entry(&bf_q, struct ath_buf, list); -	hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data; - -	if (hdr->frame_control & cpu_to_le16(IEEE80211_FCTL_MOREDATA)) { -		hdr->frame_control &= ~cpu_to_le16(IEEE80211_FCTL_MOREDATA); -		dma_sync_single_for_device(sc->dev, bf->bf_buf_addr, -			sizeof(*hdr), DMA_TO_DEVICE); -	} +	bf = list_last_entry(&bf_q, struct ath_buf, list); +	ath9k_set_moredata(sc, bf, false); +	bf = list_first_entry(&bf_q, struct ath_buf, list);  	ath_txq_lock(sc, txctl.txq);  	ath_tx_fill_desc(sc, bf, txctl.txq, 0);  	ath_tx_txqaddbuf(sc, txctl.txq, &bf_q, false);  | 
