From 48760b26368b144323973dad7a31124930942972 Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Thu, 4 Jul 2019 11:30:54 +0000 Subject: [PATCH] Merged in masayuki2009/nuttx.nuttx/improve_gs2200m_performance (pull request #931) Improve gs2200m performance * arch/arm/src/cxd56xx: Fix dma initialization in cxd56_dmac.c up_dma_initialize() must be used instead of up_dmainitialize() Signed-off-by: Masayuki Ishikawa * drivers/wireless: Introduce CONFIG_WL_GS2200M_SPI_FREQUENCY Also, changed usleep(100) to up_udelay(100) to avoid invalid response. Signed-off-by: Masayuki Ishikawa * configs/spresense/wifi: Improve performance for webserver This commit changes followings. 1. Enable SPI DMA for both TX and RX 2. Increase SPI clock speed from 4MHz to 10MHz 3. Increase buffer size for sendfile() from 512B to 1KB 4. Enable sendfile() for webserver Signed-off-by: Masayuki Ishikawa Approved-by: Gregory Nutt --- arch/arm/src/cxd56xx/cxd56_dmac.c | 2 +- configs/spresense/wifi/defconfig | 6 ++++++ drivers/wireless/Kconfig | 9 +++++++++ drivers/wireless/gs2200m.c | 13 ++++++++++--- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/arch/arm/src/cxd56xx/cxd56_dmac.c b/arch/arm/src/cxd56xx/cxd56_dmac.c index 851065822d..5f1126a7fe 100644 --- a/arch/arm/src/cxd56xx/cxd56_dmac.c +++ b/arch/arm/src/cxd56xx/cxd56_dmac.c @@ -664,7 +664,7 @@ static int dma_stop(int ch) * ****************************************************************************/ -void weak_function up_dmainitialize(void) +void weak_function up_dma_initialize(void) { int i; diff --git a/configs/spresense/wifi/defconfig b/configs/spresense/wifi/defconfig index dfefc6ab1f..7b9d8a5e78 100644 --- a/configs/spresense/wifi/defconfig +++ b/configs/spresense/wifi/defconfig @@ -20,6 +20,8 @@ CONFIG_BOOT_RUNFROMISRAM=y CONFIG_BUILTIN=y CONFIG_CLOCK_MONOTONIC=y CONFIG_CODECS_HASH_MD5=y +CONFIG_CXD56_DMAC_SPI5_RX=y +CONFIG_CXD56_DMAC_SPI5_TX=y CONFIG_CXD56_SDIO=y CONFIG_CXD56_SPI5=y CONFIG_CXD56_SPI=y @@ -38,15 +40,18 @@ CONFIG_FS_PROCFS_REGISTER=y CONFIG_HAVE_CXX=y CONFIG_HAVE_CXXINITIALIZE=y CONFIG_I2C=y +CONFIG_LIB_SENDFILE_BUFSIZE=1024 CONFIG_MAX_WDOGPARMS=2 CONFIG_MMCSD=y CONFIG_MMCSD_SDIO=y +CONFIG_NAME_MAX=256 CONFIG_NET=y CONFIG_NETDB_DNSCLIENT=y CONFIG_NETDEVICES=y CONFIG_NETINIT_NETLOCAL=y CONFIG_NETUTILS_CODECS=y CONFIG_NETUTILS_FTPC=y +CONFIG_NETUTILS_HTTPD_SENDFILE=y CONFIG_NETUTILS_TELNETD=y CONFIG_NETUTILS_WEBCLIENT=y CONFIG_NETUTILS_WEBSERVER=y @@ -93,3 +98,4 @@ CONFIG_USBMSC_REMOVABLE=y CONFIG_USER_ENTRYPOINT="nsh_main" CONFIG_WIRELESS_GS2200M=y CONFIG_WL_GS2200M=y +CONFIG_WL_GS2200M_SPI_FREQUENCY=10000000 diff --git a/drivers/wireless/Kconfig b/drivers/wireless/Kconfig index 0662abcffc..c49988e9c4 100644 --- a/drivers/wireless/Kconfig +++ b/drivers/wireless/Kconfig @@ -29,6 +29,15 @@ config WL_GS2200M select SPI select LIBC_SCANSET +if WL_GS2200M + +config WL_GS2200M_SPI_FREQUENCY + int "SPI frequencey for GS2200M" + default 4000000 + range 4000000 10000000 + +endif + source drivers/wireless/spirit/Kconfig menuconfig DRIVERS_IEEE802154 diff --git a/drivers/wireless/gs2200m.c b/drivers/wireless/gs2200m.c index 57cc38d9ce..542371623a 100644 --- a/drivers/wireless/gs2200m.c +++ b/drivers/wireless/gs2200m.c @@ -72,7 +72,7 @@ #define GS2200MWORK LPWORK -#define SPI_MAXFREQ (4000000) /* 4MHz. */ +#define SPI_MAXFREQ CONFIG_WL_GS2200M_SPI_FREQUENCY #define NRESPMSG 8 #define MAX_PKT_LEN 1500 @@ -861,7 +861,7 @@ retry: * workaround to avoid realy receiving an invalid frame response */ - usleep(100); + up_udelay(100); /* Read frame response */ @@ -1408,7 +1408,7 @@ static enum pkt_type_e gs2200m_get_mac(FAR struct gs2200m_dev_s *dev) dev->net_dev.d_mac.ether.ether_addr_octet[n] = (uint8_t)mac[n]; } - errout: +errout: _release_pkt_dat(&pkt_dat); return r; } @@ -1868,6 +1868,13 @@ static int gs2200m_ioctl_connect(FAR struct gs2200m_dev_s *dev, break; default: + /* REVISIT: + * TYPE_BULK for other sockets might be received here, + * if the sockets have heavy bulk traffic. + * In this case, the packet should be queued and + * wait for a response to the NCTCP command. + */ + wlerr("+++ error: type=%d \n", type); ASSERT(false); ret = -EINVAL;