svn commit: r253057 - head/usr.sbin/rtadvd

2013-07-09 Thread Hiroki Sato
Author: hrs
Date: Tue Jul  9 07:03:54 2013
New Revision: 253057
URL: http://svnweb.freebsd.org/changeset/base/253057

Log:
  Add a missing white space.

Modified:
  head/usr.sbin/rtadvd/config.c

Modified: head/usr.sbin/rtadvd/config.c
==
--- head/usr.sbin/rtadvd/config.c   Tue Jul  9 06:51:41 2013
(r253056)
+++ head/usr.sbin/rtadvd/config.c   Tue Jul  9 07:03:54 2013
(r253057)
@@ -1286,7 +1286,7 @@ make_prefix(struct rainfo *rai, int ifin
 
memset(&ipr, 0, sizeof(ipr));
if (if_indextoname(ifindex, ipr.ipr_name) == NULL) {
-   syslog(LOG_ERR, "<%s> Prefix added interface No.%d doesn't"
+   syslog(LOG_ERR, "<%s> Prefix added interface No.%d doesn't "
"exist. This should not happen! %s", __func__,
ifindex, strerror(errno));
exit(1);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253058 - head/usr.sbin/rtadvd

2013-07-09 Thread Hiroki Sato
Author: hrs
Date: Tue Jul  9 07:08:36 2013
New Revision: 253058
URL: http://svnweb.freebsd.org/changeset/base/253058

Log:
  - Add missing "static" keywords.
  - Add a check for ifindex to if_indextoifinfo().  It returns NULL when
if_indextoname() fails.
  
  MFC after:3 days

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

Modified: head/usr.sbin/rtadvd/rtadvd.c
==
--- head/usr.sbin/rtadvd/rtadvd.c   Tue Jul  9 07:03:54 2013
(r253057)
+++ head/usr.sbin/rtadvd/rtadvd.c   Tue Jul  9 07:08:36 2013
(r253058)
@@ -95,7 +95,7 @@ struct sockaddr_in6 rcvfrom;
 static const char *pidfilename = _PATH_RTADVDPID;
 const char *conffile = _PATH_RTADVDCONF;
 static struct pidfh *pfh;
-int dflag = 0, sflag = 0;
+static int dflag, sflag;
 static int wait_shutdown;
 
 #definePFD_RAWSOCK 0
@@ -139,7 +139,7 @@ union nd_opt {
 #define NDOPT_FLAG_RDNSS   (1 << 5)
 #define NDOPT_FLAG_DNSSL   (1 << 6)
 
-uint32_t ndopt_flags[] = {
+static uint32_t ndopt_flags[] = {
[ND_OPT_SOURCE_LINKADDR]= NDOPT_FLAG_SRCLINKADDR,
[ND_OPT_TARGET_LINKADDR]= NDOPT_FLAG_TGTLINKADDR,
[ND_OPT_PREFIX_INFORMATION] = NDOPT_FLAG_PREFIXINFO,
@@ -1637,6 +1637,11 @@ struct ifinfo *
 if_indextoifinfo(int idx)
 {
struct ifinfo *ifi;
+   char *name, name0[IFNAMSIZ];
+
+   /* Check if the interface has a valid name or not. */
+   if (if_indextoname(idx, name0) == NULL)
+   return (NULL);
 
TAILQ_FOREACH(ifi, &ifilist, ifi_next) {
if (ifi->ifi_ifindex == idx)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2013-07-09 Thread Hiroki Sato
Author: hrs
Date: Tue Jul  9 07:55:47 2013
New Revision: 253060
URL: http://svnweb.freebsd.org/changeset/base/253060

Log:
  Document IPv6 support.

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

Modified: head/share/man/man4/bridge.4
==
--- head/share/man/man4/bridge.4Tue Jul  9 07:51:11 2013
(r253059)
+++ head/share/man/man4/bridge.4Tue Jul  9 07:55:47 2013
(r253060)
@@ -35,7 +35,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 9, 2010
+.Dd July 3, 2013
 .Dt IF_BRIDGE 4
 .Os
 .Sh NAME
@@ -142,6 +142,79 @@ This can be used to multiplex the input 
 stream.
 This is useful for reconstructing the traffic for network taps
 that transmit the RX/TX signals out through two separate interfaces.
+.Sh IPV6 SUPPORT
+.Nm
+supports the
+.Li AF_INET6
+address family on bridge interfaces.
+The following
+.Xr rc.conf 5
+variable configures an IPv6 link-local address on
+.Li bridge0
+interface: 
+.Bd -literal -offset indent
+ifconfig_bridge0_ipv6="up"
+.Ed
+.Pp
+or in a more explicit manner:
+.Bd -literal -offset indent
+ifconfig_bridge0_ipv6="inet6 auto_linklocal"
+.Ed
+.Pp
+However, the
+.Li AF_INET6
+address family has a concept of scope zone.
+Bridging multiple interfaces change the zone configuration because
+multiple links are merged to each other and form a new single link
+while the member interfaces still work individually.
+This means each member interface still has a separate link-local scope
+zone and the
+.Nm
+interface has another single,
+aggregated link-local scope zone at the same time.
+This situation is clearly against the description
+.Qq zones of the same scope cannot overlap
+in Section 5,
+RFC 4007.
+Although it works in most cases,
+it can cause some conterintuitive or undesirable behavior in some
+edge cases when both of the
+.Nm
+interface and one of the member interface have an IPv6 address
+and applications use both of them.
+.Pp
+To prevent this situation,
+.Nm
+checks whether an link-local scoped IPv6 address is configured on
+a member interface to be added and the 
+.Nm
+interface.
+When the
+.Nm
+interface has IPv6 addresses,
+IPv6 addresses on the member interface will be automatically removed
+before the interface is added.
+When both
+.Nm
+interface and the existing member interfaces do not have one,
+adding an interface with IPv6 addresses as a new member interface is allowed.
+These means only one interface in the link-local scope zone where the
+.Nm
+interface forms can have link-local scoped IPv6 addresses.
+.Pp
+Note that
+.Li ACCEPT_RTADV
+and
+.Li AUTO_LINKLOCAL
+interface flag are not enabled by default on
+.Nm
+interface even when
+.Va net.inet6.ip6.accept_rtadv
+and/or
+.Va net.inet6.ip6.auto_linklocal
+is set to
+.Li 1 .
+.Ed
 .Sh SPANNING TREE
 The
 .Nm
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2013-07-09 Thread Hiroki Sato
Author: hrs
Date: Tue Jul  9 07:57:10 2013
New Revision: 253061
URL: http://svnweb.freebsd.org/changeset/base/253061

Log:
  Remove $swapfile and $geli_swap_flags.

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

Modified: head/share/man/man5/rc.conf.5
==
--- head/share/man/man5/rc.conf.5   Tue Jul  9 07:55:47 2013
(r253060)
+++ head/share/man/man5/rc.conf.5   Tue Jul  9 07:57:10 2013
(r253061)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 25, 2013
+.Dd July 9, 2013
 .Dt RC.CONF 5
 .Os
 .Sh NAME
@@ -161,12 +161,6 @@ Setting this option will bypass that che
 always test whether or not the service is actually running.
 Enabling this option is likely to increase your boot time if
 services are enabled that utilize the force_depend check.
-.It Va swapfile
-.Pq Vt str
-If set to
-.Dq Li NO ,
-no swapfile is installed, otherwise the value is used as the full
-pathname to a file to use for additional swap space.
 .It Ao Ar name Ac Ns Va _chroot
 .Pq Vt str
 .Xr chroot
@@ -1890,12 +1884,6 @@ Default is
 This can be changed for every device separately by defining
 .Va geli_ Ns Ao Ar device Ac Ns Va _autodetach
 variable.
-.It Va geli_swap_flags
-Options passed to the
-.Xr geli 8
-utility when encrypted GEOM providers for swap partitions are created.
-The default is
-.Dq Li "-e aes -l 256 -s 4096 -d" .
 .It Va root_rw_mount
 .Pq Vt bool
 Set to
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253066 - head/lib/libc/net

2013-07-09 Thread Hiroki Sato
Author: hrs
Date: Tue Jul  9 08:23:43 2013
New Revision: 253066
URL: http://svnweb.freebsd.org/changeset/base/253066

Log:
  Update references.

Modified:
  head/lib/libc/net/getaddrinfo.3
  head/lib/libc/net/getnameinfo.3

Modified: head/lib/libc/net/getaddrinfo.3
==
--- head/lib/libc/net/getaddrinfo.3 Tue Jul  9 08:17:43 2013
(r253065)
+++ head/lib/libc/net/getaddrinfo.3 Tue Jul  9 08:23:43 2013
(r253066)
@@ -255,7 +255,7 @@ member points to a filled-in socket addr
 This implementation of
 .Fn getaddrinfo
 allows numeric IPv6 address notation with scope identifier,
-as documented in chapter 11 of draft-ietf-ipv6-scoping-arch-02.txt.
+as documented in chapter 11 of RFC 4007.
 By appending the percent character and scope identifier to addresses,
 one can fill the
 .Li sin6_scope_id
@@ -441,9 +441,8 @@ freeaddrinfo(res0);
 .%A E. Nordmark
 .%A B. Zill
 .%T "IPv6 Scoped Address Architecture"
-.%R internet draft
-.%N draft-ietf-ipv6-scoping-arch-02.txt
-.%O work in progress material
+.%R RFC 4007
+.%D March 2005
 .Re
 .Rs
 .%A Craig Metz

Modified: head/lib/libc/net/getnameinfo.3
==
--- head/lib/libc/net/getnameinfo.3 Tue Jul  9 08:17:43 2013
(r253065)
+++ head/lib/libc/net/getnameinfo.3 Tue Jul  9 08:23:43 2013
(r253066)
@@ -191,10 +191,11 @@ printf("host=%s\en", hbuf);
 .%A R. Gilligan
 .%A S. Thomson
 .%A J. Bound
+.%A J. McCann
 .%A W. Stevens
 .%T Basic Socket Interface Extensions for IPv6
-.%R RFC 2553
-.%D March 1999
+.%R RFC 3493
+.%D February 2003
 .Re
 .Rs
 .%A S. Deering
@@ -203,9 +204,8 @@ printf("host=%s\en", hbuf);
 .%A E. Nordmark
 .%A B. Zill
 .%T "IPv6 Scoped Address Architecture"
-.%R internet draft
-.%N draft-ietf-ipv6-scoping-arch-02.txt
-.%O work in progress material
+.%R RFC 4007
+.%D March 2005
 .Re
 .Rs
 .%A Craig Metz
@@ -217,9 +217,9 @@ printf("host=%s\en", hbuf);
 The
 .Fn getnameinfo
 function is defined by the
-.St -p1003.1g-2000
-draft specification and documented in
-.Tn "RFC 2553" ,
+.St -p1003.1-2004
+specification and documented in
+.Tn "RFC 3493" ,
 .Dq Basic Socket Interface Extensions for IPv6 .
 .Sh CAVEATS
 .Fn getnameinfo
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253067 - head/tools/tools/zfsboottest

2013-07-09 Thread Andriy Gapon
Author: avg
Date: Tue Jul  9 08:29:14 2013
New Revision: 253067
URL: http://svnweb.freebsd.org/changeset/base/253067

Log:
  zfsboottest: sync with changes in zfs boot code
  
  - spa status can not be called before spa init
  - libzfs.h inclusion is now required
  - fix alternative code for explicit root dataset lookup
  
  MFC after:10 days

Modified:
  head/tools/tools/zfsboottest/zfsboottest.c

Modified: head/tools/tools/zfsboottest/zfsboottest.c
==
--- head/tools/tools/zfsboottest/zfsboottest.c  Tue Jul  9 08:23:43 2013
(r253066)
+++ head/tools/tools/zfsboottest/zfsboottest.c  Tue Jul  9 08:29:14 2013
(r253067)
@@ -52,6 +52,7 @@ pager_output(const char *line)
 
 #define ZFS_TEST
 #defineprintf(...)  fprintf(stderr, __VA_ARGS__)
+#include "libzfs.h"
 #include "zfsimpl.c"
 #undef printf
 
@@ -134,7 +135,6 @@ main(int argc, char** argv)
close(fd[i - 1]);
}
}
-   spa_all_status();
 
spa = STAILQ_FIRST(&zfs_pools);
if (spa == NULL) {
@@ -147,7 +147,10 @@ main(int argc, char** argv)
exit(1);
}
 
+   spa_all_status();
+
 #if 0
+   uint64_t rootobj;
if (zfs_get_root(spa, &rootobj)) {
fprintf(stderr, "can't get root\n");
exit(1);
@@ -158,8 +161,8 @@ main(int argc, char** argv)
if (zfs_mount(spa, 0, &zfsmnt)) {
fprintf(stderr, "can't mount\n");
exit(1);
-   }
 #endif
+   }
 
printf("\n");
for (++i, failures = 0; i < argc; i++) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253068 - head/tools/tools/zfsboottest

2013-07-09 Thread Andriy Gapon
Author: avg
Date: Tue Jul  9 08:30:31 2013
New Revision: 253068
URL: http://svnweb.freebsd.org/changeset/base/253068

Log:
  zfsboottest.sh: remove checks for things that are not strictly required
  
  MFC after:10 days

Modified:
  head/tools/tools/zfsboottest/zfsboottest.sh

Modified: head/tools/tools/zfsboottest/zfsboottest.sh
==
--- head/tools/tools/zfsboottest/zfsboottest.sh Tue Jul  9 08:29:14 2013
(r253067)
+++ head/tools/tools/zfsboottest/zfsboottest.sh Tue Jul  9 08:30:31 2013
(r253068)
@@ -54,11 +54,6 @@ bootfs=`zpool get bootfs "${pool}" | tai
 if [ "${bootfs}" = "-" ]; then
bootfs="${pool}"
 fi
-# Dataset's mountpoint property should be set to 'legacy'.
-if [ "`zfs get -H -o value mountpoint ${bootfs}`" != "legacy" ]; then
-   echo "The \"mountpoint\" property of dataset \"${bootfs}\" should be 
set to \"legacy\"." >&2
-   exit 1
-fi
 mountpoint=`df -t zfs "${bootfs}" 2>/dev/null | tail -1 | awk '{print $6}'`
 if [ -z "${mountpoint}" ]; then
echo "The \"${bootfs}\" dataset is not mounted." >&2
@@ -68,19 +63,6 @@ if [ ! -d "${mountpoint}${startdir}" ]; 
echo "The \"${mountpoint}${startdir}\" directory doesn't exist." >&2
exit 1
 fi
-# To be able to mount root ZFS file system we need either /etc/fstab entry
-# or vfs.root.mountfrom variable set in /boot/loader.conf.
-egrep -q '^'"${bootfs}"'[[:space:]]+/[[:space:]]+zfs[[:space:]]+' 
"${mountpoint}/etc/fstab" 2>/dev/null
-if [ $? -ne 0 ]; then
-   egrep -q 'vfs.root.mountfrom="?'"zfs:${bootfs}"'"?[[:space:]]*$' 
"${mountpoint}/boot/loader.conf" 2>/dev/null
-   if [ $? -ne 0 ]; then
-   echo "To be able to boot from \"${bootfs}\", you need to 
declare" >&2
-   echo "\"${bootfs}\" as being root file system in 
${mountpoint}/etc/fstab" >&2
-   echo "or add \"vfs.root.mountfrom\" variable set to 
\"zfs:${bootfs}\" to" >&2
-   echo "${mountpoint}/boot/loader.conf." >&2
-   exit 1
-   fi
-fi
 vdevs=""
 for vdev in `zpool status "${pool}" | grep ONLINE | awk '{print $1}'`; do
vdev="/dev/${vdev#/dev/}"
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253069 - head/sys/dev/ahci

2013-07-09 Thread Alexander Motin
Author: mav
Date: Tue Jul  9 08:32:17 2013
New Revision: 253069
URL: http://svnweb.freebsd.org/changeset/base/253069

Log:
  Add one more ID of Marvell SATA controller.
  
  Submitted by: marck
  MFC after:3 days

Modified:
  head/sys/dev/ahci/ahci.c

Modified: head/sys/dev/ahci/ahci.c
==
--- head/sys/dev/ahci/ahci.cTue Jul  9 08:30:31 2013(r253068)
+++ head/sys/dev/ahci/ahci.cTue Jul  9 08:32:17 2013(r253069)
@@ -228,6 +228,7 @@ static struct {
{0x91301b4b, 0x00, "Marvell 88SE9130",  AHCI_Q_NOBSYRES|AHCI_Q_ALTSIG},
{0x91721b4b, 0x00, "Marvell 88SE9172",  AHCI_Q_NOBSYRES},
{0x91821b4b, 0x00, "Marvell 88SE9182",  AHCI_Q_NOBSYRES},
+   {0x91a01b4b, 0x00, "Marvell 88SE91Ax",  AHCI_Q_NOBSYRES},
{0x92201b4b, 0x00, "Marvell 88SE9220",  AHCI_Q_NOBSYRES|AHCI_Q_ALTSIG},
{0x92301b4b, 0x00, "Marvell 88SE9230",  AHCI_Q_NOBSYRES|AHCI_Q_ALTSIG},
{0x92351b4b, 0x00, "Marvell 88SE9235",  AHCI_Q_NOBSYRES},
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r253069 - head/sys/dev/ahci

2013-07-09 Thread Dmitry Morozovsky
On Tue, 9 Jul 2013, Alexander Motin wrote:

> Author: mav
> Date: Tue Jul  9 08:32:17 2013
> New Revision: 253069
> URL: http://svnweb.freebsd.org/changeset/base/253069
> 
> Log:
>   Add one more ID of Marvell SATA controller.
>   
>   Submitted by:   marck
>   MFC after:  3 days

Thanks a lot for lightning-fast commit! ;)

-- 
Sincerely,
D.Marck [DM5020, MCK-RIPE, DM3-RIPN]
[ FreeBSD committer: ma...@freebsd.org ]

*** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- ma...@rinet.ru ***

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


svn commit: r253070 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2013-07-09 Thread Andriy Gapon
Author: avg
Date: Tue Jul  9 08:37:42 2013
New Revision: 253070
URL: http://svnweb.freebsd.org/changeset/base/253070

Log:
  zfs: load zpool.cache after a root fs is mounted
  
  MFC after:3 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c  Tue Jul 
 9 08:32:17 2013(r253069)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c  Tue Jul 
 9 08:37:42 2013(r253070)
@@ -1697,6 +1697,10 @@ spa_boot_init()
spa_config_load();
 }
 
+#ifdef _KERNEL
+EVENTHANDLER_DEFINE(mountroot, spa_boot_init, NULL, 0);
+#endif
+
 void
 spa_init(int mode)
 {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253071 - head/sys/boot/forth

2013-07-09 Thread Andriy Gapon
Author: avg
Date: Tue Jul  9 08:40:05 2013
New Revision: 253071
URL: http://svnweb.freebsd.org/changeset/base/253071

Log:
  default loader.conf: there is no need to load zpool.cache now
  
  kernel does not need it for importing a root pool.
  
  MFC after:4 weeks

Modified:
  head/sys/boot/forth/loader.conf

Modified: head/sys/boot/forth/loader.conf
==
--- head/sys/boot/forth/loader.conf Tue Jul  9 08:37:42 2013
(r253070)
+++ head/sys/boot/forth/loader.conf Tue Jul  9 08:40:05 2013
(r253071)
@@ -518,11 +518,3 @@ mac_seeotheruids_load="NO" # UID visbili
 #module_before="cmd"   # executes "cmd" before loading the module
 #module_after="cmd"# executes "cmd" after loading the module
 #module_error="cmd"# executes "cmd" if load fails
-
-##
-###  Always try to load ZFS pool cache file  #
-##
-
-zpool_cache_load="YES"
-zpool_cache_type="/boot/zfs/zpool.cache"
-zpool_cache_name="/boot/zfs/zpool.cache"
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253072 - head/sys/conf

2013-07-09 Thread Andriy Gapon
Author: avg
Date: Tue Jul  9 08:42:02 2013
New Revision: 253072
URL: http://svnweb.freebsd.org/changeset/base/253072

Log:
  amd64: use -mno-omit-leaf-frame-pointer in addition to -fno-omit-frame-pointer
  
  ... in kernel builds.  This is to make behavior of clang consistent with
  behavior of gcc.
  
  MFC after:2 weeks

Modified:
  head/sys/conf/Makefile.amd64
  head/sys/conf/kmod.mk

Modified: head/sys/conf/Makefile.amd64
==
--- head/sys/conf/Makefile.amd64Tue Jul  9 08:40:05 2013
(r253071)
+++ head/sys/conf/Makefile.amd64Tue Jul  9 08:42:02 2013
(r253072)
@@ -34,7 +34,7 @@ S=../../..
 INCLUDES+= -I$S/contrib/libfdt
 
 .if !empty(DDB_ENABLED) || !empty(DTR_ENABLED) || !empty(HWPMC_ENABLED)
-CFLAGS+=   -fno-omit-frame-pointer
+CFLAGS+=   -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
 .endif
 
 MKMODULESENV+= MACHINE=amd64

Modified: head/sys/conf/kmod.mk
==
--- head/sys/conf/kmod.mk   Tue Jul  9 08:40:05 2013(r253071)
+++ head/sys/conf/kmod.mk   Tue Jul  9 08:42:02 2013(r253072)
@@ -122,7 +122,7 @@ LDFLAGS+=   -d -warn-common
 
 CFLAGS+=   ${DEBUG_FLAGS}
 .if ${MACHINE_CPUARCH} == amd64
-CFLAGS+=   -fno-omit-frame-pointer
+CFLAGS+=   -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
 .endif
 
 .if ${MACHINE_CPUARCH} == powerpc
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253073 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2013-07-09 Thread Andriy Gapon
Author: avg
Date: Tue Jul  9 08:47:11 2013
New Revision: 253073
URL: http://svnweb.freebsd.org/changeset/base/253073

Log:
  zfs: try to properly handle i/o errors in mappedread_sf
  
  Unconditionally freeing a page is not good, especially if it is the page
  that was wired by the caller.  The checks are picked up from
  kern_sendfile.
  
  MFC after:3 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Jul 
 9 08:42:02 2013(r253072)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Jul 
 9 08:47:11 2013(r253073)
@@ -546,7 +546,9 @@ mappedread_sf(vnode_t *vp, int nbytes, u
vm_page_io_finish(pp);
vm_page_lock(pp);
if (error) {
-   vm_page_free(pp);
+   if (pp->wire_count == 0 && pp->valid == 0 &&
+   pp->busy == 0 && !(pp->oflags & VPO_BUSY))
+   vm_page_free(pp);
} else {
pp->valid = VM_PAGE_BITS_ALL;
vm_page_activate(pp);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253074 - head/sys/dev/ahci

2013-07-09 Thread Alexander Motin
Author: mav
Date: Tue Jul  9 08:49:17 2013
New Revision: 253074
URL: http://svnweb.freebsd.org/changeset/base/253074

Log:
  Add ID for Marvell 88SE9215 AHCI SATA controller.
  
  MFC after:3 days

Modified:
  head/sys/dev/ahci/ahci.c

Modified: head/sys/dev/ahci/ahci.c
==
--- head/sys/dev/ahci/ahci.cTue Jul  9 08:47:11 2013(r253073)
+++ head/sys/dev/ahci/ahci.cTue Jul  9 08:49:17 2013(r253074)
@@ -229,6 +229,7 @@ static struct {
{0x91721b4b, 0x00, "Marvell 88SE9172",  AHCI_Q_NOBSYRES},
{0x91821b4b, 0x00, "Marvell 88SE9182",  AHCI_Q_NOBSYRES},
{0x91a01b4b, 0x00, "Marvell 88SE91Ax",  AHCI_Q_NOBSYRES},
+   {0x92151b4b, 0x00, "Marvell 88SE9215",  AHCI_Q_NOBSYRES},
{0x92201b4b, 0x00, "Marvell 88SE9220",  AHCI_Q_NOBSYRES|AHCI_Q_ALTSIG},
{0x92301b4b, 0x00, "Marvell 88SE9230",  AHCI_Q_NOBSYRES|AHCI_Q_ALTSIG},
{0x92351b4b, 0x00, "Marvell 88SE9235",  AHCI_Q_NOBSYRES},
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r253002 - head

2013-07-09 Thread Dmitry Morozovsky
On Mon, 8 Jul 2013, Garance A Drosehn wrote:

> I think it's probably helpful to point out the -j flag, but I'm
> not sure I would phrase it as if we're sure that the values here
> are the ideal ones.  I expect the ideal values depend too much on
> hardware (e.g.: the CPU, type of disk used, and amount of memory
> on the machine).

Just a quick note on the last sentense: building world with clang on core2Q 
with 8 gigs of RAM with even -j4 starts intense swapping, especially if using 
ZFS...


-- 
Sincerely,
D.Marck [DM5020, MCK-RIPE, DM3-RIPN]
[ FreeBSD committer: ma...@freebsd.org ]

*** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- ma...@rinet.ru ***

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


svn commit: r253075 - head/sys/kern

2013-07-09 Thread Andriy Gapon
Author: avg
Date: Tue Jul  9 08:58:34 2013
New Revision: 253075
URL: http://svnweb.freebsd.org/changeset/base/253075

Log:
  namecache sdt: freebsd doesn't support structured characters yet
  
  :-)
  
  MFC after: 7 days

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Tue Jul  9 08:49:17 2013(r253074)
+++ head/sys/kern/vfs_cache.c   Tue Jul  9 08:58:34 2013(r253075)
@@ -68,10 +68,10 @@ SDT_PROBE_DEFINE2(vfs, namecache, enter_
 "char *");
 SDT_PROBE_DEFINE1(vfs, namecache, fullpath, entry, entry, "struct vnode *");
 SDT_PROBE_DEFINE3(vfs, namecache, fullpath, hit, hit, "struct vnode *",
-"struct char *", "struct vnode *");
+"char *", "struct vnode *");
 SDT_PROBE_DEFINE1(vfs, namecache, fullpath, miss, miss, "struct vnode *");
 SDT_PROBE_DEFINE3(vfs, namecache, fullpath, return, return, "int",
-"struct vnode *", "struct char *");
+"struct vnode *", "char *");
 SDT_PROBE_DEFINE3(vfs, namecache, lookup, hit, hit, "struct vnode *", "char *",
 "struct vnode *");
 SDT_PROBE_DEFINE2(vfs, namecache, lookup, hit_negative, hit-negative,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253076 - head/etc/rc.d

2013-07-09 Thread Andriy Gapon
Author: avg
Date: Tue Jul  9 08:59:39 2013
New Revision: 253076
URL: http://svnweb.freebsd.org/changeset/base/253076

Log:
  rc.d/zfs: pass -v option to zfs mount
  
  this should make boot process more informative (and entertaining)
  on systems with lots of zfs filesystems.
  
  MFC after:7 days

Modified:
  head/etc/rc.d/zfs

Modified: head/etc/rc.d/zfs
==
--- head/etc/rc.d/zfs   Tue Jul  9 08:58:34 2013(r253075)
+++ head/etc/rc.d/zfs   Tue Jul  9 08:59:39 2013(r253076)
@@ -23,7 +23,7 @@ zfs_start_jail()
 
 zfs_start_main()
 {
-   zfs mount -a
+   zfs mount -va
zfs share -a
if [ ! -r /etc/zfs/exports ]; then
touch /etc/zfs/exports
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253077 - head/sys/kern

2013-07-09 Thread Andriy Gapon
Author: avg
Date: Tue Jul  9 09:01:44 2013
New Revision: 253077
URL: http://svnweb.freebsd.org/changeset/base/253077

Log:
  should_yield: protect from td_swvoltick being uninitialized or too stale
  
  The distance between ticks and td_swvoltick should be calculated as
  an unsigned number.  Previously we could end up comparing a negative
  number with hogticks in which case should_yield() would give incorrect
  answer.
  
  We should probably ensure that td_swvoltick is properly initialized.
  
  Sponsored by: HybridCluster
  MFC after:5 days

Modified:
  head/sys/kern/kern_synch.c

Modified: head/sys/kern/kern_synch.c
==
--- head/sys/kern/kern_synch.c  Tue Jul  9 08:59:39 2013(r253076)
+++ head/sys/kern/kern_synch.c  Tue Jul  9 09:01:44 2013(r253077)
@@ -581,7 +581,7 @@ int
 should_yield(void)
 {
 
-   return (ticks - curthread->td_swvoltick >= hogticks);
+   return ((unsigned int)(ticks - curthread->td_swvoltick) >= hogticks);
 }
 
 void
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253078 - head/sys/security/audit

2013-07-09 Thread Andriy Gapon
Author: avg
Date: Tue Jul  9 09:03:01 2013
New Revision: 253078
URL: http://svnweb.freebsd.org/changeset/base/253078

Log:
  audit_proc_coredump: check return value of audit_new
  
  audit_new may return NULL if audit is disabled or suspended.
  
  Sponsored by: HybridCluster
  MFC after:7 days

Modified:
  head/sys/security/audit/audit.c

Modified: head/sys/security/audit/audit.c
==
--- head/sys/security/audit/audit.c Tue Jul  9 09:01:44 2013
(r253077)
+++ head/sys/security/audit/audit.c Tue Jul  9 09:03:01 2013
(r253078)
@@ -701,6 +701,8 @@ audit_proc_coredump(struct thread *td, c
 * (signal) tokens.
 */
ar = audit_new(AUE_CORE, td);
+   if (ar == NULL)
+   return;
if (path != NULL) {
pathp = &ar->k_ar.ar_arg_upath1;
*pathp = malloc(MAXPATHLEN, M_AUDITPATH, M_WAITOK);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253079 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace

2013-07-09 Thread Andriy Gapon
Author: avg
Date: Tue Jul  9 09:05:00 2013
New Revision: 253079
URL: http://svnweb.freebsd.org/changeset/base/253079

Log:
  dtrace/fasttrap: install hook functions only after all data is
  initialized
  
  Sponsored by: HybridCluster
  MFC after: 7 days

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c  Tue Jul 
 9 09:03:01 2013(r253078)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c  Tue Jul 
 9 09:05:00 2013(r253079)
@@ -2283,13 +2283,6 @@ fasttrap_load(void)
return (ret);
}
 
-   /*
-* Install our hooks into fork(2), exec(2), and exit(2).
-*/
-   dtrace_fasttrap_fork = &fasttrap_fork;
-   dtrace_fasttrap_exit = &fasttrap_exec_exit;
-   dtrace_fasttrap_exec = &fasttrap_exec_exit;
-
 #if defined(sun)
fasttrap_max = ddi_getprop(DDI_DEV_T_ANY, devi, DDI_PROP_DONTPASS,
"fasttrap-max-probes", FASTTRAP_MAX_DEFAULT);
@@ -2366,6 +2359,13 @@ fasttrap_load(void)
}
 #endif
 
+   /*
+* Install our hooks into fork(2), exec(2), and exit(2).
+*/
+   dtrace_fasttrap_fork = &fasttrap_fork;
+   dtrace_fasttrap_exit = &fasttrap_exec_exit;
+   dtrace_fasttrap_exec = &fasttrap_exec_exit;
+
(void) dtrace_meta_register("fasttrap", &fasttrap_mops, NULL,
&fasttrap_meta_id);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253081 - in head: sys/net sys/netinet sys/netinet6 sys/netipsec tools/tools/crypto usr.bin/netstat

2013-07-09 Thread Andrey V. Elsukov
Author: ae
Date: Tue Jul  9 09:32:06 2013
New Revision: 253081
URL: http://svnweb.freebsd.org/changeset/base/253081

Log:
  Prepare network statistics structures for migration to PCPU counters.
  Use uint64_t as type for all fields of structures.
  
  Changed structures: ahstat, arpstat, espstat, icmp6_ifstat, icmp6stat,
  in6_ifstat, ip6stat, ipcompstat, ipipstat, ipsecstat, mrt6stat, mrtstat,
  pfkeystat, pim6stat, pimstat, rip6stat, udpstat.
  
  Discussed with:   arch@

Modified:
  head/sys/net/if_arp.h
  head/sys/netinet/icmp6.h
  head/sys/netinet/ip_mroute.h
  head/sys/netinet/pim_var.h
  head/sys/netinet/udp_var.h
  head/sys/netinet6/in6_var.h
  head/sys/netinet6/ip6_mroute.h
  head/sys/netinet6/ip6_var.h
  head/sys/netinet6/pim6_var.h
  head/sys/netinet6/raw_ip6.h
  head/sys/netipsec/ah_var.h
  head/sys/netipsec/esp_var.h
  head/sys/netipsec/ipcomp_var.h
  head/sys/netipsec/ipip_var.h
  head/sys/netipsec/ipsec.h
  head/sys/netipsec/keysock.h
  head/sys/netipsec/xform_ipcomp.c
  head/tools/tools/crypto/ipsecstats.c
  head/usr.bin/netstat/inet.c
  head/usr.bin/netstat/ipsec.c
  head/usr.bin/netstat/mroute.c

Modified: head/sys/net/if_arp.h
==
--- head/sys/net/if_arp.h   Tue Jul  9 09:31:26 2013(r253080)
+++ head/sys/net/if_arp.h   Tue Jul  9 09:32:06 2013(r253081)
@@ -113,18 +113,18 @@ structarpcom {
 
 struct arpstat {
/* Normal things that happen: */
-   u_long txrequests;  /* # of ARP requests sent by this host. */
-   u_long txreplies;   /* # of ARP replies sent by this host. */
-   u_long rxrequests;  /* # of ARP requests received by this host. */
-   u_long rxreplies;   /* # of ARP replies received by this host. */
-   u_long received;/* # of ARP packets received by this host. */
+   uint64_t txrequests;/* # of ARP requests sent by this host. */
+   uint64_t txreplies; /* # of ARP replies sent by this host. */
+   uint64_t rxrequests;/* # of ARP requests received by this host. */
+   uint64_t rxreplies; /* # of ARP replies received by this host. */
+   uint64_t received;  /* # of ARP packets received by this host. */
 
-   u_long arp_spares[4];   /* For either the upper or lower half. */
+   uint64_t arp_spares[4]; /* For either the upper or lower half. */
/* Abnormal event and error  counting: */
-   u_long dropped; /* # of packets dropped waiting for a reply. */
-   u_long timeouts;/* # of times with entries removed */
+   uint64_t dropped;   /* # of packets dropped waiting for a reply. */
+   uint64_t timeouts;  /* # of times with entries removed */
/* due to timeout. */
-   u_long dupips;  /* # of duplicate IPs detected. */
+   uint64_t dupips;/* # of duplicate IPs detected. */
 };
 
 /*

Modified: head/sys/netinet/icmp6.h
==
--- head/sys/netinet/icmp6.hTue Jul  9 09:31:26 2013(r253080)
+++ head/sys/netinet/icmp6.hTue Jul  9 09:32:06 2013(r253081)
@@ -555,39 +555,39 @@ do {  
\
  * of the internet control message protocol version 6.
  */
 struct icmp6errstat {
-   u_quad_t icp6errs_dst_unreach_noroute;
-   u_quad_t icp6errs_dst_unreach_admin;
-   u_quad_t icp6errs_dst_unreach_beyondscope;
-   u_quad_t icp6errs_dst_unreach_addr;
-   u_quad_t icp6errs_dst_unreach_noport;
-   u_quad_t icp6errs_packet_too_big;
-   u_quad_t icp6errs_time_exceed_transit;
-   u_quad_t icp6errs_time_exceed_reassembly;
-   u_quad_t icp6errs_paramprob_header;
-   u_quad_t icp6errs_paramprob_nextheader;
-   u_quad_t icp6errs_paramprob_option;
-   u_quad_t icp6errs_redirect; /* we regard redirect as an error here */
-   u_quad_t icp6errs_unknown;
+   uint64_t icp6errs_dst_unreach_noroute;
+   uint64_t icp6errs_dst_unreach_admin;
+   uint64_t icp6errs_dst_unreach_beyondscope;
+   uint64_t icp6errs_dst_unreach_addr;
+   uint64_t icp6errs_dst_unreach_noport;
+   uint64_t icp6errs_packet_too_big;
+   uint64_t icp6errs_time_exceed_transit;
+   uint64_t icp6errs_time_exceed_reassembly;
+   uint64_t icp6errs_paramprob_header;
+   uint64_t icp6errs_paramprob_nextheader;
+   uint64_t icp6errs_paramprob_option;
+   uint64_t icp6errs_redirect; /* we regard redirect as an error here */
+   uint64_t icp6errs_unknown;
 };
 
 struct icmp6stat {
 /* statistics related to icmp6 packets generated */
-   u_quad_t icp6s_error;   /* # of calls to icmp6_error */
-   u_quad_t icp6s_canterror;   /* no error 'cuz old was icmp */
-   u_quad_t icp6s_toofreq; /* no error 'cuz rate limitation */
-   u_quad_t icp6s_outhist[256];
+   uint64_t ic

svn commit: r253082 - in head/sys: net sys

2013-07-09 Thread Andrey V. Elsukov
Author: ae
Date: Tue Jul  9 09:37:21 2013
New Revision: 253082
URL: http://svnweb.freebsd.org/changeset/base/253082

Log:
  Add several macros to help migrate statistics structures to PCPU counters.

Modified:
  head/sys/net/vnet.h
  head/sys/sys/counter.h

Modified: head/sys/net/vnet.h
==
--- head/sys/net/vnet.h Tue Jul  9 09:32:06 2013(r253081)
+++ head/sys/net/vnet.h Tue Jul  9 09:37:21 2013(r253082)
@@ -85,6 +85,55 @@ struct vnet {
 
 #ifdef _KERNEL
 
+#defineVNET_PCPUSTAT_DECLARE(type, name)   \
+VNET_DECLARE(counter_u64_t, name[sizeof(type) / sizeof(uint64_t)])
+
+#defineVNET_PCPUSTAT_DEFINE(type, name)\
+VNET_DEFINE(counter_u64_t, name[sizeof(type) / sizeof(uint64_t)])
+
+#defineVNET_PCPUSTAT_ALLOC(name, wait) \
+COUNTER_ARRAY_ALLOC(VNET(name), \
+   sizeof(VNET(name)) / sizeof(counter_u64_t), (wait))
+
+#defineVNET_PCPUSTAT_FREE(name)\
+COUNTER_ARRAY_FREE(VNET(name), sizeof(VNET(name)) / sizeof(counter_u64_t))
+
+#defineVNET_PCPUSTAT_ADD(type, name, f, v) \
+counter_u64_add(VNET(name)[offsetof(type, f) / sizeof(uint64_t)], (v))
+
+#defineVNET_PCPUSTAT_SYSINIT(name) \
+static void\
+vnet_##name##_init(const void *unused) \
+{  \
+   VNET_PCPUSTAT_ALLOC(name, M_WAITOK);\
+}  \
+VNET_SYSINIT(vnet_ ## name ## _init, SI_SUB_PROTO_IFATTACHDOMAIN,  \
+SI_ORDER_ANY, vnet_ ## name ## _init, NULL)
+
+#defineVNET_PCPUSTAT_SYSUNINIT(name)   
\
+static void\
+vnet_##name##_uninit(const void *unused)   \
+{  \
+   VNET_PCPUSTAT_FREE(name);   \
+}  \
+VNET_SYSUNINIT(vnet_ ## name ## _uninit, SI_SUB_PROTO_IFATTACHDOMAIN,  \
+SI_ORDER_ANY, vnet_ ## name ## _uninit, NULL)
+
+#defineSYSCTL_VNET_PCPUSTAT(parent, nbr, name, type, array, desc)  
\
+static int \
+array##_sysctl(SYSCTL_HANDLER_ARGS)\
+{  \
+   type s; \
+   CTASSERT(sizeof(type) == sizeof(VNET(array)));  \
+   COUNTER_ARRAY_COPY(VNET(array), &s, sizeof(type) / sizeof(uint64_t));\
+   if (req->newptr)\
+   COUNTER_ARRAY_ZERO(VNET(array), \
+   sizeof(type) / sizeof(uint64_t));   \
+   return (SYSCTL_OUT(req, &s, sizeof(type))); \
+}  \
+SYSCTL_VNET_PROC(parent, nbr, name, CTLTYPE_OPAQUE | CTLFLAG_RW, NULL, \
+0, array ## _sysctl, "I", desc)
+
 #ifdef VIMAGE
 #include 
 #include   /* for struct thread */

Modified: head/sys/sys/counter.h
==
--- head/sys/sys/counter.h  Tue Jul  9 09:32:06 2013(r253081)
+++ head/sys/sys/counter.h  Tue Jul  9 09:37:21 2013(r253082)
@@ -39,4 +39,23 @@ void counter_u64_free(counter_u64_t);
 void   counter_u64_zero(counter_u64_t);
 uint64_t   counter_u64_fetch(counter_u64_t);
 
+#defineCOUNTER_ARRAY_ALLOC(a, n, wait) do {\
+   for (int i = 0; i < (n); i++)   \
+   (a)[i] = counter_u64_alloc(wait);   \
+} while (0)
+
+#defineCOUNTER_ARRAY_FREE(a, n)do {\
+   for (int i = 0; i < (n); i++)   \
+   counter_u64_free((a)[i]);   \
+} while (0)
+
+#defineCOUNTER_ARRAY_COPY(a, dstp, n)  do {\
+   for (int i = 0; i < (n); i++)   \
+   ((uint64_t *)(dstp))[i] = counter_u64_fetch((a)[i]);\
+} while (0)
+
+#defineCOUNTER_ARRAY_ZERO(a, n)do {\
+   for (int i = 0; i < (n); i++)   \
+   counter_u64_zero((a)[i]);   \
+} while (0)
 #endif /* ! __SYS_COUNTER_H__ */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253083 - in head: sys/netinet usr.bin/netstat

2013-07-09 Thread Andrey V. Elsukov
Author: ae
Date: Tue Jul  9 09:43:03 2013
New Revision: 253083
URL: http://svnweb.freebsd.org/changeset/base/253083

Log:
  Use new macros to implement ipstat and tcpstat using PCPU counters.
  Change interface of kread_counters() similar ot kread() in the netstat(1).

Modified:
  head/sys/netinet/ip_input.c
  head/sys/netinet/ip_var.h
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_var.h
  head/usr.bin/netstat/inet.c
  head/usr.bin/netstat/main.c
  head/usr.bin/netstat/netstat.h

Modified: head/sys/netinet/ip_input.c
==
--- head/sys/netinet/ip_input.c Tue Jul  9 09:37:21 2013(r253082)
+++ head/sys/netinet/ip_input.c Tue Jul  9 09:43:03 2013(r253083)
@@ -208,73 +208,17 @@ SYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, 
 static voidip_freef(struct ipqhead *, struct ipq *);
 
 /*
- * IP statistics are stored in struct ipstat_p, which is
- * an "array" of counter(9)s.  Although it isn't a real
- * array, we treat it as array to reduce code bloat.
+ * IP statistics are stored in the "array" of counter(9)s.
  */
-VNET_DEFINE(struct ipstat_p, ipstatp);
-
-static void
-vnet_ipstatp_init(const void *unused)
-{
-   counter_u64_t *c;
-   int i;
-
-   for (i = 0, c = (counter_u64_t *)&V_ipstatp;
-   i < sizeof(V_ipstatp) / sizeof(counter_u64_t);
-   i++, c++) {
-   *c = counter_u64_alloc(M_WAITOK);
-   counter_u64_zero(*c);
-   }
-}
-VNET_SYSINIT(vnet_ipstatp_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
-vnet_ipstatp_init, NULL);
+VNET_PCPUSTAT_DEFINE(struct ipstat, ipstat);
+VNET_PCPUSTAT_SYSINIT(ipstat);
+SYSCTL_VNET_PCPUSTAT(_net_inet_ip, IPCTL_STATS, stats, struct ipstat, ipstat,
+"IP statistics (struct ipstat, netinet/ip_var.h)");
 
 #ifdef VIMAGE
-static void
-vnet_ipstatp_uninit(const void *unused)
-{
-   counter_u64_t *c;
-   int i;
-
-   for (i = 0, c = (counter_u64_t *)&V_ipstatp;
-   i < sizeof(V_ipstatp) / sizeof(counter_u64_t);
-   i++, c++)
-   counter_u64_free(*c);
-}
-VNET_SYSUNINIT(vnet_ipstatp_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
-vnet_ipstatp_uninit, NULL);
+VNET_PCPUSTAT_SYSUNINIT(ipstat);
 #endif /* VIMAGE */
 
-static int
-ipstat_sysctl(SYSCTL_HANDLER_ARGS)
-{
-   struct ipstat ipstat;
-   counter_u64_t *c;
-   uint64_t *v;
-   int i;
-
-   for (i = 0, c = (counter_u64_t *)&V_ipstatp, v = (uint64_t *)&ipstat;
-   i < sizeof(V_ipstatp) / sizeof(counter_u64_t);
-   i++, c++, v++) {
-   *v = counter_u64_fetch(*c);
-   /*
-* Old interface allowed to rewrite 'struct ipstat', and
-* netstat(1) used it to zero the structure. To keep
-* compatibility with old netstat(1) we will zero out
-* statistics on every write attempt, however we no longer
-* support writing arbitrary fake values to the statistics.
-*/
-   if (req->newptr)
-   counter_u64_zero(*c);
-   }
-
-   return (SYSCTL_OUT(req, &ipstat, sizeof(ipstat)));
-}
-SYSCTL_VNET_PROC(_net_inet_ip, IPCTL_STATS, stats, CTLTYPE_OPAQUE | CTLFLAG_RW,
-NULL, 0, ipstat_sysctl, "I",
-"IP statistics (struct ipstat, netinet/ip_var.h)");
-
 /*
  * Kernel module interface for updating ipstat.  The argument is an index
  * into ipstat treated as an array.
@@ -283,14 +227,14 @@ void
 kmod_ipstat_inc(int statnum)
 {
 
-   counter_u64_add(*((counter_u64_t *)&V_ipstatp + statnum), 1);
+   counter_u64_add(VNET(ipstat)[statnum], 1);
 }
 
 void
 kmod_ipstat_dec(int statnum)
 {
 
-   counter_u64_add(*((counter_u64_t *)&V_ipstatp + statnum), -1);
+   counter_u64_add(VNET(ipstat)[statnum], -1);
 }
 
 static int

Modified: head/sys/netinet/ip_var.h
==
--- head/sys/netinet/ip_var.h   Tue Jul  9 09:37:21 2013(r253082)
+++ head/sys/netinet/ip_var.h   Tue Jul  9 09:43:03 2013(r253083)
@@ -133,46 +133,13 @@ structipstat {
 #include 
 #include 
 
-/* Should match 'struct ipstat' above. */
-struct ipstat_p {
-   counter_u64_t ips_total;
-   counter_u64_t ips_badsum;
-   counter_u64_t ips_tooshort;
-   counter_u64_t ips_toosmall;
-   counter_u64_t ips_badhlen;
-   counter_u64_t ips_badlen;
-   counter_u64_t ips_fragments;
-   counter_u64_t ips_fragdropped;
-   counter_u64_t ips_fragtimeout;
-   counter_u64_t ips_forward;
-   counter_u64_t ips_fastforward;
-   counter_u64_t ips_cantforward;
-   counter_u64_t ips_redirectsent;
-   counter_u64_t ips_noproto;
-   counter_u64_t ips_delivered;
-   counter_u64_t ips_localout;
-   counter_u64_t ips_odropped;
-   counter_u64_t ips_reassembled;
-   counter_u64_t ips_fragmented;
-   counter_u64_t ips_ofragments;
-   co

svn commit: r253084 - in head: sys/net sys/netinet usr.bin/netstat

2013-07-09 Thread Andrey V. Elsukov
Author: ae
Date: Tue Jul  9 09:50:15 2013
New Revision: 253084
URL: http://svnweb.freebsd.org/changeset/base/253084

Log:
  Migrate structs arpstat, icmpstat, mrtstat, pimstat and udpstat to PCPU
  counters.

Modified:
  head/sys/net/if_arp.h
  head/sys/netinet/icmp_var.h
  head/sys/netinet/if_ether.c
  head/sys/netinet/in.c
  head/sys/netinet/ip_icmp.c
  head/sys/netinet/ip_mroute.c
  head/sys/netinet/ip_mroute.h
  head/sys/netinet/pim_var.h
  head/sys/netinet/udp_usrreq.c
  head/sys/netinet/udp_var.h
  head/usr.bin/netstat/inet.c
  head/usr.bin/netstat/mroute.c

Modified: head/sys/net/if_arp.h
==
--- head/sys/net/if_arp.h   Tue Jul  9 09:43:03 2013(r253083)
+++ head/sys/net/if_arp.h   Tue Jul  9 09:50:15 2013(r253084)
@@ -127,13 +127,21 @@ struct arpstat {
uint64_t dupips;/* # of duplicate IPs detected. */
 };
 
+#ifdef _KERNEL
+#include 
+#include 
+
+VNET_PCPUSTAT_DECLARE(struct arpstat, arpstat);
 /*
  * In-kernel consumers can use these accessor macros directly to update
  * stats.
  */
-#defineARPSTAT_ADD(name, val)  V_arpstat.name += (val)
-#defineARPSTAT_SUB(name, val)  V_arpstat.name -= (val)
+#defineARPSTAT_ADD(name, val)  \
+VNET_PCPUSTAT_ADD(struct arpstat, arpstat, name, (val))
+#defineARPSTAT_SUB(name, val)  ARPSTAT_ADD(name, -(val))
 #defineARPSTAT_INC(name)   ARPSTAT_ADD(name, 1)
 #defineARPSTAT_DEC(name)   ARPSTAT_SUB(name, 1)
 
+#endif /* _KERNEL */
+
 #endif /* !_NET_IF_ARP_H_ */

Modified: head/sys/netinet/icmp_var.h
==
--- head/sys/netinet/icmp_var.h Tue Jul  9 09:43:03 2013(r253083)
+++ head/sys/netinet/icmp_var.h Tue Jul  9 09:50:15 2013(r253084)
@@ -58,11 +58,15 @@ struct  icmpstat {
 };
 
 #ifdef _KERNEL
+#include 
+
+VNET_PCPUSTAT_DECLARE(struct icmpstat, icmpstat);
 /*
  * In-kernel consumers can use these accessor macros directly to update
  * stats.
  */
-#defineICMPSTAT_ADD(name, val) V_icmpstat.name += (val)
+#defineICMPSTAT_ADD(name, val) \
+VNET_PCPUSTAT_ADD(struct icmpstat, icmpstat, name, (val))
 #defineICMPSTAT_INC(name)  ICMPSTAT_ADD(name, 1)
 
 /*
@@ -70,7 +74,7 @@ structicmpstat {
  */
 void   kmod_icmpstat_inc(int statnum);
 #defineKMOD_ICMPSTAT_INC(name) 
\
-   kmod_icmpstat_inc(offsetof(struct icmpstat, name) / sizeof(u_long))
+kmod_icmpstat_inc(offsetof(struct icmpstat, name) / sizeof(uint64_t))
 #endif
 
 /*
@@ -91,9 +95,6 @@ void  kmod_icmpstat_inc(int statnum);
 #ifdef _KERNEL
 SYSCTL_DECL(_net_inet_icmp);
 
-VNET_DECLARE(struct icmpstat, icmpstat);   /* icmp statistics. */
-#defineV_icmpstat  VNET(icmpstat)
-
 extern int badport_bandlim(int);
 #define BANDLIM_UNLIMITED -1
 #define BANDLIM_ICMP_UNREACH 0

Modified: head/sys/netinet/if_ether.c
==
--- head/sys/netinet/if_ether.c Tue Jul  9 09:43:03 2013(r253083)
+++ head/sys/netinet/if_ether.c Tue Jul  9 09:50:15 2013(r253084)
@@ -89,7 +89,12 @@ VNET_DEFINE(int, useloopback) = 1;   /* us
 static VNET_DEFINE(int, arp_proxyall) = 0;
 static VNET_DEFINE(int, arpt_down) = 20;   /* keep incomplete entries for
 * 20 seconds */
-VNET_DEFINE(struct arpstat, arpstat);  /* ARP statistics, see if_arp.h */
+VNET_PCPUSTAT_DEFINE(struct arpstat, arpstat);  /* ARP statistics, see 
if_arp.h */
+VNET_PCPUSTAT_SYSINIT(arpstat);
+
+#ifdef VIMAGE
+VNET_PCPUSTAT_SYSUNINIT(arpstat);
+#endif /* VIMAGE */
 
 static VNET_DEFINE(int, arp_maxhold) = 1;
 
@@ -97,7 +102,6 @@ static VNET_DEFINE(int, arp_maxhold) = 1
 #defineV_arpt_down VNET(arpt_down)
 #defineV_arp_maxtries  VNET(arp_maxtries)
 #defineV_arp_proxyall  VNET(arp_proxyall)
-#defineV_arpstat   VNET(arpstat)
 #defineV_arp_maxhold   VNET(arp_maxhold)
 
 SYSCTL_VNET_INT(_net_link_ether_inet, OID_AUTO, max_age, CTLFLAG_RW,
@@ -115,9 +119,8 @@ SYSCTL_VNET_INT(_net_link_ether_inet, OI
 SYSCTL_VNET_INT(_net_link_ether_inet, OID_AUTO, wait, CTLFLAG_RW,
&VNET_NAME(arpt_down), 0,
"Incomplete ARP entry lifetime in seconds");
-SYSCTL_VNET_STRUCT(_net_link_ether_arp, OID_AUTO, stats, CTLFLAG_RW,
-   &VNET_NAME(arpstat), arpstat,
-   "ARP statistics (struct arpstat, net/if_arp.h)");
+SYSCTL_VNET_PCPUSTAT(_net_link_ether_arp, OID_AUTO, stats, struct arpstat,
+arpstat, "ARP statistics (struct arpstat, net/if_arp.h)");
 SYSCTL_VNET_INT(_net_link_ether_inet, OID_AUTO, maxhold, CTLFLAG_RW,
&VNET_NAME(arp_maxhold), 0,
"Number of packets to hold per ARP entry");

Modified: head/sys/netinet/in.c
===

svn commit: r253085 - in head: sys/netinet sys/netinet6 usr.bin/netstat

2013-07-09 Thread Andrey V. Elsukov
Author: ae
Date: Tue Jul  9 09:54:54 2013
New Revision: 253085
URL: http://svnweb.freebsd.org/changeset/base/253085

Log:
  Migrate structs ip6stat, icmp6stat and rip6stat to PCPU counters.

Modified:
  head/sys/netinet/icmp6.h
  head/sys/netinet6/icmp6.c
  head/sys/netinet6/in6_proto.c
  head/sys/netinet6/in6_var.h
  head/sys/netinet6/ip6_input.c
  head/sys/netinet6/ip6_var.h
  head/sys/netinet6/raw_ip6.c
  head/sys/netinet6/raw_ip6.h
  head/usr.bin/netstat/inet6.c

Modified: head/sys/netinet/icmp6.h
==
--- head/sys/netinet/icmp6.hTue Jul  9 09:50:15 2013(r253084)
+++ head/sys/netinet/icmp6.hTue Jul  9 09:54:54 2013(r253085)
@@ -617,19 +617,23 @@ struct icmp6stat {
 };
 
 #ifdef _KERNEL
+#include 
+
+VNET_PCPUSTAT_DECLARE(struct icmp6stat, icmp6stat);
 /*
  * In-kernel consumers can use these accessor macros directly to update
  * stats.
  */
-#defineICMP6STAT_ADD(name, val)V_icmp6stat.name += (val)
+#defineICMP6STAT_ADD(name, val)\
+VNET_PCPUSTAT_ADD(struct icmp6stat, icmp6stat, name, (val))
 #defineICMP6STAT_INC(name) ICMP6STAT_ADD(name, 1)
 
 /*
  * Kernel module consumers must use this accessor macro.
  */
 void   kmod_icmp6stat_inc(int statnum);
-#defineKMOD_ICMP6STAT_INC(name)
\
-   kmod_icmp6stat_inc(offsetof(struct icmp6stat, name) / sizeof(u_quad_t))
+#defineKMOD_ICMP6STAT_INC(name)\
+kmod_icmp6stat_inc(offsetof(struct icmp6stat, name) / sizeof(uint64_t))
 #endif
 
 /*

Modified: head/sys/netinet6/icmp6.c
==
--- head/sys/netinet6/icmp6.c   Tue Jul  9 09:50:15 2013(r253084)
+++ head/sys/netinet6/icmp6.c   Tue Jul  9 09:54:54 2013(r253085)
@@ -114,7 +114,12 @@ __FBSDID("$FreeBSD$");
 
 extern struct domain inet6domain;
 
-VNET_DEFINE(struct icmp6stat, icmp6stat);
+VNET_PCPUSTAT_DEFINE(struct icmp6stat, icmp6stat);
+VNET_PCPUSTAT_SYSINIT(icmp6stat);
+
+#ifdef VIMAGE
+VNET_PCPUSTAT_SYSUNINIT(icmp6stat);
+#endif /* VIMAGE */
 
 VNET_DECLARE(struct inpcbinfo, ripcbinfo);
 VNET_DECLARE(struct inpcbhead, ripcb);
@@ -155,7 +160,7 @@ void
 kmod_icmp6stat_inc(int statnum)
 {
 
-   (*((u_quad_t *)&V_icmp6stat + statnum))++;
+   counter_u64_add(VNET(icmp6stat)[statnum], 1);
 }
 
 static void

Modified: head/sys/netinet6/in6_proto.c
==
--- head/sys/netinet6/in6_proto.c   Tue Jul  9 09:50:15 2013
(r253084)
+++ head/sys/netinet6/in6_proto.c   Tue Jul  9 09:54:54 2013
(r253085)
@@ -506,8 +506,8 @@ SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_
&VNET_NAME(ip6_sendredirects), 0, "");
 SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_DEFHLIM, hlim, CTLFLAG_RW,
&VNET_NAME(ip6_defhlim), 0, "");
-SYSCTL_VNET_STRUCT(_net_inet6_ip6, IPV6CTL_STATS, stats, CTLFLAG_RW,
-   &VNET_NAME(ip6stat), ip6stat, "");
+SYSCTL_VNET_PCPUSTAT(_net_inet6_ip6, IPV6CTL_STATS, stats, struct ip6stat,
+ip6stat, "IP6 statistics (struct ip6stat, netinet6/ip6_var.h)");
 SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGPACKETS, maxfragpackets,
CTLFLAG_RW, &VNET_NAME(ip6_maxfragpackets), 0, "");
 SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_ACCEPT_RTADV, accept_rtadv,
@@ -559,8 +559,9 @@ SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_
CTLFLAG_RW, &VNET_NAME(ip6_auto_linklocal), 0,
"Default value of per-interface flag for automatically adding an IPv6"
" link-local address to interfaces when attached");
-SYSCTL_VNET_STRUCT(_net_inet6_ip6, IPV6CTL_RIP6STATS, rip6stats, CTLFLAG_RW,
-   &VNET_NAME(rip6stat), rip6stat, "");
+SYSCTL_VNET_PCPUSTAT(_net_inet6_ip6, IPV6CTL_RIP6STATS, rip6stats,
+struct rip6stat, rip6stat,
+"Raw IP6 statistics (struct rip6stat, netinet6/raw_ip6.h)");
 SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_PREFER_TEMPADDR, prefer_tempaddr,
CTLFLAG_RW, &VNET_NAME(ip6_prefer_tempaddr), 0, "");
 SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_USE_DEFAULTZONE, use_defaultzone,
@@ -589,8 +590,9 @@ SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6
CTLFLAG_RW, &VNET_NAME(icmp6_rediraccept), 0, "");
 SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6CTL_REDIRTIMEOUT, redirtimeout,
CTLFLAG_RW, &VNET_NAME(icmp6_redirtimeout), 0, "");
-SYSCTL_VNET_STRUCT(_net_inet6_icmp6, ICMPV6CTL_STATS, stats, CTLFLAG_RW,
-   &VNET_NAME(icmp6stat), icmp6stat, "");
+SYSCTL_VNET_PCPUSTAT(_net_inet6_icmp6, ICMPV6CTL_STATS, stats,
+struct icmp6stat, icmp6stat,
+"ICMPv6 statistics (struct icmp6stat, netinet/icmp6.h)");
 SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_PRUNE, nd6_prune, CTLFLAG_RW,
&VNET_NAME(nd6_prune), 0, "");
 SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_DELAY, nd6_delay, CTLFLAG_RW,

Modified: head/sys/netinet6/in6_var.h
===

Re: svn commit: r253081 - in head: sys/net sys/netinet sys/netinet6 sys/netipsec tools/tools/crypto usr.bin/netstat

2013-07-09 Thread Andre Oppermann

On 09.07.2013 11:32, Andrey V. Elsukov wrote:

Author: ae
Date: Tue Jul  9 09:32:06 2013
New Revision: 253081
URL: http://svnweb.freebsd.org/changeset/base/253081

Log:
   Prepare network statistics structures for migration to PCPU counters.
   Use uint64_t as type for all fields of structures.


Yes!  Finally 64 bit counters! :)

--
Andre

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


svn commit: r253086 - in head/sys: netinet netinet6

2013-07-09 Thread Andrey V. Elsukov
Author: ae
Date: Tue Jul  9 09:59:46 2013
New Revision: 253086
URL: http://svnweb.freebsd.org/changeset/base/253086

Log:
  Migrate structs in6_ifstat and icmp6_ifstat to PCPU counters.

Modified:
  head/sys/netinet/icmp6.h
  head/sys/netinet6/in6.c
  head/sys/netinet6/in6_var.h

Modified: head/sys/netinet/icmp6.h
==
--- head/sys/netinet/icmp6.hTue Jul  9 09:54:54 2013(r253085)
+++ head/sys/netinet/icmp6.hTue Jul  9 09:59:46 2013(r253086)
@@ -692,7 +692,9 @@ voidicmp6_mtudisc_update(struct ip6ctlp
 #define icmp6_ifstat_inc(ifp, tag) \
 do {   \
if (ifp)\
-   ((struct in6_ifextra 
*)((ifp)->if_afdata[AF_INET6]))->icmp6_ifstat->tag++; \
+   counter_u64_add(((struct in6_ifextra *) \
+   ((ifp)->if_afdata[AF_INET6]))->icmp6_ifstat[\
+   offsetof(struct icmp6_ifstat, tag) / sizeof(uint64_t)], 1);\
 } while (/*CONSTCOND*/ 0)
 
 #define icmp6_ifoutstat_inc(ifp, type, code) \

Modified: head/sys/netinet6/in6.c
==
--- head/sys/netinet6/in6.c Tue Jul  9 09:54:54 2013(r253085)
+++ head/sys/netinet6/in6.c Tue Jul  9 09:59:46 2013(r253086)
@@ -570,10 +570,10 @@ in6_control(struct socket *so, u_long cm
error = EINVAL;
goto out;
}
-   bzero(&ifr->ifr_ifru.ifru_stat,
-   sizeof(ifr->ifr_ifru.ifru_stat));
-   ifr->ifr_ifru.ifru_stat =
-   *((struct in6_ifextra 
*)ifp->if_afdata[AF_INET6])->in6_ifstat;
+   COUNTER_ARRAY_COPY(((struct in6_ifextra *)
+   ifp->if_afdata[AF_INET6])->in6_ifstat,
+   &ifr->ifr_ifru.ifru_stat,
+   sizeof(struct in6_ifstat) / sizeof(uint64_t));
break;
 
case SIOCGIFSTAT_ICMP6:
@@ -581,10 +581,10 @@ in6_control(struct socket *so, u_long cm
error = EINVAL;
goto out;
}
-   bzero(&ifr->ifr_ifru.ifru_icmp6stat,
-   sizeof(ifr->ifr_ifru.ifru_icmp6stat));
-   ifr->ifr_ifru.ifru_icmp6stat =
-   *((struct in6_ifextra 
*)ifp->if_afdata[AF_INET6])->icmp6_ifstat;
+   COUNTER_ARRAY_COPY(((struct in6_ifextra *)
+   ifp->if_afdata[AF_INET6])->icmp6_ifstat,
+   &ifr->ifr_ifru.ifru_icmp6stat,
+   sizeof(struct icmp6_ifstat) / sizeof(uint64_t));
break;
 
case SIOCGIFALIFETIME_IN6:
@@ -2749,14 +2749,15 @@ in6_domifattach(struct ifnet *ifp)
ext = (struct in6_ifextra *)malloc(sizeof(*ext), M_IFADDR, M_WAITOK);
bzero(ext, sizeof(*ext));
 
-   ext->in6_ifstat = (struct in6_ifstat *)malloc(sizeof(struct in6_ifstat),
-   M_IFADDR, M_WAITOK);
-   bzero(ext->in6_ifstat, sizeof(*ext->in6_ifstat));
-
-   ext->icmp6_ifstat =
-   (struct icmp6_ifstat *)malloc(sizeof(struct icmp6_ifstat),
-   M_IFADDR, M_WAITOK);
-   bzero(ext->icmp6_ifstat, sizeof(*ext->icmp6_ifstat));
+   ext->in6_ifstat = malloc(sizeof(struct in6_ifstat), M_IFADDR,
+   M_WAITOK);
+   COUNTER_ARRAY_ALLOC(ext->in6_ifstat,
+   sizeof(struct in6_ifstat) / sizeof(uint64_t), M_WAITOK);
+
+   ext->icmp6_ifstat = malloc(sizeof(struct icmp6_ifstat), M_IFADDR,
+   M_WAITOK);
+   COUNTER_ARRAY_ALLOC(ext->icmp6_ifstat,
+   sizeof(struct icmp6_ifstat) / sizeof(uint64_t), M_WAITOK);
 
ext->nd_ifinfo = nd6_ifattach(ifp);
ext->scope6_id = scope6_ifattach(ifp);
@@ -2781,7 +2782,11 @@ in6_domifdetach(struct ifnet *ifp, void 
scope6_ifdetach(ext->scope6_id);
nd6_ifdetach(ext->nd_ifinfo);
lltable_free(ext->lltable);
+   COUNTER_ARRAY_FREE(ext->in6_ifstat,
+   sizeof(struct in6_ifstat) / sizeof(uint64_t));
free(ext->in6_ifstat, M_IFADDR);
+   COUNTER_ARRAY_FREE(ext->icmp6_ifstat,
+   sizeof(struct icmp6_ifstat) / sizeof(uint64_t));
free(ext->icmp6_ifstat, M_IFADDR);
free(ext, M_IFADDR);
 }

Modified: head/sys/netinet6/in6_var.h
==
--- head/sys/netinet6/in6_var.h Tue Jul  9 09:54:54 2013(r253085)
+++ head/sys/netinet6/in6_var.h Tue Jul  9 09:59:46 2013(r253086)
@@ -98,14 +98,28 @@ struct scope6_id;
 struct lltable;
 struct mld_ifinfo;
 
+#ifdef _KERNEL
+#include 
+
+struct in6_ifextra {
+   counter_u64_t *in6_ifstat;
+   counter_u64_t *icmp6_ifstat;
+   struct nd_ifinfo *nd_ifinfo;
+   struct scope6_id *scope6_id;
+   struct lltable *lltable;
+   struct mld_ifinfo *mld_ifinfo;
+};
+#else
+
 struct in6_i

svn commit: r253087 - in head: sys/netinet usr.bin/netstat

2013-07-09 Thread Andrey V. Elsukov
Author: ae
Date: Tue Jul  9 10:02:51 2013
New Revision: 253087
URL: http://svnweb.freebsd.org/changeset/base/253087

Log:
  Migrate struct carpstats to PCPU counters.

Modified:
  head/sys/netinet/ip_carp.c
  head/sys/netinet/ip_carp.h
  head/usr.bin/netstat/inet.c

Modified: head/sys/netinet/ip_carp.c
==
--- head/sys/netinet/ip_carp.c  Tue Jul  9 09:59:46 2013(r253086)
+++ head/sys/netinet/ip_carp.c  Tue Jul  9 10:02:51 2013(r253087)
@@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -209,9 +210,25 @@ SYSCTL_INT(_net_inet_carp, OID_AUTO, sen
 SYSCTL_INT(_net_inet_carp, OID_AUTO, ifdown_demotion_factor, CTLFLAG_RW,
 &carp_ifdown_adj, 0, "Interface down demotion factor adjustment");
 
-static struct carpstats carpstats;
-SYSCTL_STRUCT(_net_inet_carp, OID_AUTO, stats, CTLFLAG_RW, &carpstats,
-carpstats, "CARP statistics (struct carpstats, netinet/ip_carp.h)");
+static counter_u64_t carpstats[sizeof(struct carpstats) / sizeof(uint64_t)];
+#defineCARPSTATS_ADD(name, val)\
+counter_u64_add(carpstats[offsetof(struct carpstats, name) / \
+   sizeof(uint64_t)], (val))
+#defineCARPSTATS_INC(name) CARPSTATS_ADD(name, 1)
+
+static int
+carpstats_sysctl(SYSCTL_HANDLER_ARGS)
+{
+   struct carpstats s;
+
+   COUNTER_ARRAY_COPY(carpstats, &s, sizeof(s) / sizeof(uint64_t));
+   if (req->newptr)
+   COUNTER_ARRAY_ZERO(carpstats, sizeof(s) / sizeof(uint64_t));
+   return (SYSCTL_OUT(req, &s, sizeof(s)));
+}
+SYSCTL_PROC(_net_inet_carp, OID_AUTO, stats, CTLTYPE_OPAQUE | CTLFLAG_RW,
+NULL, 0, carpstats_sysctl, "I",
+"CARP statistics (struct carpstats, netinet/ip_carp.h)");
 
 #defineCARP_LOCK_INIT(sc)  mtx_init(&(sc)->sc_mtx, "carp_softc",   
\
NULL, MTX_DEF)
@@ -2084,6 +2101,8 @@ carp_mod_cleanup(void)
mtx_unlock(&carp_mtx);
taskqueue_drain(taskqueue_swi, &carp_sendall_task);
mtx_destroy(&carp_mtx);
+   COUNTER_ARRAY_FREE(carpstats,
+   sizeof(struct carpstats) / sizeof(uint64_t));
 }
 
 static int
@@ -2093,6 +2112,8 @@ carp_mod_load(void)
 
mtx_init(&carp_mtx, "carp_mtx", NULL, MTX_DEF);
LIST_INIT(&carp_list);
+   COUNTER_ARRAY_ALLOC(carpstats,
+   sizeof(struct carpstats) / sizeof(uint64_t), M_WAITOK);
carp_get_vhid_p = carp_get_vhid;
carp_forus_p = carp_forus;
carp_output_p = carp_output;

Modified: head/sys/netinet/ip_carp.h
==
--- head/sys/netinet/ip_carp.h  Tue Jul  9 09:59:46 2013(r253086)
+++ head/sys/netinet/ip_carp.h  Tue Jul  9 10:02:51 2013(r253087)
@@ -117,11 +117,6 @@ struct carpstats {
uint64_tcarps_preempt;  /* if enabled, preemptions */
 };
 
-#ifdef _KERNEL
-#defineCARPSTATS_ADD(name, val)carpstats.name += (val)
-#defineCARPSTATS_INC(name) CARPSTATS_ADD(name, 1)
-#endif
-
 /*
  * Configuration structure for SIOCSVH SIOCGVH
  */

Modified: head/usr.bin/netstat/inet.c
==
--- head/usr.bin/netstat/inet.c Tue Jul  9 09:59:46 2013(r253086)
+++ head/usr.bin/netstat/inet.c Tue Jul  9 10:02:51 2013(r253087)
@@ -811,7 +811,7 @@ carp_stats(u_long off, const char *name,
} else {
if (off == 0)
return;
-   kread(off, &carpstat, len);
+   kread_counters(off, &carpstat, len);
}
 
printf("%s:\n", name);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253088 - in head: sys/netipsec usr.bin/netstat

2013-07-09 Thread Andrey V. Elsukov
Author: ae
Date: Tue Jul  9 10:08:13 2013
New Revision: 253088
URL: http://svnweb.freebsd.org/changeset/base/253088

Log:
  Migrate structs ahstat, espstat, ipcompstat, ipipstat, pfkeystat,
  ipsec4stat, ipsec6stat to PCPU counters.

Modified:
  head/sys/netipsec/ah_var.h
  head/sys/netipsec/esp_var.h
  head/sys/netipsec/ipcomp_var.h
  head/sys/netipsec/ipip_var.h
  head/sys/netipsec/ipsec.c
  head/sys/netipsec/ipsec.h
  head/sys/netipsec/ipsec6.h
  head/sys/netipsec/keysock.c
  head/sys/netipsec/keysock.h
  head/sys/netipsec/xform_ah.c
  head/sys/netipsec/xform_esp.c
  head/sys/netipsec/xform_ipcomp.c
  head/sys/netipsec/xform_ipip.c
  head/usr.bin/netstat/ipsec.c
  head/usr.bin/netstat/pfkey.c

Modified: head/sys/netipsec/ah_var.h
==
--- head/sys/netipsec/ah_var.h  Tue Jul  9 10:02:51 2013(r253087)
+++ head/sys/netipsec/ah_var.h  Tue Jul  9 10:08:13 2013(r253088)
@@ -71,14 +71,16 @@ struct ahstat {
 };
 
 #ifdef _KERNEL
+#include 
+
 VNET_DECLARE(int, ah_enable);
 VNET_DECLARE(int, ah_cleartos);
-VNET_DECLARE(struct ahstat, ahstat);
+VNET_PCPUSTAT_DECLARE(struct ahstat, ahstat);
 
-#defineAHSTAT_ADD(name, val)   V_ahstat.name += (val)
+#defineAHSTAT_ADD(name, val)   \
+VNET_PCPUSTAT_ADD(struct ahstat, ahstat, name , (val))
 #defineAHSTAT_INC(name)AHSTAT_ADD(name, 1)
 #defineV_ah_enable VNET(ah_enable)
 #defineV_ah_cleartos   VNET(ah_cleartos)
-#defineV_ahstatVNET(ahstat)
 #endif /* _KERNEL */
 #endif /*_NETIPSEC_AH_VAR_H_*/

Modified: head/sys/netipsec/esp_var.h
==
--- head/sys/netipsec/esp_var.h Tue Jul  9 10:02:51 2013(r253087)
+++ head/sys/netipsec/esp_var.h Tue Jul  9 10:08:13 2013(r253088)
@@ -72,12 +72,14 @@ struct espstat {
 };
 
 #ifdef _KERNEL
+#include 
+
 VNET_DECLARE(int, esp_enable);
-VNET_DECLARE(struct espstat, espstat);
+VNET_PCPUSTAT_DECLARE(struct espstat, espstat);
 
-#defineESPSTAT_ADD(name, val)  V_espstat.name += (val)
+#defineESPSTAT_ADD(name, val)  \
+VNET_PCPUSTAT_ADD(struct espstat, espstat, name, (val))
 #defineESPSTAT_INC(name)   ESPSTAT_ADD(name, 1)
 #defineV_esp_enableVNET(esp_enable)
-#defineV_espstat   VNET(espstat)
 #endif /* _KERNEL */
 #endif /*_NETIPSEC_ESP_VAR_H_*/

Modified: head/sys/netipsec/ipcomp_var.h
==
--- head/sys/netipsec/ipcomp_var.h  Tue Jul  9 10:02:51 2013
(r253087)
+++ head/sys/netipsec/ipcomp_var.h  Tue Jul  9 10:08:13 2013
(r253088)
@@ -64,12 +64,14 @@ struct ipcompstat {
 };
 
 #ifdef _KERNEL
+#include 
+
 VNET_DECLARE(int, ipcomp_enable);
-VNET_DECLARE(struct ipcompstat, ipcompstat);
+VNET_PCPUSTAT_DECLARE(struct ipcompstat, ipcompstat);
 
-#defineIPCOMPSTAT_ADD(name, val)   V_ipcompstat.name += (val)
+#defineIPCOMPSTAT_ADD(name, val)   \
+VNET_PCPUSTAT_ADD(struct ipcompstat, ipcompstat, name, (val))
 #defineIPCOMPSTAT_INC(name)IPCOMPSTAT_ADD(name, 1)
 #defineV_ipcomp_enable VNET(ipcomp_enable)
-#defineV_ipcompstatVNET(ipcompstat)
 #endif /* _KERNEL */
 #endif /*_NETIPSEC_IPCOMP_VAR_H_*/

Modified: head/sys/netipsec/ipip_var.h
==
--- head/sys/netipsec/ipip_var.hTue Jul  9 10:02:51 2013
(r253087)
+++ head/sys/netipsec/ipip_var.hTue Jul  9 10:08:13 2013
(r253088)
@@ -58,12 +58,14 @@ struct ipipstat {
 };
 
 #ifdef _KERNEL
+#include 
+
 VNET_DECLARE(int, ipip_allow);
-VNET_DECLARE(struct ipipstat, ipipstat);
+VNET_PCPUSTAT_DECLARE(struct ipipstat, ipipstat);
 
-#defineIPIPSTAT_ADD(name, val) V_ipipstat.name += (val)
+#defineIPIPSTAT_ADD(name, val) \
+VNET_PCPUSTAT_ADD(struct ipipstat, ipipstat, name, (val))
 #defineIPIPSTAT_INC(name)  IPIPSTAT_ADD(name, 1)
 #defineV_ipip_allowVNET(ipip_allow)
-#defineV_ipipstat  VNET(ipipstat)
 #endif /* _KERNEL */
 #endif /* _NETINET_IPIP_H_ */

Modified: head/sys/netipsec/ipsec.c
==
--- head/sys/netipsec/ipsec.c   Tue Jul  9 10:02:51 2013(r253087)
+++ head/sys/netipsec/ipsec.c   Tue Jul  9 10:08:13 2013(r253088)
@@ -104,7 +104,13 @@ VNET_DEFINE(int, ipsec_debug) = 0;
 #endif
 
 /* NB: name changed so netstat doesn't use it. */
-VNET_DEFINE(struct ipsecstat, ipsec4stat);
+VNET_PCPUSTAT_DEFINE(struct ipsecstat, ipsec4stat);
+VNET_PCPUSTAT_SYSINIT(ipsec4stat);
+
+#ifdef VIMAGE
+VNET_PCPUSTAT_SYSUNINIT(ipsec4stat);
+#endif /* VIMAGE */
+
 VNET_DEFINE(int, ip4_ah_offsetmask) = 0;   /* maybe IP_DF? */
 /* DF bit on encap. 0: clear 1: set 2: co

svn commit: r253089 - in head: . sys/sys

2013-07-09 Thread Andrey V. Elsukov
Author: ae
Date: Tue Jul  9 10:20:27 2013
New Revision: 253089
URL: http://svnweb.freebsd.org/changeset/base/253089

Log:
  Bump __FreeBSD_version to reflect changes in statistics structures.

Modified:
  head/UPDATING
  head/sys/sys/param.h

Modified: head/UPDATING
==
--- head/UPDATING   Tue Jul  9 10:08:13 2013(r253088)
+++ head/UPDATING   Tue Jul  9 10:20:27 2013(r253089)
@@ -31,6 +31,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20130709:
+   Most of network statistics structures were changed to be able
+   keep 64-bits counters. Thus all tools, that work with networking
+   statistics, must be rebuilded (netstat(1), bsnmpd(1), etc.)
+
 20130629:
Fix targets that run multiple make's to use && rather than ;
so that subsequent steps depend on success of previous.

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hTue Jul  9 10:08:13 2013(r253088)
+++ head/sys/sys/param.hTue Jul  9 10:20:27 2013(r253089)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 136  /* Master, propagated to newvers */
+#define __FreeBSD_version 137  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253090 - head/sys/crypto/sha2

2013-07-09 Thread Robert Millan
Author: rmh
Date: Tue Jul  9 10:27:26 2013
New Revision: 253090
URL: http://svnweb.freebsd.org/changeset/base/253090

Log:
  Allow assert() to operate correctly when building userland code.

Modified:
  head/sys/crypto/sha2/sha2.c

Modified: head/sys/crypto/sha2/sha2.c
==
--- head/sys/crypto/sha2/sha2.c Tue Jul  9 10:20:27 2013(r253089)
+++ head/sys/crypto/sha2/sha2.c Tue Jul  9 10:27:26 2013(r253090)
@@ -67,8 +67,10 @@ __FBSDID("$FreeBSD$");
  *
  */
 
-#if defined(__bsdi__) || defined(__FreeBSD__)
+#if defined(_KERNEL) && (defined(__bsdi__) || defined(__FreeBSD__))
 #define assert(x)
+#else
+#include 
 #endif
 
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253091 - in head/sys/cam: ata scsi

2013-07-09 Thread Steven Hartland
Author: smh
Date: Tue Jul  9 10:41:17 2013
New Revision: 253091
URL: http://svnweb.freebsd.org/changeset/base/253091

Log:
  Added 4K QUIRK for OCZ Vertex 4 SSDs
  
  Submitted by: Borja Marcos 
  MFC after:2 days

Modified:
  head/sys/cam/ata/ata_da.c
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Tue Jul  9 10:27:26 2013(r253090)
+++ head/sys/cam/ata/ata_da.c   Tue Jul  9 10:41:17 2013(r253091)
@@ -396,6 +396,14 @@ static struct ada_quirk_entry ada_quirk_
},
{
/*
+* OCZ Vertex 4 SSDs
+* 4k optimised & trim only works in 4k requests + 4k aligned
+*/
+   { T_DIRECT, SIP_MEDIA_FIXED, "*", "OCZ-VERTEX4*", "*" },
+   /*quirks*/ADA_Q_4K
+   },
+   {
+   /*
 * Samsung 830 Series SSDs
 * 4k optimised
 */

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Tue Jul  9 10:27:26 2013(r253090)
+++ head/sys/cam/scsi/scsi_da.c Tue Jul  9 10:41:17 2013(r253091)
@@ -1031,6 +1031,14 @@ static struct da_quirk_entry da_quirk_ta
},
{
/*
+* OCZ Vertex 4 SSDs
+* 4k optimised & trim only works in 4k requests + 4k aligned
+*/
+   { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "OCZ-VERTEX4*", "*" },
+   /*quirks*/DA_Q_4K
+   },
+   {
+   /*
 * Samsung 830 Series SSDs
 * 4k optimised & trim only works in 4k requests + 4k aligned
 */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2013-07-09 Thread Joel Dahl
Author: joel (doc committer)
Date: Tue Jul  9 12:25:44 2013
New Revision: 253093
URL: http://svnweb.freebsd.org/changeset/base/253093

Log:
  Make mandoc lint happy.

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

Modified: head/share/man/man4/bridge.4
==
--- head/share/man/man4/bridge.4Tue Jul  9 11:00:10 2013
(r253092)
+++ head/share/man/man4/bridge.4Tue Jul  9 12:25:44 2013
(r253093)
@@ -151,7 +151,7 @@ The following
 .Xr rc.conf 5
 variable configures an IPv6 link-local address on
 .Li bridge0
-interface: 
+interface:
 .Bd -literal -offset indent
 ifconfig_bridge0_ipv6="up"
 .Ed
@@ -186,7 +186,7 @@ and applications use both of them.
 To prevent this situation,
 .Nm
 checks whether an link-local scoped IPv6 address is configured on
-a member interface to be added and the 
+a member interface to be added and the
 .Nm
 interface.
 When the
@@ -214,7 +214,6 @@ and/or
 .Va net.inet6.ip6.auto_linklocal
 is set to
 .Li 1 .
-.Ed
 .Sh SPANNING TREE
 The
 .Nm
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r253077 - head/sys/kern

2013-07-09 Thread Bruce Evans

On Tue, 9 Jul 2013, Andriy Gapon wrote:


Log:
 should_yield: protect from td_swvoltick being uninitialized or too stale

 The distance between ticks and td_swvoltick should be calculated as
 an unsigned number.  Previously we could end up comparing a negative
 number with hogticks in which case should_yield() would give incorrect
 answer.

 We should probably ensure that td_swvoltick is properly initialized.

 Sponsored by:  HybridCluster
 MFC after: 5 days

Modified:
 head/sys/kern/kern_synch.c

Modified: head/sys/kern/kern_synch.c
==
--- head/sys/kern/kern_synch.c  Tue Jul  9 08:59:39 2013(r253076)
+++ head/sys/kern/kern_synch.c  Tue Jul  9 09:01:44 2013(r253077)
@@ -581,7 +581,7 @@ int
should_yield(void)
{

-   return (ticks - curthread->td_swvoltick >= hogticks);
+   return ((unsigned int)(ticks - curthread->td_swvoltick) >= hogticks);
}


Hrmph.  Perhaps it should be calculated as an unsigned number, but
this calculates it as a signed number, with undefined behaviour if
overflow occurs, and then bogusly casts the signed number to unsigned.

It also has a style bug in the cast -- "unsigned int" is verbose, and
even "unsigned" is too long, so it is spelled "u_int" in the kernel.

Next, after the cast the operand types are mismatched, and compilers
could reasonably warn about the possible sign extension bugs from this.
Compilers do warn about the mismatch for "i < size_t(foo)" in loops.
This warning is so annoying and it is not normally produced when both
the operands are variables.  Many "fixes" for this warning make sign
extension bugs worse by casting changing the type of the variable
instead of casting the size_t.

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


svn commit: r253094 - head/sys/dev/usb/controller

2013-07-09 Thread Konstantin Belousov
Author: kib
Date: Tue Jul  9 12:55:01 2013
New Revision: 253094
URL: http://svnweb.freebsd.org/changeset/base/253094

Log:
  Use MSI for xhci(4), if supported.
  
  Reviewed by:  jhb
  Tested by:dchagin
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/dev/usb/controller/xhci.h
  head/sys/dev/usb/controller/xhci_pci.c

Modified: head/sys/dev/usb/controller/xhci.h
==
--- head/sys/dev/usb/controller/xhci.h  Tue Jul  9 12:25:44 2013
(r253093)
+++ head/sys/dev/usb/controller/xhci.h  Tue Jul  9 12:55:01 2013
(r253094)
@@ -447,6 +447,7 @@ struct xhci_softc {
 
struct usb_device   *sc_devices[XHCI_MAX_DEVICES];
struct resource *sc_io_res;
+   int sc_irq_rid;
struct resource *sc_irq_res;
 
void*sc_intr_hdl;

Modified: head/sys/dev/usb/controller/xhci_pci.c
==
--- head/sys/dev/usb/controller/xhci_pci.c  Tue Jul  9 12:25:44 2013
(r253093)
+++ head/sys/dev/usb/controller/xhci_pci.c  Tue Jul  9 12:55:01 2013
(r253094)
@@ -146,8 +146,7 @@ static int
 xhci_pci_attach(device_t self)
 {
struct xhci_softc *sc = device_get_softc(self);
-   int err;
-   int rid;
+   int count, err, rid;
 
/* XXX check for 64-bit capability */
 
@@ -171,11 +170,21 @@ xhci_pci_attach(device_t self)
 
usb_callout_init_mtx(&sc->sc_callout, &sc->sc_bus.bus_mtx, 0);
 
-   rid = 0;
-   sc->sc_irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid,
-   RF_SHAREABLE | RF_ACTIVE);
+   sc->sc_irq_rid = 0;
+   count = pci_msi_count(self);
+   if (count >= 1) {
+   count = 1;
+   if (pci_alloc_msi(self, &count) == 0) {
+   if (bootverbose)
+   device_printf(self, "MSI enabled\n");
+   sc->sc_irq_rid = 1;
+   }
+   }
+   sc->sc_irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ,
+   &sc->sc_irq_rid, RF_SHAREABLE | RF_ACTIVE);
if (sc->sc_irq_res == NULL) {
device_printf(self, "Could not allocate IRQ\n");
+   goto error;
}
sc->sc_bus.bdev = device_add_child(self, "usbus", -1);
if (sc->sc_bus.bdev == NULL) {
@@ -249,7 +258,10 @@ xhci_pci_detach(device_t self)
sc->sc_intr_hdl = NULL;
}
if (sc->sc_irq_res) {
-   bus_release_resource(self, SYS_RES_IRQ, 0, sc->sc_irq_res);
+   if (sc->sc_irq_rid == 1)
+   pci_release_msi(self);
+   bus_release_resource(self, SYS_RES_IRQ, sc->sc_irq_rid,
+   sc->sc_irq_res);
sc->sc_irq_res = NULL;
}
if (sc->sc_io_res) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r252425 - head/sys/arm/arm

2013-07-09 Thread Aleksandr Rybalko
On Mon, 1 Jul 2013 11:56:25 +1000 (EST)
Bruce Evans  wrote:

> On Sun, 30 Jun 2013, Aleksandr Rybalko wrote:
> 
> > Log:
> >  Decrypt magic numbers - define names for fields of Generic Timer's CNTKCTL 
> > reg.
> >
> >  Submitted by:  Ruslan Bukin 
> >
> > Modified:
> >  head/sys/arm/arm/generic_timer.c
> >
> > Modified: head/sys/arm/arm/generic_timer.c
> > ==
> > --- head/sys/arm/arm/generic_timer.cSun Jun 30 19:36:17 2013
> > (r252424)
> > +++ head/sys/arm/arm/generic_timer.cSun Jun 30 19:52:41 2013
> > (r252425)
> > @@ -66,7 +66,22 @@ __FBSDID("$FreeBSD$");
> > #define GENERIC_TIMER_REG_CTRL  0
> > #define GENERIC_TIMER_REG_TVAL  1
> >
> > -#defineCNTPSIRQ29
> > +#defineGENERIC_TIMER_CNTKCTL_PL0PTEN   (1 << 9) /* Physical timer 
> > registers
> > +   access from PL0 */
> > +#defineGENERIC_TIMER_CNTKCTL_PL0VTEN   (1 << 8) /* Virtual timer 
> > registers
> 
> With names like these, the magic numbers are better.  The prefix name
> GENERIC_TIMER is especially bad.  GT would be good.

Changed in r252780.

> 
> > ...
> > +#defineGENERIC_TIMER_CNTPSIRQ  29
> 
> Here the interesting part CNTPSIRQ is fairly abbreviated, but its prefix
> is not.

GENERIC_TIMER was original prefix before timer access bits was added,
but CNTPSIRQ is original name from documentation. Name was preserved to
avoid confusion.

> 
> >
> > struct arm_tmr_softc {
> > struct resource *irq_res;
> > @@ -167,7 +182,11 @@ disable_user_access(void)
> > uint32_t cntkctl;
> >
> > __asm volatile("mrc p15, 0, %0, c14, c1, 0" : "=r" (cntkctl));
> > -   cntkctl &= ~((3 << 8) | (7 << 0));
> > +   cntkctl &= ~(GENERIC_TIMER_CNTKCTL_PL0PTEN |
> > +   GENERIC_TIMER_CNTKCTL_PL0VTEN |
> > +   GENERIC_TIMER_CNTKCTL_EVNTEN |
> > +   GENERIC_TIMER_CNTKCTL_PL0VCTEN |
> > +   GENERIC_TIMER_CNTKCTL_PL0PCTEN);
> > __asm volatile("mcr p15, 0, %0, c14, c1, 0" : : "r" (cntkctl));
> > isb();
> > }
> 
> Using these verbose names takes about 15 times as much code as
> before (the statement is only 5 times longer, but the definitions
> macros are about 10 times longer), and looks like even more becayse
> the statement is misformatted with non-KNF indentation which then
> requires extra line spitting with only 1 name per line.

Now a lot of bytes saved! :)

> 
> > @@ -270,7 +289,8 @@ arm_tmr_attach(device_t dev)
> >
> > rid = 0;
> > sc->irq_res = bus_alloc_resource(dev, SYS_RES_IRQ, &rid,
> > -   CNTPSIRQ, CNTPSIRQ, 1, RF_SHAREABLE | RF_ACTIVE);
> > +   GENERIC_TIMER_CNTPSIRQ, GENERIC_TIMER_CNTPSIRQ,
> > +   1, RF_SHAREABLE | RF_ACTIVE);
> >
> > arm_tmr_sc = sc;
> 
> For full uglyness, expand all the prefixes and names:

I will! :-D

> - SYS -> SYSTEM
> - RES -> RESOURCE
> - IRQ -> INTERRUPT_REQUEST_NUMBER
> - SYS_RES_IRQ -> SYSTEM_RESOURCE_INTERRUPT_REQUEST_NUMBER
> - RF -> RESOURCE_FLAG
> - RF_SHAREABLE_RESOURCE_FLAG_SHAREABLE 
> - RF_ACTIVE -> RESOURCE_FLAG_ACTIVE
> - CNTPSIRQ -> COUNT_PRIVATELY_SOURCED_INTERRUPT_REQUEST_NUMBER
>(just guessing what PS means):
> 
>   sc->irq_res = bus_alloc_resource(dev, SYS_RES_INTERRUPT_REQUEST_NUMBER,
>   &rid,
>   GENERIC_TIMER_COUNT_PRIVATELY_SOURCED_INTERRUPT_REQUEST_NUMBER,
>   GENERIC_TIMER_COUNT_PRIVATELY_SOURCED_INTERRUPT_REQUEST_NUMBER,
>   1, RESOURCE_FLAG_SHAREABLE | RESOURCE_FLAG_ACTIVE);
> 
> Next, use non-KNF indentation:
> 
>   sc->irq_res = bus_alloc_resource(dev, SYS_RES_INTERRUPT_REQUEST_NUMBER,
>   &rid,
>   GENERIC_TIMER_COUNT_PRIVATELY_SOURCED_INTERRUPT_REQUEST_NUMBER,
>   GENERIC_TIMER_COUNT_PRIVATELY_SOURCED_INTERRUPT_REQUEST_NUMBER,
>   1, RESOURCE_FLAG_SHAREABLE | RESOURCE_FLAG_ACTIVE);
> 
> The names aren't even 80 characters long, so they actually fit on 1 line.
> 
> Bruce

Thanks Bruce!

"Long words only upset me." (c) Vinny-Pooh (USSR version) :-D

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


svn commit: r253095 - head/sys/vm

2013-07-09 Thread Konstantin Belousov
Author: kib
Date: Tue Jul  9 13:22:30 2013
New Revision: 253095
URL: http://svnweb.freebsd.org/changeset/base/253095

Log:
  Fix typo in comment.
  
  MFC after:3 days

Modified:
  head/sys/vm/swap_pager.c

Modified: head/sys/vm/swap_pager.c
==
--- head/sys/vm/swap_pager.cTue Jul  9 12:55:01 2013(r253094)
+++ head/sys/vm/swap_pager.cTue Jul  9 13:22:30 2013(r253095)
@@ -836,7 +836,7 @@ swap_pager_freespace(vm_object_t object,
  * SWAP_PAGER_RESERVE() - reserve swap blocks in object
  *
  * Assigns swap blocks to the specified range within the object.  The
- * swap blocks are not zerod.  Any previous swap assignment is destroyed.
+ * swap blocks are not zeroed.  Any previous swap assignment is destroyed.
  *
  * Returns 0 on success, -1 on failure.
  */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253098 - head/sys/fs/ext2fs

2013-07-09 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Jul  9 14:23:00 2013
New Revision: 253098
URL: http://svnweb.freebsd.org/changeset/base/253098

Log:
  Reinstate the assertion from r253045.
  
  UFS r232732 reverted the change as the real problem was to be fixed
  at the syscall level.
  
  Reported by:  bde

Modified:
  head/sys/fs/ext2fs/ext2_vnops.c

Modified: head/sys/fs/ext2fs/ext2_vnops.c
==
--- head/sys/fs/ext2fs/ext2_vnops.c Tue Jul  9 13:52:34 2013
(r253097)
+++ head/sys/fs/ext2fs/ext2_vnops.c Tue Jul  9 14:23:00 2013
(r253098)
@@ -1598,11 +1598,11 @@ ext2_read(struct vop_read_args *ap)
} else if (vp->v_type != VREG && vp->v_type != VDIR)
panic("%s: type %d", "ext2_read", vp->v_type);
 #endif
-   if (uio->uio_resid < 0 || uio->uio_offset < 0)
-   return (EINVAL);
orig_resid = uio->uio_resid;
+   KASSERT(orig_resid >= 0, ("ext2_read: uio->uio_resid < 0"));
if (orig_resid == 0)
return (0);
+   KASSERT(uio->uio_offset >= 0, ("ext2_read: uio->uio_offset < 0"));
fs = ip->i_e2fs;
if (uio->uio_offset < ip->i_size &&
uio->uio_offset >= fs->e2fs_maxfilesize)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253099 - head/sys/netinet

2013-07-09 Thread Michael Tuexen
Author: tuexen
Date: Tue Jul  9 14:38:26 2013
New Revision: 253099
URL: http://svnweb.freebsd.org/changeset/base/253099

Log:
  Use IPSECSTAT_INC() and IPSEC6STAT_INC() macros for ipsec statistics
  accounting.
  
  X-MFC with: r252026

Modified:
  head/sys/netinet/sctp_input.c

Modified: head/sys/netinet/sctp_input.c
==
--- head/sys/netinet/sctp_input.c   Tue Jul  9 14:23:00 2013
(r253098)
+++ head/sys/netinet/sctp_input.c   Tue Jul  9 14:38:26 2013
(r253099)
@@ -5705,7 +5705,7 @@ sctp_common_input_processing(struct mbuf
 #ifdef INET
case AF_INET:
if (ipsec4_in_reject(m, &inp->ip_inp.inp)) {
-   MODULE_GLOBAL(ipsec4stat).in_polvio++;
+   IPSECSTAT_INC(in_polvio);
SCTP_STAT_INCR(sctps_hdrops);
goto out;
}
@@ -5714,7 +5714,7 @@ sctp_common_input_processing(struct mbuf
 #ifdef INET6
case AF_INET6:
if (ipsec6_in_reject(m, &inp->ip_inp.inp)) {
-   MODULE_GLOBAL(ipsec6stat).in_polvio++;
+   IPSEC6STAT_INC(in_polvio);
SCTP_STAT_INCR(sctps_hdrops);
goto out;
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253101 - head/sys/netinet6

2013-07-09 Thread Andrey V. Elsukov
Author: ae
Date: Tue Jul  9 15:20:46 2013
New Revision: 253101
URL: http://svnweb.freebsd.org/changeset/base/253101

Log:
  Correct the size of allocated memory to store array of counters.

Modified:
  head/sys/netinet6/in6.c

Modified: head/sys/netinet6/in6.c
==
--- head/sys/netinet6/in6.c Tue Jul  9 15:10:27 2013(r253100)
+++ head/sys/netinet6/in6.c Tue Jul  9 15:20:46 2013(r253101)
@@ -2749,12 +2749,13 @@ in6_domifattach(struct ifnet *ifp)
ext = (struct in6_ifextra *)malloc(sizeof(*ext), M_IFADDR, M_WAITOK);
bzero(ext, sizeof(*ext));
 
-   ext->in6_ifstat = malloc(sizeof(struct in6_ifstat), M_IFADDR,
-   M_WAITOK);
+   ext->in6_ifstat = malloc(sizeof(counter_u64_t) *
+   sizeof(struct in6_ifstat) / sizeof(uint64_t), M_IFADDR, M_WAITOK);
COUNTER_ARRAY_ALLOC(ext->in6_ifstat,
sizeof(struct in6_ifstat) / sizeof(uint64_t), M_WAITOK);
 
-   ext->icmp6_ifstat = malloc(sizeof(struct icmp6_ifstat), M_IFADDR,
+   ext->icmp6_ifstat = malloc(sizeof(counter_u64_t) *
+   sizeof(struct icmp6_ifstat) / sizeof(uint64_t), M_IFADDR,
M_WAITOK);
COUNTER_ARRAY_ALLOC(ext->icmp6_ifstat,
sizeof(struct icmp6_ifstat) / sizeof(uint64_t), M_WAITOK);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253100 - head/sys/net

2013-07-09 Thread Andrey V. Elsukov
Author: ae
Date: Tue Jul  9 15:10:27 2013
New Revision: 253100
URL: http://svnweb.freebsd.org/changeset/base/253100

Log:
  Correct CTASSERT condition.

Modified:
  head/sys/net/vnet.h

Modified: head/sys/net/vnet.h
==
--- head/sys/net/vnet.h Tue Jul  9 14:38:26 2013(r253099)
+++ head/sys/net/vnet.h Tue Jul  9 15:10:27 2013(r253100)
@@ -124,7 +124,8 @@ static int  
\
 array##_sysctl(SYSCTL_HANDLER_ARGS)\
 {  \
type s; \
-   CTASSERT(sizeof(type) == sizeof(VNET(array)));  \
+   CTASSERT((sizeof(type) / sizeof(uint64_t)) ==   \
+   (sizeof(VNET(array)) / sizeof(counter_u64_t))); \
COUNTER_ARRAY_COPY(VNET(array), &s, sizeof(type) / sizeof(uint64_t));\
if (req->newptr)\
COUNTER_ARRAY_ZERO(VNET(array), \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r253048 - in head/sys/ofed: drivers/net/mlx4 include/linux

2013-07-09 Thread John Baldwin
On Monday, July 08, 2013 6:13:22 pm Garrett Cooper wrote:
> On Jul 8, 2013, at 2:25 PM, John Baldwin wrote:
> 
> > Author: jhb
> > Date: Mon Jul  8 21:25:12 2013
> > New Revision: 253048
> > URL: http://svnweb.freebsd.org/changeset/base/253048
> > 
> > Log:
> >  Allow mlx4 devices to switch from Ethernet to Infiniband (and vice 
versa):
> >  - Fix sysctl wrapper for sysfs attributes to properly handle new string
> >values similar to sysctl_handle_string() (only copyin the user's
> >supplied length and nul-terminate the string).
> >  - Don't check for a trailing newline when evaluating the desired 
operating
> >mode of a mlx4 device.
> > 
> >  PR:kern/17
> >  Submitted by:  Shahar Klein 
> >  MFC after: 1 week
> 
> Was there an issue with the patch I submitted via 
http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/174213 (basically solving the 
same problem, but only with the sysfs <-> sysctl(9) handler)? I was of the 
impression that sysfs on Linux always added on trailing newlines (but I could 
be wrong because I haven't used Linux at a dev level for ages). Thanks!

I hadn't seen it.  I had wondered if the '\n' issue was a generic sysfs thing.
It sounds like it is and I'd be happy to revert the mlx4 change and alter the
sysfs bits to manage the newline directly if that is more appropriate.  I'd
also like this to use sysctl_handle_string() if at all possible.  Are you in
a position to test patches still?

If so, maybe give this a whirl.  It's similar to yours except it uses
sysctl_handle_string() and strlcat() rather than continuing to do things
by hand.  It also outputs an empty string to userland if the attribute
doesn't have a show method (your version would never pass out an old
string in that case unlike the original code).

Index: drivers/net/mlx4/main.c
===
--- drivers/net/mlx4/main.c (revision 253096)
+++ drivers/net/mlx4/main.c (working copy)
@@ -479,11 +479,11 @@
int i;
int err = 0;
 
-   if (!strcmp(buf, "ib"))
+   if (!strcmp(buf, "ib\n"))
info->tmp_type = MLX4_PORT_TYPE_IB;
-   else if (!strcmp(buf, "eth"))
+   else if (!strcmp(buf, "eth\n"))
info->tmp_type = MLX4_PORT_TYPE_ETH;
-   else if (!strcmp(buf, "auto"))
+   else if (!strcmp(buf, "auto\n"))
info->tmp_type = MLX4_PORT_TYPE_AUTO;
else {
mlx4_err(mdev, "%s is not supported port type\n", buf);
Index: include/linux/sysfs.h
===
--- include/linux/sysfs.h   (revision 253096)
+++ include/linux/sysfs.h   (working copy)
@@ -81,37 +81,35 @@
 
kobj = arg1;
attr = (struct attribute *)arg2;
-   buf = (void *)get_zeroed_page(GFP_KERNEL);
-   len = 1;/* Copy out a NULL byte at least. */
if (kobj->ktype == NULL || kobj->ktype->sysfs_ops == NULL)
return (ENODEV);
-   ops = kobj->ktype->sysfs_ops;
+   buf = (void *)get_zeroed_page(GFP_KERNEL);
if (buf == NULL)
return (ENOMEM);
+   ops = kobj->ktype->sysfs_ops;
if (ops->show) {
len = ops->show(kobj, attr, buf);
/*
-* It's valid not to have a 'show' so we just return 1 byte
-* of NULL.
+* It's valid to not have a 'show' so just return an
+* empty string.
 */
if (len < 0) {
error = -len;
-   len = 1;
if (error != EIO)
goto out;
}
+
+   /* Trim trailing newline. */
+   len--;
+   buf[len] = '\0';
}
-   error = SYSCTL_OUT(req, buf, len);
-   if (error || !req->newptr || ops->store == NULL)
+
+   /* Leave one trailing byte to append a newline. */
+   error = sysctl_handle_string(oidp, buf, PAGE_SIZE - 1, req);
+   if (error != 0 || req->newptr == NULL || ops->store == NULL)
goto out;
-   len = req->newlen - req->newidx;
-   if (len >= PAGE_SIZE)
-   error = EINVAL;
-   else 
-   error = SYSCTL_IN(req, buf, len);
-   if (error)
-   goto out;
-   ((char *)buf)[len] = '\0';
+   len = strlcat(buf, "\n", PAGE_SIZE);
+   KASSERT(len < PAGE_SIZE, ("new attribute truncated"));
len = ops->store(kobj, attr, buf, len);
if (len < 0)
error = -len;

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


svn commit: r253102 - head/sys/dev/ixgb

2013-07-09 Thread Jung-uk Kim
Author: jkim
Date: Tue Jul  9 18:15:59 2013
New Revision: 253102
URL: http://svnweb.freebsd.org/changeset/base/253102

Log:
  Remove redundant definitions to appease tinderbox.

Modified:
  head/sys/dev/ixgb/if_ixgb.c
  head/sys/dev/ixgb/ixgb_ids.h

Modified: head/sys/dev/ixgb/if_ixgb.c
==
--- head/sys/dev/ixgb/if_ixgb.c Tue Jul  9 15:20:46 2013(r253101)
+++ head/sys/dev/ixgb/if_ixgb.c Tue Jul  9 18:15:59 2013(r253102)
@@ -72,8 +72,8 @@ charixgb_copyright[] = "Copy
 static ixgb_vendor_info_t ixgb_vendor_info_array[] =
 {
/* Intel(R) PRO/1 Network Connection */
-   {INTEL_VENDOR_ID, IXGB_DEVICE_ID_82597EX, PCI_ANY_ID, PCI_ANY_ID, 0},
-   {INTEL_VENDOR_ID, IXGB_DEVICE_ID_82597EX_SR, PCI_ANY_ID, PCI_ANY_ID, 0},
+   {IXGB_VENDOR_ID, IXGB_DEVICE_ID_82597EX, PCI_ANY_ID, PCI_ANY_ID, 0},
+   {IXGB_VENDOR_ID, IXGB_DEVICE_ID_82597EX_SR, PCI_ANY_ID, PCI_ANY_ID, 0},
/* required last entry */
{0, 0, 0, 0, 0}
 };

Modified: head/sys/dev/ixgb/ixgb_ids.h
==
--- head/sys/dev/ixgb/ixgb_ids.hTue Jul  9 15:20:46 2013
(r253101)
+++ head/sys/dev/ixgb/ixgb_ids.hTue Jul  9 18:15:59 2013
(r253102)
@@ -37,13 +37,9 @@
 #define _IXGB_IDS_H_
 
 /**
-** The Device and Vendor IDs for 10 Gigabit MACs
+** The Device IDs for 10 Gigabit MACs
 **/
 
-#define INTEL_VENDOR_ID 0x8086
-#define INTEL_SUBVENDOR_ID  0x8086
-
-
 #define IXGB_DEVICE_ID_82597EX  0x1048   /* Cibolo A1, -LR (1310nm) */
 #define IXGB_DEVICE_ID_82597EX_SR   0x1A48   /* Cibolo B0, -SR (850nm)  */
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r253002 - head

2013-07-09 Thread John Baldwin
On Monday, July 08, 2013 7:24:04 pm Garrett Cooper wrote:
> On Mon, Jul 8, 2013 at 2:13 PM, John Baldwin  wrote:
> > On Monday, July 08, 2013 2:23:31 am Garrett Cooper wrote:
> >> On Sun, Jul 7, 2013 at 7:25 PM, Garrett Cooper 
> > wrote:
> >> > On Jul 7, 2013, at 2:15 PM, Alfred Perlstein  wrote:
> >> >
> >> >> On 7/7/13 2:01 PM, Garrett Cooper wrote:
> >> >>> Why the magic number 12?
> >> >>
> >> >> Numbers higher seem to result in worse performance as reported by some
> > members of my team.
> >> >
> >> > The suggestion is good in spirit, but this doesn't justify the reasoning
> > for this recommendation for all cases.
> >> >
> >> > Please revert this change and add a doc page or notes to the dev handbook
> > discussing what the empirical process and results were for determining this
> > value so people can come up with their own values that work best with their
> > hardware and software config. This recommendation is prone to bitrot like 
> > some
> > of the recommendations in tuning(7).
> >> >
> >> > Misinformation is sometimes more harmful than no information.
> >>
> >> I spoke with Alfred over the phone and did some more careful thought
> >> about this and I'm rescinding this request.
> >>
> >> Alfred did a good job at documenting how JFLAG works (it was
> >> previously undocumented). My concern over -j12 was performance
> >> related, and after giving things more careful thought it actually
> >> makes sense why -j12 was chosen because Westmere and newer processors
> >> have issues with NUMA and cache locality between multiple processor
> >> packages as we've seen non-empirically and empirically at Isilon with
> >> FreeBSD 7 and 10 (it's a known issue that jeffr@ and jhb@ are aware
> >> of).
> >>
> >> I'll come up with a concise patch that does what Alfred was trying to
> >> achieve and have Alfred review it.
> >>
> >> Thanks (and thank you Alfred for the contribution!!!)!
> >
> > Westmere is fine, it's post-Westmere that is more troublesome.
> 
> Even the 6-core Westmeres (I'm being completely dumb here as you and
> Jeff know a lot more about the NUMA issue than I do as I just caught
> the tail end of the conversation at BSDCan)?

Yes.  NUMA can matter some on Nehalem and Westmere, but for workloads
that involve I/O, the SB/IB generation where the I/O hub moves onto
the processor itself is much more finicky.

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


svn commit: r253103 - head/sys/mips/include

2013-07-09 Thread Warner Losh
Author: imp
Date: Tue Jul  9 19:01:38 2013
New Revision: 253103
URL: http://svnweb.freebsd.org/changeset/base/253103

Log:
  Nearly a complete rewrite of elf.h.
  
  Start with NetBSD's sys/arch/mips/include/elf_machdep.h 1.18. Remove the 
NetBSD
  specific glue pieces (leaving mostly just relocation types).
  
  Add in FreeBSD specific glue pieces from older versions of this file, and
  move to the top of the file:
  r237430 | kib | 2012-06-22 00:38:31 -0600 (Fri, 22 Jun 2012) | 5 lines
  r232449 | jmallett | 2012-03-03 01:19:18 -0700 (Sat, 03 Mar 2012) | 18 lines
  r217097 | kib | 2011-01-07 07:22:34 -0700 (Fri, 07 Jan 2011) | 3 lines
  r211412 | kib | 2010-08-17 02:55:45 -0600 (Tue, 17 Aug 2010) | 7 lines
  r202908 | gonzo | 2010-01-23 19:59:22 -0700 (Sat, 23 Jan 2010) | 4 lines
  r195356 | imp | 2009-07-05 01:00:51 -0600 (Sun, 05 Jul 2009) | 6 lines
  r195128 | gonzo | 2009-06-27 17:27:41 -0600 (Sat, 27 Jun 2009) | 4 lines
  r197933 | kib | 2009-10-10 09:31:24 -0600 (Sat, 10 Oct 2009) | 9 lines
  r189926 | kib | 2009-03-17 06:50:16 -0600 (Tue, 17 Mar 2009) | 9 lines
  r186191 | imp | 2008-12-16 13:07:47 -0700 (Tue, 16 Dec 2008) | 7 lines
  as closely as I can tell, the projects/mips branch merge was disruptive
  to good history.
  
  This should make merges easier in the future from NetBSD and vice versa.

Modified:
  head/sys/mips/include/elf.h

Modified: head/sys/mips/include/elf.h
==
--- head/sys/mips/include/elf.h Tue Jul  9 18:15:59 2013(r253102)
+++ head/sys/mips/include/elf.h Tue Jul  9 19:01:38 2013(r253103)
@@ -1,7 +1,5 @@
-/* $OpenBSD: elf_abi.h,v 1.1 1998/01/28 11:14:41 pefo Exp $ */
-
-/*-
- * Copyright (c) 1996 Per Fogelstrom
+/*
+ * Copyright (c) 2013 M. Warner Losh. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -11,18 +9,12 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- *derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
@@ -30,190 +22,60 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * JNPR: elf.h,v 1.4 2006/12/02 09:53:40 katta
  * $FreeBSD$
+ */
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
  *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILI

svn commit: r253104 - head/lib/libc/net

2013-07-09 Thread Michael Tuexen
Author: tuexen
Date: Tue Jul  9 19:04:19 2013
New Revision: 253104
URL: http://svnweb.freebsd.org/changeset/base/253104

Log:
  Fix a bug where SCTP_ENABLE_STREAM_RESET is not handled by
  sctp_opt_info().
  
  MFC after: 3 days

Modified:
  head/lib/libc/net/sctp_sys_calls.c

Modified: head/lib/libc/net/sctp_sys_calls.c
==
--- head/lib/libc/net/sctp_sys_calls.c  Tue Jul  9 19:01:38 2013
(r253103)
+++ head/lib/libc/net/sctp_sys_calls.c  Tue Jul  9 19:04:19 2013
(r253104)
@@ -338,6 +338,9 @@ sctp_opt_info(int sd, sctp_assoc_t id, i
case SCTP_MAX_BURST:
((struct sctp_assoc_value *)arg)->assoc_id = id;
break;
+   case SCTP_ENABLE_STREAM_RESET:
+   ((struct sctp_assoc_value *)arg)->assoc_id = id;
+   break;
default:
break;
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253105 - head/lib/libc/net

2013-07-09 Thread Michael Tuexen
Author: tuexen
Date: Tue Jul  9 19:12:47 2013
New Revision: 253105
URL: http://svnweb.freebsd.org/changeset/base/253105

Log:
  Fix the handling of SCTP_CURRENT_ASSOC and SCTP_ALL_ASSOC in
  sctp_opt_info().
  
  MFC after: 3 days

Modified:
  head/lib/libc/net/sctp_sys_calls.c

Modified: head/lib/libc/net/sctp_sys_calls.c
==
--- head/lib/libc/net/sctp_sys_calls.c  Tue Jul  9 19:04:19 2013
(r253104)
+++ head/lib/libc/net/sctp_sys_calls.c  Tue Jul  9 19:12:47 2013
(r253105)
@@ -274,6 +274,11 @@ sctp_opt_info(int sd, sctp_assoc_t id, i
errno = EINVAL;
return (-1);
}
+   if ((id == SCTP_CURRENT_ASSOC) ||
+   (id == SCTP_ALL_ASSOC)) {
+   errno = EINVAL;
+   return (-1);
+   }
switch (opt) {
case SCTP_RTOINFO:
((struct sctp_rtoinfo *)arg)->srto_assoc_id = id;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r253072 - head/sys/conf

2013-07-09 Thread Dimitry Andric

On 2013-07-09 10:42, Andriy Gapon wrote:

Author: avg
Date: Tue Jul  9 08:42:02 2013
New Revision: 253072
URL: http://svnweb.freebsd.org/changeset/base/253072

Log:
   amd64: use -mno-omit-leaf-frame-pointer in addition to 
-fno-omit-frame-pointer

   ... in kernel builds.  This is to make behavior of clang consistent with
   behavior of gcc.

   MFC after:   2 weeks


Thanks.  This would be really nice to have in 9.2 too. :-)

-Dimitry

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


svn commit: r253106 - in head/sys: geom/journal kern sys ufs/ffs

2013-07-09 Thread Konstantin Belousov
Author: kib
Date: Tue Jul  9 20:49:32 2013
New Revision: 253106
URL: http://svnweb.freebsd.org/changeset/base/253106

Log:
  There are several code sequences like
vfs_busy(mp);
vfs_write_suspend(mp);
  which are problematic if other thread starts unmount between two
  calls.  The unmount starts a write, while vfs_write_suspend() drain
  writers.  On the other hand, unmount drains busy references, causing
  the deadlock.
  
  Add a flag argument to vfs_write_suspend and require the callers of it
  to specify VS_SKIP_UNMOUNT flag, when the call is performed not in the
  mount path, i.e. the covered vnode is not locked.  The suspension is
  not attempted if VS_SKIP_UNMOUNT is specified and unmount is in
  progress.
  
  Reported and tested by:   Andreas Longwitz 
  Sponsored by: The FreeBSD Foundation
  MFC after:3 weeks

Modified:
  head/sys/geom/journal/g_journal.c
  head/sys/kern/vfs_vnops.c
  head/sys/sys/vnode.h
  head/sys/ufs/ffs/ffs_snapshot.c
  head/sys/ufs/ffs/ffs_suspend.c
  head/sys/ufs/ffs/ffs_vfsops.c

Modified: head/sys/geom/journal/g_journal.c
==
--- head/sys/geom/journal/g_journal.c   Tue Jul  9 19:12:47 2013
(r253105)
+++ head/sys/geom/journal/g_journal.c   Tue Jul  9 20:49:32 2013
(r253106)
@@ -2960,7 +2960,7 @@ g_journal_do_switch(struct g_class *clas
GJ_TIMER_STOP(1, &bt, "BIO_FLUSH time of %s", sc->sc_name);
 
GJ_TIMER_START(1, &bt);
-   error = vfs_write_suspend(mp);
+   error = vfs_write_suspend(mp, VS_SKIP_UNMOUNT);
GJ_TIMER_STOP(1, &bt, "Suspend time of %s", mountpoint);
if (error != 0) {
GJ_DEBUG(0, "Cannot suspend file system %s (error=%d).",

Modified: head/sys/kern/vfs_vnops.c
==
--- head/sys/kern/vfs_vnops.c   Tue Jul  9 19:12:47 2013(r253105)
+++ head/sys/kern/vfs_vnops.c   Tue Jul  9 20:49:32 2013(r253106)
@@ -1668,8 +1668,7 @@ vn_finished_secondary_write(mp)
  * Request a filesystem to suspend write operations.
  */
 int
-vfs_write_suspend(mp)
-   struct mount *mp;
+vfs_write_suspend(struct mount *mp, int flags)
 {
int error;
 
@@ -1680,6 +1679,21 @@ vfs_write_suspend(mp)
}
while (mp->mnt_kern_flag & MNTK_SUSPEND)
msleep(&mp->mnt_flag, MNT_MTX(mp), PUSER - 1, "wsuspfs", 0);
+
+   /*
+* Unmount holds a write reference on the mount point.  If we
+* own busy reference and drain for writers, we deadlock with
+* the reference draining in the unmount path.  Callers of
+* vfs_write_suspend() must specify VS_SKIP_UNMOUNT if
+* vfs_busy() reference is owned and caller is not in the
+* unmount context.
+*/
+   if ((flags & VS_SKIP_UNMOUNT) != 0 &&
+   (mp->mnt_kern_flag & MNTK_UNMOUNT) != 0) {
+   MNT_IUNLOCK(mp);
+   return (EBUSY);
+   }
+
mp->mnt_kern_flag |= MNTK_SUSPEND;
mp->mnt_susp_owner = curthread;
if (mp->mnt_writeopcount > 0)

Modified: head/sys/sys/vnode.h
==
--- head/sys/sys/vnode.hTue Jul  9 19:12:47 2013(r253105)
+++ head/sys/sys/vnode.hTue Jul  9 20:49:32 2013(r253106)
@@ -398,6 +398,9 @@ extern int  vttoif_tab[];
 #defineVR_START_WRITE  0x0001  /* vfs_write_resume: start write 
atomically */
 #defineVR_NO_SUSPCLR   0x0002  /* vfs_write_resume: do not clear 
suspension */
 
+#defineVS_SKIP_UNMOUNT 0x0001  /* vfs_write_suspend: fail if the
+  filesystem is being unmounted */
+
 #defineVREF(vp)vref(vp)
 
 #ifdef DIAGNOSTIC
@@ -711,7 +714,7 @@ int vn_io_fault_pgmove(vm_page_t ma[], v
 intvfs_cache_lookup(struct vop_lookup_args *ap);
 void   vfs_timestamp(struct timespec *);
 void   vfs_write_resume(struct mount *mp, int flags);
-intvfs_write_suspend(struct mount *mp);
+intvfs_write_suspend(struct mount *mp, int flags);
 intvop_stdbmap(struct vop_bmap_args *);
 intvop_stdfsync(struct vop_fsync_args *);
 intvop_stdgetwritemount(struct vop_getwritemount_args *);

Modified: head/sys/ufs/ffs/ffs_snapshot.c
==
--- head/sys/ufs/ffs/ffs_snapshot.c Tue Jul  9 19:12:47 2013
(r253105)
+++ head/sys/ufs/ffs/ffs_snapshot.c Tue Jul  9 20:49:32 2013
(r253106)
@@ -423,7 +423,7 @@ restart:
 */
for (;;) {
vn_finished_write(wrtmp);
-   if ((error = vfs_write_suspend(vp->v_mount)) != 0) {
+   if ((error = vfs_write_suspend(vp->v_mount, 0)) != 0) {
vn_start_write(NULL, &wrtmp, V_WAIT);
vn_lock(vp, LK_EXCLUSIV

svn commit: r253107 - head/sys/dev/nvme

2013-07-09 Thread Jim Harris
Author: jimharris
Date: Tue Jul  9 21:02:45 2013
New Revision: 253107
URL: http://svnweb.freebsd.org/changeset/base/253107

Log:
  Add pci_enable_busmaster() and pci_disable_busmaster() calls in
  nvme_attach() and nvme_detach() respectively.
  
  Sponsored by: Intel
  MFC after:3 days

Modified:
  head/sys/dev/nvme/nvme.c

Modified: head/sys/dev/nvme/nvme.c
==
--- head/sys/dev/nvme/nvme.cTue Jul  9 20:49:32 2013(r253106)
+++ head/sys/dev/nvme/nvme.cTue Jul  9 21:02:45 2013(r253107)
@@ -255,6 +255,8 @@ nvme_attach(device_t dev)
 
nvme_sysctl_initialize_ctrlr(ctrlr);
 
+   pci_enable_busmaster(dev);
+
ctrlr->config_hook.ich_func = nvme_ctrlr_start_config_hook;
ctrlr->config_hook.ich_arg = ctrlr;
 
@@ -269,6 +271,7 @@ nvme_detach (device_t dev)
struct nvme_controller  *ctrlr = DEVICE2SOFTC(dev);
 
nvme_ctrlr_destruct(ctrlr, dev);
+   pci_disable_busmaster(dev);
return (0);
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253108 - head/sys/dev/nvme

2013-07-09 Thread Jim Harris
Author: jimharris
Date: Tue Jul  9 21:03:39 2013
New Revision: 253108
URL: http://svnweb.freebsd.org/changeset/base/253108

Log:
  Do not retry failed async event requests.
  
  Sponsored by: Intel
  MFC after:3 days

Modified:
  head/sys/dev/nvme/nvme_ctrlr.c

Modified: head/sys/dev/nvme/nvme_ctrlr.c
==
--- head/sys/dev/nvme/nvme_ctrlr.c  Tue Jul  9 21:02:45 2013
(r253107)
+++ head/sys/dev/nvme/nvme_ctrlr.c  Tue Jul  9 21:03:39 2013
(r253108)
@@ -649,12 +649,12 @@ nvme_ctrlr_async_event_cb(void *arg, con
 {
struct nvme_async_event_request *aer = arg;
 
-   if (cpl->status.sc == NVME_SC_ABORTED_SQ_DELETION) {
+   if (nvme_completion_is_error(cpl)) {
/*
-*  This is simulated when controller is being shut down, to
-*  effectively abort outstanding asynchronous event requests
-*  and make sure all memory is freed.  Do not repost the
-*  request in this case.
+*  Do not retry failed async event requests.  This avoids
+*  infinite loops where a new async event request is submitted
+*  to replace the one just failed, only to fail again and
+*  perpetuate the loop.
 */
return;
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253109 - head/sbin/nvmecontrol

2013-07-09 Thread Jim Harris
Author: jimharris
Date: Tue Jul  9 21:14:15 2013
New Revision: 253109
URL: http://svnweb.freebsd.org/changeset/base/253109

Log:
  Incorporate feedback from bde@ based on r252672 changes:
  
  * Use 0/1 instead of sysexits.  Man pages are confusing on this topic,
but 0/1 is sufficient for nvmecontrol.
  * Use err function family where possible instead of fprintf/exit.
  * Fix some typing errors.
  * Clean up some error message inconsistencies.
  
  Sponsored by: Intel
  Submitted by: bde (parts of firmware.c changes)
  MFC after:3 days

Modified:
  head/sbin/nvmecontrol/devlist.c
  head/sbin/nvmecontrol/firmware.c
  head/sbin/nvmecontrol/identify.c
  head/sbin/nvmecontrol/logpage.c
  head/sbin/nvmecontrol/nvmecontrol.c
  head/sbin/nvmecontrol/perftest.c
  head/sbin/nvmecontrol/reset.c

Modified: head/sbin/nvmecontrol/devlist.c
==
--- head/sbin/nvmecontrol/devlist.c Tue Jul  9 21:03:39 2013
(r253108)
+++ head/sbin/nvmecontrol/devlist.c Tue Jul  9 21:14:15 2013
(r253109)
@@ -29,13 +29,12 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include "nvmecontrol.h"
@@ -45,7 +44,7 @@ devlist_usage(void)
 {
fprintf(stderr, "usage:\n");
fprintf(stderr, DEVLIST_USAGE);
-   exit(EX_USAGE);
+   exit(1);
 }
 
 static inline uint32_t
@@ -62,9 +61,7 @@ devlist(int argc, char *argv[])
struct nvme_namespace_data  nsdata;
charname[64];
uint32_ti;
-   int ch, ctrlr, exit_code, fd, found;
-
-   exit_code = EX_OK;
+   int ch, ctrlr, fd, found, ret;
 
while ((ch = getopt(argc, argv, "")) != -1) {
switch ((char)ch) {
@@ -80,14 +77,14 @@ devlist(int argc, char *argv[])
ctrlr++;
sprintf(name, "%s%d", NVME_CTRLR_PREFIX, ctrlr);
 
-   exit_code = open_dev(name, &fd, 0, 0);
+   ret = open_dev(name, &fd, 0, 0);
 
-   if (exit_code == EX_NOINPUT)
-   break;
-   else if (exit_code == EX_NOPERM) {
-   printf("Could not open /dev/%s, errno = %d (%s)\n",
-   name, errno, strerror(errno));
-   continue;
+   if (ret != 0) {
+   if (fd < 0) {
+   warnx("could not open /dev/%s\n", name);
+   continue;
+   } else
+   break;
}
 
found++;
@@ -111,5 +108,5 @@ devlist(int argc, char *argv[])
if (found == 0)
printf("No NVMe controllers found.\n");
 
-   exit(EX_OK);
+   exit(1);
 }

Modified: head/sbin/nvmecontrol/firmware.c
==
--- head/sbin/nvmecontrol/firmware.cTue Jul  9 21:03:39 2013
(r253108)
+++ head/sbin/nvmecontrol/firmware.cTue Jul  9 21:14:15 2013
(r253109)
@@ -36,14 +36,14 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
-#include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include "nvmecontrol.h"
@@ -64,60 +64,58 @@ slot_has_valid_firmware(int fd, int slot
 }
 
 static void
-read_image_file(char *path, void **buf, ssize_t *size)
+read_image_file(char *path, void **buf, int32_t *size)
 {
struct stat sb;
+   int32_t filesize;
int fd;
 
*size = 0;
*buf = NULL;
 
-   if ((fd = open(path, O_RDONLY)) < 0) {
-   fprintf(stderr, "Unable to open '%s'.\n", path);
-   exit(EX_IOERR);
-   }
-   if (fstat(fd, &sb) < 0) {
-   fprintf(stderr, "Unable to stat '%s'.\n", path);
-   close(fd);
-   exit(EX_IOERR);
-   }
-   if ((*buf = malloc(sb.st_size)) == NULL) {
-   fprintf(stderr, "Unable to malloc %jd bytes.\n",
-   sb.st_size);
-   close(fd);
-   exit(EX_IOERR);
-   }
-   if ((*size = read(fd, *buf, sb.st_size)) < 0) {
-   fprintf(stderr, "Error reading '%s', errno=%d (%s)\n",
-   path, errno, strerror(errno));
-   close(fd);
-   exit(EX_IOERR);
-   }
-   if (*size != sb.st_size) {
-   fprintf(stderr, "Error reading '%s', "
-   "read %zd bytes, requested %jd bytes\n",
-   path, *size, sb.st_size);
-   close(fd);
-   exit(EX_IOERR);
-   }
+   if ((fd = open(path, O_RDONLY)) < 0)
+   err(1, "unable to open '%s'", path);
+   if (fstat(fd, &sb) < 0)
+   err(1, "unable to stat '%s'",

Re: svn commit: r252672 - head/sbin/nvmecontrol

2013-07-09 Thread Jim Harris
On Sat, Jul 6, 2013 at 7:26 PM, Bruce Evans  wrote:

> On Sat, 6 Jul 2013, Jilles Tjoelker wrote:
>
>  On Sat, Jul 06, 2013 at 08:42:49PM +0200, Pawel Jakub Dawidek wrote:
>>
>>> On Thu, Jul 04, 2013 at 11:44:28AM +1000, Bruce Evans wrote:
>>>
 Many style bugs are visible in this patch:

>>> [...]
>>>
 - sysexits.h is used

>>> [...]
>>>
>>
>>  Bruce, until sysexits(3) doesn't explicitly say it shouldn't be used,
>>> please stop calling this a bug, because you are just confusing people.
>>> At this point sysexits(3) actually even suggests it is blessed by
>>> style(9). This is how it starts:
>>>
>>
>>  According to style(9), it is not a good practice to call exit(3)
>>> with arbitrary values to indicate a failure condition when
>>> ending a program. Instead, the pre-defined exit codes from
>>> sysexits should be used, so the caller of the process can get a
>>> rough estimation about the failure class without looking up the
>>> source code.
>>>
>>
> This is just another bug in sysexits(3).  This is not according to
> style(9), since style(9) was fixed to not say that after I complained
> previously :-).  It has never been normal practice to use sysexits(3),
> but someone who likes it added recommendations to use it to style(9) when
> they added the man pages for sysexits(3).  Before that, it was
> so rarely used that it had no man page.
>

To add to the areas of confusion already stated in this thread, err(3)
explicitly recommends using sysexits(3) and uses it in all of the examples.

I decided to use 0/1 instead of sysexits since it seems most appropriate
based on the discussion here and other examples in sbin.  I incorporated
these changes as well as addressing some of Bruce's other feedback in
r253109.

Thanks,

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


svn commit: r253110 - head/sbin/nvmecontrol

2013-07-09 Thread Jim Harris
Author: jimharris
Date: Tue Jul  9 21:20:08 2013
New Revision: 253110
URL: http://svnweb.freebsd.org/changeset/base/253110

Log:
  Try to read firmware image before prompting the user to confirm
  firmware download.  This correctly prints an error and exits for
  an incorrect firmware image name before prompting the user to
  confirm the download.
  
  Sponsored by: Intel
  MFC after:3 days

Modified:
  head/sbin/nvmecontrol/firmware.c

Modified: head/sbin/nvmecontrol/firmware.c
==
--- head/sbin/nvmecontrol/firmware.cTue Jul  9 21:14:15 2013
(r253109)
+++ head/sbin/nvmecontrol/firmware.cTue Jul  9 21:20:08 2013
(r253110)
@@ -253,6 +253,9 @@ firmware(int argc, char *argv[])
"of available images\n",
slot, controller);
 
+   if (f_flag)
+   read_image_file(image, &buf, &size);
+
if (f_flag && a_flag)
printf("You are about to download and activate "
   "firmware image (%s) to controller %s.\n"
@@ -282,7 +285,6 @@ firmware(int argc, char *argv[])
}
 
if (f_flag) {
-   read_image_file(image, &buf, &size);
update_firmware(fd, buf, size);
if (a_flag)
activate_firmware(fd, slot,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2013-07-09 Thread Jim Harris
Author: jimharris
Date: Tue Jul  9 21:21:29 2013
New Revision: 253111
URL: http://svnweb.freebsd.org/changeset/base/253111

Log:
  Update nvme(4) and nvd(4) to reflect recent work and upcoming inclusion
  in 9.2 release.
  
  Sponsored by: Intel
  MFC after:3 days

Modified:
  head/share/man/man4/nvd.4
  head/share/man/man4/nvme.4

Modified: head/share/man/man4/nvd.4
==
--- head/share/man/man4/nvd.4   Tue Jul  9 21:20:08 2013(r253110)
+++ head/share/man/man4/nvd.4   Tue Jul  9 21:21:29 2013(r253111)
@@ -1,5 +1,5 @@
 .\"
-.\" Copyright (c) 2012 Intel Corporation
+.\" Copyright (c) 2012-2013 Intel Corporation
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -66,6 +66,11 @@ I/O commands.
 .Xr nvme 4 ,
 .Xr nvmecontrol 8 ,
 .Xr disk 9 .
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 9.2.
 .Sh AUTHORS
 .An -nosplit
 The
@@ -76,15 +81,3 @@ with contributions from Joe Golio at EMC
 .Pp
 This man page was written by
 .An Jim Harris Aq jimhar...@freebsd.org .
-.Sh BUGS
-The
-.Nm
-driver is considered experimental.
-Development and testing have been primarily focused on amd64.
-The following areas of development and testing are in progress:
-.Bl -bullet
-.It
-testing on i386
-.It
-command timeout error handling
-.El

Modified: head/share/man/man4/nvme.4
==
--- head/share/man/man4/nvme.4  Tue Jul  9 21:20:08 2013(r253110)
+++ head/share/man/man4/nvme.4  Tue Jul  9 21:21:29 2013(r253111)
@@ -1,5 +1,5 @@
 .\"
-.\" Copyright (c) 2012 Intel Corporation
+.\" Copyright (c) 2012-2013 Intel Corporation
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -147,6 +147,11 @@ and completion queues to the console.
 .Xr pci 4 ,
 .Xr nvmecontrol 8 ,
 .Xr disk 9 .
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 9.2.
 .Sh AUTHORS
 .An -nosplit
 The
@@ -157,19 +162,3 @@ with contributions from Joe Golio at EMC
 .Pp
 This man page was written by
 .An Jim Harris Aq jimhar...@freebsd.org .
-.Sh BUGS
-The
-.Nm
-driver is considered experimental.
-Development and testing have been primarily focused on amd64.
-The following areas of development and testing are in progress:
-.Bl -bullet
-.It
-testing on i386
-.It
-asynchronous error reporting
-.It
-command timeout error handling
-.It
-controller-level resets
-.El
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253112 - in head/sys/dev: nvd nvme

2013-07-09 Thread Jim Harris
Author: jimharris
Date: Tue Jul  9 21:22:17 2013
New Revision: 253112
URL: http://svnweb.freebsd.org/changeset/base/253112

Log:
  Update copyright dates.
  
  MFC after:3 days

Modified:
  head/sys/dev/nvd/nvd.c
  head/sys/dev/nvme/nvme.c
  head/sys/dev/nvme/nvme.h
  head/sys/dev/nvme/nvme_ctrlr.c
  head/sys/dev/nvme/nvme_ctrlr_cmd.c
  head/sys/dev/nvme/nvme_ns.c
  head/sys/dev/nvme/nvme_private.h
  head/sys/dev/nvme/nvme_qpair.c
  head/sys/dev/nvme/nvme_sysctl.c
  head/sys/dev/nvme/nvme_test.c

Modified: head/sys/dev/nvd/nvd.c
==
--- head/sys/dev/nvd/nvd.c  Tue Jul  9 21:21:29 2013(r253111)
+++ head/sys/dev/nvd/nvd.c  Tue Jul  9 21:22:17 2013(r253112)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (C) 2012 Intel Corporation
+ * Copyright (C) 2012-2013 Intel Corporation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/dev/nvme/nvme.c
==
--- head/sys/dev/nvme/nvme.cTue Jul  9 21:21:29 2013(r253111)
+++ head/sys/dev/nvme/nvme.cTue Jul  9 21:22:17 2013(r253112)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (C) 2012 Intel Corporation
+ * Copyright (C) 2012-2013 Intel Corporation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/dev/nvme/nvme.h
==
--- head/sys/dev/nvme/nvme.hTue Jul  9 21:21:29 2013(r253111)
+++ head/sys/dev/nvme/nvme.hTue Jul  9 21:22:17 2013(r253112)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (C) 2012 Intel Corporation
+ * Copyright (C) 2012-2013 Intel Corporation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/dev/nvme/nvme_ctrlr.c
==
--- head/sys/dev/nvme/nvme_ctrlr.c  Tue Jul  9 21:21:29 2013
(r253111)
+++ head/sys/dev/nvme/nvme_ctrlr.c  Tue Jul  9 21:22:17 2013
(r253112)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (C) 2012 Intel Corporation
+ * Copyright (C) 2012-2013 Intel Corporation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/dev/nvme/nvme_ctrlr_cmd.c
==
--- head/sys/dev/nvme/nvme_ctrlr_cmd.c  Tue Jul  9 21:21:29 2013
(r253111)
+++ head/sys/dev/nvme/nvme_ctrlr_cmd.c  Tue Jul  9 21:22:17 2013
(r253112)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (C) 2012 Intel Corporation
+ * Copyright (C) 2012-2013 Intel Corporation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/dev/nvme/nvme_ns.c
==
--- head/sys/dev/nvme/nvme_ns.c Tue Jul  9 21:21:29 2013(r253111)
+++ head/sys/dev/nvme/nvme_ns.c Tue Jul  9 21:22:17 2013(r253112)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (C) 2012 Intel Corporation
+ * Copyright (C) 2012-2013 Intel Corporation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/dev/nvme/nvme_private.h
==
--- head/sys/dev/nvme/nvme_private.hTue Jul  9 21:21:29 2013
(r253111)
+++ head/sys/dev/nvme/nvme_private.hTue Jul  9 21:22:17 2013
(r253112)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (C) 2012 Intel Corporation
+ * Copyright (C) 2012-2013 Intel Corporation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/dev/nvme/nvme_qpair.c
==
--- head/sys/dev/nvme/nvme_qpair.c  Tue Jul  9 21:21:29 2013
(r253111)
+++ head/sys/dev/nvme/nvme_qpair.c  Tue Jul  9 21:22:17 2013
(r253112)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (C) 2012 Intel Corporation
+ * Copyright (C) 2012-2013 Intel Corporation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/dev/nvme/nvme_sysctl.c
==
--- head/sys/dev/nvme/nvme_sysctl.c Tue Jul  9 21:21:29 2013
(r253111)
+++ head/sys/dev/nvme/nvme_sysctl.c Tue Jul  9 21:22:17 2013
(r253112)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (C) 2012 Intel Corporation
+ * Copyright (C) 2012-2013 Intel Corporation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/dev/nvme/nvme_test.c
==
--- hea

svn commit: r253113 - head/sys/dev/nvme

2013-07-09 Thread Jim Harris
Author: jimharris
Date: Tue Jul  9 21:24:19 2013
New Revision: 253113
URL: http://svnweb.freebsd.org/changeset/base/253113

Log:
  Add comment explaining why CACHE_LINE_SIZE is defined in nvme_private.h
  if not already defined elsewhere.
  
  Requested by: attilio
  MFC after:3 days

Modified:
  head/sys/dev/nvme/nvme_private.h

Modified: head/sys/dev/nvme/nvme_private.h
==
--- head/sys/dev/nvme/nvme_private.hTue Jul  9 21:22:17 2013
(r253112)
+++ head/sys/dev/nvme/nvme_private.hTue Jul  9 21:24:19 2013
(r253113)
@@ -109,6 +109,10 @@ MALLOC_DECLARE(M_NVME);
 /* Maximum log page size to fetch for AERs. */
 #define NVME_MAX_AER_LOG_SIZE  (4096)
 
+/*
+ * Define CACHE_LINE_SIZE here for older FreeBSD versions that do not define
+ *  it.
+ */
 #ifndef CACHE_LINE_SIZE
 #define CACHE_LINE_SIZE(64)
 #endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253114 - head/sbin/nvmecontrol

2013-07-09 Thread Jim Harris
Author: jimharris
Date: Tue Jul  9 21:31:21 2013
New Revision: 253114
URL: http://svnweb.freebsd.org/changeset/base/253114

Log:
  Send per-namespace logpage commands to the controller devnode, so they
  are processed as admin commands, not I/O commands.
  
  As part of this change, pull out the code for parsing a namespace node
  string into a separate function, since it is used for both identify and
  logpage commands.
  
  Sponsored by: Intel
  MFC after:3 days

Modified:
  head/sbin/nvmecontrol/identify.c
  head/sbin/nvmecontrol/logpage.c
  head/sbin/nvmecontrol/nvmecontrol.c
  head/sbin/nvmecontrol/nvmecontrol.h

Modified: head/sbin/nvmecontrol/identify.c
==
--- head/sbin/nvmecontrol/identify.cTue Jul  9 21:24:19 2013
(r253113)
+++ head/sbin/nvmecontrol/identify.cTue Jul  9 21:31:21 2013
(r253114)
@@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -194,7 +193,6 @@ identify_ns(int argc, char *argv[])
 {
struct nvme_namespace_data  nsdata;
charpath[64];
-   char*nsloc;
int ch, fd, hexflag = 0, hexlength, nsid;
int verboseflag = 0;
 
@@ -224,22 +222,12 @@ identify_ns(int argc, char *argv[])
close(fd);
 
/*
-* Pull the namespace id from the string. +2 skips past the "ns" part
-*  of the string.  Don't search past 10 characters into the string,
-*  otherwise we know it is malformed.
-*/
-   nsloc = strnstr(argv[optind], NVME_NS_PREFIX, 10);
-   if (nsloc != NULL)
-   nsid = strtol(nsloc + 2, NULL, 10);
-   if (nsloc == NULL || (nsid == 0 && errno != 0))
-   errx(1, "invalid namespace ID '%s'", argv[optind]);
-
-   /*
 * We send IDENTIFY commands to the controller, not the namespace,
-*  since it is an admin cmd.  So the path should only include the
-*  nvmeX part of the nvmeXnsY string.
+*  since it is an admin cmd.  The namespace ID will be specified in
+*  the IDENTIFY command itself.  So parse the namespace's device node
+*  string to get the controller substring and namespace ID.
 */
-   snprintf(path, nsloc - argv[optind] + 1, "%s", argv[optind]);
+   parse_ns_str(argv[optind], path, &nsid);
open_dev(path, &fd, 1, 1);
read_namespace_data(fd, nsid, &nsdata);
close(fd);

Modified: head/sbin/nvmecontrol/logpage.c
==
--- head/sbin/nvmecontrol/logpage.c Tue Jul  9 21:24:19 2013
(r253113)
+++ head/sbin/nvmecontrol/logpage.c Tue Jul  9 21:31:21 2013
(r253114)
@@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -242,12 +241,11 @@ logpage_usage(void)
 void
 logpage(int argc, char *argv[])
 {
-   int fd, nsid, len;
+   int fd, nsid;
int log_page = 0, pageflag = false;
-   int hexflag = false;
-   int allow_ns = false;
-   charch, *p, *nsloc = NULL;
-   char*cname = NULL;
+   int hexflag = false, ns_specified;
+   charch, *p;
+   charcname[64];
uint32_tsize;
void*buf;
struct logpage_function *f;
@@ -290,46 +288,31 @@ logpage(int argc, char *argv[])
if (optind >= argc)
logpage_usage();
 
+   if (strstr(argv[optind], NVME_NS_PREFIX) != NULL) {
+   ns_specified = true;
+   parse_ns_str(argv[optind], cname, &nsid);
+   open_dev(cname, &fd, 1, 1);
+   } else {
+   ns_specified = false;
+   nsid = NVME_GLOBAL_NAMESPACE_TAG;
+   open_dev(argv[optind], &fd, 1, 1);
+   }
+
/*
 * The log page attribtues indicate whether or not the controller
 * supports the SMART/Health information log page on a per
 * namespace basis.
 */
-   cname = malloc(strlen(NVME_CTRLR_PREFIX) + 2);
-   len = strlen(NVME_CTRLR_PREFIX) + 1;
-   cname = strncpy(cname, argv[optind], len);
-   open_dev(cname, &fd, 1, 1);
-   read_controller_data(fd, &cdata);
-
-   if (log_page == NVME_LOG_HEALTH_INFORMATION && cdata.lpa.ns_smart != 0)
-   allow_ns = true;
-
-   /* If a namespace id was specified, validate it's use */
-   if (strstr(argv[optind], NVME_NS_PREFIX) != NULL) {
-   if (!allow_ns) {
-  

svn commit: r253115 - head/sbin/nvmecontrol

2013-07-09 Thread Jim Harris
Author: jimharris
Date: Tue Jul  9 21:31:58 2013
New Revision: 253115
URL: http://svnweb.freebsd.org/changeset/base/253115

Log:
  Condense the output for displaying LBA formats.
  
  Sponsored by: Intel
  MFC after:3 days

Modified:
  head/sbin/nvmecontrol/identify.c

Modified: head/sbin/nvmecontrol/identify.c
==
--- head/sbin/nvmecontrol/identify.cTue Jul  9 21:31:21 2013
(r253114)
+++ head/sbin/nvmecontrol/identify.cTue Jul  9 21:31:58 2013
(r253115)
@@ -124,13 +124,11 @@ print_namespace(struct nvme_namespace_da
printf("Thin Provisioning:   %s\n",
nsdata->nsfeat.thin_prov ? "Supported" : "Not Supported");
printf("Number of LBA Formats:   %d\n", nsdata->nlbaf+1);
-   printf("Current LBA Format:  LBA Format #%d\n",
+   printf("Current LBA Format:  LBA Format #%02d\n",
nsdata->flbas.format);
-   for (i = 0; i <= nsdata->nlbaf; i++) {
-   printf("LBA Format #%d:\n", i);
-   printf("  LBA Data Size: %d\n",
-   1 << nsdata->lbaf[i].lbads);
-   }
+   for (i = 0; i <= nsdata->nlbaf; i++)
+   printf("LBA Format #%02d: Data Size: %5d  Metadata Size: %5d\n",
+   i, 1 << nsdata->lbaf[i].lbads, nsdata->lbaf[i].ms);
 }
 
 static void
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253116 - head/sbin/nvmecontrol

2013-07-09 Thread Jim Harris
Author: jimharris
Date: Tue Jul  9 21:33:12 2013
New Revision: 253116
URL: http://svnweb.freebsd.org/changeset/base/253116

Log:
  Ensure controller or namespace node name is specified before trying to
  access it.
  
  While here, also fix the identify usage message to show the -v and -x
  parameters.
  
  Sponsored by: Intel
  MFC after:3 days

Modified:
  head/sbin/nvmecontrol/identify.c
  head/sbin/nvmecontrol/nvmecontrol.h

Modified: head/sbin/nvmecontrol/identify.c
==
--- head/sbin/nvmecontrol/identify.cTue Jul  9 21:31:58 2013
(r253115)
+++ head/sbin/nvmecontrol/identify.cTue Jul  9 21:33:12 2013
(r253116)
@@ -259,6 +259,10 @@ identify(int argc, char *argv[])
 
while (getopt(argc, argv, "vx") != -1) ;
 
+   /* Check that a controller or namespace was specified. */
+   if (optind >= argc)
+   identify_usage();
+
target = argv[optind];
 
optreset = 1;

Modified: head/sbin/nvmecontrol/nvmecontrol.h
==
--- head/sbin/nvmecontrol/nvmecontrol.h Tue Jul  9 21:31:58 2013
(r253115)
+++ head/sbin/nvmecontrol/nvmecontrol.h Tue Jul  9 21:33:12 2013
(r253116)
@@ -38,7 +38,7 @@
 "   nvmecontrol devlist\n"
 
 #define IDENTIFY_USAGE\
-"   nvmecontrol identify \n"
+"   nvmecontrol identify [-x [-v]] \n"
 
 #define PERFTEST_USAGE\
 "   nvmecontrol perftest <-n num_threads> <-o read|write>\n"  \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253117 - head/usr.sbin/bsdconfig/share

2013-07-09 Thread Devin Teske
Author: dteske
Date: Tue Jul  9 21:53:57 2013
New Revision: 253117
URL: http://svnweb.freebsd.org/changeset/base/253117

Log:
  Do two things: First, don't obscure the backtitle. Second, read ~/.dialogrc
  if it exists to determine if use_shadow is true (ON) or false (OFF).
  
  The purpose of determining the value of use_shadow is to know how many lines
  to subtract from the maximum height value in assuring that the backtitle is
  not obscured.
  
  The detriment of obscuring the backtitle is that it provides information
  that is not easily obtained elsewhere. That is the command-line shortcut
  used to access the current menu. As you navigate from one dialog to the
  next, invariably transparently corssing module boundaries, the backtitle
  represents the command-line argument used to get there. Obscuring this
  information with a widget that is too-tall and/or too-wide would see that
  data go unnoticed (leaving few other ways to get that information in the
  same helpful context).
  
  So despite the fact that this change reduces the standard maximum height for
  all widgets, there is a trap-door to prevent this calculation. If you want
  to utilize the full screen height on the terminal (remember, this adjustment
  is not made for Xdialog(1)) you can set $NO_BACKTITLE to 1 (or any non-NULL
  value for that matter) and this calculation will be skipped. You will be
  able to draw a widget that partially obscures the backtitle if-necessary.
  
  MFC after:1 day

Modified:
  head/usr.sbin/bsdconfig/share/dialog.subr

Modified: head/usr.sbin/bsdconfig/share/dialog.subr
==
--- head/usr.sbin/bsdconfig/share/dialog.subr   Tue Jul  9 21:33:12 2013
(r253116)
+++ head/usr.sbin/bsdconfig/share/dialog.subr   Tue Jul  9 21:53:57 2013
(r253117)
@@ -292,7 +292,31 @@ f_dialog_max_size()
__max_size=$( stty size 2> /dev/null ) # usually "24 80"
: ${__max_size:=$DEFAULT_TERMINAL_SIZE}
fi
-   [ "$__var_height" ] && setvar "$__var_height" "${__max_size%%[$IFS]*}"
+   if [ "$__var_height" ]; then
+   local __height="${__max_size%%[$IFS]*}"
+   #
+   # If we're not using Xdialog(1), we should assume that $DIALOG
+   # will render --backtitle behind the widget. In such a case, we
+   # should prevent the widget from obscuring the backtitle (unless
+   # $NO_BACKTITLE is set and non-NULL, allowing a trap-door).
+   #
+   if [ ! "$USE_XDIALOG" ] && [ ! "$NO_BACKTITLE" ]; then
+   #
+   # If use_shadow (in ~/.dialogrc) is OFF, we need to
+   # subtract 4, otherwise 5. However, don't check this
+   # every time, rely on an initialization variable set
+   # by f_dialog_init().
+   #
+   local __adjust=5
+   [ "$NO_SHADOW" ] && __adjust=4
+
+   # Don't adjust the height if already too small (allowing
+   # obscured backtitle for small values of __height).
+   [ ${__height:-0} -gt 11 ] &&
+   __height=$(( $__height - $__adjust ))
+   fi
+   setvar "$__var_height" "$__height"
+   fi
[ "$__var_width" ] && setvar "$__var_width" "${__max_size##*[$IFS]}"
 }
 
@@ -1999,6 +2023,12 @@ f_dialog_menutag2index_with_help()
 #that (while running as root) sudo(8) authentication is
 #required to proceed.
 #
+# Also reads ~/.dialogrc for the following information:
+#
+#  NO_SHADOW Either NULL or Non-NULL. If use_shadow is OFF (case-
+#insensitive) in ~/.dialogrc this is set to "1" (otherwise
+#unset).
+#
 f_dialog_init()
 {
DIALOG_SELF_INITIALIZE=
@@ -2058,6 +2088,22 @@ f_dialog_init()
fi
 
#
+   # Read ~/.dialogrc (unless using Xdialog(1)) for properties
+   #
+   if [ -f ~/.dialogrc ]; then
+   eval "$(
+   awk -v param=use_shadow -v expect=OFF \
+   -v set="NO_SHADOW=1" '
+   !/^[[:space:]]*(#|$)/ && \
+   tolower($1) ~ "^"param"(=|$)" && \
+   /[^#]*=/ {
+   sub(/^[^=]*=[[:space:]]*/, "")
+   if ( toupper($1) == expect ) print set";"
+   }' ~/.dialogrc
+   )"
+   fi
+
+   #
# If we're already running as root but we got there by way of sudo(8)
# and we have X11, we should merge the xauth(1) credentials from our
# original user.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubsc

svn commit: r253118 - head/usr.sbin/bsdconfig/share

2013-07-09 Thread Devin Teske
Author: dteske
Date: Tue Jul  9 22:01:05 2013
New Revision: 253118
URL: http://svnweb.freebsd.org/changeset/base/253118

Log:
  Fix conditional (der should match the comment above it).
  
  MFC after:1 day

Modified:
  head/usr.sbin/bsdconfig/share/dialog.subr

Modified: head/usr.sbin/bsdconfig/share/dialog.subr
==
--- head/usr.sbin/bsdconfig/share/dialog.subr   Tue Jul  9 21:53:57 2013
(r253117)
+++ head/usr.sbin/bsdconfig/share/dialog.subr   Tue Jul  9 22:01:05 2013
(r253118)
@@ -2090,7 +2090,7 @@ f_dialog_init()
#
# Read ~/.dialogrc (unless using Xdialog(1)) for properties
#
-   if [ -f ~/.dialogrc ]; then
+   if [ -f ~/.dialogrc -a ! "$USE_XDIALOG" ]; then
eval "$(
awk -v param=use_shadow -v expect=OFF \
-v set="NO_SHADOW=1" '
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253119 - head/sys/crypto/sha2

2013-07-09 Thread Xin LI
Author: delphij
Date: Tue Jul  9 22:04:35 2013
New Revision: 253119
URL: http://svnweb.freebsd.org/changeset/base/253119

Log:
  Sync with KAME.
  
  MFC after:1 month

Modified:
  head/sys/crypto/sha2/sha2.c
  head/sys/crypto/sha2/sha2.h

Modified: head/sys/crypto/sha2/sha2.c
==
--- head/sys/crypto/sha2/sha2.c Tue Jul  9 22:01:05 2013(r253118)
+++ head/sys/crypto/sha2/sha2.c Tue Jul  9 22:04:35 2013(r253119)
@@ -1,4 +1,4 @@
-/* $KAME: sha2.c,v 1.8 2001/11/08 01:07:52 itojun Exp $*/
+/* $KAME: sha2.c,v 1.11 2004/06/02 09:52:45 itojun Exp $   */
 
 /*
  * sha2.c
@@ -32,6 +32,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
+ *
  */
 
 #include 
@@ -67,7 +68,7 @@ __FBSDID("$FreeBSD$");
  *
  */
 
-#if defined(_KERNEL) && (defined(__bsdi__) || defined(__FreeBSD__))
+#if defined(_KERNEL) && defined(__FreeBSD__)
 #define assert(x)
 #else
 #include 
@@ -1051,4 +1052,3 @@ char* SHA384_Data(const sha2_byte* data,
SHA384_Update(&context, data, len);
return SHA384_End(&context, digest);
 }
-

Modified: head/sys/crypto/sha2/sha2.h
==
--- head/sys/crypto/sha2/sha2.h Tue Jul  9 22:01:05 2013(r253118)
+++ head/sys/crypto/sha2/sha2.h Tue Jul  9 22:04:35 2013(r253119)
@@ -1,5 +1,5 @@
 /* $FreeBSD$   */
-/* $KAME: sha2.h,v 1.3 2001/03/12 08:27:48 itojun Exp $*/
+/* $KAME: sha2.h,v 1.5 2007/06/14 12:09:41 itojun Exp $*/
 
 /*
  * sha2.h
@@ -138,4 +138,3 @@ char* SHA512_Data(const u_int8_t*, size_
 #endif /* __cplusplus */
 
 #endif /* __SHA2_H__ */
-
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r253120 - head/sys/dev/pci

2013-07-09 Thread Marius Strobl
Author: marius
Date: Tue Jul  9 23:12:26 2013
New Revision: 253120
URL: http://svnweb.freebsd.org/changeset/base/253120

Log:
  - As it turns out, not only MSI-X is broken for devices passed through by
VMware up to at least ESXi 5.1. Actually, using INTx in that case instead
may still result in interrupt storms, with MSI being the only working
option in some configurations. So introduce a PCI_QUIRK_DISABLE_MSIX quirk
which only blacklists MSI-X but not also MSI and use it for the VMware
PCI-PCI-bridges. Note that, currently, we still assume that if MSI doesn't
work, MSI-X won't work either - but that's part of the internal logic and
not guaranteed as part of the API contract. While at it, add and employ
a pci_has_quirk() helper.
Reported and tested by: Paul Bucher
  - Use NULL instead of 0 for pointers.
  
  Submitted by: jhb (mostly)
  Approved by:  jhb
  MFC after:3 days

Modified:
  head/sys/dev/pci/pci.c
  head/sys/dev/pci/pci_pci.c
  head/sys/dev/pci/pcib_private.h
  head/sys/dev/pci/pcivar.h

Modified: head/sys/dev/pci/pci.c
==
--- head/sys/dev/pci/pci.c  Tue Jul  9 22:04:35 2013(r253119)
+++ head/sys/dev/pci/pci.c  Tue Jul  9 23:12:26 2013(r253120)
@@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$");
(((cfg)->hdrtype == PCIM_HDRTYPE_NORMAL && reg == PCIR_BIOS) || \
 ((cfg)->hdrtype == PCIM_HDRTYPE_BRIDGE && reg == PCIR_BIOS_1))
 
+static int pci_has_quirk(uint32_t devid, int quirk);
 static pci_addr_t  pci_mapbase(uint64_t mapreg);
 static const char  *pci_maptype(uint64_t mapreg);
 static int pci_mapsize(uint64_t testval);
@@ -119,6 +120,7 @@ static void pci_enable_msix(device_t de
 static voidpci_mask_msix(device_t dev, u_int index);
 static voidpci_unmask_msix(device_t dev, u_int index);
 static int pci_msi_blacklisted(void);
+static int pci_msix_blacklisted(void);
 static voidpci_resume_msi(device_t dev);
 static voidpci_resume_msix(device_t dev);
 static int pci_remap_intr_method(device_t bus, device_t dev,
@@ -185,7 +187,7 @@ static device_method_t pci_methods[] = {
 DEFINE_CLASS_0(pci, pci_driver, pci_methods, sizeof(struct pci_softc));
 
 static devclass_t pci_devclass;
-DRIVER_MODULE(pci, pcib, pci_driver, pci_devclass, pci_modevent, 0);
+DRIVER_MODULE(pci, pcib, pci_driver, pci_devclass, pci_modevent, NULL);
 MODULE_VERSION(pci, 1);
 
 static char*pci_vendordata;
@@ -195,15 +197,16 @@ struct pci_quirk {
uint32_t devid; /* Vendor/device of the card */
int type;
 #definePCI_QUIRK_MAP_REG   1 /* PCI map register in weird place */
-#definePCI_QUIRK_DISABLE_MSI   2 /* MSI/MSI-X doesn't work */
+#definePCI_QUIRK_DISABLE_MSI   2 /* Neither MSI nor MSI-X work */
 #definePCI_QUIRK_ENABLE_MSI_VM 3 /* Older chipset in VM where MSI 
works */
 #definePCI_QUIRK_UNMAP_REG 4 /* Ignore PCI map register */
+#definePCI_QUIRK_DISABLE_MSIX  5 /* MSI-X doesn't work */
int arg1;
int arg2;
 };
 
 static const struct pci_quirk pci_quirks[] = {
-   /* The Intel 82371AB and 82443MX has a map register at offset 0x90. */
+   /* The Intel 82371AB and 82443MX have a map register at offset 0x90. */
{ 0x71138086, PCI_QUIRK_MAP_REG,0x90,0 },
{ 0x719b8086, PCI_QUIRK_MAP_REG,0x90,0 },
/* As does the Serverworks OSB4 (the SMBus mapping register) */
@@ -238,8 +241,8 @@ static const struct pci_quirk pci_quirks
 * MSI-X allocation doesn't work properly for devices passed through
 * by VMware up to at least ESXi 5.1.
 */
-   { 0x079015ad, PCI_QUIRK_DISABLE_MSI,0,  0 }, /* PCI/PCI-X */
-   { 0x07a015ad, PCI_QUIRK_DISABLE_MSI,0,  0 }, /* PCIe */
+   { 0x079015ad, PCI_QUIRK_DISABLE_MSIX,   0,  0 }, /* PCI/PCI-X */
+   { 0x07a015ad, PCI_QUIRK_DISABLE_MSIX,   0,  0 }, /* PCIe */
 
/*
 * Some virtualization environments emulate an older chipset
@@ -321,7 +324,7 @@ SYSCTL_INT(_hw_pci, OID_AUTO, enable_msi
 static int pci_honor_msi_blacklist = 1;
 TUNABLE_INT("hw.pci.honor_msi_blacklist", &pci_honor_msi_blacklist);
 SYSCTL_INT(_hw_pci, OID_AUTO, honor_msi_blacklist, CTLFLAG_RD,
-&pci_honor_msi_blacklist, 1, "Honor chipset blacklist for MSI");
+&pci_honor_msi_blacklist, 1, "Honor chipset blacklist for MSI/MSI-X");
 
 #if defined(__i386__) || defined(__amd64__)
 static int pci_usb_takeover = 1;
@@ -334,6 +337,18 @@ SYSCTL_INT(_hw_pci, OID_AUTO, usb_early_
 Disable this if you depend on BIOS emulation of USB devices, that is\n\
 you use USB devices (like keyboard or mouse) but do not load USB drivers");
 
+static int
+pci_has_quirk(uint32_t devid, int quirk)
+{
+   const struct pci_quirk *q;
+
+   for (q = &pci_quirks[0]; q->d

svn commit: r253121 - head/usr.sbin/bsdconfig/share

2013-07-09 Thread Devin Teske
Author: dteske
Date: Tue Jul  9 23:21:57 2013
New Revision: 253121
URL: http://svnweb.freebsd.org/changeset/base/253121

Log:
  Adjust comments to fit within 80-columns.

Modified:
  head/usr.sbin/bsdconfig/share/dialog.subr

Modified: head/usr.sbin/bsdconfig/share/dialog.subr
==
--- head/usr.sbin/bsdconfig/share/dialog.subr   Tue Jul  9 23:12:26 2013
(r253120)
+++ head/usr.sbin/bsdconfig/share/dialog.subr   Tue Jul  9 23:21:57 2013
(r253121)
@@ -195,8 +195,8 @@ f_dialog_line_sanitize()
 # argument is NULL, the current title is returned.
 #
 # Each time this function is called, a backup of the current values is made
-# allowing a one-time (single-level) restoration of the previous title using 
the
-# f_dialog_title_restore() function (below).
+# allowing a one-time (single-level) restoration of the previous title using
+# the f_dialog_title_restore() function (below).
 #
 f_dialog_title()
 {
@@ -297,7 +297,7 @@ f_dialog_max_size()
#
# If we're not using Xdialog(1), we should assume that $DIALOG
# will render --backtitle behind the widget. In such a case, we
-   # should prevent the widget from obscuring the backtitle (unless
+   # should prevent a widget from obscuring the backtitle (unless
# $NO_BACKTITLE is set and non-NULL, allowing a trap-door).
#
if [ ! "$USE_XDIALOG" ] && [ ! "$NO_BACKTITLE" ]; then
@@ -310,7 +310,7 @@ f_dialog_max_size()
local __adjust=5
[ "$NO_SHADOW" ] && __adjust=4
 
-   # Don't adjust the height if already too small (allowing
+   # Don't adjust height if already too small (allowing
# obscured backtitle for small values of __height).
[ ${__height:-0} -gt 11 ] &&
__height=$(( $__height - $__adjust ))
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2013-07-09 Thread David E. O'Brien
Author: obrien
Date: Tue Jul  9 23:47:28 2013
New Revision: 253122
URL: http://svnweb.freebsd.org/changeset/base/253122

Log:
  Refactor random_systat to be a *random_systat. This avoids unnecessary
  structure copying in random_ident_hardware(). This change will also help
  further modularization of random(4) subsystem.
  
  Submitted by: arthurm...@gmail.com
  Reviewed by: obrien
  Obtained from: Juniper Networks

Modified:
  head/sys/dev/random/probe.c
  head/sys/dev/random/randomdev.c
  head/sys/dev/random/randomdev.h
  head/sys/dev/random/randomdev_soft.c

Modified: head/sys/dev/random/probe.c
==
--- head/sys/dev/random/probe.c Tue Jul  9 23:21:57 2013(r253121)
+++ head/sys/dev/random/probe.c Tue Jul  9 23:47:28 2013(r253122)
@@ -61,11 +61,11 @@ extern struct random_systat random_ivy;
 #endif
 
 void
-random_ident_hardware(struct random_systat *systat)
+random_ident_hardware(struct random_systat **systat)
 {
 
/* Set default to software */
-   *systat = random_yarrow;
+   *systat = &random_yarrow;
 
/* Then go looking for hardware */
 #if defined(__amd64__) || (defined(__i386__) && !defined(PC98))
@@ -76,7 +76,7 @@ random_ident_hardware(struct random_syst
enable = 1;
TUNABLE_INT_FETCH("hw.nehemiah_rng_enable", &enable);
if (enable)
-   *systat = random_nehemiah;
+   *systat = &random_nehemiah;
}
 #endif
 #ifdef RDRAND_RNG
@@ -86,7 +86,7 @@ random_ident_hardware(struct random_syst
enable = 1;
TUNABLE_INT_FETCH("hw.ivy_rng_enable", &enable);
if (enable)
-   *systat = random_ivy;
+   *systat = &random_ivy;
}
 #endif
 #endif

Modified: head/sys/dev/random/randomdev.c
==
--- head/sys/dev/random/randomdev.c Tue Jul  9 23:21:57 2013
(r253121)
+++ head/sys/dev/random/randomdev.c Tue Jul  9 23:47:28 2013
(r253122)
@@ -70,7 +70,7 @@ static struct cdevsw random_cdevsw = {
.d_name = "random",
 };
 
-struct random_systat random_systat;
+struct random_systat *random_systat;
 
 /* For use with make_dev(9)/destroy_dev(9). */
 static struct cdev *random_dev;
@@ -88,8 +88,8 @@ random_close(struct cdev *dev __unused, 
 {
if ((flags & FWRITE) && (priv_check(td, PRIV_RANDOM_RESEED) == 0)
&& (securelevel_gt(td->td_ucred, 0) == 0)) {
-   (*random_systat.reseed)();
-   random_systat.seeded = 1;
+   (*random_systat->reseed)();
+   random_systat->seeded = 1;
arc4rand(NULL, 0, 1);   /* Reseed arc4random as well. */
}
 
@@ -104,8 +104,8 @@ random_read(struct cdev *dev __unused, s
void *random_buf;
 
/* Blocking logic */
-   if (!random_systat.seeded)
-   error = (*random_systat.block)(flag);
+   if (!random_systat->seeded)
+   error = (*random_systat->block)(flag);
 
/* The actual read */
if (!error) {
@@ -114,7 +114,7 @@ random_read(struct cdev *dev __unused, s
 
while (uio->uio_resid > 0 && !error) {
c = MIN(uio->uio_resid, PAGE_SIZE);
-   c = (*random_systat.read)(random_buf, c);
+   c = (*random_systat->read)(random_buf, c);
error = uiomove(random_buf, c, uio);
}
 
@@ -139,7 +139,7 @@ random_write(struct cdev *dev __unused, 
error = uiomove(random_buf, c, uio);
if (error)
break;
-   (*random_systat.write)(random_buf, c);
+   (*random_systat->write)(random_buf, c);
}
 
free(random_buf, M_TEMP);
@@ -172,10 +172,10 @@ random_poll(struct cdev *dev __unused, i
int revents = 0;
 
if (events & (POLLIN | POLLRDNORM)) {
-   if (random_systat.seeded)
+   if (random_systat->seeded)
revents = events & (POLLIN | POLLRDNORM);
else
-   revents = (*random_systat.poll) (events,td);
+   revents = (*random_systat->poll) (events,td);
}
return (revents);
 }
@@ -189,11 +189,11 @@ random_modevent(module_t mod __unused, i
switch (type) {
case MOD_LOAD:
random_ident_hardware(&random_systat);
-   (*random_systat.init)();
+   (*random_systat->init)();
 
if (bootverbose)
printf("random: \n",
-   random_systat.ident);
+   random_systat->ident);
 
random_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, &random_cdevsw,
RANDOM_MINOR, NULL, UID_ROOT, GID_WHEEL, 0666, "random");
@@ 

Re: svn commit: r252672 - head/sbin/nvmecontrol

2013-07-09 Thread Bruce Evans

On Tue, 9 Jul 2013, Jim Harris wrote:


On Sat, Jul 6, 2013 at 7:26 PM, Bruce Evans  wrote:


On Sat, 6 Jul 2013, Jilles Tjoelker wrote:

 On Sat, Jul 06, 2013 at 08:42:49PM +0200, Pawel Jakub Dawidek wrote:

[>]* ...

 Bruce, until sysexits(3) doesn't explicitly say it shouldn't be used,

please stop calling this a bug, because you are just confusing people.
At this point sysexits(3) actually even suggests it is blessed by
style(9). This is how it starts:


 According to style(9), it is not a good practice to call exit(3)

with arbitrary values to indicate a failure condition when
ending a program. Instead, the pre-defined exit codes from
sysexits should be used, so the caller of the process can get a
rough estimation about the failure class without looking up the
source code.



This is just another bug in sysexits(3).  This is not according to
style(9), since style(9) was fixed to not say that after I complained
previously :-).  It has never been normal practice to use sysexits(3),
but someone who likes it added recommendations to use it to style(9) when
they added the man pages for sysexits(3).  Before that, it was
so rarely used that it had no man page.


To add to the areas of confusion already stated in this thread, err(3)
explicitly recommends using sysexits(3) and uses it in all of the examples.


Hmm, that isn't in err(3) in the old version of FreeBSD that I use.


I decided to use 0/1 instead of sysexits since it seems most appropriate
based on the discussion here and other examples in sbin.  I incorporated
these changes as well as addressing some of Bruce's other feedback in
r253109.


Thanks.

The examples in err(3) always were bad.  They currently are:

% EXAMPLES
%  Display the current errno information string and exit:
% 
%if ((p = malloc(size)) == NULL)

%err(EX_OSERR, NULL);

This has no string at all.  Use of err() and EX_OSERR are wrong too,
or at least a style bug and gratuitously unportable.  In Standard C,
malloc() is not specified to set errno.  In POSIX it is specified to
set errno to ENOMEM iff it fails.  The POSIX setting of errno just
allows sloppy code like the above to work -- ENOMEM will be translated
to "Cannot allocate memory" by err().

Normal style is to not depend on this and print the more specific
message "malloc failed" using errx().  Note that err() is not
sophisticated enough to print a good message following "malloc failed".
'err(1, "malloc failed")' would print "foo: malloc failed: Cannot
allocate memory\n").  This is missing a " (duh)" after the redundant
"Cannot allocate memory".

In $(find /usr/src/*bin -name *.c), there are 136 lines matching
"malloc f":
- 17 of these lines use precisely warnx("malloc failed").
- 49 use precisely errx(1, "malloc failed").
All these have normal style.
- 13 mire use errx(), with assorted bugs and style bugs:
  - 2 have a bogus newline at the end of the string
  - 4 say "failure" instead of "failed"
  - 1 says "malloc for continent submenu"
  - 1 says "malloc for submenu"
  - 1 says "kern.consile malloc failed"
  - 3 use EX_OSERR
  - 1 uses unusual whitespace
- 10 use printf or fprintf.  Most of these print the normal message
  "malloc failed" and not much more.  The only obvious stle bug is
  that 4 of these terminate the message with a "."
Most of the remaining 47 have style bugs:
- 4 use precisely err(1, "malloc failed")
- 6 in ar use precisely bsdar_errc(bsdar, EX_SOFTWARE, errno, "malloc failed")
- 2 in ar use "malloc failed" on a line by itself, presumably because the
  verboseness is large enough to defeat my simple regexp
- 3 in gzip use maybe_error("malloc failed")
- 1 uses precisely warn(1, "malloc failed")
- 13 use syslog(LOG_ERR, ...).  Mostly with "malloc failed" annotated
  inconsistently.  bsnmpd uses strerror(errno) a lot. It should use %m
  unless that is too unportable.  It mostly formats this using ": %s",
  but it sometimes uses " - %s" and sometimes doesn't print the errno.
  - 5 of the 13 don't print the redundant errno, so don't have any obvious
style bugs
- 2 are in comments, with the bad grammar "If the malloc fail".
- 1 is in a comment, with the less bad grammar "malloc fail"
- 3 use precisely fatal(EX_UNAVAIL, "malloc faield"
- 3 more use strerror(errno) to add nothing
- 2 more seem to use syslog via a utility function (no errno, so OK)
- 3 use yp_error("malloc failed" or similar
- the remaining 4 use "[...] malloc [...] failed" to add something.

The example used to be worse.   It said just err(1, NULL).  No hint about
the source of the error.

%if ((fd = open(file_name, O_RDONLY, 0)) == -1)
%err(EX_NOINPUT, "%s", file_name);

Error messages for open failure are more varied than for malloc failure.
I like to put at least the syscall or function name in all error messages
when not trying hard to write a very detailed but concise message.

% 
%  Display an error message and exit:
%

svn commit: r253134 - head/sys/dev/hme

2013-07-09 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jul 10 06:46:46 2013
New Revision: 253134
URL: http://svnweb.freebsd.org/changeset/base/253134

Log:
  Avoid controller reinitialization which could be triggered by
  dhclient(8) or alias addresses are added.
  
  Tested by:dcx dcy 

Modified:
  head/sys/dev/hme/if_hme.c

Modified: head/sys/dev/hme/if_hme.c
==
--- head/sys/dev/hme/if_hme.c   Wed Jul 10 04:59:10 2013(r253133)
+++ head/sys/dev/hme/if_hme.c   Wed Jul 10 06:46:46 2013(r253134)
@@ -742,6 +742,10 @@ hme_init_locked(struct hme_softc *sc)
u_int32_t n, v;
 
HME_LOCK_ASSERT(sc, MA_OWNED);
+
+   if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+   return;
+
/*
 * Initialization sequence. The numbered steps below correspond
 * to the sequence outlined in section 6.3.5.1 in the Ethernet
@@ -1324,6 +1328,7 @@ hme_eint(struct hme_softc *sc, u_int sta
/* check for fatal errors that needs reset to unfreeze DMA engine */
if ((status & HME_SEB_STAT_FATAL_ERRORS) != 0) {
HME_WHINE(sc->sc_dev, "error signaled, status=%#x\n", status);
+   sc->sc_ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
hme_init_locked(sc);
}
 }
@@ -1370,6 +1375,7 @@ hme_watchdog(struct hme_softc *sc)
device_printf(sc->sc_dev, "device timeout (no link)\n");
++ifp->if_oerrors;
 
+   ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
hme_init_locked(sc);
hme_start_locked(ifp);
return (EJUSTRETURN);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"