svn commit: r215794 - stable/8/usr.bin/gcore

2010-11-24 Thread David E. O'Brien
Author: obrien
Date: Wed Nov 24 08:09:33 2010
New Revision: 215794
URL: http://svn.freebsd.org/changeset/base/215794

Log:
  MFC: r204329: Fixed dependencies (make checkdpadd).

Modified:
  stable/8/usr.bin/gcore/Makefile
Directory Properties:
  stable/8/usr.bin/gcore/   (props changed)

Modified: stable/8/usr.bin/gcore/Makefile
==
--- stable/8/usr.bin/gcore/Makefile Wed Nov 24 06:22:09 2010
(r215793)
+++ stable/8/usr.bin/gcore/Makefile Wed Nov 24 08:09:33 2010
(r215794)
@@ -1,8 +1,9 @@
 #  @(#)Makefile8.1 (Berkeley) 6/6/93
 # $FreeBSD$
 
-LDADD+=-lutil
 PROG=  gcore
 SRCS=  elfcore.c gcore.c
+DPADD= ${LIBUTIL}
+LDADD= -lutil
 
 .include bsd.prog.mk
___
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: r215795 - stable/8/sys/dev/usb/serial

2010-11-24 Thread Nick Hibma
Author: n_hibma
Date: Wed Nov 24 09:36:36 2010
New Revision: 215795
URL: http://svn.freebsd.org/changeset/base/215795

Log:
  MFC 213876: Add more USB device IDs to supported list of devices.

Modified:
  stable/8/sys/dev/usb/serial/uftdi.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/usb/serial/uftdi.c
==
--- stable/8/sys/dev/usb/serial/uftdi.c Wed Nov 24 08:09:33 2010
(r215794)
+++ stable/8/sys/dev/usb/serial/uftdi.c Wed Nov 24 09:36:36 2010
(r215795)
@@ -233,6 +233,7 @@ static struct usb_device_id uftdi_devs[]
UFTDI_DEV(FTDI, CFA_633, 8U232AM),
UFTDI_DEV(FTDI, CFA_634, 8U232AM),
UFTDI_DEV(FTDI, CFA_635, 8U232AM),
+   UFTDI_DEV(FTDI, USB_UIRT, 8U232AM),
UFTDI_DEV(FTDI, USBSERIAL, 8U232AM),
UFTDI_DEV(FTDI, KBS, 8U232AM),
UFTDI_DEV(FTDI, MX2_3, 8U232AM),
@@ -254,6 +255,7 @@ static struct usb_device_id uftdi_devs[]
UFTDI_DEV(INTREPIDCS, VALUECAN, 8U232AM),
UFTDI_DEV(INTREPIDCS, NEOVI, 8U232AM),
UFTDI_DEV(BBELECTRONICS, USOTL4, 8U232AM),
+   UFTDI_DEV(MATRIXORBITAL, MOUA, 8U232AM),
UFTDI_DEV(MARVELL, SHEEVAPLUG, 8U232AM),
UFTDI_DEV(MELCO, PCOPRS1, 8U232AM),
UFTDI_DEV(RATOC, REXUSB60F, 8U232AM),
___
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: r215791 - stable/8/sys/netinet

2010-11-24 Thread Gleb Smirnoff
On Wed, Nov 24, 2010 at 06:11:53PM +1100, Bruce Evans wrote:
B  +++ stable/8/sys/netinet/if_ether.cWed Nov 24 05:37:12 2010
(r215791)
B  @@ -381,7 +381,7 @@ retry:
B int canceled;
B 
B LLE_ADDREF(la);
B  -  la-la_expire = time_second + V_arpt_down;
B  +  la-la_expire = time_second;
B canceled = callout_reset(la-la_timer, hz * V_arpt_down,
B arptimer, la);
B if (canceled)
B 
B 
B Isn't using non-monotic time for timeouts always wrong?

Sure it is wrong. I never payed attention to that fact that time_second
could be non-monotic. Is it non-monotic? I failed to understand kern_tc
code at first glance.

B There are lots of other time_second's in networkining code.  These
B still outnumber time_uptime's by about 68:41.  rtcock.c uses the weird
B expression time_second - time_uptime for metrics.  Since time_uptime
B is relative to boot time while time_second is relative to the Epoch,
B their difference is approximately the number of seconds since the
B Epoch, which is a very strange value which might nevertheless be
B useful for converting between monotonic expiry times and real expiry
B times, but I think it doesn't work even for that if the real time is
B stepped.
B 
B Bruce

-- 
Totus tuus, Glebius.
___
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: r215791 - stable/8/sys/netinet

2010-11-24 Thread Bruce Evans

On Wed, 24 Nov 2010, Gleb Smirnoff wrote:


On Wed, Nov 24, 2010 at 06:11:53PM +1100, Bruce Evans wrote:
B  +++ stable/8/sys/netinet/if_ether.c  Wed Nov 24 05:37:12 2010
(r215791)
B  @@ -381,7 +381,7 @@ retry:
B   int canceled;
B 
B   LLE_ADDREF(la);
B  -la-la_expire = time_second + V_arpt_down;
B  +la-la_expire = time_second;
B   canceled = callout_reset(la-la_timer, hz * V_arpt_down,
B   arptimer, la);
B   if (canceled)
B 
B
B Isn't using non-monotic time for timeouts always wrong?

 monotonic


Sure it is wrong. I never payed attention to that fact that time_second
could be non-monotic. Is it non-monotic? I failed to understand kern_tc
code at first glance.


