Linux wireless drivers development
 help / color / mirror / Atom feed
* Re: Connection not established with Realtek RTL8188CUS based USB device (EDIMAX)
From: Paul Menzel @ 2013-06-17 21:38 UTC (permalink / raw)
  To: Larry Finger; +Cc: linux-wireless
In-Reply-To: <51BCD7BA.1040900@lwfinger.net>

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

Am Samstag, den 15.06.2013, 16:08 -0500 schrieb Larry Finger:
> On 06/15/2013 02:57 PM, Paul Menzel wrote:

> > hopefully I am contacting the correct list. I am not able to use the
> > Realtek RTL8188CUS based USB WLAN device Edimax EW-7811Un.
> >
> >          Bus 002 Device 005: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]
> >
> > The device did not work with Debian Wheezy with Linux 3.2.x, Debian
> > Sid/unstable with Linux 3.9.x, Ubuntu 12.04 with Linux 3.2.12 to 3.5 and
> > Ubuntu 13.04 with Linux 3.8. The person, from whom the device is from,
> > claims the device once worked with Ubuntu, but I do not know which
> > version and what WLAN type(?) this was with.
> >
> > The behavior is always the same. The device is detected and the
> > NetworkManager applet `nm-applet` is also able to detect the available
> > networks. But wanting to connect to one and entering the correct
> > password, the connection cannot be established and I am asked for the
> > password again. I tested this with different systems and different
> > networks and also with wpa_supplicant. A Ralink based WLAN USB device
> > works just fine.
> >
> > The Realtek RTL8188CUS WLAN device works also fine under Microsoft
> > Windows, so the device is functional.
> 
> Use a compat-wireless package from 3.10-rc1 or later.

I only found 3.10-rc1 [1].

Unfortunately I was not able to load the modules. With the help from
#linux-wireless I did `make menuconfig` and then `make`.

        $ find net -name *ko
        net/mac80211/mac80211.ko
        net/wireless/cfg80211.ko
        $ find -name rtl*ko
        ./drivers/net/wireless/rtlwifi/rtl8192c/rtl8192c-common.ko
        ./drivers/net/wireless/rtlwifi/rtlwifi.ko
        ./drivers/net/wireless/rtlwifi/rtl8192cu/rtl8192cu.ko
        $ sudo insmod -f net/mac80211/mac80211.ko
        Error: could not insert module net/mac80211/mac80211.ko: Unknown symbol in module
        $ file net/mac80211/mac80211.ko
        net/mac80211/mac80211.ko: ELF 32-bit LSB  relocatable, Intel 80386, version 1 (SYSV), BuildID[sha1]=c3fcda409c09dcd98997f7a0a43a7eb8401b83cb, not stripped
        $ more /var/log/syslog
        […]
        Jun 17 23:26:18 myhostname kernel: [ 6853.383013] mac80211: Unknown symbol cfg80211_send_assoc_timeout (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.383049] mac80211: Unknown symbol cfg80211_sched_scan_results (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.383099] mac80211: Unknown symbol cfg80211_rx_unexpected_4addr_frame (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.383186] mac80211: Unknown symbol cfg80211_scan_done (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.383220] mac80211: Unknown symbol cfg80211_sched_scan_stopped (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.383272] mac80211: Unknown symbol cfg80211_send_auth_timeout (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.383307] mac80211: Unknown symbol cfg80211_remain_on_channel_expired (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.383340] mac80211: Unknown symbol cfg80211_cac_event (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.383395] mac80211: Unknown symbol ieee80211_amsdu_to_8023s (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.383423] mac80211: Unknown symbol cfg80211_send_deauth (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.383460] mac80211: Unknown symbol cfg80211_ref_bss (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.383531] mac80211: Unknown symbol __cfg80211_send_deauth (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.383574] mac80211: Unknown symbol cfg80211_chandef_valid (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.383601] mac80211: Unknown symbol cfg80211_new_sta (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.383639] mac80211: Unknown symbol cfg80211_send_unprot_deauth (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.383686] mac80211: Unknown symbol cfg80211_calculate_bitrate (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.383738] mac80211: Unknown symbol cfg80211_ready_on_channel (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.383773] mac80211: Unknown symbol cfg80211_classify8021d (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.383811] mac80211: Unknown symbol cfg80211_send_unprot_disassoc (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.383843] mac80211: Unknown symbol wiphy_register (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.383874] mac80211: Unknown symbol wiphy_new (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.383905] mac80211: Unknown symbol cfg80211_put_bss (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.383945] mac80211: Unknown symbol cfg80211_gtk_rekey_notify (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.383991] mac80211: Unknown symbol ieee80211_bss_get_ie (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384034] mac80211: Unknown symbol cfg80211_rx_spurious_frame (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384061] mac80211: Unknown symbol cfg80211_ibss_joined (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384090] mac80211: Unknown symbol __cfg80211_send_disassoc (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384118] mac80211: Unknown symbol cfg80211_chandef_compatible (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384155] mac80211: Unknown symbol cfg80211_report_obss_beacon (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384196] mac80211: Unknown symbol cfg80211_michael_mic_failure (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384223] mac80211: Unknown symbol cfg80211_cqm_pktloss_notify (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384254] mac80211: Unknown symbol cfg80211_send_rx_auth (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384295] mac80211: Unknown symbol ieee80211_operating_class_to_band (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384442] mac80211: Unknown symbol wiphy_unregister (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384493] mac80211: Unknown symbol cfg80211_send_disassoc (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384532] mac80211: Unknown symbol ieee80211_radiotap_iterator_init (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384574] mac80211: Unknown symbol cfg80211_get_bss (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384609] mac80211: Unknown symbol __ieee80211_get_channel (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384648] mac80211: Unknown symbol cfg80211_chandef_usable (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384682] mac80211: Unknown symbol rfc1042_header (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384724] mac80211: Unknown symbol cfg80211_mgmt_tx_status (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384757] mac80211: Unknown symbol cfg80211_check_station_change (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384792] mac80211: Unknown symbol cfg80211_reg_can_beacon (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384834] mac80211: Unknown symbol cfg80211_find_ie (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384865] mac80211: Unknown symbol cfg80211_unregister_wdev (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384892] mac80211: Unknown symbol cfg80211_del_sta (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384920] mac80211: Unknown symbol cfg80211_probe_status (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384949] mac80211: Unknown symbol ieee80211_data_to_8023 (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.384976] mac80211: Unknown symbol cfg80211_send_rx_assoc (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.385003] mac80211: Unknown symbol ieee80211_radiotap_iterator_next (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.385041] mac80211: Unknown symbol ieee80211_channel_to_frequency (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.385069] mac80211: Unknown symbol cfg80211_rx_mgmt (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.385117] mac80211: Unknown symbol ieee80211_hdrlen (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.385153] mac80211: Unknown symbol cfg80211_chandef_create (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.385181] mac80211: Unknown symbol cfg80211_report_wowlan_wakeup (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.385210] mac80211: Unknown symbol cfg80211_inform_bss_frame (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.385245] mac80211: Unknown symbol cfg80211_get_p2p_attr (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.385277] mac80211: Unknown symbol ieee80211_frequency_to_channel (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.385313] mac80211: Unknown symbol cfg80211_radar_event (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.385341] mac80211: Unknown symbol bridge_tunnel_header (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.385375] mac80211: Unknown symbol backport_dependency_symbol (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.385402] mac80211: Unknown symbol cfg80211_unlink_bss (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.385430] mac80211: Unknown symbol wiphy_free (err 0)
        Jun 17 23:26:18 myhostname kernel: [ 6853.385462] mac80211: Unknown symbol cfg80211_cqm_rssi_notify (err 0)

What am I doing wrong?

> If that fails, then I will give you a debug sequence to run.


Thanks,

Paul


[1] https://www.kernel.org/pub/linux/kernel/projects/backports/stable/

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply

* [PATCH] staging: vt6656: mac.c MACvDisableKeyEntry remove dead code wOffset
From: Malcolm Priestley @ 2013-06-17 21:34 UTC (permalink / raw)
  To: gregkh; +Cc: linux-wireless


Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
---
 drivers/staging/vt6656/mac.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/vt6656/mac.c b/drivers/staging/vt6656/mac.c
index c707d86..e2c8e48 100644
--- a/drivers/staging/vt6656/mac.c
+++ b/drivers/staging/vt6656/mac.c
@@ -120,14 +120,10 @@ void MACvSetBBType(struct vnt_private *pDevice, u8 byType)
  */
 void MACvDisableKeyEntry(struct vnt_private *pDevice, u32 uEntryIdx)
 {
-	u16 wOffset;
 	u8 byData;
 
     byData = (u8) uEntryIdx;
 
-    wOffset = MISCFIFO_KEYETRY0;
-    wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE);
-
     //issue write misc fifo command to device
     CONTROLnsRequestOut(pDevice,
                         MESSAGE_TYPE_CLRKEYENTRY,
-- 
1.8.1.2



^ permalink raw reply related

* [RFC 2/2] mac80211:  Fix bss ref leak.
From: greearb @ 2013-06-17 21:32 UTC (permalink / raw)
  To: linux-wireless; +Cc: Ben Greear
In-Reply-To: <1371504746-8476-1-git-send-email-greearb@candelatech.com>

From: Ben Greear <greearb@candelatech.com>

Some of the calls to ieee80211_destroy_assoc_data should
be putting the bss reference and were not.  Add boolean
argument to tell that method whether or not it should put
the reference and fix calling code appropriately.

Grab the bss reference where the pointer is assigned
to make it easier to properly do reference counting.

Also add some comments to help clarify the bss ref-counting
logic.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 net/mac80211/mlme.c |   34 +++++++++++++++++++++++++---------
 net/mac80211/scan.c |    6 ++++++
 2 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 6510790..732eda0 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -2400,7 +2400,7 @@ static void ieee80211_get_rates(struct ieee80211_supported_band *sband,
 }
 
 static void ieee80211_destroy_assoc_data(struct ieee80211_sub_if_data *sdata,
-					 bool assoc)
+					 bool assoc, bool put_bss)
 {
 	struct ieee80211_mgd_assoc_data *assoc_data = sdata->u.mgd.assoc_data;
 
@@ -2415,6 +2415,10 @@ static void ieee80211_destroy_assoc_data(struct ieee80211_sub_if_data *sdata,
 		ieee80211_vif_release_channel(sdata);
 	}
 
+	if (put_bss)
+		cfg80211_put_bss(sdata->local->hw.wiphy, assoc_data->bss);
+
+
 	kfree(assoc_data);
 	sdata->u.mgd.assoc_data = NULL;
 }
@@ -2587,6 +2591,7 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
 	return true;
 }
 
+/** Calling code must dispose of bss reference if it is not NULL. */
 static enum rx_mgmt_action __must_check
 ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
 			     struct ieee80211_mgmt *mgmt, size_t len,
@@ -2643,17 +2648,20 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
 		return RX_MGMT_NONE;
 	}
 
+	/** bss will be passed back to calling code, and that code must
+	 * deal with properly putting the reference.
+	 */
 	*bss = assoc_data->bss;
 
 	if (status_code != WLAN_STATUS_SUCCESS) {
 		sdata_info(sdata, "%pM denied association (code=%d)\n",
 			   mgmt->sa, status_code);
-		ieee80211_destroy_assoc_data(sdata, false);
+		ieee80211_destroy_assoc_data(sdata, false, false);
 	} else {
 		if (!ieee80211_assoc_success(sdata, *bss, mgmt, len)) {
 			/* oops -- internal error -- send timeout for now */
-			ieee80211_destroy_assoc_data(sdata, false);
-			cfg80211_put_bss(sdata->local->hw.wiphy, *bss);
+			ieee80211_destroy_assoc_data(sdata, false, true);
+			*bss = NULL; /* Ensure no stale references */
 			return RX_MGMT_CFG80211_ASSOC_TIMEOUT;
 		}
 		sdata_info(sdata, "associated\n");
@@ -2663,7 +2671,7 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
 		 * recalc after assoc_data is NULL but before associated
 		 * is set can cause the interface to go idle
 		 */
-		ieee80211_destroy_assoc_data(sdata, true);
+		ieee80211_destroy_assoc_data(sdata, true, false);
 	}
 
 	return RX_MGMT_CFG80211_RX_ASSOC;
@@ -3105,6 +3113,9 @@ void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
 		break;
 	case IEEE80211_STYPE_ASSOC_RESP:
 	case IEEE80211_STYPE_REASSOC_RESP:
