mac80211: Add new callback set_coverage_class
authorLukáš Turek <8an@praha12.net>
Mon, 21 Dec 2009 21:50:48 +0000 (22:50 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 12 Jan 2010 18:50:07 +0000 (13:50 -0500)
Mac80211 callback to driver set_coverage_class() sets slot time and ACK
timeout for given IEEE 802.11 coverage class. The callback is optional,
but it's essential for long distance links.

Signed-off-by: Lukas Turek <8an@praha12.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
include/net/mac80211.h
net/mac80211/cfg.c
net/mac80211/driver-ops.h
net/mac80211/driver-trace.h

index f073a2a5057461ecadf3b2349a44fec7c4e08941..ad4b70034e771a79578fc6bd24562fe6e7b3f823 100644 (file)
@@ -1533,6 +1533,10 @@ enum ieee80211_ampdu_mlme_action {
  *     and need to call wiphy_rfkill_set_hw_state() in the callback.
  *     The callback can sleep.
  *
+ * @set_coverage_class: Set slot time for given coverage class as specified
+ *     in IEEE 802.11-2007 section 17.3.8.6 and modify ACK timeout
+ *     accordingly. This callback is not required and may sleep.
+ *
  * @testmode_cmd: Implement a cfg80211 test mode command.
  *     The callback can sleep.
  *
@@ -1592,6 +1596,7 @@ struct ieee80211_ops {
                            struct ieee80211_sta *sta, u16 tid, u16 *ssn);
 
        void (*rfkill_poll)(struct ieee80211_hw *hw);
+       void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class);
 #ifdef CONFIG_NL80211_TESTMODE
        int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len);
 #endif
index 2e5e841e9b7bb17b3b123f4b3568490f1b417c21..976014c5e7425ce1446cd0718272005e801dd3f1 100644 (file)
@@ -1230,6 +1230,13 @@ static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
        struct ieee80211_local *local = wiphy_priv(wiphy);
        int err;
 
+       if (changed & WIPHY_PARAM_COVERAGE_CLASS) {
+               err = drv_set_coverage_class(local, wiphy->coverage_class);
+
+               if (err)
+                       return err;
+       }
+
        if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
                err = drv_set_rts_threshold(local, wiphy->rts_threshold);
 
index 8757ea73d54418ab6de216375d9002d4edff1227..de91d39e02762c496dc27a2c8e4bc8dd04884092 100644 (file)
@@ -214,6 +214,21 @@ static inline int drv_set_rts_threshold(struct ieee80211_local *local,
        return ret;
 }
 
+static inline int drv_set_coverage_class(struct ieee80211_local *local,
+                                        u8 value)
+{
+       int ret = 0;
+       might_sleep();
+
+       if (local->ops->set_coverage_class)
+               local->ops->set_coverage_class(&local->hw, value);
+       else
+               ret = -EOPNOTSUPP;
+
+       trace_drv_set_coverage_class(local, value, ret);
+       return ret;
+}
+
 static inline void drv_sta_notify(struct ieee80211_local *local,
                                  struct ieee80211_sub_if_data *sdata,
                                  enum sta_notify_cmd cmd,
index 977cc7528bc693fc525db3eae83812e2e5c5f44f..0ea258123b8e37b2ab3763d97f5f9e1b0d3fcc02 100644 (file)
@@ -491,6 +491,29 @@ TRACE_EVENT(drv_set_rts_threshold,
        )
 );
 
+TRACE_EVENT(drv_set_coverage_class,
+       TP_PROTO(struct ieee80211_local *local, u8 value, int ret),
+
+       TP_ARGS(local, value, ret),
+
+       TP_STRUCT__entry(
+               LOCAL_ENTRY
+               __field(u8, value)
+               __field(int, ret)
+       ),
+
+       TP_fast_assign(
+               LOCAL_ASSIGN;
+               __entry->ret = ret;
+               __entry->value = value;
+       ),
+
+       TP_printk(
+               LOCAL_PR_FMT " value:%d ret:%d",
+               LOCAL_PR_ARG, __entry->value, __entry->ret
+       )
+);
+
 TRACE_EVENT(drv_sta_notify,
        TP_PROTO(struct ieee80211_local *local,
                 struct ieee80211_sub_if_data *sdata,