[PATCH v5 1/3] mwifiex: refactor device dump code to make it generic for usb interface

2017-12-11 Thread Xinming Hu
This patch refactor current device dump code to make it generic
for subsequent implementation on usb interface.

Signed-off-by: Xinming Hu 
Signed-off-by: Cathy Luo 
Signed-off-by: Ganapathi Bhat 
---
v2: Addressed below review comments from Brian Norris
a) use new API timer_setup/from_timer.
b) reset devdump_len during initization
v4: Correct missed \n - intentional from James Cameron
v5: Reset dump data/len to avoid reuse from Brian Norris
---
 drivers/net/wireless/marvell/mwifiex/init.c |  1 +
 drivers/net/wireless/marvell/mwifiex/main.c | 97 +++--
 drivers/net/wireless/marvell/mwifiex/main.h | 11 +++-
 drivers/net/wireless/marvell/mwifiex/pcie.c | 13 ++--
 drivers/net/wireless/marvell/mwifiex/sdio.c | 14 +++--
 5 files changed, 79 insertions(+), 57 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/init.c 
b/drivers/net/wireless/marvell/mwifiex/init.c
index e1aa860..b0d3d68 100644
--- a/drivers/net/wireless/marvell/mwifiex/init.c
+++ b/drivers/net/wireless/marvell/mwifiex/init.c
@@ -314,6 +314,7 @@ static void mwifiex_init_adapter(struct mwifiex_adapter 
*adapter)
adapter->iface_limit.p2p_intf = MWIFIEX_MAX_P2P_NUM;
adapter->active_scan_triggered = false;
timer_setup(>wakeup_timer, wakeup_timer_fn, 0);
+   adapter->devdump_len = 0;
 }
 
 /*
diff --git a/drivers/net/wireless/marvell/mwifiex/main.c 
b/drivers/net/wireless/marvell/mwifiex/main.c
index a96bd7e..12e7399 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.c
+++ b/drivers/net/wireless/marvell/mwifiex/main.c
@@ -1051,9 +1051,30 @@ void mwifiex_multi_chan_resync(struct mwifiex_adapter 
*adapter)
 }
 EXPORT_SYMBOL_GPL(mwifiex_multi_chan_resync);
 
-int mwifiex_drv_info_dump(struct mwifiex_adapter *adapter, void **drv_info)
+void mwifiex_upload_device_dump(struct mwifiex_adapter *adapter)
 {
-   void *p;
+   /* Dump all the memory data into single file, a userspace script will
+* be used to split all the memory data to multiple files
+*/
+   mwifiex_dbg(adapter, MSG,
+   "== mwifiex dump information to /sys/class/devcoredump 
start\n");
+   dev_coredumpv(adapter->dev, adapter->devdump_data, adapter->devdump_len,
+ GFP_KERNEL);
+   mwifiex_dbg(adapter, MSG,
+   "== mwifiex dump information to /sys/class/devcoredump 
end\n");
+
+   /* Device dump data will be freed in device coredump release function
+* after 5 min. Here reset adapter->devdump_data and ->devdump_len
+* to avoid it been accidentally reused.
+*/
+   adapter->devdump_data = NULL;
+   adapter->devdump_len = 0;
+}
+EXPORT_SYMBOL_GPL(mwifiex_upload_device_dump);
+
+void mwifiex_drv_info_dump(struct mwifiex_adapter *adapter)
+{
+   char *p;
char drv_version[64];
struct usb_card_rec *cardp;
struct sdio_mmc_card *sdio_card;
@@ -1061,17 +1082,12 @@ int mwifiex_drv_info_dump(struct mwifiex_adapter 
*adapter, void **drv_info)
int i, idx;
struct netdev_queue *txq;
struct mwifiex_debug_info *debug_info;
-   void *drv_info_dump;
 
mwifiex_dbg(adapter, MSG, "===mwifiex driverinfo dump start===\n");
 
-   /* memory allocate here should be free in mwifiex_upload_device_dump*/
-   drv_info_dump = vzalloc(MWIFIEX_DRV_INFO_SIZE_MAX);
-
-   if (!drv_info_dump)
-   return 0;
-
-   p = (char *)(drv_info_dump);
+   p = adapter->devdump_data;
+   strcpy(p, "Start dump driverinfo\n");
+   p += strlen("Start dump driverinfo\n");
p += sprintf(p, "driver_name = " "\"mwifiex\"\n");
 
mwifiex_drv_get_driver_version(adapter, drv_version,
@@ -1155,21 +1171,18 @@ int mwifiex_drv_info_dump(struct mwifiex_adapter 
*adapter, void **drv_info)
kfree(debug_info);
}
 
+   strcpy(p, "\nEnd dump\n");
+   p += strlen("\nEnd dump\n");
mwifiex_dbg(adapter, MSG, "===mwifiex driverinfo dump end===\n");
-   *drv_info = drv_info_dump;
-   return p - drv_info_dump;
+   adapter->devdump_len = p - (char *)adapter->devdump_data;
 }
 EXPORT_SYMBOL_GPL(mwifiex_drv_info_dump);
 
-void mwifiex_upload_device_dump(struct mwifiex_adapter *adapter, void 
*drv_info,
-   int drv_info_size)
+void mwifiex_prepare_fw_dump_info(struct mwifiex_adapter *adapter)
 {
-   u8 idx, *dump_data, *fw_dump_ptr;
-   u32 dump_len;
-
-   dump_len = (strlen("Start dump driverinfo\n") +
-  drv_info_size +
-  strlen("\nEnd dump\n"));
+   u8 idx;
+   char *fw_dump_ptr;
+   u32 dump_len = 0;
 
for (idx = 0; idx < adapter->num_mem_types; idx++) {
struct memory_type_mapping *entry =
@@ -1184,24 +1197,24 @@ void 

[PATCH v5 3/3] mwifiex: debugfs: trigger device dump for usb interface

2017-12-11 Thread Xinming Hu
This patch extend device_dump debugfs function to make it
works for usb interface.

For command timeouts, USB firmware will automatically emit
firmware dump events, so we don't implement device_dump().

For user-initiated dumps, we trigger it by issue firmware
dump event command to firmware, as there is no command
response, do not start 10s timer.

Signed-off-by: Xinming Hu 
Signed-off-by: Cathy Luo 
---
v2: Same as v1
v3: Add more comments Regards the different dump mechanism
between usb and other interfaces.(Brian Norris)
v5: Same as v3,v4
---
 drivers/net/wireless/marvell/mwifiex/cmdevt.c  | 11 +++
 drivers/net/wireless/marvell/mwifiex/debugfs.c | 13 +
 drivers/net/wireless/marvell/mwifiex/fw.h  |  1 +
 drivers/net/wireless/marvell/mwifiex/sta_cmd.c |  4 
 4 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c 
b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
index dcc529e..8746600 100644
--- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
@@ -290,13 +290,16 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private 
*priv,
adapter->dbg.last_cmd_act[adapter->dbg.last_cmd_index] =
get_unaligned_le16((u8 *)host_cmd + S_DS_GEN);
 
+   /* Setup the timer after transmit command, except that specific
+* command might not have command response.
+*/
+   if (cmd_code != HostCmd_CMD_FW_DUMP_EVENT)
+   mod_timer(>cmd_timer,
+ jiffies + msecs_to_jiffies(MWIFIEX_TIMER_10S));
+
/* Clear BSS_NO_BITS from HostCmd */
cmd_code &= HostCmd_CMD_ID_MASK;
 
-   /* Setup the timer after transmit command */
-   mod_timer(>cmd_timer,
- jiffies + msecs_to_jiffies(MWIFIEX_TIMER_10S));
-
return 0;
 }
 
diff --git a/drivers/net/wireless/marvell/mwifiex/debugfs.c 
b/drivers/net/wireless/marvell/mwifiex/debugfs.c
index 6f4239b..db2872d 100644
--- a/drivers/net/wireless/marvell/mwifiex/debugfs.c
+++ b/drivers/net/wireless/marvell/mwifiex/debugfs.c
@@ -168,10 +168,15 @@
 {
struct mwifiex_private *priv = file->private_data;
 
-   if (!priv->adapter->if_ops.device_dump)
-   return -EIO;
-
-   priv->adapter->if_ops.device_dump(priv->adapter);
+   /* For command timeouts, USB firmware will automatically emit
+* firmware dump events, so we don't implement device_dump().
+* For user-initiated dumps, we trigger it ourselves.
+*/
+   if (priv->adapter->iface_type == MWIFIEX_USB)
+   mwifiex_send_cmd(priv, HostCmd_CMD_FW_DUMP_EVENT,
+HostCmd_ACT_GEN_SET, 0, NULL, true);
+   else
+   priv->adapter->if_ops.device_dump(priv->adapter);
 
return 0;
 }
diff --git a/drivers/net/wireless/marvell/mwifiex/fw.h 
b/drivers/net/wireless/marvell/mwifiex/fw.h
index 4d5e686..9c2cdef 100644
--- a/drivers/net/wireless/marvell/mwifiex/fw.h
+++ b/drivers/net/wireless/marvell/mwifiex/fw.h
@@ -409,6 +409,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {
 #define HostCmd_CMD_TDLS_CONFIG   0x0100
 #define HostCmd_CMD_MC_POLICY 0x0121
 #define HostCmd_CMD_TDLS_OPER 0x0122
+#define HostCmd_CMD_FW_DUMP_EVENT0x0125
 #define HostCmd_CMD_SDIO_SP_RX_AGGR_CFG   0x0223
 #define HostCmd_CMD_CHAN_REGION_CFG  0x0242
 #define HostCmd_CMD_PACKET_AGGR_CTRL 0x0251
diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c 
b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
index fb09014..211e47d 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
@@ -2206,6 +2206,10 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private 
*priv, uint16_t cmd_no,
case HostCmd_CMD_CHAN_REGION_CFG:
ret = mwifiex_cmd_chan_region_cfg(priv, cmd_ptr, cmd_action);
break;
+   case HostCmd_CMD_FW_DUMP_EVENT:
+   cmd_ptr->command = cpu_to_le16(cmd_no);
+   cmd_ptr->size = cpu_to_le16(S_DS_GEN);
+   break;
default:
mwifiex_dbg(priv->adapter, ERROR,
"PREP_CMD: unknown cmd- %#x\n", cmd_no);
-- 
1.9.1



[PATCH v5 2/3] mwifiex: device dump support for usb interface

2017-12-11 Thread Xinming Hu
Firmware dump on usb interface is different with current
sdio/pcie chipset, which is based on register operation.

When firmware hang on usb interface, context dump will be
upload to host using 0x73 firmware debug event.

This patch store dump data from debug event and send to
userspace using device coredump API.

Signed-off-by: Xinming Hu 
Signed-off-by: Cathy Luo 
---
v2: Addressed below review comments from Brian Norris
a) Check for overflow introduced by invalid event.
b) Use end of transmission signal to recognize last event.
v5: Same as v2,v3,v4
---
 drivers/net/wireless/marvell/mwifiex/fw.h| 10 
 drivers/net/wireless/marvell/mwifiex/init.c  |  9 
 drivers/net/wireless/marvell/mwifiex/main.h  |  2 +
 drivers/net/wireless/marvell/mwifiex/sta_event.c | 61 
 4 files changed, 82 insertions(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/fw.h 
b/drivers/net/wireless/marvell/mwifiex/fw.h
index 13cd58e9..4d5e686 100644
--- a/drivers/net/wireless/marvell/mwifiex/fw.h
+++ b/drivers/net/wireless/marvell/mwifiex/fw.h
@@ -56,6 +56,15 @@ struct mwifiex_fw_data {
u8 data[1];
 } __packed;
 
+struct mwifiex_fw_dump_header {
+   __le16  seq_num;
+   __le16  reserved;
+   __le16  type;
+   __le16  len;
+} __packed;
+
+#define FW_DUMP_INFO_ENDED 0x0002
+
 #define MWIFIEX_FW_DNLD_CMD_1 0x1
 #define MWIFIEX_FW_DNLD_CMD_5 0x5
 #define MWIFIEX_FW_DNLD_CMD_6 0x6
@@ -570,6 +579,7 @@ enum mwifiex_channel_flags {
 #define EVENT_BG_SCAN_STOPPED   0x0065
 #define EVENT_REMAIN_ON_CHAN_EXPIRED0x005f
 #define EVENT_MULTI_CHAN_INFO   0x006a
+#define EVENT_FW_DUMP_INFO 0x0073
 #define EVENT_TX_STATUS_REPORT 0x0074
 #define EVENT_BT_COEX_WLAN_PARA_CHANGE 0X0076
 
diff --git a/drivers/net/wireless/marvell/mwifiex/init.c 
b/drivers/net/wireless/marvell/mwifiex/init.c
index b0d3d68..d239e92 100644
--- a/drivers/net/wireless/marvell/mwifiex/init.c
+++ b/drivers/net/wireless/marvell/mwifiex/init.c
@@ -64,6 +64,13 @@ static void wakeup_timer_fn(struct timer_list *t)
adapter->if_ops.card_reset(adapter);
 }
 
+static void fw_dump_timer_fn(struct timer_list *t)
+{
+   struct mwifiex_adapter *adapter = from_timer(adapter, t, devdump_timer);
+
+   mwifiex_upload_device_dump(adapter);
+}
+
 /*
  * This function initializes the private structure and sets default
  * values to the members.
@@ -315,6 +322,7 @@ static void mwifiex_init_adapter(struct mwifiex_adapter 
*adapter)
adapter->active_scan_triggered = false;
timer_setup(>wakeup_timer, wakeup_timer_fn, 0);
adapter->devdump_len = 0;
+   timer_setup(>devdump_timer, fw_dump_timer_fn, 0);
 }
 
 /*
@@ -397,6 +405,7 @@ static void mwifiex_invalidate_lists(struct mwifiex_adapter 
*adapter)
 mwifiex_adapter_cleanup(struct mwifiex_adapter *adapter)
 {
del_timer(>wakeup_timer);
+   del_timer_sync(>devdump_timer);
mwifiex_cancel_all_pending_cmd(adapter);
wake_up_interruptible(>cmd_wait_q.wait);
wake_up_interruptible(>hs_activate_wait_q);
diff --git a/drivers/net/wireless/marvell/mwifiex/main.h 
b/drivers/net/wireless/marvell/mwifiex/main.h
index 8b6241a..6b5539b 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.h
+++ b/drivers/net/wireless/marvell/mwifiex/main.h
@@ -1037,6 +1037,7 @@ struct mwifiex_adapter {
/* Device dump data/length */
void *devdump_data;
int devdump_len;
+   struct timer_list devdump_timer;
 };
 
 void mwifiex_process_tx_queue(struct mwifiex_adapter *adapter);
@@ -1682,6 +1683,7 @@ void mwifiex_process_multi_chan_event(struct 
mwifiex_private *priv,
 void mwifiex_multi_chan_resync(struct mwifiex_adapter *adapter);
 int mwifiex_set_mac_address(struct mwifiex_private *priv,
struct net_device *dev);
+void mwifiex_devdump_tmo_func(unsigned long function_context);
 
 #ifdef CONFIG_DEBUG_FS
 void mwifiex_debugfs_init(void);
diff --git a/drivers/net/wireless/marvell/mwifiex/sta_event.c 
b/drivers/net/wireless/marvell/mwifiex/sta_event.c
index d8db412..93dfb76 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_event.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_event.c
@@ -584,6 +584,62 @@ void mwifiex_bt_coex_wlan_param_update_event(struct 
mwifiex_private *priv,
adapter->coex_rx_win_size);
 }
 
+static void
+mwifiex_fw_dump_info_event(struct mwifiex_private *priv,
+  struct sk_buff *event_skb)
+{
+   struct mwifiex_adapter *adapter = priv->adapter;
+   struct mwifiex_fw_dump_header *fw_dump_hdr =
+   (void *)adapter->event_body;
+
+   if (adapter->iface_type != MWIFIEX_USB) {
+   mwifiex_dbg(adapter, MSG,
+   "event is not on usb interface, ignore it\n");
+   return;
+   }
+
+   if 

Re: rtl8723bu support on Complex 11t

2017-12-11 Thread Larry Finger

On 12/11/2017 06:59 PM, James Hemsing wrote:

Hello,

I have a Complex 11t tablet with this wireless card on USB. The kernel
driver supports it, but even at its best, it doesn't work at full
speed and frequently loses connections, whereas Windows 10 doesn't
have any problems. I'd be happy to test and debug code, and provide
whatever help I can to improve the driver for this device. Here is
some system information. The kernel I'm currently using is version
4.13.0 on Ubuntu 17.10.

Thanks,
James

[4.031513] Bluetooth: hci0: rtl: examining hci_ver=06 hci_rev=000b
lmp_ver=06 lmp_subver=8723
[4.031515] Bluetooth: hci0: rtl: loading rtl_bt/rtl8723b_config.bin
[4.032132] bluetooth hci0: Direct firmware load for
rtl_bt/rtl8723b_config.bin failed with error -2
[4.032136] Bluetooth: hci0: rtl: loading rtl_bt/rtl8723b_fw.bin
[4.160515] usb 1-6: rtl8723bu_parse_efuse: dumping efuse (0x200 bytes):
[4.160667] usb 1-6: RTL8723BU rev E (SMIC) 1T1R, TX queues 3,
WiFi=1, BT=1, GPS=0, HI PA=0
[4.160670] usb 1-6: RTL8723BU MAC: 7c:c7:09:69:b6:3a
[4.160674] usb 1-6: rtl8xxxu: Loading firmware rtlwifi/rtl8723bu_nic.bin
[5.038493] 8723bu: loading out-of-tree module taints kernel.
[5.039092] 8723bu: module verification failed: signature and/or
required key missing - tainting kernel


Why are you loading BOTH rtl8xxxu and 8723bu? The conflict between them will 
cause all kinds of problems.


Larry




linux-next: build failure after merge of the mac80211-next tree

2017-12-11 Thread Stephen Rothwell
Hi Johannes,

After merging the mac80211-next tree, today's linux-next build (x86_64
allmodconfig) failed like this:

drivers/net/wireless/mediatek/mt76/mt76x2_main.c:539:19: error: initialization 
from incompatible pointer type [-Werror=incompatible-pointer-types]
  .wake_tx_queue = mt76_wake_tx_queue,
   ^
drivers/net/wireless/mediatek/mt76/mt76x2_main.c:539:19: note: (near 
initialization for 'mt76x2_ops.wake_tx_queue')

Caused by commits

  17f1de56df05 ("mt76: add common code shared between multiple chipsets")
  7bc04215a66b ("mt76: add driver code for MT76x2e")

from the wireless-drivers-next tree interacting with commit

  e937b8da5a59 ("mac80211: Add TXQ scheduling API")

from the mac80211-next tree.

I applied the below hack merge fix ... please let me know if something
more/better is required.  Someone needs to remember to tell Dave when
these trees meet in his tree.

From: Stephen Rothwell 
Date: Tue, 12 Dec 2017 12:50:40 +1100
Subject: [PATCH] mt76: fix up for "mac80211: Add TXQ scheduling API"

Signed-off-by: Stephen Rothwell 
---
 drivers/net/wireless/mediatek/mt76/mt76.h |  2 +-
 drivers/net/wireless/mediatek/mt76/tx.c   | 10 +++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h 
b/drivers/net/wireless/mediatek/mt76/mt76.h
index aa0880bbea7f..e395d3859212 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -338,7 +338,7 @@ void mt76_tx(struct mt76_dev *dev, struct ieee80211_sta 
*sta,
 struct mt76_wcid *wcid, struct sk_buff *skb);
 void mt76_txq_init(struct mt76_dev *dev, struct ieee80211_txq *txq);
 void mt76_txq_remove(struct mt76_dev *dev, struct ieee80211_txq *txq);
-void mt76_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *txq);
+void mt76_wake_tx_queue(struct ieee80211_hw *hw);
 void mt76_stop_tx_queues(struct mt76_dev *dev, struct ieee80211_sta *sta,
 bool send_bar);
 void mt76_txq_schedule(struct mt76_dev *dev, struct mt76_queue *hwq);
