svn commit: r305896 - head/sys/compat/linux

2016-09-17 Thread Dmitry Chagin
Author: dchagin
Date: Sat Sep 17 08:10:01 2016
New Revision: 305896
URL: https://svnweb.freebsd.org/changeset/base/305896

Log:
  Implement BLKSSZGET ioctl for the Linuxulator.
  
  PR:   212700
  Submitted by: Erik Cederstrand
  Reported by:  Erik Cederstrand
  MFC after:1 week

Modified:
  head/sys/compat/linux/linux_ioctl.c

Modified: head/sys/compat/linux/linux_ioctl.c
==
--- head/sys/compat/linux/linux_ioctl.c Sat Sep 17 05:44:57 2016
(r305895)
+++ head/sys/compat/linux/linux_ioctl.c Sat Sep 17 08:10:01 2016
(r305896)
@@ -297,6 +297,15 @@ linux_ioctl_disk(struct thread *td, stru
return (copyout(§orsize, (void *)args->arg,
sizeof(sectorsize)));
break;
+   case LINUX_BLKSSZGET:
+   error = fo_ioctl(fp, DIOCGSECTORSIZE,
+   (caddr_t)§orsize, td->td_ucred, td);
+   fdrop(fp, td);
+   if (error)
+   return (error);
+   return (copyout(§orsize, (void *)args->arg,
+   sizeof(sectorsize)));
+   break;
}
fdrop(fp, td);
return (ENOIOCTL);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r305897 - head/sys/ddb

2016-09-17 Thread Bruce Evans
Author: bde
Date: Sat Sep 17 11:43:51 2016
New Revision: 305897
URL: https://svnweb.freebsd.org/changeset/base/305897

Log:
  Silently ignore unexpected single-step traps (except for turning
  off single-stepping).  Only do this on arches (only x86 so far)
  which classify single-step traps unambiguously.
  
  This allows other parts of the kernel to be intentionally and
  unintentionally sloppy about generating single-step traps.  On
  x86, at least the following places were unintentionally sloppy:
  - all operations that context-switched [er]flags.  Especially
spinlock_enter()/exit() and cpu_switch().  When single-stepped,
saving the flags leaves PSL_T set in the saved flags, so
restoring gives a trap that is spurious if it occurs after
single-step mode has been left.  Switching contexts away from
a low priority thread gives especially long-lived saved copies.
  - the vm86 emulation allows user mode to set PSL_T.  This was
correct until vm86 bios call mode was unintentionally given
access to kdb handling its single-step traps.
  Now these places are intentionally sloppy, but unexpected
  debugger traps still cause panics if no debugger that handles
  the trap is attached when the trap is delivered.

Modified:
  head/sys/ddb/db_run.c

Modified: head/sys/ddb/db_run.c
==
--- head/sys/ddb/db_run.c   Sat Sep 17 08:10:01 2016(r305896)
+++ head/sys/ddb/db_run.c   Sat Sep 17 11:43:51 2016(r305897)
@@ -136,21 +136,29 @@ db_stop_at_pc(int type, int code, bool *
*is_breakpoint = false; /* might be a breakpoint, but not ours */
 
/*
+* If not stepping, then silently ignore single-step traps
+* (except for clearing the single-step-flag above).
+*
 * If stepping, then abort if the trap type is unexpected.
 * Breakpoints owned by us are expected and were handled above.
 * Single-steps are expected and are handled below.  All others
 * are unexpected.
 *
-* If the MD layer doesn't tell us when it is stepping, use the
-* bad historical default that all unexepected traps.
+* Only do either of these if the MD layer claims to classify
+* single-step traps unambiguously (by defining IS_SSTEP_TRAP).
+* Otherwise, fall through to the bad historical behaviour
+* given by turning unexpected traps into expected traps: if not
+* stepping, then expect only breakpoints and stop, and if
+* stepping, then expect only single-steps and step.
 */
-#ifndef IS_SSTEP_TRAP
-#defineIS_SSTEP_TRAP(type, code)   true
-#endif
+#ifdef IS_SSTEP_TRAP
+   if (db_run_mode == STEP_CONTINUE && IS_SSTEP_TRAP(type, code))
+   return (false);
if (db_run_mode != STEP_CONTINUE && !IS_SSTEP_TRAP(type, code)) {
printf("Stepping aborted\n");
return (true);
}
+#endif
 
if (db_run_mode == STEP_INVISIBLE) {
db_run_mode = STEP_CONTINUE;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r305898 - head/usr.sbin/bhyve

2016-09-17 Thread Jakub Wojciech Klama
Author: jceel
Date: Sat Sep 17 13:48:01 2016
New Revision: 305898
URL: https://svnweb.freebsd.org/changeset/base/305898

Log:
  Add virtio-console support to bhyve.
  
  Adds virtio-console device support to bhyve, allowing to create
  bidirectional character streams between host and guest.
  
  Syntax:
  -s ,virtio-console,port1=/path/to/port1.sock,anotherport=...
  
  Maximum of 16 ports per device can be created. Every port is named
  and corresponds to an Unix domain socket created by bhyve. bhyve
  accepts at most one connection per port at a time.
  
  Limitations:
  - due to lack of destructors of in bhyve, sockets on the filesystem
must be cleaned up manually after bhyve exits
  - there's no way to use "console port" feature, nor the console port
resize as of now
  - emergency write is advertised, but no-op as of now
  
  Approved by:  trasz
  MFC after:1 month
  Relnotes: yes
  Sponsored by: iXsystems, Inc.
  Differential Revision:D7185

Added:
  head/usr.sbin/bhyve/pci_virtio_console.c   (contents, props changed)
Modified:
  head/usr.sbin/bhyve/Makefile
  head/usr.sbin/bhyve/virtio.h

Modified: head/usr.sbin/bhyve/Makefile
==
--- head/usr.sbin/bhyve/MakefileSat Sep 17 11:43:51 2016
(r305897)
+++ head/usr.sbin/bhyve/MakefileSat Sep 17 13:48:01 2016
(r305898)
@@ -36,6 +36,7 @@ SRCS= \
pci_lpc.c   \
pci_passthru.c  \
pci_virtio_block.c  \
+   pci_virtio_console.c\
pci_virtio_net.c\
pci_virtio_rnd.c\
pci_uart.c  \

Added: head/usr.sbin/bhyve/pci_virtio_console.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/bhyve/pci_virtio_console.cSat Sep 17 13:48:01 2016
(r305898)
@@ -0,0 +1,631 @@
+/*-
+ * Copyright (c) 2016 iXsystems Inc.
+ * All rights reserved.
+ *
+ * This software was developed by Jakub Klama 
+ * under sponsorship from iXsystems Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer
+ *in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "bhyverun.h"
+#include "pci_emul.h"
+#include "virtio.h"
+#include "mevent.h"
+
+#defineVTCON_RINGSZ64
+#defineVTCON_MAXPORTS  16
+#defineVTCON_MAXQ  (VTCON_MAXPORTS * 2 + 2)
+
+#defineVTCON_DEVICE_READY  0
+#defineVTCON_DEVICE_ADD1
+#defineVTCON_DEVICE_REMOVE 2
+#defineVTCON_PORT_READY3
+#defineVTCON_CONSOLE_PORT  4
+#defineVTCON_CONSOLE_RESIZE5
+#defineVTCON_PORT_OPEN 6
+#defineVTCON_PORT_NAME 7
+
+#defineVTCON_F_SIZE0
+#defineVTCON_F_MULTIPORT   1
+#defineVTCON_F_EMERG_WRITE 2
+#defineVTCON_S_HOSTCAPS\
+(VTCON_F_SIZE | VTCON_F_MULTIPORT | VTCON_F_EMERG_WRITE)
+
+static int pci_vtcon_debug;
+#define DPRINTF(params) if (pci_vtcon_debug) printf params
+#define WPRINTF(params) printf params
+
+struct pci_vtcon_softc;
+struct pci_vtcon_port;
+struct pci_vtcon_config;
+typedef void (pci_vtcon_cb_t)(struct pci_vtcon_port *, void *, struct iovec *,
+int);
+
+struct pci_vtcon_port {
+   struct pci_vtcon_softc * vsp_sc;
+   int  vsp_id;
+   const char * vsp_name;
+   bool vsp_ena

svn commit: r305899 - in head/sys/i386: i386 include

2016-09-17 Thread Bruce Evans
Author: bde
Date: Sat Sep 17 14:00:52 2016
New Revision: 305899
URL: https://svnweb.freebsd.org/changeset/base/305899

Log:
  Remove all kernel uses of pcb_psl, but keep in in the struct to
  preserve the ABI and API for applications.  It was removed in the port
  to amd64, but was remained as garbage giving a micro-pessimization and
  spurious single-step traps on i386.
  
  pcb_psl was intended to be used just to do a context switch of PSL_I,
  but this context switch was null in most or all versions, and
  mis-switching of PSL_T was done instead.
  
  Some history:
  - in 386BSD-0.0, cpu_switch() ran at splhigh() and splhigh() did too
much interrupt disabling, so interrupts were hard-disabled across
cpu_switch() and too many other places
  - in 386BSD-0.0-patchkit through FreeBSD-4 and FreeBSD-5 before
SMPng, splhigh() did soft interrupt masking, and cpu_switch() was
excessively cautious and did a cli at the start and a sti at the
end to hard-disable interrupts across the switch
  - SMPng replaced the spl's and cli's by spinlocks (just sched_lock?),
so interrupts were hard-disabled across cpu_switch() and too many
other places again
  - initial attempts to fix this intended to restore some soft
interrupt disabling, but to support variations in this cpu_switch()
used pushfl/popfl into pcb_psl to avoid hard-coding the assumption
that the initial and final states have PSL_I enabled.  But the
version with soft interrupt disabling wasn't used for long, or was
never committed, (except I always used my different version of it
for UP) so the pushfl/popl and pcb_psl to hold them have been doing
less than nothing for about 14 years.

Modified:
  head/sys/i386/i386/genassym.c
  head/sys/i386/i386/swtch.s
  head/sys/i386/i386/vm_machdep.c
  head/sys/i386/include/pcb.h

Modified: head/sys/i386/i386/genassym.c
==
--- head/sys/i386/i386/genassym.c   Sat Sep 17 13:48:01 2016
(r305898)
+++ head/sys/i386/i386/genassym.c   Sat Sep 17 14:00:52 2016
(r305899)
@@ -143,7 +143,6 @@ ASSYM(PCB_DR2, offsetof(struct pcb, pcb_
 ASSYM(PCB_DR3, offsetof(struct pcb, pcb_dr3));
 ASSYM(PCB_DR6, offsetof(struct pcb, pcb_dr6));
 ASSYM(PCB_DR7, offsetof(struct pcb, pcb_dr7));
-ASSYM(PCB_PSL, offsetof(struct pcb, pcb_psl));
 ASSYM(PCB_DBREGS, PCB_DBREGS);
 ASSYM(PCB_EXT, offsetof(struct pcb, pcb_ext));
 

Modified: head/sys/i386/i386/swtch.s
==
--- head/sys/i386/i386/swtch.s  Sat Sep 17 13:48:01 2016(r305898)
+++ head/sys/i386/i386/swtch.s  Sat Sep 17 14:00:52 2016(r305899)
@@ -131,8 +131,6 @@ ENTRY(cpu_switch)
movl%esi,PCB_ESI(%edx)
movl%edi,PCB_EDI(%edx)
mov %gs,PCB_GS(%edx)
-   pushfl  /* PSL */
-   poplPCB_PSL(%edx)
/* Test if debug registers should be saved. */
testl   $PCB_DBREGS,PCB_FLAGS(%edx)
jz  1f  /* no, skip over */
@@ -261,8 +259,6 @@ sw1:
movlPCB_EDI(%edx),%edi
movlPCB_EIP(%edx),%eax
movl%eax,(%esp)
-   pushl   PCB_PSL(%edx)
-   popfl
 
movl%edx, PCPU(CURPCB)
movlTD_TID(%ecx),%eax
@@ -365,8 +361,6 @@ ENTRY(savectx)
movl%esi,PCB_ESI(%ecx)
movl%edi,PCB_EDI(%ecx)
mov %gs,PCB_GS(%ecx)
-   pushfl
-   poplPCB_PSL(%ecx)
 
movl%cr0,%eax
movl%eax,PCB_CR0(%ecx)

Modified: head/sys/i386/i386/vm_machdep.c
==
--- head/sys/i386/i386/vm_machdep.c Sat Sep 17 13:48:01 2016
(r305898)
+++ head/sys/i386/i386/vm_machdep.c Sat Sep 17 14:00:52 2016
(r305899)
@@ -273,7 +273,6 @@ cpu_fork(td1, p2, td2, flags)
pcb2->pcb_esp = (int)td2->td_frame - sizeof(void *);
pcb2->pcb_ebx = (int)td2;   /* fork_trampoline argument */
pcb2->pcb_eip = (int)fork_trampoline;
-   pcb2->pcb_psl = PSL_KERNEL; /* ints disabled */
/*-
 * pcb2->pcb_dr*:   cloned above.
 * pcb2->pcb_savefpu:   cloned above.
@@ -504,7 +503,6 @@ cpu_copy_thread(struct thread *td, struc
pcb2->pcb_esp = (int)td->td_frame - sizeof(void *); /* trampoline arg */
pcb2->pcb_ebx = (int)td;/* trampoline arg */
pcb2->pcb_eip = (int)fork_trampoline;
-   pcb2->pcb_psl &= ~(PSL_I);  /* interrupts must be disabled */
pcb2->pcb_gs = rgs();
/*
 * If we didn't copy the pcb, we'd need to do the following registers:

Modified: head/sys/i386/include/pcb.h
==
--- head/sys/i386/include/pcb.h Sat Sep 17 13:48:01 2016(r305898)
+++ head/sys/i386/include/pcb.h Sat 

Re: svn commit: r305899 - in head/sys/i386: i386 include

2016-09-17 Thread Bruce Evans

On Sat, 17 Sep 2016, Bruce Evans wrote:


Author: bde
Date: Sat Sep 17 14:00:52 2016
New Revision: 305899
URL: https://svnweb.freebsd.org/changeset/base/305899

Log:
 Remove all kernel uses of pcb_psl, but keep in in the struct to
 preserve the ABI and API for applications.  It was removed in the port
 to amd64, but was remained as garbage giving a micro-pessimization and
 spurious single-step traps on i386.
 ...


Actually, I committed a version that breaks the API by renaming the
variable.  I will leave it like that.  pcb_psl is not used anywhere
in head/ports, so it is used in at most the externally-maintained part
of a port or things like gdb scripts.

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


svn commit: r305900 - head/sys/dev/virtio/console

2016-09-17 Thread Jakub Wojciech Klama
Author: jceel
Date: Sat Sep 17 16:03:33 2016
New Revision: 305900
URL: https://svnweb.freebsd.org/changeset/base/305900

Log:
  Create aliases for named virtio-console ports.
  
  Make virtio_console(4) create `/dev/vtcon/` alias pointing
  to /dev/ttyVx.y upon receiving PORT_NAME (id = 7) event over the control
  queue.
  
  Approved by:  trasz
  MFC after:1 month
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D7182

Modified:
  head/sys/dev/virtio/console/virtio_console.c

Modified: head/sys/dev/virtio/console/virtio_console.c
==
--- head/sys/dev/virtio/console/virtio_console.cSat Sep 17 14:00:52 
2016(r305899)
+++ head/sys/dev/virtio/console/virtio_console.cSat Sep 17 16:03:33 
2016(r305900)
@@ -176,8 +176,10 @@ static void vtcon_ctrl_port_add_event(s
 static void vtcon_ctrl_port_remove_event(struct vtcon_softc *, int);
 static void vtcon_ctrl_port_console_event(struct vtcon_softc *, int);
 static void vtcon_ctrl_port_open_event(struct vtcon_softc *, int);
+static void vtcon_ctrl_port_name_event(struct vtcon_softc *, int,
+const char *, size_t);
 static void vtcon_ctrl_process_event(struct vtcon_softc *,
-struct virtio_console_control *);
+struct virtio_console_control *, void *, size_t);
 static void vtcon_ctrl_task_cb(void *, int);
 static void vtcon_ctrl_event_intr(void *);
 static void vtcon_ctrl_poll(struct vtcon_softc *,
@@ -611,8 +613,10 @@ vtcon_ctrl_event_create(struct vtcon_sof
struct virtio_console_control *control;
int error;
 
-   control = malloc(sizeof(struct virtio_console_control), M_DEVBUF,
-   M_ZERO | M_NOWAIT);
+   control = malloc(
+   sizeof(struct virtio_console_control) + VTCON_BULK_BUFSZ,
+   M_DEVBUF, M_ZERO | M_NOWAIT);
+
if (control == NULL)
return (ENOMEM);
 
@@ -796,8 +800,29 @@ vtcon_ctrl_port_open_event(struct vtcon_
 }
 
 static void
+vtcon_ctrl_port_name_event(struct vtcon_softc *sc, int id, const char *name,
+size_t len)
+{
+   device_t dev;
+   struct vtcon_softc_port *scport;
+   struct vtcon_port *port;
+
+   dev = sc->vtcon_dev;
+   scport = &sc->vtcon_ports[id];
+
+   port = scport->vcsp_port;
+   if (port == NULL) {
+   device_printf(dev, "%s: name port %d, but does not exist\n",
+   __func__, id);
+   return;
+   }
+
+   tty_makealias(port->vtcport_tty, "vtcon/%*s", (int)len, name);
+}
+
+static void
 vtcon_ctrl_process_event(struct vtcon_softc *sc,
-struct virtio_console_control *control)
+struct virtio_console_control *control, void *payload, size_t plen)
 {
device_t dev;
int id;
@@ -831,6 +856,9 @@ vtcon_ctrl_process_event(struct vtcon_so
break;
 
case VIRTIO_CONSOLE_PORT_NAME:
+   if (payload != NULL && plen > 0)
+   vtcon_ctrl_port_name_event(sc, id,
+   (const char *)payload, plen);
break;
}
 }
@@ -842,6 +870,9 @@ vtcon_ctrl_task_cb(void *xsc, int pendin
struct virtqueue *vq;
struct virtio_console_control *control;
int detached;
+   uint32_t len;
+   size_t plen;
+   void *payload;
 
sc = xsc;
vq = sc->vtcon_ctrl_rxvq;
@@ -849,12 +880,20 @@ vtcon_ctrl_task_cb(void *xsc, int pendin
VTCON_LOCK(sc);
 
while ((detached = (sc->vtcon_flags & VTCON_FLAG_DETACHED)) == 0) {
-   control = virtqueue_dequeue(vq, NULL);
+   control = virtqueue_dequeue(vq, &len);
+   payload = NULL;
+   plen = 0;
+
if (control == NULL)
break;
 
+   if (len > sizeof(control)) {
+   payload = (void *)(control + 1);
+   plen = len - sizeof(control);
+   }
+
VTCON_UNLOCK(sc);
-   vtcon_ctrl_process_event(sc, control);
+   vtcon_ctrl_process_event(sc, control, payload, plen);
VTCON_LOCK(sc);
vtcon_ctrl_event_requeue(sc, control);
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r305902 - in head/sys/ufs: ffs ufs

2016-09-17 Thread Konstantin Belousov
Author: kib
Date: Sat Sep 17 16:47:34 2016
New Revision: 305902
URL: https://svnweb.freebsd.org/changeset/base/305902

Log:
  Reduce size of ufs inode.
  
  Remove redunand i_dev and i_fs pointers, which are available as
  ip->i_ump->um_dev and ip->i_ump->um_fs, and reorder members by size to
  reduce padding.  To compensate added derefences, the most often i_ump
  access to differentiate between UFS1 and UFS2 dinode layout is
  removed, by addition of the new i_flag IN_UFS2.  Overall, this
  actually reduces the amount of memory dereferences.
  
  On 64bit machine, original struct inode size is 176, reduced to 152
  bytes with the change.
  
  Tested by:pho (previous version)
  Reviewed by:  mckusick
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/ufs/ffs/ffs_alloc.c
  head/sys/ufs/ffs/ffs_balloc.c
  head/sys/ufs/ffs/ffs_inode.c
  head/sys/ufs/ffs/ffs_rawread.c
  head/sys/ufs/ffs/ffs_snapshot.c
  head/sys/ufs/ffs/ffs_softdep.c
  head/sys/ufs/ffs/ffs_subr.c
  head/sys/ufs/ffs/ffs_vfsops.c
  head/sys/ufs/ffs/ffs_vnops.c
  head/sys/ufs/ufs/inode.h
  head/sys/ufs/ufs/ufs_acl.c
  head/sys/ufs/ufs/ufs_bmap.c
  head/sys/ufs/ufs/ufs_gjournal.c
  head/sys/ufs/ufs/ufs_inode.c
  head/sys/ufs/ufs/ufs_quota.c
  head/sys/ufs/ufs/ufs_vnops.c
  head/sys/ufs/ufs/ufsmount.h

Modified: head/sys/ufs/ffs/ffs_alloc.c
==
--- head/sys/ufs/ffs/ffs_alloc.cSat Sep 17 16:45:57 2016
(r305901)
+++ head/sys/ufs/ffs/ffs_alloc.cSat Sep 17 16:47:34 2016
(r305902)
@@ -163,13 +163,13 @@ ffs_alloc(ip, lbn, bpref, size, flags, c
 #endif
 
*bnp = 0;
-   fs = ip->i_fs;
-   ump = ip->i_ump;
+   ump = ITOUMP(ip);
+   fs = ump->um_fs;
mtx_assert(UFS_MTX(ump), MA_OWNED);
 #ifdef INVARIANTS
if ((u_int)size > fs->fs_bsize || fragoff(fs, size) != 0) {
printf("dev = %s, bsize = %ld, size = %d, fs = %s\n",
-   devtoname(ip->i_dev), (long)fs->fs_bsize, size,
+   devtoname(ump->um_dev), (long)fs->fs_bsize, size,
fs->fs_fsmnt);
panic("ffs_alloc: bad size");
}
@@ -260,9 +260,9 @@ ffs_realloccg(ip, lbprev, bprev, bpref, 
int64_t delta;
 
vp = ITOV(ip);
-   fs = ip->i_fs;
+   ump = ITOUMP(ip);
+   fs = ump->um_fs;
bp = NULL;
-   ump = ip->i_ump;
gbflags = (flags & BA_UNMAPPED) != 0 ? GB_UNMAPPED : 0;
 
mtx_assert(UFS_MTX(ump), MA_OWNED);
@@ -273,7 +273,7 @@ ffs_realloccg(ip, lbprev, bprev, bpref, 
(u_int)nsize > fs->fs_bsize || fragoff(fs, nsize) != 0) {
printf(
"dev = %s, bsize = %ld, osize = %d, nsize = %d, fs = %s\n",
-   devtoname(ip->i_dev), (long)fs->fs_bsize, osize,
+   devtoname(ump->um_dev), (long)fs->fs_bsize, osize,
nsize, fs->fs_fsmnt);
panic("ffs_realloccg: bad size");
}
@@ -288,7 +288,7 @@ retry:
}
if (bprev == 0) {
printf("dev = %s, bsize = %ld, bprev = %jd, fs = %s\n",
-   devtoname(ip->i_dev), (long)fs->fs_bsize, (intmax_t)bprev,
+   devtoname(ump->um_dev), (long)fs->fs_bsize, (intmax_t)bprev,
fs->fs_fsmnt);
panic("ffs_realloccg: bad bprev");
}
@@ -383,7 +383,7 @@ retry:
break;
default:
printf("dev = %s, optim = %ld, fs = %s\n",
-   devtoname(ip->i_dev), (long)fs->fs_optim, fs->fs_fsmnt);
+   devtoname(ump->um_dev), (long)fs->fs_optim, fs->fs_fsmnt);
panic("ffs_realloccg: bad optim");
/* NOTREACHED */
}
@@ -391,7 +391,7 @@ retry:
if (bno > 0) {
bp->b_blkno = fsbtodb(fs, bno);
if (!DOINGSOFTDEP(vp))
-   ffs_blkfree(ump, fs, ip->i_devvp, bprev, (long)osize,
+   ffs_blkfree(ump, fs, ump->um_devvp, bprev, (long)osize,
ip->i_number, vp->v_type, NULL);
delta = btodb(nsize - osize);
DIP_SET(ip, i_blocks, DIP(ip, i_blocks) + delta);
@@ -490,7 +490,7 @@ ffs_reallocblks(ap)
 * These devices are flash and therefore work less well with this
 * optimization. Also skip if reallocblks has been disabled globally.
 */
-   ump = VTOI(ap->a_vp)->i_ump;
+   ump = ap->a_vp->v_mount->mnt_data;
if (ump->um_candelete || doreallocblks == 0)
return (ENOSPC);
 
@@ -529,8 +529,8 @@ ffs_reallocblks_ufs1(ap)
 
vp = ap->a_vp;
ip = VTOI(vp);
-   fs = ip->i_fs;
-   ump = ip->i_ump;
+   ump = ITOUMP(ip);
+   fs = ump->um_fs;
/*
 * If we are not tracking block clusters or if we have less than 4%
 * free blocks left, then do not attempt to cluster. Running with
@@ -7

svn commit: r305903 - in head: lib/libprocstat sys/ufs/ufs

2016-09-17 Thread Konstantin Belousov
Author: kib
Date: Sat Sep 17 18:14:31 2016
New Revision: 305903
URL: https://svnweb.freebsd.org/changeset/base/305903

Log:
  Fix libprocstat build after r305902.
  - Use _Bool to not require userspace to include stdbool.h.
  - Make extattr.h usable without vnode_if.h.
  - Follow i_ump to get cdev pointer.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/lib/libprocstat/common_kvm.c
  head/sys/ufs/ufs/extattr.h
  head/sys/ufs/ufs/inode.h

Modified: head/lib/libprocstat/common_kvm.c
==
--- head/lib/libprocstat/common_kvm.c   Sat Sep 17 16:47:34 2016
(r305902)
+++ head/lib/libprocstat/common_kvm.c   Sat Sep 17 18:14:31 2016
(r305903)
@@ -45,6 +45,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #undef _KERNEL
@@ -88,17 +90,22 @@ int
 ufs_filestat(kvm_t *kd, struct vnode *vp, struct vnstat *vn)
 {
struct inode inode;
+   struct ufsmount um;
 
if (!kvm_read_all(kd, (unsigned long)VTOI(vp), &inode, sizeof(inode))) {
warnx("can't read inode at %p", (void *)VTOI(vp));
return (1);
}
+   if (!kvm_read_all(kd, (unsigned long)inode.i_ump, &um, sizeof(um))) {
+   warnx("can't read ufsmount at %p", (void *)inode.i_ump);
+   return (1);
+   }
/*
 * The st_dev from stat(2) is a dev_t. These kernel structures
 * contain cdev pointers. We need to convert to dev_t to make
 * comparisons
 */
-   vn->vn_fsid = dev2udev(kd, inode.i_dev);
+   vn->vn_fsid = dev2udev(kd, um.um_dev);
vn->vn_fileid = inode.i_number;
vn->vn_mode = (mode_t)inode.i_mode;
vn->vn_size = inode.i_size;

Modified: head/sys/ufs/ufs/extattr.h
==
--- head/sys/ufs/ufs/extattr.h  Sat Sep 17 16:47:34 2016(r305902)
+++ head/sys/ufs/ufs/extattr.h  Sat Sep 17 18:14:31 2016(r305903)
@@ -133,6 +133,10 @@ struct ufs_extattr_per_mount {
int uepm_flags;
 };
 
+struct vop_getextattr_args;
+struct vop_deleteextattr_args;
+struct vop_setextattr_args;
+
 void   ufs_extattr_uepm_init(struct ufs_extattr_per_mount *uepm);
 void   ufs_extattr_uepm_destroy(struct ufs_extattr_per_mount *uepm);
 intufs_extattr_start(struct mount *mp, struct thread *td);

Modified: head/sys/ufs/ufs/inode.h
==
--- head/sys/ufs/ufs/inode.hSat Sep 17 16:47:34 2016(r305902)
+++ head/sys/ufs/ufs/inode.hSat Sep 17 18:14:31 2016(r305903)
@@ -145,14 +145,14 @@ struct inode {
 #defineITOFS(ip)   (ITOUMP(ip)->um_fs)
 #defineITOVFS(ip)  ((ip)->i_vnode->v_mount)
 
-static inline bool
+static inline _Bool
 I_IS_UFS1(const struct inode *ip)
 {
 
return ((ip->i_flag & IN_UFS2) == 0);
 }
 
-static inline bool
+static inline _Bool
 I_IS_UFS2(const struct inode *ip)
 {
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r305905 - head/share/misc

2016-09-17 Thread Rene Ladan
Author: rene (doc,ports committer)
Date: Sat Sep 17 21:49:11 2016
New Revision: 305905
URL: https://svnweb.freebsd.org/changeset/base/305905

Log:
  bapt stepped down from portmgr

Modified:
  head/share/misc/organization.dot

Modified: head/share/misc/organization.dot
==
--- head/share/misc/organization.dotSat Sep 17 19:38:56 2016
(r305904)
+++ head/share/misc/organization.dotSat Sep 17 21:49:11 2016
(r305905)
@@ -30,7 +30,7 @@ coresecretary [label="Core Team Secretar
 doccommitters [label="Doc/www Committers\ndoc-committ...@freebsd.org"]
 doceng [label="Documentation Engineering Team\ndoc...@freebsd.org\ngjb, 
blackend,\ngabor, hrs"]
 portscommitters [label="Ports Committers\nports-committ...@freebsd.org"]
-portmgr [label="Port Management Team\nport...@freebsd.org\nantoine, bapt, 
bdrewery,\nmat, swills"]
+portmgr [label="Port Management Team\nport...@freebsd.org\nantoine, 
bdrewery,\nmat, swills"]
 portmgrsecretary [label="Port Management Team 
Secretary\nportmgr-secret...@freebsd.org\nrene"]
 re [label="Primary Release Engineering Team\n...@freebsd.org\nkib, blackend, 
jpaetzel, hrs, kensmith"]
 secteam [label="Security Team\nsect...@freebsd.org\ndelphij,\ndes, gavin, 
gjb,\nglebius, remko"]
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r305906 - in head/sys/dev/cxgbe: . common tom

2016-09-17 Thread Navdeep Parhar
Author: np
Date: Sat Sep 17 22:13:03 2016
New Revision: 305906
URL: https://svnweb.freebsd.org/changeset/base/305906

Log:
  cxgbe/t4_tom: The SMAC entry for a VI is at a different location in the T6.
  
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/common/t4_hw.c
  head/sys/dev/cxgbe/t4_main.c
  head/sys/dev/cxgbe/tom/t4_tom.c

Modified: head/sys/dev/cxgbe/adapter.h
==
--- head/sys/dev/cxgbe/adapter.hSat Sep 17 21:49:11 2016
(r305905)
+++ head/sys/dev/cxgbe/adapter.hSat Sep 17 22:13:03 2016
(r305906)
@@ -231,6 +231,7 @@ struct vi_info {
int if_flags;
 
uint16_t *rss, *nm_rss;
+   int smt_idx;/* for convenience */
uint16_t viid;
int16_t  xact_addr_filt;/* index of exact MAC address filter */
uint16_t rss_size;  /* size of VI's RSS table slice */

Modified: head/sys/dev/cxgbe/common/t4_hw.c
==
--- head/sys/dev/cxgbe/common/t4_hw.c   Sat Sep 17 21:49:11 2016
(r305905)
+++ head/sys/dev/cxgbe/common/t4_hw.c   Sat Sep 17 22:13:03 2016
(r305906)
@@ -8100,6 +8100,10 @@ int t4_port_init(struct adapter *adap, i
return ret;
 
p->vi[0].viid = ret;
+   if (chip_id(adap) <= CHELSIO_T5)
+   p->vi[0].smt_idx = (ret & 0x7f) << 1;
+   else
+   p->vi[0].smt_idx = (ret & 0x7f);
p->tx_chan = j;
p->rx_chan_map = t4_get_mps_bg_map(adap, j);
p->lport = j;

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cSat Sep 17 21:49:11 2016
(r305905)
+++ head/sys/dev/cxgbe/t4_main.cSat Sep 17 22:13:03 2016
(r305906)
@@ -2030,6 +2030,10 @@ vcxgbe_attach(device_t dev)
return (-rc);
}
vi->viid = rc;
+   if (chip_id(sc) <= CHELSIO_T5)
+   vi->smt_idx = (rc & 0x7f) << 1;
+   else
+   vi->smt_idx = (rc & 0x7f);
 
param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) |
V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_RSSINFO) |

Modified: head/sys/dev/cxgbe/tom/t4_tom.c
==
--- head/sys/dev/cxgbe/tom/t4_tom.c Sat Sep 17 21:49:11 2016
(r305905)
+++ head/sys/dev/cxgbe/tom/t4_tom.c Sat Sep 17 22:13:03 2016
(r305906)
@@ -538,7 +538,6 @@ select_rcv_wscale(void)
 }
 
 extern int always_keepalive;
-#define VIID_SMACIDX(v)(((unsigned int)(v) & 0x7f) << 1)
 
 /*
  * socket so could be a listening socket too.
@@ -569,7 +568,7 @@ calc_opt0(struct socket *so, struct vi_i
opt0 |= V_L2T_IDX(e->idx);
 
if (vi != NULL) {
-   opt0 |= V_SMAC_SEL(VIID_SMACIDX(vi->viid));
+   opt0 |= V_SMAC_SEL(vi->smt_idx);
opt0 |= V_TX_CHAN(vi->pi->tx_chan);
}
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r305907 - head/sys/dev/bhnd/cores/chipc

2016-09-17 Thread Landon J. Fuller
Author: landonf
Date: Sat Sep 17 22:18:32 2016
New Revision: 305907
URL: https://svnweb.freebsd.org/changeset/base/305907

Log:
  bhnd(4): Fix regression in BCM4331 SPROM pin reference counting.
  
  In r304870, refcount handling was lifted out into a common OTP/SPROM code
  path, but the refcount assertions in chipc_disable_sprom_pins() were not
  updated accordingly; this triggered an assertion on BCM4331 devices when
  releasing a SPROM pin reservation.
  
  Approved by:  adrian (mentor, implicit)

Modified:
  head/sys/dev/bhnd/cores/chipc/chipc.c

Modified: head/sys/dev/bhnd/cores/chipc/chipc.c
==
--- head/sys/dev/bhnd/cores/chipc/chipc.c   Sat Sep 17 22:13:03 2016
(r305906)
+++ head/sys/dev/bhnd/cores/chipc/chipc.c   Sat Sep 17 22:18:32 2016
(r305907)
@@ -1261,8 +1261,7 @@ chipc_disable_sprom_pins(struct chipc_so
return;
 
CHIPC_LOCK_ASSERT(sc, MA_OWNED);
-   KASSERT(sc->sprom_refcnt != 0, ("sprom pins already disabled"));
-   KASSERT(sc->sprom_refcnt == 1, ("sprom pins in use"));
+   KASSERT(sc->sprom_refcnt == 0, ("sprom pins in use"));
 
cctrl = bhnd_bus_read_4(sc->core, CHIPC_CHIPCTRL);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r305908 - head/sys/dev/cxgbe/tom

2016-09-17 Thread Navdeep Parhar
Author: np
Date: Sat Sep 17 23:08:49 2016
New Revision: 305908
URL: https://svnweb.freebsd.org/changeset/base/305908

Log:
  cxgbe/t4_tom: Update the active/passive open code to support T6.  Data
  path works as-is.
  
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/tom/t4_connect.c
  head/sys/dev/cxgbe/tom/t4_listen.c

Modified: head/sys/dev/cxgbe/tom/t4_connect.c
==
--- head/sys/dev/cxgbe/tom/t4_connect.c Sat Sep 17 22:18:32 2016
(r305907)
+++ head/sys/dev/cxgbe/tom/t4_connect.c Sat Sep 17 23:08:49 2016
(r305908)
@@ -277,19 +277,26 @@ t4_init_connect_cpl_handlers(void)
 static inline int
 act_open_cpl_size(struct adapter *sc, int isipv6)
 {
-   static const int sz_t4[] = {
-   sizeof (struct cpl_act_open_req),
-   sizeof (struct cpl_act_open_req6)
-   };
-   static const int sz_t5[] = {
-   sizeof (struct cpl_t5_act_open_req),
-   sizeof (struct cpl_t5_act_open_req6)
+   int idx;
+   static const int sz_table[3][2] = {
+   {
+   sizeof (struct cpl_act_open_req),
+   sizeof (struct cpl_act_open_req6)
+   },
+   {
+   sizeof (struct cpl_t5_act_open_req),
+   sizeof (struct cpl_t5_act_open_req6)
+   },
+   {
+   sizeof (struct cpl_t6_act_open_req),
+   sizeof (struct cpl_t6_act_open_req6)
+   },
};
 
-   if (is_t4(sc))
-   return (sz_t4[!!isipv6]);
-   else
-   return (sz_t5[!!isipv6]);
+   MPASS(chip_id(sc) >= CHELSIO_T4);
+   idx = min(chip_id(sc) - CHELSIO_T4, 2);
+
+   return (sz_table[idx][!!isipv6]);
 }
 
 /*
@@ -373,28 +380,32 @@ t4_connect(struct toedev *tod, struct so
 
if (isipv6) {
struct cpl_act_open_req6 *cpl = wrtod(wr);
+   struct cpl_t5_act_open_req6 *cpl5 = (void *)cpl;
+   struct cpl_t6_act_open_req6 *cpl6 = (void *)cpl;
 
-   if ((inp->inp_vflag & INP_IPV6) == 0) {
-   /* XXX think about this a bit more */
-   log(LOG_ERR,
-   "%s: time to think about AF_INET6 + vflag 0x%x.\n",
-   __func__, inp->inp_vflag);
+   if ((inp->inp_vflag & INP_IPV6) == 0)
DONT_OFFLOAD_ACTIVE_OPEN(ENOTSUP);
-   }
 
toep->ce = hold_lip(td, &inp->in6p_laddr);
if (toep->ce == NULL)
DONT_OFFLOAD_ACTIVE_OPEN(ENOENT);
 
-   if (is_t4(sc)) {
+   switch (chip_id(sc)) {
+   case CHELSIO_T4:
INIT_TP_WR(cpl, 0);
cpl->params = select_ntuple(vi, toep->l2te);
-   } else {
-   struct cpl_t5_act_open_req6 *c5 = (void *)cpl;
-
-   INIT_TP_WR(c5, 0);
-   c5->iss = htobe32(tp->iss);
-   c5->params = select_ntuple(vi, toep->l2te);
+   break;
+   case CHELSIO_T5:
+   INIT_TP_WR(cpl5, 0);
+   cpl5->iss = htobe32(tp->iss);
+   cpl5->params = select_ntuple(vi, toep->l2te);
+   break;
+   case CHELSIO_T6:
+   default:
+   INIT_TP_WR(cpl6, 0);
+   cpl6->iss = htobe32(tp->iss);
+   cpl6->params = select_ntuple(vi, toep->l2te);
+   break;
}
OPCODE_TID(cpl) = htobe32(MK_OPCODE_TID(CPL_ACT_OPEN_REQ6,
qid_atid));
@@ -409,16 +420,25 @@ t4_connect(struct toedev *tod, struct so
cpl->opt2 = calc_opt2a(so, toep);
} else {
struct cpl_act_open_req *cpl = wrtod(wr);
+   struct cpl_t5_act_open_req *cpl5 = (void *)cpl;
+   struct cpl_t6_act_open_req *cpl6 = (void *)cpl;
 
-   if (is_t4(sc)) {
+   switch (chip_id(sc)) {
+   case CHELSIO_T4:
INIT_TP_WR(cpl, 0);
cpl->params = select_ntuple(vi, toep->l2te);
-   } else {
-   struct cpl_t5_act_open_req *c5 = (void *)cpl;
-
-   INIT_TP_WR(c5, 0);
-   c5->iss = htobe32(tp->iss);
-   c5->params = select_ntuple(vi, toep->l2te);
+   break;
+   case CHELSIO_T5:
+   INIT_TP_WR(cpl5, 0);
+   cpl5->iss = htobe32(tp->iss);
+   cpl5->params = select_ntuple(vi, toep->l2te);
+   break;
+   case CHELSIO_T6:
+   default:
+   INIT_TP_

svn commit: r305916 - head/tests/sys/mac/bsdextended

2016-09-17 Thread Ngie Cooper
Author: ngie
Date: Sun Sep 18 05:06:15 2016
New Revision: 305916
URL: https://svnweb.freebsd.org/changeset/base/305916

Log:
  Make sure $TMPDIR is created with 0755 permissions
  
  This is required to ensure that the temporary script can be executed,
  as the default mode is apparently too restrictive
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/tests/sys/mac/bsdextended/matches_test.sh

Modified: head/tests/sys/mac/bsdextended/matches_test.sh
==
--- head/tests/sys/mac/bsdextended/matches_test.sh  Sun Sep 18 04:34:32 
2016(r305915)
+++ head/tests/sys/mac/bsdextended/matches_test.sh  Sun Sep 18 05:06:15 
2016(r305916)
@@ -36,6 +36,10 @@ if ! sysctl -N security.mac.bsdextended 
echo "1..0 # SKIP mac_bsdextended(4) support isn't available"
exit 0
 fi
+if ! chmod -Rf 0755 $TMPDIR; then
+   echo "1..0 # SKIP failed to chmod $TMPDIR"
+   exit 0
+fi
 if ! playground=$(mktemp -d $TMPDIR/tmp.XXX); then
echo "1..0 # SKIP failed to create temporary directory"
exit 0
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r305917 - head/sys/dev/iwm

2016-09-17 Thread Adrian Chadd
Author: adrian
Date: Sun Sep 18 05:07:18 2016
New Revision: 305917
URL: https://svnweb.freebsd.org/changeset/base/305917

Log:
  [iwm] fix up RSSI calculations for both scan results and normal RX operations.
  
  * hard code a noise floor of -96 for now. The noise floor update code returns
some "interesting" values that I can't map to anything useful right now.
  * Ensure a default noise floor is set - otherwise the initial scan results
have a noise floor of '0'.
  * Fix up the RSSI calculation to be correctly relative to the noise floor.
The RSSI routines return an absolute value in dBm - so fix this up.
  * Cap RSSI values appropriately.
  * Ensure we pass in a 1/2 dB unit value in to net80211.
  
  Tested:
  
  * Intel 7260, STA mode
  
  iwm0:  mem 0xf140-0xf1401fff irq 17 at 
device 0.0 on pci2
  iwm0: hw rev 0x140, fw ver 16.242414.0, address xx:xx:xx:xx:xx:xx

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Sun Sep 18 05:06:15 2016(r305916)
+++ head/sys/dev/iwm/if_iwm.c   Sun Sep 18 05:07:18 2016(r305917)
@@ -312,7 +312,8 @@ static int  iwm_mvm_get_signal_strength(s
 static voidiwm_mvm_rx_rx_phy_cmd(struct iwm_softc *,
   struct iwm_rx_packet *,
   struct iwm_rx_data *);
-static int iwm_get_noise(const struct iwm_mvm_statistics_rx_non_phy *);
+static int iwm_get_noise(struct iwm_softc *sc,
+   const struct iwm_mvm_statistics_rx_non_phy *);
 static voidiwm_mvm_rx_rx_mpdu(struct iwm_softc *, struct iwm_rx_packet *,
struct iwm_rx_data *);
 static int iwm_mvm_rx_tx_cmd_single(struct iwm_softc *,
@@ -2871,21 +2872,34 @@ iwm_mvm_rx_rx_phy_cmd(struct iwm_softc *
  * Retrieve the average noise (in dBm) among receivers.
  */
 static int
-iwm_get_noise(const struct iwm_mvm_statistics_rx_non_phy *stats)
+iwm_get_noise(struct iwm_softc *sc,
+const struct iwm_mvm_statistics_rx_non_phy *stats)
 {
int i, total, nbant, noise;
 
total = nbant = noise = 0;
for (i = 0; i < 3; i++) {
noise = le32toh(stats->beacon_silence_rssi[i]) & 0xff;
+   IWM_DPRINTF(sc, IWM_DEBUG_RECV, "%s: i=%d, noise=%d\n",
+   __func__,
+   i,
+   noise);
+
if (noise) {
total += noise;
nbant++;
}
}
 
+   IWM_DPRINTF(sc, IWM_DEBUG_RECV, "%s: nbant=%d, total=%d\n",
+   __func__, nbant, total);
+#if 0
/* There should be at least one antenna but check anyway. */
return (nbant == 0) ? -127 : (total / nbant) - 107;
+#else
+   /* For now, just hard-code it to -96 to be safe */
+   return (-96);
+#endif
 }
 
 /*
@@ -2940,8 +2954,15 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc,
} else {
rssi = iwm_mvm_calc_rssi(sc, phy_info);
}
-   rssi = (0 - IWM_MIN_DBM) + rssi;/* normalize */
-   rssi = MIN(rssi, sc->sc_max_rssi);  /* clip to max. 100% */
+
+   /* Note: RSSI is absolute (ie a -ve value) */
+   if (rssi < IWM_MIN_DBM)
+   rssi = IWM_MIN_DBM;
+   else if (rssi > IWM_MAX_DBM)
+   rssi = IWM_MAX_DBM;
+
+   /* Map it to relative value */
+   rssi = rssi - sc->sc_noise;
 
/* replenish ring for the buffer we're going to feed to the sharks */
if (iwm_rx_addbuf(sc, IWM_RBUF_SIZE, sc->rxq.cur) != 0) {
@@ -2950,6 +2971,9 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc,
return;
}
 
+   IWM_DPRINTF(sc, IWM_DEBUG_RECV,
+   "%s: rssi=%d, noise=%d\n", __func__, rssi, sc->sc_noise);
+
ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh);
 
IWM_DPRINTF(sc, IWM_DEBUG_RECV,
@@ -2970,7 +2994,9 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc,
} else {
rxs.c_freq = ieee80211_ieee2mhz(rxs.c_ieee, 
IEEE80211_CHAN_5GHZ);
}
-   rxs.rssi = rssi - sc->sc_noise;
+
+   /* rssi is in 1/2db units */
+   rxs.rssi = rssi * 2;
rxs.nf = sc->sc_noise;
 
if (ieee80211_radiotap_active_vap(vap)) {
@@ -5172,7 +5198,7 @@ iwm_notif_intr(struct iwm_softc *sc)
struct iwm_notif_statistics *stats;
SYNC_RESP_STRUCT(stats, pkt);
memcpy(&sc->sc_stats, stats, sizeof(sc->sc_stats));
-   sc->sc_noise = iwm_get_noise(&stats->rx.general);
+   sc->sc_noise = iwm_get_noise(sc, &stats->rx.general);
break; }
 
case IWM_NVM_ACCESS_CMD:
@@ -5823,8 +5849,12 @@ iwm_attach(device_t dev)
sc->sc_phyctxt[i].channel = NULL;
}
 
+   /* Default noise floor */
+   sc->sc_noise = -96;
+

svn commit: r305918 - head/tests/sys/mac/bsdextended

2016-09-17 Thread Ngie Cooper
Author: ngie
Date: Sun Sep 18 05:10:15 2016
New Revision: 305918
URL: https://svnweb.freebsd.org/changeset/base/305918

Log:
  Only chmod $TMPDIR if it's not /tmp
  
  This is a safety belt to ensure that the /tmp sticky bit stuff doesn't
  get whacked by accident if someone runs the script outright
  
  MFC after:1 week
  X-MFC with:   r305916
  Sponsored by: Dell EMC Isilon

Modified:
  head/tests/sys/mac/bsdextended/matches_test.sh

Modified: head/tests/sys/mac/bsdextended/matches_test.sh
==
--- head/tests/sys/mac/bsdextended/matches_test.sh  Sun Sep 18 05:07:18 
2016(r305917)
+++ head/tests/sys/mac/bsdextended/matches_test.sh  Sun Sep 18 05:10:15 
2016(r305918)
@@ -36,9 +36,11 @@ if ! sysctl -N security.mac.bsdextended 
echo "1..0 # SKIP mac_bsdextended(4) support isn't available"
exit 0
 fi
-if ! chmod -Rf 0755 $TMPDIR; then
-   echo "1..0 # SKIP failed to chmod $TMPDIR"
-   exit 0
+if [ "$TMPDIR" != "/tmp" ]; then
+   if ! chmod -Rf 0755 $TMPDIR; then
+   echo "1..0 # SKIP failed to chmod $TMPDIR"
+   exit 0
+   fi
 fi
 if ! playground=$(mktemp -d $TMPDIR/tmp.XXX); then
echo "1..0 # SKIP failed to create temporary directory"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r305919 - in head/lib/libc/tests: iconv net/getaddrinfo

2016-09-17 Thread Ngie Cooper
Author: ngie
Date: Sun Sep 18 05:12:23 2016
New Revision: 305919
URL: https://svnweb.freebsd.org/changeset/base/305919

Log:
  Don't define PACKAGE in lib/libc/tests/{iconv,net/getaddrinfo}
  needlessly
  
  This is already being done by bsd.test.mk
  
  The other subdirectory Makefiles were intentionally left alone
  
  MFC after:1 week
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/iconv/Makefile
  head/lib/libc/tests/net/getaddrinfo/Makefile

Modified: head/lib/libc/tests/iconv/Makefile
==
--- head/lib/libc/tests/iconv/Makefile  Sun Sep 18 05:10:15 2016
(r305918)
+++ head/lib/libc/tests/iconv/Makefile  Sun Sep 18 05:12:23 2016
(r305919)
@@ -1,7 +1,5 @@
 # $FreeBSD$
 
-PACKAGE=   tests
-
 TESTSDIR=  ${TESTSBASE}/lib/libc/iconv
 
 ATF_TESTS_C+=  iconvctl_test

Modified: head/lib/libc/tests/net/getaddrinfo/Makefile
==
--- head/lib/libc/tests/net/getaddrinfo/MakefileSun Sep 18 05:10:15 
2016(r305918)
+++ head/lib/libc/tests/net/getaddrinfo/MakefileSun Sep 18 05:12:23 
2016(r305919)
@@ -1,7 +1,5 @@
 # $FreeBSD$
 
-PACKAGE=   tests
-
 TESTSRC=   ${SRCTOP}/contrib/netbsd-tests/lib/libc/net/${.CURDIR:T}
 
 .include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r305920 - head/lib/libc/tests/stdio

2016-09-17 Thread Ngie Cooper
Author: ngie
Date: Sun Sep 18 05:54:13 2016
New Revision: 305920
URL: https://svnweb.freebsd.org/changeset/base/305920

Log:
  Remove spurious newlines from atf_tc_fail calls
  
  This changes the results from broken (incorrect) to failed (correct) on
  i386
  
  MFC after:1 week
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/stdio/printbasic_test.c
  head/lib/libc/tests/stdio/printfloat_test.c

Modified: head/lib/libc/tests/stdio/printbasic_test.c
==
--- head/lib/libc/tests/stdio/printbasic_test.c Sun Sep 18 05:12:23 2016
(r305919)
+++ head/lib/libc/tests/stdio/printbasic_test.c Sun Sep 18 05:54:13 2016
(r305920)
@@ -80,7 +80,7 @@ _testfmt(const char *result, const char 
vsnprintf(s, sizeof(s), fmt, ap);
if (strcmp(result, s) != 0) {
atf_tc_fail(
-   "printf(\"%s\", %s) ==> [%s], expected [%s]\n",
+   "printf(\"%s\", %s) ==> [%s], expected [%s]",
fmt, argstr, s, result);
}
 
@@ -91,7 +91,7 @@ _testfmt(const char *result, const char 
vswprintf(ws, sizeof(ws) / sizeof(ws[0]), wfmt, ap2);
if (wcscmp(wresult, ws) != 0) {
atf_tc_fail(
-   "wprintf(\"%ls\", %s) ==> [%ls], expected [%ls]\n",
+   "wprintf(\"%ls\", %s) ==> [%ls], expected [%ls]",
wfmt, argstr, ws, wresult);
}
va_end(ap);

Modified: head/lib/libc/tests/stdio/printfloat_test.c
==
--- head/lib/libc/tests/stdio/printfloat_test.c Sun Sep 18 05:12:23 2016
(r305919)
+++ head/lib/libc/tests/stdio/printfloat_test.c Sun Sep 18 05:54:13 2016
(r305920)
@@ -72,7 +72,7 @@ _testfmt(const char *result, const char 
vsnprintf(s, sizeof(s), fmt, ap);
if (strcmp(result, s) != 0) {
atf_tc_fail(
-   "printf(\"%s\", %s) ==> [%s], expected [%s]\n",
+   "printf(\"%s\", %s) ==> [%s], expected [%s]",
fmt, argstr, s, result);
}
 
@@ -83,7 +83,7 @@ _testfmt(const char *result, const char 
vswprintf(ws, sizeof(ws) / sizeof(ws[0]), wfmt, ap2);
if (wcscmp(wresult, ws) != 0) {
atf_tc_fail(
-   "wprintf(\"%ls\", %s) ==> [%ls], expected [%ls]\n",
+   "wprintf(\"%ls\", %s) ==> [%ls], expected [%ls]",
wfmt, argstr, ws, wresult);
}
va_end(ap);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r305921 - head/lib/libc/tests/stdio

2016-09-17 Thread Ngie Cooper
Author: ngie
Date: Sun Sep 18 06:00:07 2016
New Revision: 305921
URL: https://svnweb.freebsd.org/changeset/base/305921

Log:
  Similar to r305920, remove spurious newlines from ATF_REQUIRE_MSG calls
  
  MFC after:1 week
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/stdio/open_memstream2_test.c
  head/lib/libc/tests/stdio/open_wmemstream_test.c

Modified: head/lib/libc/tests/stdio/open_memstream2_test.c
==
--- head/lib/libc/tests/stdio/open_memstream2_test.cSun Sep 18 05:54:13 
2016(r305920)
+++ head/lib/libc/tests/stdio/open_memstream2_test.cSun Sep 18 06:00:07 
2016(r305921)
@@ -159,11 +159,11 @@ ATF_TC_BODY(seek_tests, tc)
 #define SEEK_FAIL(offset, whence, error) do {  \
errno = 0;  \
ATF_REQUIRE_MSG(fseeko(fp, (offset), (whence)) != 0,\
-   "fseeko(%s, %s) did not fail, set pos to %jd\n",\
+   "fseeko(%s, %s) did not fail, set pos to %jd",  \
__STRING(offset), __STRING(whence), \
(intmax_t)ftello(fp));  \
ATF_REQUIRE_MSG(errno == (error),   \
-   "fseeko(%s, %s) failed with %d rather than %s\n",   \
+   "fseeko(%s, %s) failed with %d rather than %s", \
__STRING(offset), __STRING(whence), errno,  \
__STRING(error));   \
 } while (0)
@@ -173,7 +173,7 @@ ATF_TC_BODY(seek_tests, tc)
"fseeko(%s, %s) failed: %s",\
__STRING(offset), __STRING(whence), strerror(errno)); \
ATF_REQUIRE_MSG(ftello(fp) == (result), \
-   "fseeko(%s, %s) seeked to %jd rather than %s\n",\
+   "fseeko(%s, %s) seeked to %jd rather than %s",  \
__STRING(offset), __STRING(whence), \
(intmax_t)ftello(fp), __STRING(result));\
 } while (0)

Modified: head/lib/libc/tests/stdio/open_wmemstream_test.c
==
--- head/lib/libc/tests/stdio/open_wmemstream_test.cSun Sep 18 05:54:13 
2016(r305920)
+++ head/lib/libc/tests/stdio/open_wmemstream_test.cSun Sep 18 06:00:07 
2016(r305921)
@@ -159,11 +159,11 @@ ATF_TC_BODY(seek_tests, tc)
 #define SEEK_FAIL(offset, whence, error) do {  \
errno = 0;  \
ATF_REQUIRE_MSG(fseeko(fp, (offset), (whence)) != 0,\
-   "fseeko(%s, %s) did not fail, set pos to %jd\n",\
+   "fseeko(%s, %s) did not fail, set pos to %jd",  \
__STRING(offset), __STRING(whence), \
(intmax_t)ftello(fp));  \
ATF_REQUIRE_MSG(errno == (error),   \
-   "fseeko(%s, %s) failed with %d rather than %s\n",   \
+   "fseeko(%s, %s) failed with %d rather than %s", \
__STRING(offset), __STRING(whence), errno,  \
__STRING(error));   \
 } while (0)
@@ -173,7 +173,7 @@ ATF_TC_BODY(seek_tests, tc)
"fseeko(%s, %s) failed: %s",\
__STRING(offset), __STRING(whence), strerror(errno)); \
ATF_REQUIRE_MSG(ftello(fp) == (result), \
-   "fseeko(%s, %s) seeked to %jd rather than %s\n",\
+   "fseeko(%s, %s) seeked to %jd rather than %s",  \
__STRING(offset), __STRING(whence), \
(intmax_t)ftello(fp), __STRING(result));\
 } while (0)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"