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

2015-06-05 Thread Kalle Valo
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
--
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 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


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

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

2015-06-03 Thread David Liu
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,
+   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 bypassing PLL setting on init. */
ATH10K_FW_FEATURE_SUPPORTS_SKIP_CLOCK_INIT = 9,
 
+   /* Raw mode support. If supported, FW supports receiving and trasmitting
+