Real time (time_second) can go backwards (or jump forwards too much)
if someone steps the the clock.  In kern_tc.c, time_uptime is implemented
as a purely monotonic clock which goes forward by 1 (second) approximately
every 1 second of real-real-time, while time_second is misimplemented
as essentially (boottime.tv_sec + time_uptime), where boottime is
bogusly changed (although the actual boot time didn't change) if someone
steps the realtime clock to fix drift in it, including for POSIX leap
seconds and resumes.  (Suspends stop the monotonic clock, and on resume
only the real time clock is advanced by much (by bogusly setting boottime
forwards so that (boottime.tv_sec + time_uptime) gives the correct real
time.)

Using real time is actually correct for some timeouts, mainly for long
ones.  E.g., ones for the next day shouldn't be 8 hours late because the
system was suspended overnight.

Bruce
___
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: r215796 - head/sys/vm

2010-11-24 Thread Konstantin Belousov
Author: kib
Date: Wed Nov 24 12:25:17 2010
New Revision: 215796
URL: http://svn.freebsd.org/changeset/base/215796

Log:
  After the sleep caused by encountering a busy page, relookup the page.
  
  Submitted and reviewed by:alc
  Reprted and tested by:pho
  MFC after:5 days

Modified:
  head/sys/vm/vm_object.c

Modified: head/sys/vm/vm_object.c
==
--- head/sys/vm/vm_object.c Wed Nov 24 09:36:36 2010(r215795)
+++ head/sys/vm/vm_object.c Wed Nov 24 12:25:17 2010(r215796)
@@ -821,9 +821,11 @@ rescan:
np = TAILQ_NEXT(p, listq);
if (p-valid == 0)
continue;
-   while (vm_page_sleep_if_busy(p, TRUE, vpcwai)) {
+   if (vm_page_sleep_if_busy(p, TRUE, vpcwai)) {
if (object-generation != curgeneration)
goto rescan;
+   np = vm_page_find_least(object, pi);
+   continue;
}
vm_page_test_dirty(p);
if (p-dirty == 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: r215797 - head/sys/kern

2010-11-24 Thread Konstantin Belousov
Author: kib
Date: Wed Nov 24 12:30:41 2010
New Revision: 215797
URL: http://svn.freebsd.org/changeset/base/215797

Log:
  Allow shared-locked vnode to be passed to vunref(9).
  When shared-locked vnode is supplied as an argument to vunref(9) and
  resulting usecount is 0, set VI_OWEINACT and do not try to upgrade vnode
  lock. The later could cause vnode unlock, allowing the vnode to be
  reclaimed meantime.
  
  Tested by:pho
  MFC after:1 week

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cWed Nov 24 12:25:17 2010(r215796)
+++ head/sys/kern/vfs_subr.cWed Nov 24 12:30:41 2010(r215797)
@@ -2186,7 +2186,7 @@ vputx(struct vnode *vp, int func)
 
KASSERT(vp != NULL, (vputx: null vp));
if (func == VPUTX_VUNREF)
-   ASSERT_VOP_ELOCKED(vp, vunref);
+   ASSERT_VOP_LOCKED(vp, vunref);
else if (func == VPUTX_VPUT)
ASSERT_VOP_LOCKED(vp, vput);
else
@@ -2224,12 +2224,22 @@ vputx(struct vnode *vp, int func)
 * as VI_DOINGINACT to avoid recursion.
 */
vp-v_iflag |= VI_OWEINACT;
-   if (func == VPUTX_VRELE) {
+   switch (func) {
+   case VPUTX_VRELE:
error = vn_lock(vp, LK_EXCLUSIVE | LK_INTERLOCK);
VI_LOCK(vp);
-   } else if (func == VPUTX_VPUT  VOP_ISLOCKED(vp) != LK_EXCLUSIVE) {
-   error = VOP_LOCK(vp, LK_UPGRADE | LK_INTERLOCK | LK_NOWAIT);
-   VI_LOCK(vp);
+   break;
+   case VPUTX_VPUT:
+   if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) {
+   error = VOP_LOCK(vp, LK_UPGRADE | LK_INTERLOCK |
+   LK_NOWAIT);
+   VI_LOCK(vp);
+   }
+   break;
+   case VPUTX_VUNREF:
+   if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE)
+   error = EBUSY;
+   break;
}
if (vp-v_usecount  0)
vp-v_iflag = ~VI_OWEINACT;
___
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: r215798 - head/share/man/man9

2010-11-24 Thread Konstantin Belousov
Author: kib
Date: Wed Nov 24 12:34:25 2010
New Revision: 215798
URL: http://svn.freebsd.org/changeset/base/215798

Log:
  Remove the note about possible unlocking during vunref(9). It might
  only happen if VOP_INACTIVATE() drops the vnode lock, which is quite
  unreasonable behaviour for filesystem, and should not be mentioned
  in the description of VFS primitives.
  
  MFC after:1 week

Modified:
  head/share/man/man9/vrele.9

Modified: head/share/man/man9/vrele.9
==
--- head/share/man/man9/vrele.9 Wed Nov 24 12:30:41 2010(r215797)
+++ head/share/man/man9/vrele.9 Wed Nov 24 12:34:25 2010(r215798)
@@ -29,7 +29,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd October 17, 2010
+.Dd November 20, 2010
 .Dt VRELE 9
 .Os
 .Sh NAME
@@ -74,10 +74,6 @@ with less overhead.
 The
 .Fn vunref
 function takes a locked vnode as argument, and returns with the vnode locked.
-Nonetheless, the
-.Fn vunref
-might drop the vnode lock during the operation, so caller should not expect
-that non-doomed vnode is still non-doomed after the function returned.
 .Pp
 Any code in the system which signified its use of a vnode by usecount
 should call one of the listed function to decrement use counter.
___
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: r215799 - in head: etc/defaults etc/rc.d share/man/man5

2010-11-24 Thread Pawel Jakub Dawidek
Author: pjd
Date: Wed Nov 24 15:25:17 2010
New Revision: 215799
URL: http://svn.freebsd.org/changeset/base/215799

Log:
  Add gptboot_enable rc variable, which allows to turn gptboot reporting off in
  case user wants to implement his own actions and doesn't want the attributes 
to
  vanish.
  
  Obtained from:Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  MFC after:3 days

Modified:
  head/etc/defaults/rc.conf
  head/etc/rc.d/gptboot
  head/share/man/man5/rc.conf.5

Modified: head/etc/defaults/rc.conf
==
--- head/etc/defaults/rc.conf   Wed Nov 24 12:34:25 2010(r215798)
+++ head/etc/defaults/rc.conf   Wed Nov 24 15:25:17 2010(r215799)
@@ -58,6 +58,8 @@ rc_conf_files=/etc/rc.conf /etc/rc.conf
 # ZFS support
 zfs_enable=NO# Set to YES to automatically mount ZFS file 
systems
 
+gptboot_enable=YES   # GPT boot success/failure reporting.
+
 # Experimental - test before enabling
 gbde_autoattach_all=NO # YES automatically mounts gbde devices from fstab
 gbde_devices=NO  # Devices to automatically attach (list, or AUTO)

Modified: head/etc/rc.d/gptboot
==
--- head/etc/rc.d/gptboot   Wed Nov 24 12:34:25 2010(r215798)
+++ head/etc/rc.d/gptboot   Wed Nov 24 15:25:17 2010(r215799)
@@ -34,6 +34,7 @@
 . /etc/rc.subr
 
 name=gptboot
+rcvar=`set_rcvar`
 start_cmd=gptboot_report
 
 gptboot_report()

Modified: head/share/man/man5/rc.conf.5
==
--- head/share/man/man5/rc.conf.5   Wed Nov 24 12:34:25 2010
(r215798)
+++ head/share/man/man5/rc.conf.5   Wed Nov 24 15:25:17 2010
(r215799)
@@ -24,7 +24,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd November 13, 2010
+.Dd November 24, 2010
 .Dt RC.CONF 5
 .Os
 .Sh NAME
@@ -1575,6 +1575,17 @@ If set to
 .Pa /etc/rc.d/zfs
 will attempt to automatically mount ZFS file systems and initialize ZFS volumes
 (ZVOLs).
+.It Va gptboot_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+.Pa /etc/rc.d/gptboot
+will log if the system successfully (or not) booted from a GPT partition,
+which had the
+.Ar bootonce
+attribute set using
+.Xr gpart 8
+utility.
 .It Va gbde_autoattach_all
 .Pq Vt bool
 If set to
___
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: r215797 - head/sys/kern

2010-11-24 Thread Attilio Rao
2010/11/24 Konstantin Belousov k...@freebsd.org:
 Author: kib
 Date: Wed Nov 24 12:30:41 2010
 New Revision: 215797
 URL: http://svn.freebsd.org/changeset/base/215797

 Log:
  Allow shared-locked vnode to be passed to vunref(9).
  When shared-locked vnode is supplied as an argument to vunref(9) and
  resulting usecount is 0, set VI_OWEINACT and do not try to upgrade vnode
  lock. The later could cause vnode unlock, allowing the vnode to be
  reclaimed meantime.

Thanks a lot, I really appreciate that.

The story here is that kib really wanted to commit another patch
aiming for the vnode lock upgrade with a modify to lockmgr that I
wasn't happy with (or more specifically that I really wished could be
carried on in a different way).

As this is a time-critical fix for him, that is probabilly a better compromise.
I'll try to find some time and go with the full patchset I have in
mind, changing this to using upgrade.

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein
___
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: r215800 - head/sys/netgraph

2010-11-24 Thread Marko Zec
Author: zec
Date: Wed Nov 24 16:02:58 2010
New Revision: 215800
URL: http://svn.freebsd.org/changeset/base/215800

Log:
  Simplify ng_pipe locking model by relying on the netgraph framework
  to provide serialization of calls into the node, which is accomplished
  by markng the node as single-threaded (NGF_FORCE_WRITER).
  
  The price we pay is that each ng_pipe instance now has its own callout
  handler which polls for queued frames on each clock tick, as long as
  the pipe has any frames in its internal queues.  OTOH, we got rid of
  the global ng_pipe mutex, so from now on multiple ng_pipe instances
  can operate in parallel.  This change also fixes counting of forwarded
  frames when an ng_pipe node is not enforcing any packet impairments.
  
  While here, attempt to improve adherance to style(9) throughout
  otherwise mostly unreadable code.
  
  MFC after:3 days

Modified:
  head/sys/netgraph/ng_pipe.c

Modified: head/sys/netgraph/ng_pipe.c
==
--- head/sys/netgraph/ng_pipe.c Wed Nov 24 15:25:17 2010(r215799)
+++ head/sys/netgraph/ng_pipe.c Wed Nov 24 16:02:58 2010(r215800)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2004-2008 University of Zagreb
+ * Copyright (c) 2004-2010 University of Zagreb
  * Copyright (c) 2007-2008 FreeBSD Foundation
  *
  * This software was developed by the University of Zagreb and the
@@ -62,8 +62,6 @@
 
 static MALLOC_DEFINE(M_NG_PIPE, ng_pipe, ng_pipe);
 
-struct mtx ng_pipe_giant;
-
 /* Packet header struct */
 struct ngp_hdr {
TAILQ_ENTRY(ngp_hdr)ngp_link;   /* next pkt in queue */
@@ -88,7 +86,6 @@ struct hookinfo {
int noqueue;/* bypass any processing */
TAILQ_HEAD(, ngp_fifo)  fifo_head;  /* FIFO queues */
TAILQ_HEAD(, ngp_hdr)   qout_head;  /* delay queue head */
-   LIST_ENTRY(hookinfo)active_le;  /* active hooks */
struct timeval  qin_utime;
struct ng_pipe_hookcfg  cfg;
struct ng_pipe_hookrun  run;
@@ -103,6 +100,8 @@ struct node_priv {
u_int32_t   header_offset;
struct hookinfo lower;
struct hookinfo upper;
+   struct callout  timer;
+   int timer_scheduled;
 };
 typedef struct node_priv *priv_p;
 
@@ -131,17 +130,9 @@ typedef struct node_priv *priv_p;
 static voidparse_cfg(struct ng_pipe_hookcfg *, struct ng_pipe_hookcfg *,
struct hookinfo *, priv_p);
 static voidpipe_dequeue(struct hookinfo *, struct timeval *);
-static voidpipe_scheduler(void *);
-static voidpipe_poll(void);
+static voidngp_callout(node_p, hook_p, void *, int);
 static int ngp_modevent(module_t, int, void *);
 
-/* linked list of active pipe hooks */
-static LIST_HEAD(, hookinfo) active_head;
-static int active_gen_id = 0;
-
-/* timeout handle for pipe_scheduler */
-static struct callout polling_timer;
-
 /* zone for storing ngp_hdr-s */
 static uma_zone_t ngp_zone;
 
@@ -267,6 +258,11 @@ ngp_constructor(node_p node)
return (ENOMEM);
NG_NODE_SET_PRIVATE(node, priv);
 
+   /* Mark node as single-threaded */
+   NG_NODE_FORCE_WRITER(node);
+
+   ng_callout_init(priv-timer);
+
return (0);
 }
 
@@ -310,8 +306,6 @@ ngp_rcvmsg(node_p node, item_p item, hoo
struct ng_pipe_cfg *cfg;
int error = 0;
 
-   mtx_lock(ng_pipe_giant);
-
NGI_GET_MSG(item, msg);
switch (msg-header.typecookie) {
case NGM_PIPE_COOKIE:
@@ -326,7 +320,7 @@ ngp_rcvmsg(node_p node, item_p item, hoo
error = ENOMEM;
break;
}
-   stats = (struct ng_pipe_stats *)resp-data;
+   stats = (struct ng_pipe_stats *) resp-data;
bcopy(priv-upper.stats, stats-downstream,
sizeof(stats-downstream));
bcopy(priv-lower.stats, stats-upstream,
@@ -345,7 +339,7 @@ ngp_rcvmsg(node_p node, item_p item, hoo
error = ENOMEM;
break;
}
-   run = (struct ng_pipe_run *)resp-data;
+   run = (struct ng_pipe_run *) resp-data;
bcopy(priv-upper.run, run-downstream,
sizeof(run-downstream));
bcopy(priv-lower.run, run-upstream,
@@ -357,7 +351,7 @@ ngp_rcvmsg(node_p node, item_p item, hoo
error = ENOMEM;
break;
}
-   cfg = (struct ng_pipe_cfg *)resp-data;
+   cfg = (struct ng_pipe_cfg *) resp-data;
bcopy(priv-upper.cfg, 

svn commit: r215801 - head/sys/amd64/amd64

2010-11-24 Thread Dimitry Andric
Author: dim
Date: Wed Nov 24 18:35:11 2010
New Revision: 215801
URL: http://svn.freebsd.org/changeset/base/215801

Log:
  Change ambiguous (or invalid, depending on how strict you want to be :)
  assembly instruction movw %rcx,2(%rax) to movw %cx,2(%rax), since
  the intent was to move 16 bits of data, in this case.
  
  Found by: clang
  Reviewed by:  kib

Modified:
  head/sys/amd64/amd64/cpu_switch.S

Modified: head/sys/amd64/amd64/cpu_switch.S
==
--- head/sys/amd64/amd64/cpu_switch.S   Wed Nov 24 16:02:58 2010
(r215800)
+++ head/sys/amd64/amd64/cpu_switch.S   Wed Nov 24 18:35:11 2010
(r215801)
@@ -276,7 +276,7 @@ load_dr:
 do_tss:movq%rdx,PCPU(TSSP)
movq%rdx,%rcx
movqPCPU(TSS),%rax
-   movw%rcx,2(%rax)
+   movw%cx,2(%rax)
shrq$16,%rcx
movb%cl,4(%rax)
shrq$8,%rcx
___
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: r215802 - in head/sys/dev/usb: . controller

2010-11-24 Thread Weongyo Jeong
Author: weongyo
Date: Wed Nov 24 19:11:32 2010
New Revision: 215802
URL: http://svn.freebsd.org/changeset/base/215802

Log:
  Removes all duplicated code with BPF that it's greatly simplified and
  take all benefits whenever BPF code is improved.
  
  Pointed by:   jkim
  Reviewed by:  thompsa

Modified:
  head/sys/dev/usb/controller/usb_controller.c
  head/sys/dev/usb/usb_bus.h
  head/sys/dev/usb/usb_pf.c
  head/sys/dev/usb/usb_pf.h

Modified: head/sys/dev/usb/controller/usb_controller.c
==
--- head/sys/dev/usb/controller/usb_controller.cWed Nov 24 18:35:11 
2010(r215801)
+++ head/sys/dev/usb/controller/usb_controller.cWed Nov 24 19:11:32 
2010(r215802)
@@ -548,7 +548,7 @@ usb_bus_mem_alloc_all(struct usb_bus *bu
 
TAILQ_INIT(bus-intr_q.head);
 
-   usbpf_attach(bus, bus-uif);
+   usbpf_attach(bus);
 
 #if USB_HAVE_BUSDMA
usb_dma_tag_setup(bus-dma_parent_tag, bus-dma_tags,

Modified: head/sys/dev/usb/usb_bus.h
==
--- head/sys/dev/usb/usb_bus.h  Wed Nov 24 18:35:11 2010(r215801)
+++ head/sys/dev/usb/usb_bus.h  Wed Nov 24 19:11:32 2010(r215802)
@@ -86,7 +86,7 @@ struct usb_bus {
struct usb_bus_methods *methods;/* filled by HC driver */
struct usb_device **devices;
 
-   struct usbpf_if *uif;   /* USB Packet Filter */
+   struct ifnet *ifp;  /* only for USB Packet Filter */
 
usb_power_mask_t hw_power_state;/* see USB_HW_POWER_XXX */
usb_size_t uframe_usage[USB_HS_MICRO_FRAMES_MAX];

Modified: head/sys/dev/usb/usb_pf.c
==
--- head/sys/dev/usb/usb_pf.c   Wed Nov 24 18:35:11 2010(r215801)
+++ head/sys/dev/usb/usb_pf.c   Wed Nov 24 19:11:32 2010(r215802)
@@ -43,6 +43,8 @@ __FBSDID($FreeBSD$);
 #include sys/socket.h
 #include sys/sockio.h
 #include net/if.h
+#include net/if_types.h
+#include net/bpf.h
 
 #include dev/usb/usb.h
 #include dev/usb/usbdi.h
@@ -55,1624 +57,39 @@ __FBSDID($FreeBSD$);
 #include dev/usb/usb_pf.h
 #include dev/usb/usb_transfer.h
 
-/*
- * All usbpf implementations are extracted from bpf(9) APIs and it's
- * specialized for USB packet filtering between the driver and the host
- * controller.
- */
-
-MALLOC_DEFINE(M_USBPF, USBPktFilter, USB Packet Filter);
-
-/*
- * Rotate the packet buffers in descriptor ud.  Move the store buffer into the
- * hold slot, and the free buffer ino the store slot.  Zero the length of the
- * new store buffer.  Descriptor lock should be held.
- */
-#defineUSBPF_ROTATE_BUFFERS(ud)do {
\
-   (ud)-ud_hbuf = (ud)-ud_sbuf;  \
-   (ud)-ud_hlen = (ud)-ud_slen;  \
-   (ud)-ud_sbuf = (ud)-ud_fbuf;  \
-   (ud)-ud_slen = 0;  \
-   (ud)-ud_fbuf = NULL;   \
-   usbpf_bufheld(ud);  \
-} while (0)
-
-#ifndef __i386__
-#defineUSBPF_ALIGN
-#endif
-
-#ifndef USBPF_ALIGN
-#defineUSBPF_EXTRACT_SHORT(p)  ((u_int16_t)ntohs(*(u_int16_t *)p))
-#defineUSBPF_EXTRACT_LONG(p)   (ntohl(*(u_int32_t *)p))
-#else
-#defineUSBPF_EXTRACT_SHORT(p)  
\
-   ((u_int16_t)\
-   ((u_int16_t)*((u_char *)p+0)8|\
-   (u_int16_t)*((u_char *)p+1)0))
-#defineUSBPF_EXTRACT_LONG(p)   
\
-   ((u_int32_t)*((u_char *)p+0)24|   \
-   (u_int32_t)*((u_char *)p+1)16|\
-   (u_int32_t)*((u_char *)p+2)8| \
-   (u_int32_t)*((u_char *)p+3)0)
-#endif
-
-/*
- * Number of scratch memory words (for USBPF_LD|USBPF_MEM and USBPF_ST).
- */
-#defineUSBPF_MEMWORDS   16
-
-/* Values for ud_state */
-#defineUSBPF_IDLE  0   /* no select in progress */
-#defineUSBPF_WAITING   1   /* waiting for read timeout in 
select */
-#defineUSBPF_TIMED_OUT 2   /* read timeout has expired in 
select */
-
-#definePRIUSB  26  /* interruptible */
-
-/* Frame directions */
-enum usbpf_direction {
-   USBPF_D_IN, /* See incoming frames */
-   USBPF_D_INOUT,  /* See incoming and outgoing frames */
-   USBPF_D_OUT /* See outgoing frames */
-};
-
-static voidusbpf_append_bytes(struct usbpf_d *, caddr_t, u_int, void *,
-   u_int);
-static voidusbpf_attachd(struct usbpf_d *, struct usbpf_if *);
-static void

svn commit: r215803 - head/usr.sbin/usbdump

2010-11-24 Thread Weongyo Jeong
Author: weongyo
Date: Wed Nov 24 19:15:26 2010
New Revision: 215803
URL: http://svn.freebsd.org/changeset/base/215803

Log:
  As a refection of r215802 it should use BPF interfaces because the
  duplication code of USB pf is removed.

Modified:
  head/usr.sbin/usbdump/usbdump.c

Modified: head/usr.sbin/usbdump/usbdump.c
==
--- head/usr.sbin/usbdump/usbdump.c Wed Nov 24 19:11:32 2010
(r215802)
+++ head/usr.sbin/usbdump/usbdump.c Wed Nov 24 19:15:26 2010
(r215803)
@@ -32,8 +32,11 @@
 #include sys/param.h
 #include sys/endian.h
 #include sys/ioctl.h
+#include sys/socket.h
 #include sys/stat.h
 #include sys/utsname.h
+#include net/if.h
+#include net/bpf.h
 #include dev/usb/usb.h
 #include dev/usb/usb_pf.h
 #include dev/usb/usbdi.h
@@ -216,7 +219,7 @@ hexdump(const char *region, size_t len)
 }
 
 static void
-print_apacket(const struct usbpf_xhdr *hdr, struct usbpf_pkthdr *up,
+print_apacket(const struct bpf_xhdr *hdr, struct usbpf_pkthdr *up,
 const char *payload)
 {
struct tm *tm;
@@ -235,8 +238,8 @@ print_apacket(const struct usbpf_xhdr *h
up-up_error = le32toh(up-up_error);
up-up_interval = le32toh(up-up_interval);
 
-   tv.tv_sec = hdr-uh_tstamp.ut_sec;
-   tv.tv_usec = hdr-uh_tstamp.ut_frac;
+   tv.tv_sec = hdr-bh_tstamp.bt_sec;
+   tv.tv_usec = hdr-bh_tstamp.bt_frac;
tm = localtime(tv.tv_sec);
 
len = strftime(buf, sizeof(buf), %H:%M:%S, tm);
@@ -267,20 +270,19 @@ print_apacket(const struct usbpf_xhdr *h
print_status(up-up_status);
}
 }
-
 
 static void
 print_packets(char *data, const int datalen)
 {
struct usbpf_pkthdr *up;
-   const struct usbpf_xhdr *hdr;
+   const struct bpf_xhdr *hdr;
u_int32_t framelen, x;
char *ptr, *next;
 
for (ptr = data; ptr  (data + datalen); ptr = next) {
-   hdr = (const struct usbpf_xhdr *)ptr;
-   up = (struct usbpf_pkthdr *)(ptr + hdr-uh_hdrlen);
-   next = ptr + USBPF_WORDALIGN(hdr-uh_hdrlen + hdr-uh_caplen);
+   hdr = (const struct bpf_xhdr *)ptr;
+   up = (struct usbpf_pkthdr *)(ptr + hdr-bh_hdrlen);
+   next = ptr + BPF_WORDALIGN(hdr-bh_hdrlen + hdr-bh_caplen);
 
ptr = ((char *)up) + sizeof(struct usbpf_pkthdr);
if (w_arg == NULL)
@@ -404,12 +406,12 @@ int
 main(int argc, char *argv[])
 {
struct timeval tv;
-   struct usbpf_insn total_insn;
-   struct usbpf_program total_prog;
-   struct usbpf_stat us;
-   struct usbpf_version uv;
+   struct bpf_insn total_insn;
+   struct bpf_program total_prog;
+   struct bpf_stat us;
+   struct bpf_version bv;
struct usbcap uc, *p = uc;
-   struct usbpf_ifreq ufr;
+   struct ifreq ifr;
long snapshot = 192;
u_int v;
int fd, o;
@@ -454,37 +456,37 @@ main(int argc, char *argv[])
exit(EXIT_SUCCESS);
}
 
-   p-fd = fd = open(/dev/usbpf, O_RDONLY);
+   p-fd = fd = open(/dev/bpf, O_RDONLY);
if (p-fd  0) {
fprintf(stderr, (no devices found)\n);
return (EXIT_FAILURE);
}
 
-   if (ioctl(fd, UIOCVERSION, (caddr_t)uv)  0) {
-   fprintf(stderr, UIOCVERSION: %s\n, strerror(errno));
+   if (ioctl(fd, BIOCVERSION, (caddr_t)bv)  0) {
+   fprintf(stderr, BIOCVERSION: %s\n, strerror(errno));
return (EXIT_FAILURE);
}
-   if (uv.uv_major != USBPF_MAJOR_VERSION ||
-   uv.uv_minor  USBPF_MINOR_VERSION) {
+   if (bv.bv_major != BPF_MAJOR_VERSION ||
+   bv.bv_minor  BPF_MINOR_VERSION) {
fprintf(stderr, kernel bpf filter out of date);
return (EXIT_FAILURE);
}
 
-   if ((ioctl(fd, UIOCGBLEN, (caddr_t)v)  0) || v  65536)
-   v = 65536;
+   if ((ioctl(fd, BIOCGBLEN, (caddr_t)v)  0) || v  4096)
+   v = 4096;
for ( ; v != 0; v = 1) {
-   (void)ioctl(fd, UIOCSBLEN, (caddr_t)v);
-   (void)strncpy(ufr.ufr_name, i_arg, sizeof(ufr.ufr_name));
-   if (ioctl(fd, UIOCSETIF, (caddr_t)ufr) = 0)
+   (void)ioctl(fd, BIOCSBLEN, (caddr_t)v);
+   (void)strncpy(ifr.ifr_name, i_arg, sizeof(ifr.ifr_name));
+   if (ioctl(fd, BIOCSETIF, (caddr_t)ifr) = 0)
break;
}
if (v == 0) {
-   fprintf(stderr, UIOCSBLEN: %s: No buffer size worked, i_arg);
+   fprintf(stderr, BIOCSBLEN: %s: No buffer size worked, i_arg);
return (EXIT_FAILURE);
}
 
-   if (ioctl(fd, UIOCGBLEN, (caddr_t)v)  0) {
-   fprintf(stderr, UIOCGBLEN: %s, strerror(errno));
+   if (ioctl(fd, BIOCGBLEN, (caddr_t)v)  0) {
+   fprintf(stderr, BIOCGBLEN: %s, strerror(errno));

Re: svn commit: r215803 - head/usr.sbin/usbdump

2010-11-24 Thread Hans Petter Selasky
On Wednesday 24 November 2010 20:15:26 Weongyo Jeong wrote:
 Author: weongyo
 Date: Wed Nov 24 19:15:26 2010
 New Revision: 215803
 URL: http://svn.freebsd.org/changeset/base/215803
 
 Log:
   As a refection of r215802 it should use BPF interfaces because the
   duplication code of USB pf is removed.
 
 Modified:
   head/usr.sbin/usbdump/usbdump.c
 

A comment: We need to do something about slow printout of captured USB 
packets. I noticed 20% CPU usage when printing via the TXT version to a 
file.txt. But 1% CPU usage when simply saving the stream.

Is this something you plan to do?

--HPS
___
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: r215802 - in head/sys/dev/usb: . controller

2010-11-24 Thread Hans Petter Selasky
On Wednesday 24 November 2010 20:11:32 Weongyo Jeong wrote:
 Author: weongyo
 Date: Wed Nov 24 19:11:32 2010
 New Revision: 215802
 URL: http://svn.freebsd.org/changeset/base/215802
 
 Log:
   Removes all duplicated code with BPF that it's greatly simplified and
   take all benefits whenever BPF code is improved.
 
   Pointed by: jkim
   Reviewed by:thompsa
 
 Modified:
   head/sys/dev/usb/controller/usb_controller.c
   head/sys/dev/usb/usb_bus.h
   head/sys/dev/usb/usb_pf.c
   head/sys/dev/usb/usb_pf.h
 

Should the Copyright be updated aswell. We are no longer using enet.c code in 
usb_pf.c ?

 * Copyright (c) 1990, 1991, 1993
 *  The Regents of the University of California.  All rights reserved.
 *
 * This code is derived from the Stanford/CMU enet packet filter,
 * (net/enet.c) distributed as part of 4.3BSD, and code contributed
 * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
 * Berkeley Laboratory.

--HPS
___
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: r215801 - head/sys/amd64/amd64

2010-11-24 Thread Dimitry Andric

On 2010-11-24 19:35, Dimitry Andric wrote:

Author: dim
Date: Wed Nov 24 18:35:11 2010
New Revision: 215801
URL: http://svn.freebsd.org/changeset/base/215801

Log:
   Change ambiguous (or invalid, depending on how strict you want to be :)
   assembly instruction movw %rcx,2(%rax) to movw %cx,2(%rax), since
   the intent was to move 16 bits of data, in this case.

   Found by:clang
   Reviewed by: kib


MFC after:  1 week
___
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: r215804 - head/sys/dev/usb

2010-11-24 Thread Weongyo Jeong
Author: weongyo
Date: Wed Nov 24 21:43:36 2010
New Revision: 215804
URL: http://svn.freebsd.org/changeset/base/215804

Log:
  Fixes a compiler warning when it's compiled with INVARIANTS.
  
  Pointy hat to:me

Modified:
  head/sys/dev/usb/usb_pf.c

Modified: head/sys/dev/usb/usb_pf.c
==
--- head/sys/dev/usb/usb_pf.c   Wed Nov 24 19:15:26 2010(r215803)
+++ head/sys/dev/usb/usb_pf.c   Wed Nov 24 21:43:36 2010(r215804)
@@ -67,7 +67,7 @@ usbpf_attach(struct usb_bus *ubus)
if_attach(ifp);
 
KASSERT(sizeof(struct usbpf_pkthdr) == USBPF_HDR_LEN,
-   (wrong USB pf header length (%d), sizeof(struct usbpf_pkthdr)));
+   (wrong USB pf header length (%zd), sizeof(struct usbpf_pkthdr)));
 
/*
 * XXX According to the specification of DLT_USB, it indicates packets
___
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: r215805 - stable/8/usr.sbin/sysinstall

2010-11-24 Thread Bruce Cran
Author: brucec
Date: Wed Nov 24 21:54:45 2010
New Revision: 215805
URL: http://svn.freebsd.org/changeset/base/215805

Log:
  MFC r215637:
  
  dispatch_add_command:
  Modify the logic so there's only one exit point instead of two.
  Only insert valid (non-NULL) values into the queue.
  
  dispatch_free_command:
  Ensure that item is not NULL before removing it from the queue and
  dereferencing the pointer.
  NULL out free'd pointers to catch any use-after-free bugs.
  
  PR:   bin/146855
  Submitted by: gcooper

Modified:
  stable/8/usr.sbin/sysinstall/dispatch.c
Directory Properties:
  stable/8/usr.sbin/sysinstall/   (props changed)

Modified: stable/8/usr.sbin/sysinstall/dispatch.c
==
--- stable/8/usr.sbin/sysinstall/dispatch.c Wed Nov 24 21:43:36 2010
(r215804)
+++ stable/8/usr.sbin/sysinstall/dispatch.c Wed Nov 24 21:54:45 2010
(r215805)
@@ -136,8 +136,12 @@ typedef struct command_buffer_ {
 static void
 dispatch_free_command(command_buffer *item)
 {
-REMQUE(item);
-free(item-string);
+if (item != NULL) {
+   REMQUE(item);
+   free(item-string);
+   item-string = NULL;
+}
+
 free(item);
 }
 
@@ -155,19 +159,29 @@ dispatch_free_all(qelement *head)
 static command_buffer *
 dispatch_add_command(qelement *head, char *string)
 {
-command_buffer *new;
+command_buffer *new = NULL;
 
 new = malloc(sizeof(command_buffer));
 
-if (!new)
-   return NULL;
+if (new != NULL) {
 
-new-string = strdup(string);
-INSQUEUE(new, head-q_back);
+   new-string = strdup(string);
+
+   /*
+* We failed to copy `string'; clean up the allocated
+* resources.
+*/
+   if (new-string == NULL) {
+   free(new);
+   new = NULL;
+   } else {
+   INSQUEUE(new, head-q_back);
+   }
+}
 
 return new;
 }
-
+
 /*
  * Command processing
  */
@@ -280,7 +294,7 @@ dispatchCommand(char *str)
 return i;
 }
 
-
+
 /*
  * File processing
  */
___
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: r215807 - stable/7/usr.sbin/sysinstall

2010-11-24 Thread Bruce Cran
Author: brucec
Date: Wed Nov 24 21:58:15 2010
New Revision: 215807
URL: http://svn.freebsd.org/changeset/base/215807

Log:
  MFC r215637:
  
  dispatch_add_command:
  Modify the logic so there's only one exit point instead of two.
  Only insert valid (non-NULL) values into the queue.
  
  dispatch_free_command:
  Ensure that item is not NULL before removing it from the queue and
  dereferencing the pointer.
  NULL out free'd pointers to catch any use-after-free bugs.
  
  PR:   bin/146855
  Submitted by: gcooper

Modified:
  stable/7/usr.sbin/sysinstall/dispatch.c
Directory Properties:
  stable/7/usr.sbin/sysinstall/   (props changed)

Modified: stable/7/usr.sbin/sysinstall/dispatch.c
==
--- stable/7/usr.sbin/sysinstall/dispatch.c Wed Nov 24 21:57:45 2010
(r215806)
+++ stable/7/usr.sbin/sysinstall/dispatch.c Wed Nov 24 21:58:15 2010
(r215807)
@@ -135,8 +135,12 @@ typedef struct command_buffer_ {
 static void
 dispatch_free_command(command_buffer *item)
 {
-REMQUE(item);
-free(item-string);
+if (item != NULL) {
+   REMQUE(item);
+   free(item-string);
+   item-string = NULL;
+}
+
 free(item);
 }
 
@@ -154,19 +158,29 @@ dispatch_free_all(qelement *head)
 static command_buffer *
 dispatch_add_command(qelement *head, char *string)
 {
-command_buffer *new;
+command_buffer *new = NULL;
 
 new = malloc(sizeof(command_buffer));
 
-if (!new)
-   return NULL;
+if (new != NULL) {
 
-new-string = strdup(string);
-INSQUEUE(new, head-q_back);
+   new-string = strdup(string);
+
+   /*
+* We failed to copy `string'; clean up the allocated
+* resources.
+*/
+   if (new-string == NULL) {
+   free(new);
+   new = NULL;
+   } else {
+   INSQUEUE(new, head-q_back);
+   }
+}
 
 return new;
 }
-
+
 /*
  * Command processing
  */
@@ -278,7 +292,7 @@ dispatchCommand(char *str)
 return i;
 }
 
-
+
 /*
  * File processing
  */
___
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: r215808 - head/sys/dev/e1000

2010-11-24 Thread Jack F Vogel
Author: jfv
Date: Wed Nov 24 22:24:07 2010
New Revision: 215808
URL: http://svn.freebsd.org/changeset/base/215808

Log:
  The purpose of this change is to add a routine to
  disable ASPM L0S and L1 LINK states on 82573, 82574,
  and 82583. The theory is that this is behind certain
  hangs being experienced by some customers.
  
  Also included a small optimization in the rxeof routine
  that was in my internal code.
  
  Change the PBA size for pchlan, it was incorrect.
  
  MFC after: 3 days

Modified:
  head/sys/dev/e1000/if_em.c

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Wed Nov 24 21:58:15 2010(r215807)
+++ head/sys/dev/e1000/if_em.c  Wed Nov 24 22:24:07 2010(r215808)
@@ -93,7 +93,7 @@ int   em_display_debug_stats = 0;
 /*
  *  Driver version:
  */
-char em_driver_version[] = 7.1.7;
+char em_driver_version[] = 7.1.8;
 
 /*
  *  PCI Device ID Table
@@ -272,6 +272,7 @@ static void em_get_wakeup(device_t);
 static void em_enable_wakeup(device_t);
 static int em_enable_phy_wakeup(struct adapter *);
 static voidem_led_func(void *, int);
+static voidem_disable_aspm(struct adapter *);
 
 static int em_irq_fast(void *);
 
@@ -1229,9 +1230,9 @@ em_init_locked(struct adapter *adapter)
break;
case e1000_ich9lan:
case e1000_ich10lan:
-   case e1000_pchlan:
pba = E1000_PBA_10K;
break;
+   case e1000_pchlan:
case e1000_pch2lan:
pba = E1000_PBA_26K;
break;
@@ -2762,6 +2763,7 @@ em_reset(struct adapter *adapter)
/* Issue a global reset */
e1000_reset_hw(hw);
E1000_WRITE_REG(hw, E1000_WUC, 0);
+   em_disable_aspm(adapter);
 
if (e1000_init_hw(hw)  0) {
device_printf(dev, Hardware Initialization Failed\n);
@@ -4205,68 +4207,66 @@ em_rxeof(struct rx_ring *rxr, int count,
 
len = le16toh(cur-length);
eop = (status  E1000_RXD_STAT_EOP) != 0;
-   count--;
 
-   if (((cur-errors  E1000_RXD_ERR_FRAME_ERR_MASK) == 0) 
-   (rxr-discard == FALSE)) {
+   if ((rxr-discard == TRUE) || (cur-errors 
+   E1000_RXD_ERR_FRAME_ERR_MASK)) {
+   ifp-if_ierrors++;
+   ++rxr-rx_discarded;
+   if (!eop) /* Catch subsequent segs */
+   rxr-discard = TRUE;
+   else
+   rxr-discard = FALSE;
+   em_rx_discard(rxr, i);
+   goto next_desc;
+   }
 
-   /* Assign correct length to the current fragment */
-   mp = rxr-rx_buffers[i].m_head;
-   mp-m_len = len;
-
-   /* Trigger for refresh */
-   rxr-rx_buffers[i].m_head = NULL;
-
-   if (rxr-fmp == NULL) {
-   mp-m_pkthdr.len = len;
-   rxr-fmp = mp; /* Store the first mbuf */
-   rxr-lmp = mp;
-   } else {
-   /* Chain mbuf's together */
-   mp-m_flags = ~M_PKTHDR;
-   rxr-lmp-m_next = mp;
-   rxr-lmp = rxr-lmp-m_next;
-   rxr-fmp-m_pkthdr.len += len;
-   }
+   /* Assign correct length to the current fragment */
+   mp = rxr-rx_buffers[i].m_head;
+   mp-m_len = len;
 
-   if (eop) {
-   rxr-fmp-m_pkthdr.rcvif = ifp;
-   ifp-if_ipackets++;
-   em_receive_checksum(cur, rxr-fmp);
+   /* Trigger for refresh */
+   rxr-rx_buffers[i].m_head = NULL;
+
+   /* First segment? */
+   if (rxr-fmp == NULL) {
+   mp-m_pkthdr.len = len;
+   rxr-fmp = rxr-lmp = mp;
+   } else {
+   /* Chain mbuf's together */
+   mp-m_flags = ~M_PKTHDR;
+   rxr-lmp-m_next = mp;
+   rxr-lmp = mp;
+   rxr-fmp-m_pkthdr.len += len;
+   }
+
+   if (eop) {
+   --count;
+   sendmp = rxr-fmp;
+   sendmp-m_pkthdr.rcvif = ifp;
+   ifp-if_ipackets++;
+   em_receive_checksum(cur, sendmp);
 #ifndef __NO_STRICT_ALIGNMENT
-   

svn commit: r215809 - stable/8/usr.bin/ldd

2010-11-24 Thread David E. O'Brien
Author: obrien
Date: Wed Nov 24 22:44:10 2010
New Revision: 215809
URL: http://svn.freebsd.org/changeset/base/215809

Log:
  MFC: r215705: hdr.elf.e_ident[EI_OSABI] is not a bitmask

Modified:
  stable/8/usr.bin/ldd/ldd.c
Directory Properties:
  stable/8/usr.bin/ldd/   (props changed)

Modified: stable/8/usr.bin/ldd/ldd.c
==
--- stable/8/usr.bin/ldd/ldd.c  Wed Nov 24 22:24:07 2010(r215808)
+++ stable/8/usr.bin/ldd/ldd.c  Wed Nov 24 22:44:10 2010(r215809)
@@ -331,7 +331,7 @@ is_executable(const char *fname, int fd,
return (0);
}
if (hdr.elf32.e_type == ET_DYN) {
-   if (hdr.elf32.e_ident[EI_OSABI]  ELFOSABI_FREEBSD) {
+   if (hdr.elf32.e_ident[EI_OSABI] == ELFOSABI_FREEBSD) {
*is_shlib = 1;
return (1);
}
@@ -373,7 +373,7 @@ is_executable(const char *fname, int fd,
return (0);
}
if (hdr.elf.e_type == ET_DYN) {
-   if (hdr.elf.e_ident[EI_OSABI]  ELFOSABI_FREEBSD) {
+   if (hdr.elf.e_ident[EI_OSABI] == ELFOSABI_FREEBSD) {
*is_shlib = 1;
return (1);
}
___
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: r215810 - head/sys/dev/usb

2010-11-24 Thread Weongyo Jeong
Author: weongyo
Date: Thu Nov 25 03:02:53 2010
New Revision: 215810
URL: http://svn.freebsd.org/changeset/base/215810

Log:
  Assigning the unit number for each interfaces could not use ubus-parent
  because it could differ depending on the host controller type.  It could
  lead the duplicate unit number assignment.

Modified:
  head/sys/dev/usb/usb_pf.c

Modified: head/sys/dev/usb/usb_pf.c
==
--- head/sys/dev/usb/usb_pf.c   Wed Nov 24 22:44:10 2010(r215809)
+++ head/sys/dev/usb/usb_pf.c   Thu Nov 25 03:02:53 2010(r215810)
@@ -61,9 +61,10 @@ void
 usbpf_attach(struct usb_bus *ubus)
 {
struct ifnet *ifp;
+   devclass_t dc = devclass_find(usbus);
 
ifp = ubus-ifp = if_alloc(IFT_USB);
-   if_initname(ifp, usbus, device_get_unit(ubus-parent));
+   if_initname(ifp, usbus, devclass_get_count(dc));
if_attach(ifp);
 
KASSERT(sizeof(struct usbpf_pkthdr) == USBPF_HDR_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


svn commit: r215812 - in head/sys/dev/usb: . controller

2010-11-24 Thread Weongyo Jeong
Author: weongyo
Date: Thu Nov 25 03:30:43 2010
New Revision: 215812
URL: http://svn.freebsd.org/changeset/base/215812

Log:
  Handles the unit number correctly that the previous commit had a problem
  (wrong unit number for a host controller) when the module is load /
  unloaded repeatly.  Attaching the USB pf is moved to usbus device's
  attach.
  
  Pointed by:   yongari

Modified:
  head/sys/dev/usb/controller/usb_controller.c
  head/sys/dev/usb/usb_pf.c

Modified: head/sys/dev/usb/controller/usb_controller.c
==
--- head/sys/dev/usb/controller/usb_controller.cThu Nov 25 03:16:31 
2010(r215811)
+++ head/sys/dev/usb/controller/usb_controller.cThu Nov 25 03:30:43 
2010(r215812)
@@ -207,6 +207,8 @@ usb_detach(device_t dev)
 
usb_proc_free(bus-control_xfer_proc);
 
+   usbpf_detach(bus);
+
return (0);
 }
 
@@ -435,6 +437,8 @@ usb_attach_sub(device_t dev, struct usb_
usb_devclass_ptr = devclass_find(usbus);
mtx_unlock(Giant);
 
+   usbpf_attach(bus);
+
/* Initialise USB process messages */
bus-explore_msg[0].hdr.pm_callback = usb_bus_explore;
bus-explore_msg[0].bus = bus;
@@ -548,8 +552,6 @@ usb_bus_mem_alloc_all(struct usb_bus *bu
 
TAILQ_INIT(bus-intr_q.head);
 
-   usbpf_attach(bus);
-
 #if USB_HAVE_BUSDMA
usb_dma_tag_setup(bus-dma_parent_tag, bus-dma_tags,
dmat, bus-bus_mtx, NULL, 32, USB_BUS_DMA_TAG_MAX);
@@ -597,8 +599,6 @@ usb_bus_mem_free_all(struct usb_bus *bus
usb_dma_tag_unsetup(bus-dma_parent_tag);
 #endif
 
-   usbpf_detach(bus);
-
mtx_destroy(bus-bus_mtx);
 }
 

Modified: head/sys/dev/usb/usb_pf.c
==
--- head/sys/dev/usb/usb_pf.c   Thu Nov 25 03:16:31 2010(r215811)
+++ head/sys/dev/usb/usb_pf.c   Thu Nov 25 03:30:43 2010(r215812)
@@ -61,10 +61,9 @@ void
 usbpf_attach(struct usb_bus *ubus)
 {
struct ifnet *ifp;
-   devclass_t dc = devclass_find(usbus);
 
ifp = ubus-ifp = if_alloc(IFT_USB);
-   if_initname(ifp, usbus, devclass_get_count(dc));
+   if_initname(ifp, usbus, device_get_unit(ubus-bdev));
if_attach(ifp);
 
KASSERT(sizeof(struct usbpf_pkthdr) == USBPF_HDR_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


svn commit: r215813 - head/sys/i386/xen

2010-11-24 Thread Colin Percival
Author: cperciva
Date: Thu Nov 25 04:45:31 2010
New Revision: 215813
URL: http://svn.freebsd.org/changeset/base/215813

Log:
  Remove vestigal debugging code which, in fork-heavy workloads, can cause
  a 30x slowdown.

Modified:
  head/sys/i386/xen/xen_machdep.c

Modified: head/sys/i386/xen/xen_machdep.c
==
--- head/sys/i386/xen/xen_machdep.c Thu Nov 25 03:30:43 2010
(r215812)
+++ head/sys/i386/xen/xen_machdep.c Thu Nov 25 04:45:31 2010
(r215813)
@@ -482,7 +482,6 @@ xen_pt_pin(vm_paddr_t ma)
struct mmuext_op op;
op.cmd = MMUEXT_PIN_L1_TABLE;
op.arg1.mfn = ma  PAGE_SHIFT;
-   printk(xen_pt_pin(): mfn=%x\n, op.arg1.mfn);
xen_flush_queue();
PANIC_IF(HYPERVISOR_mmuext_op(op, 1, NULL, DOMID_SELF)  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


Re: svn commit: r215811 - head/sys/boot/common

2010-11-24 Thread Bruce Evans

On Thu, 25 Nov 2010, Ed Maste wrote:


Log:
 Give a bit of a hint of the failure (read != expected) but don't make
 the error message needlessly more verbose.

 Discussed with: attilio


Any chance of not making the source code needlessly verbose and full of
style and type bugs?


Modified: head/sys/boot/common/load_elf.c
==
--- head/sys/boot/common/load_elf.c Thu Nov 25 03:02:53 2010
(r215810)
+++ head/sys/boot/common/load_elf.c Thu Nov 25 03:16:31 2010
(r215811)
@@ -453,7 +453,7 @@ __elfN(loadimage)(struct preloaded_file
}
result = archsw.arch_readin(ef-fd, lastaddr, shdr[i].sh_size);
if (result  0 || (size_t)result != shdr[i].sh_size) {
-   printf(\nelf __XSTRING(__ELF_WORD_SIZE) _loadimage: could not read 
symbols - skipped! (%ju - %ju), (uintmax_t)result,
+   printf(\nelf __XSTRING(__ELF_WORD_SIZE) _loadimage: could not read 
symbols - skipped! (%ju != %ju), (uintmax_t)result,
(uintmax_t)shdr[i].sh_size);
lastaddr = ssym;
ssym = 0;


This code is obviously not concerned about space or time optimizations,
else it wouldn't use uintmax_t, but it uses __XSTRING(__ELF_WORD_SIZE)
to convert an integer to a string at compile time.  This makes it more
verbose and helps give it a style bug (a too-long line).  Recent commits
expanded the style bug by lengthening the line to print another arg,
despite the careful line splitting for the other arg.

The cast to size_t at the start of this code is bogus.  It assumes that the
type of sh_size is no smaller than that of size_t, but if you assume that
then you can assume it in the printf too and cast everything to size_t (*).
This assumption may be valid, but elf itself uses careful type definitions
(not involving size_t) to avoid such assumptions.  Assuming this in the
diagnostic printf is less risky than assuming it in the error checking.

(*) Casting `result' to either uintmax_t or size_t in the printf is wrong,
since `result' is a signed type and one of the error cases reported by
this diagnostic is when result  0.  `result' actually has type ssize_t,
and it can be -1 after a read error.  ssize_t is somewhat inconsistent
with typeof(sh_size), but good enough.  Variables of type ssize_t should
by printed using %zd and not mispromoted to uintmax_t for printing with
%ju.  I think this code uses libstand printf, which supports %zd.

These and other fixes fixes give something like:

if (result  0 || (Elf_mumble))result != shdr[i].sh_size) {
printf(
\nelf%d_loadimage: could not read symbols (%zd != %ju) -- skipped,
__ELF_WORD_SIZE, result, (uintmax_t)shdr[i].sh_size);

other fixes:
- I couldn't find anything good for Elf_mumble.  Elf declarations seem
  to actively inhibit declaring the types of things in a size-independent
  way.  sh_size is declared as type Elf32_Word or ELf64_Xword.
- the strange leading newline with no trailing newline is preserved
- the string is still long so it needs outdenting to fit
- rephrase message to put the error info before the action.
- fix rendering of the dash symbol
- remove shouting (!).  More rephrasing or different termination may be
  needed if the string is expanded, as encouraged by its not having a
  trailing newline.

Bruce
___
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: r215814 - in stable/8: . contrib/bsnmp/snmpd contrib/top contrib/xz etc/periodic/daily gnu/usr.bin lib/libusb libexec/rtld-aout release/picobsd/floppy.tree/sbin sbin/geom/class/sched sb...

2010-11-24 Thread David E. O'Brien
Author: obrien
Date: Thu Nov 25 07:02:36 2010
New Revision: 215814
URL: http://svn.freebsd.org/changeset/base/215814

Log:
  MFC: r201217: ANSIfy ldconfig and the aout bits it still uses from rtld-aout

Modified:
  stable/8/libexec/rtld-aout/shlib.c
  stable/8/libexec/rtld-aout/support.c
  stable/8/sbin/ldconfig/ldconfig.c
Directory Properties:
  stable/8/   (props changed)
  stable/8/Makefile   (props changed)
  stable/8/Makefile.inc1   (props changed)
  stable/8/ObsoleteFiles.inc   (props changed)
  stable/8/UPDATING   (props changed)
  stable/8/bin/   (props changed)
  stable/8/bin/chio/   (props changed)
  stable/8/bin/chmod/   (props changed)
  stable/8/bin/cp/   (props changed)
  stable/8/bin/csh/   (props changed)
  stable/8/bin/date/   (props changed)
  stable/8/bin/echo/   (props changed)
  stable/8/bin/expr/   (props changed)
  stable/8/bin/getfacl/   (props changed)
  stable/8/bin/kill/   (props changed)
  stable/8/bin/ln/   (props changed)
  stable/8/bin/ls/   (props changed)
  stable/8/bin/mv/   (props changed)
  stable/8/bin/pax/   (props changed)
  stable/8/bin/pkill/   (props changed)
  stable/8/bin/ps/   (props changed)
  stable/8/bin/pwait/   (props changed)
  stable/8/bin/setfacl/   (props changed)
  stable/8/bin/sh/   (props changed)
  stable/8/bin/sleep/   (props changed)
  stable/8/bin/test/   (props changed)
  stable/8/cddl/compat/opensolaris/   (props changed)
  stable/8/cddl/contrib/opensolaris/   (props changed)
  stable/8/cddl/lib/   (props changed)
  stable/8/cddl/lib/libnvpair/   (props changed)
  stable/8/cddl/lib/libzpool/   (props changed)
  stable/8/cddl/usr.bin/   (props changed)
  stable/8/cddl/usr.sbin/   (props changed)
  stable/8/contrib/   (props changed)
  stable/8/contrib/bind9/   (props changed)
  stable/8/contrib/binutils/   (props changed)
  stable/8/contrib/bsnmp/   (props changed)
  stable/8/contrib/bsnmp/snmpd/bsnmpd.1   (props changed)
  stable/8/contrib/bzip2/   (props changed)
  stable/8/contrib/com_err/   (props changed)
  stable/8/contrib/csup/   (props changed)
  stable/8/contrib/ee/   (props changed)
  stable/8/contrib/expat/   (props changed)
  stable/8/contrib/file/   (props changed)
  stable/8/contrib/gcc/   (props changed)
  stable/8/contrib/gdb/   (props changed)
  stable/8/contrib/gdtoa/   (props changed)
  stable/8/contrib/ipfilter/   (props changed)
  stable/8/contrib/libpcap/   (props changed)
  stable/8/contrib/ncurses/   (props changed)
  stable/8/contrib/ntp/   (props changed)
  stable/8/contrib/nvi/   (props changed)
  stable/8/contrib/openbsm/   (props changed)
  stable/8/contrib/openpam/   (props changed)
  stable/8/contrib/pf/   (props changed)
  stable/8/contrib/sendmail/   (props changed)
  stable/8/contrib/tcp_wrappers/   (props changed)
  stable/8/contrib/tcpdump/   (props changed)
  stable/8/contrib/tcsh/   (props changed)
  stable/8/contrib/telnet/   (props changed)
  stable/8/contrib/top/   (props changed)
  stable/8/contrib/top/install-sh   (props changed)
  stable/8/contrib/traceroute/   (props changed)
  stable/8/contrib/wpa/   (props changed)
  stable/8/contrib/xz/   (props changed)
  stable/8/contrib/xz/AUTHORS   (props changed)
  stable/8/contrib/xz/COPYING   (props changed)
  stable/8/contrib/xz/ChangeLog   (props changed)
  stable/8/contrib/xz/FREEBSD-Xlist   (props changed)
  stable/8/contrib/xz/FREEBSD-upgrade   (props changed)
  stable/8/contrib/xz/README   (props changed)
  stable/8/contrib/xz/THANKS   (props changed)
  stable/8/contrib/xz/TODO   (props changed)
  stable/8/contrib/xz/po/   (props changed)
  stable/8/contrib/xz/src/   (props changed)
  stable/8/crypto/heimdal/   (props changed)
  stable/8/etc/   (props changed)
  stable/8/etc/periodic/daily/   (props changed)
  stable/8/etc/periodic/daily/800.scrub-zfs   (props changed)
  stable/8/etc/periodic/security/   (props changed)
  stable/8/games/factor/   (props changed)
  stable/8/games/fortune/   (props changed)
  stable/8/games/grdc/   (props changed)
  stable/8/games/pom/   (props changed)
  stable/8/gnu/lib/csu/   (props changed)
  stable/8/gnu/lib/libstdc++/   (props changed)
  stable/8/gnu/usr.bin/   (props changed)
  stable/8/gnu/usr.bin/Makefile   (props changed)
  stable/8/gnu/usr.bin/dialog/   (props changed)
  stable/8/gnu/usr.bin/gdb/   (props changed)
  stable/8/gnu/usr.bin/gdb/kgdb/   (props changed)
  stable/8/gnu/usr.bin/patch/   (props changed)
  stable/8/include/   (props changed)
  stable/8/kerberos5/lib/libgssapi_krb5/   (props changed)
  stable/8/kerberos5/lib/libgssapi_spnego/   (props changed)
  stable/8/kerberos5/usr.bin/kdestroy/   (props changed)
  stable/8/kerberos5/usr.bin/kpasswd/   (props changed)
  stable/8/lib/   (props changed)
  stable/8/lib/bind/   (props changed)
  stable/8/lib/csu/   (props changed)
  stable/8/lib/libarchive/   (props changed)
  stable/8/lib/libbluetooth/   (props changed)
  stable/8/lib/libc/   (props changed)
  stable/8/lib/libc/locale/   (props changed)
  stable/8/lib/libc/stdtime/   (props changed)