From c214ad2ab47f00c7127eed18f0f2f95dc01fdee7 Mon Sep 17 00:00:00 2001 From: Lior David Date: Tue, 8 Jan 2019 13:35:54 +0200 Subject: [PATCH 1/2] wil6210: fix for "runtime PM when interface is down" The original change used readl and writel which can be replaced with readl_relaxed and writel_relaxed, since we take care of memory barriers in the code. Change-Id: I4e653f51c24ee4b2fa3d1aee38574fa097424e63 Signed-off-by: Lior David --- drivers/net/wireless/ath/wil6210/debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index 243714136d30..812d52603c19 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c @@ -402,7 +402,7 @@ static int wil_debugfs_iomem_x32_get(void *data, u64 *val) if (ret < 0) return ret; - *val = readl((void __iomem *)d->offset); + *val = readl_relaxed((void __iomem *)d->offset); wil_pm_runtime_put(wil); From 60742fce451224b65781b3827f2f9bb40d779ee9 Mon Sep 17 00:00:00 2001 From: Alexei Avshalom Lazar Date: Wed, 4 Dec 2019 10:12:47 +0200 Subject: [PATCH 2/2] wil6210: add support for headroom configuration Add module parameter for configuring the headroom size in the skb allocation. Change-Id: Ie0190a6c8fa19c7121ad77b8a9a913ce876800fe Signed-off-by: Alexei Avshalom Lazar Signed-off-by: Maya Erez [liord@codeaurora.org: SPDX license] Signed-off-by: Lior David --- drivers/net/wireless/ath/wil6210/txrx.c | 41 +++++++++++++------- drivers/net/wireless/ath/wil6210/txrx_edma.c | 16 ++------ drivers/net/wireless/ath/wil6210/wil6210.h | 1 + 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c index 598c1fba9dac..84d72955fa56 100644 --- a/drivers/net/wireless/ath/wil6210/txrx.c +++ b/drivers/net/wireless/ath/wil6210/txrx.c @@ -1,18 +1,7 @@ +// SPDX-License-Identifier: ISC /* * Copyright (c) 2012-2017 Qualcomm Atheros, Inc. * 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 - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include @@ -41,6 +30,32 @@ 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; +#define WIL6210_MAX_HEADROOM_SIZE (256) + +ushort headroom_size; /* = 0; */ +static int headroom_size_set(const char *val, const struct kernel_param *kp) +{ + int ret; + + ret = param_set_uint(val, kp); + if (ret) + return ret; + + if (headroom_size > WIL6210_MAX_HEADROOM_SIZE) + return -EINVAL; + + return 0; +} + +static const struct kernel_param_ops headroom_ops = { + .set = headroom_size_set, + .get = param_get_ushort, +}; + +module_param_cb(headroom_size, &headroom_ops, &headroom_size, 0644); +MODULE_PARM_DESC(headroom_size, + " headroom size for rx skb allocation, default - 0"); + static inline uint wil_rx_snaplen(void) { return rx_align_2 ? 6 : 0; @@ -623,7 +638,7 @@ static int wil_rx_refill(struct wil6210_priv *wil, int count) u32 next_tail; int rc = 0; int headroom = ndev->type == ARPHRD_IEEE80211_RADIOTAP ? - WIL6210_RTAP_SIZE : 0; + WIL6210_RTAP_SIZE : headroom_size; for (; next_tail = wil_ring_next_tail(v), (next_tail != v->swhead) && (count-- > 0); diff --git a/drivers/net/wireless/ath/wil6210/txrx_edma.c b/drivers/net/wireless/ath/wil6210/txrx_edma.c index 04d576deae72..122873843227 100644 --- a/drivers/net/wireless/ath/wil6210/txrx_edma.c +++ b/drivers/net/wireless/ath/wil6210/txrx_edma.c @@ -1,17 +1,6 @@ +// SPDX-License-Identifier: ISC /* * 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 - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include @@ -182,10 +171,11 @@ static int wil_ring_alloc_skb_edma(struct wil6210_priv *wil, return -EAGAIN; } - skb = dev_alloc_skb(sz); + skb = dev_alloc_skb(sz + headroom_size); if (unlikely(!skb)) return -ENOMEM; + skb_reserve(skb, headroom_size); skb_put(skb, sz); /** diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h index 1b7230d68235..b2c047745b3f 100644 --- a/drivers/net/wireless/ath/wil6210/wil6210.h +++ b/drivers/net/wireless/ath/wil6210/wil6210.h @@ -28,6 +28,7 @@ extern bool rx_large_buf; extern bool debug_fw; extern bool disable_ap_sme; extern bool ftm_mode; +extern ushort headroom_size; extern bool drop_if_ring_full; extern uint max_assoc_sta;