Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH 0/5 V2] Updates to match latest Realtek version and new PM framework
From: Larry Finger @ 2011-10-12  2:28 UTC (permalink / raw)
  To: linville; +Cc: Larry Finger, linux-wireless

The latest Realtek driver for rtl8192ce, rtl8192se, and rtl8192de incorporates
some changes. With these patches, the changes are added to the mainline
drivers. In addition, the drivers are changed to the new PM framework.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---

John,

V1 of these patches had been applied to git://git.infradead.org/users/linville/wireless-testing.git.

I had committed them to my local tree and let git generate the patches. For V2, I switched to
git://git.infradead.org/users/linville/wireless-next.git. A pull on the new tree got the objects
from the for-davem branch, but master was unchanged. I reverted all 5 from my tree, imported the
patches with quilt and cleaned them up. They all apply cleanly with no warnings and no fuzz.

If I understood your mail message correctly, patches 1, 2, 3, and 5 have already been applied,
but I'm sending a new version just in case. Patches 4 and 5 can be applied in any order - thus
4 will work by itself.

Sorry for any problems.

Larry
---

Chaoming Li (4):
  rtlwifi: Update to new Realtek version - Part I
  rtlwifi: rtl8192ce: Add new chip revisions
  rtlwifi: rtl8192se: Updates from latest Realtek driver version - Part
    II
  rtlwifi: rtl8192de: Updates from latest Reaktek driver - Part III

Larry Finger (1):
  rtlwifi: Change PCI drivers to use the new PM framework

 drivers/net/wireless/rtlwifi/base.c          |    6 +-
 drivers/net/wireless/rtlwifi/pci.c           |   19 +---
 drivers/net/wireless/rtlwifi/pci.h           |    4 +-
 drivers/net/wireless/rtlwifi/rtl8192ce/def.h |   14 +++
 drivers/net/wireless/rtlwifi/rtl8192ce/sw.c  |   30 +++++--
 drivers/net/wireless/rtlwifi/rtl8192cu/def.h |    4 -
 drivers/net/wireless/rtlwifi/rtl8192de/def.h |  124 ++++++++++++++++----------
 drivers/net/wireless/rtlwifi/rtl8192de/hw.c  |   19 ++---
 drivers/net/wireless/rtlwifi/rtl8192de/sw.c  |   16 ++--
 drivers/net/wireless/rtlwifi/rtl8192se/hw.c  |   22 +++---
 drivers/net/wireless/rtlwifi/rtl8192se/reg.h |    1 +
 drivers/net/wireless/rtlwifi/rtl8192se/sw.c  |   17 +++--
 drivers/net/wireless/rtlwifi/rtl8192se/trx.c |   53 +++++++-----
 drivers/net/wireless/rtlwifi/wifi.h          |    1 +
 14 files changed, 196 insertions(+), 134 deletions(-)

-- 
1.7.6.4


^ permalink raw reply

* [PATCH 1/5 V2] rtlwifi: Change PCI drivers to use the new PM framework
From: Larry Finger @ 2011-10-12  2:28 UTC (permalink / raw)
  To: linville; +Cc: Larry Finger, linux-wireless
In-Reply-To: <1318386531-5859-1-git-send-email-Larry.Finger@lwfinger.net>

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/net/wireless/rtlwifi/pci.c          |   19 ++++---------------
 drivers/net/wireless/rtlwifi/pci.h          |    4 ++--
 drivers/net/wireless/rtlwifi/rtl8192ce/sw.c |   16 ++++++++++------
 drivers/net/wireless/rtlwifi/rtl8192de/sw.c |   16 ++++++++++------
 drivers/net/wireless/rtlwifi/rtl8192se/sw.c |   16 ++++++++++------
 5 files changed, 36 insertions(+), 35 deletions(-)

Index: wireless-testing-new/drivers/net/wireless/rtlwifi/pci.c
===================================================================
--- wireless-testing-new.orig/drivers/net/wireless/rtlwifi/pci.c
+++ wireless-testing-new/drivers/net/wireless/rtlwifi/pci.c
@@ -1993,36 +1993,25 @@ call rtl_mac_stop() from the mac80211
 suspend function first, So there is
 no need to call hw_disable here.
 ****************************************/
-int rtl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
+int rtl_pci_suspend(struct device *dev)
 {
+	struct pci_dev *pdev = to_pci_dev(dev);
 	struct ieee80211_hw *hw = pci_get_drvdata(pdev);
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 
 	rtlpriv->cfg->ops->hw_suspend(hw);
 	rtl_deinit_rfkill(hw);
 
-	pci_save_state(pdev);
-	pci_disable_device(pdev);
-	pci_set_power_state(pdev, PCI_D3hot);
 	return 0;
 }
 EXPORT_SYMBOL(rtl_pci_suspend);
 
