afsd-allow-maxmtu-override-20090530
authorDouglas Engert <deengert@anl.gov>
Sun, 31 May 2009 02:22:24 +0000 (02:22 +0000)
committerDerrick Brashear <shadow@dementia.org>
Sun, 31 May 2009 02:22:24 +0000 (02:22 +0000)
LICENSE IPL10
FIXES 124880

rxi_Findcbi, rxi_FIndIfnet, rxi_FindIfMTU "failure" end up returning
the RX_REMOTE_PACKET_SIZE as the mtu to use unless we allow our override
to apply, so we do that. then, add an afsd switch to allow setting it.

afsd man page update required and will follow.

====================
This delta was composed from multiple commits as part of the CVS->Git migration.
The checkin message with each commit was inconsistent.
The following are the additional commit messages.
====================
LICENSE IPL10
FIXES 124880

man page update to document previous work

doc/man-pages/pod8/afsd.pod
src/afs/afs_call.c
src/afsd/afs.conf.linux
src/afsd/afsd.c
src/config/afs_args.h
src/rx/rx_kcommon.c

index d46c35e..a2f1f09 100644 (file)
@@ -25,7 +25,8 @@ B<afsd> [B<-afsdb>] [B<-backuptree>]
      [B<-nosettime>]
      S<<< [B<-prealloc> <I<number of 'small' preallocated blocks>>] >>>
      [B<-rmtsys>] S<<< [B<-rootvol> <I<name of AFS root volume>>] >>>
-     [B<-rxbind>] S<<< [B<-rxpck> value for rx_extraPackets ] >>>
+     [B<-rxbind>] S<<< [B<-rxmaxmtu> value for maximum MTU ] >>> 
+     S<<< [B<-rxpck> value for rx_extraPackets ] >>>
      [B<-settime>] [B<-shutdown>]
      S<<< [B<-splitcache> <I<RW/RO ratio>>] >>>
      S<<< [B<-stat> <I<number of stat entries>>] >>> [B<-verbose>]
@@ -628,6 +629,13 @@ B<-dynroot> is given.
 
 Bind the Rx socket (one interface only).
 
+=item B<-rxmaxmtu> <I<value for maximum MTU>>
+
+Set a limit for the largest maximum transfer unit (network packet size) that
+the AFS client on this machine will be willing to transmit. This switch can
+be used where an artificial limit on the network precludes packets as large
+as the discoverable MTU from being transmitted successfully.
+
 =item B<-rxpck> <I<value for rx_extraPackets>>
 
 Set rx_extraPackets to this value. This sets the number of extra Rx
index 04610ef..2060cc1 100644 (file)
@@ -1139,6 +1139,8 @@ afs_syscall_call(long parm, long parm2, long parm3, long parm4, long parm5, long
     } else if (parm == AFSOP_SET_RXPCK) {
        rx_extraPackets = parm2;
        afscall_set_rxpck_received = 1;
+    } else if (parm == AFSOP_SET_RXMAXMTU) {
+    rx_MyMaxSendSize = rx_maxReceiveSizeUser = rx_maxReceiveSize = parm2;
     } else
        code = EINVAL;
 
index 456d073..cef13f5 100644 (file)
@@ -59,6 +59,8 @@ ENABLE_DYNROOT=on
 #      -logfile   Place where to put the logfile (default in <cache>/etc/AFSLog.
 #      -waitclose make close calls always synchronous (slows em down, tho)
 #      -files_per_subdir [n]   number of files per cache subdir. (def=2048)
+#      -rxmaxmtu  Max mtu. Useful when using VPN when packets might fragment.
+#                 a value of 1244 should work.
 #      -shutdown  Shutdown afs daemons
 # ---------------------------------------------------------------------------
 XXLARGE="-fakestat -stat 4000 -dcache 4000 -daemons 6 -volumes 256"
index 3316c78..85718d3 100644 (file)
@@ -31,6 +31,7 @@
   *    -confdir    The configuration directory .
   *    -nosettime  Don't keep checking the time to avoid drift (default).
   *     -settime    Keep checking the time to avoid drift.
+  *    -rxmaxmtu   Set the max mtu to help with VPN issues.
   *    -verbose     Be chatty.
   *    -disable-dynamic-vcaches     Disable the use of -stat value as the starting size of
   *                          the size of the vcache/stat cache pool, 
@@ -327,6 +328,7 @@ int afsd_dynamic_vcaches = 0;       /* Enable dynamic-vcache support */
 int afsd_verbose = 0;          /*Are we being chatty? */
 int afsd_debug = 0;            /*Are we printing debugging info? */
 int afsd_CloseSynch = 0;       /*Are closes synchronous or not? */
+int rxmaxmtu = 0;       /* Are we forcing a limit on the mtu? */
 
 #ifdef AFS_SGI62_ENV
 #define AFSD_INO_T ino64_t
@@ -1772,6 +1774,12 @@ mainproc(struct cmd_syndesc *as, void *arock)
     printf("afsd: %s dynamically allocated vcaches\n", ( afsd_dynamic_vcaches ? "enabling" : "disabling" ));
 #endif
 