+		/* One way or another, must eventually put bss reference
+		 * if it is not NULL.
+		 */
 		rma = ieee80211_rx_mgmt_assoc_resp(sdata, mgmt, skb->len, &bss);
 		break;
 	case IEEE80211_STYPE_ACTION:
@@ -3136,6 +3147,9 @@ void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
 		cfg80211_send_rx_assoc(sdata->dev, bss, (u8 *)mgmt, skb->len);
 		break;
 	case RX_MGMT_CFG80211_ASSOC_TIMEOUT:
+		/* bss reference is already put at this point, see
+		 * 'internal-error' comment in ieee80211_rx_mgmt_assoc_resp
+		 */
 		cfg80211_send_assoc_timeout(sdata->dev, mgmt->bssid);
 		break;
 	case RX_MGMT_CFG80211_TX_DEAUTH:
@@ -3385,7 +3399,7 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata)
 
 			memcpy(bssid, ifmgd->assoc_data->bss->bssid, ETH_ALEN);
 
-			ieee80211_destroy_assoc_data(sdata, false);
+			ieee80211_destroy_assoc_data(sdata, false, true);
 
 			mutex_unlock(&ifmgd->mtx);
 			cfg80211_send_assoc_timeout(sdata->dev, bssid);
@@ -3935,6 +3949,7 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
 		return -ENOMEM;
 
 	auth_data->bss = req->bss;
+	cfg80211_ref_bss(local->hw.wiphy, auth_data->bss);
 
 	if (req->sae_data_len >= 4) {
 		__le16 *pos = (__le16 *) req->sae_data;
@@ -3998,8 +4013,6 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
 		goto err_clear;
 	}
 
-	/* hold our own reference */
-	cfg80211_ref_bss(local->hw.wiphy, auth_data->bss);
 	err = 0;
 	goto out_unlock;
 
@@ -4008,6 +4021,7 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
 	ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BSSID);
 	ifmgd->auth_data = NULL;
  err_free:
+	cfg80211_put_bss(sdata->local->hw.wiphy, auth_data->bss);
 	kfree(auth_data);
  out_unlock:
 	mutex_unlock(&ifmgd->mtx);
@@ -4129,6 +4143,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
 	}
 
 	assoc_data->bss = req->bss;
+	cfg80211_ref_bss(sdata->local->hw.wiphy, assoc_data->bss);
 
 	if (ifmgd->req_smps == IEEE80211_SMPS_AUTOMATIC) {
 		if (ifmgd->powersave)
@@ -4259,6 +4274,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
  err_clear:
 	memset(ifmgd->bssid, 0, ETH_ALEN);
 	ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BSSID);
+	cfg80211_put_bss(sdata->local->hw.wiphy, assoc_data->bss);
 	ifmgd->assoc_data = NULL;
  err_free:
 	kfree(assoc_data);
@@ -4364,7 +4380,7 @@ void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata)
 
 	mutex_lock(&ifmgd->mtx);
 	if (ifmgd->assoc_data)
-		ieee80211_destroy_assoc_data(sdata, false);
+		ieee80211_destroy_assoc_data(sdata, false, true);
 	if (ifmgd->auth_data)
 		ieee80211_destroy_auth_data(sdata, false);
 	del_timer_sync(&ifmgd->timer);
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 0b6434b..e0fcb4a 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -55,6 +55,9 @@ static bool is_uapsd_supported(struct ieee802_11_elems *elems)
 	return qos_info & IEEE80211_WMM_IE_AP_QOSINFO_UAPSD;
 }
 
+/** Must (eventually) put the returned value to keep from leaking
+ * a reference to the bss.
+ */
 struct ieee80211_bss *
 ieee80211_bss_info_update(struct ieee80211_local *local,
 			  struct ieee80211_rx_status *rx_status,
@@ -73,6 +76,9 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
 	else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)
 		signal = (rx_status->signal * 100) / local->hw.max_signal;
 
+	/* We now own a reference to cbss, have to make sure we
+	 * put it later.
+	 */
 	cbss = cfg80211_inform_bss_frame(local->hw.wiphy, channel,
 					 mgmt, len, signal, GFP_ATOMIC);
 	if (!cbss)
-- 
1.7.3.4


^ permalink raw reply related

* [RFC 1/2] wireless:  Add memory usage debugging.
From: greearb @ 2013-06-17 21:32 UTC (permalink / raw)
  To: linux-wireless; +Cc: Ben Greear

From: Ben Greear <greearb@candelatech.com>

The bss objects are reference counted, and the ies
are also tricky to keep track of.  Add option to
track allocation and freeing of the ies and bss objects,
and add debugfs files to show the current objects.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 net/wireless/Kconfig   |   13 +++++
 net/wireless/core.c    |    5 +-
 net/wireless/core.h    |   17 ++++++
 net/wireless/debugfs.c |  117 +++++++++++++++++++++++++++++++++++++++++++
 net/wireless/debugfs.h |    2 +
 net/wireless/scan.c    |  130 ++++++++++++++++++++++++++++++++++++++++++------
 6 files changed, 267 insertions(+), 17 deletions(-)

diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig
index 16d08b3..43ec2cd 100644
--- a/net/wireless/Kconfig
+++ b/net/wireless/Kconfig
@@ -115,6 +115,19 @@ config CFG80211_DEBUGFS
 
 	  If unsure, say N.
 
+config CFG80211_MEM_DEBUGGING
+	bool "cfg80211 memory debugging logic"
+	default n
+	depends on CFG80211_DEBUGFS
+	---help---
+	  Enable this if you want to debug memory handling for bss and ies
+	  objects.  New debugfs files: ieee80211/all_ies and all_bss will
+	  be created to display these objects.  This has a moderate CPU cost
+	  and uses a bit more memory than normal, but otherwise is not very
+	  expensive.
+
+	  If unsure, say N.
+
 config CFG80211_INTERNAL_REGDB
 	bool "use statically compiled regulatory rules database" if EXPERT
 	default n
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 9f08203..eb3e1de 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -1123,6 +1123,7 @@ static int __init cfg80211_init(void)
 		goto out_fail_nl80211;
 
 	ieee80211_debugfs_dir = debugfs_create_dir("ieee80211", NULL);
+	ieee80211_debugfs_add_glbl(ieee80211_debugfs_dir);
 
 	err = regulatory_init();
 	if (err)
@@ -1137,7 +1138,7 @@ static int __init cfg80211_init(void)
 out_fail_wq:
 	regulatory_exit();
 out_fail_reg:
-	debugfs_remove(ieee80211_debugfs_dir);
+	debugfs_remove_recursive(ieee80211_debugfs_dir);
 out_fail_nl80211:
 	unregister_netdevice_notifier(&cfg80211_netdev_notifier);
 out_fail_notifier:
@@ -1151,7 +1152,7 @@ subsys_initcall(cfg80211_init);
 
 static void __exit cfg80211_exit(void)
 {
-	debugfs_remove(ieee80211_debugfs_dir);
+	debugfs_remove_recursive(ieee80211_debugfs_dir);
 	nl80211_exit();
 	unregister_netdevice_notifier(&cfg80211_netdev_notifier);
 	wiphy_sysfs_exit();
diff --git a/net/wireless/core.h b/net/wireless/core.h
index 71b7285..e75be56 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -126,6 +126,23 @@ static inline void assert_cfg80211_lock(void)
 	lockdep_assert_held(&cfg80211_mutex);
 }
 
+#ifdef CONFIG_CFG80211_MEM_DEBUGGING
+
+struct wifi_mem_tracker {
+	struct list_head mylist;
+	char buf[40];
+	void *ptr;
+};
+extern struct list_head ies_list;
+extern spinlock_t ies_lock;
+extern atomic_t ies_count;
+
+extern struct list_head bss_list;
+extern spinlock_t bss_lock;
+extern atomic_t bss_count;
+
+#endif
+
 struct cfg80211_internal_bss {
 	struct list_head list;
 	struct list_head hidden_list;
diff --git a/net/wireless/debugfs.c b/net/wireless/debugfs.c
index 920cabe..96dc757 100644
--- a/net/wireless/debugfs.c
+++ b/net/wireless/debugfs.c
@@ -31,6 +31,110 @@ static const struct file_operations name## _ops = {			\
 	.llseek = generic_file_llseek,					\
 };
 
