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

Michal Kazior michal.kazior at tieto.com
Fri Jun 5 04:52:07 PDT 2015


On 4 June 2015 at 19:47, Liu CF/TW <cfliu.tw at gmail.com> wrote:
[...]
> @@ -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);

This may be a bit too verbose. I was actually thinking of adding this
to the ath10k_print_driver_info().


[...]
>  static int ath10k_install_key(struct ath10k_vif *arvif,
> @@ -3172,9 +3184,24 @@ ath10k_tx_h_get_txmode(struct ath10k *ar, struct ieee80211_vif *vif,
>         if (ieee80211_is_data_present(fc) && sta && sta->tdls)
>                 return ATH10K_HW_TXRX_ETHERNET;
>
> +       if (test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags))
> +               return ATH10K_HW_TXRX_RAW;

This means not all traffic will go RAW. The TDLS case above will use
ethernet encap. I'm aware you might not have the hardware to test that
though.. Might be worth putting a FIXME at least.


[...]
> diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
> index 77220b0..64b31f1 100644
> --- a/drivers/net/wireless/ath/ath10k/wmi.c
> +++ b/drivers/net/wireless/ath/ath10k/wmi.c
> @@ -3894,7 +3894,9 @@ static struct sk_buff *ath10k_wmi_10_2_op_gen_init(struct ath10k *ar)
>         config.rx_timeout_pri_vi = __cpu_to_le32(TARGET_10X_RX_TIMEOUT_LO_PRI);
>         config.rx_timeout_pri_be = __cpu_to_le32(TARGET_10X_RX_TIMEOUT_LO_PRI);
>         config.rx_timeout_pri_bk = __cpu_to_le32(TARGET_10X_RX_TIMEOUT_HI_PRI);
> -       config.rx_decap_mode = __cpu_to_le32(TARGET_10X_RX_DECAP_MODE);
> +       config.rx_decap_mode = __cpu_to_le32(ATH10K_HW_TXRX_NATIVE_WIFI);
> +       if (test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags))
> +               config.rx_decap_mode = __cpu_to_le32(ATH10K_HW_TXRX_RAW);

If 636, 10.1 or wmi-tlv firmware revisions were to advertise RAW mode
support in the future rx_decap_mode won't be set correctly because you
only update the 10.2 op_gen_init code.

All TARGET_*RX_DECAP_MODE should be removed from hw.h and
ar->wmi.rx_decap_mode should be introduced which is set somewhere in
ath10k_core_init_firmware_features() and used throughout all
op_gen_init implementations.


Michał



More information about the ath10k mailing list