linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 00/10] wil6210 patches
@ 2017-08-03 19:08 Maya Erez
  2017-08-03 19:08 ` [PATCH v4 01/10] wil6210: protect against invalid length of tx management frame Maya Erez
                   ` (9 more replies)
  0 siblings, 10 replies; 18+ messages in thread
From: Maya Erez @ 2017-08-03 19:08 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Maya Erez, linux-wireless, wil6210

Changes from v3:
- Split of "wil6210: make debugfs compilation optional" patch to 2 logical patches

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 (2):
  wil6210: move vring_idle_trsh definition to wil6210_priv
  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  | 27 ++++++++++++++-----
 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, 133 insertions(+), 29 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v4 01/10] wil6210: protect against invalid length of tx management frame
  2017-08-03 19:08 [PATCH v4 00/10] wil6210 patches Maya Erez
@ 2017-08-03 19:08 ` Maya Erez
  2017-08-08 18:44   ` [v4, " Kalle Valo
  2017-08-09  8:02   ` [PATCH v4 " Arend van Spriel
  2017-08-03 19:08 ` [PATCH v4 02/10] wil6210: allow configuring scan timers Maya Erez
                   ` (8 subsequent siblings)
  9 siblings, 2 replies; 18+ messages in thread
From: Maya Erez @ 2017-08-03 19:08 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Hamad Kadmany, linux-wireless, wil6210, Maya Erez, Lior David

From: Hamad Kadmany <qca_hkadmany@qca.qualcomm.com>

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

Signed-off-by: Hamad Kadmany <qca_hkadmany@qca.qualcomm.com>
Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
---
 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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 02/10] wil6210: allow configuring scan timers
  2017-08-03 19:08 [PATCH v4 00/10] wil6210 patches Maya Erez
  2017-08-03 19:08 ` [PATCH v4 01/10] wil6210: protect against invalid length of tx management frame Maya Erez
@ 2017-08-03 19:08 ` Maya Erez
  2017-08-08 10:53   ` Kalle Valo
  2017-08-03 19:08 ` [PATCH v4 03/10] wil6210: support FW RSSI reporting Maya Erez
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 18+ messages in thread
From: Maya Erez @ 2017-08-03 19:08 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Hamad Kadmany, linux-wireless, wil6210, Maya Erez

From: Hamad Kadmany <qca_hkadmany@qca.qualcomm.com>

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

Signed-off-by: Hamad Kadmany <qca_hkadmany@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
---
 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(&wil->scan_timer, jiffies + WIL6210_SCAN_TO);
+	mod_timer(&wil->scan_timer,
+		  jiffies + msecs_to_jiffies(1000U * scan_timeout));
 
 	memset(&cmd, 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_TO		msecs_to_jiffies(10000)
+#define WIL6210_SCAN_TO_SEC		10
 #define WIL6210_DISCONNECT_TO_MS (2000)
 #define WIL6210_RX_HIGH_TRSH_INIT		(0)
 #define WIL6210_RX_HIGH_TRSH_DEFAULT \
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 03/10] wil6210: support FW RSSI reporting
  2017-08-03 19:08 [PATCH v4 00/10] wil6210 patches Maya Erez
  2017-08-03 19:08 ` [PATCH v4 01/10] wil6210: protect against invalid length of tx management frame Maya Erez
  2017-08-03 19:08 ` [PATCH v4 02/10] wil6210: allow configuring scan timers Maya Erez
@ 2017-08-03 19:08 ` Maya Erez
  2017-08-03 19:08 ` [PATCH v4 04/10] wil6210: check no_fw_recovery in resume failure recovery Maya Erez
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Maya Erez @ 2017-08-03 19:08 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Dedy Lansky, linux-wireless, wil6210, Maya Erez

From: Dedy Lansky <qca_dlansky@qca.qualcomm.com>

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

Signed-off-by: Dedy Lansky <qca_dlansky@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
---
 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] = &wil_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;
 	d_status = le16_to_cpu(data->info.status);
 	fc = rx_mgmt_frame->frame_control;
 
-	wil_dbg_wmi(wil, "MGMT Rx: channel %d MCS %d SNR %d SQI %d%%\n",
-		    data->info.channel, data->info.mcs, data->info.snr,
+	wil_dbg_wmi(wil, "MGMT Rx: channel %d MCS %d RSSI %d SQI %d%%\n",
+		    data->info.channel, data->info.mcs, data->info.rssi,
 		    data->info.sqi);
 	wil_dbg_wmi(wil, "status 0x%04x len %d fc 0x%04x\n", d_status, d_len,
 		    le16_to_cpu(fc));
diff --git a/drivers/net/wireless/ath/wil6210/wmi.h b/drivers/net/wireless/ath/wil6210/wmi.h
index 256f63c..4e31c2f 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.h
+++ b/drivers/net/wireless/ath/wil6210/wmi.h
@@ -60,6 +60,7 @@ enum wmi_fw_capability {
 	WMI_FW_CAPABILITY_WMI_ONLY		= 5,
 	WMI_FW_CAPABILITY_THERMAL_THROTTLING	= 7,
 	WMI_FW_CAPABILITY_D3_SUSPEND		= 8,
+	WMI_FW_CAPABILITY_RSSI_REPORTING	= 12,
 	WMI_FW_CAPABILITY_MAX,
 };
 
@@ -1306,7 +1307,8 @@ struct wmi_notify_req_done_event {
 	/* beamforming status, 0: fail; 1: OK; 2: retrying */
 	__le32 status;
 	__le64 tsf;
-	__le32 snr_val;
+	s8 rssi;
+	u8 reserved0[3];
 	__le32 tx_tpt;
 	__le32 tx_goodput;
 	__le32 rx_goodput;
@@ -1602,7 +1604,7 @@ struct wmi_get_ssid_event {
 /* wmi_rx_mgmt_info */
 struct wmi_rx_mgmt_info {
 	u8 mcs;
-	s8 snr;
+	s8 rssi;
 	u8 range;
 	u8 sqi;
 	__le16 stype;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 04/10] wil6210: check no_fw_recovery in resume failure recovery
  2017-08-03 19:08 [PATCH v4 00/10] wil6210 patches Maya Erez
                   ` (2 preceding siblings ...)
  2017-08-03 19:08 ` [PATCH v4 03/10] wil6210: support FW RSSI reporting Maya Erez
@ 2017-08-03 19:08 ` Maya Erez
  2017-08-03 19:08 ` [PATCH v4 05/10] wil6210: add statistics for suspend time Maya Erez
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Maya Erez @ 2017-08-03 19:08 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Maya Erez, linux-wireless, wil6210

Reset 11ad device on resume failure only if no_fw_recovery
is not set.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
---
 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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 05/10] wil6210: add statistics for suspend time
  2017-08-03 19:08 [PATCH v4 00/10] wil6210 patches Maya Erez
                   ` (3 preceding siblings ...)
  2017-08-03 19:08 ` [PATCH v4 04/10] wil6210: check no_fw_recovery in resume failure recovery Maya Erez
@ 2017-08-03 19:08 ` Maya Erez
  2017-08-03 19:08 ` [PATCH v4 06/10] wil6210: notify wiphy on wowlan support Maya Erez
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Maya Erez @ 2017-08-03 19:08 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Maya Erez, linux-wireless, wil6210

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 <qca_merez@qca.qualcomm.com>
---
 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(&wil->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(&wil->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:
-	wil_dbg_pm(wil, "resume: %s => %d\n",
-		   is_runtime ? "runtime" : "system", rc);
+	wil_dbg_pm(wil, "resume: %s => %d, suspend time %lld usec\n",
+		   is_runtime ? "runtime" : "system", rc, suspend_time_usec);
 	return rc;
 }
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h
index ac32284..724ad59 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -90,6 +90,11 @@ struct wil_suspend_stats {
 	unsigned long failed_resumes;
 	unsigned long rejected_by_device;
 	unsigned long rejected_by_host;
+	unsigned long long total_suspend_time;
+	unsigned long long min_suspend_time;
+	unsigned long long max_suspend_time;
+	ktime_t collection_start;
+	ktime_t suspend_start_time;
 };
 
 /* Calculate MAC buffer size for the firmware. It includes all overhead,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 06/10] wil6210: notify wiphy on wowlan support
  2017-08-03 19:08 [PATCH v4 00/10] wil6210 patches Maya Erez
                   ` (4 preceding siblings ...)
  2017-08-03 19:08 ` [PATCH v4 05/10] wil6210: add statistics for suspend time Maya Erez
@ 2017-08-03 19:08 ` Maya Erez
  2017-08-03 19:08 ` [PATCH v4 07/10] wil6210: fix interface-up check Maya Erez
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Maya Erez @ 2017-08-03 19:08 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Maya Erez, linux-wireless, wil6210

Set wowlan to indicate that 11ad device can wake-up
on any trigger and disconnect.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
---
 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 = &wil_wowlan_support;
+#endif
 }
 
 struct wireless_dev *wil_cfg80211_init(struct device *dev)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 07/10] wil6210: fix interface-up check
  2017-08-03 19:08 [PATCH v4 00/10] wil6210 patches Maya Erez
                   ` (5 preceding siblings ...)
  2017-08-03 19:08 ` [PATCH v4 06/10] wil6210: notify wiphy on wowlan support Maya Erez
@ 2017-08-03 19:08 ` Maya Erez
  2017-08-03 19:08 ` [PATCH v4 08/10] wil6210: store FW RF calibration result Maya Erez
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Maya Erez @ 2017-08-03 19:08 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Hamad Kadmany, linux-wireless, wil6210, Maya Erez

From: Hamad Kadmany <qca_hkadmany@qca.qualcomm.com>

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 <qca_hkadmany@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
---
 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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 08/10] wil6210: store FW RF calibration result
  2017-08-03 19:08 [PATCH v4 00/10] wil6210 patches Maya Erez
                   ` (6 preceding siblings ...)
  2017-08-03 19:08 ` [PATCH v4 07/10] wil6210: fix interface-up check Maya Erez
@ 2017-08-03 19:08 ` Maya Erez
  2017-08-03 19:08 ` [PATCH v4 09/10] wil6210: move vring_idle_trsh definition to wil6210_priv Maya Erez
  2017-08-03 19:08 ` [PATCH v4 10/10] wil6210: make debugfs compilation optional Maya Erez
  9 siblings, 0 replies; 18+ messages in thread
From: Maya Erez @ 2017-08-03 19:08 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Dedy Lansky, linux-wireless, wil6210, Maya Erez

From: Dedy Lansky <qca_dlansky@qca.qualcomm.com>

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 <qca_dlansky@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
---
 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_SEL	BIT(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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 09/10] wil6210: move vring_idle_trsh definition to wil6210_priv
  2017-08-03 19:08 [PATCH v4 00/10] wil6210 patches Maya Erez
                   ` (7 preceding siblings ...)
  2017-08-03 19:08 ` [PATCH v4 08/10] wil6210: store FW RF calibration result Maya Erez
@ 2017-08-03 19:08 ` Maya Erez
  2017-08-03 19:08 ` [PATCH v4 10/10] wil6210: make debugfs compilation optional Maya Erez
  9 siblings, 0 replies; 18+ messages in thread
From: Maya Erez @ 2017-08-03 19:08 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Gidon Studinski, linux-wireless, wil6210, Maya Erez

From: Gidon Studinski <qca_gidons@qca.qualcomm.com>

vring_idle_trsh is used in the operational driver, hence
should not be defined as a debugfs variable.

Signed-off-by: Gidon Studinski <qca_gidons@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
---
 drivers/net/wireless/ath/wil6210/debugfs.c | 5 +----
 drivers/net/wireless/ath/wil6210/main.c    | 1 +
 drivers/net/wireless/ath/wil6210/txrx.c    | 6 +++---
 drivers/net/wireless/ath/wil6210/wil6210.h | 2 +-
 4 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c
index d4e8865..6db00c1 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -20,7 +20,6 @@
 #include <linux/pci.h>
 #include <linux/rtnetlink.h>
 #include <linux/power_supply.h>
-
 #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)&dbg_txdesc_index, doff_u32},
 	{"vring_index",	0644, (ulong)&dbg_vring_index, doff_u32},
 	{"mem_addr",	0644, (ulong)&mem_addr, doff_u32},
-	{"vring_idle_trsh", 0644, (ulong)&vring_idle_trsh,
-	 doff_u32},
 	{"led_polarity", 0644, (ulong)&led_polarity, doff_u8},
 	{},
 };
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(&wil->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..cf20a8c 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  */
 	bool use_extended_dma_addr; /* indicates whether we are using 48 bits */
 	/* scan */
 	struct cfg80211_scan_request *scan_request;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 10/10] wil6210: make debugfs compilation optional
  2017-08-03 19:08 [PATCH v4 00/10] wil6210 patches Maya Erez
                   ` (8 preceding siblings ...)
  2017-08-03 19:08 ` [PATCH v4 09/10] wil6210: move vring_idle_trsh definition to wil6210_priv Maya Erez
@ 2017-08-03 19:08 ` Maya Erez
  2017-08-08 11:03   ` Kalle Valo
  9 siblings, 1 reply; 18+ messages in thread
From: Maya Erez @ 2017-08-03 19:08 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Gidon Studinski, linux-wireless, wil6210, Maya Erez

From: Gidon Studinski <qca_gidons@qca.qualcomm.com>

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

Signed-off-by: Gidon Studinski <qca_gidons@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
---
 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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 02/10] wil6210: allow configuring scan timers
  2017-08-03 19:08 ` [PATCH v4 02/10] wil6210: allow configuring scan timers Maya Erez
@ 2017-08-08 10:53   ` Kalle Valo
  0 siblings, 0 replies; 18+ messages in thread
From: Kalle Valo @ 2017-08-08 10:53 UTC (permalink / raw)
  To: qca_merez; +Cc: QCA_hkadmany, linux-wireless, wil6210

Maya Erez <qca_merez@qca.qualcomm.com> writes:

> From: Hamad Kadmany <qca_hkadmany@qca.qualcomm.com>
>
> Allow setting scan timeout and scan dwell time
> through module parameters.
>
> Signed-off-by: Hamad Kadmany <qca_hkadmany@qca.qualcomm.com>
> Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
> ---
>  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/wi=
reless/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");
> =20
> +static uint scan_dwell_time  =3D 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 =3D WIL6210_SCAN_TO_SEC;
> +module_param(scan_timeout, uint, 0644);
> +MODULE_PARM_DESC(scan_timeout, " Scan timeout (seconds)");

Module parameters are not really meant for this kind of configuration
802.11 protocol configuration. Can't you use nl80211?

--=20
Kalle Valo=

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 10/10] wil6210: make debugfs compilation optional
  2017-08-03 19:08 ` [PATCH v4 10/10] wil6210: make debugfs compilation optional Maya Erez
@ 2017-08-08 11:03   ` Kalle Valo
  2017-08-08 17:32     ` Lior David
  0 siblings, 1 reply; 18+ messages in thread
From: Kalle Valo @ 2017-08-08 11:03 UTC (permalink / raw)
  To: qca_merez; +Cc: QCA_gidons, linux-wireless, wil6210

Maya Erez <qca_merez@qca.qualcomm.com> writes:

> From: Gidon Studinski <qca_gidons@qca.qualcomm.com>
>
> Since debugfs is a kernel configuration option, enable the driver to
> compile without debugfs.
>
> Signed-off-by: Gidon Studinski <qca_gidons@qca.qualcomm.com>
> Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
> ---
>  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/wire=
less/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 :=3D main.o
>  wil6210-y +=3D netdev.o
>  wil6210-y +=3D cfg80211.o
>  wil6210-y +=3D pcie_bus.o
> -wil6210-y +=3D debugfs.o
> +wil6210-$(CONFIG_DEBUG_FS) +=3D debugfs.o
>  wil6210-y +=3D wmi.o
>  wil6210-y +=3D interrupt.o
>  wil6210-y +=3D txrx.o
> diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wir=
eless/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);
> =20
> +#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) { retur=
n 0; }
> +static inline void wil6210_debugfs_remove(struct wil6210_priv *wil) {}
> +#endif

I was thinking more that should we have CONFIG_WIL6210_DEBUGFS, just
like we have CONFIG_ATH10K_DEBUGFS and CONFIG_ATH9K_DEBUGFS? This way it
can be controlled per driver if debugfs interface is available or not.

--=20
Kalle Valo=

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 10/10] wil6210: make debugfs compilation optional
  2017-08-08 11:03   ` Kalle Valo