+#define DEBUGFS_READONLY_FILE_OPS(name) \
+static const struct file_operations name## _ops = {			\
+	.read = name## _read,						\
+	.open = simple_open,						\
+	.llseek = generic_file_llseek,					\
+};
+
+#ifdef CONFIG_CFG80211_MEM_DEBUGGING
+static ssize_t all_ies_read(struct file *file, char __user *user_buf,
+				size_t count, loff_t *ppos)
+{
+	int mxln = 31500;
+	char *buf = kzalloc(mxln, GFP_KERNEL);
+	int q, res = 0;
+	struct wifi_mem_tracker *iesm;
+
+	if (!buf)
+		return 0;
+
+	spin_lock_bh(&ies_lock);
+	res += sprintf(buf + res, "Total: %i\n", atomic_read(&ies_count));
+	list_for_each_entry(iesm, &ies_list, mylist) {
+		res += sprintf(buf + res, "%p: %s\n",
+			       iesm->ptr, iesm->buf);
+		if (res >= mxln) {
+			res = mxln;
+			break;
+		}
+	}
+	spin_unlock_bh(&ies_lock);
+
+	q = simple_read_from_buffer(user_buf, count, ppos, buf, res);
+	kfree(buf);
+	return q;
+}
+
+static ssize_t all_bss_read(struct file *file, char __user *user_buf,
+			    size_t count, loff_t *ppos)
+{
+	int mxln = 31500;
+	char *buf = kzalloc(mxln, GFP_KERNEL);
+	int q, res = 0;
+	struct wifi_mem_tracker *bssm;
+
+	if (!buf)
+		return 0;
+
+	spin_lock_bh(&bss_lock);
+	res += sprintf(buf + res, "Total: %i\n", atomic_read(&bss_count));
+	list_for_each_entry(bssm, &bss_list, mylist) {
+		struct cfg80211_internal_bss *bss;
+		bss = (struct cfg80211_internal_bss *)(bssm->ptr);
+		res += sprintf(buf + res, "%p: #%lu %s\n",
+			       bssm->ptr, bss->refcount, bssm->buf);
+		if (res >= mxln) {
+			res = mxln;
+			break;
+		}
+	}
+	spin_unlock_bh(&bss_lock);
+
+	q = simple_read_from_buffer(user_buf, count, ppos, buf, res);
+	kfree(buf);
+	return q;
+}
+
+DEBUGFS_READONLY_FILE_OPS(all_ies);
+DEBUGFS_READONLY_FILE_OPS(all_bss);
+
+#endif
+
+static ssize_t bss_read(struct file *file, char __user *user_buf,
+			size_t count, loff_t *ppos)
+{
+	struct wiphy *wiphy = file->private_data;
+	struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy);
+	int mxln = 31500;
+	char *buf = kzalloc(mxln, GFP_KERNEL);
+	int q, res = 0;
+	struct cfg80211_internal_bss *bss;
+
+	if (!buf)
+		return 0;
+
+	spin_lock_bh(&dev->bss_lock);
+	list_for_each_entry(bss, &dev->bss_list, list) {
+		res += sprintf(buf + res,
+			       "%p: #%lu  bcn: %p  pr: %p  hidden: %p\n",
+			       bss, bss->refcount,
+			       rcu_access_pointer(bss->pub.beacon_ies),
+			       rcu_access_pointer(bss->pub.proberesp_ies),
+			       bss->pub.hidden_beacon_bss);
+		if (res >= mxln) {
+			res = mxln;
+			break;
+		}
+	}
+	spin_unlock_bh(&dev->bss_lock);
+
+	q = simple_read_from_buffer(user_buf, count, ppos, buf, res);
+	kfree(buf);
+	return q;
+}
+
 DEBUGFS_READONLY_FILE(rts_threshold, 20, "%d",
 		      wiphy->rts_threshold)
 DEBUGFS_READONLY_FILE(fragmentation_threshold, 20, "%d",
@@ -39,6 +143,7 @@ DEBUGFS_READONLY_FILE(short_retry_limit, 20, "%d",
 		      wiphy->retry_short)
 DEBUGFS_READONLY_FILE(long_retry_limit, 20, "%d",
 		      wiphy->retry_long);
+DEBUGFS_READONLY_FILE_OPS(bss);
 
 static int ht_print_chan(struct ieee80211_channel *chan,
 			 char *buf, int buf_size, int offset)
@@ -112,4 +217,16 @@ void cfg80211_debugfs_rdev_add(struct cfg80211_registered_device *rdev)
 	DEBUGFS_ADD(short_retry_limit);
 	DEBUGFS_ADD(long_retry_limit);
 	DEBUGFS_ADD(ht40allow_map);
+	DEBUGFS_ADD(bss);
+}
+
+#define DEBUGFS_ADD_GLBL(name)						\
+	debugfs_create_file(#name, S_IRUGO, dir, NULL, &name## _ops);
+
+void ieee80211_debugfs_add_glbl(struct dentry *dir)
+{
+#ifdef CONFIG_CFG80211_MEM_DEBUGGING
+	DEBUGFS_ADD_GLBL(all_ies);
+	DEBUGFS_ADD_GLBL(all_bss);
+#endif
 }
diff --git a/net/wireless/debugfs.h b/net/wireless/debugfs.h
index 74fdd38..f644869 100644
--- a/net/wireless/debugfs.h
+++ b/net/wireless/debugfs.h
@@ -3,9 +3,11 @@
 
 #ifdef CONFIG_CFG80211_DEBUGFS
 void cfg80211_debugfs_rdev_add(struct cfg80211_registered_device *rdev);
+void ieee80211_debugfs_add_glbl(struct dentry *dir);
 #else
 static inline
 void cfg80211_debugfs_rdev_add(struct cfg80211_registered_device *rdev) {}
+static inline void ieee80211_debugfs_add_glbl(struct dentry *dir) { }
 #endif
 
 #endif /* __CFG80211_DEBUGFS_H */
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index fd99ea4..64cfc1b 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -57,6 +57,106 @@
 
 #define IEEE80211_SCAN_RESULT_EXPIRE	(30 * HZ)
 
+#ifdef CONFIG_CFG80211_MEM_DEBUGGING
+
+LIST_HEAD(ies_list);
+DEFINE_SPINLOCK(ies_lock);
+atomic_t ies_count = ATOMIC_INIT(0);
+
+LIST_HEAD(bss_list);
+DEFINE_SPINLOCK(bss_lock);
+atomic_t bss_count = ATOMIC_INIT(0);
+
+
+#define my_kfree_rcu_ies(a, b, bss)					\
+	do {								\
+		struct wifi_mem_tracker *iesm;				\
+		spin_lock_bh(&ies_lock);				\
+		list_for_each_entry(iesm, &ies_list, mylist) {		\
+			if (iesm->ptr == a) {				\
+				list_del(&iesm->mylist);		\
+				kfree(iesm);				\
+				break;					\
+			}						\
+		}							\
+		spin_unlock_bh(&ies_lock);				\
+		atomic_sub(1, &ies_count);				\
+		kfree_rcu(a, b);					\
+	} while (0)
+
+#define my_kmalloc_ies(s, g)				\
+	_my_kmalloc_ies(s, g, __LINE__);
+
+static void* _my_kmalloc_ies(size_t s, gfp_t gfp, int l)
+{
+	void *rv = kmalloc(s, gfp);
+	if (rv) {
+		struct wifi_mem_tracker *iesm = kmalloc(sizeof(*iesm), gfp);
+		atomic_add(1, &ies_count);
+		if (iesm) {
+			snprintf(iesm->buf, sizeof(iesm->buf), "%i", l);
+			iesm->buf[sizeof(iesm->buf)-1] = 0;
+			iesm->ptr = rv;
+			INIT_LIST_HEAD(&iesm->mylist);
+			spin_lock_bh(&ies_lock);
+			list_add(&iesm->mylist, &ies_list);
+			spin_unlock_bh(&ies_lock);
+		} else {
+			pr_err("ERROR:  Could not allocate iesm.\n");
+		}
+	}
+	return rv;
+}
+
+#define my_kfree_bss(a)					\
+	do {								\
+		struct wifi_mem_tracker *iesm;				\
+		spin_lock_bh(&bss_lock);				\
+		list_for_each_entry(iesm, &bss_list, mylist) {		\
+			if (iesm->ptr == a) {				\
+				list_del(&iesm->mylist);		\
+				kfree(iesm);				\
+				break;					\
+			}						\
+		}							\
+		atomic_sub(1, &bss_count);				\
+		spin_unlock_bh(&bss_lock);				\
+		kfree(a);						\
+	} while (0)
+
+#define my_kzalloc_bss(s, g)				\
+	_my_kzalloc_bss(s, g, __LINE__);
+
+static void* _my_kzalloc_bss(size_t s, gfp_t gfp, int l)
+{
+	void *rv = kmalloc(s, gfp);
+	if (rv) {
+		struct wifi_mem_tracker *bssm = kmalloc(sizeof(*bssm), gfp);
+		atomic_add(1, &bss_count);
+		if (bssm) {
+			snprintf(bssm->buf, sizeof(bssm->buf), "%i", l);
+			bssm->buf[sizeof(bssm->buf)-1] = 0;
+			bssm->ptr = rv;
+			INIT_LIST_HEAD(&bssm->mylist);
+			spin_lock_bh(&bss_lock);
+			list_add(&bssm->mylist, &bss_list);
+			spin_unlock_bh(&bss_lock);
+		} else {
+			pr_err("ERROR:  Could not allocate bssm for bss.\n");
+		}
+	}
+	return rv;
+}
+
+#else
+
+#define my_kfree_rcu_ies(a, b, bss) kfree_rcu(a, b)
+#define my_kmalloc_ies(s, g) kmalloc(s, g)
+#define my_kfree_bss(a) kfree(a)
+#define my_kzalloc_bss(s, g) kzalloc(s, g)
+
+#endif
+
 static void bss_free(struct cfg80211_internal_bss *bss)
 {
 	struct cfg80211_bss_ies *ies;
@@ -66,10 +166,10 @@ static void bss_free(struct cfg80211_internal_bss *bss)
 
 	ies = (void *)rcu_access_pointer(bss->pub.beacon_ies);
 	if (ies && !bss->pub.hidden_beacon_bss)
-		kfree_rcu(ies, rcu_head);
+		my_kfree_rcu_ies(ies, rcu_head, bss);
 	ies = (void *)rcu_access_pointer(bss->pub.proberesp_ies);
 	if (ies)
-		kfree_rcu(ies, rcu_head);
+		my_kfree_rcu_ies(ies, rcu_head, bss);
 
 	/*
 	 * This happens when the module is removed, it doesn't
@@ -78,7 +178,7 @@ static void bss_free(struct cfg80211_internal_bss *bss)
 	if (!list_empty(&bss->hidden_list))
 		list_del(&bss->hidden_list);
 
-	kfree(bss);
+	my_kfree_bss(bss);
 }
 
 static inline void bss_ref_get(struct cfg80211_registered_device *dev,
@@ -710,8 +810,8 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
 			rcu_assign_pointer(found->pub.ies,
 					   tmp->pub.proberesp_ies);
 			if (old)
-				kfree_rcu((struct cfg80211_bss_ies *)old,
-					  rcu_head);
+				my_kfree_rcu_ies((struct cfg80211_bss_ies *)old,
+						 rcu_head, found);
 		} else if (rcu_access_pointer(tmp->pub.beacon_ies)) {
 			const struct cfg80211_bss_ies *old;
 			struct cfg80211_internal_bss *bss;
@@ -731,8 +831,8 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
 				 */
 
 				f = rcu_access_pointer(tmp->pub.beacon_ies);
-				kfree_rcu((struct cfg80211_bss_ies *)f,
-					  rcu_head);
+				my_kfree_rcu_ies((struct cfg80211_bss_ies *)f,
+						 rcu_head, NULL);
 				goto drop;
 			}
 
@@ -759,8 +859,8 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
 			}
 
 			if (old)
-				kfree_rcu((struct cfg80211_bss_ies *)old,
-					  rcu_head);
+				my_kfree_rcu_ies((struct cfg80211_bss_ies *)old,
+						 rcu_head, found);
 		}
 
 		found->pub.beacon_interval = tmp->pub.beacon_interval;
@@ -777,15 +877,15 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
 		 * is allocated on the stack since it's not needed in the
 		 * more common case of an update
 		 */
-		new = kzalloc(sizeof(*new) + dev->wiphy.bss_priv_size,
-			      GFP_ATOMIC);
+		new = my_kzalloc_bss(sizeof(*new) + dev->wiphy.bss_priv_size,
+				     GFP_ATOMIC);
 		if (!new) {
 			ies = (void *)rcu_dereference(tmp->pub.beacon_ies);
 			if (ies)
-				kfree_rcu(ies, rcu_head);
+				my_kfree_rcu_ies(ies, rcu_head, NULL);
 			ies = (void *)rcu_dereference(tmp->pub.proberesp_ies);
 			if (ies)
-				kfree_rcu(ies, rcu_head);
+				my_kfree_rcu_ies(ies, rcu_head, NULL);
 			goto drop;
 		}
 		memcpy(new, tmp, sizeof(*new));
@@ -899,7 +999,7 @@ cfg80211_inform_bss(struct wiphy *wiphy,
 	 * override the IEs pointer should we have received an earlier
 	 * indication of Probe Response data.
 	 */
-	ies = kmalloc(sizeof(*ies) + ielen, gfp);
+	ies = my_kmalloc_ies(sizeof(*ies) + ielen, gfp);
 	if (!ies)
 		return NULL;
 	ies->len = ielen;
@@ -956,7 +1056,7 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
 	if (!channel)
 		return NULL;
 
-	ies = kmalloc(sizeof(*ies) + ielen, gfp);
+	ies = my_kmalloc_ies(sizeof(*ies) + ielen, gfp);
 	if (!ies)
 		return NULL;
 	ies->len = ielen;
-- 
1.7.3.4


^ permalink raw reply related

* Re: Lots of confusion on bss refcounting.
From: Ben Greear @ 2013-06-17 21:31 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless@vger.kernel.org
In-Reply-To: <51BF5ED4.9010704@candelatech.com>

On 06/17/2013 12:09 PM, Ben Greear wrote:
> On 06/17/2013 12:02 PM, Johannes Berg wrote:

> The bss reference is passed back, and through luck or careful programming,
> it *seems* that all paths related to calling ieee80211_rx_mgmt_assoc_resp
> managed to consume the bss.
>
> I haven't figured out yet why this is not an erroneous put since I didn't
> find the reference taken in the first place.
>
> I'm going to work on making some changes to the ref counting scheme
> a bit.  I'd rather have the code perhaps take and put a few refs
> it might otherwise skip to keep the ownership cleaner and make
> the code easier to debug and understand...
>
> I'll post some for RFC when I make some progress.

I think I found at least some of the leaks.

In places like ieee80211_mgd_stop, we were calling ieee80211_destroy_assoc_data,
but it was not putting the bss reference.

I'll post some RFC patches in a minute or two...first is debugging
logic, second attempts to fix bss ref counting.  This needs more
testing before it is applied...we will continue testing it....

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


^ permalink raw reply

* [PATCH] staging: vt6656: mac.c Remove commented out dead code
From: Malcolm Priestley @ 2013-06-17 21:31 UTC (permalink / raw)
  To: gregkh; +Cc: linux-wireless


Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
---
 drivers/staging/vt6656/mac.c | 25 -------------------------
 1 file changed, 25 deletions(-)

diff --git a/drivers/staging/vt6656/mac.c b/drivers/staging/vt6656/mac.c
index 5e01be5..c707d86 100644
--- a/drivers/staging/vt6656/mac.c
+++ b/drivers/staging/vt6656/mac.c
@@ -128,10 +128,6 @@ void MACvDisableKeyEntry(struct vnt_private *pDevice, u32 uEntryIdx)
     wOffset = MISCFIFO_KEYETRY0;
     wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE);
 