+    /* set -rxmaxmtu */
+    if (as->parms[35].items) {
+        /* -rxmaxmtu */
+        rxmaxmtu = atoi(as->parms[35].items->data);
+    }
+
     /*
      * Pull out all the configuration info for the workstation's AFS cache and
      * the cellular community we're willing to let our users see.
@@ -2192,6 +2200,14 @@ mainproc(struct cmd_syndesc *as, void *arock)
               fullpn_CellInfoFile);
     call_syscall(AFSOP_CELLINFO, fullpn_CellInfoFile);
 
+    if (rxmaxmtu) {
+    if (afsd_verbose)
+        printf("%s: Setting rxmaxmtu in kernel = %d\n", rn, rxmaxmtu);
+    code = call_syscall(AFSOP_SET_RXMAXMTU, rxmaxmtu);
+    if (code)
+        printf("%s: Error seting rxmaxmtu\n", rn);
+    }
+
     if (enable_dynroot) {
        if (afsd_verbose)
            printf("%s: Enabling dynroot support in kernel.\n", rn);
@@ -2499,9 +2515,10 @@ main(int argc, char **argv)
                "set rx_extraPackets to this value");
     cmd_AddParm(ts, "-splitcache", CMD_SINGLE, CMD_OPTIONAL,
                "Percentage RW versus RO in cache (specify as 60/40)");
-     cmd_AddParm(ts, "-disable-dynamic-vcaches", CMD_FLAG, CMD_OPTIONAL, 
-        "disable stat/vcache cache growing as needed");
-
+    cmd_AddParm(ts, "-disable-dynamic-vcaches", CMD_FLAG, CMD_OPTIONAL, 
+               "disable stat/vcache cache growing as needed");
+    cmd_AddParm(ts, "-rxmaxmtu", CMD_SINGLE, CMD_OPTIONAL, "set rx max MTU to use");
+    
     return (cmd_Dispatch(argc, argv));
 }
 
index 1983cb5..e599bda 100644 (file)
@@ -46,8 +46,9 @@
 #define        AFSOP_SET_THISCELL       35     /* set the primary cell */
 #define AFSOP_BASIC_INIT        36     /* used to be part of START_AFS */
 #define AFSOP_SET_BACKUPTREE    37     /* enable backup tree support */
-#define AFSOP_SET_RXPCK                 38     /*set rx_extraPackets*/
+#define AFSOP_SET_RXPCK                 38     /* set rx_extraPackets*/
 #define AFSOP_BUCKETPCT          39     /* bucket percentage */
+#define AFSOP_SET_RXMAXMTU       40     /* set rx_MyMaxSendSize,rx_maxReceiveSizeUser,rx_maxReceiveSize */  
 
 /* The range 20-30 is reserved for AFS system offsets in the afs_syscall */
 #define        AFSCALL_PIOCTL          20
index 7eb0cd5..9d55474 100644 (file)
@@ -418,7 +418,7 @@ rxi_InitPeerParams(struct rx_peer *pp)
     if (i == -1) {
        pp->timeout.sec = 3;
        /* pp->timeout.usec = 0; */
-       pp->ifMTU = RX_REMOTE_PACKET_SIZE;
+       pp->ifMTU = MIN(RX_REMOTE_PACKET_SIZE, rx_MyMaxSendSize);
     } else {
        pp->timeout.sec = 2;
        /* pp->timeout.usec = 0; */
@@ -434,7 +434,7 @@ rxi_InitPeerParams(struct rx_peer *pp)
                pp->ifMTU = rxmtu;
        }
     } else {                   /* couldn't find the interface, so assume the worst */
-       pp->ifMTU = RX_REMOTE_PACKET_SIZE;
+       pp->ifMTU = MIN(RX_REMOTE_PACKET_SIZE, rx_MyMaxSendSize);
     }
 #else /* AFS_USERSPACE_IP_ADDR */
     AFS_IFNET_T ifn;
@@ -466,7 +466,7 @@ rxi_InitPeerParams(struct rx_peer *pp)
     } else {                   /* couldn't find the interface, so assume the worst */
        pp->timeout.sec = 3;
        /* pp->timeout.usec = 0; */
-       pp->ifMTU = RX_REMOTE_PACKET_SIZE;
+       pp->ifMTU = MIN(RX_REMOTE_PACKET_SIZE, rx_MyMaxSendSize);
     }
 #endif /* else AFS_USERSPACE_IP_ADDR */
 #else /* AFS_SUN5_ENV */
@@ -475,7 +475,7 @@ rxi_InitPeerParams(struct rx_peer *pp)
     if (mtu <= 0) {
        pp->timeout.sec = 3;
        /* pp->timeout.usec = 0; */
-       pp->ifMTU = RX_REMOTE_PACKET_SIZE;
+       pp->ifMTU = MIN(RX_REMOTE_PACKET_SIZE, rx_MyMaxSendSize);
     } else {
        pp->timeout.sec = 2;
        /* pp->timeout.usec = 0; */
@@ -491,7 +491,7 @@ rxi_InitPeerParams(struct rx_peer *pp)
                pp->ifMTU = rxmtu;
        }
     } else {                   /* couldn't find the interface, so assume the worst */
-       pp->ifMTU = RX_REMOTE_PACKET_SIZE;
+       pp->ifMTU = MIN(RX_REMOTE_PACKET_SIZE,rx_MyMaxSendSize);
     }
 #endif /* AFS_SUN5_ENV */
 #else /* ADAPT_MTU */