svn commit: r232585 - head/sys/mips/mips

2012-03-06 Thread Juli Mallett
Author: jmallett
Date: Tue Mar  6 08:02:10 2012
New Revision: 232585
URL: http://svn.freebsd.org/changeset/base/232585

Log:
  Store TLS base in the sigframe just as is done in freebsd32_sendsig.  Because
  the native sigreturn doesn't use set_mcontext like the COMPAT_FREEBSD32 
version
  does, this wouldn't actually result in overwriting the TLS base.  Probably it
  makes sense to restructure the native sigreturn to use set_mcontext for
  consistency, and to allow sigreturn to change the TLS base.

Modified:
  head/sys/mips/mips/pm_machdep.c

Modified: head/sys/mips/mips/pm_machdep.c
==
--- head/sys/mips/mips/pm_machdep.c Tue Mar  6 07:50:45 2012
(r232584)
+++ head/sys/mips/mips/pm_machdep.c Tue Mar  6 08:02:10 2012
(r232585)
@@ -110,6 +110,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, 
sf.sf_uc.uc_mcontext.mc_pc = regs-pc;
sf.sf_uc.uc_mcontext.mullo = regs-mullo;
sf.sf_uc.uc_mcontext.mulhi = regs-mulhi;
+   sf.sf_uc.uc_mcontext.mc_tls = td-td_md.md_tls;
sf.sf_uc.uc_mcontext.mc_regs[0] = UCONTEXT_MAGIC;  /* magic number */
bcopy((void *)regs-ast, (void *)sf.sf_uc.uc_mcontext.mc_regs[1],
sizeof(sf.sf_uc.uc_mcontext.mc_regs) - sizeof(register_t));
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232586 - head/sys/mips/mips

2012-03-06 Thread Juli Mallett
Author: jmallett
Date: Tue Mar  6 08:10:48 2012
New Revision: 232586
URL: http://svn.freebsd.org/changeset/base/232586

Log:
  Make the native sigreturn just wrap set_mcontext, much as freebsd32_sigreturn
  does.

Modified:
  head/sys/mips/mips/pm_machdep.c

