Skip to contentSkip to conversation

rtlwifi: rtl8192su subdriver

WIP In review Joshua Roys 2 participants 25 messages May 3, 2012 – May 8, 2012 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

Hello all,

I would like to submit the work I have done so far on a native mac80211 driver for the RTL8192SU family of chips (91SU/88SU also). It builds off of the rtlwifi driver, especially the rtl8192se subdriver, as well as the r8712u and the deleted rtl8192su staging drivers.

The first few patches are enhancements or bug fixes to the rtlwifi core which I would like to get pulled upstream after review. The second to last patch is an ugly hack to allow subdrivers to register new/different features with mac80211 (hardware scanning, for instance). And the last patch adds the work done so far on rtl8192su.

As of now, the rtl8192su subdriver can initialize the hardware, load the firmware, setup bulk communication, and configure the RF/BB/PHY. There are a handful of FIXMEs scattered around the code, and many of the new FW commands still need to be implemented. The site survey FW command works quite well and returns available BSSIDs in the area. However, the firmware currently eats beacons and returns the scan results in a struct that will require some work to feed into mac80211.

(I'm too tired to setup git-send-email tonight, so please pardon the following manually sent patches which are not inlined.)

Joshua Roys

#1 lore raw

PATCH 1/9 rtlwifi: avoid race registering with mac80211

Quoted 1 line

From 3511cdf6c7d4388a21a4d36da423258e73a963b6 Mon Sep 17 00:00:00 2001

From: Joshua Roys <[email protected]>
Date: Wed, 2 May 2012 23:48:21 -0400
Subject: [PATCH 1/9] rtlwifi: avoid race registering with mac80211

Move the ieee80211_register_hw call out of the firmware callback. If the firmware is cached in memory, the callback could be called before rtl_init_core which configures the mac80211 bits.

---
 drivers/net/wireless/rtlwifi/base.c         |    9 +++++++++
 drivers/net/wireless/rtlwifi/core.c         |    9 ---------
 drivers/net/wireless/rtlwifi/rtl8192se/sw.c |    9 ---------
 3 files changed, 9 insertions(+), 18 deletions(-)
drivers/net/wireless/rtlwifi/base.c +9 -0
index e54488d..a08b408 100644
@@ -421,11 +421,20 @@ int rtl_init_core(struct ieee80211_hw *hw)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_mac *rtlmac = rtl_mac(rtl_priv(hw));
+	int err;
 
 	/* <1> init mac80211 */
 	_rtl_init_mac80211(hw);
 	rtlmac->hw = hw;
 
+	err = ieee80211_register_hw(hw);
+	if (err) {
+		RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
+			"Can't register mac80211 hw\n");
+		return 1;
+	}
+	rtlpriv->mac80211.mac80211_registered = 1;
+
 	/* <2> rate control register */
 	hw->rate_control_algorithm = "rtl_rc";
 
drivers/net/wireless/rtlwifi/core.c +0 -9
index 278e9f9..5f62b9d 100644
@@ -40,7 +40,6 @@ void rtl_fw_cb(const struct firmware *firmware, void *context)
 {
 	struct ieee80211_hw *hw = context;
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
-	int err;
 
 	RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD,
 			 "Firmware callback routine entered!\n");
@@ -60,14 +59,6 @@ void rtl_fw_cb(const struct firmware *firmware, void *context)
 	rtlpriv->rtlhal.fwsize = firmware->size;
 	release_firmware(firmware);
 
-	err = ieee80211_register_hw(hw);
-	if (err) {
-		RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
-			 "Can't register mac80211 hw\n");
-		return;
-	} else {
-		rtlpriv->mac80211.mac80211_registered = 1;
-	}
 	set_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status);
 
 	/*init rfkill */
drivers/net/wireless/rtlwifi/rtl8192se/sw.c +0 -9
index f1b3600..9739e24 100644
@@ -95,7 +95,6 @@ static void rtl92se_fw_cb(const struct firmware *firmware, void *context)
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_pci *rtlpci = rtl_pcidev(pcipriv);
 	struct rt_firmware *pfirmware = NULL;
-	int err;
 
 	RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD,
 			 "Firmware callback routine entered!\n");
@@ -117,14 +116,6 @@ static void rtl92se_fw_cb(const struct firmware *firmware, void *context)
 	pfirmware->sz_fw_tmpbufferlen = firmware->size;
 	release_firmware(firmware);
 
-	err = ieee80211_register_hw(hw);
-	if (err) {
-		RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
-			 "Can't register mac80211 hw\n");
-		return;
-	} else {
-		rtlpriv->mac80211.mac80211_registered = 1;
-	}
 	rtlpci->irq_alloc = 1;
 	set_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status);
 
Signature · 1 line
1.7.7.6
#2 lore raw

Re: [PATCH 1/9] rtlwifi: avoid race registering with mac80211

On 05/03/2012 12:10 AM, Joshua Roys wrote:

This patch is totally wrong. It is possible that there is a race condition, and it may be the source of the problem at
https://bugzilla.kernel.org/show_bug.cgi?id=43187, but this patch fails when the firmware is not cached. As a result, it prevents my box from booting.

I will try to find a fix for both conditions.

Larry

#3 lore raw

Re: [PATCH 1/9] rtlwifi: avoid race registering with mac80211

Quoted 9 lines · Larry Finger

On 05/03/2012 12:10 AM, Joshua Roys wrote:

This patch is totally wrong. It is possible that there is a race condition, and it may be the source of the problem at
https://bugzilla.kernel.org/show_bug.cgi?id=43187, but this patch fails when the firmware is not cached. As a result, it prevents my box from booting.

Quoted 4 lines

I will try to find a fix for both conditions.

Larry

Hm,

Sorry about that.

Do you think I should have moved the
set_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status);
lines also? Or is the idea of the patch just wrong?

Josh

#4 lore raw

Re: [PATCH 1/9] rtlwifi: avoid race registering with mac80211

Quoted 4 lines · Joshua Roys

Do you think I should have moved the set_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status); lines also? Or is the idea of the patch just wrong?

I am still thinking about the problem, but a few things are clear. There can be no ieee80211 callbacks until the firmware has been loaded from the file. On bootup when user-space code is not running, there will be a delay, which is the reason we switched to asynchronous fw loading. Thus, the call to ieee80211_register_hw() must not be done until the firmware is available.

If your analysis that the calling of rtl_init_core() is out of order, then the following should fix it:

