[PATCH] ath10k: Fix descriptor size in ce tx completion for WCN3990

2019-02-11 Thread Rakesh Pillai
When the driver receives the tx completion of the
descriptor over ce, it clears the nbytes configured
for that particular descriptor. WCN3990 uses ce
descriptors with 64-bit address.

Currently during handling the tx completion of the
descriptors, the nbytes are accessed from the descriptors
using ce_desc for 32-bit targets. This will lead to clearing
of memory at incorrect offset if DMA MASK is set to greater
than 32 bits.

Attach different ce tx copy completed handler for targets
using address above 32-bit address.

Tested HW: WCN3990
Tested FW: WLAN.HL.2.0-01387-QCAHLSWMTPLZ-1

Signed-off-by: Rakesh Pillai 
---
 drivers/net/wireless/ath/ath10k/ce.c | 64 +++-
 drivers/net/wireless/ath/ath10k/ce.h |  2 ++
 2 files changed, 65 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c 
b/drivers/net/wireless/ath/ath10k/ce.c
index 8b4a910..0c6d0ae 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -1077,7 +1077,7 @@ EXPORT_SYMBOL(ath10k_ce_revoke_recv_next);
  * Guts of ath10k_ce_completed_send_next.
  * The caller takes responsibility for any necessary locking.
  */
