Skip to content

Commit

Permalink
carl9170: don't enable hw crypto offload, if the fw doesn't support it
Browse files Browse the repository at this point in the history
Previously, op_start would set disable_offload always
to false, even if it was set to true by the fw parser.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Christian Lamparter authored and John W. Linville committed Jan 7, 2013
1 parent 17f658a commit 7a5c730
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
1 change: 1 addition & 0 deletions drivers/net/wireless/ath/carl9170/carl9170.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ struct ar9170 {
unsigned int rx_size;
unsigned int tx_seq_table;
bool ba_filter;
bool disable_offload_fw;
} fw;

/* interface configuration combinations */
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/ath/carl9170/fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ static int carl9170_fw(struct ar9170 *ar, const __u8 *data, size_t len)
if (!SUPP(CARL9170FW_COMMAND_CAM)) {
dev_info(&ar->udev->dev, "crypto offloading is disabled "
"by firmware.\n");
ar->disable_offload = true;
ar->fw.disable_offload_fw = true;
}

if (SUPP(CARL9170FW_PSM) && SUPP(CARL9170FW_FIXED_5GHZ_PSM))
Expand Down
33 changes: 22 additions & 11 deletions drivers/net/wireless/ath/carl9170/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,13 @@ static int carl9170_op_start(struct ieee80211_hw *hw)
ar->ps.last_action = jiffies;
ar->ps.last_slept = jiffies;
ar->erp_mode = CARL9170_ERP_AUTO;
ar->rx_software_decryption = false;
ar->disable_offload = false;

/* Set "disable hw crypto offload" whenever the module parameter
* nohwcrypt is true or if the firmware does not support it.
*/
ar->disable_offload = modparam_nohwcrypt |
ar->fw.disable_offload_fw;
ar->rx_software_decryption = ar->disable_offload;

for (i = 0; i < ar->hw->queues; i++) {
ar->queue_stop_timeout[i] = jiffies;
Expand Down Expand Up @@ -565,12 +570,20 @@ static int carl9170_init_interface(struct ar9170 *ar,

memcpy(common->macaddr, vif->addr, ETH_ALEN);

if (modparam_nohwcrypt ||
((vif->type != NL80211_IFTYPE_STATION) &&
(vif->type != NL80211_IFTYPE_AP))) {
ar->rx_software_decryption = true;
ar->disable_offload = true;
}
/* We have to fall back to software crypto, whenever
* the user choose to participates in an IBSS. HW
* offload for IBSS RSN is not supported by this driver.
*
* NOTE: If the previous main interface has already
* disabled hw crypto offload, we have to keep this
* previous disable_offload setting as it was.
* Altough ideally, we should notify mac80211 and tell
* it to forget about any HW crypto offload for now.
*/
ar->disable_offload |= ((vif->type != NL80211_IFTYPE_STATION) &&
(vif->type != NL80211_IFTYPE_AP));

ar->rx_software_decryption = ar->disable_offload;

err = carl9170_set_operating_mode(ar);
return err;
Expand Down Expand Up @@ -1160,9 +1173,7 @@ static int carl9170_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
if (ar->disable_offload || !vif)
return -EOPNOTSUPP;

/*
* We have to fall back to software encryption, whenever
* the user choose to participates in an IBSS or is connected
/* Fall back to software encryption whenever the driver is connected
* to more than one network.
*
* This is very unfortunate, because some machines cannot handle
Expand Down

0 comments on commit 7a5c730

Please sign in to comment.