Return-path: Received: from mail-wi0-f169.google.com ([209.85.212.169]:34764 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753369AbbFRIGW (ORCPT ); Thu, 18 Jun 2015 04:06:22 -0400 Received: by wicnd19 with SMTP id nd19so14486419wic.1 for ; Thu, 18 Jun 2015 01:06:20 -0700 (PDT) MIME-Version: 1.0 Date: Thu, 18 Jun 2015 10:06:20 +0200 Message-ID: (sfid-20150618_100635_431547_CF0724AB) Subject: ath9k: multicast don't work when: two STA (sta + p2p_client) + hwcrypt From: Janusz Dziedzic To: linux-wireless@vger.kernel.org Cc: Felix Fietkau , Sujith Manoharan Content-Type: text/plain; charset=UTF-8 Sender: linux-wireless-owner@vger.kernel.org List-ID: STA iface: ath: phy0: Set HW Key 0 (pairwise) vif: 2c:d0:5a:d3:f1:e9 sta: f4:b7:e2:38:83:f3 - idx: 4 ath: phy0: Set HW Key 0 (group) vif: 2c:d0:5a:d3:f1:e9 sta: (null) - idx: 1 P2P_CLIENT iface: ath: phy0: Set HW Key 0 (pairwise) vif: 2e:d0:5a:d3:f1:e9 sta: 0c:8b:fd:1e:58:9f - idx: 68 ath: phy0: Set HW Key 0 (group) vif: 2e:d0:5a:d3:f1:e9 sta: (null) - idx: 1 Seems we overwrite multicast hw key - both idx = 1 1) First patch I made: diff --git a/drivers/net/wireless/ath/key.c b/drivers/net/wireless/ath/key.c index 1816b4e..b15873b 100644 --- a/drivers/net/wireless/ath/key.c +++ b/drivers/net/wireless/ath/key.c @@ -507,6 +507,15 @@ int ath_key_config(struct ath_common *common, if (!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) { switch (vif->type) { + case NL80211_IFTYPE_STATION: + idx = key->keyidx; + if (vif->bss_conf.bssid) { + ether_addr_copy(gmac, bssid); + gmac[0] |= 0x01; + mac = gmac; + idx = ath_reserve_key_cache_slot(common, key->cipher); + } + break; case NL80211_IFTYPE_AP: memcpy(gmac, vif->addr, ETH_ALEN); gmac[0] |= 0x01; Multicast works fine for STA/P2P_CLIENT but multicast rekeying don't work correctly, while we have 2 multicast keys installed for the same bssid (eg. idx 6, 68) after rekey. Seem hw choose always key with lowest idx - hw decrypt mcast packects correctly every second rekey :-) BTW, this needs attention to be sure hw decrypt frames correctly - I am checking RX_FLAG_DECRYPTED flag, while often HW send crypted packets and mac80211 decrypt them correctly (every second rekey for example). So, some mixture of hwcrypt and swcrypt is seen :) 2) works perfectly when ath9k loaded with nohwcrypt=1 Any ideas how to solve this correctly (is it possible with hwcrypt at all)? BR Janusz