diff --git a/drivers/net/wireless/mediatek/mt76/tx.c 
b/drivers/net/wireless/mediatek/mt76/tx.c
index 4eef69bd8a9e..ad414af0750f 100644
--- a/drivers/net/wireless/mediatek/mt76/tx.c
+++ b/drivers/net/wireless/mediatek/mt76/tx.c
@@ -463,12 +463,16 @@ void mt76_stop_tx_queues(struct mt76_dev *dev, struct 
ieee80211_sta *sta,
 }
 EXPORT_SYMBOL_GPL(mt76_stop_tx_queues);
 
-void mt76_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
+void mt76_wake_tx_queue(struct ieee80211_hw *hw)
 {
+   struct ieee80211_txq *txq;
struct mt76_dev *dev = hw->priv;
-   struct mt76_txq *mtxq = (struct mt76_txq *) txq->drv_priv;
-   struct mt76_queue *hwq = mtxq->hwq;
+   struct mt76_txq *mtxq;
+   struct mt76_queue *hwq;
 
+   txq = ieee80211_next_txq(hw);
+   mtxq = (struct mt76_txq *) txq->drv_priv;
+   hwq = mtxq->hwq;
spin_lock_bh(>lock);
if (list_empty(>list))
list_add_tail(>list, >swq);
-- 
2.15.0

-- 
Cheers,
Stephen Rothwell


rtl8723bu support on Complex 11t

2017-12-11 Thread James Hemsing
Hello,

I have a Complex 11t tablet with this wireless card on USB. The kernel
driver supports it, but even at its best, it doesn't work at full
speed and frequently loses connections, whereas Windows 10 doesn't
have any problems. I'd be happy to test and debug code, and provide
whatever help I can to improve the driver for this device. Here is
some system information. The kernel I'm currently using is version
4.13.0 on Ubuntu 17.10.

Thanks,
James

[4.031513] Bluetooth: hci0: rtl: examining hci_ver=06 hci_rev=000b
lmp_ver=06 lmp_subver=8723
[4.031515] Bluetooth: hci0: rtl: loading rtl_bt/rtl8723b_config.bin
[4.032132] bluetooth hci0: Direct firmware load for
rtl_bt/rtl8723b_config.bin failed with error -2
[4.032136] Bluetooth: hci0: rtl: loading rtl_bt/rtl8723b_fw.bin
[4.160515] usb 1-6: rtl8723bu_parse_efuse: dumping efuse (0x200 bytes):
[4.160667] usb 1-6: RTL8723BU rev E (SMIC) 1T1R, TX queues 3,
WiFi=1, BT=1, GPS=0, HI PA=0
[4.160670] usb 1-6: RTL8723BU MAC: 7c:c7:09:69:b6:3a
[4.160674] usb 1-6: rtl8xxxu: Loading firmware rtlwifi/rtl8723bu_nic.bin
[5.038493] 8723bu: loading out-of-tree module taints kernel.
[5.039092] 8723bu: module verification failed: signature and/or
required key missing - tainting kernel
[5.042286] RTL871X: module init start
[5.042289] RTL871X: rtl8723bu v4.3.6.11_12942.20141204_BTCOEX20140507-4E40
[5.042290] RTL871X: rtl8723bu BT-Coex version = BTCOEX20140507-4E40
[5.042331] usbcore: registered new interface driver rtl8723bu
[5.042332] RTL871X: module init ret=0
[  188.690578] Modules linked in: rfcomm ccm cmac bnep 8723bu(OE) arc4
snd_hda_codec_hdmi cmdlinepart intel_spi_platform intel_spi rtl8xxxu
spi_nor nls_iso8859_1 mtd rtsx_usb_ms mac80211 memstick btusb btrtl
btbcm cfg80211 btintel uvcvideo bluetooth videobuf2_vmalloc
videobuf2_memops videobuf2_v4l2 videobuf2_core videodev media
ecdh_generic intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp
kvm_intel kvm irqbypass crct10dif_pclmul crc32_pclmul
ghash_clmulni_intel pcbc aesni_intel aes_x86_64 crypto_simd
glue_helper cryptd intel_cstate intel_rapl_perf input_leds serio_raw
hid_multitouch snd_hda_codec_realtek snd_hda_codec_generic joydev
snd_soc_rt5640 snd_hda_intel intel_pch_thermal snd_hda_codec mei_me
mei lpc_ich snd_hda_core snd_soc_rl6231 processor_thermal_device
snd_hwdep snd_soc_ssm4567 intel_soc_dts_iosf
Linux butterscotch 4.13.0-16-generic #19-Ubuntu SMP Wed Oct 11
18:35:14 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux


Bus 001 Device 004: ID 0bda:b720 Realtek Semiconductor Corp.
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   2.10
  bDeviceClass  239 Miscellaneous Device
  bDeviceSubClass 2 ?
  bDeviceProtocol 1 Interface Association
  bMaxPacketSize064
  idVendor   0x0bda Realtek Semiconductor Corp.
  idProduct  0xb720
  bcdDevice2.00
  iManufacturer   1
  iProduct2
  iSerial 3
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength  236
bNumInterfaces  3
bConfigurationValue 1
iConfiguration  0
bmAttributes 0xe0
  Self Powered
  Remote Wakeup
MaxPower  500mA
Interface Association:
  bLength 8
  bDescriptorType11
  bFirstInterface 0
  bInterfaceCount 2
  bFunctionClass224 Wireless
  bFunctionSubClass   1 Radio Frequency
  bFunctionProtocol   1 Bluetooth
  iFunction   4
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   0
  bNumEndpoints   3
  bInterfaceClass   224 Wireless
  bInterfaceSubClass  1 Radio Frequency
  bInterfaceProtocol  1 Bluetooth
  iInterface  4
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81  EP 1 IN
bmAttributes3
  Transfer TypeInterrupt
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0010  1x 16 bytes
bInterval   4
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02  EP 2 OUT
bmAttributes2
  Transfer TypeBulk
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0200  1x 512 bytes
bInterval   0
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82  EP 2 IN
bmAttributes2
  Transfer Type

nl80211: Remove obsolete kerneldoc line

2017-12-11 Thread Jonathan Corbet
Commit ca986ad9bcd3 (nl80211: allow multiple active scheduled scan
requests) removed WIPHY_FLAG_SUPPORTS_SCHED_SCAN but left the kerneldoc
description in place, leading to this docs-build warning:

   ./include/net/cfg80211.h:3278: warning: Excess enum value
   'WIPHY_FLAG_SUPPORTS_SCHED_SCAN' description in 'wiphy_flags'

Remove the line and gain a bit of peace.

Signed-off-by: Jonathan Corbet 
---
 include/net/cfg80211.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 8b8118a7fadb..cb4d92b79cd9 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3226,7 +3226,6 @@ struct cfg80211_ops {
  * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
  * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
  * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
- * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans.
  * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
  * firmware.
  * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
-- 
2.14.3



ieee80211 phy0: rt2x00queue_write_tx_frame: Error - Dropping frame due to full tx queue...?

2017-12-11 Thread Enrico Mioso

Hello guys, and sorry for the big CC list.
I would like to point out about a bug who survived for years - at least from 
2015 until now, regarding the Ralink driver getting stuck, and in some cases 
not being able to recover.
The problem manifested with an MT7620A chip, and the wireless card inside the 
WL-330N3G device.
The error message is in rt2x00/rt2x00queue.c .

This bug was discussed, and a patch proposed, in this thread:
https://lists.openwrt.org/pipermail/openwrt-devel/2015-September/thread.html#35778

I would like to help if possible - I have the have both an Archer MR200, and 
the WL330n3G hardware.
BTW, the Archer MR200 is a nice MT7610 device, and the problem manifests 
itself, see:
https://forum.openwrt.org/viewtopic.php?id=64293=6

Any help, hint, anything would be apreciated.
thank you to all.

Enrico


Re: [PATCH v2] wcn36xx: Fix dynamic power saving

2017-12-11 Thread Loic Poulain
Hi Ramon,

On 11 December 2017 at 16:41, Bjorn Andersson
 wrote:
> On Mon 11 Dec 07:34 PST 2017, Ramon Fried wrote:
>
>> On Mon, Dec 11, 2017 at 10:52:22AM +0200, Loic Poulain wrote:
>> > Since driver does not report hardware dynamic power saving cap,
>> > this is up to the mac80211 to manage power saving timeout and
>> > state machine, using the ieee80211 config callback to report
>> > PS changes. This patch enables/disables PS mode according to
>> > the new configuration.
>> >
>> > Remove old behaviour enabling PS mode in a static way, this make
>> > the device unusable when power save is enabled since device is
>> > forced to PS regardless RX/TX traffic.
>> >
>>
>> Hi.
>> I tried to see if this patch solves the ping delay once power save is
>> turned on and it appears it doesn't (log below).
>> I do see some change in the delay though in comparison to testing without 
>> the patch.
>> Bjorn, How did you test it ?

For me this is the expected behavior, when station is in PS mode, some
time is required
to leave PS, this is the cost for saving power. Since ping is every
second, station goes
back to PS between each ping due to dynamic PS timeout, this indeed
leads to some
latency... I obtain same kind of results pinging my mobile phone. Note
that the PS
timeout can be changed (100ms by default).

>>
>
> Without this patch I get ping times around a second and SSH is not
> usable, with this patch I see similar ping times as you, but SSH is
> usable.
>
> I have not been able to run iperf, because I keep hitting
> https://bugs.96boards.org/show_bug.cgi?id=663

Yes, improvement can be mainly observed with high traffic.

Regards,
Loic


Re: [PATCH 1/1] rtlwifi: always initialize variables given to RT_TRACE()

2017-12-11 Thread Larry Finger

On 12/10/2017 01:51 PM, Nicolas Iooss wrote:

In rtl_rx_ampdu_apply(), when rtlpriv->cfg->ops->get_btc_status()
returns false, RT_TRACE() is called with the values of variables
reject_agg and agg_size, which have not been initialized.

Always initialize these variables in order to prevent using
uninitialized values.

This issue has been found with clang. The compiler reported:

 drivers/net/wireless/realtek/rtlwifi/base.c:1665:6: error: variable
 'agg_size' is used uninitialized whenever 'if' condition is false
 [-Werror,-Wsometimes-uninitialized]
 if (rtlpriv->cfg->ops->get_btc_status())
 ^~~
 drivers/net/wireless/realtek/rtlwifi/base.c:1671:31: note:
 uninitialized use occurs here
  reject_agg, ctrl_agg_size, agg_size);
 ^~~~

 drivers/net/wireless/realtek/rtlwifi/base.c:1665:6: error: variable
 'reject_agg' is used uninitialized whenever 'if' condition
   is false [-Werror,-Wsometimes-uninitialized]
 if (rtlpriv->cfg->ops->get_btc_status())
 ^~~
 drivers/net/wireless/realtek/rtlwifi/base.c:1671:4: note:
 uninitialized use occurs here
  reject_agg, ctrl_agg_size, agg_size);
  ^~

