From: Jeffrey Altman Date: Wed, 21 Oct 2009 13:13:22 +0000 (-0400) Subject: Add rx_SetMinPeerTimeout and rx_GetMinPeerTimeout X-Git-Tag: openafs-devel-1_5_66~24 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=c4263054a0c3101199d84527f36e18e2743169c4 Add rx_SetMinPeerTimeout and rx_GetMinPeerTimeout 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 Tested-by: Jeffrey Altman Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- diff --git a/src/libafsrpc/afsrpc.def b/src/libafsrpc/afsrpc.def index 35fa380..29e7b76 100755 --- a/src/libafsrpc/afsrpc.def +++ b/src/libafsrpc/afsrpc.def @@ -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 diff --git a/src/rx/rx.c b/src/rx/rx.c index c7d4ad7..d06e676 100755 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -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); diff --git a/src/rx/rx_globals.c b/src/rx/rx_globals.c index 1cad13c..dd4e2cd 100644 --- a/src/rx/rx_globals.c +++ b/src/rx/rx_globals.c @@ -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) diff --git a/src/rx/rx_globals.h b/src/rx/rx_globals.h index a7557da..78020fb 100644 --- a/src/rx/rx_globals.h +++ b/src/rx/rx_globals.h @@ -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 */ diff --git a/src/rx/rx_prototypes.h b/src/rx/rx_prototypes.h index dce96d4..e1fbe50 100755 --- a/src/rx/rx_prototypes.h +++ b/src/rx/rx_prototypes.h @@ -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; diff --git a/src/shlibafsrpc/libafsrpc.map b/src/shlibafsrpc/libafsrpc.map index c38f7b3..8272b43 100755 --- a/src/shlibafsrpc/libafsrpc.map +++ b/src/shlibafsrpc/libafsrpc.map @@ -125,6 +125,8 @@ rx_GetMaxSendWindow; rx_SetMaxReceiveWindow; rx_SetMaxSendWindow; + rx_GetMinPeerTimeout; + rx_SetMinPeerTimeout; local: *;