-    //VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
-    //VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, 0);
-    //VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
-
     //issue write misc fifo command to device
     CONTROLnsRequestOut(pDevice,
                         MESSAGE_TYPE_CLRKEYENTRY,
@@ -180,12 +176,6 @@ void MACvSetKeyEntry(struct vnt_private *pDevice, u16 wKeyCtl, u32 uEntryIdx,
 	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1. wOffset: %d, Data: %X,"\
 		" KeyCtl:%X\n", wOffset, dwData1, wKeyCtl);
 
-    //VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
-    //VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
-    //VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
-
-    //wOffset++;
-
     dwData2 = 0;
     dwData2 |= *(pbyAddr+3);
     dwData2 <<= 8;
@@ -198,21 +188,6 @@ void MACvSetKeyEntry(struct vnt_private *pDevice, u16 wKeyCtl, u32 uEntryIdx,
 	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"2. wOffset: %d, Data: %X\n",
 		wOffset, dwData2);
 
-    //VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
-    //VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
-    //VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
-
-    //wOffset++;
-
-    //wOffset += (uKeyIdx * 4);
-/*    for (ii=0;ii<4;ii++) {
-        // alway push 128 bits
-        DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"3.(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey);
-        VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii);
-        VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++);
-        VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
-    }
-*/
     pbyKey = (u8 *)pdwKey;
 
     pbyData[0] = (u8)dwData1;
-- 
1.8.1.2



^ permalink raw reply related

* [PATCH] staging: vt6656: mac.c MACvWriteMultiAddr: Remove secondary variable byData1
From: Malcolm Priestley @ 2013-06-17 21:26 UTC (permalink / raw)
  To: gregkh; +Cc: linux-wireless


Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
---
 drivers/staging/vt6656/mac.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/vt6656/mac.c b/drivers/staging/vt6656/mac.c
index 87c7c8b..5e01be5 100644
--- a/drivers/staging/vt6656/mac.c
+++ b/drivers/staging/vt6656/mac.c
@@ -57,15 +57,13 @@ static int          msglevel                =MSG_LEVEL_INFO;
  */
 void MACvWriteMultiAddr(struct vnt_private *pDevice, u32 uByteIdx, u8 byData)
 {
-	u8 byData1;
 
-    byData1 = byData;
     CONTROLnsRequestOut(pDevice,
                         MESSAGE_TYPE_WRITE,
                         (u16) (MAC_REG_MAR0 + uByteIdx),
                         MESSAGE_REQUEST_MACREG,
                         1,
-                        &byData1);
+			&byData);
 }
 
 /*
-- 
1.8.1.2



^ permalink raw reply related

* [PATCH] staging: vt6656: mac.c pbyData Remove magic number array size
From: Malcolm Priestley @ 2013-06-17 21:19 UTC (permalink / raw)
  To: gregkh; +Cc: linux-wireless

Array size always equals ARRAY_SIZE of pbyData

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
---
 drivers/staging/vt6656/mac.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/vt6656/mac.c b/drivers/staging/vt6656/mac.c
index 343db19..87c7c8b 100644
--- a/drivers/staging/vt6656/mac.c
+++ b/drivers/staging/vt6656/mac.c
@@ -101,7 +101,7 @@ void MACvSetBBType(struct vnt_private *pDevice, u8 byType)
                         MESSAGE_TYPE_WRITE_MASK,
                         MAC_REG_ENCFG0,
                         MESSAGE_REQUEST_MACREG,
-                        2,
+			ARRAY_SIZE(pbyData),
                         pbyData
                         );
 }
@@ -232,7 +232,7 @@ void MACvSetKeyEntry(struct vnt_private *pDevice, u16 wKeyCtl, u32 uEntryIdx,
                         MESSAGE_TYPE_SETKEY,
                         wOffset,
                         (u16)uKeyIdx,
-                        24,
+			ARRAY_SIZE(pbyData),
                         pbyData
                         );
 
@@ -249,7 +249,7 @@ void MACvRegBitsOff(struct vnt_private *pDevice, u8 byRegOfs, u8 byBits)
                         MESSAGE_TYPE_WRITE_MASK,
                         byRegOfs,
                         MESSAGE_REQUEST_MACREG,
-                        2,
+			ARRAY_SIZE(pbyData),
                         pbyData
                         );
 }
@@ -265,7 +265,7 @@ void MACvRegBitsOn(struct vnt_private *pDevice, u8 byRegOfs, u8 byBits)
                         MESSAGE_TYPE_WRITE_MASK,
                         byRegOfs,
                         MESSAGE_REQUEST_MACREG,
-                        2,
+			ARRAY_SIZE(pbyData),
                         pbyData
                         );
 }
@@ -281,7 +281,7 @@ void MACvWriteWord(struct vnt_private *pDevice, u8 byRegOfs, u16 wData)
                         MESSAGE_TYPE_WRITE,
                         byRegOfs,
                         MESSAGE_REQUEST_MACREG,
-                        2,
+			ARRAY_SIZE(pbyData),
                         pbyData
                         );
 
@@ -302,7 +302,7 @@ void MACvWriteBSSIDAddress(struct vnt_private *pDevice, u8 *pbyEtherAddr)
                         MESSAGE_TYPE_WRITE,
                         MAC_REG_BSSID0,
                         MESSAGE_REQUEST_MACREG,
-                        6,
+			ARRAY_SIZE(pbyData),
                         pbyData
                         );
 }
@@ -318,7 +318,7 @@ void MACvEnableProtectMD(struct vnt_private *pDevice)
                         MESSAGE_TYPE_WRITE_MASK,
                         MAC_REG_ENCFG0,
                         MESSAGE_REQUEST_MACREG,
-                        2,
+			ARRAY_SIZE(pbyData),
                         pbyData
                         );
 }
@@ -334,7 +334,7 @@ void MACvDisableProtectMD(struct vnt_private *pDevice)
                         MESSAGE_TYPE_WRITE_MASK,
                         MAC_REG_ENCFG0,
                         MESSAGE_REQUEST_MACREG,
-                        2,
+			ARRAY_SIZE(pbyData),
                         pbyData
                         );
 }
@@ -350,7 +350,7 @@ void MACvEnableBarkerPreambleMd(struct vnt_private *pDevice)
                         MESSAGE_TYPE_WRITE_MASK,
                         MAC_REG_ENCFG2,
                         MESSAGE_REQUEST_MACREG,
-                        2,
+			ARRAY_SIZE(pbyData),
                         pbyData
                         );
 }
@@ -366,7 +366,7 @@ void MACvDisableBarkerPreambleMd(struct vnt_private *pDevice)
                         MESSAGE_TYPE_WRITE_MASK,
                         MAC_REG_ENCFG2,
                         MESSAGE_REQUEST_MACREG,
-                        2,
+			ARRAY_SIZE(pbyData),
                         pbyData
                         );
 }
@@ -382,7 +382,7 @@ void MACvWriteBeaconInterval(struct vnt_private *pDevice, u16 wInterval)
 			MESSAGE_TYPE_WRITE,
 			MAC_REG_BI,
 			MESSAGE_REQUEST_MACREG,
-			2,
+			ARRAY_SIZE(pbyData),
 			pbyData
 			);
 }
-- 
1.8.1.2



^ permalink raw reply related

* Re: [PATCH] ssb: add struct for serial flash
From: Florian Fainelli @ 2013-06-17 21:09 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: linux-wireless, John W. Linville, Hauke Mehrtens
In-Reply-To: <CACna6rzDv1d4Znni+XUXprZp4RrFLr5yyBdJyPVLHB9n2U3_BQ@mail.gmail.com>

Le lundi 17 juin 2013 21:38:42, Rafał Miłecki a écrit :
> 2013/6/17 Rafał Miłecki <zajec5@gmail.com>:
> > This data allow writing for example MTD driver.
> 
> To make this a bit more clear:
> 
> Up until now, we were detecting flash model in
> driver_chipcommon_sflash.c, but nothing more than that. It was printed
> and that's all. Noone could read it's details or/and use it.
> 
> As providing an access to the flash is usually a good idea, we need an
> additional MTD driver for it. Such MTD driver needs some basic info
> about flash. It's mapping address and size at least.
> With this patch we put all important data in struct ssb_sflash. It can
> be accessed in two possible ways:
> 1) With the: bus->mipscore.sflash path. How to get a reference to the
> "bus"? It's an static exported symbols on some archs (bcm47xx).
> 2) Directly, it "sflash" is registered as a platform driver data. My
> next patch will address that.

Ok, well this was probably worth a cover letter just for this, and the second 
patch to be posted too ;) Thanks for the explanation


-- 
Florian

^ permalink raw reply

* Re: [PATCH] ssb: add struct for serial flash
From: Rafał Miłecki @ 2013-06-17 20:40 UTC (permalink / raw)
  To: linux-wireless, John W. Linville; +Cc: Hauke Mehrtens, Rafał Miłecki
In-Reply-To: <CACna6rzDv1d4Znni+XUXprZp4RrFLr5yyBdJyPVLHB9n2U3_BQ@mail.gmail.com>

2013/6/17 Rafał Miłecki <zajec5@gmail.com>:
> 2013/6/17 Rafał Miłecki <zajec5@gmail.com>:
>> This data allow writing for example MTD driver.
>
> To make this a bit more clear:
>
> Up until now, we were detecting flash model in
> driver_chipcommon_sflash.c, but nothing more than that. It was printed
> and that's all. Noone could read it's details or/and use it.
>
> As providing an access to the flash is usually a good idea, we need an
> additional MTD driver for it. Such MTD driver needs some basic info
> about flash. It's mapping address and size at least.

As an example you can see drivers/mtd/devices/bcm47xxsflash.c which a
driver for "bcma_sflash" platform device.

-- 
Rafał

^ permalink raw reply

* Re: [PATCH] ssb: add struct for serial flash
From: Rafał Miłecki @ 2013-06-17 20:38 UTC (permalink / raw)
  To: linux-wireless, John W. Linville; +Cc: Hauke Mehrtens, Rafał Miłecki
In-Reply-To: <1371491780-23412-1-git-send-email-zajec5@gmail.com>

2013/6/17 Rafał Miłecki <zajec5@gmail.com>:
> This data allow writing for example MTD driver.

To make this a bit more clear:

Up until now, we were detecting flash model in
driver_chipcommon_sflash.c, but nothing more than that. It was printed
and that's all. Noone could read it's details or/and use it.

As providing an access to the flash is usually a good idea, we need an
additional MTD driver for it. Such MTD driver needs some basic info
about flash. It's mapping address and size at least.
With this patch we put all important data in struct ssb_sflash. It can
be accessed in two possible ways:
1) With the: bus->mipscore.sflash path. How to get a reference to the
"bus"? It's an static exported symbols on some archs (bcm47xx).
2) Directly, it "sflash" is registered as a platform driver data. My
next patch will address that.

-- 
Rafał

^ permalink raw reply

* Re: [PATCH] ssb: add struct for serial flash
From: Rafał Miłecki @ 2013-06-17 20:33 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: linux-wireless, John W. Linville, Hauke Mehrtens
In-Reply-To: <CACna6rzCDHx7s9hz0=yDYsMeb45KANW0mW8qe=uH8QJGV-64CA@mail.gmail.com>

2013/6/17 Rafał Miłecki <zajec5@gmail.com>:
> 2013/6/17 Florian Fainelli <florian@openwrt.org>:
>> Hello Rafal,
>>
>> Le lundi 17 juin 2013 18:56:20, Rafał Miłecki a écrit :
>>> This data allow writing for example MTD driver.
>>
>> Your commit message could probably have some more information, by looking at
>> the patch, it is not entirely clear to me what this does, especially as sflash
>> is just a write only structure?
>
> OK, no problem. I'll give people w little more time for comments, and
> then I'll submit next version.

It's already in wireless-next, so I'll explain this just in an e-mail.
There is not much more to explain anyway ;)

-- 
Rafał

^ permalink raw reply

* Re: [PATCH] ssb: add struct for serial flash
From: Rafał Miłecki @ 2013-06-17 19:46 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: linux-wireless, John W. Linville, Hauke Mehrtens
In-Reply-To: <201306172038.21642.florian@openwrt.org>

2013/6/17 Florian Fainelli <florian@openwrt.org>:
> Hello Rafal,
>
> Le lundi 17 juin 2013 18:56:20, Rafał Miłecki a écrit :
>> This data allow writing for example MTD driver.
>
> Your commit message could probably have some more information, by looking at
> the patch, it is not entirely clear to me what this does, especially as sflash
> is just a write only structure?

OK, no problem. I'll give people w little more time for comments, and
then I'll submit next version.

-- 
Rafał

^ permalink raw reply

* Re: [PATCH] ssb: add struct for serial flash
From: Florian Fainelli @ 2013-06-17 19:38 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: linux-wireless, John W. Linville, Hauke Mehrtens
In-Reply-To: <1371491780-23412-1-git-send-email-zajec5@gmail.com>

Hello Rafal,

Le lundi 17 juin 2013 18:56:20, Rafał Miłecki a écrit :
> This data allow writing for example MTD driver.

Your commit message could probably have some more information, by looking at 
the patch, it is not entirely clear to me what this does, especially as sflash 
is just a write only structure?

> 
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
> ---
>  drivers/ssb/driver_chipcommon_sflash.c |    7 +++++++
>  include/linux/ssb/ssb_driver_mips.h    |   15 +++++++++++++++
>  2 files changed, 22 insertions(+)
> 
> diff --git a/drivers/ssb/driver_chipcommon_sflash.c
> b/drivers/ssb/driver_chipcommon_sflash.c index 1b9e770..205f1c4 100644
> --- a/drivers/ssb/driver_chipcommon_sflash.c
> +++ b/drivers/ssb/driver_chipcommon_sflash.c
> @@ -73,6 +73,7 @@ static void ssb_sflash_cmd(struct ssb_chipcommon *cc, u32
> opcode) /* Initialize serial flash access */
>  int ssb_sflash_init(struct ssb_chipcommon *cc)
>  {
> +	struct ssb_sflash *sflash = &cc->dev->bus->mipscore.sflash;
>  	const struct ssb_sflash_tbl_e *e;
>  	u32 id, id2;
> 
> @@ -131,6 +132,12 @@ int ssb_sflash_init(struct ssb_chipcommon *cc)
>  		return -ENOTSUPP;
>  	}
> 
> +	sflash->window = SSB_FLASH2;
> +	sflash->blocksize = e->blocksize;
> +	sflash->numblocks = e->numblocks;
> +	sflash->size = sflash->blocksize * sflash->numblocks;
> +	sflash->present = true;
> +
>  	pr_info("Found %s serial flash (blocksize: 0x%X, blocks: %d)\n",
>  		e->name, e->blocksize, e->numblocks);
> 
> diff --git a/include/linux/ssb/ssb_driver_mips.h
> b/include/linux/ssb/ssb_driver_mips.h index afe79d4..6535e47 100644
> --- a/include/linux/ssb/ssb_driver_mips.h
> +++ b/include/linux/ssb/ssb_driver_mips.h
> @@ -20,6 +20,18 @@ struct ssb_pflash {
>  	u32 window_size;
>  };
> 
> +#ifdef CONFIG_SSB_SFLASH
> +struct ssb_sflash {
> +	bool present;
> +	u32 window;
> +	u32 blocksize;
> +	u16 numblocks;
> +	u32 size;
> +
> +	void *priv;
> +};
> +#endif
> +
>  struct ssb_mipscore {
>  	struct ssb_device *dev;
> 
> @@ -27,6 +39,9 @@ struct ssb_mipscore {
>  	struct ssb_serial_port serial_ports[4];
> 
>  	struct ssb_pflash pflash;
> +#ifdef CONFIG_SSB_SFLASH
> +	struct ssb_sflash sflash;
> +#endif
>  };
> 
>  extern void ssb_mipscore_init(struct ssb_mipscore *mcore);

-- 
Florian

^ permalink raw reply

* Re: Lots of confusion on bss refcounting.
From: Ben Greear @ 2013-06-17 19:09 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless@vger.kernel.org
In-Reply-To: <1371495758.8168.3.camel@jlt4.sipsolutions.net>

On 06/17/2013 12:02 PM, Johannes Berg wrote:
> On Mon, 2013-06-17 at 11:49 -0700, Ben Greear wrote:
>
>> We create an assoc_data, assign a bss pointer in ieee80211_mgd_assoc,
>> but do not claim a reference.
>
> Heh, yeah, I was actually looking at this code too but didn't have time
> today to finish my thoughts ...
>
>> Later, when deleting the assoc_data, the ref is not freed either,
>> except in one error path where it is explicitly freed:
>>
>> 		if (!ieee80211_assoc_success(sdata, *bss, mgmt, len)) {
>> 			/* oops -- internal error -- send timeout for now */
>> 			ieee80211_destroy_assoc_data(sdata, false);
>> 			cfg80211_put_bss(sdata->local->hw.wiphy, *bss);
>> 			return RX_MGMT_CFG80211_ASSOC_TIMEOUT;
>> 		}
>>
>> This seems ripe for bugs, if not already buggy.
>>
>> Maybe we should be more explicit about always grabbing a ref when
>> we take a reference to the pointer, and always put it when we
>> destroy the pointer?
>
> I think the reference is actually given to mac80211 by cfg80211 in
> cfg80211_mlme_assoc(), so we shouldn't need to grab a reference?
> Although I'm certainly willing to change this and make cfg80211 always
> put the reference after calling rdev_assoc() so that the driver/mac80211
> would be responsible for obtaining its own if it needs to hang on to the
> struct.
>
> This does seem broken though.

The bss reference is passed back, and through luck or careful programming,
it *seems* that all paths related to calling ieee80211_rx_mgmt_assoc_resp
managed to consume the bss.

I haven't figured out yet why this is not an erroneous put since I didn't
find the reference taken in the first place.

I'm going to work on making some changes to the ref counting scheme
a bit.  I'd rather have the code perhaps take and put a few refs
it might otherwise skip to keep the ownership cleaner and make
the code easier to debug and understand...

I'll post some for RFC when I make some progress.

Thanks,
Ben


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


^ permalink raw reply

* Re: ath3k hackery; doing it in userland
From: Adrian Chadd @ 2013-06-17 19:05 UTC (permalink / raw)
  To: Julian Calaby; +Cc: linux-wireless
In-Reply-To: <CAGRGNgWJr=EahOWeQxpchCAyv5di-WnwyL9hvJa3XYFf64OSxg@mail.gmail.com>

On 16 June 2013 23:35, Julian Calaby <julian.calaby@gmail.com> wrote:

> A further question: why isn't this in usb-modeswitch or some similar
> "make my dumb USB device work" system?

Well, there's a couple of hoops needed to jump through in order to
make this thing work. It's not a "set this value to make it work",
it's "upload this firmware blob to make this thing work."

I don't have any clue what the right order is to poke these BT devices
(and even when i was working at QCA, finding documentation on the
bluetooth devices was difficult!) and how they should behave. This
whole "it detaches right after I load the sysconfig file" thing is
quite annoying.



adrian

^ permalink raw reply

* Re: Lots of confusion on bss refcounting.
From: Johannes Berg @ 2013-06-17 19:02 UTC (permalink / raw)
  To: Ben Greear; +Cc: linux-wireless@vger.kernel.org
In-Reply-To: <51BF5A53.8050100@candelatech.com>

On Mon, 2013-06-17 at 11:49 -0700, Ben Greear wrote:

> We create an assoc_data, assign a bss pointer in ieee80211_mgd_assoc,
> but do not claim a reference.

Heh, yeah, I was actually looking at this code too but didn't have time
today to finish my thoughts ...

> Later, when deleting the assoc_data, the ref is not freed either,
> except in one error path where it is explicitly freed:
> 
> 		if (!ieee80211_assoc_success(sdata, *bss, mgmt, len)) {
> 			/* oops -- internal error -- send timeout for now */
> 			ieee80211_destroy_assoc_data(sdata, false);
> 			cfg80211_put_bss(sdata->local->hw.wiphy, *bss);
> 			return RX_MGMT_CFG80211_ASSOC_TIMEOUT;
> 		}
> 
> This seems ripe for bugs, if not already buggy.
> 
> Maybe we should be more explicit about always grabbing a ref when
> we take a reference to the pointer, and always put it when we
> destroy the pointer?

I think the reference is actually given to mac80211 by cfg80211 in
cfg80211_mlme_assoc(), so we shouldn't need to grab a reference?
Although I'm certainly willing to change this and make cfg80211 always
put the reference after calling rdev_assoc() so that the driver/mac80211
would be responsible for obtaining its own if it needs to hang on to the
struct.

This does seem broken though.

johannes


^ permalink raw reply

* Lots of confusion on bss refcounting.
From: Ben Greear @ 2013-06-17 18:49 UTC (permalink / raw)
  To: linux-wireless@vger.kernel.org

More on looking for bss and ies leaks...

I am trying to understand the bss refcounting, but everywhere I
look it seems like the code is weird at best.

For instance:

We create an assoc_data, assign a bss pointer in ieee80211_mgd_assoc,
but do not claim a reference.

Later, when deleting the assoc_data, the ref is not freed either,
except in one error path where it is explicitly freed:

		if (!ieee80211_assoc_success(sdata, *bss, mgmt, len)) {
			/* oops -- internal error -- send timeout for now */
			ieee80211_destroy_assoc_data(sdata, false);
			cfg80211_put_bss(sdata->local->hw.wiphy, *bss);
			return RX_MGMT_CFG80211_ASSOC_TIMEOUT;
		}

This seems ripe for bugs, if not already buggy.

Maybe we should be more explicit about always grabbing a ref when
we take a reference to the pointer, and always put it when we
destroy the pointer?

I'll be happy to cook up some patches if this seems like the right
path to take.

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


^ permalink raw reply

* pull request: wireless 2013-06-17
From: John W. Linville @ 2013-06-17 18:27 UTC (permalink / raw)
  To: davem; +Cc: linux-wireless, netdev, linux-kernel

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

Dave,

This will probably be the last batch of wireless fixes intended
for 3.10.  Many of these are one- or two-liners, and a couple of
others are mostly relocating existing code to avoid races or to
limit the code to effecting specific hardware, etc.

The mac80211 fixes have a couple of exceptions to the above.
Regarding those, Johannes says:

"Following davem's complaint about my patch, here's a new pull request
w/o the patch he was complaining about, but instead with the const
fix rolled into the fix.

I have a fix for radar detection, one for rate control and a workaround
for broken HT APs which is a regression fix because we didn't rely
on them to be correct before."

Johannes also sends some iwlwifi fixes:

"I picked up Nikolay's patch for the chain noise calibration bug
that seems to have been there forever, a fix from Emmanuel for
setting TX flags on BAR frames and a fix of my own to avoid printing
request_module() errors if the kernel isn't even modular. We also
have our own version of Stanislaw's fix for rate control."

Along with those...

Anderson Lizardo fixes a Bluetooth memory corruption bug when an MTU
value is set to too small of a value.

Arend van Spriel sends a revised brcmsmac bug that fixes a regression
caused by a bad return value in an earlier patch.  He also sends a
brcmfmac fix to avoid an oops when loading the driver at boot.

Daniel Drake fixes a race condition in btmrvl that causes hangs on
suspend for OLPC hardware.

Johan Hedberg adds a check to avoid sending a
HCI_Delete_Stored_Link_Key command to devices that don't support them,
avoiding some scary looking log spam.

Stanislaw Gruszka gives us a fix for iwlegacy to be able to use rates
higher than 1Mb/s on older wireless networks.  He also sends an rt2x00
fix to reinstate older tx power handling behavior for some devices
that didn't work well with the current code.

Please let me know if there are problems!  If you don't want to
pull this batch for 3.10, then I will go ahead and pull them into
wireless-next...

John

---

The following changes since commit 8177a9d79c0e942dcac3312f15585d0344d505a5:

  lseek(fd, n, SEEK_END) does *not* go to eof - n (2013-06-16 08:10:53 -1000)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git for-davem

for you to fetch changes up to 722a300bf84ebebe21da164e75024c0ce7ca1868:

  Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless into for-davem (2013-06-17 13:44:01 -0400)

----------------------------------------------------------------

Anderson Lizardo (1):
      Bluetooth: Fix crash in l2cap_build_cmd() with small MTU

Arend van Spriel (2):
      brcmsmac: disable power-save related functions
      brcmfmac: free primary net_device when brcmf_bus_start() fails

Daniel Drake (1):
      Bluetooth: btmrvl: fix thread stopping race

Emmanuel Grumbach (1):
      iwlwifi: mvm: correctly set the flags for BAR

Johan Hedberg (1):
      Bluetooth: Fix conditions for HCI_Delete_Stored_Link_Key

Johannes Berg (2):
      iwlwifi: don't print module loading error if not modular
      mac80211: work around broken APs not including HT info

John W. Linville (3):
      Merge branch 'for-john' of git://git.kernel.org/.../jberg/mac80211
      Merge branch 'for-john' of git://git.kernel.org/.../iwlwifi/iwlwifi-fixes
      Merge branch 'master' of git://git.kernel.org/.../linville/wireless into for-davem

Moshe Benji (1):
      iwlwifi: fix rate control regression

Nikolay Martynov (1):
      iwlwifi: dvm: fix chain noise calibration

Simon Wunderlich (2):
      mac80211: abort CAC in stop_ap()
      mac80211: Fix rate control mask matching call

Stanislaw Gruszka (2):
      iwlegacy: fix rate control regression
      rt2800: fix RT5390 & RT3290 TX power settings regression

 drivers/bluetooth/btmrvl_main.c                    |  9 +--
 .../net/wireless/brcm80211/brcmfmac/dhd_linux.c    |  4 +
 drivers/net/wireless/brcm80211/brcmsmac/main.c     | 17 +----
 drivers/net/wireless/iwlegacy/3945-rs.c            |  1 +
 drivers/net/wireless/iwlegacy/4965-rs.c            |  2 +-
 drivers/net/wireless/iwlwifi/dvm/rs.c              |  2 +-
 drivers/net/wireless/iwlwifi/dvm/rxon.c            |  2 +-
 drivers/net/wireless/iwlwifi/iwl-drv.c             |  2 +
 drivers/net/wireless/iwlwifi/mvm/rs.c              |  1 +
 drivers/net/wireless/iwlwifi/mvm/tx.c              |  3 +-
 drivers/net/wireless/rt2x00/rt2800lib.c            | 29 +++++---
 net/bluetooth/hci_core.c                           | 15 ++--
 net/bluetooth/l2cap_core.c                         |  3 +
 net/mac80211/cfg.c                                 |  6 ++
 net/mac80211/ieee80211_i.h                         |  5 +-
 net/mac80211/mlme.c                                | 87 ++++++++++++++++++++--
 net/mac80211/rate.c                                |  2 +-
 net/mac80211/util.c                                |  4 +-
 18 files changed, 142 insertions(+), 52 deletions(-)

diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c
index 3a4343b..9a9f518 100644
--- a/drivers/bluetooth/btmrvl_main.c
+++ b/drivers/bluetooth/btmrvl_main.c
@@ -498,6 +498,10 @@ static int btmrvl_service_main_thread(void *data)
 		add_wait_queue(&thread->wait_q, &wait);
 
 		set_current_state(TASK_INTERRUPTIBLE);
+		if (kthread_should_stop()) {
+			BT_DBG("main_thread: break from main thread");
+			break;
+		}
 
 		if (adapter->wakeup_tries ||
 				((!adapter->int_count) &&
@@ -513,11 +517,6 @@ static int btmrvl_service_main_thread(void *data)
 
 		BT_DBG("main_thread woke up");
 
-		if (kthread_should_stop()) {
-			BT_DBG("main_thread: break from main thread");
-			break;
-		}
-
 		spin_lock_irqsave(&priv->driver_lock, flags);
 		if (adapter->int_count) {
 			adapter->int_count = 0;
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
index b98f223..2c59357 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
@@ -930,6 +930,10 @@ fail:
 			brcmf_fws_del_interface(ifp);
 			brcmf_fws_deinit(drvr);
 		}
+		if (drvr->iflist[0]) {
+			free_netdev(ifp->ndev);
+			drvr->iflist[0] = NULL;
+		}
 		if (p2p_ifp) {
 			free_netdev(p2p_ifp->ndev);
 			drvr->iflist[1] = NULL;
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index 28e7aee..9fd6f2f 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -3074,21 +3074,8 @@ static void brcms_b_antsel_set(struct brcms_hardware *wlc_hw, u32 antsel_avail)
  */
 static bool brcms_c_ps_allowed(struct brcms_c_info *wlc)
 {
-	/* disallow PS when one of the following global conditions meets */
-	if (!wlc->pub->associated)
-		return false;
-
-	/* disallow PS when one of these meets when not scanning */
-	if (wlc->filter_flags & FIF_PROMISC_IN_BSS)
-		return false;
-
-	if (wlc->bsscfg->type == BRCMS_TYPE_AP)
-		return false;
-
-	if (wlc->bsscfg->type == BRCMS_TYPE_ADHOC)
-		return false;
-
-	return true;
+	/* not supporting PS so always return false for now */
+	return false;
 }
 
 static void brcms_c_statsupd(struct brcms_c_info *wlc)
diff --git a/drivers/net/wireless/iwlegacy/3945-rs.c b/drivers/net/wireless/iwlegacy/3945-rs.c
index c9f197d..fe31590 100644
--- a/drivers/net/wireless/iwlegacy/3945-rs.c
+++ b/drivers/net/wireless/iwlegacy/3945-rs.c
@@ -816,6 +816,7 @@ out:
 		rs_sta->last_txrate_idx = idx;
 		info->control.rates[0].idx = rs_sta->last_txrate_idx;
 	}
+	info->control.rates[0].count = 1;
 
 	D_RATE("leave: %d\n", idx);
 }
diff --git a/drivers/net/wireless/iwlegacy/4965-rs.c b/drivers/net/wireless/iwlegacy/4965-rs.c
index 1fc0b22..ed3c42a 100644
--- a/drivers/net/wireless/iwlegacy/4965-rs.c
+++ b/drivers/net/wireless/iwlegacy/4965-rs.c
@@ -2268,7 +2268,7 @@ il4965_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
 		info->control.rates[0].flags = 0;
 	}
 	info->control.rates[0].idx = rate_idx;
-
+	info->control.rates[0].count = 1;
 }
 
 static void *
diff --git a/drivers/net/wireless/iwlwifi/dvm/rs.c b/drivers/net/wireless/iwlwifi/dvm/rs.c
index 907bd6e..10fbb17 100644
--- a/drivers/net/wireless/iwlwifi/dvm/rs.c
+++ b/drivers/net/wireless/iwlwifi/dvm/rs.c
@@ -2799,7 +2799,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
 		info->control.rates[0].flags = 0;
 	}
 	info->control.rates[0].idx = rate_idx;
