linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] iwlwifi: dvm: don't sleep in event_callback callback
@ 2015-04-20 19:53 Emmanuel Grumbach
  2015-04-20 19:53 ` [PATCH 2/3] mac80211: notify the driver upon BAR Rx Emmanuel Grumbach
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Emmanuel Grumbach @ 2015-04-20 19:53 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Emmanuel Grumbach

This will allow mac80211 to forbid sleeping from the
event_callback callback.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
Please apply this on mac80211-next.git since other mac80211 patches
depend on it.
---
 drivers/net/wireless/iwlwifi/dvm/mac80211.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/iwlwifi/dvm/mac80211.c
index 5707ba5..1e2c352 100644
--- a/drivers/net/wireless/iwlwifi/dvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/dvm/mac80211.c
@@ -1139,7 +1139,6 @@ static void iwlagn_mac_event_callback(struct ieee80211_hw *hw,
 		return;
 
 	IWL_DEBUG_MAC80211(priv, "enter\n");
-	mutex_lock(&priv->mutex);
 
 	if (priv->lib->bt_params &&
 	    priv->lib->bt_params->advanced_bt_coexist) {
@@ -1148,13 +1147,12 @@ static void iwlagn_mac_event_callback(struct ieee80211_hw *hw,
 		else if (event->u.rssi.data == RSSI_EVENT_HIGH)
 			priv->bt_enable_pspoll = false;
 
-		iwlagn_send_advance_bt_config(priv);
+		queue_work(priv->workqueue, &priv->bt_runtime_config);
 	} else {
 		IWL_DEBUG_MAC80211(priv, "Advanced BT coex disabled,"
 				"ignoring RSSI callback\n");
 	}
 
-	mutex_unlock(&priv->mutex);
 	IWL_DEBUG_MAC80211(priv, "leave\n");
 }
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] mac80211: notify the driver upon BAR Rx
  2015-04-20 19:53 [PATCH 1/3] iwlwifi: dvm: don't sleep in event_callback callback Emmanuel Grumbach
@ 2015-04-20 19:53 ` Emmanuel Grumbach
  2015-04-20 19:53 ` [PATCH 3/3] mac80211: notify the driver on reordering buffer timeout Emmanuel Grumbach
  2015-04-24 10:25 ` [PATCH 1/3] iwlwifi: dvm: don't sleep in event_callback callback Johannes Berg
  2 siblings, 0 replies; 4+ messages in thread
From: Emmanuel Grumbach @ 2015-04-20 19:53 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Emmanuel Grumbach

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>
---
 include/net/mac80211.h | 20 ++++++++++++++++++--
 net/mac80211/rx.c      |  8 ++++++++
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 38a5fd7..e682927 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -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,
 };
 
 /**
@@ -400,17 +402,31 @@ struct ieee80211_mlme_event {
 };
 
 /**
+ * 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;
 };
 
@@ -3002,7 +3018,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
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index bc59c8a..b01468f 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2443,6 +2443,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;
@@ -2458,6 +2461,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)
@@ -2470,6 +2476,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;
 	}
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] mac80211: notify the driver on reordering buffer timeout
  2015-04-20 19:53 [PATCH 1/3] iwlwifi: dvm: don't sleep in event_callback callback Emmanuel Grumbach
  2015-04-20 19:53 ` [PATCH 2/3] mac80211: notify the driver upon BAR Rx Emmanuel Grumbach
@ 2015-04-20 19:53 ` Emmanuel Grumbach
  2015-04-24 10:25 ` [PATCH 1/3] iwlwifi: dvm: don't sleep in event_callback callback Johannes Berg
  2 siblings, 0 replies; 4+ messages in thread
From: Emmanuel Grumbach @ 2015-04-20 19:53 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Emmanuel Grumbach

When frames time out in the reordering buffer, it is a
good indication that something went wrong and the driver
may want to know about that to take action or trigger
debug flows.
It is pointless to notify the driver about each frame that
is released. Notify each time the timer fires.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 include/net/mac80211.h | 8 ++++++--
 net/mac80211/rx.c      | 9 +++++++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index e682927..ac6c13c 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -338,11 +338,15 @@ enum ieee80211_bss_change {
  * @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
+ * @BA_FRAME_TIMEOUT: Frames were released from the reordering buffer because
+ *	they timed out. This won't be called for each frame released, but only
+ *	once each time the timeout triggers.
  */
 enum ieee80211_event_type {
 	RSSI_EVENT,
 	MLME_EVENT,
 	BAR_RX_EVENT,
+	BA_FRAME_TIMEOUT,
 };
 
 /**
@@ -405,7 +409,7 @@ struct ieee80211_mlme_event {
  * 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
+ * @ssn: the starting sequence number (for %BAR_RX_EVENT)
  */
 struct ieee80211_ba_event {
 	struct ieee80211_sta *sta;
@@ -418,7 +422,7 @@ struct ieee80211_ba_event {
  * @type: The event itself. See &enum ieee80211_event_type.
  * @rssi: relevant if &type is %RSSI_EVENT
  * @mlme: relevant if &type is %AUTH_EVENT
- * @ba: relevant if &type is %BAR_RX_EVENT
+ * @ba: relevant if &type is %BAR_RX_EVENT or %BA_FRAME_TIMEOUT
  * @u:union holding the fields above
  */
 struct ieee80211_event {
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index b01468f..6f19837 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -3252,6 +3252,15 @@ void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid)
 	ieee80211_sta_reorder_release(sta->sdata, tid_agg_rx, &frames);
 	spin_unlock(&tid_agg_rx->reorder_lock);
 
+	if (!skb_queue_empty(&frames)) {
+		struct ieee80211_event event = {
+			.type = BA_FRAME_TIMEOUT,
+			.u.ba.tid = tid,
+			.u.ba.sta = &sta->sta,
+		};
+		drv_event_callback(rx.local, rx.sdata, &event);
+	}
+
 	ieee80211_rx_handlers(&rx, &frames);
 }
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] iwlwifi: dvm: don't sleep in event_callback callback
  2015-04-20 19:53 [PATCH 1/3] iwlwifi: dvm: don't sleep in event_callback callback Emmanuel Grumbach
  2015-04-20 19:53 ` [PATCH 2/3] mac80211: notify the driver upon BAR Rx Emmanuel Grumbach
  2015-04-20 19:53 ` [PATCH 3/3] mac80211: notify the driver on reordering buffer timeout Emmanuel Grumbach
@ 2015-04-24 10:25 ` Johannes Berg
  2 siblings, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2015-04-24 10:25 UTC (permalink / raw)
  To: Emmanuel Grumbach; +Cc: linux-wireless

On Mon, 2015-04-20 at 22:53 +0300, Emmanuel Grumbach wrote:
> This will allow mac80211 to forbid sleeping from the
> event_callback callback.
> 
> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
> ---
> Please apply this on mac80211-next.git since other mac80211 patches
> depend on it.

Applied all 3.

johannes


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-04-24 10:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-20 19:53 [PATCH 1/3] iwlwifi: dvm: don't sleep in event_callback callback Emmanuel Grumbach
2015-04-20 19:53 ` [PATCH 2/3] mac80211: notify the driver upon BAR Rx Emmanuel Grumbach
2015-04-20 19:53 ` [PATCH 3/3] mac80211: notify the driver on reordering buffer timeout Emmanuel Grumbach
2015-04-24 10:25 ` [PATCH 1/3] iwlwifi: dvm: don't sleep in event_callback callback Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).