Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs
On 12 May 2009, at 06:03, Kip Macy wrote: Here is the problem, FreeBSD is sloppy about 32-bit vs. 64-bit for xdr whereas in the kernel, Solaris is not. I thought that XDR 'long' types were 32 bit regardless of whether the platform was 32 or 64 bit. I'll have to read the code again. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r192011 - head/sys/netinet
Author: qingli Date: Tue May 12 07:41:20 2009 New Revision: 192011 URL: http://svn.freebsd.org/changeset/base/192011 Log: This patch adds a host route to an interface address (that is assigned to a non loopback/ppp link types) through the loopback interface. Prior to the new L2/L3 rewrite, this host route is implicitly added by the L2 code during RTM_RESOLVE of that interface address. This host route is deleted when that interface is removed. Reviewed by: kmacy Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c == --- head/sys/netinet/in.c Tue May 12 05:49:02 2009(r192010) +++ head/sys/netinet/in.c Tue May 12 07:41:20 2009(r192011) @@ -45,12 +45,15 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include #include +#include #include #include @@ -814,6 +817,9 @@ in_ifinit(struct ifnet *ifp, struct in_i INIT_VNET_INET(ifp->if_vnet); register u_long i = ntohl(sin->sin_addr.s_addr); struct sockaddr_in oldaddr; + struct rtentry *rt = NULL; + struct rt_addrinfo info; + static struct sockaddr_dl null_sdl = {sizeof(null_sdl), AF_LINK}; int s = splimp(), flags = RTF_UP, error = 0; oldaddr = ia->ia_addr; @@ -900,6 +906,29 @@ in_ifinit(struct ifnet *ifp, struct in_i if ((error = in_addprefix(ia, flags)) != 0) return (error); + /* +* add a loopback route to self +*/ + if (!(ifp->if_flags & (IFF_LOOPBACK | IFF_POINTOPOINT))) { + bzero(&info, sizeof(info)); + info.rti_ifp = V_loif; + info.rti_flags = ia->ia_flags | RTF_HOST | RTF_STATIC; + info.rti_info[RTAX_DST] = (struct sockaddr *)&ia->ia_addr; + info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&null_sdl; + error = rtrequest1_fib(RTM_ADD, &info, &rt, 0); + + if (error == 0 && rt != NULL) { + RT_LOCK(rt); + ((struct sockaddr_dl *)rt->rt_gateway)->sdl_type = + rt->rt_ifp->if_type; + ((struct sockaddr_dl *)rt->rt_gateway)->sdl_index = + rt->rt_ifp->if_index; + RT_REMREF(rt); + RT_UNLOCK(rt); + } else if (error != 0) + log(LOG_INFO, "in_ifinit: insertion failed\n"); + } + return (error); } @@ -979,10 +1008,28 @@ in_scrubprefix(struct in_ifaddr *target) struct in_ifaddr *ia; struct in_addr prefix, mask, p; int error; + struct rt_addrinfo info; + struct sockaddr_dl null_sdl; if ((target->ia_flags & IFA_ROUTE) == 0) return (0); + if (!(target->ia_ifp->if_flags & (IFF_LOOPBACK | IFF_POINTOPOINT))) { + bzero(&null_sdl, sizeof(null_sdl)); + null_sdl.sdl_len = sizeof(null_sdl); + null_sdl.sdl_family = AF_LINK; + null_sdl.sdl_type = V_loif->if_type; + null_sdl.sdl_index = V_loif->if_index; + bzero(&info, sizeof(info)); + info.rti_flags = target->ia_flags | RTF_HOST | RTF_STATIC; + info.rti_info[RTAX_DST] = (struct sockaddr *)&target->ia_addr; + info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&null_sdl; + error = rtrequest1_fib(RTM_DELETE, &info, NULL, 0); + + if (error != 0) + log(LOG_INFO, "in_scrubprefix: deletion failed\n"); + } + if (rtinitflags(target)) prefix = target->ia_dstaddr.sin_addr; else { @@ -1136,7 +1183,6 @@ in_purgemaddrs(struct ifnet *ifp) IN_MULTI_UNLOCK(); } -#include #include #include ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs
On Tue, May 12, 2009 at 12:33 AM, Doug Rabson wrote: > > On 12 May 2009, at 06:03, Kip Macy wrote: > >> Here is the problem, FreeBSD is sloppy about 32-bit vs. 64-bit for xdr >> whereas in the kernel, Solaris is not. > > I thought that XDR 'long' types were 32 bit regardless of whether the > platform was 32 or 64 bit. I'll have to read the code again. I'm not familiar with XDR, so I might be in error. If you could reconcile the differences between Solaris and FreeBSD so that ZFS can use FreeBSD's XDR implementation I would greatly appreciate it. Thanks, Kip -- When bad men combine, the good must associate; else they will fall one by one, an unpitied sacrifice in a contemptible struggle. Edmund Burke ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs
On 12 May 2009, at 09:16, Kip Macy wrote: On Tue, May 12, 2009 at 12:33 AM, Doug Rabson wrote: On 12 May 2009, at 06:03, Kip Macy wrote: Here is the problem, FreeBSD is sloppy about 32-bit vs. 64-bit for xdr whereas in the kernel, Solaris is not. I thought that XDR 'long' types were 32 bit regardless of whether the platform was 32 or 64 bit. I'll have to read the code again. I'm not familiar with XDR, so I might be in error. If you could reconcile the differences between Solaris and FreeBSD so that ZFS can use FreeBSD's XDR implementation I would greatly appreciate it. I'll see what I can do. Thanks for taking the time to look at it. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs
On Tue, May 12, 2009 at 12:33 AM, Doug Rabson wrote: > > I thought that XDR 'long' types were 32 bit regardless of whether the > > platform was 32 or 64 bit. I'll have to read the code again. XDR is defined in RFC 4506. It should be independent from architecture. "An XDR {signed,unsigned} integer is a 32-bit datum..." "The standard also defines 64-bit (8-byte) numbers called hyper integers and unsigned hyper integers." -- Frank Behrens, Osterwieck, Germany PGP-key 0x5B7C47ED on public servers available. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r192012 - head/sys/fs/fdescfs
Author: kib Date: Tue May 12 09:22:33 2009 New Revision: 192012 URL: http://svn.freebsd.org/changeset/base/192012 Log: Return controlled EINVAL when the fdescfs lookup routine is given string representing too large integer, instead of overflowing and possibly returning a random but valid vnode. Noted by: Jilles Tjoelker MFC after:3 days Modified: head/sys/fs/fdescfs/fdesc_vnops.c Modified: head/sys/fs/fdescfs/fdesc_vnops.c == --- head/sys/fs/fdescfs/fdesc_vnops.c Tue May 12 07:41:20 2009 (r192011) +++ head/sys/fs/fdescfs/fdesc_vnops.c Tue May 12 09:22:33 2009 (r192012) @@ -265,7 +265,7 @@ fdesc_lookup(ap) struct thread *td = cnp->cn_thread; struct file *fp; int nlen = cnp->cn_namelen; - u_int fd; + u_int fd, fd1; int error; struct vnode *fvp; @@ -297,7 +297,12 @@ fdesc_lookup(ap) error = ENOENT; goto bad; } - fd = 10 * fd + *pname++ - '0'; + fd1 = 10 * fd + *pname++ - '0'; + if (fd1 < fd) { + error = ENOENT; + goto bad; + } + fd = fd1; } if ((error = fget(td, fd, &fp)) != 0) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r192013 - head/sys/fs/fdescfs
Author: kib Date: Tue May 12 09:28:45 2009 New Revision: 192013 URL: http://svn.freebsd.org/changeset/base/192013 Log: Report all fdescfs vnodes as VCHR for stat(2). Fake the unique major/minor numbers of the devices. Pretending that the vnodes are character devices prevents file tree walkers from descending into the directories opened by current process. Also, not doing stat on the filedescriptors prevents the recursive entry into the VFS. Requested by: kientzle Discussed with: Jilles Tjoelker Modified: head/sys/fs/fdescfs/fdesc_vnops.c Modified: head/sys/fs/fdescfs/fdesc_vnops.c == --- head/sys/fs/fdescfs/fdesc_vnops.c Tue May 12 09:22:33 2009 (r192012) +++ head/sys/fs/fdescfs/fdesc_vnops.c Tue May 12 09:28:45 2009 (r192013) @@ -389,78 +389,34 @@ fdesc_getattr(ap) { struct vnode *vp = ap->a_vp; struct vattr *vap = ap->a_vap; - struct thread *td = curthread; - struct file *fp; - struct stat stb; - u_int fd; - int error = 0; + + vap->va_mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH; + vap->va_fileid = VTOFDESC(vp)->fd_ix; + vap->va_uid = 0; + vap->va_gid = 0; + vap->va_blocksize = DEV_BSIZE; + vap->va_atime.tv_sec = boottime.tv_sec; + vap->va_atime.tv_nsec = 0; + vap->va_mtime = vap->va_atime; + vap->va_ctime = vap->va_mtime; + vap->va_gen = 0; + vap->va_flags = 0; + vap->va_bytes = 0; + vap->va_filerev = 0; switch (VTOFDESC(vp)->fd_type) { case Froot: - vap->va_mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH; vap->va_type = VDIR; vap->va_nlink = 2; vap->va_size = DEV_BSIZE; - vap->va_fileid = VTOFDESC(vp)->fd_ix; - vap->va_uid = 0; - vap->va_gid = 0; - vap->va_blocksize = DEV_BSIZE; - vap->va_atime.tv_sec = boottime.tv_sec; - vap->va_atime.tv_nsec = 0; - vap->va_mtime = vap->va_atime; - vap->va_ctime = vap->va_mtime; - vap->va_gen = 0; - vap->va_flags = 0; vap->va_rdev = NODEV; - vap->va_bytes = 0; - vap->va_filerev = 0; break; case Fdesc: - fd = VTOFDESC(vp)->fd_fd; - - if ((error = fget(td, fd, &fp)) != 0) - return (error); - - bzero(&stb, sizeof(stb)); - error = fo_stat(fp, &stb, td->td_ucred, td); - fdrop(fp, td); - if (error == 0) { - vap->va_type = IFTOVT(stb.st_mode); - vap->va_mode = stb.st_mode; - if (vap->va_type == VDIR) - vap->va_mode &= ~(S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH); - vap->va_nlink = 1; - vap->va_flags = 0; - vap->va_bytes = stb.st_blocks * stb.st_blksize; - vap->va_fileid = VTOFDESC(vp)->fd_ix; - vap->va_size = stb.st_size; - vap->va_blocksize = stb.st_blksize; - vap->va_rdev = stb.st_rdev; - - /* -* If no time data is provided, use the current time. -*/ - if (stb.st_atimespec.tv_sec == 0 && - stb.st_atimespec.tv_nsec == 0) - nanotime(&stb.st_atimespec); - - if (stb.st_ctimespec.tv_sec == 0 && - stb.st_ctimespec.tv_nsec == 0) - nanotime(&stb.st_ctimespec); - - if (stb.st_mtimespec.tv_sec == 0 && - stb.st_mtimespec.tv_nsec == 0) - nanotime(&stb.st_mtimespec); - - vap->va_atime = stb.st_atimespec; - vap->va_mtime = stb.st_mtimespec; - vap->va_ctime = stb.st_ctimespec; - vap->va_uid = stb.st_uid; - vap->va_gid = stb.st_gid; - vap->va_gen = 0; - vap->va_filerev = 0; - } + vap->va_type = VCHR; + vap->va_nlink = 1; + vap->va_size = 0; + vap->va_rdev = makedev(0, vap->va_fileid); break; default: @@ -468,9 +424,8 @@ fdesc_getattr(ap) break; } - if (error == 0) - vp->v_type = vap->va_type; - return (error); + vp->v_type = vap->va_type; + return (0); } static int ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.or
svn commit: r192015 - head/sys/cam/scsi
Author: trasz Date: Tue May 12 15:03:47 2009 New Revision: 192015 URL: http://svn.freebsd.org/changeset/base/192015 Log: Add missing 'break' statements. Found with: Coverity Prevent(tm) CID: 3936, 3937 Reviewed by: scottl@ Modified: head/sys/cam/scsi/scsi_sg.c Modified: head/sys/cam/scsi/scsi_sg.c == --- head/sys/cam/scsi/scsi_sg.c Tue May 12 09:38:51 2009(r192014) +++ head/sys/cam/scsi/scsi_sg.c Tue May 12 15:03:47 2009(r192015) @@ -953,6 +953,7 @@ sg_scsiio_status(struct ccb_scsiio *csio case CAM_SCSI_STATUS_ERROR: *hoststat = DID_ERROR; *drvstat = 0; + break; case CAM_SCSI_BUS_RESET: *hoststat = DID_RESET; *drvstat = 0; @@ -964,6 +965,7 @@ sg_scsiio_status(struct ccb_scsiio *csio case CAM_SCSI_BUSY: *hoststat = DID_BUS_BUSY; *drvstat = 0; + break; default: *hoststat = DID_ERROR; *drvstat = DRIVER_ERROR; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r192016 - head/sys/cam
Author: trasz Date: Tue May 12 15:14:37 2009 New Revision: 192016 URL: http://svn.freebsd.org/changeset/base/192016 Log: Add missing free(9) in error case. Found with: Coverity Prevent(tm) CID: 4224 Modified: head/sys/cam/cam_periph.c Modified: head/sys/cam/cam_periph.c == --- head/sys/cam/cam_periph.c Tue May 12 15:03:47 2009(r192015) +++ head/sys/cam/cam_periph.c Tue May 12 15:14:37 2009(r192016) @@ -173,6 +173,7 @@ cam_periph_alloc(periph_ctor_t *periph_c xpt_unlock_buses(); if (*p_drv == NULL) { printf("cam_periph_alloc: invalid periph name '%s'\n", name); + free(periph, M_CAMPERIPH); return (CAM_REQ_INVALID); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r192017 - head/sys/fs/nfsserver
Author: rmacklem Date: Tue May 12 16:04:51 2009 New Revision: 192017 URL: http://svn.freebsd.org/changeset/base/192017 Log: Modify the experimental nfs server to use the new nfsd_nfsd_args structure for nfsd. Includes a change that clarifies the use of an empty principal name string to indicate AUTH_SYS only. Approved by: kib (mentor) Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c == --- head/sys/fs/nfsserver/nfs_nfsdkrpc.cTue May 12 15:14:37 2009 (r192016) +++ head/sys/fs/nfsserver/nfs_nfsdkrpc.cTue May 12 16:04:51 2009 (r192017) @@ -350,20 +350,16 @@ int nfsrvd_nfsd(struct thread *td, struct nfsd_nfsd_args *args) { #ifdef KGSSAPI - char principal[128]; + char principal[MAXHOSTNAMELEN + 5]; int error; bool_t ret2, ret3, ret4; #endif #ifdef KGSSAPI - if (args != NULL) { - error = copyinstr(args->principal, principal, - sizeof(principal), NULL); - if (error) - return (error); - } else { - snprintf(principal, sizeof(principal), "n...@%s", hostname); - } + error = copyinstr(args->principal, principal, sizeof (principal), + NULL); + if (error) + return (error); #endif /* @@ -380,40 +376,36 @@ nfsrvd_nfsd(struct thread *td, struct nf NFSD_UNLOCK(); #ifdef KGSSAPI - ret2 = rpc_gss_set_svc_name(principal, "kerberosv5", - GSS_C_INDEFINITE, NFS_PROG, NFS_VER2); - ret3 = rpc_gss_set_svc_name(principal, "kerberosv5", - GSS_C_INDEFINITE, NFS_PROG, NFS_VER3); - ret4 = rpc_gss_set_svc_name(principal, "kerberosv5", - GSS_C_INDEFINITE, NFS_PROG, NFS_VER4); - - /* -* If the principal name was specified, these should have -* succeeded. -*/ - if (args != NULL && principal[0] != '\0' && - (!ret2 || !ret3 || !ret4)) { - NFSD_LOCK(); - newnfs_numnfsd--; - NFSD_UNLOCK(); - return (EAUTH); + /* An empty string implies AUTH_SYS only. */ + if (principal[0] != '\0') { + ret2 = rpc_gss_set_svc_name(principal, "kerberosv5", + GSS_C_INDEFINITE, NFS_PROG, NFS_VER2); + ret3 = rpc_gss_set_svc_name(principal, "kerberosv5", + GSS_C_INDEFINITE, NFS_PROG, NFS_VER3); + ret4 = rpc_gss_set_svc_name(principal, "kerberosv5", + GSS_C_INDEFINITE, NFS_PROG, NFS_VER4); + + if (!ret2 || !ret3 || !ret4) { + NFSD_LOCK(); + newnfs_numnfsd--; + nfsrvd_init(1); + NFSD_UNLOCK(); + return (EAUTH); + } } #endif - if (args != NULL) { - nfsrvd_pool->sp_minthreads = args->minthreads; - nfsrvd_pool->sp_maxthreads = args->maxthreads; - } else { - nfsrvd_pool->sp_minthreads = 4; - nfsrvd_pool->sp_maxthreads = 4; - } + nfsrvd_pool->sp_minthreads = args->minthreads; + nfsrvd_pool->sp_maxthreads = args->maxthreads; svc_run(nfsrvd_pool); #ifdef KGSSAPI - rpc_gss_clear_svc_name(NFS_PROG, NFS_VER2); - rpc_gss_clear_svc_name(NFS_PROG, NFS_VER3); - rpc_gss_clear_svc_name(NFS_PROG, NFS_VER4); + if (principal[0] != '\0') { + rpc_gss_clear_svc_name(NFS_PROG, NFS_VER2); + rpc_gss_clear_svc_name(NFS_PROG, NFS_VER3); + rpc_gss_clear_svc_name(NFS_PROG, NFS_VER4); + } #endif NFSD_LOCK(); Modified: head/sys/fs/nfsserver/nfs_nfsdport.c == --- head/sys/fs/nfsserver/nfs_nfsdport.cTue May 12 15:14:37 2009 (r192016) +++ head/sys/fs/nfsserver/nfs_nfsdport.cTue May 12 16:04:51 2009 (r192017) @@ -2866,14 +2866,15 @@ static int nfssvc_nfsd(struct thread *td, struct nfssvc_args *uap) { struct file *fp; - struct nfsd_addsock_args nfsdarg; + struct nfsd_addsock_args sockarg; + struct nfsd_nfsd_args nfsdarg; int error; if (uap->flag & NFSSVC_NFSDADDSOCK) { - error = copyin(uap->argp, (caddr_t)&nfsdarg, sizeof(nfsdarg)); +
svn commit: r192018 - head/sys/arm/at91
Author: stas Date: Tue May 12 16:07:08 2009 New Revision: 192018 URL: http://svn.freebsd.org/changeset/base/192018 Log: - Implement detach path. - Release memory and DMA resources on stop. - Unload the associated DMA maps after transmit is complete. Modified: head/sys/arm/at91/if_ate.c Modified: head/sys/arm/at91/if_ate.c == --- head/sys/arm/at91/if_ate.c Tue May 12 16:04:51 2009(r192017) +++ head/sys/arm/at91/if_ate.c Tue May 12 16:07:08 2009(r192018) @@ -23,14 +23,10 @@ * SUCH DAMAGE. */ -/* TODO: (in no order) +/* TODO * - * 8) Need to sync busdma goo in atestop - * 9) atestop should maybe free the mbufs? - * - * 1) detach - * 2) Free dma setup - * 3) Turn on the clock in pmc? Turn off? + * 1) Turn on the clock in pmc? Turn off? + * 2) GPIO initializtion in board setup code. */ #include @@ -152,7 +148,7 @@ static void ate_intr(void *); /* helper routines */ static int ate_activate(device_t dev); -static void ate_deactivate(device_t dev); +static void ate_deactivate(struct ate_softc *sc); static int ate_ifmedia_upd(struct ifnet *ifp); static void ate_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr); static int ate_get_mac(struct ate_softc *sc, u_char *eaddr); @@ -179,11 +175,33 @@ ate_attach(device_t dev) struct ifnet *ifp = NULL; struct sysctl_ctx_list *sctx; struct sysctl_oid *soid; - int err; u_char eaddr[ETHER_ADDR_LEN]; uint32_t rnd; + int rid, err; sc->dev = dev; + ATE_LOCK_INIT(sc); + + /* +* Allocate resources. +*/ + rid = 0; + sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->mem_res == NULL) { + device_printf(dev, "could not allocate memory resources.\n"); + err = ENOMEM; + goto out; + } + rid = 0; + sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE); + if (sc->irq_res == NULL) { + device_printf(dev, "could not allocate interrupt resources.\n"); + err = ENOMEM; + goto out; + } + err = ate_activate(dev); if (err) goto out; @@ -197,8 +215,9 @@ ate_attach(device_t dev) CTLFLAG_RD, &sc->use_rmii, 0, "rmii in use"); /* calling atestop before ifp is set is OK */ + ATE_LOCK(sc); atestop(sc); - ATE_LOCK_INIT(sc); + ATE_UNLOCK(sc); callout_init_mtx(&sc->tick_ch, &sc->sc_mtx, 0); if ((err = ate_get_mac(sc, eaddr)) != 0) { @@ -252,26 +271,65 @@ ate_attach(device_t dev) ether_ifattach(ifp, eaddr); /* -* Activate the interrupt +* Activate the interrupt. */ err = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE, NULL, ate_intr, sc, &sc->intrhand); if (err) { + device_printf(dev, "could not establish interrupt handler.\n"); ether_ifdetach(ifp); - ATE_LOCK_DESTROY(sc); + goto out; } -out:; + +out: if (err) - ate_deactivate(dev); - if (err && ifp) - if_free(ifp); + ate_detach(dev); return (err); } static int ate_detach(device_t dev) { - return EBUSY; /* XXX TODO(1) */ + struct ate_softc *sc; + struct ifnet *ifp; + + sc = device_get_softc(dev); + KASSERT(sc != NULL, ("[ate: %d]: sc is NULL", __LINE__)); + ifp = sc->ifp; + if (device_is_attached(dev)) { + ATE_LOCK(sc); + sc->flags |= ATE_FLAG_DETACHING; + atestop(sc); + ATE_UNLOCK(sc); + callout_drain(&sc->tick_ch); + ether_ifdetach(ifp); + } + if (sc->miibus != NULL) { + device_delete_child(dev, sc->miibus); + sc->miibus = NULL; + } + bus_generic_detach(sc->dev); + ate_deactivate(sc); + if (sc->intrhand != NULL) { + bus_teardown_intr(dev, sc->irq_res, sc->intrhand); + sc->intrhand = NULL; + } + if (ifp != NULL) { + if_free(ifp); + sc->ifp = NULL; + } + if (sc->mem_res != NULL) { + bus_release_resource(dev, SYS_RES_IOPORT, + rman_get_rid(sc->mem_res), sc->mem_res); + sc->mem_res = NULL; + } + if (sc->irq_res != NULL) { + bus_release_resource(dev, SYS_RES_IRQ, + rman_get_rid(sc->irq_res), sc->irq_res); + sc->irq_res = NULL; + } + ATE_LOCK_DESTROY(sc); + return (0); } static void @@ -367,20 +425,9 @@ static int ate_activate(device_t dev) { struct ate_softc *sc; - int rid, err, i; + int err,
svn commit: r192019 - head/sys/cam/scsi
Author: trasz Date: Tue May 12 16:38:32 2009 New Revision: 192019 URL: http://svn.freebsd.org/changeset/base/192019 Log: Remove dead code. Found with: Coverity Prevent(tm) CID: 3667 Modified: head/sys/cam/scsi/scsi_pass.c Modified: head/sys/cam/scsi/scsi_pass.c == --- head/sys/cam/scsi/scsi_pass.c Tue May 12 16:07:08 2009 (r192018) +++ head/sys/cam/scsi/scsi_pass.c Tue May 12 16:38:32 2009 (r192019) @@ -179,7 +179,6 @@ passasync(void *callback_arg, u_int32_t struct cam_path *path, void *arg) { struct cam_periph *periph; - struct cam_sim *sim; periph = (struct cam_periph *)callback_arg; @@ -198,7 +197,6 @@ passasync(void *callback_arg, u_int32_t * this device and start the probe * process. */ - sim = xpt_path_sim(cgd->ccb_h.path); status = cam_periph_alloc(passregister, passoninvalidate, passcleanup, passstart, "pass", CAM_PERIPH_BIO, cgd->ccb_h.path, ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r192020 - head/sys/dev/ata
Author: trasz Date: Tue May 12 16:39:43 2009 New Revision: 192020 URL: http://svn.freebsd.org/changeset/base/192020 Log: Remove dead code. Found with: Coverity Prevent(tm) CID: 556 Modified: head/sys/dev/ata/atapi-cam.c Modified: head/sys/dev/ata/atapi-cam.c == --- head/sys/dev/ata/atapi-cam.cTue May 12 16:38:32 2009 (r192019) +++ head/sys/dev/ata/atapi-cam.cTue May 12 16:39:43 2009 (r192020) @@ -796,14 +796,10 @@ static void atapi_async(void *callback_arg, u_int32_t code, struct cam_path* path, void *arg) { -struct atapi_xpt_softc *softc; -struct cam_sim *sim; int targ; GIANT_REQUIRED; -sim = (struct cam_sim *) callback_arg; -softc = (struct atapi_xpt_softc *) cam_sim_softc(sim); switch (code) { case AC_LOST_DEVICE: targ = xpt_path_target_id(path); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r192021 - head/sys/geom/concat
Author: trasz Date: Tue May 12 16:59:50 2009 New Revision: 192021 URL: http://svn.freebsd.org/changeset/base/192021 Log: Check return value of gctl_get_asciiparam(). Found with: Coverity Prevent(tm) CID: 1118 Modified: head/sys/geom/concat/g_concat.c Modified: head/sys/geom/concat/g_concat.c == --- head/sys/geom/concat/g_concat.c Tue May 12 16:39:43 2009 (r192020) +++ head/sys/geom/concat/g_concat.c Tue May 12 16:59:50 2009 (r192021) @@ -753,6 +753,10 @@ g_concat_ctl_create(struct gctl_req *req for (attached = 0, no = 1; no < *nargs; no++) { snprintf(param, sizeof(param), "arg%u", no); name = gctl_get_asciiparam(req, param); + if (name == NULL) { + gctl_error(req, "No 'arg%d' argument.", no); + return; + } if (strncmp(name, "/dev/", strlen("/dev/")) == 0) name += strlen("/dev/"); pp = g_provider_by_name(name); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r192022 - head/sys/kern
Author: trasz Date: Tue May 12 17:05:40 2009 New Revision: 192022 URL: http://svn.freebsd.org/changeset/base/192022 Log: Add missing 'break' statement. Found with: Coverity Prevent(tm) CID: 3919 Modified: head/sys/kern/kern_lock.c Modified: head/sys/kern/kern_lock.c == --- head/sys/kern/kern_lock.c Tue May 12 16:59:50 2009(r192021) +++ head/sys/kern/kern_lock.c Tue May 12 17:05:40 2009(r192022) @@ -1067,6 +1067,7 @@ db_show_lockmgr(struct lock_object *lock switch (lk->lk_lock & LK_ALL_WAITERS) { case LK_SHARED_WAITERS: db_printf("shared\n"); + break; case LK_EXCLUSIVE_WAITERS: db_printf("exclusive\n"); break; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r192011 - head/sys/netinet
On 2009-05-12 09:41, Qing Li wrote: > Author: qingli > Date: Tue May 12 07:41:20 2009 > New Revision: 192011 > URL: http://svn.freebsd.org/changeset/base/192011 > > Log: > This patch adds a host route to an interface address (that is assigned > to a non loopback/ppp link types) through the loopback interface. Prior > to the new L2/L3 rewrite, this host route is implicitly added by the L2 > code during RTM_RESOLVE of that interface address. This host route is > deleted when that interface is removed. This commit breaks dhclient startup, I now get: [...] in_ifinit: insertion failed ifconfig: ioctl (SIOCAIFADDR): File exists em0: not found exiting. So it seems to hit this part: + } else if (error != 0) + log(LOG_INFO, "in_ifinit: insertion failed\n"); Reverting the commit makes dhclient work again. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs
On Tue, May 12, 2009 at 2:13 AM, Frank Behrens wrote: > On Tue, May 12, 2009 at 12:33 AM, Doug Rabson wrote: >> > I thought that XDR 'long' types were 32 bit regardless of whether the >> > platform was 32 or 64 bit. I'll have to read the code again. > > XDR is defined in RFC 4506. It should be independent from > architecture. > > "An XDR {signed,unsigned} integer is a 32-bit datum..." > "The standard also defines 64-bit (8-byte) numbers called hyper > integers and unsigned hyper integers." > That is the definition. The implementation may be something entirely different :-) -Kip ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r192018 - head/sys/arm/at91
On Tuesday 12 May 2009 12:07:08 pm Stanislav Sedov wrote: > Author: stas > Date: Tue May 12 16:07:08 2009 > New Revision: 192018 > URL: http://svn.freebsd.org/changeset/base/192018 > > Log: > - Implement detach path. > - Release memory and DMA resources on stop. > - Unload the associated DMA maps after transmit is complete. Most NIC drivers that I am familiar with do not destroy DMA resources (tags and maps) during stop() and then create them during if_init(). Instead, they create those during attach() and detach(). They do tend to populate the RX ring with buffers during if_init() and free all of the mbus during stop() though. -- John Baldwin ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r192018 - head/sys/arm/at91
On Tue, 12 May 2009 12:17:05 -0400 John Baldwin mentioned: > On Tuesday 12 May 2009 12:07:08 pm Stanislav Sedov wrote: > > Author: stas > > Date: Tue May 12 16:07:08 2009 > > New Revision: 192018 > > URL: http://svn.freebsd.org/changeset/base/192018 > > > > Log: > > - Implement detach path. > > - Release memory and DMA resources on stop. > > - Unload the associated DMA maps after transmit is complete. > > Most NIC drivers that I am familiar with do not destroy DMA resources (tags > and maps) during stop() and then create them during if_init(). Instead, they > create those during attach() and detach(). They do tend to populate the RX > ring with buffers during if_init() and free all of the mbus during stop() > though. > Well, probably my commit message was slightly wrong. I do not destroy DMA maps and tags in the stop routine, instead I free all allocated mbufs and unload DMA maps associated with them. -- Stanislav Sedov ST4096-RIPE !DSPAM:4a09c2ee994291210395111! ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs
On Tuesday 12 May 2009 04:18 am, Doug Rabson wrote: > On 12 May 2009, at 09:16, Kip Macy wrote: > > On Tue, May 12, 2009 at 12:33 AM, Doug Rabson wrote: > >> On 12 May 2009, at 06:03, Kip Macy wrote: > >>> Here is the problem, FreeBSD is sloppy about 32-bit vs. 64-bit > >>> for xdr > >>> whereas in the kernel, Solaris is not. > >> > >> I thought that XDR 'long' types were 32 bit regardless of > >> whether the platform was 32 or 64 bit. I'll have to read the > >> code again. > > > > I'm not familiar with XDR, so I might be in error. If you could > > reconcile the differences between Solaris and FreeBSD so that ZFS > > can use FreeBSD's XDR implementation I would greatly appreciate > > it. > > I'll see what I can do. Thanks for taking the time to look at it. xdr in kernel is originally from Sun. So, we have two versions of xdr from Sun with different license terms now, one from ancient rpcsrc distribution and one from OpenSolaris. Interesting... Sorry, just thinking out loud... ;-) Jung-uk Kim ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r191984 - in head/sys: cddl/contrib/opensolaris/uts/common/rpc modules/zfs
On 12 May 2009, at 20:16, Jung-uk Kim wrote: On Tuesday 12 May 2009 04:18 am, Doug Rabson wrote: On 12 May 2009, at 09:16, Kip Macy wrote: On Tue, May 12, 2009 at 12:33 AM, Doug Rabson wrote: On 12 May 2009, at 06:03, Kip Macy wrote: Here is the problem, FreeBSD is sloppy about 32-bit vs. 64-bit for xdr whereas in the kernel, Solaris is not. I thought that XDR 'long' types were 32 bit regardless of whether the platform was 32 or 64 bit. I'll have to read the code again. I'm not familiar with XDR, so I might be in error. If you could reconcile the differences between Solaris and FreeBSD so that ZFS can use FreeBSD's XDR implementation I would greatly appreciate it. I'll see what I can do. Thanks for taking the time to look at it. xdr in kernel is originally from Sun. So, we have two versions of xdr from Sun with different license terms now, one from ancient rpcsrc distribution and one from OpenSolaris. Interesting... Sorry, just thinking out loud... ;-) Well hopefully we can end up with just from from ancient rpcsrc (and not CDDL). ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r192023 - head/sys/dev/vge
Author: brueffer Date: Tue May 12 19:30:46 2009 New Revision: 192023 URL: http://svn.freebsd.org/changeset/base/192023 Log: Remove unused variable. Found with: Coverity Prevent(tm) CID: 550 Modified: head/sys/dev/vge/if_vge.c Modified: head/sys/dev/vge/if_vge.c == --- head/sys/dev/vge/if_vge.c Tue May 12 17:05:40 2009(r192022) +++ head/sys/dev/vge/if_vge.c Tue May 12 19:30:46 2009(r192023) @@ -651,10 +651,8 @@ vge_probe(dev) device_tdev; { struct vge_type *t; - struct vge_softc*sc; t = vge_devs; - sc = device_get_softc(dev); while (t->vge_name != NULL) { if ((pci_get_vendor(dev) == t->vge_vid) && ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r192024 - head/sys/dev/lge
Author: brueffer Date: Tue May 12 19:33:36 2009 New Revision: 192024 URL: http://svn.freebsd.org/changeset/base/192024 Log: Remove unused variable. Found with: Coverity Prevent(tm) CID: 549 Modified: head/sys/dev/lge/if_lge.c Modified: head/sys/dev/lge/if_lge.c == --- head/sys/dev/lge/if_lge.c Tue May 12 19:30:46 2009(r192023) +++ head/sys/dev/lge/if_lge.c Tue May 12 19:33:36 2009(r192024) @@ -1257,7 +1257,6 @@ lge_init_locked(sc) struct lge_softc*sc; { struct ifnet*ifp = sc->lge_ifp; - struct mii_data *mii; LGE_LOCK_ASSERT(sc); if (ifp->if_drv_flags & IFF_DRV_RUNNING) @@ -1269,8 +1268,6 @@ lge_init_locked(sc) lge_stop(sc); lge_reset(sc); - mii = device_get_softc(sc->lge_miibus); - /* Set MAC address */ CSR_WRITE_4(sc, LGE_PAR0, *(u_int32_t *)(&IF_LLADDR(sc->lge_ifp)[0])); CSR_WRITE_4(sc, LGE_PAR1, *(u_int32_t *)(&IF_LLADDR(sc->lge_ifp)[4])); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r192025 - head/usr.bin/truss
Author: dds Date: Tue May 12 20:42:12 2009 New Revision: 192025 URL: http://svn.freebsd.org/changeset/base/192025 Log: Add -c option to summarize number of calls, errors, and system time. Reviewed by: alfred Modified: head/usr.bin/truss/amd64-fbsd.c head/usr.bin/truss/amd64-fbsd32.c head/usr.bin/truss/amd64-linux32.c head/usr.bin/truss/i386-fbsd.c head/usr.bin/truss/i386-linux.c head/usr.bin/truss/ia64-fbsd.c head/usr.bin/truss/main.c head/usr.bin/truss/powerpc-fbsd.c head/usr.bin/truss/sparc64-fbsd.c head/usr.bin/truss/syscall.h head/usr.bin/truss/syscalls.c head/usr.bin/truss/truss.1 head/usr.bin/truss/truss.h Modified: head/usr.bin/truss/amd64-fbsd.c == --- head/usr.bin/truss/amd64-fbsd.c Tue May 12 19:33:36 2009 (r192024) +++ head/usr.bin/truss/amd64-fbsd.c Tue May 12 20:42:12 2009 (r192025) @@ -323,7 +323,8 @@ amd64_syscall_exit(struct trussinfo *tru * but that complicates things considerably. */ - print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, retval); + print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, + retval, fsc.sc); clear_fsc(); return (retval); Modified: head/usr.bin/truss/amd64-fbsd32.c == --- head/usr.bin/truss/amd64-fbsd32.c Tue May 12 19:33:36 2009 (r192024) +++ head/usr.bin/truss/amd64-fbsd32.c Tue May 12 20:42:12 2009 (r192025) @@ -339,7 +339,8 @@ amd64_fbsd32_syscall_exit(struct trussin * but that complicates things considerably. */ - print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, retval); + print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, + retval, fsc.sc); clear_fsc(); return (retval); Modified: head/usr.bin/truss/amd64-linux32.c == --- head/usr.bin/truss/amd64-linux32.c Tue May 12 19:33:36 2009 (r192024) +++ head/usr.bin/truss/amd64-linux32.c Tue May 12 20:42:12 2009 (r192025) @@ -309,7 +309,7 @@ amd64_linux32_syscall_exit(struct trussi } print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, -errorp ? i : retval); +errorp ? i : retval, fsc.sc); clear_fsc(); return (retval); Modified: head/usr.bin/truss/i386-fbsd.c == --- head/usr.bin/truss/i386-fbsd.c Tue May 12 19:33:36 2009 (r192024) +++ head/usr.bin/truss/i386-fbsd.c Tue May 12 20:42:12 2009 (r192025) @@ -329,7 +329,8 @@ i386_syscall_exit(struct trussinfo *trus * but that complicates things considerably. */ - print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, retval); + print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, + retval, fsc.sc); clear_fsc(); return (retval); Modified: head/usr.bin/truss/i386-linux.c == --- head/usr.bin/truss/i386-linux.c Tue May 12 19:33:36 2009 (r192024) +++ head/usr.bin/truss/i386-linux.c Tue May 12 20:42:12 2009 (r192025) @@ -309,7 +309,7 @@ i386_linux_syscall_exit(struct trussinfo } print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, -errorp ? i : retval); +errorp ? i : retval, fsc.sc); clear_fsc(); return (retval); Modified: head/usr.bin/truss/ia64-fbsd.c == --- head/usr.bin/truss/ia64-fbsd.c Tue May 12 19:33:36 2009 (r192024) +++ head/usr.bin/truss/ia64-fbsd.c Tue May 12 20:42:12 2009 (r192025) @@ -294,7 +294,8 @@ ia64_syscall_exit(struct trussinfo *trus * but that complicates things considerably. */ - print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, retval); + print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, + fsc.sc, retval); clear_fsc(); return (retval); Modified: head/usr.bin/truss/main.c == --- head/usr.bin/truss/main.c Tue May 12 19:33:36 2009(r192024) +++ head/usr.bin/truss/main.c Tue May 12 20:42:12 2009(r192025) @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include "truss.h" #include "extern.h" +#include "syscall.h" #define MAXARGS 6 @@ -65,8 +66,8 @@ static void usage(void) { fprintf(stderr, "%s\n%s\n", - "usage: truss [-faedDS] [-o file] [-s strsize] -p pid", - " truss [-faedDS] [-o file] [-s strsize] command [args]"); + "usage: truss [-cfaedDS] [-o file] [-s
svn commit: r192026 - head/share/man/man9
Author: marius Date: Tue May 12 20:56:34 2009 New Revision: 192026 URL: http://svn.freebsd.org/changeset/base/192026 Log: Correct r190283 (partially reverting it) as on sparc64 BUS_DMA_NOCACHE actually is only valid for bus_dmamap_load(). MFC after:3 days Modified: head/share/man/man9/bus_dma.9 Modified: head/share/man/man9/bus_dma.9 == --- head/share/man/man9/bus_dma.9 Tue May 12 20:42:12 2009 (r192025) +++ head/share/man/man9/bus_dma.9 Tue May 12 20:56:34 2009 (r192026) @@ -60,7 +60,7 @@ .\" $FreeBSD$ .\" $NetBSD: bus_dma.9,v 1.25 2002/10/14 13:43:16 wiz Exp $ .\" -.Dd November 16, 2008 +.Dd May 12, 2009 .Dt BUS_DMA 9 .Os .Sh NAME @@ -561,6 +561,13 @@ Are as follows: .It Dv BUS_DMA_NOWAIT The load should not be deferred in case of insufficient mapping resources, and instead should return immediately with an appropriate error. +.It Dv BUS_DMA_NOCACHE +The generated transactions to and from the virtual page are non-cacheable. +For +.Fn bus_dmamap_load , +the +.Dv BUS_DMA_NOCACHE +flag is currently implemented on sparc64. .El .El .Pp @@ -780,11 +787,12 @@ Causes the allocated memory to be set to The allocated memory will not be cached in the processor caches. All memory accesses appear on the bus and are executed without reordering. -On the amd64 and i386 architectures this flag results in the -Strong Uncacheable PAT to be set for the allocated virtual address range. -The +For +.Fn bus_dmamem_alloc , +the .Dv BUS_DMA_NOCACHE -flag is currently implemented on amd64, i386 and sparc64. +flag is currently implemented on amd64 and i386 where it results in the +Strong Uncacheable PAT to be set for the allocated virtual address range. .El .It Fa mapp Pointer to a ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r192027 - head/sys/arm/at91
Author: stas Date: Tue May 12 21:14:36 2009 New Revision: 192027 URL: http://svn.freebsd.org/changeset/base/192027 Log: - Eliminate extra register reads by using a variable to store registers contents. - Use memory barriers to preserve the order of buffer space operations. This might be needed if we'll ever use this driver on architectures where ordering is not guaranteed. Modified: head/sys/arm/at91/if_ate.c Modified: head/sys/arm/at91/if_ate.c == --- head/sys/arm/at91/if_ate.c Tue May 12 20:56:34 2009(r192026) +++ head/sys/arm/at91/if_ate.c Tue May 12 21:14:36 2009(r192027) @@ -118,6 +118,13 @@ WR4(struct ate_softc *sc, bus_size_t off bus_write_4(sc->mem_res, off, val); } +static inline void +BARRIER(struct ate_softc *sc, bus_size_t off, bus_size_t len, int flags) +{ + + bus_barrier(sc->mem_res, off, len, flags); +} + #define ATE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #defineATE_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) #define ATE_LOCK_INIT(_sc) \ @@ -586,18 +593,19 @@ ate_ifmedia_sts(struct ifnet *ifp, struc static void ate_stat_update(struct ate_softc *sc, int active) { + uint32_t reg; + /* * The speed and full/half-duplex state needs to be reflected * in the ETH_CFG register. */ - if (IFM_SUBTYPE(active) == IFM_10_T) - WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) & ~ETH_CFG_SPD); - else - WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) | ETH_CFG_SPD); + reg = RD4(sc, ETH_CFG); + reg &= ~(ETH_CFG_SPD | ETH_CFG_FD); + if (IFM_SUBTYPE(active) != IFM_10_T) + reg |= ETH_CFG_SPD; if (active & IFM_FDX) - WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) | ETH_CFG_FD); - else - WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) & ~ETH_CFG_FD); + reg |= ETH_CFG_FD; + WR4(sc, ETH_CFG, reg); } static void @@ -709,11 +717,10 @@ ate_intr(void *xsc) { struct ate_softc *sc = xsc; struct ifnet *ifp = sc->ifp; - int status; - int i; - void *bp; struct mbuf *mb; - uint32_t rx_stat; + void *bp; + uint32_t status, reg, rx_stat; + int i; status = RD4(sc, ETH_ISR); if (status == 0) @@ -800,10 +807,11 @@ ate_intr(void *xsc) ATE_UNLOCK(sc); } if (status & ETH_ISR_RBNA) { - printf("RBNA workaround\n"); /* Workaround Errata #11 */ - WR4(sc, ETH_CTL, RD4(sc, ETH_CTL) &~ ETH_CTL_RE); - WR4(sc, ETH_CTL, RD4(sc, ETH_CTL) | ETH_CTL_RE); + reg = RD4(sc, ETH_CTL); + WR4(sc, ETH_CTL, reg & ~ETH_CTL_RE); + BARRIER(sc, ETH_CTL, 4, BUS_SPACE_BARRIER_WRITE); + WR4(sc, ETH_CTL, reg | ETH_CTL_RE); } } @@ -816,6 +824,7 @@ ateinit_locked(void *xsc) struct ate_softc *sc = xsc; struct ifnet *ifp = sc->ifp; struct mii_data *mii; + uint32_t reg; ATE_ASSERT_LOCKED(sc); @@ -834,10 +843,12 @@ ateinit_locked(void *xsc) * to this chip. Select the right one based on a compile-time * option. */ + reg = RD4(sc, ETH_CFG); if (sc->use_rmii) - WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) | ETH_CFG_RMII); + reg |= ETH_CFG_RMII; else - WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) & ~ETH_CFG_RMII); + reg &= ~ETH_CFG_RMII; + WR4(sc, ETH_CFG, reg); ate_rxfilter(sc); @@ -926,6 +937,7 @@ atestart_locked(struct ifnet *ifp) * tell the hardware to xmit the packet. */ WR4(sc, ETH_TAR, segs[0].ds_addr); + BARRIER(sc, ETH_TAR, 8, BUS_SPACE_BARRIER_WRITE); WR4(sc, ETH_TCR, segs[0].ds_len); /* ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r192026 - head/share/man/man9
On Tue, May 12, 2009 at 04:13:06PM -0500, Robert Noland wrote: > On Tue, 2009-05-12 at 20:56 +, Marius Strobl wrote: > > Author: marius > > Date: Tue May 12 20:56:34 2009 > > New Revision: 192026 > > URL: http://svn.freebsd.org/changeset/base/192026 > > > > Log: > > Correct r190283 (partially reverting it) as on sparc64 BUS_DMA_NOCACHE > > actually is only valid for bus_dmamap_load(). > > Ok, this is getting very confusing... This means that code has to set > this flag on both alloc and load to allow for somethine resembling > consistent behavior. > Personally I don't understand why amd64 and i386 where decided to implement BUS_DMA_NOCACHE for bus_dmamem_alloc(9) only as this is less flexible than using it with bus_dmamap_load(9) (which also is the older existing implementation). Anyway, documents BUS_DMA_NOCACHE and BUS_DMA_NOWRITE as "non-standard or specific to only certain architectures" so I think it's okay for the usage of these flags to differ across them. Marius ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r192028 - head/sys/arm/at91
Author: stas Date: Tue May 12 21:28:41 2009 New Revision: 192028 URL: http://svn.freebsd.org/changeset/base/192028 Log: - Resurrect the debug printf message I accidentally dropped in the previous commit. - Use device_printf instead of printf. - Put all printfs in the interrupt handler under bootverbose. Modified: head/sys/arm/at91/if_ate.c Modified: head/sys/arm/at91/if_ate.c == --- head/sys/arm/at91/if_ate.c Tue May 12 21:14:36 2009(r192027) +++ head/sys/arm/at91/if_ate.c Tue May 12 21:28:41 2009(r192028) @@ -734,7 +734,8 @@ ate_intr(void *xsc) bp = sc->rx_buf[i]; rx_stat = sc->rx_descs[i].status; if ((rx_stat & ETH_LEN_MASK) == 0) { - printf("ignoring bogus 0 len packet\n"); + if (bootverbose) + device_printf(sc->dev, "ignoring bogus zero-length packet\n"); bus_dmamap_sync(sc->rx_desc_tag, sc->rx_desc_map, BUS_DMASYNC_PREWRITE); sc->rx_descs[i].addr &= ~ETH_CPU_OWNER; @@ -808,6 +809,8 @@ ate_intr(void *xsc) } if (status & ETH_ISR_RBNA) { /* Workaround Errata #11 */ + if (bootverbose) + device_printf(sc->dev, "RBNA workaround\n"); reg = RD4(sc, ETH_CTL); WR4(sc, ETH_CTL, reg & ~ETH_CTL_RE); BARRIER(sc, ETH_CTL, 4, BUS_SPACE_BARRIER_WRITE); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r192026 - head/share/man/man9
On Tue, 2009-05-12 at 20:56 +, Marius Strobl wrote: > Author: marius > Date: Tue May 12 20:56:34 2009 > New Revision: 192026 > URL: http://svn.freebsd.org/changeset/base/192026 > > Log: > Correct r190283 (partially reverting it) as on sparc64 BUS_DMA_NOCACHE > actually is only valid for bus_dmamap_load(). Ok, this is getting very confusing... This means that code has to set this flag on both alloc and load to allow for somethine resembling consistent behavior. robert. > MFC after: 3 days > > Modified: > head/share/man/man9/bus_dma.9 > > Modified: head/share/man/man9/bus_dma.9 > == > --- head/share/man/man9/bus_dma.9 Tue May 12 20:42:12 2009 > (r192025) > +++ head/share/man/man9/bus_dma.9 Tue May 12 20:56:34 2009 > (r192026) > @@ -60,7 +60,7 @@ > .\" $FreeBSD$ > .\" $NetBSD: bus_dma.9,v 1.25 2002/10/14 13:43:16 wiz Exp $ > .\" > -.Dd November 16, 2008 > +.Dd May 12, 2009 > .Dt BUS_DMA 9 > .Os > .Sh NAME > @@ -561,6 +561,13 @@ Are as follows: > .It Dv BUS_DMA_NOWAIT > The load should not be deferred in case of insufficient mapping resources, > and instead should return immediately with an appropriate error. > +.It Dv BUS_DMA_NOCACHE > +The generated transactions to and from the virtual page are non-cacheable. > +For > +.Fn bus_dmamap_load , > +the > +.Dv BUS_DMA_NOCACHE > +flag is currently implemented on sparc64. > .El > .El > .Pp > @@ -780,11 +787,12 @@ Causes the allocated memory to be set to > The allocated memory will not be cached in the processor caches. > All memory accesses appear on the bus and are executed > without reordering. > -On the amd64 and i386 architectures this flag results in the > -Strong Uncacheable PAT to be set for the allocated virtual address range. > -The > +For > +.Fn bus_dmamem_alloc , > +the > .Dv BUS_DMA_NOCACHE > -flag is currently implemented on amd64, i386 and sparc64. > +flag is currently implemented on amd64 and i386 where it results in the > +Strong Uncacheable PAT to be set for the allocated virtual address range. > .El > .It Fa mapp > Pointer to a -- Robert Noland FreeBSD signature.asc Description: This is a digitally signed message part
svn commit: r192029 - head/sys/i386/cpufreq
Author: brueffer Date: Tue May 12 22:11:02 2009 New Revision: 192029 URL: http://svn.freebsd.org/changeset/base/192029 Log: Remove unused variables. Found with: Coverity Prevent(tm) CID: 4285, 4286 Modified: head/sys/i386/cpufreq/hwpstate.c Modified: head/sys/i386/cpufreq/hwpstate.c == --- head/sys/i386/cpufreq/hwpstate.cTue May 12 21:28:41 2009 (r192028) +++ head/sys/i386/cpufreq/hwpstate.cTue May 12 22:11:02 2009 (r192029) @@ -161,7 +161,6 @@ DRIVER_MODULE(hwpstate, cpu, hwpstate_dr static int hwpstate_goto_pstate(device_t dev, int pstate) { - struct hwpstate_softc *sc; struct pcpu *pc; int i; uint64_t msr; @@ -170,7 +169,6 @@ hwpstate_goto_pstate(device_t dev, int p int id = pstate; int error; - sc = device_get_softc(dev); /* get the current pstate limit */ msr = rdmsr(MSR_AMD_10H_11H_LIMIT); limit = AMD_10H_11H_GET_PSTATE_LIMIT(msr); @@ -299,7 +297,6 @@ hwpstate_type(device_t dev, int *type) static void hwpstate_identify(driver_t *driver, device_t parent) { - device_t child; if (device_find_child(parent, "hwpstate", -1) != NULL) return; @@ -318,7 +315,7 @@ hwpstate_identify(driver_t *driver, devi if (resource_disabled("hwpstate", 0)) return; - if ((child = BUS_ADD_CHILD(parent, 10, "hwpstate", -1)) == NULL) + if (BUS_ADD_CHILD(parent, 10, "hwpstate", -1) == NULL) device_printf(parent, "hwpstate: add child failed\n"); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r192030 - head/sys/dev/acpi_support
Author: brueffer Date: Tue May 12 23:22:58 2009 New Revision: 192030 URL: http://svn.freebsd.org/changeset/base/192030 Log: Remove unused variables. Found with: Coverity Prevent(tm) CID: 544, 545 Modified: head/sys/dev/acpi_support/acpi_ibm.c head/sys/dev/acpi_support/acpi_sony.c Modified: head/sys/dev/acpi_support/acpi_ibm.c == --- head/sys/dev/acpi_support/acpi_ibm.cTue May 12 22:11:02 2009 (r192029) +++ head/sys/dev/acpi_support/acpi_ibm.cTue May 12 23:22:58 2009 (r192030) @@ -332,7 +332,6 @@ static int acpi_ibm_attach(device_t dev) { struct acpi_ibm_softc *sc; - struct acpi_softc *acpi_sc; devclass_t ec_devclass; ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); @@ -341,8 +340,6 @@ acpi_ibm_attach(device_t dev) sc->dev = dev; sc->handle = acpi_get_handle(dev); - acpi_sc = acpi_device_get_parent_softc(dev); - /* Look for the first embedded controller */ if (!(ec_devclass = devclass_find ("acpi_ec"))) { if (bootverbose) Modified: head/sys/dev/acpi_support/acpi_sony.c == --- head/sys/dev/acpi_support/acpi_sony.c Tue May 12 22:11:02 2009 (r192029) +++ head/sys/dev/acpi_support/acpi_sony.c Tue May 12 23:22:58 2009 (r192030) @@ -102,10 +102,7 @@ static char*sny_id[] = {"SNY5001", N static int acpi_sony_probe(device_t dev) { - struct acpi_sony_softc *sc; - int ret = ENXIO; - - sc = device_get_softc(dev); + int ret = ENXIO; if (ACPI_ID_PROBE(device_get_parent(dev), dev, sny_id)) { device_set_desc(dev, "Sony notebook controller"); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r192031 - head/lib/libarchive
Author: kientzle Date: Wed May 13 00:04:08 2009 New Revision: 192031 URL: http://svn.freebsd.org/changeset/base/192031 Log: Eliminate duplicate error messages from "tar c". Reported by: pav@ Modified: head/lib/libarchive/archive_read_disk_entry_from_file.c Modified: head/lib/libarchive/archive_read_disk_entry_from_file.c == --- head/lib/libarchive/archive_read_disk_entry_from_file.c Tue May 12 23:22:58 2009(r192030) +++ head/lib/libarchive/archive_read_disk_entry_from_file.c Wed May 13 00:04:08 2009(r192031) @@ -92,6 +92,7 @@ archive_read_disk_entry_from_file(struct int initial_fd = fd; int r, r1; + archive_clear_error(_a); path = archive_entry_sourcepath(entry); if (path == NULL) path = archive_entry_pathname(entry); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r192032 - head/sys/netgraph/netflow
Author: mav Date: Wed May 13 02:26:34 2009 New Revision: 192032 URL: http://svn.freebsd.org/changeset/base/192032 Log: Fix copy-paste bug in NGM_NETFLOW_SETCONFIG argument size verification. PR: kern/134220 Submitted by: Eugene Mychlo MFC after:1 week Modified: head/sys/netgraph/netflow/ng_netflow.c Modified: head/sys/netgraph/netflow/ng_netflow.c == --- head/sys/netgraph/netflow/ng_netflow.c Wed May 13 00:04:08 2009 (r192031) +++ head/sys/netgraph/netflow/ng_netflow.c Wed May 13 02:26:34 2009 (r192032) @@ -422,7 +422,7 @@ ng_netflow_rcvmsg (node_p node, item_p i { struct ng_netflow_setconfig *set; - if (msg->header.arglen != sizeof(struct ng_netflow_settimeouts)) + if (msg->header.arglen != sizeof(struct ng_netflow_setconfig)) ERROUT(EINVAL); set = (struct ng_netflow_setconfig *)msg->data; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r192033 - stable/7/sys/dev/ata
Author: mav Date: Wed May 13 02:55:21 2009 New Revision: 192033 URL: http://svn.freebsd.org/changeset/base/192033 Log: Make vendor-specific drivers prefered over the generic AHCI one. This fixes some controllers, like JMicron ones, which provide also PATA via PCI function that declared as AHCI controller. This is not an MFC, but the same was already done in 8-CURRENT in other way. PR: kern/132082 Modified: stable/7/sys/dev/ata/ata-pci.c Modified: stable/7/sys/dev/ata/ata-pci.c == --- stable/7/sys/dev/ata/ata-pci.c Wed May 13 02:26:34 2009 (r192032) +++ stable/7/sys/dev/ata/ata-pci.c Wed May 13 02:55:21 2009 (r192033) @@ -76,12 +76,6 @@ ata_pci_probe(device_t dev) if (pci_get_class(dev) != PCIC_STORAGE) return ENXIO; -/* if this is an AHCI chipset grab it */ -if (pci_get_subclass(dev) == PCIS_STORAGE_SATA) { - if (!ata_ahci_ident(dev)) - return ATA_PROBE_OK; -} - /* run through the vendor specific drivers */ switch (pci_get_vendor(dev)) { case ATA_ACARD_ID: @@ -178,6 +172,12 @@ ata_pci_probe(device_t dev) break; } +/* if this is an AHCI chipset grab it */ +if (pci_get_subclass(dev) == PCIS_STORAGE_SATA) { + if (!ata_ahci_ident(dev)) + return ATA_PROBE_OK; +} + /* unknown chipset, try generic DMA if it seems possible */ if (pci_get_subclass(dev) == PCIS_STORAGE_IDE) { if (!ata_generic_ident(dev)) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r192034 - in head/sys: kern vm
Author: alc Date: Wed May 13 05:39:39 2009 New Revision: 192034 URL: http://svn.freebsd.org/changeset/base/192034 Log: Eliminate page queues locking from bufdone_finish() through the following changes: Rename vfs_page_set_valid() to vfs_page_set_validclean() to reflect what this function actually does. Suggested by: tegge Introduce a new version of vfs_page_set_valid() that does no more than what the function's name implies. Specifically, it does not update the page's dirty mask, and thus it does not require the page queues lock to be held. Update two of the three callers to the old vfs_page_set_valid() to call vfs_page_set_validclean() instead because they actually require the page's dirty mask to be cleared. Introduce vm_page_set_valid(). Reviewed by: tegge Modified: head/sys/kern/vfs_bio.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/kern/vfs_bio.c == --- head/sys/kern/vfs_bio.c Wed May 13 02:55:21 2009(r192033) +++ head/sys/kern/vfs_bio.c Wed May 13 05:39:39 2009(r192034) @@ -98,7 +98,8 @@ static void vm_hold_free_pages(struct bu vm_offset_t to); static void vm_hold_load_pages(struct buf *bp, vm_offset_t from, vm_offset_t to); -static void vfs_page_set_valid(struct buf *bp, vm_ooffset_t off, +static void vfs_page_set_valid(struct buf *bp, vm_ooffset_t off, vm_page_t m); +static void vfs_page_set_validclean(struct buf *bp, vm_ooffset_t off, vm_page_t m); static void vfs_clean_pages(struct buf *bp); static void vfs_setdirty(struct buf *bp); @@ -3277,7 +3278,6 @@ bufdone_finish(struct buf *bp) vm_object_t obj; int iosize; struct vnode *vp = bp->b_vp; - boolean_t are_queues_locked; obj = bp->b_bufobj->bo_object; @@ -3314,11 +3314,6 @@ bufdone_finish(struct buf *bp) !(bp->b_ioflags & BIO_ERROR)) { bp->b_flags |= B_CACHE; } - if (bp->b_iocmd == BIO_READ) { - vm_page_lock_queues(); - are_queues_locked = TRUE; - } else - are_queues_locked = FALSE; for (i = 0; i < bp->b_npages; i++) { int bogusflag = 0; int resid; @@ -3354,6 +3349,9 @@ bufdone_finish(struct buf *bp) * only need to do this here in the read case. */ if ((bp->b_iocmd == BIO_READ) && !bogusflag && resid > 0) { + KASSERT((m->dirty & vm_page_bits(foff & + PAGE_MASK, resid)) == 0, ("bufdone_finish:" + " page %p has unexpected dirty bits", m)); vfs_page_set_valid(bp, foff, m); } @@ -3387,8 +3385,6 @@ bufdone_finish(struct buf *bp) foff = (foff + PAGE_SIZE) & ~(off_t)PAGE_MASK; iosize -= resid; } - if (are_queues_locked) - vm_page_unlock_queues(); vm_object_pip_wakeupn(obj, 0); VM_OBJECT_UNLOCK(obj); } @@ -3454,6 +3450,35 @@ vfs_unbusy_pages(struct buf *bp) static void vfs_page_set_valid(struct buf *bp, vm_ooffset_t off, vm_page_t m) { + vm_ooffset_t eoff; + + /* +* Compute the end offset, eoff, such that [off, eoff) does not span a +* page boundary and eoff is not greater than the end of the buffer. +* The end of the buffer, in this case, is our file EOF, not the +* allocation size of the buffer. +*/ + eoff = (off + PAGE_SIZE) & ~(vm_ooffset_t)PAGE_MASK; + if (eoff > bp->b_offset + bp->b_bcount) + eoff = bp->b_offset + bp->b_bcount; + + /* +* Set valid range. This is typically the entire buffer and thus the +* entire page. +*/ + if (eoff > off) + vm_page_set_valid(m, off & PAGE_MASK, eoff - off); +} + +/* + * vfs_page_set_validclean: + * + * Set the valid bits and clear the dirty bits in a page based on the + * supplied offset. The range is restricted to the buffer's size. + */ +static void +vfs_page_set_validclean(struct buf *bp, vm_ooffset_t off, vm_page_t m) +{ vm_ooffset_t soff, eoff; mtx_assert(&vm_page_queue_mtx, MA_OWNED); @@ -3545,7 +3570,7 @@ retry: */ if (clear_modify) { pmap_remove_write(m); - vfs_page_set_valid(bp, foff, m); + vfs_page_set_validclean(bp, foff, m); } else if (m->valid == VM_PAGE_BITS_ALL && (bp->b_flags & B_CACHE) == 0) { bp->b_pages[