Re: [PATCH v4] ath10k: enable raw encap mode and software crypto engine.

2015-07-27 Thread Liu CF/TW
Hi Kalle. I reviewed the change and it looks good to me.

Thanks
David

On Fri, Jul 24, 2015 at 10:29 AM, Kalle Valo kv...@qca.qualcomm.com wrote:
 Liu CF/TW cfliu...@gmail.com writes:

 From: David Liu cfliu...@gmail.com

   This patch enables raw Rx/Tx encap mode to support software based
   crypto engine. This patch introduces a new module param 'cryptmode'.

cryptmode:

  0: Use hardware crypto engine globally with native Wi-Fi mode TX/RX
 encapsulation to the firmware. This is the default mode.
  1: Use sofware crypto engine globally with raw mode TX/RX
 encapsulation to the firmware.

Known limitation:
  A-MSDU must be disabled for RAW Tx encap mode to perform well when
  heavy traffic is applied.

Testing: (by Michal Kazior michal.kaz...@tieto.com)

  a) Performance Testing

   cryptmode=1
ap=qca988x sta=killer1525
 killer1525  -  qca988x 194.496 mbps [tcp1 ip4]
 killer1525  -  qca988x 238.309 mbps [tcp5 ip4]
 killer1525  -  qca988x 266.958 mbps [udp1 ip4]
 killer1525  -  qca988x 477.468 mbps [udp5 ip4]
 qca988x -  killer1525  301.378 mbps [tcp1 ip4]
 qca988x -  killer1525  297.949 mbps [tcp5 ip4]
 qca988x -  killer1525  331.351 mbps [udp1 ip4]
 qca988x -  killer1525  371.528 mbps [udp5 ip4]
ap=killer1525 sta=qca988x
 qca988x -  killer1525  331.447 mbps [tcp1 ip4]
 qca988x -  killer1525  328.783 mbps [tcp5 ip4]
 qca988x -  killer1525  375.309 mbps [udp1 ip4]
 qca988x -  killer1525  403.379 mbps [udp5 ip4]
 killer1525  -  qca988x 203.689 mbps [tcp1 ip4]
 killer1525  -  qca988x 222.339 mbps [tcp5 ip4]
 killer1525  -  qca988x 264.199 mbps [udp1 ip4]
 killer1525  -  qca988x 479.371 mbps [udp5 ip4]

   Note:
- only open network tested for RAW vs nwifi performance comparison
- killer1525 (qca6174 hw2.2) is 2x2 device (hence max 866mbps)
- used iperf
- OTA, devices a few cm apart from each other, no shielding
- tcpX/udpX, X - means number of threads used

   Overview:
- relative Tx performance drop is seen but is within reasonable and
  expected threshold (A-MSDU must be disabled with RAW Tx)

  b) Connectivity Testing

   cryptmode=1
ap=iwl6205 sta1=qca988x crypto=open topology-1ap1sta  OK
ap=iwl6205 sta1=qca988x crypto=wep1 topology-1ap1sta  OK
ap=iwl6205 sta1=qca988x crypto=wpa  topology-1ap1sta  OK
ap=iwl6205 sta1=qca988x crypto=wpa-ccmp topology-1ap1sta  OK
ap=qca988x sta1=iwl6205 crypto=open topology-1ap1sta  OK
ap=qca988x sta1=iwl6205 crypto=wep1 topology-1ap1sta  OK
ap=qca988x sta1=iwl6205 crypto=wpa  topology-1ap1sta  OK
ap=qca988x sta1=iwl6205 crypto=wpa-ccmp topology-1ap1sta  OK
ap=iwl6205 sta1=qca988x crypto=open topology-1ap1sta2br   OK
ap=iwl6205 sta1=qca988x crypto=wep1 topology-1ap1sta2br   OK
ap=iwl6205 sta1=qca988x crypto=wpa  topology-1ap1sta2br   OK
ap=iwl6205 sta1=qca988x crypto=wpa-ccmp topology-1ap1sta2br   OK
ap=qca988x sta1=iwl6205 crypto=open topology-1ap1sta2br   OK
ap=qca988x sta1=iwl6205 crypto=wep1 topology-1ap1sta2br   OK
ap=qca988x sta1=iwl6205 crypto=wpa  topology-1ap1sta2br   OK
ap=qca988x sta1=iwl6205 crypto=wpa-ccmp topology-1ap1sta2br   OK
ap=iwl6205 sta1=qca988x crypto=open topology-1ap1sta2br1vlan  OK
ap=iwl6205 sta1=qca988x crypto=wep1 topology-1ap1sta2br1vlan  OK
ap=iwl6205 sta1=qca988x crypto=wpa  topology-1ap1sta2br1vlan  OK
ap=iwl6205 sta1=qca988x crypto=wpa-ccmp topology-1ap1sta2br1vlan  OK
ap=qca988x sta1=iwl6205 crypto=open topology-1ap1sta2br1vlan  OK
ap=qca988x sta1=iwl6205 crypto=wep1 topology-1ap1sta2br1vlan  OK
ap=qca988x sta1=iwl6205 crypto=wpa  topology-1ap1sta2br1vlan  OK
ap=qca988x sta1=iwl6205 crypto=wpa-ccmp topology-1ap1sta2br1vlan  OK

   Note:
- each test takes all possible endpoint pairs and pings
- each pair-ping flushes arp table
- ip6 is used

  c) Testbed Topology:

   1ap1sta:
 [ap]  [sta]

 endpoints: ap, sta

   1ap1sta2br:
 [veth0] [ap]  [sta] [veth2]
| |  | |
 [veth1]  |  \   [veth3]
 \   /\  /
 [br0][br1]

 endpoints: veth0, veth2, br0, br1
 note: STA works in 4addr mode, AP has wds_sta=1

   1ap1sta2br1vlan:
 [veth0] [ap]  [sta] [veth2]
| |  | |
 [veth1]  |  \   [veth3]
 \   /\  /
   [br0

[PATCH v4] ath10k: enable raw encap mode and software crypto engine.

2015-06-12 Thread Liu CF/TW
From: David Liu cfliu...@gmail.com

  This patch enables raw Rx/Tx encap mode to support software based
  crypto engine. This patch introduces a new module param 'cryptmode'.

   cryptmode:

 0: Use hardware crypto engine globally with native Wi-Fi mode TX/RX
encapsulation to the firmware. This is the default mode.
 1: Use sofware crypto engine globally with raw mode TX/RX
encapsulation to the firmware.

   Known limitation:
 A-MSDU must be disabled for RAW Tx encap mode to perform well when
 heavy traffic is applied.

   Testing: (by Michal Kazior michal.kaz...@tieto.com)

 a) Performance Testing

  cryptmode=1
   ap=qca988x sta=killer1525
killer1525  -  qca988x 194.496 mbps [tcp1 ip4]
killer1525  -  qca988x 238.309 mbps [tcp5 ip4]
killer1525  -  qca988x 266.958 mbps [udp1 ip4]
killer1525  -  qca988x 477.468 mbps [udp5 ip4]
qca988x -  killer1525  301.378 mbps [tcp1 ip4]
qca988x -  killer1525  297.949 mbps [tcp5 ip4]
qca988x -  killer1525  331.351 mbps [udp1 ip4]
qca988x -  killer1525  371.528 mbps [udp5 ip4]
   ap=killer1525 sta=qca988x
