Re: [PATCH 07/12] wifi: ath12k: Cache vdev configs before vdev create

Kalle Valo
2024-01-13T09:44:45Z

Jeff Johnson <quic_jjohnson@quicinc.com> writes:

>> +static int ath12k_mac_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
>> + struct ieee80211_vif *vif, struct ieee80211_sta *sta,
>> + struct ieee80211_key_conf *key)
>> +{
>> + struct ath12k_hw *ah = ath12k_hw_to_ah(hw);
>> + struct ath12k *ar;
>> + struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
>> + int ret;
>> +
>> + /* BIP needs to be done in software */
>> + if (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC ||
>> + key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 ||
>> + key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256 ||
>> + key->cipher == WLAN_CIPHER_SUITE_BIP_CMAC_256)
>> + return 1;
>
> I know this in the existing code, but what is the significance of
> returning 1? Should this be returning a -errno like the error cases that
> follow?

It's to use software encryption, from mac80211.h:

* Note that in the case that the @IEEE80211_HW_SW_CRYPTO_CONTROL flag is
* set, mac80211 will not automatically fall back to software crypto if
* enabling hardware crypto failed. The set_key() call may also return the
* value 1 to permit this specific key/algorithm to be done in software.

Yeah, this is confusing. IMHO there should be a define or an enum for
this value.

--