Re: Typo "st_mtim" in stat manpage.
On Tue, Jul 10, 2012 at 1:51 PM, Matthew Dempsky wrote: > On Tue, Jul 10, 2012 at 11:49 AM, Han Boetes wrote: >> I found this mistake in the stat manpage: > > Not a mistake; see /usr/include/sys/stat.h. ...or just keep reading further on the manpage and think about the types... Philip Guenther
Re: tedu sched_peg_curproc()
On 10 July 2012 22:32, Mark Kettenis wrote: >> Date: Tue, 10 Jul 2012 21:44:06 +0200 >> From: "Christiano F. Haesbaert" >> >> This isn't used, the idle thread just sets the PEG flag and goes on. > > Please don't; I have some stuff that *will* use this. > Okayz :) >> Index: kern/kern_sched.c >> === >> RCS file: /cvs/src/sys/kern/kern_sched.c,v >> retrieving revision 1.27 >> diff -d -u -p -r1.27 kern_sched.c >> --- kern/kern_sched.c 10 Jul 2012 18:20:37 - 1.27 >> +++ kern/kern_sched.c 10 Jul 2012 19:41:55 - >> @@ -545,26 +545,6 @@ sched_proc_to_cpu_cost(struct cpu_info * >> return (cost); >> } >> >> -/* >> - * Peg a proc to a cpu. >> - */ >> -void >> -sched_peg_curproc(struct cpu_info *ci) >> -{ >> - struct proc *p = curproc; >> - int s; >> - >> - SCHED_LOCK(s); >> - p->p_priority = p->p_usrpri; >> - p->p_stat = SRUN; >> - p->p_cpu = ci; >> - atomic_setbits_int(&p->p_flag, P_CPUPEG); >> - setrunqueue(p); >> - p->p_ru.ru_nvcsw++; >> - mi_switch(); >> - SCHED_UNLOCK(s); >> -} >> - >> #ifdef MULTIPROCESSOR >> >> void >> Index: sys/sched.h >> === >> RCS file: /cvs/src/sys/sys/sched.h,v >> retrieving revision 1.30 >> diff -d -u -p -r1.30 sched.h >> --- sys/sched.h 16 Nov 2011 20:50:19 - 1.30 >> +++ sys/sched.h 10 Jul 2012 19:42:05 - >> @@ -151,7 +151,6 @@ struct cpu_info *sched_choosecpu_fork(st >> void cpu_idle_enter(void); >> void cpu_idle_cycle(void); >> void cpu_idle_leave(void); >> -void sched_peg_curproc(struct cpu_info *ci); >> >> #ifdef MULTIPROCESSOR >> void sched_start_secondary_cpus(void);
Re: Typo "st_mtim" in stat manpage.
On Tue, Jul 10, 2012 at 11:49 AM, Han Boetes wrote: > I found this mistake in the stat manpage: Not a mistake; see /usr/include/sys/stat.h.
Re: tedu sched_peg_curproc()
> Date: Tue, 10 Jul 2012 21:44:06 +0200 > From: "Christiano F. Haesbaert" > > This isn't used, the idle thread just sets the PEG flag and goes on. Please don't; I have some stuff that *will* use this. > Index: kern/kern_sched.c > === > RCS file: /cvs/src/sys/kern/kern_sched.c,v > retrieving revision 1.27 > diff -d -u -p -r1.27 kern_sched.c > --- kern/kern_sched.c 10 Jul 2012 18:20:37 - 1.27 > +++ kern/kern_sched.c 10 Jul 2012 19:41:55 - > @@ -545,26 +545,6 @@ sched_proc_to_cpu_cost(struct cpu_info * > return (cost); > } > > -/* > - * Peg a proc to a cpu. > - */ > -void > -sched_peg_curproc(struct cpu_info *ci) > -{ > - struct proc *p = curproc; > - int s; > - > - SCHED_LOCK(s); > - p->p_priority = p->p_usrpri; > - p->p_stat = SRUN; > - p->p_cpu = ci; > - atomic_setbits_int(&p->p_flag, P_CPUPEG); > - setrunqueue(p); > - p->p_ru.ru_nvcsw++; > - mi_switch(); > - SCHED_UNLOCK(s); > -} > - > #ifdef MULTIPROCESSOR > > void > Index: sys/sched.h > === > RCS file: /cvs/src/sys/sys/sched.h,v > retrieving revision 1.30 > diff -d -u -p -r1.30 sched.h > --- sys/sched.h 16 Nov 2011 20:50:19 - 1.30 > +++ sys/sched.h 10 Jul 2012 19:42:05 - > @@ -151,7 +151,6 @@ struct cpu_info *sched_choosecpu_fork(st > void cpu_idle_enter(void); > void cpu_idle_cycle(void); > void cpu_idle_leave(void); > -void sched_peg_curproc(struct cpu_info *ci); > > #ifdef MULTIPROCESSOR > void sched_start_secondary_cpus(void);
Re: fix for ClickPad
For what it's worth, this fixes the issue on my laptop. I still can't highlight a portion of a line, but at least I can copy / paste a word now \o/ Thanks a *LOT* as it was plenty annoying Gilles On Wed, Jul 11, 2012 at 12:53:00AM +0600, Alexandr Shadchin wrote: > Now in clickpad mode the pointer moves to [1,1] (upper left corner) > even on a single tap. These patches fixes it. > > On issue pointed gilles@ and matthieu@ > > * cd /sys > * patch < 01_kernel.diff > * build and install new kernel > * cd /usr/src > * (if need - make obj) > * make includes > * cd /usr/xenocara/driver/xf86-input-synaptics > * patch < 02_xenocara.diff > * make -f Makefile.bsd-wrapper obj build > * reboot and test > > Also need check on other touchpad. > > Comments ? OK ? > > -- > Alexandr Shadchin > Index: dev/pckbc/pms.c > === > RCS file: /cvs/src/sys/dev/pckbc/pms.c,v > retrieving revision 1.30 > diff -u -p -r1.30 pms.c > --- dev/pckbc/pms.c 1 Jul 2012 12:59:34 - 1.30 > +++ dev/pckbc/pms.c 10 Jul 2012 18:17:14 - > @@ -782,6 +782,9 @@ int > synaptics_get_hwinfo(struct pms_softc *sc) > { > struct synaptics_softc *syn = sc->synaptics; > +#ifdef DEBUG > + int i, val; > +#endif > > if (synaptics_query(sc, SYNAPTICS_QUE_IDENTIFY, &syn->identify)) > return (-1); > @@ -817,6 +820,15 @@ synaptics_get_hwinfo(struct pms_softc *s > if (SYNAPTICS_EXT_MODEL_BUTTONS(syn->ext_model) > 8) > syn->ext_model &= ~0xf000; > > +#ifdef DEBUG > + for (i = 0; i < 16; i++) { > + if (synaptics_query(sc, i, &val)) > + printf("%s: querie %2d: fail\n", DEVNAME(sc), i); > + else > + printf("%s: querie %2d: 0x%06x\n", DEVNAME(sc), i, val); > + } > +#endif > + > return (0); > } > > @@ -1026,7 +1038,8 @@ pms_proc_synaptics(struct pms_softc *sc) > if (syn->wsmode == WSMOUSE_NATIVE) { > wsmouse_input(sc->sc_wsmousedev, buttons, x, y, z, w, > WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y | > - WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W); > + WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W | > + WSMOUSE_INPUT_SYNC); > } else { > dx = dy = 0; > if (z > SYNAPTICS_PRESSURE) { > @@ -1335,7 +1348,8 @@ pms_proc_alps(struct pms_softc *sc) > > wsmouse_input(sc->sc_wsmousedev, buttons, x, y, z, w, > WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y | > - WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W); > + WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W | > + WSMOUSE_INPUT_SYNC); > > alps->old_fin = fin; > } else { > Index: dev/wscons/wsconsio.h > === > RCS file: /cvs/src/sys/dev/wscons/wsconsio.h,v > retrieving revision 1.65 > diff -u -p -r1.65 wsconsio.h > --- dev/wscons/wsconsio.h 17 Apr 2012 08:51:24 - 1.65 > +++ dev/wscons/wsconsio.h 10 Jul 2012 18:17:14 - > @@ -80,6 +80,7 @@ struct wscons_event { >/* 12-15, see below */ > #define WSCONS_EVENT_MOUSE_DELTA_W 16 /* W delta amount */ > #define WSCONS_EVENT_MOUSE_ABSOLUTE_W 17 /* W location */ > +#define WSCONS_EVENT_SYNC 18 > /* > * Following events are not real wscons_event but are used as parameters of > the > * WSDISPLAYIO_WSMOUSED ioctl > Index: dev/wscons/wsmouse.c > === > RCS file: /cvs/src/sys/dev/wscons/wsmouse.c,v > retrieving revision 1.22 > diff -u -p -r1.22 wsmouse.c > --- dev/wscons/wsmouse.c 17 Aug 2011 16:10:27 - 1.22 > +++ dev/wscons/wsmouse.c 10 Jul 2012 18:17:14 - > @@ -455,6 +455,14 @@ wsmouse_input(struct device *wsmousedev, > ub ^= d; > } > > + if (flags & WSMOUSE_INPUT_SYNC) { > + NEXT; > + ev->type = WSCONS_EVENT_SYNC; > + ev->value = 0; > + TIMESTAMP; > + ADVANCE; > + } > + > /* XXX fake wscons_event notifying wsmoused(8) to close mouse device */ > if (flags & WSMOUSE_INPUT_WSMOUSED_CLOSE) { > NEXT; > Index: dev/wscons/wsmousevar.h > === > RCS file: /cvs/src/sys/dev/wscons/wsmousevar.h,v > retrieving revision 1.5 > diff -u -p -r1.5 wsmousevar.h > --- dev/wscons/wsmousevar.h 10 Apr 2007 22:37:17 - 1.5 > +++ dev/wscons/wsmousevar.h 10 Jul 2012 18:17:14 - > @@ -72,6 +72,7 @@ int wsmousedevprint(void *, const char * > #define WSMOUSE_INPUT_ABSOLUTE_Y (1<<1) > #define WSMOUSE_INPUT_ABSOLUTE_Z (1<<2) > #define WSMOUSE_INPUT_ABSOLUTE_W (1<<4) > +#define WSMOUSE_INPUT
Typo "st_mtim" in stat manpage.
I found this mistake in the stat manpage: Index: sys/stat.2 === RCS file: /cvs/src/lib/libc/sys/stat.2,v retrieving revision 1.31 diff -u -p -r1.31 stat.2 --- sys/stat.2 17 Nov 2011 14:26:14 - 1.31 +++ sys/stat.2 10 Jul 2012 18:45:20 - @@ -149,9 +149,9 @@ struct stat { uid_t st_uid;/* user ID of the file's owner */ gid_t st_gid;/* group ID of the file's group */ dev_t st_rdev; /* device type */ -struct timespec st_atim; /* time of last access */ -struct timespec st_mtim; /* time of last data modification */ -struct timespec st_ctim; /* time of last file status change */ +struct timespec st_atime; /* time of last access */ +struct timespec st_mtime; /* time of last data modification */ +struct timespec st_ctime; /* time of last file status change */ off_t st_size; /* file size, in bytes */ int64_tst_blocks; /* blocks allocated for file */ u_int32_t st_blksize;/* optimal blocksize for I/O */ # Han
tedu sched_peg_curproc()
This isn't used, the idle thread just sets the PEG flag and goes on. Index: kern/kern_sched.c === RCS file: /cvs/src/sys/kern/kern_sched.c,v retrieving revision 1.27 diff -d -u -p -r1.27 kern_sched.c --- kern/kern_sched.c 10 Jul 2012 18:20:37 - 1.27 +++ kern/kern_sched.c 10 Jul 2012 19:41:55 - @@ -545,26 +545,6 @@ sched_proc_to_cpu_cost(struct cpu_info * return (cost); } -/* - * Peg a proc to a cpu. - */ -void -sched_peg_curproc(struct cpu_info *ci) -{ - struct proc *p = curproc; - int s; - - SCHED_LOCK(s); - p->p_priority = p->p_usrpri; - p->p_stat = SRUN; - p->p_cpu = ci; - atomic_setbits_int(&p->p_flag, P_CPUPEG); - setrunqueue(p); - p->p_ru.ru_nvcsw++; - mi_switch(); - SCHED_UNLOCK(s); -} - #ifdef MULTIPROCESSOR void Index: sys/sched.h === RCS file: /cvs/src/sys/sys/sched.h,v retrieving revision 1.30 diff -d -u -p -r1.30 sched.h --- sys/sched.h 16 Nov 2011 20:50:19 - 1.30 +++ sys/sched.h 10 Jul 2012 19:42:05 - @@ -151,7 +151,6 @@ struct cpu_info *sched_choosecpu_fork(st void cpu_idle_enter(void); void cpu_idle_cycle(void); void cpu_idle_leave(void); -void sched_peg_curproc(struct cpu_info *ci); #ifdef MULTIPROCESSOR void sched_start_secondary_cpus(void);
fix for ClickPad
Now in clickpad mode the pointer moves to [1,1] (upper left corner) even on a single tap. These patches fixes it. On issue pointed gilles@ and matthieu@ * cd /sys * patch < 01_kernel.diff * build and install new kernel * cd /usr/src * (if need - make obj) * make includes * cd /usr/xenocara/driver/xf86-input-synaptics * patch < 02_xenocara.diff * make -f Makefile.bsd-wrapper obj build * reboot and test Also need check on other touchpad. Comments ? OK ? -- Alexandr Shadchin Index: dev/pckbc/pms.c === RCS file: /cvs/src/sys/dev/pckbc/pms.c,v retrieving revision 1.30 diff -u -p -r1.30 pms.c --- dev/pckbc/pms.c 1 Jul 2012 12:59:34 - 1.30 +++ dev/pckbc/pms.c 10 Jul 2012 18:17:14 - @@ -782,6 +782,9 @@ int synaptics_get_hwinfo(struct pms_softc *sc) { struct synaptics_softc *syn = sc->synaptics; +#ifdef DEBUG + int i, val; +#endif if (synaptics_query(sc, SYNAPTICS_QUE_IDENTIFY, &syn->identify)) return (-1); @@ -817,6 +820,15 @@ synaptics_get_hwinfo(struct pms_softc *s if (SYNAPTICS_EXT_MODEL_BUTTONS(syn->ext_model) > 8) syn->ext_model &= ~0xf000; +#ifdef DEBUG + for (i = 0; i < 16; i++) { + if (synaptics_query(sc, i, &val)) + printf("%s: querie %2d: fail\n", DEVNAME(sc), i); + else + printf("%s: querie %2d: 0x%06x\n", DEVNAME(sc), i, val); + } +#endif + return (0); } @@ -1026,7 +1038,8 @@ pms_proc_synaptics(struct pms_softc *sc) if (syn->wsmode == WSMOUSE_NATIVE) { wsmouse_input(sc->sc_wsmousedev, buttons, x, y, z, w, WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y | - WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W); + WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W | + WSMOUSE_INPUT_SYNC); } else { dx = dy = 0; if (z > SYNAPTICS_PRESSURE) { @@ -1335,7 +1348,8 @@ pms_proc_alps(struct pms_softc *sc) wsmouse_input(sc->sc_wsmousedev, buttons, x, y, z, w, WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y | - WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W); + WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W | + WSMOUSE_INPUT_SYNC); alps->old_fin = fin; } else { Index: dev/wscons/wsconsio.h === RCS file: /cvs/src/sys/dev/wscons/wsconsio.h,v retrieving revision 1.65 diff -u -p -r1.65 wsconsio.h --- dev/wscons/wsconsio.h 17 Apr 2012 08:51:24 - 1.65 +++ dev/wscons/wsconsio.h 10 Jul 2012 18:17:14 - @@ -80,6 +80,7 @@ struct wscons_event { /* 12-15, see below */ #defineWSCONS_EVENT_MOUSE_DELTA_W 16 /* W delta amount */ #defineWSCONS_EVENT_MOUSE_ABSOLUTE_W 17 /* W location */ +#defineWSCONS_EVENT_SYNC 18 /* * Following events are not real wscons_event but are used as parameters of the * WSDISPLAYIO_WSMOUSED ioctl Index: dev/wscons/wsmouse.c === RCS file: /cvs/src/sys/dev/wscons/wsmouse.c,v retrieving revision 1.22 diff -u -p -r1.22 wsmouse.c --- dev/wscons/wsmouse.c17 Aug 2011 16:10:27 - 1.22 +++ dev/wscons/wsmouse.c10 Jul 2012 18:17:14 - @@ -455,6 +455,14 @@ wsmouse_input(struct device *wsmousedev, ub ^= d; } + if (flags & WSMOUSE_INPUT_SYNC) { + NEXT; + ev->type = WSCONS_EVENT_SYNC; + ev->value = 0; + TIMESTAMP; + ADVANCE; + } + /* XXX fake wscons_event notifying wsmoused(8) to close mouse device */ if (flags & WSMOUSE_INPUT_WSMOUSED_CLOSE) { NEXT; Index: dev/wscons/wsmousevar.h === RCS file: /cvs/src/sys/dev/wscons/wsmousevar.h,v retrieving revision 1.5 diff -u -p -r1.5 wsmousevar.h --- dev/wscons/wsmousevar.h 10 Apr 2007 22:37:17 - 1.5 +++ dev/wscons/wsmousevar.h 10 Jul 2012 18:17:14 - @@ -72,6 +72,7 @@ int wsmousedevprint(void *, const char * #define WSMOUSE_INPUT_ABSOLUTE_Y (1<<1) #define WSMOUSE_INPUT_ABSOLUTE_Z (1<<2) #define WSMOUSE_INPUT_ABSOLUTE_W (1<<4) +#define WSMOUSE_INPUT_SYNC (1<<5) #define WSMOUSE_INPUT_WSMOUSED_CLOSE (1<<3) /* notify wsmoused(8) to close mouse device */ Index: src/wsconscomm.c === RCS file: /cvs/xenocara/driver/xf86-input-synaptics/src/wsconscomm.c,v retrieving revision 1.5 diff -u -p -r1.5 wsconscomm.c --- src/wsconscomm
rum and host ap mode
Hello, I'm resending this to tech list also. I have rum driver in host AP mode. Below patch makes it faster from 100 kB/s to 700 kB/s. "+++" part is copied from other place in the file. There could be better choice even. Index: sys/dev/usb/if_rum.c === RCS file: /cvs/src/sys/dev/usb/if_rum.c,v retrieving revision 1.97 diff -u -r1.97 if_rum.c --- sys/dev/usb/if_rum.c25 Jan 2011 20:03:35 - 1.97 +++ sys/dev/usb/if_rum.c10 Jul 2012 10:00:14 - @@ -2221,8 +2221,13 @@ void rum_newassoc(struct ieee80211com *ic, struct ieee80211_node *ni, int isnew) { - /* start with lowest Tx rate */ - ni->ni_txrate = 0; + int i; + + /* set rate to some reasonable initial value */ + for (i = ni->ni_rates.rs_nrates - 1; +i > 0 && (ni->ni_rates.rs_rates[i] & IEEE80211_RATE_VAL) > 72; +i--); + ni->ni_txrate = i; } void
Re: tcpdump -A
On 2012/07/10 14:15, Mike Small wrote: > Stuart Henderson writes: > > > +/* dump the text from the buffer */ > > +void > > +default_print_ascii(const u_char *cp, unsigned int length, unsigned int > > offset) > > +{ > > + int c, i; > > + > > + printf("\n"); > > + for (i = 0; i < length; i++) { > > + c = cp[i]; > > + c = isprint(c) || isspace(c) ? c : '.'; > > + putchar(c); > > + } > > +} > > + > > Is not using the offset argument intentional? Too much copy and paste. However it's not really used in default_print_hexl either. Index: tcpdump.c === RCS file: /cvs/src/usr.sbin/tcpdump/tcpdump.c,v retrieving revision 1.64 diff -u -p -r1.64 tcpdump.c --- tcpdump.c 10 Jul 2012 18:07:37 - 1.64 +++ tcpdump.c 10 Jul 2012 18:37:39 - @@ -561,7 +561,7 @@ gotchld(int signo) /* dump the buffer in `emacs-hexl' style */ void -default_print_hexl(const u_char *cp, unsigned int length, unsigned int offset) +default_print_hexl(const u_char *cp, unsigned int length) { unsigned int i, j, jm; int c; @@ -569,8 +569,7 @@ default_print_hexl(const u_char *cp, uns printf("\n"); for (i = 0; i < length; i += 0x10) { - snprintf(ln, sizeof(ln), " %04x: ", - (unsigned int)(i + offset)); + snprintf(ln, sizeof(ln), " %04x: ", (unsigned int)i); jm = length - i; jm = jm > 16 ? 16 : jm; @@ -605,7 +604,7 @@ default_print_hexl(const u_char *cp, uns /* dump the text from the buffer */ void -default_print_ascii(const u_char *cp, unsigned int length, unsigned int offset) +default_print_ascii(const u_char *cp, unsigned int length) { int c, i; @@ -626,10 +625,10 @@ default_print_unaligned(register const u if (Xflag) { /* dump the buffer in `emacs-hexl' style */ - default_print_hexl(cp, length, 0); + default_print_hexl(cp, length); } else if (Aflag) { /* dump the text in the buffer */ - default_print_ascii(cp, length, 0); + default_print_ascii(cp, length); } else { /* dump the buffer in old tcpdump style */ nshorts = (u_int) length / sizeof(u_short); @@ -657,10 +656,10 @@ default_print(register const u_char *bp, if (Xflag) { /* dump the buffer in `emacs-hexl' style */ - default_print_hexl(bp, length, 0); + default_print_hexl(bp, length); } else if (Aflag) { /* dump the text in the buffer */ - default_print_ascii(bp, length, 0); + default_print_ascii(bp, length); } else { /* dump the buffer in old tcpdump style */ if ((long)bp & 1) {
Re: tcpdump -A
Stuart Henderson writes: > +/* dump the text from the buffer */ > +void > +default_print_ascii(const u_char *cp, unsigned int length, unsigned int > offset) > +{ > + int c, i; > + > + printf("\n"); > + for (i = 0; i < length; i++) { > + c = cp[i]; > + c = isprint(c) || isspace(c) ? c : '.'; > + putchar(c); > + } > +} > + Is not using the offset argument intentional? - Mike Small
tcpdump -A
adds support for -A for tcpdump, to print captured text without the hex dump. can be useful if you're watching text-based protocols like HTTP or SIP. tcpdump.org uses the same flag (this isn't their code though). comments? OK? Index: tcpdump.8 === RCS file: /cvs/src/usr.sbin/tcpdump/tcpdump.8,v retrieving revision 1.75 diff -u -p -r1.75 tcpdump.8 --- tcpdump.8 28 Mar 2011 09:37:03 - 1.75 +++ tcpdump.8 10 Jul 2012 17:22:47 - @@ -28,7 +28,7 @@ .Sh SYNOPSIS .Nm tcpdump .Bk -words -.Op Fl adefILlNnOopqStvXx +.Op Fl AadefILlNnOopqStvXx .Op Fl c Ar count .Op Fl D Ar direction .Oo Fl E Oo Ar espalg : Oc Ns @@ -51,6 +51,14 @@ You must have read access to .Pp The options are as follows: .Bl -tag -width "-c count" +.It Fl A +Print each packet in ASCII. +If the +.Fl e +option is also specified, the link-level header will be included. +The smaller of the entire packet or +.Ar snaplen +bytes will be printed. .It Fl a Attempt to convert network and broadcast addresses to names. .It Fl c Ar count Index: tcpdump.c === RCS file: /cvs/src/usr.sbin/tcpdump/tcpdump.c,v retrieving revision 1.63 diff -u -p -r1.63 tcpdump.c --- tcpdump.c 26 Jun 2010 16:47:07 - 1.63 +++ tcpdump.c 10 Jul 2012 17:22:47 - @@ -59,6 +59,7 @@ #include "pfctl_parser.h" #include "privsep.h" +int Aflag; /* dump ascii */ int aflag; /* translate network and broadcast addresses */ int dflag; /* print filter code */ int eflag; /* print ethernet header */ @@ -228,9 +229,14 @@ main(int argc, char **argv) opterr = 0; while ((op = getopt(argc, argv, - "ac:D:deE:fF:i:IlLnNOopqr:s:StT:vw:xXy:Y")) != -1) + "Aac:D:deE:fF:i:IlLnNOopqr:s:StT:vw:xXy:Y")) != -1) switch (op) { + case 'A': + if (xflag == 0) ++xflag; + ++Aflag; + break; + case 'a': ++aflag; break; @@ -597,6 +603,20 @@ default_print_hexl(const u_char *cp, uns } } +/* dump the text from the buffer */ +void +default_print_ascii(const u_char *cp, unsigned int length, unsigned int offset) +{ + int c, i; + + printf("\n"); + for (i = 0; i < length; i++) { + c = cp[i]; + c = isprint(c) || isspace(c) ? c : '.'; + putchar(c); + } +} + /* Like default_print() but data need not be aligned */ void default_print_unaligned(register const u_char *cp, register u_int length) @@ -607,6 +627,9 @@ default_print_unaligned(register const u if (Xflag) { /* dump the buffer in `emacs-hexl' style */ default_print_hexl(cp, length, 0); + } else if (Aflag) { + /* dump the text in the buffer */ + default_print_ascii(cp, length, 0); } else { /* dump the buffer in old tcpdump style */ nshorts = (u_int) length / sizeof(u_short); @@ -635,6 +658,9 @@ default_print(register const u_char *bp, if (Xflag) { /* dump the buffer in `emacs-hexl' style */ default_print_hexl(bp, length, 0); + } else if (Aflag) { + /* dump the text in the buffer */ + default_print_ascii(bp, length, 0); } else { /* dump the buffer in old tcpdump style */ if ((long)bp & 1) { @@ -674,7 +700,7 @@ __dead void usage(void) { (void)fprintf(stderr, -"Usage: %s [-adefILlNnOopqStvXx] [-c count] [-D direction]\n", +"Usage: %s [-AadefILlNnOopqStvXx] [-c count] [-D direction]\n", program_name); (void)fprintf(stderr, "\t [-E [espalg:]espkey] [-F file] [-i interface] [-r file]\n");
Re: wakeup should only call need_resched if priority is lower than current one.
Commited, it fixes aja's problem indeed. Now, I don't like this at all, we'll have more bugs of this nature, can't we turn setrunnable() into an inline function and place it in a header ? Or just call setrunnable() directly, but I'd have to run some tests to see the performance impact. On Tue, Jul 10, 2012 at 04:37:13PM +0200, Christiano F. Haesbaert wrote: > Heya, > > wakeup_n() has a "inline expansion" of setrunnable(), but it differs by > always calling need_resched(), this sends an ipi for *every* wakeup > channel. > > It might have something to do with aja's problem. > > Index: kern_synch.c > === > RCS file: /cvs/src/sys/kern/kern_synch.c,v > retrieving revision 1.102 > diff -d -u -p -r1.102 kern_synch.c > --- kern_synch.c 10 Apr 2012 11:33:58 - 1.102 > +++ kern_synch.c 10 Jul 2012 14:27:17 - > @@ -378,7 +378,9 @@ wakeup_n(const volatile void *ident, int > p->p_stat = SRUN; > p->p_cpu = sched_choosecpu(p); > setrunqueue(p); > - need_resched(p->p_cpu); > + if (p->p_priority < > + p->p_cpu->ci_schedstate.spc_curpriority) > + need_resched(p->p_cpu); > /* END INLINE EXPANSION */ > > }
Re: ral(4) tx/prio queue fixes (was: rt2560 tx/prio queue fixes)
On Sun, Jul 08, 2012 at 10:11:44AM +0200, Stefan Sperling wrote: > The rt2560 part of the ral driver uses a prio queue for management > frames and a tx queue for data frames. > > Both queues currently use a shared flag to tell the network stack that they > are full (IFF_OACTIVE). It seems that IFF_OACTIVE can get cleared by the > interrupt handler for one queue while the other queue is still loaded, > so the network layer might try to push more frames down while we can't > actually handle them. With the diff below we reset IFF_OACTIVE only if > both prio and tx queues have been drained. > > Also, don't reset the tx watchdog counter if the tx/prio queues still have > frames queued when we exit the frame-processing loop in either interrupt > handler. Else, it seems the watchdog might fail to run rt2560_init() even > though we failed to transmit some frames. Updated version that includes similar fixes for the rt2661 variants. This seems to help soekris-based ral APs that get stuck with the OACTIVE flag set (see the flags line in "ifconfig ral0" output when the AP stops responding) and then require "ifconfig ral0 down up" to recover. It would be great to get some more testing. Thanks! Index: rt2560.c === RCS file: /cvs/src/sys/dev/ic/rt2560.c,v retrieving revision 1.58 diff -u -p -r1.58 rt2560.c --- rt2560.c22 Feb 2011 20:05:03 - 1.58 +++ rt2560.c10 Jul 2012 15:34:21 - @@ -995,9 +995,14 @@ rt2560_tx_intr(struct rt2560_softc *sc) sc->txq.next = (sc->txq.next + 1) % RT2560_TX_RING_COUNT; } - sc->sc_tx_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; - rt2560_start(ifp); + if (sc->txq.queued == 0 && sc->prioq.queued == 0) + sc->sc_tx_timer = 0; + if (sc->txq.queued < RT2560_TX_RING_COUNT - 1) { + sc->sc_flags &= ~RT2560_DATA_OACTIVE; + if (!(sc->sc_flags & (RT2560_DATA_OACTIVE|RT2560_PRIO_OACTIVE))) + ifp->if_flags &= ~IFF_OACTIVE; + rt2560_start(ifp); + } } void @@ -1061,9 +1066,14 @@ rt2560_prio_intr(struct rt2560_softc *sc sc->prioq.next = (sc->prioq.next + 1) % RT2560_PRIO_RING_COUNT; } - sc->sc_tx_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; - rt2560_start(ifp); + if (sc->txq.queued == 0 && sc->prioq.queued == 0) + sc->sc_tx_timer = 0; + if (sc->prioq.queued < RT2560_PRIO_RING_COUNT) { + sc->sc_flags &= ~RT2560_PRIO_OACTIVE; + if (!(sc->sc_flags & (RT2560_DATA_OACTIVE|RT2560_PRIO_OACTIVE))) + ifp->if_flags &= ~IFF_OACTIVE; + rt2560_start(ifp); + } } /* @@ -1931,6 +1941,7 @@ rt2560_start(struct ifnet *ifp) if (m0 != NULL) { if (sc->prioq.queued >= RT2560_PRIO_RING_COUNT) { ifp->if_flags |= IFF_OACTIVE; + sc->sc_flags |= RT2560_PRIO_OACTIVE; break; } IF_DEQUEUE(&ic->ic_mgtq, m0); @@ -1952,6 +1963,7 @@ rt2560_start(struct ifnet *ifp) break; if (sc->txq.queued >= RT2560_TX_RING_COUNT - 1) { ifp->if_flags |= IFF_OACTIVE; + sc->sc_flags |= RT2560_DATA_OACTIVE; break; } IFQ_DEQUEUE(&ifp->if_snd, m0); @@ -2685,6 +2697,7 @@ rt2560_stop(struct ifnet *ifp, int disab struct ieee80211com *ic = &sc->sc_ic; sc->sc_tx_timer = 0; + sc->sc_flags &= ~(RT2560_PRIO_OACTIVE|RT2560_DATA_OACTIVE); ifp->if_timer = 0; ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); Index: rt2560var.h === RCS file: /cvs/src/sys/dev/ic/rt2560var.h,v retrieving revision 1.9 diff -u -p -r1.9 rt2560var.h --- rt2560var.h 7 Sep 2010 16:21:42 - 1.9 +++ rt2560var.h 7 Jul 2012 15:58:58 - @@ -116,6 +116,8 @@ struct rt2560_softc { #define RT2560_ENABLED (1 << 0) #define RT2560_UPDATE_SLOT (1 << 1) #define RT2560_SET_SLOTTIME(1 << 2) +#define RT2560_PRIO_OACTIVE(1 << 3) +#define RT2560_DATA_OACTIVE(1 << 4) int sc_tx_timer; Index: rt2661.c === RCS file: /cvs/src/sys/dev/ic/rt2661.c,v retrieving revision 1.65 diff -u -p -r1.65 rt2661.c --- rt2661.c18 Mar 2011 06:05:21 - 1.65 +++ rt2661.c10 Jul 2012 15:38:03 - @@ -986,9 +986,18 @@ rt2661_tx_intr(struct rt2661_softc *sc) txq->stat = 0; } - sc->sc_tx_timer = 0; - ifp->if_flags &= ~IFF_OACTIVE; - rt2661_start(ifp); + if (sc->mgtq.queued == 0 && sc->txq[0].queued ==
wakeup should only call need_resched if priority is lower than current one.
Heya, wakeup_n() has a "inline expansion" of setrunnable(), but it differs by always calling need_resched(), this sends an ipi for *every* wakeup channel. It might have something to do with aja's problem. Index: kern_synch.c === RCS file: /cvs/src/sys/kern/kern_synch.c,v retrieving revision 1.102 diff -d -u -p -r1.102 kern_synch.c --- kern_synch.c10 Apr 2012 11:33:58 - 1.102 +++ kern_synch.c10 Jul 2012 14:27:17 - @@ -378,7 +378,9 @@ wakeup_n(const volatile void *ident, int p->p_stat = SRUN; p->p_cpu = sched_choosecpu(p); setrunqueue(p); - need_resched(p->p_cpu); + if (p->p_priority < + p->p_cpu->ci_schedstate.spc_curpriority) + need_resched(p->p_cpu); /* END INLINE EXPANSION */ }
relayd: statistics are broken [patches]
Hi, There is a bug in relayd's handling of statistics collected from each "prefork" (0,1,2,3,4,..). Once received over IMSG, statistics should be saved in a rl_stats[RELAY_MAXPROC + 1] array per relay (rlay->rl_stats). However all ends up in rlay->rl_stats[0] overwriting other children's statistics in a holy mess. So, fixing this bug, and you should start to see up to five times more statistics than before. I have been running the large patch (which removes proc_id) in production for a few months on multiple installations, and it all seems fine. Test case: # cat relayd.conf table { 127.0.0.1 } relay "test" { listen on 0.0.0.0 port forward to port 22 check tcp } # relayd -f relayd.conf # for i in `echo "1 2 3 4 5 6 7 8 9 0"`; do nc 127.0.0.1 > /dev/null & done; sleep 3; pkill -9 nc (wait a minute for statistics to be summarized) # relayctl show relays Id TypeNameAvlblty Status 1 relay testactive total: 7 sessions last: 0/60s 7/h 7/d sessions average: 1/60s 0/h 0/d sessions 7 sessions hit the first relay fork. We should expect 10 sessions. This is due to the unset variable proc_id which is used as if it were incremented for each forked child. This proc_id should be the same as p->p_instance and env->sc_ps->ps_instance. So I have two suggested fixes. 1. Use the big patch below, it removes the proc_id variable and imho. cleans up the current struct relayd* env confusion. 2. Use the small quick-fix patch below, it sets up proc_id properly. However env is NULL dereferenced for sc_timeout in relay_udp.c, thus crashing in a simple "dns forward" test. If the big patch is applied, env is always set in relay.c and relay_udp.c, so we should let this patch decide if another bug report is needed. (reported by Tom Knienieder: relayd UDP bug and patch ...) Regards Erik Two patched attached below. -- cut -- Index: relay.c === RCS file: /cvs/src/usr.sbin/relayd/relay.c,v retrieving revision 1.144 diff -u -r1.144 relay.c --- relay.c 21 Jan 2012 13:40:48 - 1.144 +++ relay.c 7 Mar 2012 10:24:57 - @@ -332,6 +332,9 @@ if (config_init(ps->ps_env) == -1) fatal("failed to initialize configuration"); + + /* Set to current prefork id */ + proc_id = p->p_instance; /* We use a custom shutdown callback */ p->p_shutdown = relay_shutdown; -- cut -- ...or... (the "large patch") -- cut -- Index: pfe.c === RCS file: /cvs/src/usr.sbin/relayd/pfe.c,v retrieving revision 1.72 diff -u -r1.72 pfe.c --- pfe.c 21 Jan 2012 13:40:48 - 1.72 +++ pfe.c 7 Mar 2012 00:30:19 - @@ -46,7 +46,7 @@ int pfe_dispatch_hce(int, struct privsep_proc *, struct imsg *); int pfe_dispatch_relay(int, struct privsep_proc *, struct imsg *); -static struct relayd *env = NULL; +struct relayd *env = NULL; static struct privsep_proc procs[] = { { "parent", PROC_PARENT,pfe_dispatch_parent }, Index: relay.c === RCS file: /cvs/src/usr.sbin/relayd/relay.c,v retrieving revision 1.144 diff -u -r1.144 relay.c --- relay.c 21 Jan 2012 13:40:48 - 1.144 +++ relay.c 7 Mar 2012 00:30:20 - @@ -135,8 +135,7 @@ volatile sig_atomic_t relay_sessions; objid_t relay_conid; -static struct relayd *env = NULL; -int proc_id; +extern struct relayd *env; static struct privsep_proc procs[] = { { "parent", PROC_PARENT,relay_dispatch_parent }, @@ -305,7 +304,7 @@ switch (rlay->rl_proto->type) { case RELAY_PROTO_DNS: - relay_udp_privinit(env, rlay); + relay_udp_privinit(rlay); break; case RELAY_PROTO_TCP: case RELAY_PROTO_HTTP: @@ -367,7 +366,7 @@ bzero(&crs, sizeof(crs)); resethour = resetday = 0; - cur = &rlay->rl_stats[proc_id]; + cur = &rlay->rl_stats[env->sc_ps->ps_instance]; cur->cnt += cur->last; cur->tick++; cur->avg = (cur->last + cur->avg) / 2; @@ -390,7 +389,7 @@ cur->last_day = 0; crs.id = rlay->rl_conf.id; - crs.proc = proc_id; + crs.proc = env->sc_ps->ps_instance; proc_compose_imsg(env->sc_ps, PROC_PFE, -1, IMSG_STATISTICS, -1, &crs, sizeof(crs)); @@ -2009,7 +2008,7 @@ SPLAY_INSERT(session_tree, &rlay->rl_sessions, con); /* Increment the per-relay session counter */ - rlay->rl_stats[proc_id].last++; + rlay->rl_stats[env->sc_ps->ps_instance].last++;