qca988x -  killer1525  331.447 mbps [tcp1 ip4]
qca988x -  killer1525  328.783 mbps [tcp5 ip4]
qca988x -  killer1525  375.309 mbps [udp1 ip4]
qca988x -  killer1525  403.379 mbps [udp5 ip4]
killer1525  -  qca988x 203.689 mbps [tcp1 ip4]
killer1525  -  qca988x 222.339 mbps [tcp5 ip4]
killer1525  -  qca988x 264.199 mbps [udp1 ip4]
killer1525  -  qca988x 479.371 mbps [udp5 ip4]

  Note:
   - only open network tested for RAW vs nwifi performance comparison
   - killer1525 (qca6174 hw2.2) is 2x2 device (hence max 866mbps)
   - used iperf
   - OTA, devices a few cm apart from each other, no shielding
   - tcpX/udpX, X - means number of threads used

  Overview:
   - relative Tx performance drop is seen but is within reasonable and
 expected threshold (A-MSDU must be disabled with RAW Tx)

 b) Connectivity Testing

  cryptmode=1
   ap=iwl6205 sta1=qca988x crypto=open topology-1ap1sta  OK
   ap=iwl6205 sta1=qca988x crypto=wep1 topology-1ap1sta  OK
   ap=iwl6205 sta1=qca988x crypto=wpa  topology-1ap1sta  OK
   ap=iwl6205 sta1=qca988x crypto=wpa-ccmp topology-1ap1sta  OK
   ap=qca988x sta1=iwl6205 crypto=open topology-1ap1sta  OK
   ap=qca988x sta1=iwl6205 crypto=wep1 topology-1ap1sta  OK
   ap=qca988x sta1=iwl6205 crypto=wpa  topology-1ap1sta  OK
   ap=qca988x sta1=iwl6205 crypto=wpa-ccmp topology-1ap1sta  OK
   ap=iwl6205 sta1=qca988x crypto=open topology-1ap1sta2br   OK
   ap=iwl6205 sta1=qca988x crypto=wep1 topology-1ap1sta2br   OK
   ap=iwl6205 sta1=qca988x crypto=wpa  topology-1ap1sta2br   OK
   ap=iwl6205 sta1=qca988x crypto=wpa-ccmp topology-1ap1sta2br   OK
   ap=qca988x sta1=iwl6205 crypto=open topology-1ap1sta2br   OK
   ap=qca988x sta1=iwl6205 crypto=wep1 topology-1ap1sta2br   OK
   ap=qca988x sta1=iwl6205 crypto=wpa  topology-1ap1sta2br   OK
   ap=qca988x sta1=iwl6205 crypto=wpa-ccmp topology-1ap1sta2br   OK
   ap=iwl6205 sta1=qca988x crypto=open topology-1ap1sta2br1vlan  OK
   ap=iwl6205 sta1=qca988x crypto=wep1 topology-1ap1sta2br1vlan  OK
   ap=iwl6205 sta1=qca988x crypto=wpa  topology-1ap1sta2br1vlan  OK
   ap=iwl6205 sta1=qca988x crypto=wpa-ccmp topology-1ap1sta2br1vlan  OK
   ap=qca988x sta1=iwl6205 crypto=open topology-1ap1sta2br1vlan  OK
   ap=qca988x sta1=iwl6205 crypto=wep1 topology-1ap1sta2br1vlan  OK
   ap=qca988x sta1=iwl6205 crypto=wpa  topology-1ap1sta2br1vlan  OK
   ap=qca988x sta1=iwl6205 crypto=wpa-ccmp topology-1ap1sta2br1vlan  OK

  Note:
   - each test takes all possible endpoint pairs and pings
   - each pair-ping flushes arp table
   - ip6 is used

 c) Testbed Topology:

  1ap1sta:
[ap]  [sta]

endpoints: ap, sta

  1ap1sta2br:
[veth0] [ap]  [sta] [veth2]
   | |  | |
[veth1]  |  \   [veth3]
\   /\  /
[br0][br1]

endpoints: veth0, veth2, br0, br1
note: STA works in 4addr mode, AP has wds_sta=1

  1ap1sta2br1vlan:
[veth0] [ap]  [sta] [veth2]
   | |  | |
[veth1]  |  \   [veth3]
\   /\  /
  [br0]  [br1]
|  |
  [vlan0_id2][vlan1_id2]

endpoints: vlan0_id2, vlan1_id2
note: STA works in 4addr mode, AP has wds_sta=1

  Credits:

Thanks to Michal Kazior michal.kaz...@tieto.com who helped find 

Re: [PATCH v3] ath10k: add 'cryptmode' param to support raw tx injection and software crypto

2015-06-11 Thread Liu CF/TW
On Thu, Jun 11, 2015 at 6:59 AM, Kalle Valo kv...@qca.qualcomm.com wrote:
 Liu CF/TW cfliu...@gmail.com writes:

 This change supports hardware crypto engine bypass by enabling raw
 Rx/Tx encap mode. This enables use cases such as software crypto and raw
 tx injection. This change introduces a new module param 'cryptmode'.

 cryptmode:

   0: Use hardware crypto engine globally with native Wi-Fi mode TX/RX
  encapsulation to the firmware. This is the default mode.
   1: Use sofware crypto engine globally with raw mode TX/RX encapsulation
  to the firmware.

 These two values are ok.

   2: Supports both hardware and software crypto with raw mode TX/RX
  encapsulation to the firmware. By default hardware crypto engine is
  used. To use software crypto in this mode, set the per ath10k_vif
  'nohwcrypt' flag value to True.*
  *) The patch for setting vif specific 'nohwcrypt' flag when
 cryptmode=2 would be a separate patch to mac80211.

 But this the problematic one. I cannot apply something to ath10k until
 Johannes applies the mac80211 part. Didn't I mention this already
 earlier? At least I was supposed to do that.


Yes I already removed those mac80211 dependent changes in v3. So this
patch doesn't really depend on any mac80211 change.


 And most importantly does Johannes even agree with the approach? IIRC he
 was pretty reluctant about configuring the crypto mode via nl80211.

 I suggest splitting the patch into two: patch 1 adding support for
 cryptmode values 0 and 1, patch 2 adding support for cryptmode 2. That
 way we can commit patch 1 early and see what we can do with patch 2.

Thanks. Will do in v4.
Removing cryptmode=2 is just a enum change. No additional changes in
the business logic required.

After your review of v1, I have implemented knobs in both mac80211's
debugfs and nl80211. I will send an RFC to mac80211 ML to see which
one they prefer.


 --
 Kalle Valo
--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3] ath10k: add 'cryptmode' param to support raw tx injection and software crypto

2015-06-11 Thread Liu CF/TW
On Thu, Jun 11, 2015 at 7:03 AM, Kalle Valo kv...@qca.qualcomm.com wrote:
 Liu CF/TW cfliu...@gmail.com writes:

 This change supports hardware crypto engine bypass by enabling raw
 Rx/Tx encap mode. This enables use cases such as software crypto and raw
 tx injection. This change introduces a new module param 'cryptmode'.

 [...]

 --- a/drivers/net/wireless/ath/ath10k/debug.c
 +++ b/drivers/net/wireless/ath/ath10k/debug.c
 @@ -124,7 +124,7 @@ EXPORT_SYMBOL(ath10k_info);

  void ath10k_print_driver_info(struct ath10k *ar)
  {
 - ath10k_info(ar, %s (0x%08x, 0x%08x%s%s%s) fw %s api %d htt %d.%d wmi 
 %d cal %s max_sta %d\n,
 + ath10k_info(ar, %s (0x%08x, 0x%08x%s%s%s) fw %s api %d htt %d.%d wmi 
 %d cal %s max_sta %d flags 0x%lu\n,
   ar-hw_params.name,
   ar-target_version,
   ar-chip_id,
 @@ -138,7 +138,8 @@ void ath10k_print_driver_info(struct ath10k *ar)
   ar-htt.target_version_minor,
   ar-wmi.op_version,
   ath10k_cal_mode_str(ar-cal_mode),
 - ar-max_num_stations);
 + ar-max_num_stations,
 + ar-dev_flags);

 What's the goal here? Printing a bitmap in hex is just gibberish, people
 would always have to count the bits etc to get anything useful
 information out from that print.

 I would prefer the messages in more readable format. For example, if
 idea is to show if cryptmode is enabled or not can't we just directly
 print that like with format cryptmode %d?

Sure. will do in v4.


 --
 Kalle Valo
--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3] ath10k: add 'cryptmode' param to support raw tx injection and software crypto

