Add rx_SetMinPeerTimeout and rx_GetMinPeerTimeout
authorJeffrey Altman <jaltman@your-file-system.com>
Wed, 21 Oct 2009 13:13:22 +0000 (09:13 -0400)
committerDerrick Brashear <shadow|account-1000005@unknown>
Wed, 21 Oct 2009 17:58:45 +0000 (10:58 -0700)
Permit the minimum peer timeout value to be adjusted at runtime.
The default remains 350ms.

LICENSE BSD

Reviewed-on: http://gerrit.openafs.org/699
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

src/libafsrpc/afsrpc.def
src/rx/rx.c
src/rx/rx_globals.c
src/rx/rx_globals.h
src/rx/rx_prototypes.h
src/shlibafsrpc/libafsrpc.map

index 35fa380..29e7b76 100755 (executable)
@@ -253,6 +253,8 @@ EXPORTS
        rx_GetMaxSendWindow                     @258
        rx_SetMaxReceiveWindow                  @259
        rx_SetMaxSendWindow                     @260
+       rx_GetMinPeerTimeout                    @261
+       rx_SetMinPeerTimeout                    @262
 
 ; for performance testing
         rx_TSFPQGlobSize                        @2001 DATA
index c7d4ad7..d06e676 100755 (executable)
@@ -6068,12 +6068,11 @@ rxi_ComputeRoundTripTime(struct rx_packet *p,
        peer->rtt = _8THMSEC(rttp) + 8;
        peer->rtt_dev = peer->rtt >> 2; /* rtt/2: they're scaled differently */
     }
-    /* the timeout is RTT + 4*MDEV but no less than 350 msec   This is because one end or
-     * the other of these connections is usually in a user process, and can
-     * be switched and/or swapped out.  So on fast, reliable networks, the
-     * timeout would otherwise be too short.  
-     */
-    rtt_timeout = MAX(((peer->rtt >> 3) + peer->rtt_dev), 350);
+    /* the timeout is RTT + 4*MDEV but no less than rx_minPeerTimeout msec.
+     * This is because one end or the other of these connections is usually
+     * in a user process, and can be switched and/or swapped out.  So on fast,
+     * reliable networks, the timeout would otherwise be too short. */
+    rtt_timeout = MAX(((peer->rtt >> 3) + peer->rtt_dev), rx_minPeerTimeout);
     clock_Zero(&(peer->timeout));
     clock_Addmsec(&(peer->timeout), rtt_timeout);
 
index 1cad13c..dd4e2cd 100644 (file)
@@ -72,6 +72,17 @@ int rx_GetMaxSendWindow(void)
     return rx_maxSendWindow;
 }
 
+void rx_SetMinPeerTimeout(int timeo)
+{
+    if (timeo >= 1 && timeo < 1000)
+        rx_minPeerTimeout = timeo;
+}
+
+int rx_GetMinPeerTimeout(void)
+{
+    return rx_minPeerTimeout;
+}
+
 #ifdef AFS_NT40_ENV
 
 void rx_SetRxDeadTime(int seconds)
index a7557da..78020fb 100644 (file)
@@ -124,6 +124,7 @@ EXT int rx_BusyError GLOBALSINIT(-1);
 #define RX_FAST_ACK_RATE 1     /* as of 3.4, ask for an ack every 
                                 * other packet. */
 
+EXT int rx_minPeerTimeout GLOBALSINIT(350); /* in milliseconds */
 EXT int rx_minWindow GLOBALSINIT(1);
 EXT int rx_maxWindow GLOBALSINIT(65535);        /* twind is u_short */
 EXT int rx_initReceiveWindow GLOBALSINIT(16);  /* how much to accept */
index dce96d4..e1fbe50 100755 (executable)
@@ -350,6 +350,8 @@ extern int rx_GetMaxReceiveWindow(void);
 extern int rx_GetMaxSendWindow(void);
 extern void rx_SetMaxReceiveWindow(int packets);
 extern void rx_SetMaxSendWindow(int packets);
+extern int rx_GetMinPeerTimeout(void);
+extern void rx_SetMinPeerTimeout(int msecs);
 
 /* rx_kcommon.c */
 struct socket;
index c38f7b3..8272b43 100755 (executable)
        rx_GetMaxSendWindow;
        rx_SetMaxReceiveWindow;
        rx_SetMaxSendWindow;
+       rx_GetMinPeerTimeout;
+       rx_SetMinPeerTimeout;
 
     local:
        *;