-int ath10k_ce_completed_send_next_nolock(struct ath10k_ce_pipe *ce_state,
+static int _ath10k_ce_completed_send_next_nolock(struct ath10k_ce_pipe 
*ce_state,
 void **per_transfer_contextp)
 {
struct ath10k_ce_ring *src_ring = ce_state->src_ring;
@@ -1129,6 +1129,66 @@ int ath10k_ce_completed_send_next_nolock(struct 
ath10k_ce_pipe *ce_state,
 
return 0;
 }
+
+static int _ath10k_ce_completed_send_next_nolock_64(struct ath10k_ce_pipe 
*ce_state,
+void **per_transfer_contextp)
+{
+   struct ath10k_ce_ring *src_ring = ce_state->src_ring;
+   u32 ctrl_addr = ce_state->ctrl_addr;
+   struct ath10k *ar = ce_state->ar;
+   unsigned int nentries_mask = src_ring->nentries_mask;
+   unsigned int sw_index = src_ring->sw_index;
+   unsigned int read_index;
+   struct ce_desc_64 *desc;
+
+   if (src_ring->hw_index == sw_index) {
+   /*
+* The SW completion index has caught up with the cached
+* version of the HW completion index.
+* Update the cached HW completion index to see whether
+* the SW has really caught up to the HW, or if the cached
+* value of the HW index has become stale.
+*/
+
+   read_index = ath10k_ce_src_ring_read_index_get(ar, ctrl_addr);
+   if (read_index == 0x)
+   return -ENODEV;
+
+   read_index &= nentries_mask;
+   src_ring->hw_index = read_index;
+   }
+
+   if (ar->hw_params.rri_on_ddr)
+   read_index = ath10k_ce_src_ring_read_index_get(ar, ctrl_addr);
+   else
+   read_index = src_ring->hw_index;
+
+   if (read_index == sw_index)
+   return -EIO;
+
+   if (per_transfer_contextp)
+   *per_transfer_contextp =
+   src_ring->per_transfer_context[sw_index];
+
+   /* sanity */
+   src_ring->per_transfer_context[sw_index] = NULL;
+   desc = CE_SRC_RING_TO_DESC_64(src_ring->base_addr_owner_space,
+  sw_index);
+   desc->nbytes = 0;
+
+   /* Update sw_index */
+   sw_index = CE_RING_IDX_INCR(nentries_mask, sw_index);
+   src_ring->sw_index = sw_index;
+
+   return 0;
+}
+
+int ath10k_ce_completed_send_next_nolock(struct ath10k_ce_pipe *ce_state,
+void **per_transfer_contextp)
+{
+   return ce_state->ops->ce_completed_send_next_nolock(ce_state,
+   
per_transfer_contextp);
+}
 EXPORT_SYMBOL(ath10k_ce_completed_send_next_nolock);
 
 static void ath10k_ce_extract_desc_data(struct ath10k *ar,
@@ -1849,6 +1909,7 @@ static const struct ath10k_ce_ops ce_ops = {
.ce_send_nolock = _ath10k_ce_send_nolock,
.ce_set_src_ring_base_addr_hi = NULL,
.ce_set_dest_ring_base_addr_hi = NULL,
+   .ce_completed_send_next_nolock = _ath10k_ce_completed_send_next_nolock,
 };
 
 static const struct ath10k_ce_ops ce_64_ops = {
@@ -1863,6 +1924,7 @@ static const struct ath10k_ce_ops ce_64_ops = {
.ce_send_nolock = _ath10k_ce_send_nolock_64,
.ce_set_src_ring_base_addr_hi = ath10k_ce_set_src_ring_base_addr_hi,
.ce_set_dest_ring_base_addr_hi = ath10k_ce_set_dest_ring_base_addr_hi,
+   .ce_completed_send_next_nolock = 
_ath10k_ce_completed_send_next_nolock_64,
 };
 
 static void ath10k_ce_set_ops(struct ath10k *ar,
diff --git a/drivers/net/wireless/ath/ath10k/ce.h 
b/drivers/net/wireless/ath/ath10k/ce.h
index c44a52e..dffb8a0 100644
--- a/drivers/net/wireless/ath/ath10k/ce.h
+++ b/drivers/net/wireless/ath/ath10k/ce.h
@@ -340,6 +340,8 @@ struct ath10k_ce_ops {
   

Kernel tainted after resume (QCA9377/hw1.0/TF2.1-firmware-v6)

2019-02-11 Thread Tobias Predel
Hello everyone,

this happens on 4.20.7 (Arch Linux) with 
ath10k/QCA9377/hw1.0/TF2.1/firmware-6.bin (WLAN.TF.2.1-00021-QCARMSWP-1) while 
suspending to RAM and resuming. It doesn't break functionality (reconnection 
works), but it doesn't look good in the logs.

Regards,
Tobias Predel

[  107.302390] ath10k_pci :02:00.0: unsupported HTC service id: 1536
[  107.317978] ath10k_pci :02:00.0: Unknown eventid: 118809
[  107.320886] ath10k_pci :02:00.0: Unknown eventid: 90118
[  107.346304] WARNING: CPU: 1 PID: 1425 at 
drivers/net/wireless/ath/ath10k/mac.c:5650 ath10k_bss_info_changed+0xfb7/0x1120 
[ath10k_core]
[  107.346310] Modules linked in: dm_crypt algif_skcipher af_alg dm_mod rfcomm 
fuse ccm cmac arc4 bnep snd_hda_codec_hdmi snd_hda_codec_realtek 
snd_hda_codec_generic hid_multitouch ofpart cmdlinepart hid_generic joydev 
mousedev intel_spi_platform intel_spi spi_nor asus_nb_wmi asus_wmi mtd btusb 
btrtl iTCO_wdt sparse_keymap btbcm iTCO_vendor_support btintel intel_rapl 
bluetooth intel_powerclamp ath10k_pci coretemp kvm_intel ath10k_core usbhid 
crct10dif_pclmul crc32_pclmul ecdh_generic ghash_clmulni_intel ath i915 
nls_iso8859_1 mac80211 uas nls_cp437 vfat fat squashfs aesni_intel loop 
aes_x86_64 kvmgt vfio_mdev mdev crypto_simd vfio_iommu_type1 cryptd vfio 
glue_helper intel_cstate intel_xhci_usb_role_switch kvm roles input_leds pcspkr 
ak8975 irqbypass i2c_algo_bit drm_kms_helper cfg80211 snd_hda_intel 
snd_hda_codec drm snd_hda_core snd_hwdep snd_pcm snd_timer intel_gtt agpgart 
snd syscopyarea mei_txe sysfillrect processor_thermal_device sysimgblt rfkill 
int340x_thermal_zone i2c_i801 i2c_hid
[  107.346467]  fb_sys_fops mei lpc_ich soundcore intel_soc_dts_iosf 
inv_mpu6050_i2c uvcvideo battery wmi inv_mpu6050 hid 
industrialio_triggered_buffer kfifo_buf i2c_mux videobuf2_vmalloc tpm_crb 
tpm_tis industrialio tpm_tis_core videobuf2_memops ac tpm asus_wireless 
pwm_lpss_platform videobuf2_v4l2 evdev pwm_lpss elan_i2c rng_core pcc_cpufreq 
int3400_thermal acpi_thermal_rel sd_mod mac_hid intel_int0002_vgpio 
videobuf2_common videodev media sg crypto_user ip_tables x_tables usb_storage 
scsi_mod ext4 crc32c_generic crc16 mbcache jbd2 fscrypto mmc_block serio_raw 
atkbd libps2 crc32c_intel xhci_pci xhci_hcd i8042 serio sdhci_acpi sdhci 
mmc_core
[  107.346597] CPU: 1 PID: 1425 Comm: kworker/u8:12 Tainted: GW 
4.20.7-arch1-1-ARCH #1
[  107.346602] Hardware name: ASUSTeK COMPUTER INC. E205SA/E205SA, BIOS 
E205SA.302 02/10/2017
[  107.346615] Workqueue: events_unbound async_run_entry_fn
[  107.346654] RIP: 0010:ath10k_bss_info_changed+0xfb7/0x1120 [ath10k_core]
[  107.346661] Code: 4f 67 00 00 e9 a5 f1 ff ff 0f 0b 4c 89 f7 e8 00 ca d3 dd 
e9 ff f3 ff ff b8 40 00 00 00 e9 65 f5 ff ff 8b 95 70 01 00 00 eb c4 <0f> 0b e9 
02 f3 ff ff 89 c2 48 c7 c6 80 72 f4 c0 4c 89 cf 89 04 24
[  107.346665] RSP: 0018:ab0b40613cd0 EFLAGS: 00010282
[  107.346674] RAX: fffe RBX: 9e85ee0d1580 RCX: 
[  107.346679] RDX: 9e85ee0d18f8 RSI: ab0b40613cf0 RDI: 9e85e4d9b3a0
[  107.346683] RBP: 9e85e4d9b3a0 R08: 0001 R09: 
[  107.346687] R10: 001f R11:  R12: 020674ff
[  107.346692] R13: 9e85e4d9b3a8 R14: 9e85ee0d2558 R15: 9e85ee0d1580
[  107.346697] FS:  () GS:9e85f5c8() 
knlGS:
[  107.346702] CS:  0010 DS:  ES:  CR0: 80050033
[  107.346706] CR2: 55a5eba9a8e0 CR3: 2ee0a000 CR4: 001006e0
[  107.346710] Call Trace:
[  107.346757]  ? ath10k_conf_tx+0x7a/0x4b0 [ath10k_core]
[  107.346840]  ieee80211_bss_info_change_notify+0xb5/0x1c0 [mac80211]
[  107.346926]  ieee80211_reconfig+0x6c3/0x14d0 [mac80211]
[  107.346940]  ? preempt_count_add+0x79/0xb0
[  107.347018]  wiphy_resume+0x7f/0x150 [cfg80211]
[  107.347088]  ? wiphy_namespace+0x10/0x10 [cfg80211]
[  107.347097]  dpm_run_callback+0x59/0x180
[  107.347107]  device_resume+0xac/0x1f0
[  107.347116]  async_resume+0x19/0x30
[  107.347123]  async_run_entry_fn+0x37/0x140
[  107.347135]  process_one_work+0x1eb/0x410
[  107.347145]  worker_thread+0x2d/0x3d0
[  107.347153]  ? process_one_work+0x410/0x410
[  107.347161]  kthread+0x112/0x130
[  107.347169]  ? kthread_park+0x80/0x80
[  107.347181]  ret_from_fork+0x35/0x40
[  107.347194] ---[ end trace 023720a07093ea74 ]---
[  107.347286] WARNING: CPU: 1 PID: 1425 at 
drivers/net/wireless/ath/ath10k/mac.c:5688 ath10k_bss_info_changed+0xf96/0x1120 
[ath10k_core]
[  107.347289] Modules linked in: dm_crypt algif_skcipher af_alg dm_mod rfcomm 
fuse ccm cmac arc4 bnep snd_hda_codec_hdmi snd_hda_codec_realtek 
snd_hda_codec_generic hid_multitouch ofpart cmdlinepart hid_generic joydev 
mousedev intel_spi_platform intel_spi spi_nor asus_nb_wmi asus_wmi mtd btusb 
btrtl iTCO_wdt sparse_keymap btbcm iTCO_vendor_support btintel intel_rapl 
bluetooth intel_powerclamp ath10k_pci coretemp kvm_intel ath10k_core usbhid 

Re: [PATCH] ath10k: Fix shadow register implementation for WCN3990

2019-02-11 Thread Kalle Valo
Rakesh Pillai  wrote:

> WCN3990 supports shadow registers write operation support
> for copy engine for regular operation in powersave mode.
> 
> Since WCN3990 is a 64-bit target, the shadow register
> implementation needs to be done in the copy engine handlers
> for 64-bit target. Currently the shadow register implementation
> is present in the 32-bit target handlers of copy engine.
> 
> Fix the shadow register copy engine write operation
> implementation for 64-bit target(WCN3990).
> 
> Tested HW: WCN3990
> Tested FW: WLAN.HL.2.0-01188-QCAHLSWMTPLZ-1
> 
> Fixes: b7ba83f7c414 ("ath10k: add support for shadow register for WNC3990")
> Signed-off-by: Rakesh Pillai 
> Signed-off-by: Kalle Valo 

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

1863008369ae ath10k: fix shadow register implementation for WCN3990

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

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


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH] ath10k: Enable Factory Test Mode for WCN3990

2019-02-11 Thread Kalle Valo
Rakesh Pillai  wrote:

> The support to put WCN3990 firmware into Factory
> test mode is not present currently. The WCN3990
> firmware can operate in Factory test mode based
> on the mode it receives in the wlan enable message
> from the host driver.
> 
> When the host driver is started in testmode send
> the operating mode as UTF mode, to the WCN3990
> firmware, in the wlan enable message to start the
> firmware in Factory test mode.
> 
> Tested on: WCN3990
> Tested FW: WLAN.HL.2.0-01192-QCAHLSWMTPLZ-1.
> 
> Signed-off-by: Rakesh Pillai 
> Reviewed-by: Brian Norris 
> Signed-off-by: Kalle Valo 

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

3c545a25939c ath10k: enable Factory Test Mode for WCN3990

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

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


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH] ath10k: pci: use mutex for diagnostic window CE polling

2019-02-11 Thread Kalle Valo
Brian Norris  wrote:

> The DIAG copy engine is only used via polling, but it holds a spinlock
> with softirqs disabled. Each iteration of our read/write loops can
> theoretically take 20ms (two 10ms timeout loops), and this loop can be
> run an unbounded number of times while holding the spinlock -- dependent
> on the request size given by the caller.
> 
> As of commit 39501ea64116 ("ath10k: download firmware via diag Copy
> Engine for QCA6174 and QCA9377."), we transfer large chunks of firmware
> memory using this mechanism. With large enough firmware segments, this
> becomes an exceedingly long period for disabling soft IRQs. For example,
> with a 500KiB firmware segment, in testing QCA6174A, I see 200 loop
> iterations of about 50-100us each, which can total about 10-20ms.
> 
> In reality, we don't really need to block softirqs for this duration.
> The DIAG CE is only used in polling mode, and we only need to hold
> ce_lock to make sure any CE bookkeeping is done without screwing up
> another CE. Otherwise, we only need to ensure exclusion between
> ath10k_pci_diag_{read,write}_mem() contexts.
> 
> This patch moves to use fine-grained locking for the shared ce_lock,
> while adding a new mutex just to ensure mutual exclusion of diag
> read/write operations.
> 
> Tested on QCA6174A, firmware version WLAN.RM.4.4.1-00132-QCARMSWPZ-1.
> 
> Fixes: 39501ea64116 ("ath10k: download firmware via diag Copy Engine for 
> QCA6174 and QCA9377.")
> Signed-off-by: Brian Norris 
> Signed-off-by: Kalle Valo 

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

25733c4e67df ath10k: pci: use mutex for diagnostic window CE polling

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

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


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH v3 1/3] ath10k: Enable bus layer suspend/resume for WCN3990

2019-02-11 Thread Kalle Valo
Govind Singh  wrote:

> Register snoc bus layer suspend/resume PM ops and configure
> the wakeup source(CE2) for the device.
> 
> Testing:
> Tested on WCN3990 HW.
> Tested FW: WLAN.HL.2.0-01192-QCAHLSWMTPLZ-1.
> 
> Signed-off-by: Govind Singh 
> Signed-off-by: Kalle Valo 

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

185be1c66469 ath10k: enable bus layer suspend/resume for WCN3990
de8781d7e74d ath10k: disable interface pause wow config for integrated chipset
c40e448e0bcf ath10k: request credit report if flow control enabled on ep

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

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


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH v2] ath10k: implement set_base_macaddr to fix rx-bssid mask in multiple APs conf

2019-02-11 Thread Kalle Valo
Christian Lamparter  wrote:

> Many integrated QCA9984 WiFis in various IPQ806x platform routers
> from various vendors (Netgear R7800, ZyXEL NBG6817, TP-LINK C2600,
> etc.) have either blank, bogus or non-unique MAC-addresses in
> their calibration data.
> 
> As a result, OpenWrt utilizes a discouraged binary calibration data
> patching method that allows to modify the device's MAC-addresses right
> at the source. This is because the ath10k' firmware extracts the MAC
> address from the supplied radio/calibration data and issues a response
> to the ath10k linux driver. Which was designed to take the main MAC in
> ath10k_wmi_event_ready().
> 
> Part of the "setting an alternate MAC" issue was already tackled by a
> patch from Brian Norris:
> commit 9d5804662ce1
> ("ath10k: retrieve MAC address from system firmware if provided")
> by allowing the option to specify an alternate MAC-address with the
> established device_get_mac_address() function which extracts the right
> address from DeviceTree/fwnode mac-address or local-mac-address
> properties and saves it for later.
> 
> However, Ben Greear noted that the Qualcomm's ath10k firmware is liable
> to not properly calculate its rx-bssid mask in this case. This can cause
> issues in the popluar "multiple AP with a single ath10k instance"
> configurations.
> 
> To improve MAC address handling, Felix Fietkau suggested to call
> pdev_set_base_macaddr_cmdid before bringing up the first vif and
> use the first vif MAC address there. Which is in ath10k_core_start().
> 
> This patch implement Felix Fietkau's request to
> "call pdev_set_base_macaddr_cmdid before bringing up the first vif".
> The pdev_set_base_macaddr_cmdid is already declared for all devices
> and version. The driver just needed the support code for this
> function.
> 
> Tested on:
> QCA9880/CUS223, firmwares: 10.2.4.13-2, 10.2.4.70.44, 10.2.4-1.0-00041
> QCA9887/MR33 firmware:10.2.4-1.0-00033
> QCA4019/RT-AC58U firmware: 10.4-3.4-00104, 10.4-3.5.3-00057
> QCA9984/R7800 firmware: Candela Technologies (CT) Firmware
> 
> BugLink: 
> https://lists.openwrt.org/pipermail/openwrt-devel/2018-November/014595.html
> Fixes: 9d5804662ce1 ("ath10k: retrieve MAC address from system firmware if 
> provided")
> Cc: Brian Norris 
> Cc: Ben Greear 
> Cc: Felix Fietkau 
> Cc: Mathias Kresin 
> Signed-off-by: Christian Lamparter 
> Tested-by: Brian Norris 
> Signed-off-by: Kalle Valo 

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

05e7ba24b10d ath10k: implement set_base_macaddr to fix rx-bssid mask in 
multiple APs conf

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

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


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH 1/2] ath10k: Assign 'n_cipher_suites = 11' for WCN3990 to enable WPA3

2019-02-11 Thread Kalle Valo
Abhishek Ambure  wrote:

> Hostapd uses CCMP, GCMP & GCMP-256 as 'wpa_pairwise' option to run WPA3.
> In WCN3990 firmware cipher suite numbers 9 to 11 are for CCMP,
> GCMP & GCMP-256.
> 
> To enable CCMP, GCMP & GCMP-256 cipher suites in WCN3990 firmware,
> host sets 'n_cipher_suites = 11' while initializing hardware parameters.
> 
> Tested HW: WCN3990
> Tested FW: WLAN.HL.2.0-01188-QCAHLSWMTPLZ-1
> 
> Signed-off-by: Abhishek Ambure 
> Signed-off-by: Kalle Valo 

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

7ba31e6e0cdc ath10k: assign 'n_cipher_suites = 11' for WCN3990 to enable WPA3
7d94f862d648 ath10k: update GCMP & GCMP-256 cipher suite number for WCN3990

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

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


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 5/6] ath10k: fix documentation in ath10k_wow_convert_8023_to_80211()

2019-02-11 Thread Kalle Valo
With W=1 there's a warning:

drivers/net/wireless/ath/ath10k/wow.c:93: warning: Function parameter or member 
'new' not described in 'ath10k_wow_convert_8023_to_80211'
drivers/net/wireless/ath/ath10k/wow.c:93: warning: Function parameter or member 
'old' not described in 'ath10k_wow_convert_8023_to_80211'

Fix it by changing the documentation marker '/**' to a normal code comment.
While at it, clean up the line wrapping.

Signed-off-by: Kalle Valo 
---
 drivers/net/wireless/ath/ath10k/wow.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wow.c 
b/drivers/net/wireless/ath/ath10k/wow.c
index 36d4245c308e..b36fa0f8892e 100644
--- a/drivers/net/wireless/ath/ath10k/wow.c
+++ b/drivers/net/wireless/ath/ath10k/wow.c
@@ -77,7 +77,7 @@ static int ath10k_wow_cleanup(struct ath10k *ar)
return 0;
 }
 
-/**
+/*
  * Convert a 802.3 format to a 802.11 format.
  * ++---+++
  * 802.3:  |dest mac(6B)|src mac(6B)|type(2B)| body...|
@@ -88,9 +88,8 @@ static int ath10k_wow_cleanup(struct ath10k *ar)
  * 802.11: |4B|dest mac(6B)| 6B |src mac(6B)|  8B  |type(2B)|  body...  |
  * +--+++---+---+---+
  */
-static void ath10k_wow_convert_8023_to_80211
-   (struct cfg80211_pkt_pattern *new,
-   const struct cfg80211_pkt_pattern *old)
+static void ath10k_wow_convert_8023_to_80211(struct cfg80211_pkt_pattern *new,
+const struct cfg80211_pkt_pattern 
*old)
 {
u8 hdr_8023_pattern[ETH_HLEN] = {};
u8 hdr_8023_bit_mask[ETH_HLEN] = {};
-- 
2.7.4


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 6/6] ath10k: copy the whole struct ath10k_bus_params in ath10k_core_register()

2019-02-11 Thread Kalle Valo
Instead of copying fields one by one copy the whole structure. This way there's
no need to modify the function every time we add a new field to the struct.

Compile tested only.

Signed-off-by: Kalle Valo 
---
 drivers/net/wireless/ath/ath10k/core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 6c1dd5f8d012..a1b2aea4a77f 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -2997,9 +2997,8 @@ static void ath10k_core_register_work(struct work_struct 
*work)
 int ath10k_core_register(struct ath10k *ar,
 const struct ath10k_bus_params *bus_params)
 {
-   ar->bus_param.chip_id = bus_params->chip_id;
-   ar->bus_param.dev_type = bus_params->dev_type;
-   ar->bus_param.link_can_suspend = bus_params->link_can_suspend;
+   ar->bus_param = *bus_params;
+
queue_work(ar->workqueue, >register_work);
 
return 0;
-- 
2.7.4


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 4/6] ath10k: align ath10k_htt_txbuf structures

2019-02-11 Thread Kalle Valo
With W=1 GCC warns:

drivers/net/wireless/ath/ath10k/htt.h:1746:1: warning: alignment 1 of 'struct 
ath10k_htt_txbuf_32' is less than 4 [-Wpacked-not-aligned]
drivers/net/wireless/ath/ath10k/htt.h:1753:1: warning: alignment 1 of 'struct 
ath10k_htt_txbuf_64' is less than 4 [-Wpacked-not-aligned]

Fix that by using __align(4). Compile tested only.

Signed-off-by: Kalle Valo 
---
 drivers/net/wireless/ath/ath10k/htt.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt.h 
b/drivers/net/wireless/ath/ath10k/htt.h
index 005fad94edad..d194bbe18fc3 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -1743,14 +1743,14 @@ struct ath10k_htt_txbuf_32 {
struct ath10k_htc_hdr htc_hdr;
struct htt_cmd_hdr cmd_hdr;
struct htt_data_tx_desc cmd_tx;
-} __packed;
+} __packed __aligned(4);
 
 struct ath10k_htt_txbuf_64 {
struct htt_data_tx_desc_frag frags[2];
struct ath10k_htc_hdr htc_hdr;
struct htt_cmd_hdr cmd_hdr;
struct htt_data_tx_desc_64 cmd_tx;
-} __packed;
+} __packed __aligned(4);
 
 struct ath10k_htt {
struct ath10k *ar;
-- 
2.7.4


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 1/6] ath10k: add missing values to wmi_service_name()