drivers/net/wireless/rtlwifi/pci.c +8 -8
Index: wireless-testing-new/drivers/net/wireless/rtlwifi/pci.c
===================================================================
@@ -1853,14 +1853,6 @@ int __devinit rtl_pci_probe(struct pci_d
  	/*like read eeprom and so on */
  	rtlpriv->cfg->ops->read_eeprom_info(hw);
 
-	if (rtlpriv->cfg->ops->init_sw_vars(hw)) {
-		RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n");
-		err = -ENODEV;
-		goto fail3;
-	}
-
-	rtlpriv->cfg->ops->init_sw_leds(hw);
-
  	/*aspm */
  	rtl_pci_init_aspm(hw);
 
@@ -1879,6 +1871,14 @@ int __devinit rtl_pci_probe(struct pci_d
  		goto fail3;
  	}
 
+	if (rtlpriv->cfg->ops->init_sw_vars(hw)) {
+		RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n");
+		err = -ENODEV;
+		goto fail3;
+	}
+
+	rtlpriv->cfg->ops->init_sw_leds(hw);
+
  	err = sysfs_create_group(&pdev->dev.kobj, &rtl_attribute_group);
  	if (err) {
  		RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,

This one works on my system, and is being tested against the Bugzilla entry I noted earlier.

Larry

#5 lore raw

PATCH 2/9 rtlwifi: don't pass a null pointer to fill_tx_desc

In reply to Joshua Roys
Quoted 1 line

From bdd269b21d249d75175de4e22c11e2a5bfbb8a08 Mon Sep 17 00:00:00 2001

From: Joshua Roys <[email protected]>
Date: Thu, 3 May 2012 00:03:09 -0400
Subject: [PATCH 2/9] rtlwifi: don't pass a null pointer to fill_tx_desc

Take care of "allocating" the txdesc in the usb core, rather than in each subdriver. This also avoids passing a rather useless null argument to fill_tx_desc.

---
 drivers/net/wireless/rtlwifi/rtl8192cu/trx.c |    4 +---
 drivers/net/wireless/rtlwifi/usb.c           |    6 ++++--
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/rtlwifi/rtl8192cu/trx.c +1 -3
index 21bc827..9e01f96 100644
@@ -513,12 +513,10 @@ void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw,
 	u16 pktlen = skb->len;
 	enum rtl_desc_qsel fw_qsel = _rtl8192cu_mq_to_descq(hw, fc,
 						skb_get_queue_mapping(skb));
-	u8 *txdesc;
+	u8 *txdesc = pdesc_tx;
 
 	seq_number = (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4;
 	rtl_get_tcb_desc(hw, info, sta, skb, tcb_desc);
-	txdesc = (u8 *)skb_push(skb, RTL_TX_HEADER_SIZE);
-	memset(txdesc, 0, RTL_TX_HEADER_SIZE);
 	SET_TX_DESC_PKT_SIZE(txdesc, pktlen);
 	SET_TX_DESC_LINIP(txdesc, 0);
 	SET_TX_DESC_PKT_OFFSET(txdesc, RTL_DUMMY_OFFSET);
drivers/net/wireless/rtlwifi/usb.c +4 -2
index d04dbda..91969ee 100644
@@ -850,7 +850,7 @@ static void _rtl_usb_tx_preprocess(struct ieee80211_hw *hw, struct sk_buff *skb,
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
-	struct rtl_tx_desc *pdesc = NULL;
+	u8 *pdesc = NULL;
 	struct rtl_tcb_desc tcb_desc;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data);
 	__le16 fc = hdr->frame_control;
@@ -887,7 +887,9 @@ static void _rtl_usb_tx_preprocess(struct ieee80211_hw *hw, struct sk_buff *skb,
 		seq_number += 1;
 		seq_number <<= 4;
 	}
-	rtlpriv->cfg->ops->fill_tx_desc(hw, hdr, (u8 *)pdesc, info, skb,
+	pdesc = (u8 *)skb_push(skb, RTL_TX_HEADER_SIZE);
+	memset(pdesc, 0, RTL_TX_HEADER_SIZE);
+	rtlpriv->cfg->ops->fill_tx_desc(hw, hdr, pdesc, info, skb,
 					hw_queue, &tcb_desc);
 	if (!ieee80211_has_morefrags(hdr->frame_control)) {
 		if (qc)
Signature · 1 line
1.7.7.6
#6 lore raw

PATCH 3/9 rtlwifi: fix typo

In reply to Joshua Roys
Quoted 1 line

From c5b3148ba19f9292030709cfd6476bc3db9bf077 Mon Sep 17 00:00:00 2001

From: Joshua Roys <[email protected]>
Date: Thu, 3 May 2012 00:07:45 -0400
Subject: [PATCH 3/9] rtlwifi: fix typo

---
 drivers/net/wireless/rtlwifi/rtl8192se/def.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/rtlwifi/rtl8192se/def.h +1 -1
index d1b0a1e..4373f43 100644
@@ -346,7 +346,7 @@ do {								\
 #define SET_RX_STATUS_DESC_BC(__pdesc, __val)			\
 	SET_BITS_OFFSET_LE(__pdesc + 4, 31, 1, __val)
 
-#define GET_RX_STATUS_DEC_MACID(__pdesc)			\
+#define GET_RX_STATUS_DESC_MACID(__pdesc)			\
 	SHIFT_AND_MASK_LE(__pdesc + 4, 0, 5)
 #define GET_RX_STATUS_DESC_TID(__pdesc)				\
 	SHIFT_AND_MASK_LE(__pdesc + 4, 5, 4)
Signature · 1 line
1.7.7.6
#7 lore raw

PATCH 4/9 rtlwifi: fix the selection of the bulk in endpoint

In reply to Joshua Roys
Quoted 1 line

From 750c8403c86edc794999de6330ee7390f923cf6a Mon Sep 17 00:00:00 2001

From: Joshua Roys <[email protected]>
Date: Thu, 3 May 2012 00:12:48 -0400
Subject: [PATCH 4/9] rtlwifi: fix the selection of the bulk in endpoint

The endpoint number is not always the same as the number of bulk in endpoints. I don't actually have a CU card, but I can only assume that the bulk in endpoint number is 1.

---
 drivers/net/wireless/rtlwifi/rtl8192cu/trx.c |    2 ++
 drivers/net/wireless/rtlwifi/usb.c           |    1 -
 2 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/wireless/rtlwifi/rtl8192cu/trx.c +2 -0
index 9e01f96..32dc884 100644
@@ -203,7 +203,9 @@ err_out:
 int  rtl8192cu_endpoint_mapping(struct ieee80211_hw *hw)
 {
 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
+	struct rtl_usb *rtlusb = rtl_usbdev(usb_priv);
 	int error = 0;
+	rtlusb->in_ep = 0x01;
 	if (likely(IS_NORMAL_CHIP(rtlhal->version)))
 		error = _ConfigVerNOutEP(hw);
 	else
drivers/net/wireless/rtlwifi/usb.c +0 -1
index 91969ee..88dbef0 100644
@@ -302,7 +302,6 @@ static int _rtl_usb_init_rx(struct ieee80211_hw *hw)
 
 	rtlusb->rx_max_size = rtlpriv->cfg->usb_interface_cfg->rx_max_size;
 	rtlusb->rx_urb_num = rtlpriv->cfg->usb_interface_cfg->rx_urb_num;
-	rtlusb->in_ep = rtlpriv->cfg->usb_interface_cfg->in_ep_num;
 	rtlusb->usb_rx_hdl = rtlpriv->cfg->usb_interface_cfg->usb_rx_hdl;
 	rtlusb->usb_rx_segregate_hdl =
 		rtlpriv->cfg->usb_interface_cfg->usb_rx_segregate_hdl;
Signature · 1 line
1.7.7.6
#8 lore raw

Re: [PATCH 4/9] rtlwifi: fix the selection of the bulk in endpoint

On 05/03/2012 12:11 AM, Joshua Roys wrote:

I am still reviewing the patches; however, the build fails after this patch with

CC [M] drivers/net/wireless/rtlwifi/rtl8192cu/trx.o
drivers/net/wireless/rtlwifi/rtl8192cu/trx.c: In function ‘rtl8192cu_endpoint_mapping’:
drivers/net/wireless/rtlwifi/rtl8192cu/trx.c:206:27: error: ‘usb_priv’ undeclared (first use in this function) drivers/net/wireless/rtlwifi/rtl8192cu/trx.c:206:27: note: each undeclared identifier is reported only once for each function it appears in make[2]: *** [drivers/net/wireless/rtlwifi/rtl8192cu/trx.o] Error 1
make[1]: *** [drivers/net/wireless/rtlwifi/rtl8192cu] Error 2
make: *** [drivers/net/wireless/rtlwifi/] Error 2

You are missing a

struct rtl_usb_priv *usb_priv = rtl_usbpriv(hw);

ahead of line 206.

I also had some compilation problems with patch 9. The problem there was that you are basing your changes on the wrong tree. All changes to wireless drivers should be from the wireless-testing git tree at

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

and not from the mainline tree.

Larry

#9 lore raw

Re: [PATCH 4/9] rtlwifi: fix the selection of the bulk in endpoint

Quoted 26 lines · Larry Finger

On 05/03/2012 12:11 AM, Joshua Roys wrote:

I am still reviewing the patches; however, the build fails after this patch with

CC [M] drivers/net/wireless/rtlwifi/rtl8192cu/trx.o drivers/net/wireless/rtlwifi/rtl8192cu/trx.c: In function ‘rtl8192cu_endpoint_mapping’:
drivers/net/wireless/rtlwifi/rtl8192cu/trx.c:206:27: error: ‘usb_priv’ undeclared (first use in this function) drivers/net/wireless/rtlwifi/rtl8192cu/trx.c:206:27: note: each undeclared identifier is reported only once for each function it appears in make[2]: *** [drivers/net/wireless/rtlwifi/rtl8192cu/trx.o] Error 1 make[1]: *** [drivers/net/wireless/rtlwifi/rtl8192cu] Error 2
make: *** [drivers/net/wireless/rtlwifi/] Error 2

You are missing a

struct rtl_usb_priv *usb_priv = rtl_usbpriv(hw);

ahead of line 206.

I also had some compilation problems with patch 9. The problem there was that you are basing your changes on the wrong tree. All changes to wireless drivers should be from the wireless-testing git tree at

Quoted 5 lines

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

and not from the mainline tree.

Larry

OK, thanks. I'll rebase them all later tonight.

Josh

#10 lore raw

PATCH 5/9 rtlwifi: check for all 8192Sx-family cards for efuse operations

In reply to Joshua Roys
Quoted 1 line

From faf3570295654de24245fb00f422ed00d0ea6415 Mon Sep 17 00:00:00 2001

From: Joshua Roys <[email protected]>
Date: Thu, 3 May 2012 00:15:13 -0400
Subject: [PATCH 5/9] rtlwifi: check for all 8192Sx-family cards for efuse
operations

---
 drivers/net/wireless/rtlwifi/efuse.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
drivers/net/wireless/rtlwifi/efuse.c +4 -5
index 1f14380..fef3727 100644
@@ -1102,8 +1102,7 @@ static void efuse_power_switch(struct ieee80211_hw *hw, u8 write, u8 pwrstate)
 	u8 tempval;
 	u16 tmpV16;
 
-	if (pwrstate && (rtlhal->hw_type !=
-		HARDWARE_TYPE_RTL8192SE)) {
+	if (pwrstate && (!IS_HARDWARE_TYPE_8192S(rtlhal))) {
 		tmpV16 = rtl_read_word(rtlpriv,
 				       rtlpriv->cfg->maps[SYS_ISO_CTRL]);
 		if (!(tmpV16 & rtlpriv->cfg->maps[EFUSE_PWC_EV12V])) {
@@ -1137,7 +1136,7 @@ static void efuse_power_switch(struct ieee80211_hw *hw, u8 write, u8 pwrstate)
 						rtlpriv->cfg->maps[EFUSE_TEST] +
 						3);
 
-			if (rtlhal->hw_type != HARDWARE_TYPE_RTL8192SE) {
+			if (!IS_HARDWARE_TYPE_8192S(rtlhal)) {
 				tempval &= 0x0F;
 				tempval |= (VOLTAGE_V25 << 4);
 			}
@@ -1147,7 +1146,7 @@ static void efuse_power_switch(struct ieee80211_hw *hw, u8 write, u8 pwrstate)
 				       (tempval | 0x80));
 		}
 
-		if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192SE) {
+		if (IS_HARDWARE_TYPE_8192S(rtlhal)) {
 			rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CLK],
 						0x03);
 		}
@@ -1162,7 +1161,7 @@ static void efuse_power_switch(struct ieee80211_hw *hw, u8 write, u8 pwrstate)
 				       (tempval & 0x7F));
 		}
 
-		if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192SE) {
+		if (IS_HARDWARE_TYPE_8192S(rtlhal)) {
 			rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CLK],
 						0x02);
 		}
Signature · 1 line
1.7.7.6
#11 lore raw

PATCH 6/9 rtlwifi: add short circuit in the receive path

In reply to Joshua Roys
Quoted 1 line

From 78b5e60d9797583172d3e1f755a9f354b5a20759 Mon Sep 17 00:00:00 2001

From: Joshua Roys <[email protected]>
Date: Thu, 3 May 2012 00:16:39 -0400
Subject: [PATCH 6/9] rtlwifi: add short circuit in the receive path

Allow things like C2H events without any actual 802.11 data to avoid the rest of the receive path.

---
 drivers/net/wireless/rtlwifi/usb.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
drivers/net/wireless/rtlwifi/usb.c +10 -2
index 88dbef0..00e90bc 100644
@@ -440,7 +440,11 @@ static void _rtl_usb_rx_process_agg(struct ieee80211_hw *hw,
 	};
 
 	skb_pull(skb, RTL_RX_DESC_SIZE);
-	rtlpriv->cfg->ops->query_rx_desc(hw, &stats, &rx_status, rxdesc, skb);
+	if (!rtlpriv->cfg->ops->query_rx_desc(hw, &stats, &rx_status, rxdesc,
+	    skb)) {
+		dev_kfree_skb_any(skb);
+		return;
+	}
 	skb_pull(skb, (stats.rx_drvinfo_size + stats.rx_bufshift));
 	hdr = (struct ieee80211_hdr *)(skb->data);
 	fc = hdr->frame_control;
@@ -483,7 +487,11 @@ static void _rtl_usb_rx_process_noagg(struct ieee80211_hw *hw,
 	};
 
 	skb_pull(skb, RTL_RX_DESC_SIZE);
-	rtlpriv->cfg->ops->query_rx_desc(hw, &stats, &rx_status, rxdesc, skb);
+	if (!rtlpriv->cfg->ops->query_rx_desc(hw, &stats, &rx_status, rxdesc,
+	    skb)) {
+		dev_kfree_skb_any(skb);
+		return;
+	}
 	skb_pull(skb, (stats.rx_drvinfo_size + stats.rx_bufshift));
 	hdr = (struct ieee80211_hdr *)(skb->data);
 	fc = hdr->frame_control;
Signature · 1 line
1.7.7.6
#12 lore raw

PATCH 7/9 rtlwifi: fail rtl_usb_start if any bulk in urbs fail

In reply to Joshua Roys
Quoted 1 line

From 2cb9c6eca9f0b05d8055d1c7ba78f89c89c34869 Mon Sep 17 00:00:00 2001

From: Joshua Roys <[email protected]>
Date: Thu, 3 May 2012 00:20:18 -0400
Subject: [PATCH 7/9] rtlwifi: fail rtl_usb_start if any bulk in urbs fail

This would have made debugging the erroneous bulk in endpoint number easier.

---
 drivers/net/wireless/rtlwifi/usb.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/wireless/rtlwifi/usb.c +6 -2
index 00e90bc..c62fc7d 100644
@@ -648,13 +648,17 @@ static int _rtl_usb_receive(struct ieee80211_hw *hw)
 
 		usb_anchor_urb(urb, &rtlusb->rx_submitted);
 		err = usb_submit_urb(urb, GFP_KERNEL);
-		if (err)
+		if (err) {
+			RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG,
+				 "Failed to submit URB!!\n");
 			goto err_out;
+		}
 		usb_free_urb(urb);
 	}
 	return 0;
 
 err_out:
