[PATCH RFC/RFT v2 2/2] ath9k: use mac80211 intermediate software queues

2016-03-04 Thread Tim Shepard

This patch leaves the code for ath9k's internal per-node per-tid
queues in place and just modifies the driver to also pull from
the new mac80211 intermediate software queues, and implements
the .wake_tx_queue method, which will cause mac80211 to deliver
packets to be sent via the new intermediate queue.

Signed-off-by: Tim Shepard 
---
 drivers/net/wireless/ath/ath9k/ath9k.h |   16 +++-
 drivers/net/wireless/ath/ath9k/debug_sta.c |8 +-
 drivers/net/wireless/ath/ath9k/init.c  |1 +
 drivers/net/wireless/ath/ath9k/main.c  |1 +
 drivers/net/wireless/ath/ath9k/xmit.c  |  122 
 5 files changed, 129 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h 
b/drivers/net/wireless/ath/ath9k/ath9k.h
index 1118b3d..96cbcad 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -145,8 +145,6 @@ int ath_descdma_setup(struct ath_softc *sc, struct 
ath_descdma *dd,
 #define BAW_WITHIN(_start, _bawsz, _seqno) \
_seqno) - (_start)) & 4095) < (_bawsz))
 
-#define ATH_AN_2_TID(_an, _tidno)  (&(_an)->tid[(_tidno)])
-
 #define IS_HT_RATE(rate)   (rate & 0x80)
 #define IS_CCK_RATE(rate)  ((rate >= 0x18) && (rate <= 0x1e))
 #define IS_OFDM_RATE(rate) ((rate >= 0x8) && (rate <= 0xf))