2015-06-11 Thread Liu CF/TW
Thanks Michal for the tests you did and the additional patch to
address AMSDU limitation.
Per our discussions offline, in v4, I will squash your patch and add
your test results in the commit log.
I will also put a note that AMSDU be a known limitation when cryptmode!=0.

Thanks
David

On Tue, Jun 9, 2015 at 5:40 AM, Michal Kazior michal.kaz...@tieto.com wrote:
 On 9 June 2015 at 03:13, Liu CF/TW cfliu...@gmail.com wrote:
 This change supports hardware crypto engine bypass by enabling raw
 Rx/Tx encap mode. This enables use cases such as software crypto and raw
 tx injection. This change introduces a new module param 'cryptmode'.

 cryptmode:

   0: Use hardware crypto engine globally with native Wi-Fi mode TX/RX
  encapsulation to the firmware. This is the default mode.
   1: Use sofware crypto engine globally with raw mode TX/RX encapsulation
  to the firmware.
   2: Supports both hardware and software crypto with raw mode TX/RX
  encapsulation to the firmware. By default hardware crypto engine is
  used. To use software crypto in this mode, set the per ath10k_vif
  'nohwcrypt' flag value to True.*
  *) The patch for setting vif specific 'nohwcrypt' flag when
 cryptmode=2 would be a separate patch to mac80211.

 Possible use case examples:

   - Use software crypto engine in mac80211. (cryptmode=1)

   - Support inject raw unencrypted frame on monitor interface and use
 hardware crypto to encrypt the injected Tx frames. (cryptmode=2)

   - Support receive raw hardware decrypted frame with encryption header
 on monitor interface. (cryptmode=2)

   - Support hybrid local  split MAC mode to support tunneling protocols
 such as CAPWAP: Use hardware crypto for BSS in local mode,
 and bypass hardware crypto for BSS in split MAC mode.
 (cryptmode=2, ath10k_vif nohwcrypt=0 for local mode, =1 for split MAC
  mode)

 Testing:

   Used QCA988x hw 2.0 with firmware-4.bin_10.2.4.48 with
   backports-20150424.

   All test case tested** with hostapd in both WPA2-PSK-TKIP (11g) and
   WPA2-PSK-CCMP(11n/ac). Verified ping and http to google.com works.

   **) Need to skip ATH10K_FW_FEATURE_RAW_MODE_SUPPORT check in core.c to
   test firmware. After all, none of the existing QCA official firmware
   exports that firmware bit yet.

   Test Casecryptmode value tested
   ---
   1. ath10k hardware crypto can encrypt/decrypt   0: PASS
  data frames when hostapd config the BSS in   1: Not applicable.
  WPA2-PSK-TKIP and WPA2-PSK-CCMP modes.   2: PASS

   2. mac80211 software crypto can encrypt/decrypt 0: Not applicable
  data frames when hostapd config the BSS in   1: PASS
  WPA2-PSK-TKIP and WPA2-PSK-CCMP modes.   2: PASS, when vif
  nohwcrypt=1

   3. Monitor interface Tx: User application can   0: Not applicable
  inject unencrypted raw Tx frames to monitor  1: PASS (mac80211)
  interface for mac80211 or hardware to encrypt2: PASS (hardware)
  the frames.

   4. Monitor interface Rx: mac80211 software crypto   0: Not applicable
  engine can decrypt received TKIP/CCMP frames.1: PASS
  User application see decrypted frames.   2: PASS, when vif
  nohwcrypt=1

   5. CAPWAP-like local and split MAC datapath 0: Not applicable
  tunneling: Setup BSS1=Local MAC mode on wlan0,   1: Not applicable
  BSS2=Split MAC mode on wlan0_monitor interface.  2: PASS
  Test BSS1 data frames can be encrypted and
  decrypted by ath10k hardware crypto engine
  while BSS2 data frames can skip both hardware 
  kernel mac80211 crypto engines via monitor
  interface to the user application fot tunneling.

 I've finally got to run a few tests on your patch.

 I've tried qca988x with 10.2.4.48-2 (fw_feature hardcoded in driver).

 Here's a short summary of my findings:

  - cryptmode=1 can fix 4addr+802.1q VLAN tagging in both AP and STA
 modes (a problem recently reported by Cedric),
  - your patch as-is has AP WEP broken, see below
  - your patch as-is has TCP broken, see below
  - your patch as-is has performance really broken, see below
  - once patched it looks pretty solid.


 At the end of this email I'm attaching (most likely whitespace
 damaged) patch I've made on top of your patch for reviewing
 convenience.

 For testing/merging convenience here's a paste link: http://paste.ee/p/YMFrO


 Performance:

 cryptmode=1
  ap=qca988x sta=killer1525
   killer1525  -  qca988x 194.496 mbps [tcp1 ip4]
   killer1525  -  qca988x 238.309 mbps [tcp5 ip4]
   killer1525  -  qca988x 266.958 mbps [udp1 ip4]
   killer1525  -  qca988x 477.468 mbps [udp5 ip4]
   qca988x -  killer1525  301.378 mbps [tcp1 ip4]
   qca988x -  killer1525  297.949

[PATCH v3] ath10k: add 'cryptmode' param to support raw tx injection and software crypto

2015-06-08 Thread Liu CF/TW
This change supports hardware crypto engine bypass by enabling raw
Rx/Tx encap mode. This enables use cases such as software crypto and raw
tx injection. This change introduces a new module param 'cryptmode'.

cryptmode:

  0: Use hardware crypto engine globally with native Wi-Fi mode TX/RX
 encapsulation to the firmware. This is the default mode.
  1: Use sofware crypto engine globally with raw mode TX/RX encapsulation
 to the firmware.
  2: Supports both hardware and software crypto with raw mode TX/RX
 encapsulation to the firmware. By default hardware crypto engine is
 used. To use software crypto in this mode, set the per ath10k_vif
 'nohwcrypt' flag value to True.*
 *) The patch for setting vif specific 'nohwcrypt' flag when
cryptmode=2 would be a separate patch to mac80211.

Possible use case examples:

  - Use software crypto engine in mac80211. (cryptmode=1)

  - Support inject raw unencrypted frame on monitor interface and use
hardware crypto to encrypt the injected Tx frames. (cryptmode=2)

  - Support receive raw hardware decrypted frame with encryption header
on monitor interface. (cryptmode=2)

  - Support hybrid local  split MAC mode to support tunneling protocols
such as CAPWAP: Use hardware crypto for BSS in local mode,
and bypass hardware crypto for BSS in split MAC mode.
(cryptmode=2, ath10k_vif nohwcrypt=0 for local mode, =1 for split MAC
 mode)