+	RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, "err=%i\n", err);
 	usb_kill_anchored_urbs(&rtlusb->rx_submitted);
 	return err;
 }
@@ -676,7 +680,7 @@ static int rtl_usb_start(struct ieee80211_hw *hw)
 		set_hal_start(rtlhal);
 
 		/* Start bulk IN */
-		_rtl_usb_receive(hw);
+		err = _rtl_usb_receive(hw);
 	}
 
 	return err;
Signature · 1 line
1.7.7.6
#13 lore raw

PATCH 8/9 rtlwifi: ugly hack to enable feature disparity between subdrivers

In reply to Joshua Roys
Quoted 1 line

From 18ac2269c0ce57824b9c4212c1be9c81560c149f Mon Sep 17 00:00:00 2001

From: Joshua Roys <[email protected]>
Date: Thu, 3 May 2012 00:23:09 -0400
Subject: [PATCH 8/9] rtlwifi: ugly hack to enable feature disparity between
subdrivers

---
 drivers/net/wireless/rtlwifi/core.c |    2 +-
 drivers/net/wireless/rtlwifi/core.h |    2 +-
 drivers/net/wireless/rtlwifi/usb.c  |    7 ++++++-
 drivers/net/wireless/rtlwifi/wifi.h |    1 +
 4 files changed, 9 insertions(+), 3 deletions(-)
