diff options
author | Stanislaw Gruszka <sgruszka@redhat.com> | 2018-09-04 17:40:59 +0300 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2018-09-19 13:29:08 +0300 |
commit | 60c26859e863c1b83757759176517453599db500 (patch) | |
tree | 4e7acdccdc13d7a9d48c8d4a77af658f075967f4 /drivers/net/wireless/mediatek/mt76/mt76x0/main.c | |
parent | 22c575c4f1777fdcb718f1c610ed8d25ae5ce653 (diff) | |
download | linux-60c26859e863c1b83757759176517453599db500.tar.xz |
mt76: unify set_key
Merge mt76x0 and mt76x2 set_key mac80211 callback.
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt76x0/main.c')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt76x0/main.c | 37 |
1 files changed, 1 insertions, 36 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/main.c b/drivers/net/wireless/mediatek/mt76/mt76x0/main.c index d2e243785b67..f58c7ee332e0 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/main.c @@ -181,41 +181,6 @@ mt76x0_sw_scan_complete(struct ieee80211_hw *hw, MT_CALIBRATE_INTERVAL); } -static int -mt76x0_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, - struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) -{ - struct mt76x0_dev *dev = hw->priv; - struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv; - struct mt76x02_sta *msta = sta ? (struct mt76x02_sta *) sta->drv_priv : NULL; - struct mt76_wcid *wcid = msta ? &msta->wcid : &mvif->group_wcid; - int idx = key->keyidx; - int ret; - - if (cmd == SET_KEY) { - key->hw_key_idx = wcid->idx; - wcid->hw_key_idx = idx; - } else { - if (idx == wcid->hw_key_idx) - wcid->hw_key_idx = -1; - - key = NULL; - } - - if (!msta) { - if (key || wcid->hw_key_idx == idx) { - ret = mt76x02_mac_wcid_set_key(&dev->mt76, wcid->idx, key); - if (ret) - return ret; - } - - return mt76x02_mac_shared_key_setup(&dev->mt76, mvif->idx, idx, key); - } - - return mt76x02_mac_wcid_set_key(&dev->mt76, msta->wcid.idx, key); -} - static int mt76x0_set_rts_threshold(struct ieee80211_hw *hw, u32 value) { struct mt76x0_dev *dev = hw->priv; @@ -260,7 +225,7 @@ const struct ieee80211_ops mt76x0_ops = { .sta_add = mt76x02_sta_add, .sta_remove = mt76x02_sta_remove, .sta_notify = mt76x0_sta_notify, - .set_key = mt76x0_set_key, + .set_key = mt76x02_set_key, .conf_tx = mt76x0_conf_tx, .sw_scan_start = mt76x0_sw_scan, .sw_scan_complete = mt76x0_sw_scan_complete, |