mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
staging: wfx: introduce wfx_set_default_unicast_key()
Currently code handle WEP keys manually. It is far easier to use the set_default_unicast_key() callback provided by mac80211. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20200420160311.57323-11-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
28502e02e2
commit
7a44644c93
@@ -257,13 +257,3 @@ int wfx_upload_keys(struct wfx_vif *wvif)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wfx_wep_key_work(struct work_struct *work)
|
|
||||||
{
|
|
||||||
struct wfx_vif *wvif = container_of(work, struct wfx_vif, wep_key_work);
|
|
||||||
|
|
||||||
wfx_tx_flush(wvif->wdev);
|
|
||||||
hif_wep_default_key_id(wvif, wvif->wep_default_key_id);
|
|
||||||
wfx_pending_requeue(wvif->wdev, wvif->wep_pending_skb);
|
|
||||||
wvif->wep_pending_skb = NULL;
|
|
||||||
wfx_tx_unlock(wvif->wdev);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -17,6 +17,5 @@ int wfx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
|
|||||||
struct ieee80211_vif *vif, struct ieee80211_sta *sta,
|
struct ieee80211_vif *vif, struct ieee80211_sta *sta,
|
||||||
struct ieee80211_key_conf *key);
|
struct ieee80211_key_conf *key);
|
||||||
int wfx_upload_keys(struct wfx_vif *wvif);
|
int wfx_upload_keys(struct wfx_vif *wvif);
|
||||||
void wfx_wep_key_work(struct work_struct *work);
|
|
||||||
|
|
||||||
#endif /* WFX_STA_H */
|
#endif /* WFX_STA_H */
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ static const struct ieee80211_ops wfx_ops = {
|
|||||||
.set_tim = wfx_set_tim,
|
.set_tim = wfx_set_tim,
|
||||||
.set_key = wfx_set_key,
|
.set_key = wfx_set_key,
|
||||||
.set_rts_threshold = wfx_set_rts_threshold,
|
.set_rts_threshold = wfx_set_rts_threshold,
|
||||||
|
.set_default_unicast_key = wfx_set_default_unicast_key,
|
||||||
.bss_info_changed = wfx_bss_info_changed,
|
.bss_info_changed = wfx_bss_info_changed,
|
||||||
.prepare_multicast = wfx_prepare_multicast,
|
.prepare_multicast = wfx_prepare_multicast,
|
||||||
.configure_filter = wfx_configure_filter,
|
.configure_filter = wfx_configure_filter,
|
||||||
|
|||||||
@@ -254,36 +254,6 @@ bool wfx_tx_queues_has_cab(struct wfx_vif *wvif)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool wfx_handle_tx_data(struct wfx_dev *wdev, struct sk_buff *skb)
|
|
||||||
{
|
|
||||||
struct hif_req_tx *req = wfx_skb_txreq(skb);
|
|
||||||
struct ieee80211_key_conf *hw_key = wfx_skb_tx_priv(skb)->hw_key;
|
|
||||||
struct ieee80211_hdr *frame =
|
|
||||||
(struct ieee80211_hdr *)(req->frame + req->data_flags.fc_offset);
|
|
||||||
struct wfx_vif *wvif =
|
|
||||||
wdev_to_wvif(wdev, ((struct hif_msg *)skb->data)->interface);
|
|
||||||
|
|
||||||
if (!wvif)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// FIXME: identify the exact scenario matched by this condition. Does it
|
|
||||||
// happen yet?
|
|
||||||
if (ieee80211_has_protected(frame->frame_control) &&
|
|
||||||
hw_key && hw_key->keyidx != wvif->wep_default_key_id &&
|
|
||||||
(hw_key->cipher == WLAN_CIPHER_SUITE_WEP40 ||
|
|
||||||
hw_key->cipher == WLAN_CIPHER_SUITE_WEP104)) {
|
|
||||||
wfx_tx_lock(wdev);
|
|
||||||
WARN_ON(wvif->wep_pending_skb);
|
|
||||||
wvif->wep_default_key_id = hw_key->keyidx;
|
|
||||||
wvif->wep_pending_skb = skb;
|
|
||||||
if (!schedule_work(&wvif->wep_key_work))
|
|
||||||
wfx_tx_unlock(wdev);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev)
|
static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev)
|
||||||
{
|
{
|
||||||
struct wfx_queue *sorted_queues[IEEE80211_NUM_ACS];
|
struct wfx_queue *sorted_queues[IEEE80211_NUM_ACS];
|
||||||
@@ -348,9 +318,6 @@ struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev)
|
|||||||
return NULL;
|
return NULL;
|
||||||
skb_queue_tail(&wdev->tx_pending, skb);
|
skb_queue_tail(&wdev->tx_pending, skb);
|
||||||
wake_up(&wdev->tx_dequeue);
|
wake_up(&wdev->tx_dequeue);
|
||||||
// FIXME: is it useful?
|
|
||||||
if (wfx_handle_tx_data(wdev, skb))
|
|
||||||
continue;
|
|
||||||
tx_priv = wfx_skb_tx_priv(skb);
|
tx_priv = wfx_skb_tx_priv(skb);
|
||||||
tx_priv->xmit_timestamp = ktime_get();
|
tx_priv->xmit_timestamp = ktime_get();
|
||||||
return (struct hif_msg *)skb->data;
|
return (struct hif_msg *)skb->data;
|
||||||
|
|||||||
@@ -275,6 +275,14 @@ static void wfx_beacon_loss_work(struct work_struct *work)
|
|||||||
msecs_to_jiffies(bss_conf->beacon_int));
|
msecs_to_jiffies(bss_conf->beacon_int));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wfx_set_default_unicast_key(struct ieee80211_hw *hw,
|
||||||
|
struct ieee80211_vif *vif, int idx)
|
||||||
|
{
|
||||||
|
struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv;
|
||||||
|
|
||||||
|
hif_wep_default_key_id(wvif, idx);
|
||||||
|
}
|
||||||
|
|
||||||
// Call it with wdev->conf_mutex locked
|
// Call it with wdev->conf_mutex locked
|
||||||
static void wfx_do_unjoin(struct wfx_vif *wvif)
|
static void wfx_do_unjoin(struct wfx_vif *wvif)
|
||||||
{
|
{
|
||||||
@@ -560,13 +568,6 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw,
|
|||||||
wfx_filter_beacon(wvif, true);
|
wfx_filter_beacon(wvif, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* assoc/disassoc, or maybe AID changed */
|
|
||||||
if (changed & BSS_CHANGED_ASSOC) {
|
|
||||||
wfx_tx_lock_flush(wdev);
|
|
||||||
wvif->wep_default_key_id = -1;
|
|
||||||
wfx_tx_unlock(wdev);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (changed & BSS_CHANGED_ASSOC) {
|
if (changed & BSS_CHANGED_ASSOC) {
|
||||||
if (info->assoc || info->ibss_joined)
|
if (info->assoc || info->ibss_joined)
|
||||||
wfx_join_finalize(wvif, info);
|
wfx_join_finalize(wvif, info);
|
||||||
@@ -757,9 +758,6 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
|
|||||||
INIT_WORK(&wvif->update_tim_work, wfx_update_tim_work);
|
INIT_WORK(&wvif->update_tim_work, wfx_update_tim_work);
|
||||||
INIT_DELAYED_WORK(&wvif->beacon_loss_work, wfx_beacon_loss_work);
|
INIT_DELAYED_WORK(&wvif->beacon_loss_work, wfx_beacon_loss_work);
|
||||||
|
|
||||||
wvif->wep_default_key_id = -1;
|
|
||||||
INIT_WORK(&wvif->wep_key_work, wfx_wep_key_work);
|
|
||||||
|
|
||||||
init_completion(&wvif->set_pm_mode_complete);
|
init_completion(&wvif->set_pm_mode_complete);
|
||||||
complete(&wvif->set_pm_mode_complete);
|
complete(&wvif->set_pm_mode_complete);
|
||||||
INIT_WORK(&wvif->tx_policy_upload_work, wfx_tx_policy_upload_work);
|
INIT_WORK(&wvif->tx_policy_upload_work, wfx_tx_policy_upload_work);
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ int wfx_start(struct ieee80211_hw *hw);
|
|||||||
void wfx_stop(struct ieee80211_hw *hw);
|
void wfx_stop(struct ieee80211_hw *hw);
|
||||||
int wfx_config(struct ieee80211_hw *hw, u32 changed);
|
int wfx_config(struct ieee80211_hw *hw, u32 changed);
|
||||||
int wfx_set_rts_threshold(struct ieee80211_hw *hw, u32 value);
|
int wfx_set_rts_threshold(struct ieee80211_hw *hw, u32 value);
|
||||||
|
void wfx_set_default_unicast_key(struct ieee80211_hw *hw,
|
||||||
|
struct ieee80211_vif *vif, int idx);
|
||||||
u64 wfx_prepare_multicast(struct ieee80211_hw *hw,
|
u64 wfx_prepare_multicast(struct ieee80211_hw *hw,
|
||||||
struct netdev_hw_addr_list *mc_list);
|
struct netdev_hw_addr_list *mc_list);
|
||||||
void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags,
|
void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags,
|
||||||
|
|||||||
@@ -74,10 +74,6 @@ struct wfx_vif {
|
|||||||
bool after_dtim_tx_allowed;
|
bool after_dtim_tx_allowed;
|
||||||
struct delayed_work beacon_loss_work;
|
struct delayed_work beacon_loss_work;
|
||||||
|
|
||||||
s8 wep_default_key_id;
|
|
||||||
struct sk_buff *wep_pending_skb;
|
|
||||||
struct work_struct wep_key_work;
|
|
||||||
|
|
||||||
struct tx_policy_cache tx_policy_cache;
|
struct tx_policy_cache tx_policy_cache;
|
||||||
struct work_struct tx_policy_upload_work;
|
struct work_struct tx_policy_upload_work;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user