svn commit: r279199 - head/sys/dev/netmap

2015-02-22 Thread Luigi Rizzo
Author: luigi
Date: Mon Feb 23 07:28:31 2015
New Revision: 279199
URL: https://svnweb.freebsd.org/changeset/base/279199

Log:
  add MODULE_VERSION, needed to track module dependencies
  
  MFC after:3 days

Modified:
  head/sys/dev/netmap/netmap_freebsd.c

Modified: head/sys/dev/netmap/netmap_freebsd.c
==
--- head/sys/dev/netmap/netmap_freebsd.cMon Feb 23 06:46:04 2015
(r279198)
+++ head/sys/dev/netmap/netmap_freebsd.cMon Feb 23 07:28:31 2015
(r279199)
@@ -830,3 +830,4 @@ netmap_loader(__unused struct module *mo
 
 
 DEV_MODULE(netmap, netmap_loader, NULL);
+MODULE_VERSION(netmap, 1);
___
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: r279198 - head

2015-02-22 Thread Garrett Cooper
Author: ngie
Date: Mon Feb 23 06:46:04 2015
New Revision: 279198
URL: https://svnweb.freebsd.org/changeset/base/279198

Log:
  Fill in missing dependencies for dtrace related tools so the bootstrap-tools
  compiles properly on older hosts
  
  Pointyhat to: me
  X-MFC with: r279197
  MFC after: 2 weeks

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Mon Feb 23 05:28:17 2015(r279197)
+++ head/Makefile.inc1  Mon Feb 23 06:46:04 2015(r279198)
@@ -1307,6 +1307,9 @@ _elftoolchain_libs= lib/libelf lib/libdw
 .if ${MK_CDDL} != "no"
 _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf cddl/usr.bin/ctfconvert \
 cddl/usr.bin/ctfmerge
+
+${_bt}-cddl/usr.bin/ctfconvert: ${_bt}-lib/libelf ${_bt}-lib/libdwarf 
${_bt}-cddl/lib/libctf
+${_bt}-cddl/usr.bin/ctfmerge: ${_bt}-lib/libelf ${_bt}-lib/libdwarf 
${_bt}-cddl/lib/libctf
 .endif
 .endif
 
___
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: r279197 - head

2015-02-22 Thread Garrett Cooper
Author: ngie
Date: Mon Feb 23 05:28:17 2015
New Revision: 279197
URL: https://svnweb.freebsd.org/changeset/base/279197

Log:
  Parallelize building bootstrap-tools
  
  Differential Revision: https://reviews.freebsd.org/D1901
  MFC after: 2 weeks
  Reviewed by: ian
  No serious objections from: imp

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Mon Feb 23 01:24:10 2015(r279196)
+++ head/Makefile.inc1  Mon Feb 23 05:28:17 2015(r279197)
@@ -1222,6 +1222,8 @@ legacy:
 #
 # bootstrap-tools: Build tools needed for compatibility
 #
+_bt=   _bootstrap-tools
+
 .if ${MK_GAMES} != "no"
 _strfile=  games/fortune/strfile
 .endif
@@ -1245,6 +1247,8 @@ _sed= usr.bin/sed
 .if ${BOOTSTRAPPING} < 102
 _m4=   lib/libohash \
usr.bin/m4
+
+${_bt}-usr.bin/m4: ${_bt}-lib/libohash
 .endif
 
 .if ${BOOTSTRAPPING} < 114
@@ -1254,6 +1258,8 @@ _crunch=  usr.sbin/crunch
 .if ${BOOTSTRAPPING} < 126
 _nmtree=   lib/libnetbsd \
usr.sbin/nmtree
+
+${_bt}-usr.sbin/nmtree: ${_bt}-lib/libnetbsd
 .endif
 
 .if ${BOOTSTRAPPING} < 127
@@ -1271,6 +1277,8 @@ _awk= usr.bin/awk
 .if ${BOOTSTRAPPING} < 1001506
 _yacc= lib/liby \
usr.bin/yacc
+
+${_bt}-usr.bin/yacc: ${_bt}-lib/liby
 .endif
 
 .if ${MK_BSNMP} != "no"
@@ -1285,6 +1293,9 @@ _clang_tblgen= \
lib/clang/libllvmtablegen \
usr.bin/clang/tblgen \
usr.bin/clang/clang-tblgen
+
+${_bt}-usr.bin/clang/clang-tblgen: ${_bt}-lib/clang/libllvmtablegen 
${_bt}-lib/clang/libllvmsupport
+${_bt}-usr.bin/clang/tblgen: ${_bt}-lib/clang/libllvmtablegen 
${_bt}-lib/clang/libllvmsupport
 .endif
 
 # ELF Tool Chain libraries are needed for ELF tools and dtrace tools.
@@ -1314,12 +1325,16 @@ _kerberos5_bootstrap_tools= \
kerberos5/tools/asn1_compile \
kerberos5/tools/slc \
usr.bin/compile_et
+
+${_bt}-kerberos5/tools/slc: ${_bt}-kerberos5/lib/libroken
+${_bt}-kerberos5/tools/asn1_compile: ${_bt}-kerberos5/lib/libroken
 .endif
 
+bootstrap-tools: .PHONY
+
 #  Please document (add comment) why something is in 'bootstrap-tools'.
 #  Try to bound the building of the bootstrap-tool to just the
 #  FreeBSD versions that need the tool built at this stage of the build.
-bootstrap-tools: .MAKE
 .for _tool in \
 ${_clang_tblgen} \
 ${_kerberos5_bootstrap_tools} \
@@ -1345,12 +1360,15 @@ bootstrap-tools: .MAKE
 ${_crunch} \
 ${_nmtree} \
 ${_vtfontcvt}
+${_bt}-${_tool}: .PHONY .MAKE
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
cd ${.CURDIR}/${_tool} && \
${MAKE} DIRPRFX=${_tool}/ obj && \
${MAKE} DIRPRFX=${_tool}/ depend && \
${MAKE} DIRPRFX=${_tool}/ all && \
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy 
install
+
+bootstrap-tools: ${_bt}-${_tool}
 .endfor
 
 #
___
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: r279189 - in head/sys/powerpc: aim fpu include powerpc

2015-02-22 Thread Nathan Whitehorn


On 02/22/15 17:21, Konstantin Belousov wrote:

On Sun, Feb 22, 2015 at 09:40:28PM +, Nathan Whitehorn wrote:

Author: nwhitehorn
Date: Sun Feb 22 21:40:27 2015
New Revision: 279189
URL: https://svnweb.freebsd.org/changeset/base/279189

Log:
   Kernel support for the Vector-Scalar eXtension (VSX) found on the POWER7
   and POWER8. This instruction set unifies the 32 64-bit scalar floating
   point registers with the 32 128-bit vector registers into a single bank
   of 64 128-bit registers. Kernel support mostly amounts to saving and
   restoring the wider version of the floating point registers and making
   sure that both scalar FP and vector registers are enabled once a VSX
   instruction is executed. get_mcontext() and friends currently cannot
   see the high bits, which will require a little more work.
   
   As the system compiler (GCC 4.2) does not support VSX, making use of this

   from userland requires either newer GCC or clang.

Handling the similar issue (exploding of the machine state size) for x86
resulted in the creation of the getcontextx(3) API.  It is both get/set
context(2) syscalls  and signal handling which require modifications.

For signal handlers and sigreturn(2), it is possible to make it transparent
for the consumers, but not for *context(2), since mcontext_t is explicit
type allocated by callers.



Thanks! I had forgotten about the signal handling issue. Will look into 
this tomorrow.

-Nathan
___
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: r279189 - in head/sys/powerpc: aim fpu include powerpc

2015-02-22 Thread Konstantin Belousov
On Sun, Feb 22, 2015 at 09:40:28PM +, Nathan Whitehorn wrote:
> Author: nwhitehorn
> Date: Sun Feb 22 21:40:27 2015
> New Revision: 279189
> URL: https://svnweb.freebsd.org/changeset/base/279189
> 
> Log:
>   Kernel support for the Vector-Scalar eXtension (VSX) found on the POWER7
>   and POWER8. This instruction set unifies the 32 64-bit scalar floating
>   point registers with the 32 128-bit vector registers into a single bank
>   of 64 128-bit registers. Kernel support mostly amounts to saving and
>   restoring the wider version of the floating point registers and making
>   sure that both scalar FP and vector registers are enabled once a VSX
>   instruction is executed. get_mcontext() and friends currently cannot
>   see the high bits, which will require a little more work.
>   
>   As the system compiler (GCC 4.2) does not support VSX, making use of this
>   from userland requires either newer GCC or clang.

Handling the similar issue (exploding of the machine state size) for x86
resulted in the creation of the getcontextx(3) API.  It is both get/set
context(2) syscalls  and signal handling which require modifications.

For signal handlers and sigreturn(2), it is possible to make it transparent
for the consumers, but not for *context(2), since mcontext_t is explicit
type allocated by callers.
___
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: r279189 - in head/sys/powerpc: aim fpu include powerpc

2015-02-22 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Sun Feb 22 21:40:27 2015
New Revision: 279189
URL: https://svnweb.freebsd.org/changeset/base/279189

Log:
  Kernel support for the Vector-Scalar eXtension (VSX) found on the POWER7
  and POWER8. This instruction set unifies the 32 64-bit scalar floating
  point registers with the 32 128-bit vector registers into a single bank
  of 64 128-bit registers. Kernel support mostly amounts to saving and
  restoring the wider version of the floating point registers and making
  sure that both scalar FP and vector registers are enabled once a VSX
  instruction is executed. get_mcontext() and friends currently cannot
  see the high bits, which will require a little more work.
  
  As the system compiler (GCC 4.2) does not support VSX, making use of this
  from userland requires either newer GCC or clang.
  
  Relnotes: yes
  Sponsored by: FreeBSD Foundation

Modified:
  head/sys/powerpc/aim/trap.c
  head/sys/powerpc/aim/trap_subr64.S
  head/sys/powerpc/fpu/fpu_emu.c
  head/sys/powerpc/fpu/fpu_explode.c
  head/sys/powerpc/include/cpu.h
  head/sys/powerpc/include/pcb.h
  head/sys/powerpc/include/psl.h
  head/sys/powerpc/include/reg.h
  head/sys/powerpc/include/trap.h
  head/sys/powerpc/powerpc/cpu.c
  head/sys/powerpc/powerpc/db_trace.c
  head/sys/powerpc/powerpc/exec_machdep.c
  head/sys/powerpc/powerpc/fpu.c

Modified: head/sys/powerpc/aim/trap.c
==
--- head/sys/powerpc/aim/trap.c Sun Feb 22 21:32:57 2015(r279188)
+++ head/sys/powerpc/aim/trap.c Sun Feb 22 21:40:27 2015(r279189)
@@ -116,6 +116,7 @@ static struct powerpc_exception powerpc_
{ 0x0e00, "floating-point assist" },
{ 0x0f00, "performance monitoring" },
{ 0x0f20, "altivec unavailable" },
+   { 0x0f40, "vsx unavailable" },
{ 0x1000, "instruction tlb miss" },
{ 0x1100, "data load tlb miss" },
{ 0x1200, "data store tlb miss" },
@@ -230,6 +231,17 @@ trap(struct trapframe *frame)
enable_vec(td);
break;
 
+   case EXC_VSX:
+   KASSERT((td->td_pcb->pcb_flags & PCB_VSX) != PCB_VSX,
+   ("VSX already enabled for thread"));
+   if (!(td->td_pcb->pcb_flags & PCB_VEC))
+   enable_vec(td);
+   if (!(td->td_pcb->pcb_flags & PCB_FPU))
+   save_fpu(td);
+   td->td_pcb->pcb_flags |= PCB_VSX;
+   enable_fpu(td);
+   break;
+
case EXC_VECAST_G4:
case EXC_VECAST_G5:
/*
@@ -709,7 +721,7 @@ fix_unaligned(struct thread *td, struct 
case EXC_ALI_LFD:
case EXC_ALI_STFD:
reg = EXC_ALI_RST(frame->cpu.aim.dsisr);
-   fpr = &td->td_pcb->pcb_fpu.fpr[reg];
+   fpr = &td->td_pcb->pcb_fpu.fpr[reg].fpr;
fputhread = PCPU_GET(fputhread);
 
/* Juggle the FPU to ensure that we've initialized

Modified: head/sys/powerpc/aim/trap_subr64.S
==
--- head/sys/powerpc/aim/trap_subr64.S  Sun Feb 22 21:32:57 2015
(r279188)
+++ head/sys/powerpc/aim/trap_subr64.S  Sun Feb 22 21:40:27 2015
(r279189)
@@ -359,7 +359,7 @@ CNAME(trapcode):
li  %r1,TRAP_GENTRAP
ld  %r1,0(%r1)
mtlr%r1
-   li  %r1, 0xA0   /* How to get the vector from LR */
+   li  %r1, 0xe0   /* How to get the vector from LR */
blrl/* Branch to generictrap */
 CNAME(trapcodeend):
 

Modified: head/sys/powerpc/fpu/fpu_emu.c
==
--- head/sys/powerpc/fpu/fpu_emu.c  Sun Feb 22 21:32:57 2015
(r279188)
+++ head/sys/powerpc/fpu/fpu_emu.c  Sun Feb 22 21:40:27 2015
(r279189)
@@ -335,7 +335,7 @@ fpu_execute(struct trapframe *tf, struct
if (ra != 0)
addr += tf->fixreg[ra];
rt = instr.i_x.i_rt;
-   a = (int *)&fs->fpreg[rt];
+   a = (int *)&fs->fpreg[rt].fpr;
DPRINTF(FPE_INSN,
("fpu_execute: Store INT %x at %p\n",
a[1], (void *)addr));
@@ -402,7 +402,8 @@ fpu_execute(struct trapframe *tf, struct
DPRINTF(FPE_INSN, 
("fpu_execute: Store DBL at %p\n",
(void *)addr));
-   if (copyout(&fs->fpreg[rt], (void *)addr, size))
+   if (copyout(&fs->fpreg[rt].fp

svn commit: r279188 - head/bin/sh

2015-02-22 Thread Jilles Tjoelker
Author: jilles
Date: Sun Feb 22 21:32:57 2015
New Revision: 279188
URL: https://svnweb.freebsd.org/changeset/base/279188

Log:
  sh: Add details about importing the environment and initializing OPTIND.

Modified:
  head/bin/sh/sh.1

Modified: head/bin/sh/sh.1
==
--- head/bin/sh/sh.1Sun Feb 22 20:52:29 2015(r279187)
+++ head/bin/sh/sh.1Sun Feb 22 21:32:57 2015(r279188)
@@ -32,7 +32,7 @@
 .\"from: @(#)sh.1  8.6 (Berkeley) 5/4/95
 .\" $FreeBSD$
 .\"
-.Dd November 14, 2014
+.Dd February 22, 2015
 .Dt SH 1
 .Os
 .Sh NAME
@@ -1196,17 +1196,18 @@ command is implemented as a special buil
 .Ss Variables and Parameters
 The shell maintains a set of parameters.
 A parameter
-denoted by a name is called a variable.
+denoted by a name
+(consisting solely
+of alphabetics, numerics, and underscores,
+and starting with an alphabetic or an underscore)
+is called a variable.
 When starting up,
-the shell turns all the environment variables into shell
+the shell turns all environment variables with valid names into shell
 variables.
 New variables can be set using the form
 .Pp
 .D1 Ar name Ns = Ns Ar value
 .Pp
-Variables set by the user must have a name consisting solely
-of alphabetics, numerics, and underscores.
-The first letter of a variable name must not be numeric.
 A parameter can also be denoted by a number
 or a special character as explained below.
 .Pp
@@ -1369,6 +1370,10 @@ This variable overrides the
 .Va MAIL
 setting.
 There is a maximum of 10 mailboxes that can be monitored at once.
+.It Va OPTIND
+The index of the next argument to be processed by
+.Ic getopts .
+This is initialized to 1 at startup.
 .It Va PATH
 The default search path for executables.
 See the
@@ -2297,6 +2302,8 @@ If an invalid option is encountered,
 is set to
 .Ql \&? .
 It returns a false value (1) when it encounters the end of the options.
+A new set of arguments may be parsed by assigning
+.Li OPTIND=1 .
 .It Ic hash Oo Fl rv Oc Op Ar command ...
 The shell maintains a hash table which remembers the locations of commands.
 With no arguments whatsoever, the
@@ -2771,7 +2778,7 @@ This is inherited by children of the she
 editing modes.
 .El
 .Pp
-Additionally, all environment variables are turned into shell variables
+Additionally, environment variables are turned into shell variables
 at startup,
 which may affect the shell as described under
 .Sx Special Variables .
___
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: r279187 - head/contrib/binutils/opcodes

2015-02-22 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Sun Feb 22 20:52:29 2015
New Revision: 279187
URL: https://svnweb.freebsd.org/changeset/base/279187

Log:
  Add some opcodes for assembling forthcoming VSX (Vector-Scalar eXtension)
  support in the kernel. Userspace programs are expected to rely on LLVM's
  integrated assembler or newer binutils.

Modified:
  head/contrib/binutils/opcodes/ppc-opc.c

Modified: head/contrib/binutils/opcodes/ppc-opc.c
==
--- head/contrib/binutils/opcodes/ppc-opc.c Sun Feb 22 20:16:44 2015
(r279186)
+++ head/contrib/binutils/opcodes/ppc-opc.c Sun Feb 22 20:52:29 2015
(r279187)
@@ -4268,6 +4268,11 @@ const struct powerpc_opcode powerpc_opco
 { "stvx",X(31, 231), X_MASK,   PPCVEC, { VS, RA, RB } },
 { "stvxl",   X(31, 487), X_MASK,   PPCVEC, { VS, RA, RB } },
 
+/* New VSX opcodes in POWER ISA 2.06 */
+/* XXX: only enough opcodes for FreeBSD kernel, remove and replace with real 
info */
+{ "stxvw4x", X(31, 908), X_MASK,   PPCVEC, { FRS, RA0, RB } },
+{ "lxvw4x",  X(31, 780), X_MASK,   PPCVEC, { FRT, RA0, RB } },
+
 /* New load/store left/right index vector instructions that are in the Cell 
only.  */
 { "lvlx",X(31, 519), X_MASK,   CELL,   { VD, RA0, RB } },
 { "lvlxl",   X(31, 775), X_MASK,   CELL,   { VD, RA0, RB } },
___
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: r279186 - head/lib/libc/gen

2015-02-22 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Feb 22 20:16:44 2015
New Revision: 279186
URL: https://svnweb.freebsd.org/changeset/base/279186

Log:
  setmode(3): Make sure that setmode sets errno on failure.
  
  Our man page already documented this partially but now
  we have some consistent behavior.
  
  PR:   136669
  Obtained from:NetBSD (CVS rev. 1.31, 1.33)
  Relnotes: yes
  MFC after:3 weeks

Modified:
  head/lib/libc/gen/setmode.3
  head/lib/libc/gen/setmode.c

Modified: head/lib/libc/gen/setmode.3
==
--- head/lib/libc/gen/setmode.3 Sun Feb 22 19:42:50 2015(r279185)
+++ head/lib/libc/gen/setmode.3 Sun Feb 22 20:16:44 2015(r279186)
@@ -28,7 +28,7 @@
 .\" @(#)setmode.3  8.2 (Berkeley) 4/28/95
 .\" $FreeBSD$
 .\"
-.Dd April 28, 1995
+.Dd February 22, 2015
 .Dt SETMODE 3
 .Os
 .Sh NAME
@@ -99,7 +99,20 @@ The
 function
 may fail and set errno for any of the errors specified for the library
 routine
-.Xr malloc 3 .
+.Xr malloc 3
+or
+.Xr strtol 3 .
+In addition,
+.Fn setmode
+will fail and set
+.Va errno
+to:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Fa mode
+argument does not represent a valid mode.
+.El
 .Sh SEE ALSO
 .Xr chmod 1 ,
 .Xr stat 2 ,

Modified: head/lib/libc/gen/setmode.c
==
--- head/lib/libc/gen/setmode.c Sun Feb 22 19:42:50 2015(r279185)
+++ head/lib/libc/gen/setmode.c Sun Feb 22 20:16:44 2015(r279186)
@@ -41,6 +41,8 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -66,7 +68,7 @@ typedef struct bitcmd {
 #defineCMD2_OBITS  0x08
 #defineCMD2_UBITS  0x10
 
-static BITCMD  *addcmd(BITCMD *, int, int, int, u_int);
+static BITCMD  *addcmd(BITCMD *, mode_t, mode_t, mode_t, mode_t);
 static void compress_mode(BITCMD *);
 #ifdef SETMODE_DEBUG
 static void dumpmode(BITCMD *);
@@ -151,33 +153,32 @@ common:   if (set->cmd2 & CMD2_CLR) {
BITCMD *newset; \
setlen += SET_LEN_INCR; \
newset = realloc(saveset, sizeof(BITCMD) * setlen); \
-   if (!newset) {  \
-   if (saveset)\
-   free(saveset);  \
-   saveset = NULL; \
-   return (NULL);  \
-   }   \
+   if (newset == NULL) \
+   goto out;   \
set = newset + (set - saveset); \
saveset = newset;   \
endset = newset + (setlen - 2); \
}   \
-   set = addcmd(set, (a), (b), (c), (d))
+   set = addcmd(set, (mode_t)(a), (mode_t)(b), (mode_t)(c), (d))
 
 #defineSTANDARD_BITS   (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO)
 
 void *
 setmode(const char *p)
 {
-   int perm, who;
+   int serrno;
char op, *ep;
BITCMD *set, *saveset, *endset;
sigset_t sigset, sigoset;
-   mode_t mask;
-   int equalopdone=0, permXbits, setlen;
+   mode_t mask, perm, permXbits, who;
long perml;
+   int equalopdone;
+   int setlen;
 
-   if (!*p)
+   if (!*p) {
+   errno = EINVAL;
return (NULL);
+   }
 
/*
 * Get a copy of the mask for the permissions that are mask relative.
@@ -203,10 +204,17 @@ setmode(const char *p)
 * or illegal bits.
 */
if (isdigit((unsigned char)*p)) {
+   errno = 0;
perml = strtol(p, &ep, 8);
-   if (*ep || perml < 0 || perml & ~(STANDARD_BITS|S_ISTXT)) {
-   free(saveset);
-   return (NULL);
+   if (*ep) {
+   errno = EINVAL;
+   goto out;
+   }
+   if (errno == ERANGE && (perml == LONG_MAX || perml == LONG_MIN))
+   goto out;
+   if (perml & ~(STANDARD_BITS|S_ISTXT)) {
+   errno = EINVAL;
+   goto out;
}
perm = (mode_t)perml;
ADDCMD('=', (STANDARD_BITS|S_ISTXT), perm, mask);
@@ -218,6 +226,7 @@ setmode(const char *p)
 * Build list of structures to set/clear/copy bits as described by
 * each clause of the symbolic mode.
 */
+   equalopdone = 0;
for (;;) {
   

svn commit: r279185 - head/share/man/man5

2015-02-22 Thread Maxim Konovalov
Author: maxim
Date: Sun Feb 22 19:42:50 2015
New Revision: 279185
URL: https://svnweb.freebsd.org/changeset/base/279185

Log:
  o Typo: securiy -> security.
  
  PR:   197927
  Submitted by: mike@comcast.net
  MFC after:1 week

Modified:
  head/share/man/man5/periodic.conf.5

Modified: head/share/man/man5/periodic.conf.5
==
--- head/share/man/man5/periodic.conf.5 Sun Feb 22 19:25:57 2015
(r279184)
+++ head/share/man/man5/periodic.conf.5 Sun Feb 22 19:42:50 2015
(r279185)
@@ -591,15 +591,15 @@ This would usually be set to
 .It Va weekly_status_security_enable
 .Pq Vt bool
 Weekly counterpart of
-.Va daily_status_securiy_enable .
+.Va daily_status_security_enable .
 .It Va weekly_status_security_inline
 .Pq Vt bool
 Weekly counterpart of
-.Va daily_status_securiy_inline .
+.Va daily_status_security_inline .
 .It Va weekly_status_security_output
 .Pq Vt str
 Weekly counterpart of
-.Va daily_status_securiy_output .
+.Va daily_status_security_output .
 .It Va weekly_status_pkg_enable
 .Pq Vt bool
 Set to
@@ -670,15 +670,15 @@ command.
 .It Va monthly_status_security_enable
 .Pq Vt bool
 Monthly counterpart of
-.Va daily_status_securiy_enable .
+.Va daily_status_security_enable .
 .It Va monthly_status_security_inline
 .Pq Vt bool
 Monthly counterpart of
-.Va daily_status_securiy_inline .
+.Va daily_status_security_inline .
 .It Va monthly_status_security_output
 .Pq Vt str
 Monthly counterpart of
-.Va daily_status_securiy_output .
+.Va daily_status_security_output .
 .It Va monthly_local
 .Pq Vt str
 Set to a list of extra scripts that should be run after all other
___
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: r279184 - head/sys/dev/sfxge

2015-02-22 Thread Andrew Rybchenko
Author: arybchik
Date: Sun Feb 22 19:25:57 2015
New Revision: 279184
URL: https://svnweb.freebsd.org/changeset/base/279184

Log:
  sfxge: implement if_get_counter callback
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge.c
  head/sys/dev/sfxge/sfxge.h
  head/sys/dev/sfxge/sfxge_port.c
  head/sys/dev/sfxge/sfxge_tx.c
  head/sys/dev/sfxge/sfxge_tx.h

Modified: head/sys/dev/sfxge/sfxge.c
==
--- head/sys/dev/sfxge/sfxge.c  Sun Feb 22 19:24:08 2015(r279183)
+++ head/sys/dev/sfxge/sfxge.c  Sun Feb 22 19:25:57 2015(r279184)
@@ -61,10 +61,10 @@ __FBSDID("$FreeBSD$");
 #defineSFXGE_CAP (IFCAP_VLAN_MTU | \
   IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM | IFCAP_TSO |   \
   IFCAP_JUMBO_MTU | IFCAP_LRO |\
-  IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE)
+  IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE | IFCAP_HWSTATS)
 #defineSFXGE_CAP_ENABLE SFXGE_CAP
 #defineSFXGE_CAP_FIXED (IFCAP_VLAN_MTU | IFCAP_HWCSUM | 
IFCAP_VLAN_HWCSUM | \
-IFCAP_JUMBO_MTU | IFCAP_LINKSTATE)
+IFCAP_JUMBO_MTU | IFCAP_LINKSTATE | IFCAP_HWSTATS)
 
 MALLOC_DEFINE(M_SFXGE, "sfxge", "Solarflare 10GigE driver");
 
@@ -343,6 +343,8 @@ sfxge_ifnet_init(struct ifnet *ifp, stru
mtx_init(&sc->tx_lock, sc->tx_lock_name, NULL, MTX_DEF);
 #endif
 
+   ifp->if_get_counter = sfxge_get_counter;
+
if ((rc = sfxge_port_ifmedia_init(sc)) != 0)
goto fail;
 

Modified: head/sys/dev/sfxge/sfxge.h
==
--- head/sys/dev/sfxge/sfxge.h  Sun Feb 22 19:24:08 2015(r279183)
+++ head/sys/dev/sfxge/sfxge.h  Sun Feb 22 19:25:57 2015(r279184)
@@ -324,6 +324,7 @@ extern void sfxge_mac_link_update(struct
 efx_link_mode_t mode);
 extern int sfxge_mac_filter_set(struct sfxge_softc *sc);
 extern int sfxge_port_ifmedia_init(struct sfxge_softc *sc);
+extern uint64_t sfxge_get_counter(struct ifnet *ifp, ift_counter c);
 
 #defineSFXGE_MAX_MTU (9 * 1024)
 

Modified: head/sys/dev/sfxge/sfxge_port.c
==
--- head/sys/dev/sfxge/sfxge_port.c Sun Feb 22 19:24:08 2015
(r279183)
+++ head/sys/dev/sfxge/sfxge_port.c Sun Feb 22 19:25:57 2015
(r279184)
@@ -85,6 +85,68 @@ out:
return (rc);
 }
 
+uint64_t
+sfxge_get_counter(struct ifnet *ifp, ift_counter c)
+{
+   struct sfxge_softc *sc = ifp->if_softc;
+   uint64_t *mac_stats;
+   uint64_t val;
+
+   SFXGE_PORT_LOCK(&sc->port);
+
+   /* Ignore error and use old values */
+   (void)sfxge_mac_stat_update(sc);
+
+   mac_stats = (uint64_t *)sc->port.mac_stats.decode_buf;
+
+   switch (c) {
+   case IFCOUNTER_IPACKETS:
+   val = mac_stats[EFX_MAC_RX_PKTS];
+   break;
+   case IFCOUNTER_IERRORS:
+   val = mac_stats[EFX_MAC_RX_ERRORS];
+   break;
+   case IFCOUNTER_OPACKETS:
+   val = mac_stats[EFX_MAC_TX_PKTS];
+   break;
+   case IFCOUNTER_OERRORS:
+   val = mac_stats[EFX_MAC_TX_ERRORS];
+   break;
+   case IFCOUNTER_COLLISIONS:
+   val = mac_stats[EFX_MAC_TX_SGL_COL_PKTS] +
+ mac_stats[EFX_MAC_TX_MULT_COL_PKTS] +
+ mac_stats[EFX_MAC_TX_EX_COL_PKTS] +
+ mac_stats[EFX_MAC_TX_LATE_COL_PKTS];
+   break;
+   case IFCOUNTER_IBYTES:
+   val = mac_stats[EFX_MAC_RX_OCTETS];
+   break;
+   case IFCOUNTER_OBYTES:
+   val = mac_stats[EFX_MAC_TX_OCTETS];
+   break;
+   case IFCOUNTER_OMCASTS:
+   val = mac_stats[EFX_MAC_TX_MULTICST_PKTS] +
+ mac_stats[EFX_MAC_TX_BRDCST_PKTS];
+   break;
+   case IFCOUNTER_OQDROPS:
+   SFXGE_PORT_UNLOCK(&sc->port);
+   return (sfxge_tx_get_drops(sc));
+   case IFCOUNTER_IMCASTS:
+   /* if_imcasts is maintained in net/if_ethersubr.c */
+   case IFCOUNTER_IQDROPS:
+   /* if_iqdrops is maintained in net/if_ethersubr.c */
+   case IFCOUNTER_NOPROTO:
+   /* if_noproto is maintained in net/if_ethersubr.c */
+   default:
+   SFXGE_PORT_UNLOCK(&sc->port);
+   return (if_get_counter_default(ifp, c));
+   }
+
+   SFXGE_PORT_UNLOCK(&sc->port);
+
+   return (val);
+}
+
 static int
 sfxge_mac_stat_handler(SYSCTL_HANDLER_ARGS)
 {

Modified: head/sys/dev/sfxge/sfxge_tx.c
==
--- head/sys/dev/sfxge/sfxge_tx.c   Sun Feb 22 19:24:08 2015
(r279183)
+++ head/sys/dev/sfxge/sfxge_tx.c   Sun 

Re: svn commit: r279028 - in head/usr.sbin: . ifmcstat

2015-02-22 Thread Bruce Simpson

On 21/02/2015 00:50, Gleb Smirnoff wrote:
   


May be you refer to code that was always under #if 0, disabled due to
difficulty to go through RB-trees via kvm(3)?


My bad - yes - this code was unfinished as of SVN rev 192923, it seems I 
ran into problems with RB-tree walks through KREAD().


To implement this as a sysctl, one might copy the backend implementation 
of getsourcefilter(3) and work from there, specifically the internal 
IP_MSFILTER socket option.


Bruce
___
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: r279183 - head/sys/dev/sfxge/common

2015-02-22 Thread Andrew Rybchenko
Author: arybchik
Date: Sun Feb 22 19:24:08 2015
New Revision: 279183
URL: https://svnweb.freebsd.org/changeset/base/279183

Log:
  sfxge: add common code support for changing TX queue pace
  
  To delay packets from a particular TX queue by a particular time, write a 
value
  into the TX Pace table s.t. pace time <= TX Pace Clock Period * (2 ^ pace 
value)
  - the TX pace clock is 1/13 of the system clock, so its period should be 104 
or
  52 ns depending on whether turbo mode is active.
  
  EFX_TX_PACE_CLOCK_BASE added by me.
  
  Submitted by:   Mark Spender 
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_regs.h
  head/sys/dev/sfxge/common/efx_tx.c

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Sun Feb 22 19:13:52 2015
(r279182)
+++ head/sys/dev/sfxge/common/efx.h Sun Feb 22 19:24:08 2015
(r279183)
@@ -1736,6 +1736,11 @@ efx_tx_qpost(
__inunsigned int completed,
__inout unsigned int *addedp);
 
+extern __checkReturn   int
+efx_tx_qpace(
+   __inefx_txq_t *etp,
+   __inunsigned int ns);
+
 extern void
 efx_tx_qpush(
__inefx_txq_t *etp,

Modified: head/sys/dev/sfxge/common/efx_regs.h
==
--- head/sys/dev/sfxge/common/efx_regs.hSun Feb 22 19:13:52 2015
(r279182)
+++ head/sys/dev/sfxge/common/efx_regs.hSun Feb 22 19:24:08 2015
(r279183)
@@ -34,6 +34,13 @@ extern "C" {
 #endif
 
 
+/**
+ *
+ * Falcon/Siena registers and descriptors
+ *
+ **
+ */
+
 /*
  * FR_AB_EE_VPD_CFG0_REG_SF(128bit):
  * SPI/VPD configuration register 0
@@ -3838,6 +3845,18 @@ extern "C" {
 #defineFSF_AZ_DRIVER_EV_RX_DESCQ_ID_WIDTH 12
 
 
+
+/**
+ *
+ * Falcon non-volatile configuration
+ *
+ **
+ */
+
+
+#define FR_AZ_TX_PACE_TBL_OFST FR_BZ_TX_PACE_TBL_OFST
+
+
 #ifdef __cplusplus
 }
 #endif

Modified: head/sys/dev/sfxge/common/efx_tx.c
==
--- head/sys/dev/sfxge/common/efx_tx.c  Sun Feb 22 19:13:52 2015
(r279182)
+++ head/sys/dev/sfxge/common/efx_tx.c  Sun Feb 22 19:24:08 2015
(r279183)
@@ -224,6 +224,53 @@ efx_tx_qpush(
etp->et_index, &dword, B_FALSE);
 }
 
+#defineEFX_MAX_PACE_VALUE 20
+#defineEFX_TX_PACE_CLOCK_BASE  104
+
+   __checkReturn   int
+efx_tx_qpace(
+   __inefx_txq_t *etp,
+   __inunsigned int ns)
+{
+   efx_nic_t *enp = etp->et_enp;
+   efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
+   efx_oword_t oword;
+   unsigned int pace_val;
+   unsigned int timer_period;
+   int rc;
+
+   EFSYS_ASSERT3U(etp->et_magic, ==, EFX_TXQ_MAGIC);
+
+   if (ns == 0) {
+   pace_val = 0;
+   } else {
+   /*
+* The pace_val to write into the table is s.t
+* ns <= timer_period * (2 ^ pace_val)
+*/
+   timer_period = EFX_TX_PACE_CLOCK_BASE / encp->enc_clk_mult;
+   for (pace_val = 1; pace_val <= EFX_MAX_PACE_VALUE; pace_val++) {
+   if ((timer_period << pace_val) >= ns)
+   break;
+   }
+   }
+   if (pace_val > EFX_MAX_PACE_VALUE) {
+   rc = EINVAL;
+   goto fail1;
+   }
+
+   /* Update the pacing table */
+   EFX_POPULATE_OWORD_1(oword, FRF_AZ_TX_PACE, pace_val);
+   EFX_BAR_TBL_WRITEO(enp, FR_AZ_TX_PACE_TBL, etp->et_index, &oword);
+
+   return (0);
+
+fail1:
+   EFSYS_PROBE1(fail1, int, rc);
+
+   return (rc);
+}
+
void
 efx_tx_qflush(
__inefx_txq_t *etp)
@@ -234,6 +281,8 @@ efx_tx_qflush(
 
EFSYS_ASSERT3U(etp->et_magic, ==, EFX_TXQ_MAGIC);
 
+   efx_tx_qpace(etp, 0);
+
label = etp->et_index;
 
/* Flush the queue */
___
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: r279182 - in head/sys/dev/sfxge: . common

2015-02-22 Thread Andrew Rybchenko
Author: arybchik
Date: Sun Feb 22 19:13:52 2015
New Revision: 279182
URL: https://svnweb.freebsd.org/changeset/base/279182

Log:
  sfxge: correct event queue interrupt moderation timer quanta
  
  Submitted by:   Andrew Lee 
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_ev.c
  head/sys/dev/sfxge/common/efx_impl.h
  head/sys/dev/sfxge/common/siena_nic.c
  head/sys/dev/sfxge/sfxge_ev.c

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Sun Feb 22 18:59:00 2015
(r279181)
+++ head/sys/dev/sfxge/common/efx.h Sun Feb 22 19:13:52 2015
(r279182)
@@ -895,7 +895,8 @@ typedef struct efx_nic_cfg_s {
uint32_tenc_txq_limit;
uint32_tenc_rxq_limit;
uint32_tenc_buftbl_limit;
-   uint32_tenc_evq_moderation_max;
+   uint32_tenc_evq_timer_quantum_ns;
+   uint32_tenc_evq_timer_max_us;
uint32_tenc_clk_mult;
 #if EFSYS_OPT_LOOPBACK
uint32_tenc_loopback_types[EFX_LINK_NMODES];

Modified: head/sys/dev/sfxge/common/efx_ev.c
==
--- head/sys/dev/sfxge/common/efx_ev.c  Sun Feb 22 18:59:00 2015
(r279181)
+++ head/sys/dev/sfxge/common/efx_ev.c  Sun Feb 22 19:13:52 2015
(r279182)
@@ -857,7 +857,7 @@ efx_ev_qmoderate(
 
EFSYS_ASSERT3U(eep->ee_magic, ==, EFX_EVQ_MAGIC);
 
-   if (us > encp->enc_evq_moderation_max) {
+   if (us > encp->enc_evq_timer_max_us) {
rc = EINVAL;
goto fail1;
}
@@ -876,7 +876,7 @@ efx_ev_qmoderate(
uint32_t timer_val;
 
/* Calculate the timer value in quanta */
-   timer_val = us * encp->enc_clk_mult / EFX_EV_TIMER_QUANTUM;
+   timer_val = us * 1000 / encp->enc_evq_timer_quantum_ns;
 
/* Moderation value is base 0 so we need to deduct 1 */
if (timer_val > 0)

Modified: head/sys/dev/sfxge/common/efx_impl.h
==
--- head/sys/dev/sfxge/common/efx_impl.hSun Feb 22 18:59:00 2015
(r279181)
+++ head/sys/dev/sfxge/common/efx_impl.hSun Feb 22 19:13:52 2015
(r279182)
@@ -408,7 +408,8 @@ struct efx_evq_s {
 
 #defineEFX_EVQ_MAGIC   0x08081997
 
-#defineEFX_EV_TIMER_QUANTUM5
+#defineEFX_EVQ_FALCON_TIMER_QUANTUM_NS 4968 /* 621 cycles */
+#defineEFX_EVQ_SIENA_TIMER_QUANTUM_NS  6144 /* 768 cycles */
 
 struct efx_rxq_s {
uint32_ter_magic;

Modified: head/sys/dev/sfxge/common/siena_nic.c
==
--- head/sys/dev/sfxge/common/siena_nic.c   Sun Feb 22 18:59:00 2015
(r279181)
+++ head/sys/dev/sfxge/common/siena_nic.c   Sun Feb 22 19:13:52 2015
(r279182)
@@ -329,8 +329,10 @@ siena_board_cfg(
encp->enc_clk_mult = 2;
}
 
-   encp->enc_evq_moderation_max = EFX_EV_TIMER_QUANTUM <<
-   FRF_AB_TIMER_VAL_WIDTH / encp->enc_clk_mult;
+   encp->enc_evq_timer_quantum_ns =
+   EFX_EVQ_SIENA_TIMER_QUANTUM_NS / encp->enc_clk_mult;
+   encp->enc_evq_timer_max_us = (encp->enc_evq_timer_quantum_ns <<
+   FRF_CZ_TC_TIMER_VAL_WIDTH) / 1000;
 
/* Resource limits */
req.emr_cmd = MC_CMD_GET_RESOURCE_LIMITS;

Modified: head/sys/dev/sfxge/sfxge_ev.c
==
--- head/sys/dev/sfxge/sfxge_ev.c   Sun Feb 22 18:59:00 2015
(r279181)
+++ head/sys/dev/sfxge/sfxge_ev.c   Sun Feb 22 19:13:52 2015
(r279182)
@@ -522,7 +522,7 @@ sfxge_int_mod_handler(SYSCTL_HANDLER_ARG
 * so we have to range-check the value ourselves.
 */
if (moderation >
-   efx_nic_cfg_get(sc->enp)->enc_evq_moderation_max) {
+   efx_nic_cfg_get(sc->enp)->enc_evq_timer_max_us) {
error = EINVAL;
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"


svn commit: r279181 - head/share/man/man4

2015-02-22 Thread Andrew Rybchenko
Author: arybchik
Date: Sun Feb 22 18:59:00 2015
New Revision: 279181
URL: https://svnweb.freebsd.org/changeset/base/279181

Log:
  sfxge: add indefinite article and update timestamp
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/share/man/man4/sfxge.4

Modified: head/share/man/man4/sfxge.4
==
--- head/share/man/man4/sfxge.4 Sun Feb 22 18:57:28 2015(r279180)
+++ head/share/man/man4/sfxge.4 Sun Feb 22 18:59:00 2015(r279181)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 30, 2014
+.Dd February 22, 2015
 .Dt SFXGE 4
 .Os
 .Sh NAME
@@ -103,7 +103,7 @@ The value must be greater than 0.
 The maximum number of non-TCP packets in the deferred packet
 .Dq get-list
 , used only if the transmit queue lock can be acquired.
-If packet is dropped, the
+If a packet is dropped, the
 .Va tx_get_non_tcp_overflow
 counter is incremented and the local sender receives ENOBUFS.
 The value must be greater than 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"


svn commit: r279180 - head/sys/modules/sfxge

2015-02-22 Thread Andrew Rybchenko
Author: arybchik
Date: Sun Feb 22 18:57:28 2015
New Revision: 279180
URL: https://svnweb.freebsd.org/changeset/base/279180

Log:
  sfxge: list header in SRCS
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/modules/sfxge/Makefile

Modified: head/sys/modules/sfxge/Makefile
==
--- head/sys/modules/sfxge/Makefile Sun Feb 22 18:56:03 2015
(r279179)
+++ head/sys/modules/sfxge/Makefile Sun Feb 22 18:57:28 2015
(r279180)
@@ -11,14 +11,19 @@ SRCS+=  opt_inet.h opt_sched.h
 SRCS+= sfxge.c sfxge_dma.c sfxge_ev.c
 SRCS+= sfxge_intr.c sfxge_mcdi.c
 SRCS+= sfxge_port.c sfxge_rx.c sfxge_tx.c
+SRCS+= sfxge.h sfxge_rx.h sfxge_tx.h
 
 .PATH: ${.CURDIR}/../../dev/sfxge/common
 SRCS+= efx_ev.c efx_intr.c efx_mac.c efx_mcdi.c efx_nic.c 
 SRCS+= efx_nvram.c efx_phy.c efx_port.c efx_rx.c efx_sram.c efx_tx.c
 SRCS+= efx_vpd.c efx_wol.c
+SRCS+= efsys.h
+SRCS+= efx.h efx_impl.h efx_mcdi.h efx_regs.h efx_regs_ef10.h
+SRCS+= efx_regs_mcdi.h efx_regs_pci.h efx_types.h
 
 SRCS+= siena_mac.c siena_nic.c siena_nvram.c siena_phy.c
 SRCS+= siena_sram.c siena_vpd.c 
+SRCS+= siena_flash.h siena_impl.h
 
 DEBUG_FLAGS= -DDEBUG=1
 
___
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: r279179 - head/sys/dev/sfxge

2015-02-22 Thread Andrew Rybchenko
Author: arybchik
Date: Sun Feb 22 18:56:03 2015
New Revision: 279179
URL: https://svnweb.freebsd.org/changeset/base/279179

Log:
  sfxge: DMA allocated memory is set to zeros because of BUS_DMA_ZERO flag
  
  It is not required to set it to zeros once again.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge_rx.c
  head/sys/dev/sfxge/sfxge_tx.c

Modified: head/sys/dev/sfxge/sfxge_rx.c
==
--- head/sys/dev/sfxge/sfxge_rx.c   Sun Feb 22 18:54:16 2015
(r279178)
+++ head/sys/dev/sfxge/sfxge_rx.c   Sun Feb 22 18:56:03 2015
(r279179)
@@ -1113,7 +1113,6 @@ sfxge_rx_qinit(struct sfxge_softc *sc, u
/* Allocate and zero DMA space. */
if ((rc = sfxge_dma_alloc(sc, EFX_RXQ_SIZE(sc->rxq_entries), esmp)) != 
0)
return (rc);
-   (void)memset(esmp->esm_base, 0, EFX_RXQ_SIZE(sc->rxq_entries));
 
/* Allocate buffer table entries. */
sfxge_sram_buf_tbl_alloc(sc, EFX_RXQ_NBUFS(sc->rxq_entries),

Modified: head/sys/dev/sfxge/sfxge_tx.c
==
--- head/sys/dev/sfxge/sfxge_tx.c   Sun Feb 22 18:54:16 2015
(r279178)
+++ head/sys/dev/sfxge/sfxge_tx.c   Sun Feb 22 18:56:03 2015
(r279179)
@@ -1400,7 +1400,6 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u
/* Allocate and zero DMA space for the descriptor ring. */
if ((rc = sfxge_dma_alloc(sc, EFX_TXQ_SIZE(sc->txq_entries), esmp)) != 
0)
return (rc);
-   (void)memset(esmp->esm_base, 0, EFX_TXQ_SIZE(sc->txq_entries));
 
/* Allocate buffer table entries. */
sfxge_sram_buf_tbl_alloc(sc, EFX_TXQ_NBUFS(sc->txq_entries),
___
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: r279178 - head/sys/dev/sfxge/common

2015-02-22 Thread Andrew Rybchenko
Author: arybchik
Date: Sun Feb 22 18:54:16 2015
New Revision: 279178
URL: https://svnweb.freebsd.org/changeset/base/279178

Log:
  sfxge: do no allow EFSYS_MEM_ALLOC sleep
  
  It solves locking problem when EFSYS_MEM_ALLOC is called in
  the context holding a mutex (not allowed to sleep).
  E.g. on interface bring up or multicast addresses addition.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/common/efsys.h

Modified: head/sys/dev/sfxge/common/efsys.h
==
--- head/sys/dev/sfxge/common/efsys.h   Sun Feb 22 18:52:15 2015
(r279177)
+++ head/sys/dev/sfxge/common/efsys.h   Sun Feb 22 18:54:16 2015
(r279178)
@@ -941,7 +941,11 @@ typedefclock_t efsys_timestamp_t;
 #defineEFSYS_KMEM_ALLOC(_esip, _size, _p)  
\
do {\
(_esip) = (_esip);  \
-   (_p) = malloc((_size), M_SFXGE, M_WAITOK|M_ZERO);   \
+   /*  \
+* The macro is used in non-sleepable contexts, for \
+* example, holding a mutex.\
+*/ \
+   (_p) = malloc((_size), M_SFXGE, M_NOWAIT|M_ZERO);   \
_NOTE(CONSTANTCONDITION)\
} while (B_FALSE)
 
___
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: r279177 - head/sys/dev/sfxge

2015-02-22 Thread Andrew Rybchenko
Author: arybchik
Date: Sun Feb 22 18:52:15 2015
New Revision: 279177
URL: https://svnweb.freebsd.org/changeset/base/279177

Log:
  sfxge: assert event queue lock in event handlers
  
  It is useful to highlight lock context.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge_ev.c

Modified: head/sys/dev/sfxge/sfxge_ev.c
==
--- head/sys/dev/sfxge/sfxge_ev.c   Sun Feb 22 18:50:59 2015
(r279176)
+++ head/sys/dev/sfxge/sfxge_ev.c   Sun Feb 22 18:52:15 2015
(r279177)
@@ -50,6 +50,8 @@ sfxge_ev_qcomplete(struct sfxge_evq *evq
struct sfxge_rxq *rxq;
struct sfxge_txq *txq;
 
+   SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
+
sc = evq->sc;
index = evq->index;
rxq = sc->rxq[index];
@@ -89,6 +91,8 @@ sfxge_ev_rx(void *arg, uint32_t label, u
struct sfxge_rx_sw_desc *rx_desc;
 
evq = arg;
+   SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
+
sc = evq->sc;
 
if (evq->exception)
@@ -140,6 +144,8 @@ sfxge_ev_exception(void *arg, uint32_t c
struct sfxge_softc *sc;
 
evq = (struct sfxge_evq *)arg;
+   SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
+
sc = evq->sc;
 
evq->exception = B_TRUE;
@@ -165,6 +171,8 @@ sfxge_ev_rxq_flush_done(void *arg, uint3
uint16_t magic;
 
evq = (struct sfxge_evq *)arg;
+   SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
+
sc = evq->sc;
rxq = sc->rxq[rxq_index];
 
@@ -197,6 +205,8 @@ sfxge_ev_rxq_flush_failed(void *arg, uin
uint16_t magic;
 
evq = (struct sfxge_evq *)arg;
+   SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
+
sc = evq->sc;
rxq = sc->rxq[rxq_index];
 
@@ -238,6 +248,8 @@ sfxge_ev_tx(void *arg, uint32_t label, u
unsigned int delta;
 
evq = (struct sfxge_evq *)arg;
+   SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
+
txq = sfxge_get_txq_by_label(evq, label);
 
KASSERT(txq != NULL, ("txq == NULL"));
@@ -278,6 +290,8 @@ sfxge_ev_txq_flush_done(void *arg, uint3
uint16_t magic;
 
evq = (struct sfxge_evq *)arg;
+   SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
+
sc = evq->sc;
txq = sc->txq[txq_index];
 
@@ -308,6 +322,8 @@ sfxge_ev_software(void *arg, uint16_t ma
unsigned int label;
 
evq = (struct sfxge_evq *)arg;
+   SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
+
sc = evq->sc;
 
label = magic & SFXGE_MAGIC_DMAQ_LABEL_MASK;
@@ -533,6 +549,7 @@ sfxge_ev_initialized(void *arg)
struct sfxge_evq *evq;
 
evq = (struct sfxge_evq *)arg;
+   SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
 
KASSERT(evq->init_state == SFXGE_EVQ_STARTING,
("evq not starting"));
@@ -549,6 +566,8 @@ sfxge_ev_link_change(void *arg, efx_link
struct sfxge_softc *sc;
 
evq = (struct sfxge_evq *)arg;
+   SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
+
sc = evq->sc;
 
sfxge_mac_link_update(sc, link_mode);
___
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: r279176 - head/sys/dev/sfxge

2015-02-22 Thread Andrew Rybchenko
Author: arybchik
Date: Sun Feb 22 18:50:59 2015
New Revision: 279176
URL: https://svnweb.freebsd.org/changeset/base/279176

Log:
  sfxge: pass correct address to free allocated memory in the case of load error
  
  It is one more place missed in the previous fix.
  Most likely is was just memory leak on the error handling path since
  typically efsys_mem_t is filled in by zeros on allocation.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge_dma.c

Modified: head/sys/dev/sfxge/sfxge_dma.c
==
--- head/sys/dev/sfxge/sfxge_dma.c  Sun Feb 22 18:48:54 2015
(r279175)
+++ head/sys/dev/sfxge/sfxge_dma.c  Sun Feb 22 18:50:59 2015
(r279176)
@@ -168,8 +168,8 @@ sfxge_dma_alloc(struct sfxge_softc *sc, 
 * wrong.
 */
if (esmp->esm_addr == 0) {
-   bus_dmamem_free(esmp->esm_tag, esmp->esm_base, esmp->esm_map);
-   bus_dma_tag_destroy(esmp->esm_tag); 
+   bus_dmamem_free(esmp->esm_tag, vaddr, esmp->esm_map);
+   bus_dma_tag_destroy(esmp->esm_tag);
return (ENOMEM);
}
 
___
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: r279175 - head/sys/dev/sfxge/common

2015-02-22 Thread Andrew Rybchenko
Author: arybchik
Date: Sun Feb 22 18:48:54 2015
New Revision: 279175
URL: https://svnweb.freebsd.org/changeset/base/279175

Log:
  sfxge: using bus_space_*_stream_* API for better portability
  
  Host-bus byte order translation is not requred.
  
  Submitted by:   Artem V. Andreev 
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/common/efsys.h

Modified: head/sys/dev/sfxge/common/efsys.h
==
--- head/sys/dev/sfxge/common/efsys.h   Sun Feb 22 18:47:30 2015
(r279174)
+++ head/sys/dev/sfxge/common/efsys.h   Sun Feb 22 18:48:54 2015
(r279175)
@@ -94,6 +94,15 @@ extern "C" {
 #defineISP2(x) (((x) & ((x) - 1)) == 0)
 #endif
 
+#if defined(__x86_64__)
+#if !defined(bus_space_read_stream_8)
+#definebus_space_read_stream_8(t, h, o)
\
+   bus_space_read_8((t), (h), (o))
+#definebus_space_write_stream_8(t, h, o, v)
\
+   bus_space_write_8((t), (h), (o), (v))
+#endif
+#endif
+
 #defineENOTACTIVE EINVAL
 
 /* Memory type to use on FreeBSD */
@@ -641,8 +650,9 @@ typedef struct efsys_bar_s {
if (_lock)  \
SFXGE_BAR_LOCK(_esbp);  \
\
-   (_edp)->ed_u32[0] = bus_space_read_4((_esbp)->esb_tag,  \
-   (_esbp)->esb_handle, (_offset));\
+   (_edp)->ed_u32[0] = bus_space_read_stream_4(\
+   (_esbp)->esb_tag, (_esbp)->esb_handle,  \
+   (_offset)); \
\
EFSYS_PROBE2(bar_readd, unsigned int, (_offset),\
uint32_t, (_edp)->ed_u32[0]);   \
@@ -662,8 +672,9 @@ typedef struct efsys_bar_s {
\
SFXGE_BAR_LOCK(_esbp);  \
\
-   (_eqp)->eq_u64[0] = bus_space_read_8((_esbp)->esb_tag,  \
-   (_esbp)->esb_handle, (_offset));\
+   (_eqp)->eq_u64[0] = bus_space_read_stream_8(\
+   (_esbp)->esb_tag, (_esbp)->esb_handle,  \
+   (_offset)); \
\
EFSYS_PROBE3(bar_readq, unsigned int, (_offset),\
uint32_t, (_eqp)->eq_u32[1],\
@@ -683,10 +694,12 @@ typedef struct efsys_bar_s {
if (_lock)  \
SFXGE_BAR_LOCK(_esbp);  \
\
-   (_eop)->eo_u64[0] = bus_space_read_8((_esbp)->esb_tag,  \
-   (_esbp)->esb_handle, (_offset));\
-   (_eop)->eo_u64[1] = bus_space_read_8((_esbp)->esb_tag,  \
-   (_esbp)->esb_handle, (_offset+8));  \
+   (_eop)->eo_u64[0] = bus_space_read_stream_8(\
+   (_esbp)->esb_tag, (_esbp)->esb_handle,  \
+   (_offset)); \
+   (_eop)->eo_u64[1] = bus_space_read_stream_8(\
+   (_esbp)->esb_tag, (_esbp)->esb_handle,  \
+   (_offset) + 8); \
\
EFSYS_PROBE5(bar_reado, unsigned int, (_offset),\
uint32_t, (_eop)->eo_u32[3],\
@@ -709,10 +722,12 @@ typedef struct efsys_bar_s {
\
SFXGE_BAR_LOCK(_esbp);  \
\
-   (_eqp)->eq_u32[0] = bus_space_read_4((_esbp)->esb_tag,  \
-   (_esbp)->esb_handle, (_offset));\
-   (_eqp)->eq_u32[1] = bus_space_read_4((_esbp)->esb_tag,  \
-   (_esbp)->esb_handle, (_offset+4));  \
+   (_eqp)->eq_u32[0] = bus_space_read_stream_4(\
+   (_esbp)->esb_tag, (_esbp)->esb_handle,  \
+   (_offset)); \
+   (_eqp)->eq_u32[

svn commit: r279174 - head/sys/dev/sfxge/common

2015-02-22 Thread Andrew Rybchenko
Author: arybchik
Date: Sun Feb 22 18:47:30 2015
New Revision: 279174
URL: https://svnweb.freebsd.org/changeset/base/279174

Log:
  sfxge: add missing Siena sensors to common code
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/common/siena_mon.c

Modified: head/sys/dev/sfxge/common/siena_mon.c
==
--- head/sys/dev/sfxge/common/siena_mon.c   Sun Feb 22 18:46:11 2015
(r279173)
+++ head/sys/dev/sfxge/common/siena_mon.c   Sun Feb 22 18:47:30 2015
(r279174)
@@ -70,6 +70,21 @@ static __cs uint16_t __siena_mon_port0_m
EFX_MON_STAT_2_5V,  /* MC_CMD_SENSOR_IN_2V5 */
EFX_MON_STAT_3_3V,  /* MC_CMD_SENSOR_IN_3V3 */
EFX_MON_STAT_12V,   /* MC_CMD_SENSOR_IN_12V0 */
+   EFX_MON_STAT_1_2VA, /* MC_CMD_SENSOR_IN_1V2A */
+   EFX_MON_STAT_VREF,  /* MC_CMD_SENSOR_IN_VREF */
+   EFX_MON_STAT_VAOE,  /* MC_CMD_SENSOR_OUT_VAOE */
+   EFX_MON_STAT_AOE_TEMP,  /* MC_CMD_SENSOR_AOE_TEMP */
+   EFX_MON_STAT_PSU_AOE_TEMP,  /* MC_CMD_SENSOR_PSU_AOE_TEMP */
+   EFX_MON_STAT_PSU_TEMP,  /* MC_CMD_SENSOR_PSE_TEMP */
+   EFX_MON_STAT_FAN0,  /* MC_CMD_SENSOR_FAN_0 */
+   EFX_MON_STAT_FAN1,  /* MC_CMD_SENSOR_FAN_1 */
+   EFX_MON_STAT_FAN2,  /* MC_CMD_SENSOR_FAN_2 */
+   EFX_MON_STAT_FAN3,  /* MC_CMD_SENSOR_FAN_3 */
+   EFX_MON_STAT_FAN4,  /* MC_CMD_SENSOR_FAN_4 */
+   EFX_MON_STAT_VAOE_IN,   /* MC_CMD_SENSOR_IN_VAOE */
+   EFX_MON_STAT_IAOE,  /* MC_CMD_SENSOR_OUT_IAOE */
+   EFX_MON_STAT_IAOE_IN,   /* MC_CMD_SENSOR_IN_IAOE */
+
 };
 
 static __cs uint16_t __siena_mon_port1_map[] = {
@@ -86,6 +101,21 @@ static __cs uint16_t __siena_mon_port1_m
EFX_MON_STAT_2_5V,  /* MC_CMD_SENSOR_IN_2V5 */
EFX_MON_STAT_3_3V,  /* MC_CMD_SENSOR_IN_3V3 */
EFX_MON_STAT_12V,   /* MC_CMD_SENSOR_IN_12V0 */
+   EFX_MON_STAT_1_2VA, /* MC_CMD_SENSOR_IN_1V2A */
+   EFX_MON_STAT_VREF,  /* MC_CMD_SENSOR_IN_VREF */
+   EFX_MON_STAT_VAOE,  /* MC_CMD_SENSOR_OUT_VAOE */
+   EFX_MON_STAT_AOE_TEMP,  /* MC_CMD_SENSOR_AOE_TEMP */
+   EFX_MON_STAT_PSU_AOE_TEMP,  /* MC_CMD_SENSOR_PSU_AOE_TEMP */
+   EFX_MON_STAT_PSU_TEMP,  /* MC_CMD_SENSOR_PSE_TEMP */
+   EFX_MON_STAT_FAN0,  /* MC_CMD_SENSOR_FAN_0 */
+   EFX_MON_STAT_FAN1,  /* MC_CMD_SENSOR_FAN_1 */
+   EFX_MON_STAT_FAN2,  /* MC_CMD_SENSOR_FAN_2 */
+   EFX_MON_STAT_FAN3,  /* MC_CMD_SENSOR_FAN_3 */
+   EFX_MON_STAT_FAN4,  /* MC_CMD_SENSOR_FAN_4 */
+   EFX_MON_STAT_VAOE_IN,   /* MC_CMD_SENSOR_IN_VAOE */
+   EFX_MON_STAT_IAOE,  /* MC_CMD_SENSOR_OUT_IAOE */
+   EFX_MON_STAT_IAOE_IN,   /* MC_CMD_SENSOR_IN_IAOE */
+
 };
 
 #defineSIENA_STATIC_SENSOR_ASSERT(_field)  
\
___
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: r279173 - head/sys/dev/sfxge/common

2015-02-22 Thread Andrew Rybchenko
Author: arybchik
Date: Sun Feb 22 18:46:11 2015
New Revision: 279173
URL: https://svnweb.freebsd.org/changeset/base/279173

Log:
  sfxge: add missing common code NVRAM types and map from MCDI
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/siena_nvram.c

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Sun Feb 22 18:44:37 2015
(r279172)
+++ head/sys/dev/sfxge/common/efx.h Sun Feb 22 18:46:11 2015
(r279173)
@@ -1024,6 +1024,10 @@ typedef enum efx_nvram_type_e {
EFX_NVRAM_MC_GOLDEN,
EFX_NVRAM_PHY,
EFX_NVRAM_NULLPHY,
+   EFX_NVRAM_FPGA,
+   EFX_NVRAM_FCFW,
+   EFX_NVRAM_CPLD,
+   EFX_NVRAM_FPGA_BACKUP,
EFX_NVRAM_NTYPES,
 } efx_nvram_type_t;
 

Modified: head/sys/dev/sfxge/common/siena_nvram.c
==
--- head/sys/dev/sfxge/common/siena_nvram.c Sun Feb 22 18:44:37 2015
(r279172)
+++ head/sys/dev/sfxge/common/siena_nvram.c Sun Feb 22 18:46:11 2015
(r279173)
@@ -330,6 +330,14 @@ static siena_parttbl_entry_t siena_partt
{MC_CMD_NVRAM_TYPE_EXP_ROM_CFG_PORT1,   2, EFX_NVRAM_BOOTROM_CFG},
{MC_CMD_NVRAM_TYPE_PHY_PORT0,   1, EFX_NVRAM_PHY},
{MC_CMD_NVRAM_TYPE_PHY_PORT1,   2, EFX_NVRAM_PHY},
+   {MC_CMD_NVRAM_TYPE_FPGA,1, EFX_NVRAM_FPGA},
+   {MC_CMD_NVRAM_TYPE_FPGA,2, EFX_NVRAM_FPGA},
+   {MC_CMD_NVRAM_TYPE_FPGA_BACKUP, 1, EFX_NVRAM_FPGA_BACKUP},
+   {MC_CMD_NVRAM_TYPE_FPGA_BACKUP, 2, EFX_NVRAM_FPGA_BACKUP},
+   {MC_CMD_NVRAM_TYPE_FC_FW,   1, EFX_NVRAM_FCFW},
+   {MC_CMD_NVRAM_TYPE_FC_FW,   2, EFX_NVRAM_FCFW},
+   {MC_CMD_NVRAM_TYPE_CPLD,1, EFX_NVRAM_CPLD},
+   {MC_CMD_NVRAM_TYPE_CPLD,2, EFX_NVRAM_CPLD},
{0, 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"


svn commit: r279172 - head/sys/dev/sfxge/common

2015-02-22 Thread Andrew Rybchenko
Author: arybchik
Date: Sun Feb 22 18:44:37 2015
New Revision: 279172
URL: https://svnweb.freebsd.org/changeset/base/279172

Log:
  sfxge: add new identities to Siena static config
  
  Submitted by:   Andrew Jackson 
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/common/siena_flash.h

Modified: head/sys/dev/sfxge/common/siena_flash.h
==
--- head/sys/dev/sfxge/common/siena_flash.h Sun Feb 22 18:04:32 2015
(r279171)
+++ head/sys/dev/sfxge/common/siena_flash.h Sun Feb 22 18:44:37 2015
(r279172)
@@ -81,7 +81,9 @@ typedef struct siena_mc_static_config_hd
efx_byte_t  green_mode_valid;   /* Whether cal holds a valid 
value */
efx_word_t  mac_addr_count;
efx_word_t  mac_addr_stride;
-   efx_dword_t reserved2[2];   /* (write as zero) */
+   efx_word_t  calibrated_vref;
+   efx_word_t  adc_vref;
+   efx_dword_t reserved2[1];   /* (write as zero) */
efx_dword_t num_dbi_items;
struct {
efx_word_t  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: r279162 - head/contrib/llvm/patches

2015-02-22 Thread Dimitry Andric
Author: dim
Date: Sun Feb 22 15:56:16 2015
New Revision: 279162
URL: https://svnweb.freebsd.org/changeset/base/279162

Log:
  Add llvm patch corresponding to r279161.

Added:
  head/contrib/llvm/patches/patch-32-llvm-r230058-indirectbrs-assert.diff

Added: head/contrib/llvm/patches/patch-32-llvm-r230058-indirectbrs-assert.diff
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/llvm/patches/patch-32-llvm-r230058-indirectbrs-assert.diff 
Sun Feb 22 15:56:16 2015(r279162)
@@ -0,0 +1,55 @@
+Pull in r230058 from upstream llvm trunk (by Benjamin Kramer):
+
+  LoopRotate: When reconstructing loop simplify form don't split edges
+  from indirectbrs.
+
+  Yet another chapter in the endless story. While this looks like we
+  leave the loop in a non-canonical state this replicates the logic in
+  LoopSimplify so it doesn't diverge from the canonical form in any way.
+
+  PR21968
+
+This fixes a "Cannot split critical edge from IndirectBrInst" assertion
+failure when building the devel/radare2 port.
+
+Introduced here: https://svnweb.freebsd.org/changeset/base/279161
+
+Index: lib/Transforms/Scalar/LoopRotation.cpp
+===
+--- lib/Transforms/Scalar/LoopRotation.cpp
 lib/Transforms/Scalar/LoopRotation.cpp
+@@ -498,6 +498,8 @@ bool LoopRotate::rotateLoop(Loop *L, bool Simplifi
+   Loop *PredLoop = LI->getLoopFor(*PI);
+   if (!PredLoop || PredLoop->contains(Exit))
+ continue;
++  if (isa((*PI)->getTerminator()))
++continue;
+   SplitLatchEdge |= L->getLoopLatch() == *PI;
+   BasicBlock *ExitSplit = SplitCriticalEdge(*PI, Exit, this);
+   ExitSplit->moveBefore(Exit);
+Index: test/Transforms/LoopRotate/crash.ll
+===
+--- test/Transforms/LoopRotate/crash.ll
 test/Transforms/LoopRotate/crash.ll
+@@ -153,3 +153,21 @@ entry:
+ "5":  ; preds = %"3", %entry
+   ret void
+ }
++
++; PR21968
++define void @test8(i1 %C, i8* %P) #0 {
++entry:
++  br label %for.cond
++
++for.cond: ; preds = %for.inc, %entry
++  br i1 %C, label %l_bad, label %for.body
++
++for.body: ; preds = %for.cond
++  indirectbr i8* %P, [label %for.inc, label %l_bad]
++
++for.inc:  ; preds = %for.body
++  br label %for.cond
++
++l_bad:; preds = %for.body, 
%for.cond
++  ret void
++}
___
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: r279161 - head/contrib/llvm/lib/Transforms/Scalar

2015-02-22 Thread Dimitry Andric
Author: dim
Date: Sun Feb 22 15:51:49 2015
New Revision: 279161
URL: https://svnweb.freebsd.org/changeset/base/279161

Log:
  Pull in r230058 from upstream llvm trunk (by Benjamin Kramer):
  
LoopRotate: When reconstructing loop simplify form don't split edges
from indirectbrs.
  
Yet another chapter in the endless story. While this looks like we
leave the loop in a non-canonical state this replicates the logic in
LoopSimplify so it doesn't diverge from the canonical form in any way.
  
http://llvm.org/PR21968
  
  This fixes a "Cannot split critical edge from IndirectBrInst" assertion
  failure when building the devel/radare2 port.
  
  PR:   195480, 196987
  MFC after:3 days

Modified:
  head/contrib/llvm/lib/Transforms/Scalar/LoopRotation.cpp

Modified: head/contrib/llvm/lib/Transforms/Scalar/LoopRotation.cpp
==
--- head/contrib/llvm/lib/Transforms/Scalar/LoopRotation.cppSun Feb 22 
15:48:36 2015(r279160)
+++ head/contrib/llvm/lib/Transforms/Scalar/LoopRotation.cppSun Feb 22 
15:51:49 2015(r279161)
@@ -498,6 +498,8 @@ bool LoopRotate::rotateLoop(Loop *L, boo
   Loop *PredLoop = LI->getLoopFor(*PI);
   if (!PredLoop || PredLoop->contains(Exit))
 continue;
+  if (isa((*PI)->getTerminator()))
+continue;
   SplitLatchEdge |= L->getLoopLatch() == *PI;
   BasicBlock *ExitSplit = SplitCriticalEdge(*PI, Exit, this);
   ExitSplit->moveBefore(Exit);
___
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: r279156 - head/usr.sbin/pmccontrol

2015-02-22 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Feb 22 14:45:00 2015
New Revision: 279156
URL: https://svnweb.freebsd.org/changeset/base/279156

Log:
  pmccontrol(8): Replace malloc() + memset() with calloc()
  
  PMCC_OP_IGNORE happens to be zero, so just use calloc() here.

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

Modified: head/usr.sbin/pmccontrol/pmccontrol.c
==
--- head/usr.sbin/pmccontrol/pmccontrol.c   Sun Feb 22 14:03:40 2015
(r279155)
+++ head/usr.sbin/pmccontrol/pmccontrol.c   Sun Feb 22 14:45:00 2015
(r279156)
@@ -147,11 +147,9 @@ pmcc_do_enable_disable(struct pmcc_op_li
if (npmc == 0)
errx(EX_CONFIG, "No PMCs found");
 
-   if ((map = malloc(npmc * ncpu)) == NULL)
+   if ((map = calloc(npmc, ncpu)) == NULL)
err(EX_SOFTWARE, "Out of memory");
 
-   (void) memset(map, PMCC_OP_IGNORE, npmc*ncpu);
-
error = 0;
STAILQ_FOREACH(np, op_list, op_next) {
 
___
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: r279154 - in head: contrib/netbsd-tests/lib/libc/gen lib/libc/gen

2015-02-22 Thread Jilles Tjoelker
Author: jilles
Date: Sun Feb 22 13:36:44 2015
New Revision: 279154
URL: https://svnweb.freebsd.org/changeset/base/279154

Log:
  nice(): Correct return value and [EPERM] error.
  
  PR:   189821
  Obtained from:NetBSD
  Relnotes: yes

Modified:
  head/contrib/netbsd-tests/lib/libc/gen/t_nice.c
  head/lib/libc/gen/nice.3
  head/lib/libc/gen/nice.c

Modified: head/contrib/netbsd-tests/lib/libc/gen/t_nice.c
==
--- head/contrib/netbsd-tests/lib/libc/gen/t_nice.c Sun Feb 22 11:11:05 
2015(r279153)
+++ head/contrib/netbsd-tests/lib/libc/gen/t_nice.c Sun Feb 22 13:36:44 
2015(r279154)
@@ -72,11 +72,6 @@ ATF_TC_BODY(nice_err, tc)
 {
int i;
 
-#ifdef __FreeBSD__
-   atf_tc_expect_fail("nice(incr) with incr < 0 fails with unprivileged "
-  "users and sets errno == EPERM; see PR # 189821 for more details");
-#endif
-
/*
 * The call should fail with EPERM if the
 * supplied parameter is negative and the
@@ -98,11 +93,7 @@ ATF_TC_HEAD(nice_priority, tc)
 
 ATF_TC_BODY(nice_priority, tc)
 {
-#ifdef __FreeBSD__
-   int i, pri, pri2, nic;
-#else
int i, pri, nic;
-#endif
pid_t pid;
int sta;
 
@@ -115,10 +106,8 @@ ATF_TC_BODY(nice_priority, tc)
pri = getpriority(PRIO_PROCESS, 0);
ATF_REQUIRE(errno == 0);
 
-#ifdef __NetBSD__
if (nic != pri)
atf_tc_fail("nice(3) and getpriority(2) conflict");
-#endif
 
/*
 * Also verify that the nice(3) values
@@ -130,18 +119,10 @@ ATF_TC_BODY(nice_priority, tc)
if (pid == 0) {
 
errno = 0;
-#ifdef __FreeBSD__
pri = getpriority(PRIO_PROCESS, 0);
-#else
-   pri2 = getpriority(PRIO_PROCESS, 0);
-#endif
ATF_REQUIRE(errno == 0);
 
-#ifdef __FreeBSD__
-   if (pri != pri2)
-#else
if (nic != pri)
-#endif
_exit(EXIT_FAILURE);
 
_exit(EXIT_SUCCESS);
@@ -180,11 +161,7 @@ ATF_TC_HEAD(nice_thread, tc)
 ATF_TC_BODY(nice_thread, tc)
 {
pthread_t tid[5];
-#ifdef __FreeBSD__
-   int pri, rv, val;
-#else
int rv, val;
-#endif
size_t i;
 
/*
@@ -196,12 +173,7 @@ ATF_TC_BODY(nice_thread, tc)
val = nice(i);
ATF_REQUIRE(val != -1);
 
-#ifdef __FreeBSD__
-   pri = getpriority(PRIO_PROCESS, 0);
-   rv = pthread_create(&tid[i], NULL, threadfunc, &pri);
-#else
rv = pthread_create(&tid[i], NULL, threadfunc, &val);
-#endif
ATF_REQUIRE(rv == 0);
 
rv = pthread_join(tid[i], NULL);

Modified: head/lib/libc/gen/nice.3
==
--- head/lib/libc/gen/nice.3Sun Feb 22 11:11:05 2015(r279153)
+++ head/lib/libc/gen/nice.3Sun Feb 22 13:36:44 2015(r279154)
@@ -28,7 +28,7 @@
 .\" @(#)nice.3 8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd June 4, 1993
+.Dd February 22, 2015
 .Dt NICE 3
 .Os
 .Sh NAME
@@ -57,11 +57,34 @@ Only the super-user may lower priorities
 .Pp
 Children inherit the priority of their parent processes via
 .Xr fork 2 .
+.Sh RETURN VALUES
+Upon successful completion,
+.Fn nice
+returns the new nice value minus
+.Dv NZERO .
+Otherwise, \-1 is returned, the process' nice value is not changed, and
+.Va errno
+is set to indicate the error.
+.Sh ERRORS
+The
+.Fn nice
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EPERM
+The
+.Fa incr
+argument is negative and the caller does not have appropriate privileges.
+.El
 .Sh SEE ALSO
 .Xr nice 1 ,
 .Xr fork 2 ,
 .Xr setpriority 2 ,
 .Xr renice 8
+.Sh STANDARDS
+The
+.Fn nice
+function conforms to
+.St -xpg4.2 .
 .Sh HISTORY
 A
 .Fn nice

Modified: head/lib/libc/gen/nice.c
==
--- head/lib/libc/gen/nice.cSun Feb 22 11:11:05 2015(r279153)
+++ head/lib/libc/gen/nice.cSun Feb 22 13:36:44 2015(r279154)
@@ -43,14 +43,18 @@ __FBSDID("$FreeBSD$");
  * Backwards compatible nice.
  */
 int
-nice(incr)
-   int incr;
+nice(int incr)
 {
int prio;
 
errno = 0;
prio = getpriority(PRIO_PROCESS, 0);
if (prio == -1 && errno)
-   return (-1);
-   return (setpriority(PRIO_PROCESS, 0, prio + incr));
+   return -1;
+   if (setpriority(PRIO_PROCESS, 0, prio + incr) == -1) {
+   if (errno == EACCES)
+   errno = EPERM;
+   return -1;
+   }
+   return getpriority(PRIO_PROCESS, 0);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any ma

Re: svn commit: r272284 - head/usr.bin/systat

2015-02-22 Thread Slawa Olhovchenkov
On Mon, Sep 29, 2014 at 05:38:51PM +, Ryan Stone wrote:

> Author: rstone
> Date: Mon Sep 29 17:38:50 2014
> New Revision: 272284
> URL: http://svnweb.freebsd.org/changeset/base/272284
> 
> Log:
>   Fix integer truncation in affecting systat -ifstat
>   
>   The "systat -ifstat" command was using a u_int to store byte counters.
>   With a 10Gbps or faster interface, this overflows within the default
>   5 second refresh period.  Switch to using a uint64_t across the board,
>   which matches the size used for all counters as of r263102.
>   
>   PR: 182448
>   MFC after:  1 week
>   Sponsored by:   Sandvine Inc

No NFC yet.
___
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: r279153 - head/sys/arm/broadcom/bcm2835

2015-02-22 Thread Andrew Turner
Author: andrew
Date: Sun Feb 22 11:11:05 2015
New Revision: 279153
URL: https://svnweb.freebsd.org/changeset/base/279153

Log:
  Add support to the bcm2835 mailbox driver to work before interrupts are
  enabled. This will be needed to enable the power on devices early on in the
  boot process.

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_mbox.cSun Feb 22 08:54:25 
2015(r279152)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_mbox.cSun Feb 22 11:11:05 
2015(r279153)
@@ -89,27 +89,39 @@ struct bcm_mbox_softc {
 #definembox_write_4(sc, reg, val)  \
 bus_space_write_4((sc)->bst, (sc)->bsh, reg, val)
 
+static int
+bcm_mbox_read_msg(struct bcm_mbox_softc *sc, int *ochan)
+{
+   uint32_t data;
+   uint32_t msg;
+   int chan;
+
+   msg = mbox_read_4(sc, REG_READ);
+   dprintf("bcm_mbox_intr: raw data %08x\n", msg);
+   chan = MBOX_CHAN(msg);
+   data = MBOX_DATA(msg);
+   if (sc->msg[chan]) {
+   printf("bcm_mbox_intr: channel %d oveflow\n", chan);
+   return (1);
+   }
+   dprintf("bcm_mbox_intr: chan %d, data %08x\n", chan, data);
+   sc->msg[chan] = msg;
+
+   if (ochan != NULL)
+   *ochan = chan;
+
+   return (0);
+}
+
 static void
 bcm_mbox_intr(void *arg)
 {
struct bcm_mbox_softc *sc = arg;
int chan;
-   uint32_t data;
-   uint32_t msg;
 
-   while (!(mbox_read_4(sc, REG_STATUS) & STATUS_EMPTY)) {
-   msg = mbox_read_4(sc, REG_READ);
-   dprintf("bcm_mbox_intr: raw data %08x\n", msg);
-   chan = MBOX_CHAN(msg);
-   data = MBOX_DATA(msg);
-   if (sc->msg[chan]) {
-   printf("bcm_mbox_intr: channel %d oveflow\n", chan);
-   continue;
-   }
-   dprintf("bcm_mbox_intr: chan %d, data %08x\n", chan, data);
-   sc->msg[chan] = msg;
-   sema_post(&sc->sema[chan]);
-   }
+   while (!(mbox_read_4(sc, REG_STATUS) & STATUS_EMPTY))
+   if (bcm_mbox_read_msg(sc, &chan) == 0)
+   sema_post(&sc->sema[chan]);
 }
 
 static int
@@ -201,14 +213,30 @@ static int
 bcm_mbox_read(device_t dev, int chan, uint32_t *data)
 {
struct bcm_mbox_softc *sc = device_get_softc(dev);
+   int err, read_chan;
 
dprintf("bcm_mbox_read: chan %d\n", chan);
+
+   err = 0;
MBOX_LOCK(sc);
-   while (sema_trywait(&sc->sema[chan]) == 0) {
-   /* do not unlock sc while waiting for the mbox */
-   if (sema_timedwait(&sc->sema[chan], 10*hz) == 0)
-   break;
-   printf("timeout sema for chan %d\n", chan);
+   if (!cold) {
+   while (sema_trywait(&sc->sema[chan]) == 0) {
+   /* do not unlock sc while waiting for the mbox */
+   if (sema_timedwait(&sc->sema[chan], 10*hz) == 0)
+   break;
+   printf("timeout sema for chan %d\n", chan);
+   }
+   } else {
+   do {
+   /* Wait for a message */
+   while ((mbox_read_4(sc, REG_STATUS) & STATUS_EMPTY))
+   ;
+   /* Read the message */
+   if (bcm_mbox_read_msg(sc, &read_chan) != 0) {
+   err = EINVAL;
+   goto out;
+   }
+   } while (read_chan != chan);
}
/*
 *  get data from intr handler, the same channel is never coming
@@ -216,10 +244,11 @@ bcm_mbox_read(device_t dev, int chan, ui
 */
*data = MBOX_DATA(sc->msg[chan]);
sc->msg[chan] = 0;
+out:
MBOX_UNLOCK(sc);
dprintf("bcm_mbox_read: chan %d, data %08x\n", chan, *data);
 
-   return (0);
+   return (err);
 }
 
 static device_method_t bcm_mbox_methods[] = {
___
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: r279150 - in head: . games games/bcd games/ppt tools/build/mk

2015-02-22 Thread Colin Percival
Author: cperciva
Date: Sun Feb 22 08:50:05 2015
New Revision: 279150
URL: https://svnweb.freebsd.org/changeset/base/279150

Log:
  Step 2 of eliminating the "games" distribution: Remove punch card
  utilities.
  
  I was originally planning on removing the phase-of-moon (pom), clock
  (grdc), and caesar cipher (caesar, rot13) utilities as well, but after
  I committed r278616 I received an astonishing volume of email informing
  me that those are still being widely used.  Much to my relief, nobody
  reported continuing to use the punch card utilities in production.
  
  The final step will be to merge src/games into src/usr.bin.
  
  This change will not be MFCed.

Deleted:
  head/games/bcd/
  head/games/ppt/
Modified:
  head/ObsoleteFiles.inc
  head/games/Makefile
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Sun Feb 22 08:25:08 2015(r279149)
+++ head/ObsoleteFiles.inc  Sun Feb 22 08:50:05 2015(r279150)
@@ -38,6 +38,11 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20150222: Removed bcd(6) and ppt(6)
+OLD_FILES+=usr/bin/bcd
+OLD_FILES+=usr/bin/ppt
+OLD_FILES+=usr/share/man/man6/bcd.6.gz
+OLD_FILES+=usr/share/man/man6/ppt.6.gz
 # 20150217: Removed remnants of ar(4) driver
 OLD_FILES+=usr/include/sys/dev/ic/hd64570.h
 # 20150212: /usr/games moving into /usr/bin

Modified: head/games/Makefile
==
--- head/games/Makefile Sun Feb 22 08:25:08 2015(r279149)
+++ head/games/Makefile Sun Feb 22 08:50:05 2015(r279150)
@@ -3,7 +3,6 @@
 .include 
 
 SUBDIR= \
-   bcd \
caesar \
factor \
fortune \
@@ -11,7 +10,6 @@ SUBDIR= \
morse \
number \
pom \
-   ppt \
primes \
random \
${_tests}

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Sun Feb 22 08:25:08 
2015(r279149)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Sun Feb 22 08:50:05 
2015(r279150)
@@ -1606,7 +1606,6 @@ OLD_FILES+=usr/share/man/man8/freebsd-up
 .endif
 
 .if ${MK_GAMES} == no
-OLD_FILES+=usr/bin/bcd
 OLD_FILES+=usr/bin/caesar
 OLD_FILES+=usr/bin/factor
 OLD_FILES+=usr/bin/fortune
@@ -1614,7 +1613,6 @@ OLD_FILES+=usr/bin/grdc
 OLD_FILES+=usr/bin/morse
 OLD_FILES+=usr/bin/number
 OLD_FILES+=usr/bin/pom
-OLD_FILES+=usr/bin/ppt
 OLD_FILES+=usr/bin/primes
 OLD_FILES+=usr/bin/random
 OLD_FILES+=usr/bin/rot13
@@ -1638,7 +1636,6 @@ OLD_FILES+=usr/share/games/fortune/zippy
 OLD_FILES+=usr/share/games/fortune/zippy.dat
 OLD_DIRS+=usr/share/games/fortune
 OLD_DIRS+=usr/share/games
-OLD_FILES+=usr/share/man/man6/bcd.6.gz
 OLD_FILES+=usr/share/man/man6/caesar.6.gz
 OLD_FILES+=usr/share/man/man6/factor.6.gz
 OLD_FILES+=usr/share/man/man6/fortune.6.gz
@@ -1646,7 +1643,6 @@ OLD_FILES+=usr/share/man/man6/grdc.6.gz
 OLD_FILES+=usr/share/man/man6/morse.6.gz
 OLD_FILES+=usr/share/man/man6/number.6.gz
 OLD_FILES+=usr/share/man/man6/pom.6.gz
-OLD_FILES+=usr/share/man/man6/ppt.6.gz
 OLD_FILES+=usr/share/man/man6/primes.6.gz
 OLD_FILES+=usr/share/man/man6/random.6.gz
 OLD_FILES+=usr/share/man/man6/rot13.6.gz
___
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"