mt76: mt7615: add set_key_cmd and mt76_wcid to mt7615_mac_wtbl_set_key signature
Introduce set_key_cmd and mt76_wcid pointer to mt7615_mac_wtbl_set_key signature and do not set key to NULL if cmd is DISABLE_KEY. This is a preliminary patch to add BIP_CMAC_128 hw support to mt7615 driver Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
093733ca53
commit
27b8a900b2
|
@ -594,9 +594,12 @@ void mt7615_mac_set_rates(struct mt7615_dev *dev, struct mt7615_sta *sta,
|
||||||
|
|
||||||
static enum mt7615_cipher_type
|
static enum mt7615_cipher_type
|
||||||
mt7615_mac_get_key_info(struct ieee80211_key_conf *key,
|
mt7615_mac_get_key_info(struct ieee80211_key_conf *key,
|
||||||
u8 *key_data)
|
u8 *key_data, enum set_key_cmd cmd)
|
||||||
{
|
{
|
||||||
if (!key || key->keylen > 32)
|
if (cmd == DISABLE_KEY)
|
||||||
|
return MT_CIPHER_NONE;
|
||||||
|
|
||||||
|
if (key->keylen > 32)
|
||||||
return MT_CIPHER_NONE;
|
return MT_CIPHER_NONE;
|
||||||
|
|
||||||
memcpy(key_data, key->key, key->keylen);
|
memcpy(key_data, key->key, key->keylen);
|
||||||
|
@ -626,8 +629,9 @@ mt7615_mac_get_key_info(struct ieee80211_key_conf *key,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int mt7615_mac_wtbl_set_key(struct mt7615_dev *dev, int wcid,
|
int mt7615_mac_wtbl_set_key(struct mt7615_dev *dev, struct mt76_wcid *wcid,
|
||||||
struct ieee80211_key_conf *key)
|
struct ieee80211_key_conf *key,
|
||||||
|
enum set_key_cmd cmd)
|
||||||
{
|
{
|
||||||
enum mt7615_cipher_type cipher;
|
enum mt7615_cipher_type cipher;
|
||||||
u8 key_data[32] = {};
|
u8 key_data[32] = {};
|
||||||
|
@ -640,13 +644,13 @@ int mt7615_mac_wtbl_set_key(struct mt7615_dev *dev, int wcid,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
cipher = mt7615_mac_get_key_info(key, key_data);
|
cipher = mt7615_mac_get_key_info(key, key_data, cmd);
|
||||||
if (cipher == MT_CIPHER_NONE && key) {
|
if (cipher == MT_CIPHER_NONE && cmd == SET_KEY) {
|
||||||
err = -EOPNOTSUPP;
|
err = -EOPNOTSUPP;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
addr = mt7615_mac_wtbl_addr(wcid);
|
addr = mt7615_mac_wtbl_addr(wcid->idx);
|
||||||
|
|
||||||
mt76_wr_copy(dev, addr + 30 * 4, key_data, sizeof(key_data));
|
mt76_wr_copy(dev, addr + 30 * 4, key_data, sizeof(key_data));
|
||||||
|
|
||||||
|
@ -656,14 +660,14 @@ int mt7615_mac_wtbl_set_key(struct mt7615_dev *dev, int wcid,
|
||||||
w0 = mt76_rr(dev, addr);
|
w0 = mt76_rr(dev, addr);
|
||||||
w1 = mt76_rr(dev, addr + 4);
|
w1 = mt76_rr(dev, addr + 4);
|
||||||
w0 &= ~(MT_WTBL_W0_KEY_IDX | MT_WTBL_W0_RX_KEY_VALID);
|
w0 &= ~(MT_WTBL_W0_KEY_IDX | MT_WTBL_W0_RX_KEY_VALID);
|
||||||
if (key)
|
if (cmd == SET_KEY)
|
||||||
w0 |= FIELD_PREP(MT_WTBL_W0_KEY_IDX, key->keyidx) |
|
w0 |= FIELD_PREP(MT_WTBL_W0_KEY_IDX, key->keyidx) |
|
||||||
MT_WTBL_W0_RX_KEY_VALID;
|
MT_WTBL_W0_RX_KEY_VALID;
|
||||||
mt76_wr(dev, MT_WTBL_RICR0, w0);
|
mt76_wr(dev, MT_WTBL_RICR0, w0);
|
||||||
mt76_wr(dev, MT_WTBL_RICR1, w1);
|
mt76_wr(dev, MT_WTBL_RICR1, w1);
|
||||||
|
|
||||||
mt76_wr(dev, MT_WTBL_UPDATE,
|
mt76_wr(dev, MT_WTBL_UPDATE,
|
||||||
FIELD_PREP(MT_WTBL_UPDATE_WLAN_IDX, wcid) |
|
FIELD_PREP(MT_WTBL_UPDATE_WLAN_IDX, wcid->idx) |
|
||||||
MT_WTBL_UPDATE_RXINFO_UPDATE);
|
MT_WTBL_UPDATE_RXINFO_UPDATE);
|
||||||
|
|
||||||
if (!mt76_poll(dev, MT_WTBL_UPDATE, MT_WTBL_UPDATE_BUSY, 0, 5000))
|
if (!mt76_poll(dev, MT_WTBL_UPDATE, MT_WTBL_UPDATE_BUSY, 0, 5000))
|
||||||
|
|
|
@ -196,15 +196,13 @@ static int mt7615_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
|
||||||
if (cmd == SET_KEY) {
|
if (cmd == SET_KEY) {
|
||||||
key->hw_key_idx = wcid->idx;
|
key->hw_key_idx = wcid->idx;
|
||||||
wcid->hw_key_idx = idx;
|
wcid->hw_key_idx = idx;
|
||||||
} else {
|
} else if (idx == wcid->hw_key_idx) {
|
||||||
if (idx == wcid->hw_key_idx)
|
wcid->hw_key_idx = -1;
|
||||||
wcid->hw_key_idx = -1;
|
|
||||||
|
|
||||||
key = NULL;
|
|
||||||
}
|
}
|
||||||
mt76_wcid_key_setup(&dev->mt76, wcid, key);
|
mt76_wcid_key_setup(&dev->mt76, wcid,
|
||||||
|
cmd == SET_KEY ? key : NULL);
|
||||||
|
|
||||||
return mt7615_mac_wtbl_set_key(dev, wcid->idx, key);
|
return mt7615_mac_wtbl_set_key(dev, wcid, key, cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mt7615_config(struct ieee80211_hw *hw, u32 changed)
|
static int mt7615_config(struct ieee80211_hw *hw, u32 changed)
|
||||||
|
|
|
@ -219,8 +219,9 @@ int mt7615_mac_write_txwi(struct mt7615_dev *dev, __le32 *txwi,
|
||||||
int mt7615_mac_fill_rx(struct mt7615_dev *dev, struct sk_buff *skb);
|
int mt7615_mac_fill_rx(struct mt7615_dev *dev, struct sk_buff *skb);
|
||||||
void mt7615_mac_add_txs(struct mt7615_dev *dev, void *data);
|
void mt7615_mac_add_txs(struct mt7615_dev *dev, void *data);
|
||||||
void mt7615_mac_tx_free(struct mt7615_dev *dev, struct sk_buff *skb);
|
void mt7615_mac_tx_free(struct mt7615_dev *dev, struct sk_buff *skb);
|
||||||
int mt7615_mac_wtbl_set_key(struct mt7615_dev *dev, int wcid,
|
int mt7615_mac_wtbl_set_key(struct mt7615_dev *dev, struct mt76_wcid *wcid,
|
||||||
struct ieee80211_key_conf *key);
|
struct ieee80211_key_conf *key,
|
||||||
|
enum set_key_cmd cmd);
|
||||||
|
|
||||||
int mt7615_mcu_set_eeprom(struct mt7615_dev *dev);
|
int mt7615_mcu_set_eeprom(struct mt7615_dev *dev);
|
||||||
int mt7615_mcu_init_mac(struct mt7615_dev *dev);
|
int mt7615_mcu_init_mac(struct mt7615_dev *dev);
|
||||||
|
|
Loading…
Reference in New Issue