lkml.org 
[lkml]   [2021]   [Dec]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 50/50] wilc1000: add module parameter "disable_zero_copy_tx" to SPI driver
Date
Add a module parameter to disable the zero-copy transmit path.  This
is useful for testing and performance measurement, for example.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
drivers/net/wireless/microchip/wilc1000/spi.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/spi.c b/drivers/net/wireless/microchip/wilc1000/spi.c
index 8d94f111ffc49..588cec326a74b 100644
--- a/drivers/net/wireless/microchip/wilc1000/spi.c
+++ b/drivers/net/wireless/microchip/wilc1000/spi.c
@@ -31,6 +31,11 @@ MODULE_PARM_DESC(enable_crc16,
"\t\t\tData transfers can be large and the CPU-cycle cost\n"
"\t\t\tof enabling this may be substantial.");

+static bool disable_zero_copy_tx;
+module_param(disable_zero_copy_tx, bool, 0644);
+MODULE_PARM_DESC(disable_zero_copy_tx,
+ "Disable zero-copy when sending packets.");
+
/*
* For CMD_SINGLE_READ and CMD_INTERNAL_READ, WILC may insert one or
* more zero bytes between the command response and the DATA Start tag
@@ -41,7 +46,7 @@ MODULE_PARM_DESC(enable_crc16,
*/
#define WILC_SPI_RSP_HDR_EXTRA_DATA 8

-static const struct wilc_hif_func wilc_hif_spi;
+static struct wilc_hif_func wilc_hif_spi;

static int wilc_spi_reset(struct wilc *wilc);
static int wilc_spi_write_sk_buffs(struct wilc *wilc, u32 addr,
@@ -254,6 +259,9 @@ static int wilc_bus_probe(struct spi_device *spi)
if (!spi_priv)
return -ENOMEM;

+ if (!disable_zero_copy_tx)
+ wilc_hif_spi.hif_sk_buffs_tx = wilc_spi_write_sk_buffs;
+
ret = wilc_cfg80211_init(&wilc, &spi->dev, WILC_HIF_SPI, &wilc_hif_spi);
if (ret)
goto free;
@@ -1424,7 +1432,7 @@ static int wilc_spi_sync_ext(struct wilc *wilc, int nint)
}

/* Global spi HIF function table */
-static const struct wilc_hif_func wilc_hif_spi = {
+static struct wilc_hif_func wilc_hif_spi = {
.hif_init = wilc_spi_init,
.hif_deinit = wilc_spi_deinit,
.hif_read_reg = wilc_spi_read_reg,
@@ -1436,7 +1444,6 @@ static const struct wilc_hif_func wilc_hif_spi = {
.hif_read_size = wilc_spi_read_size,
.hif_block_tx_ext = wilc_spi_write,
.hif_block_rx_ext = wilc_spi_read,
- .hif_sk_buffs_tx = wilc_spi_write_sk_buffs,
.hif_sync_ext = wilc_spi_sync_ext,
.hif_reset = wilc_spi_reset,
};
--
2.25.1
\
 
 \ /
  Last update: 2021-12-23 02:16    [W:0.303 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site