2019-02-11 Thread Kalle Valo
After implementing the next patch GCC reported:

drivers/net/wireless/ath/ath10k/wmi.h:385:2: warning: enumeration value 
'WMI_SERVICE_BTCOEX' not handled in switch [-Wswitch]
drivers/net/wireless/ath/ath10k/wmi.h:385:2: warning: enumeration value 
'WMI_SERVICE_MGMT_TX_WMI' not handled in switch [-Wswitch]
drivers/net/wireless/ath/ath10k/wmi.h:385:2: warning: enumeration value 
'WMI_SERVICE_SPOOF_MAC_SUPPORT' not handled in switch [-Wswitch]
drivers/net/wireless/ath/ath10k/wmi.h:385:2: warning: enumeration value 
'WMI_SERVICE_VDEV_DISABLE_4_ADDR_SRC_LRN_SUPPORT' not handled in switch 
[-Wswitch]
drivers/net/wireless/ath/ath10k/wmi.h:385:2: warning: enumeration value 
'WMI_SERVICE_BB_TIMING_CONFIG_SUPPORT' not handled in switch [-Wswitch]
drivers/net/wireless/ath/ath10k/wmi.h:385:2: warning: enumeration value 
'WMI_SERVICE_THERM_THROT' not handled in switch [-Wswitch]

