svn commit: r278932 - in head/lib/libc: rpc stdio

2015-02-17 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Feb 18 03:33:17 2015
New Revision: 278932
URL: https://svnweb.freebsd.org/changeset/base/278932

Log:
  libc: clean some set-but-not-used errors.
  
  These were found by gcc 5.0 on Dragonfly BSD, however I
  made no attempt to silence the false positives.
  
  Obtained from:DragonFly (cf515c3a6f3a8964ad592e524442bc628f8ed63b)

Modified:
  head/lib/libc/rpc/clnt_dg.c
  head/lib/libc/rpc/rpc_soc.c
  head/lib/libc/stdio/xprintf_float.c

Modified: head/lib/libc/rpc/clnt_dg.c
==
--- head/lib/libc/rpc/clnt_dg.c Wed Feb 18 03:02:03 2015(r278931)
+++ head/lib/libc/rpc/clnt_dg.c Wed Feb 18 03:33:17 2015(r278932)
@@ -327,7 +327,7 @@ clnt_dg_call(cl, proc, xargs, argsp, xre
struct sockaddr *sa;
sigset_t mask;
sigset_t newmask;
-   socklen_t inlen, salen;
+   socklen_t salen;
ssize_t recvlen = 0;
int kin_len, n, rpc_lock_value;
u_int32_t xid;
@@ -520,7 +520,6 @@ get_reply:
goto call_again_same_xid;
}
}
-   inlen = (socklen_t)recvlen;
 
/*
 * now decode and validate the response

Modified: head/lib/libc/rpc/rpc_soc.c
==
--- head/lib/libc/rpc/rpc_soc.c Wed Feb 18 03:02:03 2015(r278931)
+++ head/lib/libc/rpc/rpc_soc.c Wed Feb 18 03:33:17 2015(r278932)
@@ -462,12 +462,10 @@ clntunix_create(raddr, prog, vers, sockp
u_int recvsz;
 {
struct netbuf *svcaddr;
-   struct netconfig *nconf;
CLIENT *cl;
int len;
 
cl = NULL;
-   nconf = NULL;
svcaddr = NULL;
if ((raddr-sun_len == 0) ||
   ((svcaddr = malloc(sizeof(struct netbuf))) == NULL ) ||

Modified: head/lib/libc/stdio/xprintf_float.c
==
--- head/lib/libc/stdio/xprintf_float.c Wed Feb 18 03:02:03 2015
(r278931)
+++ head/lib/libc/stdio/xprintf_float.c Wed Feb 18 03:33:17 2015
(r278932)
@@ -168,7 +168,6 @@ __printf_render_float(struct __printf_io
int realsz; /* field size expanded by dprec, sign, etc */
int dprec;  /* a copy of prec if [diouxX], 0 otherwise */
char ox[2]; /* space for 0x; ox[1] is either x, X, or \0 */
-   int prsize; /* max size of printed field */
int ret;/* return value accumulator */
char *decimal_point;/* locale specific decimal point */
int n2; /* XXX: for PRINTANDPAD */
@@ -344,8 +343,6 @@ here:
if (ox[1])
realsz += 2;
 
-   prsize = pi-width  realsz ? pi-width : realsz;
-
/* right-adjusting blank padding */
if (pi-pad != '0'  pi-left == 0)
ret += __printf_pad(io, pi-width - realsz, 0);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278930 - in head/sys: kern ofed/include/linux sys

2015-02-17 Thread Mateusz Guzik
Author: mjg
Date: Tue Feb 17 23:54:06 2015
New Revision: 278930
URL: https://svnweb.freebsd.org/changeset/base/278930

Log:
  filedesc: simplify fget_unlocked  friends
  
  Introduce fget_fcntl which performs appropriate checks when needed.
  This removes a branch from fget_unlocked.
  
  Introduce fget_mmap dealing with cap_rights_to_vmprot conversion.
  This removes a branch from _fget.
  
  Modify fget_unlocked to pass sequence counter to interested callers so
  that they can perform their own checks and make sure the result was
  otained from stable  current state.
  
  Reviewed by:  silence on -hackers