-int rtl_pci_resume(struct pci_dev *pdev)
+int rtl_pci_resume(struct device *dev)
 {
-	int ret;
+	struct pci_dev *pdev = to_pci_dev(dev);
 	struct ieee80211_hw *hw = pci_get_drvdata(pdev);
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 
-	pci_set_power_state(pdev, PCI_D0);
-	ret = pci_enable_device(pdev);
-	if (ret) {
-		RT_ASSERT(false, ("ERR: <======\n"));
-		return ret;
-	}
-
-	pci_restore_state(pdev);
-
 	rtlpriv->cfg->ops->hw_resume(hw);
 	rtl_init_rfkill(hw);
 	return 0;
Index: wireless-testing-new/drivers/net/wireless/rtlwifi/pci.h
===================================================================
--- wireless-testing-new.orig/drivers/net/wireless/rtlwifi/pci.h
+++ wireless-testing-new/drivers/net/wireless/rtlwifi/pci.h
@@ -237,8 +237,8 @@ extern struct rtl_intf_ops rtl_pci_ops;
 int __devinit rtl_pci_probe(struct pci_dev *pdev,
 			    const struct pci_device_id *id);
 void rtl_pci_disconnect(struct pci_dev *pdev);
-int rtl_pci_suspend(struct pci_dev *pdev, pm_message_t state);
-int rtl_pci_resume(struct pci_dev *pdev);
+int rtl_pci_suspend(struct device *dev);
+int rtl_pci_resume(struct device *dev);
 
 static inline u8 pci_read8_sync(struct rtl_priv *rtlpriv, u32 addr)
 {
Index: wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
===================================================================
--- wireless-testing-new.orig/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
+++ wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
@@ -370,17 +370,21 @@ MODULE_PARM_DESC(swlps, "Set to 1 to use
 MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n");
 MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)");
 
+static const struct dev_pm_ops rtlwifi_pm_ops = {
+	.suspend = rtl_pci_suspend,
+	.resume = rtl_pci_resume,
+	.freeze = rtl_pci_suspend,
+	.thaw = rtl_pci_resume,
+	.poweroff = rtl_pci_suspend,
+	.restore = rtl_pci_resume,
+};
+
 static struct pci_driver rtl92ce_driver = {
 	.name = KBUILD_MODNAME,
 	.id_table = rtl92ce_pci_ids,
 	.probe = rtl_pci_probe,
 	.remove = rtl_pci_disconnect,
-
-#ifdef CONFIG_PM
-	.suspend = rtl_pci_suspend,
-	.resume = rtl_pci_resume,
-#endif
-
+	.driver.pm = &rtlwifi_pm_ops,
 };
 
 static int __init rtl92ce_module_init(void)
Index: wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
===================================================================
--- wireless-testing-new.orig/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
+++ wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
@@ -390,17 +390,21 @@ MODULE_PARM_DESC(swlps, "Set to 1 to use
 MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n");
 MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)");
 
+static const struct dev_pm_ops rtlwifi_pm_ops = {
+	.suspend = rtl_pci_suspend,
+	.resume = rtl_pci_resume,
+	.freeze = rtl_pci_suspend,
+	.thaw = rtl_pci_resume,
+	.poweroff = rtl_pci_suspend,
+	.restore = rtl_pci_resume,
+};
+
 static struct pci_driver rtl92de_driver = {
 	.name = KBUILD_MODNAME,
 	.id_table = rtl92de_pci_ids,
 	.probe = rtl_pci_probe,
 	.remove = rtl_pci_disconnect,
-
-#ifdef CONFIG_PM
-	.suspend = rtl_pci_suspend,
-	.resume = rtl_pci_resume,
-#endif
-
+	.driver.pm = &rtlwifi_pm_ops,
 };
 
 /* add global spin lock to solve the problem that
Index: wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
===================================================================
--- wireless-testing-new.orig/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
+++ wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
@@ -401,17 +401,21 @@ MODULE_PARM_DESC(swlps, "Set to 1 to use
 MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n");
 MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)");
 
+static const struct dev_pm_ops rtlwifi_pm_ops = {
+	.suspend = rtl_pci_suspend,
+	.resume = rtl_pci_resume,
+	.freeze = rtl_pci_suspend,
+	.thaw = rtl_pci_resume,
+	.poweroff = rtl_pci_suspend,
+	.restore = rtl_pci_resume,
+};
+
 static struct pci_driver rtl92se_driver = {
 	.name = KBUILD_MODNAME,
 	.id_table = rtl92se_pci_ids,
 	.probe = rtl_pci_probe,
 	.remove = rtl_pci_disconnect,
-
-#ifdef CONFIG_PM
-	.suspend = rtl_pci_suspend,
-	.resume = rtl_pci_resume,
-#endif
-
+	.driver.pm = &rtlwifi_pm_ops,
 };
 
 static int __init rtl92se_module_init(void)

^ permalink raw reply

* [PATCH 2/5 V2] rtlwifi: Update to new Realtek version - Part I
From: Larry Finger @ 2011-10-12  2:28 UTC (permalink / raw)
  To: linville; +Cc: Chaoming Li, linux-wireless, Larry Finger
In-Reply-To: <1318386531-5859-1-git-send-email-Larry.Finger@lwfinger.net>

From: Chaoming Li <chaoming_li@realsil.com.cn>

This patch incorporate the differences between the 06/20/2011 and
08/16/2011 Realtek releases of the rtlwifi driver.

The changes include:

1. Handling of IEEE80211_HW_CONNECTION_MONITOR.
2. Fix typo to get proper response to nullfunc frames.

Signed-off-by: Chaoming Li <chaoming_li@realsil.com.cn>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/net/wireless/rtlwifi/base.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c
index eafe980..a2704fb 100644
--- a/drivers/net/wireless/rtlwifi/base.c
+++ b/drivers/net/wireless/rtlwifi/base.c
@@ -311,6 +311,8 @@ static void _rtl_init_mac80211(struct ieee80211_hw *hw)
 	    IEEE80211_HW_RX_INCLUDES_FCS |
 	    IEEE80211_HW_BEACON_FILTER |
 	    IEEE80211_HW_AMPDU_AGGREGATION |
+	    IEEE80211_HW_CONNECTION_MONITOR |
+	    /* IEEE80211_HW_SUPPORTS_CQM_RSSI | */
 	    IEEE80211_HW_REPORTS_TX_ACK_STATUS | 0;
 
 	/* swlps or hwlps has been set in diff chip in init_sw_vars */
@@ -850,7 +852,7 @@ void rtl_get_tcb_desc(struct ieee80211_hw *hw,
 		 *So tcb_desc->hw_rate is just used for
 		 *special data and mgt frames
 		 */
-		if (info->control.rates[0].idx == 0 &&
+		if (info->control.rates[0].idx == 0 ||
 				ieee80211_is_nullfunc(fc)) {
 			tcb_desc->use_driver_rate = true;
 			tcb_desc->ratr_index = RATR_INX_WIRELESS_MC;
@@ -1138,7 +1140,7 @@ void rtl_watchdog_wq_callback(void *data)
 	}
 
 	/*
-	 *<3> to check if traffic busy, if
+	 *<2> to check if traffic busy, if
 	 * busytraffic we don't change channel
 	 */
 	if (mac->link_state >= MAC80211_LINKED) {
-- 
1.7.6.4


^ permalink raw reply related

* [PATCH 3/5 V2] rtlwifi: rtl8192ce: Add new chip revisions
From: Larry Finger @ 2011-10-12  2:28 UTC (permalink / raw)
  To: linville; +Cc: Chaoming Li, linux-wireless, Larry Finger
In-Reply-To: <1318386531-5859-1-git-send-email-Larry.Finger@lwfinger.net>

From: Chaoming Li <chaoming_li@realsil.com.cn>

This patch incorporate the differences between the 06/20/2011 and
08/16/2011 Realtek releases of the rtlwifi driver.

The changes include:

1. Adding new chip revisions including new firmware.

Signed-off-by: Chaoming Li <chaoming_li@realsil.com.cn>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/net/wireless/rtlwifi/rtl8192ce/def.h |   14 ++++++++++++++
 drivers/net/wireless/rtlwifi/rtl8192ce/sw.c  |   14 ++++++++++++--
 drivers/net/wireless/rtlwifi/rtl8192cu/def.h |    4 ----
 3 files changed, 26 insertions(+), 6 deletions(-)

Index: wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192ce/def.h
===================================================================
--- wireless-testing-new.orig/drivers/net/wireless/rtlwifi/rtl8192ce/def.h
+++ wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192ce/def.h
@@ -142,8 +142,22 @@ enum version_8192c {
 	VERSION_UNKNOWN = 0x88,
 };
 
+#define CUT_VERSION_MASK		(BIT(6)|BIT(7))
+#define CHIP_VENDOR_UMC			BIT(5)
+#define CHIP_VENDOR_UMC_B_CUT		BIT(6) /* Chip version for ECO */
+#define IS_VENDOR_UMC_A_CUT(version)	((IS_CHIP_VENDOR_UMC(version)) ? \
+	((GET_CVID_CUT_VERSION(version)) ? false : true) : false)
 #define IS_CHIP_VER_B(version)  ((version & CHIP_VER_B) ? true : false)
+#define IS_VENDOR_UMC_A_CUT(version)	((IS_CHIP_VENDOR_UMC(version)) ? \
+	((GET_CVID_CUT_VERSION(version)) ? false : true) : false)
 #define IS_92C_SERIAL(version)  ((version & CHIP_92C_BITMASK) ? true : false)
+#define IS_CHIP_VENDOR_UMC(version)		\
+	((version & CHIP_VENDOR_UMC) ? true : false)
+#define GET_CVID_CUT_VERSION(version)	((version) & CUT_VERSION_MASK)
+#define IS_81xxC_VENDOR_UMC_B_CUT(version)		\
+	((IS_CHIP_VENDOR_UMC(version)) ? \
+	((GET_CVID_CUT_VERSION(version) == CHIP_VENDOR_UMC_B_CUT) ?	\
+	true : false) : false)
 
 enum rtl819x_loopback_e {
 	RTL819X_NO_LOOPBACK = 0,
Index: wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
===================================================================
--- wireless-testing-new.orig/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
+++ wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
@@ -92,6 +92,8 @@ int rtl92c_init_sw_vars(struct ieee80211
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
 	const struct firmware *firmware;
+	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
+	char *fw_name = NULL;
 
 	rtl8192ce_bt_reg_init(hw);
 
@@ -161,8 +163,14 @@ int rtl92c_init_sw_vars(struct ieee80211
 	}
 
 	/* request fw */
-	err = request_firmware(&firmware, rtlpriv->cfg->fw_name,
-			rtlpriv->io.dev);
+	if (IS_VENDOR_UMC_A_CUT(rtlhal->version) &&
+	    !IS_92C_SERIAL(rtlhal->version))
+		fw_name = "rtlwifi/rtl8192cfwU.bin";
+	else if (IS_81xxC_VENDOR_UMC_B_CUT(rtlhal->version))
+		fw_name = "rtlwifi/rtl8192cfwU_B.bin";
+	else
+		fw_name = rtlpriv->cfg->fw_name;
+	err = request_firmware(&firmware, fw_name, rtlpriv->io.dev);
 	if (err) {
 		RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
 			 ("Failed to request firmware!\n"));
@@ -358,6 +366,8 @@ MODULE_AUTHOR("Larry Finger	<Larry.Finge
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Realtek 8192C/8188C 802.11n PCI wireless");
 MODULE_FIRMWARE("rtlwifi/rtl8192cfw.bin");
+MODULE_FIRMWARE("rtlwifi/rtl8192cfwU.bin");
+MODULE_FIRMWARE("rtlwifi/rtl8192cfwU_B.bin");
 
 module_param_named(swenc, rtl92ce_mod_params.sw_crypto, bool, 0444);
 module_param_named(debug, rtl92ce_mod_params.debug, int, 0444);
Index: wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192cu/def.h
===================================================================
--- wireless-testing-new.orig/drivers/net/wireless/rtlwifi/rtl8192cu/def.h
+++ wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192cu/def.h
@@ -50,10 +50,6 @@
 #define IS_VENDOR_UMC(version)		\
 	(((version) & CHIP_VENDOR_UMC) ? true : false)
 
-#define IS_VENDOR_UMC_A_CUT(version)	\
-	(((version) & CHIP_VENDOR_UMC) ? (((version) & (BIT(6) | BIT(7))) ? \
-	false : true) : false)
-
 #define IS_VENDOR_8723_A_CUT(version)	\
 	(((version) & CHIP_VENDOR_UMC) ? (((version) & (BIT(6))) ? \
 	false : true) : false)

^ permalink raw reply

* [PATCH 4/5 V2] rtlwifi: rtl8192se: Updates from latest Realtek driver version - Part II
From: Larry Finger @ 2011-10-12  2:28 UTC (permalink / raw)
  To: linville; +Cc: Chaoming Li, linux-wireless, Larry Finger
In-Reply-To: <1318386531-5859-1-git-send-email-Larry.Finger@lwfinger.net>

From: Chaoming Li <chaoming_li@realsil.com.cn>

This patch incorporate the differences between the 06/20/2011 and
08/16/2011 Realtek releases of the rtl8192se driver.

The changes include:

1. Fixing some typos in register usage.
2. A change in the handling of decryption status for 802.11w packets.

Signed-off-by: Chaoming Li <chaoming_li@realsil.com.cn>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/net/wireless/rtlwifi/rtl8192se/hw.c  |   22 +++++-----
 drivers/net/wireless/rtlwifi/rtl8192se/reg.h |    1 +
 drivers/net/wireless/rtlwifi/rtl8192se/sw.c  |    1 +
 drivers/net/wireless/rtlwifi/rtl8192se/trx.c |   53 +++++++++++++++----------
 drivers/net/wireless/rtlwifi/wifi.h          |    1 +
 5 files changed, 46 insertions(+), 32 deletions(-)

Index: wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192se/hw.c
===================================================================
--- wireless-testing-new.orig/drivers/net/wireless/rtlwifi/rtl8192se/hw.c
+++ wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192se/hw.c
@@ -1382,7 +1382,7 @@ static void _rtl92se_power_domain_init(s
 	rtl_write_byte(rtlpriv, LDOA15_CTRL, 0x34);
 
 	/* Reset MAC-IO and CPU and Core Digital BIT10/11/15 */
-	tmpu1b = rtl_read_byte(rtlpriv, SYS_FUNC_EN + 1);
+	tmpu1b = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1);
 
 	/* If IPS we need to turn LED on. So we not
 	 * not disable BIT 3/7 of reg3. */
@@ -1391,7 +1391,7 @@ static void _rtl92se_power_domain_init(s
 	else
 		tmpu1b &= 0x73;
 
-	rtl_write_byte(rtlpriv, SYS_FUNC_EN + 1, tmpu1b);
+	rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, tmpu1b);
 	/* wait for BIT 10/11/15 to pull high automatically!! */
 	mdelay(1);
 
@@ -1428,15 +1428,15 @@ static void _rtl92se_power_domain_init(s
 	rtl_write_byte(rtlpriv, LDOA15_CTRL, (tmpu1b | BIT(0)));
 
 	/* Set Digital Vdd to Retention isolation Path. */
-	tmpu2b = rtl_read_word(rtlpriv, SYS_ISO_CTRL);
-	rtl_write_word(rtlpriv, SYS_ISO_CTRL, (tmpu2b | BIT(11)));
+	tmpu2b = rtl_read_word(rtlpriv, REG_SYS_ISO_CTRL);
+	rtl_write_word(rtlpriv, REG_SYS_ISO_CTRL, (tmpu2b | BIT(11)));
 
 
 	/* For warm reboot NIC disappera bug. */
-	tmpu2b = rtl_read_word(rtlpriv, SYS_FUNC_EN);
-	rtl_write_word(rtlpriv, SYS_FUNC_EN, (tmpu2b | BIT(13)));
+	tmpu2b = rtl_read_word(rtlpriv, REG_SYS_FUNC_EN);
+	rtl_write_word(rtlpriv, REG_SYS_FUNC_EN, (tmpu2b | BIT(13)));
 
-	rtl_write_byte(rtlpriv, SYS_ISO_CTRL + 1, 0x68);
+	rtl_write_byte(rtlpriv, REG_SYS_ISO_CTRL + 1, 0x68);
 
 	/* Enable AFE PLL Macro Block */
 	tmpu1b = rtl_read_byte(rtlpriv, AFE_PLL_CTRL);
@@ -1447,17 +1447,17 @@ static void _rtl92se_power_domain_init(s
 	mdelay(1);
 
 	/* Release isolation AFE PLL & MD */
-	rtl_write_byte(rtlpriv, SYS_ISO_CTRL, 0xA6);
+	rtl_write_byte(rtlpriv, REG_SYS_ISO_CTRL, 0xA6);
 
 	/* Enable MAC clock */
 	tmpu2b = rtl_read_word(rtlpriv, SYS_CLKR);
 	rtl_write_word(rtlpriv, SYS_CLKR, (tmpu2b | BIT(12) | BIT(11)));
 
 	/* Enable Core digital and enable IOREG R/W */
-	tmpu2b = rtl_read_word(rtlpriv, SYS_FUNC_EN);
-	rtl_write_word(rtlpriv, SYS_FUNC_EN, (tmpu2b | BIT(11)));
+	tmpu2b = rtl_read_word(rtlpriv, REG_SYS_FUNC_EN);
+	rtl_write_word(rtlpriv, REG_SYS_FUNC_EN, (tmpu2b | BIT(11)));
 	/* enable REG_EN */
-	rtl_write_word(rtlpriv, SYS_FUNC_EN, (tmpu2b | BIT(11) | BIT(15)));
+	rtl_write_word(rtlpriv, REG_SYS_FUNC_EN, (tmpu2b | BIT(11) | BIT(15)));
 
 	/* Switch the control path. */
 	tmpu2b = rtl_read_word(rtlpriv, SYS_CLKR);
Index: wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192se/reg.h
===================================================================
--- wireless-testing-new.orig/drivers/net/wireless/rtlwifi/rtl8192se/reg.h
+++ wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192se/reg.h
@@ -735,6 +735,7 @@
 #define	HWSET_MAX_SIZE_92S			128
 #define EFUSE_MAX_SECTION			16
 #define EFUSE_REAL_CONTENT_LEN			512
+#define EFUSE_OOB_PROTECT_BYTES			15
 
 #define RTL8190_EEPROM_ID			0x8129
 #define EEPROM_HPON				0x02
Index: wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
===================================================================
--- wireless-testing-new.orig/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
+++ wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
@@ -307,6 +307,7 @@ static struct rtl_hal_cfg rtl92se_hal_cf
 	.maps[EFUSE_HWSET_MAX_SIZE] = HWSET_MAX_SIZE_92S,
 	.maps[EFUSE_MAX_SECTION_MAP] = EFUSE_MAX_SECTION,
 	.maps[EFUSE_REAL_CONTENT_SIZE] = EFUSE_REAL_CONTENT_LEN,
+	.maps[EFUSE_OOB_PROTECT_BYTES_LEN] = EFUSE_OOB_PROTECT_BYTES,
 
 	.maps[RWCAM] = REG_RWCAM,
 	.maps[WCAMI] = REG_WCAMI,
Index: wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
===================================================================
--- wireless-testing-new.orig/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
+++ wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
@@ -124,18 +124,15 @@ static void _rtl92se_query_rxphystatus(s
 	u8 i, max_spatial_stream;
 	u32 rssi, total_rssi = 0;
 	bool in_powersavemode = false;
-	bool is_cck_rate;
+	bool is_cck = pstats->is_cck;
 
-	is_cck_rate = SE_RX_HAL_IS_CCK_RATE(pdesc);
 	pstats->packet_matchbssid = packet_match_bssid;
 	pstats->packet_toself = packet_toself;
-	pstats->is_cck = is_cck_rate;
 	pstats->packet_beacon = packet_beacon;
-	pstats->is_cck = is_cck_rate;
 	pstats->rx_mimo_signalquality[0] = -1;
 	pstats->rx_mimo_signalquality[1] = -1;
 
-	if (is_cck_rate) {
+	if (is_cck) {
 		u8 report, cck_highpwr;
 		cck_buf = (struct phy_sts_cck_8192s_t *)p_drvinfo;
 
@@ -246,9 +243,8 @@ static void _rtl92se_query_rxphystatus(s
 		pstats->rxpower = rx_pwr_all;
 		pstats->recvsignalpower = rx_pwr_all;
 
-		if (GET_RX_STATUS_DESC_RX_HT(pdesc) &&
-			GET_RX_STATUS_DESC_RX_MCS(pdesc) >= DESC92_RATEMCS8 &&
-		    GET_RX_STATUS_DESC_RX_MCS(pdesc) <= DESC92_RATEMCS15)
+		if (pstats->is_ht && pstats->rate >= DESC92_RATEMCS8 &&
+		    pstats->rate <= DESC92_RATEMCS15)
 			max_spatial_stream = 2;
 		else
 			max_spatial_stream = 1;
@@ -266,7 +262,7 @@ static void _rtl92se_query_rxphystatus(s
 		}
 	}
 
-	if (is_cck_rate)
+	if (is_cck)
 		pstats->signalstrength = (u8)(_rtl92se_signal_scale_mapping(hw,
 					 pwdb_all));
 	else if (rf_rx_num != 0)
@@ -518,6 +514,7 @@ bool rtl92se_rx_query_desc(struct ieee80
 {
 	struct rx_fwinfo *p_drvinfo;
 	u32 phystatus = (u32)GET_RX_STATUS_DESC_PHY_STATUS(pdesc);
+	struct ieee80211_hdr *hdr;
 
 	stats->length = (u16)GET_RX_STATUS_DESC_PKT_LEN(pdesc);
 	stats->rx_drvinfo_size = (u8)GET_RX_STATUS_DESC_DRVINFO_SIZE(pdesc) * 8;
@@ -530,8 +527,12 @@ bool rtl92se_rx_query_desc(struct ieee80
 	stats->rate = (u8)GET_RX_STATUS_DESC_RX_MCS(pdesc);
 	stats->shortpreamble = (u16)GET_RX_STATUS_DESC_SPLCP(pdesc);
 	stats->isampdu = (bool)(GET_RX_STATUS_DESC_PAGGR(pdesc) == 1);
+	stats->isfirst_ampdu = (bool) ((GET_RX_STATUS_DESC_PAGGR(pdesc) == 1)
+			       && (GET_RX_STATUS_DESC_FAGGR(pdesc) == 1));
 	stats->timestamp_low = GET_RX_STATUS_DESC_TSFL(pdesc);
 	stats->rx_is40Mhzpacket = (bool)GET_RX_STATUS_DESC_BW(pdesc);
+	stats->is_ht = (bool)GET_RX_STATUS_DESC_RX_HT(pdesc);
+	stats->is_cck = SE_RX_HAL_IS_CCK_RATE(pdesc);
 
 	if (stats->hwerror)
 		return false;
@@ -539,29 +540,39 @@ bool rtl92se_rx_query_desc(struct ieee80
 	rx_status->freq = hw->conf.channel->center_freq;
 	rx_status->band = hw->conf.channel->band;
 
-	if (GET_RX_STATUS_DESC_CRC32(pdesc))
-		rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
+	hdr = (struct ieee80211_hdr *)(skb->data + stats->rx_drvinfo_size
+	      + stats->rx_bufshift);
 
-	if (!GET_RX_STATUS_DESC_SWDEC(pdesc))
-		rx_status->flag |= RX_FLAG_DECRYPTED;
+	if (stats->crc)
+		rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
 
-	if (GET_RX_STATUS_DESC_BW(pdesc))
+	if (stats->rx_is40Mhzpacket)
 		rx_status->flag |= RX_FLAG_40MHZ;
 
-	if (GET_RX_STATUS_DESC_RX_HT(pdesc))
+	if (stats->is_ht)
 		rx_status->flag |= RX_FLAG_HT;
 
 	rx_status->flag |= RX_FLAG_MACTIME_MPDU;
 
-	if (stats->decrypted)
-		rx_status->flag |= RX_FLAG_DECRYPTED;
+	/* hw will set stats->decrypted true, if it finds the
+	 * frame is open data frame or mgmt frame,
+	 * hw will not decrypt robust managment frame
+	 * for IEEE80211w but still set stats->decrypted
+	 * true, so here we should set it back to undecrypted
+	 * for IEEE80211w frame, and mac80211 sw will help
+	 * to decrypt it */
+	if (stats->decrypted) {
+		if ((ieee80211_is_robust_mgmt_frame(hdr)) &&
+			(ieee80211_has_protected(hdr->frame_control)))
+			rx_status->flag &= ~RX_FLAG_DECRYPTED;
+		else
+			rx_status->flag |= RX_FLAG_DECRYPTED;
+	}
 
 	rx_status->rate_idx = rtlwifi_rate_mapping(hw,
-				(bool)GET_RX_STATUS_DESC_RX_HT(pdesc),
-				(u8)GET_RX_STATUS_DESC_RX_MCS(pdesc));
-
+			     stats->is_ht, stats->rate);
 
-	rx_status->mactime = GET_RX_STATUS_DESC_TSFL(pdesc);
+	rx_status->mactime = stats->timestamp_low;
 	if (phystatus) {
 		p_drvinfo = (struct rx_fwinfo *)(skb->data +
 						 stats->rx_bufshift);
Index: wireless-testing-new/drivers/net/wireless/rtlwifi/wifi.h
===================================================================
--- wireless-testing-new.orig/drivers/net/wireless/rtlwifi/wifi.h
+++ wireless-testing-new/drivers/net/wireless/rtlwifi/wifi.h
@@ -450,6 +450,7 @@ enum rtl_var_map {
 	EFUSE_HWSET_MAX_SIZE,
 	EFUSE_MAX_SECTION_MAP,
 	EFUSE_REAL_CONTENT_SIZE,
+	EFUSE_OOB_PROTECT_BYTES_LEN,
 
 	/*CAM map */
 	RWCAM,
@@ -1324,6 +1325,7 @@ struct rtl_stats {
 	s8 rx_mimo_signalquality[2];
 	bool packet_matchbssid;
 	bool is_cck;
+	bool is_ht;
 	bool packet_toself;
 	bool packet_beacon;	/*for rssi */
 	char cck_adc_pwdb[4];	/*for rx path selection */

^ permalink raw reply

* [PATCH 5/5 V2] rtlwifi: rtl8192de: Updates from latest Reaktek driver - Part III
From: Larry Finger @ 2011-10-12  2:28 UTC (permalink / raw)
  To: linville; +Cc: Chaoming Li, linux-wireless, Larry Finger
In-Reply-To: <1318386531-5859-1-git-send-email-Larry.Finger@lwfinger.net>

From: Chaoming Li <chaoming_li@realsil.com.cn>

This patch incorporate the differences between the 06/20/2011 and
08/16/2011 Realtek releases of the rtl8192de driver.

The changes include:

1. Update for new chip versions

Signed-off-by: Chaoming Li <chaoming_li@realsil.com.cn>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/net/wireless/rtlwifi/rtl8192de/def.h |  124 ++++++++++++++++----------
 drivers/net/wireless/rtlwifi/rtl8192de/hw.c  |   19 ++---
 2 files changed, 84 insertions(+), 59 deletions(-)

Index: wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192de/def.h
===================================================================
--- wireless-testing-new.orig/drivers/net/wireless/rtlwifi/rtl8192de/def.h
+++ wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192de/def.h
@@ -122,60 +122,99 @@
 #define	GET_C2H_CMD_FEEDBACK_CCX_SEQ(__pcmdfbhdr)	\
 	LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 20, 12)
 
-/*
- * 92D chip ver:
- * BIT8: IS 92D
- * BIT9: single phy
- * BIT10: C-cut
- * BIT11: D-cut
- */
-
-/* Chip specific */
-#define CHIP_92C			BIT(0)
-#define CHIP_92C_1T2R			BIT(1)
-#define CHIP_8723			BIT(2) /* RTL8723 With BT feature */
-#define CHIP_8723_DRV_REV		BIT(3) /* RTL8723 Driver Revised */
-#define NORMAL_CHIP			BIT(4)
-#define CHIP_VENDOR_UMC			BIT(5)
-#define CHIP_VENDOR_UMC_B_CUT		BIT(6) /* Chip version for ECO */
+enum version_8192d {
+	VERSION_TEST_CHIP_88C = 0x0000,
+	VERSION_TEST_CHIP_92C = 0x0020,
+	VERSION_TEST_UMC_CHIP_8723 = 0x0081,
+	VERSION_NORMAL_TSMC_CHIP_88C = 0x0008,
+	VERSION_NORMAL_TSMC_CHIP_92C = 0x0028,
+	VERSION_NORMAL_TSMC_CHIP_92C_1T2R = 0x0018,
+	VERSION_NORMAL_UMC_CHIP_88C_A_CUT = 0x0088,
+	VERSION_NORMAL_UMC_CHIP_92C_A_CUT = 0x00a8,
+	VERSION_NORMAL_UMC_CHIP_92C_1T2R_A_CUT = 0x0098,
+	VERSION_NORMAL_UMC_CHIP_8723_1T1R_A_CUT = 0x0089,
+	VERSION_NORMAL_UMC_CHIP_8723_1T1R_B_CUT = 0x1089,
+	VERSION_NORMAL_UMC_CHIP_88C_B_CUT = 0x1088,
+	VERSION_NORMAL_UMC_CHIP_92C_B_CUT = 0x10a8,
+	VERSION_NORMAL_UMC_CHIP_92C_1T2R_B_CUT = 0x1090,
+	VERSION_TEST_CHIP_92D_SINGLEPHY = 0x0022,
+	VERSION_TEST_CHIP_92D_DUALPHY = 0x0002,
+	VERSION_NORMAL_CHIP_92D_SINGLEPHY = 0x002a,
+	VERSION_NORMAL_CHIP_92D_DUALPHY = 0x000a,
+	VERSION_NORMAL_CHIP_92D_C_CUT_SINGLEPHY = 0x202a,
+	VERSION_NORMAL_CHIP_92D_C_CUT_DUALPHY = 0x200a,
+	VERSION_NORMAL_CHIP_92D_D_CUT_SINGLEPHY = 0x302a,
+	VERSION_NORMAL_CHIP_92D_D_CUT_DUALPHY = 0x300a,
+	VERSION_NORMAL_CHIP_92D_E_CUT_SINGLEPHY = 0x402a,
+	VERSION_NORMAL_CHIP_92D_E_CUT_DUALPHY = 0x400a,
+};
 
 /* for 92D */
-#define CHIP_92D			BIT(8)
 #define CHIP_92D_SINGLEPHY		BIT(9)
+#define C_CUT_VERSION			BIT(13)
+#define D_CUT_VERSION			((BIT(12)|BIT(13)))
+#define E_CUT_VERSION			BIT(14)
+
+/* Chip specific */
+#define CHIP_BONDING_IDENTIFIER(_value)	(((_value)>>22)&0x3)
+#define CHIP_BONDING_92C_1T2R			0x1
+#define CHIP_BONDING_88C_USB_MCARD		0x2
+#define CHIP_BONDING_88C_USB_HP			0x1
+
+/* [15:12] IC version(CUT): A-cut=0, B-cut=1, C-cut=2, D-cut=3 */
+/* [7] Manufacturer: TSMC=0, UMC=1 */
+/* [6:4] RF type: 1T1R=0, 1T2R=1, 2T2R=2 */
+/* [3] Chip type: TEST=0, NORMAL=1 */
+/* [2:0] IC type: 81xxC=0, 8723=1, 92D=2 */
+#define CHIP_8723			BIT(0)
+#define CHIP_92D			BIT(1)
+#define NORMAL_CHIP			BIT(3)
+#define RF_TYPE_1T1R			(~(BIT(4)|BIT(5)|BIT(6)))
+#define RF_TYPE_1T2R			BIT(4)
+#define RF_TYPE_2T2R			BIT(5)
+#define CHIP_VENDOR_UMC			BIT(7)
+#define B_CUT_VERSION			BIT(12)
+
+/* MASK */
+#define IC_TYPE_MASK			(BIT(0)|BIT(1)|BIT(2))
+#define CHIP_TYPE_MASK			BIT(3)
+#define RF_TYPE_MASK			(BIT(4)|BIT(5)|BIT(6))
+#define MANUFACTUER_MASK		BIT(7)
+#define ROM_VERSION_MASK		(BIT(11)|BIT(10)|BIT(9)|BIT(8))
+#define CUT_VERSION_MASK		(BIT(15)|BIT(14)|BIT(13)|BIT(12))
+
+
+/* Get element */
+#define GET_CVID_IC_TYPE(version)	((version) & IC_TYPE_MASK)
+#define GET_CVID_CHIP_TYPE(version)	((version) & CHIP_TYPE_MASK)
+#define GET_CVID_RF_TYPE(version)	((version) & RF_TYPE_MASK)
+#define GET_CVID_MANUFACTUER(version)	((version) & MANUFACTUER_MASK)
+#define GET_CVID_ROM_VERSION(version)	((version) & ROM_VERSION_MASK)
+#define GET_CVID_CUT_VERSION(version)	((version) & CUT_VERSION_MASK)
+
+#define IS_1T1R(version)		((GET_CVID_RF_TYPE(version)) ?	\
+					 false : true)
+#define IS_1T2R(version)		((GET_CVID_RF_TYPE(version) ==	\
+					 RF_TYPE_1T2R) ? true : false)
+#define IS_2T2R(version)		((GET_CVID_RF_TYPE(version) ==	\
+					 RF_TYPE_2T2R) ? true : false)
+
+#define IS_92D_SINGLEPHY(version)	((IS_92D(version)) ?		\
+				 (IS_2T2R(version) ? true : false) : false)
+#define IS_92D(version)			((GET_CVID_IC_TYPE(version) ==	\
+					 CHIP_92D) ? true : false)
+#define IS_92D_C_CUT(version)		((IS_92D(version)) ?		\
+				 ((GET_CVID_CUT_VERSION(version) ==	\
+				 0x2000) ? true : false) : false)
+#define IS_92D_D_CUT(version)			((IS_92D(version)) ?	\
+				 ((GET_CVID_CUT_VERSION(version) ==	\
+				 0x3000) ? true : false) : false)
+#define IS_92D_E_CUT(version)		((IS_92D(version)) ?		\
+				 ((GET_CVID_CUT_VERSION(version) ==	\
+				 0x4000) ? true : false) : false)
 #define CHIP_92D_C_CUT			BIT(10)
 #define CHIP_92D_D_CUT			BIT(11)
 
-enum version_8192d {
-	VERSION_TEST_CHIP_88C = 0x00,
-	VERSION_TEST_CHIP_92C = 0x01,
-	VERSION_NORMAL_TSMC_CHIP_88C = 0x10,
-	VERSION_NORMAL_TSMC_CHIP_92C = 0x11,
-	VERSION_NORMAL_TSMC_CHIP_92C_1T2R = 0x13,
-	VERSION_NORMAL_UMC_CHIP_88C_A_CUT = 0x30,
-	VERSION_NORMAL_UMC_CHIP_92C_A_CUT = 0x31,
-	VERSION_NORMAL_UMC_CHIP_92C_1T2R_A_CUT = 0x33,
-	VERSION_NORMA_UMC_CHIP_8723_1T1R_A_CUT = 0x34,
-	VERSION_NORMA_UMC_CHIP_8723_1T1R_B_CUT = 0x3c,
-	VERSION_NORMAL_UMC_CHIP_88C_B_CUT = 0x70,
-	VERSION_NORMAL_UMC_CHIP_92C_B_CUT = 0x71,
-	VERSION_NORMAL_UMC_CHIP_92C_1T2R_B_CUT = 0x73,
-	VERSION_TEST_CHIP_92D_SINGLEPHY = 0x300,
-	VERSION_TEST_CHIP_92D_DUALPHY = 0x100,
-	VERSION_NORMAL_CHIP_92D_SINGLEPHY = 0x310,
-	VERSION_NORMAL_CHIP_92D_DUALPHY = 0x110,
-	VERSION_NORMAL_CHIP_92D_C_CUT_SINGLEPHY = 0x710,
-	VERSION_NORMAL_CHIP_92D_C_CUT_DUALPHY = 0x510,
-	VERSION_NORMAL_CHIP_92D_D_CUT_SINGLEPHY = 0xB10,
-	VERSION_NORMAL_CHIP_92D_D_CUT_DUALPHY = 0x910,
-};
-
-#define IS_92D_SINGLEPHY(version)		\
-	((version & CHIP_92D_SINGLEPHY) ? true : false)
-#define IS_92D_C_CUT(version)			\
-	((version & CHIP_92D_C_CUT) ? true : false)
-#define IS_92D_D_CUT(version)			\
-	((version & CHIP_92D_D_CUT) ? true : false)
-
 enum rf_optype {
 	RF_OP_BY_SW_3WIRE = 0,
 	RF_OP_BY_FW,
Index: wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192de/hw.c
===================================================================
--- wireless-testing-new.orig/drivers/net/wireless/rtlwifi/rtl8192de/hw.c
+++ wireless-testing-new/drivers/net/wireless/rtlwifi/rtl8192de/hw.c
@@ -1608,17 +1608,16 @@ static void _rtl92de_read_txpower_info(s
 		tempval[0] = hwinfo[EEPROM_IQK_DELTA] & 0x03;
 		tempval[1] = (hwinfo[EEPROM_LCK_DELTA] & 0x0C) >> 2;
 		rtlefuse->txpwr_fromeprom = true;
-		if (IS_92D_D_CUT(rtlpriv->rtlhal.version)) {
+		if (IS_92D_D_CUT(rtlpriv->rtlhal.version) ||
+		    IS_92D_E_CUT(rtlpriv->rtlhal.version)) {
 			rtlefuse->internal_pa_5g[0] =
-				 !((hwinfo[EEPROM_TSSI_A_5G] &
-				 BIT(6)) >> 6);
+				!((hwinfo[EEPROM_TSSI_A_5G] & BIT(6)) >> 6);
 			rtlefuse->internal_pa_5g[1] =
-				 !((hwinfo[EEPROM_TSSI_B_5G] &
-				 BIT(6)) >> 6);
-			RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
+				!((hwinfo[EEPROM_TSSI_B_5G] & BIT(6)) >> 6);
+			RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
 				 ("Is D cut,Internal PA0 %d Internal PA1 %d\n",
-				  rtlefuse->internal_pa_5g[0],
-				  rtlefuse->internal_pa_5g[1]))
+				 rtlefuse->internal_pa_5g[0],
+				 rtlefuse->internal_pa_5g[1]))
 		}
 		rtlefuse->eeprom_c9 = hwinfo[EEPROM_RF_OPT6];
 		rtlefuse->eeprom_cc = hwinfo[EEPROM_RF_OPT7];

^ permalink raw reply

* Re: [RFC 01/07] wireless-next: WAPI support for hardware-accelerated drivers
From: Julian Calaby @ 2011-10-12  2:54 UTC (permalink / raw)
  To: Dmitry Tarnyagin; +Cc: linux-wireless, Bartosz MARKOWSKI, Janusz DZIEDZIC
In-Reply-To: <op.v27rufm9ya27un@edmitar>

Hi Dmitry,

Some minor comments on your patch:

Note that I'm not a maintainer and that these are comments on the
patch itself, not the code it adds.

On Wed, Oct 12, 2011 at 12:02, Dmitry Tarnyagin <abi.dmitryt@gmail.com> wrote:
> From: Janusz Dziedzic <janusz.dziedzic@tieto.com>
> Date: Wed, 1 Jun 2011 14:40:13 +0200
>
> This commit implements WAPI support for hardware-accelerated devices.
>
> Signed-off-by: Dmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>
> ---
> diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
> index 48363c3..bf86b0d 100644
> --- a/include/linux/ieee80211.h
> +++ b/include/linux/ieee80211.h
> @@ -1551,12 +1552,14 @@ enum ieee80211_sa_query_action {
>  #define WLAN_CIPHER_SUITE_CCMP         0x000FAC04
>  #define WLAN_CIPHER_SUITE_WEP104       0x000FAC05
>  #define WLAN_CIPHER_SUITE_AES_CMAC     0x000FAC06
> +#define WLAN_CIPHER_SUITE_SMS4         0x000FAC07
>
>  /* AKM suite selectors */
>  #define WLAN_AKM_SUITE_8021X           0x000FAC01
>  #define WLAN_AKM_SUITE_PSK             0x000FAC02
>  #define WLAN_AKM_SUITE_SAE                     0x000FAC08
>  #define WLAN_AKM_SUITE_FT_OVER_SAE     0x000FAC09
> +#define WLAN_AKM_SUITE_WAPI_PSK                0x000FAC03

Should these go in numerical order?

> diff --git a/net/mac80211/wapi.h b/net/mac80211/wapi.h
> new file mode 100644
> index 0000000..f06eee0
> --- /dev/null
> +++ b/net/mac80211/wapi.h
> @@ -0,0 +1,27 @@

[snip]

> +#ifndef ETH_P_WAPI
> +#define ETH_P_WAPI     0x88B4
> +#endif

Should this go somewhere else? Maybe where the other ETH_P_* #defines
are defined?

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
.Plan: http://sites.google.com/site/juliancalaby/

^ permalink raw reply

* Re: [RFC 02/07] compat-wireless: Connection quality monitor extensions
From: Julian Calaby @ 2011-10-12  3:15 UTC (permalink / raw)
  To: Dmitry Tarnyagin; +Cc: linux-wireless, Bartosz MARKOWSKI, Janusz DZIEDZIC
In-Reply-To: <op.v27rulkhya27un@edmitar>

Hi Dmitry,

Some minor comments on this patch:

Note that I'm not a maintainer and that these are comments on the
patch itself, not the code it adds.

That said, it's nice to see someone updating compat-wireless when they
update the main wireless repository.

On Wed, Oct 12, 2011 at 12:02, Dmitry Tarnyagin <abi.dmitryt@gmail.com> wrote:
> From: Bartosz Markowski <bartosz.markowski@tieto.com>
> Date: Tue, 12 Jul 2011 13:29:03 +0200
> Subject: [PATCH 2/7] compat-wireless: CQM STE extensions
>
> added:
> * beacon miss threshold - This value specifies the threshold
>  for the BEACON loss level
> * tx fail - This value specifies the threshold for the TX loss level
>
> Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
> ---
>  include/linux/compat-3.0.h |    2 +
>  include/linux/nl80211.h    |   16 +++++
>  include/net/cfg80211.h     |   34 ++++++++++
>  include/net/mac80211.h     |   41 ++++++++++++
>  net/mac80211/cfg.c         |   54 ++++++++++++++++
>  net/mac80211/mlme.c        |   23 ++++++-
>  net/wireless/mlme.c        |   25 +++++++
>  net/wireless/nl80211.c     |  152
> +++++++++++++++++++++++++++++++++++++++++++-
>  net/wireless/nl80211.h     |    9 +++

You are changing a lot of files that are not actually part of the
compat-wireless git repository - are you sure that this patch is
correct?

> diff --git a/include/linux/compat-3.0.h b/include/linux/compat-3.0.h
> index 8c8720e..961a3a6 100644
> --- a/include/linux/compat-3.0.h
> +++ b/include/linux/compat-3.0.h
> @@ -59,6 +59,7 @@ int __must_check kstrtos16_from_user(const char __user *s,
> size_t count, unsigne
>  int __must_check kstrtou8_from_user(const char __user *s, size_t count,
> unsigned int base, u8 *res);
>  int __must_check kstrtos8_from_user(const char __user *s, size_t count,
> unsigned int base, s8 *res);
>
> +/*
>  static inline int __must_check kstrtou64_from_user(const char __user *s,
> size_t count, unsigned int base, u64 *res)
>  {
>        return kstrtoull_from_user(s, count, base, res);
> @@ -78,6 +79,7 @@ static inline int __must_check kstrtos32_from_user(const
> char __user *s, size_t
>  {
>        return kstrtoint_from_user(s, count, base, res);
>  }
> +*/

Why are you commenting out this function?

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
.Plan: http://sites.google.com/site/juliancalaby/

^ permalink raw reply

* Re: [RFC 03/07] compat-wireless: Enable changing regulatory domain
From: Julian Calaby @ 2011-10-12  3:17 UTC (permalink / raw)
  To: Dmitry Tarnyagin
  Cc: linux-wireless.vger.kernel.org, Bartosz MARKOWSKI,
	Janusz DZIEDZIC, Johan Lilje
In-Reply-To: <op.v27rusy7ya27un@edmitar>

Hi Dmitry,

Some minor comments on this patch:

Note that I'm not a maintainer and that these are comments on the
patch itself, not the code it adds.

On Wed, Oct 12, 2011 at 12:02, Dmitry Tarnyagin <abi.dmitryt@gmail.com> wrote:
> From: Johan Lilje <johan.lilje@stericsson.com>
> Date: Tue, 2 Aug 2011 09:21:49 +0200
>
> If compat-wireless code is compiled into the kernel,
> first request regulatory hint fails to return since
> userspace is not ready yet.
> Added timeout mechanism to remove old pending requests.
>
> Signed-off-by: Johan Lilje <johan.lilje@stericsson.com>
> ---
>  include/net/regulatory.h |    3 +++
>  net/wireless/reg.c       |   26 +++++++++++++++++++++++---

Again, you're updating files that aren't part of the compat-wireless
repository. Are you sure this patch is correct?

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
.Plan: http://sites.google.com/site/juliancalaby/

^ permalink raw reply

* Re: [RFC 04/07] compat-wireless: p2p power save support
From: Julian Calaby @ 2011-10-12  3:17 UTC (permalink / raw)
  To: Dmitry Tarnyagin
  Cc: linux-wireless.vger.kernel.org, Bartosz MARKOWSKI,
	Janusz DZIEDZIC
In-Reply-To: <op.v27ruwj6ya27un@edmitar>

Hi Dmitry,

Some minor comments on this patch:

Note that I'm not a maintainer and that these are comments on the
patch itself, not the code it adds.

On Wed, Oct 12, 2011 at 12:02, Dmitry Tarnyagin <abi.dmitryt@gmail.com> wrote:
> From: Janusz Dziedzic <janusz.dziedzic@tieto.com>
> Date: Thu, 4 Aug 2011 11:42:16 +0200
>
> P2P power save support:
>  - Opportunistic Power Save
>  - Notice Of Absence
>
> Signed-off-by: Dmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>
> ---
>  include/linux/nl80211.h    |   12 +++++
>  include/net/cfg80211.h     |   34 +++++++++++++
>  include/net/mac80211.h     |    3 +
>  net/mac80211/cfg.c         |   24 +++++++++
>  net/mac80211/ieee80211_i.h |    3 +
>  net/mac80211/mlme.c        |  114
> ++++++++++++++++++++++++++++++++++++++++++
>  net/wireless/nl80211.c     |  119
> ++++++++++++++++++++++++++++++++++++++++++++
>  net/wireless/util.c        |    9 +++

Same again.

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
.Plan: http://sites.google.com/site/juliancalaby/

^ permalink raw reply

* Re: [RFC 06/07] compat-wireless: UAPSD configuration in STA mode
From: Julian Calaby @ 2011-10-12  3:19 UTC (permalink / raw)
  To: Dmitry Tarnyagin
  Cc: linux-wireless.vger.kernel.org, Bartosz MARKOWSKI,
	Janusz DZIEDZIC
In-Reply-To: <op.v27ru00wya27un@edmitar>

Hi Dmitry,

Some minor comments on this patch:

Note that I'm not a maintainer and that these are comments on the
patch itself, not the code it adds.

Again, this is marked as a compat-wireless patch, but you're modifying
files that aren't in compat-wireless. Are you sure this patch is
correct?

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
.Plan: http://sites.google.com/site/juliancalaby/

^ permalink raw reply

* Re: [PATCH] ath6kl: fix firmware start address for ar6003 hw2.0
From: Kalle Valo @ 2011-10-12  7:20 UTC (permalink / raw)
  To: Sangwook Lee; +Cc: linux-wireless
In-Reply-To: <1317906725-31130-1-git-send-email-sangwook.lee@linaro.org>

On 10/06/2011 04:12 PM, Sangwook Lee wrote:
> From: Kalle Valo <kvalo@qca.qualcomm.com>
> 
> Sangwook found out that commit 639d0b89 ("ath6kl: read firmware start
> address from hardware") broke firmware boot on ar6003 hw2.0 as it seems
> it's not posible to automatically query the address from hardware. So
> we need to hardcode the address for hw2.0.
> 
> Reported-by: Sangwook Lee <sangwook.lee@linaro.org>
> Tested-by: Sangwook Lee <sangwook.lee@linaro.org>
> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
> ---
> Kalle:
> I slightly changed again. without running ath6kl_bmi_read() before,
> ath6kl_bmi_execute() failed with hw2.0 board, but I am not clear about this reason.

Hmm, that's strange. I didn't find any reason why this is needed.

> @@ -1201,25 +1202,28 @@ static int ath6kl_upload_otp(struct ath6kl *ar)
>  	}
>  
>  	/* read firmware start address */
> -	ret = ath6kl_bmi_read(ar,
> -			      ath6kl_get_hi_item_addr(ar,
> -						      HI_ITEM(hi_app_start)),
> -			      (u8 *) &address, sizeof(address));
> +	ret = ath6kl_bmi_read(ar, ath6kl_get_hi_item_addr(ar,
> +		HI_ITEM(hi_app_start)), (u8 *) &address, sizeof(address));

You just change indentation here, right? So this part can be dropped.

I have applied to ath6kl.git now. Thank you very much for your help!

Kalle

^ permalink raw reply

* [PATCH] ath6kl: unbreak suspend
From: Kalle Valo @ 2011-10-12  7:42 UTC (permalink / raw)
  To: linux-wireless

From: Sam Leffler <sleffler@chromium.org>

Add missing {}'s that caused ath6kl_sdio_suspend to always return -EINVAL
causing suspend to be aborted.

kvalo: I broke this in commit f7325b85e ("ath6kl: add sdio debug messages")

Signed-off-by: Sam Leffler <sleffler@chromium.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath6kl/sdio.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c b/drivers/net/wireless/ath/ath6kl/sdio.c
index 2394c17..58e31f6 100644
--- a/drivers/net/wireless/ath/ath6kl/sdio.c
+++ b/drivers/net/wireless/ath/ath6kl/sdio.c
@@ -724,12 +724,13 @@ static int ath6kl_sdio_suspend(struct ath6kl *ar)
 
 	flags = sdio_get_host_pm_caps(func);
 
-	if (!(flags & MMC_PM_KEEP_POWER))
+	if (!(flags & MMC_PM_KEEP_POWER)) {
 		/* as host doesn't support keep power we need to bail out */
 		ath6kl_dbg(ATH6KL_DBG_SDIO,
 			   "func %d doesn't support MMC_PM_KEEP_POWER\n",
 			   func->num);
 		return -EINVAL;
+	}
 
 	ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
 	if (ret) {


^ permalink raw reply related

* [patch] iwmc3200wifi: add a range check to iwm_cfg80211_get_key()
From: Dan Carpenter @ 2011-10-12  8:10 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: Intel Linux Wireless, John W. Linville, linux-wireless,
	kernel-janitors

Smatch complains that "key_index" is capped at 5 in nl80211_get_key()
but iwm->keys[] only has 4 elements.  I don't know if this is really
needed, but the other ->get_key() implementations seemed to check
for overflows so I've added a check here.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/net/wireless/iwmc3200wifi/cfg80211.c b/drivers/net/wireless/iwmc3200wifi/cfg80211.c
index ed57e44..c42be81 100644
--- a/drivers/net/wireless/iwmc3200wifi/cfg80211.c
+++ b/drivers/net/wireless/iwmc3200wifi/cfg80211.c
@@ -187,13 +187,17 @@ static int iwm_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
 						 struct key_params*))
 {
 	struct iwm_priv *iwm = ndev_to_iwm(ndev);
-	struct iwm_key *key = &iwm->keys[key_index];
+	struct iwm_key *key;
 	struct key_params params;
 
 	IWM_DBG_WEXT(iwm, DBG, "Getting key %d\n", key_index);
 
+	if (key_index >= IWM_NUM_KEYS)
+		return -ENOENT;
+
 	memset(&params, 0, sizeof(params));
 
+	key = &iwm->keys[key_index];
 	params.cipher = key->cipher;
 	params.key_len = key->key_len;
 	params.seq_len = key->seq_len;

^ permalink raw reply related

* Re: [RFC 01/07] wireless-next: WAPI support for hardware-accelerated drivers
From: Johannes Berg @ 2011-10-12  8:13 UTC (permalink / raw)
  To: Dmitry Tarnyagin; +Cc: linux-wireless, Bartosz MARKOWSKI, Janusz DZIEDZIC
In-Reply-To: <op.v27rufm9ya27un@edmitar>

Hi Dmitry,

Thanks for sending these patches.

Process things first: Your patches are line-wrapped in a few places.
You'll have to fix that later (but it's not very important for the first
round of review)

> This commit implements WAPI support for hardware-accelerated devices.

Note that there's at least one device that supports WAPI already, it has
HW crypto for SMS4. So it is already possible to implement. I'm not
saying this patch is bad though, it may be good to make things gradually
more generic.

> --- a/include/linux/wireless.h
> +++ b/include/linux/wireless.h
> @@ -586,6 +586,7 @@
>   #define IW_AUTH_WPA_VERSION_DISABLED	0x00000001
>   #define IW_AUTH_WPA_VERSION_WPA		0x00000002
>   #define IW_AUTH_WPA_VERSION_WPA2	0x00000004
> +#define IW_AUTH_WPA_VERSION_WAPI	0x00000008

I don't think we should be extending wireless extensions any more, so
please remove all the wireless extensions bits from your patch(es).


> --- a/net/mac80211/Makefile

This patch is changing both mac80211 and cfg80211. I'd prefer to have
clearly separated patches so it is easier to tell which part is mac80211
specific and which will apply to other drivers that don't use mac80211.


> +++ b/net/mac80211/ieee80211_i.h
> @@ -42,7 +42,7 @@ struct ieee80211_local;
>   #define TOTAL_MAX_TX_BUFFER 512
> 
>   /* Required encryption head and tailroom */
> -#define IEEE80211_ENCRYPT_HEADROOM 8
> +#define IEEE80211_ENCRYPT_HEADROOM 20

Hmm. This is pretty wasteful. Is this really the only way you can do
this?

> --- a/net/mac80211/main.c
> +++ b/net/mac80211/main.c
> @@ -716,6 +716,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
>   		WLAN_CIPHER_SUITE_WEP104,
>   		WLAN_CIPHER_SUITE_TKIP,
>   		WLAN_CIPHER_SUITE_CCMP,
> +		WLAN_CIPHER_SUITE_SMS4,

This is quite clearly not true -- you don't support SMS4 unless the
hardware has support for it. As a result, you can't put this here -- you
need to make your low-level driver override the cipher list. See wl12xx
for example.

> --- a/net/mac80211/tx.c
> +++ b/net/mac80211/tx.c
> @@ -31,6 +31,7 @@
>   #include "mesh.h"
>   #include "wep.h"
>   #include "wpa.h"
> +#include "wapi.h"
>   #include "wme.h"
>   #include "rate.h"
> 
> @@ -592,6 +593,11 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data  
> *tx)
>   			if (!ieee80211_is_mgmt(hdr->frame_control))
>   				tx->key = NULL;
>   			break;
> +
> +		case WLAN_CIPHER_SUITE_SMS4:
> +			if (tx->ethertype == ETH_P_WAPI)
> +				tx->key = NULL;
> +			break;

This is wrong -- and already covered by
ieee80211_tx_h_check_control_port_protocol() if you set that up
correctly from nl80211. Another reason to get rid of wireless extensions
support for this.

> +static int ieee80211_wapi_decrypt(struct ieee80211_local *local,
> +				  struct sk_buff *skb,
> +				  struct ieee80211_key *key)
> +{
> +	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
> +	int hdrlen = ieee80211_hdrlen(hdr->frame_control);
> +	struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
> +	int data_len;
> +
> +	if (!(status->flag & RX_FLAG_DECRYPTED)) {
> +		/* TODO - SMS4 decryption for firmware without
> +		 * SMS4 support */
> +		return RX_DROP_UNUSABLE;
> +	}
> +
> +
> +	data_len = skb->len - hdrlen - WAPI_IV_LEN - WAPI_ICV_LEN;
> +	if (data_len < 0)
> +		return RX_DROP_UNUSABLE;
> +
> +	/* Trim ICV */
> +	skb_trim(skb, skb->len - WAPI_ICV_LEN);
> +
> +	/* Remove IV */
> +	memmove(skb->data + WAPI_IV_LEN, skb->data, hdrlen);
> +	skb_pull(skb, WAPI_IV_LEN);
> +
> +	return RX_CONTINUE;

This is wrong -- if the device didn't strip the IV it likely also didn't
*check* the IV, so it should be checked here. If it *did* check the IV
then we expect drivers to strip it as well.

> +}
> +
> +ieee80211_rx_result
> +ieee80211_crypto_wapi_decrypt(struct ieee80211_rx_data *rx)
> +{
> +	struct sk_buff *skb = rx->skb;
> +	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
> +
> +	if (!ieee80211_is_data(hdr->frame_control))
> +		return RX_CONTINUE;

This probably needs to check data_present, not is_data. But again, I
think if you just strip the IV you can simplify this and move it into
the driver, like wl12xx, unless you need to verify the IV.


> +++ b/net/mac80211/wapi.h

This header file is unnecessary.

> +#ifndef ETH_P_WAPI
> +#define ETH_P_WAPI     0x88B4
> +#endif

This you don't actually need any more given my comments above.

> +ieee80211_rx_result
> +ieee80211_crypto_wapi_decrypt(struct ieee80211_rx_data *rx);

We can stick that into wpa.h. It also needs to be renamed -- it's not
doing decryption. I think you should get rid of it unless you need it to
check IVs.

> @@ -4167,7 +4167,8 @@ static bool nl80211_valid_auth_type(enum  
> nl80211_auth_type auth_type)
>   static bool nl80211_valid_wpa_versions(u32 wpa_versions)
>   {
>   	return !(wpa_versions & ~(NL80211_WPA_VERSION_1 |
> -				  NL80211_WPA_VERSION_2));
> +				  NL80211_WPA_VERSION_2 |
> +				  NL80211_WAPI_VERSION_1));
>   }

If your device is a mac80211 device then this isn't really needed.

johannes


^ permalink raw reply

* [PATCH] iwlagn: fix priv->cfg->ht_params NULL pointer dereference
From: Stanislaw Gruszka @ 2011-10-12  8:16 UTC (permalink / raw)
  To: Wey-Yi Guy; +Cc: linux-wireless, John W. Linville

This fix regression introduced by commit:

commit 15b3f3b006b42a678523cad989bfd60b76bf4403
Author: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Date:   Fri Jun 3 07:54:13 2011 -0700

    iwlagn: set smps mode after assoc for 1000 device

Also remove unneeded brackets on the way.

Address:
https://bugzilla.redhat.com/show_bug.cgi?id=744155

If fix will not get 3.1 release, it should be applied in 3.1 stable.

Cc: stable@kernel.org # 3.1+
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/iwlwifi/iwl-agn-rxon.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
index ca632f9..5004342 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
@@ -296,8 +296,8 @@ static int iwlagn_rxon_connect(struct iwl_priv *priv,
 		return ret;
 	}
 
-	if ((ctx->vif && ctx->vif->type == NL80211_IFTYPE_STATION) &&
-	    priv->cfg->ht_params->smps_mode)
+	if (ctx->vif && ctx->vif->type == NL80211_IFTYPE_STATION &&
+	    priv->cfg->ht_params && priv->cfg->ht_params->smps_mode)
 		ieee80211_request_smps(ctx->vif,
 				       priv->cfg->ht_params->smps_mode);
 
-- 
1.7.1


^ permalink raw reply related

* Re: [RFC 02/07] compat-wireless: Connection quality monitor extensions
From: Johannes Berg @ 2011-10-12  8:21 UTC (permalink / raw)
  To: Dmitry Tarnyagin; +Cc: linux-wireless, Bartosz MARKOWSKI, Janusz DZIEDZIC
In-Reply-To: <op.v27rulkhya27un@edmitar>

On Wed, 2011-10-12 at 03:02 +0200, Dmitry Tarnyagin wrote:

> added:
> * beacon miss threshold - This value specifies the threshold
>    for the BEACON loss level
> * tx fail - This value specifies the threshold for the TX loss level

That's a bit short for a changelog for such a big patch. The patch might
stand to be split up into two and be explained better.

Also, as Julian pointed out -- get your compat vs. wireless tree in
order. You don't want to be modifying the compat repository, it's even
impossible, you need to be submitting patches against wireless-next or
-testing. You also need to make sure they apply against those trees,
which this patch obviously can't:


>   include/linux/compat-3.0.h |    2 +

as you can see easily :)

> +++ b/include/linux/nl80211.h
> @@ -2311,6 +2311,14 @@ enum nl80211_ps_state {
>    * @NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT: RSSI threshold event
>    * @NL80211_ATTR_CQM_PKT_LOSS_EVENT: a u32 value indicating that this many
>    *	consecutive packets were not acknowledged by the peer
> + * @NL80211_ATTR_CQM_BEACON_MISS_THOLD: BEACON threshold. This value  
> specifies
> + *	the threshold for the BEACON loss level at which an event will be
> + *	sent. Zero to disable.

Should it really be zero to disable rather than leaving it out to
disable?

> + * @NL80211_ATTR_CQM_BEACON_MISS_THOLD_EVENT: BEACON miss event
> + * @NL80211_ATTR_CQM_TX_FAIL_THOLD: TX threshold. This value specifies the
> + *	the threshold for the TX loss level at which an event will be
> + *	sent. Zero to disable.
> + * @NL80211_ATTR_CQM_TX_FAIL_THOLD_EVENT: TX threshold event

How's this not the same as PKT_LOSS_EVENT?

Some advertising for whether this is supported or not is necessary.

> +++ b/include/net/mac80211.h

Again a fairly complex patch modifying both cfg80211 and mac80211 -- not
good. Keep in mind that there are in fact drivers not using mac80211.

> @@ -244,6 +244,10 @@ enum ieee80211_rssi_event {
>    * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero  
> value
>    *	implies disabled
>    * @cqm_rssi_hyst: Connection quality monitor RSSI hysteresis
> + * @cqm_beacon_miss_thold: Connection quality monitor beacon threshold, a  
> zero
> + *	value implies disabled
> + * @cqm_tx_fail_thold: Connection quality monitor tx threshold, a zero  
> value
> + *	implies disabled

Your line-wrapping makes this hard to read :(

> +++ b/net/mac80211/cfg.c
> @@ -1751,6 +1751,58 @@ static int ieee80211_set_cqm_rssi_config(struct  
> wiphy *wiphy,
>   	return 0;
>   }
> 
> +static int ieee80211_set_cqm_beacon_miss_config(struct wiphy *wiphy,
> +						struct net_device *dev,
> +						u32 beacon_thold)
> +{
> +	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
> +	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
> +	struct ieee80211_vif *vif = &sdata->vif;
> +	struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
> +
> +	if (beacon_thold == bss_conf->cqm_beacon_miss_thold)
> +		return 0;
> +
> +	bss_conf->cqm_beacon_miss_thold = beacon_thold;
> +
> +	if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_CQM_BEACON_MISS)) {
> +		if (sdata->vif.type != NL80211_IFTYPE_STATION)
> +			return -EOPNOTSUPP;
> +		return 0;

This looks/is wrong in multiple ways.

> +++ b/net/mac80211/mlme.c
> @@ -2174,7 +2174,10 @@ void ieee80211_sta_work(struct  
> ieee80211_sub_if_data *sdata)
>   				    ifmgd->probe_send_count, max_tries);
>   #endif
>   			ieee80211_mgd_probe_ap_send(sdata);
> -		} else {
> +		} else if (!(local->hw.flags &
> +				IEEE80211_HW_SUPPORTS_CQM_BEACON_MISS) &&
> +			   !(local->hw.flags &
> +				IEEE80211_HW_SUPPORTS_CQM_TX_FAIL)) {
>   			/*
>   			 * We actually lost the connection ... or did we?
>   			 * Let's make sure!

explain.

> diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
> index 21fc970..4194b3e 100644
> --- a/net/wireless/mlme.c
> +++ b/net/wireless/mlme.c
> @@ -1097,6 +1097,7 @@ void cfg80211_gtk_rekey_notify(struct net_device  
> *dev, const u8 *bssid,
>   }
>   EXPORT_SYMBOL(cfg80211_gtk_rekey_notify);
> 
> +
>   void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,

spurious whitespace change

johannes


^ permalink raw reply

* Re: [RFC 03/07] compat-wireless: Enable changing regulatory domain
From: Johannes Berg @ 2011-10-12  8:22 UTC (permalink / raw)
  To: Dmitry Tarnyagin
  Cc: linux-wireless.vger.kernel.org, Bartosz MARKOWSKI,
	Janusz DZIEDZIC, Johan Lilje
In-Reply-To: <op.v27rusy7ya27un@edmitar>

On Wed, 2011-10-12 at 03:02 +0200, Dmitry Tarnyagin wrote:
> From: Johan Lilje <johan.lilje@stericsson.com>
> Date: Tue, 2 Aug 2011 09:21:49 +0200
> 
> If compat-wireless code is compiled into the kernel,
> first request regulatory hint fails to return since
> userspace is not ready yet.
> Added timeout mechanism to remove old pending requests.

Completely wrong description. Make your patches apply to the kernel, not
compat-wireless.

> + * @timestamp: stores the time when this request calls crda, to enable
> + *	timeout mechanism.
>    * @list: used to insert into the reg_requests_list linked list
>    */
>   struct regulatory_request {
> @@ -70,6 +72,7 @@ struct regulatory_request {
>   	bool intersect;
>   	bool processed;
>   	enum environment_cap country_ie_env;
> +	struct timespec timestamp;

Seriously? You've gotta be kidding. WAAYY overkill to use timespec. Just
use jiffies.

johannes


^ permalink raw reply

* Re: [patch] iwmc3200wifi: add a range check to iwm_cfg80211_get_key()
From: Samuel Ortiz @ 2011-10-12  8:26 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Intel Linux Wireless, John W. Linville, linux-wireless,
	kernel-janitors
In-Reply-To: <20111012081036.GA32384@elgon.mountain>

Hi Dan,

On Wed, Oct 12, 2011 at 11:10:37AM +0300, Dan Carpenter wrote:
> Smatch complains that "key_index" is capped at 5 in nl80211_get_key()
> but iwm->keys[] only has 4 elements.  I don't know if this is really
> needed, but the other ->get_key() implementations seemed to check
> for overflows so I've added a check here.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>

Cheers.
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


^ permalink raw reply

* Re: [RFC 06/07] compat-wireless: UAPSD configuration in STA mode
From: Johannes Berg @ 2011-10-12  8:25 UTC (permalink / raw)
  To: Dmitry Tarnyagin
  Cc: linux-wireless.vger.kernel.org, Bartosz MARKOWSKI,
	Janusz DZIEDZIC
In-Reply-To: <op.v27ru00wya27un@edmitar>

On Wed, 2011-10-12 at 03:02 +0200, Dmitry Tarnyagin wrote:
> From: Janusz Dziedzic <janusz.dziedzic@tieto.com>
> Date: Wed, 3 Aug 2011 09:46:05 +0200
> 
> This patch adds UAPSD queues configuration as a param to assoc request.
> With the patch it's possible to configure UAPSD from user space.
> 
> Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
> ---
>   include/linux/nl80211.h |    2 ++
>   include/net/cfg80211.h  |    1 +
>   net/mac80211/main.c     |    3 ++-
>   net/mac80211/mlme.c     |    2 ++
>   net/wireless/core.h     |    6 ++++--
>   net/wireless/mlme.c     |   10 +++++++---
>   net/wireless/nl80211.c  |    7 ++++++-
>   net/wireless/sme.c      |    2 +-
>   8 files changed, 25 insertions(+), 8 deletions(-)

This is a rare case where *maybe* it's OK to do both mac80211 and
cfg80211 in one patch, but I haven't seen much evidence from all of you
that you really understand the separation, so I'd prefer if you split it
up and explained the changes separately.

> +++ b/include/net/cfg80211.h
> @@ -1050,6 +1050,7 @@ struct cfg80211_assoc_request {
>   	size_t ie_len;
>   	struct cfg80211_crypto_settings crypto;
>   	bool use_mfp;
> +	int uapsd;

int? explain. also you're obviously missing documentation that would
have explained this.

> -	local->uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES;
> +	/* Disable all UAPSD AC by default */
> +	local->uapsd_queues = 0;

You should obviously then remove the default constant, or better yet
just set it to 0. Also _that_ specific change needs to be a separate
change since it modifies existing behaviour.


> +	if (info->attrs[NL80211_ATTR_UAPSD])
> +		uapsd = nla_get_u32(info->attrs[NL80211_ATTR_UAPSD]);

clearly missing validation.

> +++ b/net/wireless/sme.c
> @@ -190,7 +190,7 @@ static int cfg80211_conn_do_work(struct wireless_dev  
> *wdev)
>   					    prev_bssid,
>   					    params->ssid, params->ssid_len,
>   					    params->ie, params->ie_len,
> -					    false, &params->crypto);
> +					    false, &params->crypto, -1);
>   		if (err)
>   			__cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid,
>   					       NULL, 0,

Really? Why should this not be able to do uapsd with the same way?

johannes


^ permalink raw reply

* Re: [RFC 04/07] compat-wireless: p2p power save support
From: Johannes Berg @ 2011-10-12  8:30 UTC (permalink / raw)
  To: Dmitry Tarnyagin
  Cc: linux-wireless.vger.kernel.org, Bartosz MARKOWSKI,
	Janusz DZIEDZIC
In-Reply-To: <op.v27ruwj6ya27un@edmitar>

On Wed, 2011-10-12 at 03:02 +0200, Dmitry Tarnyagin wrote:
> From: Janusz Dziedzic <janusz.dziedzic@tieto.com>
> Date: Thu, 4 Aug 2011 11:42:16 +0200
> 
> P2P power save support:
>   - Opportunistic Power Save
>   - Notice Of Absence

More explanation please. I know I sound like a broken record but for
such a big change you really need more text.

I'm not even going to bother to review the patch in detail. You need to
explain why you need to set NoA. There are three reasons this would be
used:
1) actually save power
2) do scanning, multi-channel operation, etc.
3) P2P certification testing

Only 3) seems to be useful from userspace, and then maybe it shouldn't
be full-blown nl80211 API.


Similarly for the P2P power save stuff. Since you generally lack
documentation updates in your patches (read this as criticism) there's
no way reason to even look through your patches since they don't explain
anything.

FWIW, a very brief glance over this patch tells me that there's at least
one obvious, glaring bug in it.

johannes


^ permalink raw reply

* Re: [RFC 05/07] mac80211: Purge cfg80211 beacon cache before authentication.
From: Johannes Berg @ 2011-10-12  8:31 UTC (permalink / raw)
  To: Dmitry Tarnyagin
  Cc: linux-wireless.vger.kernel.org, Bartosz MARKOWSKI,
	Janusz DZIEDZIC
In-Reply-To: <op.v27ruyliya27un@edmitar>

On Wed, 2011-10-12 at 03:02 +0200, Dmitry Tarnyagin wrote:
> From: Dmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>
> Date: Wed, 10 Aug 2011 19:15:13 +0200
> 
> cw1200 device requires SSID to be available at AUTH stage.
> cfg80211 beacon cache is designed to handle multi-SSID BSSes, so
> bss struct returned by cfg80211_get_bss() has random SSID if BSS
> just changed SSID before authentication (typical for p2p).
> 
> As a workaround cfg80211 beacon cache is purged to make sure
> target BSS is searchable in rb-tree at the AUTH stage.

Funny, but hell no.

johannes


^ permalink raw reply

* Re: [RFC 07/07] mac80211: Do not call release_buffered_frames if not available.
From: Johannes Berg @ 2011-10-12  8:32 UTC (permalink / raw)
  To: Dmitry Tarnyagin
  Cc: linux-wireless.vger.kernel.org, Bartosz MARKOWSKI,
	Janusz DZIEDZIC
In-Reply-To: <op.v27ru2maya27un@edmitar>

On Wed, 2011-10-12 at 03:02 +0200, Dmitry Tarnyagin wrote:
> From: Dmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>
> Date: Wed, 5 Oct 2011 13:20:04 +0200
> 
> A new .release_buffered_frames callback was introduced recently.
> Check for the callback presence was missing in the mac80211 code,
> and PM state could get broken in some cases.

Interesting, but we do check:

drv_release_buffered_frames(struct ieee80211_local *local,
                            struct sta_info *sta, u16 tids, int num_frames,
                            enum ieee80211_frame_release_type reason,
                            bool more_data)
{
        trace_drv_release_buffered_frames(local, &sta->sta, tids, num_frames,
                                          reason, more_data);
        if (local->ops->release_buffered_frames)
                local->ops->release_buffered_frames(&local->hw, &sta->sta, tids,


So whatever you're trying to do must be something else.

johannes


^ permalink raw reply

* Re: [PATCH] iw: add DFS region parsing support
From: Johannes Berg @ 2011-10-12  8:37 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linville, linux-wireless
In-Reply-To: <CAB=NE6WtkokxWg4zJtjyKVZmhZAhzArfoJuOOqhuKSw940hxqg@mail.gmail.com>

On Tue, 2011-10-11 at 13:25 -0700, Luis R. Rodriguez wrote:

> > Also, I prefer patches w/o nl80211.h updates.
> 
> In my RFC on December the stars aligned differently and you preferred
> it together I think.

Really? I must've been confused. The reason I don't want them is that
then I can never merge something that isn't upstream yet. :)

johannes


^ permalink raw reply

* Re: [RFC 01/07] wireless-next: WAPI support for hardware-accelerated drivers
From: Jouni Malinen @ 2011-10-12  8:50 UTC (permalink / raw)
  To: Dmitry Tarnyagin; +Cc: linux-wireless, Bartosz MARKOWSKI, Janusz DZIEDZIC
In-Reply-To: <op.v27rufm9ya27un@edmitar>

On Wed, Oct 12, 2011 at 03:02:29AM +0200, Dmitry Tarnyagin wrote:
> diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
> @@ -1551,12 +1552,14 @@ enum ieee80211_sa_query_action {
>  #define WLAN_CIPHER_SUITE_CCMP		0x000FAC04
>  #define WLAN_CIPHER_SUITE_WEP104	0x000FAC05
>  #define WLAN_CIPHER_SUITE_AES_CMAC	0x000FAC06
> +#define WLAN_CIPHER_SUITE_SMS4		0x000FAC07
> 
>  /* AKM suite selectors */
>  #define WLAN_AKM_SUITE_8021X		0x000FAC01
>  #define WLAN_AKM_SUITE_PSK		0x000FAC02
>  #define WLAN_AKM_SUITE_SAE			0x000FAC08
>  #define WLAN_AKM_SUITE_FT_OVER_SAE	0x000FAC09
> +#define WLAN_AKM_SUITE_WAPI_PSK		0x000FAC03

Where do these values come from?

00-0F-AC:7 cipher suite selector has already been allocated for other
purposes ("Group addressed traffic not allowed") and similarly, AKM
suite 00-0F-AC:3 is already in use ("FT authentication negotiated over
IEEE 802.1X"). The 00-0F-AC OUI is managed by IEEE 802.11 and you cannot
just pick a random suite type from that OUI and hope for the best. This
will result in conflicts with other uses.

These need to be either allocated by IEEE 802.11 ANA or maybe more
likely, by any vendor that has their own OUI could allocate a unique
identifier for this purpose.

-- 
Jouni Malinen                                            PGP id EFC895FA

^ 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