Testing:

  Used QCA988x hw 2.0 with firmware-4.bin_10.2.4.48 with
  backports-20150424.

  All test case tested** with hostapd in both WPA2-PSK-TKIP (11g) and
  WPA2-PSK-CCMP(11n/ac). Verified ping and http to google.com works.

  **) Need to skip ATH10K_FW_FEATURE_RAW_MODE_SUPPORT check in core.c to
  test firmware. After all, none of the existing QCA official firmware
  exports that firmware bit yet.

  Test Casecryptmode value tested
  ---
  1. ath10k hardware crypto can encrypt/decrypt   0: PASS
 data frames when hostapd config the BSS in   1: Not applicable.
 WPA2-PSK-TKIP and WPA2-PSK-CCMP modes.   2: PASS

  2. mac80211 software crypto can encrypt/decrypt 0: Not applicable
 data frames when hostapd config the BSS in   1: PASS
 WPA2-PSK-TKIP and WPA2-PSK-CCMP modes.   2: PASS, when vif
 nohwcrypt=1

  3. Monitor interface Tx: User application can   0: Not applicable
 inject unencrypted raw Tx frames to monitor  1: PASS (mac80211)
 interface for mac80211 or hardware to encrypt2: PASS (hardware)
 the frames.

  4. Monitor interface Rx: mac80211 software crypto   0: Not applicable
 engine can decrypt received TKIP/CCMP frames.1: PASS
 User application see decrypted frames.   2: PASS, when vif
 nohwcrypt=1

  5. CAPWAP-like local and split MAC datapath 0: Not applicable
 tunneling: Setup BSS1=Local MAC mode on wlan0,   1: Not applicable
 BSS2=Split MAC mode on wlan0_monitor interface.  2: PASS
 Test BSS1 data frames can be encrypted and 
 decrypted by ath10k hardware crypto engine 
 while BSS2 data frames can skip both hardware 
 kernel mac80211 crypto engines via monitor
 interface to the user application fot tunneling.

Signed-off-by: Liu CF/TW cfliu...@gmail.com
---
 drivers/net/wireless/ath/ath10k/core.c| 31 ++
 drivers/net/wireless/ath/ath10k/core.h| 33 +--
 drivers/net/wireless/ath/ath10k/debug.c   |  5 +--
 drivers/net/wireless/ath/ath10k/htt_rx.c  |  5 ++-
 drivers/net/wireless/ath/ath10k/htt_tx.c  |  9 +-
 drivers/net/wireless/ath/ath10k/hw.h  | 11 +++
 drivers/net/wireless/ath/ath10k/mac.c | 54 ++-
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |  2 +-
 drivers/net/wireless/ath/ath10k/wmi.c |  8 ++---
 9 files changed, 129 insertions(+), 29 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 59496a9..ea1c43f 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -31,16 +31,19 @@
 #include wmi-ops.h
 
 unsigned int ath10k_debug_mask;
+static unsigned int ath10k_cryptmode_param;
 static bool uart_print;
 static bool skip_otp;
 
 module_param_named(debug_mask, ath10k_debug_mask, uint, 0644);
+module_param_named(cryptmode, ath10k_cryptmode_param, uint, 0644);
 module_param(uart_print, bool, 0644);
 module_param(skip_otp, bool, 0644);
 
 MODULE_PARM_DESC(debug_mask, Debugging mask);
 MODULE_PARM_DESC(uart_print, Uart target debugging);
 MODULE_PARM_DESC(skip_otp, Skip otp failure for calibration in testmode);
+MODULE_PARM_DESC(cryptmode, Crypto mode: 0-hardware, 1-software, 2-both);
 
 static const struct ath10k_hw_params ath10k_hw_params_list

Re: [PATCH v2] ath10k: add cryptmode param to support sw crypto and raw tx injection.

2015-06-05 Thread Liu CF/TW
On Fri, Jun 5, 2015 at 10:43 AM, Kalle Valo kv...@qca.qualcomm.com wrote:
 Liu CF/TW cfliu...@gmail.com writes:

 Kalle et al. Please ignore this patch and review the new email with
 subject line changed with [PATCH V2] highlighted. Looks like only by
 doing so would it start a new thread in the ML.
 That patch is exactly the same as the last one in this thread. I
 updated the commit message with more testing details.

 If you send a new version of the patch, please increase the version
 number so that it's easy to find the latest patch. v2 vs V2 is just
 confusing, so just mark the new patch as v3. It's not like we are
 running out of version numbers or anything like that.

 --
 Kalle Valo

Kalle,

Sure. Will do, with 'v3' next time.
Do you have other comments so I can address them together with Michal's in v3?

Thanks
David
--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2] ath10k: add 'cryptmode' param to support raw tx injection and sw crypto.

2015-06-04 Thread Liu CF/TW
This change supports bypassing HW crypto engine by enabling raw Rx/Tx mode.
This will enable use cases such as sw crypto and raw tx injection.
This change introduces a new module param 'cryptmode'.

cryptmode:

 0Use HW crypto engine. Use native WiFi mode Tx/Rx encap

 1Use SW crypto engine. Use raw mode Tx/Rx encap

 2Supports both SW  HW crypto engine. Use raw mode Tx/Rx encap.

Testing: used QCA988x hw 2.0 with firmware-4.bin_10.2.4.48 with 
backports-20150424
(Skipped ATH10K_FW_FEATURE_RAW_MODE_SUPPORT check in core.c within this patch. 
 Since none of the existing QCA official firmware has the feature bit set yet)

 ath10k
 cryptmode
 param  Testing Status
 ----
0   HW CCMP/TKIP tested ok.
Note: HW crypto bypass not supported by ath10k hw in native WiFi
mode.

1   - mac80211 SW crypto tested ok.
- raw Tx frame injection tested ok.

2   HW CCMP/TKIP tested ok.
SW CCMP/TKIP tested ok.
Tested raw Tx encrypted frame injection ok.

Signed-off-by: Liu CF/TW cfliu...@gmail.com
---
 drivers/net/wireless/ath/ath10k/core.c   | 29 +
 drivers/net/wireless/ath/ath10k/core.h   | 29 +++--
 drivers/net/wireless/ath/ath10k/htt_rx.c |  5 ++-
 drivers/net/wireless/ath/ath10k/htt_tx.c |  9 +-
 drivers/net/wireless/ath/ath10k/mac.c| 53 +++-
 drivers/net/wireless/ath/ath10k/wmi.c|  4 ++-
 6 files changed, 114 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 59496a9..a81c7a7 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -31,16 +31,19 @@
 #include wmi-ops.h
 
 unsigned int ath10k_debug_mask;
+unsigned int ath10k_cryptmode_param;
 static bool uart_print;
 static bool skip_otp;
 
 module_param_named(debug_mask, ath10k_debug_mask, uint, 0644);
+module_param_named(cryptmode, ath10k_cryptmode_param, uint, 0644);
 module_param(uart_print, bool, 0644);
 module_param(skip_otp, bool, 0644);
 
 MODULE_PARM_DESC(debug_mask, Debugging mask);
 MODULE_PARM_DESC(uart_print, Uart target debugging);
 MODULE_PARM_DESC(skip_otp, Skip otp failure for calibration in testmode);
