From: Andrew Deason Date: Thu, 21 Jul 2011 18:20:54 +0000 (-0500) Subject: afsd: Add the -rxmaxfrags option X-Git-Tag: openafs-devel-1_7_1~253 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=ba546ecf0c6a404f2efced2e600826621876ffcf afsd: Add the -rxmaxfrags option 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 Reviewed-by: Derrick Brashear --- diff --git a/doc/man-pages/pod8/afsd.pod b/doc/man-pages/pod8/afsd.pod index ef5c930..9616ac1 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 @@ -660,6 +660,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 39f7b97..123ae64 100644 --- a/src/afs/afs_call.c +++ b/src/afs/afs_call.c @@ -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; } diff --git a/src/afsd/afsd.c b/src/afsd/afsd.c index b951a22..16d3451 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); + } 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 diff --git a/src/config/afs_args.h b/src/config/afs_args.h index 54445ed..9864b8b 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