drivers/net/wireless/rtlwifi/core.c +1 -1
index 5f62b9d..7486599 100644
@@ -1162,7 +1162,7 @@ static void rtl_op_flush(struct ieee80211_hw *hw, bool drop)
 		rtlpriv->intf_ops->flush(hw, drop);
 }
 
-const struct ieee80211_ops rtl_ops = {
+struct ieee80211_ops rtl_ops = {
 	.start = rtl_op_start,
 	.stop = rtl_op_stop,
 	.tx = rtl_op_tx,
drivers/net/wireless/rtlwifi/core.h +1 -1
index 2fe46a1..a1d8227 100644
@@ -39,7 +39,7 @@
 
 #define RTL_SUPPORTED_CTRL_FILTER	0xFF
 
-extern const struct ieee80211_ops rtl_ops;
+extern struct ieee80211_ops rtl_ops;
 void rtl_fw_cb(const struct firmware *firmware, void *context);
 
 #endif
drivers/net/wireless/rtlwifi/usb.c +6 -1
index c62fc7d..1f78536 100644
@@ -952,6 +952,11 @@ int __devinit rtl_usb_probe(struct usb_interface *intf,
 	struct rtl_priv *rtlpriv = NULL;
 	struct usb_device	*udev;
 	struct rtl_usb_priv *usb_priv;
+	struct rtl_hal_cfg *hal_cfg;
+
+	hal_cfg = (struct rtl_hal_cfg *)(id->driver_info);
+	if (hal_cfg->ops->modify_ieee80211_ops)
+		hal_cfg->ops->modify_ieee80211_ops(&rtl_ops);
 
 	hw = ieee80211_alloc_hw(sizeof(struct rtl_priv) +
 				sizeof(struct rtl_usb_priv), &rtl_ops);
@@ -976,7 +981,7 @@ int __devinit rtl_usb_probe(struct usb_interface *intf,
 	usb_set_intfdata(intf, hw);
 	/* init cfg & intf_ops */
 	rtlpriv->rtlhal.interface = INTF_USB;
-	rtlpriv->cfg = (struct rtl_hal_cfg *)(id->driver_info);
+	rtlpriv->cfg = hal_cfg;
 	rtlpriv->intf_ops = &rtl_usb_ops;
 	rtl_dbgp_flag_init(hw);
 	/* Init IO handler */
drivers/net/wireless/rtlwifi/wifi.h +1 -0
index 28ebc69..80d8128 100644
@@ -1386,6 +1386,7 @@ struct rtl_tcb_desc {
 };
 
 struct rtl_hal_ops {
+	void (*modify_ieee80211_ops) (struct ieee80211_ops *ops);
 	int (*init_sw_vars) (struct ieee80211_hw *hw);
 	void (*deinit_sw_vars) (struct ieee80211_hw *hw);
 	void (*read_chip_version)(struct ieee80211_hw *hw);
Signature · 1 line
1.7.7.6
#14 lore raw

PATCH 9/9 rtlwifi: add rtl8192su subdriver

In reply to Joshua Roys

Not ready for prime time / WIP. Only tested on the one dongle I have (an ASUS USB-N10).

Quoted 1 line

From 9546263e61282838396f3c1b4d6009ebdb2d8ced Mon Sep 17 00:00:00 2001

From: Joshua Roys <[email protected]>
Date: Thu, 3 May 2012 00:25:11 -0400
Subject: [PATCH 9/9] [WIP] rtlwifi: add rtl8192su subdriver

Currently a WIP.

---
 drivers/net/wireless/rtlwifi/Makefile           |    1 +
 drivers/net/wireless/rtlwifi/rtl8192su/Makefile |   15 +
 drivers/net/wireless/rtlwifi/rtl8192su/def.h    |   30 +
 drivers/net/wireless/rtlwifi/rtl8192su/dm.c     |  734 +++++++
 drivers/net/wireless/rtlwifi/rtl8192su/dm.h     |  164 ++
 drivers/net/wireless/rtlwifi/rtl8192su/fw.c     |  796 +++++++
 drivers/net/wireless/rtlwifi/rtl8192su/fw.h     |  456 ++++
 drivers/net/wireless/rtlwifi/rtl8192su/hw.c     | 2582 +++++++++++++++++++++++
 drivers/net/wireless/rtlwifi/rtl8192su/hw.h     |   80 +
 drivers/net/wireless/rtlwifi/rtl8192su/led.c    |  155 ++
 drivers/net/wireless/rtlwifi/rtl8192su/led.h    |   38 +
 drivers/net/wireless/rtlwifi/rtl8192su/phy.c    | 1748 +++++++++++++++
 drivers/net/wireless/rtlwifi/rtl8192su/phy.h    |  101 +
 drivers/net/wireless/rtlwifi/rtl8192su/reg.h    | 1232 +++++++++++
 drivers/net/wireless/rtlwifi/rtl8192su/rf.c     |  542 +++++
 drivers/net/wireless/rtlwifi/rtl8192su/rf.h     |   43 +
 drivers/net/wireless/rtlwifi/rtl8192su/sw.c     |  545 +++++
 drivers/net/wireless/rtlwifi/rtl8192su/sw.h     |   36 +
 drivers/net/wireless/rtlwifi/rtl8192su/table.c  |  634 ++++++
 drivers/net/wireless/rtlwifi/rtl8192su/table.h  |   49 +
 drivers/net/wireless/rtlwifi/rtl8192su/trx.c    | 1030 +++++++++
 drivers/net/wireless/rtlwifi/rtl8192su/trx.h    |   59 +
 22 files changed, 11070 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/Makefile
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/def.h
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/dm.c
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/dm.h
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/fw.c
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/fw.h
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/hw.c
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/hw.h
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/led.c
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/led.h
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/phy.c
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/phy.h
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/reg.h
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/rf.c
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/rf.h
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/sw.c
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/sw.h
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/table.c
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/table.h
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/trx.c
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/trx.h
drivers/net/wireless/rtlwifi/Makefile +1 -0
index 97935c5..b54f45e 100644
@@ -23,6 +23,7 @@ obj-$(CONFIG_RTL8192C_COMMON)	+= rtl8192c/
 obj-$(CONFIG_RTL8192CE)		+= rtl8192ce/
 obj-$(CONFIG_RTL8192CU)		+= rtl8192cu/
 obj-$(CONFIG_RTL8192SE)		+= rtl8192se/
+obj-$(CONFIG_RTL8192SU)		+= rtl8192su/
 obj-$(CONFIG_RTL8192DE)		+= rtl8192de/
 
 ccflags-y += -D__CHECK_ENDIAN__
drivers/net/wireless/rtlwifi/rtl8192su/Makefile new file +15 -0
new file mode 100644
index 0000000..e43490b
@@ -0,0 +1,15 @@
+rtl8192su-objs :=		\
+		dm.o		\
+		fw.o		\
+		hw.o		\
+		led.o		\
+		phy.o		\
+		rf.o		\
+		sw.o		\
+		table.o		\
+		trx.o
+
+obj-$(CONFIG_RTL8192SU) += rtl8192su.o
+
+ccflags-y += -D__CHECK_ENDIAN__
+
drivers/net/wireless/rtlwifi/rtl8192su/def.h new file +30 -0
new file mode 100644
index 0000000..f2ce4bf
@@ -0,0 +1,30 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2009-2012  Realtek Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * The full GNU General Public License is included in this distribution in the
+ * file called LICENSE.
+ *
+ * Contact Information:
+ * wlanfae <[email protected]>
+ * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
+ * Hsinchu 300, Taiwan.
+ *
+ * Larry Finger <[email protected]>
+ *
+ *****************************************************************************/
+
+#include "../rtl8192se/def.h"
drivers/net/wireless/rtlwifi/rtl8192su/dm.c new file +734 -0

734 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/dm.h new file +164 -0

164 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/fw.c new file +796 -0

796 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/fw.h new file +456 -0

456 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/hw.c new file +2582 -0

798 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/hw.h new file +80 -0

80 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/led.c new file +155 -0

155 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/led.h new file +38 -0
new file mode 100644
index 0000000..2ed8772

Lines of this file are not shown. View the raw message.

drivers/net/wireless/rtlwifi/rtl8192su/phy.c new file +1748 -0

1,748 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/phy.h new file +101 -0

101 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/reg.h new file +1232 -0

1,232 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/rf.c new file +542 -0

542 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/rf.h new file +43 -0

43 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/sw.c new file +545 -0

545 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/sw.h new file +36 -0
new file mode 100644
index 0000000..5b9b553

Lines of this file are not shown. View the raw message.

drivers/net/wireless/rtlwifi/rtl8192su/table.c new file +634 -0

634 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/table.h new file +49 -0

49 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/trx.c new file +1030 -0

1,030 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/trx.h new file +59 -0

59 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.7.6

Part of the diff is not shown here. View the raw message.

#15 lore raw

PATCH v2 1/1 rtlwifi: rtl8192su subdriver

In reply to Joshua Roys

Hello,

A few things have changed between this and the previous version. Larry Finger's patch for handling the race condition with mac80211 and the firmware callback is used instead (rtlwifi: fix for race condition when firmware is cached), and a new patch for disabling the LEDs in the usb core is added (mirroring rtl_pci_stop). All patches were rebased on wireless-testing from the 3rd. The subdriver handles shutdown much better, although there is still room for improvement. Some differences from rtl8192se were eliminated, although all PHY/BB/RF reg commands are still commented out. When any of those regs were accessed directly, the device would die. When accessed through the IOCMD regs, the firmware on the device would seem to disable automatic control of some important functions causing a large drop in receive sensitivity and general performance. I discovered the RXFILTERMAP registers were set by the firmware after download causing the firmware to handle many management frames; allowing everything but beacons through still does not allow an association/authentication against a WPA2-PSK AP to succeed. The AP sees a probe request and sends a probe response, but the driver never sees the response. There are firmware commands available for offloading the joining of a BSS and the authentication bits which are likely the easiest solution. Also needing fixing are a few WARNs, for example if you happen to unload the module during a scan. Finally, the site survey results are now properly handed off to cfg80211.

Thanks,

Josh

#16 lore raw

PATCH 1/9 rtlwifi: don't pass a null pointer to fill_tx_desc

Take care of "allocating" the txdesc in the usb core, rather than in each subdriver. This also avoids passing a rather useless null argument to fill_tx_desc.

---
 drivers/net/wireless/rtlwifi/rtl8192cu/trx.c |    4 +---
 drivers/net/wireless/rtlwifi/usb.c           |    6 ++++--
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/rtlwifi/rtl8192cu/trx.c +1 -3
index 21bc827..9e01f96 100644
@@ -513,12 +513,10 @@ void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw,
 	u16 pktlen = skb->len;
 	enum rtl_desc_qsel fw_qsel = _rtl8192cu_mq_to_descq(hw, fc,
 						skb_get_queue_mapping(skb));
-	u8 *txdesc;
+	u8 *txdesc = pdesc_tx;
 
 	seq_number = (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4;
 	rtl_get_tcb_desc(hw, info, sta, skb, tcb_desc);
-	txdesc = (u8 *)skb_push(skb, RTL_TX_HEADER_SIZE);
-	memset(txdesc, 0, RTL_TX_HEADER_SIZE);
 	SET_TX_DESC_PKT_SIZE(txdesc, pktlen);
 	SET_TX_DESC_LINIP(txdesc, 0);
 	SET_TX_DESC_PKT_OFFSET(txdesc, RTL_DUMMY_OFFSET);
drivers/net/wireless/rtlwifi/usb.c +4 -2
index a6049d7..8dd588b 100644
@@ -850,7 +850,7 @@ static void _rtl_usb_tx_preprocess(struct ieee80211_hw *hw, struct sk_buff *skb,
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
-	struct rtl_tx_desc *pdesc = NULL;
+	u8 *pdesc = NULL;
 	struct rtl_tcb_desc tcb_desc;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data);
 	__le16 fc = hdr->frame_control;
@@ -887,7 +887,9 @@ static void _rtl_usb_tx_preprocess(struct ieee80211_hw *hw, struct sk_buff *skb,
 		seq_number += 1;
 		seq_number <<= 4;
 	}
-	rtlpriv->cfg->ops->fill_tx_desc(hw, hdr, (u8 *)pdesc, info, skb,
+	pdesc = (u8 *)skb_push(skb, RTL_TX_HEADER_SIZE);
+	memset(pdesc, 0, RTL_TX_HEADER_SIZE);
+	rtlpriv->cfg->ops->fill_tx_desc(hw, hdr, pdesc, info, skb,
 					hw_queue, &tcb_desc);
 	if (!ieee80211_has_morefrags(hdr->frame_control)) {
 		if (qc)
Signature · 1 line
1.7.4.1
#17 lore raw

PATCH 2/9 rtlwifi: fix typo

In reply to Joshua Roys
---
 drivers/net/wireless/rtlwifi/rtl8192se/def.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/rtlwifi/rtl8192se/def.h +1 -1
index 20afec6..0418b7c 100644
@@ -341,7 +341,7 @@
 #define SET_RX_STATUS_DESC_BC(__pdesc, __val)			\
 	SET_BITS_OFFSET_LE(__pdesc + 4, 31, 1, __val)
 
-#define GET_RX_STATUS_DEC_MACID(__pdesc)			\
+#define GET_RX_STATUS_DESC_MACID(__pdesc)			\
 	SHIFT_AND_MASK_LE(__pdesc + 4, 0, 5)
 #define GET_RX_STATUS_DESC_TID(__pdesc)				\
 	SHIFT_AND_MASK_LE(__pdesc + 4, 5, 4)
Signature · 1 line
1.7.4.1
#18 lore raw

PATCH 3/9 rtlwifi: fix the selection of the bulk in endpoint

In reply to Joshua Roys

The endpoint number is not always the same as the number of bulk in endpoints. I don't actually have a CU card, but I can only assume that the bulk in endpoint number is 1.

---
 drivers/net/wireless/rtlwifi/rtl8192cu/trx.c |    2 ++
 drivers/net/wireless/rtlwifi/usb.c           |    1 -
 2 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/wireless/rtlwifi/rtl8192cu/trx.c +2 -0
index 9e01f96..a2dae17 100644
@@ -203,7 +203,9 @@ err_out:
 int  rtl8192cu_endpoint_mapping(struct ieee80211_hw *hw)
 {
 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
+	struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw));
 	int error = 0;
+	rtlusb->in_ep = 0x01;
 	if (likely(IS_NORMAL_CHIP(rtlhal->version)))
 		error = _ConfigVerNOutEP(hw);
 	else
drivers/net/wireless/rtlwifi/usb.c +0 -1
index 8dd588b..471a112 100644
@@ -302,7 +302,6 @@ static int _rtl_usb_init_rx(struct ieee80211_hw *hw)
 
 	rtlusb->rx_max_size = rtlpriv->cfg->usb_interface_cfg->rx_max_size;
 	rtlusb->rx_urb_num = rtlpriv->cfg->usb_interface_cfg->rx_urb_num;
-	rtlusb->in_ep = rtlpriv->cfg->usb_interface_cfg->in_ep_num;
 	rtlusb->usb_rx_hdl = rtlpriv->cfg->usb_interface_cfg->usb_rx_hdl;
 	rtlusb->usb_rx_segregate_hdl =
 		rtlpriv->cfg->usb_interface_cfg->usb_rx_segregate_hdl;
Signature · 1 line
1.7.4.1
#19 lore raw

PATCH 4/9 rtlwifi: check for all 8192Sx-family cards for efuse operations

In reply to Joshua Roys
---
 drivers/net/wireless/rtlwifi/efuse.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
drivers/net/wireless/rtlwifi/efuse.c +4 -5
index 1f14380..fef3727 100644
@@ -1102,8 +1102,7 @@ static void efuse_power_switch(struct ieee80211_hw *hw, u8 write, u8 pwrstate)
 	u8 tempval;
 	u16 tmpV16;
 
-	if (pwrstate && (rtlhal->hw_type !=
-		HARDWARE_TYPE_RTL8192SE)) {
+	if (pwrstate && (!IS_HARDWARE_TYPE_8192S(rtlhal))) {
 		tmpV16 = rtl_read_word(rtlpriv,
 				       rtlpriv->cfg->maps[SYS_ISO_CTRL]);
 		if (!(tmpV16 & rtlpriv->cfg->maps[EFUSE_PWC_EV12V])) {
@@ -1137,7 +1136,7 @@ static void efuse_power_switch(struct ieee80211_hw *hw, u8 write, u8 pwrstate)
 						rtlpriv->cfg->maps[EFUSE_TEST] +
 						3);
 
-			if (rtlhal->hw_type != HARDWARE_TYPE_RTL8192SE) {
+			if (!IS_HARDWARE_TYPE_8192S(rtlhal)) {
 				tempval &= 0x0F;
 				tempval |= (VOLTAGE_V25 << 4);
 			}
@@ -1147,7 +1146,7 @@ static void efuse_power_switch(struct ieee80211_hw *hw, u8 write, u8 pwrstate)
 				       (tempval | 0x80));
 		}
 
-		if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192SE) {
+		if (IS_HARDWARE_TYPE_8192S(rtlhal)) {
 			rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CLK],
 						0x03);
 		}
@@ -1162,7 +1161,7 @@ static void efuse_power_switch(struct ieee80211_hw *hw, u8 write, u8 pwrstate)
 				       (tempval & 0x7F));
 		}
 
-		if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192SE) {
+		if (IS_HARDWARE_TYPE_8192S(rtlhal)) {
 			rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CLK],
 						0x02);
 		}
Signature · 1 line
1.7.4.1
#20 lore raw

PATCH 5/9 rtlwifi: add short circuit in the receive path

In reply to Joshua Roys

Allow things like C2H events without any actual 802.11 data to avoid the rest of the receive path.

---
 drivers/net/wireless/rtlwifi/usb.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
drivers/net/wireless/rtlwifi/usb.c +10 -2
index 471a112..d9a0a9f 100644
@@ -440,7 +440,11 @@ static void _rtl_usb_rx_process_agg(struct ieee80211_hw *hw,
 	};
 
 	skb_pull(skb, RTL_RX_DESC_SIZE);
-	rtlpriv->cfg->ops->query_rx_desc(hw, &stats, &rx_status, rxdesc, skb);
+	if (!rtlpriv->cfg->ops->query_rx_desc(hw, &stats, &rx_status, rxdesc,
+	    skb)) {
+		dev_kfree_skb_any(skb);
+		return;
+	}
 	skb_pull(skb, (stats.rx_drvinfo_size + stats.rx_bufshift));
 	hdr = (struct ieee80211_hdr *)(skb->data);
 	fc = hdr->frame_control;
@@ -483,7 +487,11 @@ static void _rtl_usb_rx_process_noagg(struct ieee80211_hw *hw,
 	};
 
 	skb_pull(skb, RTL_RX_DESC_SIZE);
-	rtlpriv->cfg->ops->query_rx_desc(hw, &stats, &rx_status, rxdesc, skb);
+	if (!rtlpriv->cfg->ops->query_rx_desc(hw, &stats, &rx_status, rxdesc,
+	    skb)) {
+		dev_kfree_skb_any(skb);
+		return;
+	}
 	skb_pull(skb, (stats.rx_drvinfo_size + stats.rx_bufshift));
 	hdr = (struct ieee80211_hdr *)(skb->data);
 	fc = hdr->frame_control;
Signature · 1 line
1.7.4.1
#21 lore raw

PATCH 6/9 rtlwifi: fail rtl_usb_start if any bulk in urbs fail

In reply to Joshua Roys

This would have made debugging the erroneous bulk in endpoint number easier.

---
 drivers/net/wireless/rtlwifi/usb.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/wireless/rtlwifi/usb.c +6 -2
index d9a0a9f..686af86 100644
@@ -648,13 +648,17 @@ static int _rtl_usb_receive(struct ieee80211_hw *hw)
 
 		usb_anchor_urb(urb, &rtlusb->rx_submitted);
 		err = usb_submit_urb(urb, GFP_KERNEL);
-		if (err)
+		if (err) {
+			RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG,
+				 "Failed to submit URB!!\n");
 			goto err_out;
+		}
 		usb_free_urb(urb);
 	}
 	return 0;
 
 err_out:
