Index: lib/libstand/nfs.c =================================================================== --- lib/libstand/nfs.c +++ lib/libstand/nfs.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -50,7 +51,8 @@ #define NFS_DEBUGxx -#define NFSREAD_SIZE 1024 +#define NFSREAD_MIN_SIZE 1024 +#define NFSREAD_MAX_SIZE 4096 /* Define our own NFS attributes without NQNFS stuff. */ #ifdef OLD_NFSV2 @@ -83,7 +85,7 @@ n_long errno; struct nfsv2_fattrs fa; n_long count; - u_char data[NFSREAD_SIZE]; + u_char data[NFSREAD_MAX_SIZE]; }; #ifndef NFS_NOSYMLINK @@ -210,6 +212,8 @@ nfs_readdir }; +static int nfs_read_size = NFSREAD_MIN_SIZE; + #ifdef OLD_NFSV2 /* * Fetch the root file handle (call mount daemon) @@ -264,6 +268,17 @@ if (repl->errno) return (ntohl(repl->errno)); bcopy(repl->fh, fhp, sizeof(repl->fh)); + + /* + * Improve boot performance over NFS + */ + if (getenv("nfs.read_size") != NULL) + nfs_read_size = strtol(getenv("nfs.read_size"), NULL, 0); + if (nfs_read_size < NFSREAD_MIN_SIZE) + nfs_read_size = NFSREAD_MIN_SIZE; + if (nfs_read_size > NFSREAD_MAX_SIZE) + nfs_read_size = NFSREAD_MAX_SIZE; + return (0); } @@ -401,11 +416,11 @@ bcopy(d->fh, args->fh, NFS_FHSIZE); args->off = htonl((n_long)off); - if (len > NFSREAD_SIZE) - len = NFSREAD_SIZE; + if (len > nfs_read_size) + len = nfs_read_size; args->len = htonl((n_long)len); args->xxx = htonl((n_long)0); - hlen = sizeof(*repl) - NFSREAD_SIZE; + hlen = offsetof(struct nfs_read_rpl, data[0]); cc = rpc_call(d->iodesc, NFS_PROG, NFS_VER2, NFSPROC_READ, args, sizeof(*args), @@ -1025,7 +1040,7 @@ uint32_t count; uint32_t eof; uint32_t len; - u_char data[NFSREAD_SIZE]; + u_char data[NFSREAD_MAX_SIZE]; } *repl; struct { uint32_t h[RPC_HEADER_WORDS]; @@ -1048,10 +1063,10 @@ pos = roundup(d->fhsize, sizeof(uint32_t)) / sizeof(uint32_t); args->fhoffcnt[pos++] = 0; args->fhoffcnt[pos++] = htonl((uint32_t)off); - if (len > NFSREAD_SIZE) - len = NFSREAD_SIZE; + if (len > nfs_read_size) + len = nfs_read_size; args->fhoffcnt[pos] = htonl((uint32_t)len); - hlen = sizeof(*repl) - NFSREAD_SIZE; + hlen = offsetof(struct repl, data[0]); cc = rpc_call(d->iodesc, NFS_PROG, NFS_VER3, NFSPROCV3_READ, args, 4 * sizeof(uint32_t) + roundup(d->fhsize, sizeof(uint32_t)), Index: sys/boot/i386/pxeldr/pxeboot.8 =================================================================== --- sys/boot/i386/pxeldr/pxeboot.8 +++ /dev/null @@ -1,121 +0,0 @@ -.\" Copyright (c) 1999 Doug White -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd May 1, 2000 -.Dt PXEBOOT 8 -.Os -.Sh NAME -.Nm pxeboot -.Nd Preboot Execution Environment (PXE) bootloader -.Sh DESCRIPTION -The -.Nm -bootloader is a modified version of the system third-stage bootstrap -.Xr loader 8 -configured to run under Intel's Preboot Execution Environment (PXE) system. -PXE is a form of smart boot ROM, built into Intel EtherExpress Pro/100 and -3Com 3c905c Ethernet cards, and Ethernet-equipped Intel motherboards. -PXE supports DHCP configuration and provides low-level NIC access services. -The -.Nm -bootloader retrieves the kernel, modules, -and other files either via NFS over UDP or by TFTP, -selectable through compile-time options. -In combination with a memory file system image or NFS-mounted root file system, -.Nm -allows for easy, -EEPROM-burner free construction of diskless machines. -.Pp -The -.Nm -binary is loaded just like any other boot file, -by specifying it in the DHCP server's configuration file. -Below is a sample configuration for the ISC DHCP v2 server: -.Bd -literal -offset indent -option domain-name "example.com"; -option routers 10.0.0.1; -option subnet-mask 255.255.255.0; -option broadcast-address 10.0.0.255; -option domain-name-servers 10.0.0.1; -server-name "DHCPserver"; -server-identifier 10.0.0.1; - -default-lease-time 120; -max-lease-time 120; - -subnet 10.0.0.0 netmask 255.255.255.0 { - filename "pxeboot"; - range 10.0.0.10 10.0.0.254; -} - -.Ed -.Nm -recognizes -.Va next-server -and -.Va option root-path -directives as the server and path to NFS mount for file requests, -respectively, or the server to make TFTP requests to. -Note that -.Nm -expects to fetch -.Pa /boot/loader.rc -from the specified server before loading any other files. -.Pp -In all other respects, -.Nm -acts just like -.Xr loader 8 . -.Pp -As PXE is still in its infancy, some firmware versions may not work -properly. -The -.Nm -bootloader has been extensively tested on version 0.99 of Intel firmware; -pre-release versions of the newer 2.0 firmware are known to have -problems. -Check with the device's manufacturer for their latest stable release. -.Pp -For further information on Intel's PXE specifications and Wired for -Management (WfM) systems, see -.Li http://www.intel.com/design/archives/wfm/ . -.Sh SEE ALSO -.Xr loader 8 -.Sh HISTORY -The -.Nm -bootloader first appeared in -.Fx 4.1 . -.Sh AUTHORS -.An -nosplit -The -.Nm -bootloader was written by -.An John Baldwin Aq jhb@FreeBSD.org -and -.An Paul Saab Aq ps@FreeBSD.org . -This manual page was written by -.An Doug White Aq dwhite@FreeBSD.org .