-
+	info->control.rates[0].count = 1;
 }
 
 static void *rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta,
diff --git a/drivers/net/wireless/iwlwifi/dvm/rxon.c b/drivers/net/wireless/iwlwifi/dvm/rxon.c
index 707446f..cd1ad001 100644
--- a/drivers/net/wireless/iwlwifi/dvm/rxon.c
+++ b/drivers/net/wireless/iwlwifi/dvm/rxon.c
@@ -1378,7 +1378,7 @@ static void iwlagn_chain_noise_reset(struct iwl_priv *priv)
 	struct iwl_chain_noise_data *data = &priv->chain_noise_data;
 	int ret;
 
-	if (!(priv->calib_disabled & IWL_CHAIN_NOISE_CALIB_DISABLED))
+	if (priv->calib_disabled & IWL_CHAIN_NOISE_CALIB_DISABLED)
 		return;
 
 	if ((data->state == IWL_CHAIN_NOISE_ALIVE) &&
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c b/drivers/net/wireless/iwlwifi/iwl-drv.c
index 39aad98..40fed1f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/iwlwifi/iwl-drv.c
@@ -1000,10 +1000,12 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
 	 */
 	if (load_module) {
 		err = request_module("%s", op->name);
+#ifdef CONFIG_IWLWIFI_OPMODE_MODULAR
 		if (err)
 			IWL_ERR(drv,
 				"failed to load module %s (error %d), is dynamic loading enabled?\n",
 				op->name, err);
+#endif
 	}
 	return;
 
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c
index 55334d5..b99fe31 100644
--- a/drivers/net/wireless/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/rs.c
@@ -2546,6 +2546,7 @@ static void rs_get_rate(void *mvm_r, struct ieee80211_sta *sta, void *mvm_sta,
 		info->control.rates[0].flags = 0;
 	}
 	info->control.rates[0].idx = rate_idx;
+	info->control.rates[0].count = 1;
 }
 
 static void *rs_alloc_sta(void *mvm_rate, struct ieee80211_sta *sta,
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c
index f212f16..48c1891 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c
@@ -180,7 +180,8 @@ static void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm,
 		tx_cmd->tx_flags |= cpu_to_le32(TX_CMD_FLG_STA_RATE);
 		return;
 	} else if (ieee80211_is_back_req(fc)) {
-		tx_cmd->tx_flags |= cpu_to_le32(TX_CMD_FLG_STA_RATE);
+		tx_cmd->tx_flags |=
+			cpu_to_le32(TX_CMD_FLG_ACK | TX_CMD_FLG_BAR);
 	}
 
 	/* HT rate doesn't make sense for a non data frame */
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index b52d70c..72f32e5 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -3027,19 +3027,26 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev,
 	 * TODO: we do not use +6 dBm option to do not increase power beyond
 	 * regulatory limit, however this could be utilized for devices with
 	 * CAPABILITY_POWER_LIMIT.
