]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mac80211: notify the driver upon BAR Rx
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Mon, 20 Apr 2015 19:53:37 +0000 (22:53 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 24 Apr 2015 10:25:00 +0000 (12:25 +0200)
When we receive a BAR, this typically means that our peer
doesn't hear our Block-Acks or that we can't hear its
frames. Either way, it is a good indication that the link
is in a bad condition. This is why it can serve as a probe
to the driver.
Use the event_callback callback for this.
Since more events with the same data will be added in the
feature, the structure that describes the data attached to
the event is called in a generic name: ieee80211_ba_event.

This also means that from now on, the event_callback can't
sleep.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/mac80211.h
net/mac80211/rx.c

index 4feb74da5eaf059a1fc1843dfbe1d211f24e4826..0c3983b74b3ec29c03cae92053b769cde9c581a3 100644 (file)
@@ -337,10 +337,12 @@ enum ieee80211_bss_change {
  * enum ieee80211_event_type - event to be notified to the low level driver
  * @RSSI_EVENT: AP's rssi crossed the a threshold set by the driver.
  * @MLME_EVENT: event related to MLME
+ * @BAR_RX_EVENT: a BAR was received
  */
 enum ieee80211_event_type {
        RSSI_EVENT,
        MLME_EVENT,
+       BAR_RX_EVENT,
 };
 
 /**
@@ -399,18 +401,32 @@ struct ieee80211_mlme_event {
        u16 reason;
 };
 
+/**
+ * struct ieee80211_ba_event - data attached for BlockAck related events
+ * @sta: pointer to the &ieee80211_sta to which this event relates
+ * @tid: the tid
+ * @ssn: the starting sequence number
+ */
+struct ieee80211_ba_event {
+       struct ieee80211_sta *sta;
+       u16 tid;
+       u16 ssn;
+};
+
 /**
  * struct ieee80211_event - event to be sent to the driver
  * @type: The event itself. See &enum ieee80211_event_type.
  * @rssi: relevant if &type is %RSSI_EVENT
  * @mlme: relevant if &type is %AUTH_EVENT
- * @u:    union holding the above two fields
+ * @ba: relevant if &type is %BAR_RX_EVENT
+ * @u:union holding the fields above
  */
 struct ieee80211_event {
        enum ieee80211_event_type type;
        union {
                struct ieee80211_rssi_event rssi;
                struct ieee80211_mlme_event mlme;
+               struct ieee80211_ba_event ba;
        } u;
 };
 
@@ -3001,7 +3017,7 @@ enum ieee80211_reconfig_type {
  *     The callback can sleep.
  * @event_callback: Notify driver about any event in mac80211. See
  *     &enum ieee80211_event_type for the different types.
- *     The callback can sleep.
+ *     The callback must be atomic.
  *
  * @release_buffered_frames: Release buffered frames according to the given
  *     parameters. In the case where the driver buffers some frames for
index b69a071d76790c12036d3423a70e33f5bb9bcb5a..ac6bfa999416f9d94b21ef0c302e4cf9493e4c11 100644 (file)
@@ -2427,6 +2427,9 @@ ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx, struct sk_buff_head *frames)
                struct {
                        __le16 control, start_seq_num;
                } __packed bar_data;
+               struct ieee80211_event event = {
+                       .type = BAR_RX_EVENT,
+               };
 
                if (!rx->sta)
                        return RX_DROP_MONITOR;
@@ -2442,6 +2445,9 @@ ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx, struct sk_buff_head *frames)
                        return RX_DROP_MONITOR;
 
                start_seq_num = le16_to_cpu(bar_data.start_seq_num) >> 4;
+               event.u.ba.tid = tid;
+               event.u.ba.ssn = start_seq_num;
+               event.u.ba.sta = &rx->sta->sta;
 
                /* reset session timer */
                if (tid_agg_rx->timeout)
@@ -2454,6 +2460,8 @@ ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx, struct sk_buff_head *frames)
                                                 start_seq_num, frames);
                spin_unlock(&tid_agg_rx->reorder_lock);
 
+               drv_event_callback(rx->local, rx->sdata, &event);
+
                kfree_skb(skb);
                return RX_QUEUED;
        }