Modified: head/sys/mips/mips/pm_machdep.c
==
--- head/sys/mips/mips/pm_machdep.c Tue Mar  6 08:02:10 2012
(r232585)
+++ head/sys/mips/mips/pm_machdep.c Tue Mar  6 08:10:48 2012
(r232586)
@@ -216,51 +216,22 @@ cpu_thread_siginfo(int sig, u_long code,
 int
 sys_sigreturn(struct thread *td, struct sigreturn_args *uap)
 {
-   struct trapframe *regs;
-   ucontext_t *ucp;
ucontext_t uc;
int error;
 
-   ucp = uc;
-
error = copyin(uap-sigcntxp, uc, sizeof(uc));
if (error != 0)
return (error);
 
-   regs = td-td_frame;
-
-/* #ifdef DEBUG */
-   if (ucp-uc_mcontext.mc_regs[ZERO] != UCONTEXT_MAGIC) {
-   printf(sigreturn: pid %d, ucp %p\n, td-td_proc-p_pid, ucp);
-   printf(  old sp %p ra %p pc %p\n,
-   (void *)(intptr_t)regs-sp, (void *)(intptr_t)regs-ra, 
(void *)(intptr_t)regs-pc);
-   printf(  new sp %p ra %p pc %p z %p\n,
-   (void *)(intptr_t)ucp-uc_mcontext.mc_regs[SP],
-   (void *)(intptr_t)ucp-uc_mcontext.mc_regs[RA],
-   (void *)(intptr_t)ucp-uc_mcontext.mc_regs[PC],
-   (void *)(intptr_t)ucp-uc_mcontext.mc_regs[ZERO]);
-   return EINVAL;
-   }
-/* #endif */
-
-   bcopy((const void *)ucp-uc_mcontext.mc_regs[1], (void *)regs-ast,
-   sizeof(ucp-uc_mcontext.mc_regs) - sizeof(register_t));
-
-   if (ucp-uc_mcontext.mc_fpused)
-   bcopy((const void *)ucp-uc_mcontext.mc_fpregs,
-   (void *)td-td_frame-f0,
-   sizeof(ucp-uc_mcontext.mc_fpregs));
-
-   regs-pc = ucp-uc_mcontext.mc_pc;
-   regs-mullo = ucp-uc_mcontext.mullo;
-   regs-mulhi = ucp-uc_mcontext.mulhi;
+   error = set_mcontext(td, uc.uc_mcontext);
+   if (error != 0)
+   return (error);
 
-   kern_sigprocmask(td, SIG_SETMASK, ucp-uc_sigmask, NULL, 0);
+   kern_sigprocmask(td, SIG_SETMASK, uc.uc_sigmask, NULL, 0);
 
-   return(EJUSTRETURN);
+   return (EJUSTRETURN);
 }
 
-
 int
 ptrace_set_pc(struct thread *td, unsigned long addr)
 {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232587 - head/sys/mips/mips

2012-03-06 Thread Juli Mallett
Author: jmallett
Date: Tue Mar  6 08:40:21 2012
New Revision: 232587
URL: http://svn.freebsd.org/changeset/base/232587

Log:
  Garbage collect some unused symbols.

Modified:
  head/sys/mips/mips/genassym.c

Modified: head/sys/mips/mips/genassym.c
==
--- head/sys/mips/mips/genassym.c   Tue Mar  6 08:10:48 2012
(r232586)
+++ head/sys/mips/mips/genassym.c   Tue Mar  6 08:40:21 2012
(r232587)
@@ -71,12 +71,8 @@ ASSYM(TD_UPTE, offsetof(struct thread, t
 ASSYM(TD_KSTACK, offsetof(struct thread, td_kstack));
 ASSYM(TD_FLAGS, offsetof(struct thread, td_flags));
 ASSYM(TD_LOCK, offsetof(struct thread, td_lock));
-ASSYM(TD_FRAME, offsetof(struct thread, td_frame));
-ASSYM(TD_TLS, offsetof(struct thread, td_md.md_tls));
 ASSYM(TD_MDFLAGS, offsetof(struct thread, td_md.md_flags));
 
-ASSYM(TF_REG_SR, offsetof(struct trapframe, sr));
-
 ASSYM(U_PCB_REGS, offsetof(struct pcb, pcb_regs.zero));
 ASSYM(U_PCB_CONTEXT, offsetof(struct pcb, pcb_context));
 ASSYM(U_PCB_ONFAULT, offsetof(struct pcb, pcb_onfault));
@@ -87,7 +83,6 @@ ASSYM(PC_SEGBASE, offsetof(struct pcpu, 
 ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread));
 ASSYM(PC_FPCURTHREAD, offsetof(struct pcpu, pc_fpcurthread));
 ASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid));
-ASSYM(PC_CURPMAP, offsetof(struct pcpu, pc_curpmap));
 
 ASSYM(VM_MAX_KERNEL_ADDRESS, VM_MAX_KERNEL_ADDRESS);
 ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS);
@@ -98,13 +93,10 @@ ASSYM(SIGF32_UC, offsetof(struct sigfram
 ASSYM(SIGFPE, SIGFPE);
 ASSYM(PAGE_SHIFT, PAGE_SHIFT);
 ASSYM(PAGE_SIZE, PAGE_SIZE);
-ASSYM(PAGE_MASK, PAGE_MASK);
 ASSYM(PDRSHIFT, PDRSHIFT);
 ASSYM(SEGSHIFT, SEGSHIFT);
-ASSYM(NPTEPG, NPTEPG);
 ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
 ASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
-ASSYM(PCPU_SIZE, sizeof(struct pcpu));
 ASSYM(MAXCOMLEN, MAXCOMLEN);
 ASSYM(MDTD_COP2USED, MDTD_COP2USED);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r232580 - head/lib/csu/mips

2012-03-06 Thread Konstantin Belousov
On Tue, Mar 06, 2012 at 03:29:47AM +, Oleksandr Tymoshenko wrote:
 Author: gonzo
 Date: Tue Mar  6 03:29:46 2012
 New Revision: 232580
 URL: http://svn.freebsd.org/changeset/base/232580
 
 Log:
   - Remove NOSHARED parts since it seems to be no-op
   - Call _init_tls for statically linked binaries
 
 Modified:
   head/lib/csu/mips/crt1.c
 
 Modified: head/lib/csu/mips/crt1.c
 ==
 --- head/lib/csu/mips/crt1.c  Tue Mar  6 03:27:58 2012(r232579)
 +++ head/lib/csu/mips/crt1.c  Tue Mar  6 03:29:46 2012(r232580)
 @@ -47,10 +47,8 @@ __FBSDID($FreeBSD$);
  struct Struct_Obj_Entry;
  struct ps_strings;
  
 -#ifndef NOSHARED
  extern int _DYNAMIC;
  #pragma weak _DYNAMIC
 -#endif
  
  extern void _init(void);
  extern void _fini(void);
 @@ -91,10 +89,11 @@ __start(char **ap,
   __progname = s + 1;
   }
  
 -#ifndef NOSHARED
   if (_DYNAMIC != NULL)
   atexit(cleanup);
 -#endif
 + else
 + _init_tls();
 +
  #ifdef GCRT
   atexit(_mcleanup);
  #endif

Oh great. I tried to understand this bits for some time, due to init_array
work, and was unable to make any sense of it. I will update the patchset
to include MIPS now.


pgp0XBOE8LBZx.pgp
Description: PGP signature


svn commit: r232589 - head/share/man/man9

2012-03-06 Thread Sergey Kandaurov
Author: pluknet
Date: Tue Mar  6 09:04:53 2012
New Revision: 232589
URL: http://svn.freebsd.org/changeset/base/232589

Log:
  The missing part of r232588 that documents ifaddr_byindex() itself.
  
  MFC after:1 week

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

Modified: head/share/man/man9/ifnet.9
==
--- head/share/man/man9/ifnet.9 Tue Mar  6 08:59:42 2012(r232588)
+++ head/share/man/man9/ifnet.9 Tue Mar  6 09:04:53 2012(r232589)
@@ -1351,6 +1351,10 @@ precisely
 .Fa addr
 will be returned.
 .Pp
+.Fn ifaddr_byindex
+returns the link-level address of the interface with the given index
+.Fa idx .
+.Pp
 All of these functions return a null pointer if no such address can be
 found.
 .Ss Interface Multicast Address Functions
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232590 - head/libexec/rtld-elf

2012-03-06 Thread Sergey Kandaurov
Author: pluknet
Date: Tue Mar  6 09:34:30 2012
New Revision: 232590
URL: http://svn.freebsd.org/changeset/base/232590

Log:
  Cosmetic nit:
  - rename isspace1() macro to the more appropriate rtld_isspace().
  
  Discussed with:   kib

Modified:
  head/libexec/rtld-elf/libmap.c

Modified: head/libexec/rtld-elf/libmap.c
==
--- head/libexec/rtld-elf/libmap.c  Tue Mar  6 09:04:53 2012
(r232589)
+++ head/libexec/rtld-elf/libmap.c  Tue Mar  6 09:34:30 2012
(r232590)
@@ -56,7 +56,7 @@ static intclosestrfn  (void * cookie);
  * Do not use ctype.h macros, which rely on working TLS.  It is
  * too early to have thread-local variables functional.
  */
-#defineisspace1(c) ((c) == ' ' || (c) == '\t')
+#definertld_isspace(c) ((c) == ' ' || (c) == '\t')
 
 int
 lm_init (char *libmap_override)
@@ -112,7 +112,7 @@ lmc_parse (FILE *fp)
t = f = c = NULL;
 
/* Skip over leading space */
-   while (isspace1(*cp)) cp++;
+   while (rtld_isspace(*cp)) cp++;
 
/* Found a comment or EOL */
if (iseol(*cp)) continue;
@@ -122,7 +122,7 @@ lmc_parse (FILE *fp)
cp++;
 
/* Skip leading space */
-   while (isspace1(*cp)) cp++;
+   while (rtld_isspace(*cp)) cp++;
 
/* Found comment, EOL or end of selector */
if  (iseol(*cp) || *cp == ']')
@@ -130,11 +130,11 @@ lmc_parse (FILE *fp)
 
c = cp++;
/* Skip to end of word */
-   while (!isspace1(*cp)  !iseol(*cp)  *cp != ']')
+   while (!rtld_isspace(*cp)  !iseol(*cp)  *cp != ']')
cp++;
 
/* Skip and zero out trailing space */
-   while (isspace1(*cp)) *cp++ = '\0';
+   while (rtld_isspace(*cp)) *cp++ = '\0';
 
/* Check if there is a closing brace */
if (*cp != ']') continue;
@@ -146,7 +146,7 @@ lmc_parse (FILE *fp)
 * There should be nothing except whitespace or comment
  from this point to the end of the line.
 */
-   while(isspace1(*cp)) cp++;
+   while(rtld_isspace(*cp)) cp++;
if (!iseol(*cp)) continue;
 
strcpy(prog, c);
@@ -156,20 +156,20 @@ lmc_parse (FILE *fp)
 
/* Parse the 'from' candidate. */
f = cp++;
-   while (!isspace1(*cp)  !iseol(*cp)) cp++;
+   while (!rtld_isspace(*cp)  !iseol(*cp)) cp++;
 
/* Skip and zero out the trailing whitespace */
-   while (isspace1(*cp)) *cp++ = '\0';
+   while (rtld_isspace(*cp)) *cp++ = '\0';
 
/* Found a comment or EOL */
if (iseol(*cp)) continue;
 
/* Parse 'to' mapping */
t = cp++;
-   while (!isspace1(*cp)  !iseol(*cp)) cp++;
+   while (!rtld_isspace(*cp)  !iseol(*cp)) cp++;
 
/* Skip and zero out the trailing whitespace */
-   while (isspace1(*cp)) *cp++ = '\0';
+   while (rtld_isspace(*cp)) *cp++ = '\0';
 
/* Should be no extra tokens at this point */
if (!iseol(*cp)) continue;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232591 - head/share/man/man9

2012-03-06 Thread Sergey Kandaurov
Author: pluknet
Date: Tue Mar  6 09:40:34 2012
New Revision: 232591
URL: http://svn.freebsd.org/changeset/base/232591

Log:
  Kill EoL whitespaces.

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

Modified: head/share/man/man9/ifnet.9
==
--- head/share/man/man9/ifnet.9 Tue Mar  6 09:34:30 2012(r232590)
+++ head/share/man/man9/ifnet.9 Tue Mar  6 09:40:34 2012(r232591)
@@ -394,7 +394,7 @@ This function will return
 .Dv ENOBUFS
 if the devices software and hardware queues are both full.
 This function must be installed after
-.Fn if_attach 
+.Fn if_attach
 to override the default implementation.
 This function is exposed in order to allow drivers to manage their own queues
 and to reduce the latency caused by a frequently gratuitous enqueue / dequeue
@@ -402,8 +402,8 @@ pair to ifq.
 The suggested internal software queueing mechanism is buf_ring.
 .It Fn if_qflush
 Free mbufs in internally managed queues when the interface is marked down.
-This function must be installed after 
-.Fn if_attach 
+This function must be installed after
+.Fn if_attach
 to override the default implementation.
 This function is exposed in order to allow drivers to manage their own queues
 and to reduce the latency caused by a frequently gratuitous enqueue / dequeue
@@ -623,14 +623,14 @@ This Ethernet interface supports TCP Seg
 .It Dv IFCAP_TSO6
 This Ethernet interface supports TCP6 Segmentation offloading.
 .It Dv IFCAP_TSO
-A shorthand for 
+A shorthand for
 .Pq Dv IFCAP_TSO4 | IFCAP_TSO6 .
 .It Dv IFCAP_TOE4
 This Ethernet interface supports TCP offloading.
 .It Dv IFCAP_TOE6
 This Ethernet interface supports TCP6 offloading.
 .It Dv ICAP_TOE
-A Shorthand for 
+A Shorthand for
 .Pq Dv IFCAP_TOE4 | IFCAP_TOE6 .
 .It Dv IFCAP_WOL_UCAST
 This Ethernet interface supports waking up on any Unicast packet.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232592 - head/share/man/man9

2012-03-06 Thread Sergey Kandaurov
Author: pluknet
Date: Tue Mar  6 09:57:50 2012
New Revision: 232592
URL: http://svn.freebsd.org/changeset/base/232592

Log:
  Fix a typo: use lower case in A Shorthand.
  
  Noted by: maxim

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

Modified: head/share/man/man9/ifnet.9
==
--- head/share/man/man9/ifnet.9 Tue Mar  6 09:40:34 2012(r232591)
+++ head/share/man/man9/ifnet.9 Tue Mar  6 09:57:50 2012(r232592)
@@ -630,7 +630,7 @@ This Ethernet interface supports TCP off
 .It Dv IFCAP_TOE6
 This Ethernet interface supports TCP6 offloading.
 .It Dv ICAP_TOE
-A Shorthand for
+A shorthand for
 .Pq Dv IFCAP_TOE4 | IFCAP_TOE6 .
 .It Dv IFCAP_WOL_UCAST
 This Ethernet interface supports waking up on any Unicast packet.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232598 - in head/sys: kern sys

2012-03-06 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Mar  6 11:05:50 2012
New Revision: 232598
URL: http://svn.freebsd.org/changeset/base/232598

Log:
  Make racct and rctl correctly handle jail renaming.  Previously
  they would continue using old name, the one jail was created with.
  
  PR:   bin/165207

Modified:
  head/sys/kern/kern_jail.c
  head/sys/kern/kern_racct.c
  head/sys/sys/racct.h

Modified: head/sys/kern/kern_jail.c
==
--- head/sys/kern/kern_jail.c   Tue Mar  6 10:51:53 2012(r232597)
+++ head/sys/kern/kern_jail.c   Tue Mar  6 11:05:50 2012(r232598)
@@ -130,6 +130,7 @@ static char *prison_path(struct prison *
 static void prison_remove_one(struct prison *pr);
 #ifdef RACCT
 static void prison_racct_attach(struct prison *pr);
+static void prison_racct_modify(struct prison *pr);
 static void prison_racct_detach(struct prison *pr);
 #endif
 #ifdef INET
@@ -1830,6 +1831,12 @@ kern_jail_set(struct thread *td, struct 
if (!(flags  JAIL_ATTACH))
sx_sunlock(allprison_lock);
}
+
+#ifdef RACCT
+   if (!created)
+   prison_racct_modify(pr);
+#endif
+
td-td_retval[0] = pr-pr_id;
goto done_errmsg;
 
@@ -4427,24 +4434,32 @@ prison_racct_hold(struct prison_racct *p
refcount_acquire(prr-prr_refcount);
 }
 
+static void
+prison_racct_free_locked(struct prison_racct *prr)
+{
+
+   sx_assert(allprison_lock, SA_XLOCKED);
+
+   if (refcount_release(prr-prr_refcount)) {
+   racct_destroy(prr-prr_racct);
+   LIST_REMOVE(prr, prr_next);
+   free(prr, M_PRISON_RACCT);
+   }
+}
+
 void
 prison_racct_free(struct prison_racct *prr)
 {
int old;
 
+   sx_assert(allprison_lock, SA_UNLOCKED);
+
old = prr-prr_refcount;
if (old  1  atomic_cmpset_int(prr-prr_refcount, old, old - 1))
return;
 
sx_xlock(allprison_lock);
-   if (refcount_release(prr-prr_refcount)) {
-   racct_destroy(prr-prr_racct);
-   LIST_REMOVE(prr, prr_next);
-   sx_xunlock(allprison_lock);
-   free(prr, M_PRISON_RACCT);
-
-   return;
-   }
+   prison_racct_free_locked(prr);
sx_xunlock(allprison_lock);
 }
 
@@ -4454,15 +4469,63 @@ prison_racct_attach(struct prison *pr)
 {
struct prison_racct *prr;
 
+   sx_assert(allprison_lock, SA_XLOCKED);
+
prr = prison_racct_find_locked(pr-pr_name);
KASSERT(prr != NULL, (cannot find prison_racct));
 
pr-pr_prison_racct = prr;
 }
 
+/*
+ * Handle jail renaming.  From the racct point of view, renaming means
+ * moving from one prison_racct to another.
+ */
+static void
+prison_racct_modify(struct prison *pr)
+{
+   struct proc *p;
+   struct ucred *cred;
+   struct prison_racct *oldprr;
+
+   sx_slock(allproc_lock);
+   sx_xlock(allprison_lock);
+
+   if (strcmp(pr-pr_name, pr-pr_prison_racct-prr_name) == 0)
+   return;
+
+   oldprr = pr-pr_prison_racct;
+   pr-pr_prison_racct = NULL;
+
+   prison_racct_attach(pr);
+
+   /*
+* Move resource utilisation records.
+*/
+   racct_move(pr-pr_prison_racct-prr_racct, oldprr-prr_racct);
+
+   /*
+* Force rctl to reattach rules to processes.
+*/
+   FOREACH_PROC_IN_SYSTEM(p) {
+   PROC_LOCK(p);
+   cred = crhold(p-p_ucred);
+   PROC_UNLOCK(p);
+   racct_proc_ucred_changed(p, cred, cred);
+   crfree(cred);
+   }
+
+   sx_sunlock(allproc_lock);
+   prison_racct_free_locked(oldprr);
+   sx_xunlock(allprison_lock);
+}
+
 static void
 prison_racct_detach(struct prison *pr)
 {
+
+   sx_assert(allprison_lock, SA_UNLOCKED);
+
prison_racct_free(pr-pr_prison_racct);
pr-pr_prison_racct = NULL;
 }

Modified: head/sys/kern/kern_racct.c
==
--- head/sys/kern/kern_racct.c  Tue Mar  6 10:51:53 2012(r232597)
+++ head/sys/kern/kern_racct.c  Tue Mar  6 11:05:50 2012(r232598)
@@ -697,6 +697,18 @@ racct_proc_ucred_changed(struct proc *p,
 #endif
 }
 
+void
+racct_move(struct racct *dest, struct racct *src)
+{
+
+   mtx_lock(racct_lock);
+
+   racct_add_racct(dest, src);
+   racct_sub_racct(src, src);
+
+   mtx_unlock(racct_lock);
+}
+
 static void
 racctd(void)
 {

Modified: head/sys/sys/racct.h
==
--- head/sys/sys/racct.hTue Mar  6 10:51:53 2012(r232597)
+++ head/sys/sys/racct.hTue Mar  6 11:05:50 2012(r232598)
@@ -142,5 +142,6 @@ voidracct_proc_exit(struct proc *p);
 
 void   racct_proc_ucred_changed(struct proc *p, struct ucred *oldcred,
struct ucred *newcred);
+void   racct_move(struct racct *dest, struct racct 

svn commit: r232600 - head/share/man/man9

2012-03-06 Thread Sergey Kandaurov
Author: pluknet
Date: Tue Mar  6 12:20:37 2012
New Revision: 232600
URL: http://svn.freebsd.org/changeset/base/232600

Log:
  Remove if_watchdog remnants after if_timer/if_watchdog removal in r199975.
  This part was missed in r12.
  
  MFC after:1 week

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

Modified: head/share/man/man9/ifnet.9
==
--- head/share/man/man9/ifnet.9 Tue Mar  6 11:16:14 2012(r232599)
+++ head/share/man/man9/ifnet.9 Tue Mar  6 12:20:37 2012(r232600)
@@ -114,8 +114,6 @@
 .Ft int
 .Fn \*(lp*if_ioctl\*(rp struct ifnet *ifp u_long cmd caddr_t data
 .Ft void
-.Fn \*(lp*if_watchdog\*(rp struct ifnet *ifp
-.Ft void
 .Fn \*(lp*if_init\*(rp void *if_softc
 .Ft int
 .Fo \*(lp*if_resolvemulti\*(rp
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232601 - in head/lib/libc: locale regex

2012-03-06 Thread David Chisnall
Author: theraven
Date: Tue Mar  6 12:53:44 2012
New Revision: 232601
URL: http://svn.freebsd.org/changeset/base/232601

Log:
  Remove some duplicated copyright notices.
  
  Approved by:  dim (mentor)

Modified:
  head/lib/libc/locale/collate.c
  head/lib/libc/regex/regcomp.c

Modified: head/lib/libc/locale/collate.c
==
--- head/lib/libc/locale/collate.c  Tue Mar  6 12:20:37 2012
(r232600)
+++ head/lib/libc/locale/collate.c  Tue Mar  6 12:53:44 2012
(r232601)
@@ -8,11 +8,6 @@
  * Portions of this software were developed by David Chisnall
  * under sponsorship from the FreeBSD Foundation.
  *
- * Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
- * Portions of this software were developed by David Chisnall
- * under sponsorship from the FreeBSD Foundation.
- *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:

Modified: head/lib/libc/regex/regcomp.c
==
--- head/lib/libc/regex/regcomp.c   Tue Mar  6 12:20:37 2012
(r232600)
+++ head/lib/libc/regex/regcomp.c   Tue Mar  6 12:53:44 2012
(r232601)
@@ -11,11 +11,6 @@
  * This code is derived from software contributed to Berkeley by
  * Henry Spencer.
  *
- * Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
- * Portions of this software were developed by David Chisnall
- * under sponsorship from the FreeBSD Foundation.
- *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232604 - in head: sys/cam/ctl usr.sbin/ctladm

2012-03-06 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Mar  6 13:43:57 2012
New Revision: 232604
URL: http://svn.freebsd.org/changeset/base/232604

Log:
  Add LUN resizing to CTL.  Also make it possible to explicitly set
  size when creating file-backed or device-backed LUN.
  
  Reviewed by:  ken (earlier version)
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl.h
  head/sys/cam/ctl/ctl_backend.h
  head/sys/cam/ctl/ctl_backend_block.c
  head/sys/cam/ctl/ctl_backend_ramdisk.c
  head/sys/cam/ctl/ctl_error.c
  head/sys/cam/ctl/ctl_ioctl.h
  head/usr.sbin/ctladm/Makefile
  head/usr.sbin/ctladm/ctladm.8
  head/usr.sbin/ctladm/ctladm.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Tue Mar  6 12:58:19 2012(r232603)
+++ head/sys/cam/ctl/ctl.c  Tue Mar  6 13:43:57 2012(r232604)
@@ -1,7 +1,11 @@
 /*-
  * Copyright (c) 2003-2009 Silicon Graphics International Corp.
+ * Copyright (c) 2012 The FreeBSD Foundation
  * All rights reserved.
  *
+ * Portions of this software were developed by Edward Tomasz Napierala
+ * under sponsorship from the FreeBSD Foundation.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -4797,6 +4801,25 @@ ctl_lun_power_lock(struct ctl_be_lun *be
return (0);
 }
 
+void
+ctl_lun_capacity_changed(struct ctl_be_lun *be_lun)
+{
+   struct ctl_lun *lun;
+   struct ctl_softc *softc;
+   int i;
+
+   softc = control_softc;
+
+   mtx_lock(softc-ctl_lock);
+
+   lun = (struct ctl_lun *)be_lun-ctl_lun;
+
+   for (i = 0; i  CTL_MAX_INITIATORS; i++) 
+   lun-pending_sense[i].ua_pending |= CTL_UA_CAPACITY_CHANGED;
+
+   mtx_unlock(softc-ctl_lock);
+}
+
 /*
  * Backend memory move is complete callback for requests that never
  * make it down to say RAIDCore's configuration code.

Modified: head/sys/cam/ctl/ctl.h
==
--- head/sys/cam/ctl/ctl.h  Tue Mar  6 12:58:19 2012(r232603)
+++ head/sys/cam/ctl/ctl.h  Tue Mar  6 13:43:57 2012(r232604)
@@ -120,7 +120,8 @@ typedef enum {
CTL_UA_RES_PREEMPT  = 0x0200,
CTL_UA_RES_RELEASE  = 0x0400,
CTL_UA_REG_PREEMPT  = 0x0800,
-   CTL_UA_ASYM_ACC_CHANGE  = 0x1000
+   CTL_UA_ASYM_ACC_CHANGE  = 0x1000,
+   CTL_UA_CAPACITY_CHANGED = 0x2000
 } ctl_ua_type;
 
 #ifdef _KERNEL

Modified: head/sys/cam/ctl/ctl_backend.h
==
--- head/sys/cam/ctl/ctl_backend.h  Tue Mar  6 12:58:19 2012
(r232603)
+++ head/sys/cam/ctl/ctl_backend.h  Tue Mar  6 13:43:57 2012
(r232604)
@@ -280,6 +280,11 @@ int ctl_lun_power_lock(struct ctl_be_lun
 int ctl_lun_offline(struct ctl_be_lun *be_lun);
 int ctl_lun_online(struct ctl_be_lun *be_lun);
 
+/*
+ * Let the backend notify the initiator about changed capacity.
+ */
+void ctl_lun_capacity_changed(struct ctl_be_lun *be_lun);
+
 #endif /* _KERNEL */
 #endif /* _CTL_BACKEND_H_ */
 

Modified: head/sys/cam/ctl/ctl_backend_block.c
==
--- head/sys/cam/ctl/ctl_backend_block.cTue Mar  6 12:58:19 2012
(r232603)
+++ head/sys/cam/ctl/ctl_backend_block.cTue Mar  6 13:43:57 2012
(r232604)
@@ -1,8 +1,12 @@
 /*-
  * Copyright (c) 2003 Silicon Graphics International Corp.
  * Copyright (c) 2009-2011 Spectra Logic Corporation
+ * Copyright (c) 2012 The FreeBSD Foundation
  * All rights reserved.
  *
+ * Portions of this software were developed by Edward Tomasz Napierala
+ * under sponsorship from the FreeBSD Foundation.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -250,6 +254,12 @@ static int ctl_be_block_create(struct ct
   struct ctl_lun_req *req);
 static int ctl_be_block_rm(struct ctl_be_block_softc *softc,
   struct ctl_lun_req *req);
+static int ctl_be_block_modify_file(struct ctl_be_block_lun *be_lun,
+ struct ctl_lun_req *req);
+static int ctl_be_block_modify_dev(struct ctl_be_block_lun *be_lun,
+struct ctl_lun_req *req);
+static int ctl_be_block_modify(struct ctl_be_block_softc *softc,
+  struct ctl_lun_req *req);
 static void ctl_be_block_lun_shutdown(void *be_lun);
 static void ctl_be_block_lun_config_status(void *be_lun,
   ctl_lun_config_status status);
@@ -1263,6 +1273,9 @@ ctl_be_block_ioctl(struct cdev *dev, u_l
case CTL_LUNREQ_RM:
error = ctl_be_block_rm(softc, lun_req);

svn commit: r232609 - head/tools/test/netfibs

2012-03-06 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Mar  6 14:19:36 2012
New Revision: 232609
URL: http://svn.freebsd.org/changeset/base/232609

Log:
  Use = rather than == for expressions to test(1) builtin(1) in sh(1) to
  comply with standards.
  
  On modern branches there is an undocumented alias (see r219084) but on
  stable/7 this is still an error.
  
  Sponsored by: Cisco Systems, Inc.
  MFC after:3 days

Modified:
  head/tools/test/netfibs/initiator.sh

Modified: head/tools/test/netfibs/initiator.sh
==
--- head/tools/test/netfibs/initiator.shTue Mar  6 14:18:54 2012
(r232608)
+++ head/tools/test/netfibs/initiator.shTue Mar  6 14:19:36 2012
(r232609)
@@ -410,7 +410,7 @@ testtx_ulp6_connected()
*) _f=SETFIB ;;
esac
 
-   if test ${_o} == -i -a ${_f} == SO_SETFIB; then
+   if test ${_o} = -i -a ${_f} = SO_SETFIB; then
print_debug Skipping icmp6 tests for SO_SETFIB.
return 0
fi
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r232570 - head/sys/boot/i386/boot2

2012-03-06 Thread John Baldwin
On Tuesday, March 06, 2012 6:34:42 am Dimitry Andric wrote:
 On 2012-03-05 20:53, John Baldwin wrote:
  Author: jhb
  Date: Mon Mar  5 19:53:17 2012
  New Revision: 232570
  URL: http://svn.freebsd.org/changeset/base/232570
  
  Log:
Fix boot2 to handle boot config files that only contain a custom path to
a loader or kernel.  Specifically, kname cannot be pointed at cmd[] since
it's value is change to be an empty string after the initial call to
parse, and cmd[]'s value can be changed (thus losing a prior setting for
kname) due to user input at the boot prompt.  While here, ensure that that
initial boot config file text is nul-terminated, that ops is initialized
to zero, and that kname is always initialized to a valid string.
 
 Sigh, this broke building boot2 with clang again... :(

I only put back 1 of the memcpy's instead of 3 to try to make it as small as
possible. :(  The problem is the last round of changes to shrink it broke
functionality.

-- 
John Baldwin
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232613 - head/usr.sbin/jls

2012-03-06 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Mar  6 18:39:07 2012
New Revision: 232613
URL: http://svn.freebsd.org/changeset/base/232613

Log:
  Fix building with WITHOUT_INET_SUPPORT set.
  
  Reviewed by:  jamie (actually provided the real fix)
  MFC after:3 days

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

Modified: head/usr.sbin/jls/jls.c
==
--- head/usr.sbin/jls/jls.c Tue Mar  6 17:17:03 2012(r232612)
+++ head/usr.sbin/jls/jls.c Tue Mar  6 18:39:07 2012(r232613)
@@ -403,11 +403,13 @@ print_jail(int pflags, int jflags)
 #ifdef INET
(!ip4_ok || params[1].jp_valuelen == 0) ? -
: inet_ntoa(*(struct in_addr *)params[1].jp_value),
+   (char *)params[2-!ip4_ok].jp_value,
+   (char *)params[3-!ip4_ok].jp_value);
 #else
-,
+   (char *)params[1].jp_value,
+   (char *)params[2].jp_value);
 #endif
-   (char *)params[2-!ip4_ok].jp_value,
-   (char *)params[3-!ip4_ok].jp_value);
else {
param_values = alloca(nparams * sizeof(*param_values));
for (i = 0; i  nparams; i++) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232614 - in head: share/man/man4 sys/amd64/conf sys/boot/forth sys/conf sys/dev/wbwd sys/i386/conf sys/modules sys/modules/wbwd

2012-03-06 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Mar  6 18:44:52 2012
New Revision: 232614
URL: http://svn.freebsd.org/changeset/base/232614

Log:
  Provide wbwd(4), a driver for the watchdog timer found on various
  Winbond Super I/O chips.
  
  With minor efforts it should be possible the extend the driver to support
  further chips/revisions available from Winbond.  In the simplest case
  only new IDs need to be added, while different chipsets might require
  their own function to enter extended function mode, etc.
  
  Sponsored by: Sandvine Incorporated ULC (in 2011)
  Reviewed by:  emaste, brueffer
  MFC after:2 weeks

Added:
  head/share/man/man4/wbwd.4   (contents, props changed)
  head/sys/dev/wbwd/
  head/sys/dev/wbwd/wbwd.c   (contents, props changed)
  head/sys/modules/wbwd/
  head/sys/modules/wbwd/Makefile   (contents, props changed)
Modified:
  head/sys/amd64/conf/GENERIC.hints
  head/sys/amd64/conf/NOTES
  head/sys/boot/forth/loader.conf
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/i386/conf/GENERIC.hints
  head/sys/i386/conf/NOTES
  head/sys/modules/Makefile

Added: head/share/man/man4/wbwd.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/wbwd.4  Tue Mar  6 18:44:52 2012(r232614)
@@ -0,0 +1,117 @@
+.\-
+.\ Copyright (c) 2012 Bjoern A. Zeeb b...@freebsd.org
+.\ All rights reserved.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\ ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\ SUCH DAMAGE.
+.\
+.\ $FreeBSD$
+.\
+.Dd March 6, 2012
+.Dt wbwd 4
+.Os
+.Sh NAME
+.Nm wbwd
+.Nd device driver for watchdog timer found on Winbond Super I/O chips
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd device wbwd
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the following
+line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+wbwd_load=YES
+.Ed
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.wbwd.0.at=isa
+.Sh DESCRIPTION
+The
+.Nm
+driver provides
+.Xr watchdog 4
+support for the watchdog interrupt timer present on at least the following
+Winbond Super I/O chips:
+.Pp
+.Bl -bullet -compact
+.It
+83627HF/F/HG/G Rev. G
+.It
+83627HF/F/HG/G Rev. J
+.It
+83627HF/F/HG/G Rev. UD-A
+.It
+83627DHG IC ver. 5
+.El
+.Sh SYSCTL VARIABLES
+The
+.Nm
+driver provides the following options as
+.Xr sysctl 8
+variables.
+.Bl -tag -width xx  
+.It Va dev.wbwd.0.timeout_override
+This variable allows to program the timer to a value independent on the one
+provided by the
+.Xr watchdog 4
+framework while still relying on the regular updates from e.g.
+.Xr watchdogd 8 .
+This is particularly useful if your system provides multiple watchdogs and
+you want them to fire in a special sequence to trigger an NMI after a shorter
+period than the reset timeout for example.
+The value set must not be lower than the sleep time of
+.Xr watchdogd 8 .
+A value of 0 disables this feature and the timeout value provided by
+.Xr watchdog 4
+will be used.
+.It Va dev.wbwd.0.debug_verbose
+If set this sysctl will tell the driver to log its current state before and
+after the timer reset on each invocation from
+.Xr watchdog 9
+to the kernel message buffer for debugging.
+.It Va dev.wbwd.0.debug
+This read-only value gives the state of some registers on last update.
+.El
+.Pp
+The
+.Nm
+driver also provides further sysctl options that are hidden by default.
+See the source code for more information.
+.Sh SEE ALSO
+.Xr watchdog 4 ,
+.Xr device.hints 5 ,
+.Xr watchdog 8 ,
+.Xr watchdogd 8 ,
+.Xr watchdog 9
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 10.0 .
+.Sh AUTHORS
+.An -nosplit
+This manual page was 

Re: svn commit: r232614 - in head: share/man/man4 sys/amd64/conf sys/boot/forth sys/conf sys/dev/wbwd sys/i386/conf sys/modules sys/modules/wbwd

2012-03-06 Thread Bjoern A. Zeeb
On 6. Mar 2012, at 18:44 , Bjoern A. Zeeb wrote:

 Author: bz
 Date: Tue Mar  6 18:44:52 2012
 New Revision: 232614
 URL: http://svn.freebsd.org/changeset/base/232614
 
 Log:
  Provide wbwd(4), a driver for the watchdog timer found on various
  Winbond Super I/O chips.

The supported chips can be found on a variety of motherboards.  I have
especially seen it on SuperMicro.  Some of these (like X8DT3) provide
a jumper to set whether the watchdog would trigger an NMI or a reset 
(or be disabled).  Some others only distinguish between disabled and
reset.

It's been tested on at least SM X7SPA-HF, H8QM8 and X8DT3 etc.

/bz

-- 
Bjoern A. Zeeb You have to have visions!
   It does not matter how good you are. It matters what good you do!

___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232615 - in head/sys/mips: include mips sibyte

2012-03-06 Thread Juli Mallett
Author: jmallett
Date: Tue Mar  6 19:01:32 2012
New Revision: 232615
URL: http://svn.freebsd.org/changeset/base/232615

Log:
  At the risk of reducing source compatibility with old NetBSD and Sprite:
  o) Get rid of some unused macros related to features we don't intend to
 provide.
  o) Get rid of macro definitions for MIPS-I CPUs.  We are not likely to
 support anything that predartes MIPS-III.
  o) Respell MIPS3_* macros as MIPS_*, which is how most of them were being
 used already.
  o) Eliminate a duplicate and mostly-unused set of exception vector macros.
  
  There's still considerable duplication and lots more obsolete in our headers,
  but this reduces one of the larger files to a size where one could reckon
  about the correctness of its contents with a mere few hours of contemplation.
  
  There is, of course, a question of whether we need definitions for fields,
  registers and configurations that we are unlikely to ever use or implement,
  even if they're not obsolete since 1991.  FreeBSD is not a processor
  reference manual, and things that aren't used may be wrong, or may be
  duplicated because nobody could possibly actually know whether they're
  already defined.

Modified:
  head/sys/mips/include/asm.h
  head/sys/mips/include/cpuregs.h
  head/sys/mips/include/locore.h
  head/sys/mips/mips/cpu.c
  head/sys/mips/mips/exception.S
  head/sys/mips/mips/locore.S
  head/sys/mips/mips/machdep.c
  head/sys/mips/mips/support.S
  head/sys/mips/mips/trap.c
  head/sys/mips/sibyte/sb_machdep.c

Modified: head/sys/mips/include/asm.h
==
--- head/sys/mips/include/asm.h Tue Mar  6 18:44:52 2012(r232614)
+++ head/sys/mips/include/asm.h Tue Mar  6 19:01:32 2012(r232615)
@@ -765,29 +765,6 @@ _C_LABEL(x):
:   /* no  outputs */   \
: r (data), i (spr), i (sel)); /* inputs */
 
-/*
- * The DYNAMIC_STATUS_MASK option adds an additional masking operation
- * when updating the hardware interrupt mask in the status register.
- *
- * This is useful for platforms that need to at run-time mask
- * interrupts based on motherboard configuration or to handle
- * slowly clearing interrupts.
- *
- * XXX this is only currently implemented for mips3.
- */
-#ifdef MIPS_DYNAMIC_STATUS_MASK
-#defineDYNAMIC_STATUS_MASK(sr,scratch) \
-   lw  scratch, mips_dynamic_status_mask;  \
-   and sr, sr, scratch
-
-#defineDYNAMIC_STATUS_MASK_TOUSER(sr,scratch1) \
-   ori sr, (MIPS_INT_MASK | MIPS_SR_INT_IE);   \
-   DYNAMIC_STATUS_MASK(sr,scratch1)
-#else
-#defineDYNAMIC_STATUS_MASK(sr,scratch)
-#defineDYNAMIC_STATUS_MASK_TOUSER(sr,scratch1)
-#endif
-
 #defineGET_CPU_PCPU(reg)   \
PTR_L   reg, _C_LABEL(pcpup);
 

Modified: head/sys/mips/include/cpuregs.h
==
--- head/sys/mips/include/cpuregs.h Tue Mar  6 18:44:52 2012
(r232614)
+++ head/sys/mips/include/cpuregs.h Tue Mar  6 19:01:32 2012
(r232615)
@@ -229,8 +229,7 @@
  */
 #defineMIPS_CR_BR_DELAY0x8000
 #defineMIPS_CR_COP_ERR 0x3000
-#defineMIPS1_CR_EXC_CODE   0x003C  /* four bits */
-#defineMIPS3_CR_EXC_CODE   0x007C  /* five bits */
+#defineMIPS_CR_EXC_CODE0x007C  /* five bits */
 #defineMIPS_CR_IP  0xFF00
 #defineMIPS_CR_EXC_CODE_SHIFT  2
 #defineMIPS_CR_COP_ERR_SHIFT   28
@@ -268,94 +267,31 @@
 #define MIPS_SR_INT_MASK   0xff00
 
 /*
- * The R2000/R3000-specific status register bit definitions.
- * all bits are active when set to 1.
- *
- * MIPS_SR_PARITY_ERR  Parity error.
- * MIPS_SR_CACHE_MISS  Most recent D-cache load resulted in a miss.
- * MIPS_SR_PARITY_ZERO Zero replaces outgoing parity bits.
- * MIPS_SR_SWAP_CACHES Swap I-cache and D-cache.
- * MIPS_SR_ISOL_CACHES Isolate D-cache from main memory.
- * Interrupt enable bits defined below.
- * MIPS_SR_KU_OLD  Old kernel/user mode bit. 1 = user mode.
- * MIPS_SR_INT_ENA_OLD Old interrupt enable bit.
- * MIPS_SR_KU_PREV Previous kernel/user mode bit. 1 = user mode.
- * MIPS_SR_INT_ENA_PREVPrevious interrupt enable bit.
- * MIPS_SR_KU_CUR  Current kernel/user mode bit. 1 = user mode.
- */
-
-#defineMIPS1_PARITY_ERR0x0010
-#defineMIPS1_CACHE_MISS0x0008
-#defineMIPS1_PARITY_ZERO   0x0004
-#defineMIPS1_SWAP_CACHES   0x0002
-#defineMIPS1_ISOL_CACHES   0x0001
-
-#defineMIPS1_SR_KU_OLD 0x0020  /* 2nd stacked KU/IE*/
-#defineMIPS1_SR_INT_ENA_OLD0x0010  /* 

svn commit: r232616 - head/lib/csu/mips

2012-03-06 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Mar  6 19:19:33 2012
New Revision: 232616
URL: http://svn.freebsd.org/changeset/base/232616

Log:
  - Remove one more no-op #ifndef

Modified:
  head/lib/csu/mips/crt1.c

Modified: head/lib/csu/mips/crt1.c
==
--- head/lib/csu/mips/crt1.cTue Mar  6 19:01:32 2012(r232615)
+++ head/lib/csu/mips/crt1.cTue Mar  6 19:19:33 2012(r232616)
@@ -101,9 +101,7 @@ __start(char **ap,
 #ifdef GCRT
monstartup(eprol, etext);
 #endif
-#ifndef NOGPREL
_init();
-#endif
exit( main(argc, argv, env) );
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232620 - in head/include: . xlocale

2012-03-06 Thread Dimitry Andric
Author: dim
Date: Tue Mar  6 20:15:23 2012
New Revision: 232620
URL: http://svn.freebsd.org/changeset/base/232620

Log:
  After r232498, programs built with -ansi or -std=c89 including ctype.h
  would not compile anymore, due to plain 'inline' keywords.  Fix this by
  using __inline instead.
  
  Reported by:  Jia-Shiun Li jiash...@gmail.com
  Discussed with:   theraven

Modified:
  head/include/runetype.h
  head/include/xlocale/_ctype.h

Modified: head/include/runetype.h
==
--- head/include/runetype.h Tue Mar  6 20:01:25 2012(r232619)
+++ head/include/runetype.h Tue Mar  6 20:15:23 2012(r232620)
@@ -90,7 +90,7 @@ extern const _RuneLocale *_CurrentRuneLo
 extern const _RuneLocale *__getCurrentRuneLocale(void);
 #else
 extern _Thread_local const _RuneLocale *_ThreadRuneLocale;
-static inline const _RuneLocale *__getCurrentRuneLocale(void)
+static __inline const _RuneLocale *__getCurrentRuneLocale(void)
 {
 
if (_ThreadRuneLocale) 

Modified: head/include/xlocale/_ctype.h
==
--- head/include/xlocale/_ctype.h   Tue Mar  6 20:01:25 2012
(r232619)
+++ head/include/xlocale/_ctype.h   Tue Mar  6 20:15:23 2012
(r232620)
@@ -55,11 +55,11 @@ _RuneLocale *__runes_for_locale(locale_t
 #ifndef _XLOCALE_INLINE
 #if __GNUC__  !__GNUC_STDC_INLINE__
 /* GNU89 inline has nonstandard semantics. */
-#define _XLOCALE_INLINE extern inline
+#define _XLOCALE_INLINE extern __inline
 #else
 /* Hack to work around people who define inline away */
 #ifdef inline
-#define _XLOCALE_INLINE __inline static
+#define _XLOCALE_INLINE static __inline
 #else
 /* Define with C++ / C99 compatible semantics */
 #define _XLOCALE_INLINE inline
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232621 - head/sys/mips/mips

2012-03-06 Thread Juli Mallett
Author: jmallett
Date: Tue Mar  6 20:23:29 2012
New Revision: 232621
URL: http://svn.freebsd.org/changeset/base/232621

Log:
  Remove unused file.

Deleted:
  head/sys/mips/mips/elf64_machdep.c
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232623 - head/sys/boot/i386/boot2

2012-03-06 Thread John Baldwin
Author: jhb
Date: Tue Mar  6 20:45:13 2012
New Revision: 232623
URL: http://svn.freebsd.org/changeset/base/232623

Log:
  Add a note to clarify why we create a relocated copy of boot1 in lower
  memory.

Modified:
  head/sys/boot/i386/boot2/boot1.S

Modified: head/sys/boot/i386/boot2/boot1.S
==
--- head/sys/boot/i386/boot2/boot1.STue Mar  6 20:37:06 2012
(r232622)
+++ head/sys/boot/i386/boot2/boot1.STue Mar  6 20:45:13 2012
(r232623)
@@ -125,7 +125,10 @@ main:  cld # 
String ops inc
mov $start,%sp  #  stack
 /*
  * Relocate ourself to MEM_REL.  Since %cx == 0, the inc %ch sets
- * %cx == 0x100.
+ * %cx == 0x100.  Note that boot1 does not use this relocated copy
+ * of itself while loading boot2; however, BTX reclaims the memory
+ * used by boot1 during its initialization.  As a result, boot2 uses
+ * xread from the relocated copy.
  */
mov %sp,%si # Source
mov $MEM_REL,%di# Destination
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232625 - head/sys/net80211

2012-03-06 Thread Adrian Chadd
Author: adrian
Date: Tue Mar  6 21:20:16 2012
New Revision: 232625
URL: http://svn.freebsd.org/changeset/base/232625

Log:
  Modify HWMP to be able to allocate memory for PREQ/PREP/PERR for all 
scenarios.
  
  * Added verify_mesh_*_len functions that verify the length
according to the amendment spec and return number of destination addresses
for allocation of appropriate struct size in memory;
  * Modified hwmp_recv_action_meshpath to allocate HWMP ie instead of
storing them on the stack and store all available field according the flags;
  * Modify hwmp_add_mesh* to work with all cases of HWMP according to amendment.
  * Modify hwmp_send_* to calculate correct len of bytes for the HWMP ie.
  * Added new M_80211_MESH_* malloc defines.
  * Added macros with magic numbers for HWMP ie sizes according to amendment.
  * Added the external address to all HWMP ie structs.
  
  Submitted by: montha...@gmail.com

Modified:
  head/sys/net80211/ieee80211_hwmp.c
  head/sys/net80211/ieee80211_mesh.c
  head/sys/net80211/ieee80211_mesh.h

Modified: head/sys/net80211/ieee80211_hwmp.c
==
--- head/sys/net80211/ieee80211_hwmp.c  Tue Mar  6 21:13:12 2012
(r232624)
+++ head/sys/net80211/ieee80211_hwmp.c  Tue Mar  6 21:20:16 2012
(r232625)
@@ -279,17 +279,114 @@ hwmp_newstate(struct ieee80211vap *vap, 
return 0;
 }
 
+/*
+ * Verify the length of an HWMP PREQ and return the number
+ * of destinations = 1, if verification fails -1 is returned.
+ */
+static int
+verify_mesh_preq_len(struct ieee80211vap *vap,
+const struct ieee80211_frame *wh, const uint8_t *iefrm)
+{
+   int alloc_sz = -1;
+   int ndest = -1;
+   if (iefrm[2]  IEEE80211_MESHPREQ_FLAGS_AE) {
+   /* Originator External Address  present */
+   alloc_sz =  IEEE80211_MESHPREQ_BASE_SZ_AE;
+   ndest = iefrm[IEEE80211_MESHPREQ_TCNT_OFFSET_AE];
+   } else {
+   /* w/o Originator External Address */
+   alloc_sz =  IEEE80211_MESHPREQ_BASE_SZ;
+   ndest = iefrm[IEEE80211_MESHPREQ_TCNT_OFFSET];
+   }
+   alloc_sz += ndest * IEEE80211_MESHPREQ_TRGT_SZ;
+
+   if(iefrm[1] != (alloc_sz)) {
+   IEEE80211_DISCARD(vap,
+   IEEE80211_MSG_ACTION | IEEE80211_MSG_HWMP,
+   wh, NULL, PREQ (AE=%s) with wrong len,
+   iefrm[2]  IEEE80211_MESHPREQ_FLAGS_AE ? 1 : 0);
+   return (-1);
+   }
+   return ndest;
+}
+
+/*
+ * Verify the length of an HWMP PREP and returns 1 on success,
+ * otherwise -1.
+ */
+static int
+verify_mesh_prep_len(struct ieee80211vap *vap,
+const struct ieee80211_frame *wh, const uint8_t *iefrm)
+{
+   int alloc_sz = -1;
+   if (iefrm[2]  IEEE80211_MESHPREP_FLAGS_AE) {
+   if (iefrm[1] == IEEE80211_MESHPREP_BASE_SZ_AE)
+   alloc_sz = IEEE80211_MESHPREP_BASE_SZ_AE;
+   } else if (iefrm[1] == IEEE80211_MESHPREP_BASE_SZ)
+   alloc_sz = IEEE80211_MESHPREP_BASE_SZ;
+   if(alloc_sz  0) {
+   IEEE80211_DISCARD(vap,
+   IEEE80211_MSG_ACTION | IEEE80211_MSG_HWMP,
+   wh, NULL, PREP (AE=%s) with wrong len,
+   iefrm[2]  IEEE80211_MESHPREP_FLAGS_AE ? 1 : 0);
+   return (-1);
+   }
+   return (1);
+}
+
+/*
+ * Verify the length of an HWMP PERR and return the number
+ * of destinations = 1, if verification fails -1 is returned.
+ */
+static int
+verify_mesh_perr_len(struct ieee80211vap *vap,
+const struct ieee80211_frame *wh, const uint8_t *iefrm)
+{
+   int alloc_sz = -1;
+   const uint8_t *iefrm_t = iefrm;
+   uint8_t ndest = iefrm_t[IEEE80211_MESHPERR_NDEST_OFFSET];
+   int i;
+
+   if(ndest  IEEE80211_MESHPERR_MAXDEST) {
+   IEEE80211_DISCARD(vap,
+   IEEE80211_MSG_ACTION | IEEE80211_MSG_HWMP,
+   wh, NULL, PERR with wrong number of destionat (19), %u,
+   ndest);
+   return (-1);
+   }
+
+   iefrm_t += IEEE80211_MESHPERR_NDEST_OFFSET + 1; /* flag is next field */
+   /* We need to check each destionation flag to know size */
+   for(i = 0; indest; i++) {
+   if ((*iefrm_t)  IEEE80211_MESHPERR_FLAGS_AE)
+   iefrm_t += IEEE80211_MESHPERR_DEST_SZ_AE;
+   else
+   iefrm_t += IEEE80211_MESHPERR_DEST_SZ;
+   }
+
+   alloc_sz = (iefrm_t - iefrm) - 2; /* action + code */
+   if(alloc_sz !=  iefrm[1]) {
+   IEEE80211_DISCARD(vap,
+   IEEE80211_MSG_ACTION | IEEE80211_MSG_HWMP,
+   wh, NULL, %s, PERR with wrong len);
+   return (-1);
+   }
+   return ndest;
+}
+
 static int
 hwmp_recv_action_meshpath(struct ieee80211_node *ni,
const struct ieee80211_frame *wh,
const uint8_t *frm, const uint8_t 

svn commit: r232627 - head/sys/mips/atheros

2012-03-06 Thread Aleksandr Rybalko
Author: ray
Date: Tue Mar  6 22:16:10 2012
New Revision: 232627
URL: http://svn.freebsd.org/changeset/base/232627

Log:
  Remove EoL whitespaces.
  
  Approved by:  adri (mentor)

Modified:
  head/sys/mips/atheros/if_arge.c

Modified: head/sys/mips/atheros/if_arge.c
==
--- head/sys/mips/atheros/if_arge.c Tue Mar  6 21:56:30 2012
(r232626)
+++ head/sys/mips/atheros/if_arge.c Tue Mar  6 22:16:10 2012
(r232627)
@@ -175,7 +175,7 @@ DRIVER_MODULE(arge, nexus, arge_driver, 
 DRIVER_MODULE(miibus, arge, miibus_driver, miibus_devclass, 0, 0);
 
 /*
- * RedBoot passes MAC address to entry point as environment 
+ * RedBoot passes MAC address to entry point as environment
  * variable. platfrom_start parses it and stores in this variable
  */
 extern uint32_t ar711_base_mac[ETHER_ADDR_LEN];
@@ -184,9 +184,8 @@ static struct mtx miibus_mtx;
 
 MTX_SYSINIT(miibus_mtx, miibus_mtx, arge mii lock, MTX_DEF);
 
-
 /*
- * Flushes all 
+ * Flushes all
  */
 static void
 arge_flush_ddr(struct arge_softc *sc)
@@ -195,7 +194,7 @@ arge_flush_ddr(struct arge_softc *sc)
ar71xx_device_flush_ddr_ge(sc-arge_mac_unit);
 }
 
-static int 
+static int
 arge_probe(device_t dev)
 {
 
@@ -260,7 +259,7 @@ arge_attach(device_t dev)
 * in CPU address space.
 */
if (sc-arge_mac_unit == 0 
-   resource_long_value(device_get_name(dev), device_get_unit(dev), 
+   resource_long_value(device_get_name(dev), device_get_unit(dev),
eeprommac, eeprom_mac_addr) == 0) {
int i;
const char *mac = (const char *) 
MIPS_PHYS_TO_KSEG1(eeprom_mac_addr);
@@ -270,17 +269,17 @@ arge_attach(device_t dev)
}
}
 
-   KASSERT(((sc-arge_mac_unit == 0) || (sc-arge_mac_unit == 1)), 
+   KASSERT(((sc-arge_mac_unit == 0) || (sc-arge_mac_unit == 1)),
(if_arge: Only MAC0 and MAC1 supported));
 
/*
 *  Get which PHY of 5 available we should use for this unit
 */
-   if (resource_int_value(device_get_name(dev), device_get_unit(dev), 
+   if (resource_int_value(device_get_name(dev), device_get_unit(dev),
phymask, phymask) != 0) {
/*
-* Use port 4 (WAN) for GE0. For any other port use 
-* its PHY the same as its unit number 
+* Use port 4 (WAN) for GE0. For any other port use
+* its PHY the same as its unit number
 */
if (sc-arge_mac_unit == 0)
phymask = (1  4);
@@ -292,10 +291,10 @@ arge_attach(device_t dev)
}
 
/*
-*  Get default media  duplex mode, by default its Base100T 
+*  Get default media  duplex mode, by default its Base100T
 *  and full duplex
 */
-   if (resource_int_value(device_get_name(dev), device_get_unit(dev), 
+   if (resource_int_value(device_get_name(dev), device_get_unit(dev),
media, hint) != 0)
hint = 0;
 
@@ -304,7 +303,7 @@ arge_attach(device_t dev)
else
sc-arge_media_type = IFM_100_TX;
 
-   if (resource_int_value(device_get_name(dev), device_get_unit(dev), 
+   if (resource_int_value(device_get_name(dev), device_get_unit(dev),
fduplex, hint) != 0)
hint = 1;
 
@@ -322,7 +321,7 @@ arge_attach(device_t dev)
 
/* Map control/status registers. */
sc-arge_rid = 0;
-   sc-arge_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, 
+   sc-arge_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
sc-arge_rid, RF_ACTIVE);
 
if (sc-arge_res == NULL) {
@@ -333,7 +332,7 @@ arge_attach(device_t dev)
 
/* Allocate interrupts */
rid = 0;
-   sc-arge_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, rid, 
+   sc-arge_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, rid,
RF_SHAREABLE | RF_ACTIVE);
 
if (sc-arge_irq == NULL) {
@@ -381,7 +380,7 @@ arge_attach(device_t dev)
 * No MAC address configured. Generate the random one.
 */
if  (bootverbose)
-   device_printf(dev, 
+   device_printf(dev,
Generating random ethernet address.\n);
 
rnd = arc4random();
@@ -402,7 +401,7 @@ arge_attach(device_t dev)
}
 
/* Initialize the MAC block */
-   
+
/* Step 1. Soft-reset MAC */
ARGE_SET_BITS(sc, AR71XX_MAC_CFG1, MAC_CFG1_SOFT_RESET);
DELAY(20);
@@ -413,7 +412,7 @@ arge_attach(device_t dev)
ar71xx_device_start(sc-arge_mac_unit == 0 ? RST_RESET_GE0_MAC : 
RST_RESET_GE1_MAC);
 
/* Step 3. Reconfigure MAC block */
-   ARGE_WRITE(sc, AR71XX_MAC_CFG1, 
+   ARGE_WRITE(sc, AR71XX_MAC_CFG1,
MAC_CFG1_SYNC_RX | MAC_CFG1_RX_ENABLE |

svn commit: r232628 - head/sys/mips/atheros

2012-03-06 Thread Aleksandr Rybalko
Author: ray
Date: Tue Mar  6 22:45:54 2012
New Revision: 232628
URL: http://svn.freebsd.org/changeset/base/232628

Log:
  Break long lines.
  
  Approved by:  adri (mentor)

Modified:
  head/sys/mips/atheros/if_arge.c

Modified: head/sys/mips/atheros/if_arge.c
==
--- head/sys/mips/atheros/if_arge.c Tue Mar  6 22:16:10 2012
(r232627)
+++ head/sys/mips/atheros/if_arge.c Tue Mar  6 22:45:54 2012
(r232628)
@@ -220,8 +220,8 @@ arge_attach_sysctl(device_t dev)
number of TX aligned packets);
 
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
-   tx_pkts_unaligned, CTLFLAG_RW, sc-stats.tx_pkts_unaligned, 
0,
-   number of TX unaligned packets);
+   tx_pkts_unaligned, CTLFLAG_RW, sc-stats.tx_pkts_unaligned,
+   0, number of TX unaligned packets);
 
 #ifdef ARGE_DEBUG
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, tx_prod,
@@ -262,7 +262,8 @@ arge_attach(device_t dev)
resource_long_value(device_get_name(dev), device_get_unit(dev),
eeprommac, eeprom_mac_addr) == 0) {
int i;
-   const char *mac = (const char *) 
MIPS_PHYS_TO_KSEG1(eeprom_mac_addr);
+   const char *mac =
+   (const char *) MIPS_PHYS_TO_KSEG1(eeprom_mac_addr);
device_printf(dev, Overriding MAC from EEPROM\n);
for (i = 0; i  6; i++) {
ar711_base_mac[i] = mac[i];
@@ -287,7 +288,8 @@ arge_attach(device_t dev)
/* Use all phys up to 4 */
phymask = (1  4) - 1;
 
-   device_printf(dev, No PHY specified, using mask %d\n, 
phymask);
+   device_printf(dev, No PHY specified, using mask %d\n,
+   phymask);
}
 
/*
@@ -407,9 +409,11 @@ arge_attach(device_t dev)
DELAY(20);
 
/* Step 2. Punt the MAC core from the central reset register */
-   ar71xx_device_stop(sc-arge_mac_unit == 0 ? RST_RESET_GE0_MAC : 
RST_RESET_GE1_MAC);
+   ar71xx_device_stop(sc-arge_mac_unit == 0 ? RST_RESET_GE0_MAC :
+   RST_RESET_GE1_MAC);
DELAY(100);
-   ar71xx_device_start(sc-arge_mac_unit == 0 ? RST_RESET_GE0_MAC : 
RST_RESET_GE1_MAC);
+   ar71xx_device_start(sc-arge_mac_unit == 0 ? RST_RESET_GE0_MAC :
+   RST_RESET_GE1_MAC);
 
/* Step 3. Reconfigure MAC block */
ARGE_WRITE(sc, AR71XX_MAC_CFG1,
@@ -433,7 +437,7 @@ arge_attach(device_t dev)
 * set all four addresses to 66-88-aa-cc-dd-ee
 */
ARGE_WRITE(sc, AR71XX_MAC_STA_ADDR1,
-   (eaddr[2]  24) | (eaddr[3]  16) | (eaddr[4]  8)  | eaddr[5]);
+   (eaddr[2]  24) | (eaddr[3]  16) | (eaddr[4]  8) | eaddr[5]);
ARGE_WRITE(sc, AR71XX_MAC_STA_ADDR2, (eaddr[0]  8) | eaddr[1]);
 
ARGE_WRITE(sc, AR71XX_MAC_FIFO_CFG0,
@@ -521,7 +525,8 @@ arge_detach(device_t dev)
struct arge_softc   *sc = device_get_softc(dev);
struct ifnet*ifp = sc-arge_ifp;
 
-   KASSERT(mtx_initialized(sc-arge_mtx), (arge mutex not initialized));
+   KASSERT(mtx_initialized(sc-arge_mtx),
+   (arge mutex not initialized));
 
/* These should only be active if attach succeeded */
if (device_is_attached(dev)) {
@@ -623,8 +628,9 @@ arge_miibus_readreg(device_t dev, int ph
ARGE_MII_WRITE(AR71XX_MAC_MII_CMD, MAC_MII_CMD_WRITE);
mtx_unlock(miibus_mtx);
 
-   ARGEDEBUG(sc, ARGE_DBG_MII, %s: phy=%d, reg=%02x, value[%08x]=%04x\n, 
__func__,
-phy, reg, addr, result);
+   ARGEDEBUG(sc, ARGE_DBG_MII,
+   %s: phy=%d, reg=%02x, value[%08x]=%04x\n,
+   __func__, phy, reg, addr, result);
 
return (result);
 }
@@ -641,8 +647,8 @@ arge_miibus_writereg(device_t dev, int p
if ((sc-arge_phymask   (1  phy)) == 0)
return (-1);
 
-   ARGEDEBUG(sc, ARGE_DBG_MII, %s: phy=%d, reg=%02x, value=%04x\n, 
__func__,
-   phy, reg, data);
+   ARGEDEBUG(sc, ARGE_DBG_MII, %s: phy=%d, reg=%02x, value=%04x\n,
+   __func__, phy, reg, data);
 
mtx_lock(miibus_mtx);
ARGE_MII_WRITE(AR71XX_MAC_MII_ADDR, addr);
@@ -979,7 +985,8 @@ arge_encap(struct arge_softc *sc, struct
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
/* Start transmitting */
-   ARGEDEBUG(sc, ARGE_DBG_TX, %s: setting DMA_TX_CONTROL_EN\n, __func__);
+   ARGEDEBUG(sc, ARGE_DBG_TX, %s: setting DMA_TX_CONTROL_EN\n,
+   __func__);
ARGE_WRITE(sc, AR71XX_DMA_TX_CONTROL, DMA_TX_CONTROL_EN);
return (0);
 }
@@ -1022,8 +1029,10 @@ arge_start_locked(struct ifnet *ifp)
 */
if (sc-arge_cdata.arge_tx_cnt = ARGE_TX_RING_COUNT - 2) {
ifp-if_drv_flags |= IFF_DRV_OACTIVE;
-   ARGEDEBUG(sc, ARGE_DBG_ERR, %s: tx_cnt %d = max %d; setting 

svn commit: r232629 - in head: sbin/ifconfig sys/net

2012-03-06 Thread Andrew Thompson
Author: thompsa
Date: Tue Mar  6 22:58:13 2012
New Revision: 232629
URL: http://svn.freebsd.org/changeset/base/232629

Log:
  Add the ability to set which packet layers are used for the load balance hash
  calculation.

Modified:
  head/sbin/ifconfig/ifconfig.8
  head/sbin/ifconfig/iflagg.c
  head/sys/net/ieee8023ad_lacp.c
  head/sys/net/if_lagg.c
  head/sys/net/if_lagg.h

Modified: head/sbin/ifconfig/ifconfig.8
==
--- head/sbin/ifconfig/ifconfig.8   Tue Mar  6 22:45:54 2012
(r232628)
+++ head/sbin/ifconfig/ifconfig.8   Tue Mar  6 22:58:13 2012
(r232629)
@@ -2309,6 +2309,21 @@ Set the aggregation protocol.
 The default is failover.
 The available options are failover, fec, lacp, loadbalance, roundrobin and
 none.
+.It Cm lagghash Ar option Ns Oo , Ns Ar option Oc
+Set the packet layers to hash for aggregation protocols which load balance.
+The default is
+.Dq l2,l3,l4 .
+The options can be combined using commas.
+.Pp
+.Bl -tag -width .Cm l2 -compact
+.It Cm l2
+src/dst mac address and optional vlan number.
+.It Cm l3
+src/dst address for IPv4 or IPv6.
+.It Cm l4
+src/dst port for TCP/UCP/SCTP.
+.El
+.Pp
 .El
 .Pp
 The following parameters are specific to IP tunnel interfaces,

Modified: head/sbin/ifconfig/iflagg.c
==
--- head/sbin/ifconfig/iflagg.c Tue Mar  6 22:45:54 2012(r232628)
+++ head/sbin/ifconfig/iflagg.c Tue Mar  6 22:58:13 2012(r232629)
@@ -81,6 +81,36 @@ setlaggproto(const char *val, int d, int
err(1, SIOCSLAGG);
 }
 
+static void
+setlagghash(const char *val, int d, int s, const struct afswtch *afp)
+{
+   struct lagg_reqflags rf;
+   char *str, *tmp, *tok;
+
+
+   rf.rf_flags = 0;
+   str = tmp = strdup(val);
+   while ((tok = strsep(tmp, ,)) != NULL) {
+   if (strcmp(tok, l2) == 0)
+   rf.rf_flags |= LAGG_F_HASHL2;
+   else if (strcmp(tok, l3) == 0)
+   rf.rf_flags |= LAGG_F_HASHL3;
+   else if (strcmp(tok, l4) == 0)
+   rf.rf_flags |= LAGG_F_HASHL4;
+   else  {
+   free(str);
+   errx(1, Invalid lagghash option: %s, tok);
+   }
+   }
+   free(str);
+   if (rf.rf_flags == 0)
+   errx(1, No lagghash options supplied);
+
+   strlcpy(rf.rf_ifname, name, sizeof(rf.rf_ifname));
+   if (ioctl(s, SIOCSLAGGHASH, rf))
+   err(1, SIOCSLAGGHASH);
+}
+
 static char *
 lacp_format_mac(const uint8_t *mac, char *buf, size_t buflen)
 {
@@ -115,6 +145,7 @@ lagg_status(int s)
struct lagg_protos lpr[] = LAGG_PROTOS;
struct lagg_reqport rp, rpbuf[LAGG_MAX_PORTS];
struct lagg_reqall ra;
+   struct lagg_reqflags rf;
struct lacp_opreq *lp;
const char *proto = unknown;
int i, isport = 0;
@@ -132,6 +163,10 @@ lagg_status(int s)
ra.ra_size = sizeof(rpbuf);
ra.ra_port = rpbuf;
 
+   strlcpy(rf.rf_ifname, name, sizeof(rf.rf_ifname));
+   if (ioctl(s, SIOCGLAGGFLAGS, rf) != 0)
+   rf.rf_flags = 0;
+
if (ioctl(s, SIOCGLAGG, ra) == 0) {
lp = (struct lacp_opreq *)ra.ra_lacpreq;
 
@@ -143,6 +178,23 @@ lagg_status(int s)
}
 
printf(\tlaggproto %s, proto);
+   if (rf.rf_flags  LAGG_F_HASHMASK) {
+   const char *sep = ;
+
+   printf( lagghash );
+   if (rf.rf_flags  LAGG_F_HASHL2) {
+   printf(%sl2, sep);
+   sep = ,;
+   }
+   if (rf.rf_flags  LAGG_F_HASHL3) {
+   printf(%sl3, sep);
+   sep = ,;
+   }
+   if (rf.rf_flags  LAGG_F_HASHL4) {
+   printf(%sl4, sep);
+   sep = ,;
+   }
+   }
if (isport)
printf( laggdev %s, rp.rp_ifname);
putchar('\n');
@@ -174,6 +226,7 @@ static struct cmd lagg_cmds[] = {
DEF_CMD_ARG(laggport, setlaggport),
DEF_CMD_ARG(-laggport,unsetlaggport),
DEF_CMD_ARG(laggproto,setlaggproto),
+   DEF_CMD_ARG(lagghash, setlagghash),
 };
 static struct afswtch af_lagg = {
.af_name= af_lagg,

Modified: head/sys/net/ieee8023ad_lacp.c
==
--- head/sys/net/ieee8023ad_lacp.c  Tue Mar  6 22:45:54 2012
(r232628)
+++ head/sys/net/ieee8023ad_lacp.c  Tue Mar  6 22:58:13 2012
(r232629)
@@ -815,7 +815,7 @@ lacp_select_tx_port(struct lagg_softc *s
if (sc-use_flowid  (m-m_flags  

svn commit: r232630 - in head/sys/mips: include mips

2012-03-06 Thread Juli Mallett
Author: jmallett
Date: Tue Mar  6 23:08:02 2012
New Revision: 232630
URL: http://svn.freebsd.org/changeset/base/232630

Log:
  Get rid of duplicated versions of the KSU bits.

Modified:
  head/sys/mips/include/cpu.h
  head/sys/mips/mips/exception.S
  head/sys/mips/mips/mpboot.S

Modified: head/sys/mips/include/cpu.h
==
--- head/sys/mips/include/cpu.h Tue Mar  6 22:58:13 2012(r232629)
+++ head/sys/mips/include/cpu.h Tue Mar  6 23:08:02 2012(r232630)
@@ -51,11 +51,6 @@
 
 /* BEGIN: these are going away */
 
-#defineSR_KSU_MASK 0x0018
-#defineSR_KSU_USER 0x0010
-#defineSR_KSU_SUPER0x0008
-#defineSR_KSU_KERNEL   0x
-
 #definesoft_int_mask(softintr) (1  ((softintr) + 8))
 #definehard_int_mask(hardintr) (1  ((hardintr) + 10))
 
@@ -69,7 +64,7 @@
 #include machine/cpufunc.h
 #include machine/frame.h
 
-#defineTRAPF_USERMODE(framep)  (((framep)-sr  SR_KSU_USER) != 0)
+#defineTRAPF_USERMODE(framep)  (((framep)-sr  MIPS_SR_KSU_USER) != 0)
 #defineTRAPF_PC(framep)((framep)-pc)
 #definecpu_getstack(td)((td)-td_frame-sp)
 #definecpu_setstack(td, nsp)   ((td)-td_frame-sp = (nsp))

Modified: head/sys/mips/mips/exception.S
==
--- head/sys/mips/mips/exception.S  Tue Mar  6 22:58:13 2012
(r232629)
+++ head/sys/mips/mips/exception.S  Tue Mar  6 23:08:02 2012
(r232630)
@@ -162,7 +162,7 @@ VECTOR(MipsException, unknown)
.setnoat
mfc0k0, MIPS_COP_0_STATUS   # Get the status register
mfc0k1, MIPS_COP_0_CAUSE# Get the cause register value.
-   and k0, k0, SR_KSU_USER # test for user mode
+   and k0, k0, MIPS_SR_KSU_USER# test for user mode
# sneaky but the bits are
# with us
sll k0, k0, 3   # shift user bit for cause index
@@ -193,7 +193,7 @@ SlowFault:
.setnoat
mfc0k0, MIPS_COP_0_STATUS
nop
-   and k0, k0, SR_KSU_USER
+   and k0, k0, MIPS_SR_KSU_USER
bne k0, zero, _C_LABEL(MipsUserGenException)
nop
.setat
@@ -224,7 +224,7 @@ SlowFault:
mfc0a0, MIPS_COP_0_STATUS   ;\
li  a2, (MIPS_SR_KX | MIPS_SR_SX | MIPS_SR_UX) ; \
or  a0, a0, a2  ; \
-   li  a2, ~(MIPS_SR_INT_IE | MIPS_SR_EXL | SR_KSU_USER)   ; \
+   li  a2, ~(MIPS_SR_INT_IE | MIPS_SR_EXL | MIPS_SR_KSU_USER)   ; \
and a0, a0, a2  ; \
 mtc0a0, MIPS_COP_0_STATUS   ; \
ITLBNOPFIX
@@ -233,14 +233,14 @@ SlowFault:
mfc0a0, MIPS_COP_0_STATUS   ;\
li  a2, (MIPS_SR_KX | MIPS_SR_UX | MIPS_SR_COP_2_BIT) ; \
or  a0, a0, a2  ; \
-   li  a2, ~(MIPS_SR_INT_IE | MIPS_SR_EXL | SR_KSU_USER)   ; \
+   li  a2, ~(MIPS_SR_INT_IE | MIPS_SR_EXL | MIPS_SR_KSU_USER)   ; \
and a0, a0, a2  ; \
 mtc0a0, MIPS_COP_0_STATUS   ; \
ITLBNOPFIX
 #else
 #define CLEAR_STATUS \
mfc0a0, MIPS_COP_0_STATUS   ;\
-   li  a2, ~(MIPS_SR_INT_IE | MIPS_SR_EXL | SR_KSU_USER)   ; \
+   li  a2, ~(MIPS_SR_INT_IE | MIPS_SR_EXL | MIPS_SR_KSU_USER)   ; \
and a0, a0, a2  ; \
mtc0a0, MIPS_COP_0_STATUS   ; \
ITLBNOPFIX
@@ -929,7 +929,7 @@ tlb_insert_random:
 * Branch to the comprehensive exception processing.
 */
mfc0k1, MIPS_COP_0_STATUS
-   andik1, k1, SR_KSU_USER
+   andik1, k1, MIPS_SR_KSU_USER
bnezk1, _C_LABEL(MipsUserGenException)
nop
 

Modified: head/sys/mips/mips/mpboot.S
==
--- head/sys/mips/mips/mpboot.S Tue Mar  6 22:58:13 2012(r232629)
+++ head/sys/mips/mips/mpboot.S Tue Mar  6 23:08:02 2012(r232630)
@@ -42,7 +42,7 @@
mfc0a0, MIPS_COP_0_STATUS   ;\
li  a2, (MIPS_SR_KX | MIPS_SR_SX | MIPS_SR_UX) ; \
or  a0, a0, a2  ; \
-   li  a2, ~(MIPS_SR_INT_IE | MIPS_SR_EXL | SR_KSU_USER | MIPS_SR_BEV) 
; \
+   li  a2, ~(MIPS_SR_INT_IE | MIPS_SR_EXL | MIPS_SR_KSU_USER | 
MIPS_SR_BEV) ; \
and a0, a0, a2  ; \
 mtc0a0, MIPS_COP_0_STATUS
 #elif defined(__mips_n64)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r232620 - in head/include: . xlocale

2012-03-06 Thread Bruce Evans

On Tue, 6 Mar 2012, Dimitry Andric wrote:


Log:
 After r232498, programs built with -ansi or -std=c89 including ctype.h
 would not compile anymore, due to plain 'inline' keywords.  Fix this by
 using __inline instead.

 Reported by:   Jia-Shiun Li jiash...@gmail.com
 Discussed with:theraven


Any chance of also fixing the style bugs?  Old ctype was one of the
most carefully written headers, so it was almost free of style bugs.


Modified: head/include/runetype.h
==
--- head/include/runetype.h Tue Mar  6 20:01:25 2012(r232619)
+++ head/include/runetype.h Tue Mar  6 20:15:23 2012(r232620)
@@ -90,7 +90,7 @@ extern const _RuneLocale *_CurrentRuneLo
extern const _RuneLocale *__getCurrentRuneLocale(void);


Old ctype had no style bugs like declaring prototypes as extern.

Old ctype carefully indented prototypes.


#else
extern _Thread_local const _RuneLocale *_ThreadRuneLocale;
-static inline const _RuneLocale *__getCurrentRuneLocale(void)
+static __inline const _RuneLocale *__getCurrentRuneLocale(void)
{

if (_ThreadRuneLocale)

Modified: head/include/xlocale/_ctype.h
==
--- head/include/xlocale/_ctype.h   Tue Mar  6 20:01:25 2012
(r232619)
+++ head/include/xlocale/_ctype.h   Tue Mar  6 20:15:23 2012
(r232620)
@@ -55,11 +55,11 @@ _RuneLocale *__runes_for_locale(locale_t
#ifndef _XLOCALE_INLINE
#if __GNUC__  !__GNUC_STDC_INLINE__
/* GNU89 inline has nonstandard semantics. */
-#define _XLOCALE_INLINE extern inline
+#define _XLOCALE_INLINE extern __inline


Old ctype always used a tab after #define.

Old ctype even used a tab after macro names.


#else
/* Hack to work around people who define inline away */


Old ctype mostly terminated its comments.

This comment now doesn't match the code.  The code is now supposed to
use __inline, so it isn't affected by defining away inline.


#ifdef inline


This part of the code was nonsense and hasn't really changed.  The
code should be using __inline, so it shouldn't be affected by any
definition of inline.  sys/cdefs.h defines both inline and __inline
to support old compilers.  FreeBSD headers should not have their own
ifdefs for this.


-#define _XLOCALE_INLINE __inline static
+#define _XLOCALE_INLINE static __inline


This change is just a partial style fix.  __inline was already used here,
and still is, but in a different order.

2 style bugs remain in this line (same 2 as above).


#else
/* Define with C++ / C99 compatible semantics */
#define _XLOCALE_INLINE inline


This still doesn't use __inline, so it is still broken in most cases where
it is reached at all, if any.  `inline' not being defined has very little
to do with whether it actually works here.

There are some complications for old gcc extern inline vs C99 extern
inline, but otherwise this code should just use __inline as defined
in sys/cdefs.h and not add its own ifdef tangle to the one there.
Or better yet, use only static __inline like old ctype does.  I once
hoped to replace the static inlines in ctype.h by extern inline ones,
but that was before changing the semantics of extern inline made it
evern harder to use.  Using it in libm mainly gives unportability to
C90.

Repeating the above, with the ifdefs untangled a bit:


Modified: head/include/xlocale/_ctype.h
==
--- head/include/xlocale/_ctype.h   Tue Mar  6 20:01:25 2012
(r232619)
+++ head/include/xlocale/_ctype.h   Tue Mar  6 20:15:23 2012
(r232620)
@@ -55,11 +55,11 @@ _RuneLocale *__runes_for_locale(locale_t
#ifndef _XLOCALE_INLINE
#if __GNUC__  !__GNUC_STDC_INLINE__


The first part of this should be written as defined(__GNUC__), to support
broken compilers that warn about an undefined identifier being used in an
ifdef.

Unfortunately, the simpler test 'ifdef __GNUC_GNU_INLINE__' seems to be
unusable, since old versions of gcc that only have gnu inline also don't
have a feature test for it.


/* GNU89 inline has nonstandard semantics. */
-#define _XLOCALE_INLINE extern inline
+#define _XLOCALE_INLINE extern __inline


I'm not sure if this actually works.  Old gnu extern inline is quite
different from C99 plain inline.

Anyway, the above seems to fix the main bug.  Old version of gcc have
both inline and __inline, but -ansi or -std=c89 kills both.  Except,
very old versions of gcc (gcc-1?) have neither.  These are partially
handled by sys/cdefs.h killing __inline.  sys/cdefs.h normally
doesn't kill inline; it takes the namespace pollution NO_ANSI_KEYWORDS
to do that; the semantics of this are even subtler.  The fix seems
to be only partial, since extern inline in any spelling simply
doesn't work for compilers that don't support inline in any form.
Here we have slightly wrong ifdefs that lead gcc-1 being misclassified
and then 

Re: svn commit: r232629 - in head: sbin/ifconfig sys/net

2012-03-06 Thread Andrey Zonov

On 07.03.2012 2:58, Andrew Thompson wrote:
[snip]

Modified: head/sbin/ifconfig/ifconfig.8
==
--- head/sbin/ifconfig/ifconfig.8   Tue Mar  6 22:45:54 2012
(r232628)
+++ head/sbin/ifconfig/ifconfig.8   Tue Mar  6 22:58:13 2012
(r232629)
@@ -2309,6 +2309,21 @@ Set the aggregation protocol.
  The default is failover.
  The available options are failover, fec, lacp, loadbalance, roundrobin and
  none.
+.It Cm lagghash Ar option Ns Oo , Ns Ar option Oc
+Set the packet layers to hash for aggregation protocols which load balance.
+The default is
+.Dq l2,l3,l4 .
+The options can be combined using commas.
+.Pp
+.Bl -tag -width .Cm l2 -compact
+.It Cm l2
+src/dst mac address and optional vlan number.
+.It Cm l3
+src/dst address for IPv4 or IPv6.
+.It Cm l4
+src/dst port for TCP/UCP/SCTP.


s/UCP/UDP/?


+.El
+.Pp
  .El
  .Pp
  The following parameters are specific to IP tunnel interfaces,


[snip]

--
Andrey Zonov
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r232629 - in head: sbin/ifconfig sys/net

2012-03-06 Thread Andrew Thompson
On 7 March 2012 19:07, Andrey Zonov and...@zonov.org wrote:
 On 07.03.2012 2:58, Andrew Thompson wrote:
 [snip]

 Modified: head/sbin/ifconfig/ifconfig.8

 ==
 --- head/sbin/ifconfig/ifconfig.8       Tue Mar  6 22:45:54 2012
  (r232628)
 +++ head/sbin/ifconfig/ifconfig.8       Tue Mar  6 22:58:13 2012
  (r232629)
 @@ -2309,6 +2309,21 @@ Set the aggregation protocol.
  The default is failover.
  The available options are failover, fec, lacp, loadbalance, roundrobin
 and
  none.
 +.It Cm lagghash Ar option Ns Oo , Ns Ar option Oc
 +Set the packet layers to hash for aggregation protocols which load
 balance.
 +The default is
 +.Dq l2,l3,l4 .
 +The options can be combined using commas.
 +.Pp
 +.Bl -tag -width .Cm l2 -compact
 +.It Cm l2
 +src/dst mac address and optional vlan number.
 +.It Cm l3
 +src/dst address for IPv4 or IPv6.
 +.It Cm l4
 +src/dst port for TCP/UCP/SCTP.


 s/UCP/UDP/?

Oops, thanks.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232638 - head/sbin/ifconfig

2012-03-06 Thread Andrew Thompson
Author: thompsa
Date: Wed Mar  7 06:25:17 2012
New Revision: 232638
URL: http://svn.freebsd.org/changeset/base/232638

Log:
  Fix typo and bump the document date which I also forgot.
  
  Spotted by:   Andrey Zonov

Modified:
  head/sbin/ifconfig/ifconfig.8

Modified: head/sbin/ifconfig/ifconfig.8
==
--- head/sbin/ifconfig/ifconfig.8   Wed Mar  7 03:16:45 2012
(r232637)
+++ head/sbin/ifconfig/ifconfig.8   Wed Mar  7 06:25:17 2012
(r232638)
@@ -28,7 +28,7 @@
 .\ From: @(#)ifconfig.8   8.3 (Berkeley) 1/5/94
 .\ $FreeBSD$
 .\
-.Dd February 29, 2012
+.Dd March 7, 2012
 .Dt IFCONFIG 8
 .Os
 .Sh NAME
@@ -2321,7 +2321,7 @@ src/dst mac address and optional vlan nu
 .It Cm l3
 src/dst address for IPv4 or IPv6.
 .It Cm l4
-src/dst port for TCP/UCP/SCTP.
+src/dst port for TCP/UDP/SCTP.
 .El
 .Pp
 .El
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232639 - head/sys/dev/uart

2012-03-06 Thread Remko Lodder
Author: remko
Date: Wed Mar  7 06:42:21 2012
New Revision: 232639
URL: http://svn.freebsd.org/changeset/base/232639

Log:
  Add support for the MosChip MCS9904 four serial ports
  controller.
  
  PR:   165804
  Submitted by: Eugene Grosbein
  MFC after:1 week

Modified:
  head/sys/dev/uart/uart_bus_pci.c

Modified: head/sys/dev/uart/uart_bus_pci.c
==
--- head/sys/dev/uart/uart_bus_pci.cWed Mar  7 06:25:17 2012
(r232638)
+++ head/sys/dev/uart/uart_bus_pci.cWed Mar  7 06:42:21 2012
(r232639)
@@ -126,6 +126,8 @@ static struct pci_id pci_ns8250_ids[] = 
MosChip MCS9900 PCIe to Peripheral Controller, 0x10 },
 { 0x9710, 0x9901, 0xa000, 0x1000,
MosChip MCS9901 PCIe to Peripheral Controller, 0x10 },
+{ 0x9710, 0x9904, 0xa000, 0x1000,
+   MosChip MCS9904 PCIe to Peripheral Controller, 0x10 },
 { 0xdeaf, 0x9051, 0x, 0, Middle Digital PC Weasel Serial Port, 0x10 },
 { 0x, 0, 0x, 0, NULL, 0, 0}
 };
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r232629 - in head: sbin/ifconfig sys/net

2012-03-06 Thread Sergey Kandaurov
On 7 March 2012 02:58, Andrew Thompson thom...@freebsd.org wrote:
 Author: thompsa
 Date: Tue Mar  6 22:58:13 2012
 New Revision: 232629
 URL: http://svn.freebsd.org/changeset/base/232629

 Log:
  Add the ability to set which packet layers are used for the load balance hash
  calculation.

 Modified:
  head/sbin/ifconfig/ifconfig.8
  head/sbin/ifconfig/iflagg.c
  head/sys/net/ieee8023ad_lacp.c
  head/sys/net/if_lagg.c
  head/sys/net/if_lagg.h

HI.

This change breaks LINT-NOIP.
Something like this shoud fix it:

Index: sys/net/if_lagg.c
===
--- sys/net/if_lagg.c  (revision 232637)
+++ sys/net/if_lagg.c  (working copy)
@@ -1449,6 +1449,7 @@
const struct ip6_hdr *ip6;
uint32_t flow;
 #endif
+#if defined(INET) || defined(INET6)
union {
 #ifdef INET
struct ip ip;
@@ -1458,8 +1459,8 @@
 #endif
uint32_t port;
} buf;
+#endif

-
off = sizeof(*eh);
if (m-m_len  off)
goto out;


 Modified: head/sys/net/if_lagg.c
 ==
 --- head/sys/net/if_lagg.c      Tue Mar  6 22:45:54 2012        (r232628)
 +++ head/sys/net/if_lagg.c      Tue Mar  6 22:58:13 2012        (r232629)
[..]
 @@ -1413,34 +1432,46 @@ lagg_gethdr(struct mbuf *m, u_int off, u
  }

  uint32_t
 -lagg_hashmbuf(struct mbuf *m, uint32_t key)
 +lagg_hashmbuf(struct lagg_softc *sc, struct mbuf *m, uint32_t key)
  {
        uint16_t etype;
 -       uint32_t p = 0;
 +       uint32_t p = key;
        int off;
        struct ether_header *eh;
        struct ether_vlan_header vlanbuf;
        const struct ether_vlan_header *vlan;
  #ifdef INET
        const struct ip *ip;
 -       struct ip ipbuf;
 +       const uint32_t *ports;
 +       int iphlen;
  #endif
  #ifdef INET6
        const struct ip6_hdr *ip6;
 -       struct ip6_hdr ip6buf;
        uint32_t flow;
  #endif
 +       union {
 +#ifdef INET
 +               struct ip ip;
 +#endif
 +#ifdef INET6
 +               struct ip6_hdr ip6;
 +#endif
 +               uint32_t port;
 +       } buf;
 +

[..]

-- 
wbr,
pluknet
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232640 - head/sys/net

2012-03-06 Thread Andrew Thompson
Author: thompsa
Date: Wed Mar  7 07:22:53 2012
New Revision: 232640
URL: http://svn.freebsd.org/changeset/base/232640

Log:
  Move the vlan buffer space into the union which also fixes an unused variable
  warning with !INET  !INET6.
  
  Spotted by:   pluknet

Modified:
  head/sys/net/if_lagg.c

Modified: head/sys/net/if_lagg.c
==
--- head/sys/net/if_lagg.c  Wed Mar  7 06:42:21 2012(r232639)
+++ head/sys/net/if_lagg.c  Wed Mar  7 07:22:53 2012(r232640)
@@ -1438,7 +1438,6 @@ lagg_hashmbuf(struct lagg_softc *sc, str
uint32_t p = key;
int off;
struct ether_header *eh;
-   struct ether_vlan_header vlanbuf;
const struct ether_vlan_header *vlan;
 #ifdef INET
const struct ip *ip;
@@ -1456,6 +1455,7 @@ lagg_hashmbuf(struct lagg_softc *sc, str
 #ifdef INET6
struct ip6_hdr ip6;
 #endif
+   struct ether_vlan_header vlan;
uint32_t port;
} buf;
 
@@ -1475,7 +1475,7 @@ lagg_hashmbuf(struct lagg_softc *sc, str
p = hash32_buf(m-m_pkthdr.ether_vtag,
sizeof(m-m_pkthdr.ether_vtag), p);
} else if (etype == ETHERTYPE_VLAN) {
-   vlan = lagg_gethdr(m, off,  sizeof(*vlan), vlanbuf);
+   vlan = lagg_gethdr(m, off,  sizeof(*vlan), buf);
if (vlan == NULL)
goto out;
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r232640 - head/sys/net

2012-03-06 Thread Sergey Kandaurov
On 7 March 2012 11:22, Andrew Thompson thom...@freebsd.org wrote:
 Author: thompsa
 Date: Wed Mar  7 07:22:53 2012
 New Revision: 232640
 URL: http://svn.freebsd.org/changeset/base/232640

 Log:
  Move the vlan buffer space into the union which also fixes an unused variable
  warning with !INET  !INET6.

  Spotted by:   pluknet

 Modified:
  head/sys/net/if_lagg.c

Thank you.
BTW, how do you like this change?

Index: Makefile
===
--- Makefile(revision 232637)
+++ Makefile(working copy)
@@ -7,8 +7,10 @@
 SRCS=  if_lagg.c ieee8023ad_lacp.c opt_inet.h opt_inet6.h

 .if !defined(KERNBUILDDIR)
+.if ${MK_INET_SUPPORT} != no
 opt_inet.h:
echo #define INET 1  ${.TARGET}
+.endif

 .if ${MK_INET6_SUPPORT} != no
 opt_inet6.h:



 Modified: head/sys/net/if_lagg.c
 ==
 --- head/sys/net/if_lagg.c      Wed Mar  7 06:42:21 2012        (r232639)
 +++ head/sys/net/if_lagg.c      Wed Mar  7 07:22:53 2012        (r232640)
 @@ -1438,7 +1438,6 @@ lagg_hashmbuf(struct lagg_softc *sc, str
        uint32_t p = key;
        int off;
        struct ether_header *eh;
 -       struct ether_vlan_header vlanbuf;
        const struct ether_vlan_header *vlan;
  #ifdef INET
        const struct ip *ip;
 @@ -1456,6 +1455,7 @@ lagg_hashmbuf(struct lagg_softc *sc, str
  #ifdef INET6
                struct ip6_hdr ip6;
  #endif
 +               struct ether_vlan_header vlan;
                uint32_t port;
        } buf;

 @@ -1475,7 +1475,7 @@ lagg_hashmbuf(struct lagg_softc *sc, str
                p = hash32_buf(m-m_pkthdr.ether_vtag,
                    sizeof(m-m_pkthdr.ether_vtag), p);
        } else if (etype == ETHERTYPE_VLAN) {
 -               vlan = lagg_gethdr(m, off,  sizeof(*vlan), vlanbuf);
 +               vlan = lagg_gethdr(m, off,  sizeof(*vlan), buf);
                if (vlan == NULL)
                        goto out;


-- 
wbr,
pluknet
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232641 - in head/sys: fs/fifofs kern sys

2012-03-06 Thread Konstantin Belousov
Author: kib
Date: Wed Mar  7 07:31:50 2012
New Revision: 232641
URL: http://svn.freebsd.org/changeset/base/232641

Log:
  The pipe_poll() performs lockless access to the vnode to test
  fifo_iseof() condition, allowing the v_fifoinfo to be reset and freed
  by fifo_cleanup().
  
  Precalculate EOF at the places were fo_wgen is changed, and cache the
  state in a new pipe state flag PIPE_SAMEWGEN.
  
  Reported and tested by:   bf
  Submitted by: gianni
  MFC after:1 week (a backport)

Modified:
  head/sys/fs/fifofs/fifo.h
  head/sys/fs/fifofs/fifo_vnops.c
  head/sys/kern/sys_pipe.c
  head/sys/sys/pipe.h

Modified: head/sys/fs/fifofs/fifo.h
==
--- head/sys/fs/fifofs/fifo.h   Wed Mar  7 07:22:53 2012(r232640)
+++ head/sys/fs/fifofs/fifo.h   Wed Mar  7 07:31:50 2012(r232641)
@@ -33,7 +33,6 @@
 /*
  * Prototypes for fifo operations on vnodes.
  */
-intfifo_iseof(struct file *);
 intfifo_vnoperate(struct vop_generic_args *);
 intfifo_printinfo(struct vnode *);
 

Modified: head/sys/fs/fifofs/fifo_vnops.c
==
--- head/sys/fs/fifofs/fifo_vnops.c Wed Mar  7 07:22:53 2012
(r232640)
+++ head/sys/fs/fifofs/fifo_vnops.c Wed Mar  7 07:31:50 2012
(r232641)
@@ -67,8 +67,16 @@ struct fifoinfo {
longfi_readers;
longfi_writers;
int fi_wgen;
+   int fi_seqcount;
 };
 
+#define FIFO_UPDWGEN(fip, pip) do { \
+   if ((fip)-fi_wgen == (fip)-fi_seqcount)   \
+   (pip)-pipe_state |= PIPE_SAMEWGEN; \
+   else\
+   (pip)-pipe_state = ~PIPE_SAMEWGEN;\
+} while (0)
+
 static vop_print_t fifo_print;
 static vop_open_t  fifo_open;
 static vop_close_t fifo_close;
@@ -174,7 +182,8 @@ fifo_open(ap)
if (fip-fi_writers  0)
wakeup(fip-fi_writers);
}
-   fp-f_seqcount = fip-fi_wgen - fip-fi_writers;
+   fip-fi_seqcount = fip-fi_wgen - fip-fi_writers;
+   FIFO_UPDWGEN(fip, fpipe);
}
if (ap-a_mode  FWRITE) {
if ((ap-a_mode  O_NONBLOCK)  fip-fi_readers == 0) {
@@ -228,6 +237,7 @@ fifo_open(ap)
if (fpipe-pipe_state  PIPE_WANTR)
wakeup(fpipe);
fip-fi_wgen++;
+   FIFO_UPDWGEN(fip, fpipe);
PIPE_UNLOCK(fpipe);
fifo_cleanup(vp);
}
@@ -287,6 +297,7 @@ fifo_close(ap)
if (cpipe-pipe_state  PIPE_WANTR)
wakeup(cpipe);
fip-fi_wgen++;
+   FIFO_UPDWGEN(fip, cpipe);
PIPE_UNLOCK(cpipe);
}
}
@@ -373,15 +384,3 @@ fifo_advlock(ap)
return (ap-a_flags  F_FLOCK ? EOPNOTSUPP : EINVAL);
 }
 
-int
-fifo_iseof(struct file *fp)
-{
-   struct fifoinfo *fip;
-
-   KASSERT(fp-f_vnode != NULL, (fifo_iseof: no vnode info));
-   KASSERT(fp-f_vnode-v_fifoinfo != NULL, (fifo_iseof: no fifoinfo));
-   fip = fp-f_vnode-v_fifoinfo;
-   PIPE_LOCK_ASSERT(fip-fi_pipe, MA_OWNED);
-   return (fp-f_seqcount == fip-fi_wgen);
-}
-

Modified: head/sys/kern/sys_pipe.c
==
--- head/sys/kern/sys_pipe.cWed Mar  7 07:22:53 2012(r232640)
+++ head/sys/kern/sys_pipe.cWed Mar  7 07:31:50 2012(r232641)
@@ -1430,7 +1430,7 @@ pipe_poll(fp, events, active_cred, td)
levents = events 
(POLLIN | POLLINIGNEOF | POLLPRI | POLLRDNORM | POLLRDBAND);
if (rpipe-pipe_state  PIPE_NAMED  fp-f_flag  FREAD  levents 
-   fifo_iseof(fp))
+   rpipe-pipe_state  PIPE_SAMEWGEN)
events |= POLLINIGNEOF;
 
if ((events  POLLINIGNEOF) == 0) {

Modified: head/sys/sys/pipe.h
==
--- head/sys/sys/pipe.h Wed Mar  7 07:22:53 2012(r232640)
+++ head/sys/sys/pipe.h Wed Mar  7 07:31:50 2012(r232641)
@@ -96,6 +96,7 @@ struct pipemapping {
 #define PIPE_DIRECTW   0x400   /* Pipe direct write active. */
 #define PIPE_DIRECTOK  0x800   /* Direct mode ok. */
 #define PIPE_NAMED 0x1000  /* Is a named pipe. */
+#define PIPE_SAMEWGEN  0x2000  /* same write generation for named pipes. */
 
 /*
  * Per-pipe data structure.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to