+	 *
+	 * TODO: add different temperature compensation code for RT3290 & RT5390
+	 * to allow to use BBP_R1 for those chips.
 	 */
-	rt2800_bbp_read(rt2x00dev, 1, &r1);
-	if (delta <= -12) {
-		power_ctrl = 2;
-		delta += 12;
-	} else if (delta <= -6) {
-		power_ctrl = 1;
-		delta += 6;
-	} else {
-		power_ctrl = 0;
+	if (!rt2x00_rt(rt2x00dev, RT3290) &&
+	    !rt2x00_rt(rt2x00dev, RT5390)) {
+		rt2800_bbp_read(rt2x00dev, 1, &r1);
+		if (delta <= -12) {
+			power_ctrl = 2;
+			delta += 12;
+		} else if (delta <= -6) {
+			power_ctrl = 1;
+			delta += 6;
+		} else {
+			power_ctrl = 0;
+		}
+		rt2x00_set_field8(&r1, BBP1_TX_POWER_CTRL, power_ctrl);
+		rt2800_bbp_write(rt2x00dev, 1, r1);
 	}
-	rt2x00_set_field8(&r1, BBP1_TX_POWER_CTRL, power_ctrl);
-	rt2800_bbp_write(rt2x00dev, 1, r1);
+
 	offset = TX_PWR_CFG_0;
 
 	for (i = 0; i < EEPROM_TXPOWER_BYRATE_SIZE; i += 2) {
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index d817c93..ace5e55 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -341,7 +341,6 @@ static void hci_init1_req(struct hci_request *req, unsigned long opt)
 
 static void bredr_setup(struct hci_request *req)
 {
-	struct hci_cp_delete_stored_link_key cp;
 	__le16 param;
 	__u8 flt_type;
 
@@ -365,10 +364,6 @@ static void bredr_setup(struct hci_request *req)
 	param = __constant_cpu_to_le16(0x7d00);
 	hci_req_add(req, HCI_OP_WRITE_CA_TIMEOUT, 2, &param);
 
-	bacpy(&cp.bdaddr, BDADDR_ANY);
-	cp.delete_all = 0x01;
-	hci_req_add(req, HCI_OP_DELETE_STORED_LINK_KEY, sizeof(cp), &cp);
-
 	/* Read page scan parameters */
 	if (req->hdev->hci_ver > BLUETOOTH_VER_1_1) {
 		hci_req_add(req, HCI_OP_READ_PAGE_SCAN_ACTIVITY, 0, NULL);
@@ -602,6 +597,16 @@ static void hci_init3_req(struct hci_request *req, unsigned long opt)
 	struct hci_dev *hdev = req->hdev;
 	u8 p;
 
+	/* Only send HCI_Delete_Stored_Link_Key if it is supported */
+	if (hdev->commands[6] & 0x80) {
+		struct hci_cp_delete_stored_link_key cp;
+
+		bacpy(&cp.bdaddr, BDADDR_ANY);
+		cp.delete_all = 0x01;
+		hci_req_add(req, HCI_OP_DELETE_STORED_LINK_KEY,
+			    sizeof(cp), &cp);
+	}
+
 	if (hdev->commands[5] & 0x10)
 		hci_setup_link_policy(req);
 
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 24bee07..4be6a26 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -2852,6 +2852,9 @@ static struct sk_buff *l2cap_build_cmd(struct l2cap_conn *conn, u8 code,
 	BT_DBG("conn %p, code 0x%2.2x, ident 0x%2.2x, len %u",
 	       conn, code, ident, dlen);
 
+	if (conn->mtu < L2CAP_HDR_SIZE + L2CAP_CMD_HDR_SIZE)
+		return NULL;
+
 	len = L2CAP_HDR_SIZE + L2CAP_CMD_HDR_SIZE + dlen;
 	count = min_t(unsigned int, conn->mtu, len);
 
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 1a89c80..4fdb306e 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1057,6 +1057,12 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
 	clear_bit(SDATA_STATE_OFFCHANNEL_BEACON_STOPPED, &sdata->state);
 	ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED);
 
+	if (sdata->wdev.cac_started) {
+		cancel_delayed_work_sync(&sdata->dfs_cac_timer_work);
+		cfg80211_cac_event(sdata->dev, NL80211_RADAR_CAC_ABORTED,
+				   GFP_KERNEL);
+	}
+
 	drv_stop_ap(sdata->local, sdata);
 
 	/* free all potentially still buffered bcast frames */
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 44be28c..9ca8e32 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1497,10 +1497,11 @@ static inline void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata,
 	ieee80211_tx_skb_tid(sdata, skb, 7);
 }
 
-u32 ieee802_11_parse_elems_crc(u8 *start, size_t len, bool action,
+u32 ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action,
 			       struct ieee802_11_elems *elems,
 			       u64 filter, u32 crc);
-static inline void ieee802_11_parse_elems(u8 *start, size_t len, bool action,
+static inline void ieee802_11_parse_elems(const u8 *start, size_t len,
+					  bool action,
 					  struct ieee802_11_elems *elems)
 {
 	ieee802_11_parse_elems_crc(start, len, action, elems, 0, 0);
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index a8c2130..741448b 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -2522,8 +2522,11 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
 	u16 capab_info, aid;
 	struct ieee802_11_elems elems;
 	struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf;
+	const struct cfg80211_bss_ies *bss_ies = NULL;
+	struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data;
 	u32 changed = 0;
 	int err;
+	bool ret;
 
 	/* AssocResp and ReassocResp have identical structure */
 
@@ -2555,21 +2558,86 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
 	ifmgd->aid = aid;
 
 	/*
+	 * Some APs are erroneously not including some information in their
+	 * (re)association response frames. Try to recover by using the data
+	 * from the beacon or probe response. This seems to afflict mobile
+	 * 2G/3G/4G wifi routers, reported models include the "Onda PN51T",
+	 * "Vodafone PocketWiFi 2", "ZTE MF60" and a similar T-Mobile device.
+	 */
+	if ((assoc_data->wmm && !elems.wmm_param) ||
+	    (!(ifmgd->flags & IEEE80211_STA_DISABLE_HT) &&
+	     (!elems.ht_cap_elem || !elems.ht_operation)) ||
+	    (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT) &&
+	     (!elems.vht_cap_elem || !elems.vht_operation))) {
+		const struct cfg80211_bss_ies *ies;
+		struct ieee802_11_elems bss_elems;
+
+		rcu_read_lock();
+		ies = rcu_dereference(cbss->ies);
+		if (ies)
+			bss_ies = kmemdup(ies, sizeof(*ies) + ies->len,
+					  GFP_ATOMIC);
+		rcu_read_unlock();
+		if (!bss_ies)
+			return false;
+
+		ieee802_11_parse_elems(bss_ies->data, bss_ies->len,
+				       false, &bss_elems);
+		if (assoc_data->wmm &&
+		    !elems.wmm_param && bss_elems.wmm_param) {
+			elems.wmm_param = bss_elems.wmm_param;
+			sdata_info(sdata,
+				   "AP bug: WMM param missing from AssocResp\n");
+		}
+
+		/*
+		 * Also check if we requested HT/VHT, otherwise the AP doesn't
+		 * have to include the IEs in the (re)association response.
+		 */
+		if (!elems.ht_cap_elem && bss_elems.ht_cap_elem &&
+		    !(ifmgd->flags & IEEE80211_STA_DISABLE_HT)) {
+			elems.ht_cap_elem = bss_elems.ht_cap_elem;
+			sdata_info(sdata,
+				   "AP bug: HT capability missing from AssocResp\n");
+		}
+		if (!elems.ht_operation && bss_elems.ht_operation &&
+		    !(ifmgd->flags & IEEE80211_STA_DISABLE_HT)) {
+			elems.ht_operation = bss_elems.ht_operation;
+			sdata_info(sdata,
+				   "AP bug: HT operation missing from AssocResp\n");
+		}
+		if (!elems.vht_cap_elem && bss_elems.vht_cap_elem &&
+		    !(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) {
+			elems.vht_cap_elem = bss_elems.vht_cap_elem;
+			sdata_info(sdata,
+				   "AP bug: VHT capa missing from AssocResp\n");
+		}
+		if (!elems.vht_operation && bss_elems.vht_operation &&
+		    !(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) {
+			elems.vht_operation = bss_elems.vht_operation;
+			sdata_info(sdata,
+				   "AP bug: VHT operation missing from AssocResp\n");
+		}
+	}
+
+	/*
 	 * We previously checked these in the beacon/probe response, so
 	 * they should be present here. This is just a safety net.
 	 */
 	if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HT) &&
 	    (!elems.wmm_param || !elems.ht_cap_elem || !elems.ht_operation)) {
 		sdata_info(sdata,
-			   "HT AP is missing WMM params or HT capability/operation in AssocResp\n");
-		return false;
+			   "HT AP is missing WMM params or HT capability/operation\n");
+		ret = false;
+		goto out;
 	}
 
 	if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT) &&
 	    (!elems.vht_cap_elem || !elems.vht_operation)) {
 		sdata_info(sdata,
-			   "VHT AP is missing VHT capability/operation in AssocResp\n");
-		return false;
+			   "VHT AP is missing VHT capability/operation\n");
+		ret = false;
+		goto out;
 	}
 
 	mutex_lock(&sdata->local->sta_mtx);