Modified:
  head/sys/kern/kern_descrip.c
  head/sys/kern/sys_generic.c
  head/sys/kern/tty.c
  head/sys/kern/uipc_syscalls.c
  head/sys/kern/vfs_syscalls.c
  head/sys/ofed/include/linux/file.h
  head/sys/sys/file.h
  head/sys/sys/filedesc.h

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cTue Feb 17 23:41:08 2015
(r278929)
+++ head/sys/kern/kern_descrip.cTue Feb 17 23:54:06 2015
(r278930)
@@ -531,8 +531,8 @@ kern_fcntl(struct thread *td, int fd, in
break;
 
case F_GETFL:
-   error = fget_unlocked(fdp, fd,
-   cap_rights_init(rights, CAP_FCNTL), F_GETFL, fp, NULL);
+   error = fget_fcntl(td, fd,
+   cap_rights_init(rights, CAP_FCNTL), F_GETFL, fp);
if (error != 0)
break;
td-td_retval[0] = OFLAGS(fp-f_flag);
@@ -540,8 +540,8 @@ kern_fcntl(struct thread *td, int fd, in
break;
 
case F_SETFL:
-   error = fget_unlocked(fdp, fd,
-   cap_rights_init(rights, CAP_FCNTL), F_SETFL, fp, NULL);
+   error = fget_fcntl(td, fd,
+   cap_rights_init(rights, CAP_FCNTL), F_SETFL, fp);
if (error != 0)
break;
do {
@@ -568,8 +568,8 @@ kern_fcntl(struct thread *td, int fd, in
break;
 
case F_GETOWN:
-   error = fget_unlocked(fdp, fd,
-   cap_rights_init(rights, CAP_FCNTL), F_GETOWN, fp, NULL);
+   error = fget_fcntl(td, fd,
+   cap_rights_init(rights, CAP_FCNTL), F_GETOWN, fp);
if (error != 0)
break;
error = fo_ioctl(fp, FIOGETOWN, tmp, td-td_ucred, td);
@@ -579,8 +579,8 @@ kern_fcntl(struct thread *td, int fd, in
break;
 
case F_SETOWN:
-   error = fget_unlocked(fdp, fd,
-   cap_rights_init(rights, CAP_FCNTL), F_SETOWN, fp, NULL);
+   error = fget_fcntl(td, fd,
+   cap_rights_init(rights, CAP_FCNTL), F_SETOWN, fp);
if (error != 0)
break;
tmp = arg;
@@ -602,7 +602,7 @@ kern_fcntl(struct thread *td, int fd, in
case F_SETLK:
do_setlk:
cap_rights_init(rights, CAP_FLOCK);
-   error = fget_unlocked(fdp, fd, rights, 0, fp, NULL);
+   error = fget_unlocked(fdp, fd, rights, fp, NULL);
if (error != 0)
break;
if (fp-f_type != DTYPE_VNODE) {
@@ -691,7 +691,7 @@ kern_fcntl(struct thread *td, int fd, in
 * that the closing thread was a bit slower and that the
 * advisory lock succeeded before the close.
 */
-   error = fget_unlocked(fdp, fd, rights, 0, fp2, NULL);
+   error = fget_unlocked(fdp, fd, rights, fp2, NULL);
if (error != 0) {
fdrop(fp, td);
break;
@@ -710,7 +710,7 @@ kern_fcntl(struct thread *td, int fd, in
 
case F_GETLK:
error = fget_unlocked(fdp, fd,
-   cap_rights_init(rights, CAP_FLOCK), 0, fp, NULL);
+   cap_rights_init(rights, CAP_FLOCK), fp, NULL);
if (error != 0)
break;
if (fp-f_type != DTYPE_VNODE) {
@@ -748,7 +748,7 @@ kern_fcntl(struct thread *td, int fd, in
arg = arg ? 128 * 1024: 0;
/* FALLTHROUGH */
case F_READAHEAD:
-   error = fget_unlocked(fdp, fd, NULL, 0, fp, NULL);
+   error = fget_unlocked(fdp, fd, NULL, fp, NULL);
if (error != 0)
break;
if (fp-f_type != DTYPE_VNODE) {
@@ -2327,10 +2327,10 @@ finit(struct file *fp, u_int flag, short
 
 int
 fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp,
-int needfcntl, struct file **fpp, cap_rights_t *haverightsp)
+struct file **fpp, seq_t *seqp)
 {
 #ifdef CAPABILITIES
-   struct filedescent fde;
+   struct filedescent *fde;
 #endif
struct fdescenttbl *fdt;
struct file *fp;
@@ 

svn commit: r278933 - head/etc

2015-02-17 Thread Rui Paulo
Author: rpaulo
Date: Wed Feb 18 03:46:43 2015
New Revision: 278933
URL: https://svnweb.freebsd.org/changeset/base/278933

Log:
  Fix a typo in ipv6_down().
  
  We weren't skipping extraneous entries in the ifconfig | grep inet6 case.
  
  Submitted by: Ashutosh Kumar AK0037447 at TechMahindra.com
  MFC after:1 week

Modified:
  head/etc/network.subr

Modified: head/etc/network.subr
==
--- head/etc/network.subr   Wed Feb 18 03:33:17 2015(r278932)
+++ head/etc/network.subr   Wed Feb 18 03:46:43 2015(r278933)
@@ -754,7 +754,7 @@ ipv6_down()
IFS=$_ifs
for _inet6 in $inetList ; do
# get rid of extraneous line
-   case $_inet in
+   case $_inet6 in
inet6\ *)   ;;
*)  continue ;;
esac
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r278914 - in head/sys: kern sys

2015-02-17 Thread Rui Paulo
On Feb 17, 2015, at 11:32, Gleb Smirnoff gleb...@freebsd.org wrote:
 
  Differential Revision:   D1499

You need to use the *FULL* URL.  Otherwise the revision won't be closed 
automatically.  

--
Rui Paulo



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


svn commit: r278927 - head/sys/dev/random

2015-02-17 Thread John-Mark Gurney
Author: jmg
Date: Tue Feb 17 23:14:26 2015
New Revision: 278927
URL: https://svnweb.freebsd.org/changeset/base/278927

Log:
  Fix a bug where this function overflowed it's buffer...  This was
  causing ZFS panics on boot...
  
  This is purely reviewed and tested by peter.
  
  Reviewed by:  peter
  Approved by:  so (implicit), peter

Modified:
  head/sys/dev/random/yarrow.c

Modified: head/sys/dev/random/yarrow.c
==
--- head/sys/dev/random/yarrow.cTue Feb 17 23:13:45 2015
(r278926)
+++ head/sys/dev/random/yarrow.cTue Feb 17 23:14:26 2015
(r278927)
@@ -432,6 +432,7 @@ reseed(u_int fastslow)
 void
 random_yarrow_read(uint8_t *buf, u_int bytecount)
 {
+   uint8_t tbuf[BLOCKSIZE];
u_int blockcount, i;
 
/* Check for initial/final read requests */
@@ -448,8 +449,15 @@ random_yarrow_read(uint8_t *buf, u_int b
yarrow_state.outputblocks = 0;
}
uint128_increment(yarrow_state.counter.whole);
-   randomdev_encrypt(yarrow_state.key, yarrow_state.counter.byte, 
buf, BLOCKSIZE);
-   buf += BLOCKSIZE;
+   if ((i + 1) * BLOCKSIZE  bytecount) {
+   randomdev_encrypt(yarrow_state.key,
+   yarrow_state.counter.byte, tbuf, BLOCKSIZE);
+   memcpy(buf, tbuf, bytecount - i * BLOCKSIZE);
+   } else {
+   randomdev_encrypt(yarrow_state.key,
+   yarrow_state.counter.byte, buf, BLOCKSIZE);
+   buf += BLOCKSIZE;
+   }
}
 
mtx_unlock(random_reseed_mtx);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278929 - head

2015-02-17 Thread John-Mark Gurney
Author: jmg
Date: Tue Feb 17 23:41:08 2015
New Revision: 278929
URL: https://svnweb.freebsd.org/changeset/base/278929

Log:
  bump the rev...  ZFS is the first fall out of this bug, but there might
  be others...

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Tue Feb 17 23:20:19 2015(r278928)
+++ head/UPDATING   Tue Feb 17 23:41:08 2015(r278929)
@@ -33,8 +33,8 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
 
 20150217:
If you are running a -CURRENT kernel since r273872 (Oct 30th, 2014),
-   but before r278907, the RNG was not seeded properly.  Immediately
-   upgrade the kernel to r278907 or later and regenerate any keys (e.g.
+   but before r278927, the RNG was not seeded properly.  Immediately
+   upgrade the kernel to r278927 or later and regenerate any keys (e.g.
ssh keys or openssl keys) that were generated w/ a kernel from that
range.  This does not effect programs that directly used /dev/random
or /dev/urandom.  All userland uses of arc4random(3) are effected.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278928 - head/usr.bin/ministat

2015-02-17 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Feb 17 23:20:19 2015
New Revision: 278928
URL: https://svnweb.freebsd.org/changeset/base/278928

Log:
  ministat(1): replace malloc + memset with calloc.
  
  Reviewed by:  phk

Modified:
  head/usr.bin/ministat/ministat.c

Modified: head/usr.bin/ministat/ministat.c
==
--- head/usr.bin/ministat/ministat.cTue Feb 17 23:14:26 2015
(r278927)
+++ head/usr.bin/ministat/ministat.cTue Feb 17 23:20:19 2015
(r278928)
@@ -329,10 +329,8 @@ PlotSet(struct dataset *ds, int val)
else
bar = 0;
 
-   if (pl-bar == NULL) {
-   pl-bar = malloc(sizeof(char *) * pl-num_datasets);
-   memset(pl-bar, 0, sizeof(char*) * pl-num_datasets);
-   }
+   if (pl-bar == NULL)
+   pl-bar = calloc(sizeof(char *), pl-num_datasets);
if (pl-bar[bar] == NULL) {
pl-bar[bar] = malloc(pl-width);
memset(pl-bar[bar], 0, pl-width);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r278927 - head/sys/dev/random

2015-02-17 Thread Shawn Webb
On Tuesday, February 17, 2015 08:06:32 PM Shawn Webb wrote:
 On Tuesday, February 17, 2015 11:14:26 PM John-Mark Gurney wrote:
  Author: jmg
  Date: Tue Feb 17 23:14:26 2015
  New Revision: 278927
  URL: https://svnweb.freebsd.org/changeset/base/278927
  
  Log:
Fix a bug where this function overflowed it's buffer...  This was
causing ZFS panics on boot...

This is purely reviewed and tested by peter.

Reviewed by:  peter
Approved by:  so (implicit), peter
 
 I'm still seeing the kernel panic even after this commit.
 
 Thanks,
 
 Shawn

Whoops. Applied the patch to the wrong box. Never mind.

signature.asc
Description: This is a digitally signed message part.


svn commit: r278926 - in head: . release share/mk

2015-02-17 Thread Rui Paulo
Author: rpaulo
Date: Tue Feb 17 23:13:45 2015
New Revision: 278926
URL: https://svnweb.freebsd.org/changeset/base/278926

Log:
  release: use xz via pipe when compressing the tarballs.
  
  libarchive(3) doesn't support the new liblzma API yet, but this change
  allows us to enable multi-threaded xz compression.
  ``make release'' should now finish in half the time on a machine with
  several cores and fast disks (our typical build server).
  
  This behaviour only applies when building a release and it doesn't
  affect buildworld/installworld.  To disable threaded xz compression,
  set XZ_THREADS=1.
  
  Reviewed by:  gjb
  Tested by:gjb

Modified:
  head/Makefile.inc1
  head/release/Makefile
  head/release/Makefile.vm
  head/share/mk/bsd.own.mk

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Tue Feb 17 22:33:22 2015(r278925)
+++ head/Makefile.inc1  Tue Feb 17 23:13:45 2015(r278926)
@@ -912,25 +912,25 @@ packageworld:
 .for dist in base ${EXTRA_DISTRIBUTIONS}
 .if defined(NO_ROOT)
${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
-   tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
-   --exclude usr/lib/debug \
-   @${DESTDIR}/${DISTDIR}/${dist}.meta
+   tar cvf - --exclude usr/lib/debug \
+   @${DESTDIR}/${DISTDIR}/${dist}.meta | \
+   ${XZ_CMD}  ${DESTDIR}/${DISTDIR}/${dist}.txz
 .else
${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
-   tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
-   --exclude usr/lib/debug .
+   tar cvf - --exclude usr/lib/debug . | \
+   ${XZ_CMD}  ${DESTDIR}/${DISTDIR}/${dist}.txz
 .endif
 .endfor
 
 .for dist in ${DEBUG_DISTRIBUTIONS}
 . if defined(NO_ROOT)
${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
-   tar cvJf ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz \
-   @${DESTDIR}/${DISTDIR}/${dist}.debug.meta
+   tar cvf - @${DESTDIR}/${DISTDIR}/${dist}.debug.meta | \
+   ${XZ_CMD}  ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz
 . else
${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
-   tar cvJLf ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz \
-   usr/lib/debug
+   tar cvLf - usr/lib/debug | \
+   ${XZ_CMD}  ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz
 . endif
 .endfor
 
@@ -1138,19 +1138,21 @@ distributekernel distributekernel.debug:
 packagekernel:
 .if defined(NO_ROOT)
cd ${DESTDIR}/${DISTDIR}/kernel; \
-   tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz \
-   @${DESTDIR}/${DISTDIR}/kernel.meta
+   tar cvf - @${DESTDIR}/${DISTDIR}/kernel.meta | \
+   ${XZ_CMD}  ${DESTDIR}/${DISTDIR}/kernel.txz
 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
-   tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz \
-   @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
+   tar cvf - @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \
+   ${XZ_CMD}  ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz
 .endfor
 .else
cd ${DESTDIR}/${DISTDIR}/kernel; \
-   tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz .
+   tar cvf - . | \
+   ${XZ_CMD}  ${DESTDIR}/${DISTDIR}/kernel.txz
 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
-   tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz .
+   tar cvf - . | \
+   ${XZ_CMD}  ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz
 .endfor
 .endif
 

Modified: head/release/Makefile
==
--- head/release/Makefile   Tue Feb 17 22:33:22 2015(r278925)
+++ head/release/Makefile   Tue Feb 17 23:13:45 2015(r278926)
@@ -33,18 +33,12 @@
 #  with xz(1) (extremely time consuming)
 #  WITH_CLOUDWARE: if set, build cloud hosting disk images with the release
 #  TARGET/TARGET_ARCH: architecture of built release
-#  XZ_FLAGS: Additional arguments to pass to xz(1)
-#  XZ_THREADS: Number of xz(1) threads to use
-#  NO_XZTHREADS: Disable multi-threaded xz(1) compression
 #
 
 WORLDDIR?= ${.CURDIR}/..
 PORTSDIR?= /usr/ports
 DOCDIR?=   /usr/doc
 RELNOTES_LANG?= en_US.ISO8859-1
-XZCMD?=/usr/bin/xz
-XZ_FLAGS?=
-XZ_THREADS?=
 
 .if !defined(TARGET) || empty(TARGET)
 TARGET=${MACHINE}
@@ -59,15 +53,6 @@ TARGET_ARCH= ${TARGET}
 IMAKE= ${MAKE} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}
 DISTDIR=   dist
 
-.if !defined(NO_XZTHREADS)  empty(XZ_THREADS)
-XZ_THREADS=0
-.else
-XZ_THREADS=${XZ_THREADS}
-.endif
-.if !empty(XZ_THREADS)
-XZ_FLAGS+= -T ${XZ_THREADS}
-.endif
-
 # Define OSRELEASE by using newvars.sh
 .if !defined(OSRELEASE) || empty(OSRELEASE)
 .for _V in TYPE BRANCH REVISION
@@ -158,16 +143,18 @@ kernel.txz:
 src.txz:
mkdir -p ${DISTDIR}/usr
ln -fs ${WORLDDIR} 

Re: svn commit: r278927 - head/sys/dev/random

2015-02-17 Thread Shawn Webb
On Tuesday, February 17, 2015 11:14:26 PM John-Mark Gurney wrote:
 Author: jmg
 Date: Tue Feb 17 23:14:26 2015
 New Revision: 278927
 URL: https://svnweb.freebsd.org/changeset/base/278927
 
 Log:
   Fix a bug where this function overflowed it's buffer...  This was
   causing ZFS panics on boot...
 
   This is purely reviewed and tested by peter.
 
   Reviewed by:peter
   Approved by:so (implicit), peter

I'm still seeing the kernel panic even after this commit.

Thanks,

Shawn

signature.asc
Description: This is a digitally signed message part.


svn commit: r278934 - in head: cddl/contrib/opensolaris/lib/libdtrace/common share/mk

2015-02-17 Thread Mark Johnston
Author: markj
Date: Wed Feb 18 03:54:54 2015
New Revision: 278934
URL: https://svnweb.freebsd.org/changeset/base/278934

Log:
  Remove drti.o's dependency on libelf. This makes it possible to add DTrace
  probes to userland programs and libraries without also needing to link
  libelf.
  
  dtrace -G places the __SUNW_dof symbol at the beginning of the DOF (DTrace
  probe and provider metdata) section in the generated object file; drti.o
  now just uses this symbol to locate the section. A complication occurs
  when multiple dtrace-generated object files are linked together, since the
  __SUNW_dof symbol defined in each file is global. This is handled by
  using objcopy(1) to convert __SUNW_dof to a local symbol once drti.o has
  been linked with the generated object file. Upstream, this is done using a
  linker feature not present in GNU ld.
  
  Differential Revision:https://reviews.freebsd.org/D1757
  Reviewed by:  rpaulo
  MFC after:1 month
  Relnotes: yes

Modified:
  head/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c
  head/share/mk/bsd.dep.mk

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c
==
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c   Wed Feb 18 
03:46:43 2015(r278933)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c   Wed Feb 18 
03:54:54 2015(r278934)
@@ -36,7 +36,6 @@
 #include string.h
 #include errno.h
 #include libelf.h
-#include gelf.h
 
 /*
  * In Solaris 10 GA, the only mechanism for communicating helper information
@@ -62,9 +61,7 @@ static const char *olddevname = /device
 
 static const char *modname;/* Name of this load object */
 static int gen;/* DOF helper generation */
-#ifdef illumos
 extern dof_hdr_t __SUNW_dof;   /* DOF defined in the .SUNW_dof section */
-#endif
 static boolean_t dof_init_debug = B_FALSE; /* From DTRACE_DOF_INIT_DEBUG */
 
 static void
@@ -99,11 +96,7 @@ static void dtrace_dof_init(void) __attr
 static void
 dtrace_dof_init(void)
 {
-#ifdef illumos
dof_hdr_t *dof = __SUNW_dof;
-#else
-   dof_hdr_t *dof = NULL;
-#endif
 #ifdef _LP64
Elf64_Ehdr *elf;
 #else
@@ -118,17 +111,6 @@ dtrace_dof_init(void)
 #endif
int fd;
const char *p;
-#ifndef illumos
-   Elf *e;
-   Elf_Scn *scn = NULL;
-   Elf_Data *dofdata = NULL;
-   dof_hdr_t *dof_next = NULL;
-   GElf_Shdr shdr;
-   int efd;
-   char *s;
-   size_t shstridx;
-   uint64_t aligned_filesz;
-#endif
 
if (getenv(DTRACE_DOF_INIT_DISABLE) != NULL)
return;
@@ -152,42 +134,6 @@ dtrace_dof_init(void)
modname = lmp-l_name;
else
modname++;
-#ifndef illumos
-   elf_version(EV_CURRENT);
-   if ((efd = open(lmp-l_name, O_RDONLY, 0))  0) {
-   dprintf(1, couldn't open file for reading\n);
-   return;
-   }
-   if ((e = elf_begin(efd, ELF_C_READ, NULL)) == NULL) {
-   dprintf(1, elf_begin failed\n);
-   close(efd);
-   return;
-   }
-   elf_getshdrstrndx(e, shstridx);
-   dof = NULL;
-   while ((scn = elf_nextscn(e, scn)) != NULL) {
-   gelf_getshdr(scn, shdr);
-   if (shdr.sh_type == SHT_SUNW_dof) {
-   s = elf_strptr(e, shstridx, shdr.sh_name);
-   if (s != NULL  strcmp(s, .SUNW_dof) == 0) {
-   dofdata = elf_getdata(scn, NULL);
-   dof = dofdata-d_buf;
-   break;
-   }
-   }
-   }
-   if (dof == NULL) {
-   dprintf(1, SUNW_dof section not found\n);
-   elf_end(e);
-   close(efd);
-   return;
-   }
-
-   while ((char *) dof  (char *) dofdata-d_buf + dofdata-d_size) {
-   aligned_filesz = (shdr.sh_addralign == 0 ? dof-dofh_filesz :
-   roundup2(dof-dofh_filesz, shdr.sh_addralign));
-   dof_next = (void *) ((char *) dof + aligned_filesz);
-#endif
 
if (dof-dofh_ident[DOF_ID_MAG0] != DOF_MAG_MAG0 ||
dof-dofh_ident[DOF_ID_MAG1] != DOF_MAG_MAG1 ||
@@ -237,21 +183,12 @@ dtrace_dof_init(void)
dprintf(1, DTrace ioctl failed for DOF at %p, dof);
else {
dprintf(1, DTrace ioctl succeeded for DOF at %p\n, dof);
-#ifndef illumos
+#ifdef __FreeBSD__
gen = dh.gen;
 #endif
}
 
(void) close(fd);
-
-#ifndef illumos
-   /* End of while loop */
-   dof = dof_next;
-   }
-
-   

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

2015-02-17 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Feb 18 06:23:16 2015
New Revision: 278941
URL: https://svnweb.freebsd.org/changeset/base/278941

Log:
  sfxge: support variable-length response to MCDI GET_BOARD_CFG
  
  Allocate the minimum or maximum response length for GET_BOARD_CFG as
  appropriate.  When looking up firmware subtypes by partition ID,
  check the ID against the actual response length.
  
  Merge of the patch made by Ben Hutchings in 2011.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

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

Modified: head/sys/dev/sfxge/common/efx_regs_mcdi.h
==
--- head/sys/dev/sfxge/common/efx_regs_mcdi.h   Wed Feb 18 06:21:59 2015
(r278940)
+++ head/sys/dev/sfxge/common/efx_regs_mcdi.h   Wed Feb 18 06:23:16 2015
(r278941)
@@ -709,7 +709,9 @@
 #defineMC_CMD_GET_BOARD_CFG_IN_LEN 0
 
 /* MC_CMD_GET_BOARD_CFG_OUT msgresponse */
-#defineMC_CMD_GET_BOARD_CFG_OUT_LEN 96
+#defineMC_CMD_GET_BOARD_CFG_OUT_LENMIN 96
+#defineMC_CMD_GET_BOARD_CFG_OUT_LENMAX 136
+#defineMC_CMD_GET_BOARD_CFG_OUT_LEN(num) (72+2*(num))
 #defineMC_CMD_GET_BOARD_CFG_OUT_BOARD_TYPE_OFST 0
 #defineMC_CMD_GET_BOARD_CFG_OUT_BOARD_NAME_OFST 4
 #defineMC_CMD_GET_BOARD_CFG_OUT_BOARD_NAME_LEN 32
@@ -729,7 +731,8 @@
 #defineMC_CMD_GET_BOARD_CFG_OUT_MAC_STRIDE_PORT1_OFST 68
 #defineMC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST 72
 #defineMC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_LEN 2
-#defineMC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_NUM 12
+#defineMC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MINNUM 12
+#defineMC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MAXNUM 32
 
 
 /***/

Modified: head/sys/dev/sfxge/common/siena_nic.c
==
--- head/sys/dev/sfxge/common/siena_nic.c   Wed Feb 18 06:21:59 2015
(r278940)
+++ head/sys/dev/sfxge/common/siena_nic.c   Wed Feb 18 06:23:16 2015
(r278941)
@@ -276,7 +276,7 @@ siena_board_cfg(
 {
efx_nic_cfg_t *encp = (enp-en_nic_cfg);
efx_mcdi_iface_t *emip = (enp-en_u.siena.enu_mip);
-   uint8_t outbuf[MAX(MC_CMD_GET_BOARD_CFG_OUT_LEN,
+   uint8_t outbuf[MAX(MC_CMD_GET_BOARD_CFG_OUT_LENMIN,
MC_CMD_GET_RESOURCE_LIMITS_OUT_LEN)];
efx_mcdi_req_t req;
uint8_t *src;
@@ -288,7 +288,7 @@ siena_board_cfg(
req.emr_in_buf = NULL;
req.emr_in_length = 0;
req.emr_out_buf = outbuf;
-   req.emr_out_length = MC_CMD_GET_BOARD_CFG_OUT_LEN;
+   req.emr_out_length = MC_CMD_GET_BOARD_CFG_OUT_LENMIN;
 
efx_mcdi_execute(enp, req);
 
@@ -297,7 +297,7 @@ siena_board_cfg(
goto fail1;
}
 
-   if (req.emr_out_length_used  MC_CMD_GET_BOARD_CFG_OUT_LEN) {
+   if (req.emr_out_length_used  MC_CMD_GET_BOARD_CFG_OUT_LENMIN) {
rc = EMSGSIZE;
goto fail2;
}

Modified: head/sys/dev/sfxge/common/siena_nvram.c
==
--- head/sys/dev/sfxge/common/siena_nvram.c Wed Feb 18 06:21:59 2015
(r278940)
+++ head/sys/dev/sfxge/common/siena_nvram.c Wed Feb 18 06:23:16 2015
(r278941)
@@ -587,7 +587,7 @@ siena_nvram_get_subtype(
__out   uint32_t *subtypep)
 {
efx_mcdi_req_t req;
-   uint8_t outbuf[MC_CMD_GET_BOARD_CFG_OUT_LEN];
+   uint8_t outbuf[MC_CMD_GET_BOARD_CFG_OUT_LENMAX];
efx_word_t *fw_list;
int rc;
 
@@ -605,17 +605,26 @@ siena_nvram_get_subtype(
goto fail1;
}
 
-   if (req.emr_out_length_used  MC_CMD_GET_BOARD_CFG_OUT_LEN) {
+   if (req.emr_out_length_used  MC_CMD_GET_BOARD_CFG_OUT_LENMIN) {
rc = EMSGSIZE;
goto fail2;
}
 
+   if (req.emr_out_length_used 
+   MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST +
+   (partn + 1) * sizeof(efx_word_t)) {
+   rc = ENOENT;
+   goto fail3;
+   }
+
fw_list = MCDI_OUT2(req, efx_word_t,
GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST);
*subtypep = EFX_WORD_FIELD(fw_list[partn], EFX_WORD_0);
 
return (0);
 
+fail3:
+   EFSYS_PROBE(fail3);
 fail2:
EFSYS_PROBE(fail2);
 fail1:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278940 - head/sys/dev/sfxge

2015-02-17 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Feb 18 06:21:59 2015
New Revision: 278940
URL: https://svnweb.freebsd.org/changeset/base/278940

Log:
  sfxge: add driver context member with number of event queues
  
  Mainly to unify with similar member for transmit and receive queues.
  It will be used in the future for resources allocation processing.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

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

Modified: head/sys/dev/sfxge/sfxge.h
==
--- head/sys/dev/sfxge/sfxge.h  Wed Feb 18 06:20:59 2015(r278939)
+++ head/sys/dev/sfxge/sfxge.h  Wed Feb 18 06:21:59 2015(r278940)
@@ -260,6 +260,7 @@ struct sfxge_softc {
chartx_lock_name[SFXGE_LOCK_NAME_MAX];
 #endif
 
+   unsigned intevq_count;
unsigned intrxq_count;
unsigned inttxq_count;
 };

Modified: head/sys/dev/sfxge/sfxge_ev.c
==
--- head/sys/dev/sfxge/sfxge_ev.c   Wed Feb 18 06:20:59 2015
(r278939)
+++ head/sys/dev/sfxge/sfxge_ev.c   Wed Feb 18 06:21:59 2015
(r278940)
@@ -427,7 +427,7 @@ sfxge_ev_stat_update(struct sfxge_softc 
sc-ev_stats_update_time = now;
 
/* Add event counts from each event queue in turn */
-   for (index = 0; index  sc-intr.n_alloc; index++) {
+   for (index = 0; index  sc-evq_count; index++) {
evq = sc-evq[index];
SFXGE_EVQ_LOCK(evq);
efx_ev_qstats_update(evq-common, sc-ev_stats);
@@ -493,7 +493,7 @@ sfxge_int_mod_handler(SYSCTL_HANDLER_ARG
struct sfxge_intr *intr = sc-intr;
unsigned int moderation;
int error;
-   int index;
+   unsigned int index;
 
SFXGE_ADAPTER_LOCK(sc);
 
@@ -513,7 +513,7 @@ sfxge_int_mod_handler(SYSCTL_HANDLER_ARG
 
sc-ev_moderation = moderation;
if (intr-state == SFXGE_INTR_STARTED) {
-   for (index = 0; index  intr-n_alloc; index++)
+   for (index = 0; index  sc-evq_count; index++)
sfxge_ev_qmoderate(sc, index, moderation);
}
} else {
@@ -727,7 +727,7 @@ sfxge_ev_stop(struct sfxge_softc *sc)
(Interrupts not started));
 
/* Stop the event queue(s) */
-   index = intr-n_alloc;
+   index = sc-evq_count;
while (--index = 0)
sfxge_ev_qstop(sc, index);
 
@@ -752,7 +752,7 @@ sfxge_ev_start(struct sfxge_softc *sc)
return (rc);
 
/* Start the event queues */
-   for (index = 0; index  intr-n_alloc; index++) {
+   for (index = 0; index  sc-evq_count; index++) {
if ((rc = sfxge_ev_qstart(sc, index)) != 0)
goto fail;
}
@@ -853,9 +853,11 @@ sfxge_ev_fini(struct sfxge_softc *sc)
sc-ev_moderation = 0;
 
/* Tear down the event queue(s). */
-   index = intr-n_alloc;
+   index = sc-evq_count;
while (--index = 0)
sfxge_ev_qfini(sc, index);
+
+   sc-evq_count = 0;
 }
 
 int
@@ -869,6 +871,8 @@ sfxge_ev_init(struct sfxge_softc *sc)
 
intr = sc-intr;
 
+   sc-evq_count = intr-n_alloc;
+
KASSERT(intr-state == SFXGE_INTR_INITIALIZED,
(intr-state != SFXGE_INTR_INITIALIZED));
 
@@ -884,7 +888,7 @@ sfxge_ev_init(struct sfxge_softc *sc)
/*
 * Initialize the event queue(s) - one per interrupt.
 */
-   for (index = 0; index  intr-n_alloc; index++) {
+   for (index = 0; index  sc-evq_count; index++) {
if ((rc = sfxge_ev_qinit(sc, index)) != 0)
goto fail;
}
@@ -899,5 +903,6 @@ fail:
while (--index = 0)
sfxge_ev_qfini(sc, index);
 
+   sc-evq_count = 0;
return (rc);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278943 - head/sys/powerpc/powermac

2015-02-17 Thread Justin Hibbits
Author: jhibbits
Date: Wed Feb 18 06:53:40 2015
New Revision: 278943
URL: https://svnweb.freebsd.org/changeset/base/278943

Log:
  Don't set the write bit if we're just reading.
  
  Also fix a couple typos.
  
  MFC after:3 weeks

Modified:
  head/sys/powerpc/powermac/atibl.c

Modified: head/sys/powerpc/powermac/atibl.c
==
--- head/sys/powerpc/powermac/atibl.c   Wed Feb 18 06:26:07 2015
(r278942)
+++ head/sys/powerpc/powermac/atibl.c   Wed Feb 18 06:53:40 2015
(r278943)
@@ -162,14 +162,13 @@ atibl_pll_rreg(struct atibl_softc *sc, u
 {
uint32_t data, save, tmp;
 
-   bus_write_1(sc-sc_memr, RADEON_CLOCK_CNTL_INDEX,
-   ((reg  0x3f) | RADEON_PLL_WR_EN));
+   bus_write_1(sc-sc_memr, RADEON_CLOCK_CNTL_INDEX, (reg  0x3f));
(void)bus_read_4(sc-sc_memr, RADEON_CLOCK_CNTL_DATA);
(void)bus_read_4(sc-sc_memr, RADEON_CRTC_GEN_CNTL);
 
data = bus_read_4(sc-sc_memr, RADEON_CLOCK_CNTL_DATA);
 
-   /* Only necessary on R300, bt won't hurt others. */
+   /* Only necessary on R300, but won't hurt others. */
save = bus_read_4(sc-sc_memr, RADEON_CLOCK_CNTL_INDEX);
tmp = save  (~0x3f | RADEON_PLL_WR_EN);
bus_write_4(sc-sc_memr, RADEON_CLOCK_CNTL_INDEX, tmp);
@@ -192,7 +191,7 @@ atibl_pll_wreg(struct atibl_softc *sc, u
bus_write_4(sc-sc_memr, RADEON_CLOCK_CNTL_DATA, val);
DELAY(5000);
 
-   /* Only necessary on R300, bt won't hurt others. */
+   /* Only necessary on R300, but won't hurt others. */
save = bus_read_4(sc-sc_memr, RADEON_CLOCK_CNTL_INDEX);
tmp = save  (~0x3f | RADEON_PLL_WR_EN);
bus_write_4(sc-sc_memr, RADEON_CLOCK_CNTL_INDEX, tmp);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278936 - in head/sys/dev: cardbus pccbb

2015-02-17 Thread Warner Losh
Author: imp
Date: Wed Feb 18 05:53:04 2015
New Revision: 278936
URL: https://svnweb.freebsd.org/changeset/base/278936

Log:
  On my Lenovo T400, a Atheros 2413 has a problem powering up
  sometimes. It will power up wrong and identify itself badly:
  
  cardbus0: network, ethernet at device 0.0 (no driver attached)
  cardbus0: simple comms, UART at device 0.1 (no driver attached)
  cardbus0: old, non-VGA display device at device 0.2 (no driver attached)
  cardbus0: old, non-VGA display device at device 0.3 (no driver attached)
  cardbus0: old, non-VGA display device at device 0.4 (no driver attached)
  cardbus0: old, non-VGA display device at device 0.5 (no driver attached)
  cardbus0: old, non-VGA display device at device 0.6 (no driver attached)
  cardbus0: old, non-VGA display device at device 0.7 (no driver attached)
  
  All the higher numbered functions (.2 and above) have a config space
  of all 0's. This smells a bit like a special debug mode, but the
  current atheros driver doesn't cope. It is unclear if this card is
  just a flake, or if we're doing something wrong in the power-up
  sequence.
  
  Put a work around into the code that tests for this rather unusual
  condition. If we power a CardBus device up, and the device says it is
  multi-function, and any of the functions have a 0 device ID, try the
  power-up sequence again.

Modified:
  head/sys/dev/cardbus/cardbus.c
  head/sys/dev/pccbb/pccbb.c

Modified: head/sys/dev/cardbus/cardbus.c
==
--- head/sys/dev/cardbus/cardbus.c  Wed Feb 18 05:20:52 2015
(r278935)
+++ head/sys/dev/cardbus/cardbus.c  Wed Feb 18 05:53:04 2015
(r278936)
@@ -122,6 +122,7 @@ cardbus_detach(device_t cbdev)
cardbus_detach_card(cbdev);
 #ifdef PCI_RES_BUS
sc = device_get_softc(cbdev);
+   device_printf(cbdev, Freeing up the allocatd bus\n);
(void)bus_release_resource(cbdev, PCI_RES_BUS, 0, sc-sc_bus);
 #endif
return (0);
@@ -180,6 +181,7 @@ cardbus_attach_card(device_t cbdev)
 
sc = device_get_softc(cbdev);
cardbus_detach_card(cbdev); /* detach existing cards */
+   POWER_DISABLE_SOCKET(brdev, cbdev); /* Turn the socket off first */
POWER_ENABLE_SOCKET(brdev, cbdev);
domain = pcib_get_domain(cbdev);
bus = pcib_get_bus(cbdev);

Modified: head/sys/dev/pccbb/pccbb.c
==
--- head/sys/dev/pccbb/pccbb.c  Wed Feb 18 05:20:52 2015(r278935)
+++ head/sys/dev/pccbb/pccbb.c  Wed Feb 18 05:53:04 2015(r278936)
@@ -155,7 +155,7 @@ SYSCTL_INT(_hw_cbb, OID_AUTO, debug, CTL
 static voidcbb_insert(struct cbb_softc *sc);
 static voidcbb_removal(struct cbb_softc *sc);
 static uint32_tcbb_detect_voltage(device_t brdev);
-static voidcbb_cardbus_reset_power(device_t brdev, device_t child, int on);
+static int cbb_cardbus_reset_power(device_t brdev, device_t child, int on);
 static int cbb_cardbus_io_open(device_t brdev, int win, uint32_t start,
uint32_t end);
 static int cbb_cardbus_mem_open(device_t brdev, int win,
@@ -958,12 +958,12 @@ cbb_do_power(device_t brdev)
 /* CardBus power functions */
 //
 
-static void
+static int
 cbb_cardbus_reset_power(device_t brdev, device_t child, int on)
 {
struct cbb_softc *sc = device_get_softc(brdev);
-   uint32_t b;
-   int delay, count;
+   uint32_t b, h;
+   int delay, count, zero_seen, func;
 
/*
 * Asserting reset for 20ms is necessary for most bridges.  For some
@@ -1002,30 +1002,61 @@ cbb_cardbus_reset_power(device_t brdev, 
0xul  --count = 0);
if (count  0)
device_printf(brdev, Warning: Bus reset timeout\n);
+
+   /*
+* Some cards (so far just an atheros card I have) seem to
+* come out of reset in a funky state. They report they are
+* multi-function cards, but have nonsense for some of the
+* higher functions.  So if the card claims to be MFDEV, and
+* any of the higher functions' ID is 0, then we've hit the
+* bug and we'll try again.
+*/
+   h = PCIB_READ_CONFIG(brdev, b, 0, 0, PCIR_HDRTYPE, 1);
+   if ((h  PCIM_MFDEV) == 0)
+   return 0;
+   zero_seen = 0;
+   for (func = 1; func  8; func++) {
+   h = PCIB_READ_CONFIG(brdev, b, 0, func,
+   PCIR_DEVVENDOR, 4);
+   if (h == 0)
+   zero_seen++;
+   }
+   if (!zero_seen)
+   return 0;
+   return (EINVAL);
}
+   

svn commit: r278938 - head/sys/dev/sfxge

2015-02-17 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Feb 18 06:19:35 2015
New Revision: 278938
URL: https://svnweb.freebsd.org/changeset/base/278938

Log:
  sfxge: add driver context member with number of transmit queues
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

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

Modified: head/sys/dev/sfxge/sfxge.h
==
--- head/sys/dev/sfxge/sfxge.h  Wed Feb 18 06:18:51 2015(r278937)
+++ head/sys/dev/sfxge/sfxge.h  Wed Feb 18 06:19:35 2015(r278938)
@@ -259,6 +259,8 @@ struct sfxge_softc {
struct mtx  tx_lock __aligned(CACHE_LINE_SIZE);
chartx_lock_name[SFXGE_LOCK_NAME_MAX];
 #endif
+
+   unsigned inttxq_count;
 };
 
 #defineSFXGE_LINK_UP(sc) ((sc)-port.link_mode != EFX_LINK_DOWN)

Modified: head/sys/dev/sfxge/sfxge_tx.c
==
--- head/sys/dev/sfxge/sfxge_tx.c   Wed Feb 18 06:18:51 2015
(r278937)
+++ head/sys/dev/sfxge/sfxge_tx.c   Wed Feb 18 06:19:35 2015
(r278938)
@@ -649,7 +649,7 @@ sfxge_if_qflush(struct ifnet *ifp)
 
sc = ifp-if_softc;
 
-   for (i = 0; i  SFXGE_TXQ_IP_TCP_UDP_CKSUM + SFXGE_TX_SCALE(sc); i++)
+   for (i = 0; i  sc-txq_count; i++)
sfxge_tx_qdpl_flush(sc-txq[i]);
 }
 
@@ -1280,13 +1280,9 @@ sfxge_tx_stop(struct sfxge_softc *sc)
 {
int index;
 
-   index = SFXGE_TX_SCALE(sc);
+   index = sc-txq_count;
while (--index = 0)
-   sfxge_tx_qstop(sc, SFXGE_TXQ_IP_TCP_UDP_CKSUM + index);
-
-   sfxge_tx_qstop(sc, SFXGE_TXQ_IP_CKSUM);
-
-   sfxge_tx_qstop(sc, SFXGE_TXQ_NON_CKSUM);
+   sfxge_tx_qstop(sc, index);
 
/* Tear down the transmit module */
efx_tx_fini(sc-enp);
@@ -1302,30 +1298,17 @@ sfxge_tx_start(struct sfxge_softc *sc)
if ((rc = efx_tx_init(sc-enp)) != 0)
return (rc);
 
-   if ((rc = sfxge_tx_qstart(sc, SFXGE_TXQ_NON_CKSUM)) != 0)
-   goto fail;
-
-   if ((rc = sfxge_tx_qstart(sc, SFXGE_TXQ_IP_CKSUM)) != 0)
-   goto fail2;
-
-   for (index = 0; index  SFXGE_TX_SCALE(sc); index++) {
-   if ((rc = sfxge_tx_qstart(sc, SFXGE_TXQ_IP_TCP_UDP_CKSUM +
-   index)) != 0)
-   goto fail3;
+   for (index = 0; index  sc-txq_count; index++) {
+   if ((rc = sfxge_tx_qstart(sc, index)) != 0)
+   goto fail;
}
 
return (0);
 
-fail3:
+fail:
while (--index = 0)
-   sfxge_tx_qstop(sc, SFXGE_TXQ_IP_TCP_UDP_CKSUM + index);
-
-   sfxge_tx_qstop(sc, SFXGE_TXQ_IP_CKSUM);
-
-fail2:
-   sfxge_tx_qstop(sc, SFXGE_TXQ_NON_CKSUM);
+   sfxge_tx_qstop(sc, index);
 
-fail:
efx_tx_fini(sc-enp);
 
return (rc);
@@ -1536,9 +1519,7 @@ sfxge_tx_stat_handler(SYSCTL_HANDLER_ARG
 
/* Sum across all TX queues */
sum = 0;
-   for (index = 0;
-index  SFXGE_TXQ_IP_TCP_UDP_CKSUM + SFXGE_TX_SCALE(sc);
-index++)
+   for (index = 0; index  sc-txq_count; index++)
sum += *(unsigned long *)((caddr_t)sc-txq[index] +
  sfxge_tx_stats[id].offset);
 
@@ -1571,12 +1552,11 @@ sfxge_tx_fini(struct sfxge_softc *sc)
 {
int index;
 
-   index = SFXGE_TX_SCALE(sc);
+   index = sc-txq_count;
while (--index = 0)
-   sfxge_tx_qfini(sc, SFXGE_TXQ_IP_TCP_UDP_CKSUM + index);
+   sfxge_tx_qfini(sc, index);
 
-   sfxge_tx_qfini(sc, SFXGE_TXQ_IP_CKSUM);
-   sfxge_tx_qfini(sc, SFXGE_TXQ_NON_CKSUM);
+   sc-txq_count = 0;
 }
 
 
@@ -1592,6 +1572,12 @@ sfxge_tx_init(struct sfxge_softc *sc)
KASSERT(intr-state == SFXGE_INTR_INITIALIZED,
(intr-state != SFXGE_INTR_INITIALIZED));
 
+#ifdef SFXGE_HAVE_MQ
+   sc-txq_count = SFXGE_TXQ_NTYPES - 1 + sc-intr.n_alloc;
+#else
+   sc-txq_count = SFXGE_TXQ_NTYPES;
+#endif
+
sc-txqs_node = SYSCTL_ADD_NODE(
device_get_sysctl_ctx(sc-dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(sc-dev)),
@@ -1610,8 +1596,10 @@ sfxge_tx_init(struct sfxge_softc *sc)
SFXGE_TXQ_IP_CKSUM, 0)) != 0)
goto fail2;
 
-   for (index = 0; index  SFXGE_TX_SCALE(sc); index++) {
-   if ((rc = sfxge_tx_qinit(sc, SFXGE_TXQ_IP_TCP_UDP_CKSUM + index,
+   for (index = 0;
+index  sc-txq_count - SFXGE_TXQ_NTYPES + 1;
+index++) {
+   if ((rc = sfxge_tx_qinit(sc, SFXGE_TXQ_NTYPES - 1 + index,
SFXGE_TXQ_IP_TCP_UDP_CKSUM, index)) != 0)
goto fail3;
}
@@ -1621,15 +1609,16 @@ sfxge_tx_init(struct sfxge_softc *sc)

svn commit: r278945 - head/sys/powerpc/powermac

2015-02-17 Thread Justin Hibbits
Author: jhibbits
Date: Wed Feb 18 07:34:32 2015
New Revision: 278945
URL: https://svnweb.freebsd.org/changeset/base/278945

Log:
  Match the right backlight driver.
  
  Some ATI-based PowerBooks use the string 'mnca' in the backlight controller
  device tree entry, so account for this and don't use nVidia when it's not an
  nVidia device.
  
  MFC after:3 weeks

Modified:
  head/sys/powerpc/powermac/atibl.c
  head/sys/powerpc/powermac/nvbl.c

Modified: head/sys/powerpc/powermac/atibl.c
==
--- head/sys/powerpc/powermac/atibl.c   Wed Feb 18 06:55:11 2015
(r278944)
+++ head/sys/powerpc/powermac/atibl.c   Wed Feb 18 07:34:32 2015
(r278945)
@@ -38,6 +38,11 @@ __FBSDID($FreeBSD$);
 #include machine/bus.h
 
 #include dev/ofw/openfirm.h
+#include dev/pci/pcivar.h
+
+#ifndef PCI_VENDOR_ID_ATI
+#define PCI_VENDOR_ID_ATI 0x1002
+#endif
 
 /* From the xf86-video-ati driver's radeon_reg.h */
 #define RADEON_LVDS_GEN_CNTL 0x02d0
@@ -121,7 +126,9 @@ atibl_probe(device_t dev)
if (OF_getprop(handle, backlight-control, control, sizeof(control)) 
 0)
return (ENXIO);
 
-   if (strcmp(control, ati) != 0)
+   if (strcmp(control, ati) != 0 
+   (strcmp(control, mnca) != 0 ||
+   pci_get_vendor(device_get_parent(dev)) != 0x1002))
return (ENXIO);
 
device_set_desc(dev, PowerBook backlight for ATI graphics);

Modified: head/sys/powerpc/powermac/nvbl.c
==
--- head/sys/powerpc/powermac/nvbl.cWed Feb 18 06:55:11 2015
(r278944)
+++ head/sys/powerpc/powermac/nvbl.cWed Feb 18 07:34:32 2015
(r278945)
@@ -38,6 +38,9 @@ __FBSDID($FreeBSD$);
 #include machine/bus.h
 
 #include dev/ofw/openfirm.h
+#include dev/pci/pcivar.h
+
+#define PCI_VENDOR_ID_NVIDIA   0x10de
 
 #define NVIDIA_BRIGHT_MIN (0x0ec)
 #define NVIDIA_BRIGHT_MAX (0x538)
@@ -102,7 +105,8 @@ nvbl_probe(device_t dev)
if (OF_getprop(handle, backlight-control, control, sizeof(control)) 
 0)
return (ENXIO);
 
-   if (strcmp(control, mnca) != 0)
+   if ((strcmp(control, mnca) != 0) ||
+   pci_get_vendor(device_get_parent(dev)) != PCI_VENDOR_ID_NVIDIA)
return (ENXIO);
 
device_set_desc(dev, PowerBook backlight for nVidia graphics);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r278936 - in head/sys/dev: cardbus pccbb

2015-02-17 Thread Adrian Chadd
Hm!

Can you dump the config space when this happens, just locally?

I'd like to see what the device id and sub ids are.

(That'll tell me if the thing hit a power-on bug, which there has
actually been a reset power-on bug in atheros hardware since.. well,
forever.)



-adrian


On 17 February 2015 at 21:53, Warner Losh i...@freebsd.org wrote:
 Author: imp
 Date: Wed Feb 18 05:53:04 2015
 New Revision: 278936
 URL: https://svnweb.freebsd.org/changeset/base/278936

 Log:
   On my Lenovo T400, a Atheros 2413 has a problem powering up
   sometimes. It will power up wrong and identify itself badly:

   cardbus0: network, ethernet at device 0.0 (no driver attached)
   cardbus0: simple comms, UART at device 0.1 (no driver attached)
   cardbus0: old, non-VGA display device at device 0.2 (no driver attached)
   cardbus0: old, non-VGA display device at device 0.3 (no driver attached)
   cardbus0: old, non-VGA display device at device 0.4 (no driver attached)
   cardbus0: old, non-VGA display device at device 0.5 (no driver attached)
   cardbus0: old, non-VGA display device at device 0.6 (no driver attached)
   cardbus0: old, non-VGA display device at device 0.7 (no driver attached)

   All the higher numbered functions (.2 and above) have a config space
   of all 0's. This smells a bit like a special debug mode, but the
   current atheros driver doesn't cope. It is unclear if this card is
   just a flake, or if we're doing something wrong in the power-up
   sequence.

   Put a work around into the code that tests for this rather unusual
   condition. If we power a CardBus device up, and the device says it is
   multi-function, and any of the functions have a 0 device ID, try the
   power-up sequence again.

 Modified:
   head/sys/dev/cardbus/cardbus.c
   head/sys/dev/pccbb/pccbb.c

 Modified: head/sys/dev/cardbus/cardbus.c
 ==
 --- head/sys/dev/cardbus/cardbus.c  Wed Feb 18 05:20:52 2015
 (r278935)
 +++ head/sys/dev/cardbus/cardbus.c  Wed Feb 18 05:53:04 2015
 (r278936)
 @@ -122,6 +122,7 @@ cardbus_detach(device_t cbdev)
 cardbus_detach_card(cbdev);
  #ifdef PCI_RES_BUS
 sc = device_get_softc(cbdev);
 +   device_printf(cbdev, Freeing up the allocatd bus\n);
 (void)bus_release_resource(cbdev, PCI_RES_BUS, 0, sc-sc_bus);
  #endif
 return (0);
 @@ -180,6 +181,7 @@ cardbus_attach_card(device_t cbdev)

 sc = device_get_softc(cbdev);
 cardbus_detach_card(cbdev); /* detach existing cards */
 +   POWER_DISABLE_SOCKET(brdev, cbdev); /* Turn the socket off first */
 POWER_ENABLE_SOCKET(brdev, cbdev);
 domain = pcib_get_domain(cbdev);
 bus = pcib_get_bus(cbdev);

 Modified: head/sys/dev/pccbb/pccbb.c
 ==
 --- head/sys/dev/pccbb/pccbb.c  Wed Feb 18 05:20:52 2015(r278935)
 +++ head/sys/dev/pccbb/pccbb.c  Wed Feb 18 05:53:04 2015(r278936)
 @@ -155,7 +155,7 @@ SYSCTL_INT(_hw_cbb, OID_AUTO, debug, CTL
  static voidcbb_insert(struct cbb_softc *sc);
  static voidcbb_removal(struct cbb_softc *sc);
  static uint32_tcbb_detect_voltage(device_t brdev);
 -static voidcbb_cardbus_reset_power(device_t brdev, device_t child, int 
 on);
 +static int cbb_cardbus_reset_power(device_t brdev, device_t child, int 
 on);
  static int cbb_cardbus_io_open(device_t brdev, int win, uint32_t start,
 uint32_t end);
  static int cbb_cardbus_mem_open(device_t brdev, int win,
 @@ -958,12 +958,12 @@ cbb_do_power(device_t brdev)
  /* CardBus power functions */
  //

 -static void
 +static int
  cbb_cardbus_reset_power(device_t brdev, device_t child, int on)
  {
 struct cbb_softc *sc = device_get_softc(brdev);
 -   uint32_t b;
 -   int delay, count;
 +   uint32_t b, h;
 +   int delay, count, zero_seen, func;

 /*
  * Asserting reset for 20ms is necessary for most bridges.  For some
 @@ -1002,30 +1002,61 @@ cbb_cardbus_reset_power(device_t brdev,
 0xul  --count = 0);
 if (count  0)
 device_printf(brdev, Warning: Bus reset timeout\n);
 +
 +   /*
 +* Some cards (so far just an atheros card I have) seem to
 +* come out of reset in a funky state. They report they are
 +* multi-function cards, but have nonsense for some of the
 +* higher functions.  So if the card claims to be MFDEV, and
 +* any of the higher functions' ID is 0, then we've hit the
 +* bug and we'll try again.
 +*/
 +   h = PCIB_READ_CONFIG(brdev, b, 0, 0, PCIR_HDRTYPE, 1);
 +   if ((h  PCIM_MFDEV) == 0)
 +   

svn commit: r278937 - head/sys/dev/sfxge

2015-02-17 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Feb 18 06:18:51 2015
New Revision: 278937
URL: https://svnweb.freebsd.org/changeset/base/278937

Log:
  sfxge: add TCP segment size to sfxge_tso_state
  
  It avoids access to m_pkthdr when TSO packet is started and also makes
  tso_start_new_packet() function smaller.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

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

Modified: head/sys/dev/sfxge/sfxge_tx.c
==
--- head/sys/dev/sfxge/sfxge_tx.c   Wed Feb 18 05:53:04 2015
(r278936)
+++ head/sys/dev/sfxge/sfxge_tx.c   Wed Feb 18 06:18:51 2015
(r278937)
@@ -791,6 +791,7 @@ struct sfxge_tso_state {
ssize_t nh_off; /* Offset of network header */
ssize_t tcph_off;   /* Offset of TCP header */
unsigned header_len;/* Number of bytes of header */
+   unsigned seg_size;  /* TCP segment size */
 };
 
 static const struct ip *tso_iph(const struct sfxge_tso_state *tso)
@@ -892,6 +893,7 @@ static void tso_start(struct sfxge_tso_s
}
 
tso-header_len = tso-tcph_off + 4 * tso_tcph(tso)-th_off;
+   tso-seg_size = mbuf-m_pkthdr.tso_segsz;
 
tso-seqnum = ntohl(tso_tcph(tso)-th_seq);
 
@@ -1008,11 +1010,10 @@ static int tso_start_new_packet(struct s
m_copydata(tso-mbuf, 0, tso-header_len, header);
 
tsoh_th-th_seq = htonl(tso-seqnum);
-   tso-seqnum += tso-mbuf-m_pkthdr.tso_segsz;
-   if (tso-out_len  tso-mbuf-m_pkthdr.tso_segsz) {
+   tso-seqnum += tso-seg_size;
+   if (tso-out_len  tso-seg_size) {
/* This packet will not finish the TSO burst. */
-   ip_length = tso-header_len - tso-nh_off +
-   tso-mbuf-m_pkthdr.tso_segsz;
+   ip_length = tso-header_len - tso-nh_off + tso-seg_size;
tsoh_th-th_flags = ~(TH_FIN | TH_PUSH);
} else {
/* This packet will be the last in the TSO burst. */
@@ -1034,7 +1035,7 @@ static int tso_start_new_packet(struct s
/* Make the header visible to the hardware. */
bus_dmamap_sync(txq-packet_dma_tag, map, BUS_DMASYNC_PREWRITE);
 
-   tso-packet_space = tso-mbuf-m_pkthdr.tso_segsz;
+   tso-packet_space = tso-seg_size;
txq-tso_packets++;
 
/* Form a descriptor for this header. */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2015-02-17 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Feb 18 06:26:07 2015
New Revision: 278942
URL: https://svnweb.freebsd.org/changeset/base/278942

Log:
  sfxge: fix broken MCDI_EV_FIELD() macro
  
  Submitted by:   Andrew Lee alee at solarflare.com
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/common/efx_ev.c
  head/sys/dev/sfxge/common/efx_mcdi.h
  head/sys/dev/sfxge/common/siena_phy.c

Modified: head/sys/dev/sfxge/common/efx_ev.c
==
--- head/sys/dev/sfxge/common/efx_ev.c  Wed Feb 18 06:23:16 2015
(r278941)
+++ head/sys/dev/sfxge/common/efx_ev.c  Wed Feb 18 06:26:07 2015
(r278942)
@@ -577,9 +577,9 @@ efx_ev_mcdi(
 
case MCDI_EVENT_CODE_CMDDONE:
efx_mcdi_ev_cpl(enp,
-   MCDI_EV_FIELD(*eqp, CMDDONE_SEQ),
-   MCDI_EV_FIELD(*eqp, CMDDONE_DATALEN),
-   MCDI_EV_FIELD(*eqp, CMDDONE_ERRNO));
+   MCDI_EV_FIELD(eqp, CMDDONE_SEQ),
+   MCDI_EV_FIELD(eqp, CMDDONE_DATALEN),
+   MCDI_EV_FIELD(eqp, CMDDONE_ERRNO));
break;
 
case MCDI_EVENT_CODE_LINKCHANGE: {

Modified: head/sys/dev/sfxge/common/efx_mcdi.h
==
--- head/sys/dev/sfxge/common/efx_mcdi.hWed Feb 18 06:23:16 2015
(r278941)
+++ head/sys/dev/sfxge/common/efx_mcdi.hWed Feb 18 06:26:07 2015
(r278942)
@@ -231,7 +231,7 @@ efx_mcdi_version(
MC_CMD_ ## _field)
 
 #defineMCDI_EV_FIELD(_eqp, _field) 
\
-   EFX_QWORD_FIELD(*eqp, MCDI_EVENT_ ## _field)
+   EFX_QWORD_FIELD(*_eqp, MCDI_EVENT_ ## _field)
 
 #ifdef __cplusplus
 }

Modified: head/sys/dev/sfxge/common/siena_phy.c
==
--- head/sys/dev/sfxge/common/siena_phy.c   Wed Feb 18 06:23:16 2015
(r278941)
+++ head/sys/dev/sfxge/common/siena_phy.c   Wed Feb 18 06:26:07 2015
(r278942)
@@ -122,7 +122,7 @@ siena_phy_link_ev(
 * Convert the LINKCHANGE speed enumeration into mbit/s, in the
 * same way as GET_LINK encodes the speed
 */
-   switch (MCDI_EV_FIELD(*eqp, LINKCHANGE_SPEED)) {
+   switch (MCDI_EV_FIELD(eqp, LINKCHANGE_SPEED)) {
case MCDI_EVENT_LINKCHANGE_SPEED_100M:
speed = 100;
break;
@@ -137,11 +137,11 @@ siena_phy_link_ev(
break;
}
 
-   link_flags = MCDI_EV_FIELD(*eqp, LINKCHANGE_LINK_FLAGS);
+   link_flags = MCDI_EV_FIELD(eqp, LINKCHANGE_LINK_FLAGS);
siena_phy_decode_link_mode(enp, link_flags, speed,
-   MCDI_EV_FIELD(*eqp, LINKCHANGE_FCNTL),
+   MCDI_EV_FIELD(eqp, LINKCHANGE_FCNTL),
link_mode, fcntl);
-   siena_phy_decode_cap(MCDI_EV_FIELD(*eqp, LINKCHANGE_LP_CAP),
+   siena_phy_decode_cap(MCDI_EV_FIELD(eqp, LINKCHANGE_LP_CAP),
lp_cap_mask);
 
/*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278939 - head/sys/dev/sfxge

2015-02-17 Thread Andrew Rybchenko
Author: arybchik
Date: Wed Feb 18 06:20:59 2015
New Revision: 278939
URL: https://svnweb.freebsd.org/changeset/base/278939

Log:
  sfxge: add driver context member with number of receive queues
  
  Mainly to unify with similar member for transmit queues.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

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

Modified: head/sys/dev/sfxge/sfxge.h
==
--- head/sys/dev/sfxge/sfxge.h  Wed Feb 18 06:19:35 2015(r278938)
+++ head/sys/dev/sfxge/sfxge.h  Wed Feb 18 06:20:59 2015(r278939)
@@ -260,6 +260,7 @@ struct sfxge_softc {
chartx_lock_name[SFXGE_LOCK_NAME_MAX];
 #endif
 
+   unsigned intrxq_count;
unsigned inttxq_count;
 };
 

Modified: head/sys/dev/sfxge/sfxge_rx.c
==
--- head/sys/dev/sfxge/sfxge_rx.c   Wed Feb 18 06:19:35 2015
(r278938)
+++ head/sys/dev/sfxge/sfxge_rx.c   Wed Feb 18 06:20:59 2015
(r278939)
@@ -939,13 +939,10 @@ fail:
 void
 sfxge_rx_stop(struct sfxge_softc *sc)
 {
-   struct sfxge_intr *intr;
int index;
 
-   intr = sc-intr;
-
/* Stop the receive queue(s) */
-   index = intr-n_alloc;
+   index = sc-rxq_count;
while (--index = 0)
sfxge_rx_qstop(sc, index);
 
@@ -987,7 +984,7 @@ sfxge_rx_start(struct sfxge_softc *sc)
 * Set up the scale table.  Enable all hash types and hash insertion.
 */
for (index = 0; index  SFXGE_RX_SCALE_MAX; index++)
-   sc-rx_indir_table[index] = index % sc-intr.n_alloc;
+   sc-rx_indir_table[index] = index % sc-rxq_count;
if ((rc = efx_rx_scale_tbl_set(sc-enp, sc-rx_indir_table,
   SFXGE_RX_SCALE_MAX)) != 0)
goto fail;
@@ -1000,7 +997,7 @@ sfxge_rx_start(struct sfxge_softc *sc)
goto fail;
 
/* Start the receive queue(s). */
-   for (index = 0; index  intr-n_alloc; index++) {
+   for (index = 0; index  sc-rxq_count; index++) {
if ((rc = sfxge_rx_qstart(sc, index)) != 0)
goto fail2;
}
@@ -1099,7 +1096,7 @@ sfxge_rx_qinit(struct sfxge_softc *sc, u
efsys_mem_t *esmp;
int rc;
 
-   KASSERT(index  sc-intr.n_alloc, (index = %d, sc-intr.n_alloc));
+   KASSERT(index  sc-rxq_count, (index = %d, sc-rxq_count));
 
rxq = malloc(sizeof(struct sfxge_rxq), M_SFXGE, M_ZERO | M_WAITOK);
rxq-sc = sc;
@@ -1159,7 +1156,7 @@ sfxge_rx_stat_handler(SYSCTL_HANDLER_ARG
 
/* Sum across all RX queues */
sum = 0;
-   for (index = 0; index  sc-intr.n_alloc; index++)
+   for (index = 0; index  sc-rxq_count; index++)
sum += *(unsigned int *)((caddr_t)sc-rxq[index] +
 sfxge_rx_stats[id].offset);
 
@@ -1190,14 +1187,13 @@ sfxge_rx_stat_init(struct sfxge_softc *s
 void
 sfxge_rx_fini(struct sfxge_softc *sc)
 {
-   struct sfxge_intr *intr;
int index;
 
-   intr = sc-intr;
-
-   index = intr-n_alloc;
+   index = sc-rxq_count;
while (--index = 0)
sfxge_rx_qfini(sc, index);
+
+   sc-rxq_count = 0;
 }
 
 int
@@ -1212,11 +1208,13 @@ sfxge_rx_init(struct sfxge_softc *sc)
 
intr = sc-intr;
 
+   sc-rxq_count = intr-n_alloc;
+
KASSERT(intr-state == SFXGE_INTR_INITIALIZED,
(intr-state != SFXGE_INTR_INITIALIZED));
 
/* Initialize the receive queue(s) - one per interrupt. */
-   for (index = 0; index  intr-n_alloc; index++) {
+   for (index = 0; index  sc-rxq_count; index++) {
if ((rc = sfxge_rx_qinit(sc, index)) != 0)
goto fail;
}
@@ -1230,5 +1228,6 @@ fail:
while (--index = 0)
sfxge_rx_qfini(sc, index);
 
+   sc-rxq_count = 0;
return (rc);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278899 - vendor/elftoolchain/r3163

2015-02-17 Thread Ed Maste
Author: emaste
Date: Tue Feb 17 14:35:53 2015
New Revision: 278899
URL: https://svnweb.freebsd.org/changeset/base/278899

Log:
  Tag elftoolchain r3163

Added:
  vendor/elftoolchain/r3163/
 - copied from r278898, vendor/elftoolchain/dist/
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278901 - vendor/elftoolchain/r3163

2015-02-17 Thread Ed Maste
Author: emaste
Date: Tue Feb 17 14:37:11 2015
New Revision: 278901
URL: https://svnweb.freebsd.org/changeset/base/278901

Log:
  Remove incorrect tag

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


svn commit: r278900 - vendor/elftoolchain/elftoolchain-r3163

2015-02-17 Thread Ed Maste
Author: emaste
Date: Tue Feb 17 14:36:21 2015
New Revision: 278900
URL: https://svnweb.freebsd.org/changeset/base/278900

Log:
  Tag elftoolchain r3163

Added:
  vendor/elftoolchain/elftoolchain-r3163/
 - copied from r278899, vendor/elftoolchain/dist/
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278904 - in head: contrib/elftoolchain/addr2line contrib/elftoolchain/common contrib/elftoolchain/elfcopy contrib/elftoolchain/libdwarf contrib/elftoolchain/libelf contrib/elftoolchain...

2015-02-17 Thread Ed Maste
Author: emaste
Date: Tue Feb 17 15:19:58 2015
New Revision: 278904
URL: https://svnweb.freebsd.org/changeset/base/278904

Log:
  Update elftoolchain to upstream revision 3163
  
  Most of our changes have now been committed upstream, so this change is
  largely bookkeeping.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/contrib/elftoolchain/addr2line/addr2line.c
  head/contrib/elftoolchain/common/_elftc.h
  head/contrib/elftoolchain/common/elfdefinitions.h
  head/contrib/elftoolchain/elfcopy/main.c
  head/contrib/elftoolchain/elfcopy/sections.c
  head/contrib/elftoolchain/libdwarf/_libdwarf.h
  head/contrib/elftoolchain/libdwarf/dwarf_attrval.c
  head/contrib/elftoolchain/libdwarf/dwarf_get_AT_name.3
  head/contrib/elftoolchain/libdwarf/dwarf_get_arange_info.3
  head/contrib/elftoolchain/libdwarf/dwarf_get_section_max_offsets.3
  head/contrib/elftoolchain/libdwarf/dwarf_hasattr.3
  head/contrib/elftoolchain/libdwarf/dwarf_reloc.c
  head/contrib/elftoolchain/libdwarf/dwarf_set_reloc_application.3
  head/contrib/elftoolchain/libdwarf/dwarf_whatattr.3
  head/contrib/elftoolchain/libdwarf/libdwarf.c
  head/contrib/elftoolchain/libdwarf/libdwarf.h
  head/contrib/elftoolchain/libdwarf/libdwarf_elf_init.c
  head/contrib/elftoolchain/libdwarf/libdwarf_reloc.c
  head/contrib/elftoolchain/libelf/_libelf_config.h
  head/contrib/elftoolchain/libelf/elf.3
  head/contrib/elftoolchain/libelf/elf_scn.c
  head/contrib/elftoolchain/libelf/libelf_ar_util.c
  head/contrib/elftoolchain/libelf/libelf_convert.m4
  head/contrib/elftoolchain/nm/nm.1
  head/contrib/elftoolchain/nm/nm.c
  head/contrib/elftoolchain/readelf/readelf.c
  head/lib/libelftc/elftc_version.c
Directory Properties:
  head/contrib/elftoolchain/   (props changed)

Modified: head/contrib/elftoolchain/addr2line/addr2line.c
==
--- head/contrib/elftoolchain/addr2line/addr2line.c Tue Feb 17 15:04:53 
2015(r278903)
+++ head/contrib/elftoolchain/addr2line/addr2line.c Tue Feb 17 15:19:58 
2015(r278904)
@@ -40,7 +40,7 @@
 
 #include _elftc.h
 
-ELFTC_VCSID($Id: addr2line.c 2185 2011-11-19 16:07:16Z jkoshy $);
+ELFTC_VCSID($Id: addr2line.c 3148 2015-02-15 18:47:39Z emaste $);
 
 static struct option longopts[] = {
{target , required_argument, NULL, 'b'},

Modified: head/contrib/elftoolchain/common/_elftc.h
==
--- head/contrib/elftoolchain/common/_elftc.h   Tue Feb 17 15:04:53 2015
(r278903)
+++ head/contrib/elftoolchain/common/_elftc.h   Tue Feb 17 15:19:58 2015
(r278904)
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: _elftc.h 2922 2013-03-17 22:53:15Z kaiwang27 $
+ * $Id: _elftc.h 3139 2015-01-05 03:17:06Z kaiwang27 $
  */
 
 /**
@@ -76,10 +76,17 @@
  * SUCH DAMAGE.
  */
 
+#ifndefLIST_FOREACH_SAFE
+#defineLIST_FOREACH_SAFE(var, head, field, tvar)   \
+   for ((var) = LIST_FIRST((head));\
+   (var)  ((tvar) = LIST_NEXT((var), field), 1); \
+   (var) = (tvar))
+#endif
+
 #ifndefSLIST_FOREACH_SAFE
-#defineSLIST_FOREACH_SAFE(var, head, field, tvar)  
\
-   for ((var) = SLIST_FIRST((head));   \
-   (var)  ((tvar) = SLIST_NEXT((var), field), 1);\
+#defineSLIST_FOREACH_SAFE(var, head, field, tvar)  \
+   for ((var) = SLIST_FIRST((head));   \
+   (var)  ((tvar) = SLIST_NEXT((var), field), 1);\
(var) = (tvar))
 #endif
 

Modified: head/contrib/elftoolchain/common/elfdefinitions.h
==
--- head/contrib/elftoolchain/common/elfdefinitions.h   Tue Feb 17 15:04:53 
2015(r278903)
+++ head/contrib/elftoolchain/common/elfdefinitions.h   Tue Feb 17 15:19:58 
2015(r278904)
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: elfdefinitions.h 3110 2014-12-20 08:32:46Z kaiwang27 $
+ * $Id: elfdefinitions.h 3149 2015-02-15 19:00:06Z emaste $
  */
 
 /*
@@ -1396,6 +1396,12 @@ _ELF_DEFINE_RELOC(R_386_8,   22) \
 _ELF_DEFINE_RELOC(R_386_PC8,   23)
 
 /*
+ */
+#define_ELF_DEFINE_AARCH64_RELOCATIONS()   \
+_ELF_DEFINE_RELOC(R_AARCH64_ABS64, 257)\
+_ELF_DEFINE_RELOC(R_AARCH64_ABS32, 258)\
+
+/*
  * These are the symbols used in the Sun ``Linkers and Loaders
  * Guide'', Document No: 817-1984-17.  See the X86_64 relocations list
  * below for the spellings used in the ELF specification.
@@ -1962,6 +1968,7 @@ _ELF_DEFINE_RELOC(R_X86_64_IRELATIVE, 37
 
 #define_ELF_DEFINE_RELOCATIONS()   \
 _ELF_DEFINE_386_RELOCATIONS()  

svn commit: r278905 - head/lib/libc/gen

2015-02-17 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Feb 17 16:01:00 2015
New Revision: 278905
URL: https://svnweb.freebsd.org/changeset/base/278905

Log:
  ulimit(3): simplify.
  
  rlim_t is at least as large as long, so we don't need the
  extra variable to keep the intermediate step. We don't
  need the volatile either.
  
  The code was tested on i386 and amd64.
  
  Suggested by: bde
  X-MFC with:   r278803

Modified:
  head/lib/libc/gen/ulimit.c

Modified: head/lib/libc/gen/ulimit.c
==
--- head/lib/libc/gen/ulimit.c  Tue Feb 17 15:19:58 2015(r278904)
+++ head/lib/libc/gen/ulimit.c  Tue Feb 17 16:01:00 2015(r278905)
@@ -33,7 +33,6 @@
 #include errno.h
 #include limits.h
 #include stdarg.h
-#include stdint.h
 #include ulimit.h
 
 long
@@ -41,8 +40,7 @@ ulimit(int cmd, ...)
 {
struct rlimit limit;
va_list ap;
-   volatile intmax_t targ;
-   long arg;
+   rlim_t arg;
 
if (cmd == UL_GETFSIZE) {
if (getrlimit(RLIMIT_FSIZE, limit) == -1)
@@ -53,18 +51,18 @@ ulimit(int cmd, ...)
return ((long)limit.rlim_cur);
} else if (cmd == UL_SETFSIZE) {
va_start(ap, cmd);
-   targ = arg = va_arg(ap, long);
+   arg = va_arg(ap, long);
va_end(ap);
-   if (targ  0)
-   targ = LONG_MAX;
-   if (targ  RLIM_INFINITY / 512)
-   targ = RLIM_INFINITY / 512;
-   limit.rlim_max = limit.rlim_cur = targ * 512;
+   if (arg  0)
+   arg = LONG_MAX;
+   if (arg  RLIM_INFINITY / 512)
+   arg = RLIM_INFINITY / 512;
+   limit.rlim_max = limit.rlim_cur = arg * 512;
 
/* The setrlimit() function sets errno to EPERM if needed. */
if (setrlimit(RLIMIT_FSIZE, limit) == -1)
return (-1);
-   return ((long)targ);
+   return ((long)arg);
} else {
errno = EINVAL;
return (-1);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278898 - in vendor/elftoolchain/dist: addr2line ar common elfcopy elfdump libdwarf libelf nm readelf

2015-02-17 Thread Ed Maste
Author: emaste
Date: Tue Feb 17 14:34:11 2015
New Revision: 278898
URL: https://svnweb.freebsd.org/changeset/base/278898

Log:
  Import elftoolchain rev 3163
  
  From svn.code.sf.net/p/elftoolchain/code

Modified:
  vendor/elftoolchain/dist/addr2line/addr2line.c
  vendor/elftoolchain/dist/ar/acplex.l
  vendor/elftoolchain/dist/ar/read.c
  vendor/elftoolchain/dist/common/_elftc.h
  vendor/elftoolchain/dist/common/elfdefinitions.h
  vendor/elftoolchain/dist/elfcopy/main.c
  vendor/elftoolchain/dist/elfcopy/sections.c
  vendor/elftoolchain/dist/elfdump/elfdump.c
  vendor/elftoolchain/dist/libdwarf/_libdwarf.h
  vendor/elftoolchain/dist/libdwarf/dwarf_attrval.c
  vendor/elftoolchain/dist/libdwarf/dwarf_get_AT_name.3
  vendor/elftoolchain/dist/libdwarf/dwarf_get_arange_info.3
  vendor/elftoolchain/dist/libdwarf/dwarf_get_section_max_offsets.3
  vendor/elftoolchain/dist/libdwarf/dwarf_hasattr.3
  vendor/elftoolchain/dist/libdwarf/dwarf_reloc.c
  vendor/elftoolchain/dist/libdwarf/dwarf_set_reloc_application.3
  vendor/elftoolchain/dist/libdwarf/dwarf_whatattr.3
  vendor/elftoolchain/dist/libdwarf/libdwarf.c
  vendor/elftoolchain/dist/libdwarf/libdwarf.h
  vendor/elftoolchain/dist/libdwarf/libdwarf_elf_init.c
  vendor/elftoolchain/dist/libdwarf/libdwarf_reloc.c
  vendor/elftoolchain/dist/libelf/_libelf_config.h
  vendor/elftoolchain/dist/libelf/elf.3
  vendor/elftoolchain/dist/libelf/elf_scn.c
  vendor/elftoolchain/dist/libelf/libelf_ar_util.c
  vendor/elftoolchain/dist/libelf/libelf_convert.m4
  vendor/elftoolchain/dist/nm/nm.1
  vendor/elftoolchain/dist/nm/nm.c
  vendor/elftoolchain/dist/readelf/readelf.c

Modified: vendor/elftoolchain/dist/addr2line/addr2line.c
==
--- vendor/elftoolchain/dist/addr2line/addr2line.c  Tue Feb 17 14:33:51 
2015(r278897)
+++ vendor/elftoolchain/dist/addr2line/addr2line.c  Tue Feb 17 14:34:11 
2015(r278898)
@@ -40,7 +40,7 @@
 
 #include _elftc.h
 
-ELFTC_VCSID($Id: addr2line.c 2185 2011-11-19 16:07:16Z jkoshy $);
+ELFTC_VCSID($Id: addr2line.c 3148 2015-02-15 18:47:39Z emaste $);
 
 static struct option longopts[] = {
{target , required_argument, NULL, 'b'},
@@ -399,8 +399,10 @@ main(int argc, char **argv)
for (i = 0; i  argc; i++)
translate(dbg, argv[i]);
else
-   while (fgets(line, sizeof(line), stdin) != NULL)
+   while (fgets(line, sizeof(line), stdin) != NULL) {
translate(dbg, line);
+   fflush(stdout);
+   }
 
dwarf_finish(dbg, de);
 

Modified: vendor/elftoolchain/dist/ar/acplex.l
==
--- vendor/elftoolchain/dist/ar/acplex.lTue Feb 17 14:33:51 2015
(r278897)
+++ vendor/elftoolchain/dist/ar/acplex.lTue Feb 17 14:34:11 2015
(r278898)
@@ -34,7 +34,7 @@
 
 #include _elftc.h
 
-ELFTC_VCSID($Id: acplex.l 2130 2011-11-10 06:56:46Z jkoshy $);
+ELFTC_VCSID($Id: acplex.l 3162 2015-02-15 21:43:41Z emaste $);
 
 #include acpyacc.h
 
@@ -49,6 +49,7 @@ int   yylex(void);
 
 %}
 
+%option nounput
 %option noyywrap
 
 %%

Modified: vendor/elftoolchain/dist/ar/read.c
==
--- vendor/elftoolchain/dist/ar/read.c  Tue Feb 17 14:33:51 2015
(r278897)
+++ vendor/elftoolchain/dist/ar/read.c  Tue Feb 17 14:34:11 2015
(r278898)
@@ -39,7 +39,7 @@
 
 #include ar.h
 
-ELFTC_VCSID($Id: read.c 3102 2014-10-29 21:09:01Z jkoshy $);
+ELFTC_VCSID($Id: read.c 3163 2015-02-15 21:43:51Z emaste $);
 
 /*
  * Handle read modes: 'x', 't' and 'p'.
@@ -90,7 +90,8 @@ ar_read_archive(struct bsdar *bsdar, int
else
bsdar-options = ~AR_BSD;
 
-   name = archive_entry_pathname(entry);
+   if ((name = archive_entry_pathname(entry)) == NULL)
+   break;
 
/* Skip pseudo members. */
if (bsdar_is_pseudomember(bsdar, name))

Modified: vendor/elftoolchain/dist/common/_elftc.h
==
--- vendor/elftoolchain/dist/common/_elftc.hTue Feb 17 14:33:51 2015
(r278897)
+++ vendor/elftoolchain/dist/common/_elftc.hTue Feb 17 14:34:11 2015
(r278898)
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: _elftc.h 2922 2013-03-17 22:53:15Z kaiwang27 $
+ * $Id: _elftc.h 3139 2015-01-05 03:17:06Z kaiwang27 $
  */
 
 /**
@@ -76,10 +76,17 @@
  * SUCH DAMAGE.
  */
 
+#ifndefLIST_FOREACH_SAFE
+#defineLIST_FOREACH_SAFE(var, head, field, tvar)   \
+   for ((var) = LIST_FIRST((head));\
+   (var)  ((tvar) = LIST_NEXT((var), field), 1); \
+   (var) = (tvar))
+#endif
+
 

svn commit: r278902 - head/usr.sbin/pw/tests

2015-02-17 Thread Brad Davis
Author: brd (doc committer)
Date: Tue Feb 17 14:48:16 2015
New Revision: 278902
URL: https://svnweb.freebsd.org/changeset/base/278902

Log:
  Add tests for account and password expiration.
  
  Approved by:  will

Modified:
  head/usr.sbin/pw/tests/pw_useradd.sh

Modified: head/usr.sbin/pw/tests/pw_useradd.sh
==
--- head/usr.sbin/pw/tests/pw_useradd.shTue Feb 17 14:37:11 2015
(r278901)
+++ head/usr.sbin/pw/tests/pw_useradd.shTue Feb 17 14:48:16 2015
(r278902)
@@ -63,6 +63,108 @@ user_add_comments_invalid_noupdate_body(
atf_check -s exit:1 -o empty grep ^test:.* $HOME/master.passwd
 }
 
+# Test add user with alternate homedir
+atf_test_case user_add_homedir
+user_add_homedir_body() {
+   populate_etc_skel
+
+   atf_check -s exit:0 ${PW} useradd test -d /foo/bar
+   atf_check -s exit:0 -o match:^test:\*:.*::0:0:User :/foo/bar:.* \
+   ${PW} usershow test
+}
+
+# Test add user with account expiration as an epoch date
+atf_test_case user_add_account_expiration_epoch
+user_add_account_expiration_epoch_body() {
+   populate_etc_skel
+
+   DATE=`date -j -v+1d +%s`
+   atf_check -s exit:0 ${PW} useradd test -e ${DATE}
+   atf_check -s exit:0 -o match:^test:\*:.*::0:${DATE}:.* \
+   ${PW} usershow test
+}
+
+# Test add user with account expiration as a DD-MM- date
+atf_test_case user_add_account_expiration_date_numeric
+user_add_account_expiration_date_numeric_body() {
+   populate_etc_skel
+
+   DATE=`date -j -v+1d +%d-%m-%Y`
+   EPOCH=`date -j -f %d-%m-%Y %H:%M:%S ${DATE} 00:00:00 +%s`
+   atf_check -s exit:0 ${PW} useradd test -e ${DATE}
+   atf_check -s exit:0 -o match:^test:\*:.*::0:${EPOCH}:User :.* \
+   ${PW} usershow test
+}
+
+# Test add user with account expiration as a DD-MM- date
+atf_test_case user_add_account_expiration_date_month
+user_add_account_expiration_date_month_body() {
+   populate_etc_skel
+
+   DATE=`date -j -v+1d +%d-%b-%Y`
+   EPOCH=`date -j -f %d-%b-%Y %H:%M:%S ${DATE} 00:00:00 +%s`
+   atf_check -s exit:0 ${PW} useradd test -e ${DATE}
+   atf_check -s exit:0 -o match:^test:\*:.*::0:${EPOCH}:User :.* \
+   ${PW} usershow test
+}
+
+# Test add user with account expiration as a relative date
+atf_test_case user_add_account_expiration_date_relative
+user_add_account_expiration_date_relative_body() {
+   populate_etc_skel
+
+   EPOCH=`date -j -v+13m +%s`
+   atf_check -s exit:0 ${PW} useradd test -e +13o
+   atf_check -s exit:0 -o match:^test:\*:.*::0:${EPOCH}:User :.* \
+   ${PW} usershow test
+}
+
+# Test add user with password expiration as an epoch date
+atf_test_case user_add_password_expiration_epoch
+user_add_password_expiration_epoch_body() {
+   populate_etc_skel
+
+   DATE=`date -j -v+1d +%s`
+   atf_check -s exit:0 ${PW} useradd test -p ${DATE}
+   atf_check -s exit:0 -o match:^test:\*:.*::${DATE}:0:.* \
+   ${PW} usershow test
+}
+
+# Test add user with password expiration as a DD-MM- date
+atf_test_case user_add_password_expiration_date_numeric
+user_add_password_expiration_date_numeric_body() {
+   populate_etc_skel
+
+   DATE=`date -j -v+1d +%d-%m-%Y`
+   EPOCH=`date -j -f %d-%m-%Y %H:%M:%S ${DATE} 00:00:00 +%s`
+   atf_check -s exit:0 ${PW} useradd test -p ${DATE}
+   atf_check -s exit:0 -o match:^test:\*:.*::${EPOCH}:0:User :.* \
+   ${PW} usershow test
+}
+
+# Test add user with password expiration as a DD-MMM- date
+atf_test_case user_add_password_expiration_date_month
+user_add_password_expiration_date_month_body() {
+   populate_etc_skel
+
+   DATE=`date -j -v+1d +%d-%b-%Y`
+   EPOCH=`date -j -f %d-%b-%Y %H:%M:%S ${DATE} 00:00:00 +%s`
+   atf_check -s exit:0 ${PW} useradd test -p ${DATE}
+   atf_check -s exit:0 -o match:^test:\*:.*::${EPOCH}:0:User :.* \
+   ${PW} usershow test
+}
+
+# Test add user with password expiration as a relative date
+atf_test_case user_add_password_expiration_date_relative
+user_add_password_expiration_date_relative_body() {
+   populate_etc_skel
+
+   EPOCH=`date -j -v+13m +%s`
+   atf_check -s exit:0 ${PW} useradd test -p +13o
+   atf_check -s exit:0 -o match:^test:\*:.*::${EPOCH}:0:User :.* \
+   ${PW} usershow test
+}
+
 atf_init_test_cases() {
atf_add_test_case user_add
atf_add_test_case user_add_noupdate
@@ -70,4 +172,13 @@ atf_init_test_cases() {
atf_add_test_case user_add_comments_noupdate
atf_add_test_case user_add_comments_invalid 
atf_add_test_case user_add_comments_invalid_noupdate
+   atf_add_test_case user_add_homedir
+   atf_add_test_case user_add_account_expiration_epoch
+   atf_add_test_case user_add_account_expiration_date_numeric
+   atf_add_test_case 

Re: svn commit: r278879 - in head/sys: kern sys

2015-02-17 Thread hiren panchasara
On 02/17/15 at 02:35P, Adrian Chadd wrote:
 Author: adrian
 Date: Tue Feb 17 02:35:06 2015
 New Revision: 278879
 URL: https://svnweb.freebsd.org/changeset/base/278879
 
 Log:
   Implement taskqueue_start_threads_cpuset().
   
   This is a more generic version of taskqueue_start_threads_pinned()
   which only supports a single cpuid.
   
   This originally came from John Baldwin jhb@ who implemented it
   as part of a push towards NUMA awareness in drivers.  I started implementing
   something similar for RSS and NUMA, then found he already did it.
   
   I'd like to axe taskqueue_start_threads_pinned() so it doesn't become
   part of a longer-term API.  (Read: hps@ wants to MFC things, and
   if I don't do this soon, he'll MFC what's here. :-)
   
   I have a follow-up commit which converts the intel drivers over
   to using the cpuset version of this function, so we can eventually
   nuke the the pinned version.
   
   Tested:
   
   * igb, ixgbe
   
   Obtained from:  jhbbsd
 
 Modified:
   head/sys/kern/subr_taskqueue.c
   head/sys/sys/taskqueue.h

Can you please also update taskqueue(9) manpage?

Cheers,
Hiren


pgpHfkOBZNJ_o.pgp
Description: PGP signature


svn commit: r278913 - in head/sys: conf modules/cxgbe/if_cxgbe modules/drm2/radeonkms modules/ibcore modules/ipoib modules/mlx4 modules/mlx4ib modules/mlxen modules/mthca ofed/drivers/net/mlx4

2015-02-17 Thread Gleb Smirnoff
Author: glebius
Date: Tue Feb 17 19:27:14 2015
New Revision: 278913
URL: https://svnweb.freebsd.org/changeset/base/278913

Log:
Globally enable -fms-extensions when building kernel with gcc, and remove
  this option from all modules that enable it theirselves.
In C mode -fms-extensions option enables anonymous structs and unions,
  allowing us to use this C11 feature in kernel. Of course, clang supports
  it without any extra options.
  
  Reviewed by:  dim

Modified:
  head/sys/conf/files
  head/sys/conf/kern.mk
  head/sys/conf/kern.pre.mk
  head/sys/conf/kmod.mk
  head/sys/modules/cxgbe/if_cxgbe/Makefile
  head/sys/modules/drm2/radeonkms/Makefile
  head/sys/modules/ibcore/Makefile
  head/sys/modules/ipoib/Makefile
  head/sys/modules/mlx4/Makefile
  head/sys/modules/mlx4ib/Makefile
  head/sys/modules/mlxen/Makefile
  head/sys/modules/mthca/Makefile
  head/sys/ofed/drivers/net/mlx4/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue Feb 17 19:15:07 2015(r278912)
+++ head/sys/conf/files Tue Feb 17 19:27:14 2015(r278913)
@@ -1141,7 +1141,7 @@ dev/cxgb/sys/uipc_mvec.c  optional cxgb p
 dev/cxgb/cxgb_t3fw.c   optional cxgb cxgb_t3fw \
compile-with ${NORMAL_C} -I$S/dev/cxgb
 dev/cxgbe/t4_mp_ring.c optional cxgbe pci \
-   compile-with ${NORMAL_C} -I$S/dev/cxgbe ${GCC_MS_EXTENSIONS}
+   compile-with ${NORMAL_C} -I$S/dev/cxgbe
 dev/cxgbe/t4_main.coptional cxgbe pci \
compile-with ${NORMAL_C} -I$S/dev/cxgbe
 dev/cxgbe/t4_netmap.c  optional cxgbe pci \

Modified: head/sys/conf/kern.mk
==
--- head/sys/conf/kern.mk   Tue Feb 17 19:15:07 2015(r278912)
+++ head/sys/conf/kern.mk   Tue Feb 17 19:27:14 2015(r278913)
@@ -39,7 +39,6 @@ CLANG_NO_IAS34= -no-integrated-as
 .endif
 
 .if ${COMPILER_TYPE} == gcc
-GCC_MS_EXTENSIONS= -fms-extensions
 .if ${COMPILER_VERSION} = 40300
 # Catch-all for all the things that are in our tree, but for which we're
 # not yet ready for this compiler. Note: we likely only really support

Modified: head/sys/conf/kern.pre.mk
==
--- head/sys/conf/kern.pre.mk   Tue Feb 17 19:15:07 2015(r278912)
+++ head/sys/conf/kern.pre.mk   Tue Feb 17 19:27:14 2015(r278913)
@@ -97,7 +97,7 @@ CFLAGS_PARAM_LARGE_FUNCTION_GROWTH?=1000
 .if ${MACHINE_CPUARCH} == mips
 CFLAGS_ARCH_PARAMS?=--param max-inline-insns-single=1000
 .endif
-CFLAGS.gcc+= -fno-common -finline-limit=${INLINE_LIMIT}
+CFLAGS.gcc+= -fno-common -fms-extensions -finline-limit=${INLINE_LIMIT}
 CFLAGS.gcc+= --param inline-unit-growth=${CFLAGS_PARAM_INLINE_UNIT_GROWTH}
 CFLAGS.gcc+= --param 
large-function-growth=${CFLAGS_PARAM_LARGE_FUNCTION_GROWTH}
 .if defined(CFLAGS_ARCH_PARAMS)
@@ -162,7 +162,7 @@ NORMAL_LINT=${LINT} ${LINTFLAGS} ${CFLA
 # Infiniband C flags.  Correct include paths and omit errors that linux
 # does not honor.
 OFEDINCLUDES=  -I$S/ofed/include/
-OFEDNOERR= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS}
+OFEDNOERR= -Wno-cast-qual -Wno-pointer-arith
 OFEDCFLAGS=${CFLAGS:N-I*} ${OFEDINCLUDES} ${CFLAGS:M-I*} ${OFEDNOERR}
 OFED_C_NOIMP=  ${CC} -c -o ${.TARGET} ${OFEDCFLAGS} ${WERROR} ${PROF}
 OFED_C=${OFED_C_NOIMP} ${.IMPSRC}

Modified: head/sys/conf/kmod.mk
==
--- head/sys/conf/kmod.mk   Tue Feb 17 19:15:07 2015(r278912)
+++ head/sys/conf/kmod.mk   Tue Feb 17 19:27:14 2015(r278913)
@@ -105,6 +105,7 @@ CFLAGS+=-I. -I${SYSDIR}
 CFLAGS+=   -I${SYSDIR}/contrib/altq
 
 CFLAGS.gcc+=   -finline-limit=${INLINE_LIMIT}
+CFLAGS.gcc+=   -fms-extensions
 CFLAGS.gcc+= --param inline-unit-growth=100
 CFLAGS.gcc+= --param large-function-growth=1000
 

Modified: head/sys/modules/cxgbe/if_cxgbe/Makefile
==
--- head/sys/modules/cxgbe/if_cxgbe/MakefileTue Feb 17 19:15:07 2015
(r278912)
+++ head/sys/modules/cxgbe/if_cxgbe/MakefileTue Feb 17 19:27:14 2015
(r278913)
@@ -26,4 +26,3 @@ SRCS+=t4_tracer.c
 CFLAGS+= -I${CXGBE}
 
 .include bsd.kmod.mk
-CFLAGS+= ${GCC_MS_EXTENSIONS}

Modified: head/sys/modules/drm2/radeonkms/Makefile
==
--- head/sys/modules/drm2/radeonkms/MakefileTue Feb 17 19:15:07 2015
(r278912)
+++ head/sys/modules/drm2/radeonkms/MakefileTue Feb 17 19:27:14 2015
(r278913)
@@ -106,6 +106,6 @@ SRCS+=  
\
iicbus_if.h \
pci_if.h
 
-CFLAGS  += -I${.CURDIR}/../../../dev/drm2/radeon 

svn commit: r278917 - head/sys/dev/iicbus

2015-02-17 Thread Luiz Otavio O Souza
Author: loos
Date: Tue Feb 17 20:08:40 2015
New Revision: 278917
URL: https://svnweb.freebsd.org/changeset/base/278917

Log:
  Fix the display of negative temperatures.
  
  Fix the setting of TOS (overtemperature shutdown) and THYST (hysteresis
  temperature).

Modified:
  head/sys/dev/iicbus/lm75.c

Modified: head/sys/dev/iicbus/lm75.c
==
--- head/sys/dev/iicbus/lm75.c  Tue Feb 17 19:53:41 2015(r278916)
+++ head/sys/dev/iicbus/lm75.c  Tue Feb 17 20:08:40 2015(r278917)
@@ -51,6 +51,8 @@ __FBSDID($FreeBSD$);
 
 /* LM75 registers. */
 #defineLM75_TEMP   0x0
+#defineLM75_TEMP_MASK  0xff80
+#defineLM75A_TEMP_MASK 0xffe0
 #defineLM75_CONF   0x1
 #defineLM75_CONF_FSHIFT3
 #defineLM75_CONF_FAULT 0x18
@@ -331,20 +333,24 @@ lm75_temp_read(struct lm75_softc *sc, ui
 {
uint8_t buf8[2];
uint16_t buf;
-   int t;
+   int neg, t;
 
if (lm75_read(sc-sc_dev, sc-sc_addr, reg, buf8, 2)  0)
return (-1);
-
-   buf = (buf8[0]  8) | (buf8[1]  0xff);
-
+   buf = (uint16_t)((buf8[0]  8) | (buf8[1]  0xff));
/*
 * LM75 has a 9 bit ADC with resolution of 0.5 C per bit.
 * LM75A has an 11 bit ADC with resolution of 0.125 C per bit.
 * Temperature is stored with two's complement.
 */
-   if (buf  LM75_NEG_BIT)
-   buf = ~buf + 1;
+   neg = 0;
+   if (buf  LM75_NEG_BIT) {
+   if (sc-sc_hwtype == HWTYPE_LM75A)
+   buf = ~(buf  LM75A_TEMP_MASK) + 1;
+   else
+   buf = ~(buf  LM75_TEMP_MASK) + 1;
+   neg = 1;
+   }
*temp = ((int16_t)buf  8) * 10;
t = 0;
if (sc-sc_hwtype == HWTYPE_LM75A) {
@@ -357,7 +363,7 @@ lm75_temp_read(struct lm75_softc *sc, ui
t += 500;
t /= 100;
*temp += t;
-   if (buf  LM75_NEG_BIT)
+   if (neg)
*temp = -(*temp);
*temp += TZ_ZEROC;
 
@@ -370,6 +376,7 @@ lm75_temp_write(struct lm75_softc *sc, u
uint8_t buf8[3];
uint16_t buf;
 
+   temp = (temp - TZ_ZEROC) / 10;
if (temp  LM75_MAX_TEMP)
temp = LM75_MAX_TEMP;
if (temp  LM75_MIN_TEMP)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r278831 - head/sys/netpfil/pf

2015-02-17 Thread John-Mark Gurney
Gleb Smirnoff wrote this message on Tue, Feb 17, 2015 at 23:21 +0300:
 On Tue, Feb 17, 2015 at 09:31:34AM -0800, John-Mark Gurney wrote:
 J Gleb Smirnoff wrote this message on Mon, Feb 16, 2015 at 03:38 +:
 J  Author: glebius
 J  Date: Mon Feb 16 03:38:27 2015
 J  New Revision: 278831
 J  URL: https://svnweb.freebsd.org/changeset/base/278831
 J  
 J  Log:
 JUpdate the pf fragment handling code to closer match recent OpenBSD.
 JThat partially fixes IPv6 fragment handling. Thanks to Kristof for
 Jworking on that.
 J
 JSubmitted by:  Kristof Provost
 JTested by: peter
 JDifferential Revision: D1765
 J 
 J Looks like pf_flush_fragments still called in !INET case, though only
 J defined for INET case:
 J /scratch/tmp/jmg/src.head/sys/modules/pf/../../netpfil/pf/pf_norm.c:385:3: 
 error: implicit declaration of function 'pf_flush_fragments' is invalid in 
 C99 [-Werror,-Wimplicit-function-declaration]
 J pf_flush_fragments();
 J 
 J when compiling LINT-NOINET kernel..
 J 
 J at least as of r278883...
 J 
 J We need to get Jenkins to be compiling the LINT-NOINET kernel too..
 
 Strange, since r278874 was tested with KERNCONF=LINT LINT-NOINET 
 LINT-NOINET6.
 
 I will take a look.

This is a result of a tinderbox build on ref10-amd64.freebsd.org...
Look at /scratch/tmp/jmg/src.head/*NOINET

-- 
  John-Mark Gurney  Voice: +1 415 225 5579

 All that I will do, has been done, All that I have, has not.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r278886 - in head/sys: conf contrib/rdma/krping dev/cxgb/ulp/iw_cxgb dev/cxgbe/iw_cxgbe modules/ibcore modules/mlx4ib ofed/drivers/infiniband/core ofed/drivers/infiniband/debug ofed/dr

2015-02-17 Thread Hans Petter Selasky

Hi,

On 02/17/15 18:34, Navdeep Parhar wrote:

On Tue, Feb 17, 2015 at 08:40:28AM +, Hans Petter Selasky wrote:

Author: hselasky
Date: Tue Feb 17 08:40:27 2015
New Revision: 278886
URL: https://svnweb.freebsd.org/changeset/base/278886

Log:
   Update the infiniband stack to Mellanox's OFED version 2.1.


What version of the Linux kernel does this match?


It is very close to the latest 3.xxx Linux kernel.




   Highlights:
- Multiple verbs API updates
- Support for RoCE, RDMA over ethernet

   All hardware drivers depending on the common infiniband stack has been
   updated aswell.

   Discussed with:  np @
   Sponsored by:Mellanox Technologies
   MFC after:   1 month


My reading of the project's MFC policy is that changes to the verbs
cannot be MFC'd as that's a KPI/API change.


I agree, and if this will break binary compatibility and that is a 
requirement, I will not MFC.




I still plan to test these changes with some iWARP gear later this week.
I thought you were going to wait till then, but, oh well.


Thank you!

--HPS

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


Re: svn commit: r278831 - head/sys/netpfil/pf

2015-02-17 Thread Gleb Smirnoff
On Tue, Feb 17, 2015 at 09:31:34AM -0800, John-Mark Gurney wrote:
J Gleb Smirnoff wrote this message on Mon, Feb 16, 2015 at 03:38 +:
J  Author: glebius
J  Date: Mon Feb 16 03:38:27 2015
J  New Revision: 278831
J  URL: https://svnweb.freebsd.org/changeset/base/278831
J  
J  Log:
JUpdate the pf fragment handling code to closer match recent OpenBSD.
JThat partially fixes IPv6 fragment handling. Thanks to Kristof for
Jworking on that.
J
JSubmitted by:Kristof Provost
JTested by:   peter
JDifferential Revision:   D1765
J 
J Looks like pf_flush_fragments still called in !INET case, though only
J defined for INET case:
J /scratch/tmp/jmg/src.head/sys/modules/pf/../../netpfil/pf/pf_norm.c:385:3: 
error: implicit declaration of function 'pf_flush_fragments' is invalid in C99 
[-Werror,-Wimplicit-function-declaration]
J pf_flush_fragments();
J 
J when compiling LINT-NOINET kernel..
J 
J at least as of r278883...
J 
J We need to get Jenkins to be compiling the LINT-NOINET kernel too..

Strange, since r278874 was tested with KERNCONF=LINT LINT-NOINET LINT-NOINET6.

I will take a look.

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


svn commit: r278907 - head/sys/dev/random

2015-02-17 Thread John-Mark Gurney
Author: jmg
Date: Tue Feb 17 17:37:00 2015
New Revision: 278907
URL: https://svnweb.freebsd.org/changeset/base/278907

Log:
  When the new random adaptor code was brought it in r273872, a call to
  randomdev_init_reader to change read_random over to the newly installed
  adaptor was missed.  This means both read_random and arc4random (seeded
  from read_random) were not returning very random data.  This also
  effects userland arc4random as it is seeded from kernel arc4random.
  
  The random devices are uneffected and have returned good randomness
  since the change.
  
  All keys generated with a kernel of r273872 must be regenerated with
  a kernel with this patch.  Keys generated may be predictable.
  
  Remove the warning as log is too early to print anything, and it would
  always get printed due to early use of arc4random...
  
  Reviewed by:  delphij, markm
  Approved by:so (delphij)

Modified:
  head/sys/dev/random/dummy_rng.c
  head/sys/dev/random/random_adaptors.c
  head/sys/dev/random/randomdev.c
  head/sys/dev/random/randomdev.h

Modified: head/sys/dev/random/dummy_rng.c
==
--- head/sys/dev/random/dummy_rng.c Tue Feb 17 17:34:45 2015
(r278906)
+++ head/sys/dev/random/dummy_rng.c Tue Feb 17 17:37:00 2015
(r278907)
@@ -82,19 +82,13 @@ dummy_random_init(void)
  *
  * Caveat Emptor.
  */
-u_int
+void
 dummy_random_read_phony(uint8_t *buf, u_int count)
 {
/* If no entropy device is loaded, don't spam the console with warnings 
*/
-   static int warned = 0;
u_long randval;
size_t size, i;
 
-   if (!warned) {
-   log(LOG_WARNING, random device not loaded/active; using 
insecure pseudo-random number generator\n);
-   warned = 1;
-   }
-
/* srandom() is called in kern/init_main.c:proc0_post() */
 
/* Fill buf[] with random(9) output */
@@ -103,8 +97,6 @@ dummy_random_read_phony(uint8_t *buf, u_
size = MIN(count - i, sizeof(randval));
memcpy(buf + i, randval, (size_t)size);
}
-
-   return (count);
 }
 
 struct random_adaptor randomdev_dummy = {

Modified: head/sys/dev/random/random_adaptors.c
==
--- head/sys/dev/random/random_adaptors.c   Tue Feb 17 17:34:45 2015
(r278906)
+++ head/sys/dev/random/random_adaptors.c   Tue Feb 17 17:37:00 2015
(r278907)
@@ -149,10 +149,14 @@ random_adaptor_choose(void)
(random_adaptor_previous == NULL ? NULL : 
random_adaptor_previous-ra_ident),
random_adaptor-ra_ident);
 #endif
-   if (random_adaptor_previous != NULL)
+   if (random_adaptor_previous != NULL) {
+   randomdev_deinit_reader();
(random_adaptor_previous-ra_deinit)();
+   }
(random_adaptor-ra_init)();
}
+
+   randomdev_init_reader(random_adaptor-ra_read);
 }
 
 

Modified: head/sys/dev/random/randomdev.c
==
--- head/sys/dev/random/randomdev.c Tue Feb 17 17:34:45 2015
(r278906)
+++ head/sys/dev/random/randomdev.c Tue Feb 17 17:37:00 2015
(r278907)
@@ -214,11 +214,11 @@ random_harvest(const void *entropy, u_in
  */
 
 /* Hold the address of the routine which is actually called */
-static u_int (*read_func)(uint8_t *, u_int) = dummy_random_read_phony;
+static void (*read_func)(uint8_t *, u_int) = dummy_random_read_phony;
 
 /* Initialise the reader when/if it is loaded */
 void
-randomdev_init_reader(u_int (*reader)(uint8_t *, u_int))
+randomdev_init_reader(void (*reader)(uint8_t *, u_int))
 {
 
read_func = reader;
@@ -240,5 +240,10 @@ int
 read_random(void *buf, int count)
 {
 
-   return ((int)(*read_func)(buf, (u_int)count));
+   if (count  0)
+   return 0;
+
+   read_func(buf, count);
+
+   return count;
 }

Modified: head/sys/dev/random/randomdev.h
==
--- head/sys/dev/random/randomdev.h Tue Feb 17 17:34:45 2015
(r278906)
+++ head/sys/dev/random/randomdev.h Tue Feb 17 17:37:00 2015
(r278907)
@@ -37,12 +37,12 @@ typedef void random_init_func_t(void);
 typedef void random_deinit_func_t(void);
 
 void randomdev_init_harvester(void (*)(const void *, u_int, u_int, enum 
random_entropy_source));
-void randomdev_init_reader(u_int (*)(uint8_t *, u_int));
+void randomdev_init_reader(void (*)(uint8_t *, u_int));
 void randomdev_deinit_harvester(void);
 void randomdev_deinit_reader(void);
 
 /* Stub/fake routines for when no entropy processor is loaded */
-extern u_int dummy_random_read_phony(uint8_t *, u_int);
+extern void dummy_random_read_phony(uint8_t *, u_int);
 
 /* kern.random sysctls */
 #ifdef SYSCTL_DECL /* 

svn commit: r278911 - stable/9/lib/libc/regex

2015-02-17 Thread Xin LI
Author: delphij
Date: Tue Feb 17 19:14:41 2015
New Revision: 278911
URL: https://svnweb.freebsd.org/changeset/base/278911

Log:
  MFC r278739:
  
  Disallow pattern spaces which would cause intermediate calculations to
  overflow size_t.
  
  Obtained from:DragonFly (2841837793bd095a82f477e9c370cfe6cfb3862c 
dillon)
  Security: CERT VU#695940

Modified:
  stable/9/lib/libc/regex/regcomp.c
Directory Properties:
  stable/9/lib/libc/   (props changed)

Modified: stable/9/lib/libc/regex/regcomp.c
==
--- stable/9/lib/libc/regex/regcomp.c   Tue Feb 17 19:14:16 2015
(r278910)
+++ stable/9/lib/libc/regex/regcomp.c   Tue Feb 17 19:14:41 2015
(r278911)
@@ -192,6 +192,7 @@ regcomp(regex_t * __restrict preg,
struct parse *p = pa;
int i;
size_t len;
+   size_t maxlen;
 #ifdef REDEBUG
 #  define  GOODFLAGS(f)(f)
 #else
@@ -213,7 +214,23 @@ regcomp(regex_t * __restrict preg,
g = (struct re_guts *)malloc(sizeof(struct re_guts));
if (g == NULL)
return(REG_ESPACE);
+   /*
+* Limit the pattern space to avoid a 32-bit overflow on buffer
+* extension.  Also avoid any signed overflow in case of conversion
+* so make the real limit based on a 31-bit overflow.
+*
+* Likely not applicable on 64-bit systems but handle the case
+* generically (who are we to stop people from using ~715MB+
+* patterns?).
+*/
+   maxlen = ((size_t)-1  1) / sizeof(sop) * 2 / 3;
+   if (len = maxlen) {
+   free((char *)g);
+   return(REG_ESPACE);
+   }
p-ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */
+   assert(p-ssize = len);
+
p-strip = (sop *)malloc(p-ssize * sizeof(sop));
p-slen = 0;
if (p-strip == NULL) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278910 - stable/10/lib/libc/regex

2015-02-17 Thread Xin LI
Author: delphij
Date: Tue Feb 17 19:14:16 2015
New Revision: 278910
URL: https://svnweb.freebsd.org/changeset/base/278910

Log:
  MFC r278739:
  
  Disallow pattern spaces which would cause intermediate calculations to
  overflow size_t.
  
  Obtained from:DragonFly (2841837793bd095a82f477e9c370cfe6cfb3862c 
dillon)
  Security: CERT VU#695940

Modified:
  stable/10/lib/libc/regex/regcomp.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/regex/regcomp.c
==
--- stable/10/lib/libc/regex/regcomp.c  Tue Feb 17 18:33:17 2015
(r278909)
+++ stable/10/lib/libc/regex/regcomp.c  Tue Feb 17 19:14:16 2015
(r278910)
@@ -192,6 +192,7 @@ regcomp(regex_t * __restrict preg,
struct parse *p = pa;
int i;
size_t len;
+   size_t maxlen;
 #ifdef REDEBUG
 #  define  GOODFLAGS(f)(f)
 #else
@@ -213,7 +214,23 @@ regcomp(regex_t * __restrict preg,
g = (struct re_guts *)malloc(sizeof(struct re_guts));
if (g == NULL)
return(REG_ESPACE);
+   /*
+* Limit the pattern space to avoid a 32-bit overflow on buffer
+* extension.  Also avoid any signed overflow in case of conversion
+* so make the real limit based on a 31-bit overflow.
+*
+* Likely not applicable on 64-bit systems but handle the case
+* generically (who are we to stop people from using ~715MB+
+* patterns?).
+*/
+   maxlen = ((size_t)-1  1) / sizeof(sop) * 2 / 3;
+   if (len = maxlen) {
+   free((char *)g);
+   return(REG_ESPACE);
+   }
p-ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */
+   assert(p-ssize = len);
+
p-strip = (sop *)malloc(p-ssize * sizeof(sop));
p-slen = 0;
if (p-strip == NULL) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278912 - stable/8/lib/libc/regex

2015-02-17 Thread Xin LI
Author: delphij
Date: Tue Feb 17 19:15:07 2015
New Revision: 278912
URL: https://svnweb.freebsd.org/changeset/base/278912

Log:
  MFC r278739:
  
  Disallow pattern spaces which would cause intermediate calculations to
  overflow size_t.
  
  Obtained from:DragonFly (2841837793bd095a82f477e9c370cfe6cfb3862c 
dillon)
  Security: CERT VU#695940

Modified:
  stable/8/lib/libc/regex/regcomp.c
Directory Properties:
  stable/8/lib/libc/   (props changed)

Modified: stable/8/lib/libc/regex/regcomp.c
==
--- stable/8/lib/libc/regex/regcomp.c   Tue Feb 17 19:14:41 2015
(r278911)
+++ stable/8/lib/libc/regex/regcomp.c   Tue Feb 17 19:15:07 2015
(r278912)
@@ -187,6 +187,7 @@ regcomp(regex_t * __restrict preg,
struct parse *p = pa;
int i;
size_t len;
+   size_t maxlen;
 #ifdef REDEBUG
 #  define  GOODFLAGS(f)(f)
 #else
@@ -208,7 +209,23 @@ regcomp(regex_t * __restrict preg,
g = (struct re_guts *)malloc(sizeof(struct re_guts));
if (g == NULL)
return(REG_ESPACE);
+   /*
+* Limit the pattern space to avoid a 32-bit overflow on buffer
+* extension.  Also avoid any signed overflow in case of conversion
+* so make the real limit based on a 31-bit overflow.
+*
+* Likely not applicable on 64-bit systems but handle the case
+* generically (who are we to stop people from using ~715MB+
+* patterns?).
+*/
+   maxlen = ((size_t)-1  1) / sizeof(sop) * 2 / 3;
+   if (len = maxlen) {
+   free((char *)g);
+   return(REG_ESPACE);
+   }
p-ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */
+   assert(p-ssize = len);
+
p-strip = (sop *)malloc(p-ssize * sizeof(sop));
p-slen = 0;
if (p-strip == NULL) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278906 - stable/10/sys/cam/ctl

2015-02-17 Thread Alexander Motin
Author: mav
Date: Tue Feb 17 17:34:45 2015
New Revision: 278906
URL: https://svnweb.freebsd.org/changeset/base/278906

Log:
  MFC r278500: Do not abort already aborted tasks.
  
  This fixes abort of new tasks with the same tags as previously aborted,
  but still remaining on the queue.

Modified:
  stable/10/sys/cam/ctl/ctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==
--- stable/10/sys/cam/ctl/ctl.c Tue Feb 17 16:01:00 2015(r278905)
+++ stable/10/sys/cam/ctl/ctl.c Tue Feb 17 17:34:45 2015(r278906)
@@ -12176,64 +12176,57 @@ ctl_abort_task(union ctl_io *io)
printf(%s\n, sbuf_data(sb));
 #endif
 
-   if ((xio-io_hdr.nexus.targ_port == io-io_hdr.nexus.targ_port)
- (xio-io_hdr.nexus.initid.id ==
-io-io_hdr.nexus.initid.id)) {
-   /*
-* If the abort says that the task is untagged, the
-* task in the queue must be untagged.  Otherwise,
-* we just check to see whether the tag numbers
-* match.  This is because the QLogic firmware
-* doesn't pass back the tag type in an abort
-* request.
-*/
+   if ((xio-io_hdr.nexus.targ_port != io-io_hdr.nexus.targ_port)
+|| (xio-io_hdr.nexus.initid.id != io-io_hdr.nexus.initid.id)
+|| (xio-io_hdr.flags  CTL_FLAG_ABORT))
+   continue;
+
+   /*
+* If the abort says that the task is untagged, the
+* task in the queue must be untagged.  Otherwise,
+* we just check to see whether the tag numbers
+* match.  This is because the QLogic firmware
+* doesn't pass back the tag type in an abort
+* request.
+*/
 #if 0
-   if (((xio-scsiio.tag_type == CTL_TAG_UNTAGGED)
-  (io-taskio.tag_type == CTL_TAG_UNTAGGED))
-|| (xio-scsiio.tag_num == io-taskio.tag_num)) {
+   if (((xio-scsiio.tag_type == CTL_TAG_UNTAGGED)
+  (io-taskio.tag_type == CTL_TAG_UNTAGGED))
+|| (xio-scsiio.tag_num == io-taskio.tag_num)) {
 #endif
-   /*
-* XXX KDM we've got problems with FC, because it
-* doesn't send down a tag type with aborts.  So we
-* can only really go by the tag number...
-* This may cause problems with parallel SCSI.
-* Need to figure that out!!
-*/
-   if (xio-scsiio.tag_num == io-taskio.tag_num) {
-   xio-io_hdr.flags |= CTL_FLAG_ABORT;
-   found = 1;
-   if ((io-io_hdr.flags 
-CTL_FLAG_FROM_OTHER_SC) == 0 
-   !(lun-flags  CTL_LUN_PRIMARY_SC)) {
-   union ctl_ha_msg msg_info;
-
-   io-io_hdr.flags |=
-   CTL_FLAG_SENT_2OTHER_SC;
-   msg_info.hdr.nexus = io-io_hdr.nexus;
-   msg_info.task.task_action =
-   CTL_TASK_ABORT_TASK;
-   msg_info.task.tag_num =
-   io-taskio.tag_num;
-   msg_info.task.tag_type =
-   io-taskio.tag_type;
-   msg_info.hdr.msg_type =
-   CTL_MSG_MANAGE_TASKS;
-   msg_info.hdr.original_sc = NULL;
-   msg_info.hdr.serializing_sc = NULL;
+   /*
+* XXX KDM we've got problems with FC, because it
+* doesn't send down a tag type with aborts.  So we
+* can only really go by the tag number...
+* This may cause problems with parallel SCSI.
+* Need to figure that out!!
+*/
+   if (xio-scsiio.tag_num == io-taskio.tag_num) {
+   xio-io_hdr.flags |= CTL_FLAG_ABORT;
+   found = 1;
+   if ((io-io_hdr.flags  CTL_FLAG_FROM_OTHER_SC) == 0 
+   !(lun-flags  CTL_LUN_PRIMARY_SC)) {
+   union ctl_ha_msg msg_info;
+
+   io-io_hdr.flags |= CTL_FLAG_SENT_2OTHER_SC;
+  

Re: svn commit: r278886 - in head/sys: conf contrib/rdma/krping dev/cxgb/ulp/iw_cxgb dev/cxgbe/iw_cxgbe modules/ibcore modules/mlx4ib ofed/drivers/infiniband/core ofed/drivers/infiniband/debug ofed/dr

2015-02-17 Thread Navdeep Parhar
On Tue, Feb 17, 2015 at 08:40:28AM +, Hans Petter Selasky wrote:
 Author: hselasky
 Date: Tue Feb 17 08:40:27 2015
 New Revision: 278886
 URL: https://svnweb.freebsd.org/changeset/base/278886
 
 Log:
   Update the infiniband stack to Mellanox's OFED version 2.1.

What version of the Linux kernel does this match?

   
   Highlights:
- Multiple verbs API updates
- Support for RoCE, RDMA over ethernet
   
   All hardware drivers depending on the common infiniband stack has been
   updated aswell.
   
   Discussed with: np @
   Sponsored by:   Mellanox Technologies
   MFC after:  1 month

My reading of the project's MFC policy is that changes to the verbs
cannot be MFC'd as that's a KPI/API change.

I still plan to test these changes with some iWARP gear later this week.
I thought you were going to wait till then, but, oh well.

Regards,
Navdeep

 
 Added:
   head/sys/ofed/drivers/infiniband/core/peer_mem.c   (contents, props changed)
   head/sys/ofed/drivers/infiniband/hw/mlx4/mlx4_exp.c   (contents, props 
 changed)
   head/sys/ofed/drivers/infiniband/hw/mlx4/mlx4_exp.h   (contents, props 
 changed)
   head/sys/ofed/include/rdma/ib_peer_mem.h   (contents, props changed)
   head/sys/ofed/include/rdma/ib_user_verbs_exp.h   (contents, props changed)
   head/sys/ofed/include/rdma/ib_verbs_exp.h   (contents, props changed)
   head/sys/ofed/include/rdma/peer_mem.h   (contents, props changed)
 Deleted:
   head/sys/ofed/drivers/infiniband/core/Makefile
   head/sys/ofed/drivers/infiniband/core/local_sa.c
   head/sys/ofed/drivers/infiniband/core/notice.c
   head/sys/ofed/drivers/infiniband/hw/mlx4/Makefile
   head/sys/ofed/drivers/infiniband/ulp/ipoib/Makefile
 Modified:
   head/sys/conf/files
   head/sys/contrib/rdma/krping/krping.c
   head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c
   head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_qp.c
   head/sys/dev/cxgbe/iw_cxgbe/cq.c
   head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h
   head/sys/dev/cxgbe/iw_cxgbe/mem.c
   head/sys/modules/ibcore/Makefile
   head/sys/modules/mlx4ib/Makefile
   head/sys/ofed/drivers/infiniband/core/addr.c
   head/sys/ofed/drivers/infiniband/core/cache.c
   head/sys/ofed/drivers/infiniband/core/cm.c
   head/sys/ofed/drivers/infiniband/core/cm_msgs.h
   head/sys/ofed/drivers/infiniband/core/cma.c
   head/sys/ofed/drivers/infiniband/core/core_priv.h
   head/sys/ofed/drivers/infiniband/core/device.c
   head/sys/ofed/drivers/infiniband/core/fmr_pool.c
   head/sys/ofed/drivers/infiniband/core/iwcm.c
   head/sys/ofed/drivers/infiniband/core/mad.c
   head/sys/ofed/drivers/infiniband/core/mad_priv.h
   head/sys/ofed/drivers/infiniband/core/mad_rmpp.c
   head/sys/ofed/drivers/infiniband/core/multicast.c
   head/sys/ofed/drivers/infiniband/core/packer.c
   head/sys/ofed/drivers/infiniband/core/sa.h
   head/sys/ofed/drivers/infiniband/core/sa_query.c
   head/sys/ofed/drivers/infiniband/core/smi.c
   head/sys/ofed/drivers/infiniband/core/sysfs.c
   head/sys/ofed/drivers/infiniband/core/ucm.c
   head/sys/ofed/drivers/infiniband/core/ucma.c
   head/sys/ofed/drivers/infiniband/core/ud_header.c
   head/sys/ofed/drivers/infiniband/core/umem.c
   head/sys/ofed/drivers/infiniband/core/user_mad.c
   head/sys/ofed/drivers/infiniband/core/uverbs.h
   head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c
   head/sys/ofed/drivers/infiniband/core/uverbs_main.c
   head/sys/ofed/drivers/infiniband/core/uverbs_marshall.c
   head/sys/ofed/drivers/infiniband/core/verbs.c
   head/sys/ofed/drivers/infiniband/debug/memtrack.c
   head/sys/ofed/drivers/infiniband/debug/memtrack.h
   head/sys/ofed/drivers/infiniband/debug/mtrack.h
   head/sys/ofed/drivers/infiniband/hw/mlx4/ah.c
   head/sys/ofed/drivers/infiniband/hw/mlx4/alias_GUID.c
   head/sys/ofed/drivers/infiniband/hw/mlx4/cm.c
   head/sys/ofed/drivers/infiniband/hw/mlx4/cq.c
   head/sys/ofed/drivers/infiniband/hw/mlx4/doorbell.c
   head/sys/ofed/drivers/infiniband/hw/mlx4/mad.c
   head/sys/ofed/drivers/infiniband/hw/mlx4/main.c
   head/sys/ofed/drivers/infiniband/hw/mlx4/mcg.c
   head/sys/ofed/drivers/infiniband/hw/mlx4/mlx4_ib.h
   head/sys/ofed/drivers/infiniband/hw/mlx4/mr.c
   head/sys/ofed/drivers/infiniband/hw/mlx4/qp.c
   head/sys/ofed/drivers/infiniband/hw/mlx4/sysfs.c
   head/sys/ofed/drivers/infiniband/hw/mthca/mthca_provider.c
   head/sys/ofed/drivers/infiniband/hw/mthca/mthca_qp.c
   head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h
   head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c
   head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
   head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
   head/sys/ofed/include/rdma/ib_addr.h
   head/sys/ofed/include/rdma/ib_cache.h
   head/sys/ofed/include/rdma/ib_cm.h
   head/sys/ofed/include/rdma/ib_mad.h
   head/sys/ofed/include/rdma/ib_pack.h
   head/sys/ofed/include/rdma/ib_sa.h
   head/sys/ofed/include/rdma/ib_umem.h
   head/sys/ofed/include/rdma/ib_user_verbs.h
   head/sys/ofed/include/rdma/ib_verbs.h
   head/sys/ofed/include/rdma/iw_cm.h
   

Re: svn commit: r278831 - head/sys/netpfil/pf

2015-02-17 Thread John-Mark Gurney
Gleb Smirnoff wrote this message on Mon, Feb 16, 2015 at 03:38 +:
 Author: glebius
 Date: Mon Feb 16 03:38:27 2015
 New Revision: 278831
 URL: https://svnweb.freebsd.org/changeset/base/278831
 
 Log:
   Update the pf fragment handling code to closer match recent OpenBSD.
   That partially fixes IPv6 fragment handling. Thanks to Kristof for
   working on that.
   
   Submitted by:   Kristof Provost
   Tested by:  peter
   Differential Revision:  D1765

Looks like pf_flush_fragments still called in !INET case, though only
defined for INET case:
/scratch/tmp/jmg/src.head/sys/modules/pf/../../netpfil/pf/pf_norm.c:385:3: 
error: implicit declaration of function 'pf_flush_fragments' is invalid in C99 
[-Werror,-Wimplicit-function-declaration]
pf_flush_fragments();

when compiling LINT-NOINET kernel..

at least as of r278883...

We need to get Jenkins to be compiling the LINT-NOINET kernel too..

-- 
  John-Mark Gurney  Voice: +1 415 225 5579

 All that I will do, has been done, All that I have, has not.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r278907 - head/sys/dev/random

2015-02-17 Thread Mark R V Murray
Hi

Thanks John-Mark!

M

 On 17 Feb 2015, at 17:37, John-Mark Gurney j...@freebsd.org wrote:
 
 Author: jmg
 Date: Tue Feb 17 17:37:00 2015
 New Revision: 278907
 URL: https://svnweb.freebsd.org/changeset/base/278907
 
 Log:
  When the new random adaptor code was brought it in r273872, a call to
  randomdev_init_reader to change read_random over to the newly installed
  adaptor was missed.  This means both read_random and arc4random (seeded
  from read_random) were not returning very random data.  This also
  effects userland arc4random as it is seeded from kernel arc4random.
 
  The random devices are uneffected and have returned good randomness
  since the change.
 
  All keys generated with a kernel of r273872 must be regenerated with
  a kernel with this patch.  Keys generated may be predictable.
 
  Remove the warning as log is too early to print anything, and it would
  always get printed due to early use of arc4random...
 
  Reviewed by: delphij, markm
  Approved by:so (delphij)
 
 Modified:
  head/sys/dev/random/dummy_rng.c
  head/sys/dev/random/random_adaptors.c
  head/sys/dev/random/randomdev.c
  head/sys/dev/random/randomdev.h
 
 Modified: head/sys/dev/random/dummy_rng.c
 ==
 --- head/sys/dev/random/dummy_rng.c   Tue Feb 17 17:34:45 2015
 (r278906)
 +++ head/sys/dev/random/dummy_rng.c   Tue Feb 17 17:37:00 2015
 (r278907)
 @@ -82,19 +82,13 @@ dummy_random_init(void)
  *
  * Caveat Emptor.
  */
 -u_int
 +void
 dummy_random_read_phony(uint8_t *buf, u_int count)
 {
   /* If no entropy device is loaded, don't spam the console with warnings 
 */
 - static int warned = 0;
   u_long randval;
   size_t size, i;
 
 - if (!warned) {
 - log(LOG_WARNING, random device not loaded/active; using 
 insecure pseudo-random number generator\n);
 - warned = 1;
 - }
 -
   /* srandom() is called in kern/init_main.c:proc0_post() */
 
   /* Fill buf[] with random(9) output */
 @@ -103,8 +97,6 @@ dummy_random_read_phony(uint8_t *buf, u_
   size = MIN(count - i, sizeof(randval));
   memcpy(buf + i, randval, (size_t)size);
   }
 -
 - return (count);
 }
 
 struct random_adaptor randomdev_dummy = {
 
 Modified: head/sys/dev/random/random_adaptors.c
 ==
 --- head/sys/dev/random/random_adaptors.c Tue Feb 17 17:34:45 2015
 (r278906)
 +++ head/sys/dev/random/random_adaptors.c Tue Feb 17 17:37:00 2015
 (r278907)
 @@ -149,10 +149,14 @@ random_adaptor_choose(void)
   (random_adaptor_previous == NULL ? NULL : 
 random_adaptor_previous-ra_ident),
   random_adaptor-ra_ident);
 #endif
 - if (random_adaptor_previous != NULL)
 + if (random_adaptor_previous != NULL) {
 + randomdev_deinit_reader();
   (random_adaptor_previous-ra_deinit)();
 + }
   (random_adaptor-ra_init)();
   }
 +
 + randomdev_init_reader(random_adaptor-ra_read);
 }
 
 
 
 Modified: head/sys/dev/random/randomdev.c
 ==
 --- head/sys/dev/random/randomdev.c   Tue Feb 17 17:34:45 2015
 (r278906)
 +++ head/sys/dev/random/randomdev.c   Tue Feb 17 17:37:00 2015
 (r278907)
 @@ -214,11 +214,11 @@ random_harvest(const void *entropy, u_in
  */
 
 /* Hold the address of the routine which is actually called */
 -static u_int (*read_func)(uint8_t *, u_int) = dummy_random_read_phony;
 +static void (*read_func)(uint8_t *, u_int) = dummy_random_read_phony;
 
 /* Initialise the reader when/if it is loaded */
 void
 -randomdev_init_reader(u_int (*reader)(uint8_t *, u_int))
 +randomdev_init_reader(void (*reader)(uint8_t *, u_int))
 {
 
   read_func = reader;
 @@ -240,5 +240,10 @@ int
 read_random(void *buf, int count)
 {
 
 - return ((int)(*read_func)(buf, (u_int)count));
 + if (count  0)
 + return 0;
 +
 + read_func(buf, count);
 +
 + return count;
 }
 
 Modified: head/sys/dev/random/randomdev.h
 ==
 --- head/sys/dev/random/randomdev.h   Tue Feb 17 17:34:45 2015
 (r278906)
 +++ head/sys/dev/random/randomdev.h   Tue Feb 17 17:37:00 2015
 (r278907)
 @@ -37,12 +37,12 @@ typedef void random_init_func_t(void);
 typedef void random_deinit_func_t(void);
 
 void randomdev_init_harvester(void (*)(const void *, u_int, u_int, enum 
 random_entropy_source));
 -void randomdev_init_reader(u_int (*)(uint8_t *, u_int));
 +void randomdev_init_reader(void (*)(uint8_t *, u_int));
 void randomdev_deinit_harvester(void);
 void randomdev_deinit_reader(void);
 
 /* Stub/fake routines for when no entropy processor is loaded */
 -extern u_int dummy_random_read_phony(uint8_t *, u_int);
 +extern 

svn commit: r278908 - head

2015-02-17 Thread Warner Losh
Author: imp
Date: Tue Feb 17 18:10:46 2015
New Revision: 278908
URL: https://svnweb.freebsd.org/changeset/base/278908

Log:
  hd64570.h was installed, so add it here now that it is gone.
  
  Submitted by: ae@

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Tue Feb 17 17:37:00 2015(r278907)
+++ head/ObsoleteFiles.inc  Tue Feb 17 18:10:46 2015(r278908)
@@ -38,6 +38,8 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20150217: Removed remnants of ar(4) driver
+OLD_FILES+=usr/include/sys/dev/ic/hd64570.h
 # 20150212: /usr/games moving into /usr/bin
 OLD_FILES+=usr/games/bcd
 OLD_FILES+=usr/games/caesar
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278909 - head/contrib/llvm/tools/lldb/source/Plugins/ObjectFile/ELF

2015-02-17 Thread Ed Maste
Author: emaste
Date: Tue Feb 17 18:33:17 2015
New Revision: 278909
URL: https://svnweb.freebsd.org/changeset/base/278909

Log:
  lldb: workaround to permit cross-arch core file debugging
  
  FreeBSD core files have no section table and thus LLDB's OS and vendor
  detection logic does not work. If we encounter such an ELF file, update
  an unknown OS to match the host.
  
  This is not really the correct way to handle this, but more extensive
  rework of ObjectFileELF will be needed and this change restores cross-
  arch core debugging until that can be completed.

Modified:
  head/contrib/llvm/tools/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Modified: 
head/contrib/llvm/tools/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
==
--- 
head/contrib/llvm/tools/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
Tue Feb 17 18:10:46 2015(r278908)
+++ 
head/contrib/llvm/tools/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
Tue Feb 17 18:33:17 2015(r278909)
@@ -1331,8 +1331,11 @@ ObjectFileELF::GetSectionHeaderInfo(Sect
 }
 
 // If there are no section headers we are done.
-if (header.e_shnum == 0)
+if (header.e_shnum == 0) {
+if (arch_spec.GetTriple().getOS() == llvm::Triple::OSType::UnknownOS)
+arch_spec.GetTriple().setOSName(HostInfo::GetOSString().data());
 return 0;
+}
 
 Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_MODULES));
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2015-02-17 Thread Gleb Smirnoff
Author: glebius
Date: Tue Feb 17 19:32:11 2015
New Revision: 278914
URL: https://svnweb.freebsd.org/changeset/base/278914

Log:
  Use anonymous unions to add possibility to put mbufs into queue(3)
  STAILQs and SLISTs using the same structure field as good old m_next
  and m_nextpkt linkage occupy.
  
  New code is encouraged to use queue(3) macros, instead of implementing
  the wheel. However, better not to have a mixture of old style and
  queue(3) in one file or subsystem.
  
  Reviewed by:  rwatson, rrs, rpaulo
  Differential Revision:D1499

Modified:
  head/sys/kern/uipc_mbuf.c
  head/sys/sys/mbuf.h

Modified: head/sys/kern/uipc_mbuf.c
==
--- head/sys/kern/uipc_mbuf.c   Tue Feb 17 19:27:14 2015(r278913)
+++ head/sys/kern/uipc_mbuf.c   Tue Feb 17 19:32:11 2015(r278914)
@@ -120,6 +120,18 @@ CTASSERT(sizeof(struct struct_m_ext) == 
 #endif
 
 /*
+ * Assert that the queue(3) macros produce code of the same size as an old
+ * plain pointer does.
+ */
+#ifdef INVARIANTS
+static struct mbuf m_assertbuf;
+CTASSERT(sizeof(m_assertbuf.m_slist) == sizeof(m_assertbuf.m_next));
+CTASSERT(sizeof(m_assertbuf.m_stailq) == sizeof(m_assertbuf.m_next));
+CTASSERT(sizeof(m_assertbuf.m_slistpkt) == sizeof(m_assertbuf.m_nextpkt));
+CTASSERT(sizeof(m_assertbuf.m_stailqpkt) == sizeof(m_assertbuf.m_nextpkt));
+#endif
+
+/*
  * m_get2() allocates minimum mbuf that would fit size argument.
  */
 struct mbuf *

Modified: head/sys/sys/mbuf.h
==
--- head/sys/sys/mbuf.h Tue Feb 17 19:27:14 2015(r278913)
+++ head/sys/sys/mbuf.h Tue Feb 17 19:32:11 2015(r278914)
@@ -184,8 +184,16 @@ struct mbuf {
 * Compile-time assertions in uipc_mbuf.c test these values to ensure
 * that they are correct.
 */
-   struct mbuf *m_next;/* next buffer in chain */
-   struct mbuf *m_nextpkt; /* next chain in queue/record */
+   union { /* next buffer in chain */
+   struct mbuf *m_next;
+   SLIST_ENTRY(mbuf)   m_slist;
+   STAILQ_ENTRY(mbuf)  m_stailq;
+   };
+   union { /* next chain in queue/record */
+   struct mbuf *m_nextpkt;
+   SLIST_ENTRY(mbuf)   m_slistpkt;
+   STAILQ_ENTRY(mbuf)  m_stailqpkt;
+   };
caddr_t  m_data;/* location of data */
int32_t  m_len; /* amount of data in this mbuf */
uint32_t m_type:8,  /* type of data in this mbuf */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278915 - head/sys/boot/fdt/dts/arm

2015-02-17 Thread Luiz Otavio O Souza
Author: loos
Date: Tue Feb 17 19:38:16 2015
New Revision: 278915
URL: https://svnweb.freebsd.org/changeset/base/278915

Log:
  Set the #address-cells and #size-cells properties on I2C controllers of
  Raspberry-pi.
  
  This fixes the issues of dtc(1) while compiling I2C addresses set in reg
  property.
  
  MFC after:2 weeks

Modified:
  head/sys/boot/fdt/dts/arm/bcm2835.dtsi

Modified: head/sys/boot/fdt/dts/arm/bcm2835.dtsi
==
--- head/sys/boot/fdt/dts/arm/bcm2835.dtsi  Tue Feb 17 19:32:11 2015
(r278914)
+++ head/sys/boot/fdt/dts/arm/bcm2835.dtsi  Tue Feb 17 19:38:16 2015
(r278915)
@@ -397,6 +397,8 @@
};
 
bsc0 {
+   #address-cells = 1;
+   #size-cells = 0;
compatible = broadcom,bcm2835-bsc,
 broadcom,bcm2708-bsc;
reg = 0x205000 0x20;
@@ -405,6 +407,8 @@
};
 
bsc1 {
+   #address-cells = 1;
+   #size-cells = 0;
compatible = broadcom,bcm2835-bsc,
 broadcom,bcm2708-bsc;
reg = 0x804000 0x20;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278918 - head/sys/dev/iicbus

2015-02-17 Thread Luiz Otavio O Souza
Author: loos
Date: Tue Feb 17 20:29:42 2015
New Revision: 278918
URL: https://svnweb.freebsd.org/changeset/base/278918

Log:
  Replace hardcoded sizes by sizeof() and nitems().
  
  Set all the sysctls as CTLFLAG_MPSAFE.

Modified:
  head/sys/dev/iicbus/lm75.c

Modified: head/sys/dev/iicbus/lm75.c
==
--- head/sys/dev/iicbus/lm75.c  Tue Feb 17 20:08:40 2015(r278917)
+++ head/sys/dev/iicbus/lm75.c  Tue Feb 17 20:29:42 2015(r278918)
@@ -134,7 +134,7 @@ lm75_read(device_t dev, uint32_t addr, u
{ addr, IIC_M_RD, len, data },
};
 
-   if (iicbus_transfer(dev, msg, 2) != 0)
+   if (iicbus_transfer(dev, msg, nitems(msg)) != 0)
return (-1);
 
return (0);
@@ -147,7 +147,7 @@ lm75_write(device_t dev, uint32_t addr, 
{ addr, IIC_M_WR, len, data },
};
 
-   if (iicbus_transfer(dev, msg, 1) != 0)
+   if (iicbus_transfer(dev, msg, nitems(msg)) != 0)
return (-1);
 
return (0);
@@ -228,7 +228,8 @@ lm75_type_detect(struct lm75_softc *sc)
 */
lm75a = 0;
for (i = 4; i = 6; i++) {
-   if (lm75_read(sc-sc_dev, sc-sc_addr, i, buf8, 1)  0)
+   if (lm75_read(sc-sc_dev, sc-sc_addr, i,
+   buf8, sizeof(buf8))  0)
return (-1);
if (buf8 != LM75_TEST_PATTERN  buf8 != 0xff)
return (-1);
@@ -288,16 +289,16 @@ lm75_start(void *xdev)
 
/* Configuration parameters. */
SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, faults,
-   CTLFLAG_RW | CTLTYPE_UINT, dev, 0,
+   CTLFLAG_RW | CTLTYPE_UINT | CTLFLAG_MPSAFE, dev, 0,
lm75_faults_sysctl, IU, LM75 fault queue);
SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, mode,
-   CTLFLAG_RW | CTLTYPE_STRING, dev, 0,
+   CTLFLAG_RW | CTLTYPE_STRING | CTLFLAG_MPSAFE, dev, 0,
lm75_mode_sysctl, A, LM75 mode);
SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, polarity,
-   CTLFLAG_RW | CTLTYPE_STRING, dev, 0,
+   CTLFLAG_RW | CTLTYPE_STRING | CTLFLAG_MPSAFE, dev, 0,
lm75_pol_sysctl, A, LM75 OS polarity);
SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, shutdown,
-   CTLFLAG_RW | CTLTYPE_UINT, dev, 0,
+   CTLFLAG_RW | CTLTYPE_UINT | CTLFLAG_MPSAFE, dev, 0,
lm75_shutdown_sysctl, IU, LM75 shutdown);
 }
 
@@ -306,9 +307,9 @@ lm75_conf_read(struct lm75_softc *sc)
 {
uint8_t buf8;
 
-   if (lm75_read(sc-sc_dev, sc-sc_addr, LM75_CONF, buf8, 1)  0)
+   if (lm75_read(sc-sc_dev, sc-sc_addr, LM75_CONF,
+   buf8, sizeof(buf8))  0)
return (-1);
-
sc-sc_conf = (uint32_t)buf8;
 
return (0);
@@ -321,8 +322,7 @@ lm75_conf_write(struct lm75_softc *sc)
 
buf8[0] = LM75_CONF;
buf8[1] = (uint8_t)sc-sc_conf  LM75_CONF_MASK;
-
-   if (lm75_write(sc-sc_dev, sc-sc_addr, buf8, 2)  0)
+   if (lm75_write(sc-sc_dev, sc-sc_addr, buf8, sizeof(buf8))  0)
return (-1);
 
return (0);
@@ -335,7 +335,7 @@ lm75_temp_read(struct lm75_softc *sc, ui
uint16_t buf;
int neg, t;
 
-   if (lm75_read(sc-sc_dev, sc-sc_addr, reg, buf8, 2)  0)
+   if (lm75_read(sc-sc_dev, sc-sc_addr, reg, buf8, sizeof(buf8))  0)
return (-1);
buf = (uint16_t)((buf8[0]  8) | (buf8[1]  0xff));
/*
@@ -388,8 +388,7 @@ lm75_temp_write(struct lm75_softc *sc, u
buf8[0] = reg;
buf8[1] = buf  8;
buf8[2] = buf  0xff;
-
-   if (lm75_write(sc-sc_dev, sc-sc_addr, buf8, 3)  0)
+   if (lm75_write(sc-sc_dev, sc-sc_addr, buf8, sizeof(buf8))  0)
return (-1);
 
return (0);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r278886 - in head/sys: conf contrib/rdma/krping dev/cxgb/ulp/iw_cxgb dev/cxgbe/iw_cxgbe modules/ibcore modules/mlx4ib ofed/drivers/infiniband/core ofed/drivers/infiniband/debug ofed/dr

2015-02-17 Thread Navdeep Parhar

On 02/17/15 12:15, Hans Petter Selasky wrote:

Hi,

On 02/17/15 18:34, Navdeep Parhar wrote:

On Tue, Feb 17, 2015 at 08:40:28AM +, Hans Petter Selasky wrote:

Author: hselasky
Date: Tue Feb 17 08:40:27 2015
New Revision: 278886
URL: https://svnweb.freebsd.org/changeset/base/278886

Log:
   Update the infiniband stack to Mellanox's OFED version 2.1.


What version of the Linux kernel does this match?


It is very close to the latest 3.xxx Linux kernel.


Let's please try and get an exact version the next time there's a big 
overhaul like this.  It is important to be able to pinpoint the exact 
version of upstream that our stuff is supposed to be API/KPI compatible 
with.


Regards,
Navdeep





   Highlights:
- Multiple verbs API updates
- Support for RoCE, RDMA over ethernet

   All hardware drivers depending on the common infiniband stack has
been
   updated aswell.

   Discussed with:np @
   Sponsored by:Mellanox Technologies
   MFC after:1 month


My reading of the project's MFC policy is that changes to the verbs
cannot be MFC'd as that's a KPI/API change.


I agree, and if this will break binary compatibility and that is a
requirement, I will not MFC.



I still plan to test these changes with some iWARP gear later this week.
I thought you were going to wait till then, but, oh well.


Thank you!

--HPS




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


svn commit: r278919 - head/sys/arm/broadcom/bcm2835

2015-02-17 Thread Luiz Otavio O Souza
Author: loos
Date: Tue Feb 17 20:37:21 2015
New Revision: 278919
URL: https://svnweb.freebsd.org/changeset/base/278919

Log:
  Make use of the newly introduced macros.
  
  Update the copyright.

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

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_gpio.cTue Feb 17 20:29:42 
2015(r278918)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_gpio.cTue Feb 17 20:37:21 
2015(r278919)
@@ -1,6 +1,6 @@
 /*-
- * Copyright (c) 2012 Oleksandr Tymoshenko go...@freebsd.org
- * Copyright (c) 2012 Luiz Otavio O Souza.
+ * Copyright (c) 2012 Oleksandr Tymoshenko go...@freebsd.org
+ * Copyright (c) 2012-2015 Luiz Otavio O Souza l...@freebsd.org
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -251,16 +251,14 @@ bcm_gpio_set_function(struct bcm_gpio_so
 static void
 bcm_gpio_set_pud(struct bcm_gpio_softc *sc, uint32_t pin, uint32_t state)
 {
-   uint32_t bank, offset;
+   uint32_t bank;
 
/* Must be called with lock held. */
BCM_GPIO_LOCK_ASSERT(sc);
 
-   bank = pin / 32;
-   offset = pin - 32 * bank;
-
+   bank = BCM_GPIO_BANK(pin);
BCM_GPIO_WRITE(sc, BCM_GPIO_GPPUD(0), state);
-   BCM_GPIO_WRITE(sc, BCM_GPIO_GPPUDCLK(bank), (1  offset));
+   BCM_GPIO_WRITE(sc, BCM_GPIO_GPPUDCLK(bank), BCM_GPIO_MASK(pin));
BCM_GPIO_WRITE(sc, BCM_GPIO_GPPUD(0), 0);
BCM_GPIO_WRITE(sc, BCM_GPIO_GPPUDCLK(bank), 0);
 }
@@ -438,29 +436,25 @@ static int
 bcm_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value)
 {
struct bcm_gpio_softc *sc = device_get_softc(dev);
-   uint32_t bank, offset;
+   uint32_t bank, reg;
int i;
 
for (i = 0; i  sc-sc_gpio_npins; i++) {
if (sc-sc_gpio_pins[i].gp_pin == pin)
break;
}
-
if (i = sc-sc_gpio_npins)
return (EINVAL);
-
/* We never write to read-only/reserved pins. */
if (bcm_gpio_pin_is_ro(sc, pin))
return (EINVAL);
-
-   bank = pin / 32;
-   offset = pin - 32 * bank;
-
BCM_GPIO_LOCK(sc);
+   bank = BCM_GPIO_BANK(pin);
if (value)
-   BCM_GPIO_WRITE(sc, BCM_GPIO_GPSET(bank), (1  offset));
+   reg = BCM_GPIO_GPSET(bank);
else
-   BCM_GPIO_WRITE(sc, BCM_GPIO_GPCLR(bank), (1  offset));
+   reg = BCM_GPIO_GPCLR(bank);
+   BCM_GPIO_WRITE(sc, reg, BCM_GPIO_MASK(pin));
BCM_GPIO_UNLOCK(sc);
 
return (0);
@@ -470,24 +464,20 @@ static int
 bcm_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val)
 {
struct bcm_gpio_softc *sc = device_get_softc(dev);
-   uint32_t bank, offset, reg_data;
+   uint32_t bank, reg_data;
int i;
 
for (i = 0; i  sc-sc_gpio_npins; i++) {
if (sc-sc_gpio_pins[i].gp_pin == pin)
break;
}
-
if (i = sc-sc_gpio_npins)
return (EINVAL);
-
-   bank = pin / 32;
-   offset = pin - 32 * bank;
-
+   bank = BCM_GPIO_BANK(pin);
BCM_GPIO_LOCK(sc);
reg_data = BCM_GPIO_READ(sc, BCM_GPIO_GPLEV(bank));
BCM_GPIO_UNLOCK(sc);
-   *val = (reg_data  (1  offset)) ? 1 : 0;
+   *val = (reg_data  BCM_GPIO_MASK(pin)) ? 1 : 0;
 
return (0);
 }
@@ -496,30 +486,26 @@ static int
 bcm_gpio_pin_toggle(device_t dev, uint32_t pin)
 {
struct bcm_gpio_softc *sc = device_get_softc(dev);
-   uint32_t bank, data, offset;
+   uint32_t bank, data, reg;
int i;
 
for (i = 0; i  sc-sc_gpio_npins; i++) {
if (sc-sc_gpio_pins[i].gp_pin == pin)
break;
}
-
if (i = sc-sc_gpio_npins)
return (EINVAL);
-
/* We never write to read-only/reserved pins. */
if (bcm_gpio_pin_is_ro(sc, pin))
return (EINVAL);
-
-   bank = pin / 32;
-   offset = pin - 32 * bank;
-
BCM_GPIO_LOCK(sc);
+   bank = BCM_GPIO_BANK(pin);
data = BCM_GPIO_READ(sc, BCM_GPIO_GPLEV(bank));
-   if (data  (1  offset))
-   BCM_GPIO_WRITE(sc, BCM_GPIO_GPCLR(bank), (1  offset));
+   if (data  BCM_GPIO_MASK(pin))
+   reg = BCM_GPIO_GPCLR(bank);
else
-   BCM_GPIO_WRITE(sc, BCM_GPIO_GPSET(bank), (1  offset));
+   reg = BCM_GPIO_GPSET(bank);
+   BCM_GPIO_WRITE(sc, reg, BCM_GPIO_MASK(pin));
BCM_GPIO_UNLOCK(sc);
 
return (0);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2015-02-17 Thread Gleb Smirnoff
Author: glebius
Date: Tue Feb 17 20:52:51 2015
New Revision: 278920
URL: https://svnweb.freebsd.org/changeset/base/278920

Log:
Use anonymous unions and structs to organize shared space in mbuf(9),
  instead of preprocessor macros.
This will make debugger output of 'print *m' exactly match the names
  we use in code, making life of a kernel hacker way more pleasant. And
  this also allows to rename struct_m_ext back to m_ext.

Modified:
  head/sys/kern/uipc_mbuf.c
  head/sys/sys/mbuf.h

Modified: head/sys/kern/uipc_mbuf.c
==
--- head/sys/kern/uipc_mbuf.c   Tue Feb 17 20:37:21 2015(r278919)
+++ head/sys/kern/uipc_mbuf.c   Tue Feb 17 20:52:51 2015(r278920)
@@ -112,11 +112,11 @@ CTASSERT(offsetof(struct mbuf, m_pktdat)
 #if defined(__LP64__)
 CTASSERT(offsetof(struct mbuf, m_dat) == 32);
 CTASSERT(sizeof(struct pkthdr) == 56);
-CTASSERT(sizeof(struct struct_m_ext) == 48);
+CTASSERT(sizeof(struct m_ext) == 48);
 #else
 CTASSERT(offsetof(struct mbuf, m_dat) == 24);
 CTASSERT(sizeof(struct pkthdr) == 48);
-CTASSERT(sizeof(struct struct_m_ext) == 28);
+CTASSERT(sizeof(struct m_ext) == 28);
 #endif
 
 /*

Modified: head/sys/sys/mbuf.h
==
--- head/sys/sys/mbuf.h Tue Feb 17 20:37:21 2015(r278919)
+++ head/sys/sys/mbuf.h Tue Feb 17 20:52:51 2015(r278920)
@@ -65,8 +65,8 @@
  * they are sensible.
  */
 struct mbuf;
-#defineMHSIZE  offsetof(struct mbuf, M_dat.M_databuf)
-#defineMPKTHSIZE   offsetof(struct mbuf, 
M_dat.MH.MH_dat.MH_databuf)
+#defineMHSIZE  offsetof(struct mbuf, m_dat)
+#defineMPKTHSIZE   offsetof(struct mbuf, m_pktdat)
 #defineMLEN((int)(MSIZE - MHSIZE))
 #defineMHLEN   ((int)(MSIZE - MPKTHSIZE))
 #defineMINCLSIZE   (MHLEN + 1)
@@ -160,7 +160,7 @@ struct pkthdr {
  * Compile-time assertions in uipc_mbuf.c test these values to ensure that
  * they are correct.
  */
-struct struct_m_ext {
+struct m_ext {
volatile u_int  *ext_cnt;   /* pointer to ref count info */
caddr_t  ext_buf;   /* start of buffer */
uint32_t ext_size;  /* size of buffer, for ext_free */
@@ -211,19 +211,15 @@ struct mbuf {
 */
union {
struct {
-   struct pkthdr   MH_pkthdr;  /* M_PKTHDR set */
+   struct pkthdr   m_pkthdr;   /* M_PKTHDR set */
union {
-   struct struct_m_ext MH_ext; /* M_EXT set */
-   charMH_databuf[0];
-   } MH_dat;
-   } MH;
-   charM_databuf[0];   /* !M_PKTHDR, !M_EXT */
-   } M_dat;
+   struct m_extm_ext;  /* M_EXT set */
+   charm_pktdat[0];
+   };
+   };
+   charm_dat[0];   /* !M_PKTHDR, !M_EXT */
+   };
 };
-#definem_pkthdrM_dat.MH.MH_pkthdr
-#definem_ext   M_dat.MH.MH_dat.MH_ext
-#definem_pktdatM_dat.MH.MH_dat.MH_databuf
-#definem_dat   M_dat.M_databuf
 
 /*
  * mbuf flags of global significance and layer crossing.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278921 - head/usr.bin/du

2015-02-17 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Feb 17 21:12:45 2015
New Revision: 278921
URL: https://svnweb.freebsd.org/changeset/base/278921

Log:
  du(1): replace malloc + memset with calloc.

Modified:
  head/usr.bin/du/du.c

Modified: head/usr.bin/du/du.c
==
--- head/usr.bin/du/du.cTue Feb 17 20:52:51 2015(r278920)
+++ head/usr.bin/du/du.cTue Feb 17 21:12:45 2015(r278921)
@@ -376,7 +376,7 @@ linkchk(FTSENT *p)
/* If the hash table is getting too full, enlarge it. */
if (number_entries  number_buckets * 10  !stop_allocating) {
new_size = number_buckets * 2;
-   new_buckets = malloc(new_size * sizeof(struct links_entry *));
+   new_buckets = calloc(new_size, sizeof(struct links_entry *));
 
/* Try releasing the free list to see if that helps. */
if (new_buckets == NULL  free_list != NULL) {
@@ -385,16 +385,13 @@ linkchk(FTSENT *p)
free_list = le-next;
free(le);
}
-   new_buckets = malloc(new_size *
-   sizeof(new_buckets[0]));
+   new_buckets = calloc(new_size, sizeof(new_buckets[0]));
}
 
if (new_buckets == NULL) {
stop_allocating = 1;
warnx(No more memory for tracking hard links);
} else {
-   memset(new_buckets, 0,
-   new_size * sizeof(struct links_entry *));
for (i = 0; i  number_buckets; i++) {
while (buckets[i] != NULL) {
/* Remove entry from old bucket. */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r278831 - head/sys/netpfil/pf

2015-02-17 Thread Sergey Kandaurov
On 17 February 2015 at 20:31, John-Mark Gurney j...@funkthat.com wrote:
 Gleb Smirnoff wrote this message on Mon, Feb 16, 2015 at 03:38 +:
 Author: glebius
 Date: Mon Feb 16 03:38:27 2015
 New Revision: 278831
 URL: https://svnweb.freebsd.org/changeset/base/278831

 Log:
   Update the pf fragment handling code to closer match recent OpenBSD.
   That partially fixes IPv6 fragment handling. Thanks to Kristof for
   working on that.

   Submitted by:   Kristof Provost
   Tested by:  peter
   Differential Revision:  D1765

 Looks like pf_flush_fragments still called in !INET case, though only
 defined for INET case:
 /scratch/tmp/jmg/src.head/sys/modules/pf/../../netpfil/pf/pf_norm.c:385:3: 
 error: implicit declaration of function 'pf_flush_fragments' is invalid in 
 C99 [-Werror,-Wimplicit-function-declaration]
 pf_flush_fragments();

 when compiling LINT-NOINET kernel..

With the changes attached I got all three kernels with both cc compiled
(tested on MINI w/ MODULES_OVERRIDE=pf). Basically,
- pf_flush_fragments is improperly INET-only
- pf_find_fragment is properly declared, but its body is under INET
- pf_refragment6 / pf_reassemble6 are properly under INET6,
  which is also under INET (the latter is wrong).
- bonus: some functions may be / were static'ized.

-- 
wbr,
pluknet
Index: sys/netpfil/pf/pf_norm.c
===
--- sys/netpfil/pf/pf_norm.c(revision 278917)
+++ sys/netpfil/pf/pf_norm.c(working copy)
@@ -138,17 +138,17 @@ static void   pf_free_fragment(struct pf_fragment *)
 static voidpf_remove_fragment(struct pf_fragment *);
 static int pf_normalize_tcpopt(struct pf_rule *, struct mbuf *,
struct tcphdr *, int, sa_family_t);
-struct pf_frent*pf_create_fragment(u_short *);
+static struct pf_frent *pf_create_fragment(u_short *);
 static struct pf_fragment *
pf_find_fragment(struct pf_fragment_cmp *key,
struct pf_frag_tree *tree);
 static struct pf_fragment *
pf_fillup_fragment(struct pf_fragment_cmp *, struct pf_frent *, 
u_short *);
 static int pf_isfull_fragment(struct pf_fragment *);
-struct mbuf*pf_join_fragment(struct pf_fragment *);
+static struct mbuf *pf_join_fragment(struct pf_fragment *);
+static voidpf_flush_fragments(void);
 #ifdef INET
 static voidpf_scrub_ip(struct mbuf **, uint32_t, uint8_t, uint8_t);
-static voidpf_flush_fragments(void);
 static int pf_reassemble(struct mbuf **, struct ip *, int, u_short *);
 static struct mbuf *
pf_fragcache(struct mbuf **, struct ip*, struct pf_fragment **,
@@ -267,7 +267,6 @@ pf_purge_expired_fragments(void)
PF_FRAG_UNLOCK();
 }
 
-#ifdef INET
 /*
  * Try to flush old fragments to make space for new ones
  */
@@ -292,7 +291,6 @@ pf_flush_fragments(void)
break;
}
 }
-#endif /* INET */
 
 /* Frees the fragments and all associated entries */
 static void
@@ -329,7 +327,6 @@ pf_free_fragment(struct pf_fragment *frag)
pf_remove_fragment(frag);
 }
 
-#ifdef INET
 static struct pf_fragment *
 pf_find_fragment(struct pf_fragment_cmp *key, struct pf_frag_tree *tree)
 {
@@ -352,10 +349,8 @@ pf_find_fragment(struct pf_fragment_cmp *key, stru
 
return (frag);
 }
-#endif /* INET */
 
 /* Removes a fragment from the fragment queue and frees the fragment */
-
 static void
 pf_remove_fragment(struct pf_fragment *frag)
 {
@@ -373,7 +368,7 @@ pf_remove_fragment(struct pf_fragment *frag)
}
 }
 
-struct pf_frent *
+static struct pf_frent *
 pf_create_fragment(u_short *reason)
 {
struct pf_frent *frent;
@@ -393,7 +388,7 @@ pf_create_fragment(u_short *reason)
return (frent);
 }
 
-struct pf_fragment *
+static struct pf_fragment *
 pf_fillup_fragment(struct pf_fragment_cmp *key, struct pf_frent *frent,
u_short *reason)
 {
@@ -570,7 +565,7 @@ pf_isfull_fragment(struct pf_fragment *frag)
return (1);
 }
 
-struct mbuf *
+static struct mbuf *
 pf_join_fragment(struct pf_fragment *frag)
 {
struct mbuf *m, *m2;
@@ -666,6 +661,7 @@ pf_reassemble(struct mbuf **m0, struct ip *ip, int
DPFPRINTF((complete: %p(%d)\n, m, ntohs(ip-ip_len)));
return (PF_PASS);
 }
+#endif /* INET */
 
 #ifdef INET6
 static int
@@ -789,6 +785,7 @@ fail:
 }
 #endif /* INET6 */
 
+#ifdef INET
 static struct mbuf *
 pf_fragcache(struct mbuf **m0, struct ip *h, struct pf_fragment **frag, int 
mff,
 int drop, int *nomem)
@@ -1090,6 +1087,7 @@ pf_fragcache(struct mbuf **m0, struct ip *h, struc
m_freem(m);
return (NULL);
 }
+#endif /* INET */
 
 #ifdef INET6
 int
@@ -1162,6 +1160,7 @@ pf_refragment6(struct ifnet *ifp, struct mbuf **m0
 }
 #endif /* INET6 */
 
+#ifdef INET
 int
 pf_normalize_ip(struct mbuf **m0, int dir, struct pfi_kif *kif, u_short 
*reason,
 struct pf_pdesc *pd)

Re: svn commit: r278831 - head/sys/netpfil/pf

2015-02-17 Thread Gleb Smirnoff
On Wed, Feb 18, 2015 at 01:40:36AM +0400, Sergey Kandaurov wrote:
S On 17 February 2015 at 20:31, John-Mark Gurney j...@funkthat.com wrote:
S  Gleb Smirnoff wrote this message on Mon, Feb 16, 2015 at 03:38 +:
S  Author: glebius
S  Date: Mon Feb 16 03:38:27 2015
S  New Revision: 278831
S  URL: https://svnweb.freebsd.org/changeset/base/278831
S 
S  Log:
SUpdate the pf fragment handling code to closer match recent OpenBSD.
SThat partially fixes IPv6 fragment handling. Thanks to Kristof for
Sworking on that.
S 
SSubmitted by:   Kristof Provost
STested by:  peter
SDifferential Revision:  D1765
S 
S  Looks like pf_flush_fragments still called in !INET case, though only
S  defined for INET case:
S  /scratch/tmp/jmg/src.head/sys/modules/pf/../../netpfil/pf/pf_norm.c:385:3: 
error: implicit declaration of function 'pf_flush_fragments' is invalid in C99 
[-Werror,-Wimplicit-function-declaration]
S  pf_flush_fragments();
S 
S  when compiling LINT-NOINET kernel..
S 
S With the changes attached I got all three kernels with both cc compiled
S (tested on MINI w/ MODULES_OVERRIDE=pf). Basically,
S - pf_flush_fragments is improperly INET-only
S - pf_find_fragment is properly declared, but its body is under INET
S - pf_refragment6 / pf_reassemble6 are properly under INET6,
S   which is also under INET (the latter is wrong).
S - bonus: some functions may be / were static'ized.

Thanks, looks very close to patch that I'm build testing now.

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


svn commit: r278922 - head

2015-02-17 Thread John-Mark Gurney
Author: jmg
Date: Tue Feb 17 21:18:17 2015
New Revision: 278922
URL: https://svnweb.freebsd.org/changeset/base/278922

Log:
  note that you should update your kernel due to RNG issue, and what
  versions you should upgrade...
  
  Suggested by: Ryan Stone

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Tue Feb 17 21:12:45 2015(r278921)
+++ head/UPDATING   Tue Feb 17 21:18:17 2015(r278922)
@@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
disable the most expensive debugging functionality run
ln -s 'abort:false,junk:false' /etc/malloc.conf.)
 
+20150217:
+   If you are running a -CURRENT kernel since r273872 (Oct 30th, 2014),
+   but before r278907, the RNG was not seeded properly.  Immediately
+   upgrade the kernel to r278907 or later and regenerate any keys (e.g.
+   ssh keys or openssl keys) that were generated w/ a kernel from that
+   range.  This does not effect programs that directly used /dev/random
+   or /dev/urandom.  All userland uses of arc4random(3) are effected.
+
 20150210:
The autofs(4) ABI was changed in order to restore binary compatibility
with 10.1-RELEASE.  The automountd(8) daemon needs to be rebuilt to work
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278924 - head/sys/ofed/include/net

2015-02-17 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Feb 17 21:59:15 2015
New Revision: 278924
URL: https://svnweb.freebsd.org/changeset/base/278924

Log:
  Fix compilation of LINT-NOINET kernel target after r278886.
  
  Sponsored by: Mellanox Technologies
  MFC after:1 month

Modified:
  head/sys/ofed/include/net/ip.h

Modified: head/sys/ofed/include/net/ip.h
==
--- head/sys/ofed/include/net/ip.h  Tue Feb 17 21:39:22 2015
(r278923)
+++ head/sys/ofed/include/net/ip.h  Tue Feb 17 21:59:15 2015
(r278924)
@@ -42,13 +42,17 @@
 #include netinet/in.h
 #include netinet/in_pcb.h
 
-#ifdef INET
 static inline void inet_get_local_port_range(int *low, int *high)
 {
+#ifdef INET
CURVNET_SET_QUIET(TD_TO_VNET(curthread));
*low = V_ipport_firstauto;
*high = V_ipport_lastauto;
CURVNET_RESTORE();
+#else
+   *low = IPPORT_EPHEMERALFIRST; /* 1 */
+   *high = IPPORT_EPHEMERALLAST; /* 65535 */
+#endif
 }
 
 static inline void
@@ -79,6 +83,5 @@ ip_ib_mc_map(uint32_t addr, const unsign
buf[18] = (addr  8)  0xff;
buf[19] = addr  0xff;
 }
-#endif
 
 #endif /* _LINUX_NET_IP_H_ */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278886 - in head/sys: conf contrib/rdma/krping dev/cxgb/ulp/iw_cxgb dev/cxgbe/iw_cxgbe modules/ibcore modules/mlx4ib ofed/drivers/infiniband/core ofed/drivers/infiniband/debug ofed/dri...

2015-02-17 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Feb 17 08:40:27 2015
New Revision: 278886
URL: https://svnweb.freebsd.org/changeset/base/278886

Log:
  Update the infiniband stack to Mellanox's OFED version 2.1.
  
  Highlights:
   - Multiple verbs API updates
   - Support for RoCE, RDMA over ethernet
  
  All hardware drivers depending on the common infiniband stack has been
  updated aswell.
  
  Discussed with:   np @
  Sponsored by: Mellanox Technologies
  MFC after:1 month

Added:
  head/sys/ofed/drivers/infiniband/core/peer_mem.c   (contents, props changed)
  head/sys/ofed/drivers/infiniband/hw/mlx4/mlx4_exp.c   (contents, props 
changed)
  head/sys/ofed/drivers/infiniband/hw/mlx4/mlx4_exp.h   (contents, props 
changed)
  head/sys/ofed/include/rdma/ib_peer_mem.h   (contents, props changed)
  head/sys/ofed/include/rdma/ib_user_verbs_exp.h   (contents, props changed)
  head/sys/ofed/include/rdma/ib_verbs_exp.h   (contents, props changed)
  head/sys/ofed/include/rdma/peer_mem.h   (contents, props changed)
Deleted:
  head/sys/ofed/drivers/infiniband/core/Makefile
  head/sys/ofed/drivers/infiniband/core/local_sa.c
  head/sys/ofed/drivers/infiniband/core/notice.c
  head/sys/ofed/drivers/infiniband/hw/mlx4/Makefile
  head/sys/ofed/drivers/infiniband/ulp/ipoib/Makefile
Modified:
  head/sys/conf/files
  head/sys/contrib/rdma/krping/krping.c
  head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c
  head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_qp.c
  head/sys/dev/cxgbe/iw_cxgbe/cq.c
  head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h
  head/sys/dev/cxgbe/iw_cxgbe/mem.c
  head/sys/modules/ibcore/Makefile
  head/sys/modules/mlx4ib/Makefile
  head/sys/ofed/drivers/infiniband/core/addr.c
  head/sys/ofed/drivers/infiniband/core/cache.c
  head/sys/ofed/drivers/infiniband/core/cm.c
  head/sys/ofed/drivers/infiniband/core/cm_msgs.h
  head/sys/ofed/drivers/infiniband/core/cma.c
  head/sys/ofed/drivers/infiniband/core/core_priv.h
  head/sys/ofed/drivers/infiniband/core/device.c
  head/sys/ofed/drivers/infiniband/core/fmr_pool.c
  head/sys/ofed/drivers/infiniband/core/iwcm.c
  head/sys/ofed/drivers/infiniband/core/mad.c
  head/sys/ofed/drivers/infiniband/core/mad_priv.h
  head/sys/ofed/drivers/infiniband/core/mad_rmpp.c
  head/sys/ofed/drivers/infiniband/core/multicast.c
  head/sys/ofed/drivers/infiniband/core/packer.c
  head/sys/ofed/drivers/infiniband/core/sa.h
  head/sys/ofed/drivers/infiniband/core/sa_query.c
  head/sys/ofed/drivers/infiniband/core/smi.c
  head/sys/ofed/drivers/infiniband/core/sysfs.c
  head/sys/ofed/drivers/infiniband/core/ucm.c
  head/sys/ofed/drivers/infiniband/core/ucma.c
  head/sys/ofed/drivers/infiniband/core/ud_header.c
  head/sys/ofed/drivers/infiniband/core/umem.c
  head/sys/ofed/drivers/infiniband/core/user_mad.c
  head/sys/ofed/drivers/infiniband/core/uverbs.h
  head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c
  head/sys/ofed/drivers/infiniband/core/uverbs_main.c
  head/sys/ofed/drivers/infiniband/core/uverbs_marshall.c
  head/sys/ofed/drivers/infiniband/core/verbs.c
  head/sys/ofed/drivers/infiniband/debug/memtrack.c
  head/sys/ofed/drivers/infiniband/debug/memtrack.h
  head/sys/ofed/drivers/infiniband/debug/mtrack.h
  head/sys/ofed/drivers/infiniband/hw/mlx4/ah.c
  head/sys/ofed/drivers/infiniband/hw/mlx4/alias_GUID.c
  head/sys/ofed/drivers/infiniband/hw/mlx4/cm.c
  head/sys/ofed/drivers/infiniband/hw/mlx4/cq.c
  head/sys/ofed/drivers/infiniband/hw/mlx4/doorbell.c
  head/sys/ofed/drivers/infiniband/hw/mlx4/mad.c
  head/sys/ofed/drivers/infiniband/hw/mlx4/main.c
  head/sys/ofed/drivers/infiniband/hw/mlx4/mcg.c
  head/sys/ofed/drivers/infiniband/hw/mlx4/mlx4_ib.h
  head/sys/ofed/drivers/infiniband/hw/mlx4/mr.c
  head/sys/ofed/drivers/infiniband/hw/mlx4/qp.c
  head/sys/ofed/drivers/infiniband/hw/mlx4/sysfs.c
  head/sys/ofed/drivers/infiniband/hw/mthca/mthca_provider.c
  head/sys/ofed/drivers/infiniband/hw/mthca/mthca_qp.c
  head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h
  head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c
  head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
  head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
  head/sys/ofed/include/rdma/ib_addr.h
  head/sys/ofed/include/rdma/ib_cache.h
  head/sys/ofed/include/rdma/ib_cm.h
  head/sys/ofed/include/rdma/ib_mad.h
  head/sys/ofed/include/rdma/ib_pack.h
  head/sys/ofed/include/rdma/ib_sa.h
  head/sys/ofed/include/rdma/ib_umem.h
  head/sys/ofed/include/rdma/ib_user_verbs.h
  head/sys/ofed/include/rdma/ib_verbs.h
  head/sys/ofed/include/rdma/iw_cm.h
  head/sys/ofed/include/rdma/rdma_cm.h
  head/sys/ofed/include/rdma/rdma_user_cm.h

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue Feb 17 08:38:02 2015(r278885)
+++ head/sys/conf/files Tue Feb 17 08:40:27 2015(r278886)
@@ -3624,19 +3624,16 @@ ofed/drivers/infiniband/core/fmr_pool.c 
 ofed/drivers/infiniband/core/iwcm.coptional ofed   \
no-depend 

svn commit: r278888 - head/sys/vm

2015-02-17 Thread Garrett Cooper
Author: ngie
Date: Tue Feb 17 08:50:26 2015
New Revision: 27
URL: https://svnweb.freebsd.org/changeset/base/27

Log:
  Some minor style(9) fixes (whitespace + comment)
  
  MFC after: 3 days

Modified:
  head/sys/vm/memguard.c

Modified: head/sys/vm/memguard.c
==
--- head/sys/vm/memguard.c  Tue Feb 17 08:42:26 2015(r278887)
+++ head/sys/vm/memguard.c  Tue Feb 17 08:50:26 2015(r27)
@@ -89,9 +89,7 @@ memguard_sysctl_desc(SYSCTL_HANDLER_ARGS
return (error);
 
mtx_lock(malloc_mtx);
-   /*
-* If mtp is NULL, it will be initialized in memguard_cmp().
-*/
+   /* If mtp is NULL, it will be initialized in memguard_cmp() */
vm_memguard_mtype = malloc_desc2type(desc);
strlcpy(vm_memguard_desc, desc, sizeof(vm_memguard_desc));
mtx_unlock(malloc_mtx);
@@ -502,7 +500,7 @@ int
 memguard_cmp_zone(uma_zone_t zone)
 {
 
-if ((memguard_options  MG_GUARD_NOFREE) == 0 
+   if ((memguard_options  MG_GUARD_NOFREE) == 0 
zone-uz_flags  UMA_ZONE_NOFREE)
return (0);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r278880 - head/sys/dev/ic

2015-02-17 Thread Andrey V. Elsukov
On 17.02.2015 08:07, Warner Losh wrote:
 Author: imp
 Date: Tue Feb 17 05:07:38 2015
 New Revision: 278880
 URL: https://svnweb.freebsd.org/changeset/base/278880
 
 Log:
   This should have been GC'd 6 years ago when ar(4) was removed.
 
 Deleted:
   head/sys/dev/ic/hd64570.h

Hi,

I think it should be added to ObsoleteFiles.inc.

-- 
WBR, Andrey V. Elsukov



signature.asc
Description: OpenPGP digital signature


svn commit: r278889 - head/lib/libc/include

2015-02-17 Thread Konstantin Belousov
Author: kib
Date: Tue Feb 17 08:54:03 2015
New Revision: 278889
URL: https://svnweb.freebsd.org/changeset/base/278889

Log:
  Restore the extern qualifier on __cleanup.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

Modified:
  head/lib/libc/include/libc_private.h

Modified: head/lib/libc/include/libc_private.h
==
--- head/lib/libc/include/libc_private.hTue Feb 17 08:50:26 2015
(r27)
+++ head/lib/libc/include/libc_private.hTue Feb 17 08:54:03 2015
(r278889)
@@ -271,7 +271,7 @@ void _malloc_first_thread(void);
 /*
  * Function to clean up streams, called from abort() and exit().
  */
-void (*__cleanup)(void) __hidden;
+extern void (*__cleanup)(void) __hidden;
 
 /*
  * Get kern.osreldate to detect ABI revisions.  Explicitly
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278890 - head/sys/ofed/drivers/infiniband/core

2015-02-17 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Feb 17 08:57:36 2015
New Revision: 278890
URL: https://svnweb.freebsd.org/changeset/base/278890

Log:
  Fix compilation when DEBUG is defined.
  
  Sponsored by: Mellanox Technologies
  MFC after:1 month

Modified:
  head/sys/ofed/drivers/infiniband/core/fmr_pool.c

Modified: head/sys/ofed/drivers/infiniband/core/fmr_pool.c
==
--- head/sys/ofed/drivers/infiniband/core/fmr_pool.cTue Feb 17 08:54:03 
2015(r278889)
+++ head/sys/ofed/drivers/infiniband/core/fmr_pool.cTue Feb 17 08:57:36 
2015(r278890)
@@ -151,7 +151,7 @@ static void ib_fmr_batch_release(struct 
 
 #ifdef DEBUG
if (fmr-ref_count !=0) {
-   printk(KERN_WARNING PFX Unmapping FMR 0x%08x with ref 
count %d\n,
+   printk(KERN_WARNING PFX Unmapping FMR %p with ref 
count %d\n,
   fmr, fmr-ref_count);
}
 #endif
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r278913 - in head/sys: conf modules/cxgbe/if_cxgbe modules/drm2/radeonkms modules/ibcore modules/ipoib modules/mlx4 modules/mlx4ib modules/mlxen modules/mthca ofed/drivers/net/mlx4

2015-02-17 Thread Bruce Evans

On Tue, 17 Feb 2015, Gleb Smirnoff wrote:


Author: glebius
Date: Tue Feb 17 19:27:14 2015
New Revision: 278913
URL: https://svnweb.freebsd.org/changeset/base/278913

Log:
   Globally enable -fms-extensions when building kernel with gcc, and remove
 this option from all modules that enable it theirselves.
   In C mode -fms-extensions option enables anonymous structs and unions,
 allowing us to use this C11 feature in kernel. Of course, clang supports
 it without any extra options.


Anonymous unions have been a standard gcc extension for more than 20 years.
It shouldn't take a ms extensions flag to get them, except possibly for
C++.

Indeed, the bugs are mostly in extra options that are already present.
Of course, clang handles these options incorrectly:

- the default CFLAGS for kernels include the foot-shooting flag -std=c99.
  The feature isn't in C99, so this should make the feature unavailable
  in kernels.  This works for gcc-4.2, but not for clang or gcc-4.8.  It
  takes -pedantic as well as -std=c99 to kill the feature for these
  compilers.

- the default CFLAGS for userland include -std=gnu99.  This of course
  doesn't kill 20+ year old gcc extensions, so userland doesn't have the
  problem.

I recently noticed several other bugs involving -std:

- -std sets __STDC_VERSION__, but sys/cdefs.h mostly ignores that.  It
  sets __ISO_C_VISIBLE based mainly on _POSIX_C_SOURCE, so
  __ISO_C_VISIBLE defaults to 2011 and is thus inconsistent with
  __STDC_VERSION__ in all cases where -std=c11 is not used -- that is,
  in almost all cases since everything defaults to -std=c99 or
  -std-gnu99 which give __STDC_VERSION__ = 199901L.

  Compiling with an old makefile or script that doesn't use -std gives
  larger inconsistencies -- it gives C90 for gcc but C99 for clang.
  gcc-4.8 remains compatible with gcc-4.2 (and gcc-1?) here.

- most FreeBSD header files use __ISO_C_VISIBLE and not __STDC_VERSION__,
  so they give C11 symbols by default.  They are supposed to give
  maximal symbols by default, but this is wrong if the symbols are
  related to language features that are turned off by -std.

- gcc-4.8 uses some private header files.  It doesn't use FreeBSD's
  __ISO_C_VISBLE of course, so it gives inconsistent symbols.

- lib/msun used to depend on __ISO_C_VISIBLE being wrong when it was
  compiled with defaults.  Now it depends on -std=*99 being in the
  defaults.  Both conditions are satisifed when the system headers
  are used.  But when gcc's float.h is used and -std is either not
  used or is *89, then the compile breaks.

- gcc's private header for float.h also has incompatibilities unrelated
  to -std.  These break lib/msun more seriously on i386.

- -std=c99 in gcc-4.8 gives large pessimizations in floating point code
  on i386.  -std=gnu99 gives compatible FP code (not perfectly pessimized
  to Standards spec).  clang is just missing support for Standards here.

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


svn commit: r278925 - head/sys/netpfil/pf

2015-02-17 Thread Gleb Smirnoff
Author: glebius
Date: Tue Feb 17 22:33:22 2015
New Revision: 278925
URL: https://svnweb.freebsd.org/changeset/base/278925

Log:
  Even more fixes to !INET and !INET6 kernels.
  
  In collaboration with:pluknet

Modified:
  head/sys/netpfil/pf/pf_norm.c

Modified: head/sys/netpfil/pf/pf_norm.c
==
--- head/sys/netpfil/pf/pf_norm.c   Tue Feb 17 21:59:15 2015
(r278924)
+++ head/sys/netpfil/pf/pf_norm.c   Tue Feb 17 22:33:22 2015
(r278925)
@@ -134,25 +134,23 @@ static int pf_frag_compare(struct pf_f
 static RB_PROTOTYPE(pf_frag_tree, pf_fragment, fr_entry, pf_frag_compare);
 static RB_GENERATE(pf_frag_tree, pf_fragment, fr_entry, pf_frag_compare);
 
+static voidpf_flush_fragments(void);
 static voidpf_free_fragment(struct pf_fragment *);
 static voidpf_remove_fragment(struct pf_fragment *);
 static int pf_normalize_tcpopt(struct pf_rule *, struct mbuf *,
struct tcphdr *, int, sa_family_t);
-struct pf_frent*pf_create_fragment(u_short *);
-static struct pf_fragment *
-   pf_find_fragment(struct pf_fragment_cmp *key,
+static struct pf_frent *pf_create_fragment(u_short *);
+static struct pf_fragment *pf_find_fragment(struct pf_fragment_cmp *key,
struct pf_frag_tree *tree);
-static struct pf_fragment *
-   pf_fillup_fragment(struct pf_fragment_cmp *, struct pf_frent *, 
u_short *);
+static struct pf_fragment *pf_fillup_fragment(struct pf_fragment_cmp *,
+   struct pf_frent *, u_short *);
 static int pf_isfull_fragment(struct pf_fragment *);
-struct mbuf*pf_join_fragment(struct pf_fragment *);
+static struct mbuf *pf_join_fragment(struct pf_fragment *);
 #ifdef INET
 static voidpf_scrub_ip(struct mbuf **, uint32_t, uint8_t, uint8_t);
-static voidpf_flush_fragments(void);
 static int pf_reassemble(struct mbuf **, struct ip *, int, u_short *);
-static struct mbuf *
-   pf_fragcache(struct mbuf **, struct ip*, struct pf_fragment **,
-   int, int, int *);
+static struct mbuf *pf_fragcache(struct mbuf **, struct ip*,
+   struct pf_fragment **, int, int, int *);
 #endif /* INET */
 #ifdef INET6
 static int pf_reassemble6(struct mbuf **, struct ip6_hdr *,
@@ -267,7 +265,6 @@ pf_purge_expired_fragments(void)
PF_FRAG_UNLOCK();
 }
 
-#ifdef INET
 /*
  * Try to flush old fragments to make space for new ones
  */
@@ -292,7 +289,6 @@ pf_flush_fragments(void)
break;
}
 }
-#endif /* INET */
 
 /* Frees the fragments and all associated entries */
 static void
@@ -329,7 +325,6 @@ pf_free_fragment(struct pf_fragment *fra
pf_remove_fragment(frag);
 }
 
-#ifdef INET
 static struct pf_fragment *
 pf_find_fragment(struct pf_fragment_cmp *key, struct pf_frag_tree *tree)
 {
@@ -352,10 +347,8 @@ pf_find_fragment(struct pf_fragment_cmp 
 
return (frag);
 }
-#endif /* INET */
 
 /* Removes a fragment from the fragment queue and frees the fragment */
-
 static void
 pf_remove_fragment(struct pf_fragment *frag)
 {
@@ -373,7 +366,7 @@ pf_remove_fragment(struct pf_fragment *f
}
 }
 
-struct pf_frent *
+static struct pf_frent *
 pf_create_fragment(u_short *reason)
 {
struct pf_frent *frent;
@@ -570,7 +563,7 @@ pf_isfull_fragment(struct pf_fragment *f
return (1);
 }
 
-struct mbuf *
+static struct mbuf *
 pf_join_fragment(struct pf_fragment *frag)
 {
struct mbuf *m, *m2;
@@ -666,6 +659,7 @@ pf_reassemble(struct mbuf **m0, struct i
DPFPRINTF((complete: %p(%d)\n, m, ntohs(ip-ip_len)));
return (PF_PASS);
 }
+#endif /* INET */
 
 #ifdef INET6
 static int
@@ -789,6 +783,7 @@ fail:
 }
 #endif /* INET6 */
 
+#ifdef INET
 static struct mbuf *
 pf_fragcache(struct mbuf **m0, struct ip *h, struct pf_fragment **frag, int 
mff,
 int drop, int *nomem)
@@ -1090,6 +1085,7 @@ pf_fragcache(struct mbuf **m0, struct ip
m_freem(m);
return (NULL);
 }
+#endif /* INET */
 
 #ifdef INET6
 int
@@ -1162,6 +1158,7 @@ pf_refragment6(struct ifnet *ifp, struct
 }
 #endif /* INET6 */
 
+#ifdef INET
 int
 pf_normalize_ip(struct mbuf **m0, int dir, struct pfi_kif *kif, u_short 
*reason,
 struct pf_pdesc *pd)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278894 - in head/sys: conf ofed/drivers/infiniband/hw/mlx4 ofed/drivers/infiniband/ulp/sdp

2015-02-17 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Feb 17 10:00:15 2015
New Revision: 278894
URL: https://svnweb.freebsd.org/changeset/base/278894

Log:
  Fix compilation of the SDP driver and a compile warning after r278886.
  Also fix the kernel build rule for mlx4_exp.c.
  This fixes the LINT kernel target for amd64.
  
  Sponsored by: Mellanox Technologies
  MFC after:1 month

Modified:
  head/sys/conf/files
  head/sys/ofed/drivers/infiniband/hw/mlx4/mcg.c
  head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c
  head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c
  head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue Feb 17 09:40:36 2015(r278893)
+++ head/sys/conf/files Tue Feb 17 10:00:15 2015(r278894)
@@ -3739,7 +3739,7 @@ ofed/drivers/infiniband/hw/mlx4/main.c
no-depend obj-prefix mlx4ib_  \
compile-with ${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/
 ofed/drivers/infiniband/hw/mlx4/mlx4_exp.c optional mlx4ib \
-   no-depend \
+   no-depend obj-prefix mlx4ib_  \
compile-with ${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/
 ofed/drivers/infiniband/hw/mlx4/mr.c   optional mlx4ib \
no-depend obj-prefix mlx4ib_  \

Modified: head/sys/ofed/drivers/infiniband/hw/mlx4/mcg.c
==
--- head/sys/ofed/drivers/infiniband/hw/mlx4/mcg.c  Tue Feb 17 09:40:36 
2015(r278893)
+++ head/sys/ofed/drivers/infiniband/hw/mlx4/mcg.c  Tue Feb 17 10:00:15 
2015(r278894)
@@ -668,7 +668,7 @@ static void mlx4_ib_mcg_work_handler(str
if (!list_empty(group-pending_list))
req = list_first_entry(group-pending_list,
struct mcast_req, group_list);
-   if ((method == IB_MGMT_METHOD_GET_RESP)) {
+   if (method == IB_MGMT_METHOD_GET_RESP) {
if (req) {
send_reply_to_slave(req-func, 
group, req-sa_mad, status);

--group-func[req-func].num_pend_reqs;

Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c
==
--- head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Tue Feb 17 09:40:36 
2015(r278893)
+++ head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Tue Feb 17 10:00:15 
2015(r278894)
@@ -129,7 +129,7 @@ sdp_pcbbind(struct sdp_sock *ssk, struct
/* rdma_bind_addr handles bind races.  */
SDP_WUNLOCK(ssk);
if (ssk-id == NULL)
-   ssk-id = rdma_create_id(sdp_cma_handler, ssk, RDMA_PS_SDP);
+   ssk-id = rdma_create_id(sdp_cma_handler, ssk, RDMA_PS_SDP, 
IB_QPT_RC);
if (ssk-id == NULL) {
SDP_WLOCK(ssk);
return (ENOMEM);
@@ -1702,11 +1702,15 @@ int sdp_mod_usec = 0;
 void
 sdp_set_default_moderation(struct sdp_sock *ssk)
 {
+   struct ib_cq_attr attr;
if (sdp_mod_count = 0 || sdp_mod_usec = 0)
return;
-   ib_modify_cq(ssk-rx_ring.cq, sdp_mod_count, sdp_mod_usec);
-}
+   memset(attr, 0, sizeof(attr));
+   attr.moderation.cq_count = sdp_mod_count;
+   attr.moderation.cq_period = sdp_mod_usec;
 
+   ib_modify_cq(ssk-rx_ring.cq, attr, IB_CQ_MODERATION);
+}
 
 static void
 sdp_dev_add(struct ib_device *device)

Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c
==
--- head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c   Tue Feb 17 09:40:36 
2015(r278893)
+++ head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c   Tue Feb 17 10:00:15 
2015(r278894)
@@ -736,7 +736,7 @@ sdp_rx_ring_create(struct sdp_sock *ssk,
}
 
rx_cq = ib_create_cq(device, sdp_rx_irq, sdp_rx_cq_event_handler,
- ssk-socket, SDP_RX_SIZE, 
IB_CQ_VECTOR_LEAST_ATTACHED);
+ ssk-socket, SDP_RX_SIZE, 0);
 
if (IS_ERR(rx_cq)) {
rc = PTR_ERR(rx_cq);

Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c
==
--- head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c   Tue Feb 17 09:40:36 
2015(r278893)
+++ head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c   Tue Feb 17 10:00:15 
2015(r278894)
@@ -438,7 +438,7 @@ sdp_tx_ring_create(struct sdp_sock *ssk,
}
 
tx_cq = ib_create_cq(device, sdp_tx_irq, sdp_tx_cq_event_handler,
- ssk, SDP_TX_SIZE, IB_CQ_VECTOR_LEAST_ATTACHED);
+   

svn commit: r278891 - head/sys/kern

2015-02-17 Thread Garrett Cooper
Author: ngie
Date: Tue Feb 17 09:31:58 2015
New Revision: 278891
URL: https://svnweb.freebsd.org/changeset/base/278891

Log:
  Add the mnt_lockref field to the ddb(4) 'show mount' command
  
  MFC after: 1 week
  Differential Revision: https://reviews.freebsd.org/D1688
  Submitted by: Conrad Meyer conrad.me...@isilon.com
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cTue Feb 17 08:57:36 2015(r278890)
+++ head/sys/kern/vfs_subr.cTue Feb 17 09:31:58 2015(r278891)
@@ -3203,6 +3203,7 @@ DB_SHOW_COMMAND(mount, db_show_mount)
db_printf(mnt_maxsymlinklen = %d\n, mp-mnt_maxsymlinklen);
db_printf(mnt_iosize_max = %d\n, mp-mnt_iosize_max);
db_printf(mnt_hashseed = %u\n, mp-mnt_hashseed);
+   db_printf(mnt_lockref = %d\n, mp-mnt_lockref);
db_printf(mnt_secondary_writes = %d\n, mp-mnt_secondary_writes);
db_printf(mnt_secondary_accwrites = %d\n,
mp-mnt_secondary_accwrites);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278896 - in head: lib/liblzma usr.bin/compress usr.bin/gzip

2015-02-17 Thread Jilles Tjoelker
Author: jilles
Date: Tue Feb 17 13:12:54 2015
New Revision: 278896
URL: https://svnweb.freebsd.org/changeset/base/278896

Log:
  compress,gzip,xz: Preserve timestamps with nanosecond precision.

Modified:
  head/lib/liblzma/config.h
  head/usr.bin/compress/compress.c
  head/usr.bin/gzip/gzip.c

Modified: head/lib/liblzma/config.h
==
--- head/lib/liblzma/config.h   Tue Feb 17 13:09:20 2015(r278895)
+++ head/lib/liblzma/config.h   Tue Feb 17 13:12:54 2015(r278896)
@@ -26,6 +26,7 @@
 #define HAVE_ENCODER_SPARC 1
 #define HAVE_ENCODER_X86 1
 #define HAVE_FCNTL_H 1
+#define HAVE_FUTIMENS 1
 #define HAVE_FUTIMES 1
 #define HAVE_GETOPT_H 1
 #define HAVE_GETOPT_LONG 1

Modified: head/usr.bin/compress/compress.c
==
--- head/usr.bin/compress/compress.cTue Feb 17 13:09:20 2015
(r278895)
+++ head/usr.bin/compress/compress.cTue Feb 17 13:12:54 2015
(r278896)
@@ -48,6 +48,7 @@ __FBSDID($FreeBSD$);
 
 #include err.h
 #include errno.h
+#include fcntl.h
 #include stdarg.h
 #include stdio.h
 #include stdlib.h
@@ -360,14 +361,14 @@ err:  if (ofp) {
 static void
 setfile(const char *name, struct stat *fs)
 {
-   static struct timeval tv[2];
+   static struct timespec tspec[2];
 
fs-st_mode = S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO;
 
-   TIMESPEC_TO_TIMEVAL(tv[0], fs-st_atim);
-   TIMESPEC_TO_TIMEVAL(tv[1], fs-st_mtim);
-   if (utimes(name, tv))
-   cwarn(utimes: %s, name);
+   tspec[0] = fs-st_atim;
+   tspec[1] = fs-st_mtim;
+   if (utimensat(AT_FDCWD, name, tspec, 0))
+   cwarn(utimensat: %s, name);
 
/*
 * Changing the ownership probably won't succeed, unless we're root

Modified: head/usr.bin/gzip/gzip.c
==
--- head/usr.bin/gzip/gzip.cTue Feb 17 13:09:20 2015(r278895)
+++ head/usr.bin/gzip/gzip.cTue Feb 17 13:12:54 2015(r278896)
@@ -1070,7 +1070,7 @@ out2:
 static void
 copymodes(int fd, const struct stat *sbp, const char *file)
 {
-   struct timeval times[2];
+   struct timespec times[2];
struct stat sb;
 
/*
@@ -1098,10 +1098,10 @@ copymodes(int fd, const struct stat *sbp
if (fchmod(fd, sb.st_mode)  0)
maybe_warn(couldn't fchmod: %s, file);
 
-   TIMESPEC_TO_TIMEVAL(times[0], sb.st_atim);
-   TIMESPEC_TO_TIMEVAL(times[1], sb.st_mtim);
-   if (futimes(fd, times)  0)
-   maybe_warn(couldn't utimes: %s, file);
+   times[0] = sb.st_atim;
+   times[1] = sb.st_mtim;
+   if (futimens(fd, times)  0)
+   maybe_warn(couldn't futimens: %s, file);
 
/* only try flags if they exist already */
 if (sb.st_flags != 0  fchflags(fd, sb.st_flags)  0)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r278895 - in head/sys: arm/arm arm/include conf

2015-02-17 Thread Andrew Turner
Author: andrew
Date: Tue Feb 17 13:09:20 2015
New Revision: 278895
URL: https://svnweb.freebsd.org/changeset/base/278895

Log:
  Pull the ARM ddb unwind code out to a new file. This will allow it to be
  used by other places that expect to unwind the stack, e.g. dtrace and
  stack(9).
  
  As I have written most of this code I'm changing the license to the
  standard FreeBSD license. I have received approval from the other
  developers who have changed any of the affected code.
  
  Approved by:  ian, imp, rpaulo, eadler (all license change)

Added:
  head/sys/arm/arm/unwind.c
 - copied, changed from r278894, head/sys/arm/arm/db_trace.c
Modified:
  head/sys/arm/arm/db_trace.c
  head/sys/arm/include/stack.h
  head/sys/conf/files.arm

Modified: head/sys/arm/arm/db_trace.c
==
--- head/sys/arm/arm/db_trace.c Tue Feb 17 10:00:15 2015(r278894)
+++ head/sys/arm/arm/db_trace.c Tue Feb 17 13:09:20 2015(r278895)
@@ -38,6 +38,7 @@ __FBSDID($FreeBSD$);
 #include sys/proc.h
 #include sys/kdb.h
 #include sys/stack.h
+
 #include machine/armreg.h
 #include machine/asm.h
 #include machine/cpufunc.h
@@ -45,322 +46,15 @@ __FBSDID($FreeBSD$);
 #include machine/pcb.h
 #include machine/stack.h
 #include machine/vmparam.h
+
 #include ddb/ddb.h
 #include ddb/db_access.h
 #include ddb/db_sym.h
 #include ddb/db_output.h
 
-/*
- * Definitions for the instruction interpreter.
- *
- * The ARM EABI specifies how to perform the frame unwinding in the
- * Exception Handling ABI for the ARM Architecture document. To perform
- * the unwind we need to know the initial frame pointer, stack pointer,
- * link register and program counter. We then find the entry within the
- * index table that points to the function the program counter is within.
- * This gives us either a list of three instructions to process, a 31-bit
- * relative offset to a table of instructions, or a value telling us
- * we can't unwind any further.
- *
- * When we have the instructions to process we need to decode them
- * following table 4 in section 9.3. This describes a collection of bit
- * patterns to encode that steps to take to update the stack pointer and
- * link register to the correct values at the start of the function.
- */
-
-/* A special case when we are unable to unwind past this function */
-#defineEXIDX_CANTUNWIND1
-
-/* The register names */
-#defineFP  11
-#defineSP  13
-#defineLR  14
-#definePC  15
-
-/*
- * These are set in the linker script. Their addresses will be
- * either the start or end of the exception table or index.
- */
-extern int extab_start, extab_end, exidx_start, exidx_end;
-
-/*
- * Entry types.
- * These are the only entry types that have been seen in the kernel.
- */
-#defineENTRY_MASK  0xff00
-#defineENTRY_ARM_SU16  0x8000
-#defineENTRY_ARM_LU16  0x8100
-
-/* Instruction masks. */
-#defineINSN_VSP_MASK   0xc0
-#defineINSN_VSP_SIZE_MASK  0x3f
-#defineINSN_STD_MASK   0xf0
-#defineINSN_STD_DATA_MASK  0x0f
-#defineINSN_POP_TYPE_MASK  0x08
-#defineINSN_POP_COUNT_MASK 0x07
-#defineINSN_VSP_LARGE_INC_MASK 0xff
-
-/* Instruction definitions */
-#defineINSN_VSP_INC0x00
-#defineINSN_VSP_DEC0x40
-#defineINSN_POP_MASKED 0x80
-#defineINSN_VSP_REG0x90
-#defineINSN_POP_COUNT  0xa0
-#defineINSN_FINISH 0xb0
-#defineINSN_POP_REGS   0xb1
-#defineINSN_VSP_LARGE_INC  0xb2
-
-/* An item in the exception index table */
-struct unwind_idx {
-   uint32_t offset;
-   uint32_t insn;
-};
-
-/* The state of the unwind process */
-struct unwind_state {
-   uint32_t registers[16];
-   uint32_t start_pc;
-   uint32_t *insn;
-   u_int entries;
-   u_int byte;
-   uint16_t update_mask;
-};
-
-/* Expand a 31-bit signed value to a 32-bit signed value */
-static __inline int32_t
-db_expand_prel31(uint32_t prel31)
-{
-
-   return ((int32_t)(prel31  0x7fffu)  1) / 2;
-}
-
-/*
- * Perform a binary search of the index table to find the function
- * with the largest address that doesn't exceed addr.
- */
-static struct unwind_idx *
-db_find_index(uint32_t addr)
-{
-   unsigned int min, mid, max;
-   struct unwind_idx *start;
-   struct unwind_idx *item;
-   int32_t prel31_addr;
-   uint32_t func_addr;
-
-   start = (struct unwind_idx *)exidx_start;
-
-   min = 0;
-   max = (exidx_end - exidx_start) / 2;
-
-   while (min != max) {
-   mid = min + (max - min + 1) / 2;
-
-   item = start[mid];
-
-   prel31_addr = db_expand_prel31(item-offset);
-   func_addr = (uint32_t)item-offset + prel31_addr;
-
-   if (func_addr =