From c9638363f02df48a8b215c6e4b056f7646ba403f Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Thu, 6 Aug 2020 11:47:01 +0100 Subject: staging: wfx: fix a handful of spelling mistakes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are various spelling mistakes in comments and error messages. Fix these. Signed-off-by: Colin Ian King Acked-by: Randy Dunlap Reviewed-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20200806104701.46123-1-colin.king@canonical.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/sta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging/wfx/sta.c') diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 4e30ab17a93d..ad63332f690c 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -214,7 +214,7 @@ static int wfx_get_ps_timeout(struct wfx_vif *wvif, bool *enable_ps) if (chan0 && chan1 && chan0->hw_value != chan1->hw_value && wvif->vif->type != NL80211_IFTYPE_AP) { // It is necessary to enable powersave if channels - // are differents. + // are different. if (enable_ps) *enable_ps = true; if (wvif->wdev->force_ps_timeout > -1) -- cgit v1.2.3 From 268bceec1684932e194ae87877dcc73f534d921c Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Tue, 25 Aug 2020 10:58:17 +0200 Subject: staging: wfx: fix BA when device is AP and MFP is enabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The protection of the management frames is mainly done by mac80211. However, frames for the management of the BlockAck sessions are directly sent by the device. These frames have to be protected if MFP is in use. So the driver has to pass the MFP configuration to the device. Until now, the BlockAck management frames were completely unprotected whatever the status of the MFP negotiation. So, some devices dropped these frames. The device has two knobs to control the MFP. One global and one per station. Normally, the driver should always enable global MFP. Then it should enable MFP on every station with which MFP was successfully negotiated. Unfortunately, the older firmwares only provide the global control. So, this patch enable global MFP as it is exposed in the beacon. Then it marks every station with which the MFP is effective. Thus, the support for the old firmwares is not so bad. It may only encounter some difficulties to negotiate BA sessions when the local device (the AP) is MFP capable (ieee80211w=1) but the station is not. The only solution for this case is to upgrade the firmware. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20200825085828.399505-1-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/sta.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'drivers/staging/wfx/sta.c') diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index ad63332f690c..c31e302d05c9 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -434,7 +434,7 @@ int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, wvif->link_id_map |= BIT(sta_priv->link_id); WARN_ON(!sta_priv->link_id); WARN_ON(sta_priv->link_id >= HIF_LINK_ID_MAX); - hif_map_link(wvif, sta->addr, 0, sta_priv->link_id); + hif_map_link(wvif, sta->addr, sta->mfp ? 2 : 0, sta_priv->link_id); return 0; } @@ -474,6 +474,31 @@ static int wfx_upload_ap_templates(struct wfx_vif *wvif) return 0; } +static void wfx_set_mfp_ap(struct wfx_vif *wvif) +{ + struct sk_buff *skb = ieee80211_beacon_get(wvif->wdev->hw, wvif->vif); + const int ieoffset = offsetof(struct ieee80211_mgmt, u.beacon.variable); + const u16 *ptr = (u16 *)cfg80211_find_ie(WLAN_EID_RSN, + skb->data + ieoffset, + skb->len - ieoffset); + const int pairwise_cipher_suite_count_offset = 8 / sizeof(u16); + const int pairwise_cipher_suite_size = 4 / sizeof(u16); + const int akm_suite_size = 4 / sizeof(u16); + + if (ptr) { + ptr += pairwise_cipher_suite_count_offset; + if (WARN_ON(ptr > (u16 *)skb_tail_pointer(skb))) + return; + ptr += 1 + pairwise_cipher_suite_size * *ptr; + if (WARN_ON(ptr > (u16 *)skb_tail_pointer(skb))) + return; + ptr += 1 + akm_suite_size * *ptr; + if (WARN_ON(ptr > (u16 *)skb_tail_pointer(skb))) + return; + hif_set_mfp(wvif, *ptr & BIT(7), *ptr & BIT(6)); + } +} + int wfx_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; @@ -488,6 +513,7 @@ int wfx_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) ret = hif_start(wvif, &vif->bss_conf, wvif->channel); if (ret > 0) return -EIO; + wfx_set_mfp_ap(wvif); return ret; } -- cgit v1.2.3 From c566f1c79e981861a7552d7775bf9bcdb8812824 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Tue, 25 Aug 2020 10:58:18 +0200 Subject: staging: wfx: improve usage of hif_map_link() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Until now, hif_map_link() get as argument the raw value for map_link_flags when map_link_flags is defined as a bitfield. It was error prone. Now hif_map_link() takes explicit value for every flags of the struct map_link_flags. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20200825085828.399505-2-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/hif_tx.c | 5 +++-- drivers/staging/wfx/hif_tx.h | 3 ++- drivers/staging/wfx/sta.c | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'drivers/staging/wfx/sta.c') diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index 3b5f4dcc469c..6b89e55f03f4 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -499,7 +499,7 @@ int hif_beacon_transmit(struct wfx_vif *wvif, bool enable) return ret; } -int hif_map_link(struct wfx_vif *wvif, u8 *mac_addr, int flags, int sta_id) +int hif_map_link(struct wfx_vif *wvif, bool unmap, u8 *mac_addr, int sta_id, bool mfp) { int ret; struct hif_msg *hif; @@ -509,7 +509,8 @@ int hif_map_link(struct wfx_vif *wvif, u8 *mac_addr, int flags, int sta_id) return -ENOMEM; if (mac_addr) ether_addr_copy(body->mac_addr, mac_addr); - body->map_link_flags = *(struct hif_map_link_flags *)&flags; + body->map_link_flags.mfpc = mfp ? 1 : 0; + body->map_link_flags.map_direction = unmap ? 1 : 0; body->peer_sta_id = sta_id; wfx_fill_header(hif, wvif->id, HIF_REQ_ID_MAP_LINK, sizeof(*body)); ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); diff --git a/drivers/staging/wfx/hif_tx.h b/drivers/staging/wfx/hif_tx.h index e1da28aef706..b371b3777a31 100644 --- a/drivers/staging/wfx/hif_tx.h +++ b/drivers/staging/wfx/hif_tx.h @@ -55,7 +55,8 @@ int hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue, int hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, const struct ieee80211_channel *channel); int hif_beacon_transmit(struct wfx_vif *wvif, bool enable); -int hif_map_link(struct wfx_vif *wvif, u8 *mac_addr, int flags, int sta_id); +int hif_map_link(struct wfx_vif *wvif, + bool unmap, u8 *mac_addr, int sta_id, bool mfp); int hif_update_ie_beacon(struct wfx_vif *wvif, const u8 *ies, size_t ies_len); int hif_sl_set_mac_key(struct wfx_dev *wdev, const u8 *slk_key, int destination); diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index c31e302d05c9..b6ccb04f308a 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -434,7 +434,7 @@ int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, wvif->link_id_map |= BIT(sta_priv->link_id); WARN_ON(!sta_priv->link_id); WARN_ON(sta_priv->link_id >= HIF_LINK_ID_MAX); - hif_map_link(wvif, sta->addr, sta->mfp ? 2 : 0, sta_priv->link_id); + hif_map_link(wvif, false, sta->addr, sta_priv->link_id, sta->mfp); return 0; } @@ -449,7 +449,7 @@ int wfx_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, if (!sta_priv->link_id) return 0; // FIXME add a mutex? - hif_map_link(wvif, sta->addr, 1, sta_priv->link_id); + hif_map_link(wvif, true, sta->addr, sta_priv->link_id, false); wvif->link_id_map &= ~BIT(sta_priv->link_id); return 0; } -- cgit v1.2.3 From d1e0de312ba9a6939a34ba7f89fe2968e1bc6227 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Tue, 25 Aug 2020 10:58:19 +0200 Subject: staging: wfx: fix BA when MFP is disabled but BSS is MFP capable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The protection of the management frames is mainly done by mac80211. However, frames for the management of the BlockAck sessions are directly sent by the device. These frames have to be protected if MFP is in use. So the driver has to pass the MFP configuration to the device. Until now, the driver directly read the RSN IE of the BSS. However, it didn't work when the BSS was MFP capable (ieee80211w=1) and the local device has disabled MFP (ieee80211w=0). This patch read the MFP information directly from the struct ieee80211_sta. This information take into account the MFP negotiated during the association. In addition, the code is far simpler. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20200825085828.399505-3-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/sta.c | 34 +++------------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) (limited to 'drivers/staging/wfx/sta.c') diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index b6ccb04f308a..2b848b8985df 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -323,36 +323,6 @@ void wfx_set_default_unicast_key(struct ieee80211_hw *hw, hif_wep_default_key_id(wvif, idx); } -static void wfx_set_mfp(struct wfx_vif *wvif, - struct cfg80211_bss *bss) -{ - const int pairwise_cipher_suite_count_offset = 8 / sizeof(u16); - const int pairwise_cipher_suite_size = 4 / sizeof(u16); - const int akm_suite_size = 4 / sizeof(u16); - const u16 *ptr = NULL; - bool mfpc = false; - bool mfpr = false; - - /* 802.11w protected mgmt frames */ - - /* retrieve MFPC and MFPR flags from beacon or PBRSP */ - - rcu_read_lock(); - if (bss) - ptr = (const u16 *)ieee80211_bss_get_ie(bss, WLAN_EID_RSN); - - if (ptr) { - ptr += pairwise_cipher_suite_count_offset; - ptr += 1 + pairwise_cipher_suite_size * *ptr; - ptr += 1 + akm_suite_size * *ptr; - mfpr = *ptr & BIT(6); - mfpc = *ptr & BIT(7); - } - rcu_read_unlock(); - - hif_set_mfp(wvif, mfpc, mfpr); -} - void wfx_reset(struct wfx_vif *wvif) { struct wfx_dev *wdev = wvif->wdev; @@ -400,7 +370,6 @@ static void wfx_do_join(struct wfx_vif *wvif) } rcu_read_unlock(); - wfx_set_mfp(wvif, bss); cfg80211_put_bss(wvif->wdev->hw->wiphy, bss); wvif->join_in_progress = true; @@ -427,6 +396,9 @@ int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, sta_priv->vif_id = wvif->id; + if (vif->type == NL80211_IFTYPE_STATION) + hif_set_mfp(wvif, sta->mfp, sta->mfp); + // In station mode, the firmware interprets new link-id as a TDLS peer. if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) return 0; -- cgit v1.2.3 From 7373f31c4b5e382e5117b71a6792e8005c45aa50 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Tue, 25 Aug 2020 10:58:23 +0200 Subject: staging: wfx: fix frame reordering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When mac80211 debug is enabled, the trace below appears: [60744.340037] wlan0: Rx A-MPDU request on aa:bb:cc:97:60:24 tid 0 result -524 This imply that ___ieee80211_start_rx_ba_session will prematurely exit and frame reordering won't be enabled. Fixes: e5da5fbd77411 ("staging: wfx: fix CCMP/TKIP replay protection") Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20200825085828.399505-7-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/sta.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'drivers/staging/wfx/sta.c') diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 2b848b8985df..7a4c9f63c4a2 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -680,15 +680,16 @@ int wfx_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_ampdu_params *params) { - /* Aggregation is implemented fully in firmware, - * including block ack negotiation. Do not allow - * mac80211 stack to do anything: it interferes with - * the firmware. - */ - - /* Note that we still need this function stubbed. */ - - return -ENOTSUPP; + // Aggregation is implemented fully in firmware + switch (params->action) { + case IEEE80211_AMPDU_RX_START: + case IEEE80211_AMPDU_RX_STOP: + // Just acknowledge it to enable frame re-ordering + return 0; + default: + // Leave the firmware doing its business for tx aggregation + return -ENOTSUPP; + } } int wfx_add_chanctx(struct ieee80211_hw *hw, -- cgit v1.2.3 From ce3653a8d3db096aa163fc80239d8ec1305c81fa Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Tue, 25 Aug 2020 10:58:24 +0200 Subject: staging: wfx: fix potential use before init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The trace below can appear: [83613.832200] INFO: trying to register non-static key. [83613.837248] the code is fine but needs lockdep annotation. [83613.842808] turning off the locking correctness validator. [83613.848375] CPU: 3 PID: 141 Comm: kworker/3:2H Tainted: G O 5.6.13-silabs15 #2 [83613.857019] Hardware name: BCM2835 [83613.860605] Workqueue: events_highpri bh_work [wfx] [83613.865552] Backtrace: [83613.868041] [] (dump_backtrace) from [] (show_stack+0x20/0x24) [83613.881463] [] (show_stack) from [] (dump_stack+0xe8/0x114) [83613.888882] [] (dump_stack) from [] (register_lock_class+0x748/0x768) [83613.905035] [] (register_lock_class) from [] (__lock_acquire+0x88/0x13dc) [83613.924192] [] (__lock_acquire) from [] (lock_acquire+0xe8/0x274) [83613.942644] [] (lock_acquire) from [] (_raw_spin_lock_irqsave+0x58/0x6c) [83613.961714] [] (_raw_spin_lock_irqsave) from [] (skb_dequeue+0x24/0x78) [83613.974967] [] (skb_dequeue) from [] (wfx_tx_queues_get+0x96c/0x1294 [wfx]) [83613.989728] [] (wfx_tx_queues_get [wfx]) from [] (bh_work+0x454/0x26d8 [wfx]) [83614.009337] [] (bh_work [wfx]) from [] (process_one_work+0x23c/0x7ec) [83614.028141] [] (process_one_work) from [] (worker_thread+0x4c/0x55c) [83614.046861] [] (worker_thread) from [] (kthread+0x138/0x168) [83614.064876] [] (kthread) from [] (ret_from_fork+0x14/0x20) [83614.072200] Exception stack(0xecad3fb0 to 0xecad3ff8) [83614.077323] 3fa0: 00000000 00000000 00000000 00000000 [83614.085620] 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [83614.093914] 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000 Indeed, the code of wfx_add_interface() shows that the interface is enabled to early. So, the spinlock associated with some skb_queue may not yet initialized when wfx_tx_queues_get() is called. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20200825085828.399505-8-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/sta.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'drivers/staging/wfx/sta.c') diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 7a4c9f63c4a2..a890fe32161c 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -759,17 +759,6 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) return -EOPNOTSUPP; } - for (i = 0; i < ARRAY_SIZE(wdev->vif); i++) { - if (!wdev->vif[i]) { - wdev->vif[i] = vif; - wvif->id = i; - break; - } - } - if (i == ARRAY_SIZE(wdev->vif)) { - mutex_unlock(&wdev->conf_mutex); - return -EOPNOTSUPP; - } // FIXME: prefer use of container_of() to get vif wvif->vif = vif; wvif->wdev = wdev; @@ -786,12 +775,22 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) init_completion(&wvif->scan_complete); INIT_WORK(&wvif->scan_work, wfx_hw_scan_work); - mutex_unlock(&wdev->conf_mutex); + wfx_tx_queues_init(wvif); + wfx_tx_policy_init(wvif); + + for (i = 0; i < ARRAY_SIZE(wdev->vif); i++) { + if (!wdev->vif[i]) { + wdev->vif[i] = vif; + wvif->id = i; + break; + } + } + WARN(i == ARRAY_SIZE(wdev->vif), "try to instantiate more vif than supported"); hif_set_macaddr(wvif, vif->addr); - wfx_tx_queues_init(wvif); - wfx_tx_policy_init(wvif); + mutex_unlock(&wdev->conf_mutex); + wvif = NULL; while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { // Combo mode does not support Block Acks. We can re-enable them @@ -823,6 +822,7 @@ void wfx_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) wvif->vif = NULL; mutex_unlock(&wdev->conf_mutex); + wvif = NULL; while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { // Combo mode does not support Block Acks. We can re-enable them -- cgit v1.2.3 From 468f3386f71dde13a3421aaf6f89886f19f7f927 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Mon, 7 Sep 2020 12:14:51 +0200 Subject: staging: wfx: improve readability of association processing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The statements in wfx_bss_info_changed() has no particular order. For better readability, group and sort the statements relative to the association processing. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20200907101521.66082-2-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/sta.c | 53 +++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 27 deletions(-) (limited to 'drivers/staging/wfx/sta.c') diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index a890fe32161c..502967874373 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -547,19 +547,6 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, mutex_lock(&wdev->conf_mutex); - /* TODO: BSS_CHANGED_QOS */ - if (changed & BSS_CHANGED_ARP_FILTER) { - for (i = 0; i < HIF_MAX_ARP_IP_ADDRTABLE_ENTRIES; i++) { - __be32 *arp_addr = &info->arp_addr_list[i]; - - if (info->arp_addr_cnt > HIF_MAX_ARP_IP_ADDRTABLE_ENTRIES) - arp_addr = NULL; - if (i >= info->arp_addr_cnt) - arp_addr = NULL; - hif_set_arp_ipv4_filter(wvif, i, arp_addr); - } - } - if (changed & BSS_CHANGED_BASIC_RATES || changed & BSS_CHANGED_BEACON_INT || changed & BSS_CHANGED_BSSID) { @@ -567,12 +554,15 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, wfx_do_join(wvif); } - if (changed & BSS_CHANGED_AP_PROBE_RESP || - changed & BSS_CHANGED_BEACON) - wfx_upload_ap_templates(wvif); - - if (changed & BSS_CHANGED_BEACON_ENABLED) - wfx_enable_beacon(wvif, info->enable_beacon); + if (changed & BSS_CHANGED_ASSOC) { + if (info->assoc || info->ibss_joined) + wfx_join_finalize(wvif, info); + else if (!info->assoc && vif->type == NL80211_IFTYPE_STATION) + wfx_reset(wvif); + else + dev_warn(wdev->dev, "%s: misunderstood change: ASSOC\n", + __func__); + } if (changed & BSS_CHANGED_BEACON_INFO) { if (vif->type != NL80211_IFTYPE_STATION) @@ -585,16 +575,25 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, wfx_filter_beacon(wvif, true); } - if (changed & BSS_CHANGED_ASSOC) { - if (info->assoc || info->ibss_joined) - wfx_join_finalize(wvif, info); - else if (!info->assoc && vif->type == NL80211_IFTYPE_STATION) - wfx_reset(wvif); - else - dev_warn(wdev->dev, "%s: misunderstood change: ASSOC\n", - __func__); + if (changed & BSS_CHANGED_ARP_FILTER) { + for (i = 0; i < HIF_MAX_ARP_IP_ADDRTABLE_ENTRIES; i++) { + __be32 *arp_addr = &info->arp_addr_list[i]; + + if (info->arp_addr_cnt > HIF_MAX_ARP_IP_ADDRTABLE_ENTRIES) + arp_addr = NULL; + if (i >= info->arp_addr_cnt) + arp_addr = NULL; + hif_set_arp_ipv4_filter(wvif, i, arp_addr); + } } + if (changed & BSS_CHANGED_AP_PROBE_RESP || + changed & BSS_CHANGED_BEACON) + wfx_upload_ap_templates(wvif); + + if (changed & BSS_CHANGED_BEACON_ENABLED) + wfx_enable_beacon(wvif, info->enable_beacon); + if (changed & BSS_CHANGED_KEEP_ALIVE) hif_keep_alive_period(wvif, info->max_idle_period * USEC_PER_TU / USEC_PER_MSEC); -- cgit v1.2.3 From 178b8943d3e61a6e8a6d795fca5c98cb3fd13278 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Mon, 7 Sep 2020 12:14:52 +0200 Subject: staging: wfx: relocate wfx_join() beside wfx_join_finalize() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit wfx_join() and wfx_join_finalize() are the two halves of the association process. Group them. In addition, for better uniformity of the code, rename wfx_do_join() in wfx_join(). Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20200907101521.66082-3-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/sta.c | 100 +++++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 50 deletions(-) (limited to 'drivers/staging/wfx/sta.c') diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 502967874373..b2a29b2ac20c 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -340,54 +340,6 @@ void wfx_reset(struct wfx_vif *wvif) wfx_update_pm(wvif); } -static void wfx_do_join(struct wfx_vif *wvif) -{ - int ret; - struct ieee80211_bss_conf *conf = &wvif->vif->bss_conf; - struct cfg80211_bss *bss = NULL; - u8 ssid[IEEE80211_MAX_SSID_LEN]; - const u8 *ssidie = NULL; - int ssidlen = 0; - - wfx_tx_lock_flush(wvif->wdev); - - bss = cfg80211_get_bss(wvif->wdev->hw->wiphy, wvif->channel, - conf->bssid, NULL, 0, - IEEE80211_BSS_TYPE_ANY, IEEE80211_PRIVACY_ANY); - if (!bss && !conf->ibss_joined) { - wfx_tx_unlock(wvif->wdev); - return; - } - - rcu_read_lock(); // protect ssidie - if (bss) - ssidie = ieee80211_bss_get_ie(bss, WLAN_EID_SSID); - if (ssidie) { - ssidlen = ssidie[1]; - if (ssidlen > IEEE80211_MAX_SSID_LEN) - ssidlen = IEEE80211_MAX_SSID_LEN; - memcpy(ssid, &ssidie[2], ssidlen); - } - rcu_read_unlock(); - - cfg80211_put_bss(wvif->wdev->hw->wiphy, bss); - - wvif->join_in_progress = true; - ret = hif_join(wvif, conf, wvif->channel, ssid, ssidlen); - if (ret) { - ieee80211_connection_loss(wvif->vif); - wfx_reset(wvif); - } else { - /* Due to beacon filtering it is possible that the - * AP's beacon is not known for the mac80211 stack. - * Disable filtering temporary to make sure the stack - * receives at least one - */ - wfx_filter_beacon(wvif, false); - } - wfx_tx_unlock(wvif->wdev); -} - int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { @@ -496,6 +448,54 @@ void wfx_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) wfx_reset(wvif); } +static void wfx_join(struct wfx_vif *wvif) +{ + int ret; + struct ieee80211_bss_conf *conf = &wvif->vif->bss_conf; + struct cfg80211_bss *bss = NULL; + u8 ssid[IEEE80211_MAX_SSID_LEN]; + const u8 *ssidie = NULL; + int ssidlen = 0; + + wfx_tx_lock_flush(wvif->wdev); + + bss = cfg80211_get_bss(wvif->wdev->hw->wiphy, wvif->channel, + conf->bssid, NULL, 0, + IEEE80211_BSS_TYPE_ANY, IEEE80211_PRIVACY_ANY); + if (!bss && !conf->ibss_joined) { + wfx_tx_unlock(wvif->wdev); + return; + } + + rcu_read_lock(); // protect ssidie + if (bss) + ssidie = ieee80211_bss_get_ie(bss, WLAN_EID_SSID); + if (ssidie) { + ssidlen = ssidie[1]; + if (ssidlen > IEEE80211_MAX_SSID_LEN) + ssidlen = IEEE80211_MAX_SSID_LEN; + memcpy(ssid, &ssidie[2], ssidlen); + } + rcu_read_unlock(); + + cfg80211_put_bss(wvif->wdev->hw->wiphy, bss); + + wvif->join_in_progress = true; + ret = hif_join(wvif, conf, wvif->channel, ssid, ssidlen); + if (ret) { + ieee80211_connection_loss(wvif->vif); + wfx_reset(wvif); + } else { + /* Due to beacon filtering it is possible that the + * AP's beacon is not known for the mac80211 stack. + * Disable filtering temporary to make sure the stack + * receives at least one + */ + wfx_filter_beacon(wvif, false); + } + wfx_tx_unlock(wvif->wdev); +} + static void wfx_join_finalize(struct wfx_vif *wvif, struct ieee80211_bss_conf *info) { @@ -514,7 +514,7 @@ int wfx_join_ibss(struct ieee80211_hw *hw, struct ieee80211_vif *vif) struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; wfx_upload_ap_templates(wvif); - wfx_do_join(wvif); + wfx_join(wvif); return 0; } @@ -551,7 +551,7 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, changed & BSS_CHANGED_BEACON_INT || changed & BSS_CHANGED_BSSID) { if (vif->type == NL80211_IFTYPE_STATION) - wfx_do_join(wvif); + wfx_join(wvif); } if (changed & BSS_CHANGED_ASSOC) { -- cgit v1.2.3 From 2a8f72648975c158b4bb55079e569752352ab19e Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Mon, 7 Sep 2020 12:14:53 +0200 Subject: staging: wfx: simplify hif_set_association_mode() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The file hif_tx_mib.c expects to contain functions that format messages for the hardware. It is unexpected to find function that manipulate RCU and structures from mac80211. Keep hif_set_association_mode() with the code necessary for message formatting and relocate the smart part in wfx_join_finalize(). Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20200907101521.66082-4-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/hif_tx_mib.c | 21 +++++---------------- drivers/staging/wfx/hif_tx_mib.h | 4 ++-- drivers/staging/wfx/sta.c | 17 ++++++++++++++++- 3 files changed, 23 insertions(+), 19 deletions(-) (limited to 'drivers/staging/wfx/sta.c') diff --git a/drivers/staging/wfx/hif_tx_mib.c b/drivers/staging/wfx/hif_tx_mib.c index 05f1e1e98af9..3b20b7486f08 100644 --- a/drivers/staging/wfx/hif_tx_mib.c +++ b/drivers/staging/wfx/hif_tx_mib.c @@ -187,29 +187,18 @@ int hif_set_block_ack_policy(struct wfx_vif *wvif, &val, sizeof(val)); } -int hif_set_association_mode(struct wfx_vif *wvif, - struct ieee80211_bss_conf *info) +int hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density, + bool greenfield, bool short_preamble) { - struct ieee80211_sta *sta = NULL; struct hif_mib_set_association_mode val = { .preambtype_use = 1, .mode = 1, .spacing = 1, - .short_preamble = info->use_short_preamble, + .short_preamble = short_preamble, + .greenfield = greenfield, + .mpdu_start_spacing = ampdu_density, }; - rcu_read_lock(); // protect sta - if (info->bssid && !info->ibss_joined) - sta = ieee80211_find_sta(wvif->vif, info->bssid); - - // FIXME: it is strange to not retrieve all information from bss_info - if (sta && sta->ht_cap.ht_supported) { - val.mpdu_start_spacing = sta->ht_cap.ampdu_density; - if (!(info->ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT)) - val.greenfield = !!(sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD); - } - rcu_read_unlock(); - return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_SET_ASSOCIATION_MODE, &val, sizeof(val)); } diff --git a/drivers/staging/wfx/hif_tx_mib.h b/drivers/staging/wfx/hif_tx_mib.h index 86683de7de7c..1a6f4221bdeb 100644 --- a/drivers/staging/wfx/hif_tx_mib.h +++ b/drivers/staging/wfx/hif_tx_mib.h @@ -33,8 +33,8 @@ int hif_set_template_frame(struct wfx_vif *wvif, struct sk_buff *skb, int hif_set_mfp(struct wfx_vif *wvif, bool capable, bool required); int hif_set_block_ack_policy(struct wfx_vif *wvif, u8 tx_tid_policy, u8 rx_tid_policy); -int hif_set_association_mode(struct wfx_vif *wvif, - struct ieee80211_bss_conf *info); +int hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density, + bool greenfield, bool short_preamble); int hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, int policy_index, u8 *rates); int hif_set_mac_addr_condition(struct wfx_vif *wvif, diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index b2a29b2ac20c..feebb7c3bdfe 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -499,8 +499,23 @@ static void wfx_join(struct wfx_vif *wvif) static void wfx_join_finalize(struct wfx_vif *wvif, struct ieee80211_bss_conf *info) { + struct ieee80211_sta *sta = NULL; + int ampdu_density = 0; + bool greenfield = false; + + rcu_read_lock(); // protect sta + if (info->bssid && !info->ibss_joined) + sta = ieee80211_find_sta(wvif->vif, info->bssid); + if (sta && sta->ht_cap.ht_supported) + ampdu_density = sta->ht_cap.ampdu_density; + if (sta && sta->ht_cap.ht_supported && + !(info->ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT)) + greenfield = !!(sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD); + rcu_read_unlock(); + wvif->join_in_progress = false; - hif_set_association_mode(wvif, info); + hif_set_association_mode(wvif, ampdu_density, greenfield, + info->use_short_preamble); hif_keep_alive_period(wvif, 0); // beacon_loss_count is defined to 7 in net/mac80211/mlme.c. Let's use // the same value. -- cgit v1.2.3 From 99cd05d6a09a91b90d0845299f3cb765dbb9ae91 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Mon, 7 Sep 2020 12:14:56 +0200 Subject: staging: wfx: drop multicast filtering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The device allows to filter multicast frames. The driver has the necessary code to take advantage of this feature. However, some bugs has been reported on this feature. So, it was temporary disabled. Finally, the things work well as-is for more than one year now. So there is no plan to enable this feature in near future. Since we dislike to maintain dead code, drop it. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20200907101521.66082-7-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/hif_api_mib.h | 36 ------------------------ drivers/staging/wfx/hif_tx_mib.c | 40 -------------------------- drivers/staging/wfx/hif_tx_mib.h | 6 ---- drivers/staging/wfx/main.c | 1 - drivers/staging/wfx/sta.c | 59 ++------------------------------------- drivers/staging/wfx/sta.h | 2 -- drivers/staging/wfx/wfx.h | 3 -- 7 files changed, 2 insertions(+), 145 deletions(-) (limited to 'drivers/staging/wfx/sta.c') diff --git a/drivers/staging/wfx/hif_api_mib.h b/drivers/staging/wfx/hif_api_mib.h index 6f1434795fa8..d0e0a9e29afa 100644 --- a/drivers/staging/wfx/hif_api_mib.h +++ b/drivers/staging/wfx/hif_api_mib.h @@ -82,42 +82,6 @@ struct hif_mib_gl_set_multi_msg { u8 reserved2[3]; } __packed; -enum hif_mac_addr_type { - HIF_MAC_ADDR_A1 = 0x0, - HIF_MAC_ADDR_A2 = 0x1, - HIF_MAC_ADDR_A3 = 0x2 -}; - -struct hif_mib_mac_addr_data_frame_condition { - u8 condition_idx; - u8 address_type; - u8 mac_address[ETH_ALEN]; -} __packed; - -#define HIF_FILTER_UNICAST 0x1 -#define HIF_FILTER_MULTICAST 0x2 -#define HIF_FILTER_BROADCAST 0x4 - -struct hif_mib_uc_mc_bc_data_frame_condition { - u8 condition_idx; - u8 allowed_frames; - u8 reserved[2]; -} __packed; - -struct hif_mib_config_data_filter { - u8 filter_idx; - u8 enable; - u8 reserved1[2]; - u8 eth_type_cond; - u8 port_cond; - u8 magic_cond; - u8 mac_cond; - u8 ipv4_cond; - u8 ipv6_cond; - u8 uc_mc_bc_cond; - u8 reserved2; -} __packed; - struct hif_mib_set_data_filtering { u8 invert_matching:1; u8 reserved1:7; diff --git a/drivers/staging/wfx/hif_tx_mib.c b/drivers/staging/wfx/hif_tx_mib.c index 3b20b7486f08..7f24e9f77c22 100644 --- a/drivers/staging/wfx/hif_tx_mib.c +++ b/drivers/staging/wfx/hif_tx_mib.c @@ -228,46 +228,6 @@ int hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, return ret; } -int hif_set_mac_addr_condition(struct wfx_vif *wvif, - int idx, const u8 *mac_addr) -{ - struct hif_mib_mac_addr_data_frame_condition val = { - .condition_idx = idx, - .address_type = HIF_MAC_ADDR_A1, - }; - - ether_addr_copy(val.mac_address, mac_addr); - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_MAC_ADDR_DATAFRAME_CONDITION, - &val, sizeof(val)); -} - -int hif_set_uc_mc_bc_condition(struct wfx_vif *wvif, int idx, u8 allowed_frames) -{ - struct hif_mib_uc_mc_bc_data_frame_condition val = { - .condition_idx = idx, - .allowed_frames = allowed_frames, - }; - - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_UC_MC_BC_DATAFRAME_CONDITION, - &val, sizeof(val)); -} - -int hif_set_config_data_filter(struct wfx_vif *wvif, bool enable, int idx, - int mac_filters, int frames_types_filters) -{ - struct hif_mib_config_data_filter val = { - .enable = enable, - .filter_idx = idx, - .mac_cond = mac_filters, - .uc_mc_bc_cond = frames_types_filters, - }; - - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_CONFIG_DATA_FILTER, &val, sizeof(val)); -} - int hif_set_data_filtering(struct wfx_vif *wvif, bool enable, bool invert) { struct hif_mib_set_data_filtering val = { diff --git a/drivers/staging/wfx/hif_tx_mib.h b/drivers/staging/wfx/hif_tx_mib.h index 1a6f4221bdeb..d4cac63164ba 100644 --- a/drivers/staging/wfx/hif_tx_mib.h +++ b/drivers/staging/wfx/hif_tx_mib.h @@ -37,12 +37,6 @@ int hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density, bool greenfield, bool short_preamble); int hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, int policy_index, u8 *rates); -int hif_set_mac_addr_condition(struct wfx_vif *wvif, - int idx, const u8 *mac_addr); -int hif_set_uc_mc_bc_condition(struct wfx_vif *wvif, - int idx, u8 allowed_frames); -int hif_set_config_data_filter(struct wfx_vif *wvif, bool enable, int idx, - int mac_filters, int frames_types_filters); int hif_set_data_filtering(struct wfx_vif *wvif, bool enable, bool invert); int hif_keep_alive_period(struct wfx_vif *wvif, int period); int hif_set_arp_ipv4_filter(struct wfx_vif *wvif, int idx, __be32 *addr); diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index 2af4914e905c..1017a2290f08 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -142,7 +142,6 @@ static const struct ieee80211_ops wfx_ops = { .set_rts_threshold = wfx_set_rts_threshold, .set_default_unicast_key = wfx_set_default_unicast_key, .bss_info_changed = wfx_bss_info_changed, - .prepare_multicast = wfx_prepare_multicast, .configure_filter = wfx_configure_filter, .ampdu_action = wfx_ampdu_action, .flush = wfx_flush, diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index feebb7c3bdfe..8700d2fc6a77 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -91,59 +91,12 @@ static void wfx_filter_beacon(struct wfx_vif *wvif, bool filter_beacon) } } -static void wfx_filter_mcast(struct wfx_vif *wvif, bool filter_mcast) -{ - int i; - - // Temporary workaround for filters - hif_set_data_filtering(wvif, false, true); - return; - - if (!filter_mcast) { - hif_set_data_filtering(wvif, false, true); - return; - } - for (i = 0; i < wvif->filter_mcast_count; i++) - hif_set_mac_addr_condition(wvif, i, wvif->filter_mcast_addr[i]); - hif_set_uc_mc_bc_condition(wvif, 0, - HIF_FILTER_UNICAST | HIF_FILTER_BROADCAST); - hif_set_config_data_filter(wvif, true, 0, BIT(1), - BIT(wvif->filter_mcast_count) - 1); - hif_set_data_filtering(wvif, true, true); -} - -u64 wfx_prepare_multicast(struct ieee80211_hw *hw, - struct netdev_hw_addr_list *mc_list) -{ - int i; - struct netdev_hw_addr *ha; - struct wfx_vif *wvif = NULL; - struct wfx_dev *wdev = hw->priv; - int count = netdev_hw_addr_list_count(mc_list); - - while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { - if (count > ARRAY_SIZE(wvif->filter_mcast_addr)) { - wvif->filter_mcast_count = 0; - continue; - } - wvif->filter_mcast_count = count; - - i = 0; - netdev_hw_addr_list_for_each(ha, mc_list) { - ether_addr_copy(wvif->filter_mcast_addr[i], ha->addr); - i++; - } - } - - return 0; -} - void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, unsigned int *total_flags, u64 unused) { struct wfx_vif *wvif = NULL; struct wfx_dev *wdev = hw->priv; - bool filter_bssid, filter_prbreq, filter_beacon, filter_mcast; + bool filter_bssid, filter_prbreq, filter_beacon; // Notes: // - Probe responses (FIF_BCN_PRBRESP_PROMISC) are never filtered @@ -167,15 +120,7 @@ void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, filter_beacon = true; wfx_filter_beacon(wvif, filter_beacon); - if (*total_flags & FIF_ALLMULTI) { - filter_mcast = false; - } else if (!wvif->filter_mcast_count) { - dev_dbg(wdev->dev, "disabling unconfigured multicast filter"); - filter_mcast = false; - } else { - filter_mcast = true; - } - wfx_filter_mcast(wvif, filter_mcast); + hif_set_data_filtering(wvif, false, true); if (*total_flags & FIF_OTHER_BSS) filter_bssid = false; diff --git a/drivers/staging/wfx/sta.h b/drivers/staging/wfx/sta.h index 6b15a64ac9e2..610cfb0fcd02 100644 --- a/drivers/staging/wfx/sta.h +++ b/drivers/staging/wfx/sta.h @@ -25,8 +25,6 @@ int wfx_config(struct ieee80211_hw *hw, u32 changed); 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, - struct netdev_hw_addr_list *mc_list); void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, unsigned int *total_flags, u64 unused); diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h index 241eaaf71f5e..56fbfab05651 100644 --- a/drivers/staging/wfx/wfx.h +++ b/drivers/staging/wfx/wfx.h @@ -79,9 +79,6 @@ struct wfx_vif { struct work_struct update_tim_work; - int filter_mcast_count; - u8 filter_mcast_addr[8][ETH_ALEN]; - unsigned long uapsd_mask; /* avoid some operations in parallel with scan */ -- cgit v1.2.3 From 135baf19e56d3df560052036f642863858059112 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Mon, 7 Sep 2020 12:14:57 +0200 Subject: staging: wfx: drop useless function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the code for multicast filtering has been dropped, the function hif_set_data_filtering() is only called to disable multicast filtering. In fact, the multicast filtering is already disabled by default. So, this function is useless and can be dropped. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20200907101521.66082-8-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/hif_api_mib.h | 8 -------- drivers/staging/wfx/hif_tx_mib.c | 11 ----------- drivers/staging/wfx/hif_tx_mib.h | 1 - drivers/staging/wfx/sta.c | 2 -- 4 files changed, 22 deletions(-) (limited to 'drivers/staging/wfx/sta.c') diff --git a/drivers/staging/wfx/hif_api_mib.h b/drivers/staging/wfx/hif_api_mib.h index d0e0a9e29afa..73873d29456d 100644 --- a/drivers/staging/wfx/hif_api_mib.h +++ b/drivers/staging/wfx/hif_api_mib.h @@ -82,14 +82,6 @@ struct hif_mib_gl_set_multi_msg { u8 reserved2[3]; } __packed; -struct hif_mib_set_data_filtering { - u8 invert_matching:1; - u8 reserved1:7; - u8 enable:1; - u8 reserved2:7; - u8 reserved3[2]; -} __packed; - enum hif_arp_ns_frame_treatment { HIF_ARP_NS_FILTERING_DISABLE = 0x0, HIF_ARP_NS_FILTERING_ENABLE = 0x1, diff --git a/drivers/staging/wfx/hif_tx_mib.c b/drivers/staging/wfx/hif_tx_mib.c index 7f24e9f77c22..2eb2a20890c7 100644 --- a/drivers/staging/wfx/hif_tx_mib.c +++ b/drivers/staging/wfx/hif_tx_mib.c @@ -228,17 +228,6 @@ int hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, return ret; } -int hif_set_data_filtering(struct wfx_vif *wvif, bool enable, bool invert) -{ - struct hif_mib_set_data_filtering val = { - .enable = enable, - .invert_matching = invert, - }; - - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_SET_DATA_FILTERING, &val, sizeof(val)); -} - int hif_keep_alive_period(struct wfx_vif *wvif, int period) { struct hif_mib_keep_alive_period arg = { diff --git a/drivers/staging/wfx/hif_tx_mib.h b/drivers/staging/wfx/hif_tx_mib.h index d4cac63164ba..6c25015173cd 100644 --- a/drivers/staging/wfx/hif_tx_mib.h +++ b/drivers/staging/wfx/hif_tx_mib.h @@ -37,7 +37,6 @@ int hif_set_association_mode(struct wfx_vif *wvif, int ampdu_density, bool greenfield, bool short_preamble); int hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, int policy_index, u8 *rates); -int hif_set_data_filtering(struct wfx_vif *wvif, bool enable, bool invert); int hif_keep_alive_period(struct wfx_vif *wvif, int period); int hif_set_arp_ipv4_filter(struct wfx_vif *wvif, int idx, __be32 *addr); int hif_use_multi_tx_conf(struct wfx_dev *wdev, bool enable); diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 8700d2fc6a77..0d27ca27e48c 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -120,8 +120,6 @@ void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, filter_beacon = true; wfx_filter_beacon(wvif, filter_beacon); - hif_set_data_filtering(wvif, false, true); - if (*total_flags & FIF_OTHER_BSS) filter_bssid = false; else -- cgit v1.2.3 From f9dc9f3750e1e2bd0358122542c7cc08679a7236 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Wed, 7 Oct 2020 12:19:41 +0200 Subject: staging: wfx: update copyrights dates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Most of the files have been modified in 2020, so update the copyright notices. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20201007101943.749898-6-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/bh.c | 2 +- drivers/staging/wfx/bh.h | 2 +- drivers/staging/wfx/bus.h | 2 +- drivers/staging/wfx/bus_sdio.c | 2 +- drivers/staging/wfx/bus_spi.c | 2 +- drivers/staging/wfx/data_rx.c | 2 +- drivers/staging/wfx/data_rx.h | 2 +- drivers/staging/wfx/data_tx.c | 2 +- drivers/staging/wfx/data_tx.h | 2 +- drivers/staging/wfx/debug.c | 2 +- drivers/staging/wfx/fwio.c | 2 +- drivers/staging/wfx/hif_api_cmd.h | 2 +- drivers/staging/wfx/hif_api_general.h | 2 +- drivers/staging/wfx/hif_api_mib.h | 2 +- drivers/staging/wfx/hif_rx.c | 2 +- drivers/staging/wfx/hif_tx.c | 2 +- drivers/staging/wfx/hif_tx.h | 2 +- drivers/staging/wfx/hif_tx_mib.c | 2 +- drivers/staging/wfx/hif_tx_mib.h | 2 +- drivers/staging/wfx/hwio.c | 2 +- drivers/staging/wfx/hwio.h | 2 +- drivers/staging/wfx/key.c | 2 +- drivers/staging/wfx/key.h | 2 +- drivers/staging/wfx/main.c | 2 +- drivers/staging/wfx/main.h | 2 +- drivers/staging/wfx/queue.c | 2 +- drivers/staging/wfx/queue.h | 2 +- drivers/staging/wfx/scan.c | 2 +- drivers/staging/wfx/scan.h | 2 +- drivers/staging/wfx/sta.c | 2 +- drivers/staging/wfx/sta.h | 2 +- drivers/staging/wfx/traces.h | 2 +- drivers/staging/wfx/wfx.h | 2 +- 33 files changed, 33 insertions(+), 33 deletions(-) (limited to 'drivers/staging/wfx/sta.c') diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c index 72da2f4af49f..586b769c0446 100644 --- a/drivers/staging/wfx/bh.c +++ b/drivers/staging/wfx/bh.c @@ -2,7 +2,7 @@ /* * Interrupt bottom half (BH). * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson */ #include diff --git a/drivers/staging/wfx/bh.h b/drivers/staging/wfx/bh.h index 4b73437869e1..78c49329e22a 100644 --- a/drivers/staging/wfx/bh.h +++ b/drivers/staging/wfx/bh.h @@ -2,7 +2,7 @@ /* * Interrupt bottom half. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson */ #ifndef WFX_BH_H diff --git a/drivers/staging/wfx/bus.h b/drivers/staging/wfx/bus.h index 0370b6c59863..ca04b3da6204 100644 --- a/drivers/staging/wfx/bus.h +++ b/drivers/staging/wfx/bus.h @@ -2,7 +2,7 @@ /* * Common bus abstraction layer. * - * Copyright (c) 2017-2018, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson */ #ifndef WFX_BUS_H diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c index 496bfc8bbacc..e06d7e1ebe9c 100644 --- a/drivers/staging/wfx/bus_sdio.c +++ b/drivers/staging/wfx/bus_sdio.c @@ -2,7 +2,7 @@ /* * SDIO interface. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson */ #include diff --git a/drivers/staging/wfx/bus_spi.c b/drivers/staging/wfx/bus_spi.c index d19c0478e8be..a99125d1a30d 100644 --- a/drivers/staging/wfx/bus_spi.c +++ b/drivers/staging/wfx/bus_spi.c @@ -2,7 +2,7 @@ /* * SPI interface. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2011, Sagrad Inc. * Copyright (c) 2010, ST-Ericsson */ diff --git a/drivers/staging/wfx/data_rx.c b/drivers/staging/wfx/data_rx.c index 3822a22b9fe3..385f2d42a0e2 100644 --- a/drivers/staging/wfx/data_rx.c +++ b/drivers/staging/wfx/data_rx.c @@ -2,7 +2,7 @@ /* * Datapath implementation. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson */ #include diff --git a/drivers/staging/wfx/data_rx.h b/drivers/staging/wfx/data_rx.h index 125dbfc1f875..4c0da37f2084 100644 --- a/drivers/staging/wfx/data_rx.h +++ b/drivers/staging/wfx/data_rx.h @@ -2,7 +2,7 @@ /* * Datapath implementation. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson */ #ifndef WFX_DATA_RX_H diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index e2fb770e98fc..b4d5dd3d2d23 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -2,7 +2,7 @@ /* * Datapath implementation. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson */ #include diff --git a/drivers/staging/wfx/data_tx.h b/drivers/staging/wfx/data_tx.h index 87e1b9b62dbb..46c9fff7a870 100644 --- a/drivers/staging/wfx/data_tx.h +++ b/drivers/staging/wfx/data_tx.h @@ -2,7 +2,7 @@ /* * Datapath implementation. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson */ #ifndef WFX_DATA_TX_H diff --git a/drivers/staging/wfx/debug.c b/drivers/staging/wfx/debug.c index 4bd5f9fa21a1..eedada78c25f 100644 --- a/drivers/staging/wfx/debug.c +++ b/drivers/staging/wfx/debug.c @@ -2,7 +2,7 @@ /* * Debugfs interface. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson */ #include diff --git a/drivers/staging/wfx/fwio.c b/drivers/staging/wfx/fwio.c index c99adb0c99f1..1b8aec02d169 100644 --- a/drivers/staging/wfx/fwio.c +++ b/drivers/staging/wfx/fwio.c @@ -2,7 +2,7 @@ /* * Firmware loading. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson */ #include diff --git a/drivers/staging/wfx/hif_api_cmd.h b/drivers/staging/wfx/hif_api_cmd.h index bdd468800189..11bc1a58edae 100644 --- a/drivers/staging/wfx/hif_api_cmd.h +++ b/drivers/staging/wfx/hif_api_cmd.h @@ -2,7 +2,7 @@ /* * WFx hardware interface definitions * - * Copyright (c) 2018-2019, Silicon Laboratories Inc. + * Copyright (c) 2018-2020, Silicon Laboratories Inc. */ #ifndef WFX_HIF_API_CMD_H diff --git a/drivers/staging/wfx/hif_api_general.h b/drivers/staging/wfx/hif_api_general.h index 9d522bc1aa69..24188945718d 100644 --- a/drivers/staging/wfx/hif_api_general.h +++ b/drivers/staging/wfx/hif_api_general.h @@ -2,7 +2,7 @@ /* * WFx hardware interface definitions * - * Copyright (c) 2018-2019, Silicon Laboratories Inc. + * Copyright (c) 2018-2020, Silicon Laboratories Inc. */ #ifndef WFX_HIF_API_GENERAL_H diff --git a/drivers/staging/wfx/hif_api_mib.h b/drivers/staging/wfx/hif_api_mib.h index 55bd399ccdfb..ace924720ce6 100644 --- a/drivers/staging/wfx/hif_api_mib.h +++ b/drivers/staging/wfx/hif_api_mib.h @@ -2,7 +2,7 @@ /* * WFx hardware interface definitions * - * Copyright (c) 2018-2019, Silicon Laboratories Inc. + * Copyright (c) 2018-2020, Silicon Laboratories Inc. */ #ifndef WFX_HIF_API_MIB_H diff --git a/drivers/staging/wfx/hif_rx.c b/drivers/staging/wfx/hif_rx.c index b40af86356f1..d6dfab094b03 100644 --- a/drivers/staging/wfx/hif_rx.c +++ b/drivers/staging/wfx/hif_rx.c @@ -3,7 +3,7 @@ * Implementation of chip-to-host event (aka indications) of WFxxx Split Mac * (WSM) API. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson */ #include diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index 1bd7f773209c..e61cc2486761 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -3,7 +3,7 @@ * Implementation of host-to-chip commands (aka request/confirmation) of WFxxx * Split Mac (WSM) API. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson */ #include diff --git a/drivers/staging/wfx/hif_tx.h b/drivers/staging/wfx/hif_tx.h index 960d5f2fa41c..3521c545ae6b 100644 --- a/drivers/staging/wfx/hif_tx.h +++ b/drivers/staging/wfx/hif_tx.h @@ -3,7 +3,7 @@ * Implementation of host-to-chip commands (aka request/confirmation) of WFxxx * Split Mac (WSM) API. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson * Copyright (C) 2010, ST-Ericsson SA */ diff --git a/drivers/staging/wfx/hif_tx_mib.c b/drivers/staging/wfx/hif_tx_mib.c index c375b9052a07..1926cf1b62be 100644 --- a/drivers/staging/wfx/hif_tx_mib.c +++ b/drivers/staging/wfx/hif_tx_mib.c @@ -2,7 +2,7 @@ /* * Implementation of host-to-chip MIBs of WFxxx Split Mac (WSM) API. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson * Copyright (C) 2010, ST-Ericsson SA */ diff --git a/drivers/staging/wfx/hif_tx_mib.h b/drivers/staging/wfx/hif_tx_mib.h index 6c25015173cd..812b3ba0f00e 100644 --- a/drivers/staging/wfx/hif_tx_mib.h +++ b/drivers/staging/wfx/hif_tx_mib.h @@ -2,7 +2,7 @@ /* * Implementation of host-to-chip MIBs of WFxxx Split Mac (WSM) API. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson * Copyright (C) 2010, ST-Ericsson SA */ diff --git a/drivers/staging/wfx/hwio.c b/drivers/staging/wfx/hwio.c index 777217cdf9a7..36fbc5b5d64c 100644 --- a/drivers/staging/wfx/hwio.c +++ b/drivers/staging/wfx/hwio.c @@ -2,7 +2,7 @@ /* * Low-level I/O functions. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson */ #include diff --git a/drivers/staging/wfx/hwio.h b/drivers/staging/wfx/hwio.h index 4b6ef061b40b..0b8e4f7157df 100644 --- a/drivers/staging/wfx/hwio.h +++ b/drivers/staging/wfx/hwio.h @@ -2,7 +2,7 @@ /* * Low-level API. * - * Copyright (c) 2017-2018, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson */ #ifndef WFX_HWIO_H diff --git a/drivers/staging/wfx/key.c b/drivers/staging/wfx/key.c index 728e5f8d3b7c..2ab82bed4c1b 100644 --- a/drivers/staging/wfx/key.c +++ b/drivers/staging/wfx/key.c @@ -2,7 +2,7 @@ /* * Key management related functions. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson */ #include diff --git a/drivers/staging/wfx/key.h b/drivers/staging/wfx/key.h index ff31fc9c565a..70a44d0ca35e 100644 --- a/drivers/staging/wfx/key.h +++ b/drivers/staging/wfx/key.h @@ -2,7 +2,7 @@ /* * Implementation of mac80211 API. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson */ #ifndef WFX_KEY_H diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index 2a9098bad1f5..df11c091e094 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -2,7 +2,7 @@ /* * Device probe and register. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson * Copyright (c) 2008, Johannes Berg * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). diff --git a/drivers/staging/wfx/main.h b/drivers/staging/wfx/main.h index 2457cb595b0f..a0db322383a3 100644 --- a/drivers/staging/wfx/main.h +++ b/drivers/staging/wfx/main.h @@ -2,7 +2,7 @@ /* * Device probe and register. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson * Copyright (c) 2006, Michael Wu * Copyright 2004-2006 Jean-Baptiste Note , et al. diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c index 55b801a02959..31c37f69c295 100644 --- a/drivers/staging/wfx/queue.c +++ b/drivers/staging/wfx/queue.c @@ -2,7 +2,7 @@ /* * O(1) TX queue with built-in allocator. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson */ #include diff --git a/drivers/staging/wfx/queue.h b/drivers/staging/wfx/queue.h index 2695c10d6a22..80ba19455ef3 100644 --- a/drivers/staging/wfx/queue.h +++ b/drivers/staging/wfx/queue.h @@ -2,7 +2,7 @@ /* * O(1) TX queue with built-in allocator. * - * Copyright (c) 2017-2018, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson */ #ifndef WFX_QUEUE_H diff --git a/drivers/staging/wfx/scan.c b/drivers/staging/wfx/scan.c index 02d4e653d594..fb47c7cddf2f 100644 --- a/drivers/staging/wfx/scan.c +++ b/drivers/staging/wfx/scan.c @@ -2,7 +2,7 @@ /* * Scan related functions. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson */ #include diff --git a/drivers/staging/wfx/scan.h b/drivers/staging/wfx/scan.h index 2eb786c9572c..c7496a766478 100644 --- a/drivers/staging/wfx/scan.h +++ b/drivers/staging/wfx/scan.h @@ -2,7 +2,7 @@ /* * Scan related functions. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson */ #ifndef WFX_SCAN_H diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 0d27ca27e48c..a246f0d1d6e9 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -2,7 +2,7 @@ /* * Implementation of mac80211 API. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson */ #include diff --git a/drivers/staging/wfx/sta.h b/drivers/staging/wfx/sta.h index 610cfb0fcd02..d7b5df5ea4e6 100644 --- a/drivers/staging/wfx/sta.h +++ b/drivers/staging/wfx/sta.h @@ -2,7 +2,7 @@ /* * Implementation of mac80211 API. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson */ #ifndef WFX_STA_H diff --git a/drivers/staging/wfx/traces.h b/drivers/staging/wfx/traces.h index d376db2f1891..e34c7a538c65 100644 --- a/drivers/staging/wfx/traces.h +++ b/drivers/staging/wfx/traces.h @@ -2,7 +2,7 @@ /* * Tracepoints definitions. * - * Copyright (c) 2018-2019, Silicon Laboratories, Inc. + * Copyright (c) 2018-2020, Silicon Laboratories, Inc. */ #undef TRACE_SYSTEM diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h index 56fbfab05651..94898680ccde 100644 --- a/drivers/staging/wfx/wfx.h +++ b/drivers/staging/wfx/wfx.h @@ -2,7 +2,7 @@ /* * Common private data for Silicon Labs WFx chips. * - * Copyright (c) 2017-2019, Silicon Laboratories, Inc. + * Copyright (c) 2017-2020, Silicon Laboratories, Inc. * Copyright (c) 2010, ST-Ericsson * Copyright (c) 2006, Michael Wu * Copyright 2004-2006 Jean-Baptiste Note , et al. -- cgit v1.2.3 From bb97bc286171f58f3286c2d1da876c7a62708ea6 Mon Sep 17 00:00:00 2001 From: Jérôme Pouiller Date: Fri, 9 Oct 2020 19:13:02 +0200 Subject: staging: wfx: standardize the error when vif does not exist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Smatch complains: drivers/staging/wfx/hif_rx.c:177 hif_scan_complete_indication() warn: potential NULL parameter dereference 'wvif' drivers/staging/wfx/data_tx.c:576 wfx_flush() warn: potential NULL parameter dereference 'wvif' Indeed, if the vif id returned by the device does not exist anymore, wdev_to_wvif() could return NULL. In add, the error is not handled uniformly in the code, sometime a WARN() is displayed but code continue, sometime a dev_warn() is displayed, sometime it is just not tested, ... This patch standardize that. Reported-by: Dan Carpenter Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20201009171307.864608-4-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/data_tx.c | 5 ++++- drivers/staging/wfx/hif_rx.c | 34 ++++++++++++++++++++++++---------- drivers/staging/wfx/sta.c | 4 ++++ 3 files changed, 32 insertions(+), 11 deletions(-) (limited to 'drivers/staging/wfx/sta.c') diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index b4d5dd3d2d23..8db0be08daf8 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -431,7 +431,10 @@ static void wfx_skb_dtor(struct wfx_vif *wvif, struct sk_buff *skb) sizeof(struct hif_req_tx) + req->fc_offset; - WARN_ON(!wvif); + if (!wvif) { + pr_warn("%s: vif associated with the skb does not exist anymore\n", __func__); + return; + } wfx_tx_policy_put(wvif, req->retry_policy_index); skb_pull(skb, offset); ieee80211_tx_status_irqsafe(wvif->wdev->hw, skb); diff --git a/drivers/staging/wfx/hif_rx.c b/drivers/staging/wfx/hif_rx.c index d6dfab094b03..ca09467cba05 100644 --- a/drivers/staging/wfx/hif_rx.c +++ b/drivers/staging/wfx/hif_rx.c @@ -110,9 +110,9 @@ static int hif_receive_indication(struct wfx_dev *wdev, const struct hif_ind_rx *body = buf; if (!wvif) { - dev_warn(wdev->dev, "ignore rx data for non-existent vif %d\n", - hif->interface); - return 0; + dev_warn(wdev->dev, "%s: ignore rx data for non-existent vif %d\n", + __func__, hif->interface); + return -EIO; } skb_pull(skb, sizeof(struct hif_msg) + sizeof(struct hif_ind_rx)); wfx_rx_cb(wvif, body, skb); @@ -128,8 +128,8 @@ static int hif_event_indication(struct wfx_dev *wdev, int type = le32_to_cpu(body->event_id); if (!wvif) { - dev_warn(wdev->dev, "received event for non-existent vif\n"); - return 0; + dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); + return -EIO; } switch (type) { @@ -161,7 +161,10 @@ static int hif_pm_mode_complete_indication(struct wfx_dev *wdev, { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); - WARN_ON(!wvif); + if (!wvif) { + dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); + return -EIO; + } complete(&wvif->set_pm_mode_complete); return 0; @@ -173,7 +176,11 @@ static int hif_scan_complete_indication(struct wfx_dev *wdev, { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); - WARN_ON(!wvif); + if (!wvif) { + dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); + return -EIO; + } + wfx_scan_complete(wvif); return 0; @@ -185,7 +192,10 @@ static int hif_join_complete_indication(struct wfx_dev *wdev, { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); - WARN_ON(!wvif); + if (!wvif) { + dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); + return -EIO; + } dev_warn(wdev->dev, "unattended JoinCompleteInd\n"); return 0; @@ -195,11 +205,15 @@ static int hif_suspend_resume_indication(struct wfx_dev *wdev, const struct hif_msg *hif, const void *buf) { - struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); const struct hif_ind_suspend_resume_tx *body = buf; + struct wfx_vif *wvif; if (body->bc_mc_only) { - WARN_ON(!wvif); + wvif = wdev_to_wvif(wdev, hif->interface); + if (!wvif) { + dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); + return -EIO; + } if (body->resume) wfx_suspend_resume_mc(wvif, STA_NOTIFY_AWAKE); else diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index a246f0d1d6e9..2320a81eae0b 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -619,6 +619,10 @@ int wfx_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, bool set) struct wfx_sta_priv *sta_dev = (struct wfx_sta_priv *)&sta->drv_priv; struct wfx_vif *wvif = wdev_to_wvif(wdev, sta_dev->vif_id); + if (!wvif) { + dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); + return -EIO; + } schedule_work(&wvif->update_tim_work); return 0; } -- cgit v1.2.3