2013-09-12 15:33:11

by Vladimir Murzin

[permalink] [raw]
Subject: small PAGE_SIZE related fixes for wl{12,18}xx drivers


This small series is considering PAGE_SIZE usage into the wl drivers. I have
no real HW to test it tightly, probably these drivers will never run on arches
with PAGE_SIZE different to 4K. Nevertheless, I hope this mini-series (or some
part of it) will be useful for you.

Thanks.
Vladimir


2013-09-12 15:34:27

by Vladimir Murzin

[permalink] [raw]
Subject: [PATCH 3/3] wlcore: limit base for output buffer in dev_mem_read

dev_mem_read tries to speed up things a bit by limiting output
buffer which can not exceed WLCORE_MAX_BLOCK_SIZE. However,
WLCORE_MAX_BLOCK_SIZE is based on PAGE_SIZE which may vary.

Use 4K size base for buffer explicitly.

Signed-off-by: Vladimir Murzin <[email protected]>
---
drivers/net/wireless/ti/wlcore/debugfs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ti/wlcore/debugfs.c b/drivers/net/wireless/ti/wlcore/debugfs.c
index e17630c..6b413a7 100644
--- a/drivers/net/wireless/ti/wlcore/debugfs.c
+++ b/drivers/net/wireless/ti/wlcore/debugfs.c
@@ -38,7 +38,8 @@
/* ms */
#define WL1271_DEBUGFS_STATS_LIFETIME 1000

-#define WLCORE_MAX_BLOCK_SIZE ((size_t)(4*PAGE_SIZE))
+#define WLCORE_PAGE_SIZE 4096
+#define WLCORE_MAX_BLOCK_SIZE ((size_t)(4*WLCORE_PAGE_SIZE))

/* debugfs macros idea from mac80211 */
int wl1271_format_buffer(char __user *userbuf, size_t count,
--
1.7.10.4


2013-09-12 15:33:39

by Vladimir Murzin

[permalink] [raw]
Subject: [PATCH 1/3] wlcore: fix frame size overflow warning in wl12xx_spi_raw_write

While cross-building for PPC64 I've got

drivers/net/wireless/ti/wlcore/spi.c: In function
'wl12xx_spi_raw_write': drivers/net/wireless/ti/wlcore/spi.c:317:1:
warning: the frame size of 9712 bytes is larger than 2048 bytes
[-Wframe-larger-than=]

WSPI_MAX_NUM_OF_CHUNKS depends on SPI_AGGR_BUFFER_SIZE which in turn
is based on PAGE_SIZE. For most systems PAGE_SIZE is stands for 4K,
but it may vary - in my case PAGE_SIZE is 64K.

Fix calculation by using 4K explicitly.

Signed-off-by: Vladimir Murzin <[email protected]>
---
drivers/net/wireless/ti/wlcore/spi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c
index 1b0cd98..8dce028 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -70,7 +70,8 @@
* only support SPI for 12xx - this code should be reworked when 18xx
* support is introduced
*/
-#define SPI_AGGR_BUFFER_SIZE (4 * PAGE_SIZE)
+#define SPI_PAGE_SIZE 4096
+#define SPI_AGGR_BUFFER_SIZE (4 * SPI_PAGE_SIZE)

#define WSPI_MAX_NUM_OF_CHUNKS (SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE)

--
1.7.10.4


2013-09-12 15:34:06

by Vladimir Murzin

[permalink] [raw]
Subject: [PATCH 2/3] wl12xx/wl18xx: limit base for aggregate buffer size to 4K

WL{12,18}XX_AGGR_BUFFER_SIZE is depends on PAGE_SIZE which may be more
than 4K. In this case memory might be aggressively wasted.

Use 4K size base for buffer explicitly.

Signed-off-by: Vladimir Murzin <[email protected]>
---
drivers/net/wireless/ti/wl12xx/wl12xx.h | 3 ++-
drivers/net/wireless/ti/wl18xx/wl18xx.h | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ti/wl12xx/wl12xx.h b/drivers/net/wireless/ti/wl12xx/wl12xx.h
index 9e5484a..3649d40 100644
--- a/drivers/net/wireless/ti/wl12xx/wl12xx.h
+++ b/drivers/net/wireless/ti/wl12xx/wl12xx.h
@@ -56,7 +56,8 @@
#define WL128X_SUBTYPE_MR_VER WLCORE_FW_VER_IGNORE
#define WL128X_MINOR_MR_VER 42

-#define WL12XX_AGGR_BUFFER_SIZE (4 * PAGE_SIZE)
+#define WL12XX_PAGE_SIZE 4096
+#define WL12XX_AGGR_BUFFER_SIZE (4 * WL12XX_PAGE_SIZE)

#define WL12XX_NUM_TX_DESCRIPTORS 16
#define WL12XX_NUM_RX_DESCRIPTORS 8
diff --git a/drivers/net/wireless/ti/wl18xx/wl18xx.h b/drivers/net/wireless/ti/wl18xx/wl18xx.h
index 9204e07..a3214b4 100644
--- a/drivers/net/wireless/ti/wl18xx/wl18xx.h
+++ b/drivers/net/wireless/ti/wl18xx/wl18xx.h
@@ -33,7 +33,8 @@

#define WL18XX_CMD_MAX_SIZE 740

-#define WL18XX_AGGR_BUFFER_SIZE (13 * PAGE_SIZE)
+#define WL18XX_PAGE_SIZE 4096
+#define WL18XX_AGGR_BUFFER_SIZE (13 * WL18XX_PAGE_SIZE)

#define WL18XX_NUM_TX_DESCRIPTORS 32
#define WL18XX_NUM_RX_DESCRIPTORS 32
--
1.7.10.4