afsd: Add the -rxmaxfrags option
authorAndrew Deason <adeason@sinenomine.net>
Thu, 21 Jul 2011 18:20:54 +0000 (13:20 -0500)
committerDerrick Brashear <shadow@dementia.org>
Fri, 22 Jul 2011 12:36:08 +0000 (05:36 -0700)
Add an option to afsd to limit the number of fragments Rx will
send/receive, called -rxmaxfrags.

Change-Id: I9f0b3edd95db17f82ef8f7d1e300df4eff355172
Reviewed-on: http://gerrit.openafs.org/4899
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

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

index ef5c930..9616ac1 100644 (file)
@@ -32,7 +32,7 @@ B<afsd> [B<-afsdb>] [B<-backuptree>]
      S<<< [B<-stat> <I<number of stat entries>>] >>> [B<-verbose>]
      [B<-disable-dynamic-vcaches>] 
      S<<< [B<-volumes> <I<number of volume entries>>] >>>
-     [B<-waitclose>]
+     [B<-waitclose>] [B<-rxmaxfrags> <I<max # of fragments>>]
 
 =for html
 </div>
@@ -660,6 +660,20 @@ B<-dynroot> is given.
 
 Bind the Rx socket (one interface only).
 
+=item B<-rxmaxfrags> <I<max # of fragments>>
+
+Set a limit for the maximum number of UDP fragments Rx will send per Rx
+packet, and the maximum number of fragments Rx thinks it can receive when
+advertising its receive size to peers. Practically speaking, setting this
+option means that you will not see Rx data packets that are broken into more
+than N fragments, where N is the value specified for this option. Setting this
+option to 1 effectively prevents fragmentation, and can be useful when dealing
+with networking equipment that does not properly handle UDP fragments.
+
+Note that this option just specifies a maximum. The actual number of fragments
+seen on the wire may be less than what is specified, depending on the
+configuration of the peer.
+
 =item B<-rxmaxmtu> <I<value for maximum MTU>>
 
 Set a limit for the largest maximum transfer unit (network packet size) that
index 39f7b97..123ae64 100644 (file)
@@ -1310,6 +1310,8 @@ afs_syscall_call(long parm, long parm2, long parm3,
        afscall_set_rxpck_received = 1;
     } else if (parm == AFSOP_SET_RXMAXMTU) {
        rx_MyMaxSendSize = rx_maxReceiveSizeUser = rx_maxReceiveSize = parm2;
+    } else if (parm == AFSOP_SET_RXMAXFRAGS) {
+       rxi_nSendFrags = rxi_nRecvFrags = parm2;
     } else {
        code = EINVAL;
     }
index b951a22..16d3451 100644 (file)
@@ -302,6 +302,7 @@ int afsd_verbose = 0;               /*Are we being chatty? */
 int afsd_debug = 0;            /*Are we printing debugging info? */
 static int afsd_CloseSynch = 0;        /*Are closes synchronous or not? */
 static int rxmaxmtu = 0;       /* Are we forcing a limit on the mtu? */
+static int rxmaxfrags = 0;      /* Are we forcing a limit on frags? */
 
 #ifdef AFS_SGI62_ENV
 #define AFSD_INO_T ino64_t
@@ -1904,6 +1905,10 @@ mainproc(struct cmd_syndesc *as, void *arock)
        /* -dynroot-sparse */
        enable_dynroot = 2;
     }
+    if (as->parms[38].items) {
+       /* -rxmaxfrags */
+       rxmaxfrags = atoi(as->parms[38].items->data);
+    }
     return 0;
 }
 
@@ -2308,6 +2313,14 @@ afsd_run(void)
        afsd_call_syscall(AFSOP_CELLINFO, fullpn_CellInfoFile);
     }
 
+    if (rxmaxfrags) {
+       if (afsd_verbose)
+            printf("%s: Setting rxmaxfrags in kernel = %d\n", rn, rxmaxfrags);
+       code = afsd_call_syscall(AFSOP_SET_RXMAXFRAGS, rxmaxfrags);
+        if (code)
+            printf("%s: Error seting rxmaxfrags\n", rn);
+    }
+
     if (rxmaxmtu) {
        if (afsd_verbose)
             printf("%s: Setting rxmaxmtu in kernel = %d\n", rn, rxmaxmtu);
@@ -2567,6 +2580,9 @@ afsd_init(void)
     cmd_AddParm(ts, "-rxmaxmtu", CMD_SINGLE, CMD_OPTIONAL, "set rx max MTU to use");
     cmd_AddParm(ts, "-dynroot-sparse", CMD_FLAG, CMD_OPTIONAL,
                "Enable dynroot support with minimal cell list");
+    cmd_AddParm(ts, "-rxmaxfrags", CMD_SINGLE, CMD_OPTIONAL,
+                "Set the maximum number of UDP fragments Rx should send/receive"
+                " per Rx packet");
 }
 
 int
index 54445ed..9864b8b 100644 (file)
@@ -50,6 +50,7 @@
 #define AFSOP_BUCKETPCT          39     /* bucket percentage */
 #define AFSOP_SET_RXMAXMTU       40     /* set rx_MyMaxSendSize,rx_maxReceiveSizeUser,rx_maxReceiveSize */
 #define AFSOP_BKG_HANDLER        41     /* userspace-capable Bkg daemon */
+#define AFSOP_SET_RXMAXFRAGS     43     /* set rxi_nSendFrags, rxi_nRecvFrags */
 
 /* The range 20-30 is reserved for AFS system offsets in the afs_syscall */
 #define        AFSCALL_PIOCTL          20