Commit a60951d4 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau
Browse files

mt76: mt7921: enable hw offloading for wep keys



Enable wep key hw offloading for sta mode. This patch fixes
WoW support for wep connections.

Tested-by: default avatarDeren.Wu <deren.wu@mediatek.com>
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 83d229d2
Loading
Loading
Loading
Loading
+17 −5
Original line number Original line Diff line number Diff line
@@ -376,6 +376,10 @@ static int mt7921_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
		key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIE;
		key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIE;
		wcid_keyidx = &wcid->hw_key_idx2;
		wcid_keyidx = &wcid->hw_key_idx2;
		break;
		break;
	case WLAN_CIPHER_SUITE_WEP40:
	case WLAN_CIPHER_SUITE_WEP104:
		if (!mvif->wep_sta)
			return -EOPNOTSUPP;
	case WLAN_CIPHER_SUITE_TKIP:
	case WLAN_CIPHER_SUITE_TKIP:
	case WLAN_CIPHER_SUITE_CCMP:
	case WLAN_CIPHER_SUITE_CCMP:
	case WLAN_CIPHER_SUITE_CCMP_256:
	case WLAN_CIPHER_SUITE_CCMP_256:
@@ -383,8 +387,6 @@ static int mt7921_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
	case WLAN_CIPHER_SUITE_GCMP_256:
	case WLAN_CIPHER_SUITE_GCMP_256:
	case WLAN_CIPHER_SUITE_SMS4:
	case WLAN_CIPHER_SUITE_SMS4:
		break;
		break;
	case WLAN_CIPHER_SUITE_WEP40:
	case WLAN_CIPHER_SUITE_WEP104:
	default:
	default:
		return -EOPNOTSUPP;
		return -EOPNOTSUPP;
	}
	}
@@ -402,6 +404,12 @@ static int mt7921_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
			    cmd == SET_KEY ? key : NULL);
			    cmd == SET_KEY ? key : NULL);


	err = mt7921_mcu_add_key(dev, vif, msta, key, cmd);
	err = mt7921_mcu_add_key(dev, vif, msta, key, cmd);
	if (err)
		goto out;

	if (key->cipher == WLAN_CIPHER_SUITE_WEP104 ||
	    key->cipher == WLAN_CIPHER_SUITE_WEP40)
		err = mt7921_mcu_add_key(dev, vif, mvif->wep_sta, key, cmd);
out:
out:
	mt7921_mutex_release(dev);
	mt7921_mutex_release(dev);


@@ -608,9 +616,12 @@ int mt7921_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
	if (ret)
	if (ret)
		return ret;
		return ret;


	if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls)
	if (vif->type == NL80211_IFTYPE_STATION) {
		mt76_connac_mcu_uni_add_bss(&dev->mphy, vif, &mvif->sta.wcid,
		mvif->wep_sta = msta;
					    true);
		if (!sta->tdls)
			mt76_connac_mcu_uni_add_bss(&dev->mphy, vif,
						    &mvif->sta.wcid, true);
	}


	mt7921_mac_wtbl_update(dev, idx,
	mt7921_mac_wtbl_update(dev, idx,
			       MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
			       MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
@@ -640,6 +651,7 @@ void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
	if (vif->type == NL80211_IFTYPE_STATION) {
	if (vif->type == NL80211_IFTYPE_STATION) {
		struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
		struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;


		mvif->wep_sta = NULL;
		ewma_rssi_init(&mvif->rssi);
		ewma_rssi_init(&mvif->rssi);
		if (!sta->tdls)
		if (!sta->tdls)
			mt76_connac_mcu_uni_add_bss(&dev->mphy, vif,
			mt76_connac_mcu_uni_add_bss(&dev->mphy, vif,
+2 −0
Original line number Original line Diff line number Diff line
@@ -102,6 +102,8 @@ struct mt7921_vif {
	struct mt76_vif mt76; /* must be first */
	struct mt76_vif mt76; /* must be first */


	struct mt7921_sta sta;
	struct mt7921_sta sta;
	struct mt7921_sta *wep_sta;

	struct mt7921_phy *phy;
	struct mt7921_phy *phy;


	struct ewma_rssi rssi;
	struct ewma_rssi rssi;