Linux wireless drivers development
 help / color / mirror / Atom feed
* Re: [PATCH v2] ath9k_htc: Restore skb headroom when returning skb to mac80211
From: Helmut Schaa @ 2013-08-20 12:59 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: linux-wireless, Oleksij Rempel, ath9k-devel, Marc Kleine-Budde
In-Reply-To: <1376681980-27831-1-git-send-email-mkl@pengutronix.de>

On Fri, Aug 16, 2013 at 9:39 PM, Marc Kleine-Budde <mkl@pengutronix.de> wrote:
> Tested in ARMv5 with USB device
>   "ID 0cf3:7015 Atheros Communications, Inc. TP-Link TL-WN821N v3 802.11n [Atheros AR7010+AR9287]"
> for four weeks. Without that patch the kernel oopes after about one week.

Thanks for testing by the way!
Helmut

^ permalink raw reply

* Re: [PATCH v2] ath9k_htc: Restore skb headroom when returning skb to mac80211
From: Helmut Schaa @ 2013-08-20 12:57 UTC (permalink / raw)
  To: Marc Kleine-Budde, John Linville
  Cc: Marc Kleine-Budde, linux-wireless, Oleksij Rempel, ath9k-devel
In-Reply-To: <52133070.2050301@blackshift.org>

Hi John, Hi Marc,

On Tue, Aug 20, 2013 at 11:01 AM, Marc Kleine-Budde <mkl@blackshift.org> wrote:
> On 08/16/2013 09:39 PM, Marc Kleine-Budde wrote:
>> From: Helmut Schaa <helmut.schaa@googlemail.com>
>>
>> ath9k_htc adds padding between the 802.11 header and the payload during
>> TX by moving the header. When handing the frame back to mac80211 for TX
>> status handling the header is not moved back into its original position.
>> This can result in a too small skb headroom when entering ath9k_htc
>> again (due to a soft retransmission for example) causing an
>> skb_under_panic oops.
>>
>> Fix this by moving the 802.11 header back into its original position
>> before returning the frame to mac80211 as other drivers like rt2x00
>> or ath5k do.
>>
>> Reported-by: Marc Kleine-Budde <mkl@blackshift.org>
>> Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
>> Tested-by: Marc Kleine-Budde <mkl@blackshift.org>
>> Signed-off-by: Marc Kleine-Budde <mkl@blackshift.org>
>> ---
>> Hello Helmut,
>>
>> I've change the patch a bit, I've used ieee80211_get_hdrlen_from_skb() instead
>> of open coding it.
>>
>> Tested in ARMv5 with USB device
>>   "ID 0cf3:7015 Atheros Communications, Inc. TP-Link TL-WN821N v3 802.11n [Atheros AR7010+AR9287]"
>> for four weeks. Without that patch the kernel oopes after about one week.
>>
>> I think this is a candidate for stable, can you add stable to Cc?
>
> ping

Sorry, completely forgot about this patch. You're right, this is
indeed a stable candidate.

John, could you please add  "Cc: stable@vger.kernel.org" when applying
this to your tree?

Thanks,
Helmut

^ permalink raw reply

* [RFC 2/2] mac80211: implement SMPS for AP
From: Emmanuel Grumbach @ 2013-08-20 11:12 UTC (permalink / raw)
  To: linux-wireless; +Cc: Emmanuel Grumbach
In-Reply-To: <1376997139-6228-1-git-send-email-emmanuel.grumbach@intel.com>

When the driver requests to move to STATIC or DYNAMIC SMPS,
we send an action frame to each associated station and
reconfigure the channel context / driver.
Of course, non-MIMO stations are ignored.

The beacon isn't updated. The association response will
include the original capabilities. Stations that associate
while in non-OFF SMPS mode will get an action frame right
after association to inform them about our current state.
Note that we wait until the end of the EAPOL. Sending an
action frame before the EAPOL is finished can be an issue
for a few clients. Clients aren't likely to send EAPOL
frames in MIMO anyway.

When the SMPS configuration gets more permissive (e.g.
STATIC -> OFF), we don't wake up stations that are asleep
We remember that they don't know about the change and send
the action frame when they wake up.

When the SMPS configuration gets more restrictive (e.g.
OFF -> STATIC), we set the TIM bit for every sleeping STA.
uAPSD stations might send MIMO until they poll the action
frame, but this is for a short period of time.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 net/mac80211/cfg.c            |   91 +++++++++++++++++++++++++++++++++++++++++
 net/mac80211/debugfs_netdev.c |    1 +
 net/mac80211/ht.c             |    3 ++
 net/mac80211/ieee80211_i.h    |    3 ++
 net/mac80211/sta_info.c       |   56 +++++++++++++++++++++++++
 net/mac80211/sta_info.h       |    5 +++
 net/mac80211/status.c         |   15 ++++---
 net/mac80211/util.c           |   25 +++++++++++
 8 files changed, 194 insertions(+), 5 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index bd6b38c..0e00c83 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1553,6 +1553,19 @@ static int ieee80211_change_station(struct wiphy *wiphy,
 
 	mutex_unlock(&local->sta_mtx);
 
+	if (sdata->vif.type == NL80211_IFTYPE_AP &&
+	    sta->known_smps_mode != sta->sdata->smps_mode &&
+	    test_sta_flag(sta, WLAN_STA_AUTHORIZED) &&
+	    sta_info_tx_chains(sta) != 1) {
+		ht_dbg(sta->sdata,
+		       "%pM just authorized and MIMO capable - update SMPS\n",
+		       sta->sta.addr);
+		ieee80211_send_smps_action(sta->sdata,
+			sta->sdata->u.ap.req_smps,
+			sta->sta.addr,
+			sta->sdata->vif.bss_conf.bssid);
+	}
+
 	if (sdata->vif.type == NL80211_IFTYPE_STATION &&
 	    params->sta_flags_mask & BIT(NL80211_STA_FLAG_AUTHORIZED)) {
 		ieee80211_recalc_ps(local, -1);
@@ -2340,6 +2353,84 @@ static int ieee80211_testmode_dump(struct wiphy *wiphy,
 int __ieee80211_request_smps_ap(struct ieee80211_sub_if_data *sdata,
 				enum ieee80211_smps_mode smps_mode)
 {
+	struct sta_info *sta;
+	enum ieee80211_smps_mode old_req;
+	int i;
+
+	if (WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_AP))
+		return -EINVAL;
+
+	if (sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT)
+		return 0;
+
+	old_req = sdata->u.ap.req_smps;
+	sdata->u.ap.req_smps = smps_mode;
+
+	/* AUTOMATIC doesn't mean much for AP - don't allow it */
+	if (old_req == smps_mode ||
+	    smps_mode == IEEE80211_SMPS_AUTOMATIC)
+		return 0;
+
+	 /* If no associated stations, there's no need to do anything */
+	if (!atomic_read(&sdata->u.ap.num_mcast_sta)) {
+		sdata->smps_mode = smps_mode;
+		ieee80211_queue_work(&sdata->local->hw, &sdata->recalc_smps);
+		return 0;
+	}
+
+	ht_dbg(sdata,
+	       "SMSP %d requested in AP mode, sending Action frame to %d stations\n",
+	       smps_mode, atomic_read(&sdata->u.ap.num_mcast_sta));
+
+	mutex_lock(&sdata->local->sta_mtx);
+	for (i = 0; i < STA_HASH_SIZE; i++) {
+		for (sta = rcu_dereference_protected(sdata->local->sta_hash[i],
+				lockdep_is_held(&sdata->local->sta_mtx));
+		     sta;
+		     sta = rcu_dereference_protected(sta->hnext,
+				lockdep_is_held(&sdata->local->sta_mtx))) {
+			if (sta->sdata != sdata)
+				continue;
+
+			/* This station doesn't support MIMO - skip it */
+			if (sta_info_tx_chains(sta) == 1) {
+				ht_dbg(sdata,
+				       "Won't send SMPS to non-MIMO capable STA %pM\n",
+				       sta->sta.addr);
+				continue;
+			}
+
+			/*
+			 * Don't wake up a STA just to send the action frame
+			 * unless we are getting more restrictive.
+			 */
+			if (test_sta_flag(sta, WLAN_STA_PS_STA) &&
+			    !ieee80211_smps_is_restrictive(sta->known_smps_mode,
+							   smps_mode)) {
+				ht_dbg(sdata,
+				       "Won't send SMPS to sleeping STA %pM\n",
+				       sta->sta.addr);
+				continue;
+			}
+
+			/*
+			 * If the STA is not authorized, wait until it gets
+			 * authorized and the action frame will be sent then.
+			 */
+			if (!test_sta_flag(sta, WLAN_STA_AUTHORIZED))
+				continue;
+
+			ht_dbg(sdata, "Sending SMPS to %pM\n", sta->sta.addr);
+			ieee80211_send_smps_action(sdata, smps_mode,
+						   sta->sta.addr,
+						   sdata->vif.bss_conf.bssid);
+		}
+	}
+	mutex_unlock(&sdata->local->sta_mtx);
+
+	sdata->smps_mode = smps_mode;
+	ieee80211_queue_work(&sdata->local->hw, &sdata->recalc_smps);
+
 	return 0;
 }
 
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index 7609e47..4e9ec9e 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -569,6 +569,7 @@ static void add_sta_files(struct ieee80211_sub_if_data *sdata)
 static void add_ap_files(struct ieee80211_sub_if_data *sdata)
 {
 	DEBUGFS_ADD(num_mcast_sta);
+	DEBUGFS_ADD_MODE(smps, 0600);
 	DEBUGFS_ADD(num_sta_ps);
 	DEBUGFS_ADD(dtim_count);
 	DEBUGFS_ADD(num_buffered_multicast);
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c
index 2c85b96..9a8be8f 100644
--- a/net/mac80211/ht.c
+++ b/net/mac80211/ht.c
@@ -489,6 +489,9 @@ void ieee80211_request_smps(struct ieee80211_vif *vif,
 		ieee80211_queue_work(&sdata->local->hw,
 				     &sdata->u.mgd.request_smps_work);
 	} else {
+		/* AUTOMATIC is meaningless in AP mode */
+		if (WARN_ON_ONCE(smps_mode == IEEE80211_SMPS_AUTOMATIC))
+			return;
 		if (sdata->u.ap.driver_smps_mode == smps_mode)
 			return;
 		sdata->u.ap.driver_smps_mode = smps_mode;
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 7c68eac..85387cb 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1445,6 +1445,9 @@ int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata,
 			       const u8 *bssid);
 void ieee80211_request_smps_ap_work(struct work_struct *work);
 void ieee80211_request_smps_mgd_work(struct work_struct *work);
+bool ieee80211_smps_is_restrictive(enum ieee80211_smps_mode smps_mode_old,
+				   enum ieee80211_smps_mode smps_mode_new);
+
 
 void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
 				     u16 initiator, u16 reason, bool stop);
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 9c97237..74c88ba 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -385,6 +385,25 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
 		sta->last_seq_ctrl[i] = cpu_to_le16(USHRT_MAX);
 
 	sta->sta.smps_mode = IEEE80211_SMPS_OFF;
+	if (sdata->vif.type == NL80211_IFTYPE_AP) {
+		struct ieee80211_supported_band *sband =
+			local->hw.wiphy->bands[ieee80211_get_sdata_band(sdata)];
+		u8 smps = (sband->ht_cap.cap & IEEE80211_HT_CAP_SM_PS) >>
+				IEEE80211_HT_CAP_SM_PS_SHIFT;
+		switch (smps) {
+		case WLAN_HT_SMPS_CONTROL_DISABLED:
+			sta->known_smps_mode = IEEE80211_SMPS_OFF;
+			break;
+		case WLAN_HT_SMPS_CONTROL_STATIC:
+			sta->known_smps_mode = IEEE80211_SMPS_STATIC;
+			break;
+		case WLAN_HT_SMPS_CONTROL_DYNAMIC:
+			sta->known_smps_mode = IEEE80211_SMPS_DYNAMIC;
+			break;
+		default:
+			WARN_ON(1);
+		}
+	}
 
 	sta_dbg(sdata, "Allocated STA %pM\n", sta->sta.addr);
 
@@ -1069,6 +1088,19 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta)
 
 	ieee80211_add_pending_skbs_fn(local, &pending, clear_sta_ps_flags, sta);
 
+	/* This station just woke up and isn't aware of our SMPS state */
+	if (!ieee80211_smps_is_restrictive(sta->known_smps_mode,
+					   sdata->smps_mode) &&
+	    sta->known_smps_mode != sdata->smps_mode &&
+	    sta_info_tx_chains(sta) != 1) {
+		ht_dbg(sdata,
+		       "%pM just woke up and MIMO capable - update SMPS\n",
+		       sta->sta.addr);
+		ieee80211_send_smps_action(sdata, sdata->smps_mode,
+					   sta->sta.addr,
+					   sdata->vif.bss_conf.bssid);
+	}
+
 	local->total_ps_buffered -= buffered;
 
 	sta_info_recalc_tim(sta);
@@ -1520,3 +1552,27 @@ int sta_info_move_state(struct sta_info *sta,
 
 	return 0;
 }
+
+u8 sta_info_tx_chains(struct sta_info *sta)
+{
+	struct ieee80211_sta_ht_cap *ht_cap = &sta->sta.ht_cap;
+	u8 rx_chains;
+
+	if (!sta->sta.ht_cap.ht_supported)
+		return 1;
+
+	if (ht_cap->mcs.rx_mask[3])
+		rx_chains = 4;
+	else if (ht_cap->mcs.rx_mask[2])
+		rx_chains = 3;
+	else if (ht_cap->mcs.rx_mask[1])
+		rx_chains = 2;
+	else
+		rx_chains = 1;
+
+	if (!(ht_cap->mcs.tx_params & IEEE80211_HT_MCS_TX_RX_DIFF))
+		return rx_chains;
+
+	return ((ht_cap->mcs.tx_params & IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK)
+			>> IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT) + 1;
+}
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 9013969..240aef2 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -301,6 +301,8 @@ struct sta_ampdu_mlme {
  * @chains: chains ever used for RX from this station
  * @chain_signal_last: last signal (per chain)
  * @chain_signal_avg: signal average (per chain)
+ * @known_smps_mode: the smps_mode the client thinks we are in. Relevant for
+ *	AP only.
  */
 struct sta_info {
 	/* General information, mostly static */
@@ -411,6 +413,8 @@ struct sta_info {
 	unsigned int lost_packets;
 	unsigned int beacon_loss_count;
 
+	enum ieee80211_smps_mode known_smps_mode;
+
 	/* keep last! */
 	struct ieee80211_sta sta;
 };
@@ -613,6 +617,7 @@ void sta_set_rate_info_rx(struct sta_info *sta,
 			  struct rate_info *rinfo);
 void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata,
 			  unsigned long exp_time);
+u8 sta_info_tx_chains(struct sta_info *sta);
 
 void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta);
 void ieee80211_sta_ps_deliver_poll_response(struct sta_info *sta);
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index 368837f..7746cd0 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -191,8 +191,8 @@ static void ieee80211_frame_acked(struct sta_info *sta, struct sk_buff *skb)
 	if (ieee80211_is_action(mgmt->frame_control) &&
 	    mgmt->u.action.category == WLAN_CATEGORY_HT &&
 	    mgmt->u.action.u.ht_smps.action == WLAN_HT_ACTION_SMPS &&
-	    sdata->vif.type == NL80211_IFTYPE_STATION &&
 	    ieee80211_sdata_running(sdata)) {
+		enum ieee80211_smps_mode smps_mode;
 		/*
 		 * This update looks racy, but isn't -- if we come
 		 * here we've definitely got a station that we're
@@ -202,18 +202,23 @@ static void ieee80211_frame_acked(struct sta_info *sta, struct sk_buff *skb)
 		 */
 		switch (mgmt->u.action.u.ht_smps.smps_control) {
 		case WLAN_HT_SMPS_CONTROL_DYNAMIC:
-			sdata->smps_mode = IEEE80211_SMPS_DYNAMIC;
+			smps_mode = IEEE80211_SMPS_DYNAMIC;
 			break;
 		case WLAN_HT_SMPS_CONTROL_STATIC:
-			sdata->smps_mode = IEEE80211_SMPS_STATIC;
+			smps_mode = IEEE80211_SMPS_STATIC;
 			break;
 		case WLAN_HT_SMPS_CONTROL_DISABLED:
 		default: /* shouldn't happen since we don't send that */
-			sdata->smps_mode = IEEE80211_SMPS_OFF;
+			smps_mode = IEEE80211_SMPS_OFF;
 			break;
 		}
 
-		ieee80211_queue_work(&local->hw, &sdata->recalc_smps);
+		if (sdata->vif.type == NL80211_IFTYPE_STATION) {
+			sdata->smps_mode = smps_mode;
+			ieee80211_queue_work(&local->hw, &sdata->recalc_smps);
+		} else if (sdata->vif.type == NL80211_IFTYPE_AP) {
+			sta->known_smps_mode = smps_mode;
+		}
 	}
 }
 
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index d23c5a7..dad8262 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2295,3 +2295,28 @@ void ieee80211_radar_detected(struct ieee80211_hw *hw)
 	ieee80211_queue_work(hw, &local->radar_detected_work);
 }
 EXPORT_SYMBOL(ieee80211_radar_detected);