Signed-off-by: Kalle Valo 
---
 drivers/net/wireless/ath/ath10k/wmi.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index b10ed523b99e..529f5a26f3f3 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -475,6 +475,7 @@ static inline char *wmi_service_name(int service_id)
SVCSTR(WMI_SERVICE_TX_MODE_PUSH_PULL);
SVCSTR(WMI_SERVICE_TX_MODE_DYNAMIC);
SVCSTR(WMI_SERVICE_VDEV_RX_FILTER);
+   SVCSTR(WMI_SERVICE_BTCOEX);
SVCSTR(WMI_SERVICE_CHECK_CAL_VERSION);
SVCSTR(WMI_SERVICE_DBGLOG_WARN2);
SVCSTR(WMI_SERVICE_BTCOEX_DUTY_CYCLE);
@@ -484,13 +485,18 @@ static inline char *wmi_service_name(int service_id)
SVCSTR(WMI_SERVICE_SMART_LOGGING_SUPPORT);
SVCSTR(WMI_SERVICE_TDLS_CONN_TRACKER_IN_HOST_MODE);
SVCSTR(WMI_SERVICE_TDLS_EXPLICIT_MODE_ONLY);
+   SVCSTR(WMI_SERVICE_MGMT_TX_WMI);
SVCSTR(WMI_SERVICE_TDLS_WIDER_BANDWIDTH);
SVCSTR(WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS);
SVCSTR(WMI_SERVICE_HOST_DFS_CHECK_SUPPORT);
SVCSTR(WMI_SERVICE_TPC_STATS_FINAL);
SVCSTR(WMI_SERVICE_RESET_CHIP);
+   SVCSTR(WMI_SERVICE_SPOOF_MAC_SUPPORT);
SVCSTR(WMI_SERVICE_TX_DATA_ACK_RSSI);
SVCSTR(WMI_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT);
+   SVCSTR(WMI_SERVICE_VDEV_DISABLE_4_ADDR_SRC_LRN_SUPPORT);
+   SVCSTR(WMI_SERVICE_BB_TIMING_CONFIG_SUPPORT);
+   SVCSTR(WMI_SERVICE_THERM_THROT);
SVCSTR(WMI_SERVICE_RTT_RESPONDER_ROLE);
SVCSTR(WMI_SERVICE_PER_PACKET_SW_ENCRYPT);
SVCSTR(WMI_SERVICE_REPORT_AIRTIME);
-- 
2.7.4


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 2/6] ath10k: make wmi_service_name() warn about missing service ids