@ 2017-08-08 17:32     ` Lior David
  2017-08-08 18:43       ` Kalle Valo
  0 siblings, 1 reply; 18+ messages in thread
From: Lior David @ 2017-08-08 17:32 UTC (permalink / raw)
  To: Kalle Valo, qca_merez; +Cc: QCA_gidons, linux-wireless, wil6210



On 8/8/2017 2:03 PM, Kalle Valo wrote:
> Maya Erez <qca_merez@qca.qualcomm.com> writes:
> 
>> From: Gidon Studinski <qca_gidons@qca.qualcomm.com>
>>
>> Since debugfs is a kernel configuration option, enable the driver to
>> compile without debugfs.
>>
>> Signed-off-by: Gidon Studinski <qca_gidons@qca.qualcomm.com>
>> Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
>> ---
>>  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
> 
> I was thinking more that should we have CONFIG_WIL6210_DEBUGFS, just
> like we have CONFIG_ATH10K_DEBUGFS and CONFIG_ATH9K_DEBUGFS? This way it
> can be controlled per driver if debugfs interface is available or not.
> 
Hi Kalle, I am answering instead of Maya, she is currently on holiday.
We will consider this and resend the patch.
Is it possible to apply the other patches in the v4 series except this one and
patch #2 (the scan timeout module parameter)?