+
+/*
+ * Returns true if smps_mode_new is strictly more restrictive than
+ * smps_mode_old.
+ */
+bool ieee80211_smps_is_restrictive(enum ieee80211_smps_mode smps_mode_old,
+				   enum ieee80211_smps_mode smps_mode_new)
+{
+	if (WARN_ON_ONCE(smps_mode_old == IEEE80211_SMPS_AUTOMATIC ||
+			 smps_mode_new == IEEE80211_SMPS_AUTOMATIC))
+		return false;
+
+	switch (smps_mode_old) {
+	case IEEE80211_SMPS_STATIC:
+		return false;
+	case IEEE80211_SMPS_DYNAMIC:
+		return smps_mode_new == IEEE80211_SMPS_STATIC;
+	case IEEE80211_SMPS_OFF:
+		return smps_mode_new != IEEE80211_SMPS_OFF;
+	default:
+		WARN_ON(1);
+	}
+
+	return false;
+}
-- 
1.7.10.4


^ permalink raw reply related

* [RFC 1/2] mac80211: allow APs to send SMPS frames
From: Emmanuel Grumbach @ 2013-08-20 11:12 UTC (permalink / raw)
  To: linux-wireless; +Cc: Emmanuel Grumbach

SMPS code checks all over the place that the vif is
BSS. Remove that constraint and allow SMPS for AP too.

Provide dummy implementation that will be used for
further patches.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 net/mac80211/cfg.c            |   15 ++++++++++++---
 net/mac80211/debugfs_netdev.c |   24 +++++++++++++++---------
 net/mac80211/ht.c             |   38 ++++++++++++++++++++++++++++----------
 net/mac80211/ieee80211_i.h    |   13 ++++++++++---
 net/mac80211/iface.c          |    2 ++
 net/mac80211/mlme.c           |    2 +-
 6 files changed, 68 insertions(+), 26 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 4cc81c3..bd6b38c 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2337,8 +2337,14 @@ static int ieee80211_testmode_dump(struct wiphy *wiphy,
 }
 #endif
 
-int __ieee80211_request_smps(struct ieee80211_sub_if_data *sdata,
-			     enum ieee80211_smps_mode smps_mode)
+int __ieee80211_request_smps_ap(struct ieee80211_sub_if_data *sdata,
+				enum ieee80211_smps_mode smps_mode)
+{
+	return 0;
+}
+
+int __ieee80211_request_smps_mgd(struct ieee80211_sub_if_data *sdata,
+				 enum ieee80211_smps_mode smps_mode)
 {
 	const u8 *ap;
 	enum ieee80211_smps_mode old_req;
@@ -2346,6 +2352,9 @@ int __ieee80211_request_smps(struct ieee80211_sub_if_data *sdata,
 
 	lockdep_assert_held(&sdata->wdev.mtx);
 
+	if (WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION))
+		return -EINVAL;
+
 	old_req = sdata->u.mgd.req_smps;
 	sdata->u.mgd.req_smps = smps_mode;
 
@@ -2402,7 +2411,7 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
 
 	/* no change, but if automatic follow powersave */
 	sdata_lock(sdata);
-	__ieee80211_request_smps(sdata, sdata->u.mgd.req_smps);
+	__ieee80211_request_smps_mgd(sdata, sdata->u.mgd.req_smps);
 	sdata_unlock(sdata);
 
 	if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS)
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index e601c9f..7609e47 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -224,12 +224,15 @@ static int ieee80211_set_smps(struct ieee80211_sub_if_data *sdata,
 	     smps_mode == IEEE80211_SMPS_AUTOMATIC))
 		return -EINVAL;
 
-	/* supported only on managed interfaces for now */
-	if (sdata->vif.type != NL80211_IFTYPE_STATION)
+	if (sdata->vif.type != NL80211_IFTYPE_STATION &&
+	    sdata->vif.type != NL80211_IFTYPE_AP)
 		return -EOPNOTSUPP;
 
 	sdata_lock(sdata);
-	err = __ieee80211_request_smps(sdata, smps_mode);
+	if (sdata->vif.type == NL80211_IFTYPE_STATION)
+		err = __ieee80211_request_smps_mgd(sdata, smps_mode);
+	else
+		err = __ieee80211_request_smps_ap(sdata, smps_mode);
 	sdata_unlock(sdata);
 
 	return err;
@@ -245,12 +248,15 @@ static const char *smps_modes[IEEE80211_SMPS_NUM_MODES] = {
 static ssize_t ieee80211_if_fmt_smps(const struct ieee80211_sub_if_data *sdata,
 				     char *buf, int buflen)
 {
-	if (sdata->vif.type != NL80211_IFTYPE_STATION)
-		return -EOPNOTSUPP;
-
-	return snprintf(buf, buflen, "request: %s\nused: %s\n",
-			smps_modes[sdata->u.mgd.req_smps],
-			smps_modes[sdata->smps_mode]);
+	if (sdata->vif.type == NL80211_IFTYPE_STATION)
+		return snprintf(buf, buflen, "request: %s\nused: %s\n",
+				smps_modes[sdata->u.mgd.req_smps],
+				smps_modes[sdata->smps_mode]);
+	if (sdata->vif.type == NL80211_IFTYPE_AP)
+		return snprintf(buf, buflen, "request: %s\nused: %s\n",
+				smps_modes[sdata->u.ap.req_smps],
+				smps_modes[sdata->smps_mode]);
+	return -EINVAL;
 }
 
 static ssize_t ieee80211_if_parse_smps(struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c
index 529bf58..2c85b96 100644
--- a/net/mac80211/ht.c
+++ b/net/mac80211/ht.c
@@ -448,14 +448,25 @@ int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata,
 	return 0;
 }
 
-void ieee80211_request_smps_work(struct work_struct *work)
+void ieee80211_request_smps_mgd_work(struct work_struct *work)
 {
 	struct ieee80211_sub_if_data *sdata =
 		container_of(work, struct ieee80211_sub_if_data,
 			     u.mgd.request_smps_work);
 
 	sdata_lock(sdata);
-	__ieee80211_request_smps(sdata, sdata->u.mgd.driver_smps_mode);
+	__ieee80211_request_smps_mgd(sdata, sdata->u.mgd.driver_smps_mode);
+	sdata_unlock(sdata);
+}
+
+void ieee80211_request_smps_ap_work(struct work_struct *work)
+{
+	struct ieee80211_sub_if_data *sdata =
+		container_of(work, struct ieee80211_sub_if_data,
+			     u.ap.request_smps_work);
+
+	sdata_lock(sdata);
+	__ieee80211_request_smps_ap(sdata, sdata->u.ap.driver_smps_mode);
 	sdata_unlock(sdata);
 }
 
@@ -464,19 +475,26 @@ void ieee80211_request_smps(struct ieee80211_vif *vif,
 {
 	struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
 
-	if (WARN_ON(vif->type != NL80211_IFTYPE_STATION))
+	if (WARN_ON_ONCE(vif->type != NL80211_IFTYPE_STATION &&
+			 vif->type != NL80211_IFTYPE_AP))
 		return;
 
 	if (WARN_ON(smps_mode == IEEE80211_SMPS_OFF))
 		smps_mode = IEEE80211_SMPS_AUTOMATIC;
 
-	if (sdata->u.mgd.driver_smps_mode == smps_mode)
-		return;
-
-	sdata->u.mgd.driver_smps_mode = smps_mode;
-
-	ieee80211_queue_work(&sdata->local->hw,
-			     &sdata->u.mgd.request_smps_work);
+	if (vif->type == NL80211_IFTYPE_STATION) {
+		if (sdata->u.mgd.driver_smps_mode == smps_mode)
+			return;
+		sdata->u.mgd.driver_smps_mode = smps_mode;
+		ieee80211_queue_work(&sdata->local->hw,
+				     &sdata->u.mgd.request_smps_work);
+	} else {
+		if (sdata->u.ap.driver_smps_mode == smps_mode)
+			return;
+		sdata->u.ap.driver_smps_mode = smps_mode;
+		ieee80211_queue_work(&sdata->local->hw,
+				     &sdata->u.ap.request_smps_work);
+	}
 }
 /* this might change ... don't want non-open drivers using it */
 EXPORT_SYMBOL_GPL(ieee80211_request_smps);
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 47cf62e..7c68eac 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -265,6 +265,10 @@ struct ieee80211_if_ap {
 
 	struct ps_data ps;
 	atomic_t num_mcast_sta; /* number of stations receiving multicast */
+	enum ieee80211_smps_mode req_smps, /* requested smps mode */
+			 driver_smps_mode; /* smps mode request */
+
+	struct work_struct request_smps_work;
 };
 
 struct ieee80211_if_wds {
@@ -1439,7 +1443,8 @@ void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata,
 int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata,
 			       enum ieee80211_smps_mode smps, const u8 *da,
 			       const u8 *bssid);
-void ieee80211_request_smps_work(struct work_struct *work);
+void ieee80211_request_smps_ap_work(struct work_struct *work);
+void ieee80211_request_smps_mgd_work(struct work_struct *work);
 
 void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
 				     u16 initiator, u16 reason, bool stop);
@@ -1634,8 +1639,10 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
 u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata,
 			    struct ieee802_11_elems *elems,
 			    enum ieee80211_band band, u32 *basic_rates);
-int __ieee80211_request_smps(struct ieee80211_sub_if_data *sdata,
-			     enum ieee80211_smps_mode smps_mode);
+int __ieee80211_request_smps_mgd(struct ieee80211_sub_if_data *sdata,
+				 enum ieee80211_smps_mode smps_mode);
+int __ieee80211_request_smps_ap(struct ieee80211_sub_if_data *sdata,
+				enum ieee80211_smps_mode smps_mode);
 void ieee80211_recalc_smps(struct ieee80211_sub_if_data *sdata);
 
 size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index cc0c4be..913ef15 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1301,6 +1301,8 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
 	case NL80211_IFTYPE_AP:
 		skb_queue_head_init(&sdata->u.ap.ps.bc_buf);
 		INIT_LIST_HEAD(&sdata->u.ap.vlans);
+		INIT_WORK(&sdata->u.ap.request_smps_work,
+			  ieee80211_request_smps_ap_work);
 		sdata->vif.bss_conf.bssid = sdata->vif.addr;
 		break;
 	case NL80211_IFTYPE_P2P_CLIENT:
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 21bccd8..89e6f28 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -3693,7 +3693,7 @@ void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata)
 		  ieee80211_beacon_connection_loss_work);
 	INIT_WORK(&ifmgd->csa_connection_drop_work,
 		  ieee80211_csa_connection_drop_work);
-	INIT_WORK(&ifmgd->request_smps_work, ieee80211_request_smps_work);
+	INIT_WORK(&ifmgd->request_smps_work, ieee80211_request_smps_mgd_work);
 	setup_timer(&ifmgd->timer, ieee80211_sta_timer,
 		    (unsigned long) sdata);
 	setup_timer(&ifmgd->bcn_mon_timer, ieee80211_sta_bcn_mon_timer,
-- 
1.7.10.4


^ permalink raw reply related

* Re: [REGRESSION] 3.10.{6,7} crashes on network activity
From: Georgios Magklaras @ 2013-08-20 10:10 UTC (permalink / raw)
  To: Arend van Spriel
  Cc: Tom Gundersen, Felix Fietkau, Greg Kroah-Hartman, stable,
	Linux Wireless List, LKML, Johannes Berg
In-Reply-To: <52133DD9.8010902@broadcom.com>

I verify the same issue on a Latitude E6520 running both the
vanilla/clean and the Fedora 19 specific kernels. I thought it was the
NVIDIA/nouveau driver and I reproduce by switching to non graphical mode
and performing scp transfers.

GM


On Tue, 2013-08-20 at 11:58 +0200, Arend van Spriel wrote:
> On 08/20/2013 10:36 AM, Tom Gundersen wrote:
> > On Tue, Aug 20, 2013 at 4:15 PM, Arend van Spriel <arend@broadcom.com> wrote:
> >> On 08/20/2013 06:56 AM, Felix Fietkau wrote:
> >>>
> >>> On 2013-08-20 2:28 AM, Greg Kroah-Hartman wrote:
> >>>>
> >>>> On Tue, Aug 20, 2013 at 08:26:11AM +0800, Tom Gundersen wrote:
> >>>>>
> >>>>> On Tue, Aug 20, 2013 at 8:03 AM, Greg Kroah-Hartman
> >>>>> <gregkh@linuxfoundation.org> wrote:
> >>>>>>
> >>>>>> On Tue, Aug 20, 2013 at 07:59:47AM +0800, Tom Gundersen wrote:
> >>>>>>>
> >>>>>>> Hi guys,
> >>>>>>>
> >>>>>>> Starting with 3.10.6 (and still present in .7) I get an oops on
> >>>>>>> connecting to the network.
> >>>>>>>
> >>>>>>> The attached picture shows the oops. In case it does not reach the ML,
> >>>>>>> the top of the call trace reads:
> >>>>>>>
> >>>>>>> brcms_c_compute_rtscts_dur
> >>>>>>> brcms_c_ampdu_finalize
> >>>>>>> ampdu_finalize
> >>>>>>> dma_txfast
> >>>>>>> brcms_c_txfifo
> >>>>>>> brcms_c_sendpkt_mac80211
> >>>>>>> brcms_ops_tx
> >>>>>>> __ieee80211_tx
> >>>>>>>
> >>>>>>> I bisected the problem and the first bad commit is
> >>>>>>>
> >>>>>>> commit ef47a5e4f1aaf1d0e2e6875e34b2c9595897bef6
> >>>>>>> Author: Felix Fietkau <nbd@openwrt.org>
> >>>>>>> Date:   Fri Jun 28 21:04:35 2013 +0200
> >>>>>>>
> >>>>>>>       mac80211/minstrel_ht: fix cck rate sampling
> >>>>>>>
> >>>>>>>       commit 1cd158573951f737fbc878a35cb5eb47bf9af3d5 upstream.
> >>>>>>>
> >>>>>>> Reverting it on top of .7 fixes the problem.
> >>>>>>>
> >>>>>>> I had the same (I suppose) problem on mainline some time ago, but I
> >>>>>>> have not bisected it, verified that the problem still occurs there, or
> >>>>>>> checked if reverting the upstream patch fixes it. I'd be happy to do
> >>>>>>> that if it would help though.
> >>>>>>>
> >>>>>>> Let me know if you need any more information.
> >>>>>>
> >>>>>>
> >>>>>> Do you have this same problem with 3.11-rc6 as well?
> >>>>>
> >>>>>
> >>>>> Yes, I just confirmed. I also confirmed that reverting the mainline
> >>>>> commit on top of -rc6 fixes the problem.
> >>>>
> >>>>
> >>>> Great, thanks.
> >>>>
> >>>> Felix and Johannes, any chance we can get this reverted in Linus tree
> >>>> soon, and push that revert back to the 3.10 stable tree as well?
> >>>
> >>> I'd like to avoid a revert, since that will simply replace one set of
> >>> issues with another. Let's limit the use of the feature that brcmsmac
> >>> can't handle to drivers that are known to work with it. Tom, Please
> >>> test this patch to see if it fixes your issue.
> >>
> >>
> >> Hi Felix,
> >>
> >> I have been diving into root causing why brcmsmac can not handle cck
> >> fallback rates, because it should. Maybe it is better to flag no cck support
> >> and only change brcmsmac.
> >
> > Hi Arend,
> >
> > In case you cannot reproduce, let me know if I can help with testing patches.
> 
> So far I have not been able to reproduce it. I have a patch to avoid the 
> oops, but the transmit of the related frames will fail in the device so 
> it is not a real fix. I will let you you know.
> 
> Regards,
> Arend
> 
> > Cheers,
> >
> > Tom
> >
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



^ permalink raw reply

* Re: changing dev->needed_headroom/needed_tailroom?
From: Florian Fainelli @ 2013-08-20 10:00 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Eric Dumazet, Ben Hutchings, netdev, linux-wireless
In-Reply-To: <1375711240.8120.11.camel@jlt4.sipsolutions.net>

2013/8/5 Johannes Berg <johannes@sipsolutions.net>:
> On Fri, 2013-08-02 at 06:11 -0700, Eric Dumazet wrote:
>> On Fri, 2013-08-02 at 10:55 +0200, Ben Hutchings wrote:
>>
>> > I don't think this is safe when the interface is running (even if
>> > carrier is off).  Some functions may read dev->needed_headroom twice and
>> > rely on getting the same value each time.
>>
>> It should be no problem. Remaining unsafe places should be fixed.
>
> Most interesting would be stack devs, which I hadn't even considered. In
> any case, since I can't completely _rely_ on it, it's an optimisation,
> the only bugs would be around the double-access and then running
> over/under the SKB or so?

As far as I could test this with an Ethernet driver which adjusted its
needed_headroom by 64 bytes whenever some hardware feature was
enabled/disabled, this expectedly broke bridge and vlans at least.
Bridge code does not use the slave ports needed_headroom values, and
VLAN devices get the parent device needed_headroom only when creating
the vlan device. The good thing is since the needed_headroom space you
need is most likely fixed for a given configuration type, you should
see a pretty "stable" corruption of your SKB head.

>
>> We already had this discussion in the past, and some patches were
>> issued. Check commit ae641949df01b85117845bec45328eab6d6fada1
>> ("net: Remove all uses of LL_ALLOCATED_SPACE")
>
> That would have addressed some of that, I guess.
>
>
> I'm asking because some of the crypto stuff we do has fairly large
> head/tailroom requirements and it seems I may need to add more. But if
> you don't have crypto, it would be much smaller, so I figured we could
> switch it.

We could probably do it via a pair of new NETDEV_* notify event to
signal new needed_headroom/tailroom values to stacked devices. Would
that be acceptable?
-- 
Florian

^ permalink raw reply

* Re: [REGRESSION] 3.10.{6,7} crashes on network activity
From: Arend van Spriel @ 2013-08-20  9:58 UTC (permalink / raw)
  To: Tom Gundersen
  Cc: Felix Fietkau, Greg Kroah-Hartman, stable, Linux Wireless List,
	LKML, Johannes Berg
In-Reply-To: <CAG-2HqVo+Jn4QsmErCVcqgS6LcxvXESVWHHCp5BGapcv0A_+Ww@mail.gmail.com>

On 08/20/2013 10:36 AM, Tom Gundersen wrote:
> On Tue, Aug 20, 2013 at 4:15 PM, Arend van Spriel <arend@broadcom.com> wrote:
>> On 08/20/2013 06:56 AM, Felix Fietkau wrote:
>>>
>>> On 2013-08-20 2:28 AM, Greg Kroah-Hartman wrote:
>>>>
>>>> On Tue, Aug 20, 2013 at 08:26:11AM +0800, Tom Gundersen wrote:
>>>>>
>>>>> On Tue, Aug 20, 2013 at 8:03 AM, Greg Kroah-Hartman
>>>>> <gregkh@linuxfoundation.org> wrote:
>>>>>>
>>>>>> On Tue, Aug 20, 2013 at 07:59:47AM +0800, Tom Gundersen wrote:
>>>>>>>
>>>>>>> Hi guys,
>>>>>>>
>>>>>>> Starting with 3.10.6 (and still present in .7) I get an oops on
>>>>>>> connecting to the network.
>>>>>>>
>>>>>>> The attached picture shows the oops. In case it does not reach the ML,
>>>>>>> the top of the call trace reads:
>>>>>>>
>>>>>>> brcms_c_compute_rtscts_dur
>>>>>>> brcms_c_ampdu_finalize
>>>>>>> ampdu_finalize
>>>>>>> dma_txfast
>>>>>>> brcms_c_txfifo
>>>>>>> brcms_c_sendpkt_mac80211
>>>>>>> brcms_ops_tx
>>>>>>> __ieee80211_tx
>>>>>>>
>>>>>>> I bisected the problem and the first bad commit is
>>>>>>>
>>>>>>> commit ef47a5e4f1aaf1d0e2e6875e34b2c9595897bef6
>>>>>>> Author: Felix Fietkau <nbd@openwrt.org>
>>>>>>> Date:   Fri Jun 28 21:04:35 2013 +0200
>>>>>>>
>>>>>>>       mac80211/minstrel_ht: fix cck rate sampling
>>>>>>>
>>>>>>>       commit 1cd158573951f737fbc878a35cb5eb47bf9af3d5 upstream.
>>>>>>>
>>>>>>> Reverting it on top of .7 fixes the problem.
>>>>>>>
>>>>>>> I had the same (I suppose) problem on mainline some time ago, but I
>>>>>>> have not bisected it, verified that the problem still occurs there, or
>>>>>>> checked if reverting the upstream patch fixes it. I'd be happy to do
>>>>>>> that if it would help though.
>>>>>>>
>>>>>>> Let me know if you need any more information.
>>>>>>
>>>>>>
>>>>>> Do you have this same problem with 3.11-rc6 as well?
>>>>>
>>>>>
>>>>> Yes, I just confirmed. I also confirmed that reverting the mainline
>>>>> commit on top of -rc6 fixes the problem.
>>>>
>>>>
>>>> Great, thanks.
>>>>
>>>> Felix and Johannes, any chance we can get this reverted in Linus tree
>>>> soon, and push that revert back to the 3.10 stable tree as well?
>>>
>>> I'd like to avoid a revert, since that will simply replace one set of
>>> issues with another. Let's limit the use of the feature that brcmsmac
>>> can't handle to drivers that are known to work with it. Tom, Please
>>> test this patch to see if it fixes your issue.
>>
>>
>> Hi Felix,
>>
>> I have been diving into root causing why brcmsmac can not handle cck
>> fallback rates, because it should. Maybe it is better to flag no cck support
>> and only change brcmsmac.
>
> Hi Arend,
>
> In case you cannot reproduce, let me know if I can help with testing patches.

So far I have not been able to reproduce it. I have a patch to avoid the 
oops, but the transmit of the related frames will fail in the device so 
it is not a real fix. I will let you you know.

Regards,
Arend

> Cheers,
>
> Tom
>



^ permalink raw reply

* Re: [PATCH v2] ath9k_htc: Restore skb headroom when returning skb to mac80211
From: Marc Kleine-Budde @ 2013-08-20  9:01 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-wireless, linux, ath9k-devel, Helmut Schaa
In-Reply-To: <1376681980-27831-1-git-send-email-mkl@pengutronix.de>

[-- Attachment #1: Type: text/plain, Size: 1325 bytes --]

On 08/16/2013 09:39 PM, Marc Kleine-Budde wrote:
> From: Helmut Schaa <helmut.schaa@googlemail.com>
> 
> ath9k_htc adds padding between the 802.11 header and the payload during
> TX by moving the header. When handing the frame back to mac80211 for TX
> status handling the header is not moved back into its original position.
> This can result in a too small skb headroom when entering ath9k_htc
> again (due to a soft retransmission for example) causing an
> skb_under_panic oops.
> 
> Fix this by moving the 802.11 header back into its original position
> before returning the frame to mac80211 as other drivers like rt2x00
> or ath5k do.
> 
> Reported-by: Marc Kleine-Budde <mkl@blackshift.org>
> Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
> Tested-by: Marc Kleine-Budde <mkl@blackshift.org>
> Signed-off-by: Marc Kleine-Budde <mkl@blackshift.org>
> ---
> Hello Helmut,
> 
> I've change the patch a bit, I've used ieee80211_get_hdrlen_from_skb() instead
> of open coding it.
> 
> Tested in ARMv5 with USB device
>   "ID 0cf3:7015 Atheros Communications, Inc. TP-Link TL-WN821N v3 802.11n [Atheros AR7010+AR9287]"
> for four weeks. Without that patch the kernel oopes after about one week.
> 
> I think this is a candidate for stable, can you add stable to Cc?

ping

Marc


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 897 bytes --]

^ permalink raw reply

* Re: [REGRESSION] 3.10.{6,7} crashes on network activity
From: Tom Gundersen @ 2013-08-20  8:36 UTC (permalink / raw)
  To: Arend van Spriel
  Cc: Felix Fietkau, Greg Kroah-Hartman, stable, Linux Wireless List,
	LKML, Johannes Berg
In-Reply-To: <52132589.5000306@broadcom.com>

On Tue, Aug 20, 2013 at 4:15 PM, Arend van Spriel <arend@broadcom.com> wrote:
> On 08/20/2013 06:56 AM, Felix Fietkau wrote:
>>
>> On 2013-08-20 2:28 AM, Greg Kroah-Hartman wrote:
>>>
>>> On Tue, Aug 20, 2013 at 08:26:11AM +0800, Tom Gundersen wrote:
>>>>
>>>> On Tue, Aug 20, 2013 at 8:03 AM, Greg Kroah-Hartman
>>>> <gregkh@linuxfoundation.org> wrote:
>>>>>
>>>>> On Tue, Aug 20, 2013 at 07:59:47AM +0800, Tom Gundersen wrote:
>>>>>>
>>>>>> Hi guys,
>>>>>>
>>>>>> Starting with 3.10.6 (and still present in .7) I get an oops on
>>>>>> connecting to the network.
>>>>>>
>>>>>> The attached picture shows the oops. In case it does not reach the ML,
>>>>>> the top of the call trace reads:
>>>>>>
>>>>>> brcms_c_compute_rtscts_dur
>>>>>> brcms_c_ampdu_finalize
>>>>>> ampdu_finalize
>>>>>> dma_txfast
>>>>>> brcms_c_txfifo
>>>>>> brcms_c_sendpkt_mac80211
>>>>>> brcms_ops_tx
>>>>>> __ieee80211_tx
>>>>>>
>>>>>> I bisected the problem and the first bad commit is
>>>>>>
>>>>>> commit ef47a5e4f1aaf1d0e2e6875e34b2c9595897bef6
>>>>>> Author: Felix Fietkau <nbd@openwrt.org>
>>>>>> Date:   Fri Jun 28 21:04:35 2013 +0200
>>>>>>
>>>>>>      mac80211/minstrel_ht: fix cck rate sampling
>>>>>>
>>>>>>      commit 1cd158573951f737fbc878a35cb5eb47bf9af3d5 upstream.
>>>>>>
>>>>>> Reverting it on top of .7 fixes the problem.
>>>>>>
>>>>>> I had the same (I suppose) problem on mainline some time ago, but I
>>>>>> have not bisected it, verified that the problem still occurs there, or
>>>>>> checked if reverting the upstream patch fixes it. I'd be happy to do
>>>>>> that if it would help though.
>>>>>>
>>>>>> Let me know if you need any more information.
>>>>>
>>>>>
>>>>> Do you have this same problem with 3.11-rc6 as well?
>>>>
>>>>
>>>> Yes, I just confirmed. I also confirmed that reverting the mainline
>>>> commit on top of -rc6 fixes the problem.
>>>
>>>
>>> Great, thanks.
>>>
>>> Felix and Johannes, any chance we can get this reverted in Linus tree
>>> soon, and push that revert back to the 3.10 stable tree as well?
>>
>> I'd like to avoid a revert, since that will simply replace one set of
>> issues with another. Let's limit the use of the feature that brcmsmac
>> can't handle to drivers that are known to work with it. Tom, Please
>> test this patch to see if it fixes your issue.
>
>
> Hi Felix,
>
> I have been diving into root causing why brcmsmac can not handle cck
> fallback rates, because it should. Maybe it is better to flag no cck support
> and only change brcmsmac.

Hi Arend,

In case you cannot reproduce, let me know if I can help with testing patches.

Cheers,

Tom

^ permalink raw reply

* Re: [REGRESSION] 3.10.{6,7} crashes on network activity
From: Tom Gundersen @ 2013-08-20  8:34 UTC (permalink / raw)
  To: Felix Fietkau
  Cc: Greg Kroah-Hartman, stable, Linux Wireless List, LKML,
	Johannes Berg
In-Reply-To: <5212F6E8.3090107@openwrt.org>

On Tue, Aug 20, 2013 at 12:56 PM, Felix Fietkau <nbd@openwrt.org> wrote:
> On 2013-08-20 2:28 AM, Greg Kroah-Hartman wrote:
>> On Tue, Aug 20, 2013 at 08:26:11AM +0800, Tom Gundersen wrote:
>>> On Tue, Aug 20, 2013 at 8:03 AM, Greg Kroah-Hartman
>>> <gregkh@linuxfoundation.org> wrote:
>>> > On Tue, Aug 20, 2013 at 07:59:47AM +0800, Tom Gundersen wrote:
>>> >> Hi guys,
>>> >>
>>> >> Starting with 3.10.6 (and still present in .7) I get an oops on
>>> >> connecting to the network.
>>> >>
>>> >> The attached picture shows the oops. In case it does not reach the ML,
>>> >> the top of the call trace reads:
>>> >>
>>> >> brcms_c_compute_rtscts_dur
>>> >> brcms_c_ampdu_finalize
>>> >> ampdu_finalize
>>> >> dma_txfast
>>> >> brcms_c_txfifo
>>> >> brcms_c_sendpkt_mac80211
>>> >> brcms_ops_tx
>>> >> __ieee80211_tx
>>> >>
>>> >> I bisected the problem and the first bad commit is
>>> >>
>>> >> commit ef47a5e4f1aaf1d0e2e6875e34b2c9595897bef6
>>> >> Author: Felix Fietkau <nbd@openwrt.org>
>>> >> Date:   Fri Jun 28 21:04:35 2013 +0200
>>> >>
>>> >>     mac80211/minstrel_ht: fix cck rate sampling
>>> >>
>>> >>     commit 1cd158573951f737fbc878a35cb5eb47bf9af3d5 upstream.
>>> >>
>>> >> Reverting it on top of .7 fixes the problem.
>>> >>
>>> >> I had the same (I suppose) problem on mainline some time ago, but I
>>> >> have not bisected it, verified that the problem still occurs there, or
>>> >> checked if reverting the upstream patch fixes it. I'd be happy to do
>>> >> that if it would help though.
>>> >>
>>> >> Let me know if you need any more information.
>>> >
>>> > Do you have this same problem with 3.11-rc6 as well?
>>>
>>> Yes, I just confirmed. I also confirmed that reverting the mainline
>>> commit on top of -rc6 fixes the problem.
>>
>> Great, thanks.
>>
>> Felix and Johannes, any chance we can get this reverted in Linus tree
>> soon, and push that revert back to the 3.10 stable tree as well?
> I'd like to avoid a revert, since that will simply replace one set of
> issues with another. Let's limit the use of the feature that brcmsmac
> can't handle to drivers that are known to work with it. Tom, Please
> test this patch to see if it fixes your issue.

The patch (on top of -rc6) fixes it for me. Thanks.

-t

