From: Andrew Deason Date: Thu, 21 Jul 2011 18:20:54 +0000 (-0500) Subject: afsd: Add the -rxmaxfrags option X-Git-Tag: upstream/1.6.6_pre2^2~75 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=3ddea6c9cc770b3fcc2669b6b43d44deea5f2d03;p=packages%2Fo%2Fopenafs.git afsd: Add the -rxmaxfrags option Add an option to afsd to limit the number of fragments Rx will send/receive, called -rxmaxfrags. Reviewed-on: http://gerrit.openafs.org/4899 Tested-by: Derrick Brashear Reviewed-by: Derrick Brashear (cherry picked from commit ba546ecf0c6a404f2efced2e600826621876ffcf) Change-Id: Idb93fc60b3056604c1d415ac7fc134ee672ceefe Reviewed-on: http://gerrit.openafs.org/9430 Tested-by: BuildBot Reviewed-by: Mark Vitale Reviewed-by: Andrew Deason Reviewed-by: Stephan Wiesand --- diff --git a/doc/man-pages/pod8/afsd.pod b/doc/man-pages/pod8/afsd.pod index 932e8c664..3e90c355d 100644 --- a/doc/man-pages/pod8/afsd.pod +++ b/doc/man-pages/pod8/afsd.pod @@ -32,7 +32,7 @@ B [B<-afsdb>] [B<-backuptree>] S<<< [B<-stat> >] >>> [B<-verbose>] [B<-disable-dynamic-vcaches>] S<<< [B<-volumes> >] >>> - [B<-waitclose>] + [B<-waitclose>] [B<-rxmaxfrags> >] =for html @@ -670,6 +670,20 @@ B<-dynroot> is given. Bind the Rx socket (one interface only). +=item B<-rxmaxfrags> > + +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> > Set a limit for the largest maximum transfer unit (network packet size) that diff --git a/src/afs/afs_call.c b/src/afs/afs_call.c index 4fa969083..7ba29659c 100644 --- a/src/afs/afs_call.c +++ b/src/afs/afs_call.c @@ -1328,6 +1328,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; } diff --git a/src/afsd/afsd.c b/src/afsd/afsd.c index 800fefcaa..c4eb720ca 100644 --- a/src/afsd/afsd.c +++ b/src/afsd/afsd.c @@ -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); + } /* parse cacheinfo file if this is a diskcache */ if (ParseCacheInfoFile()) { @@ -2312,6 +2317,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); @@ -2571,6 +2584,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 diff --git a/src/config/afs_args.h b/src/config/afs_args.h index 54445edd0..9864b8bfc 100644 --- a/src/config/afs_args.h +++ b/src/config/afs_args.h @@ -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