wil6210 patches
cover wil6210 patches
The following set of patches include:
- support up to 20 stations in AP mode
- add support for ucode tracing
- various wil6210 fixes
Ahmad Masri (6):
wil6210: support up to 20 stations in AP mode
wil6210: accessing 802.3 addresses via utility functions
wil6210: prevent device memory access while in reset or suspend
wil6210: check mid is valid
wil6210: fix report of rx packet checksum in edma mode
wil6210: add support for ucode tracing
Alexei Avshalom Lazar (2):
wil6210: check null pointer in _wil_cfg80211_merge_extra_ies
wil6210: align to latest auto generated wmi.h
Dedy Lansky (4):
wil6210: add option to drop Tx packets when Tx ring is full
wil6210: fix invalid sta statistics update
wil6210: use OEM MAC address from OTP
wil6210: free edma_rx_swtail upon reset
Lior David (1):
wil6210: fix return code of wmi_mgmt_tx and wmi_mgmt_tx_ext
Maya Erez (8):
wil6210: remove rtap_include_phy_info module param
wil6210: ignore HALP ICR if already handled
wil6210: increase PCP stop command timeout
wil6210: do not set BIT_USER_SUPPORT_T_POWER_ON_0 in Talyn-MB
wil6210: update WIL_MCS_MAX to 15
wil6210: prevent access to RGF_CAF_ICR in Talyn
wil6210: reset buff id in status message after completion
wil6210: print error in FW and board files load failures
drivers/net/wireless/ath/wil6210/cfg80211.c | 31 ++- drivers/net/wireless/ath/wil6210/debugfs.c | 61 ++++-- drivers/net/wireless/ath/wil6210/fw_inc.c | 6 +- drivers/net/wireless/ath/wil6210/interrupt.c | 12 +- drivers/net/wireless/ath/wil6210/main.c | 91 +++++--- drivers/net/wireless/ath/wil6210/netdev.c | 10 +- drivers/net/wireless/ath/wil6210/pcie_bus.c | 4 +- drivers/net/wireless/ath/wil6210/pm.c | 35 +-- drivers/net/wireless/ath/wil6210/rx_reorder.c | 10 +- drivers/net/wireless/ath/wil6210/trace.h | 3 +- drivers/net/wireless/ath/wil6210/txrx.c | 254 ++++++++++++---------- drivers/net/wireless/ath/wil6210/txrx.h | 51 ++++- drivers/net/wireless/ath/wil6210/txrx_edma.c | 85 ++++---- drivers/net/wireless/ath/wil6210/txrx_edma.h | 47 +++- drivers/net/wireless/ath/wil6210/wil6210.h | 27 ++- drivers/net/wireless/ath/wil6210/wil_crash_dump.c | 18 +- drivers/net/wireless/ath/wil6210/wmi.c | 107 ++++++--- drivers/net/wireless/ath/wil6210/wmi.h | 91 +++++++- 18 files changed, 641 insertions(+), 302 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/21 wil6210: remove rtap_include_phy_info module param
Due to a HW issue in PHY info collection rtap_include_phy_info is not in use, hence can be removed.
--- drivers/net/wireless/ath/wil6210/txrx.c | 88 ++++++--------------------------- drivers/net/wireless/ath/wil6210/txrx.h | 7 +-- drivers/net/wireless/ath/wil6210/wmi.c | 4 +- 3 files changed, 18 insertions(+), 81 deletions(-)
drivers/net/wireless/ath/wil6210/txrx.c +15 -73
@@ -1,6 +1,6 @@/* * Copyright (c) 2012-2017 Qualcomm Atheros, Inc. -* Copyright (c) 2018, The Linux Foundation. All rights reserved. +* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above
@@ -30,11 +30,6 @@#include "trace.h" #include "txrx_edma.h" -static bool rtap_include_phy_info; -module_param (rtap_include_phy_info, bool,0444 ); -MODULE_PARM_DESC (rtap_include_phy_info, -" Include PHY info in the radiotap header, default - no" ); -bool rx_align_2;module_param (rx_align_2, bool,0444 );MODULE_PARM_DESC (rx_align_2," align Rx buffers on 4*n+2, default - no" );
@@ -332,87 +327,34 @@ static void wil_rx_add_radiotap_header(struct wil6210_priv *wil,u8 mcs_flags;u8 mcs_index; } __packed; -struct wil6210_rtap_vendor { -struct wil6210_rtap rtap; -/* vendor */ -u8 vendor_oui[3 ]__aligned(2) ; -u8 vendor_ns; -__le16 vendor_skip; -u8 vendor_data[0 ]; - } __packed;struct vring_rx_desc *d =wil_skb_rxdesc (skb); -struct wil6210_rtap_vendor *rtap_vendor; +struct wil6210_rtap *rtap;int rtap_len =sizeof (struct wil6210_rtap ); -int phy_length =0 ;/* phy info header size, bytes */ -static char phy_data[128 ];struct ieee80211_channel *ch = wil->monitor_chandef.chan; -if (rtap_include_phy_info) { - rtap_len =sizeof (*rtap_vendor) +sizeof (*d); -/* calculate additional length */ -if (d->dma.status &RX_DMA_STATUS_PHY_INFO ) { -/** -* PHY info starts from 8-byte boundary -* there are 8-byte lines, last line may be partially -* written (HW bug), thus FW configures for last line -* to be excessive. Driver skips this last line. -*/ -int len =min_t (int,8 +sizeof (phy_data), -wil_rxdesc_phy_length (d)); - -if (len >8 ) { -void *p =skb_tail_pointer (skb); -void *pa =PTR_ALIGN (p,8 ); - -if (skb_tailroom (skb) >= len + (pa - p)) { - phy_length = len -8 ; -memcpy (phy_data, pa, phy_length); - } - } - } - rtap_len += phy_length; - } -if (skb_headroom (skb) < rtap_len &&pskb_expand_head (skb, rtap_len,0 ,GFP_ATOMIC )) {wil_err (wil,"Unable to expand headroom to %d\n" , rtap_len);return ; } - rtap_vendor =skb_push (skb, rtap_len); -memset (rtap_vendor,0 , rtap_len); + rtap =skb_push (skb, rtap_len); +memset (rtap,0 , rtap_len); - rtap_vendor->rtap.rthdr.it_version =PKTHDR_RADIOTAP_VERSION ; - rtap_vendor->rtap.rthdr.it_len =cpu_to_le16 (rtap_len); - rtap_vendor->rtap.rthdr.it_present =cpu_to_le32 ( - (1 <<IEEE80211_RADIOTAP_FLAGS ) | + rtap->rthdr.it_version =PKTHDR_RADIOTAP_VERSION ; + rtap->rthdr.it_len =cpu_to_le16 (rtap_len); + rtap->rthdr.it_present =cpu_to_le32 ((1 <<IEEE80211_RADIOTAP_FLAGS ) | (1 <<IEEE80211_RADIOTAP_CHANNEL ) | (1 <<IEEE80211_RADIOTAP_MCS ));if (d->dma.status &RX_DMA_STATUS_ERROR ) - rtap_vendor->rtap.flags |=IEEE80211_RADIOTAP_F_BADFCS ; - - rtap_vendor->rtap.chnl_freq =cpu_to_le16 (ch ? ch->center_freq :58320 ); - rtap_vendor->rtap.chnl_flags =cpu_to_le16 (0 ); - - rtap_vendor->rtap.mcs_present =IEEE80211_RADIOTAP_MCS_HAVE_MCS ; - rtap_vendor->rtap.mcs_flags =0 ; - rtap_vendor->rtap.mcs_index =wil_rxdesc_mcs (d); - -if (rtap_include_phy_info) { - rtap_vendor->rtap.rthdr.it_present |=cpu_to_le32 (1 << -IEEE80211_RADIOTAP_VENDOR_NAMESPACE ); -/* OUI for Wilocity 04:ce:14 */ - rtap_vendor->vendor_oui[0 ] =0x04 ; - rtap_vendor->vendor_oui[1 ] =0xce ; - rtap_vendor->vendor_oui[2 ] =0x14 ; - rtap_vendor->vendor_ns =1 ; -/* Rx descriptor + PHY data */ - rtap_vendor->vendor_skip =cpu_to_le16 (sizeof (*d) + - phy_length); -memcpy (rtap_vendor->vendor_data, (void *)d,sizeof (*d)); -memcpy (rtap_vendor->vendor_data +sizeof (*d), phy_data, - phy_length); - } + rtap->flags |=IEEE80211_RADIOTAP_F_BADFCS ; + + rtap->chnl_freq =cpu_to_le16 (ch ? ch->center_freq :58320 ); + rtap->chnl_flags =cpu_to_le16 (0 ); + + rtap->mcs_present =IEEE80211_RADIOTAP_MCS_HAVE_MCS ; + rtap->mcs_flags =0 ; + rtap->mcs_index =wil_rxdesc_mcs (d); }static bool wil_is_rx_idle (struct wil6210_priv *wil)
drivers/net/wireless/ath/wil6210/txrx.h +1 -6
@@ -1,6 +1,6 @@/* * Copyright (c) 2012-2016 Qualcomm Atheros, Inc. -* Copyright (c) 2018, The Linux Foundation. All rights reserved. +* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above
@@ -530,11 +530,6 @@ static inline int wil_rxdesc_mcast(struct vring_rx_desc *d)return WIL_GET_BITS (d->mac.d1,13 ,14 ); } -static inline int wil_rxdesc_phy_length (struct vring_rx_desc *d) -{ -return WIL_GET_BITS (d->dma.d0,16 ,29 ); -} -static inline struct vring_rx_desc *wil_skb_rxdesc (struct sk_buff *skb) {return (void *)skb->cb;
drivers/net/wireless/ath/wil6210/wmi.c +2 -2
@@ -1,6 +1,6 @@/* * Copyright (c) 2012-2017 Qualcomm Atheros, Inc. -* Copyright (c) 2018, The Linux Foundation. All rights reserved. +* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above
@@ -2516,7 +2516,7 @@ int wmi_rx_chain_add(struct wil6210_priv *wil, struct wil_ring *vring)if (ch) cmd.sniffer_cfg.channel = ch->hw_value -1 ; cmd.sniffer_cfg.phy_info_mode = -cpu_to_le32 (ndev->type ==ARPHRD_IEEE80211_RADIOTAP ); +cpu_to_le32 (WMI_SNIFFER_PHY_INFO_DISABLED ); cmd.sniffer_cfg.phy_support =cpu_to_le32 ((wil->monitor_flags &MONITOR_FLAG_CONTROL ) ?WMI_SNIFFER_CP :WMI_SNIFFER_BOTH_PHYS );
Signature · 1 line
1.9.1
PATCH 2/21 wil6210: add option to drop Tx packets when Tx ring is full
In reply to Maya ErezFrom: Dedy Lansky <[email protected]>
In AP mode with multiple clients, driver stops net queue (netif_tx_stop_queue) upon first ring (serving specific client) becoming full. This can have negative effect on transmission to other clients which may still have room in their corresponding rings.
Implement new policy in which stop/wake net queue are not used. In case there is no room in the ring for a transmitted packet, drop the packet.
New policy can be helpful to debug performance issues, to guarantee maximum utilization of net queues.
New policy is disabled by default and can be enabled by debugfs:
echo 1 > drop_if_ring_full
--- drivers/net/wireless/ath/wil6210/debugfs.c | 3 ++- drivers/net/wireless/ath/wil6210/txrx.c | 9 +++++++++ drivers/net/wireless/ath/wil6210/wil6210.h | 3 ++- 3 files changed, 13 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/wil6210/debugfs.c +2 -1
@@ -1,6 +1,6 @@/* * Copyright (c) 2012-2017 Qualcomm Atheros, Inc. -* Copyright (c) 2018, The Linux Foundation. All rights reserved. +* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above
@@ -2386,6 +2386,7 @@ static void wil6210_debugfs_init_isr(struct wil6210_priv *wil, {"led_polarity", 0644, (ulong)&led_polarity, doff_u8}, {"status_index", 0644, (ulong)&dbg_status_msg_index, doff_u32}, {"sring_index", 0644, (ulong)&dbg_sring_index, doff_u32}, + {"drop_if_ring_full", 0644, (ulong)&drop_if_ring_full, doff_u8}, {}, };
drivers/net/wireless/ath/wil6210/txrx.c +9 -0
@@ -38,6 +38,9 @@module_param (rx_large_buf, bool,0444 );MODULE_PARM_DESC (rx_large_buf," allocate 8KB RX buffers, default - no" ); +/* Drop Tx packets in case Tx ring is full */ +bool drop_if_ring_full; +static inline uint wil_rx_snaplen (void ) {return rx_align_2 ?6 :0 ;
@@ -1974,6 +1977,10 @@ static inline void __wil_update_net_queues(struct wil6210_priv *wil,wil_dbg_txrx (wil,"check_stop=%d, mid=%d, stopped=%d" , check_stop, vif->mid, vif->net_queue_stopped); +if (ring && drop_if_ring_full) +/* no need to stop/wake net queues */ +return ; +if (check_stop == vif->net_queue_stopped)/* net queues already in desired state */ return ;
@@ -2099,6 +2106,8 @@ netdev_tx_t wil_start_xmit(struct sk_buff *skb, struct net_device *ndev)dev_kfree_skb_any (skb);return NETDEV_TX_OK ;case -ENOMEM : +if (drop_if_ring_full) + goto drop;return NETDEV_TX_BUSY ;default :break ;/* goto drop; */
drivers/net/wireless/ath/wil6210/wil6210.h +2 -1
@@ -1,6 +1,6 @@/* * Copyright (c) 2012-2017 Qualcomm Atheros, Inc. -* Copyright (c) 2018, The Linux Foundation. All rights reserved. +* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above
@@ -38,6 +38,7 @@extern bool debug_fw;extern bool disable_ap_sme;extern bool ftm_mode; +extern bool drop_if_ring_full;struct wil6210_priv ;struct wil6210_vif ;
Signature · 1 line
1.9.1
PATCH 5/21 wil6210: fix invalid sta statistics update
In reply to Maya ErezFrom: Dedy Lansky <[email protected]>
Upon status ring handling, in case there are both unicast and multicast (cid == max) status messages to handle, wrong sta statistics might get updated.
Fix this by setting stats to NULL upon invalid cid
(e.g. == max_assoc_sta).
--- drivers/net/wireless/ath/wil6210/txrx_edma.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/wil6210/txrx_edma.c +2 -3
@@ -1137,7 +1137,7 @@ int wil_tx_sring_handler(struct wil6210_priv *wil,/* Total number of completed descriptors in all descriptor rings */ int desc_cnt =0 ;int cid; -struct wil_net_stats *stats =NULL ; +struct wil_net_stats *stats;struct wil_tx_enhanced_desc *_d;unsigned int ring_id;unsigned int num_descs;
@@ -1187,8 +1187,7 @@ int wil_tx_sring_handler(struct wil6210_priv *wil, ndev =vif_to_ndev (vif); cid = wil->ring2cid_tid[ring_id][0 ]; -if (cid < max_assoc_sta) - stats = &wil->sta[cid].stats; + stats = (cid < max_assoc_sta ? &wil->sta[cid].stats :NULL ); wil_dbg_txrx(wil, "tx_status: completed desc_ring (%d), num_descs (%d)\n",
Signature · 1 line
1.9.1
PATCH 4/21 wil6210: accessing 802.3 addresses via utility functions
In reply to Maya ErezFrom: Ahmad Masri <[email protected]>
Rearrange the code by having functions to access 802.3 header members, source and destination addresses.
--- drivers/net/wireless/ath/wil6210/txrx.c | 36 ++++++++++++++++----------------- drivers/net/wireless/ath/wil6210/txrx.h | 18 +++++++++++++++-- 2 files changed, 33 insertions(+), 21 deletions(-)
drivers/net/wireless/ath/wil6210/txrx.c +17 -19
@@ -383,7 +383,6 @@ static int wil_rx_get_cid_by_skb(struct wil6210_priv *wil, struct sk_buff *skb)*/ int cid =wil_rxdesc_cid (d);unsigned int snaplen =wil_rx_snaplen (); -struct ethhdr *eth;struct ieee80211_hdr_3addr *hdr;int i;unsigned char *ta;
@@ -401,8 +400,7 @@ static int wil_rx_get_cid_by_skb(struct wil6210_priv *wil, struct sk_buff *skb) skb->len);return -ENOENT ; } - eth = (void *)skb->data; - ta = eth->h_source; + ta =wil_skb_get_sa (skb); }else {if (unlikely (skb->len <sizeof (struct ieee80211_hdr_3addr ))) { wil_err_ratelimited(wil, "Short frame, len = %d\n",
@@ -739,11 +737,11 @@ void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev)unsigned int len = skb->len;int cid;int security; -struct ethhdr *eth = (void *)skb->data; +u8 *sa, *da =wil_skb_get_da (skb);/* here looking for DA, not A1, thus Rxdesc's 'mcast' indication * is not suitable, need to look at data */ -int mcast =is_multicast_ether_addr (eth->h_dest); +int mcast =is_multicast_ether_addr (da);struct wil_net_stats *stats;struct sk_buff *xmit_skb =NULL ;static const char *const gro_res_str[] = {
@@ -774,7 +772,8 @@ void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev) }if (wdev->iftype ==NL80211_IFTYPE_STATION ) { -if (mcast &ðer_addr_equal (eth->h_source, ndev->dev_addr)) { + sa =wil_skb_get_sa (skb); +if (mcast &ðer_addr_equal (sa, ndev->dev_addr)) {/* mcast packet looped back to us */ rc =GRO_DROP ;dev_kfree_skb (skb);
@@ -787,8 +786,7 @@ void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev)*/ xmit_skb =skb_copy (skb,GFP_ATOMIC ); }else { -int xmit_cid =wil_find_cid (wil, vif->mid, - eth->h_dest); +int xmit_cid =wil_find_cid (wil, vif->mid, da);if (xmit_cid >=0 ) {/* The destination station is associated to
@@ -1239,11 +1237,12 @@ static struct wil_ring *wil_find_tx_ucast(struct wil6210_priv *wil,struct wil6210_vif *vif, struct sk_buff *skb) { - int i; -struct ethhdr *eth = (void *)skb->data; -int cid =wil_find_cid (wil, vif->mid, eth->h_dest); + int i, cid; +const u8 *da =wil_skb_get_da (skb);int min_ring_id =wil_get_min_tx_ring_id (wil); + cid =wil_find_cid (wil, vif->mid, da); +if (cid <0 || cid >= max_assoc_sta)return NULL ;
@@ -1257,7 +1256,7 @@ static struct wil_ring *wil_find_tx_ucast(struct wil6210_priv *wil,struct wil_ring_tx_data *txdata = &wil->ring_tx_data[i];wil_dbg_txrx (wil,"find_tx_ucast: (%pM) -> [%d]\n" , - eth->h_dest, i); + da, i);if (v->va && txdata->enabled) {return v; }else {
@@ -1348,10 +1347,10 @@ static struct wil_ring *wil_find_tx_bcast_1(struct wil6210_priv *wil,static void wil_set_da_for_vring (struct wil6210_priv *wil,struct sk_buff *skb,int vring_index) { -struct ethhdr *eth = (void *)skb->data; +u8 *da =wil_skb_get_da (skb);int cid = wil->ring2cid_tid[vring_index][0 ]; -ether_addr_copy (eth->h_dest, wil->sta[cid].addr); +ether_addr_copy (da, wil->sta[cid].addr); } static struct wil_ring *wil_find_tx_bcast_2(struct wil6210_priv *wil,
@@ -1362,8 +1361,7 @@ static struct wil_ring *wil_find_tx_bcast_2(struct wil6210_priv *wil,struct sk_buff *skb2;int i;u8 cid; -struct ethhdr *eth = (void *)skb->data; -char *src = eth->h_source; +const u8 *src =wil_skb_get_sa (skb);struct wil_ring_tx_data *txdata, *txdata2;int min_ring_id =wil_get_min_tx_ring_id (wil);
@@ -2121,8 +2119,8 @@ netdev_tx_t wil_start_xmit(struct sk_buff *skb, struct net_device *ndev) {struct wil6210_vif *vif =ndev_to_vif (ndev);struct wil6210_priv *wil =vif_to_wil (vif); -struct ethhdr *eth = (void *)skb->data; -bool bcast =is_multicast_ether_addr (eth->h_dest); +const u8 *da =wil_skb_get_da (skb); +bool bcast =is_multicast_ether_addr (da);struct wil_ring *ring;static bool pr_once_fw;int rc;
@@ -2169,7 +2167,7 @@ netdev_tx_t wil_start_xmit(struct sk_buff *skb, struct net_device *ndev) ring =wil_find_tx_ucast (wil, vif, skb); }if (unlikely (!ring)) { -wil_dbg_txrx (wil,"No Tx RING found for %pM\n" , eth->h_dest); +wil_dbg_txrx (wil,"No Tx RING found for %pM\n" , da); goto drop; }/* set up vring entry */
drivers/net/wireless/ath/wil6210/txrx.h +16 -2
@@ -567,11 +567,25 @@ static inline int wil_ring_is_full(struct wil_ring *ring)return wil_ring_next_tail (ring) == ring->swhead; } -static inline bool wil_need_txstat (struct sk_buff *skb) +static inline u8 *wil_skb_get_da (struct sk_buff *skb) +{ +struct ethhdr *eth = (void *)skb->data; + +return eth->h_dest; +} + +static inline u8 *wil_skb_get_sa (struct sk_buff *skb) {struct ethhdr *eth = (void *)skb->data; -return is_unicast_ether_addr (eth->h_dest) && skb->sk && +return eth->h_source; +} + +static inline bool wil_need_txstat (struct sk_buff *skb) +{ +const u8 *da =wil_skb_get_da (skb); + +return is_unicast_ether_addr (da) && skb->sk && (skb_shinfo (skb)->tx_flags &SKBTX_WIFI_STATUS ); }
Signature · 1 line
1.9.1
PATCH 3/21 wil6210: support up to 20 stations in AP mode
In reply to Maya ErezFrom: Ahmad Masri <[email protected]>
New FW added support for upto 20 clients in AP mode. Change the driver to support this as well. FW reports it's max supported associations in WMI_READY_EVENT. Some WMI commands/events use cidxtid field which is limited to 16 cids. Use new cid/tid fields instead.
For Rx packets cid from rx descriptor is limited to 3 bits (0..7), to find the real cid, compare transmitter address with the stored stations mac address in the driver sta array.
EDMA FW still supports 8 stations. Extending the support to 20 stations will come later.
--- drivers/net/wireless/ath/wil6210/cfg80211.c | 6 +- drivers/net/wireless/ath/wil6210/debugfs.c | 20 ++-- drivers/net/wireless/ath/wil6210/main.c | 10 +- drivers/net/wireless/ath/wil6210/rx_reorder.c | 10 +- drivers/net/wireless/ath/wil6210/trace.h | 3 +- drivers/net/wireless/ath/wil6210/txrx.c | 127 +++++++++++++++++++++----- drivers/net/wireless/ath/wil6210/txrx.h | 26 ++++++ drivers/net/wireless/ath/wil6210/txrx_edma.c | 8 +- drivers/net/wireless/ath/wil6210/wil6210.h | 12 ++- drivers/net/wireless/ath/wil6210/wmi.c | 79 ++++++++++++---- 10 files changed, 226 insertions(+), 75 deletions(-)
drivers/net/wireless/ath/wil6210/cfg80211.c +3 -3
@@ -1,6 +1,6 @@/* * Copyright (c) 2012-2017 Qualcomm Atheros, Inc. -* Copyright (c) 2018, The Linux Foundation. All rights reserved. +* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above
@@ -395,7 +395,7 @@ static int wil_find_cid_by_idx(struct wil6210_priv *wil, u8 mid, int idx) {int i; -for (i =0 ; i <ARRAY_SIZE (wil->sta); i++) { +for (i =0 ; i < max_assoc_sta; i++) {if (wil->sta[i].status == wil_sta_unused)continue ;if (wil->sta[i].mid != mid)
@@ -3007,7 +3007,7 @@ static int wil_rf_sector_set_selected(struct wiphy *wiphy, wil, vif->mid,WMI_INVALID_RF_SECTOR_INDEX , sector_type, WIL_CID_ALL);if (rc == -EINVAL ) { -for (i =0 ; i <WIL6210_MAX_CID ; i++) { +for (i =0 ; i < max_assoc_sta; i++) {if (wil->sta[i].mid != vif->mid)continue ; rc = wil_rf_sector_wmi_set_selected(
drivers/net/wireless/ath/wil6210/debugfs.c +10 -10
@@ -162,7 +162,7 @@ static int ring_show(struct seq_file *s, void *data)snprintf (name,sizeof (name),"tx_%2d" , i); -if (cid <WIL6210_MAX_CID ) +if (cid < max_assoc_sta) seq_printf(s, "\n%pM CID %d TID %d 1x%s BACK([%u] %u TU A%s) [%3d|%3d] idle %s\n", wil->sta[cid].addr, cid, tid,
@@ -792,14 +792,14 @@ static ssize_t wil_write_back(struct file *file, const char __user *buf, "BACK: del_rx require at least 2 params\n");return -EINVAL ; } -if (p1 <0 || p1 >=WIL6210_MAX_CID ) { +if (p1 <0 || p1 >= max_assoc_sta) {wil_err (wil,"BACK: invalid CID %d\n" , p1);return -EINVAL ; }if (rc <4 ) p3 =WLAN_REASON_QSTA_LEAVE_QBSS ; sta = &wil->sta[p1]; -wmi_delba_rx (wil, sta->mid,mk_cidxtid (p1, p2), p3); +wmi_delba_rx (wil, sta->mid, p1, p2, p3); }else {wil_err (wil,"BACK: Unrecognized command \"%s\"\n" , cmd);return -EINVAL ;
@@ -1243,7 +1243,7 @@ static int bf_show(struct seq_file *s, void *data)memset (&reply,0 ,sizeof (reply)); -for (i =0 ; i <ARRAY_SIZE (wil->sta); i++) { +for (i =0 ; i < max_assoc_sta; i++) {u32 status; cmd.cid = i;
@@ -1340,7 +1340,7 @@ static int link_show(struct seq_file *s, void *data)if (!sinfo)return -ENOMEM ; -for (i =0 ; i <ARRAY_SIZE (wil->sta); i++) { +for (i =0 ; i < max_assoc_sta; i++) {struct wil_sta_info *p = &wil->sta[i];char *status ="unknown" ;struct wil6210_vif *vif;
@@ -1542,7 +1542,7 @@ static int sta_show(struct seq_file *s, void *data)struct wil6210_priv *wil = s->private;int i, tid, mcs; -for (i =0 ; i <ARRAY_SIZE (wil->sta); i++) { +for (i =0 ; i < max_assoc_sta; i++) {struct wil_sta_info *p = &wil->sta[i];char *status ="unknown" ;u8 aid =0 ;
@@ -1651,7 +1651,7 @@ static int wil_tx_latency_debugfs_show(struct seq_file *s, void *data)struct wil6210_priv *wil = s->private;int i, bin; -for (i =0 ; i <ARRAY_SIZE (wil->sta); i++) { +for (i =0 ; i < max_assoc_sta; i++) {struct wil_sta_info *p = &wil->sta[i];char *status ="unknown" ;u8 aid =0 ;
@@ -1740,7 +1740,7 @@ static ssize_t wil_tx_latency_write(struct file *file, const char __user *buf,size_t sz =sizeof (u64) *WIL_NUM_LATENCY_BINS ; wil->tx_latency_res = val; -for (i =0 ; i <ARRAY_SIZE (wil->sta); i++) { +for (i =0 ; i < max_assoc_sta; i++) {struct wil_sta_info *sta = &wil->sta[i];kfree (sta->tx_latency_bins);
@@ -1825,7 +1825,7 @@ static void wil_link_stats_debugfs_show_vif(struct wil6210_vif *vif, }seq_printf (s,"TSF %lld\n" , vif->fw_stats_tsf); -for (i =0 ; i <ARRAY_SIZE (wil->sta); i++) { +for (i =0 ; i < max_assoc_sta; i++) {if (wil->sta[i].status == wil_sta_unused)continue ;if (wil->sta[i].mid != vif->mid)
@@ -2440,7 +2440,7 @@ void wil6210_debugfs_remove(struct wil6210_priv *wil) wil->debug =NULL ;kfree (wil->dbg_data.data_arr); -for (i =0 ; i <ARRAY_SIZE (wil->sta); i++) +for (i =0 ; i < max_assoc_sta; i++)kfree (wil->sta[i].tx_latency_bins);/* free pmc memory without sending command to fw, as it will
drivers/net/wireless/ath/wil6210/main.c +5 -5
@@ -1,6 +1,6 @@/* * Copyright (c) 2012-2017 Qualcomm Atheros, Inc. -* Copyright (c) 2018, The Linux Foundation. All rights reserved. +* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above
@@ -219,7 +219,7 @@ static bool wil_vif_is_connected(struct wil6210_priv *wil, u8 mid) {int i; -for (i =0 ; i <WIL6210_MAX_CID ; i++) { +for (i =0 ; i < max_assoc_sta; i++) {if (wil->sta[i].mid == mid && wil->sta[i].status == wil_sta_connected)return true;
@@ -322,7 +322,7 @@ static void _wil6210_disconnect_complete(struct wil6210_vif *vif,wil_disconnect_cid_complete (vif, cid, reason_code); }else {/* all */ wil_dbg_misc (wil,"Disconnect complete all\n" ); -for (cid =0 ; cid <WIL6210_MAX_CID ; cid++) +for (cid =0 ; cid < max_assoc_sta; cid++)wil_disconnect_cid_complete (vif, cid, reason_code); }
@@ -434,7 +434,7 @@ static void _wil6210_disconnect(struct wil6210_vif *vif, const u8 *bssid,wil_disconnect_cid (vif, cid, reason_code); }else {/* all */ wil_dbg_misc (wil,"Disconnect all\n" ); -for (cid =0 ; cid <WIL6210_MAX_CID ; cid++) +for (cid =0 ; cid < max_assoc_sta; cid++)wil_disconnect_cid (vif, cid, reason_code); }
@@ -1895,7 +1895,7 @@ int wil_find_cid(struct wil6210_priv *wil, u8 mid, const u8 *mac)int i;int rc = -ENOENT ; -for (i =0 ; i <ARRAY_SIZE (wil->sta); i++) { +for (i =0 ; i < max_assoc_sta; i++) {if (wil->sta[i].mid == mid && wil->sta[i].status != wil_sta_unused &ðer_addr_equal (wil->sta[i].addr, mac)) {
drivers/net/wireless/ath/wil6210/rx_reorder.c +4 -6
@@ -1,6 +1,6 @@/* * Copyright (c) 2014-2017 Qualcomm Atheros, Inc. -* Copyright (c) 2018, The Linux Foundation. All rights reserved. +* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above
@@ -307,8 +307,8 @@ static u16 wil_agg_size(struct wil6210_priv *wil, u16 req_agg_wsize) }/* Block Ack - Rx side (recipient) */ -int wil_addba_rx_request (struct wil6210_priv *wil,u8 mid, -u8 cidxtid,u8 dialog_token,__le16 ba_param_set, +int wil_addba_rx_request (struct wil6210_priv *wil,u8 mid,u8 cid,u8 tid, +u8 dialog_token,__le16 ba_param_set,__le16 ba_timeout,__le16 ba_seq_ctrl) __acquires(&sta->tid_rx_lock) __releases(&sta->tid_rx_lock) {
@@ -316,7 +316,6 @@ int wil_addba_rx_request(struct wil6210_priv *wil, u8 mid,u16 agg_timeout =le16_to_cpu (ba_timeout);u16 seq_ctrl =le16_to_cpu (ba_seq_ctrl);struct wil_sta_info *sta; -u8 cid, tid;u16 agg_wsize =0 ;/* bit 0: A-MSDU supported * bit 1: policy (should be 0 for us)
@@ -335,10 +334,9 @@ int wil_addba_rx_request(struct wil6210_priv *wil, u8 mid,int rc =0 ;might_sleep (); -parse_cidxtid (cidxtid, &cid, &tid);/* sanity checks */ -if (cid >=WIL6210_MAX_CID ) { +if (cid >= max_assoc_sta) {wil_err (wil,"BACK: invalid CID %d\n" , cid); rc = -EINVAL ; goto out;
drivers/net/wireless/ath/wil6210/trace.h +2 -1
@@ -1,5 +1,6 @@/* * Copyright (c) 2013-2016 Qualcomm Atheros, Inc. +* Copyright (c) 2019, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above
@@ -181,7 +182,7 @@ __entry->seq =wil_rxdesc_seq (d); __entry->mcs =wil_rxdesc_mcs (d); ), -TP_printk ("index %d len %d mid %d cid %d tid %d mcs %d seq 0x%03x" +TP_printk ("index %d len %d mid %d cid (%%8) %d tid %d mcs %d seq 0x%03x" " type 0x%1x subtype 0x%1x" , __entry->index, __entry->len, __entry->mid, __entry->cid, __entry->tid, __entry->mcs, __entry->seq, __entry->type, __entry->subtype)
drivers/net/wireless/ath/wil6210/txrx.c +102 -25
242 lines not on this page · raw message
drivers/net/wireless/ath/wil6210/txrx.h +26 -0
@@ -458,6 +458,18 @@ struct vring_rx_desc {union wil_rx_desc rx; } __packed; +struct packet_rx_info { +u8 cid; +}; + +/* this struct will be stored in the skb cb buffer +* max length of the struct is limited to 48 bytes +*/ +struct skb_rx_info { +struct vring_rx_desc rx_desc; +struct packet_rx_info rx_info; +}; +static inline int wil_rxdesc_tid (struct vring_rx_desc *d) {return WIL_GET_BITS (d->mac.d0,0 ,3 );
@@ -605,6 +617,20 @@ static inline bool wil_val_in_range(int val, int min, int max)return val >= min && val < max; } +static inline u8 wil_skb_get_cid (struct sk_buff *skb) +{ +struct skb_rx_info *skb_rx_info = (void *)skb->cb; + +return skb_rx_info->rx_info.cid; +} + +static inline void wil_skb_set_cid (struct sk_buff *skb,u8 cid) +{ +struct skb_rx_info *skb_rx_info = (void *)skb->cb; + + skb_rx_info->rx_info.cid = cid; +} +void wil_netif_rx_any (struct sk_buff *skb,struct net_device *ndev);void wil_rx_reorder (struct wil6210_priv *wil,struct sk_buff *skb); void wil_rx_bar(struct wil6210_priv *wil, struct wil6210_vif *vif,
drivers/net/wireless/ath/wil6210/txrx_edma.c +4 -4
@@ -1,5 +1,5 @@/* -* Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. +* Copyright (c) 2012-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above
@@ -727,7 +727,7 @@ static int wil_ring_init_tx_edma(struct wil6210_vif *vif, int ring_id, txdata->enabled =0 ;spin_unlock_bh (&txdata->lock);wil_ring_free_edma (wil, ring); - wil->ring2cid_tid[ring_id][0 ] =WIL6210_MAX_CID ; + wil->ring2cid_tid[ring_id][0 ] = max_assoc_sta; wil->ring2cid_tid[ring_id][1 ] =0 ; out:
@@ -932,7 +932,7 @@ static struct sk_buff *wil_sring_reap_rx_edma(struct wil6210_priv *wil, eop =wil_rx_status_get_eop (msg); cid =wil_rx_status_get_cid (msg); -if (unlikely (!wil_val_in_range (cid,0 ,WIL6210_MAX_CID ))) { +if (unlikely (!wil_val_in_range (cid,0 , max_assoc_sta))) {wil_err (wil,"Corrupt cid=%d, sring->swhead=%d\n" , cid, sring->swhead); rxdata->skipping = true;
@@ -1187,7 +1187,7 @@ int wil_tx_sring_handler(struct wil6210_priv *wil, ndev =vif_to_ndev (vif); cid = wil->ring2cid_tid[ring_id][0 ]; -if (cid <WIL6210_MAX_CID ) +if (cid < max_assoc_sta) stats = &wil->sta[cid].stats; wil_dbg_txrx(wil,
drivers/net/wireless/ath/wil6210/wil6210.h +7 -5
@@ -39,6 +39,7 @@extern bool disable_ap_sme;extern bool ftm_mode;extern bool drop_if_ring_full; +extern uint max_assoc_sta;struct wil6210_priv ;struct wil6210_vif ;
@@ -90,7 +91,8 @@ static inline u32 WIL_GET_BITS(u32 x, int b0, int b1)#define WIL_RING_SIZE_ORDER_MIN (5)#define WIL_RING_SIZE_ORDER_MAX (15)#define WIL6210_MAX_TX_RINGS (24)/* HW limit */ -#define WIL6210_MAX_CID (8)/* HW limit */ +#define WIL6210_MAX_CID (20)/* max number of stations */ +#define WIL6210_RX_DESC_MAX_CID (8)/* HW limit */ #define WIL6210_NAPI_BUDGET (16)/* arbitrary */ #define WIL_MAX_AMPDU_SIZE (64 * 1024)/* FW/HW limit */ #define WIL_MAX_AGG_WSIZE (32)/* FW/HW limit */
@@ -458,7 +460,7 @@ static inline void parse_cidxtid(u8 cidxtid, u8 *cid, u8 *tid)*/ static inline bool wil_cid_valid (u8 cid) { -return cid <WIL6210_MAX_CID ; +return (cid >=0 && cid < max_assoc_sta); }struct wil6210_mbox_ring {
@@ -1236,7 +1238,7 @@ int wmi_disconnect_sta(struct wil6210_vif *vif, const u8 *mac, u16 reason,int wmi_addba (struct wil6210_priv *wil,u8 mid,u8 ringid,u8 size,u16 timeout);int wmi_delba_tx (struct wil6210_priv *wil,u8 mid,u8 ringid,u16 reason); -int wmi_delba_rx (struct wil6210_priv *wil,u8 mid,u8 cidxtid,u16 reason); +int wmi_delba_rx (struct wil6210_priv *wil,u8 mid,u8 cid,u8 tid,u16 reason);int wmi_addba_rx_resp (struct wil6210_priv *wil,u8 mid,u8 cid,u8 tid,u8 token,u16 status,bool amsdu,u16 agg_wsize,u16 timeout);
@@ -1249,8 +1251,8 @@ int wmi_port_allocate(struct wil6210_priv *wil, u8 mid, const u8 *mac, enum nl80211_iftype iftype);int wmi_port_delete (struct wil6210_priv *wil,u8 mid);int wmi_link_stats_cfg (struct wil6210_vif *vif,u32 type,u8 cid,u32 interval); -int wil_addba_rx_request (struct wil6210_priv *wil,u8 mid, -u8 cidxtid,u8 dialog_token,__le16 ba_param_set, +int wil_addba_rx_request (struct wil6210_priv *wil,u8 mid,u8 cid,u8 tid, +u8 dialog_token,__le16 ba_param_set,__le16 ba_timeout,__le16 ba_seq_ctrl);int wil_addba_tx_request (struct wil6210_priv *wil,u8 ringid,u16 wsize);
drivers/net/wireless/ath/wil6210/wmi.c +63 -16
158 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 6/21 wil6210: ignore HALP ICR if already handled
In reply to Maya ErezHALP ICR is set as long as the FW should stay awake.
To prevent its multiple handling the driver masks this IRQ bit. However, if there is a different MISC ICR before the driver clears this bit, there is a risk of race condition between HALP mask and unmask. This race leads to HALP timeout, in case it is mistakenly masked.
Add an atomic flag to indicate if HALP ICR should be handled.
--- drivers/net/wireless/ath/wil6210/interrupt.c | 12 ++++++++---- drivers/net/wireless/ath/wil6210/main.c | 3 +++ drivers/net/wireless/ath/wil6210/wil6210.h | 1 + 3 files changed, 12 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/wil6210/interrupt.c +8 -4
@@ -1,6 +1,6 @@/* * Copyright (c) 2012-2017 Qualcomm Atheros, Inc. -* Copyright (c) 2018, The Linux Foundation. All rights reserved. +* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above
@@ -575,10 +575,14 @@ static irqreturn_t wil6210_irq_misc(int irq, void *cookie) }if (isr &BIT_DMA_EP_MISC_ICR_HALP ) { -wil_dbg_irq (wil,"irq_misc: HALP IRQ invoked\n" ); -wil6210_mask_halp (wil); isr &= ~BIT_DMA_EP_MISC_ICR_HALP ; -complete (&wil->halp.comp); +if (wil->halp.handle_icr) { +/* no need to handle HALP ICRs until next vote */ + wil->halp.handle_icr = false; +wil_dbg_irq (wil,"irq_misc: HALP IRQ invoked\n" ); +wil6210_mask_halp (wil); +complete (&wil->halp.comp); + } } wil->isr_misc = isr;
drivers/net/wireless/ath/wil6210/main.c +3 -0
@@ -1919,11 +1919,14 @@ void wil_halp_vote(struct wil6210_priv *wil)if (++wil->halp.ref_cnt ==1 ) {reinit_completion (&wil->halp.comp); +/* mark to IRQ context to handle HALP ICR */ + wil->halp.handle_icr = true;wil6210_set_halp (wil); rc =wait_for_completion_timeout (&wil->halp.comp, to_jiffies);if (!rc) {wil_err (wil,"HALP vote timed out\n" );/* Mask HALP as done in case the interrupt is raised */ + wil->halp.handle_icr = false;wil6210_mask_halp (wil); }else { wil_dbg_irq(wil,
drivers/net/wireless/ath/wil6210/wil6210.h +1 -0
@@ -794,6 +794,7 @@ struct wil_halp {struct mutex lock;/* protect halp ref_cnt */ unsigned int ref_cnt;struct completion comp; +u8 handle_icr; };struct wil_blob_wrapper {
Signature · 1 line
1.9.1
PATCH 8/21 wil6210: align to latest auto generated wmi.h
In reply to Maya ErezFrom: Alexei Avshalom Lazar <[email protected]>
Align to latest version of the auto generated wmi file describing the interface with FW.
--- drivers/net/wireless/ath/wil6210/wmi.c | 7 +++ drivers/net/wireless/ath/wil6210/wmi.h | 91 ++++++++++++++++++++++++++++++++-- 2 files changed, 94 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/wil6210/wmi.c +7 -0
@@ -2957,6 +2957,10 @@ static const char *suspend_status2name(u8 status)switch (status) {case WMI_TRAFFIC_SUSPEND_REJECTED_LINK_NOT_IDLE :return "LINK_NOT_IDLE" ; +case WMI_TRAFFIC_SUSPEND_REJECTED_DISCONNECT : +return "DISCONNECT" ; +case WMI_TRAFFIC_SUSPEND_REJECTED_OTHER : +return "OTHER" ;default :return "Untracked status" ; }
@@ -3046,6 +3050,9 @@ static void resume_triggers2string(u32 triggers, char *string, int str_size)if (triggers &WMI_RESUME_TRIGGER_WMI_EVT )strlcat (string," WMI_EVT" , str_size); + +if (triggers &WMI_RESUME_TRIGGER_DISCONNECT ) +strlcat (string," DISCONNECT" , str_size); }int wmi_resume (struct wil6210_priv *wil)
drivers/net/wireless/ath/wil6210/wmi.h +87 -4
168 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 9/21 wil6210: prevent device memory access while in reset or suspend
In reply to Maya ErezFrom: Ahmad Masri <[email protected]>
Accessing some of the memory of the device while the device is resetting or suspending may cause unexpected error as the HW is still not in a stable state. Prevent this access to guarantee successful read/write memory operations.
--- drivers/net/wireless/ath/wil6210/debugfs.c | 25 +++++++++++--- drivers/net/wireless/ath/wil6210/main.c | 41 +++++++++++++++++------ drivers/net/wireless/ath/wil6210/pm.c | 29 ++++++++++------ drivers/net/wireless/ath/wil6210/wil6210.h | 5 ++- drivers/net/wireless/ath/wil6210/wil_crash_dump.c | 18 ++++------ 5 files changed, 80 insertions(+), 38 deletions(-)
drivers/net/wireless/ath/wil6210/debugfs.c +21 -4
@@ -258,6 +258,11 @@ static void wil_print_mbox_ring(struct seq_file *s, const char *prefix,wil_halp_vote (wil); +if (wil_mem_access_lock (wil)) { +wil_halp_unvote (wil); +return ; + } +wil_memcpy_fromio_32 (&r, off,sizeof (r));wil_mbox_ring_le2cpus (&r);/*
@@ -323,6 +328,7 @@ static void wil_print_mbox_ring(struct seq_file *s, const char *prefix, } out:seq_puts (s,"}\n" ); +wil_mem_access_unlock (wil);wil_halp_unvote (wil); }
@@ -601,6 +607,12 @@ static int memread_show(struct seq_file *s, void *data)if (ret <0 )return ret; + ret =wil_mem_access_lock (wil); +if (ret) { +wil_pm_runtime_put (wil); +return ret; + } + a =wmi_buffer (wil,cpu_to_le32 (mem_addr));if (a)
@@ -608,6 +620,7 @@ static int memread_show(struct seq_file *s, void *data)else seq_printf (s,"[0x%08x] = INVALID\n" , mem_addr); +wil_mem_access_unlock (wil);wil_pm_runtime_put (wil);return 0 ;
@@ -626,10 +639,6 @@ static ssize_t wil_read_file_ioblob(struct file *file, char __user *user_buf,size_t unaligned_bytes, aligned_count, ret;int rc; -if (test_bit (wil_status_suspending, wil_blob->wil->status) || -test_bit (wil_status_suspended, wil_blob->wil->status)) -return 0 ; -if (pos <0 )return -EINVAL ;
@@ -656,11 +665,19 @@ static ssize_t wil_read_file_ioblob(struct file *file, char __user *user_buf,return rc; } + rc =wil_mem_access_lock (wil); +if (rc) { +kfree (buf); +wil_pm_runtime_put (wil); +return rc; + } +wil_memcpy_fromio_32 (buf, (const void __iomem *) wil_blob->blob.data + aligned_pos, aligned_count); ret =copy_to_user (user_buf, buf + unaligned_bytes, count); +wil_mem_access_unlock (wil);wil_pm_runtime_put (wil);kfree (buf);
drivers/net/wireless/ath/wil6210/main.c +31 -10
78 lines not on this page · raw message
drivers/net/wireless/ath/wil6210/pm.c +18 -11
@@ -1,6 +1,6 @@/* * Copyright (c) 2014,2017 Qualcomm Atheros, Inc. -* Copyright (c) 2018, The Linux Foundation. All rights reserved. +* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above
@@ -195,14 +195,18 @@ static int wil_suspend_keep_radio_on(struct wil6210_priv *wil)wil_dbg_pm (wil,"suspend keep radio on\n" );/* Prevent handling of new tx and wmi commands */ -set_bit (wil_status_suspending, wil->status); -if (test_bit (wil_status_collecting_dumps, wil->status)) { -/* Device collects crash dump, cancel the suspend */ -wil_dbg_pm (wil,"reject suspend while collecting crash dump\n" ); -clear_bit (wil_status_suspending, wil->status); + rc =down_write_trylock (&wil->mem_lock); +if (!rc) { +wil_err (wil, +"device is busy. down_write_trylock failed, returned (0x%x)\n" , + rc); wil->suspend_stats.rejected_by_host++;return -EBUSY ; } + +set_bit (wil_status_suspending, wil->status); +up_write (&wil->mem_lock); +wil_pm_stop_all_net_queues (wil);if (!wil_is_tx_idle (wil)) {
@@ -310,15 +314,18 @@ static int wil_suspend_radio_off(struct wil6210_priv *wil)wil_dbg_pm (wil,"suspend radio off\n" ); -set_bit (wil_status_suspending, wil->status); -if (test_bit (wil_status_collecting_dumps, wil->status)) { -/* Device collects crash dump, cancel the suspend */ -wil_dbg_pm (wil,"reject suspend while collecting crash dump\n" ); -clear_bit (wil_status_suspending, wil->status); + rc =down_write_trylock (&wil->mem_lock); +if (!rc) { +wil_err (wil, +"device is busy. down_write_trylock failed, returned (0x%x)\n" , + rc); wil->suspend_stats.rejected_by_host++;return -EBUSY ; } +set_bit (wil_status_suspending, wil->status); +up_write (&wil->mem_lock); +/* if netif up, hardware is alive, shut it down */ mutex_lock (&wil->vif_mutex); active_ifaces =wil_has_active_ifaces (wil, true, false);
drivers/net/wireless/ath/wil6210/wil6210.h +4 -1
@@ -660,7 +660,6 @@ enum { /* for wil6210_priv.status */ wil_status_suspending,/* suspend in progress */ wil_status_suspended,/* suspend completed, device is suspended */ wil_status_resuming,/* resume in progress */ - wil_status_collecting_dumps,/* crashdump collection in progress */ wil_status_last /* keep last */ };
@@ -992,6 +991,8 @@ struct wil6210_priv {struct wil_txrx_ops txrx_ops;struct mutex mutex;/* for wil6210_priv access in wil_{up|down} */ +/* for synchronizing device memory access while reset or suspend */ +struct rw_semaphore mem_lock;/* statistics */ atomic_t isr_count_rx, isr_count_tx;/* debugfs */
@@ -1176,6 +1177,8 @@ void wil_memcpy_fromio_32(void *dst, const volatile void __iomem *src, size_t count);void wil_memcpy_toio_32 (volatile void __iomem *dst,const void *src,size_t count); +int wil_mem_access_lock (struct wil6210_priv *wil); +void wil_mem_access_unlock (struct wil6210_priv *wil);struct wil6210_vif * wil_vif_alloc(struct wil6210_priv *wil, const char *name,
drivers/net/wireless/ath/wil6210/wil_crash_dump.c +6 -12
@@ -1,6 +1,6 @@/* * Copyright (c) 2015,2017 Qualcomm Atheros, Inc. -* Copyright (c) 2018, The Linux Foundation. All rights reserved. +* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above
@@ -57,7 +57,7 @@ static int wil_fw_get_crash_dump_bounds(struct wil6210_priv *wil,int wil_fw_copy_crash_dump (struct wil6210_priv *wil,void *dest,u32 size) { -int i; +int i, rc;const struct fw_map *map;void *data;u32 host_min, dump_size, offset, len;
@@ -73,14 +73,9 @@ int wil_fw_copy_crash_dump(struct wil6210_priv *wil, void *dest, u32 size)return -EINVAL ; } -set_bit (wil_status_collecting_dumps, wil->status); -if (test_bit (wil_status_suspending, wil->status) || -test_bit (wil_status_suspended, wil->status) || -test_bit (wil_status_resetting, wil->status)) { -wil_err (wil,"cannot collect fw dump during suspend/reset\n" ); -clear_bit (wil_status_collecting_dumps, wil->status); -return -EINVAL ; - } + rc =wil_mem_access_lock (wil); +if (rc) +return rc;/* copy to crash dump area */ for (i =0 ; i <ARRAY_SIZE (fw_mapping); i++) {
@@ -100,8 +95,7 @@ int wil_fw_copy_crash_dump(struct wil6210_priv *wil, void *dest, u32 size)wil_memcpy_fromio_32 ((void *__force )(dest + offset), (const void __iomem *__force )data, len); } - -clear_bit (wil_status_collecting_dumps, wil->status); +wil_mem_access_unlock (wil);return 0 ; }
Signature · 1 line
1.9.1
PATCH 12/21 wil6210: update WIL_MCS_MAX to 15
In reply to Maya ErezUpdate max MCS to 15, which is supported by Talyn-MB. This will allow collecting statistics on number of RX packets in higher MCS.
--- drivers/net/wireless/ath/wil6210/wil6210.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/wil6210/wil6210.h +1 -1
@@ -569,7 +569,7 @@ struct wil_status_ring { };#define WIL_STA_TID_NUM (16) -#define WIL_MCS_MAX (12)/* Maximum MCS supported */ +#define WIL_MCS_MAX (15)/* Maximum MCS supported */ struct wil_net_stats {unsigned long rx_packets;
Signature · 1 line
1.9.1
PATCH 11/21 wil6210: do not set BIT_USER_SUPPORT_T_POWER_ON_0 in Talyn-MB
In reply to Maya ErezIn Sparrow, FW might sleep long time due to T_Power_On calculation in slow clock, so T_Power_On was set to zero to shorten the L1SS wake-up time.
In Talyn-MB the L1SS wake-up procedure is handled by the PMU (HW), hence T_Power_On calculation is accurate and should not be forced to zero.
--- drivers/net/wireless/ath/wil6210/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/wil6210/main.c +2 -1
@@ -1603,7 +1603,8 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)if (wil->hw_version ==HW_VER_UNKNOWN )return -ENODEV ; -if (test_bit (WIL_PLATFORM_CAPA_T_PWR_ON_0 , wil->platform_capa)) { +if (test_bit (WIL_PLATFORM_CAPA_T_PWR_ON_0 , wil->platform_capa) && + wil->hw_version <HW_VER_TALYN_MB ) {wil_dbg_misc (wil,"Notify FW to set T_POWER_ON=0\n" );wil_s (wil,RGF_USER_USAGE_8 ,BIT_USER_SUPPORT_T_POWER_ON_0 ); }
Signature · 1 line
1.9.1
PATCH 15/21 wil6210: free edma_rx_swtail upon reset
In reply to Maya ErezFrom: Dedy Lansky <[email protected]>
edma_rx_swtail dma memory free is missing.
Add this part of Rx desc ring free.
--- drivers/net/wireless/ath/wil6210/txrx_edma.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/ath/wil6210/txrx_edma.c +3 -0
@@ -428,6 +428,9 @@ static void wil_ring_free_edma(struct wil6210_priv *wil, struct wil_ring *ring) &ring->pa, ring->ctx);wil_move_all_rx_buff_to_free_list (wil, ring); +dma_free_coherent (dev,sizeof (*ring->edma_rx_swtail.va), + ring->edma_rx_swtail.va, + ring->edma_rx_swtail.pa); goto out; }
Signature · 1 line
1.9.1
PATCH 17/21 wil6210: fix return code of wmi_mgmt_tx and wmi_mgmt_tx_ext
In reply to Maya ErezFrom: Lior David <[email protected]>
The functions that send management TX frame have 3 possible
results: success and other side acknowledged receive (ACK=1), success and other side did not acknowledge receive(ACK=0) and failure to send the frame. The current implementation incorrectly reports the ACK=0 case as failure.
--- drivers/net/wireless/ath/wil6210/cfg80211.c | 5 +++++ drivers/net/wireless/ath/wil6210/wmi.c | 11 ++++++----- 2 files changed, 11 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/wil6210/cfg80211.c +5 -0
@@ -1274,7 +1274,12 @@ int wil_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, params->wait); out: +/* when the sent packet was not acked by receiver(ACK=0), rc will +* be -EAGAIN. In this case this function needs to return success, +* the ACK=0 will be reflected in tx_status. +*/ tx_status = (rc ==0 ); + rc = (rc == -EAGAIN ) ?0 : rc;cfg80211_mgmt_tx_status (wdev, cookie ? *cookie :0 , buf, len, tx_status,GFP_KERNEL );
drivers/net/wireless/ath/wil6210/wmi.c +6 -5
@@ -3511,8 +3511,9 @@ int wmi_mgmt_tx(struct wil6210_vif *vif, const u8 *buf, size_t len) rc =wmi_call (wil,WMI_SW_TX_REQ_CMDID , vif->mid, cmd, total,WMI_SW_TX_COMPLETE_EVENTID , &evt,sizeof (evt),2000 );if (!rc && evt.evt.status !=WMI_FW_STATUS_SUCCESS ) { -wil_err (wil,"mgmt_tx failed with status %d\n" , evt.evt.status); - rc = -EINVAL ; +wil_dbg_wmi (wil,"mgmt_tx failed with status %d\n" , + evt.evt.status); + rc = -EAGAIN ; }kfree (cmd);
@@ -3564,9 +3565,9 @@ int wmi_mgmt_tx_ext(struct wil6210_vif *vif, const u8 *buf, size_t len, rc =wmi_call (wil,WMI_SW_TX_REQ_EXT_CMDID , vif->mid, cmd, total,WMI_SW_TX_COMPLETE_EVENTID , &evt,sizeof (evt),2000 );if (!rc && evt.evt.status !=WMI_FW_STATUS_SUCCESS ) { -wil_err (wil,"mgmt_tx_ext failed with status %d\n" , - evt.evt.status); - rc = -EINVAL ; +wil_dbg_wmi (wil,"mgmt_tx_ext failed with status %d\n" , + evt.evt.status); + rc = -EAGAIN ; }kfree (cmd);
Signature · 1 line
1.9.1
PATCH 19/21 wil6210: add support for ucode tracing
In reply to Maya ErezFrom: Ahmad Masri <[email protected]>
The driver needs to expose RGF_USER_USAGE_2 register that contains the offset of the ucode logging table.
--- drivers/net/wireless/ath/wil6210/debugfs.c | 1 + drivers/net/wireless/ath/wil6210/wil6210.h | 1 + 2 files changed, 2 insertions(+)
drivers/net/wireless/ath/wil6210/debugfs.c +1 -0
@@ -2392,6 +2392,7 @@ static void wil6210_debugfs_init_isr(struct wil6210_priv *wil, {"RGF_MAC_MTRL_COUNTER_0" ,0444 ,HOSTADDR (RGF_MAC_MTRL_COUNTER_0 ), doff_io32}, {"RGF_USER_USAGE_1", 0444, HOSTADDR(RGF_USER_USAGE_1), doff_io32}, + {"RGF_USER_USAGE_2", 0444, HOSTADDR(RGF_USER_USAGE_2), doff_io32}, {}, };
drivers/net/wireless/ath/wil6210/wil6210.h +1 -0
@@ -185,6 +185,7 @@ struct RGF_ICR {/* registers - FW addresses */ #define RGF_USER_USAGE_1 (0x880004) +#define RGF_USER_USAGE_2 (0x880008)#define RGF_USER_USAGE_6 (0x880018)#define BIT_USER_OOB_MODE BIT(31)#define BIT_USER_OOB_R2_MODE BIT(30)
Signature · 1 line
1.9.1
PATCH 21/21 wil6210: print error in FW and board files load failures
In reply to Maya ErezAdd an error print-out in case FW and board files load fails, as such an error is not printed on all failures and user may not understand why the interface up operations didn't succeed.
--- drivers/net/wireless/ath/wil6210/fw_inc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/wil6210/fw_inc.c +5 -1
@@ -1,6 +1,6 @@/* * Copyright (c) 2014-2017 Qualcomm Atheros, Inc. -* Copyright (c) 2018, The Linux Foundation. All rights reserved. +* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above
@@ -647,6 +647,8 @@ int wil_request_firmware(struct wil6210_priv *wil, const char *name, out:release_firmware (fw); +if (rc) +wil_err_fw (wil,"Loading <%s> failed, rc %d\n" , name, rc);return rc; }
@@ -741,6 +743,8 @@ int wil_request_board(struct wil6210_priv *wil, const char *name) out:release_firmware (brd); +if (rc) +wil_err_fw (wil,"Loading <%s> failed, rc %d\n" , name, rc);return rc; }
Signature · 1 line
1.9.1
PATCH 18/21 wil6210: prevent access to RGF_CAF_ICR in Talyn
In reply to Maya ErezDue to access control RGF_CAF_ICR cannot be accessed by host. Such an access will cause device AHB logger to halt and it will not capture future AHB fault if there is any.
--- drivers/net/wireless/ath/wil6210/main.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/net/wireless/ath/wil6210/main.c +0 -5
@@ -1532,11 +1532,6 @@ static void wil_pre_fw_config(struct wil6210_priv *wil)if (wil->hw_version <HW_VER_TALYN_MB ) {wil_s (wil,RGF_CAF_ICR + offsetof(struct RGF_ICR , ICR),0 );wil_w (wil,RGF_CAF_ICR + offsetof(struct RGF_ICR , IMV), ~0 ); - }else { -wil_s (wil, -RGF_CAF_ICR_TALYN_MB + offsetof(struct RGF_ICR , ICR),0 ); -wil_w (wil,RGF_CAF_ICR_TALYN_MB + - offsetof(struct RGF_ICR , IMV), ~0 ); }/* clear PAL_UNIT_ICR (potential D0->D3 leftover) * In Talyn-MB host cannot access this register due to
Signature · 1 line
1.9.1
PATCH 14/21 wil6210: use OEM MAC address from OTP
In reply to Maya ErezFrom: Dedy Lansky <[email protected]>
In addition to existing MAC address field in OTP, new field added for OEM MAC address.
wil6210 gives precedence to the new OEM MAC address and will use it if its valid.
--- drivers/net/wireless/ath/wil6210/main.c | 21 +++++++++++++++------ drivers/net/wireless/ath/wil6210/wil6210.h | 1 + 2 files changed, 16 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/wil6210/main.c +15 -6
@@ -1413,13 +1413,22 @@ static int wil_get_otp_info(struct wil6210_priv *wil)u8 mac[8 ];int mac_addr; -if (wil->hw_version >=HW_VER_TALYN_MB ) - mac_addr =RGF_OTP_MAC_TALYN_MB ; -else - mac_addr =RGF_OTP_MAC ; +/* OEM MAC has precedence */ + mac_addr =RGF_OTP_OEM_MAC ; +wil_memcpy_fromio_32 (mac, wil->csr +HOSTADDR (mac_addr),sizeof (mac)); + +if (is_valid_ether_addr (mac)) { +wil_info (wil,"using OEM MAC %pM\n" , mac); + }else { +if (wil->hw_version >=HW_VER_TALYN_MB ) + mac_addr =RGF_OTP_MAC_TALYN_MB ; +else + mac_addr =RGF_OTP_MAC ; + +wil_memcpy_fromio_32 (mac, wil->csr +HOSTADDR (mac_addr), +sizeof (mac)); + } -wil_memcpy_fromio_32 (mac, wil->csr +HOSTADDR (mac_addr), -sizeof (mac));if (!is_valid_ether_addr (mac)) {wil_err (wil,"Invalid MAC %pM\n" , mac);return -EINVAL ;
drivers/net/wireless/ath/wil6210/wil6210.h +1 -0
@@ -367,6 +367,7 @@ struct RGF_ICR {#define REVISION_ID_SPARROW_D0 (0x3)#define RGF_OTP_MAC_TALYN_MB (0x8a0304) +#define RGF_OTP_OEM_MAC (0x8a0334)#define RGF_OTP_MAC (0x8a0620)/* Talyn-MB */
Signature · 1 line
1.9.1
PATCH 20/21 wil6210: reset buff id in status message after completion
In reply to Maya ErezSince DR bit and buffer id are written in different dwords of the status message, the DR bit can already be set to 1 while the buffer id is not updated yet.
Resetting the buffer id in the status message will allow the driver to identify such cases and re-read the status message until the buffer id is written by HW.
In case DR bit is set but buffer id is zero, need to read the status message again, until a valid id is identified.
In addition to that, move the completed buffer id to the tail of the free list to prevent its immediate reuse in the upcoming refill.
--- drivers/net/wireless/ath/wil6210/debugfs.c | 2 ++ drivers/net/wireless/ath/wil6210/txrx_edma.c | 50 ++++++++++++++++++++++------ drivers/net/wireless/ath/wil6210/txrx_edma.h | 6 ++++ drivers/net/wireless/ath/wil6210/wil6210.h | 1 + 4 files changed, 48 insertions(+), 11 deletions(-)
drivers/net/wireless/ath/wil6210/debugfs.c +2 -0
@@ -207,6 +207,8 @@ static void wil_print_sring(struct seq_file *s, struct wil6210_priv *wil,seq_puts (s,"???\n" ); }seq_printf (s," desc_rdy_pol = %d\n" , sring->desc_rdy_pol); +seq_printf (s," invalid_buff_id_cnt = %d\n" , + sring->invalid_buff_id_cnt);if (sring->va && (sring->size <= (1 <<WIL_RING_SIZE_ORDER_MAX ))) {uint i;
drivers/net/wireless/ath/wil6210/txrx_edma.c +39 -11
100 lines not on this page · raw message
drivers/net/wireless/ath/wil6210/txrx_edma.h +6 -0
@@ -427,6 +427,12 @@ static inline int wil_rx_status_get_eop(void *msg) /* EoP = End of Packet */ 30, 30); } +static inline void wil_rx_status_reset_buff_id (struct wil_status_ring *s) +{ + ((struct wil_rx_status_compressed *) + (s->va + (s->elem_size * s->swhead)))->buff_id =0 ; +} +static inline __le16 wil_rx_status_get_buff_id (void *msg) {return ((struct wil_rx_status_compressed *)msg)->buff_id;
drivers/net/wireless/ath/wil6210/wil6210.h +1 -0
@@ -568,6 +568,7 @@ struct wil_status_ring {bool is_rx;u8 desc_rdy_pol;/* Expected descriptor ready bit polarity */ struct wil_ring_rx_data rx_data; +u32 invalid_buff_id_cnt;/* relevant only for RX */ };#define WIL_STA_TID_NUM (16)
Signature · 1 line
1.9.1
PATCH 16/21 wil6210: fix report of rx packet checksum in edma mode
In reply to Maya ErezFrom: Ahmad Masri <[email protected]>
Update the rx packet checksum of received packet according to edma HW spec:
No need to calculate checksum in the following cases:
L4_status=0 and L3_status=0 - No L3 and no L4 known protocols found L4_status=0 and L3_status=1 - L3 was found, and checksum check passed. No known L4 protocol was found.
L4_status=1 - L4 was found, and checksum check passed.
Recalculate checksum in the following cases:
L4_status=3 and L3_status=1 - It means that L3 protocol was found, and checksum passed, but L4 checksum failed.
L4_status=3 and L3_status=2 - Both L3 and L4 checksum check failed.
--- drivers/net/wireless/ath/wil6210/txrx_edma.c | 21 +------------- drivers/net/wireless/ath/wil6210/txrx_edma.h | 41 +++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 21 deletions(-)
drivers/net/wireless/ath/wil6210/txrx_edma.c +1 -20
@@ -807,18 +807,9 @@ static int wil_rx_error_check_edma(struct wil6210_priv *wil,struct sk_buff *skb, struct wil_net_stats *stats) { - int error; int l2_rx_status; -int l3_rx_status; -int l4_rx_status;void *msg =wil_skb_rxstatus (skb); - error =wil_rx_status_get_error (msg); -if (!error) { - skb->ip_summed =CHECKSUM_UNNECESSARY ; -return 0 ; - } - l2_rx_status =wil_rx_status_get_l2_rx_status (msg);if (l2_rx_status !=0 ) { wil_dbg_txrx(wil, "L2 RX error, l2_rx_status=0x%x\n",
@@ -847,17 +838,7 @@ static int wil_rx_error_check_edma(struct wil6210_priv *wil,return -EFAULT ; } - l3_rx_status =wil_rx_status_get_l3_rx_status (msg); - l4_rx_status =wil_rx_status_get_l4_rx_status (msg); -if (!l3_rx_status && !l4_rx_status) - skb->ip_summed =CHECKSUM_UNNECESSARY ; -/* If HW reports bad checksum, let IP stack re-check it -* For example, HW don't understand Microsoft IP stack that -* mis-calculates TCP checksum - if it should be 0x0, -* it writes 0xffff in violation of RFC 1624 -*/ -else - stats->rx_csum_err++; + skb->ip_summed =wil_rx_status_get_checksum (msg, stats);return 0 ; }
drivers/net/wireless/ath/wil6210/txrx_edma.h +40 -1
51 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 13/21 wil6210: check mid is valid
In reply to Maya ErezFrom: Ahmad Masri <[email protected]>
Check that the mid is valid and that it does not exceed the memory size allocated to vifs array.
--- drivers/net/wireless/ath/wil6210/cfg80211.c | 6 +++--- drivers/net/wireless/ath/wil6210/debugfs.c | 10 +++++----- drivers/net/wireless/ath/wil6210/main.c | 8 ++++---- drivers/net/wireless/ath/wil6210/netdev.c | 10 +++++----- drivers/net/wireless/ath/wil6210/pcie_bus.c | 4 ++-- drivers/net/wireless/ath/wil6210/pm.c | 6 +++--- drivers/net/wireless/ath/wil6210/wil6210.h | 1 + drivers/net/wireless/ath/wil6210/wmi.c | 2 +- 8 files changed, 24 insertions(+), 23 deletions(-)
drivers/net/wireless/ath/wil6210/cfg80211.c +3 -3
@@ -465,7 +465,7 @@ static int wil_cfg80211_validate_add_iface(struct wil6210_priv *wil, .num_different_channels = 1, }; -for (i =0 ; i < wil->max_vifs; i++) { +for (i =0 ; i <GET_MAX_VIFS (wil); i++) {if (wil->vifs[i]) { wdev =vif_to_wdev (wil->vifs[i]); params.iftype_num[wdev->iftype]++;
@@ -486,7 +486,7 @@ static int wil_cfg80211_validate_change_iface(struct wil6210_priv *wil, };bool check_combos = false; -for (i =0 ; i < wil->max_vifs; i++) { +for (i =0 ; i <GET_MAX_VIFS (wil); i++) {struct wil6210_vif *vif_pos = wil->vifs[i];if (vif_pos && vif != vif_pos) {
@@ -1806,7 +1806,7 @@ void wil_cfg80211_ap_recovery(struct wil6210_priv *wil)int rc, i;struct wiphy *wiphy =wil_to_wiphy (wil); -for (i =0 ; i < wil->max_vifs; i++) { +for (i =0 ; i <GET_MAX_VIFS (wil); i++) {struct wil6210_vif *vif = wil->vifs[i];struct net_device *ndev;struct cfg80211_beacon_data bcon = {};
drivers/net/wireless/ath/wil6210/debugfs.c +5 -5
@@ -1381,7 +1381,7 @@ static int link_show(struct seq_file *s, void *data)if (p->status != wil_sta_connected)continue ; - vif = (mid < wil->max_vifs) ? wil->vifs[mid] :NULL ; + vif = (mid <GET_MAX_VIFS (wil)) ? wil->vifs[mid] :NULL ;if (vif) { rc =wil_cid_fill_sinfo (vif, i, sinfo);if (rc)
@@ -1579,7 +1579,7 @@ static int sta_show(struct seq_file *s, void *data)break ; } mid = (p->status != wil_sta_unused) ? p->mid :U8_MAX ; -if (mid < wil->max_vifs) { +if (mid <GET_MAX_VIFS (wil)) {struct wil6210_vif *vif = wil->vifs[mid]; if (vif->wdev.iftype == NL80211_IFTYPE_STATION &&
@@ -1645,7 +1645,7 @@ static int mids_show(struct seq_file *s, void *data)int i;mutex_lock (&wil->vif_mutex); -for (i =0 ; i < wil->max_vifs; i++) { +for (i =0 ; i <GET_MAX_VIFS (wil); i++) { vif = wil->vifs[i];if (vif) {
@@ -1866,7 +1866,7 @@ static int wil_link_stats_debugfs_show(struct seq_file *s, void *data)/* iterate over all MIDs and show per-cid statistics. Then show the * global statistics */ -for (i =0 ; i < wil->max_vifs; i++) { +for (i =0 ; i <GET_MAX_VIFS (wil); i++) { vif = wil->vifs[i];seq_printf (s,"MID %d " , i);
@@ -1922,7 +1922,7 @@ static ssize_t wil_link_stats_write(struct file *file, const char __user *buf,if (rc)return rc; -for (i =0 ; i < wil->max_vifs; i++) { +for (i =0 ; i <GET_MAX_VIFS (wil); i++) { vif = wil->vifs[i];if (!vif)continue ;
drivers/net/wireless/ath/wil6210/main.c +4 -4
@@ -685,7 +685,7 @@ void wil_bcast_fini_all(struct wil6210_priv *wil)int i;struct wil6210_vif *vif; -for (i =0 ; i < wil->max_vifs; i++) { +for (i =0 ; i <GET_MAX_VIFS (wil); i++) { vif = wil->vifs[i];if (vif)wil_bcast_fini (vif);
@@ -1483,7 +1483,7 @@ void wil_abort_scan_all_vifs(struct wil6210_priv *wil, bool sync)lockdep_assert_held (&wil->vif_mutex); -for (i =0 ; i < wil->max_vifs; i++) { +for (i =0 ; i <GET_MAX_VIFS (wil); i++) {struct wil6210_vif *vif = wil->vifs[i];if (vif)
@@ -1551,7 +1551,7 @@ static int wil_restore_vifs(struct wil6210_priv *wil)struct wireless_dev *wdev;int i, rc; -for (i =0 ; i < wil->max_vifs; i++) { +for (i =0 ; i <GET_MAX_VIFS (wil); i++) { vif = wil->vifs[i];if (!vif)continue ;
@@ -1627,7 +1627,7 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)wil_abort_scan_all_vifs (wil, false);mutex_unlock (&wil->vif_mutex); -for (i =0 ; i < wil->max_vifs; i++) { +for (i =0 ; i <GET_MAX_VIFS (wil); i++) { vif = wil->vifs[i];if (vif) {cancel_work_sync (&vif->disconnect_worker);
drivers/net/wireless/ath/wil6210/netdev.c +5 -5
@@ -1,6 +1,6 @@/* * Copyright (c) 2012-2017 Qualcomm Atheros, Inc. -* Copyright (c) 2018, The Linux Foundation. All rights reserved. +* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above
@@ -27,7 +27,7 @@ bool wil_has_other_active_ifaces(struct wil6210_priv *wil,struct wil6210_vif *vif;struct net_device *ndev_i; -for (i =0 ; i < wil->max_vifs; i++) { +for (i =0 ; i <GET_MAX_VIFS (wil); i++) { vif = wil->vifs[i];if (vif) { ndev_i =vif_to_ndev (vif);
@@ -155,7 +155,7 @@ static int wil6210_netdev_poll_tx(struct napi_struct *napi, int budget)struct wil6210_vif *vif;if (!ring->va || !txdata->enabled || - txdata->mid >= wil->max_vifs) + txdata->mid >=GET_MAX_VIFS (wil))continue ; vif = wil->vifs[txdata->mid];
@@ -294,7 +294,7 @@ static u8 wil_vif_find_free_mid(struct wil6210_priv *wil) {u8 i; -for (i =0 ; i < wil->max_vifs; i++) { +for (i =0 ; i <GET_MAX_VIFS (wil); i++) {if (!wil->vifs[i])return i; }
@@ -500,7 +500,7 @@ void wil_vif_remove(struct wil6210_priv *wil, u8 mid)bool any_active =wil_has_active_ifaces (wil, true, false);ASSERT_RTNL (); -if (mid >= wil->max_vifs) { +if (mid >=GET_MAX_VIFS (wil)) {wil_err (wil,"invalid MID: %d\n" , mid);return ; }
drivers/net/wireless/ath/wil6210/pcie_bus.c +2 -2
@@ -1,6 +1,6 @@/* * Copyright (c) 2012-2017 Qualcomm Atheros, Inc. -* Copyright (c) 2018, The Linux Foundation. All rights reserved. +* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above
@@ -176,7 +176,7 @@ static void wil_remove_all_additional_vifs(struct wil6210_priv *wil)struct wil6210_vif *vif;int i; -for (i =1 ; i < wil->max_vifs; i++) { +for (i =1 ; i <GET_MAX_VIFS (wil); i++) { vif = wil->vifs[i];if (vif) {wil_vif_prepare_stop (vif);
drivers/net/wireless/ath/wil6210/pm.c +3 -3
@@ -26,7 +26,7 @@ static void wil_pm_wake_connected_net_queues(struct wil6210_priv *wil)int i;mutex_lock (&wil->vif_mutex); -for (i =0 ; i < wil->max_vifs; i++) { +for (i =0 ; i <GET_MAX_VIFS (wil); i++) {struct wil6210_vif *vif = wil->vifs[i];if (vif &&test_bit (wil_vif_fwconnected, vif->status))
@@ -40,7 +40,7 @@ static void wil_pm_stop_all_net_queues(struct wil6210_priv *wil)int i;mutex_lock (&wil->vif_mutex); -for (i =0 ; i < wil->max_vifs; i++) { +for (i =0 ; i <GET_MAX_VIFS (wil); i++) {struct wil6210_vif *vif = wil->vifs[i];if (vif)
@@ -123,7 +123,7 @@ int wil_can_suspend(struct wil6210_priv *wil, bool is_runtime)/* interface is running */ mutex_lock (&wil->vif_mutex); -for (i =0 ; i < wil->max_vifs; i++) { +for (i =0 ; i <GET_MAX_VIFS (wil); i++) {struct wil6210_vif *vif = wil->vifs[i];if (!vif)
drivers/net/wireless/ath/wil6210/wil6210.h +1 -0
@@ -1061,6 +1061,7 @@ struct wil6210_priv {#define vif_to_wil (v) (v->wil)#define vif_to_ndev (v) (v->ndev)#define vif_to_wdev (v) (&v->wdev) +#define GET_MAX_VIFS (wil) min_t(int, (wil)->max_vifs, WIL_MAX_VIFS)static inline struct wil6210_vif *wdev_to_vif (struct wil6210_priv *wil,struct wireless_dev *wdev)
drivers/net/wireless/ath/wil6210/wmi.c +1 -1
@@ -3205,7 +3205,7 @@ static void wmi_event_handle(struct wil6210_priv *wil,if (mid ==MID_BROADCAST ) mid =0 ; -if (mid >=ARRAY_SIZE (wil->vifs) || mid >= wil->max_vifs) { +if (mid >=GET_MAX_VIFS (wil)) {wil_dbg_wmi (wil,"invalid mid %d, event skipped\n" , mid);return ;
Signature · 1 line
1.9.1
PATCH 10/21 wil6210: increase PCP stop command timeout
In reply to Maya ErezIn case there are connected stations, FW needs to disconnect them before handling PCP stop. This flow can take several seconds.
Increasing PCP stop timeout to 5 seconds to allow that.
--- drivers/net/wireless/ath/wil6210/wmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/wil6210/wmi.c +3 -1
@@ -41,6 +41,7 @@#define WIL_WAIT_FOR_SUSPEND_RESUME_COMP 200#define WIL_WMI_CALL_GENERAL_TO_MS 100 +#define WIL_WMI_PCP_STOP_TO_MS 5000/** * WMI event receiving - theory of operations
@@ -2195,7 +2196,8 @@ int wmi_pcp_stop(struct wil6210_vif *vif)return rc;return wmi_call (wil,WMI_PCP_STOP_CMDID , vif->mid,NULL ,0 , -WMI_PCP_STOPPED_EVENTID ,NULL ,0 ,20 ); +WMI_PCP_STOPPED_EVENTID ,NULL ,0 , +WIL_WMI_PCP_STOP_TO_MS ); }int wmi_set_ssid (struct wil6210_vif *vif,u8 ssid_len,const void *ssid)
Signature · 1 line
1.9.1
PATCH 7/21 wil6210: check null pointer in _wil_cfg80211_merge_extra_ies
In reply to Maya ErezFrom: Alexei Avshalom Lazar <[email protected]>
ies1 or ies2 might be null when code inside _wil_cfg80211_merge_extra_ies access them.
Add explicit check for null and make sure ies1/ies2 are not accessed in such a case.
spos might be null and be accessed inside _wil_cfg80211_merge_extra_ies.
Add explicit check for null in the while condition statement and make sure spos is not accessed in such a case.
--- drivers/net/wireless/ath/wil6210/cfg80211.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/wil6210/cfg80211.c +11 -3
@@ -1580,6 +1580,12 @@ static int _wil_cfg80211_merge_extra_ies(const u8 *ies1, u16 ies1_len,u8 *buf, *dpos;const u8 *spos; +if (!ies1) + ies1_len =0 ; + +if (!ies2) + ies2_len =0 ; +if (ies1_len ==0 && ies2_len ==0 ) { *merged_ies =NULL ; *merged_len =0 ;
@@ -1589,17 +1595,19 @@ static int _wil_cfg80211_merge_extra_ies(const u8 *ies1, u16 ies1_len, buf =kmalloc (ies1_len + ies2_len,GFP_KERNEL );if (!buf)return -ENOMEM ; -memcpy (buf, ies1, ies1_len); +if (ies1) +memcpy (buf, ies1, ies1_len); dpos = buf + ies1_len; spos = ies2; -while (spos +1 < ies2 + ies2_len) { +while (spos && (spos +1 < ies2 + ies2_len)) {/* IE tag at offset 0, length at offset 1 */ u16 ielen =2 + spos[1 ];if (spos + ielen > ies2 + ies2_len)break ;if (spos[0 ] ==WLAN_EID_VENDOR_SPECIFIC && - !_wil_cfg80211_find_ie (ies1, ies1_len, spos, ielen)) { + (!ies1 || !_wil_cfg80211_find_ie (ies1, ies1_len, + spos, ielen))) {memcpy (dpos, spos, ielen); dpos += ielen; }
Signature · 1 line
1.9.1
Quoted 4 lines · Maya Erez
The following set of patches include:
- support up to 20 stations in AP mode
- add support for ucode tracing
- various wil6210 fixes
21 patches is just too much to review. I'll review (and apply) these in smaller sets. Ideally these should have been split into 3 smaller sets and only one set at a time in review queue, that they would be applied a lot faster.
Signature · 1 line
Kalle Valo
Re: [PATCH 03/21] wil6210: support up to 20 stations in AP mode
In reply to Maya ErezQuoted 16 lines · Maya Erez
From: Ahmad Masri <[email protected]>
New FW added support for upto 20 clients in AP mode. Change the driver to support this as well. FW reports it's max supported associations in
WMI_READY_EVENT. Some WMI commands/events use cidxtid field which is limited to 16 cids. Use new cid/tid fields instead.For Rx packets cid from rx descriptor is limited to 3 bits (0..7), to find the real cid, compare transmitter address with the stored stations mac address in the driver sta array.
EDMA FW still supports 8 stations. Extending the support to 20 stations will come later.
Signed-off-by Ahmad Masri <[email protected]>Signed-off-by Maya Erez <[email protected]>
[...]
Quoted 33 lines
drivers/net/wireless/ath/wil6210/wmi.c +11
-2@@ -24,8 +24,9 @@#include "wmi.h" #include "trace.h" -static uint max_assoc_sta =WIL6210_MAX_CID ; -module_param (max_assoc_sta, uint,0644 ); +/* set the default max assoc sta to max supported by driver */ +uint max_assoc_sta =WIL6210_MAX_CID ; +module_param (max_assoc_sta, uint,0444 );MODULE_PARM_DESC (max_assoc_sta," Max number of stations associated to the AP" );int agg_wsize;/* = 0; */ @@ -770,6 +771,7 @@ static void wmi_evt_ready(struct wil6210_vif *vif, int id, void *d, int len)struct wil6210_priv *wil =vif_to_wil (vif);struct wiphy *wiphy =wil_to_wiphy (wil);struct wmi_ready_event *evt = d; +u8 fw_max_assoc_sta; wil_info(wil, "FW ver. %s(SW %d); MAC %pM; %d MID's\n", wil->fw_version, le32_to_cpu(evt->sw_version),@@ -787,6 +789,25 @@ static void wmi_evt_ready(struct wil6210_vif *vif, int id, void *d, int len) evt->rfc_read_calib_result); wil->fw_calib_result = evt->rfc_read_calib_result; } + + fw_max_assoc_sta =WIL6210_RX_DESC_MAX_CID ; +if (len > offsetof(struct wmi_ready_event , max_assoc_sta) && + evt->max_assoc_sta >0 ) { + fw_max_assoc_sta = evt->max_assoc_sta; +wil_dbg_wmi (wil,"fw reported max assoc sta %d\n" , + fw_max_assoc_sta);
drivers/net/wireless/ath/wil6210/wmi.c static void wmi_evt_ready(struct wil6210_vif *vif, int id, void *d, int len) · line 808
Quoted 10 lines
drivers/net/wireless/ath/wil6210/wmi.c +10
-0+ +if (fw_max_assoc_sta >WIL6210_MAX_CID ) { +wil_dbg_wmi (wil, +"fw max assoc sta %d exceeds max driver supported %d\n" , + fw_max_assoc_sta,WIL6210_MAX_CID ); + fw_max_assoc_sta =WIL6210_MAX_CID ; + } + } + + max_assoc_sta =min_t (uint, max_assoc_sta, fw_max_assoc_sta);
You shouldn't modify max_assoc_sta like this. If you have two wil6210 devices on the same host they will share that variable and there's a race condition. Sure, I guess currently they will use the same firmware so the values will be the same, but still this is a bug. I think you should have wil->max_assoc_sta to make this device specific value.
I'll apply this anyway as it breaks all other patches if I remove this patch. But please fix this in a follow up patch.
Signature · 1 line
Kalle Valo
Re: [PATCH 01/21] wil6210: remove rtap_include_phy_info module param
In reply to Maya ErezQuoted 5 lines · Maya Erez
Due to a HW issue in PHY info collection
rtap_include_phy_infois not in use, hence can be removed.Signed-off-by Maya Erez <[email protected]>Signed-off-by Kalle Valo <[email protected]>
7 patches applied to ath-next branch of ath.git, thanks.
387f3794b8cf wil6210: remove rtap_include_phy_info module param 0439a5e035f7 wil6210: add option to drop Tx packets when Tx ring is full bf0353a67491 wil6210: support up to 20 stations in AP mode 6d1ba32c8070 wil6210: accessing 802.3 addresses via utility functions a380eb5736c0 wil6210: fix invalid sta statistics update 979c9d8d01c4 wil6210: ignore HALP ICR if already handled de77a53c2d1e wil6210: check null pointer in _wil_cfg80211_merge_extra_ies
Signature · 3 lines
https://patchwork.kernel.org/patch/10826101/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Re: [PATCH 03/21] wil6210: support up to 20 stations in AP mode
In reply to Kalle ValoQuoted 13 lines · Kalle Valo
Review
Quoted 4 lines · Maya Erez
From: Ahmad Masri <[email protected]>
(quoted diff) +2
-0+ + max_assoc_sta = min_t(uint, max_assoc_sta, fw_max_assoc_sta);You shouldn't modify
max_assoc_stalike this. If you have two wil6210 devices on the same host they will share that variable and there's a race condition. Sure, I guess currently they will use the same firmware so the values will be the same, but still this is a bug. I think you should havewil->max_assoc_stato make this device specific value.
Quoted 2 lines
I'll apply this anyway as it breaks all other patches if I remove this patch. But please fix this in a follow up patch.
we'll fix that.
Signature · 3 lines
Maya Erez Qualcomm Israel, Inc. on behalf of Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH 08/21] wil6210: align to latest auto generated wmi.h
In reply to Maya ErezQuoted 6 lines · Maya Erez
Align to latest version of the auto generated wmi file describing the interface with FW.
Signed-off-by Alexei Avshalom Lazar <[email protected]>Signed-off-by Maya Erez <[email protected]>Signed-off-by Kalle Valo <[email protected]>
8 patches applied to ath-next branch of ath.git, thanks.
73a7d1e34d88 wil6210: align to latest auto generated wmi.h a061894587ef wil6210: prevent device memory access while in reset or suspend 5793fe9d4fde wil6210: increase PCP stop command timeout f6194f769dfc wil6210: do not set BIT_USER_SUPPORT_T_POWER_ON_0 in Talyn-MB 044974fbeade wil6210: update WIL_MCS_MAX to 15e4a29bdd8f82 wil6210: check mid is valid7b834639c4c4 wil6210: use OEM MAC address from OTP29ca376066df wil6210: free edma_rx_swtail upon reset
Signature · 3 lines
https://patchwork.kernel.org/patch/10826115/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Re: [PATCH 16/21] wil6210: fix report of rx packet checksum in edma mode
In reply to Maya ErezQuoted 9 lines · Maya Erez
Update the rx packet checksum of received packet according to edma HW spec:
No need to calculate checksum in the following cases:
L4_status=0 and L3_status=0 - No L3 and no L4 known protocols found L4_status=0 and L3_status=1 - L3 was found, and checksum check passed. No known L4 protocol was found.
L4_status=1 - L4 was found, and checksum check passed.
Quoted 8 lines
Recalculate checksum in the following cases:
L4_status=3 and L3_status=1 - It means that L3 protocol was found, and checksum passed, but L4 checksum failed.
L4_status=3 and L3_status=2 - Both L3 and L4 checksum check failed.Signed-off-by Ahmad Masri <[email protected]>Signed-off-by Maya Erez <[email protected]>Signed-off-by Kalle Valo <[email protected]>
6 patches applied to ath-next branch of ath.git, thanks.
4bf019865cf3 wil6210: fix report of rx packet checksum in edma mode 49122ec42634 wil6210: fix return code of wmi_mgmt_tx and wmi_mgmt_tx_ext 1683a001d5bf wil6210: prevent access to RGF_CAF_ICR in Talyn 8454e72a3644 wil6210: add support for ucode tracing b4a967b7d0f5 wil6210: reset buff id in status message after completion fa0b735414f9 wil6210: print error in FW and board files load failures
Signature · 3 lines
https://patchwork.kernel.org/patch/10826135/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches