svn commit: r297143 - head/sys/dev/hyperv/vmbus

2016-03-21 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Mar 21 07:16:30 2016
New Revision: 297143
URL: https://svnweb.freebsd.org/changeset/base/297143

Log:
  hyperv/vmbus: Implement bus_child_pnpinfo_str method
  
  Submitted by: Jun Su 
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5669

Modified:
  head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
==
--- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.cMon Mar 21 06:54:21 
2016(r297142)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.cMon Mar 21 07:16:30 
2016(r297143)
@@ -280,6 +280,23 @@ vmbus_write_ivar(
return (ENOENT);
 }
 
+static int
+vmbus_child_pnpinfo_str(device_t dev, device_t child, char *buf, size_t buflen)
+{
+   char guidbuf[40];
+   struct hv_device *dev_ctx = device_get_ivars(child);
+
+   strlcat(buf, "classid=", buflen);
+   snprintf_hv_guid(guidbuf, sizeof(guidbuf), &dev_ctx->class_id);
+   strlcat(buf, guidbuf, buflen);
+
+   strlcat(buf, " deviceid=", buflen);
+   snprintf_hv_guid(guidbuf, sizeof(guidbuf), &dev_ctx->device_id);
+   strlcat(buf, guidbuf, buflen);
+
+   return (0);
+}
+
 struct hv_device*
 hv_vmbus_child_device_create(
hv_guid type,
@@ -720,6 +737,7 @@ static device_method_t vmbus_methods[] =
DEVMETHOD(bus_print_child, bus_generic_print_child),
DEVMETHOD(bus_read_ivar, vmbus_read_ivar),
DEVMETHOD(bus_write_ivar, vmbus_write_ivar),
+   DEVMETHOD(bus_child_pnpinfo_str, vmbus_child_pnpinfo_str),
 
{ 0, 0 } };
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r297144 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-21 Thread Alexander Motin
Author: mav
Date: Mon Mar 21 07:36:02 2016
New Revision: 297144
URL: https://svnweb.freebsd.org/changeset/base/297144

Log:
  MFC r277629 (by will):
  When creating or updating a node, use vfs_timestamp() for "now" instead
  of gethrestime(), to allow the administrator to decide the appropriate
  timestamp precision instead of always using nanosecond precision.

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
Mon Mar 21 07:16:30 2016(r297143)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
Mon Mar 21 07:36:02 2016(r297144)
@@ -795,7 +795,7 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, d
gen = vap->va_nblocks;  /* ditto */
} else {
obj = 0;
-   gethrestime(&now);
+   vfs_timestamp(&now);
gen = dmu_tx_get_txg(tx);
}
 
@@ -1437,7 +1437,7 @@ zfs_tstamp_update_setup(znode_t *zp, uin
 {
timestruc_t now;
 
-   gethrestime(&now);
+   vfs_timestamp(&now);
 
if (have_tx) {  /* will sa_bulk_update happen really soon? */
zp->z_atime_dirty = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r297145 - head/sys/kern

2016-03-21 Thread Maxim Konovalov
Author: maxim
Date: Mon Mar 21 08:03:50 2016
New Revision: 297145
URL: https://svnweb.freebsd.org/changeset/base/297145

Log:
  o "avaliable" -> "available".
  
  PR:   208141
  Submitted by: Tyler Littlefield

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==
--- head/sys/kern/uipc_socket.c Mon Mar 21 07:36:02 2016(r297144)
+++ head/sys/kern/uipc_socket.c Mon Mar 21 08:03:50 2016(r297145)
@@ -358,7 +358,7 @@ sysctl_maxsockets(SYSCTL_HANDLER_ARGS)
 }
 SYSCTL_PROC(_kern_ipc, OID_AUTO, maxsockets, CTLTYPE_INT|CTLFLAG_RW,
 &maxsockets, 0, sysctl_maxsockets, "IU",
-"Maximum number of sockets avaliable");
+"Maximum number of sockets available");
 
 /*
  * Socket operation routines.  These routines are called by the routines in
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r297146 - head/tools/tools/nanobsd

2016-03-21 Thread Poul-Henning Kamp
Author: phk
Date: Mon Mar 21 08:30:58 2016
New Revision: 297146
URL: https://svnweb.freebsd.org/changeset/base/297146

Log:
  Unquote NANO_PACKAGE_LIST so that it actually can be a list and so
  that the default value of "*" works.

Modified:
  head/tools/tools/nanobsd/defaults.sh

Modified: head/tools/tools/nanobsd/defaults.sh
==
--- head/tools/tools/nanobsd/defaults.shMon Mar 21 08:03:50 2016
(r297145)
+++ head/tools/tools/nanobsd/defaults.shMon Mar 21 08:30:58 2016
(r297146)
@@ -916,7 +916,7 @@ cust_pkgng ( ) (
mkdir -p ${NANO_WORLDDIR}/Pkg
(
cd "${NANO_PACKAGE_DIR}"
-   find "${NANO_PACKAGE_LIST}" -print |
+   find ${NANO_PACKAGE_LIST} -print |
cpio -Ldumpv ${NANO_WORLDDIR}/Pkg
)
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r297147 - head/lib/libstand

2016-03-21 Thread Ian Lepore
Author: ian
Date: Mon Mar 21 14:21:32 2016
New Revision: 297147
URL: https://svnweb.freebsd.org/changeset/base/297147

Log:
  Garbage collect the bswap routines from libstand.  The declaration was
  wrapped in an i386 ifdef with a comment questioning their usefulness even
  there.  It turns out they aren't referenced anywhere, but their presence
  prevents using sys/endian.h in libstand code.
  
  These days, sys/endian.h provides much better support for such things, using
  compiler builtins and inline functions (and creating connections between
  libstand code and header files from sys/ would not be breaking new ground).

Modified:
  head/lib/libstand/Makefile
  head/lib/libstand/stand.h

Modified: head/lib/libstand/Makefile
==
--- head/lib/libstand/Makefile  Mon Mar 21 08:30:58 2016(r297146)
+++ head/lib/libstand/Makefile  Mon Mar 21 14:21:32 2016(r297147)
@@ -25,7 +25,7 @@ WARNS?=   0
 CFLAGS+= -I${LIBSTAND_SRC}
 
 # standalone components and stuff we have modified locally
-SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c 
gets.c \
+SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c environment.c getopt.c gets.c \
globals.c pager.c printf.c strdup.c strerror.c strtol.c strtoul.c 
random.c \
sbrk.c twiddle.c zalloc.c zalloc_malloc.c
 

Modified: head/lib/libstand/stand.h
==
--- head/lib/libstand/stand.h   Mon Mar 21 08:30:58 2016(r297146)
+++ head/lib/libstand/stand.h   Mon Mar 21 14:21:32 2016(r297147)
@@ -335,11 +335,6 @@ static __inline quad_t qmin(quad_t a, qu
 static __inline u_long ulmax(u_long a, u_long b) { return (a > b ? a : b); }
 static __inline u_long ulmin(u_long a, u_long b) { return (a < b ? a : b); }
 
-/* swaps (undocumented, useful?) */
-#ifdef __i386__
-extern u_int32_t   bswap32(u_int32_t x);
-extern u_int64_t   bswap64(u_int64_t x);
-#endif
 
 /* null functions for device/filesystem switches (undocumented) */
 extern int nodev(void);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r296769 - in head/sys/boot/efi: boot1 loader

2016-03-21 Thread Ed Maste
On 15 March 2016 at 02:16, Baptiste Daroussin  wrote:
> On Sat, Mar 12, 2016 at 09:44:33PM +, Ed Maste wrote:
>> Author: emaste
>> Date: Sat Mar 12 21:44:33 2016
>> New Revision: 296769
>> URL: https://svnweb.freebsd.org/changeset/base/296769
>>
>> Log:
>>   boot/efi: Prefer nm to objdump
>
> [...]
> grep -q maybe to avoid extra noise?

I intentionally did not hide grep's output so that if there are
undefined symbols the reason for the build failure is apparent. In the
normal case this should produce no output.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r297148 - head/lib/libstand

2016-03-21 Thread Ian Lepore
Author: ian
Date: Mon Mar 21 14:39:03 2016
New Revision: 297148
URL: https://svnweb.freebsd.org/changeset/base/297148

Log:
  Actually garbage collect the unused code, as mentioned in r297147, which
  this change should have been part of.

Deleted:
  head/lib/libstand/bswap.c
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r297149 - head/sys/nfs

2016-03-21 Thread Ian Lepore
Author: ian
Date: Mon Mar 21 14:51:51 2016
New Revision: 297149
URL: https://svnweb.freebsd.org/changeset/base/297149

Log:
  If the dhcp server provides an interface-mtu option, parse the value and
  set that mtu on the interface.
  
  These changes are based on the patch submitted by Robert Blayzor in the
  PR, but I changed things around a bit, so the blame for any mistakes
  belongs to me.
  
  PR:   187094

Modified:
  head/sys/nfs/bootp_subr.c

Modified: head/sys/nfs/bootp_subr.c
==
--- head/sys/nfs/bootp_subr.c   Mon Mar 21 14:39:03 2016(r297148)
+++ head/sys/nfs/bootp_subr.c   Mon Mar 21 14:51:51 2016(r297149)
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -158,6 +159,7 @@ struct bootpc_ifcontext {
int dhcpquerytype;  /* dhcp type sent */
struct in_addr dhcpserver;
int gotdhcpserver;
+   uint16_t mtu;
 };
 
 #define TAG_MAXLEN 1024
@@ -199,6 +201,7 @@ struct bootpc_globalcontext {
 #define TAG_ROUTERS  3  /* Routers (in order of preference) */
 #define TAG_HOSTNAME12  /* Client host name */
 #define TAG_ROOT17  /* Root path */
+#define TAG_INTF_MTU26  /* Interface MTU Size (RFC2132) */
 
 /* DHCP specific tags */
 #define TAG_OVERLOAD52  /* Option Overload */
@@ -1034,7 +1037,19 @@ bootpc_adjust_interface(struct bootpc_if
return (0);
}
 
-   printf("Adjusted interface %s\n", ifctx->ireq.ifr_name);
+   printf("Adjusted interface %s", ifctx->ireq.ifr_name);
+
+   /* Do BOOTP interface options */
+   if (ifctx->mtu != 0) {
+   printf(" (MTU=%d%s)", ifctx->mtu, 
+   (ifctx->mtu > 1514) ? "/JUMBO" : "");
+   ifr->ifr_mtu = ifctx->mtu;
+   error = ifioctl(bootp_so, SIOCSIFMTU, (caddr_t) ifr, td);
+   if (error != 0)
+   panic("%s: SIOCSIFMTU, error=%d", __func__, error);
+   }
+   printf("\n");
+
/*
 * Do enough of ifconfig(8) so that the chosen interface
 * can talk to the servers.  (just set the address)
@@ -1522,6 +1537,11 @@ bootpc_decode_reply(struct nfsv3_diskles
p[i] = '\0';
}
 
+   p = bootpc_tag(&gctx->tag, &ifctx->reply, ifctx->replylen,
+  TAG_INTF_MTU);
+   if (p != NULL) {
+   ifctx->mtu = be16dec(p);
+   }
 
printf("\n");
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r297150 - head/lib/libstand

2016-03-21 Thread Ian Lepore
Author: ian
Date: Mon Mar 21 14:58:12 2016
New Revision: 297150
URL: https://svnweb.freebsd.org/changeset/base/297150

Log:
  If the dhcp server delivers an interface-mtu option, parse it and store
  the value in a new global intf_mtu for use by the application.
  
  These changes were inspired by the patch provided by Robert Blayzor in
  PR 187094, and will allow loader(8) to propagate the value to the kernel
  along with the other nfs_diskless parms delivered via environment vars.

Modified:
  head/lib/libstand/bootp.c
  head/lib/libstand/bootp.h
  head/lib/libstand/globals.c
  head/lib/libstand/net.h

Modified: head/lib/libstand/bootp.c
==
--- head/lib/libstand/bootp.c   Mon Mar 21 14:51:51 2016(r297149)
+++ head/lib/libstand/bootp.c   Mon Mar 21 14:58:12 2016(r297150)
@@ -39,6 +39,7 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
 #include 
 #include 
 
@@ -393,6 +394,13 @@ vend_rfc1048(cp, len)
val = (const char *)cp;
strlcpy(hostname, val, sizeof(hostname));
}
+   if (tag == TAG_INTF_MTU) {
+   if ((val = getenv("dhcp.interface-mtu")) != NULL) {
+   intf_mtu = (u_int)strtoul(val, NULL, 0);
+   } else {
+   intf_mtu = be16dec(cp);
+   }
+   }
 #ifdef SUPPORT_DHCP
if (tag == TAG_DHCP_MSGTYPE) {
if(*cp != expected_dhcpmsgtype)

Modified: head/lib/libstand/bootp.h
==
--- head/lib/libstand/bootp.h   Mon Mar 21 14:51:51 2016(r297149)
+++ head/lib/libstand/bootp.h   Mon Mar 21 14:58:12 2016(r297150)
@@ -91,6 +91,7 @@ struct bootp {
 #define TAG_DOMAINNAME ((unsigned char)  15)
 #define TAG_SWAPSERVER ((unsigned char)  16)
 #define TAG_ROOTPATH   ((unsigned char)  17)
+#define TAG_INTF_MTU   ((unsigned char)  26)
 
 #ifdef SUPPORT_DHCP
 #define TAG_REQ_ADDR   ((unsigned char)  50)

Modified: head/lib/libstand/globals.c
==
--- head/lib/libstand/globals.c Mon Mar 21 14:51:51 2016(r297149)
+++ head/lib/libstand/globals.c Mon Mar 21 14:58:12 2016(r297150)
@@ -32,5 +32,6 @@ structin_addr rootip; /* root ip addr
 struct in_addr swapip; /* swap ip address */
 struct in_addr gateip; /* swap ip address */
 n_long netmask = 0xff00;   /* subnet or net mask */
+u_int  intf_mtu;   /* interface mtu from bootp/dhcp */
 interrno;  /* our old friend */
 

Modified: head/lib/libstand/net.h
==
--- head/lib/libstand/net.h Mon Mar 21 14:51:51 2016(r297149)
+++ head/lib/libstand/net.h Mon Mar 21 14:58:12 2016(r297150)
@@ -83,6 +83,7 @@ externstruct in_addr swapip;
 extern struct in_addr gateip;
 extern struct in_addr nameip;
 extern n_long netmask;
+extern u_int intf_mtu;
 
 extern int debug;  /* defined in the machdep sources */
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r297151 - in head/sys/boot: common i386/libi386

2016-03-21 Thread Ian Lepore
Author: ian
Date: Mon Mar 21 15:06:50 2016
New Revision: 297151
URL: https://svnweb.freebsd.org/changeset/base/297151

Log:
  If the dhcp server provided an interface-mtu option, transcribe the value
  to the boot.netif.mtu env var, which will be picked up by pre-existing code
  in nfs_mountroot() and used to configure the interface accordingly.
  
  This should bring the same functionality when the bootp/dhcp work is done
  by loader(8) as r297150 does for the in-kernel BOOTP case.

Modified:
  head/sys/boot/common/dev_net.c
  head/sys/boot/i386/libi386/pxe.c

Modified: head/sys/boot/common/dev_net.c
==
--- head/sys/boot/common/dev_net.c  Mon Mar 21 14:58:12 2016
(r297150)
+++ head/sys/boot/common/dev_net.c  Mon Mar 21 15:06:50 2016
(r297151)
@@ -169,6 +169,12 @@ net_open(struct open_file *f, ...)
setenv("boot.netif.gateway", inet_ntoa(gateip), 1);
setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
setenv("boot.nfsroot.path", rootpath, 1);
+   if (intf_mtu != 0) {
+   char mtu[16];
+   sprintf(mtu, "%u", intf_mtu);
+   setenv("boot.netif.mtu", mtu, 1);
+   }
+
}
netdev_opens++;
f->f_devdata = &netdev_sock;

Modified: head/sys/boot/i386/libi386/pxe.c
==
--- head/sys/boot/i386/libi386/pxe.cMon Mar 21 14:58:12 2016
(r297150)
+++ head/sys/boot/i386/libi386/pxe.cMon Mar 21 15:06:50 2016
(r297151)
@@ -310,6 +310,11 @@ pxe_open(struct open_file *f, ...)
sprintf(temp, "%6D", bootplayer.CAddr, ":");
setenv("boot.netif.hwaddr", temp, 1);
}
+   if (intf_mtu != 0) {
+   char mtu[16];
+   sprintf(mtu, "%u", intf_mtu);
+   setenv("boot.netif.mtu", mtu, 1);
+   }
 #ifdef LOADER_NFS_SUPPORT
printf("pxe_open: server addr: %s\n", inet_ntoa(rootip));
printf("pxe_open: server path: %s\n", rootpath);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-03-21 Thread John Baldwin
On Sunday, March 20, 2016 05:53:31 PM Adrian Chadd wrote:
> Author: adrian
> Date: Sun Mar 20 17:53:30 2016
> New Revision: 297069
> URL: https://svnweb.freebsd.org/changeset/base/297069
> 
> Log:
>   Now that urtwn is its own device, and it'll get hotplug loaded by
>   devd/ifconfig/etc, don't build it in the kernel.
>   
>   This should fix the build as well!
>   
>   Notice by: dchagin

You should fix the entries instead.  Not everyone uses modules and we
shouldn't prohibit building devices into a custom kernel.  This also
means the device isn't in NOTES either which is a bug.  Looks like you
need to fix rtwn as well while you are at it.

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


svn commit: r297152 - stable/10/share/man/man9

2016-03-21 Thread Bryan Drewery
Author: bdrewery
Date: Mon Mar 21 17:51:15 2016
New Revision: 297152
URL: https://svnweb.freebsd.org/changeset/base/297152

Log:
  MFC r296819:
  
Reword SX_NOADAPTIVE description to be clear that adaptive is default.

Modified:
  stable/10/share/man/man9/sx.9
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man9/sx.9
==
--- stable/10/share/man/man9/sx.9   Mon Mar 21 15:06:50 2016
(r297151)
+++ stable/10/share/man/man9/sx.9   Mon Mar 21 17:51:15 2016
(r297152)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 16, 2011
+.Dd March 13, 2016
 .Dt SX 9
 .Os
 .Sh NAME
@@ -124,12 +124,10 @@ specifies a set of optional flags to alt
 It contains one or more of the following flags:
 .Bl -tag -width SX_NOADAPTIVE
 .It Dv SX_NOADAPTIVE
-If the kernel is not compiled with
-.Cd "options NO_ADAPTIVE_SX" ,
-then lock operations for
-.Fa sx
-will spin instead of sleeping while an exclusive lock holder is executing on
-another CPU.
+Disable adaptive spinning, rather than sleeping, for lock operations
+while an exclusive lock holder is executing on another CPU.
+Adaptive spinning is the default unless the kernel is compiled with
+.Cd "options NO_ADAPTIVE_SX" .
 .It Dv SX_DUPOK
 Witness should not log messages about duplicate locks being acquired.
 .It Dv SX_NOWITNESS
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r297153 - stable/9/share/man/man9

2016-03-21 Thread Bryan Drewery
Author: bdrewery
Date: Mon Mar 21 17:53:37 2016
New Revision: 297153
URL: https://svnweb.freebsd.org/changeset/base/297153

Log:
  MFC r296819:
  
Reword SX_NOADAPTIVE description to be clear that adaptive is default.

Modified:
  stable/9/share/man/man9/sx.9
Directory Properties:
  stable/9/share/man/man9/   (props changed)

Modified: stable/9/share/man/man9/sx.9
==
--- stable/9/share/man/man9/sx.9Mon Mar 21 17:51:15 2016
(r297152)
+++ stable/9/share/man/man9/sx.9Mon Mar 21 17:53:37 2016
(r297153)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 28, 2009
+.Dd March 13, 2016
 .Dt SX 9
 .Os
 .Sh NAME
@@ -124,12 +124,10 @@ specifies a set of optional flags to alt
 It contains one or more of the following flags:
 .Bl -tag -width SX_NOADAPTIVE
 .It Dv SX_NOADAPTIVE
-If the kernel is not compiled with
-.Cd "options NO_ADAPTIVE_SX" ,
-then lock operations for
-.Fa sx
-will spin instead of sleeping while an exclusive lock holder is executing on
-another CPU.
+Disable adaptive spinning, rather than sleeping, for lock operations
+while an exclusive lock holder is executing on another CPU.
+Adaptive spinning is the default unless the kernel is compiled with
+.Cd "options NO_ADAPTIVE_SX" .
 .It Dv SX_DUPOK
 Witness should not log messages about duplicate locks being acquired.
 .It Dv SX_NOWITNESS
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r297154 - in head: sbin/kldstat sys/boot/geli sys/boot/i386/gptboot sys/boot/i386/gptzfsboot sys/boot/i386/libi386 sys/boot/i386/loader sys/boot/i386/zfsloader targets/pseudo/userland/misc

2016-03-21 Thread Bryan Drewery
Author: bdrewery
Date: Mon Mar 21 18:02:26 2016
New Revision: 297154
URL: https://svnweb.freebsd.org/changeset/base/297154

Log:
  DIRDEPS_BUILD: Update dependencies.
  
  Sponsored by: EMC / Isilon Storage Division

Added:
  head/sys/boot/geli/Makefile.depend   (contents, props changed)
Modified:
  head/sbin/kldstat/Makefile.depend
  head/sys/boot/i386/gptboot/Makefile.depend
  head/sys/boot/i386/gptzfsboot/Makefile.depend
  head/sys/boot/i386/libi386/Makefile.depend
  head/sys/boot/i386/loader/Makefile.depend
  head/sys/boot/i386/zfsloader/Makefile.depend
  head/targets/pseudo/userland/misc/Makefile.depend

Modified: head/sbin/kldstat/Makefile.depend
==
--- head/sbin/kldstat/Makefile.depend   Mon Mar 21 17:53:37 2016
(r297153)
+++ head/sbin/kldstat/Makefile.depend   Mon Mar 21 18:02:26 2016
(r297154)
@@ -5,6 +5,7 @@ DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
+   include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \

Added: head/sys/boot/geli/Makefile.depend
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/boot/geli/Makefile.depend  Mon Mar 21 18:02:26 2016
(r297154)
@@ -0,0 +1,16 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+   include \
+   include/xlocale \
+   lib/libmd \
+   lib/libstand \
+   secure/lib/libcrypto \
+
+
+.include 
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif

Modified: head/sys/boot/i386/gptboot/Makefile.depend
==
--- head/sys/boot/i386/gptboot/Makefile.depend  Mon Mar 21 17:53:37 2016
(r297153)
+++ head/sys/boot/i386/gptboot/Makefile.depend  Mon Mar 21 18:02:26 2016
(r297154)
@@ -3,6 +3,10 @@
 
 DIRDEPS = \
include \
+   include/xlocale \
+   lib/libmd \
+   lib/libstand \
+   sys/boot/geli \
sys/boot/i386/btx/btx \
sys/boot/i386/btx/lib \
sys/boot/libstand32 \

Modified: head/sys/boot/i386/gptzfsboot/Makefile.depend
==
--- head/sys/boot/i386/gptzfsboot/Makefile.depend   Mon Mar 21 17:53:37 
2016(r297153)
+++ head/sys/boot/i386/gptzfsboot/Makefile.depend   Mon Mar 21 18:02:26 
2016(r297154)
@@ -4,6 +4,9 @@
 DIRDEPS = \
include \
include/xlocale \
+   lib/libmd \
+   lib/libstand \
+   sys/boot/geli \
sys/boot/i386/btx/btx \
sys/boot/i386/btx/lib \
sys/boot/libstand32 \

Modified: head/sys/boot/i386/libi386/Makefile.depend
==
--- head/sys/boot/i386/libi386/Makefile.depend  Mon Mar 21 17:53:37 2016
(r297153)
+++ head/sys/boot/i386/libi386/Makefile.depend  Mon Mar 21 18:02:26 2016
(r297154)
@@ -4,6 +4,7 @@
 DIRDEPS = \
include \
include/xlocale \
+   lib/libmd \
 
 
 .include 

Modified: head/sys/boot/i386/loader/Makefile.depend
==
--- head/sys/boot/i386/loader/Makefile.depend   Mon Mar 21 17:53:37 2016
(r297153)
+++ head/sys/boot/i386/loader/Makefile.depend   Mon Mar 21 18:02:26 2016
(r297154)
@@ -6,6 +6,7 @@ DIRDEPS = \
include/xlocale \
lib/libstand \
sys/boot/ficl32 \
+   sys/boot/geli \
sys/boot/i386/btx/btx \
sys/boot/i386/btx/btxldr \
sys/boot/i386/btx/lib \

Modified: head/sys/boot/i386/zfsloader/Makefile.depend
==
--- head/sys/boot/i386/zfsloader/Makefile.dependMon Mar 21 17:53:37 
2016(r297153)
+++ head/sys/boot/i386/zfsloader/Makefile.dependMon Mar 21 18:02:26 
2016(r297154)
@@ -6,6 +6,7 @@ DIRDEPS = \
include/xlocale \
lib/libstand \
sys/boot/ficl32 \
+   sys/boot/geli \
sys/boot/i386/btx/btx \
sys/boot/i386/btx/btxldr \
sys/boot/i386/btx/lib \

Modified: head/targets/pseudo/userland/misc/Makefile.depend
==
--- head/targets/pseudo/userland/misc/Makefile.depend   Mon Mar 21 17:53:37 
2016(r297153)
+++ head/targets/pseudo/userland/misc/Makefile.depend   Mon Mar 21 18:02:26 
2016(r297154)
@@ -32,6 +32,7 @@ DIRDEPS+= \
 
 DIRDEPS.x86sys= \
sys/boot/efi/libefi \
+   sys/boot/geli \
sys/boot/i386/boot0 \
sys/boot/i386/boot0sio \
sys/boot/i386/boot2 \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all

Re: svn commit: r297039 - head/sys/x86/x86

2016-03-21 Thread John Baldwin
On Saturday, March 19, 2016 05:22:16 AM Konstantin Belousov wrote:
> On Fri, Mar 18, 2016 at 07:48:49PM +, John Baldwin wrote:
> >  
> > -   for (x = 0; x < delay; x += 5) {
> > +   for (x = 0; x < delay; x++) {
> > if ((lapic_read_icr_lo() & APIC_DELSTAT_MASK) ==
> > APIC_DELSTAT_IDLE)
> > return (1);
> > -   DELAY(5);
> > +   DELAY(1);
> > }
> > return (0);
> >  }
> 
> Ideally we would structure the loop differently. I think it is more
> efficient WRT latency to only block execution by ia32_pause(), and
> compare the the getbinuptime() results to calculate spent time, on each
> loop step.

Yes.  I've thought about using the TSC directly to do that, but folks are
worried about the TSC being unstable due to vcpus in a VM migrating
across physical CPUs.  DELAY() does seem to DTRT in that case assuming the
hypervisor doesn't advertise an invariant TSC via cpuid.  We'd have to
essentially duplicate DELAY() (really delay_tc()) inline.

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


svn commit: r297155 - head/sys/dev/bxe

2016-03-21 Thread David C Somayajulu
Author: davidcs
Date: Mon Mar 21 18:48:20 2016
New Revision: 297155
URL: https://svnweb.freebsd.org/changeset/base/297155

Log:
  Modifications to achieve a common source base from FreeBSD7.x thru 10.x
  
  MFC after:5 days

Modified:
  head/sys/dev/bxe/bxe.c
  head/sys/dev/bxe/bxe.h

Modified: head/sys/dev/bxe/bxe.c
==
--- head/sys/dev/bxe/bxe.c  Mon Mar 21 18:02:26 2016(r297154)
+++ head/sys/dev/bxe/bxe.c  Mon Mar 21 18:48:20 2016(r297155)
@@ -3063,7 +3063,7 @@ bxe_tpa_stop(struct bxe_softc  *
 #if __FreeBSD_version >= 80
 /* specify what RSS queue was used for this flow */
 m->m_pkthdr.flowid = fp->index;
-M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE);
+BXE_SET_FLOWID(m);
 #endif
 
 if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
@@ -3352,7 +3352,7 @@ bxe_rxeof(struct bxe_softc*sc,
 #if __FreeBSD_version >= 80
 /* specify what RSS queue was used for this flow */
 m->m_pkthdr.flowid = fp->index;
-M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE);
+BXE_SET_FLOWID(m);
 #endif
 
 next_rx:
@@ -4829,6 +4829,8 @@ bxe_dump_mbuf(struct bxe_softc *sc,
 }
 
 while (m) {
+
+#if __FreeBSD_version >= 100
 BLOGD(sc, DBG_MBUF,
   "%02d: mbuf=%p m_len=%d m_flags=0x%b m_data=%p\n",
   i, m, m->m_len, m->m_flags, M_FLAG_BITS, m->m_data);
@@ -4839,6 +4841,26 @@ bxe_dump_mbuf(struct bxe_softc *sc,
i, m->m_pkthdr.len, m->m_flags, M_FLAG_BITS,
(int)m->m_pkthdr.csum_flags, CSUM_BITS);
 }
+#else
+BLOGD(sc, DBG_MBUF,
+  "%02d: mbuf=%p m_len=%d m_flags=0x%b m_data=%p\n",
+  i, m, m->m_len, m->m_flags,
+  "\20\1M_EXT\2M_PKTHDR\3M_EOR\4M_RDONLY", m->m_data);
+
+if (m->m_flags & M_PKTHDR) {
+ BLOGD(sc, DBG_MBUF,
+   "%02d: - m_pkthdr: tot_len=%d flags=0x%b csum_flags=%b\n",
+   i, m->m_pkthdr.len, m->m_flags,
+   "\20\12M_BCAST\13M_MCAST\14M_FRAG"
+   "\15M_FIRSTFRAG\16M_LASTFRAG\21M_VLANTAG"
+   "\22M_PROMISC\23M_NOFREE",
+   (int)m->m_pkthdr.csum_flags,
+   "\20\1CSUM_IP\2CSUM_TCP\3CSUM_UDP\4CSUM_IP_FRAGS"
+   "\5CSUM_FRAGMENT\6CSUM_TSO\11CSUM_IP_CHECKED"
+   "\12CSUM_IP_VALID\13CSUM_DATA_VALID"
+   "\14CSUM_PSEUDO_HDR");
+}
+#endif /* #if __FreeBSD_version >= 100 */
 
 if (m->m_flags & M_EXT) {
 switch (m->m_ext.ext_type) {
@@ -5222,7 +5244,9 @@ bxe_tx_encap(struct bxe_fastpath *fp, st
 
 sc = fp->sc;
 
+#if __FreeBSD_version >= 80
 M_ASSERTPKTHDR(*m_head);
+#endif /* #if __FreeBSD_version >= 80 */
 
 m0 = *m_head;
 rc = defragged = nbds = ovlan = vlan_off = total_pkt_size = 0;
@@ -5741,7 +5765,7 @@ bxe_tx_mq_start_locked(struct bxe_softc 
 if (!sc->link_vars.link_up ||
 (if_getdrvflags(ifp) &
 (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) {
-rc = drbr_enqueue_drv(ifp, tx_br, m);
+rc = drbr_enqueue(ifp, tx_br, m);
 goto bxe_tx_mq_start_locked_exit;
 }
 
@@ -5756,7 +5780,7 @@ bxe_tx_mq_start_locked(struct bxe_softc 
 next = drbr_dequeue_drv(ifp, tx_br);
 } else if (drbr_needs_enqueue_drv(ifp, tx_br)) {
 /* have both new and pending work, maintain packet order */
-rc = drbr_enqueue_drv(ifp, tx_br, m);
+rc = drbr_enqueue(ifp, tx_br, m);
 if (rc != 0) {
 fp->eth_q_stats.tx_soft_errors++;
 goto bxe_tx_mq_start_locked_exit;
@@ -5785,7 +5809,7 @@ bxe_tx_mq_start_locked(struct bxe_softc 
 /* mark the TX queue as full and save the frame */
 if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0);
 /* XXX this may reorder the frame */
-rc = drbr_enqueue_drv(ifp, tx_br, next);
+rc = drbr_enqueue(ifp, tx_br, next);
 fp->eth_q_stats.mbuf_alloc_tx--;
 fp->eth_q_stats.tx_frames_deferred++;
 }
@@ -5837,7 +5861,8 @@ bxe_tx_mq_start(struct ifnet *ifp,
 fp_index = 0; /* default is the first queue */
 
 /* check if flowid is set */
-if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE)
+
+if (BXE_VALID_FLOWID(m))
 fp_index = (m->m_pkthdr.flowid % sc->num_queues);
 
 fp = &sc->fp[fp_index];
@@ -5846,7 +5871,7 @@ bxe_tx_mq_start(struct ifnet *ifp,
 rc = bxe_tx_mq_start_locked(sc, ifp, fp, m);
 BXE_FP_TX_UNLOCK(fp);
 } else
-rc = drbr_enqueue_drv(ifp, fp->tx_br, m);
+rc = drbr_enqueue(ifp, fp->tx_br, m);
 
 return (rc);
 }
@@ -15677,18 +15702,11 @@ bxe_add_sysctls(struct bxe_softc *sc)
   CTLFLAG_RD, BXE_DRIVER_VERSION, 0,
   "version");
 
-SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "bc_versio

svn commit: r297156 - in head: share/man/man4 sys/dev/filemon sys/sys

2016-03-21 Thread Bryan Drewery
Author: bdrewery
Date: Mon Mar 21 20:29:27 2016
New Revision: 297156
URL: https://svnweb.freebsd.org/changeset/base/297156

Log:
  Track filemon usage via a proc.p_filemon pointer rather than its own lists.
  
  - proc.p_filemon is added which is protected by PROC_LOCK.  This improves
performance and avoids double-fork issues, taking allproc_lock
while in syscalls, and walking the process tree in syscalls.  A
particular proc.p_filemon can only be changed to NULL or another
filemon, or the filemon inherited, while the filemon->lock is held.
  - Filemon are reference counted.  On the last reference the log will be 
closed.
  - When closing the devfs file handle, the filemon will be detached from all
processes and inheritance prevented.
  - Disallow attaching to a process already being traced since filemon is
typically intended to be used on children only.  This is allowed for
curproc as bmake relies on this behavior for rare cases when combining
.MAKE with .META.
  - Detach any previously tracked process on ioctl(FILEMON_SET_PID).
  - Handle error from devfs_set_cdevpriv() in filemon_open().
  - The global filemon lock and lists are removed.
  - A free list is no longer kept.  Previously this list was
forever-expanding and never garbage cleaned.
  - No longer loses track of double-forks.  If the process holding the filemon
handle closes it will close the log rather than wait on a daemonized 
process,
but it will log all activity until it closes its handle.  The filemon
will be removed from the process and not inherited.
  - A separate process count is kept only as an optimization for
forced detachment to avoid taking allproc_lock and walking the entire
process tree.
  - struct filemon access is protected by sx(9) filemon->lock as it was before.
  - Add more comments and KASSERTS.
  
  MFC after:2 weeks
  Reviewed by:  kib, mjg, markj (all on previous versions)
  Sponsored by: EMC / Isilon Storage Division
  Differential Revision:https://reviews.freebsd.org/D5520

Deleted:
  head/sys/dev/filemon/filemon_lock.c
Modified:
  head/share/man/man4/filemon.4
  head/sys/dev/filemon/filemon.c
  head/sys/dev/filemon/filemon_wrapper.c
  head/sys/sys/param.h
  head/sys/sys/proc.h

Modified: head/share/man/man4/filemon.4
==
--- head/share/man/man4/filemon.4   Mon Mar 21 18:48:20 2016
(r297155)
+++ head/share/man/man4/filemon.4   Mon Mar 21 20:29:27 2016
(r297156)
@@ -31,7 +31,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 9, 2016
+.Dd March 21, 2016
 .Dt FILEMON 4
 .Os
 .Sh NAME
@@ -116,6 +116,10 @@ Each takes a single argument.
 Write the internal tracing buffer to the supplied open file descriptor.
 .It Dv FILEMON_SET_PID
 Child process ID to trace.
+This should normally be done under the control of a parent in the child after
+.Xr fork 2
+but before anything else.
+See the example below.
 .El
 .Sh RETURN VALUES
 .\" .Rv -std ioctl
@@ -138,6 +142,20 @@ The
 .Nm
 handle is already associated with a file descriptor.
 .El
+.Pp
+The
+.Fn ioctl
+system call
+with
+.Dv FILEMON_SET_PID
+will fail if:
+.Bl -tag -width Er
+.It Bq Er ESRCH
+No process having the specified process ID exists.
+.It Bq Er EBUSY
+The process ID specified is already being traced and was not the current
+process.
+.El
 .Sh FILES
 .Bl -tag -width ".Pa /dev/filemon"
 .It Pa /dev/filemon
@@ -199,14 +217,5 @@ A
 device appeared in
 .Fx 9.1 .
 .Sh BUGS
-Loading
-.Nm
-may reduce system performance for the noted syscalls.
-.Pp
-Only children of the set process are logged.
-Processes can escape being traced by double forking.
-This is not seen as a problem as the intended use is build monitoring, which
-does not make sense to have daemons for.
-.Pp
 Unloading the module may panic the system, thus requires using
 .Ic kldunload -f .

Modified: head/sys/dev/filemon/filemon.c
==
--- head/sys/dev/filemon/filemon.c  Mon Mar 21 18:48:20 2016
(r297155)
+++ head/sys/dev/filemon/filemon.c  Mon Mar 21 20:29:27 2016
(r297156)
@@ -1,7 +1,7 @@
 /*-
  * Copyright (c) 2011, David E. O'Brien.
  * Copyright (c) 2009-2011, Juniper Networks, Inc.
- * Copyright (c) 2015, EMC Corp.
+ * Copyright (c) 2015-2016, EMC Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -80,23 +79,126 @@ static struct cdevsw filemon_cdevsw = {
 MALLOC_DECLARE(M_FILEMON);
 MALLOC_DEFINE(M_FILEMON, "filemon", "File access monitor");
 
+/*
+ * The filemon->lock protects several things currently:
+ * - fname1/fname2/msgbufr are pre-allocated and used per syscall
+ *   for logging and copyins rather than stack variables.
+ * - Serializing the filemon's log output.
+ * - Preventing

svn commit: r297157 - in head: share/man/man4 sys/dev/filemon

2016-03-21 Thread Bryan Drewery
Author: bdrewery
Date: Mon Mar 21 20:29:39 2016
New Revision: 297157
URL: https://svnweb.freebsd.org/changeset/base/297157

Log:
  Stop tracking stat(2).
  
  None of lstat(2), fstat(2), fstatat(2) were tracked either.
  
  The other filemon implementations also do not track stat(2), nor
  does bmake utilize it.  The act of opening a file for read should
  be enough to decide that a file is a dependency.  There could be
  rare cases where just having a file would cause a dependency but it
  is unlikely.
  
  MFC after:2 weeks
  Also noted by:sjg
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/share/man/man4/filemon.4
  head/sys/dev/filemon/filemon_wrapper.c

Modified: head/share/man/man4/filemon.4
==
--- head/share/man/man4/filemon.4   Mon Mar 21 20:29:27 2016
(r297156)
+++ head/share/man/man4/filemon.4   Mon Mar 21 20:29:39 2016
(r297157)
@@ -83,8 +83,6 @@ System calls are denoted using the follo
 .It Ql R
 .Xr open 2
 for read
-.It Ql S
-.Xr stat 2
 .It Ql W
 .Xr open 2
 for write

Modified: head/sys/dev/filemon/filemon_wrapper.c
==
--- head/sys/dev/filemon/filemon_wrapper.c  Mon Mar 21 20:29:27 2016
(r297156)
+++ head/sys/dev/filemon/filemon_wrapper.c  Mon Mar 21 20:29:39 2016
(r297157)
@@ -321,61 +321,6 @@ filemon_wrapper_linkat(struct thread *td
return (ret);
 }
 
-static int
-filemon_wrapper_stat(struct thread *td, struct stat_args *uap)
-{
-   int ret;
-   size_t done;
-   size_t len;
-   struct filemon *filemon;
-
-   if ((ret = sys_stat(td, uap)) == 0) {
-   if ((filemon = filemon_proc_get(curproc)) != NULL) {
-   copyinstr(uap->path, filemon->fname1,
-   sizeof(filemon->fname1), &done);
-
-   len = snprintf(filemon->msgbufr,
-   sizeof(filemon->msgbufr), "S %d %s\n",
-   curproc->p_pid, filemon->fname1);
-
-   filemon_output(filemon, filemon->msgbufr, len);
-
-   filemon_drop(filemon);
-   }
-   }
-
-   return (ret);
-}
-
-#if defined(COMPAT_IA32) || defined(COMPAT_FREEBSD32) || defined(COMPAT_ARCH32)
-static int
-filemon_wrapper_freebsd32_stat(struct thread *td,
-struct freebsd32_stat_args *uap)
-{
-   int ret;
-   size_t done;
-   size_t len;
-   struct filemon *filemon;
-
-   if ((ret = freebsd32_stat(td, uap)) == 0) {
-   if ((filemon = filemon_proc_get(curproc)) != NULL) {
-   copyinstr(uap->path, filemon->fname1,
-   sizeof(filemon->fname1), &done);
-
-   len = snprintf(filemon->msgbufr,
-   sizeof(filemon->msgbufr), "S %d %s\n",
-   curproc->p_pid, filemon->fname1);
-
-   filemon_output(filemon, filemon->msgbufr, len);
-
-   filemon_drop(filemon);
-   }
-   }
-
-   return (ret);
-}
-#endif
-
 static void
 filemon_event_process_exit(void *arg __unused, struct proc *p)
 {
@@ -480,7 +425,6 @@ filemon_wrapper_install(void)
sv_table[SYS_open].sy_call = (sy_call_t *) filemon_wrapper_open;
sv_table[SYS_openat].sy_call = (sy_call_t *) filemon_wrapper_openat;
sv_table[SYS_rename].sy_call = (sy_call_t *) filemon_wrapper_rename;
-   sv_table[SYS_stat].sy_call = (sy_call_t *) filemon_wrapper_stat;
sv_table[SYS_unlink].sy_call = (sy_call_t *) filemon_wrapper_unlink;
sv_table[SYS_link].sy_call = (sy_call_t *) filemon_wrapper_link;
sv_table[SYS_symlink].sy_call = (sy_call_t *) filemon_wrapper_symlink;
@@ -493,7 +437,6 @@ filemon_wrapper_install(void)
sv_table[FREEBSD32_SYS_open].sy_call = (sy_call_t *) 
filemon_wrapper_open;
sv_table[FREEBSD32_SYS_openat].sy_call = (sy_call_t *) 
filemon_wrapper_openat;
sv_table[FREEBSD32_SYS_rename].sy_call = (sy_call_t *) 
filemon_wrapper_rename;
-   sv_table[FREEBSD32_SYS_freebsd32_stat].sy_call = (sy_call_t *) 
filemon_wrapper_freebsd32_stat;
sv_table[FREEBSD32_SYS_unlink].sy_call = (sy_call_t *) 
filemon_wrapper_unlink;
sv_table[FREEBSD32_SYS_link].sy_call = (sy_call_t *) 
filemon_wrapper_link;
sv_table[FREEBSD32_SYS_symlink].sy_call = (sy_call_t *) 
filemon_wrapper_symlink;
@@ -521,7 +464,6 @@ filemon_wrapper_deinstall(void)
sv_table[SYS_open].sy_call = (sy_call_t *)sys_open;
sv_table[SYS_openat].sy_call = (sy_call_t *)sys_openat;
sv_table[SYS_rename].sy_call = (sy_call_t *)sys_rename;
-   sv_table[SYS_stat].sy_call = (sy_call_t *)sys_stat;
sv_table[SYS_unlink].sy_call = (sy_call_t *)sys_unlink;
sv_table[SYS_link].sy_call = (sy_call_t *)sys_link;
sv_table[SYS_symlink].sy_call 

svn commit: r297159 - head/sys/dev/filemon

2016-03-21 Thread Bryan Drewery
Author: bdrewery
Date: Mon Mar 21 20:29:46 2016
New Revision: 297159
URL: https://svnweb.freebsd.org/changeset/base/297159

Log:
  Use curthread for vn_fullpath.
  
  No functional change.
  
  MFC after:2 weeks
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/dev/filemon/filemon_wrapper.c

Modified: head/sys/dev/filemon/filemon_wrapper.c
==
--- head/sys/dev/filemon/filemon_wrapper.c  Mon Mar 21 20:29:43 2016
(r297158)
+++ head/sys/dev/filemon/filemon_wrapper.c  Mon Mar 21 20:29:46 2016
(r297159)
@@ -103,8 +103,7 @@ filemon_event_process_exec(void *arg __u
fullpath = "";
freepath = NULL;
 
-   vn_fullpath(FIRST_THREAD_IN_PROC(p), imgp->vp, &fullpath,
-   &freepath);
+   vn_fullpath(curthread, imgp->vp, &fullpath, &freepath);
 
len = snprintf(filemon->msgbufr,
sizeof(filemon->msgbufr), "E %d %s\n",
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r297161 - head/sys/dev/filemon

2016-03-21 Thread Bryan Drewery
Author: bdrewery
Date: Mon Mar 21 20:29:53 2016
New Revision: 297161
URL: https://svnweb.freebsd.org/changeset/base/297161

Log:
  Attempt to use the namecache for openat(2) path resolution.
  
  This finishes the work done in D2810.
  
  MFC after:2 weeks
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/dev/filemon/filemon_wrapper.c

Modified: head/sys/dev/filemon/filemon_wrapper.c
==
--- head/sys/dev/filemon/filemon_wrapper.c  Mon Mar 21 20:29:49 2016
(r297160)
+++ head/sys/dev/filemon/filemon_wrapper.c  Mon Mar 21 20:29:53 2016
(r297161)
@@ -29,8 +29,9 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include 
 #include 
+#include 
+#include 
 #include 
 #include 
 
@@ -122,24 +123,42 @@ _filemon_wrapper_openat(struct thread *t
 {
size_t done;
size_t len;
+   struct file *fp;
struct filemon *filemon;
+   char *atpath, *freepath;
+   cap_rights_t rights;
 
if ((filemon = filemon_proc_get(curproc)) != NULL) {
+   atpath = "";
+   freepath = NULL;
+   fp = NULL;
+
copyinstr(upath, filemon->fname1,
sizeof(filemon->fname1), &done);
 
-   filemon->fname2[0] = '\0';
if (filemon->fname1[0] != '/' && fd != AT_FDCWD) {
/*
 * rats - we cannot do too much about this.
 * the trace should show a dir we read
 * recently.. output an A record as a clue
 * until we can do better.
+* XXX: This may be able to come out with
+* the namecache lookup now.
 */
len = snprintf(filemon->msgbufr,
sizeof(filemon->msgbufr), "A %d %s\n",
curproc->p_pid, filemon->fname1);
filemon_output(filemon, filemon->msgbufr, len);
+   /*
+* Try to resolve the path from the vnode using the
+* namecache.  It may be inaccurate, but better
+* than nothing.
+*/
+   if (getvnode(td, fd,
+   cap_rights_init(&rights, CAP_LOOKUP), &fp) == 0) {
+   vn_fullpath(td, fp->f_vnode, &atpath,
+   &freepath);
+   }
}
if (flags & O_RDWR) {
/*
@@ -148,18 +167,23 @@ _filemon_wrapper_openat(struct thread *t
 * O_WRONLY.
 */
len = snprintf(filemon->msgbufr,
-   sizeof(filemon->msgbufr), "R %d %s%s\n",
-   curproc->p_pid, filemon->fname2, filemon->fname1);
+   sizeof(filemon->msgbufr), "R %d %s%s%s\n",
+   curproc->p_pid, atpath,
+   atpath[0] != '\0' ? "/" : "", filemon->fname1);
filemon_output(filemon, filemon->msgbufr, len);
}
 
len = snprintf(filemon->msgbufr,
-   sizeof(filemon->msgbufr), "%c %d %s%s\n",
+   sizeof(filemon->msgbufr), "%c %d %s%s%s\n",
(flags & O_ACCMODE) ? 'W':'R',
-   curproc->p_pid, filemon->fname2, filemon->fname1);
+   curproc->p_pid, atpath,
+   atpath[0] != '\0' ? "/" : "", filemon->fname1);
filemon_output(filemon, filemon->msgbufr, len);
 
filemon_drop(filemon);
+   if (fp != NULL)
+   fdrop(fp, td);
+   free(freepath, M_TEMP);
}
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-03-21 Thread Gleb Smirnoff
On Mon, Mar 21, 2016 at 05:51:21AM +, Adrian Chadd wrote:
A> Author: adrian
A> Date: Mon Mar 21 05:51:21 2016
A> New Revision: 297136
A> URL: https://svnweb.freebsd.org/changeset/base/297136
A> 
A> Log:
A>   Remove from NOTES - it's built as a module now.

You are doing wrong. A driver must be buildable as a module and
statically as well.

It is legitimate to remove from GENERIC, but not from NOTES.

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


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

2016-03-21 Thread Adrian Chadd
On 21 March 2016 at 13:35, Gleb Smirnoff  wrote:
> On Mon, Mar 21, 2016 at 05:51:21AM +, Adrian Chadd wrote:
> A> Author: adrian
> A> Date: Mon Mar 21 05:51:21 2016
> A> New Revision: 297136
> A> URL: https://svnweb.freebsd.org/changeset/base/297136
> A>
> A> Log:
> A>   Remove from NOTES - it's built as a module now.
>
> You are doing wrong. A driver must be buildable as a module and
> statically as well.
>
> It is legitimate to remove from GENERIC, but not from NOTES.

Hiya,

I'll put it back once I finish surgery on urtwn.

Thanks,


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


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

2016-03-21 Thread Adrian Chadd
Yeah, I'll recover this, and if_otus, once I finish cutting up urtwn a bit.

Thanks,


-adrian


On 20 March 2016 at 12:16, John Baldwin  wrote:
> On Sunday, March 20, 2016 05:53:31 PM Adrian Chadd wrote:
>> Author: adrian
>> Date: Sun Mar 20 17:53:30 2016
>> New Revision: 297069
>> URL: https://svnweb.freebsd.org/changeset/base/297069
>>
>> Log:
>>   Now that urtwn is its own device, and it'll get hotplug loaded by
>>   devd/ifconfig/etc, don't build it in the kernel.
>>
>>   This should fix the build as well!
>>
>>   Notice by: dchagin
>
> You should fix the entries instead.  Not everyone uses modules and we
> shouldn't prohibit building devices into a custom kernel.  This also
> means the device isn't in NOTES either which is a bug.  Looks like you
> need to fix rtwn as well while you are at it.
>
> --
> John Baldwin
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r297163 - head/tools/tools/vt/setfont

2016-03-21 Thread Ed Maste
Author: emaste
Date: Mon Mar 21 20:51:35 2016
New Revision: 297163
URL: https://svnweb.freebsd.org/changeset/base/297163

Log:
  Remove tools/vt/setfont
  
  It is included in vidcontrol as of r266836.
  
  Sponsored by: The FreeBSD Foundation

Deleted:
  head/tools/tools/vt/setfont/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r297164 - head/sys/net80211

2016-03-21 Thread Andriy Voskoboinyk
Author: avos
Date: Mon Mar 21 20:52:09 2016
New Revision: 297164
URL: https://svnweb.freebsd.org/changeset/base/297164

Log:
  net80211: enable software beacon miss timer in SLEEP state
  
  Tested with WUSB54GC, STA mode (w/ power saving enabled)
  
  Reviewed by:  adrian
  Differential Revision:https://reviews.freebsd.org/D5545

Modified:
  head/sys/net80211/ieee80211_proto.c
  head/sys/net80211/ieee80211_sta.c

Modified: head/sys/net80211/ieee80211_proto.c
==
--- head/sys/net80211/ieee80211_proto.c Mon Mar 21 20:51:35 2016
(r297163)
+++ head/sys/net80211/ieee80211_proto.c Mon Mar 21 20:52:09 2016
(r297164)
@@ -1531,7 +1531,7 @@ beacon_miss(void *arg, int npending)
IEEE80211_LOCK(ic);
TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
/*
-* We only pass events through for sta vap's in RUN state;
+* We only pass events through for sta vap's in RUN+ state;
 * may be too restrictive but for now this saves all the
 * handlers duplicating these checks.
 */
@@ -1550,7 +1550,7 @@ beacon_swmiss(void *arg, int npending)
struct ieee80211com *ic = vap->iv_ic;
 
IEEE80211_LOCK(ic);
-   if (vap->iv_state == IEEE80211_S_RUN) {
+   if (vap->iv_state >= IEEE80211_S_RUN) {
/* XXX Call multiple times if npending > zero? */
vap->iv_bmiss(vap);
}
@@ -1570,8 +1570,7 @@ ieee80211_swbmiss(void *arg)
 
IEEE80211_LOCK_ASSERT(ic);
 
-   /* XXX sleep state? */
-   KASSERT(vap->iv_state == IEEE80211_S_RUN,
+   KASSERT(vap->iv_state >= IEEE80211_S_RUN,
("wrong state %d", vap->iv_state));
 
if (ic->ic_flags & IEEE80211_F_SCAN) {

Modified: head/sys/net80211/ieee80211_sta.c
==
--- head/sys/net80211/ieee80211_sta.c   Mon Mar 21 20:51:35 2016
(r297163)
+++ head/sys/net80211/ieee80211_sta.c   Mon Mar 21 20:52:09 2016
(r297164)
@@ -206,6 +206,24 @@ sta_authretry(struct ieee80211vap *vap, 
}
 }
 
+static void
+sta_swbmiss_start(struct ieee80211vap *vap)
+{
+
+   if (vap->iv_flags_ext & IEEE80211_FEXT_SWBMISS) {
+   /*
+* Start s/w beacon miss timer for devices w/o
+* hardware support.  We fudge a bit here since
+* we're doing this in software.
+*/
+   vap->iv_swbmiss_period = IEEE80211_TU_TO_TICKS(
+   2 * vap->iv_bmissthreshold * vap->iv_bss->ni_intval);
+   vap->iv_swbmiss_count = 0;
+   callout_reset(&vap->iv_swbmiss, vap->iv_swbmiss_period,
+   ieee80211_swbmiss, vap);
+   }
+}
+
 /*
  * IEEE80211_M_STA vap state machine handler.
  * This routine handles the main states in the 802.11 protocol.
@@ -419,19 +437,8 @@ sta_newstate(struct ieee80211vap *vap, e
goto invalid;
}
ieee80211_sync_curchan(ic);
-   if (ostate != IEEE80211_S_RUN &&
-   (vap->iv_flags_ext & IEEE80211_FEXT_SWBMISS)) {
-   /*
-* Start s/w beacon miss timer for devices w/o
-* hardware support.  We fudge a bit here since
-* we're doing this in software.
-*/
-   vap->iv_swbmiss_period = IEEE80211_TU_TO_TICKS(
-   2 * vap->iv_bmissthreshold * ni->ni_intval);
-   vap->iv_swbmiss_count = 0;
-   callout_reset(&vap->iv_swbmiss, vap->iv_swbmiss_period,
-   ieee80211_swbmiss, vap);
-   }
+   if (ostate != IEEE80211_S_RUN)
+   sta_swbmiss_start(vap);
/*
 * When 802.1x is not in use mark the port authorized
 * at this point so traffic can flow.
@@ -451,6 +458,7 @@ sta_newstate(struct ieee80211vap *vap, e
goto invalid;
break;
case IEEE80211_S_SLEEP:
+   sta_swbmiss_start(vap);
vap->iv_sta_ps(vap, 1);
break;
default:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-03-21 Thread Warner Losh

> On Mar 21, 2016, at 2:35 PM, Gleb Smirnoff  wrote:
> 
> On Mon, Mar 21, 2016 at 05:51:21AM +, Adrian Chadd wrote:
> A> Author: adrian
> A> Date: Mon Mar 21 05:51:21 2016
> A> New Revision: 297136
> A> URL: https://svnweb.freebsd.org/changeset/base/297136
> A>
> A> Log:
> A>   Remove from NOTES - it's built as a module now.
> 
> You are doing wrong. A driver must be buildable as a module and
> statically as well.
> 
> It is legitimate to remove from GENERIC, but not from NOTES.

In private conversations with Adrian, he indicated that he’s about to
reorganize this driver substantially. He’ll make sure it works during the
record period as a module, but can’t guarantee he won’t break building
it into the kernel. So he took it out from here so that the LINT build
doesn’t break. He intends to reconnect it once he’s done with the
rearrangement.

Warner



signature.asc
Description: Message signed with OpenPGP using GPGMail


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

2016-03-21 Thread Adrian Chadd
On 21 March 2016 at 13:52, Warner Losh  wrote:
>
>> On Mar 21, 2016, at 2:35 PM, Gleb Smirnoff  wrote:
>>
>> On Mon, Mar 21, 2016 at 05:51:21AM +, Adrian Chadd wrote:
>> A> Author: adrian
>> A> Date: Mon Mar 21 05:51:21 2016
>> A> New Revision: 297136
>> A> URL: https://svnweb.freebsd.org/changeset/base/297136
>> A>
>> A> Log:
>> A>   Remove from NOTES - it's built as a module now.
>>
>> You are doing wrong. A driver must be buildable as a module and
>> statically as well.
>>
>> It is legitimate to remove from GENERIC, but not from NOTES.
>
> In private conversations with Adrian, he indicated that he’s about to
> reorganize this driver substantially. He’ll make sure it works during the
> record period as a module, but can’t guarantee he won’t break building
> it into the kernel. So he took it out from here so that the LINT build
> doesn’t break. He intends to reconnect it once he’s done with the
> rearrangement.

+1 here.

rtwn and urtwn are effectively the same family but with a different
DMA front-end, so I'd like to take a stab at unifying all of that.
Otherwise adding 11ac drivers in that family will just be annoyingly
duplicate-y.



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

svn commit: r297165 - head/sys/dev/usb/wlan

2016-03-21 Thread Andriy Voskoboinyk
Author: avos
Date: Mon Mar 21 21:02:57 2016
New Revision: 297165
URL: https://svnweb.freebsd.org/changeset/base/297165

Log:
  rum: separate some microcontroller vendor-specific requests into
  rum_do_mcu_request()
  
  This change should be no-op.
  
  Reviewed by:  adrian
  Differential Revision:https://reviews.freebsd.org/D5542

Modified:
  head/sys/dev/usb/wlan/if_rum.c

Modified: head/sys/dev/usb/wlan/if_rum.c
==
--- head/sys/dev/usb/wlan/if_rum.c  Mon Mar 21 20:52:09 2016
(r297164)
+++ head/sys/dev/usb/wlan/if_rum.c  Mon Mar 21 21:02:57 2016
(r297165)
@@ -154,6 +154,7 @@ static usb_callback_t rum_bulk_write_cal
 
 static usb_error_t rum_do_request(struct rum_softc *sc,
struct usb_device_request *req, void *data);
+static usb_error_t rum_do_mcu_request(struct rum_softc *sc, int);
 static struct ieee80211vap *rum_vap_create(struct ieee80211com *,
const char [IFNAMSIZ], int, enum ieee80211_opmode,
int, const uint8_t [IEEE80211_ADDR_LEN],
@@ -629,6 +630,20 @@ rum_do_request(struct rum_softc *sc,
return (err);
 }
 
+static usb_error_t
+rum_do_mcu_request(struct rum_softc *sc, int request)
+{
+   struct usb_device_request req;
+
+   req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
+   req.bRequest = RT2573_MCU_CNTL;
+   USETW(req.wValue, request);
+   USETW(req.wIndex, 0);
+   USETW(req.wLength, 0);
+
+   return (rum_do_request(sc, &req, NULL));
+}
+
 static struct ieee80211vap *
 rum_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit,
 enum ieee80211_opmode opmode, int flags,
@@ -2460,7 +2475,6 @@ rum_stop(struct rum_softc *sc)
 static void
 rum_load_microcode(struct rum_softc *sc, const uint8_t *ucode, size_t size)
 {
-   struct usb_device_request req;
uint16_t reg = RT2573_MCU_CODE_BASE;
usb_error_t err;
 
@@ -2475,14 +2489,8 @@ rum_load_microcode(struct rum_softc *sc,
}
}
 
-   req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
-   req.bRequest = RT2573_MCU_CNTL;
-   USETW(req.wValue, RT2573_MCU_RUN);
-   USETW(req.wIndex, 0);
-   USETW(req.wLength, 0);
-
-   err = rum_do_request(sc, &req, NULL);
-   if (err != 0) {
+   err = rum_do_mcu_request(sc, RT2573_MCU_RUN);
+   if (err != USB_ERR_NORMAL_COMPLETION) {
device_printf(sc->sc_dev, "could not run firmware: %s\n",
usbd_errstr(err));
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r297166 - head/sys/dev/usb/wlan

2016-03-21 Thread Andriy Voskoboinyk
Author: avos
Date: Mon Mar 21 21:33:30 2016
New Revision: 297166
URL: https://svnweb.freebsd.org/changeset/base/297166

Log:
  rum: do not try to restore bssid/TSF synchronization when device
  is not associated.
  
  Tested with WUSB54GC, STA mode.
  
  Reviewed by:  adrian
  Differential Revision:https://reviews.freebsd.org/D5543

Modified:
  head/sys/dev/usb/wlan/if_rum.c

Modified: head/sys/dev/usb/wlan/if_rum.c
==
--- head/sys/dev/usb/wlan/if_rum.c  Mon Mar 21 21:02:57 2016
(r297165)
+++ head/sys/dev/usb/wlan/if_rum.c  Mon Mar 21 21:33:30 2016
(r297166)
@@ -2932,14 +2932,15 @@ rum_scan_end(struct ieee80211com *ic)
 {
struct rum_softc *sc = ic->ic_softc;
 
-   RUM_LOCK(sc);
-   if (ic->ic_opmode != IEEE80211_M_AHDEMO)
-   rum_enable_tsf_sync(sc);
-   else
-   rum_enable_tsf(sc);
-   rum_set_bssid(sc, sc->sc_bssid);
-   RUM_UNLOCK(sc);
-
+   if (ic->ic_flags_ext & IEEE80211_FEXT_BGSCAN) {
+   RUM_LOCK(sc);
+   if (ic->ic_opmode != IEEE80211_M_AHDEMO)
+   rum_enable_tsf_sync(sc);
+   else
+   rum_enable_tsf(sc);
+   rum_set_bssid(sc, sc->sc_bssid);
+   RUM_UNLOCK(sc);
+   }
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-03-21 Thread John Baldwin
Author: jhb
Date: Mon Mar 21 21:38:35 2016
New Revision: 297168
URL: https://svnweb.freebsd.org/changeset/base/297168

Log:
  Regen.

Modified:
  head/sys/kern/init_sysent.c
  head/sys/kern/syscalls.c
  head/sys/kern/systrace_args.c
  head/sys/sys/syscall.h
  head/sys/sys/syscall.mk
  head/sys/sys/sysproto.h

Modified: head/sys/kern/init_sysent.c
==
--- head/sys/kern/init_sysent.c Mon Mar 21 21:37:33 2016(r297167)
+++ head/sys/kern/init_sysent.c Mon Mar 21 21:38:35 2016(r297168)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 296572 2016-03-09 
19:05:11Z jhb 
+ * created from FreeBSD: head/sys/kern/syscalls.master 297167 2016-03-21 
21:37:33Z jhb 
  */
 
 #include "opt_compat.h"

Modified: head/sys/kern/syscalls.c
==
--- head/sys/kern/syscalls.cMon Mar 21 21:37:33 2016(r297167)
+++ head/sys/kern/syscalls.cMon Mar 21 21:38:35 2016(r297168)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 296572 2016-03-09 
19:05:11Z jhb 
+ * created from FreeBSD: head/sys/kern/syscalls.master 297167 2016-03-21 
21:37:33Z jhb 
  */
 
 const char *syscallnames[] = {

Modified: head/sys/kern/systrace_args.c
==
--- head/sys/kern/systrace_args.c   Mon Mar 21 21:37:33 2016
(r297167)
+++ head/sys/kern/systrace_args.c   Mon Mar 21 21:38:35 2016
(r297168)
@@ -9796,7 +9796,7 @@ systrace_return_setargdesc(int sysnum, i
/* aio_return */
case 314:
if (ndx == 0 || ndx == 1)
-   p = "int";
+   p = "ssize_t";
break;
/* aio_suspend */
case 315:
@@ -9972,7 +9972,7 @@ systrace_return_setargdesc(int sysnum, i
/* aio_waitcomplete */
case 359:
if (ndx == 0 || ndx == 1)
-   p = "int";
+   p = "ssize_t";
break;
/* getresuid */
case 360:

Modified: head/sys/sys/syscall.h
==
--- head/sys/sys/syscall.h  Mon Mar 21 21:37:33 2016(r297167)
+++ head/sys/sys/syscall.h  Mon Mar 21 21:38:35 2016(r297168)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 296572 2016-03-09 
19:05:11Z jhb 
+ * created from FreeBSD: head/sys/kern/syscalls.master 297167 2016-03-21 
21:37:33Z jhb 
  */
 
 #defineSYS_syscall 0

Modified: head/sys/sys/syscall.mk
==
--- head/sys/sys/syscall.mk Mon Mar 21 21:37:33 2016(r297167)
+++ head/sys/sys/syscall.mk Mon Mar 21 21:38:35 2016(r297168)
@@ -1,7 +1,7 @@
 # FreeBSD system call object files.
 # DO NOT EDIT-- this file is automatically generated.
 # $FreeBSD$
-# created from FreeBSD: head/sys/kern/syscalls.master 296572 2016-03-09 
19:05:11Z jhb 
+# created from FreeBSD: head/sys/kern/syscalls.master 297167 2016-03-21 
21:37:33Z jhb 
 MIASM =  \
syscall.o \
exit.o \

Modified: head/sys/sys/sysproto.h
==
--- head/sys/sys/sysproto.h Mon Mar 21 21:37:33 2016(r297167)
+++ head/sys/sys/sysproto.h Mon Mar 21 21:38:35 2016(r297168)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 296572 2016-03-09 
19:05:11Z jhb 
+ * created from FreeBSD: head/sys/kern/syscalls.master 297167 2016-03-21 
21:37:33Z jhb 
  */
 
 #ifndef _SYS_SYSPROTO_H_
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r297169 - head/sys/dev/usb/wlan

2016-03-21 Thread Andriy Voskoboinyk
Author: avos
Date: Mon Mar 21 22:14:48 2016
New Revision: 297169
URL: https://svnweb.freebsd.org/changeset/base/297169

Log:
  rum: simplify error handling in rum_newstate().
  
  Tested with WUSB54GC, STA mode.
  
  Reviewed by:  adrian
  Differential Revision:https://reviews.freebsd.org/D5544

Modified:
  head/sys/dev/usb/wlan/if_rum.c

Modified: head/sys/dev/usb/wlan/if_rum.c
==
--- head/sys/dev/usb/wlan/if_rum.c  Mon Mar 21 21:38:35 2016
(r297168)
+++ head/sys/dev/usb/wlan/if_rum.c  Mon Mar 21 22:14:48 2016
(r297169)
@@ -819,7 +819,7 @@ rum_newstate(struct ieee80211vap *vap, e
const struct ieee80211_txparam *tp;
enum ieee80211_state ostate;
struct ieee80211_node *ni;
-   int ret;
+   int ret = 0;
 
ostate = vap->iv_state;
DPRINTF("%s -> %s\n",
@@ -872,6 +872,7 @@ rum_newstate(struct ieee80211vap *vap, e
tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)];
if (tp->ucastrate == IEEE80211_FIXED_RATE_NONE)
rum_ratectl_start(sc, ni);
+run_fail:
ieee80211_free_node(ni);
break;
default:
@@ -879,13 +880,7 @@ rum_newstate(struct ieee80211vap *vap, e
}
RUM_UNLOCK(sc);
IEEE80211_LOCK(ic);
-   return (rvp->newstate(vap, nstate, arg));
-
-run_fail:
-   RUM_UNLOCK(sc);
-   IEEE80211_LOCK(ic);
-   ieee80211_free_node(ni);
-   return ret;
+   return (ret == 0 ? rvp->newstate(vap, nstate, arg) : ret);
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r297170 - in head/sys/dev: mvs siis

2016-03-21 Thread Justin Hibbits
Author: jhibbits
Date: Mon Mar 21 22:19:53 2016
New Revision: 297170
URL: https://svnweb.freebsd.org/changeset/base/297170

Log:
  Fix some more long -> rman_res_t
  
  Reported by:  Michael Butler (siis breakage)

Modified:
  head/sys/dev/mvs/mvs_pci.c
  head/sys/dev/mvs/mvs_soc.c
  head/sys/dev/siis/siis.c

Modified: head/sys/dev/mvs/mvs_pci.c
==
--- head/sys/dev/mvs/mvs_pci.c  Mon Mar 21 22:14:48 2016(r297169)
+++ head/sys/dev/mvs/mvs_pci.c  Mon Mar 21 22:19:53 2016(r297170)
@@ -396,7 +396,7 @@ mvs_alloc_resource(device_t dev, device_
int unit = ((struct mvs_channel *)device_get_softc(child))->unit;
struct resource *res = NULL;
int offset = HC_BASE(unit >> 2) + PORT_BASE(unit & 0x03);
-   long st;
+   rman_res_t st;
 
switch (type) {
case SYS_RES_MEMORY:

Modified: head/sys/dev/mvs/mvs_soc.c
==
--- head/sys/dev/mvs/mvs_soc.c  Mon Mar 21 22:14:48 2016(r297169)
+++ head/sys/dev/mvs/mvs_soc.c  Mon Mar 21 22:19:53 2016(r297170)
@@ -342,7 +342,7 @@ mvs_alloc_resource(device_t dev, device_
int unit = ((struct mvs_channel *)device_get_softc(child))->unit;
struct resource *res = NULL;
int offset = PORT_BASE(unit & 0x03);
-   long st;
+   rman_res_t st;
 
switch (type) {
case SYS_RES_MEMORY:

Modified: head/sys/dev/siis/siis.c
==
--- head/sys/dev/siis/siis.cMon Mar 21 22:14:48 2016(r297169)
+++ head/sys/dev/siis/siis.cMon Mar 21 22:19:53 2016(r297170)
@@ -320,7 +320,7 @@ siis_alloc_resource(device_t dev, device
int unit = ((struct siis_channel *)device_get_softc(child))->unit;
struct resource *res = NULL;
int offset = unit << 13;
-   long st;
+   rman_res_t st;
 
switch (type) {
case SYS_RES_MEMORY:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r297171 - head/sys/dev/usb/wlan

2016-03-21 Thread Andriy Voskoboinyk
Author: avos
Date: Mon Mar 21 22:29:24 2016
New Revision: 297171
URL: https://svnweb.freebsd.org/changeset/base/297171

Log:
  rum: add legacy power saving support (STA mode).
  
  Tested with WUSB54GC, STA mode + WRT54GC / RTL8188EU in HOSTAP mode.
  
  Reviewed by:  adrian
  Differential Revision:https://reviews.freebsd.org/D5546

Modified:
  head/sys/dev/usb/wlan/if_rum.c
  head/sys/dev/usb/wlan/if_rumreg.h
  head/sys/dev/usb/wlan/if_rumvar.h

Modified: head/sys/dev/usb/wlan/if_rum.c
==
--- head/sys/dev/usb/wlan/if_rum.c  Mon Mar 21 22:19:53 2016
(r297170)
+++ head/sys/dev/usb/wlan/if_rum.c  Mon Mar 21 22:29:24 2016
(r297171)
@@ -166,6 +166,11 @@ static int rum_cmd_sleepable(struct rum
 static voidrum_tx_free(struct rum_tx_data *, int);
 static voidrum_setup_tx_list(struct rum_softc *);
 static voidrum_unsetup_tx_list(struct rum_softc *);
+static voidrum_beacon_miss(struct ieee80211vap *);
+static voidrum_sta_recv_mgmt(struct ieee80211_node *,
+   struct mbuf *, int,
+   const struct ieee80211_rx_stats *, int, int);
+static int rum_set_power_state(struct rum_softc *, int);
 static int rum_newstate(struct ieee80211vap *,
enum ieee80211_state, int);
 static uint8_t rum_crypto_mode(struct rum_softc *, u_int, int);
@@ -233,6 +238,8 @@ static int  rum_init(struct rum_softc *)
 static voidrum_stop(struct rum_softc *);
 static voidrum_load_microcode(struct rum_softc *, const uint8_t *,
size_t);
+static int rum_set_sleep_time(struct rum_softc *, uint16_t);
+static int rum_reset(struct ieee80211vap *, u_long);
 static int rum_set_beacon(struct rum_softc *,
struct ieee80211vap *);
 static int rum_alloc_beacon(struct rum_softc *,
@@ -531,6 +538,8 @@ rum_attach(device_t self)
| IEEE80211_C_BGSCAN/* bg scanning supported */
| IEEE80211_C_WPA   /* 802.11i */
| IEEE80211_C_WME   /* 802.11e */
+   | IEEE80211_C_PMGT  /* Station-side power mgmt */
+   | IEEE80211_C_SWSLEEP   /* net80211 managed power mgmt */
;
 
ic->ic_cryptocaps =
@@ -674,8 +683,24 @@ rum_vap_create(struct ieee80211com *ic, 
vap->iv_key_set = rum_key_set;
vap->iv_key_delete = rum_key_delete;
vap->iv_update_beacon = rum_update_beacon;
+   vap->iv_reset = rum_reset;
vap->iv_max_aid = RT2573_ADDR_MAX;
 
+   if (opmode == IEEE80211_M_STA) {
+   /*
+* Move device to the sleep state when
+* beacon is received and there is no data for us.
+*
+* Used only for IEEE80211_S_SLEEP state.
+*/
+   rvp->recv_mgmt = vap->iv_recv_mgmt;
+   vap->iv_recv_mgmt = rum_sta_recv_mgmt;
+
+   /* Ignored while sleeping. */
+   rvp->bmiss = vap->iv_bmiss;
+   vap->iv_bmiss = rum_beacon_miss;
+   }
+
usb_callout_init_mtx(&rvp->ratectl_ch, &sc->sc_mtx, 0);
TASK_INIT(&rvp->ratectl_task, 0, rum_ratectl_task, rvp);
ieee80211_ratectl_init(vap);
@@ -810,6 +835,89 @@ rum_unsetup_tx_list(struct rum_softc *sc
}
 }
 
+static void
+rum_beacon_miss(struct ieee80211vap *vap)
+{
+   struct ieee80211com *ic = vap->iv_ic;
+   struct rum_softc *sc = ic->ic_softc;
+   struct rum_vap *rvp = RUM_VAP(vap);
+   int sleep;
+
+   RUM_LOCK(sc);
+   if (sc->sc_sleeping && sc->sc_sleep_end < ticks) {
+   DPRINTFN(12, "dropping 'sleeping' bit, "
+   "device must be awake now\n");
+
+   sc->sc_sleeping = 0;
+   }
+
+   sleep = sc->sc_sleeping;
+   RUM_UNLOCK(sc);
+
+   if (!sleep)
+   rvp->bmiss(vap);
+#ifdef USB_DEBUG
+   else
+   DPRINTFN(13, "bmiss event is ignored whilst sleeping\n");
+#endif
+}
+
+static void
+rum_sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m, int subtype,
+const struct ieee80211_rx_stats *rxs,
+int rssi, int nf)
+{
+   struct ieee80211vap *vap = ni->ni_vap;
+   struct rum_softc *sc = vap->iv_ic->ic_softc;
+   struct rum_vap *rvp = RUM_VAP(vap);
+
+   if (vap->iv_state == IEEE80211_S_SLEEP &&
+   subtype == IEEE80211_FC0_SUBTYPE_BEACON) {
+   RUM_LOCK(sc);
+   DPRINTFN(12, "beacon, mybss %d (flags %02X)\n",
+   !!(sc->last_rx_flags & RT2573_RX_MYBSS),
+   sc->last_rx_flags);
+
+   if ((sc->last_rx_flags & (RT2573_RX_MYBSS | RT2573_RX_BC)) ==
+   (RT2573_RX_MYBSS | RT2573_RX_BC)) {
+   /*
+

Re: svn commit: r297167 - in head: lib/libc/sys sys/kern sys/sys tests/sys/aio

2016-03-21 Thread John Baldwin
On Monday, March 21, 2016 09:37:33 PM John Baldwin wrote:
> Author: jhb
> Date: Mon Mar 21 21:37:33 2016
> New Revision: 297167
> URL: https://svnweb.freebsd.org/changeset/base/297167
> 
> Log:
>   Fully handle size_t lengths in AIO requests.
>   
>   First, update the return types of aio_return() and aio_waitcomplete() to
>   ssize_t.
>   
>   POSIX requires aio_return() to return a ssize_t so that it can represent
>   all return values from read() and write().  aio_waitcomplete() should use
>   ssize_t for the same reason.
>   
>   aio_return() has used ssize_t in  since r31620 but the manpage and
>   system call entry were not updated.  aio_waitcomplete() has always
>   returned int.
>   
>   Note that this does not require new system call stubs as this is
>   effectively only an API change in how the compiler interprets the return
>   value.
>   
>   Second, allow aio_nbytes values up to IOSIZE_MAX instead of just INT_MAX.
>   
>   aio_read/write should now honor the same length limits as normal read/write.
>   
>   Third, use longs instead of ints in the aio_return() and aio_waitcomplete()
>   system call functions so that the 64-bit size_t in the in-kernel aiocb
>   isn't truncated to 32-bits before being copied out to userland or
>   being returned.
>   
>   Finally, a simple test has been added to verify the bounds checking on the
>   maximum read size from a file.

Oops, missed the metadata:

Reviewed by:kib (not the test, I added that later)
Sponsored by:   Chelsio
Differential Revision:  https://reviews.freebsd.org/D5679

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


svn commit: r297172 - head/sys/dev/filemon

2016-03-21 Thread Bryan Drewery
Author: bdrewery
Date: Mon Mar 21 23:22:19 2016
New Revision: 297172
URL: https://svnweb.freebsd.org/changeset/base/297172

Log:
  Consolidate common link(2) logic.
  
  MFC after:2 weeks
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/dev/filemon/filemon_wrapper.c

Modified: head/sys/dev/filemon/filemon_wrapper.c
==
--- head/sys/dev/filemon/filemon_wrapper.c  Mon Mar 21 22:29:24 2016
(r297171)
+++ head/sys/dev/filemon/filemon_wrapper.c  Mon Mar 21 23:22:19 2016
(r297172)
@@ -237,58 +237,46 @@ filemon_wrapper_rename(struct thread *td
return (ret);
 }
 
-static int
-filemon_wrapper_link(struct thread *td, struct link_args *uap)
+static void
+_filemon_wrapper_link(struct thread *td, char *upath1, char *upath2)
 {
-   int ret;
-   size_t done;
-   size_t len;
struct filemon *filemon;
+   size_t len;
 
-   if ((ret = sys_link(td, uap)) == 0) {
-   if ((filemon = filemon_proc_get(curproc)) != NULL) {
-   copyinstr(uap->path, filemon->fname1,
-   sizeof(filemon->fname1), &done);
-   copyinstr(uap->link, filemon->fname2,
-   sizeof(filemon->fname2), &done);
+   if ((filemon = filemon_proc_get(curproc)) != NULL) {
+   copyinstr(upath1, filemon->fname1,
+   sizeof(filemon->fname1), NULL);
+   copyinstr(upath2, filemon->fname2,
+   sizeof(filemon->fname2), NULL);
 
-   len = snprintf(filemon->msgbufr,
-   sizeof(filemon->msgbufr), "L %d '%s' '%s'\n",
-   curproc->p_pid, filemon->fname1, filemon->fname2);
+   len = snprintf(filemon->msgbufr,
+   sizeof(filemon->msgbufr), "L %d '%s' '%s'\n",
+   curproc->p_pid, filemon->fname1, filemon->fname2);
 
-   filemon_output(filemon, filemon->msgbufr, len);
+   filemon_output(filemon, filemon->msgbufr, len);
 
-   filemon_drop(filemon);
-   }
+   filemon_drop(filemon);
}
-
-   return (ret);
 }
 
 static int
-filemon_wrapper_symlink(struct thread *td, struct symlink_args *uap)
+filemon_wrapper_link(struct thread *td, struct link_args *uap)
 {
int ret;
-   size_t done;
-   size_t len;
-   struct filemon *filemon;
 
-   if ((ret = sys_symlink(td, uap)) == 0) {
-   if ((filemon = filemon_proc_get(curproc)) != NULL) {
-   copyinstr(uap->path, filemon->fname1,
-   sizeof(filemon->fname1), &done);
-   copyinstr(uap->link, filemon->fname2,
-   sizeof(filemon->fname2), &done);
+   if ((ret = sys_link(td, uap)) == 0)
+   _filemon_wrapper_link(td, uap->path, uap->link);
 
-   len = snprintf(filemon->msgbufr,
-   sizeof(filemon->msgbufr), "L %d '%s' '%s'\n",
-   curproc->p_pid, filemon->fname1, filemon->fname2);
+   return (ret);
+}
 
-   filemon_output(filemon, filemon->msgbufr, len);
+static int
+filemon_wrapper_symlink(struct thread *td, struct symlink_args *uap)
+{
+   int ret;
 
-   filemon_drop(filemon);
-   }
-   }
+   if ((ret = sys_symlink(td, uap)) == 0)
+   _filemon_wrapper_link(td, uap->path, uap->link);
 
return (ret);
 }
@@ -297,26 +285,9 @@ static int
 filemon_wrapper_linkat(struct thread *td, struct linkat_args *uap)
 {
int ret;
-   size_t done;
-   size_t len;
-   struct filemon *filemon;
-
-   if ((ret = sys_linkat(td, uap)) == 0) {
-   if ((filemon = filemon_proc_get(curproc)) != NULL) {
-   copyinstr(uap->path1, filemon->fname1,
-   sizeof(filemon->fname1), &done);
-   copyinstr(uap->path2, filemon->fname2,
-   sizeof(filemon->fname2), &done);
-
-   len = snprintf(filemon->msgbufr,
-   sizeof(filemon->msgbufr), "L %d '%s' '%s'\n",
-   curproc->p_pid, filemon->fname1, filemon->fname2);
-
-   filemon_output(filemon, filemon->msgbufr, len);
 
-   filemon_drop(filemon);
-   }
-   }
+   if ((ret = sys_linkat(td, uap)) == 0)
+   _filemon_wrapper_link(td, uap->path1, uap->path2);
 
return (ret);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r297173 - head/sys/dev/wpi

2016-03-21 Thread Andriy Voskoboinyk
Author: avos
Date: Mon Mar 21 23:25:41 2016
New Revision: 297173
URL: https://svnweb.freebsd.org/changeset/base/297173

Log:
  wpi: remove internal taskqueue
  
  - Replace sc_reinittask() by ieee80211_restart_all() (mostly the same).
  - Revert r282377 (seems to be unneeded now).
  
  Tested with Intel 3945BG, STA mode.
  
  Differential Revision:https://reviews.freebsd.org/D5056

Modified:
  head/sys/dev/wpi/if_wpi.c
  head/sys/dev/wpi/if_wpivar.h

Modified: head/sys/dev/wpi/if_wpi.c
==
--- head/sys/dev/wpi/if_wpi.c   Mon Mar 21 23:22:19 2016(r297172)
+++ head/sys/dev/wpi/if_wpi.c   Mon Mar 21 23:25:41 2016(r297173)
@@ -284,7 +284,6 @@ static void wpi_scan_end(struct ieee8021
 static voidwpi_set_channel(struct ieee80211com *);
 static voidwpi_scan_curchan(struct ieee80211_scan_state *, unsigned long);
 static voidwpi_scan_mindwell(struct ieee80211_scan_state *);
-static voidwpi_hw_reset(void *, int);
 
 static device_method_t wpi_methods[] = {
/* Device interface */
@@ -531,18 +530,9 @@ wpi_attach(device_t dev)
callout_init_mtx(&sc->scan_timeout, &sc->rxon_mtx, 0);
callout_init_mtx(&sc->tx_timeout, &sc->txq_state_mtx, 0);
callout_init_mtx(&sc->watchdog_rfkill, &sc->sc_mtx, 0);
-   TASK_INIT(&sc->sc_reinittask, 0, wpi_hw_reset, sc);
TASK_INIT(&sc->sc_radiooff_task, 0, wpi_radio_off, sc);
TASK_INIT(&sc->sc_radioon_task, 0, wpi_radio_on, sc);
 
-   sc->sc_tq = taskqueue_create("wpi_taskq", M_WAITOK,
-   taskqueue_thread_enqueue, &sc->sc_tq);
-   error = taskqueue_start_threads(&sc->sc_tq, 1, 0, "wpi_taskq");
-   if (error != 0) {
-   device_printf(dev, "can't start threads, error %d\n", error);
-   goto fail;
-   }
-
wpi_sysctlattach(sc);
 
/*
@@ -695,14 +685,10 @@ wpi_detach(device_t dev)
 
if (ic->ic_vap_create == wpi_vap_create) {
ieee80211_draintask(ic, &sc->sc_radioon_task);
+   ieee80211_draintask(ic, &sc->sc_radiooff_task);
 
wpi_stop(sc);
 
-   if (sc->sc_tq != NULL) {
-   taskqueue_drain_all(sc->sc_tq);
-   taskqueue_free(sc->sc_tq);
-   }
-
callout_drain(&sc->watchdog_rfkill);
callout_drain(&sc->tx_timeout);
callout_drain(&sc->scan_timeout);
@@ -2332,7 +2318,7 @@ wpi_notif_intr(struct wpi_softc *sc)
WPI_NT_LOCK(sc);
wpi_clear_node_table(sc);
WPI_NT_UNLOCK(sc);
-   taskqueue_enqueue(sc->sc_tq,
+   ieee80211_runtask(ic,
&sc->sc_radiooff_task);
return;
}
@@ -2569,6 +2555,8 @@ wpi_intr(void *arg)
WPI_WRITE(sc, WPI_FH_INT, r2);
 
if (__predict_false(r1 & (WPI_INT_SW_ERR | WPI_INT_HW_ERR))) {
+   struct ieee80211com *ic = &sc->sc_ic;
+
device_printf(sc->sc_dev, "fatal firmware error\n");
 #ifdef WPI_DEBUG
wpi_debug_registers(sc);
@@ -2577,7 +2565,7 @@ wpi_intr(void *arg)
DPRINTF(sc, WPI_DEBUG_HW,
"(%s)\n", (r1 & WPI_INT_SW_ERR) ? "(Software Error)" :
"(Hardware Error)");
-   taskqueue_enqueue(sc->sc_tq, &sc->sc_reinittask);
+   ieee80211_restart_all(ic);
goto end;
}
 
@@ -3200,7 +3188,7 @@ wpi_scan_timeout(void *arg)
struct ieee80211com *ic = &sc->sc_ic;
 
ic_printf(ic, "scan timeout\n");
-   taskqueue_enqueue(sc->sc_tq, &sc->sc_reinittask);
+   ieee80211_restart_all(ic);
 }
 
 static void
@@ -3210,7 +3198,7 @@ wpi_tx_timeout(void *arg)
struct ieee80211com *ic = &sc->sc_ic;
 
ic_printf(ic, "device timeout\n");
-   taskqueue_enqueue(sc->sc_tq, &sc->sc_reinittask);
+   ieee80211_restart_all(ic);
 }
 
 static void
@@ -3227,8 +3215,10 @@ wpi_parent(struct ieee80211com *ic)
ieee80211_notify_radio(ic, 0);
ieee80211_stop(vap);
}
-   } else
+   } else {
+   ieee80211_notify_radio(ic, 0);
wpi_stop(sc);
+   }
 }
 
 /*
@@ -5654,23 +5644,3 @@ wpi_scan_mindwell(struct ieee80211_scan_
 {
/* NB: don't try to abort scan; wait for firmware to finish */
 }
-
-static void
-wpi_hw_reset(void *arg, int pending)
-{
-   struct wpi_softc *sc = arg;
-   struct ieee80211com *ic = &sc->sc_ic;
-   struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
-
-   DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_DOING, __func__);
-
-   ieee80211_notify_radio(ic, 0);
-   if (vap != NULL && (ic->ic_flags & IEEE80211_F_SCAN))
-   ieee80211_cancel_scan(vap);
-
-   wpi

svn commit: r297175 - head/sys/dev/urtwn

2016-03-21 Thread Adrian Chadd
Author: adrian
Date: Tue Mar 22 01:09:15 2016
New Revision: 297175
URL: https://svnweb.freebsd.org/changeset/base/297175

Log:
  [urtwn] welcome basic 11n support to urtwn.
  
  This is a pretty good reference for teaching an almost-11n-capable
  driver about 11n.
  
  It enables HT20 operation, A-MPDU/A-MSDU RX, but no aggregate support
  for transmit.  That'll come later.  This means that receive throughput
  should be higher, but transmit throughput won't have changed much.
  
  * Disable bgscan - for now, bgscan will interfere with AMPDU TX/RX,
so until we correctly handle it in software driven scans, disable.
  * Add null 11n methods for channel width / ampdu_enable.
the firmware can apparently handle ampdu tx (and hopefully block-ack
handling and retransmission) so I'll go review the linux code and
figure it out.
  * Set the number of tx/rx streams.  I /hope/ that nchains == nstreams
here.
  * Add 11n channels in the call to ieee80211_init_channels().
  * Don't enable HT40 for now - I'll have to verify the channel set command
and tidy it up a bit first.
  * Teach the RX path about M_AMPDU for 11n nodes.  Kinda wonder why
we aren't just doing this in net80211 already, this is the fourth
driver I've had to do this to.
  * Teach rate2ridx() about MCS rates and what hardware rates to use.
  * Teach the urtwn_tx_data() routine about MCS/11ng transmission.
It doesn't know about short-gi and 40MHz modes yet; that'll come
later.
  * For 8192CU firmware, teach the rate table code about MCS rates.
  * Ensure that the fixed rate transmit sets the right transmit flag
so the firmware obeys the driver transmit path.
  * Set the default transmit rate to MCS4 if no rate control is available.
  * Add HT protection (RTS-CTS exchange) support.
  
  * Add appropriate XXX TODO entries.
  
  TODO:
  
  * 40MHz, short-gi, etc - channel tuning, TX, RX;
  * teach urtwn_tx_raw() about (more) 11n stuff;
  * A-MPDU TX would be nice!
  
  Thanks to Andriy (avos@) for reviewing the code and testing it on IRC.
  
  Tested:
  
  * RTL8188EU - STA (me)
  * RTL8192CU - STA (me)
  * RTL8188EU - hostap (avos)
  * RTL8192CU - STA (avos)
  
  Reviewed by:  avos

Modified:
  head/sys/dev/urtwn/if_urtwn.c

Modified: head/sys/dev/urtwn/if_urtwn.c
==
--- head/sys/dev/urtwn/if_urtwn.c   Mon Mar 21 23:32:13 2016
(r297174)
+++ head/sys/dev/urtwn/if_urtwn.c   Tue Mar 22 01:09:15 2016
(r297175)
@@ -95,6 +95,7 @@ enum {
URTWN_DEBUG_ROM = 0x0200,   /* various ROM info */
URTWN_DEBUG_KEY = 0x0400,   /* crypto keys management */
URTWN_DEBUG_TXPWR   = 0x0800,   /* dump Tx power values */
+   URTWN_DEBUG_RSSI= 0x1000,   /* dump RSSI lookups */
URTWN_DEBUG_ANY = 0x
 };
 
@@ -109,6 +110,9 @@ enum {
 
 #defineIEEE80211_HAS_ADDR4(wh) IEEE80211_IS_DSTODS(wh)
 
+static int urtwn_enable_11n = 1;
+TUNABLE_INT("hw.usb.urtwn.enable_11n", &urtwn_enable_11n);
+
 /* various supported device vendors/products */
 static const STRUCT_USB_HOST_ID urtwn_devs[] = {
 #define URTWN_DEV(v,p)  { USB_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p) }
@@ -465,6 +469,19 @@ urtwn_match(device_t self)
return (usbd_lookup_id_by_uaa(urtwn_devs, sizeof(urtwn_devs), uaa));
 }
 
+static void
+urtwn_update_chw(struct ieee80211com *ic)
+{
+}
+
+static int
+urtwn_ampdu_enable(struct ieee80211_node *ni, struct ieee80211_tx_ampdu *tap)
+{
+
+   /* We're driving this ourselves (eventually); don't involve net80211 */
+   return (0);
+}
+
 static int
 urtwn_attach(device_t self)
 {
@@ -555,7 +572,9 @@ urtwn_attach(device_t self)
| IEEE80211_C_HOSTAP/* hostap mode */
| IEEE80211_C_SHPREAMBLE/* short preamble supported */
| IEEE80211_C_SHSLOT/* short slot time supported */
+#if 0
| IEEE80211_C_BGSCAN/* capable of bg scanning */
+#endif
| IEEE80211_C_WPA   /* 802.11i */
| IEEE80211_C_WME   /* 802.11e */
;
@@ -565,9 +584,27 @@ urtwn_attach(device_t self)
IEEE80211_CRYPTO_TKIP |
IEEE80211_CRYPTO_AES_CCM;
 
+   /* Assume they're all 11n capable for now */
+   if (urtwn_enable_11n) {
+   device_printf(self, "enabling 11n\n");
+   ic->ic_htcaps = IEEE80211_HTC_HT |
+   IEEE80211_HTC_AMPDU |
+   IEEE80211_HTC_AMSDU |
+   IEEE80211_HTCAP_MAXAMSDU_3839 |
+   IEEE80211_HTCAP_SMPS_OFF;
+   /* no HT40 just yet */
+   // ic->ic_htcaps |= IEEE80211_HTCAP_CHWIDTH40;
+
+   /* XXX TODO: verify chains versus streams for urtwn */
+   ic->ic_txstream = sc->ntxchains;
+   ic->ic_rxstream = sc->nrxchains;
+

svn commit: r297177 - head/sys/dev/hyperv/vmbus

2016-03-21 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Mar 22 06:13:27 2016
New Revision: 297177
URL: https://svnweb.freebsd.org/changeset/base/297177

Log:
  hyperv/vmbus: Use taskqueue_fast for non-performance critical messages
  
  This gets rid of the per-cpu SWIs.
  
  Submitted by: Jun Su 
  Reviewed by:  Dexuan Cui , sephe
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5215

Modified:
  head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
==
--- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.cTue Mar 22 05:48:51 
2016(r297176)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.cTue Mar 22 06:13:27 
2016(r297177)
@@ -76,7 +76,7 @@ static char *vmbus_ids[] = { "VMBUS", NU
  * the hypervisor.
  */
 static void
-vmbus_msg_swintr(void *arg)
+vmbus_msg_swintr(void *arg, int pending __unused)
 {
int cpu;
void*   page_addr;
@@ -204,7 +204,7 @@ hv_vmbus_isr(struct trapframe *frame)
 
msg = (hv_vmbus_message*) page_addr + HV_VMBUS_MESSAGE_SINT;
if (msg->header.message_type != HV_MESSAGE_TYPE_NONE) {
-   swi_sched(hv_vmbus_g_context.msg_swintr[cpu], 0);
+   taskqueue_enqueue(taskqueue_fast, 
&hv_vmbus_g_context.hv_msg_task[cpu]);
}
 
return (FILTER_HANDLED);
@@ -510,9 +510,6 @@ vmbus_bus_init(void)
setup_args.vector = hv_vmbus_g_context.hv_cb_vector;
 
CPU_FOREACH(j) {
-   hv_vmbus_g_context.hv_msg_intr_event[j] = NULL;
-   hv_vmbus_g_context.msg_swintr[j] = NULL;
-
snprintf(buf, sizeof(buf), "cpu%d:hyperv", j);
intrcnt_add(buf, &hv_vmbus_intr_cpu[j]);
 
@@ -539,30 +536,9 @@ vmbus_bus_init(void)
"hvevent%d", j);
 
/*
-* Setup software interrupt thread and handler for msg handling.
+* Setup tasks to handle msg
 */
-   ret = swi_add(&hv_vmbus_g_context.hv_msg_intr_event[j],
-   "hv_msg", vmbus_msg_swintr, (void *)(long)j, SWI_CLOCK, 0,
-   &hv_vmbus_g_context.msg_swintr[j]);
-   if (ret) {
-   if(bootverbose)
-   printf("VMBUS: failed to setup msg swi for "
-   "cpu %d\n", j);
-   goto cleanup1;
-   }
-
-   /*
-* Bind the swi thread to the cpu.
-*/
-   ret = intr_event_bind(hv_vmbus_g_context.hv_msg_intr_event[j],
-   j);
-   if (ret) {
-   if(bootverbose)
-   printf("VMBUS: failed to bind msg swi thread "
-   "to cpu %d\n", j);
-   goto cleanup1;
-   }
-
+   TASK_INIT(&hv_vmbus_g_context.hv_msg_task[j], 0, 
vmbus_msg_swintr, (void *)(long)j);
/*
 * Prepare the per cpu msg and event pages to be called on each 
cpu.
 */
@@ -601,11 +577,10 @@ vmbus_bus_init(void)
 * remove swi and vmbus callback vector;
 */
CPU_FOREACH(j) {
-   if (hv_vmbus_g_context.hv_event_queue[j] != NULL)
+   if (hv_vmbus_g_context.hv_event_queue[j] != NULL) {
taskqueue_free(hv_vmbus_g_context.hv_event_queue[j]);
-   if (hv_vmbus_g_context.msg_swintr[j] != NULL)
-   swi_remove(hv_vmbus_g_context.msg_swintr[j]);
-   hv_vmbus_g_context.hv_msg_intr_event[j] = NULL; 
+   hv_vmbus_g_context.hv_event_queue[j] = NULL;
+   }
}
 
vmbus_vector_free(hv_vmbus_g_context.hv_cb_vector);
@@ -670,11 +645,10 @@ vmbus_bus_exit(void)
 
/* remove swi */
CPU_FOREACH(i) {
-   if (hv_vmbus_g_context.hv_event_queue[i] != NULL)
+   if (hv_vmbus_g_context.hv_event_queue[i] != NULL) {
taskqueue_free(hv_vmbus_g_context.hv_event_queue[i]);
-   if (hv_vmbus_g_context.msg_swintr[i] != NULL)
-   swi_remove(hv_vmbus_g_context.msg_swintr[i]);
-   hv_vmbus_g_context.hv_msg_intr_event[i] = NULL; 
+   hv_vmbus_g_context.hv_event_queue[i] = NULL;
+   }
}
 
vmbus_vector_free(hv_vmbus_g_context.hv_cb_vector);

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
==
--- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Tue Mar 22 05:48:51 2016
(r297176)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Tue Mar 22 06:13:27 2016
(r297177)
@@ -204,8 +204,7 @@ typedef struct {

svn commit: r297179 - head/sys/dev/ipmi

2016-03-21 Thread Alexander Motin
Author: mav
Date: Tue Mar 22 06:24:52 2016
New Revision: 297179
URL: https://svnweb.freebsd.org/changeset/base/297179

Log:
  Optimize IPMI watchdog patting.
  
  Set watchdog timer parameters only when they really need to be changed.
  In other cases just restart the timer with single Reset command instead
  of two (Set and Reset).
  
  From one side this visually reduces amount of CPU time burned in tight
  loop waiting while some slow BMC configures its watchdog hardware, that
  seems to be much more complicated task then just resetting the timer.
  
  From another side on some BMCs those slow Set commands sometimes tend to
  timeout, that leads to noisy log messages and even more CPU time burned,
  so avoiding them can provide even bigger bonuses.
  
  MFC after:2 weeks

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

Modified: head/sys/dev/ipmi/ipmi.c
==
--- head/sys/dev/ipmi/ipmi.cTue Mar 22 06:23:09 2016(r297178)
+++ head/sys/dev/ipmi/ipmi.cTue Mar 22 06:24:52 2016(r297179)
@@ -603,6 +603,20 @@ ipmi_polled_enqueue_request(struct ipmi_
  */
 
 static int
+ipmi_reset_watchdog(struct ipmi_softc *sc)
+{
+   struct ipmi_request *req;
+   int error;
+
+   IPMI_ALLOC_DRIVER_REQUEST(req, IPMI_ADDR(IPMI_APP_REQUEST, 0),
+   IPMI_RESET_WDOG, 0, 0);
+   error = ipmi_submit_driver_request(sc, req, 0);
+   if (error)
+   device_printf(sc->ipmi_dev, "Failed to reset watchdog\n");
+   return (error);
+}
+
+static int
 ipmi_set_watchdog(struct ipmi_softc *sc, unsigned int sec)
 {
struct ipmi_request *req;
@@ -613,7 +627,6 @@ ipmi_set_watchdog(struct ipmi_softc *sc,
 
IPMI_ALLOC_DRIVER_REQUEST(req, IPMI_ADDR(IPMI_APP_REQUEST, 0),
IPMI_SET_WDOG, 6, 0);
-
if (sec) {
req->ir_request[0] = IPMI_SET_WD_TIMER_DONT_STOP
| IPMI_SET_WD_TIMER_SMS_OS;
@@ -630,24 +643,10 @@ ipmi_set_watchdog(struct ipmi_softc *sc,
req->ir_request[4] = 0;
req->ir_request[5] = 0;
}
-
error = ipmi_submit_driver_request(sc, req, 0);
if (error)
device_printf(sc->ipmi_dev, "Failed to set watchdog\n");
-   else if (sec) {
-   IPMI_INIT_DRIVER_REQUEST(req, IPMI_ADDR(IPMI_APP_REQUEST, 0),
-   IPMI_RESET_WDOG, 0, 0);
-
-   error = ipmi_submit_driver_request(sc, req, 0);
-   if (error)
-   device_printf(sc->ipmi_dev,
-   "Failed to reset watchdog\n");
-   }
-
return (error);
-   /*
-   dump_watchdog(sc);
-   */
 }
 
 static void
@@ -665,12 +664,24 @@ ipmi_wd_event(void *arg, unsigned int cm
timeout = ((uint64_t)1 << cmd) / 10;
if (timeout == 0)
timeout = 1;
-   e = ipmi_set_watchdog(sc, timeout);
-   if (e == 0) {
-   *error = 0;
-   sc->ipmi_watchdog_active = 1;
-   } else
-   (void)ipmi_set_watchdog(sc, 0);
+   if (timeout != sc->ipmi_watchdog_active) {
+   e = ipmi_set_watchdog(sc, timeout);
+   if (e == 0) {
+   sc->ipmi_watchdog_active = timeout;
+   } else {
+   (void)ipmi_set_watchdog(sc, 0);
+   sc->ipmi_watchdog_active = 0;
+   }
+   }
+   if (sc->ipmi_watchdog_active != 0) {
+   e = ipmi_reset_watchdog(sc);
+   if (e == 0) {
+   *error = 0;
+   } else {
+   (void)ipmi_set_watchdog(sc, 0);
+   sc->ipmi_watchdog_active = 0;
+   }
+   }
} else if (atomic_readandclear_int(&sc->ipmi_watchdog_active) != 0) {
e = ipmi_set_watchdog(sc, 0);
if (e != 0 && cmd == 0)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r297180 - head/sys/dev/hyperv/netvsc

2016-03-21 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Mar 22 06:31:39 2016
New Revision: 297180
URL: https://svnweb.freebsd.org/changeset/base/297180

Log:
  hyperv/hn: Reduce TCP segment aggregation limit for multiple RX rings
  
  This mainly used to improve ACK timeliness when multiple RX rings
  are enabled.
  
  This value gives the best performance in both Azure and Hyper-V
  environment, w/ both 10Ge and 40Ge using non-{INVARIANTS,WITNESS}
  kernel.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5691

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Tue Mar 22 06:24:52 
2016(r297179)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Tue Mar 22 06:31:39 
2016(r297180)
@@ -181,6 +181,7 @@ struct hn_txdesc {
 #define HN_CSUM_ASSIST_WIN8(CSUM_IP | CSUM_TCP)
 #define HN_CSUM_ASSIST (CSUM_IP | CSUM_UDP | CSUM_TCP)
 
+#define HN_LRO_LENLIM_MULTIRX_DEF  (12 * ETHERMTU)
 #define HN_LRO_LENLIM_DEF  (25 * ETHERMTU)
 /* YYY 2*MTU is a bit rough, but should be good enough. */
 #define HN_LRO_LENLIM_MIN(ifp) (2 * (ifp)->if_mtu)
@@ -530,6 +531,21 @@ netvsc_attach(device_t dev)
device_printf(dev, "%d TX ring, %d RX ring\n",
sc->hn_tx_ring_inuse, sc->hn_rx_ring_inuse);
 
+#if __FreeBSD_version >= 1100099
+   if (sc->hn_rx_ring_inuse > 1) {
+   int i;
+
+   /*
+* Reduce TCP segment aggregation limit for multiple
+* RX rings to increase ACK timeliness.
+*/
+   for (i = 0; i < sc->hn_rx_ring_inuse; ++i) {
+   sc->hn_rx_ring[i].hn_lro.lro_length_lim =
+   HN_LRO_LENLIM_MULTIRX_DEF;
+   }
+   }
+#endif
+
if (device_info.link_state == 0) {
sc->hn_carrier = 1;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r297181 - head/sys/dev/hyperv/netvsc

2016-03-21 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Mar 22 06:42:24 2016
New Revision: 297181
URL: https://svnweb.freebsd.org/changeset/base/297181

Log:
  hyperv/hn: Factor out hn_set_lro_lenlim()
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5692

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Tue Mar 22 06:31:39 
2016(r297180)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Tue Mar 22 06:42:24 
2016(r297181)
@@ -334,6 +334,17 @@ static void hn_xmit_txeof(struct hn_tx_r
 static void hn_xmit_taskfunc(void *, int);
 static void hn_xmit_txeof_taskfunc(void *, int);
 
+#if __FreeBSD_version >= 1100099
+static void
+hn_set_lro_lenlim(struct hn_softc *sc, int lenlim)
+{
+   int i;
+
+   for (i = 0; i < sc->hn_rx_ring_inuse; ++i)
+   sc->hn_rx_ring[i].hn_lro.lro_length_lim = lenlim;
+}
+#endif
+
 static int
 hn_ifmedia_upd(struct ifnet *ifp __unused)
 {
@@ -533,16 +544,11 @@ netvsc_attach(device_t dev)
 
 #if __FreeBSD_version >= 1100099
if (sc->hn_rx_ring_inuse > 1) {
-   int i;
-
/*
 * Reduce TCP segment aggregation limit for multiple
 * RX rings to increase ACK timeliness.
 */
-   for (i = 0; i < sc->hn_rx_ring_inuse; ++i) {
-   sc->hn_rx_ring[i].hn_lro.lro_length_lim =
-   HN_LRO_LENLIM_MULTIRX_DEF;
-   }
+   hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MULTIRX_DEF);
}
 #endif
 
@@ -1465,14 +1471,8 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, 
 */
NV_LOCK(sc);
if (sc->hn_rx_ring[0].hn_lro.lro_length_lim <
-   HN_LRO_LENLIM_MIN(ifp)) {
-   int i;
-
-   for (i = 0; i < sc->hn_rx_ring_inuse; ++i) {
-   sc->hn_rx_ring[i].hn_lro.lro_length_lim =
-   HN_LRO_LENLIM_MIN(ifp);
-   }
-   }
+   HN_LRO_LENLIM_MIN(ifp))
+   hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MIN(ifp));
NV_UNLOCK(sc);
 #endif
 
@@ -1805,7 +1805,7 @@ hn_lro_lenlim_sysctl(SYSCTL_HANDLER_ARGS
 {
struct hn_softc *sc = arg1;
unsigned int lenlim;
-   int error, i;
+   int error;
 
lenlim = sc->hn_rx_ring[0].hn_lro.lro_length_lim;
error = sysctl_handle_int(oidp, &lenlim, 0, req);
@@ -1817,8 +1817,7 @@ hn_lro_lenlim_sysctl(SYSCTL_HANDLER_ARGS
return EINVAL;
 
NV_LOCK(sc);
-   for (i = 0; i < sc->hn_rx_ring_inuse; ++i)
-   sc->hn_rx_ring[i].hn_lro.lro_length_lim = lenlim;
+   hn_set_lro_lenlim(sc, lenlim);
NV_UNLOCK(sc);
return 0;
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"