Thanks,
Lior

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 10/10] wil6210: make debugfs compilation optional
  2017-08-08 17:32     ` Lior David
@ 2017-08-08 18:43       ` Kalle Valo
  0 siblings, 0 replies; 18+ messages in thread
From: Kalle Valo @ 2017-08-08 18:43 UTC (permalink / raw)
  To: Lior David; +Cc: qca_merez, QCA_gidons, linux-wireless, wil6210

Lior David <liord@codeaurora.org> writes:

> On 8/8/2017 2:03 PM, Kalle Valo wrote:
>> Maya Erez <qca_merez@qca.qualcomm.com> writes:
>>=20
>>> From: Gidon Studinski <qca_gidons@qca.qualcomm.com>
>>>
>>> Since debugfs is a kernel configuration option, enable the driver to
>>> compile without debugfs.
>>>
>>> Signed-off-by: Gidon Studinski <qca_gidons@qca.qualcomm.com>
>>> Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>

[...]

>>> +#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) { ret=
urn 0; }
>>> +static inline void wil6210_debugfs_remove(struct wil6210_priv *wil) {}
>>> +#endif
>>=20
>> I was thinking more that should we have CONFIG_WIL6210_DEBUGFS, just
>> like we have CONFIG_ATH10K_DEBUGFS and CONFIG_ATH9K_DEBUGFS? This way it
>> can be controlled per driver if debugfs interface is available or not.
>>=20
> Hi Kalle, I am answering instead of Maya, she is currently on holiday.
> We will consider this and resend the patch.

Ok, no rush.

> Is it possible to apply the other patches in the v4 series except this on=
e and
> patch #2 (the scan timeout module parameter)?

I was actually planning to do exactly that. I was just waiting for
kbuild bot results because I had to fix a trivial conflict after
removing patch 2.