+	RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, "err=%i\n", err);
 	usb_kill_anchored_urbs(&rtlusb->rx_submitted);
 	return err;
 }
@@ -676,7 +680,7 @@ static int rtl_usb_start(struct ieee80211_hw *hw)
 		set_hal_start(rtlhal);
 
 		/* Start bulk IN */
-		_rtl_usb_receive(hw);
+		err = _rtl_usb_receive(hw);
 	}
 
 	return err;
Signature · 1 line
1.7.4.1
#22 lore raw

PATCH 7/9 rtlwifi: mimic rtl_pci_stop and disable LEDs

In reply to Joshua Roys

From: Joshua Roys <[email protected]>

---
 drivers/net/wireless/rtlwifi/usb.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/wireless/rtlwifi/usb.c +1 -0
index 686af86..64f7464 100644
@@ -739,6 +739,7 @@ static void rtl_usb_stop(struct ieee80211_hw *hw)
 	SET_USB_STOP(rtlusb);
 	rtl_usb_deinit(hw);
 	rtlpriv->cfg->ops->hw_disable(hw);
+	rtlpriv->cfg->ops->led_control(hw, LED_CTL_POWER_OFF);
 }
 
 static void _rtl_submit_tx_urb(struct ieee80211_hw *hw, struct urb *_urb)
