Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab885f8c authored by Emmanuel Grumbach's avatar Emmanuel Grumbach Committed by John W. Linville
Browse files

iwlwifi-2.6: enables RX TKIP decryption in HW



This patch enables RX TKIP decryption in HW.

Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 2bc75089
Loading
Loading
Loading
Loading
+51 −0
Original line number Original line Diff line number Diff line
@@ -7187,6 +7187,56 @@ static int iwl4965_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
	return rc;
	return rc;
}
}


static void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw,
			struct ieee80211_key_conf *keyconf, const u8 *addr,
			u32 iv32, u16 *phase1key)
{
	struct iwl_priv *priv = hw->priv;
	u8 sta_id = IWL_INVALID_STATION;
	unsigned long flags;
	__le16 key_flags = 0;
	int i;
	DECLARE_MAC_BUF(mac);

	IWL_DEBUG_MAC80211("enter\n");

	sta_id = iwl4965_hw_find_station(priv, addr);
	if (sta_id == IWL_INVALID_STATION) {
		IWL_DEBUG_MAC80211("leave - %s not in station map.\n",
				   print_mac(mac, addr));
		return;
	}

	iwl4965_scan_cancel_timeout(priv, 100);

	key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK);
	key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
	key_flags &= ~STA_KEY_FLG_INVALID;

	if (sta_id == priv->hw_setting.bcast_sta_id)
		key_flags |= STA_KEY_MULTICAST_MSK;

	spin_lock_irqsave(&priv->sta_lock, flags);

	priv->stations[sta_id].sta.key.key_offset =
					(sta_id % STA_KEY_MAX_NUM);/* FIXME */
	priv->stations[sta_id].sta.key.key_flags = key_flags;
	priv->stations[sta_id].sta.key.tkip_rx_tsc_byte2 = (u8) iv32;

	for (i = 0; i < 5; i++)
		priv->stations[sta_id].sta.key.tkip_rx_ttak[i] =
			cpu_to_le16(phase1key[i]);

	priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
	priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;

	iwl4965_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC);

	spin_unlock_irqrestore(&priv->sta_lock, flags);

	IWL_DEBUG_MAC80211("leave\n");
}

static int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
static int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
			   const u8 *local_addr, const u8 *addr,
			   const u8 *local_addr, const u8 *addr,
			   struct ieee80211_key_conf *key)
			   struct ieee80211_key_conf *key)
@@ -8128,6 +8178,7 @@ static struct ieee80211_ops iwl4965_hw_ops = {
	.config_interface = iwl4965_mac_config_interface,
	.config_interface = iwl4965_mac_config_interface,
	.configure_filter = iwl4965_configure_filter,
	.configure_filter = iwl4965_configure_filter,
	.set_key = iwl4965_mac_set_key,
	.set_key = iwl4965_mac_set_key,
	.update_tkip_key = iwl4965_mac_update_tkip_key,
	.get_stats = iwl4965_mac_get_stats,
	.get_stats = iwl4965_mac_get_stats,
	.get_tx_stats = iwl4965_mac_get_tx_stats,
	.get_tx_stats = iwl4965_mac_get_tx_stats,
	.conf_tx = iwl4965_mac_conf_tx,
	.conf_tx = iwl4965_mac_conf_tx,