2019-02-11 Thread Kalle Valo
When adding a new value to enum wmi_service it's very easy to miss that the new
value should be also added to wmi_service_name() mapping function. Modify the
function so that GCC can now warn about this:

drivers/net/wireless/ath/ath10k/wmi.h:385:2: warning: enumeration value 
'WMI_SERVICE_FOO' not handled in switch [-Wswitch]

And also add a reminder to the enum.

Thanks to Jouni Malinen for the idea.

Signed-off-by: Kalle Valo 
---
 drivers/net/wireless/ath/ath10k/wmi.h | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index 529f5a26f3f3..74ce1a4c0e8f 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -212,6 +212,8 @@ enum wmi_service {
WMI_SERVICE_PER_PACKET_SW_ENCRYPT,
WMI_SERVICE_REPORT_AIRTIME,
 
+   /* Remember to add the new value to wmi_service_name()! */
+
/* keep last */
WMI_SERVICE_MAX,
 };
@@ -378,7 +380,7 @@ enum wmi_10_4_service {
WMI_10_4_SERVICE_REPORT_AIRTIME,
 };
 
-static inline char *wmi_service_name(int service_id)
+static inline char *wmi_service_name(enum wmi_service service_id)
 {
 #define SVCSTR(x) case x: return #x
 
@@ -501,11 +503,13 @@ static inline char *wmi_service_name(int service_id)
SVCSTR(WMI_SERVICE_PER_PACKET_SW_ENCRYPT);
SVCSTR(WMI_SERVICE_REPORT_AIRTIME);
 
-   default:
+   case WMI_SERVICE_MAX:
return NULL;
}
 
 #undef SVCSTR
