implement set_coalesce ieee80211_ops callback. Add default
wiphy_coalesce_support rules for 9k. These rules are not being used by 9k
since 9k can just toggle coalesce as on/off.

Signed-off-by: Olav Haugan <[email protected]>
---
 drivers/net/wireless/ath/ath9k/init.c | 19 +++++++++++++++++++
 drivers/net/wireless/ath/ath9k/main.c | 19 +++++++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/init.c 
b/drivers/net/wireless/ath/ath9k/init.c
index 57f95f2..10637f5 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -86,6 +86,24 @@ static const struct ieee80211_tpt_blink ath9k_tpt_blink[] = {
 };
 #endif
 
+/* 9k coalesce is binary (on/off) the below rules are
+ * not being used. Only there to give default values to
+ * wiphy_coalesce_support struct fields
+ */
+#define ATH9K_COALESCE_MAX_RULES     1
+#define ATH9K_COALESCE_MAX_FILTERS   1
+#define ATH9K_MAX_COALESCING_DELAY   1     /* in msecs */
+#define ATH9K_MAX_PATTERN_LEN        1
+#define ATH9K_MAX_OFFSET_LEN         1
+static const struct wiphy_coalesce_support ath9k_coalesce_support = {
+       .n_rules = ATH9K_COALESCE_MAX_RULES,
+       .max_delay = ATH9K_MAX_COALESCING_DELAY,
+       .n_patterns = ATH9K_COALESCE_MAX_FILTERS,
+       .pattern_min_len = 1,
+       .pattern_max_len = ATH9K_MAX_PATTERN_LEN,
+       .max_pkt_offset = ATH9K_MAX_OFFSET_LEN,
+};
+
 static void ath9k_deinit_softc(struct ath_softc *sc);
 
 static void ath9k_op_ps_wakeup(struct ath_common *common)
@@ -898,6 +916,7 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct 
ieee80211_hw *hw)
                hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
                        &common->sbands[IEEE80211_BAND_5GHZ];
 
+       hw->wiphy->coalesce = &ath9k_coalesce_support;
 #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
        ath9k_set_mcc_capab(sc, hw);
 #endif
diff --git a/drivers/net/wireless/ath/ath9k/main.c 
b/drivers/net/wireless/ath/ath9k/main.c
index c27143b..7595d5d 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -2611,6 +2611,24 @@ static int ath9k_get_txpower(struct ieee80211_hw *hw, 
struct ieee80211_vif *vif,
        return 0;
 }
 
+/* ath9k coalesce support */
+static int ath9k_set_coalesce(struct ieee80211_hw *hw,
+                             struct cfg80211_coalesce *coalesce)
+{
+       struct ath_softc *sc = hw->priv;
+       struct ath_hw *ah = sc->sc_ah;
+
+       if (!coalesce) {
+               ah->config.rx_intr_mitigation = false;
+               ath9k_hw_set_interrupts(ah);
+       } else {
+               ah->config.rx_intr_mitigation = true;
+               ath9k_hw_set_interrupts(ah);
+       }
+
+       return 0;
+}
+
 struct ieee80211_ops ath9k_ops = {
        .tx                 = ath9k_tx,
        .start              = ath9k_start,
@@ -2639,6 +2657,7 @@ struct ieee80211_ops ath9k_ops = {
        .get_stats          = ath9k_get_stats,
        .set_antenna        = ath9k_set_antenna,
        .get_antenna        = ath9k_get_antenna,
+       .set_coalesce       = ath9k_set_coalesce,
 
 #ifdef CONFIG_ATH9K_WOW
        .suspend            = ath9k_suspend,
-- 
2.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to