@@ -232,8 +230,10 @@ struct ath_buf {
 
 struct ath_atx_tid {
struct list_head list;
+   struct sk_buff_head i_q;
struct sk_buff_head buf_q;
struct sk_buff_head retry_q;
+   struct ieee80211_txq *txq;
struct ath_node *an;
struct ath_hwq *hwq;
unsigned long tx_buf[BITS_TO_LONGS(ATH_TID_MAX_BUFS)];
@@ -247,13 +247,13 @@ struct ath_atx_tid {
s8 bar_index;
bool active;
bool clear_ps_filter;
+   bool txq_nonempty;
 };
 
 struct ath_node {
struct ath_softc *sc;
struct ieee80211_sta *sta; /* station struct we're part of */
struct ieee80211_vif *vif; /* interface with which we're associated */
-   struct ath_atx_tid tid[IEEE80211_NUM_TIDS];
 
u16 maxampdu;
u8 mpdudensity;
@@ -271,6 +271,15 @@ struct ath_node {
struct list_head list;
 };
 
+static inline
+struct ath_atx_tid *ath_an_2_tid(struct ath_node *an, u8 tidno)
+{
+   struct ieee80211_sta *sta = an->sta;
+   struct ieee80211_vif *vif = an->vif;
+   struct ieee80211_txq *txq = sta? sta->txq[tidno] : vif->txq;
+   return (struct ath_atx_tid *) txq->drv_priv;
+}
+
 struct ath_tx_control {
struct ath_hwq *hwq;
struct ath_node *an;
@@ -585,6 +594,7 @@ void ath9k_release_buffered_frames(struct ieee80211_hw *hw,
   u16 tids, int nframes,
   enum ieee80211_frame_release_type reason,
   bool more_data);
+void ath9k_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *txq);
 
 //
 /* VIFs */
diff --git a/drivers/net/wireless/ath/ath9k/debug_sta.c 
b/drivers/net/wireless/ath/ath9k/debug_sta.c
index a9f4a92..100cbfd 100644
--- a/drivers/net/wireless/ath/ath9k/debug_sta.c
+++ b/drivers/net/wireless/ath/ath9k/debug_sta.c
@@ -25,6 +25,7 @@ static ssize_t read_file_node_aggr(struct file *file, char 
__user *user_buf,
 {
struct ath_node *an = file->private_data;
struct ath_softc *sc = an->sc;
+   struct ieee80211_txq *txq;
struct ath_atx_tid *tid;
struct ath_hwq *hwq;
u32 len = 0, size = 4096;
@@ -52,8 +53,11 @@ static ssize_t read_file_node_aggr(struct file *file, char 
__user *user_buf,
 "TID", "SEQ_START", "SEQ_NEXT", "BAW_SIZE",
 "BAW_HEAD", "BAW_TAIL", "BAR_IDX", "SCHED", "PAUSED");
 
-   for (tidno = 0, tid = &an->tid[tidno];
-tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
+   for (tidno = 0;
+tidno < IEEE80211_NUM_TIDS; tidno++) {
+
+   txq = an->sta->txq[tidno];
+   tid = (struct ath_atx_tid *) txq->drv_priv;
hwq = tid->hwq;
ath_hwq_lock(sc, hwq);
if (tid->active) {
diff --git a/drivers/net/wireless/ath/ath9k/init.c 
b/drivers/net/wireless/ath/ath9k/init.c
index d96055f..7d4427a 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -882,6 +882,7 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct 
ieee80211_hw *hw)
hw->max_rate_tries = 10;
hw->sta_data_size = sizeof(struct ath_node);
hw->vif_data_size = sizeof(struct ath_vif);
+   hw->txq_data_size = sizeof(struct ath_atx_tid);
hw->extra_tx_headroom = 4;
 
hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1;
diff --git a/d

[PATCH RFC/RFT v2 1/2] ath9k: rename struct ath_txq to struct ath_hwq

2016-03-04 Thread Tim Shepard

Also use hwq instead of txq to refer to it throughout ath9k/*.  This
is prep work for using mac80211's new intermediate queues, which are
called txq, and it would be too confusing if both are called txq.

Signed-off-by: Tim Shepard 
---
 drivers/net/wireless/ath/ath9k/ath9k.h |   50 +--
 drivers/net/wireless/ath/ath9k/beacon.c|   10 +-
 drivers/net/wireless/ath/ath9k/channel.c   |4 +-
 drivers/net/wireless/ath/ath9k/debug.c |   34 +-
 drivers/net/wireless/ath/ath9k/debug.h |8 +-
 drivers/net/wireless/ath/ath9k/debug_sta.c |8 +-
 drivers/net/wireless/ath/ath9k/gpio.c  |6 +-
 drivers/net/wireless/ath/ath9k/init.c  |   18 +-
 drivers/net/wireless/ath/ath9k/link.c  |   18 +-
 drivers/net/wireless/ath/ath9k/main.c  |   42 +--
 drivers/net/wireless/ath/ath9k/tx99.c  |6 +-
 drivers/net/wireless/ath/ath9k/xmit.c  |  512 ++--
 12 files changed, 358 insertions(+), 358 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h 
b/drivers/net/wireless/ath/ath9k/ath9k.h
index 5294595..1118b3d 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -80,7 +80,7 @@ int ath_descdma_setup(struct ath_softc *sc, struct 
ath_descdma *dd,
 /* RX / TX */
 /***/
 
-#defineATH_TXQ_SETUP(sc, i) ((sc)->tx.txqsetup & (1<tx.hwqsetup & (1<sc_ah;
struct ath_common *common = ath9k_hw_common(ah);
struct ath9k_tx_queue_info qi, qi_be;
-   struct ath_txq *txq;
+   struct ath_hwq *hwq;
 
ath9k_hw_get_txq_props(ah, sc->beacon.beaconq, &qi);
 
@@ -47,8 +47,8 @@ static void ath9k_beaconq_config(struct ath_softc *sc)
qi.tqi_cwmax = 0;
} else {
/* Adhoc mode; important thing is to use 2x cwmin. */
-   txq = sc->tx.txq_map[IEEE80211_AC_BE];
-   ath9k_hw_get_txq_props(ah, txq->axq_qnum, &qi_be);
+   hwq = sc->tx.hwq_map[IEEE80211_AC_BE];
+   ath9k_hw_get_txq_props(ah, hwq->axq_qnum, &qi_be);
qi.tqi_aifs = qi_be.tqi_aifs;
if (ah->slottime == ATH9K_SLOT_TIME_20)
qi.tqi_cwmin = 2*qi_be.tqi_cwmin;
@@ -117,7 +117,7 @@ static struct ath_buf *ath9k_beacon_generate(struct 
ieee80211_hw *hw,
struct ath_buf *bf;
struct ath_vif *avp = (void *)vif->drv_priv;
struct sk_buff *skb;
-   struct ath_txq *cabq = sc->beacon.cabq;
+   struct ath_hwq *cabq = sc->beacon.cabq;
struct ieee80211_tx_info *info;
struct ieee80211_mgmt *mgmt_hdr;
int cabq_depth;
@@ -180,7 +180,7 @@ static struct ath_buf *ath9k_beacon_generate(struct 
ieee80211_hw *hw,
if (sc->cur_chan->nvifs > 1) {
ath_dbg(common, BEACON,
"Flushing previous cabq traffic\n");
-   ath_draintxq(sc, cabq);
+   ath_drainhwq(sc, cabq);
}
}
 
diff --git a/drivers/net/wireless/ath/ath9k/channel.c 
b/drivers/net/wireless/ath/ath9k/channel.c
index 50e614b..0297588 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -1006,7 +1006,7 @@ static void ath_scan_send_probe(struct ath_softc *sc,
if (!ieee80211_tx_prepare_skb(sc->hw, vif, skb, band, NULL))
goto error;
 
-   txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO];
+   txctl.hwq = sc->tx.hwq_map[IEEE80211_AC_VO];
txctl.force_channel = true;
if (ath_tx_start(sc->hw, skb, &txctl))
goto error;
@@ -1128,7 +1128,7 @@ ath_chanctx_send_vif_ps_frame(struct ath_softc *sc, 
struct ath_vif *avp,
}
 
memset(&txctl, 0, sizeof(txctl));
-   txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO];
+   txctl.hwq = sc->tx.hwq_map[IEEE80211_AC_VO];
txctl.sta = sta;
txctl.force_channel = true;
if (ath_tx_start(sc->hw, skb, &txctl)) {
diff --git a/drivers/net/wireless/ath/ath9k/debug.c 
b/drivers/net/wireless/ath/ath9k/debug.c
index 6de64cf..5e9dda8 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -621,34 +621,34 @@ static int read_file_xmit(struct seq_file *file, void 
*data)
return 0;
 }
 
-static void print_queue(struct ath_softc *sc, struct ath_txq *txq,
+static void print_queue(struct ath_softc *sc, struct ath_hwq *hwq,
struct seq_file *file)
 {
-   ath_txq_lock(sc, txq);
+   ath_hwq_lock(sc, hwq);
 
-   seq_printf(file, "%s: %d ", "qnum", txq->axq_qnum);
-   seq_printf(file, "%s: %2d ", "qdepth", txq->axq_depth);
-   seq_printf(file, "%s: %2d ", "ampdu-depth", txq->axq_ampdu_depth);
-   seq_printf(file, "%s: %3d ", "pending&

[PATCH RFC/RFT v2 0/2] ath9k: use mac80211 intermediate software queues

2016-03-04 Thread Tim Shepard


[ v2: fixed compile errors in first patch when config includes
  ATH9K_TX99 or ATH9K_CHANNEL_CONTEXT.  Also added signed-off-by
  to both patches. ] 

Here is a patch in two parts to have ath9k make use the new
intermediate queues in mac80211.   It seems to work for me, but it
clearly needs more testing.

This should be useful to anyone who wants to try Michal's patch from
last week "mac80211: implement fq_codel for software queuing" as that
patch will not do anything unless you have a mac80211 driver that uses
the new mac80211 intermediate queues and indicates to mac80211 that
it does so by having a non-zero .wake_tx_queue method.

The first patch just renames the struct ath_txq in ath9k to be
struct ath_hwq and the renames the variables and fields holding a
pointer to it to be hwq  (instead of txq).

This first patch is IMHO needed because I had an earlier version of
this without renaming ath_txq and it was too mind bending to try and
keep straight which was ath9k's txq (which is per hardware queue)
and what was mac80211 txq (which is per station per tid).

The second patch changes ath9k to use the new mac80211 intermediate
software queues.

I left the existing ath9k software queue mechanisms in place. They
are used by the channel context code in some cases even for non-data
frames, and in any case it seemed like a safer first step to get this
working before removing code.  Yes, we should eventually clean this
up once this is tested and we figure out what the right way to do
the clean up.   I see little harm in leaving it stay for awhile.

I have not tried any testing with CONFIG_ATH9K_CHANNEL_CONTEXT=y and
I am not even sure what I would need to do to properly exercise that.

Please comment and/or test.

        -Tim Shepard
 s...@alum.mit.edu


Re: [PATCH RFC/RFT 1/2] ath9k: rename struct ath_txq to struct ath_hwq

2016-03-03 Thread Tim Shepard



I've already received an automated report that this patch fails to
build.  Oops.

Apparently only when either CONFIG_ATH9K_TX99=y or
CONFIG_ATH9K_CHANNEL_CONTEXT=y .

I missed a few things in the ath_txq to ath_hwq rename and failed to
catch it because I didn't have those turned on in my .config .

So if you want to test this before I resubmit, make sure those two
configs are turned off in your .config, or maybe try patching with the
diff below.

I plan to resend the patch soon (probably tomorrow) with this fix
squashed in, after I do some test compiling to make sure I've actually
fixed it.

            -Tim Shepard
 s...@alum.mit.edu
 ___ _ ___ _   _ _ ___   ___ _ _ _ _   _   _ ___ _   _   _ ___ _ ___ _ ___


diff --git a/drivers/net/wireless/ath/ath9k/channel.c 
b/drivers/net/wireless/ath/ath9k/channel.c
index 50e614b..0297588 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -1006,7 +1006,7 @@ static void ath_scan_send_probe(struct ath_softc *sc,
if (!ieee80211_tx_prepare_skb(sc->hw, vif, skb, band, NULL))
goto error;
 
-   txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO];
+   txctl.hwq = sc->tx.hwq_map[IEEE80211_AC_VO];
txctl.force_channel = true;
if (ath_tx_start(sc->hw, skb, &txctl))
goto error;
@@ -1128,7 +1128,7 @@ ath_chanctx_send_vif_ps_frame(struct ath_softc *sc, 
struct ath_vif *avp,
}
 
memset(&txctl, 0, sizeof(txctl));
-   txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO];
+   txctl.hwq = sc->tx.hwq_map[IEEE80211_AC_VO];
txctl.sta = sta;
txctl.force_channel = true;
if (ath_tx_start(sc->hw, skb, &txctl)) {
diff --git a/drivers/net/wireless/ath/ath9k/tx99.c 
b/drivers/net/wireless/ath/ath9k/tx99.c
index ac4781f..0a9ed5c 100644
--- a/drivers/net/wireless/ath/ath9k/tx99.c
+++ b/drivers/net/wireless/ath/ath9k/tx99.c
@@ -21,7 +21,7 @@ static void ath9k_tx99_stop(struct ath_softc *sc)
struct ath_hw *ah = sc->sc_ah;
struct ath_common *common = ath9k_hw_common(ah);
 
-   ath_drain_all_txq(sc);
+   ath_drain_all_hwq(sc);
ath_startrecv(sc);
 
ath9k_hw_set_interrupts(ah);
@@ -125,7 +125,7 @@ static int ath9k_tx99_init(struct ath_softc *sc)
return -ENOMEM;
 
memset(&txctl, 0, sizeof(txctl));
-   txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO];
+   txctl.hwq = sc->tx.hwq_map[IEEE80211_AC_VO];
 
ath_reset(sc, NULL);
 
@@ -133,7 +133,7 @@ static int ath9k_tx99_init(struct ath_softc *sc)
 
ath9k_hw_disable_interrupts(ah);
atomic_set(&ah->intr_ref_cnt, -1);
-   ath_drain_all_txq(sc);
+   ath_drain_all_hwq(sc);
ath_stoprecv(sc);
 
sc->tx99_state = true;


Re: [RFC/RFT] mac80211: implement fq_codel for software queuing

2016-03-03 Thread Tim Shepard



If you want to try out Michal's patch you'll need a mac80211 driver
that uses the new intermediate queues.

I just submitted a PATCH RFC/RFT to modify ath9k to use the new
intermediate software queues.  There are very few (zero or close to
zero) drivers in linux which do that, and Michal's patch does not do
anything at all unless your driver uses the new intermediate software
queues.

See If you want to try out Michal's patch you'll need a mac80211 driver
that uses the new intermediate queues.

I just submitted a PATCH RFC/RFT to modify ath9k to use the new
intermediate software queues.  There are very few (zero or close to
zero) drivers in linux which do that, and Michal's patch does not do
anything at all unless your driver uses the new intermediate software
queues.

See my post from a few hours ago with subject:

[PATCH RFC/RFT 0/2] ath9k: use mac80211 intermediate software queues


(I am interested in knowing what other mac80211 drivers have been
 modified to use the mac80211 intermediate software queues.   I know
 Michal mentioned he has patches for ath10k that are not yet released,
 and I know Felix is finishing up the mt76 driver which uses them.)


    -Tim Shepard
 s...@alum.mit.edu


[PATCH RFC/RFT 2/2] ath9k: use mac80211 intermediate software queues

2016-03-03 Thread Tim Shepard

This patch leaves the code for ath9k's internal per-node per-tid
queues in place and just modifies the driver to also pull from
the new mac80211 intermediate software queues, and implements
the .wake_tx_queue method, which will cause mac80211 to deliver
packets to be sent via the new intermediate queue.
---
 drivers/net/wireless/ath/ath9k/ath9k.h |   16 +++-
 drivers/net/wireless/ath/ath9k/debug_sta.c |8 +-
 drivers/net/wireless/ath/ath9k/init.c  |1 +
 drivers/net/wireless/ath/ath9k/main.c  |1 +
 drivers/net/wireless/ath/ath9k/xmit.c  |  122 
 5 files changed, 129 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h 
b/drivers/net/wireless/ath/ath9k/ath9k.h
index 1118b3d..96cbcad 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -145,8 +145,6 @@ int ath_descdma_setup(struct ath_softc *sc, struct 
ath_descdma *dd,
 #define BAW_WITHIN(_start, _bawsz, _seqno) \
_seqno) - (_start)) & 4095) < (_bawsz))
 
-#define ATH_AN_2_TID(_an, _tidno)  (&(_an)->tid[(_tidno)])
-
 #define IS_HT_RATE(rate)   (rate & 0x80)
 #define IS_CCK_RATE(rate)  ((rate >= 0x18) && (rate <= 0x1e))
 #define IS_OFDM_RATE(rate) ((rate >= 0x8) && (rate <= 0xf))
@@ -232,8 +230,10 @@ struct ath_buf {
 
 struct ath_atx_tid {
struct list_head list;
+   struct sk_buff_head i_q;
struct sk_buff_head buf_q;
struct sk_buff_head retry_q;
+   struct ieee80211_txq *txq;
struct ath_node *an;
struct ath_hwq *hwq;
unsigned long tx_buf[BITS_TO_LONGS(ATH_TID_MAX_BUFS)];
@@ -247,13 +247,13 @@ struct ath_atx_tid {
s8 bar_index;
bool active;
bool clear_ps_filter;
+   bool txq_nonempty;
 };
 
 struct ath_node {
struct ath_softc *sc;
struct ieee80211_sta *sta; /* station struct we're part of */
struct ieee80211_vif *vif; /* interface with which we're associated */
-   struct ath_atx_tid tid[IEEE80211_NUM_TIDS];
 
u16 maxampdu;
u8 mpdudensity;
@@ -271,6 +271,15 @@ struct ath_node {
struct list_head list;
 };
 
+static inline
+struct ath_atx_tid *ath_an_2_tid(struct ath_node *an, u8 tidno)
+{
+   struct ieee80211_sta *sta = an->sta;
+   struct ieee80211_vif *vif = an->vif;
+   struct ieee80211_txq *txq = sta? sta->txq[tidno] : vif->txq;
+   return (struct ath_atx_tid *) txq->drv_priv;
+}
+
 struct ath_tx_control {
struct ath_hwq *hwq;
struct ath_node *an;
@@ -585,6 +594,7 @@ void ath9k_release_buffered_frames(struct ieee80211_hw *hw,
   u16 tids, int nframes,
   enum ieee80211_frame_release_type reason,
   bool more_data);
+void ath9k_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *txq);
 
 //
 /* VIFs */
diff --git a/drivers/net/wireless/ath/ath9k/debug_sta.c 
b/drivers/net/wireless/ath/ath9k/debug_sta.c
index a9f4a92..100cbfd 100644
--- a/drivers/net/wireless/ath/ath9k/debug_sta.c
+++ b/drivers/net/wireless/ath/ath9k/debug_sta.c
@@ -25,6 +25,7 @@ static ssize_t read_file_node_aggr(struct file *file, char 
__user *user_buf,
 {
struct ath_node *an = file->private_data;
struct ath_softc *sc = an->sc;
+   struct ieee80211_txq *txq;
struct ath_atx_tid *tid;
struct ath_hwq *hwq;
u32 len = 0, size = 4096;
@@ -52,8 +53,11 @@ static ssize_t read_file_node_aggr(struct file *file, char 
__user *user_buf,
 "TID", "SEQ_START", "SEQ_NEXT", "BAW_SIZE",
 "BAW_HEAD", "BAW_TAIL", "BAR_IDX", "SCHED", "PAUSED");
 
-   for (tidno = 0, tid = &an->tid[tidno];
-tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
+   for (tidno = 0;
+tidno < IEEE80211_NUM_TIDS; tidno++) {
+
+   txq = an->sta->txq[tidno];
+   tid = (struct ath_atx_tid *) txq->drv_priv;
hwq = tid->hwq;
ath_hwq_lock(sc, hwq);
if (tid->active) {
diff --git a/drivers/net/wireless/ath/ath9k/init.c 
b/drivers/net/wireless/ath/ath9k/init.c
index d96055f..7d4427a 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -882,6 +882,7 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct 
ieee80211_hw *hw)
hw->max_rate_tries = 10;
hw->sta_data_size = sizeof(struct ath_node);
hw->vif_data_size = sizeof(struct ath_vif);
+   hw->txq_data_size = sizeof(struct ath_atx_tid);
hw->extra_tx_headroom = 4;
 
hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1;
diff --git a/drivers/net/wireless/ath/ath9k/main.c 
b/drivers/net/wireless/ath/ath9k/main.c
index d39eec8..6cb27b2 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -2668,4 +2668,5 @@ struct ieee80211_ops ath9k_ops = {

[PATCH RFC/RFT 1/2] ath9k: rename struct ath_txq to struct ath_hwq

2016-03-03 Thread Tim Shepard

Also use hwq instead of txq to refer to it throughout ath9k/*.  This
is prep work for using mac80211's new intermediate queues, which are
called txq, and it would be too confusing if both are called txq.
---
 drivers/net/wireless/ath/ath9k/ath9k.h |   50 +--
 drivers/net/wireless/ath/ath9k/beacon.c|   10 +-
 drivers/net/wireless/ath/ath9k/debug.c |   34 +-
 drivers/net/wireless/ath/ath9k/debug.h |8 +-
 drivers/net/wireless/ath/ath9k/debug_sta.c |8 +-
 drivers/net/wireless/ath/ath9k/gpio.c  |6 +-
 drivers/net/wireless/ath/ath9k/init.c  |   18 +-
 drivers/net/wireless/ath/ath9k/link.c  |   18 +-
 drivers/net/wireless/ath/ath9k/main.c  |   42 +--
 drivers/net/wireless/ath/ath9k/xmit.c  |  512 ++--
 10 files changed, 353 insertions(+), 353 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h 
b/drivers/net/wireless/ath/ath9k/ath9k.h
index 5294595..1118b3d 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -80,7 +80,7 @@ int ath_descdma_setup(struct ath_softc *sc, struct 
ath_descdma *dd,
 /* RX / TX */
 /***/
 
-#defineATH_TXQ_SETUP(sc, i) ((sc)->tx.txqsetup & (1beacon.beaconq, &qi);
 
@@ -47,8 +47,8 @@ static void ath9k_beaconq_config(struct ath_softc *sc)
qi.tqi_cwmax = 0;
} else {
/* Adhoc mode; important thing is to use 2x cwmin. */
-   txq = sc->tx.txq_map[IEEE80211_AC_BE];
-   ath9k_hw_get_txq_props(ah, txq->axq_qnum, &qi_be);
+   hwq = sc->tx.hwq_map[IEEE80211_AC_BE];
+   ath9k_hw_get_txq_props(ah, hwq->axq_qnum, &qi_be);
qi.tqi_aifs = qi_be.tqi_aifs;
if (ah->slottime == ATH9K_SLOT_TIME_20)
qi.tqi_cwmin = 2*qi_be.tqi_cwmin;
@@ -117,7 +117,7 @@ static struct ath_buf *ath9k_beacon_generate(struct 
ieee80211_hw *hw,
struct ath_buf *bf;
struct ath_vif *avp = (void *)vif->drv_priv;
struct sk_buff *skb;
-   struct ath_txq *cabq = sc->beacon.cabq;
+   struct ath_hwq *cabq = sc->beacon.cabq;
struct ieee80211_tx_info *info;
struct ieee80211_mgmt *mgmt_hdr;
int cabq_depth;
@@ -180,7 +180,7 @@ static struct ath_buf *ath9k_beacon_generate(struct 
ieee80211_hw *hw,
if (sc->cur_chan->nvifs > 1) {
ath_dbg(common, BEACON,
"Flushing previous cabq traffic\n");
-   ath_draintxq(sc, cabq);
+   ath_drainhwq(sc, cabq);
}
}
 
diff --git a/drivers/net/wireless/ath/ath9k/debug.c 
b/drivers/net/wireless/ath/ath9k/debug.c
index 6de64cf..5e9dda8 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -621,34 +621,34 @@ static int read_file_xmit(struct seq_file *file, void 
*data)
return 0;
 }
 
-static void print_queue(struct ath_softc *sc, struct ath_txq *txq,
+static void print_queue(struct ath_softc *sc, struct ath_hwq *hwq,
struct seq_file *file)
 {
-   ath_txq_lock(sc, txq);
+   ath_hwq_lock(sc, hwq);
 
-   seq_printf(file, "%s: %d ", "qnum", txq->axq_qnum);
-   seq_printf(file, "%s: %2d ", "qdepth", txq->axq_depth);
-   seq_printf(file, "%s: %2d ", "ampdu-depth", txq->axq_ampdu_depth);
-   seq_printf(file, "%s: %3d ", "pending", txq->pending_frames);
-   seq_printf(file, "%s: %d\n", "stopped", txq->stopped);
+   seq_printf(file, "%s: %d ", "qnum", hwq->axq_qnum);
+   seq_printf(file, "%s: %2d ", "qdepth", hwq->axq_depth);
+   seq_printf(file, "%s: %2d ", "ampdu-depth", hwq->axq_ampdu_depth);
+   seq_printf(file, "%s: %3d ", "pending", hwq->pending_frames);
+   seq_printf(file, "%s: %d\n", "stopped", hwq->stopped);
 
-   ath_txq_unlock(sc, txq);
+   ath_hwq_unlock(sc, hwq);
 }
 
 static int read_file_queues(struct seq_file *file, void *data)
 {
struct ieee80211_hw *hw = dev_get_drvdata(file->private);
struct ath_softc *sc = hw->priv;
-   struct ath_txq *txq;
+   struct ath_hwq *hwq;
int i;
static const char *qname[4] = {
"VO", "VI", "BE", "BK"
};
 
for (i = 0; i < IEEE80211_NUM_ACS; i++) {
-   txq = sc->tx.txq_map[i];
+   hwq = sc->tx.hwq_map[i];
seq_printf(file, "(%s):  ", qname[i]);
-   print_queue(sc, txq, file);
+   print_queue(sc, hwq, file);
}
 
seq_puts(file, "(CAB): ");
@@ -782,10 +782,10 @@ static int read_file_reset(struct seq_file *file, void 
*data)
 }
 
 void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
-   

[PATCH RFC/RFT 0/2] ath9k: use mac80211 intermediate software queues

2016-03-03 Thread Tim Shepard

Here is a patch in two parts to have ath9k make use the new
intermediate queues in mac80211.   It seems to work for me, but it
clearly needs more testing.

This should be useful to anyone who wants to try Michal's patch from
last week "mac80211: implement fq_codel for software queuing" as that
patch will not do anything unless you have a mac80211 driver that uses
the new mac80211 intermediate queues and indicates to mac80211 that
it does so by having a non-zero .wake_tx_queue method.

The first patch just renames the struct ath_txq in ath9k to be
struct ath_hwq and the renames the variables and fields holding a
pointer to it to be hwq  (instead of txq).

This first patch is IMHO needed because I had an earlier version of
this without renaming ath_txq and it was too mind bending to try and
keep straight which was ath9k's txq (which is per hardware queue)
and what was mac80211 txq (which is per station per tid).

The second patch changes ath9k to use the new mac80211 intermediate
software queues.

I left the existing ath9k software queue mechanisms in place. They
are used by the channel context code in some cases even for non-data
frames, and in any case it seemed like a safer first step to get this
working before removing code.  Yes, we should eventually clean this
up once this is tested and we figure out what the right way to do
the clean up.   I see little harm in leaving it stay for awhile.

I have not tried any testing with CONFIG_ATH9K_CHANNEL_CONTEXT=y and
I am not even sure what I would need to do to properly exercise that.

Please comment and/or test.

        -Tim Shepard
 s...@alum.mit.edu