Signature · 1 line
1.7.4.1
#23 lore raw

PATCH 8/9 rtlwifi: ugly hack to enable feature disparity between subdrivers

In reply to Joshua Roys
---
 drivers/net/wireless/rtlwifi/core.c |    2 +-
 drivers/net/wireless/rtlwifi/core.h |    2 +-
 drivers/net/wireless/rtlwifi/usb.c  |    7 ++++++-
 drivers/net/wireless/rtlwifi/wifi.h |    1 +
 4 files changed, 9 insertions(+), 3 deletions(-)
drivers/net/wireless/rtlwifi/core.c +1 -1
index 278e9f9..3b1108c 100644
@@ -1171,7 +1171,7 @@ static void rtl_op_flush(struct ieee80211_hw *hw, bool drop)
 		rtlpriv->intf_ops->flush(hw, drop);
 }
 
-const struct ieee80211_ops rtl_ops = {
+struct ieee80211_ops rtl_ops = {
 	.start = rtl_op_start,
 	.stop = rtl_op_stop,
 	.tx = rtl_op_tx,
drivers/net/wireless/rtlwifi/core.h +1 -1
index 2fe46a1..a1d8227 100644
@@ -39,7 +39,7 @@
 
 #define RTL_SUPPORTED_CTRL_FILTER	0xFF
 
-extern const struct ieee80211_ops rtl_ops;
+extern struct ieee80211_ops rtl_ops;
 void rtl_fw_cb(const struct firmware *firmware, void *context);
 
 #endif
drivers/net/wireless/rtlwifi/usb.c +6 -1
index 64f7464..15ffb97d 100644
@@ -953,6 +953,11 @@ int __devinit rtl_usb_probe(struct usb_interface *intf,
 	struct rtl_priv *rtlpriv = NULL;
 	struct usb_device	*udev;
 	struct rtl_usb_priv *usb_priv;
+	struct rtl_hal_cfg *hal_cfg;
+
+	hal_cfg = (struct rtl_hal_cfg *)(id->driver_info);
+	if (hal_cfg->ops->modify_ieee80211_ops)
+		hal_cfg->ops->modify_ieee80211_ops(&rtl_ops);
 
 	hw = ieee80211_alloc_hw(sizeof(struct rtl_priv) +
 				sizeof(struct rtl_usb_priv), &rtl_ops);
@@ -977,7 +982,7 @@ int __devinit rtl_usb_probe(struct usb_interface *intf,
 	usb_set_intfdata(intf, hw);
 	/* init cfg & intf_ops */
 	rtlpriv->rtlhal.interface = INTF_USB;
-	rtlpriv->cfg = (struct rtl_hal_cfg *)(id->driver_info);
+	rtlpriv->cfg = hal_cfg;
 	rtlpriv->intf_ops = &rtl_usb_ops;
 	rtl_dbgp_flag_init(hw);
 	/* Init IO handler */
drivers/net/wireless/rtlwifi/wifi.h +1 -0
index bd816ae..618f09c 100644
@@ -1386,6 +1386,7 @@ struct rtl_tcb_desc {
 };
 
 struct rtl_hal_ops {
+	void (*modify_ieee80211_ops) (struct ieee80211_ops *ops);
 	int (*init_sw_vars) (struct ieee80211_hw *hw);
 	void (*deinit_sw_vars) (struct ieee80211_hw *hw);
 	void (*read_chip_version)(struct ieee80211_hw *hw);
Signature · 1 line
1.7.4.1
#24 lore raw

PATCH 9/9 rtlwifi: add rtl8192su subdriver

In reply to Joshua Roys

Currently a WIP.

---
 drivers/net/wireless/rtlwifi/Kconfig            |   15 +-
 drivers/net/wireless/rtlwifi/Makefile           |    1 +
 drivers/net/wireless/rtlwifi/rtl8192su/Makefile |   14 +
 drivers/net/wireless/rtlwifi/rtl8192su/def.h    |   30 +
 drivers/net/wireless/rtlwifi/rtl8192su/dm.c     |  737 +++++++
 drivers/net/wireless/rtlwifi/rtl8192su/dm.h     |  119 ++
 drivers/net/wireless/rtlwifi/rtl8192su/fw.c     |  800 +++++++
 drivers/net/wireless/rtlwifi/rtl8192su/fw.h     |  456 ++++
 drivers/net/wireless/rtlwifi/rtl8192su/hw.c     | 2573 +++++++++++++++++++++++
 drivers/net/wireless/rtlwifi/rtl8192su/hw.h     |   79 +
 drivers/net/wireless/rtlwifi/rtl8192su/led.c    |  154 ++
 drivers/net/wireless/rtlwifi/rtl8192su/led.h    |   38 +
 drivers/net/wireless/rtlwifi/rtl8192su/phy.c    | 1751 +++++++++++++++
 drivers/net/wireless/rtlwifi/rtl8192su/phy.h    |  100 +
 drivers/net/wireless/rtlwifi/rtl8192su/reg.h    | 1232 +++++++++++
 drivers/net/wireless/rtlwifi/rtl8192su/rf.c     |  542 +++++
 drivers/net/wireless/rtlwifi/rtl8192su/rf.h     |   42 +
 drivers/net/wireless/rtlwifi/rtl8192su/sw.c     |  546 +++++
 drivers/net/wireless/rtlwifi/rtl8192su/sw.h     |   36 +
 drivers/net/wireless/rtlwifi/rtl8192su/table.c  |  633 ++++++
 drivers/net/wireless/rtlwifi/rtl8192su/table.h  |   48 +
 drivers/net/wireless/rtlwifi/rtl8192su/trx.c    | 1089 ++++++++++
 drivers/net/wireless/rtlwifi/rtl8192su/trx.h    |   59 +
 23 files changed, 11092 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/Makefile
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/def.h
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/dm.c
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/dm.h
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/fw.c
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/fw.h
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/hw.c
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/hw.h
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/led.c
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/led.h
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/phy.c
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/phy.h
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/reg.h
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/rf.c
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/rf.h
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/sw.c
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/sw.h
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/table.c
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/table.h
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/trx.c
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8192su/trx.h
drivers/net/wireless/rtlwifi/Kconfig +13 -2
index cefac6a..b528f41 100644
@@ -44,14 +44,25 @@ config RTL8192CU
 
 	If you choose to build it as a module, it will be called rtl8192cu
 
+config RTL8192SU
+	tristate "Realtek RTL8192SU/RTL8191SU/RTL8188SU USB Wireless Network Adapter"
+	depends on MAC80211 && USB && EXPERIMENTAL
+	select FW_LOADER
+	select RTLWIFI
+	---help---
+	This is the driver for Realtek RTL8192SU/RTL8191SU/RTL8188SU 802.11 USB
+	wireless network adapters.
+
+	If you choose to build it as a module, it will be called rtl8192su
+
 config RTLWIFI
 	tristate
-	depends on RTL8192CE || RTL8192CU || RTL8192SE || RTL8192DE
+	depends on RTL8192CE || RTL8192CU || RTL8192SE || RTL8192SU || RTL8192DE
 	default m
 
 config RTLWIFI_DEBUG
 	bool "Additional debugging output"
-	depends on RTL8192CE || RTL8192CU || RTL8192SE || RTL8192DE
+	depends on RTL8192CE || RTL8192CU || RTL8192SE || RTL8192SU || RTL8192DE
 	default y
 
 config RTL8192C_COMMON
drivers/net/wireless/rtlwifi/Makefile +1 -0
index 97935c5..b54f45e 100644
@@ -23,6 +23,7 @@ obj-$(CONFIG_RTL8192C_COMMON)	+= rtl8192c/
 obj-$(CONFIG_RTL8192CE)		+= rtl8192ce/
 obj-$(CONFIG_RTL8192CU)		+= rtl8192cu/
 obj-$(CONFIG_RTL8192SE)		+= rtl8192se/
+obj-$(CONFIG_RTL8192SU)		+= rtl8192su/
 obj-$(CONFIG_RTL8192DE)		+= rtl8192de/
 
 ccflags-y += -D__CHECK_ENDIAN__
drivers/net/wireless/rtlwifi/rtl8192su/Makefile new file +14 -0
new file mode 100644
index 0000000..ebd7080
@@ -0,0 +1,14 @@
+rtl8192su-objs :=		\
+		dm.o		\
+		fw.o		\
+		hw.o		\
+		led.o		\
+		phy.o		\
+		rf.o		\
+		sw.o		\
+		table.o		\
+		trx.o
+
+obj-$(CONFIG_RTL8192SU) += rtl8192su.o
+
+ccflags-y += -D__CHECK_ENDIAN__
drivers/net/wireless/rtlwifi/rtl8192su/def.h new file +30 -0
new file mode 100644
index 0000000..f2ce4bf
@@ -0,0 +1,30 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2009-2012  Realtek Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * The full GNU General Public License is included in this distribution in the
+ * file called LICENSE.
+ *
+ * Contact Information:
+ * wlanfae <[email protected]>
+ * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
+ * Hsinchu 300, Taiwan.
+ *
+ * Larry Finger <[email protected]>
+ *
+ *****************************************************************************/
+
+#include "../rtl8192se/def.h"
drivers/net/wireless/rtlwifi/rtl8192su/dm.c new file +737 -0

737 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/dm.h new file +119 -0

119 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/fw.c new file +800 -0

800 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/fw.h new file +456 -0

456 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/hw.c new file +2573 -0

810 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/hw.h new file +79 -0

79 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/led.c new file +154 -0

154 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/led.h new file +38 -0
new file mode 100644
index 0000000..2ed8772

Lines of this file are not shown. View the raw message.

drivers/net/wireless/rtlwifi/rtl8192su/phy.c new file +1751 -0

1,751 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/phy.h new file +100 -0

100 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/reg.h new file +1232 -0

1,232 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/rf.c new file +542 -0

542 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/rf.h new file +42 -0

42 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/sw.c new file +546 -0

546 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/sw.h new file +36 -0
new file mode 100644
index 0000000..5b9b553

Lines of this file are not shown. View the raw message.

drivers/net/wireless/rtlwifi/rtl8192su/table.c new file +633 -0

633 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/table.h new file +48 -0

48 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/trx.c new file +1089 -0

1,089 lines not on this page · raw message

drivers/net/wireless/rtlwifi/rtl8192su/trx.h new file +59 -0

59 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.4.1

Part of the diff is not shown here. View the raw message.