+
+   return NULL;
 }
 
 #define WMI_SERVICE_IS_ENABLED(wmi_svc_bmap, svc_id, len) \
-- 
2.7.4


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH v6 4/4] ath10k: reporting estimated tx airtime for fairness

2019-02-11 Thread Kalle Valo
Toke Høiland-Jørgensen wrote:

> The airtime of a transmitted frame will be estimated from last used tx rate
> which the firmware reports with the peer stats feature
> (WMI_SERVICE_PEER_STATS). The airtime is computed on the tx path and it
> will be reported to mac80211 upon tx completion.
> 
> This change is based on Kan's orginal commit in Chromium tree
> ("CHROMIUM: ath10k: Implementing airtime fairness based TX scheduler")
> ref: https://chromium-review.googlesource.com/588190
> 
> Tested on QCA4019 with firmware version 10.4-3.2.1.1-00015
> Tested on QCA9984 with firmware version 10.4-3.9.0.1-5
> 
> Signed-off-by: Kan Yan 
> [rmano...@codeaurora.org: ported only the airtime computation]
> Signed-off-by: Rajkumar Manoharan 
> [t...@redhat.com: Rebase to mac80211-next, add test note]
> Signed-off-by: Toke Høiland-Jørgensen 
> Signed-off-by: Kalle Valo 

There was a trivial conflict, please check my resolution in the pending branch.
I also reworded the commit log a bit.