@@ -2580,7 +2648,8 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
 	sta = sta_info_get(sdata, cbss->bssid);
 	if (WARN_ON(!sta)) {
 		mutex_unlock(&sdata->local->sta_mtx);
-		return false;
+		ret = false;
+		goto out;
 	}
 
 	sband = local->hw.wiphy->bands[ieee80211_get_sdata_band(sdata)];
@@ -2633,7 +2702,8 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
 			   sta->sta.addr);
 		WARN_ON(__sta_info_destroy(sta));
 		mutex_unlock(&sdata->local->sta_mtx);
-		return false;
+		ret = false;
+		goto out;
 	}
 
 	mutex_unlock(&sdata->local->sta_mtx);
@@ -2673,7 +2743,10 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
 	ieee80211_sta_rx_notify(sdata, (struct ieee80211_hdr *)mgmt);
 	ieee80211_sta_reset_beacon_monitor(sdata);
 
-	return true;
+	ret = true;
+ out:
+	kfree(bss_ies);
+	return ret;
 }
 
 static enum rx_mgmt_action __must_check
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index d3f414f..a02bef3 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -615,7 +615,7 @@ static void rate_control_apply_mask(struct ieee80211_sub_if_data *sdata,
 		if (rates[i].idx < 0)
 			break;
 
-		rate_idx_match_mask(&rates[i], sband, mask, chan_width,
+		rate_idx_match_mask(&rates[i], sband, chan_width, mask,
 				    mcs_mask);
 	}
 }
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 27e0715..72e6292 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -661,12 +661,12 @@ void ieee80211_queue_delayed_work(struct ieee80211_hw *hw,
 }
 EXPORT_SYMBOL(ieee80211_queue_delayed_work);
 
-u32 ieee802_11_parse_elems_crc(u8 *start, size_t len, bool action,
+u32 ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action,
 			       struct ieee802_11_elems *elems,
 			       u64 filter, u32 crc)
 {
 	size_t left = len;
-	u8 *pos = start;
+	const u8 *pos = start;
 	bool calc_crc = filter != 0;
 	DECLARE_BITMAP(seen_elems, 256);
 	const u8 *ie;
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply related

* [PATCH] rtlwifi: rtl8192cu: Add new USB ID for TP-Link TL-WN8200ND
From: Larry Finger @ 2013-06-17 18:25 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Larry Finger, netdev, Tobias Kluge, Stable

This is a new device for this driver.

Reported-by: Tobias Kluge <zielscheibe@gmail.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Tobias Kluge <zielscheibe@gmail.com>
Cc: Stable <stable@vger.kernel.org>
---
 drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index 826f085..2bd5985 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -359,6 +359,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
 	{RTL_USB_DEVICE(0x2001, 0x330a, rtl92cu_hal_cfg)}, /*D-Link-Alpha*/
 	{RTL_USB_DEVICE(0x2019, 0xab2b, rtl92cu_hal_cfg)}, /*Planex -Abocom*/
 	{RTL_USB_DEVICE(0x20f4, 0x624d, rtl92cu_hal_cfg)}, /*TRENDNet*/
+	{RTL_USB_DEVICE(0x2357, 0x0100, rtl92cu_hal_cfg)}, /*TP-Link WN8200ND*/
 	{RTL_USB_DEVICE(0x7392, 0x7822, rtl92cu_hal_cfg)}, /*Edimax -Edimax*/
 	{}
 };
-- 
1.8.1.4


^ permalink raw reply related

* Re: rtl8192cu fail to connect with a AP
From: Larry Finger @ 2013-06-17 18:12 UTC (permalink / raw)
  To: Tobias Kluge; +Cc: linux-wireless
In-Reply-To: <loom.20130617T185506-165@post.gmane.org>

On 06/17/2013 12:03 PM, Tobias Kluge wrote:
>
> compiled the latest stable kernel (3.9.6) with your fixed device table, the
> dongle is now recognized properly, when the module (rtl8192cu) is loaded.
> The connection issue to any AP still remains, with the same dmesg output. I
> don't believe that the changes you mentioned in 3.10.0-rc6 are the trouble
> makers with this device. I tried many different kernels before (3.26, 3.8.0
> binaries from the Ubuntu sources, 3.9.6, 3.10.0-rc6 build from scratch). I
> hope you can see some possibilities to fix this problem.

The changes in 3.10-rc6 *fix* many problems. They are not the source of them.

Using the wireless-testing tree, my RTL8188RU will connect to a WPA2/AES AP. It 
authenticates and associates with WPA1/TKIP and WEP APs, but there is no data 
throughput. To me this indicates a problem with the wireless keys. I have no 
idea (yet) why some chips are different than others.


Larry


^ permalink raw reply

* [PATCH] ssb: add struct for serial flash
From: Rafał Miłecki @ 2013-06-17 17:56 UTC (permalink / raw)
  To: linux-wireless, John W. Linville; +Cc: Hauke Mehrtens, Rafał Miłecki

This data allow writing for example MTD driver.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 drivers/ssb/driver_chipcommon_sflash.c |    7 +++++++
 include/linux/ssb/ssb_driver_mips.h    |   15 +++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/drivers/ssb/driver_chipcommon_sflash.c b/drivers/ssb/driver_chipcommon_sflash.c
index 1b9e770..205f1c4 100644
--- a/drivers/ssb/driver_chipcommon_sflash.c
+++ b/drivers/ssb/driver_chipcommon_sflash.c
@@ -73,6 +73,7 @@ static void ssb_sflash_cmd(struct ssb_chipcommon *cc, u32 opcode)
 /* Initialize serial flash access */
 int ssb_sflash_init(struct ssb_chipcommon *cc)
 {
+	struct ssb_sflash *sflash = &cc->dev->bus->mipscore.sflash;
 	const struct ssb_sflash_tbl_e *e;
 	u32 id, id2;
 
@@ -131,6 +132,12 @@ int ssb_sflash_init(struct ssb_chipcommon *cc)
 		return -ENOTSUPP;
 	}
 
+	sflash->window = SSB_FLASH2;
+	sflash->blocksize = e->blocksize;
+	sflash->numblocks = e->numblocks;
+	sflash->size = sflash->blocksize * sflash->numblocks;
+	sflash->present = true;
+
 	pr_info("Found %s serial flash (blocksize: 0x%X, blocks: %d)\n",
 		e->name, e->blocksize, e->numblocks);
 
diff --git a/include/linux/ssb/ssb_driver_mips.h b/include/linux/ssb/ssb_driver_mips.h
index afe79d4..6535e47 100644
--- a/include/linux/ssb/ssb_driver_mips.h
+++ b/include/linux/ssb/ssb_driver_mips.h
@@ -20,6 +20,18 @@ struct ssb_pflash {
 	u32 window_size;
 };
 
