Browse Source

Minor timer changes (~21 Mb/s local)

Joseph Henry 10 years ago
parent
commit
bbfc9359e9
4 changed files with 15 additions and 8 deletions
  1. 7 3
      ext/lwipopts.h
  2. 2 2
      make-linux.mk
  3. 4 1
      netcon/NetconEthernetTap.cpp
  4. 2 2
      netcon/intercept.c

+ 7 - 3
ext/lwipopts.h

@@ -64,6 +64,10 @@
 
 
 //#define PBUF_POOL_BUFSIZE 2048
 //#define PBUF_POOL_BUFSIZE 2048
 
 
+
+#define TCP_MSS 2048
+#define TCP_WND 512
+
 /*------------------------------------------------------------------------------
 /*------------------------------------------------------------------------------
 ---------------------------------- Timers --------------------------------------
 ---------------------------------- Timers --------------------------------------
 ------------------------------------------------------------------------------*/
 ------------------------------------------------------------------------------*/
@@ -71,7 +75,7 @@
 /* these are originally defined in tcp_impl.h */
 /* these are originally defined in tcp_impl.h */
 #ifndef TCP_TMR_INTERVAL
 #ifndef TCP_TMR_INTERVAL
 /* The TCP timer interval in milliseconds. */
 /* The TCP timer interval in milliseconds. */
-#define TCP_TMR_INTERVAL       20
+#define TCP_TMR_INTERVAL       250
 #endif /* TCP_TMR_INTERVAL */
 #endif /* TCP_TMR_INTERVAL */
 
 
 #ifndef TCP_FAST_INTERVAL
 #ifndef TCP_FAST_INTERVAL
@@ -113,7 +117,7 @@
 ------------------------------------------------------------------------------*/
 ------------------------------------------------------------------------------*/
 
 
 
 
-#define LWIP_CHKSUM_ALGORITHM 0
+#define LWIP_CHKSUM_ALGORITHM 2
 
 
 
 
 /**
 /**
@@ -146,7 +150,7 @@
  * MEMP_NUM_RAW_PCB: Number of raw connection PCBs
  * MEMP_NUM_RAW_PCB: Number of raw connection PCBs
  * (requires the LWIP_RAW option)
  * (requires the LWIP_RAW option)
  */
  */
-#define MEMP_NUM_RAW_PCB                128
+#define MEMP_NUM_RAW_PCB                32
 
 
 /**
 /**
  * MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
  * MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One

+ 2 - 2
make-linux.mk

@@ -73,8 +73,8 @@ endif
 # "make debug" is a shortcut for this
 # "make debug" is a shortcut for this
 ifeq ($(ZT_DEBUG),1)
 ifeq ($(ZT_DEBUG),1)
 	DEFS+=-DZT_TRACE
 	DEFS+=-DZT_TRACE
-	CFLAGS+=-Wall -pg -g -pthread $(INCLUDES) $(DEFS)
-	CXXFLAGS+=-Wall -pg -g -pthread $(INCLUDES) $(DEFS)
+	CFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS)
+	CXXFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS)
 	LDFLAGS=-ldl
 	LDFLAGS=-ldl
 	STRIP=echo
 	STRIP=echo
 	# The following line enables optimization for the crypto code, since
 	# The following line enables optimization for the crypto code, since

+ 4 - 1
netcon/NetconEthernetTap.cpp

@@ -307,7 +307,7 @@ void NetconEthernetTap::closeAll()
 		closeConnection(tcp_connections.front());
 		closeConnection(tcp_connections.front());
 }
 }
 
 
-#define ZT_LWIP_TCP_TIMER_INTERVAL 5
+#define ZT_LWIP_TCP_TIMER_INTERVAL 1
 
 
 void NetconEthernetTap::threadMain()
 void NetconEthernetTap::threadMain()
 	throw()
 	throw()
@@ -344,6 +344,7 @@ void NetconEthernetTap::threadMain()
 		if (since_tcp >= ZT_LWIP_TCP_TIMER_INTERVAL) {
 		if (since_tcp >= ZT_LWIP_TCP_TIMER_INTERVAL) {
 			prev_tcp_time = now;
 			prev_tcp_time = now;
 			lwipstack->tcp_tmr();
 			lwipstack->tcp_tmr();
+			//fprintf(stderr, "tcp_tmr\n");
 		} else {
 		} else {
 			tcp_remaining = ZT_LWIP_TCP_TIMER_INTERVAL - since_tcp;
 			tcp_remaining = ZT_LWIP_TCP_TIMER_INTERVAL - since_tcp;
 		}
 		}
@@ -353,6 +354,7 @@ void NetconEthernetTap::threadMain()
 		} else {
 		} else {
 			etharp_remaining = ARP_TMR_INTERVAL - since_etharp;
 			etharp_remaining = ARP_TMR_INTERVAL - since_etharp;
 		}
 		}
+		//fprintf(stderr, "poll_wait_time = %d\n", (unsigned long)std::min(tcp_remaining,etharp_remaining));
 		_phy.poll((unsigned long)std::min(tcp_remaining,etharp_remaining));
 		_phy.poll((unsigned long)std::min(tcp_remaining,etharp_remaining));
 	}
 	}
 	closeAll();
 	closeAll();
@@ -399,6 +401,7 @@ void NetconEthernetTap::phyOnFileDescriptorActivity(PhySocket *sock,void **uptr,
 			now space on the buffer */
 			now space on the buffer */
 			if(sndbuf == 0) {
 			if(sndbuf == 0) {
 				_phy.setNotifyReadable(sock, false);
 				_phy.setNotifyReadable(sock, false);
+				lwipstack->_tcp_output(conn->pcb);
 				return;
 				return;
 			}
 			}
 
 

+ 2 - 2
netcon/intercept.c

@@ -137,7 +137,7 @@ static int is_initialized = 0;
 static int fdret_sock; // used for fd-transfers
 static int fdret_sock; // used for fd-transfers
 static int newfd; // used for "this_end" socket
 static int newfd; // used for "this_end" socket
 
 
-static char* af_sock_name  = "/tmp/.ztnc_8056c2e21c000001";
+static char* af_sock_name  = "/tmp/.ztnc_e5cd7a9e1c5311ab";
 static char* logfilename   = "intercept.log";
 static char* logfilename   = "intercept.log";
 FILE *logfile       = NULL;
 FILE *logfile       = NULL;
 static char* logmode       = "a";
 static char* logmode       = "a";
@@ -791,7 +791,7 @@ int listen(LISTEN_SIG)
     return(reallisten(sockfd, backlog));
     return(reallisten(sockfd, backlog));
 
 
   char cmd[BUF_SZ];
   char cmd[BUF_SZ];
-  //dwr("listen(%d)\n", sockfd);
+  dwr("listen(%d)\n", sockfd);
   /* Assemble and route command */
   /* Assemble and route command */
   memset(cmd, '\0', BUF_SZ);
   memset(cmd, '\0', BUF_SZ);
   struct listen_st rpc_st;
   struct listen_st rpc_st;