$ git am -s --reject 10775551.mbox
Applying: ath10k: reporting estimated tx airtime for fairness
Checking patch drivers/net/wireless/ath/ath10k/core.h...
Checking patch drivers/net/wireless/ath/ath10k/htt_rx.c...
Hunk #1 succeeded at 3080 (offset 2 lines).
Checking patch drivers/net/wireless/ath/ath10k/mac.c...
Hunk #1 succeeded at 3566 (offset 22 lines).
Hunk #2 succeeded at 3583 (offset 22 lines).
Hunk #3 succeeded at 3971 (offset 22 lines).
Hunk #4 succeeded at 4029 (offset 22 lines).
Hunk #5 succeeded at 4047 (offset 22 lines).
Hunk #6 succeeded at 4315 (offset 22 lines).
Hunk #7 succeeded at 8671 (offset 20 lines).
Checking patch drivers/net/wireless/ath/ath10k/txrx.c...
error: while searching for:
wake_up(>empty_tx_wq);
spin_unlock_bh(>tx_lock);

if (ar->dev_type != ATH10K_DEV_TYPE_HL)
dma_unmap_single(dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE);


error: patch failed: drivers/net/wireless/ath/ath10k/txrx.c:95
Applied patch drivers/net/wireless/ath/ath10k/core.h cleanly.
Applied patch drivers/net/wireless/ath/ath10k/htt_rx.c cleanly.
Applied patch drivers/net/wireless/ath/ath10k/mac.c cleanly.
Applying patch drivers/net/wireless/ath/ath10k/txrx.c with 1 reject...
Rejected hunk #1.
Patch failed at 0001 ath10k: reporting estimated tx airtime for fairness

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

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


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH] ath10k: report tx airtime provided by fw

2019-02-11 Thread Kalle Valo
Manikanta Pubbisetty  wrote:

> If supported, update transmit airtime in mac80211 with the airtime
> values reported by the firmware. TX airtime of the PPDU is reported
> via HTT data TX completion indication message.
> 
> A new service flag 'WMI_SERVICE_REPORT_AIRTIME' is added to advertise
> the firmware support. For firmwares which do not support this feature,
> TX airtime is calculated in the driver using TX bitrate.
> 
> Hardwares tested : QCA9984
> Firmwares tested : 10.4-3.6.1-00841
> 
> Signed-off-by: Manikanta Pubbisetty 
> Signed-off-by: Kalle Valo 

I had some conflicts, please carefully check my resolution in the pending 
branch:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending=1baca5592c99c9d61924956c56c620d371b61d96

$ git am -s --reject 10684687.mbox
Applying: ath10k: report tx airtime provided by fw
Checking patch drivers/net/wireless/ath/ath10k/core.c...
Hunk #1 succeeded at 2631 (offset 32 lines).
Checking patch drivers/net/wireless/ath/ath10k/htt.h...
Hunk #1 succeeded at 571 (offset 7 lines).
Hunk #2 succeeded at 584 (offset 7 lines).
Hunk #3 succeeded at 877 (offset 7 lines).
Checking patch drivers/net/wireless/ath/ath10k/htt_rx.c...
Hunk #1 succeeded at 2220 (offset 217 lines).
Hunk #2 succeeded at 2249 (offset 217 lines).
Hunk #3 succeeded at 2286 (offset 217 lines).
Checking patch drivers/net/wireless/ath/ath10k/mac.c...
Hunk #1 succeeded at 4007 (offset 40 lines).
error: while searching for:
wiphy_ext_feature_set(ar->hw->wiphy,
  NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT);

if (ath10k_peer_stats_enabled(ar))
wiphy_ext_feature_set(ar->hw->wiphy,
  NL80211_EXT_FEATURE_AIRTIME_FAIRNESS);
/*

error: patch failed: drivers/net/wireless/ath/ath10k/mac.c:8615
Checking patch drivers/net/wireless/ath/ath10k/txrx.c...
Checking patch drivers/net/wireless/ath/ath10k/wmi.h...
error: while searching for:
WMI_SERVICE_SPOOF_MAC_SUPPORT,
WMI_SERVICE_TX_DATA_ACK_RSSI,
WMI_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT,

/* keep last */
WMI_SERVICE_MAX,

error: patch failed: drivers/net/wireless/ath/ath10k/wmi.h:205
error: while searching for:
WMI_10_4_SERVICE_PEER_TID_CONFIGS_SUPPORT,
WMI_10_4_SERVICE_VDEV_BCN_RATE_CONTROL,
WMI_10_4_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT,
};

static inline char *wmi_service_name(int service_id)

error: patch failed: drivers/net/wireless/ath/ath10k/wmi.h:359
error: while searching for:
SVCSTR(WMI_SERVICE_RESET_CHIP);
SVCSTR(WMI_SERVICE_TX_DATA_ACK_RSSI);
SVCSTR(WMI_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT);
default:
return NULL;
}

error: patch failed: drivers/net/wireless/ath/ath10k/wmi.h:474
error: while searching for:
   WMI_SERVICE_TX_DATA_ACK_RSSI, len);
SVCMAP(WMI_10_4_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT,
   WMI_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT, len);
}

#undef SVCMAP

