This is an automated email from Gerrit.

Darius Rad ([email protected]) just uploaded a new patch set to Gerrit, which 
you can find at http://openocd.zylin.com/4549

-- gerrit

commit 8fb1c47eeaa9c5e5ae7e6006b613d08a72f506bf
Author: Darius Rad <[email protected]>
Date:   Tue May 22 16:37:47 2018 -0400

    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 <[email protected]>

diff --git a/src/jtag/drivers/jtag_vpi.c b/src/jtag/drivers/jtag_vpi.c
index a1787d4..9a207ef 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
 
@@ -371,6 +375,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");
@@ -398,6 +404,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;

-- 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to