+#ifdef CONFIG_SSB_SFLASH
+struct ssb_sflash {
+	bool present;
+	u32 window;
+	u32 blocksize;
+	u16 numblocks;
+	u32 size;
+
+	void *priv;
+};
+#endif
+
 struct ssb_mipscore {
 	struct ssb_device *dev;
 
@@ -27,6 +39,9 @@ struct ssb_mipscore {
 	struct ssb_serial_port serial_ports[4];
 
 	struct ssb_pflash pflash;
+#ifdef CONFIG_SSB_SFLASH
+	struct ssb_sflash sflash;
+#endif
 };
 
 extern void ssb_mipscore_init(struct ssb_mipscore *mcore);
-- 
1.7.10.4


^ permalink raw reply related

* Re: [RFC PATCH] net: brcmfmac: add sdio chip id 0x4319
From: Jason Cooper @ 2013-06-17 17:51 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: Franky Lin, rvossen, arend, linux-wireless
In-Reply-To: <CACna6ryw=QeD5OuMWYoZLYzt9CBo+PO-SwygDY+SUaVxCYu0jA@mail.gmail.com>

On Mon, Jun 17, 2013 at 07:45:25PM +0200, Rafał Miłecki wrote:
> 2013/6/17 Franky Lin <frankyl@broadcom.com>:
> > On 06/17/2013 09:19 AM, Jason Cooper wrote:
> >>
> >> Added Franky...
> >>
> >> On Wed, Jun 12, 2013 at 06:21:23PM -0400, Jason Cooper wrote:
> >>>
> >>> All,
> >>>
> >>> I have a Seagate Wireless Plus I am trying to put a vanilla kernel on
> >>> (currently v3.10-rc5 for various omap DT bits).
> >>>
> >>> I have the board booting and running a debian rootfs on the HD.  I just
> >>> got mmc to come up and I've discovered that the wireless card is vendor
> >>> 0x02d0, device 0x4319.
> >>>
> >>> My hope, once I got to this point, was that I would be able to use
> >>> the mainline, open source driver.  Unfortunately, it looks like brcmfmac
> >>> lost support for the 0x4319 while it was in staging.
> >>>
> >>> The commit in question is:
> >>>
> >>>    4dad253 staging: brcm80211: remove code for unsupported chip
> >>>
> >>> Is adding it back in a bridge too far?
> >>
> >> It looks like only two things are needed, adding the chip id and then
> >> setting the addresses.  Here's a preliminary patch to do just that.
> >> Note, the addresses I have used are a straight copy from the 4329.  It
> >> causes this:
> >>
> >> [   12.346466] mmcblk mmc0:0001: no of_node; not parsing pinctrl DT
> >> [   12.353149] brcmfmac_sdio mmc0:0001:1: no of_node; not parsing pinctrl
> >> DT
> >> [   12.360717] brcmfmac_sdio mmc0:0001:2: no of_node; not parsing pinctrl
> >> DT
> >> [   12.368804] brcmfmac: brcmf_sdio_chip_drivestrengthinit: No SDIO Drive
> >> strength init done for chip 4319 rev 1 pmurev 7
> >> [   12.380462] brcmfmac: brcmf_sdioh_request_byte: Failed to write byte
> >> F0:@0x00408=03, Err: -22
> >> [   12.391906] brcmfmac: brcmf_sdioh_request_byte: Failed to write byte
> >> F0:@0x00408=03, Err: -22
> >> [   12.403289] brcmfmac: brcmf_sdioh_request_byte: Failed to write byte
> >> F0:@0x00408=03, Err: -22
> >> [   12.412261] brcmfmac: brcmf_sdio_regrw_helper: failed with -22
> >> [   12.418457] brcmfmac: brcmf_sdioh_request_byte: Failed to write byte
> >> F0:@0x00408=01, Err: -22
> >> [   12.429718] brcmfmac: brcmf_sdioh_request_byte: Failed to write byte
> >> F0:@0x00408=01, Err: -22
> >> [   12.441101] brcmfmac: brcmf_sdioh_request_byte: Failed to write byte
> >> F0:@0x00408=01, Err: -22
> >> [   12.450073] brcmfmac: brcmf_sdio_regrw_helper: failed with -22
> >>
> >> I've taken a quick look at aosp, the provided GPL broadcom code, and I
> >> haven't seen anything for the 4319 wrt to addresses.  How hard would it
> >> be to get those addresses from you guys?
> >
> >
> > Hi Jason,
> >
> > The major obstacle of adding 4319 support is the obsolete firmware. Since
> > it's an EOL chip we are not planning to add the support to brcmfmac.
> 
> Does it mean, BCM4319 is a "new architecture" chipset, working
> similarly to the already supported (in brcmfmac) chipsets?

In older versions of the broadcom driver 4329 and 4319 were in the same
code base.  There was minimal reference to 4319 beyond "I work with this
chip id".  Hence my attempt.

Now I'm wondering how much effort there would be to adding legacy
firmware support to brcmfmac.  I would only need AP mode to start with
(yeah, no big deal ;-) ).

thx,

Jason.

^ permalink raw reply

* Re: [RFC PATCH] net: brcmfmac: add sdio chip id 0x4319
From: Jason Cooper @ 2013-06-17 17:45 UTC (permalink / raw)
  To: Franky Lin; +Cc: rvossen, arend, linux-wireless
In-Reply-To: <51BF498F.1010007@broadcom.com>

On Mon, Jun 17, 2013 at 10:38:23AM -0700, Franky Lin wrote:
> On 06/17/2013 09:19 AM, Jason Cooper wrote:
> >Added Franky...
> >
> >On Wed, Jun 12, 2013 at 06:21:23PM -0400, Jason Cooper wrote:
> >>All,
> >>
> >>I have a Seagate Wireless Plus I am trying to put a vanilla kernel on
> >>(currently v3.10-rc5 for various omap DT bits).
> >>
> >>I have the board booting and running a debian rootfs on the HD.  I just
> >>got mmc to come up and I've discovered that the wireless card is vendor
> >>0x02d0, device 0x4319.
> >>
> >>My hope, once I got to this point, was that I would be able to use
> >>the mainline, open source driver.  Unfortunately, it looks like brcmfmac
> >>lost support for the 0x4319 while it was in staging.
> >>
> >>The commit in question is:
> >>
> >>   4dad253 staging: brcm80211: remove code for unsupported chip
> >>
> >>Is adding it back in a bridge too far?
> >It looks like only two things are needed, adding the chip id and then
> >setting the addresses.  Here's a preliminary patch to do just that.
> >Note, the addresses I have used are a straight copy from the 4329.  It
> >causes this:
> >
> >[   12.346466] mmcblk mmc0:0001: no of_node; not parsing pinctrl DT
> >[   12.353149] brcmfmac_sdio mmc0:0001:1: no of_node; not parsing pinctrl DT
> >[   12.360717] brcmfmac_sdio mmc0:0001:2: no of_node; not parsing pinctrl DT
> >[   12.368804] brcmfmac: brcmf_sdio_chip_drivestrengthinit: No SDIO Drive strength init done for chip 4319 rev 1 pmurev 7
> >[   12.380462] brcmfmac: brcmf_sdioh_request_byte: Failed to write byte F0:@0x00408=03, Err: -22
> >[   12.391906] brcmfmac: brcmf_sdioh_request_byte: Failed to write byte F0:@0x00408=03, Err: -22
> >[   12.403289] brcmfmac: brcmf_sdioh_request_byte: Failed to write byte F0:@0x00408=03, Err: -22
> >[   12.412261] brcmfmac: brcmf_sdio_regrw_helper: failed with -22
> >[   12.418457] brcmfmac: brcmf_sdioh_request_byte: Failed to write byte F0:@0x00408=01, Err: -22
> >[   12.429718] brcmfmac: brcmf_sdioh_request_byte: Failed to write byte F0:@0x00408=01, Err: -22
> >[   12.441101] brcmfmac: brcmf_sdioh_request_byte: Failed to write byte F0:@0x00408=01, Err: -22
> >[   12.450073] brcmfmac: brcmf_sdio_regrw_helper: failed with -22
> >
> >I've taken a quick look at aosp, the provided GPL broadcom code, and I
> >haven't seen anything for the 4319 wrt to addresses.  How hard would it
> >be to get those addresses from you guys?
> 
> Hi Jason,
> 
> The major obstacle of adding 4319 support is the obsolete firmware.
> Since it's an EOL chip we are not planning to add the support to
> brcmfmac.

Let me guess, the firmware would have to be updated to work with
brcmfmac?  What about adding a BRMCFMAC_LEGACY option to allow
interfacing with the old firmware?

It may be EOL, but new products are still shipping with this chip
(Wireless Plus, other Azurewave products).

thx,

Jason.

^ permalink raw reply

* Re: [RFC PATCH] net: brcmfmac: add sdio chip id 0x4319
From: Rafał Miłecki @ 2013-06-17 17:45 UTC (permalink / raw)
  To: Franky Lin; +Cc: Jason Cooper, rvossen, arend, linux-wireless
In-Reply-To: <51BF498F.1010007@broadcom.com>

2013/6/17 Franky Lin <frankyl@broadcom.com>:
> On 06/17/2013 09:19 AM, Jason Cooper wrote:
>>
>> Added Franky...
>>
>> On Wed, Jun 12, 2013 at 06:21:23PM -0400, Jason Cooper wrote:
>>>
>>> All,
>>>
>>> I have a Seagate Wireless Plus I am trying to put a vanilla kernel on
>>> (currently v3.10-rc5 for various omap DT bits).
>>>
>>> I have the board booting and running a debian rootfs on the HD.  I just
>>> got mmc to come up and I've discovered that the wireless card is vendor
>>> 0x02d0, device 0x4319.
>>>
>>> My hope, once I got to this point, was that I would be able to use
>>> the mainline, open source driver.  Unfortunately, it looks like brcmfmac
>>> lost support for the 0x4319 while it was in staging.
>>>
>>> The commit in question is:
>>>
>>>    4dad253 staging: brcm80211: remove code for unsupported chip
>>>
>>> Is adding it back in a bridge too far?
>>
>> It looks like only two things are needed, adding the chip id and then
>> setting the addresses.  Here's a preliminary patch to do just that.
>> Note, the addresses I have used are a straight copy from the 4329.  It
>> causes this:
>>
>> [   12.346466] mmcblk mmc0:0001: no of_node; not parsing pinctrl DT
>> [   12.353149] brcmfmac_sdio mmc0:0001:1: no of_node; not parsing pinctrl
>> DT
>> [   12.360717] brcmfmac_sdio mmc0:0001:2: no of_node; not parsing pinctrl
>> DT
>> [   12.368804] brcmfmac: brcmf_sdio_chip_drivestrengthinit: No SDIO Drive
>> strength init done for chip 4319 rev 1 pmurev 7
>> [   12.380462] brcmfmac: brcmf_sdioh_request_byte: Failed to write byte
>> F0:@0x00408=03, Err: -22
>> [   12.391906] brcmfmac: brcmf_sdioh_request_byte: Failed to write byte
>> F0:@0x00408=03, Err: -22
>> [   12.403289] brcmfmac: brcmf_sdioh_request_byte: Failed to write byte
>> F0:@0x00408=03, Err: -22
>> [   12.412261] brcmfmac: brcmf_sdio_regrw_helper: failed with -22
>> [   12.418457] brcmfmac: brcmf_sdioh_request_byte: Failed to write byte
>> F0:@0x00408=01, Err: -22
>> [   12.429718] brcmfmac: brcmf_sdioh_request_byte: Failed to write byte
>> F0:@0x00408=01, Err: -22
>> [   12.441101] brcmfmac: brcmf_sdioh_request_byte: Failed to write byte
>> F0:@0x00408=01, Err: -22
>> [   12.450073] brcmfmac: brcmf_sdio_regrw_helper: failed with -22
>>
>> I've taken a quick look at aosp, the provided GPL broadcom code, and I
>> haven't seen anything for the 4319 wrt to addresses.  How hard would it
>> be to get those addresses from you guys?
>
>
> Hi Jason,
>
> The major obstacle of adding 4319 support is the obsolete firmware. Since
> it's an EOL chip we are not planning to add the support to brcmfmac.

Does it mean, BCM4319 is a "new architecture" chipset, working
similarly to the already supported (in brcmfmac) chipsets?

When thinking about "old architecture" I mean BCM43236, which AFAIR
requires some different driver architecture with some extra memory
sharing or sth.

-- 
Rafał

^ permalink raw reply


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