> ---
> --- a/include/net/mac80211.h
> +++ b/include/net/mac80211.h
> @@ -1501,6 +1501,7 @@ enum ieee80211_hw_flags {
>         IEEE80211_HW_SUPPORTS_RC_TABLE                  = 1<<24,
>         IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF              = 1<<25,
>         IEEE80211_HW_TIMING_BEACON_ONLY                 = 1<<26,
> +       IEEE80211_HW_SUPPORTS_HT_CCK_RATES              = 1<<27,
>  };
>
>  /**
> --- a/net/mac80211/rc80211_minstrel_ht.c
> +++ b/net/mac80211/rc80211_minstrel_ht.c
> @@ -828,6 +828,9 @@ minstrel_ht_update_cck(struct minstrel_p
>         if (sband->band != IEEE80211_BAND_2GHZ)
>                 return;
>
> +       if (!(mp->hw->flags & IEEE80211_HW_SUPPORTS_HT_CCK_RATES))
> +               return;
> +
>         mi->cck_supported = 0;
>         mi->cck_supported_short = 0;
>         for (i = 0; i < 4; i++) {
> --- a/drivers/net/wireless/ath/ath9k/init.c
> +++ b/drivers/net/wireless/ath/ath9k/init.c
> @@ -807,7 +807,8 @@ void ath9k_set_hw_capab(struct ath_softc
>                 IEEE80211_HW_PS_NULLFUNC_STACK |
>                 IEEE80211_HW_SPECTRUM_MGMT |
>                 IEEE80211_HW_REPORTS_TX_ACK_STATUS |
> -               IEEE80211_HW_SUPPORTS_RC_TABLE;
> +               IEEE80211_HW_SUPPORTS_RC_TABLE |
> +               IEEE80211_HW_SUPPORTS_HT_CCK_RATES;
>
>         if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
>                 hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
> --- a/drivers/net/wireless/ath/carl9170/main.c
> +++ b/drivers/net/wireless/ath/carl9170/main.c
> @@ -1878,7 +1878,8 @@ void *carl9170_alloc(size_t priv_size)
>                      IEEE80211_HW_PS_NULLFUNC_STACK |
>                      IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC |
>                      IEEE80211_HW_SUPPORTS_RC_TABLE |
> -                    IEEE80211_HW_SIGNAL_DBM;
> +                    IEEE80211_HW_SIGNAL_DBM |
> +                    IEEE80211_HW_SUPPORTS_HT_CCK_RATES;
>
>         if (!modparam_noht) {
>                 /*
> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
> @@ -6327,7 +6327,8 @@ static int rt2800_probe_hw_mode(struct r
>             IEEE80211_HW_SUPPORTS_PS |
>             IEEE80211_HW_PS_NULLFUNC_STACK |
>             IEEE80211_HW_AMPDU_AGGREGATION |
> -           IEEE80211_HW_REPORTS_TX_ACK_STATUS;
> +           IEEE80211_HW_REPORTS_TX_ACK_STATUS |
> +           IEEE80211_HW_SUPPORTS_HT_CCK_RATES;
>
>         /*
>          * Don't set IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING for USB devices
>

^ permalink raw reply

* Re: [REGRESSION] 3.10.{6,7} crashes on network activity
From: Arend van Spriel @ 2013-08-20  8:15 UTC (permalink / raw)
  To: Felix Fietkau
  Cc: Greg Kroah-Hartman, Tom Gundersen, stable, Linux Wireless List,
	LKML, Johannes Berg
In-Reply-To: <5212F6E8.3090107@openwrt.org>

On 08/20/2013 06:56 AM, Felix Fietkau wrote:
> On 2013-08-20 2:28 AM, Greg Kroah-Hartman wrote:
>> On Tue, Aug 20, 2013 at 08:26:11AM +0800, Tom Gundersen wrote:
>>> On Tue, Aug 20, 2013 at 8:03 AM, Greg Kroah-Hartman
>>> <gregkh@linuxfoundation.org> wrote:
>>>> On Tue, Aug 20, 2013 at 07:59:47AM +0800, Tom Gundersen wrote:
>>>>> Hi guys,
>>>>>
>>>>> Starting with 3.10.6 (and still present in .7) I get an oops on
>>>>> connecting to the network.
>>>>>
>>>>> The attached picture shows the oops. In case it does not reach the ML,
>>>>> the top of the call trace reads:
>>>>>
>>>>> brcms_c_compute_rtscts_dur
>>>>> brcms_c_ampdu_finalize
>>>>> ampdu_finalize
>>>>> dma_txfast
>>>>> brcms_c_txfifo
>>>>> brcms_c_sendpkt_mac80211
>>>>> brcms_ops_tx
>>>>> __ieee80211_tx
>>>>>
>>>>> I bisected the problem and the first bad commit is
>>>>>
>>>>> commit ef47a5e4f1aaf1d0e2e6875e34b2c9595897bef6
>>>>> Author: Felix Fietkau <nbd@openwrt.org>
>>>>> Date:   Fri Jun 28 21:04:35 2013 +0200
>>>>>
>>>>>      mac80211/minstrel_ht: fix cck rate sampling
>>>>>
>>>>>      commit 1cd158573951f737fbc878a35cb5eb47bf9af3d5 upstream.
>>>>>
>>>>> Reverting it on top of .7 fixes the problem.
>>>>>
>>>>> I had the same (I suppose) problem on mainline some time ago, but I
>>>>> have not bisected it, verified that the problem still occurs there, or
>>>>> checked if reverting the upstream patch fixes it. I'd be happy to do
>>>>> that if it would help though.
>>>>>
>>>>> Let me know if you need any more information.
>>>>
>>>> Do you have this same problem with 3.11-rc6 as well?
>>>
>>> Yes, I just confirmed. I also confirmed that reverting the mainline
>>> commit on top of -rc6 fixes the problem.
>>
>> Great, thanks.
>>
>> Felix and Johannes, any chance we can get this reverted in Linus tree
>> soon, and push that revert back to the 3.10 stable tree as well?
> I'd like to avoid a revert, since that will simply replace one set of
> issues with another. Let's limit the use of the feature that brcmsmac
> can't handle to drivers that are known to work with it. Tom, Please
> test this patch to see if it fixes your issue.

Hi Felix,

I have been diving into root causing why brcmsmac can not handle cck 
fallback rates, because it should. Maybe it is better to flag no cck 
support and only change brcmsmac.

Regards,
Arend

> - Felix
> ---
> --- a/include/net/mac80211.h
> +++ b/include/net/mac80211.h
> @@ -1501,6 +1501,7 @@ enum ieee80211_hw_flags {
>   	IEEE80211_HW_SUPPORTS_RC_TABLE			= 1<<24,
>   	IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF		= 1<<25,
>   	IEEE80211_HW_TIMING_BEACON_ONLY			= 1<<26,
> +	IEEE80211_HW_SUPPORTS_HT_CCK_RATES		= 1<<27,
>   };
>
>   /**
> --- a/net/mac80211/rc80211_minstrel_ht.c
> +++ b/net/mac80211/rc80211_minstrel_ht.c
> @@ -828,6 +828,9 @@ minstrel_ht_update_cck(struct minstrel_p
>   	if (sband->band != IEEE80211_BAND_2GHZ)
>   		return;
>
> +	if (!(mp->hw->flags & IEEE80211_HW_SUPPORTS_HT_CCK_RATES))
> +		return;
> +
>   	mi->cck_supported = 0;
>   	mi->cck_supported_short = 0;
>   	for (i = 0; i < 4; i++) {
> --- a/drivers/net/wireless/ath/ath9k/init.c
> +++ b/drivers/net/wireless/ath/ath9k/init.c
> @@ -807,7 +807,8 @@ void ath9k_set_hw_capab(struct ath_softc
>   		IEEE80211_HW_PS_NULLFUNC_STACK |
>   		IEEE80211_HW_SPECTRUM_MGMT |
>   		IEEE80211_HW_REPORTS_TX_ACK_STATUS |
> -		IEEE80211_HW_SUPPORTS_RC_TABLE;
> +		IEEE80211_HW_SUPPORTS_RC_TABLE |
> +		IEEE80211_HW_SUPPORTS_HT_CCK_RATES;
>
>   	if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
>   		hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
> --- a/drivers/net/wireless/ath/carl9170/main.c
> +++ b/drivers/net/wireless/ath/carl9170/main.c
> @@ -1878,7 +1878,8 @@ void *carl9170_alloc(size_t priv_size)
>   		     IEEE80211_HW_PS_NULLFUNC_STACK |
>   		     IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC |
>   		     IEEE80211_HW_SUPPORTS_RC_TABLE |
> -		     IEEE80211_HW_SIGNAL_DBM;
> +		     IEEE80211_HW_SIGNAL_DBM |
> +		     IEEE80211_HW_SUPPORTS_HT_CCK_RATES;
>
>   	if (!modparam_noht) {
>   		/*
> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
> @@ -6327,7 +6327,8 @@ static int rt2800_probe_hw_mode(struct r
>   	    IEEE80211_HW_SUPPORTS_PS |
>   	    IEEE80211_HW_PS_NULLFUNC_STACK |
>   	    IEEE80211_HW_AMPDU_AGGREGATION |
> -	    IEEE80211_HW_REPORTS_TX_ACK_STATUS;
> +	    IEEE80211_HW_REPORTS_TX_ACK_STATUS |
> +	    IEEE80211_HW_SUPPORTS_HT_CCK_RATES;
>
>   	/*
>   	 * Don't set IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING for USB devices
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>



^ permalink raw reply

* [PATCH] ath9k: Add one more PCI ID for CUS198
From: Sujith Manoharan @ 2013-08-20  7:35 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

From: Sujith Manoharan <c_manoha@qca.qualcomm.com>

This is a AR9485/WB225 based card.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath9k/pci.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index 76e8c35..3280798 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -59,6 +59,11 @@ static DEFINE_PCI_DEVICE_TABLE(ath_pci_id_table) = {
 			 PCI_VENDOR_ID_AZWAVE,
 			 0x2126),
 	  .driver_data = ATH9K_PCI_CUS198 | ATH9K_PCI_BT_ANT_DIV },
+	{ PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
+			 0x0032,
+			 PCI_VENDOR_ID_AZWAVE,
+			 0x126A),
+	  .driver_data = ATH9K_PCI_CUS198 | ATH9K_PCI_BT_ANT_DIV },
 
 	/* PCI-E CUS230 */
 	{ PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
-- 
1.8.3.4


^ permalink raw reply related

* wifi hw emulator
From: Mahesh Palivela @ 2013-08-20  6:39 UTC (permalink / raw)
  To: linux

Hi,

we are trying to test mac80211 stack dependant driver to tx/rx dot11
pkts on another interface driver like Ethernet. Is there a way to pass
pkts/skbs driver to driver?

Basically we don't have the real hw yet, so want to use another physical medium.

Thanks in advance for your help.

Best regards,
Mahesh

^ permalink raw reply

* Re: [REGRESSION] 3.10.{6,7} crashes on network activity
From: Felix Fietkau @ 2013-08-20  4:56 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Tom Gundersen
  Cc: stable, Linux Wireless List, LKML, Johannes Berg
In-Reply-To: <20130820002822.GA18023@kroah.com>

On 2013-08-20 2:28 AM, Greg Kroah-Hartman wrote:
> On Tue, Aug 20, 2013 at 08:26:11AM +0800, Tom Gundersen wrote:
>> On Tue, Aug 20, 2013 at 8:03 AM, Greg Kroah-Hartman
>> <gregkh@linuxfoundation.org> wrote:
>> > On Tue, Aug 20, 2013 at 07:59:47AM +0800, Tom Gundersen wrote:
>> >> Hi guys,
>> >>
>> >> Starting with 3.10.6 (and still present in .7) I get an oops on
>> >> connecting to the network.
>> >>
>> >> The attached picture shows the oops. In case it does not reach the ML,
>> >> the top of the call trace reads:
>> >>
>> >> brcms_c_compute_rtscts_dur
>> >> brcms_c_ampdu_finalize
>> >> ampdu_finalize
>> >> dma_txfast
>> >> brcms_c_txfifo
>> >> brcms_c_sendpkt_mac80211
>> >> brcms_ops_tx
>> >> __ieee80211_tx
>> >>
>> >> I bisected the problem and the first bad commit is
>> >>
>> >> commit ef47a5e4f1aaf1d0e2e6875e34b2c9595897bef6
>> >> Author: Felix Fietkau <nbd@openwrt.org>
>> >> Date:   Fri Jun 28 21:04:35 2013 +0200
>> >>
>> >>     mac80211/minstrel_ht: fix cck rate sampling
>> >>
>> >>     commit 1cd158573951f737fbc878a35cb5eb47bf9af3d5 upstream.
>> >>
>> >> Reverting it on top of .7 fixes the problem.
>> >>
>> >> I had the same (I suppose) problem on mainline some time ago, but I
>> >> have not bisected it, verified that the problem still occurs there, or
>> >> checked if reverting the upstream patch fixes it. I'd be happy to do
>> >> that if it would help though.
>> >>
>> >> Let me know if you need any more information.
>> >
>> > Do you have this same problem with 3.11-rc6 as well?
>> 
>> Yes, I just confirmed. I also confirmed that reverting the mainline
>> commit on top of -rc6 fixes the problem.
> 
> Great, thanks.
> 
> Felix and Johannes, any chance we can get this reverted in Linus tree
> soon, and push that revert back to the 3.10 stable tree as well?
I'd like to avoid a revert, since that will simply replace one set of
issues with another. Let's limit the use of the feature that brcmsmac
can't handle to drivers that are known to work with it. Tom, Please
test this patch to see if it fixes your issue.

- Felix
---
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1501,6 +1501,7 @@ enum ieee80211_hw_flags {
 	IEEE80211_HW_SUPPORTS_RC_TABLE			= 1<<24,
 	IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF		= 1<<25,
 	IEEE80211_HW_TIMING_BEACON_ONLY			= 1<<26,
+	IEEE80211_HW_SUPPORTS_HT_CCK_RATES		= 1<<27,
 };
 
 /**
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -828,6 +828,9 @@ minstrel_ht_update_cck(struct minstrel_p
 	if (sband->band != IEEE80211_BAND_2GHZ)
 		return;
 
+	if (!(mp->hw->flags & IEEE80211_HW_SUPPORTS_HT_CCK_RATES))
+		return;
+
 	mi->cck_supported = 0;
 	mi->cck_supported_short = 0;
 	for (i = 0; i < 4; i++) {
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -807,7 +807,8 @@ void ath9k_set_hw_capab(struct ath_softc
 		IEEE80211_HW_PS_NULLFUNC_STACK |
 		IEEE80211_HW_SPECTRUM_MGMT |
 		IEEE80211_HW_REPORTS_TX_ACK_STATUS |
-		IEEE80211_HW_SUPPORTS_RC_TABLE;
+		IEEE80211_HW_SUPPORTS_RC_TABLE |
+		IEEE80211_HW_SUPPORTS_HT_CCK_RATES;
 
 	if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
 		hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
--- a/drivers/net/wireless/ath/carl9170/main.c
+++ b/drivers/net/wireless/ath/carl9170/main.c
@@ -1878,7 +1878,8 @@ void *carl9170_alloc(size_t priv_size)
 		     IEEE80211_HW_PS_NULLFUNC_STACK |
 		     IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC |
 		     IEEE80211_HW_SUPPORTS_RC_TABLE |
-		     IEEE80211_HW_SIGNAL_DBM;
+		     IEEE80211_HW_SIGNAL_DBM |
+		     IEEE80211_HW_SUPPORTS_HT_CCK_RATES;
 
 	if (!modparam_noht) {
 		/*
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -6327,7 +6327,8 @@ static int rt2800_probe_hw_mode(struct r
 	    IEEE80211_HW_SUPPORTS_PS |
 	    IEEE80211_HW_PS_NULLFUNC_STACK |
 	    IEEE80211_HW_AMPDU_AGGREGATION |
-	    IEEE80211_HW_REPORTS_TX_ACK_STATUS;
+	    IEEE80211_HW_REPORTS_TX_ACK_STATUS |
+	    IEEE80211_HW_SUPPORTS_HT_CCK_RATES;
 
 	/*
 	 * Don't set IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING for USB devices


^ permalink raw reply

* Re: WiFi roaming question
From: Christian Gagneraud @ 2013-08-20  4:40 UTC (permalink / raw)
  To: Krishna Chaitanya; +Cc: chris, linux-wireless
In-Reply-To: <CABPxzYK_q9VXcXnGLb=8aFzD1ZJdLStyhBz-LRpvwg4oVaBTDw@mail.gmail.com>

On 19/08/13 20:26, Krishna Chaitanya wrote:
>> It turned out that, as a client, I don't have to bother with roaming stuff, it simply works out of the box.
>
> Roaming has 2 types:
>
> 1) based on the disconnection (beacon loss)
> 2) based on the RSSI
>
> Is it really roaming doing background scanning and preauth #2 (or) a
> connect and disconnect (assuming same ssid and security) #1?
>
>> Though, I have a couple of questions regarding this OOBX (new buzz word seen here and there for "out of the box experience" :) ).
>> - At which level the roaming is done? Is it at the WiFi kernel stack (cfg/mac 80211), at driver level, or at chipset/firmware level or a mix of them?
>> - Can I change my setup, so that I have control over the roaming?
>> - Is it a good idea to try to manage that myself from userspace?
>
> wpa_supplicant (userspace) takes care of the roaming for you, i belive
> it has support for both types #1 and #2 (along with background scan)
>
> Some proprietary version which implement at driver/fw level, this
> reduces the roam delay as it need not involve any context switches.
>

Thanks Krishna for your answer.

Regards,
Chris

^ permalink raw reply

* [PATCH] ath9k: Enable PLL fix only for AR9340/AR9330
From: Sujith Manoharan @ 2013-08-20  4:35 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, stable

From: Sujith Manoharan <c_manoha@qca.qualcomm.com>

The PLL hang workaround is required only for AR9330 and
AR9340. This issue was first observed on an AP121 and the WAR
is enabled for AR9340 also (DB120 etc.), since it uses a PLL
design identical to AR9330. This is not required for AR9485 and AR9550.

Various bugs have been reported regarding this:

https://bugzilla.redhat.com/show_bug.cgi?id=997217
https://bugzilla.redhat.com/show_bug.cgi?id=994648

Cc: stable@vger.kernel.org
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath9k/main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index ac9f18f..e4f6590 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -173,8 +173,7 @@ static void ath_restart_work(struct ath_softc *sc)
 {
 	ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0);
 
-	if (AR_SREV_9340(sc->sc_ah) || AR_SREV_9485(sc->sc_ah) ||
-	    AR_SREV_9550(sc->sc_ah))
+	if (AR_SREV_9340(sc->sc_ah) || AR_SREV_9330(sc->sc_ah))
 		ieee80211_queue_delayed_work(sc->hw, &sc->hw_pll_work,
 				     msecs_to_jiffies(ATH_PLL_WORK_INTERVAL));
 
-- 
1.8.3.4


^ permalink raw reply related

* Re: [REGRESSION] 3.10.{6,7} crashes on network activity
From: Greg Kroah-Hartman @ 2013-08-20  0:28 UTC (permalink / raw)
  To: Tom Gundersen
  Cc: stable, Linux Wireless List, LKML, Felix Fietkau, Johannes Berg
In-Reply-To: <CAG-2HqUkxvtJNGx0UbZVfaBNvSY-OU+=anSSnroS3AfSR9H0SA@mail.gmail.com>

On Tue, Aug 20, 2013 at 08:26:11AM +0800, Tom Gundersen wrote:
> On Tue, Aug 20, 2013 at 8:03 AM, Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> > On Tue, Aug 20, 2013 at 07:59:47AM +0800, Tom Gundersen wrote:
> >> Hi guys,
> >>
> >> Starting with 3.10.6 (and still present in .7) I get an oops on
> >> connecting to the network.
> >>
> >> The attached picture shows the oops. In case it does not reach the ML,
> >> the top of the call trace reads:
> >>
> >> brcms_c_compute_rtscts_dur
> >> brcms_c_ampdu_finalize
> >> ampdu_finalize
> >> dma_txfast
> >> brcms_c_txfifo
> >> brcms_c_sendpkt_mac80211
> >> brcms_ops_tx
> >> __ieee80211_tx
> >>
> >> I bisected the problem and the first bad commit is
> >>
> >> commit ef47a5e4f1aaf1d0e2e6875e34b2c9595897bef6
> >> Author: Felix Fietkau <nbd@openwrt.org>
> >> Date:   Fri Jun 28 21:04:35 2013 +0200
> >>
> >>     mac80211/minstrel_ht: fix cck rate sampling
> >>
> >>     commit 1cd158573951f737fbc878a35cb5eb47bf9af3d5 upstream.
> >>
> >> Reverting it on top of .7 fixes the problem.
> >>
> >> I had the same (I suppose) problem on mainline some time ago, but I
> >> have not bisected it, verified that the problem still occurs there, or
> >> checked if reverting the upstream patch fixes it. I'd be happy to do
> >> that if it would help though.
> >>
> >> Let me know if you need any more information.
> >
> > Do you have this same problem with 3.11-rc6 as well?
> 
> Yes, I just confirmed. I also confirmed that reverting the mainline
> commit on top of -rc6 fixes the problem.

Great, thanks.

Felix and Johannes, any chance we can get this reverted in Linus tree
soon, and push that revert back to the 3.10 stable tree as well?

thanks,

greg k-h

^ permalink raw reply

* Re: [REGRESSION] 3.10.{6,7} crashes on network activity
From: Tom Gundersen @ 2013-08-20  0:26 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: stable, Linux Wireless List, LKML, Felix Fietkau, Johannes Berg
In-Reply-To: <20130820000336.GA15548@kroah.com>

On Tue, Aug 20, 2013 at 8:03 AM, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> On Tue, Aug 20, 2013 at 07:59:47AM +0800, Tom Gundersen wrote:
>> Hi guys,
>>
>> Starting with 3.10.6 (and still present in .7) I get an oops on
>> connecting to the network.
>>
>> The attached picture shows the oops. In case it does not reach the ML,
>> the top of the call trace reads:
>>
>> brcms_c_compute_rtscts_dur
>> brcms_c_ampdu_finalize
>> ampdu_finalize
>> dma_txfast
>> brcms_c_txfifo
>> brcms_c_sendpkt_mac80211
>> brcms_ops_tx
>> __ieee80211_tx
>>
>> I bisected the problem and the first bad commit is
>>
>> commit ef47a5e4f1aaf1d0e2e6875e34b2c9595897bef6
>> Author: Felix Fietkau <nbd@openwrt.org>
>> Date:   Fri Jun 28 21:04:35 2013 +0200
>>
>>     mac80211/minstrel_ht: fix cck rate sampling
>>
>>     commit 1cd158573951f737fbc878a35cb5eb47bf9af3d5 upstream.
>>
>> Reverting it on top of .7 fixes the problem.
>>
>> I had the same (I suppose) problem on mainline some time ago, but I
>> have not bisected it, verified that the problem still occurs there, or
>> checked if reverting the upstream patch fixes it. I'd be happy to do
>> that if it would help though.
>>
>> Let me know if you need any more information.
>
> Do you have this same problem with 3.11-rc6 as well?

Yes, I just confirmed. I also confirmed that reverting the mainline
commit on top of -rc6 fixes the problem.

Cheers,

Tom

^ permalink raw reply

* Re: [REGRESSION] 3.10.{6,7} crashes on network activity
From: Greg Kroah-Hartman @ 2013-08-20  0:03 UTC (permalink / raw)
  To: Tom Gundersen
  Cc: stable, Linux Wireless List, LKML, Felix Fietkau, Johannes Berg
In-Reply-To: <CAG-2HqUXQeq=30EpGWmn6tkC=CP1W+=UZCVPTYhhE0WyU_C4nw@mail.gmail.com>

On Tue, Aug 20, 2013 at 07:59:47AM +0800, Tom Gundersen wrote:
> Hi guys,
> 
> Starting with 3.10.6 (and still present in .7) I get an oops on
> connecting to the network.
> 
> The attached picture shows the oops. In case it does not reach the ML,
> the top of the call trace reads:
> 
> brcms_c_compute_rtscts_dur
> brcms_c_ampdu_finalize
> ampdu_finalize
> dma_txfast
> brcms_c_txfifo
> brcms_c_sendpkt_mac80211
> brcms_ops_tx
> __ieee80211_tx
> 
> I bisected the problem and the first bad commit is
> 
> commit ef47a5e4f1aaf1d0e2e6875e34b2c9595897bef6
> Author: Felix Fietkau <nbd@openwrt.org>
> Date:   Fri Jun 28 21:04:35 2013 +0200
> 
>     mac80211/minstrel_ht: fix cck rate sampling
> 
>     commit 1cd158573951f737fbc878a35cb5eb47bf9af3d5 upstream.
> 
> Reverting it on top of .7 fixes the problem.
> 
> I had the same (I suppose) problem on mainline some time ago, but I
> have not bisected it, verified that the problem still occurs there, or
> checked if reverting the upstream patch fixes it. I'd be happy to do
> that if it would help though.
> 
> Let me know if you need any more information.

Do you have this same problem with 3.11-rc6 as well?

thanks,

greg k-h

^ permalink raw reply

* [PATCH] mwifiex: do not create AP and P2P interfaces upon driver loading
From: Bing Zhao @ 2013-08-19 23:10 UTC (permalink / raw)
  To: linux-wireless
  Cc: John W. Linville, Avinash Patil, Amitkumar Karwar,
	Nishant Sarmukadam, Frank Huang, Bing Zhao

Bug 60747 - 1286:2044 [Microsoft Surface Pro]
    Marvell 88W8797 wifi show 3 interface under network
https://bugzilla.kernel.org/show_bug.cgi?id=60747

This issue was also reported previously by OLPC and some folks from
the community.

There are 3 network interfaces with different types being created
when mwifiex driver is loaded:

1. mlan0 (infra. STA)
2. uap0 (AP)
3. p2p0 (P2P_CLIENT)

The Network Manager attempts to use all 3 interfaces above without
filtering the managed interface type. As the result, 3 identical
interfaces are displayed under network manager. If user happens to
click on an entry under which its interface is uap0 or p2p0, the
association will fail.

Work around it by removing the creation of AP and P2P interfaces
at driver loading time. These interfaces can be added with 'iw' or
other applications manually when they are needed.

Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Avinash Patil <patila@marvell.com>
---
 drivers/net/wireless/mwifiex/main.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c
index 3402bff..fd77833 100644
--- a/drivers/net/wireless/mwifiex/main.c
+++ b/drivers/net/wireless/mwifiex/main.c
@@ -477,20 +477,6 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context)
 		dev_err(adapter->dev, "cannot create default STA interface\n");
 		goto err_add_intf;
 	}
-
-	/* Create AP interface by default */
-	if (!mwifiex_add_virtual_intf(adapter->wiphy, "uap%d",
-				      NL80211_IFTYPE_AP, NULL, NULL)) {
-		dev_err(adapter->dev, "cannot create default AP interface\n");
-		goto err_add_intf;
-	}
-
-	/* Create P2P interface by default */
-	if (!mwifiex_add_virtual_intf(adapter->wiphy, "p2p%d",
-				      NL80211_IFTYPE_P2P_CLIENT, NULL, NULL)) {
-		dev_err(adapter->dev, "cannot create default P2P interface\n");
-		goto err_add_intf;
-	}
 	rtnl_unlock();
 
 	mwifiex_drv_get_driver_version(adapter, fmt, sizeof(fmt) - 1);
-- 
1.8.2.3


^ permalink raw reply related

* Atheros 9280/AR9227 driver for kernel 2.6.21.7
From: Yuri Pin @ 2013-08-19 22:26 UTC (permalink / raw)
  To: linux-wireless@vger.kernel.org

Hello,
I have huawei wireless ONT modem with Atheros 9280 madwifi+carrier driver (found this in binnaries) and kernel 2.6.21.7. I can’t make it to connect to wireless networks as client. I guess that is because it doesn’t have wlan_scan_sta.ko kernel module (sta mode is available for wlanconfig but iwlist can scan only in ap mode). I tried also adhoc networking without success. There is no way I can compile wlan_scan_sta.ko module myself because it is necessary madwifi  with carrier SDK. I tried to compile compat-wireless-2.6.35-1 with enable-older-kernels patch but failed because a lot of symbols are missing in 2.6.21.7 (Huawei posted kernel sources, for example, there is no “ieee80211_ptr” symbol there).
1. Is there workaround to make Atheros working as wireless client without proper driver? Is there software that can do this (smth similar to aircrack?)
2. Any tips how compile driver for 2.6.21.7 kernel?
Thank you.

^ permalink raw reply

* [PATCH v3] Bluetooth: btmrvl: add calibration data download support
From: Bing Zhao @ 2013-08-19 22:10 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: Marcel Holtmann, Gustavo Padovan, Johan Hedberg, linux-wireless,
	Bing Zhao, Amitkumar Karwar

From: Amitkumar Karwar <akarwar@marvell.com>

A text file containing calibration data in hex format can
be provided at following path:

/lib/firmware/mrvl/sd8797_caldata.conf

The data will be downloaded to firmware during initialization.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
---
v2: Remove module parameter. The calibration data will be downloaded
    only when the device speicific data file is provided.
    (Marcel Holtmann)
v3: Fix crash (misaligned memory access) on ARM

 drivers/bluetooth/btmrvl_drv.h  |  10 ++-
 drivers/bluetooth/btmrvl_main.c | 140 +++++++++++++++++++++++++++++++++++++++-
 drivers/bluetooth/btmrvl_sdio.c |   9 ++-
 drivers/bluetooth/btmrvl_sdio.h |   2 +
 4 files changed, 157 insertions(+), 4 deletions(-)

diff --git a/drivers/bluetooth/btmrvl_drv.h b/drivers/bluetooth/btmrvl_drv.h
index 27068d1..5ef5e84 100644
--- a/drivers/bluetooth/btmrvl_drv.h
+++ b/drivers/bluetooth/btmrvl_drv.h
@@ -23,6 +23,8 @@
 #include <linux/bitops.h>
 #include <linux/slab.h>
 #include <net/bluetooth/bluetooth.h>
+#include <linux/ctype.h>
+#include <linux/firmware.h>
 
 #define BTM_HEADER_LEN			4
 #define BTM_UPLD_SIZE			2312
@@ -41,6 +43,8 @@ struct btmrvl_thread {
 struct btmrvl_device {
 	void *card;
 	struct hci_dev *hcidev;
+	struct device *dev;
+	const char *cal_data;
 
 	u8 dev_type;
 
@@ -91,6 +95,7 @@ struct btmrvl_private {
 #define BT_CMD_HOST_SLEEP_CONFIG	0x59
 #define BT_CMD_HOST_SLEEP_ENABLE	0x5A
 #define BT_CMD_MODULE_CFG_REQ		0x5B
+#define BT_CMD_LOAD_CONFIG_DATA		0x61
 
 /* Sub-commands: Module Bringup/Shutdown Request/Response */
 #define MODULE_BRINGUP_REQ		0xF1
@@ -116,10 +121,13 @@ struct btmrvl_private {
 #define PS_SLEEP			0x01
 #define PS_AWAKE			0x00
 
+#define BT_CMD_DATA_SIZE		32
+#define BT_CAL_DATA_SIZE		28
+
 struct btmrvl_cmd {
 	__le16 ocf_ogf;
 	u8 length;
-	u8 data[4];
+	u8 data[BT_CMD_DATA_SIZE];
 } __packed;
 
 struct btmrvl_event {
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c
index 9a9f518..77e940e 100644
--- a/drivers/bluetooth/btmrvl_main.c
+++ b/drivers/bluetooth/btmrvl_main.c
@@ -57,8 +57,9 @@ bool btmrvl_check_evtpkt(struct btmrvl_private *priv, struct sk_buff *skb)
 		ocf = hci_opcode_ocf(opcode);
 		ogf = hci_opcode_ogf(opcode);
 
-		if (ocf == BT_CMD_MODULE_CFG_REQ &&
-					priv->btmrvl_dev.sendcmdflag) {
+		if ((ocf == BT_CMD_MODULE_CFG_REQ ||
+		     ocf == BT_CMD_LOAD_CONFIG_DATA) &&
+		    priv->btmrvl_dev.sendcmdflag) {
 			priv->btmrvl_dev.sendcmdflag = false;
 			priv->adapter->cmd_complete = true;
 			wake_up_interruptible(&priv->adapter->cmd_wait_q);
@@ -552,6 +553,132 @@ static int btmrvl_service_main_thread(void *data)
 	return 0;
 }
 
+static int btmrvl_parse_cal_cfg(const u8 *src, u32 len, u8 *dst, u32 dst_size)
+{
+	const u8 *s = src;
+	u8 *d = dst;
+	int ret;
+	u8 tmp[3];
+
+	while ((s - src) < len) {
+		if (*s && (isspace(*s) || *s == '\t')) {
+			s++;
+			continue;
+		}
+
+		if (isxdigit(*s)) {
+			if ((d - dst) >= dst_size) {
+				BT_ERR("calibration data file too big!!!");
+				return -EINVAL;
+			}
+
+			memcpy(tmp, s, 2);
+			tmp[2] = '\0';
+
+			ret = kstrtou8(tmp, 16, d++);
+			if (ret < 0)
+				return ret;
+
+			s += 2;
+		} else {
+			s++;
+		}
+	}
+	if (d == dst)
+		return -EINVAL;
+
+	return 0;
+}
+
+static int btmrvl_load_cal_data(struct btmrvl_private *priv,
+				u8 *config_data)
+{
+	struct sk_buff *skb;
+	struct btmrvl_cmd *cmd;
+	int i;
+
+	skb = bt_skb_alloc(sizeof(*cmd), GFP_ATOMIC);
+	if (!skb)
+		return -ENOMEM;
+
+	cmd = (struct btmrvl_cmd *)skb->data;
+	cmd->ocf_ogf =
+		cpu_to_le16(hci_opcode_pack(OGF, BT_CMD_LOAD_CONFIG_DATA));
+	cmd->length = BT_CMD_DATA_SIZE;
+	cmd->data[0] = 0x00;
+	cmd->data[1] = 0x00;
+	cmd->data[2] = 0x00;
+	cmd->data[3] = BT_CMD_DATA_SIZE - 4;
+
+	/* swap cal-data bytes */
+	for (i = 4; i < BT_CMD_DATA_SIZE; i++)
+		cmd->data[i] = config_data[(i/4)*8 - 1 - i];
+
+	bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT;
+	skb_put(skb, sizeof(*cmd));
+	skb->dev = (void *)priv->btmrvl_dev.hcidev;
+	skb_queue_head(&priv->adapter->tx_queue, skb);
+	priv->btmrvl_dev.sendcmdflag = true;
+	priv->adapter->cmd_complete = false;
+
+	print_hex_dump_bytes("Calibration data: ",
+			     DUMP_PREFIX_OFFSET, cmd->data, BT_CMD_DATA_SIZE);
+
+	wake_up_interruptible(&priv->main_thread.wait_q);
+	if (!wait_event_interruptible_timeout(priv->adapter->cmd_wait_q,
+					      priv->adapter->cmd_complete,
+				       msecs_to_jiffies(WAIT_UNTIL_CMD_RESP))) {
+		BT_ERR("Timeout while loading calibration data");
+		return -ETIMEDOUT;
+	}
+
+	return 0;
+}
+
+static int
+btmrvl_process_cal_cfg(struct btmrvl_private *priv, u8 *data, u32 size)
+{
+	u8 cal_data[BT_CAL_DATA_SIZE];
+	int ret;
+
+	ret = btmrvl_parse_cal_cfg(data, size, cal_data, sizeof(cal_data));
+	if (ret)
+		return ret;
+
+	ret = btmrvl_load_cal_data(priv, cal_data);
+	if (ret) {
+		BT_ERR("Fail to load calibrate data");
+		return ret;
+	}
+
+	return 0;
+}
+
+static int btmrvl_cal_data_config(struct btmrvl_private *priv)
+{
+	const struct firmware *cfg;
+	int ret;
+	const char *cal_data = priv->btmrvl_dev.cal_data;
+
+	if (!cal_data)
+		return 0;
+
+	ret = request_firmware(&cfg, cal_data, priv->btmrvl_dev.dev);
+	if (ret < 0) {
+		BT_DBG("Failed to get %s file, skipping cal data download",
+		       cal_data);
+		ret = 0;
+		goto done;
+	}
+
+	ret = btmrvl_process_cal_cfg(priv, (u8 *)cfg->data, cfg->size);
+done:
+	if (cfg)
+		release_firmware(cfg);
+
+	return ret;
+}
+
 int btmrvl_register_hdev(struct btmrvl_private *priv)
 {
 	struct hci_dev *hdev = NULL;
@@ -583,12 +710,21 @@ int btmrvl_register_hdev(struct btmrvl_private *priv)
 		goto err_hci_register_dev;
 	}
 
+	ret = btmrvl_cal_data_config(priv);
+	if (ret) {
+		BT_ERR("Set cal data failed");
+		goto err_cal_data_config;
+	}
+
 #ifdef CONFIG_DEBUG_FS
 	btmrvl_debugfs_init(hdev);
 #endif
 
 	return 0;
 
+err_cal_data_config:
+	hci_unregister_dev(hdev);
+
 err_hci_register_dev:
 	hci_free_dev(hdev);
 
diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c
index 00da6df..af7f48d 100644
--- a/drivers/bluetooth/btmrvl_sdio.c
+++ b/drivers/bluetooth/btmrvl_sdio.c
@@ -18,7 +18,6 @@
  * this warranty disclaimer.
  **/
 
-#include <linux/firmware.h>
 #include <linux/slab.h>
 
 #include <linux/mmc/sdio_ids.h>
@@ -102,6 +101,7 @@ static const struct btmrvl_sdio_card_reg btmrvl_reg_88xx = {
 static const struct btmrvl_sdio_device btmrvl_sdio_sd8688 = {
 	.helper		= "mrvl/sd8688_helper.bin",
 	.firmware	= "mrvl/sd8688.bin",
+	.cal_data	= NULL,
 	.reg		= &btmrvl_reg_8688,
 	.sd_blksz_fw_dl	= 64,
 };
@@ -109,6 +109,7 @@ static const struct btmrvl_sdio_device btmrvl_sdio_sd8688 = {
 static const struct btmrvl_sdio_device btmrvl_sdio_sd8787 = {
 	.helper		= NULL,
 	.firmware	= "mrvl/sd8787_uapsta.bin",
+	.cal_data	= NULL,
 	.reg		= &btmrvl_reg_87xx,
 	.sd_blksz_fw_dl	= 256,
 };
@@ -116,6 +117,7 @@ static const struct btmrvl_sdio_device btmrvl_sdio_sd8787 = {
 static const struct btmrvl_sdio_device btmrvl_sdio_sd8797 = {
 	.helper		= NULL,
 	.firmware	= "mrvl/sd8797_uapsta.bin",
+	.cal_data	= "mrvl/sd8797_caldata.conf",
 	.reg		= &btmrvl_reg_87xx,
 	.sd_blksz_fw_dl	= 256,
 };
@@ -123,6 +125,7 @@ static const struct btmrvl_sdio_device btmrvl_sdio_sd8797 = {
 static const struct btmrvl_sdio_device btmrvl_sdio_sd8897 = {
 	.helper		= NULL,
 	.firmware	= "mrvl/sd8897_uapsta.bin",
+	.cal_data	= NULL,
 	.reg		= &btmrvl_reg_88xx,
 	.sd_blksz_fw_dl	= 256,
 };
@@ -1006,6 +1009,7 @@ static int btmrvl_sdio_probe(struct sdio_func *func,
 		struct btmrvl_sdio_device *data = (void *) id->driver_data;
 		card->helper = data->helper;
 		card->firmware = data->firmware;
+		card->cal_data = data->cal_data;
 		card->reg = data->reg;
 		card->sd_blksz_fw_dl = data->sd_blksz_fw_dl;
 	}
@@ -1034,6 +1038,8 @@ static int btmrvl_sdio_probe(struct sdio_func *func,
 	}
 
 	card->priv = priv;
+	priv->btmrvl_dev.dev = &card->func->dev;
+	priv->btmrvl_dev.cal_data = card->cal_data;
 
 	/* Initialize the interface specific function pointers */
 	priv->hw_host_to_card = btmrvl_sdio_host_to_card;
@@ -1222,4 +1228,5 @@ MODULE_FIRMWARE("mrvl/sd8688_helper.bin");
 MODULE_FIRMWARE("mrvl/sd8688.bin");
 MODULE_FIRMWARE("mrvl/sd8787_uapsta.bin");
 MODULE_FIRMWARE("mrvl/sd8797_uapsta.bin");
+MODULE_FIRMWARE("mrvl/sd8797_caldata.conf");
 MODULE_FIRMWARE("mrvl/sd8897_uapsta.bin");
diff --git a/drivers/bluetooth/btmrvl_sdio.h b/drivers/bluetooth/btmrvl_sdio.h
index 43d35a6..6872d9e 100644
--- a/drivers/bluetooth/btmrvl_sdio.h
+++ b/drivers/bluetooth/btmrvl_sdio.h
@@ -85,6 +85,7 @@ struct btmrvl_sdio_card {
 	u32 ioport;
 	const char *helper;
 	const char *firmware;
+	const char *cal_data;
 	const struct btmrvl_sdio_card_reg *reg;
 	u16 sd_blksz_fw_dl;
 	u8 rx_unit;
@@ -94,6 +95,7 @@ struct btmrvl_sdio_card {
 struct btmrvl_sdio_device {
 	const char *helper;
 	const char *firmware;
+	const char *cal_data;
 	const struct btmrvl_sdio_card_reg *reg;
 	u16 sd_blksz_fw_dl;
 };
-- 
1.8.0


^ permalink raw reply related

* heavily backlogged...
From: David Miller @ 2013-08-19 19:52 UTC (permalink / raw)
  To: netdev; +Cc: linux-wireless, netfilter-devel


Due to the weekend vger.kernel.org mail issues I haven't been able
to read my own email until just now.

So I've got a 9000+ email backlog to sift through because I can
do anything useful.

Thanks for your patience in advance.

^ permalink raw reply

* [PATCH 2/2] qca-swiss-army-knife: add ath10k trace-cmd plugin
From: Kalle Valo @ 2013-08-19 19:11 UTC (permalink / raw)
  To: linux-wireless
In-Reply-To: <1376939466-8282-1-git-send-email-kvalo@qca.qualcomm.com>

This one's a skeleton as well.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
 tracing/plugins/ath10k.py |  133 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 133 insertions(+)
 create mode 100644 tracing/plugins/ath10k.py

diff --git a/tracing/plugins/ath10k.py b/tracing/plugins/ath10k.py
new file mode 100644
index 0000000..1008c05
--- /dev/null
+++ b/tracing/plugins/ath10k.py
@@ -0,0 +1,133 @@
+#
+# Copyright (c) 2012 Qualcomm Atheros, Inc.
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# trace-cmd plugin for ath10k, QCA Linux wireless driver
+
+
+import tracecmd
+import struct
+import binascii
+
+def hexdump(buf, prefix=None):
+    s = binascii.b2a_hex(buf)
+    s_len = len(s)
+    result = ""
+
+    if prefix == None:
+        prefix = ""
+
+    for i in range(s_len / 2):
+        if i % 16 == 0:
+            result = result + ("%s%04x: " % (prefix, i))
+
+        result = result + (s[2*i] + s[2*i+1] + " ")
+
+        if (i + 1) % 16 == 0:
+            result = result + "\n"
+
+    # FIXME: if len(s) % 16 == 0 there's an extra \n in the end
+
+    return result
+
+wmi_scan_event_names = [
+    [0x1,  "WMI_SCAN_EVENT_STARTED" ],
+    [0x2,  "WMI_SCAN_EVENT_COMPLETED" ],
+    [0x4, "WMI_SCAN_EVENT_BSS_CHANNEL" ],
+    [0x8,  "WMI_SCAN_EVENT_FOREIGN_CHANNEL"],
+    [0x10, "WMI_SCAN_EVENT_DEQUEUED" ],
+    [0x20, "WMI_SCAN_EVENT_PREEMPTED" ],
+    [0x40, "WMI_SCAN_EVENT_START_FAILED" ],
+    ]
+
+def wmi_event_scan(pevent, trace_seq, event, buf):
+    hdr = struct.unpack("<IIIIII", buf[0:24])
+    event = hdr[0]
+    reason = hdr[1]
+    channel_freq = hdr[2]
+    requestor = hdr[3]
+    scan_id = hdr[4]
+    vdev_id = hdr[5]
+
+    trace_seq.puts("\t\t\t\tWMI_SCAN_EVENTID event 0x%x reason %d channel_freq %d requestor %d scan_id %d vdev_id %d\n" %
+                   (event, reason, channel_freq, requestor, scan_id, vdev_id))
+
+    for (i, name) in wmi_scan_event_names:
+        if event == i:
+            trace_seq.puts("\t\t\t\t\t%s" % name)
+
+wmi_event_handlers = [
+    [0x9000, wmi_event_scan ],
+    ]
+
+def wmi_cmd_start_scan_handler(pevent, trace_seq, event, buf):
+    hdr = struct.unpack("<IIIIIIIIIIIIIII", buf[0:60])
+    scan_id = hdr[0]
+
+    trace_seq.puts("\t\t\t\tWMI_START_SCAN_CMDID scan_id %d\n" % (scan_id))
+
+wmi_cmd_handlers = [
+    [0x9000, wmi_cmd_start_scan_handler ],
+    ]
+
+def ath10k_wmi_cmd_handler(pevent, trace_seq, event):
+    buf_len = long(event['buf_len'])
+    buf = event['buf'].data
+
+    # parse wmi header
+    hdr = struct.unpack("<HH", buf[0:4])
+    buf = buf[4:]
+
+    cmd_id = hdr[0]
+
+    trace_seq.puts("id 0x%x len %d\n" % (cmd_id, buf_len))
+
+    for (wmi_id, handler) in wmi_cmd_handlers:
+        if wmi_id == cmd_id:
+            handler(pevent, trace_seq, event, buf)
+            break
+
+def ath10k_wmi_event_handler(pevent, trace_seq, event):
+    buf_len = long(event['buf_len'])
+    buf = event['buf'].data
+
+    hdr = struct.unpack("<HH", buf[0:4])
+    cmd_id = hdr[0]
+
+    trace_seq.puts("id 0x%x len %d\n" % (cmd_id, buf_len))
+
+    for (wmi_id, handler) in wmi_event_handlers:
+        if wmi_id == cmd_id:
+            handler(pevent, trace_seq, event, buf[4:])
+            break
+
+def ath10k_log_dbg_dump_handler(pevent, trace_seq, event):
+    msg = event['msg']
+    prefix = event['prefix']
+    buf_len = long(event['buf_len'])
+    buf = event['buf'].data
+
+    trace_seq.puts("%s\n" % (msg))
+    trace_seq.puts("%s\n" % hexdump(buf, prefix))
+    
+def register(pevent):
+    pevent.register_event_handler("ath10k", "ath10k_wmi_cmd",
+                                  lambda *args:
+                                      ath10k_wmi_cmd_handler(pevent, *args))
+    pevent.register_event_handler("ath10k", "ath10k_wmi_event",
+                                  lambda *args:
+                                      ath10k_wmi_event_handler(pevent, *args))
+    pevent.register_event_handler("ath10k", "ath10k_log_dbg_dump",
+                                  lambda *args:
+                                      ath10k_log_dbg_dump_handler(pevent, *args))
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 1/2] qca-swiss-army-knife: add ath6kl trace-cmd plugin
From: Kalle Valo @ 2013-08-19 19:11 UTC (permalink / raw)
  To: linux-wireless

Just a skeleton for now.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
 tracing/plugins/ath6kl.py |  251 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 251 insertions(+)
 create mode 100644 tracing/plugins/ath6kl.py

diff --git a/tracing/plugins/ath6kl.py b/tracing/plugins/ath6kl.py
new file mode 100644
index 0000000..228c736
--- /dev/null
+++ b/tracing/plugins/ath6kl.py
@@ -0,0 +1,251 @@
+#
+# Copyright (c) 2012 Qualcomm Atheros, Inc.
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# To install the plugin:
+#
+# cp ath6kl.py ~/.trace-cmd/plugins/
+#
+# When making changes to the plugin use -V to see all python errors/warnings:
+#
+# trace-cmd report -V trace.dat
+
+import tracecmd
+import struct
+import binascii
+
+def hexdump(buf, prefix=None):
+    s = binascii.b2a_hex(buf)
+    s_len = len(s)
+    result = ""
+
+    if prefix == None:
+        prefix = ""
+
+    for i in range(s_len / 2):
+        if i % 16 == 0:
+            result = result + ("%s%04x: " % (prefix, i))
+
+        result = result + (s[2*i] + s[2*i+1] + " ")
+
+        if (i + 1) % 16 == 0:
+            result = result + "\n"
+
+    # FIXME: if len(s) % 16 == 0 there's an extra \n in the end
+
+    return result
+
+def wmi_event_bssinfo(pevent, trace_seq, event, buf):
+    hdr = struct.unpack("<HBB6BH", buf[0:12])
+    channel = hdr[0]
+    frame_type = hdr[1]
+    snr = hdr[2]
+    bssid = hdr[3]
+    ie_mask = hdr[4]
+
+    trace_seq.puts("\t\t\tWMI_BSSINFO_EVENTID channel %d frame_type 0x%x snr %d ie_mask 0x%x\n" %
+                   (channel, frame_type, snr, ie_mask))
+
+wmi_event_handlers = [
+    [0x1004, wmi_event_bssinfo ],
+    ]
+
+def wmi_cmd_set_bss_filter_handler(pevent, trace_seq, event, buf):
+    hdr = struct.unpack("<BBHI", buf[0:8])
+    bss_filter = hdr[0]
+    ie_mask = hdr[3]
+
+    trace_seq.puts("\t\t\tWMI_SET_BSS_FILTER_CMDID bss_filter 0x%x ie_mask 0x%08x\n" %
+                   (bss_filter, ie_mask))
+
+def wmi_cmd_set_probed_ssid_handler(pevent, trace_seq, event, buf):
+    hdr = struct.unpack("<BBB", buf[0:3])
+    entry_index = hdr[0]
+    flag = hdr[1]
+    ssid_len = hdr[2]
+
+    # fmt = "<" + ssid_len + "s"
+    # hdr = struct.unpack(fmt, buf[3:3 + ssid_len])
+
+    trace_seq.puts("\t\t\tWMI_SET_PROBED_SSID_CMDID entry_index 0x%x flag 0x%08x ssid_len %d\n" %
+                   (entry_index, flag, ssid_len))
+
+    # FIXME: print SSID
+    # for c in hdr[0]:
+    #     print ascii(c)
+
+wmi_cmd_handlers = [
+    [9, wmi_cmd_set_bss_filter_handler ],
+    [10, wmi_cmd_set_probed_ssid_handler ],
+    ]
+
+WMI_CMD_HDR_IF_ID_MASK = 0xf
+
+def ath6kl_wmi_cmd_handler(pevent, trace_seq, event):
+    buf_len = long(event['buf_len'])
+    buf = event['buf'].data
+
+    hdr = struct.unpack("<HHH", buf[0:6])
+    cmd_id = hdr[0]
+    if_idx = hdr[1] & WMI_CMD_HDR_IF_ID_MASK
+
+    trace_seq.puts("id 0x%x len %d if_idx %d\n" % (cmd_id, buf_len, if_idx))
+                   
+    for (wmi_id, handler) in wmi_cmd_handlers:
+        if wmi_id == cmd_id:
+            handler(pevent, trace_seq, event, buf[6:])
+            break
+
+def ath6kl_wmi_event_handler(pevent, trace_seq, event):
+    buf_len = long(event['buf_len'])
+    buf = event['buf'].data
+
+    hdr = struct.unpack("<HHH", buf[0:6])
+    cmd_id = hdr[0]
+    if_idx = hdr[1] & WMI_CMD_HDR_IF_ID_MASK
+
+    trace_seq.puts("id 0x%x len %d if_idx %d\n" % (cmd_id, buf_len, if_idx))
+                   
+    for (wmi_id, handler) in wmi_event_handlers:
+        if wmi_id == cmd_id:
+            handler(pevent, trace_seq, event, buf[6:])
+            break
+
+def ath6kl_htc_tx_handler(pevent, trace_seq, event):
+    buf_len = long(event['buf_len'])
+    buf = event['buf'].data
+
+    hdr = struct.unpack("<BBHBB", buf[0:6])
+    endpoint = hdr[0]
+    flags = hdr[1]
+    payload_len = hdr[2]
+    ctrl0 = hdr[3]
+    ctrl1 = hdr[4]
+
+    seqno = ctrl1
+
+    trace_seq.puts("seqno %d endpoint %d payload_len %d flags 0x%x\n" %
+                   (seqno, endpoint, payload_len, flags))
+
+    if flags != 0:
+        trace_seq.puts("\t\t\t\t\t\t")
+
+    if flags & 0x1:
+        trace_seq.puts(" NEED_CREDIT_UPDATE")
+
+    if flags & 0x2:
+        trace_seq.puts(" SEND_BUNDLE")
+
+    if flags & 0x4:
+        trace_seq.puts(" FIXUP_NETBUF")
+
+    if flags != 0:
+        trace_seq.puts("\n")
+
+def ath6kl_htc_rx_handler(pevent, trace_seq, event):
+    buf_len = long(event['buf_len'])
+    buf = event['buf'].data
+
+    hdr = struct.unpack("<BBHBB", buf[0:6])
+    endpoint = hdr[0]
+    flags = hdr[1]
+    payload_len = hdr[2]
+    ctrl0 = hdr[3]
+    ctrl1 = hdr[4]
+
+    seqno = ctrl1
+    bundle_count = (flags & 0xf0) >> 4
+
+    trace_seq.puts("seqno %d endpoint %d payload_len %d flags 0x%x bundle_count %d\n" %
+                   (seqno, endpoint, payload_len, flags, bundle_count))
+
+    if (flags & 0xf) != 0:
+        trace_seq.puts("\t\t\t\t\t\t")
+
+    if flags & 0x1:
+        trace_seq.puts(" UNUSED")
+
+    if flags & 0x2:
+        trace_seq.puts(" TRAILER")
+
+    if (flags & 0xf) != 0:
+        trace_seq.puts("\n")
+
+def ath6kl_sdio_handler(pevent, trace_seq, event):
+    tx = long(event['tx'])
+    addr = event['addr']
+    flags = event['flags']
+
+    buf_len = long(event['buf_len'])
+    buf = event['buf'].data
+
+    if tx == 1:
+        direction = "tx"
+    else:
+        direction = "rx"
+
+    trace_seq.puts("%s addr 0x%x flags 0x%x buf_len %d\n" %
+                   (direction, addr, flags, buf_len))
+    trace_seq.puts("%s\n" % hexdump(buf))
+
+def ath6kl_sdio_scat_handler(pevent, trace_seq, event):
+    tx = long(event['tx'])
+    addr = long(event['addr'])
+    flags = long(event['flags'])
+    entries = long(event['entries'])
+    total_len = long(event['total_len'])
+
+    len_array_data = event['len_array'].data
+    data = event['data'].data
+
+    if tx == 1:
+        direction = "tx"
+    else:
+        direction = "rx"
+
+    trace_seq.puts("%s addr 0x%x flags 0x%x entries %d total_len %d\n" %
+                   (direction, addr, flags, entries, total_len))
+
+    offset = 0
+
+    len_array = struct.unpack("<%dI" % entries, len_array_data[0:8])
+
+    for i in range(entries):
+        length = len_array[i]
+        start = offset
+        end = start + length
+
+        trace_seq.puts("%s\n" % hexdump(data[start:end]))
+
+        offset = offset + length
+
+def register(pevent):
+    pevent.register_event_handler("ath6kl", "ath6kl_wmi_cmd",
+                                  lambda *args:
+                                      ath6kl_wmi_cmd_handler(pevent, *args))
+    pevent.register_event_handler("ath6kl", "ath6kl_wmi_event",
+                                  lambda *args:
+                                      ath6kl_wmi_event_handler(pevent, *args))
+    pevent.register_event_handler("ath6kl", "ath6kl_htc_tx",
+                                  lambda *args:
+                                      ath6kl_htc_tx_handler(pevent, *args))
+    pevent.register_event_handler("ath6kl", "ath6kl_htc_rx",
+                                  lambda *args:
+                                      ath6kl_htc_rx_handler(pevent, *args))
+    pevent.register_event_handler("ath6kl", "ath6kl_sdio",
+                                  lambda *args:
+                                      ath6kl_sdio_handler(pevent, *args))
+    pevent.register_event_handler("ath6kl", "ath6kl_sdio_scat",
+                                  lambda *args:
+                                      ath6kl_sdio_scat_handler(pevent, *args))
-- 
1.7.9.5


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox