ath10k: handle channel change htt event
authorRajkumar Manoharan <rmanohar@qti.qualcomm.com>
Tue, 8 Mar 2016 17:27:23 +0000 (22:57 +0530)
committerKalle Valo <kvalo@qca.qualcomm.com>
Fri, 18 Mar 2016 07:49:39 +0000 (09:49 +0200)
Whenever firmware is configuring operating channel during scan or
home channel, channel change event will be indicated to host. In some
cases (device probe/ last vdev down), target will be configured to
default channel whereas host is unaware of target's operating channel.
This leads to packet drop due to unknown channel and kernel log will be
filled up with "no channel configured; ignoring frame(s)!". Fix that
by handling HTT_T2H_MSG_TYPE_CHAN_CHANGE event.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath10k/core.h
drivers/net/wireless/ath/ath10k/htt.h
drivers/net/wireless/ath/ath10k/htt_rx.c
drivers/net/wireless/ath/ath10k/wmi.c

index 23ba03fb7a5f5e1663edb54bf34b254c53c3f1d0..bb5f7e22fc1e6353c9daad00b79f7c051a148407 100644 (file)
@@ -766,6 +766,9 @@ struct ath10k {
        /* current operating channel definition */
        struct cfg80211_chan_def chandef;
 
+       /* currently configured operating channel in firmware */
+       struct ieee80211_channel *tgt_oper_chan;
+
        unsigned long long free_vdev_map;
        struct ath10k_vif *monitor_arvif;
        bool monitor;
index 02cf55d306e817555d0715569d0c7dc8f552148a..3583fd99df483addb9b12de286e7630bb3b363fb 100644 (file)
@@ -1461,6 +1461,14 @@ struct htt_tx_mode_switch_ind {
        struct htt_tx_mode_switch_record records[0];
 } __packed;
 
+struct htt_channel_change {
+       u8 pad[3];
+       __le32 freq;
+       __le32 center_freq1;
+       __le32 center_freq2;
+       __le32 phymode;
+} __packed;
+
 union htt_rx_pn_t {
        /* WEP: 24-bit PN */
        u32 pn24;
@@ -1511,6 +1519,7 @@ struct htt_resp {
                struct htt_tx_fetch_ind tx_fetch_ind;
                struct htt_tx_fetch_confirm tx_fetch_confirm;
                struct htt_tx_mode_switch_ind tx_mode_switch_ind;
+               struct htt_channel_change chan_change;
        };
 } __packed;
 
index 84b060efa1b5f4d828a01265263e071234050f19..24fe3b6b5eb6f586c8cc71b4fe20af6791503c6b 100644 (file)
@@ -862,6 +862,8 @@ static bool ath10k_htt_rx_h_channel(struct ath10k *ar,
                ch = ath10k_htt_rx_h_vdev_channel(ar, vdev_id);
        if (!ch)
                ch = ath10k_htt_rx_h_any_channel(ar);
+       if (!ch)
+               ch = ar->tgt_oper_chan;
        spin_unlock_bh(&ar->data_lock);
 
        if (!ch)
@@ -2257,6 +2259,34 @@ static void ath10k_htt_rx_tx_mode_switch_ind(struct ath10k *ar,
        ath10k_mac_tx_push_pending(ar);
 }
 
+static inline enum ieee80211_band phy_mode_to_band(u32 phy_mode)
+{
+       enum ieee80211_band band;
+
+       switch (phy_mode) {
+       case MODE_11A:
+       case MODE_11NA_HT20:
+       case MODE_11NA_HT40:
+       case MODE_11AC_VHT20:
+       case MODE_11AC_VHT40:
+       case MODE_11AC_VHT80:
+               band = IEEE80211_BAND_5GHZ;
+               break;
+       case MODE_11G:
+       case MODE_11B:
+       case MODE_11GONLY:
+       case MODE_11NG_HT20:
+       case MODE_11NG_HT40:
+       case MODE_11AC_VHT20_2G:
+       case MODE_11AC_VHT40_2G:
+       case MODE_11AC_VHT80_2G:
+       default:
+               band = IEEE80211_BAND_2GHZ;
+       }
+
+       return band;
+}
+
 void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb)
 {
        struct ath10k_htt *htt = &ar->htt;
@@ -2391,8 +2421,17 @@ void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb)
        }
        case HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND:
                break;
-       case HTT_T2H_MSG_TYPE_CHAN_CHANGE:
+       case HTT_T2H_MSG_TYPE_CHAN_CHANGE: {
+               u32 phymode = __le32_to_cpu(resp->chan_change.phymode);
+               u32 freq = __le32_to_cpu(resp->chan_change.freq);
+
+               ar->tgt_oper_chan =
+                       __ieee80211_get_channel(ar->hw->wiphy, freq);
+               ath10k_dbg(ar, ATH10K_DBG_HTT,
+                          "htt chan change freq %u phymode %s\n",
+                          freq, ath10k_wmi_phymode_str(phymode));
                break;
+       }
        case HTT_T2H_MSG_TYPE_AGGR_CONF:
                break;
        case HTT_T2H_MSG_TYPE_TX_FETCH_IND:
index c2608946f77342abed8ac91f802e90f36b550dfb..91375664dc355bef7ee4bcb006146aeae6b261e3 100644 (file)
@@ -2099,34 +2099,6 @@ int ath10k_wmi_event_scan(struct ath10k *ar, struct sk_buff *skb)
        return 0;
 }
 
-static inline enum ieee80211_band phy_mode_to_band(u32 phy_mode)
-{
-       enum ieee80211_band band;
-
-       switch (phy_mode) {
-       case MODE_11A:
-       case MODE_11NA_HT20:
-       case MODE_11NA_HT40:
-       case MODE_11AC_VHT20:
-       case MODE_11AC_VHT40:
-       case MODE_11AC_VHT80:
-               band = IEEE80211_BAND_5GHZ;
-               break;
-       case MODE_11G:
-       case MODE_11B:
-       case MODE_11GONLY:
-       case MODE_11NG_HT20:
-       case MODE_11NG_HT40:
-       case MODE_11AC_VHT20_2G:
-       case MODE_11AC_VHT40_2G:
-       case MODE_11AC_VHT80_2G:
-       default:
-               band = IEEE80211_BAND_2GHZ;
-       }
-
-       return band;
-}
-
 /* If keys are configured, HW decrypts all frames
  * with protected bit set. Mark such frames as decrypted.
  */
This page took 0.032115 seconds and 5 git commands to generate.