Fixes: 2635664e6e4a ("rtlwifi: Add rx ampdu cfg for btcoexist.")
Signed-off-by: Nicolas Iooss 


Looks good. Acked-by: Larry Finger 

Thanks,

Larry


---
  drivers/net/wireless/realtek/rtlwifi/base.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c 
b/drivers/net/wireless/realtek/rtlwifi/base.c
index cad2272ae21b..704741d6f495 100644
--- a/drivers/net/wireless/realtek/rtlwifi/base.c
+++ b/drivers/net/wireless/realtek/rtlwifi/base.c
@@ -1726,7 +1726,7 @@ int rtl_tx_agg_oper(struct ieee80211_hw *hw,
  void rtl_rx_ampdu_apply(struct rtl_priv *rtlpriv)
  {
struct rtl_btc_ops *btc_ops = rtlpriv->btcoexist.btc_ops;
-   u8 reject_agg, ctrl_agg_size = 0, agg_size;
+   u8 reject_agg = 0, ctrl_agg_size = 0, agg_size = 0;
  
  	if (rtlpriv->cfg->ops->get_btc_status())

btc_ops->btc_get_ampdu_cfg(rtlpriv, _agg,





Re: 76f43b4 fix for stable

2017-12-11 Thread David Miller
From: Richard Schütz 
Date: Mon, 11 Dec 2017 14:51:33 +0100

> as per netdev-FAQ.txt I'm requesting the submission of commit
> 57629915d568c522ac1422df7bba4bee5b5c7a7c ("mac80211: Fix addition of
> mesh configuration element") to stable. Because of automatic selection
> commit 76f43b4c0a9337af22827d78de4f2b8fd5328489 ("mac80211: Remove
> invalid flag operations in mesh TSF synchronization") was introduced
> into stable recently without this accompanying fix.

Johannes, please take care of this.

Thank you.


Re: [PATCH v2] wcn36xx: Fix dynamic power saving

2017-12-11 Thread Bjorn Andersson
On Mon 11 Dec 07:34 PST 2017, Ramon Fried wrote:

> On Mon, Dec 11, 2017 at 10:52:22AM +0200, Loic Poulain wrote:
> > Since driver does not report hardware dynamic power saving cap,
> > this is up to the mac80211 to manage power saving timeout and
> > state machine, using the ieee80211 config callback to report
> > PS changes. This patch enables/disables PS mode according to
> > the new configuration.
> > 
> > Remove old behaviour enabling PS mode in a static way, this make
> > the device unusable when power save is enabled since device is
> > forced to PS regardless RX/TX traffic.
> > 
> 
> Hi.
> I tried to see if this patch solves the ping delay once power save is
> turned on and it appears it doesn't (log below).
> I do see some change in the delay though in comparison to testing without the 
> patch.
> Bjorn, How did you test it ?
> 

Without this patch I get ping times around a second and SSH is not
usable, with this patch I see similar ping times as you, but SSH is
usable.

I have not been able to run iperf, because I keep hitting
https://bugs.96boards.org/show_bug.cgi?id=663

Regards,
Bjorn


Re: [PATCH v2] wcn36xx: Fix dynamic power saving

2017-12-11 Thread Ramon Fried
On Mon, Dec 11, 2017 at 10:52:22AM +0200, Loic Poulain wrote:
> Since driver does not report hardware dynamic power saving cap,
> this is up to the mac80211 to manage power saving timeout and
> state machine, using the ieee80211 config callback to report
> PS changes. This patch enables/disables PS mode according to
> the new configuration.
> 
> Remove old behaviour enabling PS mode in a static way, this make
> the device unusable when power save is enabled since device is
> forced to PS regardless RX/TX traffic.
> 

Hi.
I tried to see if this patch solves the ping delay once power save is
turned on and it appears it doesn't (log below).
I do see some change in the delay though in comparison to testing without the 
patch.
Bjorn, How did you test it ?

Thanks, Ramon.


root@dragonboard-410c:~# ping 192.168.0.1
PING 192.168.0.1 (192.168.0.1): 56 data bytes
64 bytes from 192.168.0.1: seq=0 ttl=64 time=2.688 ms
64 bytes from 192.168.0.1: seq=1 ttl=64 time=1.593 ms
64 bytes from 192.168.0.1: seq=2 ttl=64 time=1.581 ms
64 bytes from 192.168.0.1: seq=3 ttl=64 time=1.466 ms
64 bytes from 192.168.0.1: seq=4 ttl=64 time=1.625 ms
64 bytes from 192.168.0.1: seq=5 ttl=64 time=1.620 ms
64 bytes from 192.168.0.1: seq=6 ttl=64 time=2.907 ms
64 bytes from 192.168.0.1: seq=7 ttl=64 time=1.426 ms
64 bytes from 192.168.0.1: seq=8 ttl=64 time=1.521 ms
64 bytes from 192.168.0.1: seq=9 ttl=64 time=1.543 ms
64 bytes from 192.168.0.1: seq=10 ttl=64 time=6.804 ms
64 bytes from 192.168.0.1: seq=11 ttl=64 time=1.562 ms
64 bytes from 192.168.0.1: seq=12 ttl=64 time=3.148 ms
64 bytes from 192.168.0.1: seq=13 ttl=64 time=1.568 ms
64 bytes from 192.168.0.1: seq=14 ttl=64 time=1.491 ms
64 bytes from 192.168.0.1: seq=15 ttl=64 time=2.884 ms
64 bytes from 192.168.0.1: seq=16 ttl=64 time=1.669 ms
64 bytes from 192.168.0.1: seq=17 ttl=64 time=1.556 ms
64 bytes from 192.168.0.1: seq=18 ttl=64 time=1.487 ms
64 bytes from 192.168.0.1: seq=19 ttl=64 time=1.377 ms
64 bytes from 192.168.0.1: seq=20 ttl=64 time=1.534 ms
^C
--- 192.168.0.1 ping statistics ---
21 packets transmitted, 21 packets received, 0% packet loss
round-trip min/avg/max = 1.377/2.050/6.804 ms
root@dragonboard-410c:~# iw dev wlan0 set power_save on
root@dragonboard-410c:~# ping 192.168.0.1
PING 192.168.0.1 (192.168.0.1): 56 data bytes
64 bytes from 192.168.0.1: seq=0 ttl=64 time=4.849 ms
64 bytes from 192.168.0.1: seq=1 ttl=64 time=11.250 ms
64 bytes from 192.168.0.1: seq=2 ttl=64 time=11.402 ms
64 bytes from 192.168.0.1: seq=3 ttl=64 time=11.732 ms
64 bytes from 192.168.0.1: seq=4 ttl=64 time=10.076 ms
64 bytes from 192.168.0.1: seq=5 ttl=64 time=11.532 ms
64 bytes from 192.168.0.1: seq=6 ttl=64 time=15.479 ms
64 bytes from 192.168.0.1: seq=7 ttl=64 time=11.318 ms
64 bytes from 192.168.0.1: seq=8 ttl=64 time=13.299 ms
64 bytes from 192.168.0.1: seq=9 ttl=64 time=11.068 ms
64 bytes from 192.168.0.1: seq=10 ttl=64 time=11.087 ms
64 bytes from 192.168.0.1: seq=11 ttl=64 time=11.362 ms
64 bytes from 192.168.0.1: seq=12 ttl=64 time=11.341 ms
64 bytes from 192.168.0.1: seq=13 ttl=64 time=15.945 ms
64 bytes from 192.168.0.1: seq=14 ttl=64 time=11.318 ms
64 bytes from 192.168.0.1: seq=15 ttl=64 time=11.343 ms
64 bytes from 192.168.0.1: seq=16 ttl=64 time=11.378 ms
64 bytes from 192.168.0.1: seq=17 ttl=64 time=7.693 ms
64 bytes from 192.168.0.1: seq=18 ttl=64 time=11.703 ms
64 bytes from 192.168.0.1: seq=19 ttl=64 time=11.528 ms
64 bytes from 192.168.0.1: seq=20 ttl=64 time=12.008 ms
64 bytes from 192.168.0.1: seq=21 ttl=64 time=11.522 ms
64 bytes from 192.168.0.1: seq=22 ttl=64 time=12.949 ms
64 bytes from 192.168.0.1: seq=23 ttl=64 time=12.056 ms
64 bytes from 192.168.0.1: seq=24 ttl=64 time=13.097 ms
64 bytes from 192.168.0.1: seq=25 ttl=64 time=11.638 ms
^C
--- 192.168.0.1 ping statistics ---


> Acked-by: Bjorn Andersson 
> Signed-off-by: Loic Poulain 
> ---
>  v2: remove error msg on unbalanced bmps exit
>  return -EALREADY if not in bmps mode
> 
>  drivers/net/wireless/ath/wcn36xx/main.c | 23 ---
>  drivers/net/wireless/ath/wcn36xx/pmc.c  |  6 --
>  2 files changed, 16 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/wcn36xx/main.c
> b/drivers/net/wireless/ath/wcn36xx/main.c
> index f0b4d43..436b8ea 100644
> --- a/drivers/net/wireless/ath/wcn36xx/main.c
> +++ b/drivers/net/wireless/ath/wcn36xx/main.c
> @@ -384,6 +384,18 @@ static int wcn36xx_config(struct ieee80211_hw *hw,
> u32 changed)
>   }
>   }
>  
> + if (changed & IEEE80211_CONF_CHANGE_PS) {
> + list_for_each_entry(tmp, >vif_list, list) {
> + vif = wcn36xx_priv_to_vif(tmp);
> + if (hw->conf.flags & IEEE80211_CONF_PS) {
> + if (vif->bss_conf.ps) /* ps allowed ? */
> + wcn36xx_pmc_enter_bmps_state(wcn,
> vif);
> + } else {
> + 

Re: pull-request: mac80211 2017-12-11

2017-12-11 Thread David Miller
From: Johannes Berg 
Date: Mon, 11 Dec 2017 10:52:35 +0100

> Three fixes, two related to build issues with the new regdb stuff,
> and one for some patch overlap problem that caused locking to be
> missing which in turn caused lots of warnings.
> 
> Please pull and let me know if there's any problem.

Pulled, thanks.


Re: [PATCH] ath10k: Add BMI parameters to fix calibration from DT/pre-cal

2017-12-11 Thread Sven Eckelmann
On Montag, 11. Dezember 2017 18:50:09 CET ako...@codeaurora.org wrote:
[...]
> >> > Just tried this on an QCA9984 which doesn't seem to have the
> >> > calibration data in the PCI EEPROM.
> >> >
> >> > [   71.728929] ath10k_pci :01:00.0: qca9984/qca9994 hw1.0
> >> > target 0x0100 chip_id 0x sub 168c:cafe
> >> > [   71.732926] ath10k_pci :01:00.0: kconfig debug 1 debugfs 1
> >> > tracing 0 dfs 1 testmode 1
> >> > [   71.752282] ath10k_pci :01:00.0: firmware ver
> >> > 10.4-ct-9984-fW-009-dfa0083 api 5 features peer-flow-ctrl crc32
> >> > 7198d117
> >> > [   73.805730] ath10k_pci :01:00.0: unable to read from the
> >> > device
> >> > [   73.805769] ath10k_pci :01:00.0: could not execute otp for
> >> > board id check: -110
[...]
> 
> I tested this on QCA9984 and it worked with below config,
[...]
> 
> Kindly try with the latest firmware from Kalle's git mentioned above.

This didn't change the behavior. It was actually the OTP timeout problem on 
the QCA9984 which Ben Greear fixed [1]. Luckily, LEDE added this patch with 
your patch [2]

Kind regards,
Sven

[1] 
https://git.lede-project.org/?p=source.git;a=blob;f=package/kernel/mac80211/patches/327-ath10k-increase-BMI-timeout.patch;h=c9f493bcd8fe29afe1e08dc31b6370507b95fc72;hb=025cb640cdf27f7c68fc1d89d0698605daa06c43
[2] 
https://git.lede-project.org/?p=source.git;a=commit;h=025cb640cdf27f7c68fc1d89d0698605daa06c43

signature.asc
Description: This is a digitally signed message part.


[PATCH v3 1/4] ath10k: WMI: modify svc bitmap parsing for wcn3990

2017-12-11 Thread Rakesh Pillai
Due to the limitation of wmi tlv parsing logic, if there are
two parameters in a wmi event with same tlv tag, we can get only
the last value, as it overwrites the prev value of the same tlv tag.

The service ready event in wcn3990 contains two parameters of the
same tag UINT32, due to which the svc bitmap is overwritten with the
DBS support parameter.

Refactor the service ready event parsing to allow parsing two tlv
of the same tag UINT32 for wcn3990.

Signed-off-by: Rakesh Pillai 
Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/mac.c |  4 +-
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 61 ---
 drivers/net/wireless/ath/ath10k/wmi-tlv.h | 46 +++
 drivers/net/wireless/ath/ath10k/wmi.h |  1 +
 4 files changed, 97 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 6dbf8a2453ba..5719b3f51aa8 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -3574,7 +3574,9 @@ ath10k_mac_tx_h_get_txpath(struct ath10k *ar,
return ATH10K_MAC_TX_HTT;
case ATH10K_HW_TXRX_MGMT:
if (test_bit(ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX,
-ar->running_fw->fw_file.fw_features))
+ar->running_fw->fw_file.fw_features) ||
+test_bit(WMI_SERVICE_MGMT_TX_WMI,
+ ar->wmi.svc_map))
return ATH10K_MAC_TX_WMI_MGMT;
else if (ar->htt.target_version_major >= 3)
return ATH10K_MAC_TX_HTT;
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index 7616c1c4bbd3..c3683bc5a6a4 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -917,33 +917,69 @@ ath10k_wmi_tlv_parse_mem_reqs(struct ath10k *ar, u16 tag, 
u16 len,
return -ENOMEM;
 }
 
+struct wmi_tlv_svc_rdy_parse {
+   const struct hal_reg_capabilities *reg;
+   const struct wmi_tlv_svc_rdy_ev *ev;
+   const __le32 *svc_bmap;
+   const struct wlan_host_mem_req *mem_reqs;
+   bool svc_bmap_done;
+   bool dbs_hw_mode_done;
+};
+
+static int ath10k_wmi_tlv_svc_rdy_parse(struct ath10k *ar, u16 tag, u16 len,
+   const void *ptr, void *data)
+{
+   struct wmi_tlv_svc_rdy_parse *svc_rdy = data;
+
+   switch (tag) {
+   case WMI_TLV_TAG_STRUCT_SERVICE_READY_EVENT:
+   svc_rdy->ev = ptr;
+   break;
+   case WMI_TLV_TAG_STRUCT_HAL_REG_CAPABILITIES:
+   svc_rdy->reg = ptr;
+   break;
+   case WMI_TLV_TAG_ARRAY_STRUCT:
+   svc_rdy->mem_reqs = ptr;
+   break;
+   case WMI_TLV_TAG_ARRAY_UINT32:
+   if (!svc_rdy->svc_bmap_done) {
+   svc_rdy->svc_bmap_done = true;
+   svc_rdy->svc_bmap = ptr;
+   } else if (!svc_rdy->dbs_hw_mode_done) {
+   svc_rdy->dbs_hw_mode_done = true;
+   }
+   break;
+   default:
+   break;
+   }
+   return 0;
+}
+
 static int ath10k_wmi_tlv_op_pull_svc_rdy_ev(struct ath10k *ar,
 struct sk_buff *skb,
 struct wmi_svc_rdy_ev_arg *arg)
 {
-   const void **tb;
const struct hal_reg_capabilities *reg;
const struct wmi_tlv_svc_rdy_ev *ev;
const __le32 *svc_bmap;
const struct wlan_host_mem_req *mem_reqs;
+   struct wmi_tlv_svc_rdy_parse svc_rdy = { };
int ret;
 
-   tb = ath10k_wmi_tlv_parse_alloc(ar, skb->data, skb->len, GFP_ATOMIC);
-   if (IS_ERR(tb)) {
-   ret = PTR_ERR(tb);
+   ret = ath10k_wmi_tlv_iter(ar, skb->data, skb->len,
+ ath10k_wmi_tlv_svc_rdy_parse, _rdy);
+   if (ret) {
ath10k_warn(ar, "failed to parse tlv: %d\n", ret);
return ret;
}
 
-   ev = tb[WMI_TLV_TAG_STRUCT_SERVICE_READY_EVENT];
-   reg = tb[WMI_TLV_TAG_STRUCT_HAL_REG_CAPABILITIES];
-   svc_bmap = tb[WMI_TLV_TAG_ARRAY_UINT32];
-   mem_reqs = tb[WMI_TLV_TAG_ARRAY_STRUCT];
+   ev = svc_rdy.ev;
+   reg = svc_rdy.reg;
+   svc_bmap = svc_rdy.svc_bmap;
+   mem_reqs = svc_rdy.mem_reqs;
 
-   if (!ev || !reg || !svc_bmap || !mem_reqs) {
-   kfree(tb);
+   if (!ev || !reg || !svc_bmap || !mem_reqs)
return -EPROTO;
-   }
 
/* This is an internal ABI compatibility check for WMI TLV so check it
 * here instead of the generic WMI code.
@@ -961,7 +997,6 @@ static int ath10k_wmi_tlv_op_pull_svc_rdy_ev(struct ath10k 
*ar,
__le32_to_cpu(ev->abi.abi_ver_ns1) != 

[PATCH v3 3/4] ath10k: WMI: get wmi init parameter values from hw params

2017-12-11 Thread Rakesh Pillai
The parameter values for skid limit, number of peers and wds
entries values which are sent in wmi init cmd are hardware
specific.

Add support to obtain skid limit, number of peers and wds entries
values from hw params which will have the hw specific values
for these parameters.

Signed-off-by: Rakesh Pillai 
Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/core.c| 36 +++
 drivers/net/wireless/ath/ath10k/hw.h  |  4 
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |  7 +++---
 3 files changed, 44 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 1e4e18e5edcb..be189132623d 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -75,6 +75,9 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] 
= {
.vht160_mcs_rx_highest = 0,
.vht160_mcs_tx_highest = 0,
.n_cipher_suites = 8,
+   .num_peers = TARGET_TLV_NUM_PEERS,
+   .ast_skid_limit = 0x10,
+   .num_wds_entries = 0x20,
},
{
.id = QCA9887_HW_1_0_VERSION,
@@ -99,6 +102,9 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] 
= {
.vht160_mcs_rx_highest = 0,
.vht160_mcs_tx_highest = 0,
.n_cipher_suites = 8,
+   .num_peers = TARGET_TLV_NUM_PEERS,
+   .ast_skid_limit = 0x10,
+   .num_wds_entries = 0x20,
},
{
.id = QCA6174_HW_2_1_VERSION,
@@ -122,6 +128,9 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.vht160_mcs_rx_highest = 0,
.vht160_mcs_tx_highest = 0,
.n_cipher_suites = 8,
+   .num_peers = TARGET_TLV_NUM_PEERS,
+   .ast_skid_limit = 0x10,
+   .num_wds_entries = 0x20,
},
{
.id = QCA6174_HW_2_1_VERSION,
@@ -145,6 +154,9 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.vht160_mcs_rx_highest = 0,
.vht160_mcs_tx_highest = 0,
.n_cipher_suites = 8,
+   .num_peers = TARGET_TLV_NUM_PEERS,
+   .ast_skid_limit = 0x10,
+   .num_wds_entries = 0x20,
},
{
.id = QCA6174_HW_3_0_VERSION,
@@ -168,6 +180,9 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.vht160_mcs_rx_highest = 0,
.vht160_mcs_tx_highest = 0,
.n_cipher_suites = 8,
+   .num_peers = TARGET_TLV_NUM_PEERS,
+   .ast_skid_limit = 0x10,
+   .num_wds_entries = 0x20,
},
{
.id = QCA6174_HW_3_2_VERSION,
@@ -194,6 +209,9 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.vht160_mcs_rx_highest = 0,
.vht160_mcs_tx_highest = 0,
.n_cipher_suites = 8,
+   .num_peers = TARGET_TLV_NUM_PEERS,
+   .ast_skid_limit = 0x10,
+   .num_wds_entries = 0x20,
},
{
.id = QCA99X0_HW_2_0_DEV_VERSION,
@@ -223,6 +241,9 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.vht160_mcs_rx_highest = 0,
.vht160_mcs_tx_highest = 0,
.n_cipher_suites = 11,
+   .num_peers = TARGET_TLV_NUM_PEERS,
+   .ast_skid_limit = 0x10,
+   .num_wds_entries = 0x20,
},
{
.id = QCA9984_HW_1_0_DEV_VERSION,
@@ -257,6 +278,9 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.vht160_mcs_rx_highest = 1560,
.vht160_mcs_tx_highest = 1560,
.n_cipher_suites = 11,
+   .num_peers = TARGET_TLV_NUM_PEERS,
+   .ast_skid_limit = 0x10,
+   .num_wds_entries = 0x20,
},
{
.id = QCA9888_HW_2_0_DEV_VERSION,
@@ -290,6 +314,9 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.vht160_mcs_rx_highest = 780,
.vht160_mcs_tx_highest = 780,
.n_cipher_suites = 11,
+   .num_peers = TARGET_TLV_NUM_PEERS,
+   .ast_skid_limit = 0x10,
+   .num_wds_entries = 0x20,
},
{
.id = QCA9377_HW_1_0_DEV_VERSION,
@@ -313,6 +340,9 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.vht160_mcs_rx_highest = 0,
.vht160_mcs_tx_highest = 0,
.n_cipher_suites = 8,
+   .num_peers = TARGET_TLV_NUM_PEERS,
+   .ast_skid_limit = 0x10,
+   .num_wds_entries = 0x20,
},
{
.id = 

[PATCH v3 0/4] WMI changes for wcn3990

2017-12-11 Thread Rakesh Pillai
This patchset includes the WMI changes for wcn3390 to
Refactor service ready event parsing,
Add management frame tx by refernce over wmi,
Add hw parameters for wcn3990.

Changes since v2
- Fix ath-check warnings
  1) Using plain integer as NULL pointer
  2) incorrect type in assignment 
  3) braces {} are not necessary for single statement blocks

Rakesh Pillai (4):
  ath10k: WMI: modify svc bitmap parsing for wcn3990
  ath10k: WMI: Add management tx by reference support over wmi
  ath10k: WMI: get wmi init parameter values from hw params
  ath10k: WMI: add hw params entry for wcn3990

 drivers/net/wireless/ath/ath10k/core.c|  55 +++
 drivers/net/wireless/ath/ath10k/core.h|   3 +
 drivers/net/wireless/ath/ath10k/hw.c  |   2 +
 drivers/net/wireless/ath/ath10k/hw.h  |  14 +++
 drivers/net/wireless/ath/ath10k/mac.c |   4 +-
 drivers/net/wireless/ath/ath10k/wmi-ops.h |   9 +-
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 146 ++
 drivers/net/wireless/ath/ath10k/wmi-tlv.h | 113 +++
 drivers/net/wireless/ath/ath10k/wmi.h |   2 +
 9 files changed, 329 insertions(+), 19 deletions(-)

-- 
2.11.0



[PATCH v3 2/4] ath10k: WMI: Add management tx by reference support over wmi

2017-12-11 Thread Rakesh Pillai
HL1.0 firmware branch, used in wcn3990, transmits management
frames by reference over WMI.

Add support for management tx by reference over WMI.

Signed-off-by: Rakesh Pillai 
Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/core.c|  1 +
 drivers/net/wireless/ath/ath10k/core.h|  3 ++
 drivers/net/wireless/ath/ath10k/wmi-ops.h |  9 +++-
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 78 +++
 drivers/net/wireless/ath/ath10k/wmi-tlv.h | 67 ++
 drivers/net/wireless/ath/ath10k/wmi.h |  1 +
 6 files changed, 158 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index b29fdbd21ead..1e4e18e5edcb 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -390,6 +390,7 @@ static const char *const ath10k_core_fw_feature_str[] = {
[ATH10K_FW_FEATURE_SKIP_NULL_FUNC_WAR] = "skip-null-func-war",
[ATH10K_FW_FEATURE_ALLOWS_MESH_BCAST] = "allows-mesh-bcast",
[ATH10K_FW_FEATURE_NO_PS] = "no-ps",
+   [ATH10K_FW_FEATURE_MGMT_TX_BY_REF] = "mgmt-tx-by-reference",
 };
 
 static unsigned int ath10k_core_get_fw_feature_str(char *buf,
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 643041ef3271..30c4c07658d5 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -615,6 +615,9 @@ enum ath10k_fw_features {
/* Firmware does not support power save in station mode. */
ATH10K_FW_FEATURE_NO_PS = 17,
 
+   /* Firmware allows management tx by reference instead of by value. */
+   ATH10K_FW_FEATURE_MGMT_TX_BY_REF = 18,
+
/* keep last */
ATH10K_FW_FEATURE_COUNT,
 };
diff --git a/drivers/net/wireless/ath/ath10k/wmi-ops.h 
b/drivers/net/wireless/ath/ath10k/wmi-ops.h
index 2fc3f24ff1ca..41eef942ab2c 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h
@@ -377,6 +377,7 @@ ath10k_wmi_mgmt_tx(struct ath10k *ar, struct sk_buff *msdu)
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(msdu);
struct sk_buff *skb;
int ret;
+   u32 mgmt_tx_cmdid;
 
if (!ar->wmi.ops->gen_mgmt_tx)
return -EOPNOTSUPP;
@@ -385,7 +386,13 @@ ath10k_wmi_mgmt_tx(struct ath10k *ar, struct sk_buff *msdu)
if (IS_ERR(skb))
return PTR_ERR(skb);
 
-   ret = ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->mgmt_tx_cmdid);
+   if (test_bit(ATH10K_FW_FEATURE_MGMT_TX_BY_REF,
+ar->running_fw->fw_file.fw_features))
+   mgmt_tx_cmdid = ar->wmi.cmd->mgmt_tx_send_cmdid;
+   else
+   mgmt_tx_cmdid = ar->wmi.cmd->mgmt_tx_cmdid;
+
+   ret = ath10k_wmi_cmd_send(ar, skb, mgmt_tx_cmdid);
if (ret)
return ret;
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index c3683bc5a6a4..9910cc65af90 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -2483,6 +2483,82 @@ ath10k_wmi_tlv_op_gen_request_stats(struct ath10k *ar, 
u32 stats_mask)
 }
 
 static struct sk_buff *
+ath10k_wmi_tlv_op_gen_mgmt_tx(struct ath10k *ar, struct sk_buff *msdu)
+{
+   struct ath10k_skb_cb *cb = ATH10K_SKB_CB(msdu);
+   struct wmi_tlv_mgmt_tx_cmd *cmd;
+   struct wmi_tlv *tlv;
+   struct ieee80211_hdr *hdr;
+   struct sk_buff *skb;
+   void *ptr;
+   int len;
+   u32 buf_len = msdu->len;
+   u16 fc;
+   struct ath10k_vif *arvif;
+   dma_addr_t mgmt_frame_dma;
+   u32 vdev_id;
+
+   if (!cb->vif)
+   return ERR_PTR(-EINVAL);
+
+   hdr = (struct ieee80211_hdr *)msdu->data;
+   fc = le16_to_cpu(hdr->frame_control);
+   arvif = (void *)cb->vif->drv_priv;
+   vdev_id = arvif->vdev_id;
+
+   if (WARN_ON_ONCE(!ieee80211_is_mgmt(hdr->frame_control)))
+   return ERR_PTR(-EINVAL);
+
+   len = sizeof(*cmd) + 2 * sizeof(*tlv);
+
+   if ((ieee80211_is_action(hdr->frame_control) ||
+ieee80211_is_deauth(hdr->frame_control) ||
+ieee80211_is_disassoc(hdr->frame_control)) &&
+ieee80211_has_protected(hdr->frame_control)) {
+   len += IEEE80211_CCMP_MIC_LEN;
+   buf_len += IEEE80211_CCMP_MIC_LEN;
+   }
+
+   buf_len = min_t(u32, buf_len, WMI_TLV_MGMT_TX_FRAME_MAX_LEN);
+   buf_len = round_up(buf_len, 4);
+
+   len += buf_len;
+   len = round_up(len, 4);
+   skb = ath10k_wmi_alloc_skb(ar, len);
+   if (!skb)
+   return ERR_PTR(-ENOMEM);
+
+   ptr = (void *)skb->data;
+   tlv = ptr;
+   tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_MGMT_TX_CMD);
+   tlv->len = __cpu_to_le16(sizeof(*cmd));
+   cmd = (void *)tlv->value;
+   

[PATCH v3 4/4] ath10k: WMI: add hw params entry for wcn3990

2017-12-11 Thread Rakesh Pillai
Add hw params entry for wcn3990 and populate various
target specific values for wcn3990.

Signed-off-by: Rakesh Pillai 
Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/core.c | 18 ++
 drivers/net/wireless/ath/ath10k/hw.c   |  2 ++
 drivers/net/wireless/ath/ath10k/hw.h   | 10 ++
 3 files changed, 30 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index be189132623d..6abffb530027 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -405,6 +405,24 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.ast_skid_limit = 0x10,
.num_wds_entries = 0x20,
},
+   {
+   .id = WCN3990_HW_1_0_DEV_VERSION,
+   .dev_id = 0,
+   .name = "wcn3990 hw1.0",
+   .continuous_frag_desc = true,
+   .tx_chain_mask = 0x7,
+   .rx_chain_mask = 0x7,
+   .max_spatial_stream = 4,
+   .fw = {
+   .dir = WCN3990_HW_1_0_FW_DIR,
+   },
+   .sw_decrypt_mcast_mgmt = true,
+   .hw_ops = _ops,
+   .decap_align_bytes = 1,
+   .num_peers = TARGET_HL_10_TLV_NUM_PEERS,
+   .ast_skid_limit = TARGET_HL_10_TLV_AST_SKID_LIMIT,
+   .num_wds_entries = TARGET_HL_10_TLV_NUM_WDS_ENTRIES,
+   },
 };
 
 static const char *const ath10k_core_fw_feature_str[] = {
diff --git a/drivers/net/wireless/ath/ath10k/hw.c 
b/drivers/net/wireless/ath/ath10k/hw.c
index 88955bbe20bd..c31eea632777 100644
--- a/drivers/net/wireless/ath/ath10k/hw.c
+++ b/drivers/net/wireless/ath/ath10k/hw.c
@@ -931,3 +931,5 @@ const struct ath10k_hw_ops qca6174_ops = {
.set_coverage_class = ath10k_hw_qca988x_set_coverage_class,
.enable_pll_clk = ath10k_hw_qca6174_enable_pll_clock,
 };
+
+const struct ath10k_hw_ops wcn3990_ops = {};
diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index fedb6c799374..90ad39bdeec4 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -128,6 +128,10 @@ enum qca9377_chip_id_rev {
 #define QCA4019_HW_1_0_BOARD_DATA_FILE "board.bin"
 #define QCA4019_HW_1_0_PATCH_LOAD_ADDR  0x1234
 
+/* WCN3990 1.0 definitions */
+#define WCN3990_HW_1_0_DEV_VERSION ATH10K_HW_WCN3990
+#define WCN3990_HW_1_0_FW_DIR  ATH10K_FW_DIR "/WCN3990/hw3.0"
+
 #define ATH10K_FW_FILE_BASE"firmware"
 #define ATH10K_FW_API_MAX  6
 #define ATH10K_FW_API_MIN  2
@@ -571,6 +575,7 @@ struct ath10k_hw_ops {
 extern const struct ath10k_hw_ops qca988x_ops;
 extern const struct ath10k_hw_ops qca99x0_ops;
 extern const struct ath10k_hw_ops qca6174_ops;
+extern const struct ath10k_hw_ops wcn3990_ops;
 
 extern const struct ath10k_hw_clk_params qca6174_clk[];
 
@@ -667,6 +672,11 @@ ath10k_rx_desc_get_l3_pad_bytes(struct ath10k_hw_params 
*hw,
 #define TARGET_TLV_NUM_MSDU_DESC   (1024 + 32)
 #define TARGET_TLV_NUM_WOW_PATTERNS22
 
+/* Target specific defines for WMI-HL-1.0 firmware */
+#define TARGET_HL_10_TLV_NUM_PEERS 14
+#define TARGET_HL_10_TLV_AST_SKID_LIMIT6
+#define TARGET_HL_10_TLV_NUM_WDS_ENTRIES   2
+
 /* Diagnostic Window */
 #define CE_DIAG_PIPE   7
 
-- 
2.11.0



Re: 76f43b4 fix for stable

2017-12-11 Thread Johannes Berg
On Mon, 2017-12-11 at 14:51 +0100, Richard Schütz wrote:
> Hello,
> 
> as per netdev-FAQ.txt I'm requesting the submission of commit 
> 57629915d568c522ac1422df7bba4bee5b5c7a7c ("mac80211: Fix addition of 
> mesh configuration element") to stable. Because of automatic selection 
> commit 76f43b4c0a9337af22827d78de4f2b8fd5328489 ("mac80211: Remove 
> invalid flag operations in mesh TSF synchronization") was introduced 
> into stable recently without this accompanying fix.

It seems that due to the Fixes: tag Greg should pick it up anyway, but
in any case I don't really deal with stable myself (in that sense, I
guess wireless isn't really part of netdev...)

johannes


Re: [PATCH v2 3/5] mac80211_hwsim: add generation count for netlink dump operation

2017-12-11 Thread Johannes Berg
On Mon, 2017-12-11 at 14:29 +0100, Benjamin Beichler wrote:

> I think we need to send something like an empty message, containing the
> flag. Because there exist the corner case, that while a dump is
> interrupted the complete list is deleted. Currently this could not
> happen because of non-parallel netlink callbacks, but maybe in the
> future parallel callbacks are enabled.

I don't know if we really want parallel, but I guess it's possible
eventually.

> Would it break things, if I simply create an header with
> HWSIM_CMD_GET_RADIO, but put no other information in it? Or how could it
> be done correctly?

I think that's probably OK.

johannes


76f43b4 fix for stable

2017-12-11 Thread Richard Schütz

Hello,

as per netdev-FAQ.txt I'm requesting the submission of commit 
57629915d568c522ac1422df7bba4bee5b5c7a7c ("mac80211: Fix addition of 
mesh configuration element") to stable. Because of automatic selection 
commit 76f43b4c0a9337af22827d78de4f2b8fd5328489 ("mac80211: Remove 
invalid flag operations in mesh TSF synchronization") was introduced 
into stable recently without this accompanying fix.


--
Richard


Re: [PATCH v2 3/5] mac80211_hwsim: add generation count for netlink dump operation

2017-12-11 Thread Benjamin Beichler
Am 11.12.2017 um 14:07 schrieb Johannes Berg:
> On Mon, 2017-12-11 at 14:02 +0100, Benjamin Beichler wrote:
>>> But you added this:
>>>
>>> +   /* list changed */
>>> +   if (cb->prev_seq && cb->seq != cb->prev_seq)
>>> +   goto cleanup;
>>>
>>> which is mostly just a copy of the inline.
>>>
>>> johannes
>> Year you are right, but for nl_dump_check_consistent() I also need a
>> header struct to write the flag to it and I thought a ghost header only
>> to this function is also misleading. But if you think this is better, I
>> can do that. Or we introduce a function, which really only check
>> consistency and not also set the flag. I also thought the line is
>> readable at it's own, because it's simply inconsistent if the sequence
>> numbers are not equal.
> It's readable, but there should be an indication to userspace in this
> case, no?
>
> johannes
>
Mhh, OK you are totally right.

I think we need to send something like an empty message, containing the
flag. Because there exist the corner case, that while a dump is
interrupted the complete list is deleted. Currently this could not
happen because of non-parallel netlink callbacks, but maybe in the
future parallel callbacks are enabled.

Would it break things, if I simply create an header with
HWSIM_CMD_GET_RADIO, but put no other information in it? Or how could it
be done correctly?

-- 
M.Sc. Benjamin Beichler

Universität Rostock, Fakultät für Informatik und Elektrotechnik
Institut für Angewandte Mikroelektronik und Datentechnik

University of Rostock, Department of CS and EE
Institute of Applied Microelectronics and CE

Richard-Wagner-Straße 31
18119 Rostock
Deutschland/Germany

phone: +49 (0) 381 498 - 7278
email: benjamin.beich...@uni-rostock.de
www: http://www.imd.uni-rostock.de/





Re: [PATCH] ath10k: Add BMI parameters to fix calibration from DT/pre-cal

2017-12-11 Thread akolli

On 2017-12-08 19:10, Sven Eckelmann wrote:

On Freitag, 8. Dezember 2017 18:05:38 CET ako...@codeaurora.org wrote:

On 2017-12-08 17:42, Sven Eckelmann wrote:
> On Donnerstag, 25. Mai 2017 16:21:23 CET ako...@qti.qualcomm.com wrote:
>> From: Anilkumar Kolli 
>>
>> QCA99X0, QCA9888, QCA9984 supports calibration data in
>> either OTP or DT/pre-cal file. Current ath10k supports
>> Calibration data from OTP only.

[...]

> Just tried this on an QCA9984 which doesn't seem to have the
> calibration data in the PCI EEPROM.
>
> [   71.728929] ath10k_pci :01:00.0: qca9984/qca9994 hw1.0
> target 0x0100 chip_id 0x sub 168c:cafe
> [   71.732926] ath10k_pci :01:00.0: kconfig debug 1 debugfs 1
> tracing 0 dfs 1 testmode 1
> [   71.752282] ath10k_pci :01:00.0: firmware ver
> 10.4-ct-9984-fW-009-dfa0083 api 5 features peer-flow-ctrl crc32
> 7198d117
> [   73.805730] ath10k_pci :01:00.0: unable to read from the
> device
> [   73.805769] ath10k_pci :01:00.0: could not execute otp for
> board id check: -110
>

'ATH10K driver <-> 10.4 firmware' expects cal data to be either in
EEPROM or pre-cal-file or DT.
Hope the error is observed when there is no cal data loaded.


The problem happens when pre-cal data file is loaded using the 
userspace
helper on the QCA9984. I was only able to use the device when I (for a 
test)

used the pre-cal data as cal-data (file).

The EEPROM on the on the PCI device doesn't seem to be populated with a 
valid
pre-cal data. I've already tested it with a QCA9984 device which had 
pre-cal
data in the PCI device's EEPROM and this worked fine (without cal file 
and

without pre-cal file).


> It works when I use the pre-cal data as calibration data. The checksum
> in the
> pre-cal seems to be correct. Also the pre-cal data from 0:ART for the
> 2.4GHz
> and 5GHz QCA4019 seem to work perfectly fine.
>

Do you mean this patch works for only QCA4019 and not working for
QCA9984 ?


Worked fine for QCA4019 and QCA9888 - but I had no luck with QCA9984. 
The

error shown above it the only thing I get.



I tested this on QCA9984 and it worked with below config,

pre-cal file location: /lib/firmware/ath10k/pre-cal-pci-:01:00.0.bin
FW: 
https://github.com/kvalo/ath10k-firmware/raw/master/QCA9984/hw1.0/firmware-5.bin_10.4-3.2-00072
BDF: 
https://github.com/kvalo/ath10k-firmware/raw/master/QCA9984/hw1.0/board-2.bin


Logs:

ath10k_pci :01:00.0: found calibration file 
ath10k/pre-cal-pci-:01:00.0.bin

ath10k_pci :01:00.0: found fw version 10.4-3.2-00072
ath10k_pci :01:00.0: boot cal file downloaded
ath10k_pci :01:00.0: boot using calibration mode pre-cal-file
ath10k_pci :01:00.0: boot upload otp to 0x1234 len 8919 for board id
bmi execute address 0x1234 param 0x8000
ath10k_pci :01:00.0: bmi execute result 0x2800
ath10k_pci :01:00.0: boot get otp board id result 0x2800 
board_id 10 chip_id 0
ath10k_pci :01:00.0: boot using board name 
'bus=pci,bmi-chip-id=0,bmi-board-id=10'

ath10k_pci :01:00.0: Firmware loaded from user helper succesfully
ath10k_pci :01:00.0: boot fw request 
'ath10k/QCA9984/hw1.0/board-2.bin': 0


Kindly try with the latest firmware from Kalle's git mentioned above.

Thanks
Anil.




Re: [PATCH v2 3/5] mac80211_hwsim: add generation count for netlink dump operation

2017-12-11 Thread Johannes Berg
On Mon, 2017-12-11 at 14:02 +0100, Benjamin Beichler wrote:
> 
> > But you added this:
> > 
> > +   /* list changed */
> > +   if (cb->prev_seq && cb->seq != cb->prev_seq)
> > +   goto cleanup;
> > 
> > which is mostly just a copy of the inline.
> > 
> > johannes
> 
> Year you are right, but for nl_dump_check_consistent() I also need a
> header struct to write the flag to it and I thought a ghost header only
> to this function is also misleading. But if you think this is better, I
> can do that. Or we introduce a function, which really only check
> consistency and not also set the flag. I also thought the line is
> readable at it's own, because it's simply inconsistent if the sequence
> numbers are not equal.

It's readable, but there should be an indication to userspace in this
case, no?

johannes


Re: [PATCH v2 1/5] mac80211_hwsim: wait for deferred radio deletion on mod unload

2017-12-11 Thread Benjamin Beichler
Am 11.12.2017 um 13:57 schrieb Johannes Berg:
> On Mon, 2017-12-11 at 13:54 +0100, Benjamin Beichler wrote:
>> Am 11.12.2017 um 12:46 schrieb Johannes Berg:
 +  spin_lock_bh(_delete_lock);
 +  while (!list_empty(_radios)) {
 +  pr_debug("mac80211_hwsim: wait for deferred radio remove\n");
 +  spin_unlock_bh(_delete_lock);
 +  flush_work(_entry(_radios,
 + struct mac80211_hwsim_data, list)
 + ->destroy_work);
>>> This can't possibly be right ... you're locking the list_empty which is
>>> a trivial pointer comparison, but not the actual list_entry() ...
>> Maybe the first spin_lock is not needed, but since flush_work wait for
>> the completion of the task, which at the end also deletes the item from
>> the list, holding any spin_lock would be wrong.
> But not holding it while taking things that are on the list also seems
> wrong.
Since at this place (Netlink is already unregistered so no new deletion
requests) the only user of the delete list is the code deferred work
items (which take itself the lock). Nonetheless, with a separate
workqueue this is no problem anymore.
>
>>> I'd also prefer you actually didn't leave the problem in part as you
>>> describe - and a new workqueue probably isn't that much overhead and
>>> should introduce *less* new code than this, so IMHO that's worth it.
>> I totally agree with you, but I don't know the actual policy for
>> creating workqeues. I could also simply call flush_scheduled_work,
>> because we may have enough time at module unload. Some modules also do
>> it, but the description an some mailing threads mark it like
>> evil/deprecated. Which solution do you prefer?
> Let's go with a new workqueue.
Ok, I prepare a patch in the next few days.

>
> johannes
>

--
M.Sc. Benjamin Beichler

Universität Rostock, Fakultät für Informatik und Elektrotechnik
Institut für Angewandte Mikroelektronik und Datentechnik

University of Rostock, Department of CS and EE
Institute of Applied Microelectronics and CE

Richard-Wagner-Straße 31
18119 Rostock
Deutschland/Germany

phone: +49 (0) 381 498 - 7278
email: benjamin.beich...@uni-rostock.de
www: http://www.imd.uni-rostock.de/


Re: [PATCH v2 3/5] mac80211_hwsim: add generation count for netlink dump operation

2017-12-11 Thread Benjamin Beichler
Am 11.12.2017 um 13:49 schrieb Johannes Berg:
> On Mon, 2017-12-11 at 13:37 +0100, Benjamin Beichler wrote:
>> Am 11.12.2017 um 13:14 schrieb Johannes Berg:
>>> On Tue, 2017-11-21 at 13:17 +0100, Benjamin Beichler wrote:
 Make the dump operation aware of changes on radio list and corresponding
 inconsistent dumps. Change the dump iteration to be independent from
 increasing radio indices on radio list.
>>> Looks like this should use nl_dump_check_consistent()?
>>>
>>> johannes
>>>
>> It is called in mac80211_hwsim_get_radio, I didn't changed that.
> But you added this:
>
> +   /* list changed */
> +   if (cb->prev_seq && cb->seq != cb->prev_seq)
> +   goto cleanup;
>
> which is mostly just a copy of the inline.
>
> johannes
Year you are right, but for nl_dump_check_consistent() I also need a
header struct to write the flag to it and I thought a ghost header only
to this function is also misleading. But if you think this is better, I
can do that. Or we introduce a function, which really only check
consistency and not also set the flag. I also thought the line is
readable at it's own, because it's simply inconsistent if the sequence
numbers are not equal.

-- 
M.Sc. Benjamin Beichler

Universität Rostock, Fakultät für Informatik und Elektrotechnik
Institut für Angewandte Mikroelektronik und Datentechnik

University of Rostock, Department of CS and EE
Institute of Applied Microelectronics and CE

Richard-Wagner-Straße 31
18119 Rostock
Deutschland/Germany

phone: +49 (0) 381 498 - 7278
email: benjamin.beich...@uni-rostock.de
www: http://www.imd.uni-rostock.de/





Re: [PATCH v2 1/5] mac80211_hwsim: wait for deferred radio deletion on mod unload

2017-12-11 Thread Johannes Berg
On Mon, 2017-12-11 at 13:54 +0100, Benjamin Beichler wrote:
> Am 11.12.2017 um 12:46 schrieb Johannes Berg:
> > 
> > > + spin_lock_bh(_delete_lock);
> > > + while (!list_empty(_radios)) {
> > > + pr_debug("mac80211_hwsim: wait for deferred radio remove\n");
> > > + spin_unlock_bh(_delete_lock);
> > > + flush_work(_entry(_radios,
> > > +struct mac80211_hwsim_data, list)
> > > +->destroy_work);
> > 
> > This can't possibly be right ... you're locking the list_empty which is
> > a trivial pointer comparison, but not the actual list_entry() ...
> 
> Maybe the first spin_lock is not needed, but since flush_work wait for
> the completion of the task, which at the end also deletes the item from
> the list, holding any spin_lock would be wrong.

But not holding it while taking things that are on the list also seems
wrong.

> > I'd also prefer you actually didn't leave the problem in part as you
> > describe - and a new workqueue probably isn't that much overhead and
> > should introduce *less* new code than this, so IMHO that's worth it.
> 
> I totally agree with you, but I don't know the actual policy for
> creating workqeues. I could also simply call flush_scheduled_work,
> because we may have enough time at module unload. Some modules also do
> it, but the description an some mailing threads mark it like
> evil/deprecated. Which solution do you prefer?

Let's go with a new workqueue.

johannes


Re: [PATCH v2 1/5] mac80211_hwsim: wait for deferred radio deletion on mod unload

2017-12-11 Thread Benjamin Beichler
Am 11.12.2017 um 12:46 schrieb Johannes Berg:
>
>> +spin_lock_bh(_delete_lock);
>> +while (!list_empty(_radios)) {
>> +pr_debug("mac80211_hwsim: wait for deferred radio remove\n");
>> +spin_unlock_bh(_delete_lock);
>> +flush_work(_entry(_radios,
>> +   struct mac80211_hwsim_data, list)
>> +   ->destroy_work);
> This can't possibly be right ... you're locking the list_empty which is
> a trivial pointer comparison, but not the actual list_entry() ...
Maybe the first spin_lock is not needed, but since flush_work wait for
the completion of the task, which at the end also deletes the item from
the list, holding any spin_lock would be wrong.
>
> I'd also prefer you actually didn't leave the problem in part as you
> describe - and a new workqueue probably isn't that much overhead and
> should introduce *less* new code than this, so IMHO that's worth it.
I totally agree with you, but I don't know the actual policy for
creating workqeues. I could also simply call flush_scheduled_work,
because we may have enough time at module unload. Some modules also do
it, but the description an some mailing threads mark it like
evil/deprecated. Which solution do you prefer?

kind regards

Benjamin

-- 
M.Sc. Benjamin Beichler

Universität Rostock, Fakultät für Informatik und Elektrotechnik
Institut für Angewandte Mikroelektronik und Datentechnik

University of Rostock, Department of CS and EE
Institute of Applied Microelectronics and CE

Richard-Wagner-Straße 31
18119 Rostock
Deutschland/Germany

phone: +49 (0) 381 498 - 7278
email: benjamin.beich...@uni-rostock.de
www: http://www.imd.uni-rostock.de/





Re: [PATCH v2 3/5] mac80211_hwsim: add generation count for netlink dump operation

2017-12-11 Thread Johannes Berg
On Mon, 2017-12-11 at 13:37 +0100, Benjamin Beichler wrote:
> Am 11.12.2017 um 13:14 schrieb Johannes Berg:
> > On Tue, 2017-11-21 at 13:17 +0100, Benjamin Beichler wrote:
> > > Make the dump operation aware of changes on radio list and corresponding
> > > inconsistent dumps. Change the dump iteration to be independent from
> > > increasing radio indices on radio list.
> > 
> > Looks like this should use nl_dump_check_consistent()?
> > 
> > johannes
> > 
> 
> It is called in mac80211_hwsim_get_radio, I didn't changed that.

But you added this:

+   /* list changed */
+   if (cb->prev_seq && cb->seq != cb->prev_seq)
+   goto cleanup;

which is mostly just a copy of the inline.

johannes


Re: [PATCH v2 3/5] mac80211_hwsim: add generation count for netlink dump operation

2017-12-11 Thread Benjamin Beichler
Am 11.12.2017 um 13:14 schrieb Johannes Berg:
> On Tue, 2017-11-21 at 13:17 +0100, Benjamin Beichler wrote:
>> Make the dump operation aware of changes on radio list and corresponding
>> inconsistent dumps. Change the dump iteration to be independent from
>> increasing radio indices on radio list.
> Looks like this should use nl_dump_check_consistent()?
>
> johannes
>
It is called in mac80211_hwsim_get_radio, I didn't changed that.

--
M.Sc. Benjamin Beichler

Universität Rostock, Fakultät für Informatik und Elektrotechnik
Institut für Angewandte Mikroelektronik und Datentechnik

University of Rostock, Department of CS and EE
Institute of Applied Microelectronics and CE

Richard-Wagner-Straße 31
18119 Rostock
Deutschland/Germany

phone: +49 (0) 381 498 - 7278
email: benjamin.beich...@uni-rostock.de
www: http://www.imd.uni-rostock.de/


Re: [PATCH v2 4/5] mac80211_hwsim: add permanent mac address option for new radios

2017-12-11 Thread Johannes Berg
On Tue, 2017-11-21 at 13:17 +0100, Benjamin Beichler wrote:
> 
> + * @HWSIM_ATTR_TX_INFO_FLAGS: additional flags for corresponding
> + *   rates of %HWSIM_ATTR_TX_INFO

> + HWSIM_ATTR_TX_INFO_FLAGS,

This should be in the next patch

johannes


Re: [PATCH v2 3/5] mac80211_hwsim: add generation count for netlink dump operation

2017-12-11 Thread Johannes Berg
On Tue, 2017-11-21 at 13:17 +0100, Benjamin Beichler wrote:
> Make the dump operation aware of changes on radio list and corresponding
> inconsistent dumps. Change the dump iteration to be independent from
> increasing radio indices on radio list.

Looks like this should use nl_dump_check_consistent()?

johannes


Seasons greetings

2017-12-11 Thread Mr Sheng Li Hung
I am Mr.Sheng Li Hung, from china I got your information while search for
a reliable person, I have a very profitable business proposition for you
and i can assure you that you will not regret been part of this mutual
beneficial transaction after completion. Kindly get back to me for more
details on this email id: shengl...@hotmail.com

Thanks
Sheng Li Hung


[PATCH] wlcore: fix unused function warning

2017-12-11 Thread Arnd Bergmann
The newly added wlcore_fw_sleep function is called conditionally,
which causes a warning without CONFIG_PM:

drivers/net/wireless/ti/wlcore/main.c:981:12: error: 'wlcore_fw_sleep' defined 
but not used [-Werror=unused-function]

Instead of trying to keep track of what should be in the #ifdef and what
should not, it's easier to mark the top-level suspend/resume functions
as __maybe_unused so the compiler can silently drop all the unused code.

Fixes: 37bf241b8e7b ("wlcore: allow elp during wowlan suspend")
Signed-off-by: Arnd Bergmann 
---
 drivers/net/wireless/ti/wlcore/acx.h  | 2 --
 drivers/net/wireless/ti/wlcore/main.c | 8 +++-
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/acx.h 
b/drivers/net/wireless/ti/wlcore/acx.h
index f46d7fdf9a00..7011c5d9599f 100644
--- a/drivers/net/wireless/ti/wlcore/acx.h
+++ b/drivers/net/wireless/ti/wlcore/acx.h
@@ -1129,10 +1129,8 @@ int wl12xx_acx_config_hangover(struct wl1271 *wl);
 int wlcore_acx_average_rssi(struct wl1271 *wl, struct wl12xx_vif *wlvif,
s8 *avg_rssi);
 
-#ifdef CONFIG_PM
 int wl1271_acx_default_rx_filter_enable(struct wl1271 *wl, bool enable,
enum rx_filter_action action);
 int wl1271_acx_set_rx_filter(struct wl1271 *wl, u8 index, bool enable,
 struct wl12xx_rx_filter *filter);
-#endif /* CONFIG_PM */
 #endif /* __WL1271_ACX_H__ */
diff --git a/drivers/net/wireless/ti/wlcore/main.c 
b/drivers/net/wireless/ti/wlcore/main.c
index 6ce457022dc9..09714034dbf1 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -1343,7 +1343,6 @@ static struct sk_buff *wl12xx_alloc_dummy_packet(struct 
wl1271 *wl)
 }
 
 
-#ifdef CONFIG_PM
 static int
 wl1271_validate_wowlan_pattern(struct cfg80211_pkt_pattern *p)
 {
@@ -1715,8 +1714,8 @@ static void wl1271_configure_resume(struct wl1271 *wl, 
struct wl12xx_vif *wlvif)
}
 }
 
-static int wl1271_op_suspend(struct ieee80211_hw *hw,
-   struct cfg80211_wowlan *wow)
+static int __maybe_unused wl1271_op_suspend(struct ieee80211_hw *hw,
+   struct cfg80211_wowlan *wow)
 {
struct wl1271 *wl = hw->priv;
struct wl12xx_vif *wlvif;
@@ -1810,7 +1809,7 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
return 0;
 }
 
-static int wl1271_op_resume(struct ieee80211_hw *hw)
+static int __maybe_unused wl1271_op_resume(struct ieee80211_hw *hw)
 {
struct wl1271 *wl = hw->priv;
struct wl12xx_vif *wlvif;
@@ -1894,7 +1893,6 @@ static int wl1271_op_resume(struct ieee80211_hw *hw)
 
return 0;
 }
-#endif
 
 static int wl1271_op_start(struct ieee80211_hw *hw)
 {
-- 
2.9.0



Re: [PATCH v2 1/5] mac80211_hwsim: wait for deferred radio deletion on mod unload

2017-12-11 Thread Johannes Berg
On Tue, 2017-11-21 at 13:17 +0100, Benjamin Beichler wrote:
> 
> + /*wait for radios with deferred delete*/

please add spaces there

> + spin_lock_bh(_delete_lock);
> + while (!list_empty(_radios)) {
> + pr_debug("mac80211_hwsim: wait for deferred radio remove\n");
> + spin_unlock_bh(_delete_lock);
> + flush_work(_entry(_radios,
> +struct mac80211_hwsim_data, list)
> +->destroy_work);

This can't possibly be right ... you're locking the list_empty which is
a trivial pointer comparison, but not the actual list_entry() ...

I'd also prefer you actually didn't leave the problem in part as you
describe - and a new workqueue probably isn't that much overhead and
should introduce *less* new code than this, so IMHO that's worth it.

johannes


[PATCH] nl80211: fix nl80211_send_iface() error paths

2017-12-11 Thread Johannes Berg
From: Johannes Berg 

Evidently I introduced a locking bug in my change here,
the nla_put_failure sometimes needs to unlock. Fix it.

Fixes: 44905265bc15 ("nl80211: don't expose wdev->ssid for most interfaces")
Signed-off-by: Johannes Berg 
---
 net/wireless/nl80211.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index b1ac23ca20c8..213d0c498c97 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2610,7 +2610,7 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 
portid, u32 seq, int flag
case NL80211_IFTYPE_AP:
if (wdev->ssid_len &&
nla_put(msg, NL80211_ATTR_SSID, wdev->ssid_len, wdev->ssid))
-   goto nla_put_failure;
+   goto nla_put_failure_locked;
break;
case NL80211_IFTYPE_STATION:
case NL80211_IFTYPE_P2P_CLIENT:
@@ -2623,7 +2623,7 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 
portid, u32 seq, int flag
if (!ssid_ie)
break;
if (nla_put(msg, NL80211_ATTR_SSID, ssid_ie[1], ssid_ie + 2))
-   goto nla_put_failure;
+   goto nla_put_failure_locked;
break;
}
default:
@@ -2635,6 +2635,8 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 
portid, u32 seq, int flag
genlmsg_end(msg, hdr);
return 0;
 
+ nla_put_failure_locked:
+   wdev_unlock(wdev);
  nla_put_failure:
genlmsg_cancel(msg, hdr);
return -EMSGSIZE;
-- 
2.14.2



Re: [PATCH v3 31/36] mac80211_hwsim: Replace hrtimer tasklet with softirq hrtimer

2017-12-11 Thread Johannes Berg
On Wed, 2017-11-29 at 16:30 +0100, Anna-Maria Gleixner wrote:
> From: Thomas Gleixner 
> 
> Switch the timer to HRTIMER_MODE_SOFT, which executed the timer
> callback in softirq context and remove the hrtimer_tasklet.

You didn't change the commit log to HRTIMER_MODE_REL_SOFT, but
otherwise looks good to me.

Reviewed-by: Johannes Berg 

Re: [PATCH 1/1] ocb: Use common freqchan helper for setting the operating channel

2017-12-11 Thread Johannes Berg
On Fri, 2017-10-27 at 23:43 +0200, Peter Große wrote:
> Simplify code by using the helper which has been introduced earlier.
> 
> Signed-off-by: Peter Große 
> ---
>  ocb.c | 50 --

No objection to the patch, but you need to generate the diff against a
full tree (must show a/net/wireless/ocb.c in the diff header), and make
it actually applicable. I'm guessing whitespace got mangled, but this
patch doesn't apply as is.

johannes


Re: [PATCH] nl80211: Update ERP info using NL80211_CMD_UPDATE_CONNECT_PARAMS

2017-12-11 Thread Johannes Berg
On Wed, 2017-10-25 at 14:50 +0530, Vidyullatha Kanchanapally wrote:

> + * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
> + *   username, erp sequence number and rrk) are updated
> + * @UPDATE_AUTH_TYPE: Indicates that Authentication type is updated

These are new here, but you don't know if they were actually supported:

> + if (wiphy_ext_feature_isset(>wiphy,
> + NL80211_EXT_FEATURE_FILS_SK_OFFLOAD) &&

here.

> + info->attrs[NL80211_ATTR_FILS_ERP_USERNAME] &&
> + info->attrs[NL80211_ATTR_FILS_ERP_REALM] &&
> + info->attrs[NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM] &&
> + info->attrs[NL80211_ATTR_FILS_ERP_RRK]) {
[...]
> + } else if (info->attrs[NL80211_ATTR_FILS_ERP_USERNAME] ||
> +info->attrs[NL80211_ATTR_FILS_ERP_REALM] ||
> +info->attrs[NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM] ||
> +info->attrs[NL80211_ATTR_FILS_ERP_RRK]) {
> + return -EINVAL;
> + }

This logic is also really odd, why not

if (attrs) {
if (not flag)
return -EINVAL;
/* use attrs etc. */
}

> +
> + if (info->attrs[NL80211_ATTR_AUTH_TYPE]) {
> + u32 auth_type =
> + nla_get_u32(info->attrs[NL80211_ATTR_AUTH_TYPE]);
> + if (!nl80211_valid_auth_type(rdev, auth_type,
> +  NL80211_CMD_CONNECT))
> + return -EINVAL;
> + connect.auth_type = auth_type;
> + changed |= UPDATE_AUTH_TYPE;
> + }

Again, how do you know the driver will actually look at
UPDATE_AUTH_TYPE?

johannes


Re: [PATCH] dt-bindings: net: wireless: Add sg parameters dts parsing

2017-12-11 Thread Arend van Spriel

On 12/11/2017 9:11 AM, Chi-Hsien Lin wrote:

broken_sg_support, sd_head_align, and sd_sgentry_align are used in
brcmfmac code but not configurable in dts file. Add the parsing logic.
Now they can be configured like below in dts:
brcm,broken_sg_support;
brcm,sd_head_align = <4>;
brcm,sd_sgentry_align = <4>;

Signed-off-by: Chi-hsien Lin 
---
  .../devicetree/bindings/net/wireless/brcm,bcm43xx-fmac.txt| 8 
  1 file changed, 8 insertions(+)

diff --git 
a/Documentation/devicetree/bindings/net/wireless/brcm,bcm43xx-fmac.txt 
b/Documentation/devicetree/bindings/net/wireless/brcm,bcm43xx-fmac.txt
index 86602f2..4d42f0d 100644
--- a/Documentation/devicetree/bindings/net/wireless/brcm,bcm43xx-fmac.txt
+++ b/Documentation/devicetree/bindings/net/wireless/brcm,bcm43xx-fmac.txt
@@ -17,6 +17,11 @@ Optional properties:
When not specified the device will use in-band SDIO interrupts.
   - interrupt-names : name of the out-of-band interrupt, which must be set
to "host-wake".
+ - broken_sg_support : flag for broken sg list support of SDIO host controller.
+   Set this to true if the SDIO host controller has higher align
+   requirement than 32 bytes for each scatterlist item.


In DT context, this does not characterize the device but as described it 
is about the SDIO host controller. I think the same applies to the 
properties below, but not entirely sure about that.



+ - sg_head_align : alignment requirement for start of data buffer.
+ - sg_sgentry_align : length alignment requirement for each sg entry.


Regards,
Arend



pull-request: mac80211 2017-12-11

2017-12-11 Thread Johannes Berg
Hi Dave,

Three fixes, two related to build issues with the new regdb stuff,
and one for some patch overlap problem that caused locking to be
missing which in turn caused lots of warnings.

Please pull and let me know if there's any problem.

Thanks,
johannes



The following changes since commit ccab371f746abca05a599d074cb3b95a549ef590:

  Merge branch 'sfp-phylink-fixes' (2017-12-01 15:18:42 -0500)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git 
tags/mac80211-for-davem-2017-12-11

for you to fetch changes up to 0afe9d4ab9d40c281bdcdd118661fe8e4bdcef18:

  mac80211: fix locking in ieee80211_sta_tear_down_BA_sessions (2017-12-11 
10:50:00 +0100)


Three fixes:
 * for certificate C file generation, don't use hexdump as it's
   not always installed by default, use pure posix instead (od/sed)
 * for certificate C file generation, don't write the file if
   anything fails, so the build abort will not cause a bad build
   upon a second attempt
 * fix locking in ieee80211_sta_tear_down_BA_sessions() which had
   been causing lots of locking warnings


Johannes Berg (3):
  wireless: replace usage of hexdump with od/sed
  wireless: don't write C files on failures
  mac80211: fix locking in ieee80211_sta_tear_down_BA_sessions

 net/mac80211/ht.c |  5 ++---
 net/wireless/Makefile | 48 ++--
 2 files changed, 40 insertions(+), 13 deletions(-)


Re: [PATCH] brcmfmac: enlarge buffer size of caps to 512 bytes

2017-12-11 Thread Arend van Spriel

On 12/11/2017 8:38 AM, Wright Feng wrote:

The buffer size of return of cap iovar is greater than 256 bytes in some
firmwares. For instance, the return size of cap iovar is 271 bytes in 4373
13.10.246.79 firmare. It makes feature capability parsing failed because
caps buffer is default value.
So we enlarge caps buffer size to 512 bytes and add the error print for
cap iovar error.


Looks fine to me. However, firmware side is also broken for some chips 
where released firmware uses 256 bytes (= WLC_IOCTL_SMLEN) but the 
capability tokens do no longer fit that size and we get a cut-off 
capability string.


Anyway...

Acked-by: Arend van Spriel 

Signed-off-by: Wright Feng 
---
  drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c | 12 +---
  1 file changed, 9 insertions(+), 3 deletions(-)




Re: [PATCH] wcn36xx: Add hardware scan offload support

2017-12-11 Thread Loic Poulain
Hi Bjorn,

On 9 December 2017 at 01:34, Bjorn Andersson  wrote:
>
>> diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
>> b/drivers/net/wireless/ath/wcn36xx/smd.c
> [..]
>> +static int wcn36xx_smd_hw_scan_ind(struct wcn36xx *wcn, void *buf, size_t 
>> len)
>> +{
>> + struct wcn36xx_hal_scan_offload_ind *rsp = buf;
>> + struct cfg80211_scan_info scan_info = {};
>> +
>> + if (len != sizeof(*rsp)) {
>> + wcn36xx_warn("Corrupted delete scan indication\n");
>> + return -EIO;
>> + }
>> +
>> + wcn36xx_dbg(WCN36XX_DBG_HAL, "scan indication (type %x)", rsp->type);
>> +
>> + switch (rsp->type) {
>> + case WCN36XX_HAL_SCAN_IND_FAILED:
>> + scan_info.aborted = true;
>> + case WCN36XX_HAL_SCAN_IND_COMPLETED:
>> + mutex_lock(>scan_lock);
>
> Grabbing this mutex with DEBUG_ATOMIC_SLEEP causes issues, but that's
> because the locking in ind_smd_work() is to excessive. Will reply with a
> fix for this.

Oops you're right, thanks for the patch.

Regards,
Loic


[PATCH v2] wcn36xx: Fix dynamic power saving

2017-12-11 Thread Loic Poulain
Since driver does not report hardware dynamic power saving cap,
this is up to the mac80211 to manage power saving timeout and
state machine, using the ieee80211 config callback to report
PS changes. This patch enables/disables PS mode according to
the new configuration.

Remove old behaviour enabling PS mode in a static way, this make
the device unusable when power save is enabled since device is
forced to PS regardless RX/TX traffic.

Acked-by: Bjorn Andersson 
Signed-off-by: Loic Poulain 
---
 v2: remove error msg on unbalanced bmps exit
 return -EALREADY if not in bmps mode

 drivers/net/wireless/ath/wcn36xx/main.c | 23 ---
 drivers/net/wireless/ath/wcn36xx/pmc.c  |  6 --
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index f0b4d43..436b8ea 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -384,6 +384,18 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 
changed)
}
}
 
+   if (changed & IEEE80211_CONF_CHANGE_PS) {
+   list_for_each_entry(tmp, >vif_list, list) {
+   vif = wcn36xx_priv_to_vif(tmp);
+   if (hw->conf.flags & IEEE80211_CONF_PS) {
+   if (vif->bss_conf.ps) /* ps allowed ? */
+   wcn36xx_pmc_enter_bmps_state(wcn, vif);
+   } else {
+   wcn36xx_pmc_exit_bmps_state(wcn, vif);
+   }
+   }
+   }
+
mutex_unlock(>conf_mutex);
 
return 0;
@@ -747,17 +759,6 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw 
*hw,
vif_priv->dtim_period = bss_conf->dtim_period;
}
 
-   if (changed & BSS_CHANGED_PS) {
-   wcn36xx_dbg(WCN36XX_DBG_MAC,
-   "mac bss PS set %d\n",
-   bss_conf->ps);
-   if (bss_conf->ps) {
-   wcn36xx_pmc_enter_bmps_state(wcn, vif);
-   } else {
-   wcn36xx_pmc_exit_bmps_state(wcn, vif);
-   }
-   }
-
if (changed & BSS_CHANGED_BSSID) {
wcn36xx_dbg(WCN36XX_DBG_MAC, "mac bss changed_bssid %pM\n",
bss_conf->bssid);
diff --git a/drivers/net/wireless/ath/wcn36xx/pmc.c 
b/drivers/net/wireless/ath/wcn36xx/pmc.c
index 589fe5f..1976b80 100644
--- a/drivers/net/wireless/ath/wcn36xx/pmc.c
+++ b/drivers/net/wireless/ath/wcn36xx/pmc.c
@@ -45,8 +45,10 @@ int wcn36xx_pmc_exit_bmps_state(struct wcn36xx *wcn,
struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
 
if (WCN36XX_BMPS != vif_priv->pw_state) {
-   wcn36xx_err("Not in BMPS mode, no need to exit from BMPS 
mode!\n");
-   return -EINVAL;
+   /* Unbalanced call or last BMPS enter failed */
+   wcn36xx_dbg(WCN36XX_DBG_PMC,
+   "Not in BMPS mode, no need to exit\n");
+   return -EALREADY;
}
wcn36xx_smd_exit_bmps(wcn, vif);
vif_priv->pw_state = WCN36XX_FULL_POWER;
-- 
2.7.4



Re: [PATCH] wcn36xx: Fix dynamic power saving

2017-12-11 Thread Loic Poulain
Hi Bjorn,

On 9 December 2017 at 01:45, Bjorn Andersson  wrote:
>>   }
>>   }
>>
>> + if (changed & IEEE80211_CONF_CHANGE_PS) {
>> + list_for_each_entry(tmp, >vif_list, list) {
>> + vif = wcn36xx_priv_to_vif(tmp);
>> + if (hw->conf.flags & IEEE80211_CONF_PS) {
>> + if (vif->bss_conf.ps) /* ps allowed ? */
>> + wcn36xx_pmc_enter_bmps_state(wcn, vif);
>> + } else {
>> + wcn36xx_pmc_exit_bmps_state(wcn, vif);
>
> During startup I get the error print from wcn36xx_pmc_exit_bmps_state()
> that we're not in BMPS state. There's no harm in this, but the error
> might concern people.
>
> How about we in addition to this, change the wcn36xx_err() to a
> wcn36xx_dbg(PMC...) ?

Thanks for reporting this, I assume mac80211 disable PS mode before enabling it
on timeout... It makes sense to avoid this error msg since balancing
is well managed
by this driver.

Regards,
Loic


[PATCH] dt-bindings: net: wireless: Add sg parameters dts parsing

2017-12-11 Thread Chi-Hsien Lin
broken_sg_support, sd_head_align, and sd_sgentry_align are used in
brcmfmac code but not configurable in dts file. Add the parsing logic.
Now they can be configured like below in dts:
brcm,broken_sg_support;
brcm,sd_head_align = <4>;
brcm,sd_sgentry_align = <4>;

Signed-off-by: Chi-hsien Lin 
---
 .../devicetree/bindings/net/wireless/brcm,bcm43xx-fmac.txt| 8 
 1 file changed, 8 insertions(+)

diff --git 
a/Documentation/devicetree/bindings/net/wireless/brcm,bcm43xx-fmac.txt 
b/Documentation/devicetree/bindings/net/wireless/brcm,bcm43xx-fmac.txt
index 86602f2..4d42f0d 100644
--- a/Documentation/devicetree/bindings/net/wireless/brcm,bcm43xx-fmac.txt
+++ b/Documentation/devicetree/bindings/net/wireless/brcm,bcm43xx-fmac.txt
@@ -17,6 +17,11 @@ Optional properties:
When not specified the device will use in-band SDIO interrupts.
  - interrupt-names : name of the out-of-band interrupt, which must be set
to "host-wake".
+ - broken_sg_support : flag for broken sg list support of SDIO host controller.
+   Set this to true if the SDIO host controller has higher align
+   requirement than 32 bytes for each scatterlist item.
+ - sg_head_align : alignment requirement for start of data buffer.
+ - sg_sgentry_align : length alignment requirement for each sg entry.
 
 Example:
 
@@ -36,5 +41,8 @@ mmc3: mmc@1c12000 {
interrupt-parent = <>;
interrupts = <10 8>; /* PH10 / EINT10 */
interrupt-names = "host-wake";
+   brcm,broken_sg_support;
+   brcm,sd_head_align = <4>;
+   brcm,sd_sgentry_align = <4>;
};
 };
-- 
2.1.0



[PATCH V2] brcmfmac: Add sg parameters dts parsing

2017-12-11 Thread Chi-Hsien Lin
broken_sg_support, sd_head_align, and sd_sgentry_align are used in
brcmfmac code but not configurable in dts file. Add the parsing logic.
Now they can be configured like below in dts:
brcm,broken_sg_support;
brcm,sd_head_align = <4>;
brcm,sd_sgentry_align = <4>;

Signed-off-by: Chi-hsien Lin 
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
index aee6e59..fd028b1 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
@@ -39,6 +39,13 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type 
bus_type,
if (of_property_read_u32(np, "brcm,drive-strength", ) == 0)
sdio->drive_strength = val;
 
+   sdio->broken_sg_support = of_property_read_bool(np,
+   
"brcm,broken_sg_support");
+   if (of_property_read_u32(np, "brcm,sd_head_align", ) == 0)
+   sdio->sd_head_align = (u16)val;
+   if (of_property_read_u32(np, "brcm,sd_sgentry_align", ) == 0)
+   sdio->sd_sgentry_align = (u16)val;
+
/* make sure there are interrupts defined in the node */
if (!of_find_property(np, "interrupts", NULL))
return;
-- 
2.1.0