diff options
author | Darius Rad <darius@bluespec.com> | 2018-05-22 16:37:47 -0400 |
---|---|---|
committer | Tomas Vanek <vanekt@fbl.cz> | 2018-11-26 09:35:48 +0000 |
commit | eb8dfd5ca8af6f2d784f6b1d30c96b40c52ae0ce (patch) | |
tree | 7532798b8a6d4a988ce58e3b3679e04bcad5a35e /src/jtag | |
parent | 9542cb7c3d9f4b66d2df3d8412a73d008077ab86 (diff) | |
download | riscv-openocd-eb8dfd5ca8af6f2d784f6b1d30c96b40c52ae0ce.zip riscv-openocd-eb8dfd5ca8af6f2d784f6b1d30c96b40c52ae0ce.tar.gz riscv-openocd-eb8dfd5ca8af6f2d784f6b1d30c96b40c52ae0ce.tar.bz2 |
Set TCP_NODELAY for local connections to jtag_vpi.
This increases performance drematically for local connections, which is the
most likely arrangement for a VPI connection.
Change-Id: Id15b29ae663f5d8100b2175357649bd03d05b7c8
Signed-off-by: Darius Rad <darius@bluespec.com>
Reviewed-on: http://openocd.zylin.com/4549
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Diffstat (limited to 'src/jtag')
-rw-r--r-- | src/jtag/drivers/jtag_vpi.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/jtag/drivers/jtag_vpi.c b/src/jtag/drivers/jtag_vpi.c index 1a42b3a..35c7031 100644 --- a/src/jtag/drivers/jtag_vpi.c +++ b/src/jtag/drivers/jtag_vpi.c @@ -29,6 +29,10 @@ #include <arpa/inet.h> #endif +#ifndef _WIN32 +#include <netinet/tcp.h> +#endif + #define NO_TAP_SHIFT 0 #define TAP_SHIFT 1 @@ -368,6 +372,8 @@ static int jtag_vpi_execute_queue(void) static int jtag_vpi_init(void) { + int flag = 1; + sockfd = socket(AF_INET, SOCK_STREAM, 0); if (sockfd < 0) { LOG_ERROR("Could not create socket"); @@ -395,6 +401,13 @@ static int jtag_vpi_init(void) return ERROR_COMMAND_CLOSE_CONNECTION; } + if (serv_addr.sin_addr.s_addr == htonl(INADDR_LOOPBACK)) { + /* This increases performance drematically for local + * connections, which is the most likely arrangement + * for a VPI connection. */ + setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(int)); + } + LOG_INFO("Connection to %s : %u succeed", server_address, server_port); return ERROR_OK; |