+MODULE_PARM_DESC(cryptmode, Crypto mode - 0: HW only, 1: SW only, 2:Both);
 
 static const struct ath10k_hw_params ath10k_hw_params_list[] = {
{
@@ -991,6 +994,32 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
return -EINVAL;
}
 
+   switch (ath10k_cryptmode_param) {
+   case ATH10K_CRYPT_MODE_HW:
+   clear_bit(ATH10K_FLAG_RAW_MODE, ar-dev_flags);
+   clear_bit(ATH10K_FLAG_HW_CRYPTO_DISABLED, ar-dev_flags);
+   break;
+   case ATH10K_CRYPT_MODE_SW:
+   case ATH10K_CRYPT_MODE_HW_SW:
+   if (!test_bit(ATH10K_FW_FEATURE_RAW_MODE_SUPPORT,
+ ar-fw_features)) {
+   ath10k_err(ar, cryptmode  0 requires raw mode support 
from firmware);
+   return -EINVAL;
+   }
+
+   set_bit(ATH10K_FLAG_RAW_MODE, ar-dev_flags);
+
+   if (ath10k_cryptmode_param == ATH10K_CRYPT_MODE_SW) {
+   set_bit(ATH10K_FLAG_HW_CRYPTO_DISABLED, ar-dev_flags);
+   }
+   break;
+   default:
+   ath10k_info(ar, invalid cryptmode: %d\n,
+   ath10k_cryptmode_param);
+   return -EINVAL;
+   }
+   ath10k_info(ar, cryptmode: %d\n, ath10k_cryptmode_param);
+
/* Backwards compatibility for firmwares without
 * ATH10K_FW_IE_WMI_OP_VERSION.
 */
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 45f9603..38606e7 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -91,6 +91,7 @@ struct ath10k_skb_cb {
u8 tid;
u16 freq;
bool is_offchan;
+   bool nohwcrypt;
struct ath10k_htt_txbuf *txbuf;
u32 txbuf_paddr;
} __packed htt;
@@ -349,6 +350,7 @@ struct ath10k_vif {
} u;
 
bool use_cts_prot;
+   bool nohwcrypt;
int num_legacy_stations;
int txpower;
struct wmi_wmm_params_all_arg wmm_params;
@@ -461,16 +463,21 @@ enum ath10k_fw_features {
ATH10K_FW_FEATURE_WOWLAN_SUPPORT = 6,
 
/* Don't trust error code from otp.bin */
-   ATH10K_FW_FEATURE_IGNORE_OTP_RESULT,
+   ATH10K_FW_FEATURE_IGNORE_OTP_RESULT = 7,
 
/* Some firmware revisions pad 4th hw address to 4 byte boundary making
 * it 8 bytes long in Native Wifi Rx decap.
 */
-   ATH10K_FW_FEATURE_NO_NWIFI_DECAP_4ADDR_PADDING,
+   ATH10K_FW_FEATURE_NO_NWIFI_DECAP_4ADDR_PADDING = 8,
 
/* Firmware supports

Re: [PATCH v2] ath10k: add cryptmode param to support sw crypto and raw tx injection.

2015-06-04 Thread Liu CF/TW
Kalle et al. Please ignore this patch and review the new email with
subject line changed with [PATCH V2] highlighted. Looks like only by
doing so would it start a new thread in the ML.
That patch is exactly the same as the last one in this thread. I
updated the commit message with more testing details.


On Wed, Jun 3, 2015 at 6:56 PM, David Liu cfliu...@gmail.com wrote:
 This change supports bypassing HW crypto engine by enabling raw Rx/Tx mode.
 This will enable use cases such as sw crypto and raw tx injection.
 This change introduces a new module param 'cryptmode'.

 cryptmode:

  0Use HW crypto engine. Use native WiFi mode Tx/Rx encap

  1Use SW crypto engine. Use raw mode Tx/Rx encap

  2Supports both SW  HW crypto engine. Use raw mode Tx/Rx encap.

 Testing: used QCA988x hw 2.0 with 10.2.4.13-2 firmware with backports-20150424

  ath10k
  cryptmode
  param  Testing Status
  ----
 0   HW CCMP tested ok.
 Note: HW crypto bypass not supported by ath10k hw in native WiFi
 mode.

 1   - mac80211 SW crypto tested ok.
 - raw Tx frame injection tested ok.

 2   HW CCMP tested ok.
 SW CCMP tested ok.
 Tested raw Tx encrypted frame injection ok.

 Signed-off-by: David Liu cfliu...@gmail.com
 ---
  drivers/net/wireless/ath/ath10k/core.c   | 29 +
  drivers/net/wireless/ath/ath10k/core.h   | 29 +++--
  drivers/net/wireless/ath/ath10k/htt_rx.c |  5 ++-
  drivers/net/wireless/ath/ath10k/htt_tx.c |  9 +-
  drivers/net/wireless/ath/ath10k/mac.c| 53 
 +++-
  drivers/net/wireless/ath/ath10k/wmi.c|  4 ++-
  6 files changed, 114 insertions(+), 15 deletions(-)

 diff --git a/drivers/net/wireless/ath/ath10k/core.c 
 b/drivers/net/wireless/ath/ath10k/core.c
 index 59496a9..a81c7a7 100644
 --- a/drivers/net/wireless/ath/ath10k/core.c
 +++ b/drivers/net/wireless/ath/ath10k/core.c
 @@ -31,16 +31,19 @@
  #include wmi-ops.h

  unsigned int ath10k_debug_mask;
 +unsigned int ath10k_cryptmode_param;
  static bool uart_print;
  static bool skip_otp;

  module_param_named(debug_mask, ath10k_debug_mask, uint, 0644);
 +module_param_named(cryptmode, ath10k_cryptmode_param, uint, 0644);
  module_param(uart_print, bool, 0644);
  module_param(skip_otp, bool, 0644);

  MODULE_PARM_DESC(debug_mask, Debugging mask);
  MODULE_PARM_DESC(uart_print, Uart target debugging);
  MODULE_PARM_DESC(skip_otp, Skip otp failure for calibration in testmode);
 +MODULE_PARM_DESC(cryptmode, Crypto mode - 0: HW only, 1: SW only, 2:Both);

  static const struct ath10k_hw_params ath10k_hw_params_list[] = {
 {
 @@ -991,6 +994,32 @@ static int ath10k_core_init_firmware_features(struct 
 ath10k *ar)
 return -EINVAL;
 }

 +   switch (ath10k_cryptmode_param) {
 +   case ATH10K_CRYPT_MODE_HW:
 +   clear_bit(ATH10K_FLAG_RAW_MODE, ar-dev_flags);
 +   clear_bit(ATH10K_FLAG_HW_CRYPTO_DISABLED, ar-dev_flags);
 +   break;
 +   case ATH10K_CRYPT_MODE_SW:
 +   case ATH10K_CRYPT_MODE_HW_SW:
 +   if (!test_bit(ATH10K_FW_FEATURE_RAW_MODE_SUPPORT,
 + ar-fw_features)) {
 +   ath10k_err(ar, cryptmode  0 requires raw mode 
 support from firmware);
 +   return -EINVAL;
 +   }
 +
 +   set_bit(ATH10K_FLAG_RAW_MODE, ar-dev_flags);
 +
 +   if (ath10k_cryptmode_param == ATH10K_CRYPT_MODE_SW) {
 +   set_bit(ATH10K_FLAG_HW_CRYPTO_DISABLED, 
 ar-dev_flags);
 +   }
 +   break;
 +   default:
 +   ath10k_info(ar, invalid cryptmode: %d\n,
 +   ath10k_cryptmode_param);
 +   return -EINVAL;
 +   }
 +   ath10k_info(ar, cryptmode: %d\n, ath10k_cryptmode_param);
 +
 /* Backwards compatibility for firmwares without
  * ATH10K_FW_IE_WMI_OP_VERSION.
  */
 diff --git a/drivers/net/wireless/ath/ath10k/core.h 
 b/drivers/net/wireless/ath/ath10k/core.h
 index 45f9603..38606e7 100644
 --- a/drivers/net/wireless/ath/ath10k/core.h
 +++ b/drivers/net/wireless/ath/ath10k/core.h
 @@ -91,6 +91,7 @@ struct ath10k_skb_cb {
 u8 tid;
 u16 freq;
 bool is_offchan;
 +   bool nohwcrypt;
 struct ath10k_htt_txbuf *txbuf;
 u32 txbuf_paddr;
 } __packed htt;
 @@ -349,6 +350,7 @@ struct ath10k_vif {
 } u;

 bool use_cts_prot;
 +   bool nohwcrypt;
 int num_legacy_stations;
 int txpower;
 struct wmi_wmm_params_all_arg wmm_params;
 @@ -461,16 +463,21 @@ enum ath10k_fw_features {
 ATH10K_FW_FEATURE_WOWLAN_SUPPORT = 6,

 /* Don't trust error code from otp.bin */
 -   ATH10K_FW_FEATURE_IGNORE_OTP_RESULT,
 +   

Re: [PATCH 1/2] ath10k: add cryptmode param to support sw crypto and raw tx injection.

2015-06-03 Thread Liu CF/TW
 diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
 b/drivers/net/wireless/ath/ath10k/hw.h
 index 85cca29..37fd2f83 100644
 --- a/drivers/net/wireless/ath/ath10k/hw.h
 +++ b/drivers/net/wireless/ath/ath10k/hw.h
 @@ -296,7 +296,7 @@ enum ath10k_hw_rate_cck {
  #define TARGET_10X_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 1
  #define TARGET_10X_VOW_CONFIG  0
  #define TARGET_10X_NUM_MSDU_DESC   (1024 + 400)
 -#define TARGET_10X_MAX_FRAG_ENTRIES0
 +#define TARGET_10X_MAX_FRAG_ENTRIES10

 This is probably enough at 2 (ath10k doesn't send more than 2 tx
 fragments now). I assume fw crashes with raw tx if this isn't fixed,
 correct?

 Sidenote: I guess TARGET_MAX_FRAG_ENTRIES could be fixed as well. It
 might make sense for QCA61X4 hw2.1 which still uses the old Rx
 indication event and might be able to do raw txrx + swcrypto. But I'm
 a bit reluctant to change this without any testing.


 Sure. I change it to 10 because the document I got from QCA says so.
 Since this is a global setting, I will remove this and keep it =0 for
 now so it doesn't affect existing HW based datapath.

 Sure. I recall 10.x on QCA988X isn't really picky on this value.
 QCA61X4 with wmi-tlv on the other hand needs an adequate value for
 this configuration parameter or it'll crash horribly.


 Per QCA, the main issue not changing this would be SW crypto then
 won't be able to handle large Rx AMSDU.
 When HW is not doing Rx decryption, the whole AMSDU needs to be DMA to
 host for SW based decryption  AMSDU subframe deaggregation.

 Hmm.. From what I know this setting refers to the max number of Tx
 fragments that can be submitted via HTT TX_FRM command eventually to
 HW MAC, not Rx fragments.


Yeah you are right. I checked the QCA's PDF again and indeed it's for
Tx not for Rx.

David

 MichaƂ
--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] ath10k: add cryptmode param to support sw crypto and raw tx injection.

2015-06-02 Thread Liu CF/TW
On Tue, Jun 2, 2015 at 12:17 AM, Michal Kazior michal.kaz...@tieto.com wrote:
 On 1 June 2015 at 21:44, David Liu cfliu...@gmail.com wrote:
 [...]
 --- a/drivers/net/wireless/ath/ath10k/core.h
 +++ b/drivers/net/wireless/ath/ath10k/core.h
 @@ -91,6 +91,7 @@ struct ath10k_skb_cb {
 u8 tid;
 u16 freq;
 bool is_offchan;
 +   bool nohwcrypt;
 struct ath10k_htt_txbuf *txbuf;
 u32 txbuf_paddr;
 } __packed htt;
 @@ -349,6 +350,7 @@ struct ath10k_vif {
 } u;

 bool use_cts_prot;
 +   bool nohwcrypt;

 So this is a bit confusing. This is used only for tx policy only,
 right? It should be named accordingly then. The other nohwcrypt in
 skb_cb pretty much implies Tx already.


No, it's also for Rx.
In this patch, in mac.c, if arvif-nohwcrypt is set, ath10k_send_key()
won't install the actual key to hardware, but a clear key is
installed. This makes all matching STA's encrypted frame passthrough
HW and mac80211 can take care of decryption later in host.
(in patch V2 I will take care of the IEEE80211_HW_SW_CRYPTO_CONTROL setting)


 [...]
 @@ -484,6 +491,12 @@ enum ath10k_dev_flags {
  * waiters should immediately cancel instead of waiting for a time 
 out.
  */
 ATH10K_FLAG_CRASH_FLUSH,
 +
 +   /* Use Raw mode for Tx and Rx */
 +   ATH10K_RAW_MODE,
 +
 +   /* Disable HW crypto engine */
 +   ATH10K_HW_CRYPTO_DISABLED,

 You're missing the _FLAG prefix. Also this isn't documented well
 enough. RAW_MODE implies sw crypto rx, no? Perhaps a more fine grained
 approach would be better:

Thanks. Will fix.

Raw mode doesn't imply SW crypto only.
Indeed Raw mode is the only way to get sw crypto support, but it also
supports HW crypto.
I just tested both HW/SW crypto cases working fine in raw mode.

So my plan for the new cryptmode parameter has 3 values:

   0Use HW crypto engine only. This uses native WiFi mode Tx/Rx encap

   1Use SW crypto engine only. This uses raw mode Tx/Rx encap

   2Supports both SW  HW crypto engine. This uses raw mode Tx/Rx encap.

Once this patch is in, I guess people would only use cryptmode=0 or 1.
For cryptmode=2, I have subsequent changes to allow per BSS based
control of HW/SW crypto selection.
Plan is to make make arvif-nohwcrypt configurable via debugfs or
nl80211 (subject to review feedback)


  ATH10K_FLAG_RAW_TX,
  ATH10K_FLAG_RAW_RX,
  ATH10K_FLAG_SW_TX_CRYPTO,
  ATH10K_FLAG_SW_RX_CRYPTO,

 Obviously not all combinations are valid/doable but I think this will
 make the code look more obvious.


That would be too many flags and too complex.
I'd suggest keep the proposed ATH10K_RAW_MODE and ATH10K_HW_CRYPTO_DISABLED.
Let's make Tx/Rx HW crypto always both enabled or both disabled AFA
driver is concerned.
Ben's CT 10.1 FW is a special use case and would fit into cryptmode=0
where his FW internally does the magic to disable HW Rx which is
independent to the driver.
Once Ben's FW is ready for raw mode, driver then can switch to use
cryptmode=1 or 2.


  };

  enum ath10k_cal_mode {
 @@ -492,6 +505,15 @@ enum ath10k_cal_mode {
 ATH10K_CAL_MODE_DT,
  };

 +enum ath10k_crypt_mode {
 +   /* Use HW crypto engine only */
 +   ATH10K_CRYPT_MODE_HW,
 +   /* HW SW crypto engine only (ie. HW crypto engine disabled) */
 +   ATH10K_CRYPT_MODE_SW,
 +   /* Both SW  HW crypto engine supported */
 +   ATH10K_CRYPT_MODE_HW_SW,

 I don't think this is clear enough (and the comments don't help at all):

  ATH10K_CRYPT_MODE_HW,
  ATH10K_CRYPT_MODE_SW,
  ATH10K_CRYPT_MODE_SW_RX_HW_TX,

 It would also be nice to have some sort of indication in driver
 logs/dmesg (without any debug_masks) as to what crypto mode driver
 uses so that if someone reports a bug we can quickly see their base
 configuration. Having it completely configurable during runtime is a
 bit of a pain in this regard though.. but most people will likely just
 set cryptmode in modprobe.conf or something. Thoughts?

I will add a log line to print the cryptmode param value.



 +};
 +
  static inline const char *ath10k_cal_mode_str(enum ath10k_cal_mode mode)
  {
 switch (mode) {
 diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
 b/drivers/net/wireless/ath/ath10k/htt_rx.c
 index 89eb16b..a7df05d 100644
 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c
 +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
 @@ -1018,8 +1018,7 @@ static void ath10k_htt_rx_h_undecap_raw(struct ath10k 
 *ar,

 /* In most cases this will be true for sniffed frames. It makes sense
  * to deliver them as-is without stripping the crypto param. This 
 would
 -* also make sense for software based decryption (which is not
 -* implemented in ath10k).
 +* also make sense for software based decryption.

 I guess you should update the comment even more. The would doesn't
 fit anymore. Instead: This is necessary for software 

Re: [PATCH 1/2] ath10k: add cryptmode param to support sw crypto and raw tx injection.

2015-06-01 Thread Liu CF/TW
Typo: [PATH 1/2] should be just [PATCH]. This is the only ath10k
change in this patch.


On Mon, Jun 1, 2015 at 12:44 PM, David Liu cfliu...@gmail.com wrote:
 This change supports bypassing HW crypto engine by enabling raw Rx/Tx 
 mode.
 This will enable use cases such as sw crypto and raw tx injection.
 This change introduces a new module param 'cryptmode'.

 cryptmode:

0Use HW crypto engine. Use native WiFi mode Tx/Rx encap

1Use SW crypto engine. Use raw mode Tx/Rx encap

2Supports both SW  HW crypto engine. Use raw mode Tx/Rx encap.

 Testing: used QCA988x hw 2.0 with 10.2 firmware.

 ath10k
 cryptmode
 param  Testing Status
 ----
0   HW CCMP/TKIP tested ok.
Note: HW crypto bypass not supported by ath10k hw in native 
 WiFi
mode.

1   - mac80211 SW crypto tested ok. (Req. mac80211 change)
- raw Tx frame injection tested ok.

2   HW CCMP/TKIP tested ok.
- BSS 1 tested HW CCMP/TKIP ok.
- BSS 2 can bypass HW engine.
  - Tested mac80211 cam do SW crypto. (Req. mac80211 change)
  - Tested raw Tx encrypted frame injection.

 Signed-off-by: David Liu cfliu...@gmail.com
 ---
  drivers/net/wireless/ath/ath10k/core.c   | 17 +
  drivers/net/wireless/ath/ath10k/core.h   | 24 -
  drivers/net/wireless/ath/ath10k/htt_rx.c |  3 +-
  drivers/net/wireless/ath/ath10k/htt_tx.c |  3 ++
  drivers/net/wireless/ath/ath10k/hw.h |  2 +-
  drivers/net/wireless/ath/ath10k/mac.c| 61 
 +++-
  drivers/net/wireless/ath/ath10k/wmi.c|  6 ++--
  7 files changed, 102 insertions(+), 14 deletions(-)

 diff --git a/drivers/net/wireless/ath/ath10k/core.c 
 b/drivers/net/wireless/ath/ath10k/core.c
 index 59496a9..e91fc85 100644
 --- a/drivers/net/wireless/ath/ath10k/core.c
 +++ b/drivers/net/wireless/ath/ath10k/core.c
 @@ -31,16 +31,19 @@
  #include wmi-ops.h

  unsigned int ath10k_debug_mask;
 +bool ath10k_cryptmode_param;
  static bool uart_print;
  static bool skip_otp;

  module_param_named(debug_mask, ath10k_debug_mask, uint, 0644);
 +module_param_named(cryptmode, ath10k_cryptmode_param, bool, 0644);
  module_param(uart_print, bool, 0644);
  module_param(skip_otp, bool, 0644);

  MODULE_PARM_DESC(debug_mask, Debugging mask);
  MODULE_PARM_DESC(uart_print, Uart target debugging);
  MODULE_PARM_DESC(skip_otp, Skip otp failure for calibration in testmode);
 +MODULE_PARM_DESC(cryptmode, Crypto mode - 0: HW only, 1: SW only, 2:Both);

  static const struct ath10k_hw_params ath10k_hw_params_list[] = {
 {
 @@ -991,6 +994,20 @@ static int ath10k_core_init_firmware_features(struct 
 ath10k *ar)
 return -EINVAL;
 }

 +   if (ath10k_cryptmode_param == ATH10K_CRYPT_MODE_HW) {
 +   clear_bit(ATH10K_RAW_MODE, ar-dev_flags);
 +   clear_bit(ATH10K_HW_CRYPTO_DISABLED, ar-dev_flags);
 +   } else {
 +   if (!test_bit(ATH10K_FW_FEATURE_RAW_MODE_SUPPORT,
 + ar-fw_features)) {
 +   ath10k_err(ar, cryptmode  0 requires raw mode 
 support from firmware);
 +   return -EINVAL;
 +   }
 +   set_bit(ATH10K_RAW_MODE, ar-dev_flags);
 +   if (ath10k_cryptmode_param == ATH10K_CRYPT_MODE_SW)
 +   set_bit(ATH10K_HW_CRYPTO_DISABLED, ar-dev_flags);
 +   }
 +
 /* Backwards compatibility for firmwares without
  * ATH10K_FW_IE_WMI_OP_VERSION.
  */
 diff --git a/drivers/net/wireless/ath/ath10k/core.h 
 b/drivers/net/wireless/ath/ath10k/core.h
 index 45f9603..13799c8 100644
 --- a/drivers/net/wireless/ath/ath10k/core.h
 +++ b/drivers/net/wireless/ath/ath10k/core.h
 @@ -91,6 +91,7 @@ struct ath10k_skb_cb {
 u8 tid;
 u16 freq;
 bool is_offchan;
 +   bool nohwcrypt;
 struct ath10k_htt_txbuf *txbuf;
 u32 txbuf_paddr;
 } __packed htt;
 @@ -349,6 +350,7 @@ struct ath10k_vif {
 } u;

 bool use_cts_prot;
 +   bool nohwcrypt;
 int num_legacy_stations;
 int txpower;
 struct wmi_wmm_params_all_arg wmm_params;
 @@ -461,7 +463,12 @@ enum ath10k_fw_features {
 ATH10K_FW_FEATURE_WOWLAN_SUPPORT = 6,

 /* Don't trust error code from otp.bin */
 -   ATH10K_FW_FEATURE_IGNORE_OTP_RESULT,
 +   ATH10K_FW_FEATURE_IGNORE_OTP_RESULT = 7,
 +
 +   /* Raw mode support. If supported, FW supports receiving and 
 trasmitting
 +* frames in raw mode
 +*/
 +   ATH10K_FW_FEATURE_RAW_MODE_SUPPORT = 8,

 /* Some firmware revisions pad 4th hw address to 4 byte boundary 
 making
  * it 8 bytes long in Native Wifi Rx decap.
 @@ -484,6 +491,12 @@ enum ath10k_dev_flags {
  

Re: [PATCH] mac80211: support IEEE80211_KEY_FLAG_RESERVE_TAILROOM for CCMP and TKIP.

2015-06-01 Thread Liu CF/TW
Hi Johannes, yes indeed you are right. This change is indeed not required/right.
It's the special sw crypto path I'm working on in ath10k that resulted
in the ieee80211_key_enable_hw_accel() code being skipped.
I will fix this in ath10k driver internally.

Thanks
David

On Mon, Jun 1, 2015 at 1:34 PM, Johannes Berg johan...@sipsolutions.net wrote:
 On Mon, 2015-06-01 at 12:38 -0700, David Liu wrote:
 The change reserves neccessary tailroom in CCMP and TKIP if required by
 drivers that sets IEEE80211_KEY_FLAG_RESERVE_TAILROOM. For example,
 ath10k HW engine in raw Tx/Rx encap mode requires SW reserve MIC/ICV space.

 I don't think this makes all that much sense. The flag is already
 honoured today to actually leave enough tailroom in the SKB, and the
 remainder of the code can very easily be done in the driver (in fact, if
 you have a half-decent DMA engine, it's far more efficient to *not* set
 this flag!)

 You're also breaking other drivers with your change. Just do it in the
 driver.

 johannes

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] ath10k: add cryptmode param to support sw crypto and raw tx injection.

2015-06-01 Thread Liu CF/TW
This patch still requires some more works. Please ignore.
I will send another one to address comments from linux-wireless ML.

Thanks
David



On Mon, Jun 1, 2015 at 12:47 PM, Liu CF/TW cfliu...@gmail.com wrote:
 Typo: [PATH 1/2] should be just [PATCH]. This is the only ath10k
 change in this patch.


 On Mon, Jun 1, 2015 at 12:44 PM, David Liu cfliu...@gmail.com wrote:
 This change supports bypassing HW crypto engine by enabling raw Rx/Tx 
 mode.
 This will enable use cases such as sw crypto and raw tx injection.
 This change introduces a new module param 'cryptmode'.

 cryptmode:

0Use HW crypto engine. Use native WiFi mode Tx/Rx encap

1Use SW crypto engine. Use raw mode Tx/Rx encap

2Supports both SW  HW crypto engine. Use raw mode Tx/Rx encap.

 Testing: used QCA988x hw 2.0 with 10.2 firmware.

 ath10k
 cryptmode
 param  Testing Status
 ----
0   HW CCMP/TKIP tested ok.
Note: HW crypto bypass not supported by ath10k hw in native 
 WiFi
mode.

1   - mac80211 SW crypto tested ok. (Req. mac80211 change)
- raw Tx frame injection tested ok.

2   HW CCMP/TKIP tested ok.
- BSS 1 tested HW CCMP/TKIP ok.
- BSS 2 can bypass HW engine.
  - Tested mac80211 cam do SW crypto. (Req. mac80211 change)
  - Tested raw Tx encrypted frame injection.

 Signed-off-by: David Liu cfliu...@gmail.com
 ---
  drivers/net/wireless/ath/ath10k/core.c   | 17 +
  drivers/net/wireless/ath/ath10k/core.h   | 24 -
  drivers/net/wireless/ath/ath10k/htt_rx.c |  3 +-
  drivers/net/wireless/ath/ath10k/htt_tx.c |  3 ++
  drivers/net/wireless/ath/ath10k/hw.h |  2 +-
  drivers/net/wireless/ath/ath10k/mac.c| 61 
 +++-
  drivers/net/wireless/ath/ath10k/wmi.c|  6 ++--
  7 files changed, 102 insertions(+), 14 deletions(-)

 diff --git a/drivers/net/wireless/ath/ath10k/core.c 
 b/drivers/net/wireless/ath/ath10k/core.c
 index 59496a9..e91fc85 100644
 --- a/drivers/net/wireless/ath/ath10k/core.c
 +++ b/drivers/net/wireless/ath/ath10k/core.c
 @@ -31,16 +31,19 @@
  #include wmi-ops.h

  unsigned int ath10k_debug_mask;
 +bool ath10k_cryptmode_param;
  static bool uart_print;
  static bool skip_otp;

  module_param_named(debug_mask, ath10k_debug_mask, uint, 0644);
 +module_param_named(cryptmode, ath10k_cryptmode_param, bool, 0644);
  module_param(uart_print, bool, 0644);
  module_param(skip_otp, bool, 0644);

  MODULE_PARM_DESC(debug_mask, Debugging mask);
  MODULE_PARM_DESC(uart_print, Uart target debugging);
  MODULE_PARM_DESC(skip_otp, Skip otp failure for calibration in testmode);
 +MODULE_PARM_DESC(cryptmode, Crypto mode - 0: HW only, 1: SW only, 2:Both);

  static const struct ath10k_hw_params ath10k_hw_params_list[] = {
 {
 @@ -991,6 +994,20 @@ static int ath10k_core_init_firmware_features(struct 
 ath10k *ar)
 return -EINVAL;
 }

 +   if (ath10k_cryptmode_param == ATH10K_CRYPT_MODE_HW) {
 +   clear_bit(ATH10K_RAW_MODE, ar-dev_flags);
 +   clear_bit(ATH10K_HW_CRYPTO_DISABLED, ar-dev_flags);
 +   } else {
 +   if (!test_bit(ATH10K_FW_FEATURE_RAW_MODE_SUPPORT,
 + ar-fw_features)) {
 +   ath10k_err(ar, cryptmode  0 requires raw mode 
 support from firmware);
 +   return -EINVAL;
 +   }
 +   set_bit(ATH10K_RAW_MODE, ar-dev_flags);
 +   if (ath10k_cryptmode_param == ATH10K_CRYPT_MODE_SW)
 +   set_bit(ATH10K_HW_CRYPTO_DISABLED, ar-dev_flags);
 +   }
 +
 /* Backwards compatibility for firmwares without
  * ATH10K_FW_IE_WMI_OP_VERSION.
  */
 diff --git a/drivers/net/wireless/ath/ath10k/core.h 
 b/drivers/net/wireless/ath/ath10k/core.h
 index 45f9603..13799c8 100644
 --- a/drivers/net/wireless/ath/ath10k/core.h
 +++ b/drivers/net/wireless/ath/ath10k/core.h
 @@ -91,6 +91,7 @@ struct ath10k_skb_cb {
 u8 tid;
 u16 freq;
 bool is_offchan;
 +   bool nohwcrypt;
 struct ath10k_htt_txbuf *txbuf;
 u32 txbuf_paddr;
 } __packed htt;
 @@ -349,6 +350,7 @@ struct ath10k_vif {
 } u;

 bool use_cts_prot;
 +   bool nohwcrypt;
 int num_legacy_stations;
 int txpower;
 struct wmi_wmm_params_all_arg wmm_params;
 @@ -461,7 +463,12 @@ enum ath10k_fw_features {
 ATH10K_FW_FEATURE_WOWLAN_SUPPORT = 6,

 /* Don't trust error code from otp.bin */
 -   ATH10K_FW_FEATURE_IGNORE_OTP_RESULT,
 +   ATH10K_FW_FEATURE_IGNORE_OTP_RESULT = 7,
 +
 +   /* Raw mode support. If supported, FW supports receiving and 
 trasmitting
 +* frames in raw mode