提交 bc81d43a 编写于 作者: S Sujith Manoharan 提交者: John W. Linville

ath9k: Add debug information

Add a few statements to debug channel context operation.
Signed-off-by: NSujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 dfcbb3e8
...@@ -16,6 +16,23 @@ ...@@ -16,6 +16,23 @@
#include "ath9k.h" #include "ath9k.h"
static const char *offchannel_state_string(enum ath_offchannel_state state)
{
#define case_rtn_string(val) case val: return #val
switch (state) {
case_rtn_string(ATH_OFFCHANNEL_IDLE);
case_rtn_string(ATH_OFFCHANNEL_PROBE_SEND);
case_rtn_string(ATH_OFFCHANNEL_PROBE_WAIT);
case_rtn_string(ATH_OFFCHANNEL_SUSPEND);
case_rtn_string(ATH_OFFCHANNEL_ROC_START);
case_rtn_string(ATH_OFFCHANNEL_ROC_WAIT);
case_rtn_string(ATH_OFFCHANNEL_ROC_DONE);
default:
return "unknown";
}
}
/* Set/change channels. If the channel is really being changed, it's done /* Set/change channels. If the channel is really being changed, it's done
* by reseting the chip. To accomplish this we must first cleanup any pending * by reseting the chip. To accomplish this we must first cleanup any pending
* DMA, then restart stuff. * DMA, then restart stuff.
...@@ -373,13 +390,23 @@ void ath_chanctx_switch(struct ath_softc *sc, struct ath_chanctx *ctx, ...@@ -373,13 +390,23 @@ void ath_chanctx_switch(struct ath_softc *sc, struct ath_chanctx *ctx,
} }
sc->next_chan = ctx; sc->next_chan = ctx;
if (chandef) if (chandef) {
ctx->chandef = *chandef; ctx->chandef = *chandef;
ath_dbg(common, CHAN_CTX,
"Assigned next_chan to %d MHz\n", chandef->center_freq1);
}
if (sc->next_chan == &sc->offchannel.chan) { if (sc->next_chan == &sc->offchannel.chan) {
sc->sched.offchannel_duration = sc->sched.offchannel_duration =
TU_TO_USEC(sc->offchannel.duration) + TU_TO_USEC(sc->offchannel.duration) +
sc->sched.channel_switch_time; sc->sched.channel_switch_time;
if (chandef) {
ath_dbg(common, CHAN_CTX,
"Offchannel duration for chan %d MHz : %u\n",
chandef->center_freq1,
sc->sched.offchannel_duration);
}
} }
spin_unlock_bh(&sc->chan_lock); spin_unlock_bh(&sc->chan_lock);
ieee80211_queue_work(sc->hw, &sc->chanctx_work); ieee80211_queue_work(sc->hw, &sc->chanctx_work);
...@@ -422,9 +449,12 @@ struct ath_chanctx *ath_chanctx_get_oper_chan(struct ath_softc *sc, bool active) ...@@ -422,9 +449,12 @@ struct ath_chanctx *ath_chanctx_get_oper_chan(struct ath_softc *sc, bool active)
void ath_chanctx_offchan_switch(struct ath_softc *sc, void ath_chanctx_offchan_switch(struct ath_softc *sc,
struct ieee80211_channel *chan) struct ieee80211_channel *chan)
{ {
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct cfg80211_chan_def chandef; struct cfg80211_chan_def chandef;
cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_NO_HT); cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_NO_HT);
ath_dbg(common, CHAN_CTX,
"Channel definition created: %d MHz\n", chandef.center_freq1);
ath_chanctx_switch(sc, &sc->offchannel.chan, &chandef); ath_chanctx_switch(sc, &sc->offchannel.chan, &chandef);
} }
...@@ -698,19 +728,30 @@ static int ath_scan_channel_duration(struct ath_softc *sc, ...@@ -698,19 +728,30 @@ static int ath_scan_channel_duration(struct ath_softc *sc,
static void static void
ath_scan_next_channel(struct ath_softc *sc) ath_scan_next_channel(struct ath_softc *sc)
{ {
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct cfg80211_scan_request *req = sc->offchannel.scan_req; struct cfg80211_scan_request *req = sc->offchannel.scan_req;
struct ieee80211_channel *chan; struct ieee80211_channel *chan;
if (sc->offchannel.scan_idx >= req->n_channels) { if (sc->offchannel.scan_idx >= req->n_channels) {
ath_dbg(common, CHAN_CTX,
"Moving to ATH_OFFCHANNEL_IDLE state, scan_idx: %d, n_channels: %d\n",
sc->offchannel.scan_idx,
req->n_channels);
sc->offchannel.state = ATH_OFFCHANNEL_IDLE; sc->offchannel.state = ATH_OFFCHANNEL_IDLE;
ath_chanctx_switch(sc, ath_chanctx_get_oper_chan(sc, false), ath_chanctx_switch(sc, ath_chanctx_get_oper_chan(sc, false),
NULL); NULL);
return; return;
} }
ath_dbg(common, CHAN_CTX,
"Moving to ATH_OFFCHANNEL_PROBE_SEND state, scan_idx: %d\n",
sc->offchannel.scan_idx);
chan = req->channels[sc->offchannel.scan_idx++]; chan = req->channels[sc->offchannel.scan_idx++];
sc->offchannel.duration = ath_scan_channel_duration(sc, chan); sc->offchannel.duration = ath_scan_channel_duration(sc, chan);
sc->offchannel.state = ATH_OFFCHANNEL_PROBE_SEND; sc->offchannel.state = ATH_OFFCHANNEL_PROBE_SEND;
ath_chanctx_offchan_switch(sc, chan); ath_chanctx_offchan_switch(sc, chan);
} }
...@@ -751,6 +792,11 @@ void ath_scan_complete(struct ath_softc *sc, bool abort) ...@@ -751,6 +792,11 @@ void ath_scan_complete(struct ath_softc *sc, bool abort)
{ {
struct ath_common *common = ath9k_hw_common(sc->sc_ah); struct ath_common *common = ath9k_hw_common(sc->sc_ah);
if (abort)
ath_dbg(common, CHAN_CTX, "HW scan aborted\n");
else
ath_dbg(common, CHAN_CTX, "HW scan complete\n");
sc->offchannel.scan_req = NULL; sc->offchannel.scan_req = NULL;
sc->offchannel.scan_vif = NULL; sc->offchannel.scan_vif = NULL;
sc->offchannel.state = ATH_OFFCHANNEL_IDLE; sc->offchannel.state = ATH_OFFCHANNEL_IDLE;
...@@ -800,6 +846,7 @@ static void ath_scan_send_probe(struct ath_softc *sc, ...@@ -800,6 +846,7 @@ static void ath_scan_send_probe(struct ath_softc *sc,
static void ath_scan_channel_start(struct ath_softc *sc) static void ath_scan_channel_start(struct ath_softc *sc)
{ {
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct cfg80211_scan_request *req = sc->offchannel.scan_req; struct cfg80211_scan_request *req = sc->offchannel.scan_req;
int i; int i;
...@@ -810,12 +857,20 @@ static void ath_scan_channel_start(struct ath_softc *sc) ...@@ -810,12 +857,20 @@ static void ath_scan_channel_start(struct ath_softc *sc)
} }
ath_dbg(common, CHAN_CTX,
"Moving to ATH_OFFCHANNEL_PROBE_WAIT state\n");
sc->offchannel.state = ATH_OFFCHANNEL_PROBE_WAIT; sc->offchannel.state = ATH_OFFCHANNEL_PROBE_WAIT;
mod_timer(&sc->offchannel.timer, jiffies + sc->offchannel.duration); mod_timer(&sc->offchannel.timer, jiffies + sc->offchannel.duration);
} }
void ath_offchannel_channel_change(struct ath_softc *sc) void ath_offchannel_channel_change(struct ath_softc *sc)
{ {
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
ath_dbg(common, CHAN_CTX, "%s: state: %s\n",
__func__, offchannel_state_string(sc->offchannel.state));
switch (sc->offchannel.state) { switch (sc->offchannel.state) {
case ATH_OFFCHANNEL_PROBE_SEND: case ATH_OFFCHANNEL_PROBE_SEND:
if (!sc->offchannel.scan_req) if (!sc->offchannel.scan_req)
...@@ -854,6 +909,10 @@ void ath_offchannel_timer(unsigned long data) ...@@ -854,6 +909,10 @@ void ath_offchannel_timer(unsigned long data)
{ {
struct ath_softc *sc = (struct ath_softc *)data; struct ath_softc *sc = (struct ath_softc *)data;
struct ath_chanctx *ctx; struct ath_chanctx *ctx;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
ath_dbg(common, CHAN_CTX, "%s: state: %s\n",
__func__, offchannel_state_string(sc->offchannel.state));
switch (sc->offchannel.state) { switch (sc->offchannel.state) {
case ATH_OFFCHANNEL_PROBE_WAIT: case ATH_OFFCHANNEL_PROBE_WAIT:
......
...@@ -2228,8 +2228,13 @@ static int ath9k_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -2228,8 +2228,13 @@ static int ath9k_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
sc->offchannel.scan_req = req; sc->offchannel.scan_req = req;
sc->offchannel.scan_idx = 0; sc->offchannel.scan_idx = 0;
if (sc->offchannel.state == ATH_OFFCHANNEL_IDLE) ath_dbg(common, CHAN_CTX, "HW scan request received on vif: %pM\n",
vif->addr);
if (sc->offchannel.state == ATH_OFFCHANNEL_IDLE) {
ath_dbg(common, CHAN_CTX, "Starting HW scan\n");
ath_offchannel_next(sc); ath_offchannel_next(sc);
}
out: out:
mutex_unlock(&sc->mutex); mutex_unlock(&sc->mutex);
...@@ -2241,6 +2246,9 @@ static void ath9k_cancel_hw_scan(struct ieee80211_hw *hw, ...@@ -2241,6 +2246,9 @@ static void ath9k_cancel_hw_scan(struct ieee80211_hw *hw,
struct ieee80211_vif *vif) struct ieee80211_vif *vif)
{ {
struct ath_softc *sc = hw->priv; struct ath_softc *sc = hw->priv;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
ath_dbg(common, CHAN_CTX, "Cancel HW scan on vif: %pM\n", vif->addr);
mutex_lock(&sc->mutex); mutex_lock(&sc->mutex);
del_timer_sync(&sc->offchannel.timer); del_timer_sync(&sc->offchannel.timer);
...@@ -2254,6 +2262,7 @@ static int ath9k_remain_on_channel(struct ieee80211_hw *hw, ...@@ -2254,6 +2262,7 @@ static int ath9k_remain_on_channel(struct ieee80211_hw *hw,
enum ieee80211_roc_type type) enum ieee80211_roc_type type)
{ {
struct ath_softc *sc = hw->priv; struct ath_softc *sc = hw->priv;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
int ret = 0; int ret = 0;
mutex_lock(&sc->mutex); mutex_lock(&sc->mutex);
...@@ -2268,8 +2277,14 @@ static int ath9k_remain_on_channel(struct ieee80211_hw *hw, ...@@ -2268,8 +2277,14 @@ static int ath9k_remain_on_channel(struct ieee80211_hw *hw,
sc->offchannel.roc_chan = chan; sc->offchannel.roc_chan = chan;
sc->offchannel.roc_duration = duration; sc->offchannel.roc_duration = duration;
if (sc->offchannel.state == ATH_OFFCHANNEL_IDLE) ath_dbg(common, CHAN_CTX,
"RoC request on vif: %pM, type: %d duration: %d\n",
vif->addr, type, duration);
if (sc->offchannel.state == ATH_OFFCHANNEL_IDLE) {
ath_dbg(common, CHAN_CTX, "Starting RoC period\n");
ath_offchannel_next(sc); ath_offchannel_next(sc);
}
out: out:
mutex_unlock(&sc->mutex); mutex_unlock(&sc->mutex);
...@@ -2280,9 +2295,11 @@ static int ath9k_remain_on_channel(struct ieee80211_hw *hw, ...@@ -2280,9 +2295,11 @@ static int ath9k_remain_on_channel(struct ieee80211_hw *hw,
static int ath9k_cancel_remain_on_channel(struct ieee80211_hw *hw) static int ath9k_cancel_remain_on_channel(struct ieee80211_hw *hw)
{ {
struct ath_softc *sc = hw->priv; struct ath_softc *sc = hw->priv;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
mutex_lock(&sc->mutex); mutex_lock(&sc->mutex);
ath_dbg(common, CHAN_CTX, "Cancel RoC\n");
del_timer_sync(&sc->offchannel.timer); del_timer_sync(&sc->offchannel.timer);
if (sc->offchannel.roc_vif) { if (sc->offchannel.roc_vif) {
...@@ -2299,6 +2316,7 @@ static int ath9k_add_chanctx(struct ieee80211_hw *hw, ...@@ -2299,6 +2316,7 @@ static int ath9k_add_chanctx(struct ieee80211_hw *hw,
struct ieee80211_chanctx_conf *conf) struct ieee80211_chanctx_conf *conf)
{ {
struct ath_softc *sc = hw->priv; struct ath_softc *sc = hw->priv;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_chanctx *ctx, **ptr; struct ath_chanctx *ctx, **ptr;
int pos; int pos;
...@@ -2313,10 +2331,16 @@ static int ath9k_add_chanctx(struct ieee80211_hw *hw, ...@@ -2313,10 +2331,16 @@ static int ath9k_add_chanctx(struct ieee80211_hw *hw,
ctx->assigned = true; ctx->assigned = true;
pos = ctx - &sc->chanctx[0]; pos = ctx - &sc->chanctx[0];
ctx->hw_queue_base = pos * IEEE80211_NUM_ACS; ctx->hw_queue_base = pos * IEEE80211_NUM_ACS;
ath_dbg(common, CHAN_CTX,
"Add channel context: %d MHz\n",
conf->def.chan->center_freq);
ath_chanctx_set_channel(sc, ctx, &conf->def); ath_chanctx_set_channel(sc, ctx, &conf->def);
mutex_unlock(&sc->mutex); mutex_unlock(&sc->mutex);
return 0; return 0;
} }
mutex_unlock(&sc->mutex); mutex_unlock(&sc->mutex);
return -ENOSPC; return -ENOSPC;
} }
...@@ -2326,12 +2350,19 @@ static void ath9k_remove_chanctx(struct ieee80211_hw *hw, ...@@ -2326,12 +2350,19 @@ static void ath9k_remove_chanctx(struct ieee80211_hw *hw,
struct ieee80211_chanctx_conf *conf) struct ieee80211_chanctx_conf *conf)
{ {
struct ath_softc *sc = hw->priv; struct ath_softc *sc = hw->priv;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_chanctx *ctx = ath_chanctx_get(conf); struct ath_chanctx *ctx = ath_chanctx_get(conf);
mutex_lock(&sc->mutex); mutex_lock(&sc->mutex);
ath_dbg(common, CHAN_CTX,
"Remove channel context: %d MHz\n",
conf->def.chan->center_freq);
ctx->assigned = false; ctx->assigned = false;
ctx->hw_queue_base = -1; ctx->hw_queue_base = -1;
ath_chanctx_event(sc, NULL, ATH_CHANCTX_EVENT_UNASSIGN); ath_chanctx_event(sc, NULL, ATH_CHANCTX_EVENT_UNASSIGN);
mutex_unlock(&sc->mutex); mutex_unlock(&sc->mutex);
} }
...@@ -2340,9 +2371,13 @@ static void ath9k_change_chanctx(struct ieee80211_hw *hw, ...@@ -2340,9 +2371,13 @@ static void ath9k_change_chanctx(struct ieee80211_hw *hw,
u32 changed) u32 changed)
{ {
struct ath_softc *sc = hw->priv; struct ath_softc *sc = hw->priv;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_chanctx *ctx = ath_chanctx_get(conf); struct ath_chanctx *ctx = ath_chanctx_get(conf);
mutex_lock(&sc->mutex); mutex_lock(&sc->mutex);
ath_dbg(common, CHAN_CTX,
"Change channel context: %d MHz\n",
conf->def.chan->center_freq);
ath_chanctx_set_channel(sc, ctx, &conf->def); ath_chanctx_set_channel(sc, ctx, &conf->def);
mutex_unlock(&sc->mutex); mutex_unlock(&sc->mutex);
} }
...@@ -2352,16 +2387,24 @@ static int ath9k_assign_vif_chanctx(struct ieee80211_hw *hw, ...@@ -2352,16 +2387,24 @@ static int ath9k_assign_vif_chanctx(struct ieee80211_hw *hw,
struct ieee80211_chanctx_conf *conf) struct ieee80211_chanctx_conf *conf)
{ {
struct ath_softc *sc = hw->priv; struct ath_softc *sc = hw->priv;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_vif *avp = (void *)vif->drv_priv; struct ath_vif *avp = (void *)vif->drv_priv;
struct ath_chanctx *ctx = ath_chanctx_get(conf); struct ath_chanctx *ctx = ath_chanctx_get(conf);
int i; int i;
mutex_lock(&sc->mutex); mutex_lock(&sc->mutex);
ath_dbg(common, CHAN_CTX,
"Assign VIF (addr: %pM, type: %d, p2p: %d) to channel context: %d MHz\n",
vif->addr, vif->type, vif->p2p,
conf->def.chan->center_freq);
avp->chanctx = ctx; avp->chanctx = ctx;
list_add_tail(&avp->list, &ctx->vifs); list_add_tail(&avp->list, &ctx->vifs);
ath9k_calculate_summary_state(sc, ctx); ath9k_calculate_summary_state(sc, ctx);
for (i = 0; i < IEEE80211_NUM_ACS; i++) for (i = 0; i < IEEE80211_NUM_ACS; i++)
vif->hw_queue[i] = ctx->hw_queue_base + i; vif->hw_queue[i] = ctx->hw_queue_base + i;
mutex_unlock(&sc->mutex); mutex_unlock(&sc->mutex);
return 0; return 0;
...@@ -2372,16 +2415,24 @@ static void ath9k_unassign_vif_chanctx(struct ieee80211_hw *hw, ...@@ -2372,16 +2415,24 @@ static void ath9k_unassign_vif_chanctx(struct ieee80211_hw *hw,
struct ieee80211_chanctx_conf *conf) struct ieee80211_chanctx_conf *conf)
{ {
struct ath_softc *sc = hw->priv; struct ath_softc *sc = hw->priv;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_vif *avp = (void *)vif->drv_priv; struct ath_vif *avp = (void *)vif->drv_priv;
struct ath_chanctx *ctx = ath_chanctx_get(conf); struct ath_chanctx *ctx = ath_chanctx_get(conf);
int ac; int ac;
mutex_lock(&sc->mutex); mutex_lock(&sc->mutex);
ath_dbg(common, CHAN_CTX,
"Remove VIF (addr: %pM, type: %d, p2p: %d) from channel context: %d MHz\n",
vif->addr, vif->type, vif->p2p,
conf->def.chan->center_freq);
avp->chanctx = NULL; avp->chanctx = NULL;
list_del(&avp->list); list_del(&avp->list);
ath9k_calculate_summary_state(sc, ctx); ath9k_calculate_summary_state(sc, ctx);
for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
vif->hw_queue[ac] = IEEE80211_INVAL_HW_QUEUE; vif->hw_queue[ac] = IEEE80211_INVAL_HW_QUEUE;
mutex_unlock(&sc->mutex); mutex_unlock(&sc->mutex);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册