ath9k: unify edma and non-edma tx code, improve tx fifo handling
PATCH 2/2 ath9k_hw: remove ath9k_hw_get_desc_link
In reply to Felix Fietkau--- drivers/net/wireless/ath/ath9k/ar9002_mac.c | 6 ------ drivers/net/wireless/ath/ath9k/ar9003_mac.c | 8 -------- drivers/net/wireless/ath/ath9k/hw-ops.h | 5 ----- drivers/net/wireless/ath/ath9k/hw.h | 1 - 4 files changed, 0 insertions(+), 20 deletions(-)
drivers/net/wireless/ath/ath9k/ar9002_mac.c +0 -6
@@ -28,11 +28,6 @@ static void ar9002_hw_set_desc_link(void *ds, u32 ds_link) ((struct ath_desc *) ds)->ds_link = ds_link; } -static void ar9002_hw_get_desc_link (void *ds,u32 **ds_link) -{ - *ds_link = &((struct ath_desc *)ds)->ds_link; -} -static bool ar9002_hw_get_isr (struct ath_hw *ah,enum ath9k_int *masked) {u32 isr =0 ;
@@ -437,7 +432,6 @@ void ar9002_hw_attach_mac_ops(struct ath_hw *ah) ops->rx_enable = ar9002_hw_rx_enable; ops->set_desc_link = ar9002_hw_set_desc_link; - ops->get_desc_link = ar9002_hw_get_desc_link; ops->get_isr = ar9002_hw_get_isr; ops->fill_txdesc = ar9002_hw_fill_txdesc; ops->proc_txdesc = ar9002_hw_proc_txdesc;
drivers/net/wireless/ath/ath9k/ar9003_mac.c +0 -8
@@ -43,13 +43,6 @@ static void ar9003_hw_set_desc_link(void *ds, u32 ds_link) ads->ctl10 |=ar9003_calc_ptr_chksum (ads); } -static void ar9003_hw_get_desc_link (void *ds,u32 **ds_link) -{ -struct ar9003_txc *ads = ds; - - *ds_link = &ads->link; -} -static bool ar9003_hw_get_isr (struct ath_hw *ah,enum ath9k_int *masked) {u32 isr =0 ;
@@ -498,7 +491,6 @@ void ar9003_hw_attach_mac_ops(struct ath_hw *hw) ops->rx_enable = ar9003_hw_rx_enable; ops->set_desc_link = ar9003_hw_set_desc_link; - ops->get_desc_link = ar9003_hw_get_desc_link; ops->get_isr = ar9003_hw_get_isr; ops->fill_txdesc = ar9003_hw_fill_txdesc; ops->proc_txdesc = ar9003_hw_proc_txdesc;
drivers/net/wireless/ath/ath9k/hw-ops.h +0 -5
@@ -39,11 +39,6 @@ static inline void ath9k_hw_set_desc_link(struct ath_hw *ah, void *ds,ath9k_hw_ops (ah)->set_desc_link (ds, link); } -static inline void ath9k_hw_get_desc_link (struct ath_hw *ah,void *ds, -u32 **link) -{ -ath9k_hw_ops (ah)->get_desc_link (ds, link); -} static inline bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan, u8 rxchainmask,
drivers/net/wireless/ath/ath9k/hw.h +0 -1
@@ -603,7 +603,6 @@ struct ath_hw_ops { int power_off);void (*rx_enable)(struct ath_hw *ah);void (*set_desc_link)(void *ds,u32 link); -void (*get_desc_link)(void *ds,u32 **link); bool (*calibrate)(struct ath_hw *ah, struct ath9k_channel *chan, u8 rxchainmask,
Signature · 1 line
1.7.3.2
PATCH 1/2 ath9k: unify edma and non-edma tx code, improve tx fifo handling
EDMA based chips (AR9380+) have 8 Tx FIFO slots, which are used to fix the tx queue start/stop race conditions which have to be worked around for earlier chips by keeping the last descriptor in the queue. The current code stores all frames that do not fit onto the 8 FIFO slots in a separate list. Whenever a FIFO slot is freed up, the next frame (or A-MPDU) from the pending queue gets moved to that slot.
This process is not only inefficient, but also unnecessary. The code can be improved visibly by keeping the pending queue fully linked, and moving the contents of the entire queue to a FIFO slot as it becomes available.
This patch makes the necessary changes for that and also merges some code that was duplicated for EDMA vs non-EDMA. It changes txq->axq_link to point to the last descriptor instead of the link pointer, so that ath9k_hw_set_desc_link can be used, which works on all chips.
With this patch, a small performance increase for non-aggregated traffic was observed on AR9380 based embedded hardware.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 3 +- drivers/net/wireless/ath/ath9k/debug.c | 1 - drivers/net/wireless/ath/ath9k/main.c | 2 - drivers/net/wireless/ath/ath9k/xmit.c | 349 +++++++++++++------------------- 4 files changed, 144 insertions(+), 211 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +1 -2
@@ -179,7 +179,7 @@ enum ATH_AGGR_STATUS {struct ath_txq {int mac80211_qnum;/* mac80211 queue number, -1 means not mac80211 Q */ u32 axq_qnum;/* ath9k hardware queue number */ -u32 *axq_link; +void *axq_link;struct list_head axq_q;spinlock_t axq_lock;u32 axq_depth;
@@ -188,7 +188,6 @@ struct ath_txq {bool axq_tx_inprogress;struct list_head axq_acq;struct list_head txq_fifo[ATH_TXFIFO_DEPTH ]; -struct list_head txq_fifo_pending;u8 txq_headidx;u8 txq_tailidx;int pending_frames;
drivers/net/wireless/ath/ath9k/debug.c +0 -1
@@ -585,7 +585,6 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf,PRQLE ("axq_q empty: " , axq_q);PRQLE ("axq_acq empty: " , axq_acq); -PRQLE ("txq_fifo_pending: " , txq_fifo_pending);for (i =0 ; i <ATH_TXFIFO_DEPTH ; i++) {snprintf (tmp,sizeof (tmp) -1 ,"txq_fifo[%i] empty: " , i);PRQLE (tmp, txq_fifo[i]);
drivers/net/wireless/ath/ath9k/main.c +0 -2
@@ -62,8 +62,6 @@ static bool ath9k_has_pending_frames(struct ath_softc *sc, struct ath_txq *txq)if (txq->axq_depth || !list_empty (&txq->axq_acq)) pending = true; -else if (sc->sc_ah->caps.hw_caps &ATH9K_HW_CAP_EDMA ) - pending = !list_empty (&txq->txq_fifo_pending);spin_unlock_bh (&txq->axq_lock);return pending;
drivers/net/wireless/ath/ath9k/xmit.c +143 -206
548 lines not on this page · raw message
Signature · 1 line
1.7.3.2
CC [M] drivers/net/wireless/ath/ath9k/xmit.odrivers/net/wireless/ath/ath9k/xmit.c: In function ‘ath_tx_edma_tasklet’:drivers/net/wireless/ath/ath9k/xmit.c:2199:18: warning: ‘txq’ may be used uninitialized in this function
Please don't add warnings, especially not valid ones... :-)
Quoted 47 lines · Felix Fietkau
EDMA based chips (AR9380+) have 8 Tx FIFO slots, which are used to fix the tx queue start/stop race conditions which have to be worked around for earlier chips by keeping the last descriptor in the queue. The current code stores all frames that do not fit onto the 8 FIFO slots in a separate list. Whenever a FIFO slot is freed up, the next frame (or A-MPDU) from the pending queue gets moved to that slot.
This process is not only inefficient, but also unnecessary. The code can be improved visibly by keeping the pending queue fully linked, and moving the contents of the entire queue to a FIFO slot as it becomes available.
This patch makes the necessary changes for that and also merges some code that was duplicated for EDMA vs non-EDMA. It changes
txq->axq_linkto point to the last descriptor instead of the link pointer, so thatath9k_hw_set_desc_linkcan be used, which works on all chips.With this patch, a small performance increase for non-aggregated traffic was observed on AR9380 based embedded hardware.
Signed-off-by Felix Fietkau <[email protected]>drivers/net/wireless/ath/ath9k/xmit.c +3
-3@@ -2237,17 +2193,17 @@ void ath_tx_tasklet(struct ath_softc *sc)void ath_tx_edma_tasklet (struct ath_softc *sc) { -struct ath_tx_status txs; +struct ath_tx_status ts;struct ath_common *common =ath9k_hw_common (sc->sc_ah);struct ath_hw *ah = sc->sc_ah;struct ath_txq *txq;struct ath_buf *bf, *lastbf;struct list_head bf_head;int status; -int txok; +spin_lock_bh (&txq->axq_lock);for (;;) { - status =ath9k_hw_txprocdesc (ah,NULL , (void *)&txs); + status =ath9k_hw_txprocdesc (ah,NULL , (void *)&ts);if (status == -EINPROGRESS )break ;if (status == -EIO ) {
Signature · 2 lines
John W. Linville Someday the world will need a hero, and you [email protected] might be all we have. Be ready.
Quoted 5 lines · John W. Linville
CC [M]
drivers/net/wireless/ath/ath9k/xmit.odrivers/net/wireless/ath/ath9k/xmit.c: In function ‘ath_tx_edma_tasklet’:drivers/net/wireless/ath/ath9k/xmit.c:2199:18: warning: ‘txq’ may be used uninitialized in this functionPlease don't add warnings, especially not valid ones... :-)
Odd, I wonder why my compiler didn't show me this warning when I worked on the patch, need to check my CFLAGS :)
- Felix
Quoted 9 lines · Felix Fietkau
Quoted 6 lines · John W. Linville
CC [M]
drivers/net/wireless/ath/ath9k/xmit.odrivers/net/wireless/ath/ath9k/xmit.c: In function ‘ath_tx_edma_tasklet’:drivers/net/wireless/ath/ath9k/xmit.c:2199:18: warning: ‘txq’ may be used uninitialized in this functionPlease don't add warnings, especially not valid ones... :-)
Odd, I wonder why my compiler didn't show me this warning when I worked on the patch, need to check my CFLAGS :)
If you figure out the CFLAGS needed to show the warnings, please share that information with the list.
Thanks,
Larry
Quoted 7 lines · Larry Finger
Quoted 6 lines · Felix Fietkau
Quoted 5 lines · John W. Linville
CC [M]
drivers/net/wireless/ath/ath9k/xmit.odrivers/net/wireless/ath/ath9k/xmit.c: In function ‘ath_tx_edma_tasklet’:drivers/net/wireless/ath/ath9k/xmit.c:2199:18: warning: ‘txq’ may be used uninitialized in this function
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Please don't add warnings, especially not valid ones... :-)
Odd, I wonder why my compiler didn't show me this warning when I worked on the patch, need to check my CFLAGS :)
If you figure out the CFLAGS needed to show the warnings, please share that information with the list.
There really is an issue here -- it's like the gcc folks have added a randomize function to change the warnings generated between different versions (or even different compiles of the same version) of their compiler...
Signature · 2 lines
John W. Linville Someday the world will need a hero, and you [email protected] might be all we have. Be ready.