error: patch failed: drivers/net/wireless/ath/ath10k/wmi.h:786
Hunk #5 succeeded at 2989 (offset -7 lines).
Applied patch drivers/net/wireless/ath/ath10k/core.c cleanly.
Applied patch drivers/net/wireless/ath/ath10k/htt.h cleanly.
Applied patch drivers/net/wireless/ath/ath10k/htt_rx.c cleanly.
Applying patch drivers/net/wireless/ath/ath10k/mac.c with 1 reject...
Hunk #1 applied cleanly.
Rejected hunk #2.
Applied patch drivers/net/wireless/ath/ath10k/txrx.c cleanly.
Applying patch drivers/net/wireless/ath/ath10k/wmi.h with 4 rejects...
Rejected hunk #1.
Rejected hunk #2.
Rejected hunk #3.
Rejected hunk #4.
Hunk #5 applied cleanly.
Patch failed at 0001 ath10k: report tx airtime provided by fw

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

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


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH v2] ath10k: add dynamic vlan support

2019-02-11 Thread Kalle Valo
Manikanta Pubbisetty  wrote:

> Multicast/broadcast traffic destined for a particular vlan group will
> always be encrypted in software. To enable dynamic VLANs, it requires
> driver support for sending software encrypted packets.
> 
> In ath10k, sending software encrypted frames is allowed only when we insmod
> the driver with cryptmode param set to 1, this configuration disables
> hardware crypto and enables RAW mode implicitly. Since, enabling raw
> mode has performance impact, this cannot be considered as an ideal
> solution for supporting VLANs in the driver.
> 
> As an alternative take, in this approach, cryptographic keys for
> unicast traffic (per peer PTKs) and keys for non-vlan group traffic
> will be configured in hardware, allowing hardware encryption for unicast
> and non-vlan group traffic. Only vlan group traffic will be encrypted in
> software and pushed to the target with encap mode set to RAW in the TX
> descriptors.
> 
> Not all firmwares can support this type of key configuration(having few
> keys installed in hardware and few only in software); for this purpose a
> new WMI service flag "WMI_SERVICE_PER_PACKET_SW_ENCRYPT" is introduced to
> advertise this support.
> 
> Also, adding the logic required to send sw encrypted frames in raw mode.
> 
> Hardwares Tested : QCA9984, QCA988X
> Firmwares Tested : 10.4-3.5.3-00057, 10.2.4-1.0-00042
> 
> Signed-off-by: Manikanta Pubbisetty 
> Signed-off-by: Kalle Valo 

I had to fix some conflicts, please carefully check my resolution in the 
pending branch:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending=7ae879447535ae1327e78dc614385ff6dd45c2fd

Applying: ath10k: add dynamic vlan support
Using index info to reconstruct a base tree...
M   drivers/net/wireless/ath/ath10k/core.h
M   drivers/net/wireless/ath/ath10k/mac.c
M   drivers/net/wireless/ath/ath10k/wmi.h
Falling back to patching base and 3-way merge...
Auto-merging drivers/net/wireless/ath/ath10k/wmi.h
CONFLICT (content): Merge conflict in drivers/net/wireless/ath/ath10k/wmi.h
Auto-merging drivers/net/wireless/ath/ath10k/mac.c
Auto-merging drivers/net/wireless/ath/ath10k/core.h
Recorded preimage for 'drivers/net/wireless/ath/ath10k/wmi.h'
error: Failed to merge in the changes.
Patch failed at 0001 ath10k: add dynamic vlan support

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

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


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH] ath10k: Add support to configure ftm responder role

2019-02-11 Thread Kalle Valo
Pradeep Kumar Chitrapu  wrote:

> Configure fine timing measurement (FTM) responder role from the
> ftm_responder bss param sent by mac80211. With FTM functionality offloaded
> to firmware, adding the interface allows userspace to enable or disable
> FTM responder functionality. ath10k disables it at the time of interface
> creation.
> 
> Supported FW: 10.4
> 
> Tested on IPQ4019 with firmware: 10.4-3.2.1.1-00022
> 
> Signed-off-by: Pradeep Kumar Chitrapu 
> Signed-off-by: Kalle Valo 

I had to fix some conflicts, please carefully check my resolution in the 
pending branch:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending=a3e53eb1c7c58b131ebc0581aa44b0912809e430

$ git am -s -3 10798883.mbox
Applying: ath10k: Add support to configure ftm responder role
Using index info to reconstruct a base tree...
M   drivers/net/wireless/ath/ath10k/core.h
M   drivers/net/wireless/ath/ath10k/mac.c
M   drivers/net/wireless/ath/ath10k/wmi.c
M   drivers/net/wireless/ath/ath10k/wmi.h
Falling back to patching base and 3-way merge...
Auto-merging drivers/net/wireless/ath/ath10k/wmi.h
CONFLICT (content): Merge conflict in drivers/net/wireless/ath/ath10k/wmi.h
Auto-merging drivers/net/wireless/ath/ath10k/wmi.c
CONFLICT (content): Merge conflict in drivers/net/wireless/ath/ath10k/wmi.c
Auto-merging drivers/net/wireless/ath/ath10k/mac.c
CONFLICT (content): Merge conflict in drivers/net/wireless/ath/ath10k/mac.c
Auto-merging drivers/net/wireless/ath/ath10k/core.h
Recorded preimage for 'drivers/net/wireless/ath/ath10k/mac.c'
Recorded preimage for 'drivers/net/wireless/ath/ath10k/wmi.c'
Recorded preimage for 'drivers/net/wireless/ath/ath10k/wmi.h'
error: Failed to merge in the changes.
Patch failed at 0001 ath10k: Add support to configure ftm responder role

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

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


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k