[PATCH 1/2] wireless: move prism54 out to staging

2017-08-03 Thread Luis R. Rodriguez
prism54 is deprecated in favor of the p54pci device driver. Although
only *one soul* had reported issues with it long ago Linux most Linux
distributions these days just disable the device driver given the
conflicts with the PCI IDs of p54pci and the *very* unlikely situation
of folks really need this driver anymore.

Before trying to due away with prism54 once more stuff it into staging,
which is our hospice for dying drivers.

Signed-off-by: Luis R. Rodriguez 
---
 MAINTAINERS  |  4 ++--
 drivers/net/wireless/intersil/Kconfig| 20 
 drivers/net/wireless/intersil/Makefile   |  1 -
 drivers/staging/Kconfig  |  2 ++
 drivers/staging/Makefile |  1 +
 .../wireless/intersil => staging}/prism54/Makefile   |  0
 .../wireless/intersil => staging}/prism54/isl_38xx.c |  0
 .../wireless/intersil => staging}/prism54/isl_38xx.h |  0
 .../intersil => staging}/prism54/isl_ioctl.c |  0
 .../intersil => staging}/prism54/isl_ioctl.h |  0
 .../wireless/intersil => staging}/prism54/isl_oid.h  |  0
 .../intersil => staging}/prism54/islpci_dev.c|  0
 .../intersil => staging}/prism54/islpci_dev.h|  0
 .../intersil => staging}/prism54/islpci_eth.c|  0
 .../intersil => staging}/prism54/islpci_eth.h|  0
 .../intersil => staging}/prism54/islpci_hotplug.c|  0
 .../intersil => staging}/prism54/islpci_mgt.c|  0
 .../intersil => staging}/prism54/islpci_mgt.h|  0
 .../wireless/intersil => staging}/prism54/oid_mgt.c  |  0
 .../wireless/intersil => staging}/prism54/oid_mgt.h  |  0
 .../intersil => staging}/prism54/prismcompat.h   |  0
 21 files changed, 5 insertions(+), 23 deletions(-)
 rename drivers/{net/wireless/intersil => staging}/prism54/Makefile (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/isl_38xx.c (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/isl_38xx.h (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/isl_ioctl.c (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/isl_ioctl.h (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/isl_oid.h (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/islpci_dev.c (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/islpci_dev.h (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/islpci_eth.c (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/islpci_eth.h (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/islpci_hotplug.c 
(100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/islpci_mgt.c (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/islpci_mgt.h (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/oid_mgt.c (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/oid_mgt.h (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/prismcompat.h (100%)

diff --git a/MAINTAINERS b/MAINTAINERS
index ef340b9aeb98..97cf436e6750 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10666,11 +10666,11 @@ F:kernel/printk/
 F: include/linux/printk.h
 
 PRISM54 WIRELESS DRIVER
-M: "Luis R. Rodriguez" 
+M: "Luis R. Rodriguez" 
 L: linux-wireless@vger.kernel.org
 W: http://wireless.kernel.org/en/users/Drivers/p54
 S: Obsolete
-F: drivers/net/wireless/intersil/prism54/
+F: drivers/staging/prism54/
 
 PROC SYSCTL
 M: "Luis R. Rodriguez" 
diff --git a/drivers/net/wireless/intersil/Kconfig 
b/drivers/net/wireless/intersil/Kconfig
index 9da136049955..2b056b6daef8 100644
--- a/drivers/net/wireless/intersil/Kconfig
+++ b/drivers/net/wireless/intersil/Kconfig
@@ -15,24 +15,4 @@ source "drivers/net/wireless/intersil/hostap/Kconfig"
 source "drivers/net/wireless/intersil/orinoco/Kconfig"
 source "drivers/net/wireless/intersil/p54/Kconfig"
 
-config PRISM54
-   tristate 'Intersil Prism GT/Duette/Indigo PCI/Cardbus (DEPRECATED)'
-   depends on PCI
-   select WIRELESS_EXT
-   select WEXT_SPY
-   select WEXT_PRIV
-   select FW_LOADER
-   ---help---
- This enables support for FullMAC PCI/Cardbus prism54 devices. This
- driver is now deprecated in favor for the SoftMAC driver, p54pci.
- p54pci supports FullMAC PCI/Cardbus devices as well.
-
- For more information refer to the p54 wiki:
-
- http://wireless.kernel.org/en/users/Drivers/p54
-
- Note: You need a motherboard with DMA support to use any of these 
cards
-
- When built as module you get the module prism54
-
 endif # WLAN_VENDOR_INTERSIL
diff --git a/drivers/net/wireless/intersil/Makefile 
b/drivers/net/wireless/intersil/Makefile
index 9a8cbfee3ea5..aedb713da746 100644
--- a/drivers/net/wireless/intersil/Makefile
+++ 

[PATCH 2/2] MAINTAINERS: update email address for mcgrof for few straggling drivers

2017-08-03 Thread Luis R. Rodriguez
This will ensure I get emails on my work and personal email address.

Signed-off-by: Luis R. Rodriguez 
---
 MAINTAINERS | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 97cf436e6750..49ae596584e7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2212,7 +2212,7 @@ F:drivers/gpio/gpio-ath79.c
 F: Documentation/devicetree/bindings/gpio/gpio-ath79.txt
 
 ATHEROS ATH GENERIC UTILITIES
-M: "Luis R. Rodriguez" 
+M: "Luis R. Rodriguez" 
 L: linux-wireless@vger.kernel.org
 S: Supported
 F: drivers/net/wireless/ath/*
@@ -2220,7 +2220,7 @@ F:drivers/net/wireless/ath/*
 ATHEROS ATH5K WIRELESS DRIVER
 M: Jiri Slaby 
 M: Nick Kossifidis 
-M: "Luis R. Rodriguez" 
+M: "Luis R. Rodriguez" 
 L: linux-wireless@vger.kernel.org
 W: http://wireless.kernel.org/en/users/Drivers/ath5k
 S: Maintained
-- 
2.11.0



[PATCH 0/2] wireless: move prism54 to staging

2017-08-03 Thread Luis R. Rodriguez
Kalle, Greg,

This moves the prism54 diver to staging. The reason for this are
stated on the driver's own commit log. Let me know what tree you'd
prefer this to go through.

Luis R. Rodriguez (2):
  wireless: move prism54 out to staging
  MAINTAINERS: update email address for mcgrof for few straggling
drivers

 MAINTAINERS  |  8 
 drivers/net/wireless/intersil/Kconfig| 20 
 drivers/net/wireless/intersil/Makefile   |  1 -
 drivers/staging/Kconfig  |  2 ++
 drivers/staging/Makefile |  1 +
 .../wireless/intersil => staging}/prism54/Makefile   |  0
 .../wireless/intersil => staging}/prism54/isl_38xx.c |  0
 .../wireless/intersil => staging}/prism54/isl_38xx.h |  0
 .../intersil => staging}/prism54/isl_ioctl.c |  0
 .../intersil => staging}/prism54/isl_ioctl.h |  0
 .../wireless/intersil => staging}/prism54/isl_oid.h  |  0
 .../intersil => staging}/prism54/islpci_dev.c|  0
 .../intersil => staging}/prism54/islpci_dev.h|  0
 .../intersil => staging}/prism54/islpci_eth.c|  0
 .../intersil => staging}/prism54/islpci_eth.h|  0
 .../intersil => staging}/prism54/islpci_hotplug.c|  0
 .../intersil => staging}/prism54/islpci_mgt.c|  0
 .../intersil => staging}/prism54/islpci_mgt.h|  0
 .../wireless/intersil => staging}/prism54/oid_mgt.c  |  0
 .../wireless/intersil => staging}/prism54/oid_mgt.h  |  0
 .../intersil => staging}/prism54/prismcompat.h   |  0
 21 files changed, 7 insertions(+), 25 deletions(-)
 rename drivers/{net/wireless/intersil => staging}/prism54/Makefile (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/isl_38xx.c (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/isl_38xx.h (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/isl_ioctl.c (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/isl_ioctl.h (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/isl_oid.h (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/islpci_dev.c (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/islpci_dev.h (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/islpci_eth.c (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/islpci_eth.h (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/islpci_hotplug.c 
(100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/islpci_mgt.c (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/islpci_mgt.h (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/oid_mgt.c (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/oid_mgt.h (100%)
 rename drivers/{net/wireless/intersil => staging}/prism54/prismcompat.h (100%)

-- 
2.11.0



[PATCH v4 03/10] wil6210: support FW RSSI reporting

2017-08-03 Thread Maya Erez
From: Dedy Lansky 

New FW supports reporting RSSI signal in dBm.
Report RSSI to kernel in case FW has this capability.

Signed-off-by: Dedy Lansky 
Signed-off-by: Maya Erez 
---
 drivers/net/wireless/ath/wil6210/cfg80211.c | 12 
 drivers/net/wireless/ath/wil6210/debugfs.c  |  2 ++
 drivers/net/wireless/ath/wil6210/pcie_bus.c |  3 +++
 drivers/net/wireless/ath/wil6210/wmi.c  |  9 ++---
 drivers/net/wireless/ath/wil6210/wmi.h  |  6 --
 5 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c 
b/drivers/net/wireless/ath/wil6210/cfg80211.c
index d079533..c860c0c 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -281,12 +281,12 @@ int wil_cid_fill_sinfo(struct wil6210_priv *wil, int cid,
 
wil_dbg_wmi(wil, "Link status for CID %d: {\n"
"  MCS %d TSF 0x%016llx\n"
-   "  BF status 0x%08x SNR 0x%08x SQI %d%%\n"
+   "  BF status 0x%08x RSSI %d SQI %d%%\n"
"  Tx Tpt %d goodput %d Rx goodput %d\n"
"  Sectors(rx:tx) my %d:%d peer %d:%d\n""}\n",
cid, le16_to_cpu(reply.evt.bf_mcs),
le64_to_cpu(reply.evt.tsf), reply.evt.status,
-   le32_to_cpu(reply.evt.snr_val),
+   reply.evt.rssi,
reply.evt.sqi,
le32_to_cpu(reply.evt.tx_tpt),
le32_to_cpu(reply.evt.tx_goodput),
@@ -319,7 +319,11 @@ int wil_cid_fill_sinfo(struct wil6210_priv *wil, int cid,
 
if (test_bit(wil_status_fwconnected, wil->status)) {
sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
-   sinfo->signal = reply.evt.sqi;
+   if (test_bit(WMI_FW_CAPABILITY_RSSI_REPORTING,
+wil->fw_capabilities))
+   sinfo->signal = reply.evt.rssi;
+   else
+   sinfo->signal = reply.evt.sqi;
}
 
return rc;
@@ -1805,7 +1809,7 @@ static void wil_wiphy_init(struct wiphy *wiphy)
 
wiphy->bands[NL80211_BAND_60GHZ] = _band_60ghz;
 
-   /* TODO: figure this out */
+   /* may change after reading FW capabilities */
wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC;
 
wiphy->cipher_suites = wil_cipher_suites;
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c 
b/drivers/net/wireless/ath/wil6210/debugfs.c
index a2b5d59..21b6611 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -1016,6 +1016,7 @@ static int wil_bf_debugfs_show(struct seq_file *s, void 
*data)
   "  TSF = 0x%016llx\n"
   "  TxMCS = %2d TxTpt = %4d\n"
   "  SQI = %4d\n"
+  "  RSSI = %4d\n"
   "  Status = 0x%08x %s\n"
   "  Sectors(rx:tx) my %2d:%2d peer %2d:%2d\n"
   "  Goodput(rx:tx) %4d:%4d\n"
@@ -1025,6 +1026,7 @@ static int wil_bf_debugfs_show(struct seq_file *s, void 
*data)
   le16_to_cpu(reply.evt.bf_mcs),
   le32_to_cpu(reply.evt.tx_tpt),
   reply.evt.sqi,
+  reply.evt.rssi,
   status, wil_bfstatus_str(status),
   le16_to_cpu(reply.evt.my_rx_sector),
   le16_to_cpu(reply.evt.my_tx_sector),
diff --git a/drivers/net/wireless/ath/wil6210/pcie_bus.c 
b/drivers/net/wireless/ath/wil6210/pcie_bus.c
index d571feb..6a3ab4b 100644
--- a/drivers/net/wireless/ath/wil6210/pcie_bus.c
+++ b/drivers/net/wireless/ath/wil6210/pcie_bus.c
@@ -84,6 +84,9 @@ void wil_set_capabilities(struct wil6210_priv *wil)
 
/* extract FW capabilities from file without loading the FW */
wil_request_firmware(wil, wil->wil_fw_name, false);
+
+   if (test_bit(WMI_FW_CAPABILITY_RSSI_REPORTING, wil->fw_capabilities))
+   wil_to_wiphy(wil)->signal_type = CFG80211_SIGNAL_TYPE_MBM;
 }
 
 void wil_disable_irq(struct wil6210_priv *wil)
diff --git a/drivers/net/wireless/ath/wil6210/wmi.c 
b/drivers/net/wireless/ath/wil6210/wmi.c
index 65ef673..a9487f2 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.c
+++ b/drivers/net/wireless/ath/wil6210/wmi.c
@@ -381,12 +381,15 @@ static void wmi_evt_rx_mgmt(struct wil6210_priv *wil, int 
id, void *d, int len)
ch_no = data->info.channel + 1;
freq = ieee80211_channel_to_frequency(ch_no, NL80211_BAND_60GHZ);
channel = ieee80211_get_channel(wiphy, freq);
-   signal = data->info.sqi;
+   if (test_bit(WMI_FW_CAPABILITY_RSSI_REPORTING, wil->fw_capabilities))
+   signal = 100 * data->info.rssi;
+   else
+   signal = data->info.sqi;

[PATCH v4 08/10] wil6210: store FW RF calibration result

2017-08-03 Thread Maya Erez
From: Dedy Lansky 

Store initial FW RF calibration result in driver. Set this calibration
result back to FW after each FW reset in order to avoid future calibration
procedures.

Signed-off-by: Dedy Lansky 
Signed-off-by: Maya Erez 
---
 drivers/net/wireless/ath/wil6210/main.c| 6 ++
 drivers/net/wireless/ath/wil6210/wil6210.h | 6 ++
 drivers/net/wireless/ath/wil6210/wmi.c | 5 +
 drivers/net/wireless/ath/wil6210/wmi.h | 2 ++
 4 files changed, 19 insertions(+)

diff --git a/drivers/net/wireless/ath/wil6210/main.c 
b/drivers/net/wireless/ath/wil6210/main.c
index b1e2814..b89d017 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -1034,6 +1034,12 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)
wil_s(wil, RGF_CAF_ICR + offsetof(struct RGF_ICR, ICR), 0);
wil_w(wil, RGF_CAF_ICR + offsetof(struct RGF_ICR, IMV), ~0);
 
+   if (wil->fw_calib_result > 0) {
+   __le32 val = cpu_to_le32(wil->fw_calib_result |
+(CALIB_RESULT_SIGNATURE << 8));
+   wil_w(wil, RGF_USER_FW_CALIB_RESULT, (u32 __force)val);
+   }
+
wil_release_cpu(wil);
}
 
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h 
b/drivers/net/wireless/ath/wil6210/wil6210.h
index 724ad59..e3c0c2f 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -171,6 +171,10 @@ struct RGF_ICR {
 #define RGF_USER_USER_SCRATCH_PAD  (0x8802bc)
 #define RGF_USER_BL(0x880A3C) /* Boot Loader */
 #define RGF_USER_FW_REV_ID (0x880a8c) /* chip revision */
+#define RGF_USER_FW_CALIB_RESULT   (0x880a90) /* b0-7:result
+   * b8-15:signature
+   */
+   #define CALIB_RESULT_SIGNATURE  (0x11)
 #define RGF_USER_CLKS_CTL_0(0x880abc)
#define BIT_USER_CLKS_CAR_AHB_SW_SELBIT(1) /* ref clk/PLL */
#define BIT_USER_CLKS_RST_PWGD  BIT(11) /* reset on "power good" */
@@ -724,6 +728,8 @@ struct wil6210_priv {
 
enum wmi_ps_profile_type ps_profile;
 
+   int fw_calib_result;
+
 #ifdef CONFIG_PM
 #ifdef CONFIG_PM_SLEEP
struct notifier_block pm_notify;
diff --git a/drivers/net/wireless/ath/wil6210/wmi.c 
b/drivers/net/wireless/ath/wil6210/wmi.c
index a9487f2..ffdd2fa 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.c
+++ b/drivers/net/wireless/ath/wil6210/wmi.c
@@ -344,6 +344,11 @@ static void wmi_evt_ready(struct wil6210_priv *wil, int 
id, void *d, int len)
strlcpy(wdev->wiphy->fw_version, wil->fw_version,
sizeof(wdev->wiphy->fw_version));
 
+   if (len > offsetof(struct wmi_ready_event, rfc_read_calib_result)) {
+   wil_dbg_wmi(wil, "rfc calibration result %d\n",
+   evt->rfc_read_calib_result);
+   wil->fw_calib_result = evt->rfc_read_calib_result;
+   }
wil_set_recovery_state(wil, fw_recovery_idle);
set_bit(wil_status_fwready, wil->status);
/* let the reset sequence continue */
diff --git a/drivers/net/wireless/ath/wil6210/wmi.h 
b/drivers/net/wireless/ath/wil6210/wmi.h
index 4e31c2f..1b426d7 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.h
+++ b/drivers/net/wireless/ath/wil6210/wmi.h
@@ -1300,6 +1300,8 @@ struct wmi_ready_event {
/* enum wmi_phy_capability */
u8 phy_capability;
u8 numof_additional_mids;
+   u8 rfc_read_calib_result;
+   u8 reserved[3];
 } __packed;
 
 /* WMI_NOTIFY_REQ_DONE_EVENTID */
-- 
1.9.1



[PATCH v4 10/10] wil6210: make debugfs compilation optional

2017-08-03 Thread Maya Erez
From: Gidon Studinski 

Since debugfs is a kernel configuration option, enable the driver to
compile without debugfs.

Signed-off-by: Gidon Studinski 
Signed-off-by: Maya Erez 
---
 drivers/net/wireless/ath/wil6210/Makefile  | 2 +-
 drivers/net/wireless/ath/wil6210/wil6210.h | 6 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wil6210/Makefile 
b/drivers/net/wireless/ath/wil6210/Makefile
index 4ae21da..63a751a 100644
--- a/drivers/net/wireless/ath/wil6210/Makefile
+++ b/drivers/net/wireless/ath/wil6210/Makefile
@@ -4,7 +4,7 @@ wil6210-y := main.o
 wil6210-y += netdev.o
 wil6210-y += cfg80211.o
 wil6210-y += pcie_bus.o
-wil6210-y += debugfs.o
+wil6210-$(CONFIG_DEBUG_FS) += debugfs.o
 wil6210-y += wmi.o
 wil6210-y += interrupt.o
 wil6210-y += txrx.o
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h 
b/drivers/net/wireless/ath/wil6210/wil6210.h
index cf20a8c..d7b1e03 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -940,8 +940,14 @@ int wil_cfg80211_mgmt_tx(struct wiphy *wiphy, struct 
wireless_dev *wdev,
 struct cfg80211_mgmt_tx_params *params,
 u64 *cookie);
 
+#if defined(CONFIG_DEBUG_FS)
 int wil6210_debugfs_init(struct wil6210_priv *wil);
 void wil6210_debugfs_remove(struct wil6210_priv *wil);
+#else
+static inline int wil6210_debugfs_init(struct wil6210_priv *wil) { return 0; }
+static inline void wil6210_debugfs_remove(struct wil6210_priv *wil) {}
+#endif
+
 int wil_cid_fill_sinfo(struct wil6210_priv *wil, int cid,
   struct station_info *sinfo);
 
-- 
1.9.1



[PATCH v4 06/10] wil6210: notify wiphy on wowlan support

2017-08-03 Thread Maya Erez
Set wowlan to indicate that 11ad device can wake-up
on any trigger and disconnect.

Signed-off-by: Maya Erez 
---
 drivers/net/wireless/ath/wil6210/cfg80211.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c 
b/drivers/net/wireless/ath/wil6210/cfg80211.c
index c860c0c..61e872c 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -34,6 +34,12 @@
 module_param(scan_timeout, uint, 0644);
 MODULE_PARM_DESC(scan_timeout, " Scan timeout (seconds)");
 
+#ifdef CONFIG_PM
+static struct wiphy_wowlan_support wil_wowlan_support = {
+   .flags = WIPHY_WOWLAN_ANY | WIPHY_WOWLAN_DISCONNECT,
+};
+#endif
+
 #define CHAN60G(_channel, _flags) {\
.band   = NL80211_BAND_60GHZ,   \
.center_freq= 56160 + (2160 * (_channel)),  \
@@ -1819,6 +1825,10 @@ static void wil_wiphy_init(struct wiphy *wiphy)
 
wiphy->n_vendor_commands = ARRAY_SIZE(wil_nl80211_vendor_commands);
wiphy->vendor_commands = wil_nl80211_vendor_commands;
+
+#ifdef CONFIG_PM
+   wiphy->wowlan = _wowlan_support;
+#endif
 }
 
 struct wireless_dev *wil_cfg80211_init(struct device *dev)
-- 
1.9.1



[PATCH v4 07/10] wil6210: fix interface-up check

2017-08-03 Thread Maya Erez
From: Hamad Kadmany 

While wil_open is executed, any call to netif_running
would return a success. In case there are failures
within wil_open, should not treat the device as if it
is already opened in relevant functions (like FW recovery
and runtime suspend check).

Fix that by checking the device up flag instead.

Signed-off-by: Hamad Kadmany 
Signed-off-by: Maya Erez 
---
 drivers/net/wireless/ath/wil6210/main.c | 3 ++-
 drivers/net/wireless/ath/wil6210/pm.c   | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/main.c 
b/drivers/net/wireless/ath/wil6210/main.c
index 8968c2c..b1e2814 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -394,10 +394,11 @@ static void wil_fw_error_worker(struct work_struct *work)
struct wil6210_priv *wil = container_of(work, struct wil6210_priv,
fw_error_worker);
struct wireless_dev *wdev = wil->wdev;
+   struct net_device *ndev = wil_to_ndev(wil);
 
wil_dbg_misc(wil, "fw error worker\n");
 
-   if (!netif_running(wil_to_ndev(wil))) {
+   if (!(ndev->flags & IFF_UP)) {
wil_info(wil, "No recovery - interface is down\n");
return;
}
diff --git a/drivers/net/wireless/ath/wil6210/pm.c 
b/drivers/net/wireless/ath/wil6210/pm.c
index 820ed17..8f5d1b44 100644
--- a/drivers/net/wireless/ath/wil6210/pm.c
+++ b/drivers/net/wireless/ath/wil6210/pm.c
@@ -21,10 +21,11 @@ int wil_can_suspend(struct wil6210_priv *wil, bool 
is_runtime)
 {
int rc = 0;
struct wireless_dev *wdev = wil->wdev;
+   struct net_device *ndev = wil_to_ndev(wil);
 
wil_dbg_pm(wil, "can_suspend: %s\n", is_runtime ? "runtime" : "system");
 
-   if (!netif_running(wil_to_ndev(wil))) {
+   if (!(ndev->flags & IFF_UP)) {
/* can always sleep when down */
wil_dbg_pm(wil, "Interface is down\n");
goto out;
-- 
1.9.1



[PATCH v4 05/10] wil6210: add statistics for suspend time

2017-08-03 Thread Maya Erez
Add statistics for total, min and max suspend time, that
calculates the time the 11ad device was in suspend.
Those statistics will help to estimate the power impact
of d3hot feature.

Signed-off-by: Maya Erez 
---
 drivers/net/wireless/ath/wil6210/debugfs.c | 17 +++--
 drivers/net/wireless/ath/wil6210/main.c|  2 ++
 drivers/net/wireless/ath/wil6210/pm.c  | 20 ++--
 drivers/net/wireless/ath/wil6210/wil6210.h |  5 +
 4 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c 
b/drivers/net/wireless/ath/wil6210/debugfs.c
index 21b6611..d4e8865 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -1617,6 +1617,8 @@ static ssize_t wil_write_suspend_stats(struct file *file,
struct wil6210_priv *wil = file->private_data;
 
memset(>suspend_stats, 0, sizeof(wil->suspend_stats));
+   wil->suspend_stats.min_suspend_time = ULONG_MAX;
+   wil->suspend_stats.collection_start = ktime_get();
 
return len;
 }
@@ -1628,18 +1630,27 @@ static ssize_t wil_read_suspend_stats(struct file *file,
struct wil6210_priv *wil = file->private_data;
static char text[400];
int n;
+   unsigned long long stats_collection_time =
+   ktime_to_us(ktime_sub(ktime_get(),
+ wil->suspend_stats.collection_start));
 
n = snprintf(text, sizeof(text),
 "Suspend statistics:\n"
 "successful suspends:%ld failed suspends:%ld\n"
 "successful resumes:%ld failed resumes:%ld\n"
-"rejected by host:%ld rejected by device:%ld\n",
+"rejected by host:%ld rejected by device:%ld\n"
+"total suspend time:%lld min suspend time:%lld\n"
+"max suspend time:%lld stats collection time: %lld\n",
 wil->suspend_stats.successful_suspends,
 wil->suspend_stats.failed_suspends,
 wil->suspend_stats.successful_resumes,
 wil->suspend_stats.failed_resumes,
 wil->suspend_stats.rejected_by_host,
-wil->suspend_stats.rejected_by_device);
+wil->suspend_stats.rejected_by_device,
+wil->suspend_stats.total_suspend_time,
+wil->suspend_stats.min_suspend_time,
+wil->suspend_stats.max_suspend_time,
+stats_collection_time);
 
n = min_t(int, n, sizeof(text));
 
@@ -1795,6 +1806,8 @@ int wil6210_debugfs_init(struct wil6210_priv *wil)
 
wil6210_debugfs_create_ITR_CNT(wil, dbg);
 
+   wil->suspend_stats.collection_start = ktime_get();
+
return 0;
 }
 
diff --git a/drivers/net/wireless/ath/wil6210/main.c 
b/drivers/net/wireless/ath/wil6210/main.c
index daf944a..8968c2c 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -578,6 +578,8 @@ int wil_priv_init(struct wil6210_priv *wil)
 
wil->wakeup_trigger = WMI_WAKEUP_TRIGGER_UCAST |
  WMI_WAKEUP_TRIGGER_BCAST;
+   memset(>suspend_stats, 0, sizeof(wil->suspend_stats));
+   wil->suspend_stats.min_suspend_time = ULONG_MAX;
 
return 0;
 
diff --git a/drivers/net/wireless/ath/wil6210/pm.c 
b/drivers/net/wireless/ath/wil6210/pm.c
index 4548829..820ed17 100644
--- a/drivers/net/wireless/ath/wil6210/pm.c
+++ b/drivers/net/wireless/ath/wil6210/pm.c
@@ -300,6 +300,9 @@ int wil_suspend(struct wil6210_priv *wil, bool is_runtime)
wil_dbg_pm(wil, "suspend: %s => %d\n",
   is_runtime ? "runtime" : "system", rc);
 
+   if (!rc)
+   wil->suspend_stats.suspend_start_time = ktime_get();
+
return rc;
 }
 
@@ -309,6 +312,7 @@ int wil_resume(struct wil6210_priv *wil, bool is_runtime)
struct net_device *ndev = wil_to_ndev(wil);
bool keep_radio_on = ndev->flags & IFF_UP &&
 wil->keep_radio_on_during_sleep;
+   unsigned long long suspend_time_usec = 0;
 
wil_dbg_pm(wil, "resume: %s\n", is_runtime ? "runtime" : "system");
 
@@ -326,8 +330,20 @@ int wil_resume(struct wil6210_priv *wil, bool is_runtime)
else
rc = wil_resume_radio_off(wil);
 
+   if (rc)
+   goto out;
+
+   suspend_time_usec =
+   ktime_to_us(ktime_sub(ktime_get(),
+ wil->suspend_stats.suspend_start_time));
+   wil->suspend_stats.total_suspend_time += suspend_time_usec;
+   if (suspend_time_usec < wil->suspend_stats.min_suspend_time)
+   wil->suspend_stats.min_suspend_time = suspend_time_usec;
+   if (suspend_time_usec > wil->suspend_stats.max_suspend_time)
+   wil->suspend_stats.max_suspend_time = suspend_time_usec;
+
 out:
- 

[PATCH v4 04/10] wil6210: check no_fw_recovery in resume failure recovery

2017-08-03 Thread Maya Erez
Reset 11ad device on resume failure only if no_fw_recovery
is not set.

Signed-off-by: Maya Erez 
---
 drivers/net/wireless/ath/wil6210/pm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wil6210/pm.c 
b/drivers/net/wireless/ath/wil6210/pm.c
index ce1f384..4548829 100644
--- a/drivers/net/wireless/ath/wil6210/pm.c
+++ b/drivers/net/wireless/ath/wil6210/pm.c
@@ -85,7 +85,9 @@ static int wil_resume_keep_radio_on(struct wil6210_priv *wil)
/* Send WMI resume request to the device */
rc = wmi_resume(wil);
if (rc) {
-   wil_err(wil, "device failed to resume (%d), resetting\n", rc);
+   wil_err(wil, "device failed to resume (%d)\n", rc);
+   if (no_fw_recovery)
+   goto out;
rc = wil_down(wil);
if (rc) {
wil_err(wil, "wil_down failed (%d)\n", rc);
-- 
1.9.1



[PATCH v4 01/10] wil6210: protect against invalid length of tx management frame

2017-08-03 Thread Maya Erez
From: Hamad Kadmany 

Validate buffer length has the minimum needed size
when sending management frame to protect against
possible buffer overrun.

Signed-off-by: Hamad Kadmany 
Signed-off-by: Lior David 
Signed-off-by: Maya Erez 
---
 drivers/net/wireless/ath/wil6210/cfg80211.c | 3 +++
 drivers/net/wireless/ath/wil6210/debugfs.c  | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c 
b/drivers/net/wireless/ath/wil6210/cfg80211.c
index 0b5383a..77af749 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -884,6 +884,9 @@ int wil_cfg80211_mgmt_tx(struct wiphy *wiphy, struct 
wireless_dev *wdev,
wil_hex_dump_misc("mgmt tx frame ", DUMP_PREFIX_OFFSET, 16, 1, buf,
  len, true);
 
+   if (len < sizeof(struct ieee80211_hdr_3addr))
+   return -EINVAL;
+
cmd = kmalloc(sizeof(*cmd) + len, GFP_KERNEL);
if (!cmd) {
rc = -ENOMEM;
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c 
b/drivers/net/wireless/ath/wil6210/debugfs.c
index f82506d..a2b5d59 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -801,6 +801,9 @@ static ssize_t wil_write_file_txmgmt(struct file *file, 
const char __user *buf,
int rc;
void *frame;
 
+   if (!len)
+   return -EINVAL;
+
frame = memdup_user(buf, len);
if (IS_ERR(frame))
return PTR_ERR(frame);
-- 
1.9.1



[PATCH v4 02/10] wil6210: allow configuring scan timers

2017-08-03 Thread Maya Erez
From: Hamad Kadmany 

Allow setting scan timeout and scan dwell time
through module parameters.

Signed-off-by: Hamad Kadmany 
Signed-off-by: Maya Erez 
---
 drivers/net/wireless/ath/wil6210/cfg80211.c | 17 ++---
 drivers/net/wireless/ath/wil6210/wil6210.h  |  2 +-
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c 
b/drivers/net/wireless/ath/wil6210/cfg80211.c
index 77af749..d079533 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -26,6 +26,14 @@
 module_param(disable_ap_sme, bool, 0444);
 MODULE_PARM_DESC(disable_ap_sme, " let user space handle AP mode SME");
 
+static uint scan_dwell_time  = WMI_SCAN_DWELL_TIME_MS;
+module_param(scan_dwell_time, uint, 0644);
+MODULE_PARM_DESC(scan_dwell_time, " Scan dwell time (msec)");
+
+static uint scan_timeout = WIL6210_SCAN_TO_SEC;
+module_param(scan_timeout, uint, 0644);
+MODULE_PARM_DESC(scan_timeout, " Scan timeout (seconds)");
+
 #define CHAN60G(_channel, _flags) {\
.band   = NL80211_BAND_60GHZ,   \
.center_freq= 56160 + (2160 * (_channel)),  \
@@ -528,8 +536,9 @@ static int wil_cfg80211_scan(struct wiphy *wiphy,
 
(void)wil_p2p_stop_discovery(wil);
 
-   wil_dbg_misc(wil, "Start scan_request 0x%p\n", request);
-   wil_dbg_misc(wil, "SSID count: %d", request->n_ssids);
+   wil_dbg_misc(wil,
+"Start scan_request 0x%p, dwell_time %dms, timeout %dsec, 
SSID count %d\n",
+request, scan_dwell_time, scan_timeout, request->n_ssids);
 
for (i = 0; i < request->n_ssids; i++) {
wil_dbg_misc(wil, "SSID[%d]", i);
@@ -550,10 +559,12 @@ static int wil_cfg80211_scan(struct wiphy *wiphy,
}
 
wil->scan_request = request;
-   mod_timer(>scan_timer, jiffies + WIL6210_SCAN_TO);
+   mod_timer(>scan_timer,
+ jiffies + msecs_to_jiffies(1000U * scan_timeout));
 
memset(, 0, sizeof(cmd));
cmd.cmd.scan_type = WMI_ACTIVE_SCAN;
+   cmd.cmd.dwell_time = cpu_to_le32(scan_dwell_time);
cmd.cmd.num_channels = 0;
n = min(request->n_channels, 4U);
for (i = 0; i < n; i++) {
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h 
b/drivers/net/wireless/ath/wil6210/wil6210.h
index d085ccf..ac32284 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -112,7 +112,7 @@ static inline u32 wil_mtu2macbuf(u32 mtu)
 #define WIL6210_ITR_RX_MAX_BURST_DURATION_DEFAULT (500) /* usec */
 #define WIL6210_FW_RECOVERY_RETRIES(5) /* try to recover this many times */
 #define WIL6210_FW_RECOVERY_TO msecs_to_jiffies(5000)
-#define WIL6210_SCAN_TOmsecs_to_jiffies(1)
+#define WIL6210_SCAN_TO_SEC10
 #define WIL6210_DISCONNECT_TO_MS (2000)
 #define WIL6210_RX_HIGH_TRSH_INIT  (0)
 #define WIL6210_RX_HIGH_TRSH_DEFAULT \
-- 
1.9.1



Re: [PATCH V5 1/2] firmware: add more flexible request_firmware_async function

2017-08-03 Thread Luis R. Rodriguez
On Thu, Aug 03, 2017 at 05:55:18AM +, Coelho, Luciano wrote:
> On Thu, 2017-08-03 at 08:23 +0300, Kalle Valo wrote:
> > "Luis R. Rodriguez"  writes:
> > 
> > > > +int request_firmware_nowait(struct module *module, bool uevent,
> > > > +   const char *name, struct device *device, 
> > > > gfp_t gfp,
> > > > +   void *context,
> > > > +   void (*cont)(const struct firmware *fw, 
> > > > void *context))
> > > > +{
> > > > +   unsigned int opt_flags = FW_OPT_FALLBACK |
> > > > +   (uevent ? FW_OPT_UEVENT : FW_OPT_USERHELPER);
> > > > +
> > > > +   return __request_firmware_nowait(module, opt_flags, name, 
> > > > device, gfp,
> > > > +context, cont);
> > > > +}
> > > >  EXPORT_SYMBOL(request_firmware_nowait);
> > > >  
> > > > +int __request_firmware_async(struct module *module, const char *name,
> > > > +struct firmware_opts *fw_opts, struct 
> > > > device *dev,
> > > > +void *context,
> > > > +void (*cont)(const struct firmware *fw, 
> > > > void *context))
> > > > +{
> > > > +   unsigned int opt_flags = FW_OPT_UEVENT;
> > > 
> > > This exposes a long issue. Think -- why do we want this enabled by 
> > > default? Its
> > > actually because even though the fallback stuff is optional and can be, 
> > > the uevent
> > > internal flag *also* provides caching support as a side consequence only. 
> > > We
> > > don't want to add a new API without first cleaning up that mess.
> > > 
> > > This is a slipery slope and best to clean that up before adding any new 
> > > API.
> > > 
> > > That and also Greg recently stated he would like to see at least 3 users 
> > > of
> > > a feature before adding it. Although I think that's pretty arbitrary, and
> > > considering that request_firmware_into_buf() only has *one* user -- its 
> > > what
> > > he wishes.
> > 
> > ath10k at least needs a way to silence the warning for missing firmware
> > and I think iwlwifi also.
> 
> Yes, iwlwifi needs to silence the warning.  It the feature (only one,
> really) that I've been waiting for.

Perfect, can you guys send patches on top of these changes? Even though I still
think the flag stuff needs to be worked out I can try to iron that out myself
and fold the rest of the delta, and then I can set a new set out which is much
more suitable.

  Luis


Re: [PATCH 2/2] qlcnic: add const to bin_attribute structure

2017-08-03 Thread David Miller
From: Bhumika Goyal 
Date: Wed,  2 Aug 2017 23:27:14 +0530

> Add const to bin_attribute structure as it is only passed to the
> functions sysfs_{remove/create}_bin_file. The corresponding
> arguments are of type const, so declare the structure to be const.
> 
> Signed-off-by: Bhumika Goyal 

Applied.


[PATCH v2] rt2x00: Fix MMIC Countermeasures.

2017-08-03 Thread Michael Skeffingfon
From: Michael Skeffington 

Set RX_FLAG_DECRYPTED in case of MMIC failure so that ieee80211_rx_h_decrypt() 
doesnt drop the frame before getting to ieee80211_rx_h_michael_mic_verify().

Signed-off-by: Michael Skeffington 

---
 drivers/net/wireless/ralink/rt2x00/rt2800mmio.c | 13 +++--
 drivers/net/wireless/ralink/rt2x00/rt2800usb.c  | 15 ---
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c 
b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
index ee5276e233fa..ace91a2db756 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
@@ -136,10 +136,19 @@ void rt2800mmio_fill_rxdone(struct queue_entry *entry,
 */
rxdesc->flags |= RX_FLAG_MMIC_STRIPPED;
 
-   if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS)
+   if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) {
rxdesc->flags |= RX_FLAG_DECRYPTED;
-   else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC)
+} else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) {
+   /*
+* In order to check the Michael Mic, the packet must 
have
+* been decrypted.  Mac80211 doesnt check the MMIC 
failure 
+* flag to initiate MMIC countermeasures if the decoded 
flag
+* has not been set.
+*/
+   rxdesc->flags |= RX_FLAG_DECRYPTED;
+
rxdesc->flags |= RX_FLAG_MMIC_ERROR;
+}
}
 
if (rt2x00_get_field32(word, RXD_W3_MY_BSS))
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c 
b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
index 685b8e0cd67d..7e5f397c37f9 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
@@ -697,11 +697,20 @@ static void rt2800usb_fill_rxdone(struct queue_entry 
*entry,
 * stripped it from the frame. Signal this to mac80211.
 */
rxdesc->flags |= RX_FLAG_MMIC_STRIPPED;
-
-   if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS)
+
+   if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) {
+   rxdesc->flags |= RX_FLAG_DECRYPTED;
+} else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) {
+   /*
+* In order to check the Michael Mic, the packet must 
have
+* been decrypted.  Mac80211 doesnt check the MMIC 
failure 
+* flag to initiate MMIC countermeasures if the decoded 
flag
+* has not been set.
+*/
rxdesc->flags |= RX_FLAG_DECRYPTED;
-   else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC)
+
rxdesc->flags |= RX_FLAG_MMIC_ERROR;
+}
}
 
if (rt2x00_get_field32(word, RXD_W0_MY_BSS))
-- 
2.11.0



[PATCH] ath9k: make ath_ps_ops structures as const

2017-08-03 Thread Bhumika Goyal
ath_ps_ops structures are only stored as a reference in the ps_ops
field of a ath_common structure. This field is of type const, so make
the structures as const.

Signed-off-by: Bhumika Goyal 
---
 drivers/net/wireless/ath/ath9k/htc_drv_init.c | 2 +-
 drivers/net/wireless/ath/ath9k/init.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index defacc6..da2164b 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -71,7 +71,7 @@ static void ath9k_htc_op_ps_restore(struct ath_common *common)
ath9k_htc_ps_restore((struct ath9k_htc_priv *) common->priv);
 }
 
-static struct ath_ps_ops ath9k_htc_ps_ops = {
+static const struct ath_ps_ops ath9k_htc_ps_ops = {
.wakeup = ath9k_htc_op_ps_wakeup,
.restore = ath9k_htc_op_ps_restore,
 };
diff --git a/drivers/net/wireless/ath/ath9k/init.c 
b/drivers/net/wireless/ath/ath9k/init.c
index fd9a618..bb79360 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -104,7 +104,7 @@ static void ath9k_op_ps_restore(struct ath_common *common)
ath9k_ps_restore((struct ath_softc *) common->priv);
 }
 
-static struct ath_ps_ops ath9k_ps_ops = {
+static const struct ath_ps_ops ath9k_ps_ops = {
.wakeup = ath9k_op_ps_wakeup,
.restore = ath9k_op_ps_restore,
 };
-- 
1.9.1



[PATCH v3] iwlwifi: Demote messages about fw flags size to info

2017-08-03 Thread João Paulo Rechi Vita
These messages are not reporting a real error, just the fact that the
firmware knows about more flags than the driver.

Currently these messages are presented to the user during boot if there
is no bootsplash covering the console, even when booting the kernel with
"quiet".

Demoting it to the warn level helps having a clean boot process.

Signed-off-by: João Paulo Rechi Vita 
---

v2 changes:
 - Set to warn level instead of info

v3 changes:
 - Fix commit message typo

 drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index be466a074c1d..c98a254bbd4d 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -461,9 +461,9 @@ static int iwl_set_ucode_api_flags(struct iwl_drv *drv, 
const u8 *data,
int i;
 
if (api_index >= DIV_ROUND_UP(NUM_IWL_UCODE_TLV_API, 32)) {
-   IWL_ERR(drv,
-   "api flags index %d larger than supported by driver\n",
-   api_index);
+   IWL_WARN(drv,
+"api flags index %d larger than supported by driver\n",
+api_index);
/* don't return an error so we can load FW that has more bits */
return 0;
}
@@ -485,9 +485,9 @@ static int iwl_set_ucode_capabilities(struct iwl_drv *drv, 
const u8 *data,
int i;
 
if (api_index >= DIV_ROUND_UP(NUM_IWL_UCODE_TLV_CAPA, 32)) {
-   IWL_ERR(drv,
-   "capa flags index %d larger than supported by driver\n",
-   api_index);
+   IWL_WARN(drv,
+"capa flags index %d larger than supported by 
driver\n",
+api_index);
/* don't return an error so we can load FW that has more bits */
return 0;
}
-- 
2.13.2



RE: [PATCH v2] iwlwifi: Demote messages about fw flags size to info

2017-08-03 Thread David Laight
From: João Paulo Rechi Vita
> Sent: 03 August 2017 15:30
> These messages are not reporting a real error, just the fact that the
> firmware knows about more flags then the driver.
  than
> 
> Currently these messages are presented to the user during boot if there
> is no bootsplash covering the console, even when booting the kernel with
> "quiet".
> 
> Demoting it to the warn level helps having a clean boot process.
> 
> Signed-off-by: Joo Paulo Rechi Vita 

David



Re: [PATCH 3/8] rsi: add support for legacy power save

2017-08-03 Thread Amitkumar Karwar
On Wed, Aug 2, 2017 at 3:20 PM, Kalle Valo  wrote:
> Amitkumar Karwar  writes:
>
>> From: Karun Eagalapati 
>>
>> This patch adds support for legacy power save. Necessary
>> configuration frames are downloaded to firmware when power save
>> is enabled/disabled
>>
>> Signed-off-by: Karun Eagalapati 
>> Signed-off-by: Amitkumar Karwar 
>
> [...]
>
>> +/* This function sends power save request to firmware */
>> +int rsi_send_ps_request(struct rsi_hw *adapter, bool enable)
>
> The comment is quite useless, IMHO the function name already tells the
> same as the comment.
>
>> --- /dev/null
>> +++ b/drivers/net/wireless/rsi/rsi_91x_ps.c
>> @@ -0,0 +1,149 @@
>> +/*
>> + * Copyright (c) 2017 Redpine Signals Inc. All rights reserved.
>> + *
>> + * Redistribution and use in source and binary forms, with or without
>> + * modification, are permitted provided that the following conditions are 
>> met:
>> + *
>> + *   1. Redistributions of source code must retain the above copyright
>> + *  notice, this list of conditions and the following disclaimer.
>> + *
>> + *   2. Redistributions in binary form must reproduce the above copyright
>> + *  notice, this list of conditions and the following disclaimer in the
>> + *  documentation and/or other materials provided with the distribution.
>> + *
>> + *   3. Neither the name of the copyright holder nor the names of its
>> + *  contributors may be used to endorse or promote products derived from
>> + *  this software without specific prior written permission.
>> + *
>> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 
>> IS"
>> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
>> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
>> PURPOSE
>> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
>> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
>> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
>> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
>> + * INTERRUPTION). HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
>> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
>> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
>> THE
>> + * POSSIBILITY OF SUCH DAMAGE.
>> + */
>
> The license is now different than in rest of the driver files which is a
> bit weird. I would prefer to have the same license throughout the
> driver.
>
>> +/* This function returns the ps state in string format */
>> +char *str_psstate(enum ps_state state)
>
> [...]
>
>> +/* This function modifies PS state to a new state */
>> +static inline void rsi_modify_ps_state(struct rsi_hw *adapter,
>
> [...]
>
>> +/* This function Initalises ps_info structure with default parameters */
>> +void rsi_default_ps_params(struct rsi_hw *adapter)
>
> [...]
>
>> +/* This function is used to enable power save */
>> +void rsi_enable_ps(struct rsi_hw *adapter)
>
> [...]
>
>> +/* This function is used to disable power save */
>> +void rsi_disable_ps(struct rsi_hw *adapter)
>
> [...]
>
>> +/* This function Processes powersave confirmation */
>> +int rsi_handle_ps_confirm(struct rsi_hw *adapter, u8 *msg)
>
> More useless comments. The code comments should provide more
> information, not replicate what is already in the code.
>

Thanks for review. I have addressed these comments in V2 series.

Regards,
Amitkumar Karwar


[v2 8/8] rsi: RTS threshold configuration

2017-08-03 Thread Amitkumar Karwar
From: Karun Eagalapati 

Provision is added for configuring RTS threshold by sending
vap dynamic update frame to firmware.

Signed-off-by: Karun Eagalapati 
Signed-off-by: Amitkumar Karwar 
---
 drivers/net/wireless/rsi/rsi_91x_mac80211.c |  9 +
 drivers/net/wireless/rsi/rsi_91x_mgmt.c | 31 +
 drivers/net/wireless/rsi/rsi_main.h |  1 +
 drivers/net/wireless/rsi/rsi_mgmt.h | 14 +
 4 files changed, 55 insertions(+)

diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c 
b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
index 6b833c4..210ad79 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
@@ -497,6 +497,15 @@ static int rsi_mac80211_config(struct ieee80211_hw *hw,
spin_unlock_irqrestore(>ps_lock, flags);
}
 
+   /* RTS threshold */
+   if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
+   rsi_dbg(INFO_ZONE, "RTS threshold\n");
+   if ((common->rts_threshold) <= IEEE80211_MAX_RTS_THRESHOLD) {
+   rsi_dbg(INFO_ZONE,
+   "%s: Sending vap updates\n", __func__);
+   status = rsi_send_vap_dynamic_update(common);
+   }
+   }
mutex_unlock(>mutex);
 
return status;
diff --git a/drivers/net/wireless/rsi/rsi_91x_mgmt.c 
b/drivers/net/wireless/rsi/rsi_91x_mgmt.c
index e5fe443..f93499d0 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mgmt.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mgmt.c
@@ -1058,6 +1058,37 @@ int rsi_send_radio_params_update(struct rsi_common 
*common)
return rsi_send_internal_mgmt_frame(common, skb);
 }
 
+/* This function programs the threshold. */
+int rsi_send_vap_dynamic_update(struct rsi_common *common)
+{
+   struct sk_buff *skb;
+   struct rsi_dynamic_s *dynamic_frame;
+
+   rsi_dbg(MGMT_TX_ZONE,
+   "%s: Sending vap update indication frame\n", __func__);
+
+   skb = dev_alloc_skb(sizeof(struct rsi_dynamic_s));
+   if (!skb)
+   return -ENOMEM;
+
+   memset(skb->data, 0, sizeof(struct rsi_dynamic_s));
+   dynamic_frame = (struct rsi_dynamic_s *)skb->data;
+   rsi_set_len_qno(_frame->desc_dword0.len_qno,
+   sizeof(dynamic_frame->frame_body), RSI_WIFI_MGMT_Q);
+
+   dynamic_frame->desc_dword0.frame_type = VAP_DYNAMIC_UPDATE;
+   dynamic_frame->desc_dword2.pkt_info =
+   cpu_to_le32(common->rts_threshold);
+   /* Beacon miss threshold */
+   dynamic_frame->frame_body.keep_alive_period =
+   cpu_to_le16(RSI_DEF_KEEPALIVE);
+   dynamic_frame->desc_dword3.sta_id = 0; /* vap id */
+
+   skb_put(skb, sizeof(struct rsi_dynamic_s));
+
+   return rsi_send_internal_mgmt_frame(common, skb);
+}
+
 /**
  * rsi_compare() - This function is used to compare two integers
  * @a: pointer to the first integer
diff --git a/drivers/net/wireless/rsi/rsi_main.h 
b/drivers/net/wireless/rsi/rsi_main.h
index d2cc47e..d05b5e0 100644
--- a/drivers/net/wireless/rsi/rsi_main.h
+++ b/drivers/net/wireless/rsi/rsi_main.h
@@ -58,6 +58,7 @@ extern __printf(2, 3) void rsi_dbg(u32 zone, const char *fmt, 
...);
 #define IEEE80211_ADDR_LEN  6
 #define FRAME_DESC_SZ   16
 #define MIN_802_11_HDR_LEN  24
+#define RSI_DEF_KEEPALIVE   90
 
 #define DATA_QUEUE_WATER_MARK   400
 #define MIN_DATA_QUEUE_WATER_MARK   300
diff --git a/drivers/net/wireless/rsi/rsi_mgmt.h 
b/drivers/net/wireless/rsi/rsi_mgmt.h
index b22103f..201a465 100644
--- a/drivers/net/wireless/rsi/rsi_mgmt.h
+++ b/drivers/net/wireless/rsi/rsi_mgmt.h
@@ -239,6 +239,7 @@ enum cmd_frame_type {
CW_MODE_REQ,
PER_CMD_PKT,
ANT_SEL_FRAME = 0x20,
+   VAP_DYNAMIC_UPDATE = 0x27,
COMMON_DEV_CONFIG = 0x28,
RADIO_PARAMS_UPDATE = 0x29
 };
@@ -374,6 +375,18 @@ struct rsi_ant_sel_frame {
__le32 reserved2;
 } __packed;
 
+struct rsi_dynamic_s {
+   struct rsi_cmd_desc_dword0 desc_dword0;
+   struct rsi_cmd_desc_dword1 desc_dword1;
+   struct rsi_cmd_desc_dword2 desc_dword2;
+   struct rsi_cmd_desc_dword3 desc_dword3;
+   struct framebody {
+   __le16 data_rate;
+   __le16 mgmt_rate;
+   __le16 keep_alive_period;
+   } frame_body;
+} __packed;
+
 /* Key descriptor flags */
 #define RSI_KEY_TYPE_BROADCAST BIT(1)
 #define RSI_WEP_KEYBIT(2)
@@ -585,6 +598,7 @@ int rsi_hal_load_key(struct rsi_common *common, u8 *data, 
u16 key_len,
 u8 key_type, u8 key_id, u32 cipher);
 int rsi_set_channel(struct rsi_common *common,
struct ieee80211_channel *channel);
+int rsi_send_vap_dynamic_update(struct rsi_common *common);
 int rsi_send_block_unblock_frame(struct 

[v2 7/8] rsi: buffer available interrupt handling

2017-08-03 Thread Amitkumar Karwar
From: Karun Eagalapati 

BUFFER_AVAILABLE interrupt is sent by firmware to indicate
change in buffer status. We should check buffer status while
handling this interrupt. Currently buffer status is checked
only while dequeueing packets. This patch fixes a data
traffic stuck problem observed occasionally.

Signed-off-by: Karun Eagalapati 
Signed-off-by: Amitkumar Karwar 
---
 drivers/net/wireless/rsi/rsi_91x_sdio_ops.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c 
b/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c
index 94a9fcd..8e2a95c 100644
--- a/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c
+++ b/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c
@@ -259,10 +259,12 @@ void rsi_interrupt_handler(struct rsi_hw *adapter)
 
switch (isr_type) {
case BUFFER_AVAILABLE:
-   dev->rx_info.watch_bufferfull_count = 0;
-   dev->rx_info.buffer_full = false;
-   dev->rx_info.semi_buffer_full = false;
-   dev->rx_info.mgmt_buffer_full = false;
+   status = rsi_sdio_check_buffer_status(adapter,
+ 0);
+   if (status < 0)
+   rsi_dbg(ERR_ZONE,
+   "%s: Failed to check buffer 
status\n",
+   __func__);
rsi_sdio_ack_intr(common->priv,
  (1 << PKT_BUFF_AVAILABLE));
rsi_set_event(>tx_thread.event);
@@ -270,7 +272,6 @@ void rsi_interrupt_handler(struct rsi_hw *adapter)
rsi_dbg(ISR_ZONE,
"%s: ==> BUFFER_AVAILABLE <==\n",
__func__);
-   dev->rx_info.buf_available_counter++;
dev->buff_status_updated = true;
break;
 
-- 
2.7.4



[v2 6/8] rsi: buffer full check optimization

2017-08-03 Thread Amitkumar Karwar
From: Karun Eagalapati 

We get buffer full event from firmware whenever Tx queue is full
Host should stop writing packets after this and resume after
buffer free event.
Buffer status checking is optimized for once in 4 times if
BUFF_FULL condition is not set, otherwise once for every
packet.

Signed-off-by: Karun Eagalapati 
Signed-off-by: Amitkumar Karwar 
---
 drivers/net/wireless/rsi/rsi_91x_sdio_ops.c | 16 +++-
 drivers/net/wireless/rsi/rsi_sdio.h |  1 +
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c 
b/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c
index 9b94ba7..94a9fcd 100644
--- a/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c
+++ b/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c
@@ -271,6 +271,7 @@ void rsi_interrupt_handler(struct rsi_hw *adapter)
"%s: ==> BUFFER_AVAILABLE <==\n",
__func__);
dev->rx_info.buf_available_counter++;
+   dev->buff_status_updated = true;
break;
 
case FIRMWARE_ASSERT_IND:
@@ -333,7 +334,14 @@ int rsi_sdio_check_buffer_status(struct rsi_hw *adapter, 
u8 q_num)
(struct rsi_91x_sdiodev *)adapter->rsi_dev;
u8 buf_status = 0;
int status = 0;
+   static int counter = 4;
 
+   if (!dev->buff_status_updated && counter) {
+   counter--;
+   goto out;
+   }
+
+   dev->buff_status_updated = false;
status = rsi_sdio_read_register(common->priv,
RSI_DEVICE_BUFFER_STATUS_REGISTER,
_status);
@@ -368,10 +376,16 @@ int rsi_sdio_check_buffer_status(struct rsi_hw *adapter, 
u8 q_num)
dev->rx_info.semi_buffer_full = false;
}
 
+   if (dev->rx_info.mgmt_buffer_full || dev->rx_info.buf_full_counter)
+   counter = 1;
+   else
+   counter = 4;
+
+out:
if ((q_num == MGMT_SOFT_Q) && (dev->rx_info.mgmt_buffer_full))
return QUEUE_FULL;
 
-   if (dev->rx_info.buffer_full)
+   if ((q_num < MGMT_SOFT_Q) && (dev->rx_info.buffer_full))
return QUEUE_FULL;
 
return QUEUE_NOT_FULL;
diff --git a/drivers/net/wireless/rsi/rsi_sdio.h 
b/drivers/net/wireless/rsi/rsi_sdio.h
index 9239fbe..95e4bed 100644
--- a/drivers/net/wireless/rsi/rsi_sdio.h
+++ b/drivers/net/wireless/rsi/rsi_sdio.h
@@ -114,6 +114,7 @@ struct rsi_91x_sdiodev {
u8 prev_desc[16];
u16 tx_blk_size;
u8 write_fail;
+   bool buff_status_updated;
 };
 
 void rsi_interrupt_handler(struct rsi_hw *adapter);
-- 
2.7.4



[v2 5/8] rsi: rename sdio_read_buffer_status_register

2017-08-03 Thread Amitkumar Karwar
From: Karun Eagalapati 

rsi_sdio_check_buffer_status would be the appropriate name
for this function as we are checking hardware buffers
availability status.

Signed-off-by: Karun Eagalapati 
Signed-off-by: Amitkumar Karwar 
---
 drivers/net/wireless/rsi/rsi_91x_sdio.c |  2 +-
 drivers/net/wireless/rsi/rsi_91x_sdio_ops.c | 13 +++--
 drivers/net/wireless/rsi/rsi_sdio.h |  2 +-
 3 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c 
b/drivers/net/wireless/rsi/rsi_91x_sdio.c
index 42d558b..742f6cd 100644
--- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
+++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
@@ -860,7 +860,7 @@ static int rsi_init_sdio_interface(struct rsi_hw *adapter,
sdio_release_host(pfunction);
 
adapter->determine_event_timeout = rsi_sdio_determine_event_timeout;
-   adapter->check_hw_queue_status = rsi_sdio_read_buffer_status_register;
+   adapter->check_hw_queue_status = rsi_sdio_check_buffer_status;
 
 #ifdef CONFIG_RSI_DEBUGFS
adapter->num_debugfs_entries = MAX_DEBUGFS_ENTRIES;
diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c 
b/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c
index b3f7adc..9b94ba7 100644
--- a/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c
+++ b/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c
@@ -323,17 +323,10 @@ void rsi_interrupt_handler(struct rsi_hw *adapter)
} while (1);
 }
 
-/**
- * rsi_sdio_read_buffer_status_register() - This function is used to the read
- * buffer status register and set
- * relevant fields in
- * rsi_91x_sdiodev struct.
- * @adapter: Pointer to the driver hw structure.
- * @q_num: The Q number whose status is to be found.
- *
- * Return: status: -1 on failure or else queue full/stop is indicated.
+/* This function is used to read buffer status register and
+ * set relevant fields in rsi_91x_sdiodev struct.
  */
-int rsi_sdio_read_buffer_status_register(struct rsi_hw *adapter, u8 q_num)
+int rsi_sdio_check_buffer_status(struct rsi_hw *adapter, u8 q_num)
 {
struct rsi_common *common = adapter->priv;
struct rsi_91x_sdiodev *dev =
diff --git a/drivers/net/wireless/rsi/rsi_sdio.h 
b/drivers/net/wireless/rsi/rsi_sdio.h
index 3cf6756..9239fbe 100644
--- a/drivers/net/wireless/rsi/rsi_sdio.h
+++ b/drivers/net/wireless/rsi/rsi_sdio.h
@@ -127,5 +127,5 @@ int rsi_sdio_write_register_multiple(struct rsi_hw 
*adapter, u32 addr,
 int rsi_sdio_master_access_msword(struct rsi_hw *adapter, u16 ms_word);
 void rsi_sdio_ack_intr(struct rsi_hw *adapter, u8 int_bit);
 int rsi_sdio_determine_event_timeout(struct rsi_hw *adapter);
-int rsi_sdio_read_buffer_status_register(struct rsi_hw *adapter, u8 q_num);
+int rsi_sdio_check_buffer_status(struct rsi_hw *adapter, u8 q_num);
 #endif
-- 
2.7.4



[v2 4/8] rsi: add support for U-APSD power save

2017-08-03 Thread Amitkumar Karwar
From: Karun Eagalapati 

This patch adds support for U-APSD power save. Configuration
frame is downloaded to firmware with default settings and
support is advertised to mac80211

Signed-off-by: Karun Eagalapati 
Signed-off-by: Amitkumar Karwar 
---
 drivers/net/wireless/rsi/rsi_91x_mac80211.c | 19 +++
 drivers/net/wireless/rsi/rsi_91x_mgmt.c |  3 +++
 drivers/net/wireless/rsi/rsi_91x_ps.c   | 17 +
 drivers/net/wireless/rsi/rsi_main.h |  1 +
 drivers/net/wireless/rsi/rsi_mgmt.h |  6 ++
 5 files changed, 46 insertions(+)

diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c 
b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
index 16a0fd0..6b833c4 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
@@ -327,6 +327,7 @@ static int rsi_mac80211_add_interface(struct ieee80211_hw 
*hw,
struct rsi_common *common = adapter->priv;
int ret = -EOPNOTSUPP;
 
+   vif->driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD;
mutex_lock(>mutex);
switch (vif->type) {
case NL80211_IFTYPE_STATION:
@@ -560,6 +561,16 @@ static void rsi_mac80211_bss_info_changed(struct 
ieee80211_hw *hw,
  bss_conf->aid);
adapter->ps_info.dtim_interval_duration = bss->dtim_period;
adapter->ps_info.listen_interval = conf->listen_interval;
+
+   /* If U-APSD is updated, send ps parameters to firmware */
+   if (bss->assoc) {
+   if (common->uapsd_bitmap) {
+   rsi_dbg(INFO_ZONE, "Configuring UAPSD\n");
+   rsi_conf_uapsd(adapter);
+   }
+   } else {
+   common->uapsd_bitmap = 0;
+   }
}
 
if (changed & BSS_CHANGED_CQM) {
@@ -641,6 +652,12 @@ static int rsi_mac80211_conf_tx(struct ieee80211_hw *hw,
memcpy(>edca_params[idx],
   params,
   sizeof(struct ieee80211_tx_queue_params));
+
+   if (params->uapsd)
+   common->uapsd_bitmap |= idx;
+   else
+   common->uapsd_bitmap &= (~idx);
+
mutex_unlock(>mutex);
 
return 0;
@@ -1311,6 +1328,8 @@ int rsi_mac80211_attach(struct rsi_common *common)
 
hw->max_rates = 1;
hw->max_rate_tries = MAX_RETRIES;
+   hw->uapsd_queues = RSI_IEEE80211_UAPSD_QUEUES;
+   hw->uapsd_max_sp_len = IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL;
 
hw->max_tx_aggregation_subframes = 6;
rsi_register_rates_channels(adapter, NL80211_BAND_2GHZ);
diff --git a/drivers/net/wireless/rsi/rsi_91x_mgmt.c 
b/drivers/net/wireless/rsi/rsi_91x_mgmt.c
index f76b346..e5fe443 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mgmt.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mgmt.c
@@ -1425,6 +1425,9 @@ int rsi_send_ps_request(struct rsi_hw *adapter, bool 
enable)
ps->desc.desc_dword0.len_qno |= cpu_to_le16(RSI_PS_DISABLE_IND);
ps->desc.desc_dword3.token = cpu_to_le16(RSI_WAKEUP_REQUEST);
}
+
+   ps->ps_uapsd_acs = common->uapsd_bitmap;
+
ps->ps_sleep.sleep_type = ps_info->sleep_type;
ps->ps_sleep.num_bcns_per_lis_int =
cpu_to_le16(ps_info->num_bcns_per_lis_int);
diff --git a/drivers/net/wireless/rsi/rsi_91x_ps.c 
b/drivers/net/wireless/rsi/rsi_91x_ps.c
index 25e8f85..48c79f0 100644
--- a/drivers/net/wireless/rsi/rsi_91x_ps.c
+++ b/drivers/net/wireless/rsi/rsi_91x_ps.c
@@ -105,6 +105,22 @@ void rsi_disable_ps(struct rsi_hw *adapter)
rsi_modify_ps_state(adapter, PS_DISABLE_REQ_SENT);
 }
 
+void rsi_conf_uapsd(struct rsi_hw *adapter)
+{
+   int ret;
+
+   if (adapter->ps_state != PS_ENABLED)
+   return;
+
+   ret = rsi_send_ps_request(adapter, false);
+   if (!ret)
+   ret = rsi_send_ps_request(adapter, true);
+   if (ret)
+   rsi_dbg(ERR_ZONE,
+   "%s: Failed to send PS request to device\n",
+   __func__);
+}
+
 int rsi_handle_ps_confirm(struct rsi_hw *adapter, u8 *msg)
 {
u16 cfm_type = get_unaligned_le16(msg + PS_CONFIRM_INDEX);
@@ -127,3 +143,4 @@ int rsi_handle_ps_confirm(struct rsi_hw *adapter, u8 *msg)
 
return 0;
 }
+
diff --git a/drivers/net/wireless/rsi/rsi_main.h 
b/drivers/net/wireless/rsi/rsi_main.h
index 9aada0b..d2cc47e 100644
--- a/drivers/net/wireless/rsi/rsi_main.h
+++ b/drivers/net/wireless/rsi/rsi_main.h
@@ -243,6 +243,7 @@ struct rsi_common {
u16 oper_mode;
u8 lp_ps_handshake_mode;
u8 ulp_ps_handshake_mode;
+   u8 uapsd_bitmap;
u8 rf_power_val;
u8 wlan_rf_power_mode;
u8 obm_ant_sel_val;
diff --git a/drivers/net/wireless/rsi/rsi_mgmt.h 
b/drivers/net/wireless/rsi/rsi_mgmt.h
index c5d114d..b22103f 100644
--- a/drivers/net/wireless/rsi/rsi_mgmt.h
+++ b/drivers/net/wireless/rsi/rsi_mgmt.h
@@ -181,6 

[v2 3/8] rsi: add support for legacy power save

2017-08-03 Thread Amitkumar Karwar
From: Karun Eagalapati 

This patch adds support for legacy power save. Necessary
configuration frames are downloaded to firmware when power save
is enabled/disabled

Signed-off-by: Karun Eagalapati 
Signed-off-by: Amitkumar Karwar 
---
 drivers/net/wireless/rsi/Makefile   |   1 +
 drivers/net/wireless/rsi/rsi_91x_hal.c  |   7 ++
 drivers/net/wireless/rsi/rsi_91x_mac80211.c |  22 +
 drivers/net/wireless/rsi/rsi_91x_main.c |   2 +
 drivers/net/wireless/rsi/rsi_91x_mgmt.c |  57 +++-
 drivers/net/wireless/rsi/rsi_91x_ps.c   | 129 
 drivers/net/wireless/rsi/rsi_main.h |   9 +-
 drivers/net/wireless/rsi/rsi_mgmt.h |  21 +
 drivers/net/wireless/rsi/rsi_ps.h   |  64 ++
 9 files changed, 309 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/wireless/rsi/rsi_91x_ps.c
 create mode 100644 drivers/net/wireless/rsi/rsi_ps.h

diff --git a/drivers/net/wireless/rsi/Makefile 
b/drivers/net/wireless/rsi/Makefile
index a475c81..ebb8996 100644
--- a/drivers/net/wireless/rsi/Makefile
+++ b/drivers/net/wireless/rsi/Makefile
@@ -3,6 +3,7 @@ rsi_91x-y   += rsi_91x_core.o
 rsi_91x-y  += rsi_91x_mac80211.o
 rsi_91x-y  += rsi_91x_mgmt.o
 rsi_91x-y  += rsi_91x_hal.o
+rsi_91x-y  += rsi_91x_ps.o
 rsi_91x-$(CONFIG_RSI_DEBUGFS)  += rsi_91x_debugfs.o
 
 rsi_usb-y  += rsi_91x_usb.o rsi_91x_usb_ops.o
diff --git a/drivers/net/wireless/rsi/rsi_91x_hal.c 
b/drivers/net/wireless/rsi/rsi_91x_hal.c
index b0a7a15..4addcc0 100644
--- a/drivers/net/wireless/rsi/rsi_91x_hal.c
+++ b/drivers/net/wireless/rsi/rsi_91x_hal.c
@@ -111,6 +111,8 @@ static int rsi_prepare_mgmt_desc(struct rsi_common *common, 
struct sk_buff *skb)
 /* This function prepares descriptor for given data packet */
 static int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff 
*skb)
 {
+   struct rsi_hw *adapter = common->priv;
+   struct ieee80211_vif *vif;
struct ieee80211_hdr *wh = NULL;
struct ieee80211_tx_info *info;
struct skb_info *tx_params;
@@ -148,6 +150,7 @@ static int rsi_prepare_data_desc(struct rsi_common *common, 
struct sk_buff *skb)
xtend_desc = (struct xtended_desc *)>data[FRAME_DESC_SZ];
wh = (struct ieee80211_hdr *)>data[header_size];
seq_num = (le16_to_cpu(wh->seq_ctrl) >> 4);
+   vif = adapter->vifs[0];
 
data_desc->xtend_desc_size = header_size - FRAME_DESC_SZ;
 
@@ -156,6 +159,10 @@ static int rsi_prepare_data_desc(struct rsi_common 
*common, struct sk_buff *skb)
data_desc->mac_flags |= cpu_to_le16(RSI_QOS_ENABLE);
}
 
+   if ((vif->type == NL80211_IFTYPE_STATION) &&
+   (adapter->ps_state == PS_ENABLED))
+   wh->frame_control |= cpu_to_le16(RSI_SET_PS_ENABLE);
+
if ((!(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT)) &&
(common->secinfo.security_enable)) {
if (rsi_is_cipher_wep(common))
diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c 
b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
index 193f922..16a0fd0 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
@@ -18,6 +18,7 @@
 #include "rsi_debugfs.h"
 #include "rsi_mgmt.h"
 #include "rsi_common.h"
+#include "rsi_ps.h"
 
 static const struct ieee80211_channel rsi_2ghz_channels[] = {
{ .band = NL80211_BAND_2GHZ, .center_freq = 2412,
@@ -467,6 +468,8 @@ static int rsi_mac80211_config(struct ieee80211_hw *hw,
 {
struct rsi_hw *adapter = hw->priv;
struct rsi_common *common = adapter->priv;
+   struct ieee80211_vif *vif = adapter->vifs[0];
+   struct ieee80211_conf *conf = >conf;
int status = -EOPNOTSUPP;
 
mutex_lock(>mutex);
@@ -480,6 +483,19 @@ static int rsi_mac80211_config(struct ieee80211_hw *hw,
status = rsi_config_power(hw);
}
 
+   /* Power save parameters */
+   if ((changed & IEEE80211_CONF_CHANGE_PS) &&
+   (vif->type == NL80211_IFTYPE_STATION)) {
+   unsigned long flags;
+
+   spin_lock_irqsave(>ps_lock, flags);
+   if (conf->flags & IEEE80211_CONF_PS)
+   rsi_enable_ps(adapter);
+   else
+   rsi_disable_ps(adapter);
+   spin_unlock_irqrestore(>ps_lock, flags);
+   }
+
mutex_unlock(>mutex);
 
return status;
@@ -522,6 +538,8 @@ static void rsi_mac80211_bss_info_changed(struct 
ieee80211_hw *hw,
 {
struct rsi_hw *adapter = hw->priv;
struct rsi_common *common = adapter->priv;
+   struct ieee80211_bss_conf *bss = >bss_conf;
+   struct ieee80211_conf *conf = >conf;
u16 rx_filter_word = 0;
 
mutex_lock(>mutex);
@@ -540,6 +558,8 @@ static 

[v2 2/8] rsi: update set_antenna command frame

2017-08-03 Thread Amitkumar Karwar
From: Pavani Muthyala 

TX command frame set_antenna is modified to use common
descriptor structure. Also it's subframe type is set.

Signed-off-by: Pavani Muthyala 
Signed-off-by: Amitkumar Karwar 
---
 drivers/net/wireless/rsi/rsi_91x_mgmt.c | 13 +++--
 drivers/net/wireless/rsi/rsi_mgmt.h | 11 +++
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_mgmt.c 
b/drivers/net/wireless/rsi/rsi_91x_mgmt.c
index c488f4b..e00d4ed 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mgmt.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mgmt.c
@@ -1407,7 +1407,7 @@ int rsi_send_rx_filter_frame(struct rsi_common *common, 
u16 rx_filter_word)
  */
 int rsi_set_antenna(struct rsi_common *common, u8 antenna)
 {
-   struct rsi_mac_frame *cmd_frame;
+   struct rsi_ant_sel_frame *ant_sel_frame;
struct sk_buff *skb;
 
skb = dev_alloc_skb(FRAME_DESC_SZ);
@@ -1418,12 +1418,13 @@ int rsi_set_antenna(struct rsi_common *common, u8 
antenna)
}
 
memset(skb->data, 0, FRAME_DESC_SZ);
-   cmd_frame = (struct rsi_mac_frame *)skb->data;
-
-   cmd_frame->desc_word[1] = cpu_to_le16(ANT_SEL_FRAME);
-   cmd_frame->desc_word[3] = cpu_to_le16(antenna & 0x00ff);
-   cmd_frame->desc_word[0] = cpu_to_le16(RSI_WIFI_MGMT_Q << 12);
 
+   ant_sel_frame = (struct rsi_ant_sel_frame *)skb->data;
+   ant_sel_frame->desc_dword0.frame_type = ANT_SEL_FRAME;
+   ant_sel_frame->sub_frame_type = ANTENNA_SEL_TYPE;
+   ant_sel_frame->ant_value = cpu_to_le16(antenna & ANTENNA_MASK_VALUE);
+   rsi_set_len_qno(_sel_frame->desc_dword0.len_qno,
+   0, RSI_WIFI_MGMT_Q);
skb_put(skb, FRAME_DESC_SZ);
 
return rsi_send_internal_mgmt_frame(common, skb);
diff --git a/drivers/net/wireless/rsi/rsi_mgmt.h 
b/drivers/net/wireless/rsi/rsi_mgmt.h
index cb0b17e..1060edc 100644
--- a/drivers/net/wireless/rsi/rsi_mgmt.h
+++ b/drivers/net/wireless/rsi/rsi_mgmt.h
@@ -155,6 +155,8 @@
 
 #define ANTENNA_SEL_INT0x02 /* RF_OUT_2 / Integerated 
*/
 #define ANTENNA_SEL_UFL0x03 /* RF_OUT_1 / U.FL */
+#define ANTENNA_MASK_VALUE 0x00ff
+#define ANTENNA_SEL_TYPE   1
 
 /* Rx filter word definitions */
 #define PROMISCOUS_MODEBIT(0)
@@ -348,6 +350,15 @@ struct rsi_vap_caps {
__le16 beacon_miss_threshold;
 } __packed;
 
+struct rsi_ant_sel_frame {
+   struct rsi_cmd_desc_dword0 desc_dword0;
+   u8 reserved;
+   u8 sub_frame_type;
+   __le16 ant_value;
+   __le32 reserved1;
+   __le32 reserved2;
+} __packed;
+
 /* Key descriptor flags */
 #define RSI_KEY_TYPE_BROADCAST BIT(1)
 #define RSI_WEP_KEYBIT(2)
-- 
2.7.4



[v2 1/8] rsi: add support for rf-kill functionality

2017-08-03 Thread Amitkumar Karwar
From: Pavani Muthyala 

This patch implements rfkill_poll handler. Also, necessary changes
are done in interface up and down handler to support rfkill
functionality.

Signed-off-by: Pavani Muthyala 
Signed-off-by: Amitkumar Karwar 
---
 drivers/net/wireless/rsi/rsi_91x_mac80211.c | 21 +++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c 
b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
index c91d6ef..193f922 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
@@ -279,11 +279,12 @@ static int rsi_mac80211_start(struct ieee80211_hw *hw)
struct rsi_hw *adapter = hw->priv;
struct rsi_common *common = adapter->priv;
 
+   rsi_dbg(ERR_ZONE, "===> Interface UP <===\n");
mutex_lock(>mutex);
common->iface_down = false;
-   mutex_unlock(>mutex);
-
+   wiphy_rfkill_start_polling(hw->wiphy);
rsi_send_rx_filter_frame(common, 0);
+   mutex_unlock(>mutex);
 
return 0;
 }
@@ -299,8 +300,10 @@ static void rsi_mac80211_stop(struct ieee80211_hw *hw)
struct rsi_hw *adapter = hw->priv;
struct rsi_common *common = adapter->priv;
 
+   rsi_dbg(ERR_ZONE, "===> Interface DOWN <===\n");
mutex_lock(>mutex);
common->iface_down = true;
+   wiphy_rfkill_stop_polling(hw->wiphy);
 
/* Block all rx frames */
rsi_send_rx_filter_frame(common, 0x);
@@ -1214,6 +1217,19 @@ static void rsi_reg_notify(struct wiphy *wiphy,
mutex_unlock(>mutex);
 }
 
+static void rsi_mac80211_rfkill_poll(struct ieee80211_hw *hw)
+{
+   struct rsi_hw *adapter = hw->priv;
+   struct rsi_common *common = adapter->priv;
+
+   mutex_lock(>mutex);
+   if (common->fsm_state != FSM_MAC_INIT_DONE)
+   wiphy_rfkill_set_hw_state(hw->wiphy, true);
+   else
+   wiphy_rfkill_set_hw_state(hw->wiphy, false);
+   mutex_unlock(>mutex);
+}
+
 static struct ieee80211_ops mac80211_ops = {
.tx = rsi_mac80211_tx,
.start = rsi_mac80211_start,
@@ -1232,6 +1248,7 @@ static struct ieee80211_ops mac80211_ops = {
.sta_remove = rsi_mac80211_sta_remove,
.set_antenna = rsi_mac80211_set_antenna,
.get_antenna = rsi_mac80211_get_antenna,
+   .rfkill_poll = rsi_mac80211_rfkill_poll,
 };
 
 /**
-- 
2.7.4



[v2 0/8] rsi driver enhancements

2017-08-03 Thread Amitkumar Karwar
From: Amitkumar Karwar 

This patch series brings in few enhancements in rsi driver
like rfkill support, U-APSD and Legacy power save support,
antenna and RTS threshold configuration, improvements in
reading SDIO buffer status.

Changes in v2:
  1/8: Pavani's name was in incorrect format. Fixed this(Kalle)
  3/8: Used the same licence information for newly added files.
   Removed redundant comments for functions (Kalle)

Karun Eagalapati (6):
  rsi: add support for legacy power save
  rsi: add support for U-APSD power save
  rsi: rename sdio_read_buffer_status_register
  rsi: buffer full check optimization
  rsi: buffer available interrupt handling
  rsi: RTS threshold configuration

Pavani Muthyala (2):
  rsi: add support for rf-kill functionality
  rsi: update set_antenna command frame

 drivers/net/wireless/rsi/Makefile   |   1 +
 drivers/net/wireless/rsi/rsi_91x_hal.c  |   7 ++
 drivers/net/wireless/rsi/rsi_91x_mac80211.c |  71 +-
 drivers/net/wireless/rsi/rsi_91x_main.c |   2 +
 drivers/net/wireless/rsi/rsi_91x_mgmt.c | 104 ++--
 drivers/net/wireless/rsi/rsi_91x_ps.c   | 146 
 drivers/net/wireless/rsi/rsi_91x_sdio.c |   2 +-
 drivers/net/wireless/rsi/rsi_91x_sdio_ops.c |  40 +---
 drivers/net/wireless/rsi/rsi_main.h |  11 ++-
 drivers/net/wireless/rsi/rsi_mgmt.h |  52 ++
 drivers/net/wireless/rsi/rsi_ps.h   |  64 
 drivers/net/wireless/rsi/rsi_sdio.h |   3 +-
 12 files changed, 474 insertions(+), 29 deletions(-)
 create mode 100644 drivers/net/wireless/rsi/rsi_91x_ps.c
 create mode 100644 drivers/net/wireless/rsi/rsi_ps.h

-- 
2.7.4



[PATCH v2] iwlwifi: Demote messages about fw flags size to info

2017-08-03 Thread João Paulo Rechi Vita
These messages are not reporting a real error, just the fact that the
firmware knows about more flags then the driver.

Currently these messages are presented to the user during boot if there
is no bootsplash covering the console, even when booting the kernel with
"quiet".

Demoting it to the warn level helps having a clean boot process.

Signed-off-by: João Paulo Rechi Vita 
---

v2 changes:
 - Set to warn level instead of info

 drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index be466a074c1d..c98a254bbd4d 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -461,9 +461,9 @@ static int iwl_set_ucode_api_flags(struct iwl_drv *drv, 
const u8 *data,
int i;
 
if (api_index >= DIV_ROUND_UP(NUM_IWL_UCODE_TLV_API, 32)) {
-   IWL_ERR(drv,
-   "api flags index %d larger than supported by driver\n",
-   api_index);
+   IWL_WARN(drv,
+"api flags index %d larger than supported by driver\n",
+api_index);
/* don't return an error so we can load FW that has more bits */
return 0;
}
@@ -485,9 +485,9 @@ static int iwl_set_ucode_capabilities(struct iwl_drv *drv, 
const u8 *data,
int i;
 
if (api_index >= DIV_ROUND_UP(NUM_IWL_UCODE_TLV_CAPA, 32)) {
-   IWL_ERR(drv,
-   "capa flags index %d larger than supported by driver\n",
-   api_index);
+   IWL_WARN(drv,
+"capa flags index %d larger than supported by 
driver\n",
+api_index);
/* don't return an error so we can load FW that has more bits */
return 0;
}
-- 
2.13.2



[PATCH] rsi: fix uninitialized descriptor pointer issue

2017-08-03 Thread Amitkumar Karwar
From: Prameela Rani Garnepudi 

This patch fixes the uninitialized descriptor pointer
issue in function rsi_send_internal_mgmt_frame().
Descriptor should point to start of the skb data.

Reported-by: Dan Carpenter 
Fixes: 9a629fafe7d8 ("rsi: immediate wakeup bit and priority for TX command 
packets")
Signed-off-by: Prameela Rani Garnepudi 
Signed-off-by: Amitkumar Karwar 
---
 drivers/net/wireless/rsi/rsi_91x_mgmt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/rsi/rsi_91x_mgmt.c 
b/drivers/net/wireless/rsi/rsi_91x_mgmt.c
index c6e8a20..ba8a68f 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mgmt.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mgmt.c
@@ -275,6 +275,7 @@ static int rsi_send_internal_mgmt_frame(struct rsi_common 
*common,
rsi_dbg(ERR_ZONE, "%s: Unable to allocate skb\n", __func__);
return -ENOMEM;
}
+   desc = (struct rsi_cmd_desc *)skb->data;
desc->desc_dword0.len_qno |= cpu_to_le16(DESC_IMMEDIATE_WAKEUP);
skb->priority = MGMT_SOFT_Q;
tx_params = (struct skb_info *)_SKB_CB(skb)->driver_data;
-- 
2.7.4



Re: [PATCH v3 9/9] wil6210: make debugfs compilation optional

2017-08-03 Thread Arend van Spriel
On 03-08-17 15:25, Maya Erez wrote:
> From: Gidon Studinski 
> 
> Since debugfs is a kernel configuration option, enable the driver to
> compile without debugfs.
> 
> Signed-off-by: Gidon Studinski 
> Signed-off-by: Maya Erez 
> ---
>  drivers/net/wireless/ath/wil6210/Makefile  | 2 +-
>  drivers/net/wireless/ath/wil6210/debugfs.c | 6 ++
>  drivers/net/wireless/ath/wil6210/main.c| 1 +
>  drivers/net/wireless/ath/wil6210/txrx.c| 6 +++---
>  drivers/net/wireless/ath/wil6210/wil6210.h | 8 +++-
>  5 files changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/wil6210/Makefile 
> b/drivers/net/wireless/ath/wil6210/Makefile
> index 4ae21da..63a751a 100644
> --- a/drivers/net/wireless/ath/wil6210/Makefile
> +++ b/drivers/net/wireless/ath/wil6210/Makefile
> @@ -4,7 +4,7 @@ wil6210-y := main.o
>  wil6210-y += netdev.o
>  wil6210-y += cfg80211.o
>  wil6210-y += pcie_bus.o
> -wil6210-y += debugfs.o
> +wil6210-$(CONFIG_DEBUG_FS) += debugfs.o

This looks good, but 

>  wil6210-y += wmi.o
>  wil6210-y += interrupt.o
>  wil6210-y += txrx.o

[...]

> diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h 
> b/drivers/net/wireless/ath/wil6210/wil6210.h
> index e3c0c2f..d7b1e03 100644
> --- a/drivers/net/wireless/ath/wil6210/wil6210.h
> +++ b/drivers/net/wireless/ath/wil6210/wil6210.h
> @@ -30,7 +30,6 @@
>  extern unsigned int mtu_max;
>  extern unsigned short rx_ring_overflow_thrsh;
>  extern int agg_wsize;
> -extern u32 vring_idle_trsh;
>  extern bool rx_align_2;
>  extern bool rx_large_buf;
>  extern bool debug_fw;
> @@ -693,6 +692,7 @@ struct wil6210_priv {
>   u8 vring2cid_tid[WIL6210_MAX_TX_RINGS][2]; /* [0] - CID, [1] - TID */
>   struct wil_sta_info sta[WIL6210_MAX_CID];
>   int bcast_vring;
> + u32 vring_idle_trsh; /* HW fetches up to 16 descriptors at once  */

this vring stuff seems worth a separate patch (or I am simply
misunderstanding it).

Regards,
Arend

>   bool use_extended_dma_addr; /* indicates whether we are using 48 bits */
>   /* scan */
>   struct cfg80211_scan_request *scan_request;


[PATCH v3 8/9] wil6210: store FW RF calibration result

2017-08-03 Thread Maya Erez
From: Dedy Lansky 

Store initial FW RF calibration result in driver. Set this calibration
result back to FW after each FW reset in order to avoid future calibration
procedures.

Signed-off-by: Dedy Lansky 
Signed-off-by: Maya Erez 
---
 drivers/net/wireless/ath/wil6210/main.c| 6 ++
 drivers/net/wireless/ath/wil6210/wil6210.h | 6 ++
 drivers/net/wireless/ath/wil6210/wmi.c | 5 +
 drivers/net/wireless/ath/wil6210/wmi.h | 2 ++
 4 files changed, 19 insertions(+)

diff --git a/drivers/net/wireless/ath/wil6210/main.c 
b/drivers/net/wireless/ath/wil6210/main.c
index b1e2814..b89d017 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -1034,6 +1034,12 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)
wil_s(wil, RGF_CAF_ICR + offsetof(struct RGF_ICR, ICR), 0);
wil_w(wil, RGF_CAF_ICR + offsetof(struct RGF_ICR, IMV), ~0);
 
+   if (wil->fw_calib_result > 0) {
+   __le32 val = cpu_to_le32(wil->fw_calib_result |
+(CALIB_RESULT_SIGNATURE << 8));
+   wil_w(wil, RGF_USER_FW_CALIB_RESULT, (u32 __force)val);
+   }
+
wil_release_cpu(wil);
}
 
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h 
b/drivers/net/wireless/ath/wil6210/wil6210.h
index 724ad59..e3c0c2f 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -171,6 +171,10 @@ struct RGF_ICR {
 #define RGF_USER_USER_SCRATCH_PAD  (0x8802bc)
 #define RGF_USER_BL(0x880A3C) /* Boot Loader */
 #define RGF_USER_FW_REV_ID (0x880a8c) /* chip revision */
+#define RGF_USER_FW_CALIB_RESULT   (0x880a90) /* b0-7:result
+   * b8-15:signature
+   */
+   #define CALIB_RESULT_SIGNATURE  (0x11)
 #define RGF_USER_CLKS_CTL_0(0x880abc)
#define BIT_USER_CLKS_CAR_AHB_SW_SELBIT(1) /* ref clk/PLL */
#define BIT_USER_CLKS_RST_PWGD  BIT(11) /* reset on "power good" */
@@ -724,6 +728,8 @@ struct wil6210_priv {
 
enum wmi_ps_profile_type ps_profile;
 
+   int fw_calib_result;
+
 #ifdef CONFIG_PM
 #ifdef CONFIG_PM_SLEEP
struct notifier_block pm_notify;
diff --git a/drivers/net/wireless/ath/wil6210/wmi.c 
b/drivers/net/wireless/ath/wil6210/wmi.c
index a9487f2..ffdd2fa 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.c
+++ b/drivers/net/wireless/ath/wil6210/wmi.c
@@ -344,6 +344,11 @@ static void wmi_evt_ready(struct wil6210_priv *wil, int 
id, void *d, int len)
strlcpy(wdev->wiphy->fw_version, wil->fw_version,
sizeof(wdev->wiphy->fw_version));
 
+   if (len > offsetof(struct wmi_ready_event, rfc_read_calib_result)) {
+   wil_dbg_wmi(wil, "rfc calibration result %d\n",
+   evt->rfc_read_calib_result);
+   wil->fw_calib_result = evt->rfc_read_calib_result;
+   }
wil_set_recovery_state(wil, fw_recovery_idle);
set_bit(wil_status_fwready, wil->status);
/* let the reset sequence continue */
diff --git a/drivers/net/wireless/ath/wil6210/wmi.h 
b/drivers/net/wireless/ath/wil6210/wmi.h
index 4e31c2f..1b426d7 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.h
+++ b/drivers/net/wireless/ath/wil6210/wmi.h
@@ -1300,6 +1300,8 @@ struct wmi_ready_event {
/* enum wmi_phy_capability */
u8 phy_capability;
u8 numof_additional_mids;
+   u8 rfc_read_calib_result;
+   u8 reserved[3];
 } __packed;
 
 /* WMI_NOTIFY_REQ_DONE_EVENTID */
-- 
1.9.1



[PATCH v3 9/9] wil6210: make debugfs compilation optional

2017-08-03 Thread Maya Erez
From: Gidon Studinski 

Since debugfs is a kernel configuration option, enable the driver to
compile without debugfs.

Signed-off-by: Gidon Studinski 
Signed-off-by: Maya Erez 
---
 drivers/net/wireless/ath/wil6210/Makefile  | 2 +-
 drivers/net/wireless/ath/wil6210/debugfs.c | 6 ++
 drivers/net/wireless/ath/wil6210/main.c| 1 +
 drivers/net/wireless/ath/wil6210/txrx.c| 6 +++---
 drivers/net/wireless/ath/wil6210/wil6210.h | 8 +++-
 5 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/Makefile 
b/drivers/net/wireless/ath/wil6210/Makefile
index 4ae21da..63a751a 100644
--- a/drivers/net/wireless/ath/wil6210/Makefile
+++ b/drivers/net/wireless/ath/wil6210/Makefile
@@ -4,7 +4,7 @@ wil6210-y := main.o
 wil6210-y += netdev.o
 wil6210-y += cfg80211.o
 wil6210-y += pcie_bus.o
-wil6210-y += debugfs.o
+wil6210-$(CONFIG_DEBUG_FS) += debugfs.o
 wil6210-y += wmi.o
 wil6210-y += interrupt.o
 wil6210-y += txrx.o
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c 
b/drivers/net/wireless/ath/wil6210/debugfs.c
index d4e8865..d2afe50 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -20,7 +20,6 @@
 #include 
 #include 
 #include 
-
 #include "wil6210.h"
 #include "wmi.h"
 #include "txrx.h"
@@ -30,7 +29,6 @@
 static u32 mem_addr;
 static u32 dbg_txdesc_index;
 static u32 dbg_vring_index; /* 24+ for Rx, 0..23 for Tx */
-u32 vring_idle_trsh = 16; /* HW fetches up to 16 descriptors at once */
 
 enum dbg_off_type {
doff_u32 = 0,
@@ -1763,6 +1761,7 @@ static void wil6210_debugfs_init_isr(struct wil6210_priv 
*wil,
WIL_FIELD(chip_revision, 0444,  doff_u8),
WIL_FIELD(abft_len, 0644,   doff_u8),
WIL_FIELD(wakeup_trigger, 0644, doff_u8),
+   WIL_FIELD(vring_idle_trsh, 0644,doff_u32),
{},
 };
 
@@ -1778,8 +1777,6 @@ static void wil6210_debugfs_init_isr(struct wil6210_priv 
*wil,
{"desc_index",  0644, (ulong)_txdesc_index, doff_u32},
{"vring_index", 0644, (ulong)_vring_index, doff_u32},
{"mem_addr",0644, (ulong)_addr, doff_u32},
-   {"vring_idle_trsh", 0644, (ulong)_idle_trsh,
-doff_u32},
{"led_polarity", 0644, (ulong)_polarity, doff_u8},
{},
 };
@@ -1821,3 +1818,4 @@ void wil6210_debugfs_remove(struct wil6210_priv *wil)
 */
wil_pmc_free(wil, false);
 }
+
diff --git a/drivers/net/wireless/ath/wil6210/main.c 
b/drivers/net/wireless/ath/wil6210/main.c
index b89d017..e2ea490 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -581,6 +581,7 @@ int wil_priv_init(struct wil6210_priv *wil)
  WMI_WAKEUP_TRIGGER_BCAST;
memset(>suspend_stats, 0, sizeof(wil->suspend_stats));
wil->suspend_stats.min_suspend_time = ULONG_MAX;
+   wil->vring_idle_trsh = 16;
 
return 0;
 
diff --git a/drivers/net/wireless/ath/wil6210/txrx.c 
b/drivers/net/wireless/ath/wil6210/txrx.c
index ec57bcc..389c718 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -1666,7 +1666,7 @@ static int __wil_tx_vring_tso(struct wil6210_priv *wil, 
struct vring *vring,
 
/* performance monitoring */
used = wil_vring_used_tx(vring);
-   if (wil_val_in_range(vring_idle_trsh,
+   if (wil_val_in_range(wil->vring_idle_trsh,
 used, used + descs_used)) {
txdata->idle += get_cycles() - txdata->last_idle;
wil_dbg_txrx(wil,  "Ring[%2d] not idle %d -> %d\n",
@@ -1813,7 +1813,7 @@ static int __wil_tx_vring(struct wil6210_priv *wil, 
struct vring *vring,
 
/* performance monitoring */
used = wil_vring_used_tx(vring);
-   if (wil_val_in_range(vring_idle_trsh,
+   if (wil_val_in_range(wil->vring_idle_trsh,
 used, used + nr_frags + 1)) {
txdata->idle += get_cycles() - txdata->last_idle;
wil_dbg_txrx(wil,  "Ring[%2d] not idle %d -> %d\n",
@@ -2175,7 +2175,7 @@ int wil_tx_complete(struct wil6210_priv *wil, int ringid)
 
/* performance monitoring */
used_new = wil_vring_used_tx(vring);
-   if (wil_val_in_range(vring_idle_trsh,
+   if (wil_val_in_range(wil->vring_idle_trsh,
 used_new, used_before_complete)) {
wil_dbg_txrx(wil, "Ring[%2d] idle %d -> %d\n",
 ringid, used_before_complete, used_new);
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h 
b/drivers/net/wireless/ath/wil6210/wil6210.h
index e3c0c2f..d7b1e03 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -30,7 +30,6 @@
 extern unsigned int mtu_max;
 extern unsigned short rx_ring_overflow_thrsh;
 extern int agg_wsize;
-extern u32 

[PATCH v3 7/9] wil6210: fix interface-up check

2017-08-03 Thread Maya Erez
From: Hamad Kadmany 

While wil_open is executed, any call to netif_running
would return a success. In case there are failures
within wil_open, should not treat the device as if it
is already opened in relevant functions (like FW recovery
and runtime suspend check).

Fix that by checking the device up flag instead.

Signed-off-by: Hamad Kadmany 
Signed-off-by: Maya Erez 
---
 drivers/net/wireless/ath/wil6210/main.c | 3 ++-
 drivers/net/wireless/ath/wil6210/pm.c   | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/main.c 
b/drivers/net/wireless/ath/wil6210/main.c
index 8968c2c..b1e2814 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -394,10 +394,11 @@ static void wil_fw_error_worker(struct work_struct *work)
struct wil6210_priv *wil = container_of(work, struct wil6210_priv,
fw_error_worker);
struct wireless_dev *wdev = wil->wdev;
+   struct net_device *ndev = wil_to_ndev(wil);
 
wil_dbg_misc(wil, "fw error worker\n");
 
-   if (!netif_running(wil_to_ndev(wil))) {
+   if (!(ndev->flags & IFF_UP)) {
wil_info(wil, "No recovery - interface is down\n");
return;
}
diff --git a/drivers/net/wireless/ath/wil6210/pm.c 
b/drivers/net/wireless/ath/wil6210/pm.c
index 820ed17..8f5d1b44 100644
--- a/drivers/net/wireless/ath/wil6210/pm.c
+++ b/drivers/net/wireless/ath/wil6210/pm.c
@@ -21,10 +21,11 @@ int wil_can_suspend(struct wil6210_priv *wil, bool 
is_runtime)
 {
int rc = 0;
struct wireless_dev *wdev = wil->wdev;
+   struct net_device *ndev = wil_to_ndev(wil);
 
wil_dbg_pm(wil, "can_suspend: %s\n", is_runtime ? "runtime" : "system");
 
-   if (!netif_running(wil_to_ndev(wil))) {
+   if (!(ndev->flags & IFF_UP)) {
/* can always sleep when down */
wil_dbg_pm(wil, "Interface is down\n");
goto out;
-- 
1.9.1



[PATCH v3 2/9] wil6210: allow configuring scan timers

2017-08-03 Thread Maya Erez
From: Hamad Kadmany 

Allow setting scan timeout and scan dwell time
through module parameters.

Signed-off-by: Hamad Kadmany 
Signed-off-by: Maya Erez 
---
 drivers/net/wireless/ath/wil6210/cfg80211.c | 17 ++---
 drivers/net/wireless/ath/wil6210/wil6210.h  |  2 +-
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c 
b/drivers/net/wireless/ath/wil6210/cfg80211.c
index 77af749..d079533 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -26,6 +26,14 @@
 module_param(disable_ap_sme, bool, 0444);
 MODULE_PARM_DESC(disable_ap_sme, " let user space handle AP mode SME");
 
+static uint scan_dwell_time  = WMI_SCAN_DWELL_TIME_MS;
+module_param(scan_dwell_time, uint, 0644);
+MODULE_PARM_DESC(scan_dwell_time, " Scan dwell time (msec)");
+
+static uint scan_timeout = WIL6210_SCAN_TO_SEC;
+module_param(scan_timeout, uint, 0644);
+MODULE_PARM_DESC(scan_timeout, " Scan timeout (seconds)");
+
 #define CHAN60G(_channel, _flags) {\
.band   = NL80211_BAND_60GHZ,   \
.center_freq= 56160 + (2160 * (_channel)),  \
@@ -528,8 +536,9 @@ static int wil_cfg80211_scan(struct wiphy *wiphy,
 
(void)wil_p2p_stop_discovery(wil);
 
-   wil_dbg_misc(wil, "Start scan_request 0x%p\n", request);
-   wil_dbg_misc(wil, "SSID count: %d", request->n_ssids);
+   wil_dbg_misc(wil,
+"Start scan_request 0x%p, dwell_time %dms, timeout %dsec, 
SSID count %d\n",
+request, scan_dwell_time, scan_timeout, request->n_ssids);
 
for (i = 0; i < request->n_ssids; i++) {
wil_dbg_misc(wil, "SSID[%d]", i);
@@ -550,10 +559,12 @@ static int wil_cfg80211_scan(struct wiphy *wiphy,
}
 
wil->scan_request = request;
-   mod_timer(>scan_timer, jiffies + WIL6210_SCAN_TO);
+   mod_timer(>scan_timer,
+ jiffies + msecs_to_jiffies(1000U * scan_timeout));
 
memset(, 0, sizeof(cmd));
cmd.cmd.scan_type = WMI_ACTIVE_SCAN;
+   cmd.cmd.dwell_time = cpu_to_le32(scan_dwell_time);
cmd.cmd.num_channels = 0;
n = min(request->n_channels, 4U);
for (i = 0; i < n; i++) {
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h 
b/drivers/net/wireless/ath/wil6210/wil6210.h
index d085ccf..ac32284 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -112,7 +112,7 @@ static inline u32 wil_mtu2macbuf(u32 mtu)
 #define WIL6210_ITR_RX_MAX_BURST_DURATION_DEFAULT (500) /* usec */
 #define WIL6210_FW_RECOVERY_RETRIES(5) /* try to recover this many times */
 #define WIL6210_FW_RECOVERY_TO msecs_to_jiffies(5000)
-#define WIL6210_SCAN_TOmsecs_to_jiffies(1)
+#define WIL6210_SCAN_TO_SEC10
 #define WIL6210_DISCONNECT_TO_MS (2000)
 #define WIL6210_RX_HIGH_TRSH_INIT  (0)
 #define WIL6210_RX_HIGH_TRSH_DEFAULT \
-- 
1.9.1



[PATCH v3 1/9] wil6210: protect against invalid length of tx management frame

2017-08-03 Thread Maya Erez
From: Hamad Kadmany 

Validate buffer length has the minimum needed size
when sending management frame to protect against
possible buffer overrun.

Signed-off-by: Hamad Kadmany 
Signed-off-by: Lior David 
Signed-off-by: Maya Erez 
---
 drivers/net/wireless/ath/wil6210/cfg80211.c | 3 +++
 drivers/net/wireless/ath/wil6210/debugfs.c  | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c 
b/drivers/net/wireless/ath/wil6210/cfg80211.c
index 0b5383a..77af749 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -884,6 +884,9 @@ int wil_cfg80211_mgmt_tx(struct wiphy *wiphy, struct 
wireless_dev *wdev,
wil_hex_dump_misc("mgmt tx frame ", DUMP_PREFIX_OFFSET, 16, 1, buf,
  len, true);
 
+   if (len < sizeof(struct ieee80211_hdr_3addr))
+   return -EINVAL;
+
cmd = kmalloc(sizeof(*cmd) + len, GFP_KERNEL);
if (!cmd) {
rc = -ENOMEM;
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c 
b/drivers/net/wireless/ath/wil6210/debugfs.c
index f82506d..a2b5d59 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -801,6 +801,9 @@ static ssize_t wil_write_file_txmgmt(struct file *file, 
const char __user *buf,
int rc;
void *frame;
 
+   if (!len)
+   return -EINVAL;
+
frame = memdup_user(buf, len);
if (IS_ERR(frame))
return PTR_ERR(frame);
-- 
1.9.1



[PATCH v3 6/9] wil6210: notify wiphy on wowlan support

2017-08-03 Thread Maya Erez
Set wowlan to indicate that 11ad device can wake-up
on any trigger and disconnect.

Signed-off-by: Maya Erez 
---
 drivers/net/wireless/ath/wil6210/cfg80211.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c 
b/drivers/net/wireless/ath/wil6210/cfg80211.c
index c860c0c..61e872c 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -34,6 +34,12 @@
 module_param(scan_timeout, uint, 0644);
 MODULE_PARM_DESC(scan_timeout, " Scan timeout (seconds)");
 
+#ifdef CONFIG_PM
+static struct wiphy_wowlan_support wil_wowlan_support = {
+   .flags = WIPHY_WOWLAN_ANY | WIPHY_WOWLAN_DISCONNECT,
+};
+#endif
+
 #define CHAN60G(_channel, _flags) {\
.band   = NL80211_BAND_60GHZ,   \
.center_freq= 56160 + (2160 * (_channel)),  \
@@ -1819,6 +1825,10 @@ static void wil_wiphy_init(struct wiphy *wiphy)
 
wiphy->n_vendor_commands = ARRAY_SIZE(wil_nl80211_vendor_commands);
wiphy->vendor_commands = wil_nl80211_vendor_commands;
+
+#ifdef CONFIG_PM
+   wiphy->wowlan = _wowlan_support;
+#endif
 }
 
 struct wireless_dev *wil_cfg80211_init(struct device *dev)
-- 
1.9.1



[PATCH v3 0/9] wil6210 patches

2017-08-03 Thread Maya Erez
Changes from v2:
- Remove debugfs.c compilation if CONFIG_DEBUG_FS is not defined

Changes from v1:
- Removal of runtime PM patch, pending a fix to system suspend flow

Dedy Lansky (2):
  wil6210: support FW RSSI reporting
  wil6210: store FW RF calibration result

Gidon Studinski (1):
  wil6210: make debugfs compilation optional

Hamad Kadmany (3):
  wil6210: protect against invalid length of tx management frame
  wil6210: allow configuring scan timers
  wil6210: fix interface-up check

Maya Erez (3):
  wil6210: check no_fw_recovery in resume failure recovery
  wil6210: add statistics for suspend time
  wil6210: notify wiphy on wowlan support

 drivers/net/wireless/ath/wil6210/Makefile   |  2 +-
 drivers/net/wireless/ath/wil6210/cfg80211.c | 42 -
 drivers/net/wireless/ath/wil6210/debugfs.c  | 28 ++-
 drivers/net/wireless/ath/wil6210/main.c | 12 -
 drivers/net/wireless/ath/wil6210/pcie_bus.c |  3 +++
 drivers/net/wireless/ath/wil6210/pm.c   | 27 ---
 drivers/net/wireless/ath/wil6210/txrx.c |  6 ++---
 drivers/net/wireless/ath/wil6210/wil6210.h  | 21 +--
 drivers/net/wireless/ath/wil6210/wmi.c  | 14 +++---
 drivers/net/wireless/ath/wil6210/wmi.h  |  8 --
 10 files changed, 134 insertions(+), 29 deletions(-)

-- 
1.9.1



[PATCH v3 3/9] wil6210: support FW RSSI reporting

2017-08-03 Thread Maya Erez
From: Dedy Lansky 

New FW supports reporting RSSI signal in dBm.
Report RSSI to kernel in case FW has this capability.

Signed-off-by: Dedy Lansky 
Signed-off-by: Maya Erez 
---
 drivers/net/wireless/ath/wil6210/cfg80211.c | 12 
 drivers/net/wireless/ath/wil6210/debugfs.c  |  2 ++
 drivers/net/wireless/ath/wil6210/pcie_bus.c |  3 +++
 drivers/net/wireless/ath/wil6210/wmi.c  |  9 ++---
 drivers/net/wireless/ath/wil6210/wmi.h  |  6 --
 5 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c 
b/drivers/net/wireless/ath/wil6210/cfg80211.c
index d079533..c860c0c 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -281,12 +281,12 @@ int wil_cid_fill_sinfo(struct wil6210_priv *wil, int cid,
 
wil_dbg_wmi(wil, "Link status for CID %d: {\n"
"  MCS %d TSF 0x%016llx\n"
-   "  BF status 0x%08x SNR 0x%08x SQI %d%%\n"
+   "  BF status 0x%08x RSSI %d SQI %d%%\n"
"  Tx Tpt %d goodput %d Rx goodput %d\n"
"  Sectors(rx:tx) my %d:%d peer %d:%d\n""}\n",
cid, le16_to_cpu(reply.evt.bf_mcs),
le64_to_cpu(reply.evt.tsf), reply.evt.status,
-   le32_to_cpu(reply.evt.snr_val),
+   reply.evt.rssi,
reply.evt.sqi,
le32_to_cpu(reply.evt.tx_tpt),
le32_to_cpu(reply.evt.tx_goodput),
@@ -319,7 +319,11 @@ int wil_cid_fill_sinfo(struct wil6210_priv *wil, int cid,
 
if (test_bit(wil_status_fwconnected, wil->status)) {
sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
-   sinfo->signal = reply.evt.sqi;
+   if (test_bit(WMI_FW_CAPABILITY_RSSI_REPORTING,
+wil->fw_capabilities))
+   sinfo->signal = reply.evt.rssi;
+   else
+   sinfo->signal = reply.evt.sqi;
}
 
return rc;
@@ -1805,7 +1809,7 @@ static void wil_wiphy_init(struct wiphy *wiphy)
 
wiphy->bands[NL80211_BAND_60GHZ] = _band_60ghz;
 
-   /* TODO: figure this out */
+   /* may change after reading FW capabilities */
wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC;
 
wiphy->cipher_suites = wil_cipher_suites;
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c 
b/drivers/net/wireless/ath/wil6210/debugfs.c
index a2b5d59..21b6611 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -1016,6 +1016,7 @@ static int wil_bf_debugfs_show(struct seq_file *s, void 
*data)
   "  TSF = 0x%016llx\n"
   "  TxMCS = %2d TxTpt = %4d\n"
   "  SQI = %4d\n"
+  "  RSSI = %4d\n"
   "  Status = 0x%08x %s\n"
   "  Sectors(rx:tx) my %2d:%2d peer %2d:%2d\n"
   "  Goodput(rx:tx) %4d:%4d\n"
@@ -1025,6 +1026,7 @@ static int wil_bf_debugfs_show(struct seq_file *s, void 
*data)
   le16_to_cpu(reply.evt.bf_mcs),
   le32_to_cpu(reply.evt.tx_tpt),
   reply.evt.sqi,
+  reply.evt.rssi,
   status, wil_bfstatus_str(status),
   le16_to_cpu(reply.evt.my_rx_sector),
   le16_to_cpu(reply.evt.my_tx_sector),
diff --git a/drivers/net/wireless/ath/wil6210/pcie_bus.c 
b/drivers/net/wireless/ath/wil6210/pcie_bus.c
index d571feb..6a3ab4b 100644
--- a/drivers/net/wireless/ath/wil6210/pcie_bus.c
+++ b/drivers/net/wireless/ath/wil6210/pcie_bus.c
@@ -84,6 +84,9 @@ void wil_set_capabilities(struct wil6210_priv *wil)
 
/* extract FW capabilities from file without loading the FW */
wil_request_firmware(wil, wil->wil_fw_name, false);
+
+   if (test_bit(WMI_FW_CAPABILITY_RSSI_REPORTING, wil->fw_capabilities))
+   wil_to_wiphy(wil)->signal_type = CFG80211_SIGNAL_TYPE_MBM;
 }
 
 void wil_disable_irq(struct wil6210_priv *wil)
diff --git a/drivers/net/wireless/ath/wil6210/wmi.c 
b/drivers/net/wireless/ath/wil6210/wmi.c
index 65ef673..a9487f2 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.c
+++ b/drivers/net/wireless/ath/wil6210/wmi.c
@@ -381,12 +381,15 @@ static void wmi_evt_rx_mgmt(struct wil6210_priv *wil, int 
id, void *d, int len)
ch_no = data->info.channel + 1;
freq = ieee80211_channel_to_frequency(ch_no, NL80211_BAND_60GHZ);
channel = ieee80211_get_channel(wiphy, freq);
-   signal = data->info.sqi;
+   if (test_bit(WMI_FW_CAPABILITY_RSSI_REPORTING, wil->fw_capabilities))
+   signal = 100 * data->info.rssi;
+   else
+   signal = data->info.sqi;

[PATCH v3 5/9] wil6210: add statistics for suspend time

2017-08-03 Thread Maya Erez
Add statistics for total, min and max suspend time, that
calculates the time the 11ad device was in suspend.
Those statistics will help to estimate the power impact
of d3hot feature.

Signed-off-by: Maya Erez 
---
 drivers/net/wireless/ath/wil6210/debugfs.c | 17 +++--
 drivers/net/wireless/ath/wil6210/main.c|  2 ++
 drivers/net/wireless/ath/wil6210/pm.c  | 20 ++--
 drivers/net/wireless/ath/wil6210/wil6210.h |  5 +
 4 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c 
b/drivers/net/wireless/ath/wil6210/debugfs.c
index 21b6611..d4e8865 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -1617,6 +1617,8 @@ static ssize_t wil_write_suspend_stats(struct file *file,
struct wil6210_priv *wil = file->private_data;
 
memset(>suspend_stats, 0, sizeof(wil->suspend_stats));
+   wil->suspend_stats.min_suspend_time = ULONG_MAX;
+   wil->suspend_stats.collection_start = ktime_get();
 
return len;
 }
@@ -1628,18 +1630,27 @@ static ssize_t wil_read_suspend_stats(struct file *file,
struct wil6210_priv *wil = file->private_data;
static char text[400];
int n;
+   unsigned long long stats_collection_time =
+   ktime_to_us(ktime_sub(ktime_get(),
+ wil->suspend_stats.collection_start));
 
n = snprintf(text, sizeof(text),
 "Suspend statistics:\n"
 "successful suspends:%ld failed suspends:%ld\n"
 "successful resumes:%ld failed resumes:%ld\n"
-"rejected by host:%ld rejected by device:%ld\n",
+"rejected by host:%ld rejected by device:%ld\n"
+"total suspend time:%lld min suspend time:%lld\n"
+"max suspend time:%lld stats collection time: %lld\n",
 wil->suspend_stats.successful_suspends,
 wil->suspend_stats.failed_suspends,
 wil->suspend_stats.successful_resumes,
 wil->suspend_stats.failed_resumes,
 wil->suspend_stats.rejected_by_host,
-wil->suspend_stats.rejected_by_device);
+wil->suspend_stats.rejected_by_device,
+wil->suspend_stats.total_suspend_time,
+wil->suspend_stats.min_suspend_time,
+wil->suspend_stats.max_suspend_time,
+stats_collection_time);
 
n = min_t(int, n, sizeof(text));
 
@@ -1795,6 +1806,8 @@ int wil6210_debugfs_init(struct wil6210_priv *wil)
 
wil6210_debugfs_create_ITR_CNT(wil, dbg);
 
+   wil->suspend_stats.collection_start = ktime_get();
+
return 0;
 }
 
diff --git a/drivers/net/wireless/ath/wil6210/main.c 
b/drivers/net/wireless/ath/wil6210/main.c
index daf944a..8968c2c 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -578,6 +578,8 @@ int wil_priv_init(struct wil6210_priv *wil)
 
wil->wakeup_trigger = WMI_WAKEUP_TRIGGER_UCAST |
  WMI_WAKEUP_TRIGGER_BCAST;
+   memset(>suspend_stats, 0, sizeof(wil->suspend_stats));
+   wil->suspend_stats.min_suspend_time = ULONG_MAX;
 
return 0;
 
diff --git a/drivers/net/wireless/ath/wil6210/pm.c 
b/drivers/net/wireless/ath/wil6210/pm.c
index 4548829..820ed17 100644
--- a/drivers/net/wireless/ath/wil6210/pm.c
+++ b/drivers/net/wireless/ath/wil6210/pm.c
@@ -300,6 +300,9 @@ int wil_suspend(struct wil6210_priv *wil, bool is_runtime)
wil_dbg_pm(wil, "suspend: %s => %d\n",
   is_runtime ? "runtime" : "system", rc);
 
+   if (!rc)
+   wil->suspend_stats.suspend_start_time = ktime_get();
+
return rc;
 }
 
@@ -309,6 +312,7 @@ int wil_resume(struct wil6210_priv *wil, bool is_runtime)
struct net_device *ndev = wil_to_ndev(wil);
bool keep_radio_on = ndev->flags & IFF_UP &&
 wil->keep_radio_on_during_sleep;
+   unsigned long long suspend_time_usec = 0;
 
wil_dbg_pm(wil, "resume: %s\n", is_runtime ? "runtime" : "system");
 
@@ -326,8 +330,20 @@ int wil_resume(struct wil6210_priv *wil, bool is_runtime)
else
rc = wil_resume_radio_off(wil);
 
+   if (rc)
+   goto out;
+
+   suspend_time_usec =
+   ktime_to_us(ktime_sub(ktime_get(),
+ wil->suspend_stats.suspend_start_time));
+   wil->suspend_stats.total_suspend_time += suspend_time_usec;
+   if (suspend_time_usec < wil->suspend_stats.min_suspend_time)
+   wil->suspend_stats.min_suspend_time = suspend_time_usec;
+   if (suspend_time_usec > wil->suspend_stats.max_suspend_time)
+   wil->suspend_stats.max_suspend_time = suspend_time_usec;
+
 out:
- 

[PATCH v3 4/9] wil6210: check no_fw_recovery in resume failure recovery

2017-08-03 Thread Maya Erez
Reset 11ad device on resume failure only if no_fw_recovery
is not set.

Signed-off-by: Maya Erez 
---
 drivers/net/wireless/ath/wil6210/pm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wil6210/pm.c 
b/drivers/net/wireless/ath/wil6210/pm.c
index ce1f384..4548829 100644
--- a/drivers/net/wireless/ath/wil6210/pm.c
+++ b/drivers/net/wireless/ath/wil6210/pm.c
@@ -85,7 +85,9 @@ static int wil_resume_keep_radio_on(struct wil6210_priv *wil)
/* Send WMI resume request to the device */
rc = wmi_resume(wil);
if (rc) {
-   wil_err(wil, "device failed to resume (%d), resetting\n", rc);
+   wil_err(wil, "device failed to resume (%d)\n", rc);
+   if (no_fw_recovery)
+   goto out;
rc = wil_down(wil);
if (rc) {
wil_err(wil, "wil_down failed (%d)\n", rc);
-- 
1.9.1



Re: [linuxwifi] x86/thermal: AB-BA dependency between mvm->mutex and tz->lock

2017-08-03 Thread Jiri Kosina
On Thu, 3 Aug 2017, Jiri Kosina wrote:

> > I see the workqueue allocation you mentioned.  I'll try to move this 
> > allocation out of the mutex and see how it goes.
> 
> I have been briefly looking into this as well -- it'll basically have to 
> be moved out of the trans_pcie->mutex context, but
> 
> (a) I'm not sure whether that's actually safe
> (b) iwl_pcie_rx_reuse_rbd() (which is where corresponding work is being 
> queued) is not a proper context either (it's atomic context)

Actually moving it out of trans_pcie->mutex is likely not to be enough, 
the dependency would still be there, just the graph will have one vertex 
less, with the dependency going directly from mvm mutex to 
cpu_hotplug_lock.

-- 
Jiri Kosina
SUSE Labs



Re: wcn36xx: check dma_mapping_error()

2017-08-03 Thread Kalle Valo
Rob Clark  wrote:

> Fixes splat:
> 
>   wcn36xx a204000.wcnss:smd-edge:wcnss:wifi: DMA-API: device driver failed to 
> check map error[device address=0xb45ba000] [size=3872 bytes] [mapped 
> as single]
>   [ cut here ]
>   WARNING: CPU: 0 PID: 0 at ../lib/dma-debug.c:1167 check_unmap+0x474/0x8d0
>   Modules linked in: bnep(E) arc4(E) wcn36xx(E) mac80211(E) btqcomsmd(E) 
> btqca(E) bluetooth(E) cfg80211(E) ecdh_generic(E) rfkill(E) vfat(E) fat(E) 
> wcnss_ctrl qcom_wcnss_pil(E) mdt_loader(E) qcom_common(E) remoteproc(E) 
> crc32_ce(E) virtio_ring(E) snd_soc_lpass_apq8016(E) snd_soc_lpass_cpu(E) 
> virtio(E) snd_soc_lpass_platform(E) leds_gpio(E) snd_soc_hdmi_codec(E) 
> snd_soc_apq8016_sbc(E) snd_soc_msm8916_digital(E) snd_soc_core(E) 
> qcom_spmi_temp_alarm(E) ac97_bus(E) snd_pcm_dmaengine(E) snd_seq(E) 
> snd_seq_device(E) snd_pcm(E) spi_qup(E) nvmem_qfprom(E) snd_timer(E) snd(E) 
> soundcore(E) msm_rng(E) qcom_tsens(E) nvmem_core(E) uas(E) usb_storage(E) 
> dm9601(E) cdc_ether(E) usbnet(E) mii(E) mmc_block(E) sdhci_msm(E) 
> sdhci_pltfm(E) qcom_spmi_vadc(E) qcom_vadc_common(PE) clk_smd_rpm(E) 
> industrialio(E)
>qcom_smd_regulator(E) pinctrl_spmi_mpp(E) pinctrl_spmi_gpio(E) 
> rtc_pm8xxx(E) adv7511(E) smd_rpm(E) qcom_spmi_pmic(E) regmap_spmi(E) 
> phy_msm_usb(E) usb3503(E) extcon_usb_gpio(E) ci_hdrc_msm(E) ci_hdrc(E) 
> qcom_hwspinlock(E) udc_core(E) extcon_core(E) ehci_msm(E) i2c_qup(E) sdhci(E) 
> msm(E) mmc_core(E) drm_kms_helper(E) syscopyarea(E) sysfillrect(E) 
> sysimgblt(E) fb_sys_fops(E) spmi_pmic_arb(E) drm(E) spmi(E) qcom_smd(E) 
> rpmsg_core smsm(E) gpio_keys(E) smp2p(E) smem(E) hwspinlock_core(E) sunrpc(E) 
> scsi_transport_iscsi(E)
>   CPU: 0 PID: 0 Comm: swapper/0 Tainted: PE   4.12.0-rc7+ #1476
>   Hardware name: qualcomm dragonboard410c/dragonboard410c, BIOS 
> 2017.07-rc1-00234-g22fa70a-dirty 06/26/2017
>   task: 09049780 task.stack: 0903
>   PC is at check_unmap+0x474/0x8d0
>   LR is at check_unmap+0x474/0x8d0
>   ...
>   Mapped at:
>dma_entry_alloc+0x68/0xa8
>debug_dma_map_page+0x94/0x148
>wcn36xx_dxe_fill_skb.isra.1+0xbc/0xf8 [wcn36xx]
>wcn36xx_dxe_init+0x244/0x398 [wcn36xx]
>wcn36xx_start+0xf4/0x298 [wcn36xx]
> 
> Signed-off-by: Rob Clark 
> Signed-off-by: Kalle Valo 

Patch applied to ath-next branch of ath.git, thanks.

4165cf7ba52a wcn36xx: check dma_mapping_error()

-- 
https://patchwork.kernel.org/patch/9823509/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: ath9k: Add Dell Wireless 1802 with wowlan capability

2017-08-03 Thread Kalle Valo
Rosen Penev  wrote:

> Add the Dell Wireless 1802 card as an AR9462 in the ath9k pci list.
> Note that the wowlan feature is supported and has been tested
> successfully.
> 
> Signed-off by: Rosen Penev 
> Signed-off-by: Kalle Valo 

Patch applied to ath-next branch of ath.git, thanks.

129e12a9eb42 ath9k: Add Dell Wireless 1802 with wowlan capability

-- 
https://patchwork.kernel.org/patch/9839787/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: ath9k: fix debugfs file permission

2017-08-03 Thread Kalle Valo
Christoph Fritz  wrote:

> This patch fixes a trivial debugfs file permission issue. Debugfs
> file ack_to has no write function, so S_IWUSR gets purged.
> 
> Signed-off-by: Christoph Fritz 
> Signed-off-by: Kalle Valo 

Patch applied to ath-next branch of ath.git, thanks.

f085c105479f ath9k: fix debugfs file permission

-- 
https://patchwork.kernel.org/patch/9836539/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [049/102] ath10k: explicitly request exclusive reset control

2017-08-03 Thread Kalle Valo
Philipp Zabel  wrote:

> Commit a53e35db70d1 ("reset: Ensure drivers are explicit when requesting
> reset lines") started to transition the reset control request API calls
> to explicitly state whether the driver needs exclusive or shared reset
> control behavior. Convert all drivers requesting exclusive resets to the
> explicit API call so the temporary transition helpers can be removed.
> 
> No functional changes.
> 
> Cc: Kalle Valo 
> Cc: ath...@lists.infradead.org
> Cc: linux-wireless@vger.kernel.org
> Cc: net...@vger.kernel.org
> Signed-off-by: Philipp Zabel 
> Signed-off-by: Kalle Valo 

Patch applied to ath-next branch of ath.git, thanks.

a764284f34f9 ath10k: explicitly request exclusive reset control

-- 
https://patchwork.kernel.org/patch/9852575/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [PATCHv2, 1/3] ath10k: extend wmi service map to accommodate new services

2017-08-03 Thread Kalle Valo
mpubb...@qti.qualcomm.com wrote:

> Though there is room to accommodate 512 services in wmi service
> ready event, target uses only first 4-bits of each 32-bit word for
> advertising wmi services thereby limiting max wmi services to 64.
> 
> TDLS implementation for 10.4 firmwares introduces new wmi services by
> making use of remaining unused bits of each 32-bit word, therefore the
> wmi service mapping in host needs to be extended.
> 
> This patch adds the logic to extend the wmi SVCMAP to accommodate new
> wmi services.
> 
> Signed-off-by: Manikanta Pubbisetty 
> Signed-off-by: Kalle Valo 

3 patches applied to ath-next branch of ath.git, thanks.

810fe818d6a1 ath10k: extend wmi service map to accommodate new services
add6cd8d5ab7 ath10k: add tdls support for 10.4 firmwares
be5b4f4002a6 ath10k: push peer type to target for TDLS peers

-- 
https://patchwork.kernel.org/patch/9848157/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: ath10k: sdio: fix compile warning

2017-08-03 Thread Kalle Valo
Erik Stromdahl  wrote:

> As suggested by Arnd Bergmann, replace
> "while (time_before_...) {}"
> with
> "do {} while (time_before_...)"
> 
> This fixes the following warnings detected by gcc 4.1.2:
> 
> drivers/net/wireless/ath/ath10k/sdio.c: In function
> ‘ath10k_sdio_mbox_rxmsg_pending_handler’:
> drivers/net/wireless/ath/ath10k/sdio.c:676: warning: ‘ret’ may be used 
> uninitialized in this function
> 
> ...
> 
> drivers/net/wireless/ath/ath10k/sdio.c: In function
> ‘ath10k_sdio_irq_handler’:
> drivers/net/wireless/ath/ath10k/sdio.c:1331: warning: ‘ret’ may be used 
> uninitialized in this function
> 
> Signed-off-by: Erik Stromdahl 
> Signed-off-by: Kalle Valo 

Patch applied to ath-next branch of ath.git, thanks.

433ef1b22678 ath10k: sdio: fix compile warning

-- 
https://patchwork.kernel.org/patch/9831499/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [linuxwifi] x86/thermal: AB-BA dependency between mvm->mutex and tz->lock

2017-08-03 Thread Jiri Kosina
On Thu, 3 Aug 2017, Coelho, Luciano wrote:

> Okay, so as I understand it the problem has been there for a long time,
> but the splat is only coming up now because of Thomas' patch that adds
> the lockdep map[1], right?

Yeah, sorry, forgot to mention that pre-49dfe2a67797 kernels wouldn't 
produce this, as there would not be aware of the fact that 
cpus_read_lock() is actually semantically a lock.

> I see the workqueue allocation you mentioned.  I'll try to move this 
> allocation out of the mutex and see how it goes.

I have been briefly looking into this as well -- it'll basically have to 
be moved out of the trans_pcie->mutex context, but

(a) I'm not sure whether that's actually safe
(b) iwl_pcie_rx_reuse_rbd() (which is where corresponding work is being 
queued) is not a proper context either (it's atomic context)

Thanks,

-- 
Jiri Kosina
SUSE Labs



Re: [v3,1/2] ath10k: various usb related definitions

2017-08-03 Thread Kalle Valo
Kalle Valo  wrote:

> Definitions for USB based chipsets
> 
> Signed-off-by: Erik Stromdahl 
> Signed-off-by: Kalle Valo 

2 patches applied to ath-next branch of ath.git, thanks.

b00435e6cda6 ath10k: various usb related definitions
4db66499df91 ath10k: add initial USB support

-- 
https://patchwork.kernel.org/patch/9828093/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [linuxwifi] x86/thermal: AB-BA dependency between mvm->mutex and tz->lock

2017-08-03 Thread Coelho, Luciano
On Thu, 2017-08-03 at 13:02 +0300, Kalle Valo wrote:
> "Coelho, Luciano"  writes:
> 
> > On Thu, 2017-08-03 at 11:10 +0200, Jiri Kosina wrote:
> > > On Mon, 31 Jul 2017, Jiri Kosina wrote:
> > > 
> > > > Hi,
> > > > 
> > > > booting current Linus' tree, I'm seeing lockdep splat (see the end of 
> > > > this 
> > > > mail).
> > > > 
> > > > Apparently, there is AB-BA between tz->lock and mvm->mutex through the 
> > > > CPU 
> > > > hotplug lock.
> > > > 
> > > > The obivous depency is: thermal_zone_get_temp() acquires tz->lock, and 
> > > > then calls iwl_mvm_tzone_get_temp() (through tz->ops->get_temp() 
> > > > callback), which acquires mvm->mutex
> > > > 
> > > > The less obvious dependency is primarily caused by 
> > > > iwl_op_mode_mvm_start() 
> > > > allocating workqueue (#2 stacktrace) while holding mvm->mutex (which is 
> > > > broken, because that mutex is being taken also from CPU hotplug 
> > > > callback 
> > > > path, hence the AB-BA).
> > > 
> > > As the "central" part of the dependency is being added by iwlwifi driver 
> > > (_iwl_pcie_rx_init() allocating workqueue while holding 
> > > trans_pcie->mutex), I'm adding iwlwifi folks as well to CC.

[...]

> > > >  -> #2 (cpu_hotplug_lock.rw_sem){++}:
> > > > lock_acquire+0xbd/0x220
> > > > cpus_read_lock+0x46/0x90
> > > > apply_workqueue_attrs+0x17/0x50
> > > > __alloc_workqueue_key+0x195/0x4d0
> > > > _iwl_pcie_rx_init+0x384/0x390 [iwlwifi]
> > > > iwl_pcie_rx_init+0x1e/0x380 [iwlwifi]
> > > > iwl_trans_pcie_start_fw+0x295/0x6f0 [iwlwifi]
> > > > iwl_mvm_load_ucode_wait_alive+0xe7/0x390 [iwlmvm]
> > > > iwl_run_init_mvm_ucode+0x84/0x320 [iwlmvm]
> > > > iwl_op_mode_mvm_start+0x964/0xd30 [iwlmvm]
> > > > _iwl_op_mode_start.isra.9+0x47/0xa0 [iwlwifi]
> > > > iwl_opmode_register+0xaa/0xd0 [iwlwifi]
> > > > iwl_mvm_init+0x37/0x1000 [iwlmvm]
> > > > do_one_initcall+0x51/0x1a9
> > > > do_init_module+0x60/0x20e
> > > > load_module+0x203f/0x2b50
> > > > SYSC_finit_module+0x96/0xd0
> > > > SyS_finit_module+0xe/0x10
> > > > entry_SYSCALL_64_fastpath+0x23/0xc2

Okay, so as I understand it the problem has been there for a long time,
but the splat is only coming up now because of Thomas' patch that adds
the lockdep map[1], right?

I see the workqueue allocation you mentioned.  I'll try to move this
allocation out of the mutex and see how it goes.

[1] http://lkml.kernel.org/r/20170524081549.709375...@linutronix.de

--
Cheers,
Luca.

Re: ath10k: set a-mpdu reference number in ath10k (receiver)

2017-08-03 Thread Kalle Valo
Matthias Frei  wrote:

> Set the a-mpdu reference number in ath10k to make it accessible in the
> receivers radiotap header. Implemented as in ath9k.  The reference number is
> needed for troubleshooting and research at the receivers site (e.g. to 
> identify
> mpdu's that were aggregated in an a-mpdu)
> 
> Signed-off-by: Matthias Frei 
> [kv...@qca.qualcomm.com: fix checkpatch warning, commit log cleanup]
> Signed-off-by: Kalle Valo 

Patch applied to ath-next branch of ath.git, thanks.

47cc0ca91c9e ath10k: set a-mpdu receiver reference number

-- 
https://patchwork.kernel.org/patch/9826931/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [PATCH v5] rtlwifi: Replace hardcode value with macro

2017-08-03 Thread Souptick Joarder
On Thu, Aug 3, 2017 at 3:48 PM, Kalle Valo  wrote:
> Larry Finger  writes:
>
>> On 08/02/2017 07:29 AM, Souptick Joarder wrote:
>>> In _rtl_init_mac80211(), hardcoded value for hw->max_listen_interval
>>> and hw->max_rate_tries are replaced by macro and removed the comment.
>>>
>>> Signed-off-by: Souptick Joarder 
>>
>> Finally!
>>
>> Acked-by: Larry Finger 
>>
>> @Kalle: I'm sure you can work around this, but patchwork shows two
>> different "v5" versions and a "v4" entry for this same patch. That may
>> be due to no one formally rejecting the patch.
>
> It's because Souptick submitted two v5 patches, but yeah I can that sort
> it out.
>
> Souptick, the idea with patch versions is that maintainers and reviewers
> can easily find the latest version and drop the rest so ALWAYS increase
> the version number. Submitting duplicate version numbers defeats the
> purpose and creates extra work for others.

Noted. Thanks for the feedback.

>
> --
> Kalle Valo


RE: [PATCH] mwifiex: add module parameter to disable 40MHZ support in 2.4G band

2017-08-03 Thread Xinming Hu
Hi Arend/Kalle,

> -Original Message-
> From: Kalle Valo [mailto:kv...@codeaurora.org]
> Sent: 2017年8月3日 18:00
> To: Arend van Spriel
> Cc: Xinming Hu; Linux Wireless; Brian Norris; Dmitry Torokhov;
> raja...@google.com; Zhiyuan Yang; Tim Song; Cathy Luo; Ganapathi Bhat;
> Xinming Hu
> Subject: Re: [PATCH] mwifiex: add module parameter to disable 40MHZ
> support in 2.4G band
> 
> Arend van Spriel  writes:
> 
> > On 03-08-17 11:26, Kalle Valo wrote:
> >> Xinming Hu  writes:
> >>
> >>> From: Xinming Hu 
> >>>
> >>> This patch provide a new module parameter disable_2g4_40m, with
> >>> which driver will not report 40M capability for 2.4GHZ to cfg80211.
> >>>
> >>> Signed-off-by: Xinming Hu 
> >>> Signed-off-by: Cathy Luo 
> >>> Signed-off-by: Ganapathi Bhat 
> >>> ---
> >>>  drivers/net/wireless/marvell/mwifiex/cfg80211.c | 22
> >>> ++
> >>>  1 file changed, 14 insertions(+), 8 deletions(-)
> >>>
> >>> diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> >>> b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> >>> index 2be7817..820475a 100644
> >>> --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> >>> +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> >>> @@ -25,6 +25,10 @@
> >>>  static char *reg_alpha2;
> >>>  module_param(reg_alpha2, charp, 0);
> >>>
> >>> +static bool disable_2g4_40m;
> >>> +module_param(disable_2g4_40m, bool, );
> >>
> >> This is bool, good.
> >>
> >>> +MODULE_PARM_DESC(disable_2g4_40m, "2.4G 40M support disable:1,
> >>> +enable:0");
> >>
> >> This is not really a readable description for someone not familiar
> >> with Wi-Fi, maybe this instead:
> >>
> >> "disable 40 Mhz channels on 2.4 GHz band (disable:1, enable:0)"
> >>
> >>> @@ -2755,7 +2759,7 @@ static void mwifiex_setup_vht_caps(struct
> ieee80211_sta_vht_cap *vht_info,
> >>>   */
> >>>  static void
> >>>  mwifiex_setup_ht_caps(struct ieee80211_sta_ht_cap *ht_info,
> >>> -   struct mwifiex_private *priv)
> >>> +   struct mwifiex_private *priv, int disable_40m)
> >>
> >> But here you use int, that's a bit strange. Why not bool?
> >
> > Here is what is in net/wireless/core.c:
> >
> > static bool cfg80211_disable_40mhz_24ghz;
> > module_param(cfg80211_disable_40mhz_24ghz, bool, 0644);
> > MODULE_PARM_DESC(cfg80211_disable_40mhz_24ghz,
> >  "Disable 40MHz support in the 2.4GHz band");
> >
> > which seems exactly the same thing and ends up doing:
> >
> > /*
> >  * Since cfg80211_disable_40mhz_24ghz is global, we
> can
> >  * modify the sband's ht data even if the driver uses a
> >  * global structure for that.
> >  */
> > if (cfg80211_disable_40mhz_24ghz &&
> > band == NL80211_BAND_2GHZ &&
> > sband->ht_cap.ht_supported) {
> > sband->ht_cap.cap &=
> > ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
> > sband->ht_cap.cap &=
> ~IEEE80211_HT_CAP_SGI_40;
> > }
> 
> Good catch! So the module parameter for the driver is not needed, right?

Great, that is what we want! Thanks for the point.

> 
> --
> Kalle Valo


Re: [v5] rtlwifi: Replace hardcode value with macro

2017-08-03 Thread Kalle Valo
Souptick Joarder  wrote:

> In _rtl_init_mac80211(), hardcoded value for hw->max_listen_interval
> and hw->max_rate_tries are replaced by macro and removed the comment.
> 
> Signed-off-by: Souptick Joarder 
> Acked-by: Larry Finger 

Patch applied to wireless-drivers-next.git, thanks.

9d546198705a rtlwifi: Replace hardcode value with macro

-- 
https://patchwork.kernel.org/patch/9876703/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [PATCH v5] rtlwifi: Replace hardcode value with macro

2017-08-03 Thread Kalle Valo
Larry Finger  writes:

> On 08/02/2017 07:29 AM, Souptick Joarder wrote:
>> In _rtl_init_mac80211(), hardcoded value for hw->max_listen_interval
>> and hw->max_rate_tries are replaced by macro and removed the comment.
>>
>> Signed-off-by: Souptick Joarder 
>
> Finally!
>
> Acked-by: Larry Finger 
>
> @Kalle: I'm sure you can work around this, but patchwork shows two
> different "v5" versions and a "v4" entry for this same patch. That may
> be due to no one formally rejecting the patch.

It's because Souptick submitted two v5 patches, but yeah I can that sort
it out.

Souptick, the idea with patch versions is that maintainers and reviewers
can easily find the latest version and drop the rest so ALWAYS increase
the version number. Submitting duplicate version numbers defeats the
purpose and creates extra work for others.

-- 
Kalle Valo


Re: [v2,1/2] mwifiex: make addba request command clean

2017-08-03 Thread Kalle Valo
Xinming Hu  wrote:

> From: Xinming Hu 
> 
> uninitilized variable, such as .add_req_result might be magic stack
> value. Initialize the structure to make it clean.
> 
> Signed-off-by: Xinming Hu 
> Signed-off-by: Cathy Luo 

2 patches applied to wireless-drivers-next.git, thanks.

e37f6483dc28 mwifiex: make addba request command clean
e7ece050113d mwifiex: pcie: compatible with wifi-only image while extract 
wifi-part fw

-- 
https://patchwork.kernel.org/patch/9873551/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [10/11] net: qtnfmac: constify pci_device_id.

2017-08-03 Thread Kalle Valo
Arvind Yadav  wrote:

> pci_device_id are not supposed to change at runtime. All functions
> working with pci_device_id provided by  work with
> const pci_device_id. So mark the non-const structs as const.
> 
> Signed-off-by: Arvind Yadav 
> Reviewed-by: Sergey Matyukevich 

Patch applied to wireless-drivers-next.git, thanks.

cc5becd38e87 net: qtnfmac: constify pci_device_id.

-- 
https://patchwork.kernel.org/patch/9845911/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: qtfnmac: Tidy up DMA mask setting

2017-08-03 Thread Kalle Valo
Robin Murphy  wrote:

> As the only caller of dma_supported() outside of DMA API internals, the
> qtfnmac driver stands out and invites scrutiny. Thankfully, it's not
> being used for evil, but it is entirely redundant, since it open-codes a
> check that the DMA mask setting functions are going to perform anyway.
> In fact, the whole qtnf_pcie_init_dma_mask() function is nothing more
> than a rather long-winded implementation of dma_set_mask_and_coherent(),
> so let's just use that directly.
> 
> Signed-off-by: Robin Murphy 
> Acked-by: Sergey Matyukevich 

There's a typo in title prefix, I'll fix it to "qtnfmac:".

-- 
https://patchwork.kernel.org/patch/9859961/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [net] hostap: Fix outdated comment about dev->destructor

2017-08-03 Thread Kalle Valo
Stefano Brivio  wrote:

> After commit cf124db566e6 ("net: Fix inconsistent teardown and
> release of private netdev state."), setting
> 'dev->needs_free_netdev' ensures device data is released, and
> 'dev->destructor' is not used anymore.
> 
> Fixes: cf124db566e6 ("net: Fix inconsistent teardown and release of private 
> netdev state.")
> Signed-off-by: Stefano Brivio 

Patch applied to wireless-drivers-next.git, thanks.

9ff067ff4c4a hostap: Fix outdated comment about dev->destructor

-- 
https://patchwork.kernel.org/patch/983/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [01/11] rtlwifi: rtl8192de: constify pci_device_id.

2017-08-03 Thread Kalle Valo
Arvind Yadav  wrote:

> pci_device_id are not supposed to change at runtime. All functions
> working with pci_device_id provided by  work with
> const pci_device_id. So mark the non-const structs as const.
> 
> File size before:
>text  data bss dec hex filename
>2833   945  123790 ece realtek/rtlwifi/rtl8192de/sw.o
> 
> File size After adding 'const':
>text  data bss dec hex filename
>2929   849  123790 ece realtek/rtlwifi/rtl8192de/sw.o
> 
> Signed-off-by: Arvind Yadav 
> Acked-by: Larry Finger 

7 patches applied to wireless-drivers-next.git, thanks.

d86d8dbdebcc rtlwifi: rtl8192de: constify pci_device_id.
67f512e6707f rtlwifi: rtl8192se: constify pci_device_id.
468952f14714 rtlwifi: rtl8821ae: constify pci_device_id.
e9a214def6ce rtlwifi: rtl8723ae: constify pci_device_id.
8c6f0f5bf1e1 rtlwifi: rtl8723be: constify pci_device_id.
4dc2efc132a7 rtlwifi: rtl8188ee: constify pci_device_id.
d20d893d7a74 rtlwifi: rtl8192ee: constify pci_device_id.

-- 
https://patchwork.kernel.org/patch/9845899/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [PATCH v2 3/3] brcmfmac: fix wrong num_different_channels when mchan feature enabled

2017-08-03 Thread Kalle Valo
Wright Feng  writes:

> brcmfmac: fix wrong num_different_channels when mchan feature enabled

Here also the title is duplicated, but I'll fix that.

> When the device/firmware supports multi-channel, it can have P2P
> connection and regular connection with AP simultaneous. In this case,
> the num_different_channels in wiphy info was not correct when firmware
> supports multi-channel (The iw wiphy# info showed "#channels <= 1" in 
> interface combinations). It caused association failed and error message
> "CTRL-EVENT-FREQ-CONFLICT error" in wpa_supplicant when P2P GO interface
> was running at the same time.
> The root cause is that the num_different_channels was always overridden
> to 1 in brcmf_setup_ifmodes even multi-channel was enabled.
> We correct the logic by moving num_different_channels setting forward.
>
> Signed-off-by: Wright Feng 
> ---
> v2: Describe the motivation and reason for this patch in commit message

Perfect, thanks.

-- 
Kalle Valo


Re: [PATCH v2 1/3] brcmfmac: set wpa_auth to WPA_AUTH_DISABLED in AP/OPEN security mode

2017-08-03 Thread Kalle Valo
Wright Feng  writes:

> brcmfmac: set wpa_auth to WPA_AUTH_DISABLED in AP/OPEN security mode
>
> When setting wpa_auth to WPA_AUTH_NONE(1) in AP mode with WEP security,
> firmware will set privacy bit and add WPA OUI in VENDOR IE in beacon and
> probe response. The security type in softAP beacons confuse the
> supplicant in client side, and the user client will see [WPA-?] in
> supplicant scan result. So we set WPA_AUTH_DISABLED in softAP mode with 
> OPEN security.

The title is now duplicated, it's now in Subject and in the body, but I
can fix that.

-- 
Kalle Valo


Re: [linuxwifi] x86/thermal: AB-BA dependency between mvm->mutex and tz->lock

2017-08-03 Thread Kalle Valo
"Coelho, Luciano"  writes:

> On Thu, 2017-08-03 at 11:10 +0200, Jiri Kosina wrote:
>> On Mon, 31 Jul 2017, Jiri Kosina wrote:
>> 
>> > Hi,
>> > 
>> > booting current Linus' tree, I'm seeing lockdep splat (see the end of this 
>> > mail).
>> > 
>> > Apparently, there is AB-BA between tz->lock and mvm->mutex through the CPU 
>> > hotplug lock.
>> > 
>> > The obivous depency is: thermal_zone_get_temp() acquires tz->lock, and 
>> > then calls iwl_mvm_tzone_get_temp() (through tz->ops->get_temp() 
>> > callback), which acquires mvm->mutex
>> > 
>> > The less obvious dependency is primarily caused by iwl_op_mode_mvm_start() 
>> > allocating workqueue (#2 stacktrace) while holding mvm->mutex (which is 
>> > broken, because that mutex is being taken also from CPU hotplug callback 
>> > path, hence the AB-BA).
>> 
>> As the "central" part of the dependency is being added by iwlwifi driver 
>> (_iwl_pcie_rx_init() allocating workqueue while holding 
>> trans_pcie->mutex), I'm adding iwlwifi folks as well to CC.
>> 
>> > 
>> >  ==
>> >  WARNING: possible circular locking dependency detected
>> >  4.13.0-rc2-00110-g0b5477d #347 Not tainted
>> >  --
>> >  modprobe/881 is trying to acquire lock:
>> >   (>mutex){+.+.+.}, at: [] 
>> > iwl_mvm_tzone_get_temp+0x32/0x80 [iwlmvm]
>> >  
>> >  but task is already holding lock:
>> >   (>lock){+.+.+.}, at: [] 
>> > thermal_zone_get_temp+0x41/0x70
>> >  
>> >  which lock already depends on the new lock.
>> > 
>> >  
>> >  the existing dependency chain (in reverse order) is:
>> >  
>> >  -> #5 (>lock){+.+.+.}:
>> > lock_acquire+0xbd/0x220
>> > __mutex_lock+0x6e/0x900
>> > mutex_lock_nested+0x1b/0x20
>> > thermal_zone_get_temp+0x41/0x70
>> > thermal_zone_device_update+0x3c/0x280
>> > thermal_zone_device_register+0x3b8/0x610
>> > pkg_thermal_cpu_online+0x20b/0x284 [x86_pkg_temp_thermal]
>> > cpuhp_invoke_callback+0xac/0x900
>> > cpuhp_thread_fun+0x79/0x160
>> > smpboot_thread_fn+0x156/0x220
>> > kthread+0x114/0x150
>> > ret_from_fork+0x2a/0x40
>> >  
>> >  -> #4 (cpuhp_state){+.+.+.}:
>> > lock_acquire+0xbd/0x220
>> > cpuhp_issue_call+0xea/0x170
>> > __cpuhp_setup_state_cpuslocked+0x12a/0x190
>> > __cpuhp_setup_state+0x46/0xc0
>> > page_writeback_init+0x43/0x67
>> > pagecache_init+0x39/0x3c
>> > start_kernel+0x45a/0x4ae
>> > x86_64_start_reservations+0x24/0x26
>> > x86_64_start_kernel+0x13d/0x14c
>> > verify_cpu+0x0/0xf1
>> >  
>> >  -> #3 (cpuhp_state_mutex){+.+.+.}:
>> > lock_acquire+0xbd/0x220
>> > __mutex_lock+0x6e/0x900
>> > mutex_lock_nested+0x1b/0x20
>> > __cpuhp_setup_state_cpuslocked+0x4f/0x190
>> > __cpuhp_setup_state+0x46/0xc0
>> > page_alloc_init+0x28/0x30
>> > start_kernel+0x186/0x4ae
>> > x86_64_start_reservations+0x24/0x26
>> > x86_64_start_kernel+0x13d/0x14c
>> > verify_cpu+0x0/0xf1
>> >  
>> >  -> #2 (cpu_hotplug_lock.rw_sem){++}:
>> > lock_acquire+0xbd/0x220
>> > cpus_read_lock+0x46/0x90
>> > apply_workqueue_attrs+0x17/0x50
>> > __alloc_workqueue_key+0x195/0x4d0
>> > _iwl_pcie_rx_init+0x384/0x390 [iwlwifi]
>> > iwl_pcie_rx_init+0x1e/0x380 [iwlwifi]
>> > iwl_trans_pcie_start_fw+0x295/0x6f0 [iwlwifi]
>> > iwl_mvm_load_ucode_wait_alive+0xe7/0x390 [iwlmvm]
>> > iwl_run_init_mvm_ucode+0x84/0x320 [iwlmvm]
>> > iwl_op_mode_mvm_start+0x964/0xd30 [iwlmvm]
>> > _iwl_op_mode_start.isra.9+0x47/0xa0 [iwlwifi]
>> > iwl_opmode_register+0xaa/0xd0 [iwlwifi]
>> > iwl_mvm_init+0x37/0x1000 [iwlmvm]
>> > do_one_initcall+0x51/0x1a9
>> > do_init_module+0x60/0x20e
>> > load_module+0x203f/0x2b50
>> > SYSC_finit_module+0x96/0xd0
>> > SyS_finit_module+0xe/0x10
>> > entry_SYSCALL_64_fastpath+0x23/0xc2
>> >  
>> >  -> #1 (_pcie->mutex){+.+.+.}:
>> > lock_acquire+0xbd/0x220
>> > __mutex_lock+0x6e/0x900
>> > mutex_lock_nested+0x1b/0x20
>> > iwl_trans_pcie_start_fw+0x130/0x6f0 [iwlwifi]
>> > iwl_mvm_load_ucode_wait_alive+0xe7/0x390 [iwlmvm]
>> > iwl_run_init_mvm_ucode+0x84/0x320 [iwlmvm]
>> > iwl_op_mode_mvm_start+0x964/0xd30 [iwlmvm]
>> > _iwl_op_mode_start.isra.9+0x47/0xa0 [iwlwifi]
>> > iwl_opmode_register+0xaa/0xd0 [iwlwifi]
>> > iwl_mvm_init+0x37/0x1000 [iwlmvm]
>> > do_one_initcall+0x51/0x1a9
>> > do_init_module+0x60/0x20e
>> > load_module+0x203f/0x2b50
>> > SYSC_finit_module+0x96/0xd0
>> > SyS_finit_module+0xe/0x10
>> > entry_SYSCALL_64_fastpath+0x23/0xc2
>> >  
>> >  -> #0 (>mutex){+.+.+.}:
>> > 

Re: qtnfmac: Tidy up DMA mask setting

2017-08-03 Thread Kalle Valo
Robin Murphy  wrote:

> As the only caller of dma_supported() outside of DMA API internals, the
> qtfnmac driver stands out and invites scrutiny. Thankfully, it's not
> being used for evil, but it is entirely redundant, since it open-codes a
> check that the DMA mask setting functions are going to perform anyway.
> In fact, the whole qtnf_pcie_init_dma_mask() function is nothing more
> than a rather long-winded implementation of dma_set_mask_and_coherent(),
> so let's just use that directly.
> 
> Signed-off-by: Robin Murphy 
> Acked-by: Sergey Matyukevich 

Patch applied to wireless-drivers-next.git, thanks.

13cb8a5845ff qtnfmac: Tidy up DMA mask setting

-- 
https://patchwork.kernel.org/patch/9859961/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [v2,01/12] qtnfmac: updates for regulatory support

2017-08-03 Thread Kalle Valo
Sergey Matyukevich  wrote:

> On startup driver obtains regulatory rules from firmware and
> enables them during wiphy registration. Later on regulatory
> domain change can be requested by host. In this case firmware
> is notified about the upcoming changes. If the change is valid,
> then firmware updates hardware channel configuration and host
> driver receives updated channel info for each band.
> 
> Signed-off-by: Igor Mitsyanko 
> Signed-off-by: Sergey Matyukevich 
> Signed-off-by: Avinash Patil 

12 patches applied to wireless-drivers-next.git, thanks.

4dd07d2b58d5 qtnfmac: updates for regulatory support
ea19479f6849 qtnfmac: regulatory configuration for self-managed setup
9ef7509505c8 qtnfmac: add missing bus lock
7c04b43984a5 qtnfmac: implement cfg80211 dump_survey handler
278944482b29 qtnfmac: implement reporting current channel
fd19ecebe03e qtnfmac: fix station leave reason endianness
34f1145b2c5e qtnfmac: move current channel info from vif to mac
97883695d596 qtnfmac: implement cfg80211 channel_switch handler
c7ead2abd26a qtnfmac: implement scan timeout
41c8fa0c6274 qtnfmac: fix handling of iftype mask reported by firmware
03ddf59d786d qtnfmac: remove function qtnf_cmd_skb_put_action
805b28c05c8e qtnfmac: prepare for AP_VLAN interface type support

-- 
https://patchwork.kernel.org/patch/9867659/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [PATCH] mwifiex: add module parameter to disable 40MHZ support in 2.4G band

2017-08-03 Thread Kalle Valo
Arend van Spriel  writes:

> On 03-08-17 11:26, Kalle Valo wrote:
>> Xinming Hu  writes:
>> 
>>> From: Xinming Hu 
>>>
>>> This patch provide a new module parameter disable_2g4_40m, with
>>> which driver will not report 40M capability for 2.4GHZ to cfg80211.
>>>
>>> Signed-off-by: Xinming Hu 
>>> Signed-off-by: Cathy Luo 
>>> Signed-off-by: Ganapathi Bhat 
>>> ---
>>>  drivers/net/wireless/marvell/mwifiex/cfg80211.c | 22 ++
>>>  1 file changed, 14 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
>>> b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
>>> index 2be7817..820475a 100644
>>> --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
>>> +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
>>> @@ -25,6 +25,10 @@
>>>  static char *reg_alpha2;
>>>  module_param(reg_alpha2, charp, 0);
>>>  
>>> +static bool disable_2g4_40m;
>>> +module_param(disable_2g4_40m, bool, );
>> 
>> This is bool, good.
>> 
>>> +MODULE_PARM_DESC(disable_2g4_40m, "2.4G 40M support disable:1, enable:0");
>> 
>> This is not really a readable description for someone not familiar with
>> Wi-Fi, maybe this instead:
>> 
>> "disable 40 Mhz channels on 2.4 GHz band (disable:1, enable:0)"
>> 
>>> @@ -2755,7 +2759,7 @@ static void mwifiex_setup_vht_caps(struct 
>>> ieee80211_sta_vht_cap *vht_info,
>>>   */
>>>  static void
>>>  mwifiex_setup_ht_caps(struct ieee80211_sta_ht_cap *ht_info,
>>> - struct mwifiex_private *priv)
>>> + struct mwifiex_private *priv, int disable_40m)
>> 
>> But here you use int, that's a bit strange. Why not bool?
>
> Here is what is in net/wireless/core.c:
>
> static bool cfg80211_disable_40mhz_24ghz;
> module_param(cfg80211_disable_40mhz_24ghz, bool, 0644);
> MODULE_PARM_DESC(cfg80211_disable_40mhz_24ghz,
>  "Disable 40MHz support in the 2.4GHz band");
>
> which seems exactly the same thing and ends up doing:
>
> /*
>  * Since cfg80211_disable_40mhz_24ghz is global, we can
>  * modify the sband's ht data even if the driver uses a
>  * global structure for that.
>  */
> if (cfg80211_disable_40mhz_24ghz &&
> band == NL80211_BAND_2GHZ &&
> sband->ht_cap.ht_supported) {
> sband->ht_cap.cap &=
> ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
> sband->ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40;
> }

Good catch! So the module parameter for the driver is not needed, right?

-- 
Kalle Valo


Re: [PATCH v2 09/12] qtnfmac: implement scan timeout

2017-08-03 Thread Kalle Valo
Sergey Matyukevich  writes:

> Userspace tools may hang on scan in the case when scan completion event
> is not returned by firmware. This patch implements the scan timeout
> to avoid such situation.
>
> Signed-off-by: Igor Mitsyanko 
> Signed-off-by: Sergey Matyukevich 
> Signed-off-by: Avinash Patil 

[...]

> --- a/drivers/net/wireless/quantenna/qtnfmac/event.c
> +++ b/drivers/net/wireless/quantenna/qtnfmac/event.c
> @@ -345,6 +345,8 @@ qtnf_event_handle_scan_complete(struct qtnf_wmac *mac,
>   return -EINVAL;
>   }
>  
> + if (timer_pending(>scan_timeout))
> + del_timer_sync(>scan_timeout);

What if the device is removed while the timer is pending, is that
handled?

No need to resend because of this, a followup patch is fine. Just
started to wonder this while reviewing the patches.

-- 
Kalle Valo


Re: [PATCH] mwifiex: add module parameter to disable 40MHZ support in 2.4G band

2017-08-03 Thread Arend van Spriel
On 03-08-17 11:26, Kalle Valo wrote:
> Xinming Hu  writes:
> 
>> From: Xinming Hu 
>>
>> This patch provide a new module parameter disable_2g4_40m, with
>> which driver will not report 40M capability for 2.4GHZ to cfg80211.
>>
>> Signed-off-by: Xinming Hu 
>> Signed-off-by: Cathy Luo 
>> Signed-off-by: Ganapathi Bhat 
>> ---
>>  drivers/net/wireless/marvell/mwifiex/cfg80211.c | 22 ++
>>  1 file changed, 14 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c 
>> b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
>> index 2be7817..820475a 100644
>> --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
>> +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
>> @@ -25,6 +25,10 @@
>>  static char *reg_alpha2;
>>  module_param(reg_alpha2, charp, 0);
>>  
>> +static bool disable_2g4_40m;
>> +module_param(disable_2g4_40m, bool, );
> 
> This is bool, good.
> 
>> +MODULE_PARM_DESC(disable_2g4_40m, "2.4G 40M support disable:1, enable:0");
> 
> This is not really a readable description for someone not familiar with
> Wi-Fi, maybe this instead:
> 
> "disable 40 Mhz channels on 2.4 GHz band (disable:1, enable:0)"
> 
>> @@ -2755,7 +2759,7 @@ static void mwifiex_setup_vht_caps(struct 
>> ieee80211_sta_vht_cap *vht_info,
>>   */
>>  static void
>>  mwifiex_setup_ht_caps(struct ieee80211_sta_ht_cap *ht_info,
>> -  struct mwifiex_private *priv)
>> +  struct mwifiex_private *priv, int disable_40m)
> 
> But here you use int, that's a bit strange. Why not bool?

Here is what is in net/wireless/core.c:

static bool cfg80211_disable_40mhz_24ghz;
module_param(cfg80211_disable_40mhz_24ghz, bool, 0644);
MODULE_PARM_DESC(cfg80211_disable_40mhz_24ghz,
 "Disable 40MHz support in the 2.4GHz band");

which seems exactly the same thing and ends up doing:

/*
 * Since cfg80211_disable_40mhz_24ghz is global, we can
 * modify the sband's ht data even if the driver uses a
 * global structure for that.
 */
if (cfg80211_disable_40mhz_24ghz &&
band == NL80211_BAND_2GHZ &&
sband->ht_cap.ht_supported) {
sband->ht_cap.cap &=
~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
sband->ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40;
}

Regards,
Arend


Re: [v2] rtlwifi: Fix fallback firmware loading

2017-08-03 Thread Kalle Valo
Sven Joachim  wrote:

> Commit f70e4df2b384 ("rtlwifi: Add code to read new versions of
> firmware") added code to load an old firmware file if the new one is
> not available.  Unfortunately that code is never reached because
> request_firmware_nowait() does not wait for the firmware to show up
> and returns 0 even if the file is not there.
> 
> Use the existing fallback mechanism introduced by commit 62009b7f1279
> ("rtlwifi: rtl8192cu: Add new firmware") instead.
> 
> Fixes: f70e4df2b384 ("rtlwifi: Add code to read new versions of firmware")
> Cc: sta...@vger.kernel.org
> Signed-off-by: Sven Joachim 

Patch applied to wireless-drivers-next.git, thanks.

1d9b168d8ea9 rtlwifi: Fix fallback firmware loading

-- 
https://patchwork.kernel.org/patch/9872413/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [v2] mwifiex: correct IE parse during association

2017-08-03 Thread Kalle Valo
Xinming Hu  wrote:

> From: Xinming Hu 
> 
> It is observed that some IEs get missed during association.
> This patch correct the old IE parse code. sme->ie will be
> store as wpa ie, wps ie, wapi ie and gen ie accordingly.
> 
> Signed-off-by: Xinming Hu 
> Signed-off-by: Cathy Luo 

Patch applied to wireless-drivers-next.git, thanks.

9ddb378b237f mwifiex: correct IE parse during association

-- 
https://patchwork.kernel.org/patch/9871335/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



[PATCH v2 2/3] brcmfmac: Add support for CYW4373 SDIO/USB chipset

2017-08-03 Thread Wright Feng
From: Chi-Hsien Lin 

Add support for CYW4373 SDIO/USB chipset.
CYW4373 is a 1x1 dual-band 11ac chipset with 20/40/80Mhz channel support.
It's a WiFi/BT combo device.

Signed-off-by: Chi-Hsien Lin 
---
v2: add new chip(4737) info in commit message
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 1 +
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c   | 2 ++
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c   | 4 +++-
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c| 9 -
 drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 3 +++
 include/linux/mmc/sdio_ids.h  | 1 +
 6 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
index 9b970dc..ea47f75 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
@@ -1108,6 +1108,7 @@ static int brcmf_sdiod_probe(struct brcmf_sdio_dev 
*sdiodev)
BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43455),
BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4354),
BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4356),
+   BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_CYPRESS_4373),
{ /* end: all zeroes */ }
 };
 MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_ids);
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
index 05f22ff..c5d1a1c 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
@@ -690,6 +690,8 @@ static u32 brcmf_chip_tcm_rambase(struct brcmf_chip_priv 
*ci)
case BRCM_CC_4365_CHIP_ID:
case BRCM_CC_4366_CHIP_ID:
return 0x20;
+   case CY_CC_4373_CHIP_ID:
+   return 0x16;
default:
brcmf_err("unknown chip: %s\n", ci->pub.name);
break;
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index 5653d6d..b1789b1 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -616,6 +616,7 @@ struct sdiod_drive_str {
 BRCMF_FW_NVRAM_DEF(43455, "brcmfmac43455-sdio.bin", "brcmfmac43455-sdio.txt");
 BRCMF_FW_NVRAM_DEF(4354, "brcmfmac4354-sdio.bin", "brcmfmac4354-sdio.txt");
 BRCMF_FW_NVRAM_DEF(4356, "brcmfmac4356-sdio.bin", "brcmfmac4356-sdio.txt");
+BRCMF_FW_NVRAM_DEF(4373, "brcmfmac4373-sdio.bin", "brcmfmac4373-sdio.txt");
 
 static struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = {
BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43143_CHIP_ID, 0x, 43143),
@@ -633,7 +634,8 @@ struct sdiod_drive_str {
BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43430_CHIP_ID, 0x, 43430),
BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4345_CHIP_ID, 0xFFC0, 43455),
BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4354_CHIP_ID, 0x, 4354),
-   BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4356_CHIP_ID, 0x, 4356)
+   BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4356_CHIP_ID, 0x, 4356),
+   BRCMF_FW_NVRAM_ENTRY(CY_CC_4373_CHIP_ID, 0x, 4373)
 };
 
 static void pkt_align(struct sk_buff *p, int len, int align)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
index 0eea48e..8f20a4b 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
@@ -50,6 +50,7 @@
 BRCMF_FW_DEF(43236B, "brcmfmac43236b.bin");
 BRCMF_FW_DEF(43242A, "brcmfmac43242a.bin");
 BRCMF_FW_DEF(43569, "brcmfmac43569.bin");
+BRCMF_FW_DEF(4373, "brcmfmac4373.bin");
 
 static struct brcmf_firmware_mapping brcmf_usb_fwnames[] = {
BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0x, 43143),
@@ -58,7 +59,8 @@
BRCMF_FW_ENTRY(BRCM_CC_43238_CHIP_ID, 0x0008, 43236B),
BRCMF_FW_ENTRY(BRCM_CC_43242_CHIP_ID, 0x, 43242A),
BRCMF_FW_ENTRY(BRCM_CC_43566_CHIP_ID, 0x, 43569),
-   BRCMF_FW_ENTRY(BRCM_CC_43569_CHIP_ID, 0x, 43569)
+   BRCMF_FW_ENTRY(BRCM_CC_43569_CHIP_ID, 0x, 43569),
+   BRCMF_FW_ENTRY(CY_CC_4373_CHIP_ID, 0x, 4373)
 };
 
 #define TRX_MAGIC  0x30524448  /* "HDR0" */
@@ -1463,15 +1465,20 @@ static int brcmf_usb_reset_resume(struct usb_interface 
*intf)
 #define LINKSYS_USB_DEVICE(dev_id) \
{ USB_DEVICE(BRCM_USB_VENDOR_ID_LINKSYS, dev_id) }
 
+#define CYPRESS_USB_DEVICE(dev_id) \
+   { USB_DEVICE(CY_USB_VENDOR_ID_CYPRESS, dev_id) }
+
 static struct usb_device_id brcmf_usb_devid_table[] = {
BRCMF_USB_DEVICE(BRCM_USB_43143_DEVICE_ID),
BRCMF_USB_DEVICE(BRCM_USB_43236_DEVICE_ID),
BRCMF_USB_DEVICE(BRCM_USB_43242_DEVICE_ID),
   

[PATCH v2 3/3] brcmfmac: fix wrong num_different_channels when mchan feature enabled

2017-08-03 Thread Wright Feng
brcmfmac: fix wrong num_different_channels when mchan feature enabled

When the device/firmware supports multi-channel, it can have P2P
connection and regular connection with AP simultaneous. In this case,
the num_different_channels in wiphy info was not correct when firmware
supports multi-channel (The iw wiphy# info showed "#channels <= 1" in 
interface combinations). It caused association failed and error message
"CTRL-EVENT-FREQ-CONFLICT error" in wpa_supplicant when P2P GO interface
was running at the same time.
The root cause is that the num_different_channels was always overridden
to 1 in brcmf_setup_ifmodes even multi-channel was enabled.
We correct the logic by moving num_different_channels setting forward.

Signed-off-by: Wright Feng 
---
v2: Describe the motivation and reason for this patch in commit message
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 0281a22..0bb3b0b 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -6315,6 +6315,8 @@ static int brcmf_setup_ifmodes(struct wiphy *wiphy, 
struct brcmf_if *ifp)
if (p2p) {
if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
combo[c].num_different_channels = 2;
+   else
+   combo[c].num_different_channels = 1;
wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) |
  BIT(NL80211_IFTYPE_P2P_GO) |
  BIT(NL80211_IFTYPE_P2P_DEVICE);
@@ -6324,10 +6326,10 @@ static int brcmf_setup_ifmodes(struct wiphy *wiphy, 
struct brcmf_if *ifp)
c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
   BIT(NL80211_IFTYPE_P2P_GO);
} else {
+   combo[c].num_different_channels = 1;
c0_limits[i].max = 1;
c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
}
-   combo[c].num_different_channels = 1;
combo[c].max_interfaces = i;
combo[c].n_limits = i;
combo[c].limits = c0_limits;
-- 
1.9.1



Re: [BUG] rtlwifi: rtl_pci_probe: Fix fail path of _rtl_pci_find_adapter

2017-08-03 Thread Kalle Valo
Malcolm Priestley  wrote:

> _rtl_pci_find_adapter fail path will jump to label fail3 for
> unsupported adapter types.
> 
> However, on course for fail3 there will be call rtl_deinit_core
> before rtl_init_core.
> 
> For the inclusion of checking pci_iounmap this fail can be moved to
> fail2.
> 
> Fixes
> [4.492963] BUG: unable to handle kernel NULL pointer dereference at   
> (null)
> [4.493067] IP: rtl_deinit_core+0x31/0x90 [rtlwifi]
> 
> Signed-off-by: Malcolm Priestley 
> Cc: 

Patch applied to wireless-drivers-next.git, thanks.

fc81bab5eeb1 rtlwifi: rtl_pci_probe: Fix fail path of _rtl_pci_find_adapter

-- 
https://patchwork.kernel.org/patch/9870227/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [PATCH] mwifiex: add module parameter to disable 40MHZ support in 2.4G band

2017-08-03 Thread Kalle Valo
Xinming Hu  writes:

> From: Xinming Hu 
>
> This patch provide a new module parameter disable_2g4_40m, with
> which driver will not report 40M capability for 2.4GHZ to cfg80211.
>
> Signed-off-by: Xinming Hu 
> Signed-off-by: Cathy Luo 
> Signed-off-by: Ganapathi Bhat 
> ---
>  drivers/net/wireless/marvell/mwifiex/cfg80211.c | 22 ++
>  1 file changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c 
> b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> index 2be7817..820475a 100644
> --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> @@ -25,6 +25,10 @@
>  static char *reg_alpha2;
>  module_param(reg_alpha2, charp, 0);
>  
> +static bool disable_2g4_40m;
> +module_param(disable_2g4_40m, bool, );

This is bool, good.

> +MODULE_PARM_DESC(disable_2g4_40m, "2.4G 40M support disable:1, enable:0");

This is not really a readable description for someone not familiar with
Wi-Fi, maybe this instead:

"disable 40 Mhz channels on 2.4 GHz band (disable:1, enable:0)"

> @@ -2755,7 +2759,7 @@ static void mwifiex_setup_vht_caps(struct 
> ieee80211_sta_vht_cap *vht_info,
>   */
>  static void
>  mwifiex_setup_ht_caps(struct ieee80211_sta_ht_cap *ht_info,
> -   struct mwifiex_private *priv)
> +   struct mwifiex_private *priv, int disable_40m)

But here you use int, that's a bit strange. Why not bool?

-- 
Kalle Valo


Re: [PATCH 1/2] mwifiex: Do not change bss_num in change_virtual_intf

2017-08-03 Thread Kalle Valo
Xinming Hu  writes:

> From: Xinming Hu 
>
> Commit "mwifiex: Do not change bss_type in change_virtual_intf"
> Keep original bss_type unchanged. bss_num should keep the same
> style, in this way. Unique tuple (bss_type, bss_num) will be
> able to locate the right priv structure.

The preferred way to reference commits is:

Commit 4d7ab36f0c47 ("mwifiex: Do not change bss_type in
change_virtual_intf") kept original bss_type unchanged. bss_num should
keep the same style, in this way. Unique tuple (bss_type, bss_num) will
be able to locate the right priv structure.

I can fix that during commit.

-- 
Kalle Valo


Re: pull-request: iwlwifi-next 2017-08-01

2017-08-03 Thread Kalle Valo
Luca Coelho  writes:

> Hi Kalle,
>
> Here's my first pull-request intended for v4.14.  It contain generic
> development work, with improvements, bug fixes and
> cleanup all around.  More details in the tag description.
>
> As I mentioned earlier today, I left Emmanuel's "iwlwifi: mvm: fix TCP
> CSUM offload with WEP and A000 series" patch out of this pull-req,
> because I'll include it in the one for 4.13.
>
> I have sent this out before, and kbuildbot reported success.
>
> Please let me know if there are any issues.
>
> Cheers,
> Luca.
>
>
> The following changes since commit d28ac7be15c70343cb270648e252f54d770eca6a:
>
>   rtlwifi: rtl8821ae: Fix HW_VAR_NAV_UPPER operation (2017-07-28 18:42:59 
> +0300)
>
> are available in the git repository at:
>
>   git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next.git 
> tags/iwlwifi-next-for-kalle-2017-08-01
>
> for you to fetch changes up to d20e30af7e65811955af5bc2a268ae75cd14e99e:
>
>   iwlwifi: mvm: don't retake the pointer to skb's CB (2017-08-01 12:41:46 
> +0300)
>
> 
> First batch of iwlwifi patches for 4.14
>
> * Reorganization of the code into separate directories continues;
> * A couple of new minor features;
> * Fixes and cleanups here and there.
>
> 

Pulled, thanks.

-- 
Kalle Valo


[PATCH 1/2] mwifiex: Do not change bss_num in change_virtual_intf

2017-08-03 Thread Xinming Hu
From: Xinming Hu 

Commit "mwifiex: Do not change bss_type in change_virtual_intf"
Keep original bss_type unchanged. bss_num should keep the same
style, in this way. Unique tuple (bss_type, bss_num) will be
able to locate the right priv structure.

Signed-off-by: Xinming Hu 
Signed-off-by: Cathy Luo 
Signed-off-by: Ganapathi Bhat 
---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c 
b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 820475a..58720c9 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -893,23 +893,15 @@ static int mwifiex_deinit_priv_params(struct 
mwifiex_private *priv)
switch (type) {
case NL80211_IFTYPE_STATION:
case NL80211_IFTYPE_ADHOC:
-   priv->bss_num = mwifiex_get_unused_bss_num(adapter,
-MWIFIEX_BSS_TYPE_STA);
priv->bss_role =  MWIFIEX_BSS_ROLE_STA;
break;
case NL80211_IFTYPE_P2P_CLIENT:
-   priv->bss_num = mwifiex_get_unused_bss_num(adapter,
-MWIFIEX_BSS_TYPE_P2P);
priv->bss_role =  MWIFIEX_BSS_ROLE_STA;
break;
case NL80211_IFTYPE_P2P_GO:
-   priv->bss_num = mwifiex_get_unused_bss_num(adapter,
-MWIFIEX_BSS_TYPE_P2P);
priv->bss_role =  MWIFIEX_BSS_ROLE_UAP;
break;
case NL80211_IFTYPE_AP:
-   priv->bss_num = mwifiex_get_unused_bss_num(adapter,
-MWIFIEX_BSS_TYPE_UAP);
priv->bss_role = MWIFIEX_BSS_ROLE_UAP;
break;
default:
-- 
1.9.1



[PATCH 2/2] mwifiex: wrapper wps ie in pass through tlv

2017-08-03 Thread Xinming Hu
From: Xinming Hu 

This patch wrapper wps ie in pass through tlv, so that
firmware could parse correctly.

Signed-off-by: Xinming Hu 
Signed-off-by: Cathy Luo 
Signed-off-by: Ganapathi Bhat 
---
 drivers/net/wireless/marvell/mwifiex/join.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/join.c 
b/drivers/net/wireless/marvell/mwifiex/join.c
index b89596c..d87aeff 100644
--- a/drivers/net/wireless/marvell/mwifiex/join.c
+++ b/drivers/net/wireless/marvell/mwifiex/join.c
@@ -253,7 +253,7 @@ static int mwifiex_get_common_rates(struct mwifiex_private 
*priv, u8 *rate1,
priv->wps_ie_len, *buffer);
 
/* Wrap the generic IE buffer with a pass through TLV type */
-   ie_header.type = cpu_to_le16(TLV_TYPE_MGMT_IE);
+   ie_header.type = cpu_to_le16(TLV_TYPE_PASSTHROUGH);
ie_header.len = cpu_to_le16(priv->wps_ie_len);
memcpy(*buffer, _header, sizeof(ie_header));
*buffer += sizeof(ie_header);
-- 
1.9.1



Re: [PATCH] rt2x00: Fix MMIC countermeasures.

2017-08-03 Thread Stanislaw Gruszka
On Wed, Aug 02, 2017 at 10:36:52AM -0400, Michael Skeffington wrote:
> I traced through this code during MMIC failure and
> ieee80211_rx_h_decrypt() drops the frame before getting to
> ieee80211_rx_h_michael_mic_verify().  Johannes suggested this change
> to me in response to a previous thread and I am offering this patch
> after having conducted the proper testing on it.

Ok, please repost the patch without mangling it i.e. using
git-send-email.

Thanks
Stanislaw


[PATCH] mwifiex: add module parameter to disable 40MHZ support in 2.4G band

2017-08-03 Thread Xinming Hu
From: Xinming Hu 

This patch provide a new module parameter disable_2g4_40m, with
which driver will not report 40M capability for 2.4GHZ to cfg80211.

Signed-off-by: Xinming Hu 
Signed-off-by: Cathy Luo 
Signed-off-by: Ganapathi Bhat 
---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 22 ++
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c 
b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 2be7817..820475a 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -25,6 +25,10 @@
 static char *reg_alpha2;
 module_param(reg_alpha2, charp, 0);
 
+static bool disable_2g4_40m;
+module_param(disable_2g4_40m, bool, );
+MODULE_PARM_DESC(disable_2g4_40m, "2.4G 40M support disable:1, enable:0");
+
 static const struct ieee80211_iface_limit mwifiex_ap_sta_limits[] = {
{
.max = 3, .types = BIT(NL80211_IFTYPE_STATION) |
@@ -2755,7 +2759,7 @@ static void mwifiex_setup_vht_caps(struct 
ieee80211_sta_vht_cap *vht_info,
  */
 static void
 mwifiex_setup_ht_caps(struct ieee80211_sta_ht_cap *ht_info,
- struct mwifiex_private *priv)
+ struct mwifiex_private *priv, int disable_40m)
 {
int rx_mcs_supp;
struct ieee80211_mcs_info mcs_set;
@@ -2769,7 +2773,7 @@ static void mwifiex_setup_vht_caps(struct 
ieee80211_sta_vht_cap *vht_info,
memset(_info->mcs, 0, sizeof(ht_info->mcs));
 
/* Fill HT capability information */
-   if (ISSUPP_CHANWIDTH40(adapter->hw_dot_11n_dev_cap))
+   if (ISSUPP_CHANWIDTH40(adapter->hw_dot_11n_dev_cap) && !disable_40m)
ht_info->cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
else
ht_info->cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
@@ -2779,7 +2783,7 @@ static void mwifiex_setup_vht_caps(struct 
ieee80211_sta_vht_cap *vht_info,
else
ht_info->cap &= ~IEEE80211_HT_CAP_SGI_20;
 
-   if (ISSUPP_SHORTGI40(adapter->hw_dot_11n_dev_cap))
+   if (ISSUPP_SHORTGI40(adapter->hw_dot_11n_dev_cap) && !disable_40m)
ht_info->cap |= IEEE80211_HT_CAP_SGI_40;
else
ht_info->cap &= ~IEEE80211_HT_CAP_SGI_40;
@@ -2799,7 +2803,8 @@ static void mwifiex_setup_vht_caps(struct 
ieee80211_sta_vht_cap *vht_info,
else
ht_info->cap &= ~IEEE80211_HT_CAP_GRN_FLD;
 
-   if (ISENABLED_40MHZ_INTOLERANT(adapter->hw_dot_11n_dev_cap))
+   if (ISENABLED_40MHZ_INTOLERANT(adapter->hw_dot_11n_dev_cap) &&
+   !disable_40m)
ht_info->cap |= IEEE80211_HT_CAP_40MHZ_INTOLERANT;
else
ht_info->cap &= ~IEEE80211_HT_CAP_40MHZ_INTOLERANT;
@@ -2819,7 +2824,7 @@ static void mwifiex_setup_vht_caps(struct 
ieee80211_sta_vht_cap *vht_info,
memset([rx_mcs_supp], 0,
   sizeof(struct ieee80211_mcs_info) - rx_mcs_supp);
if (priv->bss_mode == NL80211_IFTYPE_STATION ||
-   ISSUPP_CHANWIDTH40(adapter->hw_dot_11n_dev_cap))
+   (ISSUPP_CHANWIDTH40(adapter->hw_dot_11n_dev_cap) && !disable_40m))
/* Set MCS32 for infra mode or ad-hoc mode with 40MHz support */
SETHT_MCS32(mcs_set.rx_mask);
 
@@ -2974,14 +2979,15 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct 
wiphy *wiphy,
if (ret)
goto err_sta_init;
 
-   mwifiex_setup_ht_caps(>bands[NL80211_BAND_2GHZ]->ht_cap, priv);
-   if (adapter->is_hw_11ac_capable)
+   mwifiex_setup_ht_caps(>bands[NL80211_BAND_2GHZ]->ht_cap, priv,
+ disable_2g4_40m);
+   if (adapter->is_hw_11ac_capable && !disable_2g4_40m)
mwifiex_setup_vht_caps(
>bands[NL80211_BAND_2GHZ]->vht_cap, priv);
 
if (adapter->config_bands & BAND_A)
mwifiex_setup_ht_caps(
-   >bands[NL80211_BAND_5GHZ]->ht_cap, priv);
+   >bands[NL80211_BAND_5GHZ]->ht_cap, priv, 0);
 
if ((adapter->config_bands & BAND_A) && adapter->is_hw_11ac_capable)
mwifiex_setup_vht_caps(
-- 
1.9.1



Re: pull-request: iwlwifi 2017-08-02

2017-08-03 Thread Kalle Valo
Luca Coelho  writes:

> Hi Kalle,
>
> Here is my second batch of fixes for 4.13.  More details in the tag 
> description.
>
> I have sent this out before and kbuildbot didn't find any issues. 
> Please let me know if there are any issues.
>
> Cheers,
> Luca.
>
>
> The following changes since commit 5f5d03143de5e0c593da4ab18fc6393c2815e108:
>
>   brcmfmac: fix memleak due to calling brcmf_sdiod_sgtable_alloc() twice 
> (2017-07-27 14:03:14 +0300)
>
> are available in the git repository at:
>
>   git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-fixes.git 
> tags/iwlwifi-for-kalle-2017-08-02
>
> for you to fetch changes up to 558f479f687aca6a336e13309424a7c3afd32721:
>
>   iwlwifi: add the new 9000 series PCI IDs (2017-08-01 12:26:17 +0300)
>
> 
> Some fixes in iwlwifi for 4.13
>
> * Some simple PCI HW ID fix-ups and additions for family 9000;
> * A couple of bugzilla fixes:
>   - Remove a bogus warning message with new FWs (196915)
>   - Don't allow illegal channel options to be used (195299)
> * A fix for checksum offload in family 9000;
> * A fix serious throughput degradation in 11ac with multiple streams;
> * An old bug in SMPS where the firmware was not aware of SMPS changes;
>
> 

Pulled, thanks.

-- 
Kalle Valo