ath9k: Print the event/state in ath_chanctx_event
authorSujith Manoharan <c_manoha@qca.qualcomm.com>
Sun, 24 Aug 2014 15:46:11 +0000 (21:16 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 28 Aug 2014 18:49:39 +0000 (14:49 -0400)
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/ath9k.h
drivers/net/wireless/ath/ath9k/channel.c

index 7c8c6f158c91e8c2bcb7af8939f7d9659abb636e..c690601f7276efe69e054fd1029e98b2f35fe1ba 100644 (file)
@@ -410,6 +410,9 @@ struct ath_offchannel {
        int roc_duration;
        int duration;
 };
+
+#define case_rtn_string(val) case val: return #val
+
 #define ath_for_each_chanctx(_sc, _ctx)                             \
        for (ctx = &sc->chanctx[0];                                 \
             ctx <= &sc->chanctx[ARRAY_SIZE(sc->chanctx) - 1];      \
index 34ccfa0142cf8de0a5439e53fbceb134459b2725..9be92d81ef6dd32268b9d822f5f648d36db8f496 100644 (file)
@@ -149,8 +149,6 @@ void ath_chanctx_set_channel(struct ath_softc *sc, struct ath_chanctx *ctx,
 
 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);
@@ -164,6 +162,37 @@ static const char *offchannel_state_string(enum ath_offchannel_state state)
        }
 }
 
+static const char *chanctx_event_string(enum ath_chanctx_event ev)
+{
+       switch (ev) {
+               case_rtn_string(ATH_CHANCTX_EVENT_BEACON_PREPARE);
+               case_rtn_string(ATH_CHANCTX_EVENT_BEACON_SENT);
+               case_rtn_string(ATH_CHANCTX_EVENT_TSF_TIMER);
+               case_rtn_string(ATH_CHANCTX_EVENT_BEACON_RECEIVED);
+               case_rtn_string(ATH_CHANCTX_EVENT_ASSOC);
+               case_rtn_string(ATH_CHANCTX_EVENT_SWITCH);
+               case_rtn_string(ATH_CHANCTX_EVENT_ASSIGN);
+               case_rtn_string(ATH_CHANCTX_EVENT_UNASSIGN);
+               case_rtn_string(ATH_CHANCTX_EVENT_CHANGE);
+               case_rtn_string(ATH_CHANCTX_EVENT_ENABLE_MULTICHANNEL);
+       default:
+               return "unknown";
+       }
+}
+
+static const char *chanctx_state_string(enum ath_chanctx_state state)
+{
+       switch (state) {
+               case_rtn_string(ATH_CHANCTX_STATE_IDLE);
+               case_rtn_string(ATH_CHANCTX_STATE_WAIT_FOR_BEACON);
+               case_rtn_string(ATH_CHANCTX_STATE_WAIT_FOR_TIMER);
+               case_rtn_string(ATH_CHANCTX_STATE_SWITCH);
+               case_rtn_string(ATH_CHANCTX_STATE_FORCE_ACTIVE);
+       default:
+               return "unknown";
+       }
+}
+
 void ath_chanctx_check_active(struct ath_softc *sc, struct ath_chanctx *ctx)
 {
        struct ath_common *common = ath9k_hw_common(sc->sc_ah);
@@ -275,6 +304,10 @@ void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,
        u32 beacon_int;
        bool noa_changed = false;
 
+       ath_dbg(common, CHAN_CTX, "event: %s, state: %s\n",
+               chanctx_event_string(ev),
+               chanctx_state_string(sc->sched.state));
+
        if (vif)
                avp = (struct ath_vif *) vif->drv_priv;