--=20
Kalle Valo=

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [v4, 01/10] wil6210: protect against invalid length of tx management frame
  2017-08-03 19:08 ` [PATCH v4 01/10] wil6210: protect against invalid length of tx management frame Maya Erez
@ 2017-08-08 18:44   ` Kalle Valo
  2017-08-09  8:02   ` [PATCH v4 " Arend van Spriel
  1 sibling, 0 replies; 18+ messages in thread
From: Kalle Valo @ 2017-08-08 18:44 UTC (permalink / raw)
  To: Maya Erez
  Cc: Kalle Valo, Hamad Kadmany, linux-wireless, wil6210, Maya Erez,
	Lior David

Maya Erez <qca_merez@qca.qualcomm.com> wrote:

> Validate buffer length has the minimum needed size
> when sending management frame to protect against
> possible buffer overrun.
> 
> Signed-off-by: Hamad Kadmany <qca_hkadmany@qca.qualcomm.com>
> Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
> Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>

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

6641525ce40e wil6210: protect against invalid length of tx management frame
30868f5d4413 wil6210: support FW RSSI reporting
c6622116c5ae wil6210: check no_fw_recovery in resume failure recovery
262345265e59 wil6210: add statistics for suspend time
d1fbf07540b7 wil6210: notify wiphy on wowlan support
9b2a4c2d534c wil6210: fix interface-up check
eb4c02155881 wil6210: store FW RF calibration result
38d16ab2b213 wil6210: move vring_idle_trsh definition to wil6210_priv

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

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 01/10] wil6210: protect against invalid length of tx management frame
  2017-08-03 19:08 ` [PATCH v4 01/10] wil6210: protect against invalid length of tx management frame Maya Erez
  2017-08-08 18:44   ` [v4, " Kalle Valo
@ 2017-08-09  8:02   ` Arend van Spriel
  2017-08-09 12:01     ` Lior David
  1 sibling, 1 reply; 18+ messages in thread
From: Arend van Spriel @ 2017-08-09  8:02 UTC (permalink / raw)
  To: Maya Erez, Kalle Valo; +Cc: Hamad Kadmany, linux-wireless, wil6210, Lior David

On 8/3/2017 9:08 PM, Maya Erez wrote:
> From: Hamad Kadmany <qca_hkadmany@qca.qualcomm.com>
>
> Validate buffer length has the minimum needed size
> when sending management frame to protect against
> possible buffer overrun.

I noticed this is already applied, but I saw this subject text which has 
similar sound to a recent patch in our driver so I it made me curious...

> Signed-off-by: Hamad Kadmany <qca_hkadmany@qca.qualcomm.com>
> Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
> Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
> ---
>   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;

A similar check is already in net/wireless/cfg80211_mlme_mgmt_tx() which 
calls this function:

	if (params->len < 24 + 1)
		return -EINVAL;

So it only makes sense if this is called from some other call site....

>   	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;
> +

... which is in this function. Now I wonder why you would need this 
method in the first place. Why not stick with using the nl80211 
NL80211_CMD_FRAME api?

Regards,
Arend

>   	frame = memdup_user(buf, len);
>   	if (IS_ERR(frame))
>   		return PTR_ERR(frame);
>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 01/10] wil6210: protect against invalid length of tx management frame
  2017-08-09  8:02   ` [PATCH v4 " Arend van Spriel
@ 2017-08-09 12:01     ` Lior David
  0 siblings, 0 replies; 18+ messages in thread
From: Lior David @ 2017-08-09 12:01 UTC (permalink / raw)
  To: Arend van Spriel, Maya Erez, Kalle Valo
  Cc: Hamad Kadmany, linux-wireless, wil6210, Lior David

On 8/9/2017 11:02 AM, Arend van Spriel wrote:
> On 8/3/2017 9:08 PM, Maya Erez wrote:
>> From: Hamad Kadmany <qca_hkadmany@qca.qualcomm.com>
>>
>> Validate buffer length has the minimum needed size
>> when sending management frame to protect against
>> possible buffer overrun.
> 
> I noticed this is already applied, but I saw this subject text which has similar
> sound to a recent patch in our driver so I it made me curious...
> 
>> Signed-off-by: Hamad Kadmany <qca_hkadmany@qca.qualcomm.com>
>> Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
>> Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
>> ---
>>   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;
> 
> A similar check is already in net/wireless/cfg80211_mlme_mgmt_tx() which calls
> this function:
> 
>     if (params->len < 24 + 1)
>         return -EINVAL;
> 
> So it only makes sense if this is called from some other call site....
> 
>>       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;
>> +
> 
> ... which is in this function. Now I wonder why you would need this method in
> the first place. Why not stick with using the nl80211 NL80211_CMD_FRAME api?
> 
Using NL80211_CMD_FRAME reaches cfg80211_mlme_mgmt_tx which performs validity
checks such as:
- Fail to send frame types not supported by the driver
- Some strict checks for non-public action frames.
The debugfs file provides a convenient and simple way to send any type of
management frames for debugging and testing. For example, we use it with some
testing scripts, basically turning a station into a "packet injector" and
sending frames into the air for simulating various scenarios.

Thanks,
Lior

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2017-08-09 12:01 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-03 19:08 [PATCH v4 00/10] wil6210 patches Maya Erez
2017-08-03 19:08 ` [PATCH v4 01/10] wil6210: protect against invalid length of tx management frame Maya Erez
2017-08-08 18:44   ` [v4, " Kalle Valo
2017-08-09  8:02   ` [PATCH v4 " Arend van Spriel
2017-08-09 12:01     ` Lior David
2017-08-03 19:08 ` [PATCH v4 02/10] wil6210: allow configuring scan timers Maya Erez
2017-08-08 10:53   ` Kalle Valo
2017-08-03 19:08 ` [PATCH v4 03/10] wil6210: support FW RSSI reporting Maya Erez
2017-08-03 19:08 ` [PATCH v4 04/10] wil6210: check no_fw_recovery in resume failure recovery Maya Erez
2017-08-03 19:08 ` [PATCH v4 05/10] wil6210: add statistics for suspend time Maya Erez
2017-08-03 19:08 ` [PATCH v4 06/10] wil6210: notify wiphy on wowlan support Maya Erez
2017-08-03 19:08 ` [PATCH v4 07/10] wil6210: fix interface-up check Maya Erez
2017-08-03 19:08 ` [PATCH v4 08/10] wil6210: store FW RF calibration result Maya Erez
2017-08-03 19:08 ` [PATCH v4 09/10] wil6210: move vring_idle_trsh definition to wil6210_priv Maya Erez
2017-08-03 19:08 ` [PATCH v4 10/10] wil6210: make debugfs compilation optional Maya Erez
2017-08-08 11:03   ` Kalle Valo
2017-08-08 17:32     ` Lior David
2017-08-08 18:43       ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).