* Re: pull-request: mac80211-next 2019-04-26
From: David Miller @ 2019-04-26 20:11 UTC (permalink / raw)
To: johannes; +Cc: netdev, linux-wireless
In-Reply-To: <20190426111139.5831-1-johannes@sipsolutions.net>
From: Johannes Berg <johannes@sipsolutions.net>
Date: Fri, 26 Apr 2019 13:11:38 +0200
> And another set for -next, not that big this time.
> See below for a summary of the highlights.
>
> Please pull and let me know if there's any problem.
Pulled, thanks Johannes.
There was a minor confict in the TX code, two variables being added
from different commits.
Please double check my conflict resolution.
Thank you.
^ permalink raw reply
* Re: [PATCH V2 1/3] mac80211: allow turning TWT responder support on and off via netlink
From: John Crispin @ 2019-04-26 19:53 UTC (permalink / raw)
To: Johannes Berg, Kalle Valo
Cc: linux-wireless, Rajkumar Manoharan, Srini Kode,
Shashidhar Lakkavalli, ath11k
In-Reply-To: <8b456918fc5cd0674f834771be2bb5134bccd26a.camel@sipsolutions.net>
On 26/04/2019 21:51, Johannes Berg wrote:
> On Fri, 2019-04-26 at 21:50 +0200, John Crispin wrote:
>> On 26/04/2019 11:41, John Crispin wrote:
>>> @@ -6105,6 +6106,7 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info)
>>> params.ht_opmode = -1;
>>> params.p2p_ctwindow = -1;
>>> params.p2p_opp_ps = -1;
>>> + params.twt_responder = -1;
>>>
>>> if (info->attrs[NL80211_ATTR_BSS_CTS_PROT])
>>> params.use_cts_prot =
>>> @@ -6149,6 +6151,10 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info)
>>> return -EINVAL;
>>> }
>>>
>>> + if (info->attrs[NL80211_ATTR_TWT_RESPONDER])
>>> + params.twt_responder =
>>> + nla_get_u8(info->attrs[NL80211_ATTR_TWT_RESPONDER]);
>>> +
>>> if (!rdev->ops->change_bss)
>>> return -EOPNOTSUPP;
>> Hi,
>>
>> this should probably be moved to nl80211_start_ap() instead of
>> nl80211_set_bss() as we probably dont want to change this at runtime ?
> I have no idea, can we change it at runtime? Is it a capability or an
> operational state?
>
> johannes
its a capability, only the twt_required bit is an operational state. so
I shall send a V3 moving it to start_ap() :-)
John
^ permalink raw reply
* Re: [PATCH V2 1/3] mac80211: allow turning TWT responder support on and off via netlink
From: Johannes Berg @ 2019-04-26 19:51 UTC (permalink / raw)
To: John Crispin, Kalle Valo
Cc: linux-wireless, Rajkumar Manoharan, Srini Kode,
Shashidhar Lakkavalli, ath11k
In-Reply-To: <2f153f21-17fe-26aa-98a4-b82cdb16ffff@phrozen.org>
On Fri, 2019-04-26 at 21:50 +0200, John Crispin wrote:
> On 26/04/2019 11:41, John Crispin wrote:
> > @@ -6105,6 +6106,7 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info)
> > params.ht_opmode = -1;
> > params.p2p_ctwindow = -1;
> > params.p2p_opp_ps = -1;
> > + params.twt_responder = -1;
> >
> > if (info->attrs[NL80211_ATTR_BSS_CTS_PROT])
> > params.use_cts_prot =
> > @@ -6149,6 +6151,10 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info)
> > return -EINVAL;
> > }
> >
> > + if (info->attrs[NL80211_ATTR_TWT_RESPONDER])
> > + params.twt_responder =
> > + nla_get_u8(info->attrs[NL80211_ATTR_TWT_RESPONDER]);
> > +
> > if (!rdev->ops->change_bss)
> > return -EOPNOTSUPP;
>
> Hi,
>
> this should probably be moved to nl80211_start_ap() instead of
> nl80211_set_bss() as we probably dont want to change this at runtime ?
I have no idea, can we change it at runtime? Is it a capability or an
operational state?
johannes
^ permalink raw reply
* Re: [PATCH V2 1/3] mac80211: allow turning TWT responder support on and off via netlink
From: John Crispin @ 2019-04-26 19:50 UTC (permalink / raw)
To: Johannes Berg, Kalle Valo
Cc: linux-wireless, Rajkumar Manoharan, Srini Kode,
Shashidhar Lakkavalli, ath11k
In-Reply-To: <20190426094150.18078-2-john@phrozen.org>
On 26/04/2019 11:41, John Crispin wrote:
> @@ -6105,6 +6106,7 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info)
> params.ht_opmode = -1;
> params.p2p_ctwindow = -1;
> params.p2p_opp_ps = -1;
> + params.twt_responder = -1;
>
> if (info->attrs[NL80211_ATTR_BSS_CTS_PROT])
> params.use_cts_prot =
> @@ -6149,6 +6151,10 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info)
> return -EINVAL;
> }
>
> + if (info->attrs[NL80211_ATTR_TWT_RESPONDER])
> + params.twt_responder =
> + nla_get_u8(info->attrs[NL80211_ATTR_TWT_RESPONDER]);
> +
> if (!rdev->ops->change_bss)
> return -EOPNOTSUPP;
Hi,
this should probably be moved to nl80211_start_ap() instead of
nl80211_set_bss() as we probably dont want to change this at runtime ?
John
^ permalink raw reply
* Re: [PATCH] mmc: dw_mmc: Disable SDIO interrupts while suspended to fix suspend/resume
From: Emil Renner Berthing @ 2019-04-26 17:19 UTC (permalink / raw)
To: Doug Anderson
Cc: Jaehoon Chung, Ulf Hansson, Shawn Lin, Heiko Stuebner,
Linux MMC List, Brian Norris, linux-wireless, stable,
Linux Kernel Mailing List, open list:ARM/Rockchip SoC...,
Matthias Kaehlcke, Ryan Case, Kalle Valo
In-Reply-To: <CAD=FV=UW6d2QHzxx-Vtr+WwC1dkpUfCjxCLnfaP5S2UQxRh1oQ@mail.gmail.com>
Hi Doug,
TLDR: I'm no longer convinced this patch breaks suspend/resume more
than it already is. Sorry about the noise.
On Thu, 25 Apr 2019 at 23:25, Doug Anderson <dianders@chromium.org> wrote:
>
> Hi,
>
> On Wed, Apr 24, 2019 at 1:19 AM Emil Renner Berthing
> <emil.renner.berthing@gmail.com> wrote:
> >
> > Hi Douglas,
> >
> > Unfortunately this seems to beak resume on my rk3399-gru-kevin. I have
> > a semi-complicated setup with my rootfs as a btrfs on dmcrypt on
> > mmcblk0 which is the dw_mmc, so I'm guessing something goes wrong when
> > waking up the dm_mmc which probably wasn't suspended before this
> > patch. It's not 100% consistent though. Sometimes I see it resume the
> > first time I try suspending, but then 2nd time I suspend it won't come
> > back.
>
> Thanks for testing!
Thanks for your detailed response. It made me want to make absolutely
sure that this patch is the culprit.
As a baseline I booted a vanilla 5.0.9 and suspend/resumed it about a
dusin times without any errors.
So I applied this patch and immediately it crashed on suspend, but in
a way that I could still see the kernel log,
and it was the mwifiex driver that crashed. I rebooted and tried
supend/resume again and
this time it seemed like it was the dwc3 or usb3-phy that crashed.
I still have the kernel log if anyone is interested.
However 3rd time booting 5.0.9 with this patch suspend/resume just works.
At least the 2 dusin times I tried before giving up on making it crash.
I went back to vanilla 5.0.9 and after a few tries I managed to make
that one crash too.
I guess that means this patch is off the hook. I'm sorry about the
false report :/
/Emil
^ permalink raw reply
* Re: [PATCH -next] NFC: st95hf: remove set but not used variables 'dev, nfcddev'
From: David Miller @ 2019-04-26 16:07 UTC (permalink / raw)
To: yuehaibing; +Cc: sameo, daniel, dagmcr, linux-wireless, netdev, kernel-janitors
In-Reply-To: <20190425020720.46560-1-yuehaibing@huawei.com>
From: YueHaibing <yuehaibing@huawei.com>
Date: Thu, 25 Apr 2019 02:07:20 +0000
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/nfc/st95hf/core.c: In function 'st95hf_irq_thread_handler':
> drivers/nfc/st95hf/core.c:786:26: warning:
> variable 'nfcddev' set but not used [-Wunused-but-set-variable]
>
> drivers/nfc/st95hf/core.c:784:17: warning:
> variable 'dev' set but not used [-Wunused-but-set-variable]
>
> They are never used since introduction in
> commit cab47333f0f7 ("NFC: Add STMicroelectronics ST95HF driver")
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Applied, thank you.
^ permalink raw reply
* [PATCH 6/9] wil6210: fix overwriting max_assoc_sta module param
From: Maya Erez @ 2019-04-26 15:43 UTC (permalink / raw)
To: Kalle Valo; +Cc: Ahmad Masri, linux-wireless, wil6210, Maya Erez
In-Reply-To: <1556293417-27097-1-git-send-email-merez@codeaurora.org>
From: Ahmad Masri <amasri@codeaurora.org>
Save the parameter of max_assoc_sta per device.
On fw_ready event calculate the max_assoc_sta and save it per device,
do not overwrite the max_assoc_sta module param.
Signed-off-by: Ahmad Masri <amasri@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
---
drivers/net/wireless/ath/wil6210/cfg80211.c | 4 ++--
drivers/net/wireless/ath/wil6210/debugfs.c | 18 +++++++++---------
drivers/net/wireless/ath/wil6210/main.c | 9 +++++----
drivers/net/wireless/ath/wil6210/rx_reorder.c | 2 +-
drivers/net/wireless/ath/wil6210/txrx.c | 22 +++++++++++-----------
drivers/net/wireless/ath/wil6210/txrx_edma.c | 7 ++++---
drivers/net/wireless/ath/wil6210/wil6210.h | 19 ++++++++++---------
drivers/net/wireless/ath/wil6210/wmi.c | 14 +++++++-------
8 files changed, 49 insertions(+), 46 deletions(-)
diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c
index 218296e..e9780fc 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -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 < max_assoc_sta; i++) {
+ for (i = 0; i < wil->max_assoc_sta; i++) {
if (wil->sta[i].status == wil_sta_unused)
continue;
if (wil->sta[i].mid != mid)
@@ -3020,7 +3020,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 < max_assoc_sta; i++) {
+ for (i = 0; i < wil->max_assoc_sta; i++) {
if (wil->sta[i].mid != vif->mid)
continue;
rc = wil_rf_sector_wmi_set_selected(
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c
index 42507f5..7a2c3fd 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -178,7 +178,7 @@ static int ring_show(struct seq_file *s, void *data)
snprintf(name, sizeof(name), "tx_%2d", i);
- if (cid < max_assoc_sta)
+ if (cid < wil->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,
@@ -839,7 +839,7 @@ 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 >= max_assoc_sta) {
+ if (p1 < 0 || p1 >= wil->max_assoc_sta) {
wil_err(wil, "BACK: invalid CID %d\n", p1);
return -EINVAL;
}
@@ -1290,7 +1290,7 @@ static int bf_show(struct seq_file *s, void *data)
memset(&reply, 0, sizeof(reply));
- for (i = 0; i < max_assoc_sta; i++) {
+ for (i = 0; i < wil->max_assoc_sta; i++) {
u32 status;
cmd.cid = i;
@@ -1387,7 +1387,7 @@ static int link_show(struct seq_file *s, void *data)
if (!sinfo)
return -ENOMEM;
- for (i = 0; i < max_assoc_sta; i++) {
+ for (i = 0; i < wil->max_assoc_sta; i++) {
struct wil_sta_info *p = &wil->sta[i];
char *status = "unknown";
struct wil6210_vif *vif;
@@ -1589,7 +1589,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 < max_assoc_sta; i++) {
+ for (i = 0; i < wil->max_assoc_sta; i++) {
struct wil_sta_info *p = &wil->sta[i];
char *status = "unknown";
u8 aid = 0;
@@ -1698,7 +1698,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 < max_assoc_sta; i++) {
+ for (i = 0; i < wil->max_assoc_sta; i++) {
struct wil_sta_info *p = &wil->sta[i];
char *status = "unknown";
u8 aid = 0;
@@ -1787,7 +1787,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 < max_assoc_sta; i++) {
+ for (i = 0; i < wil->max_assoc_sta; i++) {
struct wil_sta_info *sta = &wil->sta[i];
kfree(sta->tx_latency_bins);
@@ -1872,7 +1872,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 < max_assoc_sta; i++) {
+ for (i = 0; i < wil->max_assoc_sta; i++) {
if (wil->sta[i].status == wil_sta_unused)
continue;
if (wil->sta[i].mid != vif->mid)
@@ -2488,7 +2488,7 @@ void wil6210_debugfs_remove(struct wil6210_priv *wil)
wil->debug = NULL;
kfree(wil->dbg_data.data_arr);
- for (i = 0; i < max_assoc_sta; i++)
+ for (i = 0; i < wil->max_assoc_sta; i++)
kfree(wil->sta[i].tx_latency_bins);
/* free pmc memory without sending command to fw, as it will
diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c
index 03ca8e5..efdb6e1 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -241,7 +241,7 @@ static bool wil_vif_is_connected(struct wil6210_priv *wil, u8 mid)
{
int i;
- for (i = 0; i < max_assoc_sta; i++) {
+ for (i = 0; i < wil->max_assoc_sta; i++) {
if (wil->sta[i].mid == mid &&
wil->sta[i].status == wil_sta_connected)
return true;
@@ -344,7 +344,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 < max_assoc_sta; cid++)
+ for (cid = 0; cid < wil->max_assoc_sta; cid++)
wil_disconnect_cid_complete(vif, cid, reason_code);
}
@@ -456,7 +456,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 < max_assoc_sta; cid++)
+ for (cid = 0; cid < wil->max_assoc_sta; cid++)
wil_disconnect_cid(vif, cid, reason_code);
}
@@ -753,6 +753,7 @@ int wil_priv_init(struct wil6210_priv *wil)
wil->reply_mid = U8_MAX;
wil->max_vifs = 1;
+ wil->max_assoc_sta = max_assoc_sta;
/* edma configuration can be updated via debugfs before allocation */
wil->num_rx_status_rings = WIL_DEFAULT_NUM_RX_STATUS_RINGS;
@@ -1922,7 +1923,7 @@ int wil_find_cid(struct wil6210_priv *wil, u8 mid, const u8 *mac)
int i;
int rc = -ENOENT;
- for (i = 0; i < max_assoc_sta; i++) {
+ for (i = 0; i < wil->max_assoc_sta; i++) {
if (wil->sta[i].mid == mid &&
wil->sta[i].status != wil_sta_unused &&
ether_addr_equal(wil->sta[i].addr, mac)) {
diff --git a/drivers/net/wireless/ath/wil6210/rx_reorder.c b/drivers/net/wireless/ath/wil6210/rx_reorder.c
index 32b14fc..1c79664 100644
--- a/drivers/net/wireless/ath/wil6210/rx_reorder.c
+++ b/drivers/net/wireless/ath/wil6210/rx_reorder.c
@@ -336,7 +336,7 @@ int wil_addba_rx_request(struct wil6210_priv *wil, u8 mid, u8 cid, u8 tid,
might_sleep();
/* sanity checks */
- if (cid >= max_assoc_sta) {
+ if (cid >= wil->max_assoc_sta) {
wil_err(wil, "BACK: invalid CID %d\n", cid);
rc = -EINVAL;
goto out;
diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c
index a8f315b..9bc3bd3 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -411,7 +411,7 @@ static int wil_rx_get_cid_by_skb(struct wil6210_priv *wil, struct sk_buff *skb)
ta = hdr->addr2;
}
- if (max_assoc_sta <= WIL6210_RX_DESC_MAX_CID)
+ if (wil->max_assoc_sta <= WIL6210_RX_DESC_MAX_CID)
return cid;
/* assuming no concurrency between AP interfaces and STA interfaces.
@@ -426,14 +426,14 @@ static int wil_rx_get_cid_by_skb(struct wil6210_priv *wil, struct sk_buff *skb)
* to find the real cid, compare transmitter address with the stored
* stations mac address in the driver sta array
*/
- for (i = cid; i < max_assoc_sta; i += WIL6210_RX_DESC_MAX_CID) {
+ for (i = cid; i < wil->max_assoc_sta; i += WIL6210_RX_DESC_MAX_CID) {
if (wil->sta[i].status != wil_sta_unused &&
ether_addr_equal(wil->sta[i].addr, ta)) {
cid = i;
break;
}
}
- if (i >= max_assoc_sta) {
+ if (i >= wil->max_assoc_sta) {
wil_err_ratelimited(wil, "Could not find cid for frame with transmit addr = %pM, iftype = %d, frametype = %d, len = %d\n",
ta, vif->wdev.iftype, ftype, skb->len);
cid = -ENOENT;
@@ -1063,7 +1063,7 @@ static int wil_vring_init_tx(struct wil6210_vif *vif, int id, int size,
txdata->enabled = 0;
spin_unlock_bh(&txdata->lock);
wil_vring_free(wil, vring);
- wil->ring2cid_tid[id][0] = max_assoc_sta;
+ wil->ring2cid_tid[id][0] = wil->max_assoc_sta;
wil->ring2cid_tid[id][1] = 0;
out:
@@ -1148,7 +1148,7 @@ static int wil_tx_vring_modify(struct wil6210_vif *vif, int ring_id, int cid,
txdata->dot1x_open = false;
txdata->enabled = 0;
spin_unlock_bh(&txdata->lock);
- wil->ring2cid_tid[ring_id][0] = max_assoc_sta;
+ wil->ring2cid_tid[ring_id][0] = wil->max_assoc_sta;
wil->ring2cid_tid[ring_id][1] = 0;
return rc;
}
@@ -1195,7 +1195,7 @@ int wil_vring_init_bcast(struct wil6210_vif *vif, int id, int size)
if (rc)
goto out;
- wil->ring2cid_tid[id][0] = max_assoc_sta; /* CID */
+ wil->ring2cid_tid[id][0] = wil->max_assoc_sta; /* CID */
wil->ring2cid_tid[id][1] = 0; /* TID */
cmd.vring_cfg.tx_sw_ring.ring_mem_base = cpu_to_le64(vring->pa);
@@ -1243,7 +1243,7 @@ static struct wil_ring *wil_find_tx_ucast(struct wil6210_priv *wil,
cid = wil_find_cid(wil, vif->mid, da);
- if (cid < 0 || cid >= max_assoc_sta)
+ if (cid < 0 || cid >= wil->max_assoc_sta)
return NULL;
/* TODO: fix for multiple TID */
@@ -1295,7 +1295,7 @@ static struct wil_ring *wil_find_tx_ring_sta(struct wil6210_priv *wil,
continue;
cid = wil->ring2cid_tid[i][0];
- if (cid >= max_assoc_sta) /* skip BCAST */
+ if (cid >= wil->max_assoc_sta) /* skip BCAST */
continue;
if (!wil->ring_tx_data[i].dot1x_open &&
@@ -1373,7 +1373,7 @@ static struct wil_ring *wil_find_tx_bcast_2(struct wil6210_priv *wil,
continue;
cid = wil->ring2cid_tid[i][0];
- if (cid >= max_assoc_sta) /* skip BCAST */
+ if (cid >= wil->max_assoc_sta) /* skip BCAST */
continue;
if (!wil->ring_tx_data[i].dot1x_open &&
skb->protocol != cpu_to_be16(ETH_P_PAE))
@@ -1401,7 +1401,7 @@ static struct wil_ring *wil_find_tx_bcast_2(struct wil6210_priv *wil,
if (!v2->va || txdata2->mid != vif->mid)
continue;
cid = wil->ring2cid_tid[i][0];
- if (cid >= max_assoc_sta) /* skip BCAST */
+ if (cid >= wil->max_assoc_sta) /* skip BCAST */
continue;
if (!wil->ring_tx_data[i].dot1x_open &&
skb->protocol != cpu_to_be16(ETH_P_PAE))
@@ -2257,7 +2257,7 @@ int wil_tx_complete(struct wil6210_vif *vif, int ringid)
used_before_complete = wil_ring_used_tx(vring);
- if (cid < max_assoc_sta)
+ if (cid < wil->max_assoc_sta)
stats = &wil->sta[cid].stats;
while (!wil_ring_is_empty(vring)) {
diff --git a/drivers/net/wireless/ath/wil6210/txrx_edma.c b/drivers/net/wireless/ath/wil6210/txrx_edma.c
index f6fce6f..f37a205 100644
--- a/drivers/net/wireless/ath/wil6210/txrx_edma.c
+++ b/drivers/net/wireless/ath/wil6210/txrx_edma.c
@@ -734,7 +734,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] = max_assoc_sta;
+ wil->ring2cid_tid[ring_id][0] = wil->max_assoc_sta;
wil->ring2cid_tid[ring_id][1] = 0;
out:
@@ -944,7 +944,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, max_assoc_sta))) {
+ if (unlikely(!wil_val_in_range(cid, 0, wil->max_assoc_sta))) {
wil_err(wil, "Corrupt cid=%d, sring->swhead=%d\n",
cid, sring->swhead);
rxdata->skipping = true;
@@ -1199,7 +1199,8 @@ int wil_tx_sring_handler(struct wil6210_priv *wil,
ndev = vif_to_ndev(vif);
cid = wil->ring2cid_tid[ring_id][0];
- stats = (cid < max_assoc_sta ? &wil->sta[cid].stats : NULL);
+ stats = (cid < wil->max_assoc_sta) ? &wil->sta[cid].stats :
+ NULL;
wil_dbg_txrx(wil,
"tx_status: completed desc_ring (%d), num_descs (%d)\n",
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h
index 1f0175d..4498403 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -461,15 +461,6 @@ static inline void parse_cidxtid(u8 cidxtid, u8 *cid, u8 *tid)
*tid = (cidxtid >> 4) & 0xf;
}
-/**
- * wil_cid_valid - check cid is valid
- * @cid: CID value
- */
-static inline bool wil_cid_valid(u8 cid)
-{
- return (cid >= 0 && cid < max_assoc_sta);
-}
-
struct wil6210_mbox_ring {
u32 base;
u16 entry_size; /* max. size of mbox entry, incl. all headers */
@@ -950,6 +941,8 @@ struct wil6210_priv {
struct wil6210_vif *vifs[WIL_MAX_VIFS];
struct mutex vif_mutex; /* protects access to VIF entries */
atomic_t connected_vifs;
+ u32 max_assoc_sta; /* max sta's supported by the driver and the FW */
+
/* profile */
struct cfg80211_chan_def monitor_chandef;
u32 monitor_flags;
@@ -1147,6 +1140,14 @@ static inline void wil_c(struct wil6210_priv *wil, u32 reg, u32 val)
wil_w(wil, reg, wil_r(wil, reg) & ~val);
}
+/**
+ * wil_cid_valid - check cid is valid
+ */
+static inline bool wil_cid_valid(struct wil6210_priv *wil, u8 cid)
+{
+ return (cid >= 0 && cid < wil->max_assoc_sta);
+}
+
void wil_get_board_file(struct wil6210_priv *wil, char *buf, size_t len);
#if defined(CONFIG_DYNAMIC_DEBUG)
diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c
index d89cd41..0a0818f 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.c
+++ b/drivers/net/wireless/ath/wil6210/wmi.c
@@ -806,8 +806,8 @@ static void wmi_evt_ready(struct wil6210_vif *vif, int id, void *d, int len)
}
}
- max_assoc_sta = min_t(uint, max_assoc_sta, fw_max_assoc_sta);
- wil_dbg_wmi(wil, "setting max assoc sta to %d\n", max_assoc_sta);
+ wil->max_assoc_sta = min_t(uint, max_assoc_sta, fw_max_assoc_sta);
+ wil_dbg_wmi(wil, "setting max assoc sta to %d\n", wil->max_assoc_sta);
wil_set_recovery_state(wil, fw_recovery_idle);
set_bit(wil_status_fwready, wil->status);
@@ -974,7 +974,7 @@ static void wmi_evt_connect(struct wil6210_vif *vif, int id, void *d, int len)
evt->assoc_req_len, evt->assoc_resp_len);
return;
}
- if (evt->cid >= max_assoc_sta) {
+ if (evt->cid >= wil->max_assoc_sta) {
wil_err(wil, "Connect CID invalid : %d\n", evt->cid);
return;
}
@@ -1236,7 +1236,7 @@ static void wmi_evt_ring_en(struct wil6210_vif *vif, int id, void *d, int len)
return;
cid = wil->ring2cid_tid[vri][0];
- if (!wil_cid_valid(cid)) {
+ if (!wil_cid_valid(wil, cid)) {
wil_err(wil, "invalid cid %d for vring %d\n", cid, vri);
return;
}
@@ -1439,7 +1439,7 @@ static void wil_link_stats_store_basic(struct wil6210_vif *vif,
u8 cid = basic->cid;
struct wil_sta_info *sta;
- if (cid < 0 || cid >= max_assoc_sta) {
+ if (cid < 0 || cid >= wil->max_assoc_sta) {
wil_err(wil, "invalid cid %d\n", cid);
return;
}
@@ -1589,7 +1589,7 @@ static int wil_find_cid_ringid_sta(struct wil6210_priv *wil,
continue;
lcid = wil->ring2cid_tid[i][0];
- if (lcid >= max_assoc_sta) /* skip BCAST */
+ if (lcid >= wil->max_assoc_sta) /* skip BCAST */
continue;
wil_dbg_wmi(wil, "find sta -> ringid %d cid %d\n", i, lcid);
@@ -2135,7 +2135,7 @@ int wmi_pcp_start(struct wil6210_vif *vif,
.network_type = wmi_nettype,
.disable_sec_offload = 1,
.channel = chan - 1,
- .pcp_max_assoc_sta = max_assoc_sta,
+ .pcp_max_assoc_sta = wil->max_assoc_sta,
.hidden_ssid = hidden_ssid,
.is_go = is_go,
.ap_sme_offload_mode = disable_ap_sme ?
--
1.9.1
^ permalink raw reply related
* [PATCH 3/9] wil6210: add printout of platform capabilities
From: Maya Erez @ 2019-04-26 15:43 UTC (permalink / raw)
To: Kalle Valo; +Cc: Dedy Lansky, linux-wireless, wil6210, Maya Erez
In-Reply-To: <1556293417-27097-1-git-send-email-merez@codeaurora.org>
From: Dedy Lansky <dlansky@codeaurora.org>
Add logging of the platform capabilities after retrieving it from the
platform driver.
Signed-off-by: Dedy Lansky <dlansky@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
---
drivers/net/wireless/ath/wil6210/pcie_bus.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/wireless/ath/wil6210/pcie_bus.c b/drivers/net/wireless/ath/wil6210/pcie_bus.c
index 3b82d6c..4e2d922 100644
--- a/drivers/net/wireless/ath/wil6210/pcie_bus.c
+++ b/drivers/net/wireless/ath/wil6210/pcie_bus.c
@@ -142,6 +142,8 @@ int wil_set_capabilities(struct wil6210_priv *wil)
min(sizeof(wil->platform_capa), sizeof(platform_capa)));
}
+ wil_info(wil, "platform_capa 0x%lx\n", *wil->platform_capa);
+
/* extract FW capabilities from file without loading the FW */
wil_request_firmware(wil, wil->wil_fw_name, false);
wil_refresh_fw_capabilities(wil);
--
1.9.1
^ permalink raw reply related
* [PATCH 4/9] wil6210: add support for multiple sections in brd file
From: Maya Erez @ 2019-04-26 15:43 UTC (permalink / raw)
To: Kalle Valo; +Cc: Maya Erez, linux-wireless, wil6210
In-Reply-To: <1556293417-27097-1-git-send-email-merez@codeaurora.org>
Current board file loading procedure assumes that the board file
includes only one section.
New board files can include multiple sections.
Add the ability to read multiple addresses and max size from FW
file and load multiple sections from the board file into those
addresses.
Signed-off-by: Maya Erez <merez@codeaurora.org>
---
drivers/net/wireless/ath/wil6210/fw.h | 11 ++-
drivers/net/wireless/ath/wil6210/fw_inc.c | 148 +++++++++++++++++++++--------
drivers/net/wireless/ath/wil6210/main.c | 3 +-
drivers/net/wireless/ath/wil6210/wil6210.h | 9 +-
4 files changed, 126 insertions(+), 45 deletions(-)
diff --git a/drivers/net/wireless/ath/wil6210/fw.h b/drivers/net/wireless/ath/wil6210/fw.h
index 3e7a280..fa31647 100644
--- a/drivers/net/wireless/ath/wil6210/fw.h
+++ b/drivers/net/wireless/ath/wil6210/fw.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2014,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
@@ -109,12 +109,17 @@ struct wil_fw_record_concurrency { /* type == wil_fw_type_comment */
/* brd file info encoded inside a comment record */
#define WIL_BRD_FILE_MAGIC (0xabcddcbb)
+
+struct brd_info {
+ __le32 base_addr;
+ __le32 max_size_bytes;
+} __packed;
+
struct wil_fw_record_brd_file { /* type == wil_fw_type_comment */
/* identifies brd file record */
struct wil_fw_record_comment_hdr hdr;
__le32 version;
- __le32 base_addr;
- __le32 max_size_bytes;
+ struct brd_info brd_info[0];
} __packed;
/* perform action
diff --git a/drivers/net/wireless/ath/wil6210/fw_inc.c b/drivers/net/wireless/ath/wil6210/fw_inc.c
index 3ec0f2f..94ebfa3 100644
--- a/drivers/net/wireless/ath/wil6210/fw_inc.c
+++ b/drivers/net/wireless/ath/wil6210/fw_inc.c
@@ -156,17 +156,52 @@ static int fw_ignore_section(struct wil6210_priv *wil, const void *data,
size_t size)
{
const struct wil_fw_record_brd_file *rec = data;
+ u32 max_num_ent, i, ent_size;
- if (size < sizeof(*rec)) {
- wil_err_fw(wil, "brd_file record too short: %zu\n", size);
- return 0;
+ if (size <= offsetof(struct wil_fw_record_brd_file, brd_info)) {
+ wil_err(wil, "board record too short, size %zu\n", size);
+ return -EINVAL;
+ }
+
+ ent_size = size - offsetof(struct wil_fw_record_brd_file, brd_info);
+ max_num_ent = ent_size / sizeof(struct brd_info);
+
+ if (!max_num_ent) {
+ wil_err(wil, "brd info entries are missing\n");
+ return -EINVAL;
}
- wil->brd_file_addr = le32_to_cpu(rec->base_addr);
- wil->brd_file_max_size = le32_to_cpu(rec->max_size_bytes);
+ wil->brd_info = kcalloc(max_num_ent, sizeof(struct wil_brd_info),
+ GFP_KERNEL);
+ if (!wil->brd_info)
+ return -ENOMEM;
- wil_dbg_fw(wil, "brd_file_addr 0x%x, brd_file_max_size %d\n",
- wil->brd_file_addr, wil->brd_file_max_size);
+ for (i = 0; i < max_num_ent; i++) {
+ wil->brd_info[i].file_addr =
+ le32_to_cpu(rec->brd_info[i].base_addr);
+ wil->brd_info[i].file_max_size =
+ le32_to_cpu(rec->brd_info[i].max_size_bytes);
+
+ if (!wil->brd_info[i].file_addr)
+ break;
+
+ wil_dbg_fw(wil,
+ "brd info %d: file_addr 0x%x, file_max_size %d\n",
+ i, wil->brd_info[i].file_addr,
+ wil->brd_info[i].file_max_size);
+ }
+
+ wil->num_of_brd_entries = i;
+ if (wil->num_of_brd_entries == 0) {
+ kfree(wil->brd_info);
+ wil->brd_info = NULL;
+ wil_dbg_fw(wil,
+ "no valid brd info entries, using brd file addr\n");
+
+ } else {
+ wil_dbg_fw(wil, "num of brd info entries %d\n",
+ wil->num_of_brd_entries);
+ }
return 0;
}
@@ -634,6 +669,11 @@ int wil_request_firmware(struct wil6210_priv *wil, const char *name,
}
wil_dbg_fw(wil, "Loading <%s>, %zu bytes\n", name, fw->size);
+ /* re-initialize board info params */
+ wil->num_of_brd_entries = 0;
+ kfree(wil->brd_info);
+ wil->brd_info = NULL;
+
for (sz = fw->size, d = fw->data; sz; sz -= rc1, d += rc1) {
rc1 = wil_fw_verify(wil, d, sz);
if (rc1 < 0) {
@@ -662,11 +702,13 @@ static int wil_brd_process(struct wil6210_priv *wil, const void *data,
{
int rc = 0;
const struct wil_fw_record_head *hdr = data;
- size_t s, hdr_sz;
+ size_t s, hdr_sz = 0;
u16 type;
+ int i = 0;
- /* Assuming the board file includes only one header record and one data
- * record. Each record starts with wil_fw_record_head.
+ /* Assuming the board file includes only one file header
+ * and one or several data records.
+ * Each record starts with wil_fw_record_head.
*/
if (size < sizeof(*hdr))
return -EINVAL;
@@ -674,40 +716,67 @@ static int wil_brd_process(struct wil6210_priv *wil, const void *data,
if (s > size)
return -EINVAL;
- /* Skip the header record and handle the data record */
- hdr = (const void *)hdr + s;
+ /* Skip the header record and handle the data records */
size -= s;
- if (size < sizeof(*hdr))
- return -EINVAL;
- hdr_sz = le32_to_cpu(hdr->size);
- if (wil->brd_file_max_size && hdr_sz > wil->brd_file_max_size)
- return -EINVAL;
- if (sizeof(*hdr) + hdr_sz > size)
- return -EINVAL;
- if (hdr_sz % 4) {
- wil_err_fw(wil, "unaligned record size: %zu\n",
- hdr_sz);
- return -EINVAL;
- }
- type = le16_to_cpu(hdr->type);
- if (type != wil_fw_type_data) {
- wil_err_fw(wil, "invalid record type for board file: %d\n",
- type);
- return -EINVAL;
+ for (hdr = data + s;; hdr = (const void *)hdr + s, size -= s, i++) {
+ if (size < sizeof(*hdr))
+ break;
+
+ if (i >= wil->num_of_brd_entries) {
+ wil_err_fw(wil,
+ "Too many brd records: %d, num of expected entries %d\n",
+ i, wil->num_of_brd_entries);
+ break;
+ }
+
+ hdr_sz = le32_to_cpu(hdr->size);
+ s = sizeof(*hdr) + hdr_sz;
+ if (wil->brd_info[i].file_max_size &&
+ hdr_sz > wil->brd_info[i].file_max_size)
+ return -EINVAL;
+ if (sizeof(*hdr) + hdr_sz > size)
+ return -EINVAL;
+ if (hdr_sz % 4) {
+ wil_err_fw(wil, "unaligned record size: %zu\n",
+ hdr_sz);
+ return -EINVAL;
+ }
+ type = le16_to_cpu(hdr->type);
+ if (type != wil_fw_type_data) {
+ wil_err_fw(wil,
+ "invalid record type for board file: %d\n",
+ type);
+ return -EINVAL;
+ }
+ if (hdr_sz < sizeof(struct wil_fw_record_data)) {
+ wil_err_fw(wil, "data record too short: %zu\n", hdr_sz);
+ return -EINVAL;
+ }
+
+ wil_dbg_fw(wil,
+ "using info from fw file for record %d: addr[0x%08x], max size %d\n",
+ i, wil->brd_info[i].file_addr,
+ wil->brd_info[i].file_max_size);
+
+ rc = __fw_handle_data(wil, &hdr[1], hdr_sz,
+ cpu_to_le32(wil->brd_info[i].file_addr));
+ if (rc)
+ return rc;
}
- if (hdr_sz < sizeof(struct wil_fw_record_data)) {
- wil_err_fw(wil, "data record too short: %zu\n", hdr_sz);
+
+ if (size) {
+ wil_err_fw(wil, "unprocessed bytes: %zu\n", size);
+ if (size >= sizeof(*hdr)) {
+ wil_err_fw(wil,
+ "Stop at offset %ld record type %d [%zd bytes]\n",
+ (long)((const void *)hdr - data),
+ le16_to_cpu(hdr->type), hdr_sz);
+ }
return -EINVAL;
}
- wil_dbg_fw(wil, "using addr from fw file: [0x%08x]\n",
- wil->brd_file_addr);
-
- rc = __fw_handle_data(wil, &hdr[1], hdr_sz,
- cpu_to_le32(wil->brd_file_addr));
-
- return rc;
+ return 0;
}
/**
@@ -738,7 +807,8 @@ int wil_request_board(struct wil6210_priv *wil, const char *name)
rc = dlen;
goto out;
}
- /* Process the data record */
+
+ /* Process the data records */
rc = wil_brd_process(wil, brd->data, dlen);
out:
diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c
index 9b9c9ec..03ca8e5 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -838,6 +838,7 @@ void wil_priv_deinit(struct wil6210_priv *wil)
wmi_event_flush(wil);
destroy_workqueue(wil->wq_service);
destroy_workqueue(wil->wmi_wq);
+ kfree(wil->brd_info);
}
static void wil_shutdown_bl(struct wil6210_priv *wil)
@@ -1709,7 +1710,7 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)
rc = wil_request_firmware(wil, wil->wil_fw_name, true);
if (rc)
goto out;
- if (wil->brd_file_addr)
+ if (wil->num_of_brd_entries)
rc = wil_request_board(wil, board_file);
else
rc = wil_request_firmware(wil, board_file, true);
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h
index 8724d99..dc40002 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -913,6 +913,11 @@ struct wil_fw_stats_global {
struct wmi_link_stats_global stats;
};
+struct wil_brd_info {
+ u32 file_addr;
+ u32 file_max_size;
+};
+
struct wil6210_priv {
struct pci_dev *pdev;
u32 bar_size;
@@ -927,8 +932,8 @@ struct wil6210_priv {
const char *hw_name;
const char *wil_fw_name;
char *board_file;
- u32 brd_file_addr;
- u32 brd_file_max_size;
+ u32 num_of_brd_entries;
+ struct wil_brd_info *brd_info;
DECLARE_BITMAP(hw_capa, hw_capa_last);
DECLARE_BITMAP(fw_capabilities, WMI_FW_CAPABILITY_MAX);
DECLARE_BITMAP(platform_capa, WIL_PLATFORM_CAPA_MAX);
--
1.9.1
^ permalink raw reply related
* [PATCH 2/9] wil6210: fix _desc access in __wil_tx_vring_tso
From: Maya Erez @ 2019-04-26 15:43 UTC (permalink / raw)
To: Kalle Valo; +Cc: Alexei Avshalom Lazar, linux-wireless, wil6210, Maya Erez
In-Reply-To: <1556293417-27097-1-git-send-email-merez@codeaurora.org>
From: Alexei Avshalom Lazar <ailizaro@codeaurora.org>
_desc is defined in __wil_tx_vring_tso() and may not be set in
case len is 0, verify _desc is set.
Signed-off-by: Alexei Avshalom Lazar <ailizaro@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
---
drivers/net/wireless/ath/wil6210/txrx.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c
index 4ccfd14..a8f315b 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -1760,6 +1760,9 @@ static int __wil_tx_vring_tso(struct wil6210_priv *wil, struct wil6210_vif *vif,
}
}
+ if (!_desc)
+ goto mem_error;
+
/* first descriptor may also be the last.
* in this case d pointer is invalid
*/
--
1.9.1
^ permalink raw reply related
* [PATCH 9/9] wil6210: remove HALP for Talyn devices
From: Maya Erez @ 2019-04-26 15:43 UTC (permalink / raw)
To: Kalle Valo; +Cc: Maya Erez, linux-wireless, wil6210
In-Reply-To: <1556293417-27097-1-git-send-email-merez@codeaurora.org>
In Talyn the HW is responsible for power management enter / exit
flow, hence the deep sleep exit latency is significantly shorter than
in Sparrow.
In such a case HALP feature, that is meant to prevent long PCIe blocking
accesses, is no longer needed and can be removed for Talyn.
Signed-off-by: Maya Erez <merez@codeaurora.org>
---
drivers/net/wireless/ath/wil6210/main.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c
index efdb6e1..3c30076 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -1940,6 +1940,9 @@ void wil_halp_vote(struct wil6210_priv *wil)
unsigned long rc;
unsigned long to_jiffies = msecs_to_jiffies(WAIT_FOR_HALP_VOTE_MS);
+ if (wil->hw_version >= HW_VER_TALYN_MB)
+ return;
+
mutex_lock(&wil->halp.lock);
wil_dbg_irq(wil, "halp_vote: start, HALP ref_cnt (%d)\n",
@@ -1971,6 +1974,9 @@ void wil_halp_vote(struct wil6210_priv *wil)
void wil_halp_unvote(struct wil6210_priv *wil)
{
+ if (wil->hw_version >= HW_VER_TALYN_MB)
+ return;
+
WARN_ON(wil->halp.ref_cnt == 0);
mutex_lock(&wil->halp.lock);
--
1.9.1
^ permalink raw reply related
* [PATCH 1/9] wil6210: fix spurious interrupts in 3-msi
From: Maya Erez @ 2019-04-26 15:43 UTC (permalink / raw)
To: Kalle Valo; +Cc: Maya Erez, linux-wireless, wil6210
In-Reply-To: <1556293417-27097-1-git-send-email-merez@codeaurora.org>
Interrupt is set in ICM (ICR & ~IMV) rising trigger.
As the driver masks the IRQ after clearing it, there can
be a race where an additional spurious interrupt is triggered
when the driver unmask the IRQ.
This can happen in case HW triggers an interrupt after the clear
and before the mask.
To prevent the second spurious interrupt the driver needs to mask the
IRQ before reading and clearing it.
Signed-off-by: Maya Erez <merez@codeaurora.org>
---
drivers/net/wireless/ath/wil6210/interrupt.c | 65 +++++++++++++++++-----------
1 file changed, 40 insertions(+), 25 deletions(-)
diff --git a/drivers/net/wireless/ath/wil6210/interrupt.c b/drivers/net/wireless/ath/wil6210/interrupt.c
index 3f5bd17..d161dc9 100644
--- a/drivers/net/wireless/ath/wil6210/interrupt.c
+++ b/drivers/net/wireless/ath/wil6210/interrupt.c
@@ -296,21 +296,24 @@ void wil_configure_interrupt_moderation(struct wil6210_priv *wil)
static irqreturn_t wil6210_irq_rx(int irq, void *cookie)
{
struct wil6210_priv *wil = cookie;
- u32 isr = wil_ioread32_and_clear(wil->csr +
- HOSTADDR(RGF_DMA_EP_RX_ICR) +
- offsetof(struct RGF_ICR, ICR));
+ u32 isr;
bool need_unmask = true;
+ wil6210_mask_irq_rx(wil);
+
+ isr = wil_ioread32_and_clear(wil->csr +
+ HOSTADDR(RGF_DMA_EP_RX_ICR) +
+ offsetof(struct RGF_ICR, ICR));
+
trace_wil6210_irq_rx(isr);
wil_dbg_irq(wil, "ISR RX 0x%08x\n", isr);
if (unlikely(!isr)) {
wil_err_ratelimited(wil, "spurious IRQ: RX\n");
+ wil6210_unmask_irq_rx(wil);
return IRQ_NONE;
}
- wil6210_mask_irq_rx(wil);
-
/* RX_DONE and RX_HTRSH interrupts are the same if interrupt
* moderation is not used. Interrupt moderation may cause RX
* buffer overflow while RX_DONE is delayed. The required
@@ -355,21 +358,24 @@ static irqreturn_t wil6210_irq_rx(int irq, void *cookie)
static irqreturn_t wil6210_irq_rx_edma(int irq, void *cookie)
{
struct wil6210_priv *wil = cookie;
- u32 isr = wil_ioread32_and_clear(wil->csr +
- HOSTADDR(RGF_INT_GEN_RX_ICR) +
- offsetof(struct RGF_ICR, ICR));
+ u32 isr;
bool need_unmask = true;
+ wil6210_mask_irq_rx_edma(wil);
+
+ isr = wil_ioread32_and_clear(wil->csr +
+ HOSTADDR(RGF_INT_GEN_RX_ICR) +
+ offsetof(struct RGF_ICR, ICR));
+
trace_wil6210_irq_rx(isr);
wil_dbg_irq(wil, "ISR RX 0x%08x\n", isr);
if (unlikely(!isr)) {
wil_err(wil, "spurious IRQ: RX\n");
+ wil6210_unmask_irq_rx_edma(wil);
return IRQ_NONE;
}
- wil6210_mask_irq_rx_edma(wil);
-
if (likely(isr & BIT_RX_STATUS_IRQ)) {
wil_dbg_irq(wil, "RX status ring\n");
isr &= ~BIT_RX_STATUS_IRQ;
@@ -403,21 +409,24 @@ static irqreturn_t wil6210_irq_rx_edma(int irq, void *cookie)
static irqreturn_t wil6210_irq_tx_edma(int irq, void *cookie)
{
struct wil6210_priv *wil = cookie;
- u32 isr = wil_ioread32_and_clear(wil->csr +
- HOSTADDR(RGF_INT_GEN_TX_ICR) +
- offsetof(struct RGF_ICR, ICR));
+ u32 isr;
bool need_unmask = true;
+ wil6210_mask_irq_tx_edma(wil);
+
+ isr = wil_ioread32_and_clear(wil->csr +
+ HOSTADDR(RGF_INT_GEN_TX_ICR) +
+ offsetof(struct RGF_ICR, ICR));
+
trace_wil6210_irq_tx(isr);
wil_dbg_irq(wil, "ISR TX 0x%08x\n", isr);
if (unlikely(!isr)) {
wil_err(wil, "spurious IRQ: TX\n");
+ wil6210_unmask_irq_tx_edma(wil);
return IRQ_NONE;
}
- wil6210_mask_irq_tx_edma(wil);
-
if (likely(isr & BIT_TX_STATUS_IRQ)) {
wil_dbg_irq(wil, "TX status ring\n");
isr &= ~BIT_TX_STATUS_IRQ;
@@ -446,21 +455,24 @@ static irqreturn_t wil6210_irq_tx_edma(int irq, void *cookie)
static irqreturn_t wil6210_irq_tx(int irq, void *cookie)
{
struct wil6210_priv *wil = cookie;
- u32 isr = wil_ioread32_and_clear(wil->csr +
- HOSTADDR(RGF_DMA_EP_TX_ICR) +
- offsetof(struct RGF_ICR, ICR));
+ u32 isr;
bool need_unmask = true;
+ wil6210_mask_irq_tx(wil);
+
+ isr = wil_ioread32_and_clear(wil->csr +
+ HOSTADDR(RGF_DMA_EP_TX_ICR) +
+ offsetof(struct RGF_ICR, ICR));
+
trace_wil6210_irq_tx(isr);
wil_dbg_irq(wil, "ISR TX 0x%08x\n", isr);
if (unlikely(!isr)) {
wil_err_ratelimited(wil, "spurious IRQ: TX\n");
+ wil6210_unmask_irq_tx(wil);
return IRQ_NONE;
}
- wil6210_mask_irq_tx(wil);
-
if (likely(isr & BIT_DMA_EP_TX_ICR_TX_DONE)) {
wil_dbg_irq(wil, "TX done\n");
isr &= ~BIT_DMA_EP_TX_ICR_TX_DONE;
@@ -532,20 +544,23 @@ static bool wil_validate_mbox_regs(struct wil6210_priv *wil)
static irqreturn_t wil6210_irq_misc(int irq, void *cookie)
{
struct wil6210_priv *wil = cookie;
- u32 isr = wil_ioread32_and_clear(wil->csr +
- HOSTADDR(RGF_DMA_EP_MISC_ICR) +
- offsetof(struct RGF_ICR, ICR));
+ u32 isr;
+
+ wil6210_mask_irq_misc(wil, false);
+
+ isr = wil_ioread32_and_clear(wil->csr +
+ HOSTADDR(RGF_DMA_EP_MISC_ICR) +
+ offsetof(struct RGF_ICR, ICR));
trace_wil6210_irq_misc(isr);
wil_dbg_irq(wil, "ISR MISC 0x%08x\n", isr);
if (!isr) {
wil_err(wil, "spurious IRQ: MISC\n");
+ wil6210_unmask_irq_misc(wil, false);
return IRQ_NONE;
}
- wil6210_mask_irq_misc(wil, false);
-
if (isr & ISR_MISC_FW_ERROR) {
u32 fw_assert_code = wil_r(wil, wil->rgf_fw_assert_code_addr);
u32 ucode_assert_code =
--
1.9.1
^ permalink raw reply related
* [PATCH 5/9] wil6210: enhancements for descriptor and status ring debugfs
From: Maya Erez @ 2019-04-26 15:43 UTC (permalink / raw)
To: Kalle Valo; +Cc: Dedy Lansky, linux-wireless, wil6210, Maya Erez
In-Reply-To: <1556293417-27097-1-git-send-email-merez@codeaurora.org>
From: Dedy Lansky <dlansky@codeaurora.org>
Add printing of hwhead as part of desc ring and status ring debugfs.
Validate wil->rx_buff_mgmt and ring->ctx arrays before accessing them.
Dump Tx descriptor content even when it indicates invalid buff_id.
Signed-off-by: Dedy Lansky <dlansky@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
---
drivers/net/wireless/ath/wil6210/debugfs.c | 52 +++++++++++++++++++++++-------
drivers/net/wireless/ath/wil6210/wil6210.h | 5 +++
2 files changed, 45 insertions(+), 12 deletions(-)
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c
index df2adff..42507f5 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -63,7 +63,9 @@ static void wil_print_desc_edma(struct seq_file *s, struct wil6210_priv *wil,
&ring->va[idx].rx.enhanced;
u16 buff_id = le16_to_cpu(rx_d->mac.buff_id);
- has_skb = wil->rx_buff_mgmt.buff_arr[buff_id].skb;
+ if (wil->rx_buff_mgmt.buff_arr &&
+ wil_val_in_range(buff_id, 0, wil->rx_buff_mgmt.size))
+ has_skb = wil->rx_buff_mgmt.buff_arr[buff_id].skb;
seq_printf(s, "%c", (has_skb) ? _h : _s);
} else {
struct wil_tx_enhanced_desc *d =
@@ -71,9 +73,9 @@ static void wil_print_desc_edma(struct seq_file *s, struct wil6210_priv *wil,
&ring->va[idx].tx.enhanced;
num_of_descs = (u8)d->mac.d[2];
- has_skb = ring->ctx[idx].skb;
+ has_skb = ring->ctx && ring->ctx[idx].skb;
if (num_of_descs >= 1)
- seq_printf(s, "%c", ring->ctx[idx].skb ? _h : _s);
+ seq_printf(s, "%c", has_skb ? _h : _s);
else
/* num_of_descs == 0, it's a frag in a list of descs */
seq_printf(s, "%c", has_skb ? 'h' : _s);
@@ -84,7 +86,7 @@ static void wil_print_ring(struct seq_file *s, struct wil6210_priv *wil,
const char *name, struct wil_ring *ring,
char _s, char _h)
{
- void __iomem *x = wmi_addr(wil, ring->hwtail);
+ void __iomem *x;
u32 v;
seq_printf(s, "RING %s = {\n", name);
@@ -96,7 +98,21 @@ static void wil_print_ring(struct seq_file *s, struct wil6210_priv *wil,
else
seq_printf(s, " swtail = %d\n", ring->swtail);
seq_printf(s, " swhead = %d\n", ring->swhead);
+ if (wil->use_enhanced_dma_hw) {
+ int ring_id = ring->is_rx ?
+ WIL_RX_DESC_RING_ID : ring - wil->ring_tx;
+ /* SUBQ_CONS is a table of 32 entries, one for each Q pair.
+ * lower 16bits are for even ring_id and upper 16bits are for
+ * odd ring_id
+ */
+ x = wmi_addr(wil, RGF_DMA_SCM_SUBQ_CONS + 4 * (ring_id / 2));
+ v = readl_relaxed(x);
+
+ v = (ring_id % 2 ? (v >> 16) : (v & 0xffff));
+ seq_printf(s, " hwhead = %u\n", v);
+ }
seq_printf(s, " hwtail = [0x%08x] -> ", ring->hwtail);
+ x = wmi_addr(wil, ring->hwtail);
if (x) {
v = readl(x);
seq_printf(s, "0x%08x = %d\n", v, v);
@@ -188,7 +204,7 @@ static int ring_show(struct seq_file *s, void *data)
static void wil_print_sring(struct seq_file *s, struct wil6210_priv *wil,
struct wil_status_ring *sring)
{
- void __iomem *x = wmi_addr(wil, sring->hwtail);
+ void __iomem *x;
int sring_idx = sring - wil->srings;
u32 v;
@@ -199,7 +215,19 @@ static void wil_print_sring(struct seq_file *s, struct wil6210_priv *wil,
seq_printf(s, " size = %d\n", sring->size);
seq_printf(s, " elem_size = %zu\n", sring->elem_size);
seq_printf(s, " swhead = %d\n", sring->swhead);
+ if (wil->use_enhanced_dma_hw) {
+ /* COMPQ_PROD is a table of 32 entries, one for each Q pair.
+ * lower 16bits are for even ring_id and upper 16bits are for
+ * odd ring_id
+ */
+ x = wmi_addr(wil, RGF_DMA_SCM_COMPQ_PROD + 4 * (sring_idx / 2));
+ v = readl_relaxed(x);
+
+ v = (sring_idx % 2 ? (v >> 16) : (v & 0xffff));
+ seq_printf(s, " hwhead = %u\n", v);
+ }
seq_printf(s, " hwtail = [0x%08x] -> ", sring->hwtail);
+ x = wmi_addr(wil, sring->hwtail);
if (x) {
v = readl_relaxed(x);
seq_printf(s, "0x%08x = %d\n", v, v);
@@ -1091,19 +1119,18 @@ static int txdesc_show(struct seq_file *s, void *data)
if (wil->use_enhanced_dma_hw) {
if (tx) {
- skb = ring->ctx[txdesc_idx].skb;
- } else {
+ skb = ring->ctx ? ring->ctx[txdesc_idx].skb : NULL;
+ } else if (wil->rx_buff_mgmt.buff_arr) {
struct wil_rx_enhanced_desc *rx_d =
(struct wil_rx_enhanced_desc *)
&ring->va[txdesc_idx].rx.enhanced;
u16 buff_id = le16_to_cpu(rx_d->mac.buff_id);
if (!wil_val_in_range(buff_id, 0,
- wil->rx_buff_mgmt.size)) {
+ wil->rx_buff_mgmt.size))
seq_printf(s, "invalid buff_id %d\n", buff_id);
- return 0;
- }
- skb = wil->rx_buff_mgmt.buff_arr[buff_id].skb;
+ else
+ skb = wil->rx_buff_mgmt.buff_arr[buff_id].skb;
}
} else {
skb = ring->ctx[txdesc_idx].skb;
@@ -1136,7 +1163,7 @@ static int status_msg_show(struct seq_file *s, void *data)
struct wil6210_priv *wil = s->private;
int sring_idx = dbg_sring_index;
struct wil_status_ring *sring;
- bool tx = sring_idx == wil->tx_sring_idx ? 1 : 0;
+ bool tx;
u32 status_msg_idx = dbg_status_msg_index;
u32 *u;
@@ -1146,6 +1173,7 @@ static int status_msg_show(struct seq_file *s, void *data)
}
sring = &wil->srings[sring_idx];
+ tx = !sring->is_rx;
if (!sring->va) {
seq_printf(s, "No %cX status ring\n", tx ? 'T' : 'R');
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h
index dc40002..1f0175d 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -335,6 +335,11 @@ struct RGF_ICR {
#define BIT_BOOT_FROM_ROM BIT(31)
/* eDMA */
+#define RGF_SCM_PTRS_SUBQ_RD_PTR (0x8b4000)
+#define RGF_SCM_PTRS_COMPQ_RD_PTR (0x8b4100)
+#define RGF_DMA_SCM_SUBQ_CONS (0x8b60ec)
+#define RGF_DMA_SCM_COMPQ_PROD (0x8b616c)
+
#define RGF_INT_COUNT_ON_SPECIAL_EVT (0x8b62d8)
#define RGF_INT_CTRL_INT_GEN_CFG_0 (0x8bc000)
--
1.9.1
^ permalink raw reply related
* [PATCH 0/9] wil6210 patches
From: Maya Erez @ 2019-04-26 15:43 UTC (permalink / raw)
To: Kalle Valo; +Cc: Maya Erez, linux-wireless, wil6210
The following patches include;
- Various wil6210 bug fixes
- Support handling of multiple section in board file
Ahmad Masri (1):
wil6210: fix overwriting max_assoc_sta module param
Alexei Avshalom Lazar (1):
wil6210: fix _desc access in __wil_tx_vring_tso
Dedy Lansky (3):
wil6210: add printout of platform capabilities
wil6210: enhancements for descriptor and status ring debugfs
wil6210: check rx_buff_mgmt before accessing it
Maya Erez (4):
wil6210: fix spurious interrupts in 3-msi
wil6210: add support for multiple sections in brd file
wil6210: fix missed MISC mbox interrupt
wil6210: remove HALP for Talyn devices
drivers/net/wireless/ath/wil6210/cfg80211.c | 4 +-
drivers/net/wireless/ath/wil6210/debugfs.c | 70 ++++++++----
drivers/net/wireless/ath/wil6210/fw.h | 11 +-
drivers/net/wireless/ath/wil6210/fw_inc.c | 148 +++++++++++++++++++-------
drivers/net/wireless/ath/wil6210/interrupt.c | 67 +++++++-----
drivers/net/wireless/ath/wil6210/main.c | 18 +++-
drivers/net/wireless/ath/wil6210/pcie_bus.c | 2 +
drivers/net/wireless/ath/wil6210/rx_reorder.c | 2 +-
drivers/net/wireless/ath/wil6210/txrx.c | 25 +++--
drivers/net/wireless/ath/wil6210/txrx_edma.c | 10 +-
drivers/net/wireless/ath/wil6210/wil6210.h | 33 ++++--
drivers/net/wireless/ath/wil6210/wmi.c | 14 +--
12 files changed, 275 insertions(+), 129 deletions(-)
--
1.9.1
^ permalink raw reply
* [PATCH 7/9] wil6210: fix missed MISC mbox interrupt
From: Maya Erez @ 2019-04-26 15:43 UTC (permalink / raw)
To: Kalle Valo; +Cc: Maya Erez, linux-wireless, wil6210
In-Reply-To: <1556293417-27097-1-git-send-email-merez@codeaurora.org>
When MISC interrupt is triggered due to HALP bit, in parallel
to mbox events handling by the MISC threaded IRQ, new mbox
interrupt can be missed in the following scenario:
1. MISC ICR is read in the IRQ handler
2. Threaded IRQ is completed and all MISC interrupts are unmasked
3. mbox interrupt is set by FW
4. HALP is masked
The mbox interrupt in step 3 can be missed due to constant high level
of ICM.
Masking all MISC IRQs instead of masking only HALP bit in step 4
will guarantee that ICM will drop to 0 and interrupt will be triggered
once MISC interrupts will be unmasked.
Signed-off-by: Maya Erez <merez@codeaurora.org>
---
drivers/net/wireless/ath/wil6210/interrupt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/wil6210/interrupt.c b/drivers/net/wireless/ath/wil6210/interrupt.c
index d161dc9..b00a13d 100644
--- a/drivers/net/wireless/ath/wil6210/interrupt.c
+++ b/drivers/net/wireless/ath/wil6210/interrupt.c
@@ -595,7 +595,7 @@ static irqreturn_t wil6210_irq_misc(int irq, void *cookie)
/* 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);
+ wil6210_mask_irq_misc(wil, true);
complete(&wil->halp.comp);
}
}
--
1.9.1
^ permalink raw reply related
* [PATCH 8/9] wil6210: check rx_buff_mgmt before accessing it
From: Maya Erez @ 2019-04-26 15:43 UTC (permalink / raw)
To: Kalle Valo; +Cc: Dedy Lansky, linux-wireless, wil6210, Maya Erez
In-Reply-To: <1556293417-27097-1-git-send-email-merez@codeaurora.org>
From: Dedy Lansky <dlansky@codeaurora.org>
Make sure rx_buff_mgmt is initialized before accessing it.
Signed-off-by: Dedy Lansky <dlansky@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
---
drivers/net/wireless/ath/wil6210/txrx_edma.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/wireless/ath/wil6210/txrx_edma.c b/drivers/net/wireless/ath/wil6210/txrx_edma.c
index f37a205..6140db5 100644
--- a/drivers/net/wireless/ath/wil6210/txrx_edma.c
+++ b/drivers/net/wireless/ath/wil6210/txrx_edma.c
@@ -269,6 +269,9 @@ static void wil_move_all_rx_buff_to_free_list(struct wil6210_priv *wil,
struct list_head *active = &wil->rx_buff_mgmt.active;
dma_addr_t pa;
+ if (!wil->rx_buff_mgmt.buff_arr)
+ return;
+
while (!list_empty(active)) {
struct wil_rx_buff *rx_buff =
list_first_entry(active, struct wil_rx_buff, list);
--
1.9.1
^ permalink raw reply related
* Re: [wireless-drivers-next:master 21/45] drivers/net/wireless/rsi/rsi_91x_usb.c:774:17-26: ERROR: id is NULL but dereferenced. (fwd)
From: Kalle Valo @ 2019-04-26 15:25 UTC (permalink / raw)
To: Siva Rebbagondla; +Cc: Julia Lawall, kbuild-all, Linux Wireless
In-Reply-To: <CANGSkXSYfzn5oxsRvCrAWiS0itY-aVVC+=Qea506kkjq6TfYjg@mail.gmail.com>
Siva Rebbagondla <siva8118@gmail.com> writes:
> On Fri, Apr 26, 2019 at 8:28 PM Kalle Valo <kvalo@codeaurora.org> wrote:
>
>> Julia Lawall <julia.lawall@lip6.fr> writes:
>>
>> > The ifs starting on line 766 can fail because id is NULL.
>
> I don't think id will be NULL here. id is coming from probe.
> Is there any other opinions?.
The code in question:
if (id && id->idProduct == RSI_USB_PID_9113) {
rsi_dbg(INIT_ZONE, "%s: 9113 module detected\n", __func__);
adapter->device_model = RSI_DEV_9113;
} else if (id && id->idProduct == RSI_USB_PID_9116) {
rsi_dbg(INIT_ZONE, "%s: 9116 module detected\n", __func__);
adapter->device_model = RSI_DEV_9116;
} else {
rsi_dbg(ERR_ZONE, "%s: Unsupported RSI device id 0x%x\n",
__func__, id->idProduct);
goto err1;
}
I think the fact that you are checking if id is NULL is confusing the
static checkers. If it's never NULL why check for that anyway? So if
it's guaranteed that id is never NULL (I didn't check that from USB
core) I would recommend to remove the NULL checks from the driver.
--
Kalle Valo
^ permalink raw reply
* Re: [wireless-drivers-next:master 21/45] drivers/net/wireless/rsi/rsi_91x_usb.c:774:17-26: ERROR: id is NULL but dereferenced. (fwd)
From: Siva Rebbagondla @ 2019-04-26 15:13 UTC (permalink / raw)
To: Kalle Valo; +Cc: Julia Lawall, kbuild-all, Linux Wireless
In-Reply-To: <871s1ovmo4.fsf@kamboji.qca.qualcomm.com>
Hi,
On Fri, Apr 26, 2019 at 8:28 PM Kalle Valo <kvalo@codeaurora.org> wrote:
>
> + linux-wireless
>
> Julia Lawall <julia.lawall@lip6.fr> writes:
>
> > The ifs starting on line 766 can fail because id is NULL.
I don't think id will be NULL here. id is coming from probe.
Is there any other opinions?.
> >
> > julia
> >
> > ---------- Forwarded message ----------
> > Date: Fri, 26 Apr 2019 06:39:46 +0800
> > From: kbuild test robot <lkp@intel.com>
> > To: kbuild@01.org
> > Cc: Julia Lawall <julia.lawall@lip6.fr>
> > Subject: [wireless-drivers-next:master 21/45]
> > drivers/net/wireless/rsi/rsi_91x_usb.c:774:17-26: ERROR: id is NULL but
> > dereferenced.
> >
> > CC: kbuild-all@01.org
> > TO: Siva Rebbagondla <siva8118@gmail.com>
> > CC: Kalle Valo <kvalo@codeaurora.org>
> >
> > tree:
> > https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git
> > master
> > head: 147b502bda338f4f2dff19faaa5829b691305ea5
> > commit: 54fdb318c1116814711fad4bd166e6c85a477ef0 [21/45] rsi: add new
> > device model for 9116
> > :::::: branch date: 5 hours ago
> > :::::: commit date: 6 hours ago
> >
> > If you fix the issue, kindly add following tag
> > Reported-by: kbuild test robot <lkp@intel.com>
> > Reported-by: Julia Lawall <julia.lawall@lip6.fr>
> >
> >>> drivers/net/wireless/rsi/rsi_91x_usb.c:774:17-26: ERROR: id is NULL
> > but dereferenced.
> >
> > #
> > https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git/commit/?id=54fdb318c1116814711fad4bd166e6c85a477ef0
> > git remote add wireless-drivers-next
> > https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git
> > git remote update wireless-drivers-next
> > git checkout 54fdb318c1116814711fad4bd166e6c85a477ef0
> > vim +774 drivers/net/wireless/rsi/rsi_91x_usb.c
> >
> > ea0676c47 Karun Eagalapati 2017-07-06 729
> > dad0d04fa Fariya Fatima 2014-03-16 730 /**
> > dad0d04fa Fariya Fatima 2014-03-16 731 * rsi_probe() - This function
> > is called by kernel when the driver provided
> > dad0d04fa Fariya Fatima 2014-03-16 732 * Vendor and device IDs are
> > matched. All the initialization
> > dad0d04fa Fariya Fatima 2014-03-16 733 * work is done here.
> > dad0d04fa Fariya Fatima 2014-03-16 734 * @pfunction: Pointer to the
> > USB interface structure.
> > dad0d04fa Fariya Fatima 2014-03-16 735 * @id: Pointer to the
> > usb_device_id structure.
> > dad0d04fa Fariya Fatima 2014-03-16 736 *
> > 50591c60a Alexey Khoroshilov 2014-06-27 737 * Return: 0 on success, a
> > negative error code on failure.
> > dad0d04fa Fariya Fatima 2014-03-16 738 */
> > dad0d04fa Fariya Fatima 2014-03-16 739 static int rsi_probe(struct
> > usb_interface *pfunction,
> > dad0d04fa Fariya Fatima 2014-03-16 740 const struct usb_device_id *id)
> > dad0d04fa Fariya Fatima 2014-03-16 741 {
> > dad0d04fa Fariya Fatima 2014-03-16 742 struct rsi_hw *adapter;
> > dad0d04fa Fariya Fatima 2014-03-16 743 struct rsi_91x_usbdev *dev;
> > dad0d04fa Fariya Fatima 2014-03-16 744 u16 fw_status;
> > 50591c60a Alexey Khoroshilov 2014-06-27 745 int status;
> > dad0d04fa Fariya Fatima 2014-03-16 746
> > dad0d04fa Fariya Fatima 2014-03-16 747 rsi_dbg(INIT_ZONE, "%s: Init
> > function called\n", __func__);
> > dad0d04fa Fariya Fatima 2014-03-16 748
> > 898b25533 Prameela Rani Garnepudi 2018-02-27 749 adapter =
> > rsi_91x_init(dev_oper_mode);
> > dad0d04fa Fariya Fatima 2014-03-16 750 if (!adapter) {
> > dad0d04fa Fariya Fatima 2014-03-16 751 rsi_dbg(ERR_ZONE, "%s: Failed
> > to init os intf ops\n",
> > dad0d04fa Fariya Fatima 2014-03-16 752 __func__);
> > 50591c60a Alexey Khoroshilov 2014-06-27 753 return -ENOMEM;
> > dad0d04fa Fariya Fatima 2014-03-16 754 }
> > b78e91bcf Prameela Rani Garnepudi 2017-05-16 755
> > adapter->rsi_host_intf = RSI_HOST_INTF_USB;
> > dad0d04fa Fariya Fatima 2014-03-16 756
> > 50591c60a Alexey Khoroshilov 2014-06-27 757 status =
> > rsi_init_usb_interface(adapter, pfunction);
> > 50591c60a Alexey Khoroshilov 2014-06-27 758 if (status) {
> > dad0d04fa Fariya Fatima 2014-03-16 759 rsi_dbg(ERR_ZONE, "%s: Failed
> > to init usb interface\n",
> > dad0d04fa Fariya Fatima 2014-03-16 760 __func__);
> > dad0d04fa Fariya Fatima 2014-03-16 761 goto err;
> > dad0d04fa Fariya Fatima 2014-03-16 762 }
> > dad0d04fa Fariya Fatima 2014-03-16 763
> > dad0d04fa Fariya Fatima 2014-03-16 764 rsi_dbg(ERR_ZONE, "%s:
> > Initialized os intf ops\n", __func__);
> > dad0d04fa Fariya Fatima 2014-03-16 765
> > 54fdb318c Siva Rebbagondla 2019-04-03 766 if (id && id->idProduct ==
> > RSI_USB_PID_9113) {
> > 54fdb318c Siva Rebbagondla 2019-04-03 767 rsi_dbg(INIT_ZONE, "%s: 9113
> > module detected\n", __func__);
> > 54fdb318c Siva Rebbagondla 2019-04-03 768 adapter->device_model =
> > RSI_DEV_9113;
> > 54fdb318c Siva Rebbagondla 2019-04-03 769 } else if (id &&
> > id->idProduct == RSI_USB_PID_9116) {
> > 54fdb318c Siva Rebbagondla 2019-04-03 770 rsi_dbg(INIT_ZONE, "%s: 9116
> > module detected\n", __func__);
> > 54fdb318c Siva Rebbagondla 2019-04-03 771 adapter->device_model =
> > RSI_DEV_9116;
> > 54fdb318c Siva Rebbagondla 2019-04-03 772 } else {
> > 54fdb318c Siva Rebbagondla 2019-04-03 773 rsi_dbg(ERR_ZONE, "%s:
> > Unsupported RSI device id 0x%x\n",
> > 54fdb318c Siva Rebbagondla 2019-04-03 @774 __func__, id->idProduct);
> > 54fdb318c Siva Rebbagondla 2019-04-03 775 goto err1;
> > 54fdb318c Siva Rebbagondla 2019-04-03 776 }
> > 54fdb318c Siva Rebbagondla 2019-04-03 777
> > dad0d04fa Fariya Fatima 2014-03-16 778 dev = (struct rsi_91x_usbdev
> > *)adapter->rsi_dev;
> > dad0d04fa Fariya Fatima 2014-03-16 779
> > 50591c60a Alexey Khoroshilov 2014-06-27 780 status =
> > rsi_usb_reg_read(dev->usbdev, FW_STATUS_REG, &fw_status, 2);
> > b78e91bcf Prameela Rani Garnepudi 2017-05-16 781 if (status < 0)
> > dad0d04fa Fariya Fatima 2014-03-16 782 goto err1;
> > dad0d04fa Fariya Fatima 2014-03-16 783 else
> > dad0d04fa Fariya Fatima 2014-03-16 784 fw_status &= 1;
> > dad0d04fa Fariya Fatima 2014-03-16 785
> > dad0d04fa Fariya Fatima 2014-03-16 786 if (!fw_status) {
> > b78e91bcf Prameela Rani Garnepudi 2017-05-16 787 rsi_dbg(INIT_ZONE,
> > "Loading firmware...\n");
> > b78e91bcf Prameela Rani Garnepudi 2017-05-16 788 status =
> > rsi_hal_device_init(adapter);
> > 50591c60a Alexey Khoroshilov 2014-06-27 789 if (status) {
> > dad0d04fa Fariya Fatima 2014-03-16 790 rsi_dbg(ERR_ZONE, "%s: Failed
> > in device init\n",
> > dad0d04fa Fariya Fatima 2014-03-16 791 __func__);
> > dad0d04fa Fariya Fatima 2014-03-16 792 goto err1;
> > dad0d04fa Fariya Fatima 2014-03-16 793 }
> > b78e91bcf Prameela Rani Garnepudi 2017-05-16 794 rsi_dbg(INIT_ZONE,
> > "%s: Device Init Done\n", __func__);
> > dad0d04fa Fariya Fatima 2014-03-16 795 }
> > dad0d04fa Fariya Fatima 2014-03-16 796
> > 1100f81bb Prameela Rani Garnepudi 2018-02-27 797 status =
> > rsi_rx_urb_submit(adapter, WLAN_EP);
> > 50591c60a Alexey Khoroshilov 2014-06-27 798 if (status)
> > dad0d04fa Fariya Fatima 2014-03-16 799 goto err1;
> > dad0d04fa Fariya Fatima 2014-03-16 800
> > a4302bff2 Siva Rebbagondla 2018-02-27 801 if (adapter->priv->coex_mode
> >> 1) {
> > a4302bff2 Siva Rebbagondla 2018-02-27 802 status =
> > rsi_rx_urb_submit(adapter, BT_EP);
> > a4302bff2 Siva Rebbagondla 2018-02-27 803 if (status)
> > a4302bff2 Siva Rebbagondla 2018-02-27 804 goto err1;
> > a4302bff2 Siva Rebbagondla 2018-02-27 805 }
> > a4302bff2 Siva Rebbagondla 2018-02-27 806
> > dad0d04fa Fariya Fatima 2014-03-16 807 return 0;
> > dad0d04fa Fariya Fatima 2014-03-16 808 err1:
> > dad0d04fa Fariya Fatima 2014-03-16 809
> > rsi_deinit_usb_interface(adapter);
> > dad0d04fa Fariya Fatima 2014-03-16 810 err:
> > dad0d04fa Fariya Fatima 2014-03-16 811 rsi_91x_deinit(adapter);
> > dad0d04fa Fariya Fatima 2014-03-16 812 rsi_dbg(ERR_ZONE, "%s: Failed
> > in probe...Exiting\n", __func__);
> > 50591c60a Alexey Khoroshilov 2014-06-27 813 return status;
> > dad0d04fa Fariya Fatima 2014-03-16 814 }
> > dad0d04fa Fariya Fatima 2014-03-16 815
> >
> > ---
> > 0-DAY kernel test infrastructure Open Source Technology Center
> > https://lists.01.org/pipermail/kbuild-all Intel Corporation
>
> --
> Kalle Valo
--
Siva Rebbagondla
^ permalink raw reply
* Re: [wireless-drivers-next:master 21/45] drivers/net/wireless/rsi/rsi_91x_usb.c:774:17-26: ERROR: id is NULL but dereferenced. (fwd)
From: Kalle Valo @ 2019-04-26 14:58 UTC (permalink / raw)
To: Julia Lawall; +Cc: Siva Rebbagondla, kbuild-all, linux-wireless
In-Reply-To: <alpine.DEB.2.20.1904261625060.21912@hadrien>
+ linux-wireless
Julia Lawall <julia.lawall@lip6.fr> writes:
> The ifs starting on line 766 can fail because id is NULL.
>
> julia
>
> ---------- Forwarded message ----------
> Date: Fri, 26 Apr 2019 06:39:46 +0800
> From: kbuild test robot <lkp@intel.com>
> To: kbuild@01.org
> Cc: Julia Lawall <julia.lawall@lip6.fr>
> Subject: [wireless-drivers-next:master 21/45]
> drivers/net/wireless/rsi/rsi_91x_usb.c:774:17-26: ERROR: id is NULL but
> dereferenced.
>
> CC: kbuild-all@01.org
> TO: Siva Rebbagondla <siva8118@gmail.com>
> CC: Kalle Valo <kvalo@codeaurora.org>
>
> tree:
> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git
> master
> head: 147b502bda338f4f2dff19faaa5829b691305ea5
> commit: 54fdb318c1116814711fad4bd166e6c85a477ef0 [21/45] rsi: add new
> device model for 9116
> :::::: branch date: 5 hours ago
> :::::: commit date: 6 hours ago
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
> Reported-by: Julia Lawall <julia.lawall@lip6.fr>
>
>>> drivers/net/wireless/rsi/rsi_91x_usb.c:774:17-26: ERROR: id is NULL
> but dereferenced.
>
> #
> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git/commit/?id=54fdb318c1116814711fad4bd166e6c85a477ef0
> git remote add wireless-drivers-next
> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git
> git remote update wireless-drivers-next
> git checkout 54fdb318c1116814711fad4bd166e6c85a477ef0
> vim +774 drivers/net/wireless/rsi/rsi_91x_usb.c
>
> ea0676c47 Karun Eagalapati 2017-07-06 729
> dad0d04fa Fariya Fatima 2014-03-16 730 /**
> dad0d04fa Fariya Fatima 2014-03-16 731 * rsi_probe() - This function
> is called by kernel when the driver provided
> dad0d04fa Fariya Fatima 2014-03-16 732 * Vendor and device IDs are
> matched. All the initialization
> dad0d04fa Fariya Fatima 2014-03-16 733 * work is done here.
> dad0d04fa Fariya Fatima 2014-03-16 734 * @pfunction: Pointer to the
> USB interface structure.
> dad0d04fa Fariya Fatima 2014-03-16 735 * @id: Pointer to the
> usb_device_id structure.
> dad0d04fa Fariya Fatima 2014-03-16 736 *
> 50591c60a Alexey Khoroshilov 2014-06-27 737 * Return: 0 on success, a
> negative error code on failure.
> dad0d04fa Fariya Fatima 2014-03-16 738 */
> dad0d04fa Fariya Fatima 2014-03-16 739 static int rsi_probe(struct
> usb_interface *pfunction,
> dad0d04fa Fariya Fatima 2014-03-16 740 const struct usb_device_id *id)
> dad0d04fa Fariya Fatima 2014-03-16 741 {
> dad0d04fa Fariya Fatima 2014-03-16 742 struct rsi_hw *adapter;
> dad0d04fa Fariya Fatima 2014-03-16 743 struct rsi_91x_usbdev *dev;
> dad0d04fa Fariya Fatima 2014-03-16 744 u16 fw_status;
> 50591c60a Alexey Khoroshilov 2014-06-27 745 int status;
> dad0d04fa Fariya Fatima 2014-03-16 746
> dad0d04fa Fariya Fatima 2014-03-16 747 rsi_dbg(INIT_ZONE, "%s: Init
> function called\n", __func__);
> dad0d04fa Fariya Fatima 2014-03-16 748
> 898b25533 Prameela Rani Garnepudi 2018-02-27 749 adapter =
> rsi_91x_init(dev_oper_mode);
> dad0d04fa Fariya Fatima 2014-03-16 750 if (!adapter) {
> dad0d04fa Fariya Fatima 2014-03-16 751 rsi_dbg(ERR_ZONE, "%s: Failed
> to init os intf ops\n",
> dad0d04fa Fariya Fatima 2014-03-16 752 __func__);
> 50591c60a Alexey Khoroshilov 2014-06-27 753 return -ENOMEM;
> dad0d04fa Fariya Fatima 2014-03-16 754 }
> b78e91bcf Prameela Rani Garnepudi 2017-05-16 755
> adapter->rsi_host_intf = RSI_HOST_INTF_USB;
> dad0d04fa Fariya Fatima 2014-03-16 756
> 50591c60a Alexey Khoroshilov 2014-06-27 757 status =
> rsi_init_usb_interface(adapter, pfunction);
> 50591c60a Alexey Khoroshilov 2014-06-27 758 if (status) {
> dad0d04fa Fariya Fatima 2014-03-16 759 rsi_dbg(ERR_ZONE, "%s: Failed
> to init usb interface\n",
> dad0d04fa Fariya Fatima 2014-03-16 760 __func__);
> dad0d04fa Fariya Fatima 2014-03-16 761 goto err;
> dad0d04fa Fariya Fatima 2014-03-16 762 }
> dad0d04fa Fariya Fatima 2014-03-16 763
> dad0d04fa Fariya Fatima 2014-03-16 764 rsi_dbg(ERR_ZONE, "%s:
> Initialized os intf ops\n", __func__);
> dad0d04fa Fariya Fatima 2014-03-16 765
> 54fdb318c Siva Rebbagondla 2019-04-03 766 if (id && id->idProduct ==
> RSI_USB_PID_9113) {
> 54fdb318c Siva Rebbagondla 2019-04-03 767 rsi_dbg(INIT_ZONE, "%s: 9113
> module detected\n", __func__);
> 54fdb318c Siva Rebbagondla 2019-04-03 768 adapter->device_model =
> RSI_DEV_9113;
> 54fdb318c Siva Rebbagondla 2019-04-03 769 } else if (id &&
> id->idProduct == RSI_USB_PID_9116) {
> 54fdb318c Siva Rebbagondla 2019-04-03 770 rsi_dbg(INIT_ZONE, "%s: 9116
> module detected\n", __func__);
> 54fdb318c Siva Rebbagondla 2019-04-03 771 adapter->device_model =
> RSI_DEV_9116;
> 54fdb318c Siva Rebbagondla 2019-04-03 772 } else {
> 54fdb318c Siva Rebbagondla 2019-04-03 773 rsi_dbg(ERR_ZONE, "%s:
> Unsupported RSI device id 0x%x\n",
> 54fdb318c Siva Rebbagondla 2019-04-03 @774 __func__, id->idProduct);
> 54fdb318c Siva Rebbagondla 2019-04-03 775 goto err1;
> 54fdb318c Siva Rebbagondla 2019-04-03 776 }
> 54fdb318c Siva Rebbagondla 2019-04-03 777
> dad0d04fa Fariya Fatima 2014-03-16 778 dev = (struct rsi_91x_usbdev
> *)adapter->rsi_dev;
> dad0d04fa Fariya Fatima 2014-03-16 779
> 50591c60a Alexey Khoroshilov 2014-06-27 780 status =
> rsi_usb_reg_read(dev->usbdev, FW_STATUS_REG, &fw_status, 2);
> b78e91bcf Prameela Rani Garnepudi 2017-05-16 781 if (status < 0)
> dad0d04fa Fariya Fatima 2014-03-16 782 goto err1;
> dad0d04fa Fariya Fatima 2014-03-16 783 else
> dad0d04fa Fariya Fatima 2014-03-16 784 fw_status &= 1;
> dad0d04fa Fariya Fatima 2014-03-16 785
> dad0d04fa Fariya Fatima 2014-03-16 786 if (!fw_status) {
> b78e91bcf Prameela Rani Garnepudi 2017-05-16 787 rsi_dbg(INIT_ZONE,
> "Loading firmware...\n");
> b78e91bcf Prameela Rani Garnepudi 2017-05-16 788 status =
> rsi_hal_device_init(adapter);
> 50591c60a Alexey Khoroshilov 2014-06-27 789 if (status) {
> dad0d04fa Fariya Fatima 2014-03-16 790 rsi_dbg(ERR_ZONE, "%s: Failed
> in device init\n",
> dad0d04fa Fariya Fatima 2014-03-16 791 __func__);
> dad0d04fa Fariya Fatima 2014-03-16 792 goto err1;
> dad0d04fa Fariya Fatima 2014-03-16 793 }
> b78e91bcf Prameela Rani Garnepudi 2017-05-16 794 rsi_dbg(INIT_ZONE,
> "%s: Device Init Done\n", __func__);
> dad0d04fa Fariya Fatima 2014-03-16 795 }
> dad0d04fa Fariya Fatima 2014-03-16 796
> 1100f81bb Prameela Rani Garnepudi 2018-02-27 797 status =
> rsi_rx_urb_submit(adapter, WLAN_EP);
> 50591c60a Alexey Khoroshilov 2014-06-27 798 if (status)
> dad0d04fa Fariya Fatima 2014-03-16 799 goto err1;
> dad0d04fa Fariya Fatima 2014-03-16 800
> a4302bff2 Siva Rebbagondla 2018-02-27 801 if (adapter->priv->coex_mode
>> 1) {
> a4302bff2 Siva Rebbagondla 2018-02-27 802 status =
> rsi_rx_urb_submit(adapter, BT_EP);
> a4302bff2 Siva Rebbagondla 2018-02-27 803 if (status)
> a4302bff2 Siva Rebbagondla 2018-02-27 804 goto err1;
> a4302bff2 Siva Rebbagondla 2018-02-27 805 }
> a4302bff2 Siva Rebbagondla 2018-02-27 806
> dad0d04fa Fariya Fatima 2014-03-16 807 return 0;
> dad0d04fa Fariya Fatima 2014-03-16 808 err1:
> dad0d04fa Fariya Fatima 2014-03-16 809
> rsi_deinit_usb_interface(adapter);
> dad0d04fa Fariya Fatima 2014-03-16 810 err:
> dad0d04fa Fariya Fatima 2014-03-16 811 rsi_91x_deinit(adapter);
> dad0d04fa Fariya Fatima 2014-03-16 812 rsi_dbg(ERR_ZONE, "%s: Failed
> in probe...Exiting\n", __func__);
> 50591c60a Alexey Khoroshilov 2014-06-27 813 return status;
> dad0d04fa Fariya Fatima 2014-03-16 814 }
> dad0d04fa Fariya Fatima 2014-03-16 815
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation
--
Kalle Valo
^ permalink raw reply
* Re: [PATCHv2] ath10k: Add wrapper function to ath10k debug
From: Ben Greear @ 2019-04-26 13:57 UTC (permalink / raw)
To: Venkateswara Naralasetty, Venkateswara Naralasetty,
ath10k@lists.infradead.org
Cc: Kan Yan, linux-wireless@vger.kernel.org
In-Reply-To: <be151755e771423eaa0ad6e6e2e81c2b@APSANEXR01F.ap.qualcomm.com>
On 4/26/19 6:38 AM, Venkateswara Naralasetty wrote:
>>> #ifdef CONFIG_ATH10K_DEBUG
>>> -void ath10k_dbg(struct ath10k *ar, enum ath10k_debug_mask mask,
>>> - const char *fmt, ...)
>>> +void __ath10k_dbg(struct ath10k *ar, enum ath10k_debug_mask mask,
>>> + const char *fmt, ...)
>>> {
>>> struct va_format vaf;
>>> va_list args;
>>
>> Do you still need the check later in this method:
>>
>> if (ath10k_debug_mask & mask)
>>
>> since you already checked in the ath10k_dbg() macro?
> Yes, we need this check.
> Otherwise all debug messages will be printed even without any debug mask set in case of tracing enabled.
Ahh, I see.
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* Re: [PATCHv2] ath10k: Add wrapper function to ath10k debug
From: Ben Greear @ 2019-04-26 13:56 UTC (permalink / raw)
To: Michał Kazior, Venkateswara Naralasetty
Cc: ath10k, linux-wireless, Kan Yan
In-Reply-To: <CABvG-CVxmnm=JsSsgYQqEzHHYU8RJDxqCZJn4Rzy=zPLtKY1hA@mail.gmail.com>
On 4/26/19 6:44 AM, Michał Kazior wrote:
> On Fri, 26 Apr 2019 at 14:58, Venkateswara Naralasetty
> <vnaralas@codeaurora.org> wrote:
>>
>> ath10k_dbg() is called in ath10k_process_rx() with huge set of arguments
>> which is causing CPU overhead even when debug_mask is not set.
>> Good improvement was observed in the receive side performance when call
>> to ath10k_dbg() is avoided in the RX path.
> [...]
>
>> +/* Avoid calling __ath10k_dbg() if debug_mask is not set and tracing
>> + * disabled.
>> + */
>> +#define ath10k_dbg(ar, dbg_mask, fmt, ...) \
>> +do { \
>> + if ((ath10k_debug_mask & dbg_mask) || \
>> + trace_ath10k_log_dbg_enabled()) \
>> + __ath10k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__); \
>> +} while (0)
>
> Did you consider using jump labels (see include/linux/jump_label.h)?
> It's what tracing uses under the hood. I wonder if you could squeeze
> out a bit more performance with that? I guess you'd need to add
> `struct static_key ath10k_dbg_mask_keys[ATH10K_DBG_MAX]` and re-do
> ath10k_debug_mask enum a bit.
Maybe first test with debugging just compiled out to see if there is still
any significant overhead with this new patch applied?
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* Re: [PATCHv2] ath10k: Add wrapper function to ath10k debug
From: Michał Kazior @ 2019-04-26 13:44 UTC (permalink / raw)
To: Venkateswara Naralasetty; +Cc: ath10k, linux-wireless, Kan Yan
In-Reply-To: <1556283505-29539-1-git-send-email-vnaralas@codeaurora.org>
On Fri, 26 Apr 2019 at 14:58, Venkateswara Naralasetty
<vnaralas@codeaurora.org> wrote:
>
> ath10k_dbg() is called in ath10k_process_rx() with huge set of arguments
> which is causing CPU overhead even when debug_mask is not set.
> Good improvement was observed in the receive side performance when call
> to ath10k_dbg() is avoided in the RX path.
[...]
> +/* Avoid calling __ath10k_dbg() if debug_mask is not set and tracing
> + * disabled.
> + */
> +#define ath10k_dbg(ar, dbg_mask, fmt, ...) \
> +do { \
> + if ((ath10k_debug_mask & dbg_mask) || \
> + trace_ath10k_log_dbg_enabled()) \
> + __ath10k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__); \
> +} while (0)
Did you consider using jump labels (see include/linux/jump_label.h)?
It's what tracing uses under the hood. I wonder if you could squeeze
out a bit more performance with that? I guess you'd need to add
`struct static_key ath10k_dbg_mask_keys[ATH10K_DBG_MAX]` and re-do
ath10k_debug_mask enum a bit.
Michal
^ permalink raw reply
* RE: [PATCHv2] ath10k: Add wrapper function to ath10k debug
From: Venkateswara Naralasetty @ 2019-04-26 13:38 UTC (permalink / raw)
To: Ben Greear, Venkateswara Naralasetty, ath10k@lists.infradead.org
Cc: Kan Yan, linux-wireless@vger.kernel.org
In-Reply-To: <b9f263a4-e9da-18bb-5932-941a018ee860@candelatech.com>
> -----Original Message-----
> From: ath10k <ath10k-bounces@lists.infradead.org> On Behalf Of Ben
> Greear
> Sent: Friday, April 26, 2019 6:52 PM
> To: Venkateswara Naralasetty <vnaralas@codeaurora.org>;
> ath10k@lists.infradead.org
> Cc: Kan Yan <kyan@chromium.org>; linux-wireless@vger.kernel.org
> Subject: [EXT] Re: [PATCHv2] ath10k: Add wrapper function to ath10k debug
>
> On 4/26/19 5:58 AM, Venkateswara Naralasetty wrote:
> > ath10k_dbg() is called in ath10k_process_rx() with huge set of
> > arguments which is causing CPU overhead even when debug_mask is not
> set.
> > Good improvement was observed in the receive side performance when
> > call to ath10k_dbg() is avoided in the RX path.
> >
> > Since currently all debug messages are sent via tracing
> > infrastructure, we cannot entirely avoid calling ath10k_dbg.
> > Therefore, call to
> > ath10k_dbg() is made conditional based on tracing config in the driver.
> >
> > Trasmit performance remains unchanged with this patch; below are some
> > experimental results with this patch and tracing disabled.
> >
> > mesh mode:
> >
> > w/o this patch with this patch
> > Traffic TP CPU Usage TP CPU usage
> >
> > TCP 840Mbps 76.53% 960Mbps 78.14%
> > UDP 1030Mbps 74.58% 1132Mbps 74.31%
> >
> > Infra mode:
> >
> > w/o this patch with this patch
> > Traffic TP CPU Usage TP CPU usage
> >
> > TCP Rx 1241Mbps 80.89% 1270Mbps 73.50%
> > UDP Rx 1433Mbps 81.77% 1472Mbps 72.80%
> >
> > Tested platform : IPQ8064
> > hardware used : QCA9984
> > firmware ver : ver 10.4-3.5.3-00057
> >
> > Signed-off-by: Kan Yan <kyan@chromium.org>
> > Signed-off-by: Venkateswara Naralasetty <vnaralas@codeaurora.org>
> > ---
> > v2:
> > * changed trace enabled check from
> IS_ENABLED(CONFIG_ATH10K_TRACING)
> > * to trace_ath10k_log_dbg_enabled().
> >
> > drivers/net/wireless/ath/ath10k/core.c | 2 ++
> > drivers/net/wireless/ath/ath10k/debug.c | 8 ++++----
> > drivers/net/wireless/ath/ath10k/debug.h | 22 ++++++++++++++++------
> > drivers/net/wireless/ath/ath10k/trace.c | 1 +
> > drivers/net/wireless/ath/ath10k/trace.h | 6 +++++-
> > 5 files changed, 28 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/net/wireless/ath/ath10k/core.c
> > b/drivers/net/wireless/ath/ath10k/core.c
> > index cfd7bb2..ab709bf 100644
> > --- a/drivers/net/wireless/ath/ath10k/core.c
> > +++ b/drivers/net/wireless/ath/ath10k/core.c
> > @@ -26,6 +26,8 @@
> > #include "coredump.h"
> >
> > unsigned int ath10k_debug_mask;
> > +EXPORT_SYMBOL(ath10k_debug_mask);
> > +
> > static unsigned int ath10k_cryptmode_param;
> > static bool uart_print;
> > static bool skip_otp;
> > diff --git a/drivers/net/wireless/ath/ath10k/debug.c
> > b/drivers/net/wireless/ath/ath10k/debug.c
> > index 32d967a..1b63929 100644
> > --- a/drivers/net/wireless/ath/ath10k/debug.c
> > +++ b/drivers/net/wireless/ath/ath10k/debug.c
> > @@ -2620,8 +2620,8 @@ void ath10k_debug_unregister(struct ath10k *ar)
> > #endif /* CONFIG_ATH10K_DEBUGFS */
> >
> > #ifdef CONFIG_ATH10K_DEBUG
> > -void ath10k_dbg(struct ath10k *ar, enum ath10k_debug_mask mask,
> > - const char *fmt, ...)
> > +void __ath10k_dbg(struct ath10k *ar, enum ath10k_debug_mask mask,
> > + const char *fmt, ...)
> > {
> > struct va_format vaf;
> > va_list args;
>
> Do you still need the check later in this method:
>
> if (ath10k_debug_mask & mask)
>
> since you already checked in the ath10k_dbg() macro?
Yes, we need this check.
Otherwise all debug messages will be printed even without any debug mask set in case of tracing enabled.
>
> Thanks,
> Ben
>
>
> --
> Ben Greear <greearb@candelatech.com>
> Candela Technologies Inc http://www.candelatech.com
>
>
> _______________________________________________
> ath10k mailing list
> ath10k@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/ath10k
^ permalink raw reply
* Re: [PATCHv2] ath10k: Add wrapper function to ath10k debug
From: Ben Greear @ 2019-04-26 13:21 UTC (permalink / raw)
To: Venkateswara Naralasetty, ath10k; +Cc: linux-wireless, Kan Yan
In-Reply-To: <1556283505-29539-1-git-send-email-vnaralas@codeaurora.org>
On 4/26/19 5:58 AM, Venkateswara Naralasetty wrote:
> ath10k_dbg() is called in ath10k_process_rx() with huge set of arguments
> which is causing CPU overhead even when debug_mask is not set.
> Good improvement was observed in the receive side performance when call
> to ath10k_dbg() is avoided in the RX path.
>
> Since currently all debug messages are sent via tracing infrastructure,
> we cannot entirely avoid calling ath10k_dbg. Therefore, call to
> ath10k_dbg() is made conditional based on tracing config in the driver.
>
> Trasmit performance remains unchanged with this patch; below are some
> experimental results with this patch and tracing disabled.
>
> mesh mode:
>
> w/o this patch with this patch
> Traffic TP CPU Usage TP CPU usage
>
> TCP 840Mbps 76.53% 960Mbps 78.14%
> UDP 1030Mbps 74.58% 1132Mbps 74.31%
>
> Infra mode:
>
> w/o this patch with this patch
> Traffic TP CPU Usage TP CPU usage
>
> TCP Rx 1241Mbps 80.89% 1270Mbps 73.50%
> UDP Rx 1433Mbps 81.77% 1472Mbps 72.80%
>
> Tested platform : IPQ8064
> hardware used : QCA9984
> firmware ver : ver 10.4-3.5.3-00057
>
> Signed-off-by: Kan Yan <kyan@chromium.org>
> Signed-off-by: Venkateswara Naralasetty <vnaralas@codeaurora.org>
> ---
> v2:
> * changed trace enabled check from IS_ENABLED(CONFIG_ATH10K_TRACING)
> * to trace_ath10k_log_dbg_enabled().
>
> drivers/net/wireless/ath/ath10k/core.c | 2 ++
> drivers/net/wireless/ath/ath10k/debug.c | 8 ++++----
> drivers/net/wireless/ath/ath10k/debug.h | 22 ++++++++++++++++------
> drivers/net/wireless/ath/ath10k/trace.c | 1 +
> drivers/net/wireless/ath/ath10k/trace.h | 6 +++++-
> 5 files changed, 28 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
> index cfd7bb2..ab709bf 100644
> --- a/drivers/net/wireless/ath/ath10k/core.c
> +++ b/drivers/net/wireless/ath/ath10k/core.c
> @@ -26,6 +26,8 @@
> #include "coredump.h"
>
> unsigned int ath10k_debug_mask;
> +EXPORT_SYMBOL(ath10k_debug_mask);
> +
> static unsigned int ath10k_cryptmode_param;
> static bool uart_print;
> static bool skip_otp;
> diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
> index 32d967a..1b63929 100644
> --- a/drivers/net/wireless/ath/ath10k/debug.c
> +++ b/drivers/net/wireless/ath/ath10k/debug.c
> @@ -2620,8 +2620,8 @@ void ath10k_debug_unregister(struct ath10k *ar)
> #endif /* CONFIG_ATH10K_DEBUGFS */
>
> #ifdef CONFIG_ATH10K_DEBUG
> -void ath10k_dbg(struct ath10k *ar, enum ath10k_debug_mask mask,
> - const char *fmt, ...)
> +void __ath10k_dbg(struct ath10k *ar, enum ath10k_debug_mask mask,
> + const char *fmt, ...)
> {
> struct va_format vaf;
> va_list args;
Do you still need the check later in this method:
if (ath10k_debug_mask & mask)
since you already checked in the ath10k_dbg() macro?
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* [PATCHv2] ath10k: Add wrapper function to ath10k debug
From: Venkateswara Naralasetty @ 2019-04-26 12:58 UTC (permalink / raw)
To: ath10k; +Cc: linux-wireless, Venkateswara Naralasetty, Kan Yan
ath10k_dbg() is called in ath10k_process_rx() with huge set of arguments
which is causing CPU overhead even when debug_mask is not set.
Good improvement was observed in the receive side performance when call
to ath10k_dbg() is avoided in the RX path.
Since currently all debug messages are sent via tracing infrastructure,
we cannot entirely avoid calling ath10k_dbg. Therefore, call to
ath10k_dbg() is made conditional based on tracing config in the driver.
Trasmit performance remains unchanged with this patch; below are some
experimental results with this patch and tracing disabled.
mesh mode:
w/o this patch with this patch
Traffic TP CPU Usage TP CPU usage
TCP 840Mbps 76.53% 960Mbps 78.14%
UDP 1030Mbps 74.58% 1132Mbps 74.31%
Infra mode:
w/o this patch with this patch
Traffic TP CPU Usage TP CPU usage
TCP Rx 1241Mbps 80.89% 1270Mbps 73.50%
UDP Rx 1433Mbps 81.77% 1472Mbps 72.80%
Tested platform : IPQ8064
hardware used : QCA9984
firmware ver : ver 10.4-3.5.3-00057
Signed-off-by: Kan Yan <kyan@chromium.org>
Signed-off-by: Venkateswara Naralasetty <vnaralas@codeaurora.org>
---
v2:
* changed trace enabled check from IS_ENABLED(CONFIG_ATH10K_TRACING)
* to trace_ath10k_log_dbg_enabled().
drivers/net/wireless/ath/ath10k/core.c | 2 ++
drivers/net/wireless/ath/ath10k/debug.c | 8 ++++----
drivers/net/wireless/ath/ath10k/debug.h | 22 ++++++++++++++++------
drivers/net/wireless/ath/ath10k/trace.c | 1 +
drivers/net/wireless/ath/ath10k/trace.h | 6 +++++-
5 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index cfd7bb2..ab709bf 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -26,6 +26,8 @@
#include "coredump.h"
unsigned int ath10k_debug_mask;
+EXPORT_SYMBOL(ath10k_debug_mask);
+
static unsigned int ath10k_cryptmode_param;
static bool uart_print;
static bool skip_otp;
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index 32d967a..1b63929 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -2620,8 +2620,8 @@ void ath10k_debug_unregister(struct ath10k *ar)
#endif /* CONFIG_ATH10K_DEBUGFS */
#ifdef CONFIG_ATH10K_DEBUG
-void ath10k_dbg(struct ath10k *ar, enum ath10k_debug_mask mask,
- const char *fmt, ...)
+void __ath10k_dbg(struct ath10k *ar, enum ath10k_debug_mask mask,
+ const char *fmt, ...)
{
struct va_format vaf;
va_list args;
@@ -2638,7 +2638,7 @@ void ath10k_dbg(struct ath10k *ar, enum ath10k_debug_mask mask,
va_end(args);
}
-EXPORT_SYMBOL(ath10k_dbg);
+EXPORT_SYMBOL(__ath10k_dbg);
void ath10k_dbg_dump(struct ath10k *ar,
enum ath10k_debug_mask mask,
@@ -2651,7 +2651,7 @@ void ath10k_dbg_dump(struct ath10k *ar,
if (ath10k_debug_mask & mask) {
if (msg)
- ath10k_dbg(ar, mask, "%s\n", msg);
+ __ath10k_dbg(ar, mask, "%s\n", msg);
for (ptr = buf; (ptr - buf) < len; ptr += 16) {
linebuflen = 0;
diff --git a/drivers/net/wireless/ath/ath10k/debug.h b/drivers/net/wireless/ath/ath10k/debug.h
index db78e85..a5b2039 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -240,18 +240,18 @@ void ath10k_sta_update_rx_tid_stats_ampdu(struct ath10k *ar,
#endif /* CONFIG_MAC80211_DEBUGFS */
#ifdef CONFIG_ATH10K_DEBUG
-__printf(3, 4) void ath10k_dbg(struct ath10k *ar,
- enum ath10k_debug_mask mask,
- const char *fmt, ...);
+__printf(3, 4) void __ath10k_dbg(struct ath10k *ar,
+ enum ath10k_debug_mask mask,
+ const char *fmt, ...);
void ath10k_dbg_dump(struct ath10k *ar,
enum ath10k_debug_mask mask,
const char *msg, const char *prefix,
const void *buf, size_t len);
#else /* CONFIG_ATH10K_DEBUG */
-static inline int ath10k_dbg(struct ath10k *ar,
- enum ath10k_debug_mask dbg_mask,
- const char *fmt, ...)
+static inline int __ath10k_dbg(struct ath10k *ar,
+ enum ath10k_debug_mask dbg_mask,
+ const char *fmt, ...)
{
return 0;
}
@@ -263,4 +263,14 @@ static inline void ath10k_dbg_dump(struct ath10k *ar,
{
}
#endif /* CONFIG_ATH10K_DEBUG */
+
+/* Avoid calling __ath10k_dbg() if debug_mask is not set and tracing
+ * disabled.
+ */
+#define ath10k_dbg(ar, dbg_mask, fmt, ...) \
+do { \
+ if ((ath10k_debug_mask & dbg_mask) || \
+ trace_ath10k_log_dbg_enabled()) \
+ __ath10k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__); \
+} while (0)
#endif /* _DEBUG_H_ */
diff --git a/drivers/net/wireless/ath/ath10k/trace.c b/drivers/net/wireless/ath/ath10k/trace.c
index 3ecdff1..c7d4c97 100644
--- a/drivers/net/wireless/ath/ath10k/trace.c
+++ b/drivers/net/wireless/ath/ath10k/trace.c
@@ -7,3 +7,4 @@
#define CREATE_TRACE_POINTS
#include "trace.h"
+EXPORT_SYMBOL(__tracepoint_ath10k_log_dbg);
diff --git a/drivers/net/wireless/ath/ath10k/trace.h b/drivers/net/wireless/ath/ath10k/trace.h
index ba977bb..ab91645 100644
--- a/drivers/net/wireless/ath/ath10k/trace.h
+++ b/drivers/net/wireless/ath/ath10k/trace.h
@@ -29,7 +29,11 @@ static inline u32 ath10k_frm_hdr_len(const void *buf, size_t len)
#if !defined(CONFIG_ATH10K_TRACING)
#undef TRACE_EVENT
#define TRACE_EVENT(name, proto, ...) \
-static inline void trace_ ## name(proto) {}
+static inline void trace_ ## name(proto) {} \
+static inline bool trace_##name##_enabled(void) \
+{ \
+ return false; \
+}
#undef DECLARE_EVENT_CLASS
#define DECLARE_EVENT_CLASS(...)
#undef DEFINE_EVENT
--
2.7.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox