svn commit: r270087 - stable/10/sys/kern

2014-08-16 Thread Mateusz Guzik
Author: mjg
Date: Sun Aug 17 06:58:14 2014
New Revision: 270087
URL: http://svnweb.freebsd.org/changeset/base/270087

Log:
  MFC r268365:
  
  Don't call crdup nor uifind under vnode lock.
  
  A locked vnode can get into the way of satisyfing malloc with M_WATOK.
  
  This is a fixup to r268087.

Modified:
  stable/10/sys/kern/kern_exec.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_exec.c
==
--- stable/10/sys/kern/kern_exec.c  Sun Aug 17 06:56:22 2014
(r270086)
+++ stable/10/sys/kern/kern_exec.c  Sun Aug 17 06:58:14 2014
(r270087)
@@ -721,11 +721,11 @@ interpret:
VOP_UNLOCK(imgp->vp, 0);
setugidsafety(td);
error = fdcheckstd(td);
-   vn_lock(imgp->vp, LK_SHARED | LK_RETRY);
if (error != 0)
goto done1;
newcred = crdup(oldcred);
euip = uifind(attr.va_uid);
+   vn_lock(imgp->vp, LK_SHARED | LK_RETRY);
PROC_LOCK(p);
/*
 * Set the new credentials.
@@ -769,7 +769,9 @@ interpret:
if (oldcred->cr_svuid != oldcred->cr_uid ||
oldcred->cr_svgid != oldcred->cr_gid) {
PROC_UNLOCK(p);
+   VOP_UNLOCK(imgp->vp, 0);
newcred = crdup(oldcred);
+   vn_lock(imgp->vp, LK_SHARED | LK_RETRY);
PROC_LOCK(p);
change_svuid(newcred, newcred->cr_uid);
change_svgid(newcred, newcred->cr_gid);
@@ -846,6 +848,7 @@ interpret:
 
SDT_PROBE(proc, kernel, , exec__success, args->fname, 0, 0, 0, 0);
 
+   VOP_UNLOCK(imgp->vp, 0);
 done1:
/*
 * Free any resources malloc'd earlier that we didn't use.
@@ -854,7 +857,6 @@ done1:
uifree(euip);
if (newcred != NULL)
crfree(oldcred);
-   VOP_UNLOCK(imgp->vp, 0);
 
/*
 * Handle deferred decrement of ref counts.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270086 - stable/10/sys/kern

2014-08-16 Thread Mateusz Guzik
Author: mjg
Date: Sun Aug 17 06:56:22 2014
New Revision: 270086
URL: http://svnweb.freebsd.org/changeset/base/270086

Log:
  MFC r268136:
  
  Plug gcc warning after r268074 about unitialized newsigacts

Modified:
  stable/10/sys/kern/kern_exec.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_exec.c
==
--- stable/10/sys/kern/kern_exec.c  Sun Aug 17 06:54:49 2014
(r270085)
+++ stable/10/sys/kern/kern_exec.c  Sun Aug 17 06:56:22 2014
(r270086)
@@ -626,8 +626,10 @@ interpret:
oldsigacts = p->p_sigacts;
newsigacts = sigacts_alloc();
sigacts_copy(newsigacts, oldsigacts);
-   } else
+   } else {
oldsigacts = NULL;
+   newsigacts = NULL; /* satisfy gcc */
+   }
 
PROC_LOCK(p);
if (oldsigacts)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270085 - stable/10/sys/kern

2014-08-16 Thread Mateusz Guzik
Author: mjg
Date: Sun Aug 17 06:54:49 2014
New Revision: 270085
URL: http://svnweb.freebsd.org/changeset/base/270085

Log:
  MFC r268087:
  
  Don't call crcopysafe or uifind unnecessarily in execve.

Modified:
  stable/10/sys/kern/kern_exec.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_exec.c
==
--- stable/10/sys/kern/kern_exec.c  Sun Aug 17 06:52:35 2014
(r270084)
+++ stable/10/sys/kern/kern_exec.c  Sun Aug 17 06:54:49 2014
(r270085)
@@ -339,7 +339,7 @@ do_execve(td, args, mac_p)
struct proc *p = td->td_proc;
struct nameidata nd;
struct ucred *newcred = NULL, *oldcred;
-   struct uidinfo *euip;
+   struct uidinfo *euip = NULL;
register_t *stack_base;
int error, i;
struct image_params image_params, *imgp;
@@ -604,8 +604,6 @@ interpret:
/*
 * Malloc things before we need locks.
 */
-   newcred = crget();
-   euip = uifind(attr.va_uid);
i = imgp->args->begin_envv - imgp->args->begin_argv;
/* Cache arguments if they fit inside our allowance */
if (ps_arg_cache_limit >= i + sizeof(struct pargs)) {
@@ -634,7 +632,7 @@ interpret:
PROC_LOCK(p);
if (oldsigacts)
p->p_sigacts = newsigacts;
-   oldcred = crcopysafe(p, newcred);
+   oldcred = p->p_ucred;
/* Stop profiling */
stopprofclock(p);
 
@@ -724,6 +722,8 @@ interpret:
vn_lock(imgp->vp, LK_SHARED | LK_RETRY);
if (error != 0)
goto done1;
+   newcred = crdup(oldcred);
+   euip = uifind(attr.va_uid);
PROC_LOCK(p);
/*
 * Set the new credentials.
@@ -748,7 +748,6 @@ interpret:
change_svuid(newcred, newcred->cr_uid);
change_svgid(newcred, newcred->cr_gid);
p->p_ucred = newcred;
-   newcred = NULL;
} else {
if (oldcred->cr_uid == oldcred->cr_ruid &&
oldcred->cr_gid == oldcred->cr_rgid)
@@ -767,10 +766,12 @@ interpret:
 */
if (oldcred->cr_svuid != oldcred->cr_uid ||
oldcred->cr_svgid != oldcred->cr_gid) {
+   PROC_UNLOCK(p);
+   newcred = crdup(oldcred);
+   PROC_LOCK(p);
change_svuid(newcred, newcred->cr_uid);
change_svgid(newcred, newcred->cr_gid);
p->p_ucred = newcred;
-   newcred = NULL;
}
}
 
@@ -847,11 +848,10 @@ done1:
/*
 * Free any resources malloc'd earlier that we didn't use.
 */
-   uifree(euip);
-   if (newcred == NULL)
+   if (euip != NULL)
+   uifree(euip);
+   if (newcred != NULL)
crfree(oldcred);
-   else
-   crfree(newcred);
VOP_UNLOCK(imgp->vp, 0);
 
/*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270084 - stable/10/sys/kern

2014-08-16 Thread Mateusz Guzik
Author: mjg
Date: Sun Aug 17 06:52:35 2014
New Revision: 270084
URL: http://svnweb.freebsd.org/changeset/base/270084

Log:
  MFC r268074:
  
  Perform a lockless check in sigacts_shared.
  
  It is used only during execve (i.e. singlethreaded), so there is no fear
  of returning 'not shared' which soon becomes 'shared'.
  
  While here reorganize the code a little to avoid proc lock/unlock in
  shared case.

Modified:
  stable/10/sys/kern/kern_exec.c
  stable/10/sys/kern/kern_sig.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_exec.c
==
--- stable/10/sys/kern/kern_exec.c  Sun Aug 17 06:28:57 2014
(r270083)
+++ stable/10/sys/kern/kern_exec.c  Sun Aug 17 06:52:35 2014
(r270084)
@@ -624,18 +624,17 @@ interpret:
 * handlers. In execsigs(), the new process will have its signals
 * reset.
 */
-   PROC_LOCK(p);
-   oldcred = crcopysafe(p, newcred);
if (sigacts_shared(p->p_sigacts)) {
oldsigacts = p->p_sigacts;
-   PROC_UNLOCK(p);
newsigacts = sigacts_alloc();
sigacts_copy(newsigacts, oldsigacts);
-   PROC_LOCK(p);
-   p->p_sigacts = newsigacts;
} else
oldsigacts = NULL;
 
+   PROC_LOCK(p);
+   if (oldsigacts)
+   p->p_sigacts = newsigacts;
+   oldcred = crcopysafe(p, newcred);
/* Stop profiling */
stopprofclock(p);
 

Modified: stable/10/sys/kern/kern_sig.c
==
--- stable/10/sys/kern/kern_sig.c   Sun Aug 17 06:28:57 2014
(r270083)
+++ stable/10/sys/kern/kern_sig.c   Sun Aug 17 06:52:35 2014
(r270084)
@@ -3463,10 +3463,6 @@ sigacts_copy(struct sigacts *dest, struc
 int
 sigacts_shared(struct sigacts *ps)
 {
-   int shared;
 
-   mtx_lock(&ps->ps_mtx);
-   shared = ps->ps_refcnt > 1;
-   mtx_unlock(&ps->ps_mtx);
-   return (shared);
+   return (ps->ps_refcnt > 1);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270083 - head/lib/libcuse

2014-08-16 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Aug 17 06:28:57 2014
New Revision: 270083
URL: http://svnweb.freebsd.org/changeset/base/270083

Log:
  Add missing DPADD to Makefile.
  
  PR:   192733

Modified:
  head/lib/libcuse/Makefile

Modified: head/lib/libcuse/Makefile
==
--- head/lib/libcuse/Makefile   Sun Aug 17 03:01:56 2014(r270082)
+++ head/lib/libcuse/Makefile   Sun Aug 17 06:28:57 2014(r270083)
@@ -36,6 +36,7 @@ CFLAGS+=  -D_GNU_SOURCE
 CFLAGS+=   -g
 CFLAGS+=   -DHAVE_DEBUG
 .endif
+DPADD+=${LIBPTHREAD}
 LDADD+=${PTHREAD_LIBS}
 
 MLINKS=
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270082 - stable/10/sys/amd64/include

2014-08-16 Thread Peter Grehan
Author: grehan
Date: Sun Aug 17 03:01:56 2014
New Revision: 270082
URL: http://svnweb.freebsd.org/changeset/base/270082

Log:
  MFC r267338
  Replace enum forward declarations with complete definitions

Modified:
  stable/10/sys/amd64/include/vmm.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/include/vmm.h
==
--- stable/10/sys/amd64/include/vmm.h   Sun Aug 17 02:56:58 2014
(r270081)
+++ stable/10/sys/amd64/include/vmm.h   Sun Aug 17 03:01:56 2014
(r270082)
@@ -37,6 +37,53 @@ enum vm_suspend_how {
VM_SUSPEND_LAST
 };
 
+/*
+ * Identifiers for architecturally defined registers.
+ */
+enum vm_reg_name {
+   VM_REG_GUEST_RAX,
+   VM_REG_GUEST_RBX,
+   VM_REG_GUEST_RCX,
+   VM_REG_GUEST_RDX,
+   VM_REG_GUEST_RSI,
+   VM_REG_GUEST_RDI,
+   VM_REG_GUEST_RBP,
+   VM_REG_GUEST_R8,
+   VM_REG_GUEST_R9,
+   VM_REG_GUEST_R10,
+   VM_REG_GUEST_R11,
+   VM_REG_GUEST_R12,
+   VM_REG_GUEST_R13,
+   VM_REG_GUEST_R14,
+   VM_REG_GUEST_R15,
+   VM_REG_GUEST_CR0,
+   VM_REG_GUEST_CR3,
+   VM_REG_GUEST_CR4,
+   VM_REG_GUEST_DR7,
+   VM_REG_GUEST_RSP,
+   VM_REG_GUEST_RIP,
+   VM_REG_GUEST_RFLAGS,
+   VM_REG_GUEST_ES,
+   VM_REG_GUEST_CS,
+   VM_REG_GUEST_SS,
+   VM_REG_GUEST_DS,
+   VM_REG_GUEST_FS,
+   VM_REG_GUEST_GS,
+   VM_REG_GUEST_LDTR,
+   VM_REG_GUEST_TR,
+   VM_REG_GUEST_IDTR,
+   VM_REG_GUEST_GDTR,
+   VM_REG_GUEST_EFER,
+   VM_REG_GUEST_CR2,
+   VM_REG_LAST
+};
+
+enum x2apic_state {
+   X2APIC_DISABLED,
+   X2APIC_ENABLED,
+   X2APIC_STATE_LAST
+};
+
 #ifdef _KERNEL
 
 #defineVM_MAX_NAMELEN  32
@@ -54,9 +101,6 @@ struct vmspace;
 struct vm_object;
 struct pmap;
 
-enum vm_reg_name;
-enum x2apic_state;
-
 typedef int(*vmm_init_func_t)(int ipinum);
 typedef int(*vmm_cleanup_func_t)(void);
 typedef void   (*vmm_resume_func_t)(void);
@@ -250,47 +294,6 @@ enum vm_reg_name vm_segment_name(int seg
 #defineVM_MAXCPU   16  /* maximum virtual cpus 
*/
 
 /*
- * Identifiers for architecturally defined registers.
- */
-enum vm_reg_name {
-   VM_REG_GUEST_RAX,
-   VM_REG_GUEST_RBX,
-   VM_REG_GUEST_RCX,
-   VM_REG_GUEST_RDX,
-   VM_REG_GUEST_RSI,
-   VM_REG_GUEST_RDI,
-   VM_REG_GUEST_RBP,
-   VM_REG_GUEST_R8,
-   VM_REG_GUEST_R9,
-   VM_REG_GUEST_R10,
-   VM_REG_GUEST_R11,
-   VM_REG_GUEST_R12,
-   VM_REG_GUEST_R13,
-   VM_REG_GUEST_R14,
-   VM_REG_GUEST_R15,
-   VM_REG_GUEST_CR0,
-   VM_REG_GUEST_CR3,
-   VM_REG_GUEST_CR4,
-   VM_REG_GUEST_DR7,
-   VM_REG_GUEST_RSP,
-   VM_REG_GUEST_RIP,
-   VM_REG_GUEST_RFLAGS,
-   VM_REG_GUEST_ES,
-   VM_REG_GUEST_CS,
-   VM_REG_GUEST_SS,
-   VM_REG_GUEST_DS,
-   VM_REG_GUEST_FS,
-   VM_REG_GUEST_GS,
-   VM_REG_GUEST_LDTR,
-   VM_REG_GUEST_TR,
-   VM_REG_GUEST_IDTR,
-   VM_REG_GUEST_GDTR,
-   VM_REG_GUEST_EFER,
-   VM_REG_GUEST_CR2,
-   VM_REG_LAST
-};
-
-/*
  * Identifiers for optional vmm capabilities
  */
 enum vm_cap_type {
@@ -302,12 +305,6 @@ enum vm_cap_type {
VM_CAP_MAX
 };
 
-enum x2apic_state {
-   X2APIC_DISABLED,
-   X2APIC_ENABLED,
-   X2APIC_STATE_LAST
-};
-
 enum vm_intr_trigger {
EDGE_TRIGGER,
LEVEL_TRIGGER
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270081 - head/sys/arm/include

2014-08-16 Thread Ian Lepore
Author: ian
Date: Sun Aug 17 02:56:58 2014
New Revision: 270081
URL: http://svnweb.freebsd.org/changeset/base/270081

Log:
  When the initarm_* routines were renamed to platform_* and moved to their
  own header file, the lovely block of comments explaining what the generic
  init code expects of the soc implementations got lost, restore it.

Modified:
  head/sys/arm/include/platform.h

Modified: head/sys/arm/include/platform.h
==
--- head/sys/arm/include/platform.h Sun Aug 17 02:53:36 2014
(r270080)
+++ head/sys/arm/include/platform.h Sun Aug 17 02:56:58 2014
(r270081)
@@ -29,6 +29,34 @@
 #ifndef_MACHINE_PLATFORM_H_
 #define_MACHINE_PLATFORM_H_
 
+/*
+ * Initialization functions called by the common initarm() function in
+ * arm/machdep.c (but not necessarily from the custom initarm() functions of
+ * older code).
+ *
+ *  - platform_probe_and_attach() is called very early, after parsing the boot
+ *params and after physical memory has been located and sized.
+ *
+ *  - platform_devmap_init() is called as one of the last steps of early 
virtual
+ *memory initialization, shortly before the new page tables are installed.
+ *
+ *  - platform_lastaddr() is called after platform_devmap_init(), and must 
return
+ *the address of the first byte of unusable KVA space.  This allows a
+ *platform to carve out of the top of the KVA space whatever reserves it
+ *needs for things like static device mapping, and this is called to get 
the
+ *value before calling pmap_bootstrap() which uses the value to size the
+ *available KVA.
+ *
+ *  - platform_gpio_init() is called after the static device mappings are
+ *established and just before cninit().  The intention is that the routine
+ *can do any hardware setup (such as gpio or pinmux) necessary to make the
+ *console functional.
+ *
+ *  - platform_late_init() is called just after cninit().  This is the first of
+ *the init routines that can use printf() and expect the output to appear 
on
+ *a standard console.
+ *
+ */
 void platform_probe_and_attach(void);
 int platform_devmap_init(void);
 vm_offset_t platform_lastaddr(void);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270080 - head/sys/arm/at91

2014-08-16 Thread Ian Lepore
Author: ian
Date: Sun Aug 17 02:53:36 2014
New Revision: 270080
URL: http://svnweb.freebsd.org/changeset/base/270080

Log:
  Rename the old initarm_* functions to the new platform_* names.  Also
  move the registration of the static device map table into the function
  intended to do devmap init stuff.

Modified:
  head/sys/arm/at91/at91_common.c

Modified: head/sys/arm/at91/at91_common.c
==
--- head/sys/arm/at91/at91_common.c Sun Aug 17 02:40:44 2014
(r270079)
+++ head/sys/arm/at91/at91_common.c Sun Aug 17 02:53:36 2014
(r270080)
@@ -7,6 +7,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include  
 #include 
 #include 
 #include 
@@ -55,36 +56,37 @@ at91_eoi(void *unused)
 
 
 vm_offset_t
-initarm_lastaddr(void)
+platform_lastaddr(void)
 {
 
return (arm_devmap_lastaddr());
 }
 
 void
-initarm_early_init(void)
+platform_probe_and_attach(void)
 {
 
arm_post_filter = at91_eoi;
at91_soc_id();
-   arm_devmap_register_table(at91_devmap);
 }
 
 int
-initarm_devmap_init(void)
+platform_devmap_init(void)
 {
 
 // arm_devmap_add_entry(0xfff0, 0x0010); /* 1MB - uart, aic and 
timers*/
 
+   arm_devmap_register_table(at91_devmap);
+
return (0);
 }
 
 void
-initarm_gpio_init(void)
+platform_gpio_init(void)
 {
 }
 
 void
-initarm_late_init(void)
+platform_late_init(void)
 {
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270079 - stable/10

2014-08-16 Thread Ian Lepore
Author: ian
Date: Sun Aug 17 02:40:44 2014
New Revision: 270079
URL: http://svnweb.freebsd.org/changeset/base/270079

Log:
  MFC r269688: m4 now requires libohash, build it when bootstrapping.

Modified:
  stable/10/Makefile.inc1
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/Makefile.inc1
==
--- stable/10/Makefile.inc1 Sun Aug 17 01:59:54 2014(r270078)
+++ stable/10/Makefile.inc1 Sun Aug 17 02:40:44 2014(r270079)
@@ -1219,7 +1219,8 @@ _sed= usr.bin/sed
 .endif
 
 .if ${BOOTSTRAPPING} < 102
-_m4=   usr.bin/m4
+_m4=   lib/libohash \
+   usr.bin/m4
 .endif
 
 .if ${BOOTSTRAPPING} < 113
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270078 - stable/10/sys/dev/ofw

2014-08-16 Thread Ian Lepore
Author: ian
Date: Sun Aug 17 01:59:54 2014
New Revision: 270078
URL: http://svnweb.freebsd.org/changeset/base/270078

Log:
  MFC r269769, r269770:
  
Use a separate variable for resource id, because 'i' may increment at a
rate greater than 1 on each iteration.
  
Handle various ways that interrupt config data can be malformed by
warning and assuming more or less reasonable values.

Modified:
  stable/10/sys/dev/ofw/ofwbus.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/ofw/ofwbus.c
==
--- stable/10/sys/dev/ofw/ofwbus.c  Sun Aug 17 01:48:12 2014
(r270077)
+++ stable/10/sys/dev/ofw/ofwbus.c  Sun Aug 17 01:59:54 2014
(r270078)
@@ -435,10 +435,11 @@ ofwbus_setup_dinfo(device_t dev, phandle
 {
struct ofwbus_softc *sc;
struct ofwbus_devinfo *ndi;
+   const char *nodename;
uint32_t *reg, *intr, icells;
uint64_t phys, size;
phandle_t iparent;
-   int i, j;
+   int i, j, rid;
int nintr;
int nreg;
 
@@ -449,8 +450,8 @@ ofwbus_setup_dinfo(device_t dev, phandle
free(ndi, M_DEVBUF);
return (NULL);
}
-   if (OFWBUS_EXCLUDED(ndi->ndi_obdinfo.obd_name,
-   ndi->ndi_obdinfo.obd_type)) {
+   nodename = ndi->ndi_obdinfo.obd_name;
+   if (OFWBUS_EXCLUDED(nodename, ndi->ndi_obdinfo.obd_type)) {
ofw_bus_gen_destroy_devinfo(&ndi->ndi_obdinfo);
free(ndi, M_DEVBUF);
return (NULL);
@@ -463,11 +464,11 @@ ofwbus_setup_dinfo(device_t dev, phandle
if (nreg % (sc->acells + sc->scells) != 0) {
if (bootverbose)
device_printf(dev, "Malformed reg property on <%s>\n",
-   ndi->ndi_obdinfo.obd_name);
+   nodename);
nreg = 0;
}
 
-   for (i = 0; i < nreg; i += sc->acells + sc->scells) {
+   for (i = 0, rid = 0; i < nreg; i += sc->acells + sc->scells, rid++) {
phys = size = 0;
for (j = 0; j < sc->acells; j++) {
phys <<= 32;
@@ -479,7 +480,7 @@ ofwbus_setup_dinfo(device_t dev, phandle
}
/* Skip the dummy reg property of glue devices like ssm(4). */
if (size != 0)
-   resource_list_add(&ndi->ndi_rl, SYS_RES_MEMORY, i,
+   resource_list_add(&ndi->ndi_rl, SYS_RES_MEMORY, rid,
phys, phys + size - 1, size);
}
free(reg, M_OFWPROP);
@@ -487,15 +488,28 @@ ofwbus_setup_dinfo(device_t dev, phandle
nintr = OF_getencprop_alloc(node, "interrupts",  sizeof(*intr),
(void **)&intr);
if (nintr > 0) {
-   iparent = 0;
-   OF_searchencprop(node, "interrupt-parent", &iparent,
-   sizeof(iparent));
-   OF_searchencprop(OF_xref_phandle(iparent), "#interrupt-cells",
-   &icells, sizeof(icells));
-   for (i = 0; i < nintr; i+= icells) {
+   if (OF_searchencprop(node, "interrupt-parent", &iparent,
+   sizeof(iparent)) == -1) {
+   device_printf(dev, "No interrupt-parent found, "
+   "assuming nexus on <%s>\n", nodename);
+   iparent = 0x;
+   }
+   if (OF_searchencprop(OF_xref_phandle(iparent), 
+   "#interrupt-cells", &icells, sizeof(icells)) == -1) {
+   device_printf(dev, "Missing #interrupt-cells property, "
+   "assuming <1> on <%s>\n", nodename);
+   icells = 1;
+   }
+   if (icells < 1 || icells > nintr) {
+   device_printf(dev, "Invalid #interrupt-cells property "
+   "value <%d>, assuming <1> on <%s>\n", icells, 
+   nodename);
+   icells = 1;
+   }
+   for (i = 0, rid = 0; i < nintr; i += icells, rid++) {
intr[i] = ofw_bus_map_intr(dev, iparent, icells,
&intr[i]);
-   resource_list_add(&ndi->ndi_rl, SYS_RES_IRQ, i, intr[i],
+   resource_list_add(&ndi->ndi_rl, SYS_RES_IRQ, rid, 
intr[i],
intr[i], 1);
}
free(intr, M_OFWPROP);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270077 - stable/10/sys/arm/arm

2014-08-16 Thread Ian Lepore
Author: ian
Date: Sun Aug 17 01:48:12 2014
New Revision: 270077
URL: http://svnweb.freebsd.org/changeset/base/270077

Log:
  MFC r269646: Use a SYSINIT to init the array of interrupt names on arm.

Modified:
  stable/10/sys/arm/arm/intr.c
  stable/10/sys/arm/arm/machdep.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/arm/arm/intr.c
==
--- stable/10/sys/arm/arm/intr.cSun Aug 17 01:32:33 2014
(r270076)
+++ stable/10/sys/arm/arm/intr.cSun Aug 17 01:48:12 2014
(r270077)
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -75,8 +76,8 @@ size_t sintrnames = sizeof(intrnames);
  * assumptions of vmstat(8) and the kdb "show intrcnt" command, the two
  * consumers of this data.
  */
-void
-arm_intrnames_init(void)
+static void
+intr_init(void *unused)
 {
int i;
 
@@ -86,6 +87,8 @@ arm_intrnames_init(void)
}
 }
 
+SYSINIT(intr_init, SI_SUB_INTR, SI_ORDER_FIRST, intr_init, NULL);
+
 void
 arm_setup_irqhandler(const char *name, driver_filter_t *filt,
 void (*hand)(void*), void *arg, int irq, int flags, void **cookiep)

Modified: stable/10/sys/arm/arm/machdep.c
==
--- stable/10/sys/arm/arm/machdep.c Sun Aug 17 01:32:33 2014
(r270076)
+++ stable/10/sys/arm/arm/machdep.c Sun Aug 17 01:48:12 2014
(r270077)
@@ -1277,7 +1277,6 @@ initarm(struct arm_boot_params *abp)
 
init_proc0(kernelstack.pv_va);
 
-   arm_intrnames_init();
arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);
pmap_bootstrap(freemempos, &kernel_l1pt);
msgbufp = (void *)msgbufpv.pv_va;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270076 - stable/10/sys/arm/freescale/imx

2014-08-16 Thread Ian Lepore
Author: ian
Date: Sun Aug 17 01:32:33 2014
New Revision: 270076
URL: http://svnweb.freebsd.org/changeset/base/270076

Log:
  MFC r269607, r269698:
  
Cache the imx6 SoC type in a static var so that it only has to be figured
out by sniffing hardware registers once.
  
Add a missing clock register definition.

Modified:
  stable/10/sys/arm/freescale/imx/imx6_ccmreg.h
  stable/10/sys/arm/freescale/imx/imx6_machdep.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/arm/freescale/imx/imx6_ccmreg.h
==
--- stable/10/sys/arm/freescale/imx/imx6_ccmreg.h   Sun Aug 17 01:28:03 
2014(r270075)
+++ stable/10/sys/arm/freescale/imx/imx6_ccmreg.h   Sun Aug 17 01:32:33 
2014(r270076)
@@ -36,6 +36,7 @@
 #define  CCM_CLPCR_LPM_STOP  0x02
 #defineCCM_CGPR0x064
 #define  CCM_CGPR_INT_MEM_CLK_LPM(1 << 17)
+#defineCCM_CCGR0   0x068
 #defineCCM_CCGR1   0x06C
 #defineCCM_CCGR2   0x070
 #defineCCM_CCGR3   0x074

Modified: stable/10/sys/arm/freescale/imx/imx6_machdep.c
==
--- stable/10/sys/arm/freescale/imx/imx6_machdep.c  Sun Aug 17 01:28:03 
2014(r270075)
+++ stable/10/sys/arm/freescale/imx/imx6_machdep.c  Sun Aug 17 01:32:33 
2014(r270076)
@@ -145,12 +145,16 @@ u_int imx_soc_type()
 {
uint32_t digprog, hwsoc;
uint32_t *pcr;
+   static u_int soctype;
const vm_offset_t SCU_CONFIG_PHYSADDR = 0x00a4;
 #defineHWSOC_MX6SL 0x60
 #defineHWSOC_MX6DL 0x61
 #defineHWSOC_MX6SOLO   0x62
 #defineHWSOC_MX6Q  0x63
 
+   if (soctype != 0)
+   return (soctype);
+
digprog = imx6_anatop_read_4(IMX6_ANALOG_DIGPROG_SL);
hwsoc = (digprog >> IMX6_ANALOG_DIGPROG_SOCTYPE_SHIFT) & 
IMX6_ANALOG_DIGPROG_SOCTYPE_MASK;
@@ -174,20 +178,25 @@ u_int imx_soc_type()
 
switch (hwsoc) {
case HWSOC_MX6SL:
-   return (IMXSOC_6SL);
+   soctype = IMXSOC_6SL;
+   break;
case HWSOC_MX6SOLO:
-   return (IMXSOC_6S);
+   soctype = IMXSOC_6S;
+   break;
case HWSOC_MX6DL:
-   return (IMXSOC_6DL);
+   soctype = IMXSOC_6DL;
+   break;
case HWSOC_MX6Q :
-   return (IMXSOC_6Q);
+   soctype = IMXSOC_6Q;
+   break;
default:
printf("imx_soc_type: Don't understand hwsoc 0x%02x, "
"digprog 0x%08x; assuming IMXSOC_6Q\n", hwsoc, digprog);
+   soctype = IMXSOC_6Q;
break;
}
 
-   return (IMXSOC_6Q);
+   return (soctype);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270075 - in stable/10/sys: arm/arm arm/include conf dev/fdt dev/ofw sys

2014-08-16 Thread Ian Lepore
Author: ian
Date: Sun Aug 17 01:28:03 2014
New Revision: 270075
URL: http://svnweb.freebsd.org/changeset/base/270075

Log:
  MFC r269594, r269596, r269597, r269598, r269605, r269606:
  
Set ofwbus and simplebus to attach during BUS_PASS_BUS.
  
Define names that drivers can use to adjust their position relative to
other drivers within a BUS_PASS
  
Adjust ofwbus and simplebus to attach at BUS_PASS_ORDER_MIDDLE, so that
a platform can attach some other bus first if necessary.
  
Set the pl310 L2 cache driver to attach during the middle of BUS_PASS_CPU.
  
Attach arm generic interrupt and timer drivers in the middle of
BUS_PASS_INTERRUPT and BUS_PASS_TIMER, respectively.
  
Add an arm option, ARM_DEVICE_MULTIPASS, used to opt-in to multi-pass
device attachment on arm platforms.  If this is defined, nexus attaches
early in BUS_PASS_BUS, and other busses and devices attach later, in the
pass number they are set up for.  Without it defined, nexus attaches in
BUS_PASS_DEFAULT and thus so does everything else, which is status quo.

Modified:
  stable/10/sys/arm/arm/generic_timer.c
  stable/10/sys/arm/arm/gic.c
  stable/10/sys/arm/arm/mpcore_timer.c
  stable/10/sys/arm/arm/nexus.c
  stable/10/sys/arm/arm/pl190.c
  stable/10/sys/arm/arm/pl310.c
  stable/10/sys/arm/include/pl310.h
  stable/10/sys/conf/options.arm
  stable/10/sys/dev/fdt/simplebus.c
  stable/10/sys/dev/ofw/ofwbus.c
  stable/10/sys/sys/bus.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/arm/arm/generic_timer.c
==
--- stable/10/sys/arm/arm/generic_timer.c   Sun Aug 17 01:23:52 2014
(r270074)
+++ stable/10/sys/arm/arm/generic_timer.c   Sun Aug 17 01:28:03 2014
(r270075)
@@ -343,7 +343,8 @@ static driver_t arm_tmr_driver = {
 
 static devclass_t arm_tmr_devclass;
 
-DRIVER_MODULE(timer, simplebus, arm_tmr_driver, arm_tmr_devclass, 0, 0);
+EARLY_DRIVER_MODULE(timer, simplebus, arm_tmr_driver, arm_tmr_devclass, 0, 0,
+BUS_PASS_TIMER + BUS_PASS_ORDER_MIDDLE);
 
 void
 DELAY(int usec)

Modified: stable/10/sys/arm/arm/gic.c
==
--- stable/10/sys/arm/arm/gic.c Sun Aug 17 01:23:52 2014(r270074)
+++ stable/10/sys/arm/arm/gic.c Sun Aug 17 01:28:03 2014(r270075)
@@ -263,7 +263,8 @@ static driver_t arm_gic_driver = {
 
 static devclass_t arm_gic_devclass;
 
-DRIVER_MODULE(gic, simplebus, arm_gic_driver, arm_gic_devclass, 0, 0);
+EARLY_DRIVER_MODULE(gic, simplebus, arm_gic_driver, arm_gic_devclass, 0, 0,
+BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE);
 
 static void
 gic_post_filter(void *arg)

Modified: stable/10/sys/arm/arm/mpcore_timer.c
==
--- stable/10/sys/arm/arm/mpcore_timer.cSun Aug 17 01:23:52 2014
(r270074)
+++ stable/10/sys/arm/arm/mpcore_timer.cSun Aug 17 01:28:03 2014
(r270075)
@@ -382,7 +382,8 @@ static driver_t arm_tmr_driver = {
 
 static devclass_t arm_tmr_devclass;
 
-DRIVER_MODULE(mp_tmr, simplebus, arm_tmr_driver, arm_tmr_devclass, 0, 0);
+EARLY_DRIVER_MODULE(mp_tmr, simplebus, arm_tmr_driver, arm_tmr_devclass, 0, 0,
+BUS_PASS_TIMER + BUS_PASS_ORDER_MIDDLE);
 
 /*
  * Handle a change in clock frequency.  The mpcore timer runs at half the CPU

Modified: stable/10/sys/arm/arm/nexus.c
==
--- stable/10/sys/arm/arm/nexus.c   Sun Aug 17 01:23:52 2014
(r270074)
+++ stable/10/sys/arm/arm/nexus.c   Sun Aug 17 01:28:03 2014
(r270075)
@@ -125,7 +125,12 @@ static driver_t nexus_driver = {
nexus_methods,
1   /* no softc */
 };
+#ifdef ARM_DEVICE_MULTIPASS
+EARLY_DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0, 
+BUS_PASS_BUS + BUS_PASS_ORDER_EARLY);
+#else
 DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0);
+#endif
 
 static int
 nexus_probe(device_t dev)

Modified: stable/10/sys/arm/arm/pl190.c
==
--- stable/10/sys/arm/arm/pl190.c   Sun Aug 17 01:23:52 2014
(r270074)
+++ stable/10/sys/arm/arm/pl190.c   Sun Aug 17 01:28:03 2014
(r270075)
@@ -152,7 +152,8 @@ static driver_t pl190_intc_driver = {
 
 static devclass_t pl190_intc_devclass;
 
-DRIVER_MODULE(intc, simplebus, pl190_intc_driver, pl190_intc_devclass, 0, 0);
+EARLY_DRIVER_MODULE(intc, simplebus, pl190_intc_driver, pl190_intc_devclass, 
+0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE);
 
 int
 arm_get_next_irq(int last_irq)

Modified: stable/10/sys/arm/arm/pl310.c
==
--- stable/10/sys/arm/arm/pl310.c   Sun Aug 17 01:23:52 2014
(r270074)
+++ stable/10/sys/arm/arm/p

svn commit: r270074 - in stable/10: lib/libvmmapi sys/amd64/include sys/amd64/vmm sys/amd64/vmm/intel usr.sbin/bhyve usr.sbin/bhyveload

2014-08-16 Thread Peter Grehan
Author: grehan
Date: Sun Aug 17 01:23:52 2014
New Revision: 270074
URL: http://svnweb.freebsd.org/changeset/base/270074

Log:
  MFC r267311, r267330, r267811, r267884
  
  Turn on interrupt window exiting unconditionally when an ExtINT is being
  injected into the guest.
  
  Add helper functions to populate VM exit information for rendezvous and
  astpending exits.
  
  Provide APIs to directly get 'lowmem' and 'highmem' size directly.
  
  Expose the amount of resident and wired memory from the guest's vmspace

Modified:
  stable/10/lib/libvmmapi/vmmapi.c
  stable/10/lib/libvmmapi/vmmapi.h
  stable/10/sys/amd64/include/vmm.h
  stable/10/sys/amd64/vmm/intel/vmx.c
  stable/10/sys/amd64/vmm/vmm.c
  stable/10/sys/amd64/vmm/vmm_stat.c
  stable/10/sys/amd64/vmm/vmm_stat.h
  stable/10/usr.sbin/bhyve/pci_emul.c
  stable/10/usr.sbin/bhyve/rtc.c
  stable/10/usr.sbin/bhyve/smbiostbl.c
  stable/10/usr.sbin/bhyveload/bhyveload.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libvmmapi/vmmapi.c
==
--- stable/10/lib/libvmmapi/vmmapi.cSun Aug 17 01:16:40 2014
(r270073)
+++ stable/10/lib/libvmmapi/vmmapi.cSun Aug 17 01:23:52 2014
(r270074)
@@ -274,6 +274,20 @@ vm_map_gpa(struct vmctx *ctx, vm_paddr_t
return (NULL);
 }
 
+size_t
+vm_get_lowmem_size(struct vmctx *ctx)
+{
+
+   return (ctx->lowmem);
+}
+
+size_t
+vm_get_highmem_size(struct vmctx *ctx)
+{
+
+   return (ctx->highmem);
+}
+
 int
 vm_set_desc(struct vmctx *ctx, int vcpu, int reg,
uint64_t base, uint32_t limit, uint32_t access)

Modified: stable/10/lib/libvmmapi/vmmapi.h
==
--- stable/10/lib/libvmmapi/vmmapi.hSun Aug 17 01:16:40 2014
(r270073)
+++ stable/10/lib/libvmmapi/vmmapi.hSun Aug 17 01:23:52 2014
(r270074)
@@ -60,6 +60,8 @@ int   vm_get_gpa_pmap(struct vmctx *, uint
 uint32_t vm_get_lowmem_limit(struct vmctx *ctx);
 void   vm_set_lowmem_limit(struct vmctx *ctx, uint32_t limit);
 void   vm_set_memflags(struct vmctx *ctx, int flags);
+size_t vm_get_lowmem_size(struct vmctx *ctx);
+size_t vm_get_highmem_size(struct vmctx *ctx);
 intvm_set_desc(struct vmctx *ctx, int vcpu, int reg,
uint64_t base, uint32_t limit, uint32_t access);
 intvm_get_desc(struct vmctx *ctx, int vcpu, int reg,

Modified: stable/10/sys/amd64/include/vmm.h
==
--- stable/10/sys/amd64/include/vmm.h   Sun Aug 17 01:16:40 2014
(r270073)
+++ stable/10/sys/amd64/include/vmm.h   Sun Aug 17 01:23:52 2014
(r270074)
@@ -146,6 +146,8 @@ cpuset_t vm_active_cpus(struct vm *vm);
 cpuset_t vm_suspended_cpus(struct vm *vm);
 struct vm_exit *vm_exitinfo(struct vm *vm, int vcpuid);
 void vm_exit_suspended(struct vm *vm, int vcpuid, uint64_t rip);
+void vm_exit_rendezvous(struct vm *vm, int vcpuid, uint64_t rip);
+void vm_exit_astpending(struct vm *vm, int vcpuid, uint64_t rip);
 
 /*
  * Rendezvous all vcpus specified in 'dest' and execute 'func(arg)'.

Modified: stable/10/sys/amd64/vmm/intel/vmx.c
==
--- stable/10/sys/amd64/vmm/intel/vmx.c Sun Aug 17 01:16:40 2014
(r270073)
+++ stable/10/sys/amd64/vmm/intel/vmx.c Sun Aug 17 01:23:52 2014
(r270074)
@@ -1327,9 +1327,13 @@ vmx_inject_interrupts(struct vmx *vmx, i
 * have posted another one.  If that is the case, set
 * the Interrupt Window Exiting execution control so
 * we can inject that one too.
+*
+* Also, interrupt window exiting allows us to inject any
+* pending APIC vector that was preempted by the ExtINT
+* as soon as possible. This applies both for the software
+* emulated vlapic and the hardware assisted virtual APIC.
 */
-   if (vm_extint_pending(vmx->vm, vcpu))
-   vmx_set_int_window_exiting(vmx, vcpu);
+   vmx_set_int_window_exiting(vmx, vcpu);
}
 
VCPU_CTR1(vmx->vm, vcpu, "Injecting hwintr at vector %d", vector);
@@ -2275,32 +2279,7 @@ vmx_exit_process(struct vmx *vmx, int vc
return (handled);
 }
 
-static __inline int
-vmx_exit_astpending(struct vmx *vmx, int vcpu, struct vm_exit *vmexit)
-{
-
-   vmexit->rip = vmcs_guest_rip();
-   vmexit->inst_length = 0;
-   vmexit->exitcode = VM_EXITCODE_BOGUS;
-   vmx_astpending_trace(vmx, vcpu, vmexit->rip);
-   vmm_stat_incr(vmx->vm, vcpu, VMEXIT_ASTPENDING, 1);
-
-   return (HANDLED);
-}
-
-static __inline int
-vmx_exit_rendezvous(struct vmx *vmx, int vcpu, struct vm_exit *vmexit)
-{
-
-   vmexit->rip = vmcs_guest_rip();
-   vmexit->inst_length = 0;
-   vmexit->exitcode = VM_EXITCODE_RENDEZVOUS;

svn commit: r270073 - in stable/10/sys/amd64/vmm: intel io

2014-08-16 Thread Peter Grehan
Author: grehan
Date: Sun Aug 17 01:16:40 2014
New Revision: 270073
URL: http://svnweb.freebsd.org/changeset/base/270073

Log:
  MFC r267178, r267300
  
  Support guest accesses to %cr8
  
  Add reserved bit checking when doing %CR8 emulation and inject #GP if 
required.

Modified:
  stable/10/sys/amd64/vmm/intel/vmx.c
  stable/10/sys/amd64/vmm/io/vlapic.c
  stable/10/sys/amd64/vmm/io/vlapic.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/vmm/intel/vmx.c
==
--- stable/10/sys/amd64/vmm/intel/vmx.c Sun Aug 17 01:15:34 2014
(r270072)
+++ stable/10/sys/amd64/vmm/intel/vmx.c Sun Aug 17 01:16:40 2014
(r270073)
@@ -83,7 +83,9 @@ __FBSDID("$FreeBSD$");
(PROCBASED_SECONDARY_CONTROLS   |   \
 PROCBASED_IO_EXITING   |   \
 PROCBASED_MSR_BITMAPS  |   \
-PROCBASED_CTLS_WINDOW_SETTING)
+PROCBASED_CTLS_WINDOW_SETTING  |   \
+PROCBASED_CR8_LOAD_EXITING |   \
+PROCBASED_CR8_STORE_EXITING)
 #definePROCBASED_CTLS_ZERO_SETTING \
(PROCBASED_CR3_LOAD_EXITING |   \
PROCBASED_CR3_STORE_EXITING |   \
@@ -714,6 +716,13 @@ vmx_init(int ipinum)
procbased_ctls2 &= ~PROCBASED2_VIRTUALIZE_X2APIC_MODE;
 
/*
+* No need to emulate accesses to %CR8 if virtual
+* interrupt delivery is enabled.
+*/
+   procbased_ctls &= ~PROCBASED_CR8_LOAD_EXITING;
+   procbased_ctls &= ~PROCBASED_CR8_STORE_EXITING;
+
+   /*
 * Check for Posted Interrupts only if Virtual Interrupt
 * Delivery is enabled.
 */
@@ -1442,97 +1451,130 @@ vmx_emulate_xsetbv(struct vmx *vmx, int 
return (HANDLED);
 }
 
-static int
-vmx_emulate_cr_access(struct vmx *vmx, int vcpu, uint64_t exitqual)
+static uint64_t
+vmx_get_guest_reg(struct vmx *vmx, int vcpu, int ident)
 {
-   int cr, vmcs_guest_cr, vmcs_shadow_cr;
-   uint64_t crval, regval, ones_mask, zeros_mask;
const struct vmxctx *vmxctx;
 
-   /* We only handle mov to %cr0 or %cr4 at this time */
-   if ((exitqual & 0xf0) != 0x00)
-   return (UNHANDLED);
+   vmxctx = &vmx->ctx[vcpu];
 
-   cr = exitqual & 0xf;
-   if (cr != 0 && cr != 4)
-   return (UNHANDLED);
+   switch (ident) {
+   case 0:
+   return (vmxctx->guest_rax);
+   case 1:
+   return (vmxctx->guest_rcx);
+   case 2:
+   return (vmxctx->guest_rdx);
+   case 3:
+   return (vmxctx->guest_rbx);
+   case 4:
+   return (vmcs_read(VMCS_GUEST_RSP));
+   case 5:
+   return (vmxctx->guest_rbp);
+   case 6:
+   return (vmxctx->guest_rsi);
+   case 7:
+   return (vmxctx->guest_rdi);
+   case 8:
+   return (vmxctx->guest_r8);
+   case 9:
+   return (vmxctx->guest_r9);
+   case 10:
+   return (vmxctx->guest_r10);
+   case 11:
+   return (vmxctx->guest_r11);
+   case 12:
+   return (vmxctx->guest_r12);
+   case 13:
+   return (vmxctx->guest_r13);
+   case 14:
+   return (vmxctx->guest_r14);
+   case 15:
+   return (vmxctx->guest_r15);
+   default:
+   panic("invalid vmx register %d", ident);
+   }
+}
+
+static void
+vmx_set_guest_reg(struct vmx *vmx, int vcpu, int ident, uint64_t regval)
+{
+   struct vmxctx *vmxctx;
 
-   regval = 0; /* silence gcc */
vmxctx = &vmx->ctx[vcpu];
 
-   /*
-* We must use vmcs_write() directly here because vmcs_setreg() will
-* call vmclear(vmcs) as a side-effect which we certainly don't want.
-*/
-   switch ((exitqual >> 8) & 0xf) {
+   switch (ident) {
case 0:
-   regval = vmxctx->guest_rax;
+   vmxctx->guest_rax = regval;
break;
case 1:
-   regval = vmxctx->guest_rcx;
+   vmxctx->guest_rcx = regval;
break;
case 2:
-   regval = vmxctx->guest_rdx;
+   vmxctx->guest_rdx = regval;
break;
case 3:
-   regval = vmxctx->guest_rbx;
+   vmxctx->guest_rbx = regval;
break;
case 4:
-   regval = vmcs_read(VMCS_GUEST_RSP);
+   vmcs_write(VMCS_GUEST_RSP, regval);
break;
case 5:
-   regval = vmxctx->guest_rbp;
+   vmxctx->guest_rbp = regval;
break;
case 6:
-   regval = vmxctx->guest_rsi;
+   vmxctx->guest_rsi = regval;
 

svn commit: r270072 - stable/10/contrib/llvm/tools/clang/lib/Driver

2014-08-16 Thread Ian Lepore
Author: ian
Date: Sun Aug 17 01:15:34 2014
New Revision: 270072
URL: http://svnweb.freebsd.org/changeset/base/270072

Log:
  MFC r269387: Update the ARMv6 core clang targets to be an arm1176jzf-s.

Modified:
  stable/10/contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp
  stable/10/contrib/llvm/tools/clang/lib/Driver/Tools.cpp
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp
==
--- stable/10/contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp Sun Aug 17 
01:00:42 2014(r270071)
+++ stable/10/contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp Sun Aug 17 
01:15:34 2014(r270072)
@@ -183,7 +183,8 @@ static const char *getARMTargetCPU(const
 MArch = Triple.getArchName();
   }
 
-  if (Triple.getOS() == llvm::Triple::NetBSD) {
+  if (Triple.getOS() == llvm::Triple::NetBSD ||
+  Triple.getOS() == llvm::Triple::FreeBSD) {
 if (MArch == "armv6")
   return "arm1176jzf-s";
   }

Modified: stable/10/contrib/llvm/tools/clang/lib/Driver/Tools.cpp
==
--- stable/10/contrib/llvm/tools/clang/lib/Driver/Tools.cpp Sun Aug 17 
01:00:42 2014(r270071)
+++ stable/10/contrib/llvm/tools/clang/lib/Driver/Tools.cpp Sun Aug 17 
01:15:34 2014(r270072)
@@ -499,7 +499,8 @@ static std::string getARMTargetCPU(const
 MArch = Triple.getArchName();
   }
 
-  if (Triple.getOS() == llvm::Triple::NetBSD) {
+  if (Triple.getOS() == llvm::Triple::NetBSD ||
+  Triple.getOS() == llvm::Triple::FreeBSD) {
 if (MArch == "armv6")
   return "arm1176jzf-s";
   }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270071 - in stable/10: lib/libvmmapi sys/amd64/include sys/amd64/vmm usr.sbin/bhyveload

2014-08-16 Thread Peter Grehan
Author: grehan
Date: Sun Aug 17 01:00:42 2014
New Revision: 270071
URL: http://svnweb.freebsd.org/changeset/base/270071

Log:
  MFC r267216
  Add ioctl(VM_REINIT) to reinitialize the virtual machine state maintained
  by vmm.ko. This allows the virtual machine to be restarted without having
  to destroy it first.

Modified:
  stable/10/lib/libvmmapi/vmmapi.c
  stable/10/lib/libvmmapi/vmmapi.h
  stable/10/sys/amd64/include/vmm.h
  stable/10/sys/amd64/include/vmm_dev.h
  stable/10/sys/amd64/vmm/vmm.c
  stable/10/sys/amd64/vmm/vmm_dev.c
  stable/10/sys/amd64/vmm/vmm_stat.c
  stable/10/sys/amd64/vmm/vmm_stat.h
  stable/10/usr.sbin/bhyveload/bhyveload.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libvmmapi/vmmapi.c
==
--- stable/10/lib/libvmmapi/vmmapi.cSun Aug 17 00:52:07 2014
(r270070)
+++ stable/10/lib/libvmmapi/vmmapi.cSun Aug 17 01:00:42 2014
(r270071)
@@ -367,6 +367,13 @@ vm_suspend(struct vmctx *ctx, enum vm_su
return (ioctl(ctx->fd, VM_SUSPEND, &vmsuspend));
 }
 
+int
+vm_reinit(struct vmctx *ctx)
+{
+
+   return (ioctl(ctx->fd, VM_REINIT, 0));
+}
+
 static int
 vm_inject_exception_real(struct vmctx *ctx, int vcpu, int vector,
 int error_code, int error_code_valid)

Modified: stable/10/lib/libvmmapi/vmmapi.h
==
--- stable/10/lib/libvmmapi/vmmapi.hSun Aug 17 00:52:07 2014
(r270070)
+++ stable/10/lib/libvmmapi/vmmapi.hSun Aug 17 01:00:42 2014
(r270071)
@@ -69,6 +69,7 @@ int   vm_get_register(struct vmctx *ctx, i
 intvm_run(struct vmctx *ctx, int vcpu, uint64_t rip,
   struct vm_exit *ret_vmexit);
 intvm_suspend(struct vmctx *ctx, enum vm_suspend_how how);
+intvm_reinit(struct vmctx *ctx);
 intvm_apicid2vcpu(struct vmctx *ctx, int apicid);
 intvm_inject_exception(struct vmctx *ctx, int vcpu, int vec);
 intvm_inject_exception2(struct vmctx *ctx, int vcpu, int vec, int errcode);

Modified: stable/10/sys/amd64/include/vmm.h
==
--- stable/10/sys/amd64/include/vmm.h   Sun Aug 17 00:52:07 2014
(r270070)
+++ stable/10/sys/amd64/include/vmm.h   Sun Aug 17 01:00:42 2014
(r270071)
@@ -105,6 +105,7 @@ extern struct vmm_ops vmm_ops_amd;
 
 int vm_create(const char *name, struct vm **retvm);
 void vm_destroy(struct vm *vm);
+int vm_reinit(struct vm *vm);
 const char *vm_name(struct vm *vm);
 int vm_malloc(struct vm *vm, vm_paddr_t gpa, size_t len);
 int vm_map_mmio(struct vm *vm, vm_paddr_t gpa, size_t len, vm_paddr_t hpa);

Modified: stable/10/sys/amd64/include/vmm_dev.h
==
--- stable/10/sys/amd64/include/vmm_dev.h   Sun Aug 17 00:52:07 2014
(r270070)
+++ stable/10/sys/amd64/include/vmm_dev.h   Sun Aug 17 01:00:42 2014
(r270071)
@@ -196,6 +196,7 @@ enum {
IOCNUM_SET_CAPABILITY = 2,
IOCNUM_GET_CAPABILITY = 3,
IOCNUM_SUSPEND = 4,
+   IOCNUM_REINIT = 5,
 
/* memory apis */
IOCNUM_MAP_MEMORY = 10,
@@ -251,6 +252,8 @@ enum {
_IOWR('v', IOCNUM_RUN, struct vm_run)
 #defineVM_SUSPEND  \
_IOW('v', IOCNUM_SUSPEND, struct vm_suspend)
+#defineVM_REINIT   \
+   _IO('v', IOCNUM_REINIT)
 #defineVM_MAP_MEMORY   \
_IOWR('v', IOCNUM_MAP_MEMORY, struct vm_memory_segment)
 #defineVM_GET_MEMORY_SEG \

Modified: stable/10/sys/amd64/vmm/vmm.c
==
--- stable/10/sys/amd64/vmm/vmm.c   Sun Aug 17 00:52:07 2014
(r270070)
+++ stable/10/sys/amd64/vmm/vmm.c   Sun Aug 17 01:00:42 2014
(r270071)
@@ -84,25 +84,31 @@ __FBSDID("$FreeBSD$");
 
 struct vlapic;
 
+/*
+ * Initialization:
+ * (a) allocated when vcpu is created
+ * (i) initialized when vcpu is created and when it is reinitialized
+ * (o) initialized the first time the vcpu is created
+ * (x) initialized before use
+ */
 struct vcpu {
-   int flags;
-   enum vcpu_state state;
-   struct mtx  mtx;
-   int hostcpu;/* host cpuid this vcpu last ran on */
-   uint64_tguest_msrs[VMM_MSR_NUM];
-   struct vlapic   *vlapic;
-   int  vcpuid;
-   struct savefpu  *guestfpu;  /* guest fpu state */
-   uint64_tguest_xcr0;
-   void*stats;
-   struct vm_exit  exitinfo;
-   enum x2apic_state x2apic_state;
-   int nmi_pending;
-   int extint_pending;
-   struct vm_exception exception;
-   int exception_pending;
+   struct mtx  mtx;/* (o) protects 'state' and 'hostcpu' */
+   enum vcpu_state state;  /* (o) vcpu state */
+   

svn commit: r270070 - in stable/10: lib/libvmmapi sys/amd64/include sys/amd64/vmm sys/amd64/vmm/io usr.sbin/bhyve usr.sbin/bhyvectl

2014-08-16 Thread Peter Grehan
Author: grehan
Date: Sun Aug 17 00:52:07 2014
New Revision: 270070
URL: http://svnweb.freebsd.org/changeset/base/270070

Log:
  MFC r266933
  Activate vcpus from bhyve(8) using the ioctl VM_ACTIVATE_CPU instead of doing
  it implicitly in vmm.ko.

Modified:
  stable/10/lib/libvmmapi/vmmapi.c
  stable/10/lib/libvmmapi/vmmapi.h
  stable/10/sys/amd64/include/vmm.h
  stable/10/sys/amd64/include/vmm_dev.h
  stable/10/sys/amd64/vmm/io/vlapic.c
  stable/10/sys/amd64/vmm/vmm.c
  stable/10/sys/amd64/vmm/vmm_dev.c
  stable/10/usr.sbin/bhyve/bhyverun.c
  stable/10/usr.sbin/bhyve/pci_lpc.c
  stable/10/usr.sbin/bhyvectl/bhyvectl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libvmmapi/vmmapi.c
==
--- stable/10/lib/libvmmapi/vmmapi.cSat Aug 16 22:55:58 2014
(r270069)
+++ stable/10/lib/libvmmapi/vmmapi.cSun Aug 17 00:52:07 2014
(r270070)
@@ -29,11 +29,12 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1043,3 +1044,44 @@ vm_copyout(struct vmctx *ctx, int vcpu, 
len -= n;
}
 }
+
+static int
+vm_get_cpus(struct vmctx *ctx, int which, cpuset_t *cpus)
+{
+   struct vm_cpuset vm_cpuset;
+   int error;
+
+   bzero(&vm_cpuset, sizeof(struct vm_cpuset));
+   vm_cpuset.which = which;
+   vm_cpuset.cpusetsize = sizeof(cpuset_t);
+   vm_cpuset.cpus = cpus;
+
+   error = ioctl(ctx->fd, VM_GET_CPUS, &vm_cpuset);
+   return (error);
+}
+
+int
+vm_active_cpus(struct vmctx *ctx, cpuset_t *cpus)
+{
+
+   return (vm_get_cpus(ctx, VM_ACTIVE_CPUS, cpus));
+}
+
+int
+vm_suspended_cpus(struct vmctx *ctx, cpuset_t *cpus)
+{
+
+   return (vm_get_cpus(ctx, VM_SUSPENDED_CPUS, cpus));
+}
+
+int
+vm_activate_cpu(struct vmctx *ctx, int vcpu)
+{
+   struct vm_activate_cpu ac;
+   int error;
+
+   bzero(&ac, sizeof(struct vm_activate_cpu));
+   ac.vcpuid = vcpu;
+   error = ioctl(ctx->fd, VM_ACTIVATE_CPU, &ac);
+   return (error);
+}

Modified: stable/10/lib/libvmmapi/vmmapi.h
==
--- stable/10/lib/libvmmapi/vmmapi.hSat Aug 16 22:55:58 2014
(r270069)
+++ stable/10/lib/libvmmapi/vmmapi.hSun Aug 17 00:52:07 2014
(r270070)
@@ -29,6 +29,9 @@
 #ifndef _VMMAPI_H_
 #define_VMMAPI_H_
 
+#include 
+#include 
+
 struct iovec;
 struct vmctx;
 enum x2apic_state;
@@ -125,6 +128,10 @@ void   vm_copyout(struct vmctx *ctx, int v
 /* Reset vcpu register state */
 intvcpu_reset(struct vmctx *ctx, int vcpu);
 
+intvm_active_cpus(struct vmctx *ctx, cpuset_t *cpus);
+intvm_suspended_cpus(struct vmctx *ctx, cpuset_t *cpus);
+intvm_activate_cpu(struct vmctx *ctx, int vcpu);
+
 /*
  * FreeBSD specific APIs
  */

Modified: stable/10/sys/amd64/include/vmm.h
==
--- stable/10/sys/amd64/include/vmm.h   Sat Aug 16 22:55:58 2014
(r270069)
+++ stable/10/sys/amd64/include/vmm.h   Sun Aug 17 00:52:07 2014
(r270070)
@@ -140,8 +140,9 @@ int vm_set_capability(struct vm *vm, int
 int vm_get_x2apic_state(struct vm *vm, int vcpu, enum x2apic_state *state);
 int vm_set_x2apic_state(struct vm *vm, int vcpu, enum x2apic_state state);
 int vm_apicid2vcpuid(struct vm *vm, int apicid);
-void vm_activate_cpu(struct vm *vm, int vcpu);
+int vm_activate_cpu(struct vm *vm, int vcpu);
 cpuset_t vm_active_cpus(struct vm *vm);
+cpuset_t vm_suspended_cpus(struct vm *vm);
 struct vm_exit *vm_exitinfo(struct vm *vm, int vcpuid);
 void vm_exit_suspended(struct vm *vm, int vcpuid, uint64_t rip);
 

Modified: stable/10/sys/amd64/include/vmm_dev.h
==
--- stable/10/sys/amd64/include/vmm_dev.h   Sat Aug 16 22:55:58 2014
(r270069)
+++ stable/10/sys/amd64/include/vmm_dev.h   Sun Aug 17 00:52:07 2014
(r270070)
@@ -177,6 +177,18 @@ struct vm_gla2gpa {
uint64_tgpa;
 };
 
+struct vm_activate_cpu {
+   int vcpuid;
+};
+
+struct vm_cpuset {
+   int which;
+   int cpusetsize;
+   cpuset_t*cpus;
+};
+#defineVM_ACTIVE_CPUS  0
+#defineVM_SUSPENDED_CPUS   1
+
 enum {
/* general routines */
IOCNUM_ABIVERS = 0,
@@ -229,6 +241,10 @@ enum {
IOCNUM_ISA_DEASSERT_IRQ = 81,
IOCNUM_ISA_PULSE_IRQ = 82,
IOCNUM_ISA_SET_IRQ_TRIGGER = 83,
+
+   /* vm_cpuset */
+   IOCNUM_ACTIVATE_CPU = 90,
+   IOCNUM_GET_CPUSET = 91,
 };
 
 #defineVM_RUN  \
@@ -301,4 +317,8 @@ enum {
_IOWR('v', IOCNUM_GET_GPA_PMAP, struct vm_gpa_pte)
 #defineVM_GLA2GPA  \
_IOWR('v', IOCNUM_GLA2GPA, struct vm_gla2gpa)
+#defineVM_ACTIVATE_CPU \
+ 

svn commit: r270069 - head/sbin/ifconfig

2014-08-16 Thread Alexander V. Chernikov
Author: melifaro
Date: Sat Aug 16 22:55:58 2014
New Revision: 270069
URL: http://svnweb.freebsd.org/changeset/base/270069

Log:
  Clean up unused definitions.

Modified:
  head/sbin/ifconfig/sfp.c

Modified: head/sbin/ifconfig/sfp.c
==
--- head/sbin/ifconfig/sfp.cSat Aug 16 21:53:44 2014(r270068)
+++ head/sbin/ifconfig/sfp.cSat Aug 16 22:55:58 2014(r270069)
@@ -46,23 +46,6 @@ static const char rcsid[] =
 
 #include "ifconfig.h"
 
-/* Definitions from Table 3.1 */
-#define SFP_MSA_IDENTIFIER 0   /* Type of transceiver (T. 3.2), 1B */
-#defineSFP_MSA_CONNECTOR   2   /* Connector type (T. 3.3), 1B 
*/
-
-#defineSFP_MSA_TRANSCEIVER_CLASS   3   /* Ethernet/Sonet/IB 
code, 1B */
-
-#defineSFP_MSA_VENDOR_NAME 20  /* ASCII vendor name, 16B */
-#defineSFP_MSA_VENDOR_PN   40  /* ASCII vendor partnum, 16B */
-#defineSFP_MSA_VENDOR_SN   68  /* ASCII vendor serialnum, 16B 
*/
-#defineSFP_MSA_VENDOR_DATE 84  /* Vendor's date code, 8B */
-#defineSFP_MSA_DMONTYPE92  /* Type of disagnostic 
monitoring, 1B */
-
-/* Definitions from table 3.17 */
-#defineSFP_DDM_TEMP96  /* Module temperature, 2B */
-#defineSFP_DDM_TXPOWER 102 /* Measured TX output power, 2B 
*/
-#defineSFP_DDM_RXPOWER 104 /* Measured RX input power, 2B 
*/
-
 struct i2c_info;
 typedef int (read_i2c)(struct i2c_info *ii, uint8_t addr, uint8_t off,
 uint8_t len, caddr_t buf);
@@ -219,10 +202,9 @@ get_sfp_identifier(struct i2c_info *ii, 
ii->f(ii, SFF_8472_BASE, SFF_8472_ID, 1, (caddr_t)&data);
 
x = NULL;
-   if (data <= SFF_8472_ID_LAST) {
-   x = NULL;
-   //x = sff_8472_id[data];
-   } else {
+   if (data <= SFF_8472_ID_LAST)
+   x = sff_8472_id[data];
+   else {
if (data > 0x80)
x = "Vendor specific";
else
@@ -267,7 +249,7 @@ printf_sfp_transceiver_descr(struct i2c_
/* Read bytes 3-10 at once */
ii->f(ii, SFF_8472_BASE, SFF_8472_TRANS_START, 8, &xbuf[3]);
 
-   /* Check 10G first */
+   /* Check 10G ethernet first */
tech_class = find_zero_bit(eth_10g, xbuf[3], 1);
if (tech_class == NULL) {
/* No match. Try 1G */
@@ -400,6 +382,10 @@ get_sfp_temp(struct i2c_info *ii, char *
snprintf(buf, size, "%d.%d C", major, k / 100);
 }
 
+/*
+ * Converts value in @xbuf to both milliwats and dBm
+ * human representation.
+ */
 static void
 convert_power(struct i2c_info *ii, char *xbuf, char *buf, size_t size)
 {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270068 - in head: sbin/ifconfig sys/net

2014-08-16 Thread Alexander V. Chernikov
Author: melifaro
Date: Sat Aug 16 21:53:44 2014
New Revision: 270068
URL: http://svnweb.freebsd.org/changeset/base/270068

Log:
  * Use standard net/sff8472.h header for sff bits and offsets.
  * Convert sff_8472_id to 'const char *' to please clang.
  
  Pointed by:   np

Modified:
  head/sbin/ifconfig/sfp.c
  head/sys/net/sff8472.h

Modified: head/sbin/ifconfig/sfp.c
==
--- head/sbin/ifconfig/sfp.cSat Aug 16 21:42:55 2014(r270067)
+++ head/sbin/ifconfig/sfp.cSat Aug 16 21:53:44 2014(r270068)
@@ -34,6 +34,7 @@ static const char rcsid[] =
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -45,10 +46,6 @@ static const char rcsid[] =
 
 #include "ifconfig.h"
 
-/* 2wire addresses */
-#defineSFP_ADDR_MSA0xA0/* Identification data */
-#defineSFP_ADDR_DDM0xA2/* digital monitoring interface */
-
 /* Definitions from Table 3.1 */
 #define SFP_MSA_IDENTIFIER 0   /* Type of transceiver (T. 3.2), 1B */
 #defineSFP_MSA_CONNECTOR   2   /* Connector type (T. 3.3), 1B 
*/
@@ -88,25 +85,6 @@ struct _nv {
 const char *find_value(struct _nv *x, int value);
 const char *find_zero_bit(struct _nv *x, int value, int sz);
 
-
-/* SFF-8472 Rev. 11.4 table 3.2: Identifier values */
-static struct _nv ids[] = {
-   { 0x00, "Unknown" },
-   { 0x01, "GBIC" },
-   { 0x02, "SFF" },
-   { 0x03, "SFP/SFP+" },
-   { 0x04, "300 pin XBI" },
-   { 0x05, "Xenpak" },
-   { 0x06, "XFP" },
-   { 0x07, "XFF" },
-   { 0x08, "XFP-E" },
-   { 0x09, "XPak" },
-   { 0x0A, "X2" },
-   { 0x0B, "DWDM-SFP/DWDM-SFP+" },
-   { 0x0C, "QSFP" },
-   { 0, NULL, },
-};
-
 /* SFF-8472 Rev. 11.4 table 3.4: Connector values */
 static struct _nv conn[] = {
{ 0x00, "Unknown" },
@@ -128,72 +106,6 @@ static struct _nv conn[] = {
{ 0, NULL }
 };
 
-const char *
-find_value(struct _nv *x, int value)
-{
-   for (; x->n != NULL; x++)
-   if (x->v == value)
-   return (x->n);
-   return (NULL);
-}
-
-const char *
-find_zero_bit(struct _nv *x, int value, int sz)
-{
-   int v, m;
-   const char *s;
-
-   v = 1;
-   for (v = 1, m = 1 << (8 * sz); v < m; v *= 2) {
-   if ((value & v) == 0)
-   continue;
-   if ((s = find_value(x, value & v)) != NULL) {
-   value &= ~v;
-   return (s);
-   }
-   }
-
-   return (NULL);
-}
-
-static void
-get_sfp_identifier(struct i2c_info *ii, char *buf, size_t size)
-{
-   const char *x;
-   uint8_t data;
-
-   ii->f(ii, SFP_ADDR_MSA, SFP_MSA_IDENTIFIER, 1, (caddr_t)&data);
-
-   if ((x = find_value(ids, data)) == NULL) {
-   if (data > 0x80)
-   x = "Vendor specific";
-   else
-   x = "Reserved";
-   }
-
-   snprintf(buf, size, "%s", x);
-}
-
-static void
-get_sfp_connector(struct i2c_info *ii, char *buf, size_t size)
-{
-   const char *x;
-   uint8_t data;
-
-   ii->f(ii, SFP_ADDR_MSA, SFP_MSA_CONNECTOR, 1, (caddr_t)&data);
-
-   if ((x = find_value(conn, data)) == NULL) {
-   if (data >= 0x0D && data <= 0x1F)
-   x = "Unallocated";
-   else if (data >= 0x23 && data <= 0x7F)
-   x = "Unallocated";
-   else
-   x = "Vendor specific";
-   }
-
-   snprintf(buf, size, "%s", x);
-}
-
 /* SFF-8472 Rev. 11.4 table 3.5: Transceiver codes */
 /* 10G Ethernet compliance codes, byte 3 */
 static struct _nv eth_10g[] = {
@@ -270,6 +182,76 @@ static struct _nv fc_speed[] = {
{ 0, NULL }
 };
 
+const char *
+find_value(struct _nv *x, int value)
+{
+   for (; x->n != NULL; x++)
+   if (x->v == value)
+   return (x->n);
+   return (NULL);
+}
+
+const char *
+find_zero_bit(struct _nv *x, int value, int sz)
+{
+   int v, m;
+   const char *s;
+
+   v = 1;
+   for (v = 1, m = 1 << (8 * sz); v < m; v *= 2) {
+   if ((value & v) == 0)
+   continue;
+   if ((s = find_value(x, value & v)) != NULL) {
+   value &= ~v;
+   return (s);
+   }
+   }
+
+   return (NULL);
+}
+
+static void
+get_sfp_identifier(struct i2c_info *ii, char *buf, size_t size)
+{
+   const char *x;
+   uint8_t data;
+
+   ii->f(ii, SFF_8472_BASE, SFF_8472_ID, 1, (caddr_t)&data);
+
+   x = NULL;
+   if (data <= SFF_8472_ID_LAST) {
+   x = NULL;
+   //x = sff_8472_id[data];
+   } else {
+   if (data > 0x80)
+   x = "Vendor specific";
+   else
+   x = "Reserved";
+   }
+
+   snprintf(buf, size, "%s", x);
+}
+
+static voi

svn commit: r270067 - in head/sys: cddl/dev/fbt cddl/dev/fbt/powerpc cddl/dev/fbt/x86 modules/dtrace/fbt

2014-08-16 Thread Mark Johnston
Author: markj
Date: Sat Aug 16 21:42:55 2014
New Revision: 270067
URL: http://svnweb.freebsd.org/changeset/base/270067

Log:
  Factor out the common code for function boundary tracing instead of
  duplicating the entire implementation for both x86 and powerpc. This makes
  it easier to add support for other architectures and has no functional
  impact.
  
  Phabric:  D613
  Reviewed by:  gnn, jhibbits, rpaulo
  Tested by:jhibbits (powerpc)
  MFC after:2 weeks

Added:
  head/sys/cddl/dev/fbt/fbt.h   (contents, props changed)
  head/sys/cddl/dev/fbt/powerpc/
  head/sys/cddl/dev/fbt/powerpc/fbt_isa.c   (contents, props changed)
  head/sys/cddl/dev/fbt/powerpc/fbt_isa.h   (contents, props changed)
  head/sys/cddl/dev/fbt/x86/
  head/sys/cddl/dev/fbt/x86/fbt_isa.c   (contents, props changed)
  head/sys/cddl/dev/fbt/x86/fbt_isa.h   (contents, props changed)
Deleted:
  head/sys/cddl/dev/fbt/fbt_powerpc.c
Modified:
  head/sys/cddl/dev/fbt/fbt.c
  head/sys/modules/dtrace/fbt/Makefile

Modified: head/sys/cddl/dev/fbt/fbt.c
==
--- head/sys/cddl/dev/fbt/fbt.c Sat Aug 16 21:36:22 2014(r270066)
+++ head/sys/cddl/dev/fbt/fbt.c Sat Aug 16 21:42:55 2014(r270067)
@@ -61,25 +61,13 @@
 #include 
 #include 
 
-static MALLOC_DEFINE(M_FBT, "fbt", "Function Boundary Tracing");
+#include "fbt.h"
 
-#defineFBT_PUSHL_EBP   0x55
-#defineFBT_MOVL_ESP_EBP0_V00x8b
-#defineFBT_MOVL_ESP_EBP1_V00xec
-#defineFBT_MOVL_ESP_EBP0_V10x89
-#defineFBT_MOVL_ESP_EBP1_V10xe5
-#defineFBT_REX_RSP_RBP 0x48
-
-#defineFBT_POPL_EBP0x5d
-#defineFBT_RET 0xc3
-#defineFBT_RET_IMM16   0xc2
-#defineFBT_LEAVE   0xc9
-
-#ifdef __amd64__
-#defineFBT_PATCHVAL0xcc
-#else
-#defineFBT_PATCHVAL0xf0
-#endif
+MALLOC_DEFINE(M_FBT, "fbt", "Function Boundary Tracing");
+
+dtrace_provider_id_t   fbt_id;
+fbt_probe_t**fbt_probetab;
+intfbt_probetab_mask;
 
 static d_open_tfbt_open;
 static int fbt_unload(void);
@@ -92,11 +80,6 @@ static void  fbt_load(void *);
 static voidfbt_suspend(void *, dtrace_id_t, void *);
 static voidfbt_resume(void *, dtrace_id_t, void *);
 
-#defineFBT_ENTRY   "entry"
-#defineFBT_RETURN  "return"
-#defineFBT_ADDR2NDX(addr)  uintptr_t)(addr)) >> 4) & 
fbt_probetab_mask)
-#defineFBT_PROBETAB_SIZE   0x8000  /* 32k entries -- 128K 
total */
-
 static struct cdevsw fbt_cdevsw = {
.d_version  = D_VERSION,
.d_open = fbt_open,
@@ -124,28 +107,8 @@ static dtrace_pops_t fbt_pops = {
fbt_destroy
 };
 
-typedef struct fbt_probe {
-   struct fbt_probe *fbtp_hashnext;
-   uint8_t *fbtp_patchpoint;
-   int8_t  fbtp_rval;
-   uint8_t fbtp_patchval;
-   uint8_t fbtp_savedval;
-   uintptr_t   fbtp_roffset;
-   dtrace_id_t fbtp_id;
-   const char  *fbtp_name;
-   modctl_t*fbtp_ctl;
-   int fbtp_loadcnt;
-   int fbtp_primary;
-   int fbtp_invop_cnt;
-   int fbtp_symindx;
-   struct fbt_probe *fbtp_next;
-} fbt_probe_t;
-
 static struct cdev *fbt_cdev;
-static dtrace_provider_id_tfbt_id;
-static fbt_probe_t **fbt_probetab;
 static int fbt_probetab_size;
-static int fbt_probetab_mask;
 static int fbt_verbose = 0;
 
 static void
@@ -162,257 +125,6 @@ fbt_doubletrap(void)
}
 }
 
-static int
-fbt_invop(uintptr_t addr, uintptr_t *stack, uintptr_t rval)
-{
-   solaris_cpu_t *cpu = &solaris_cpu[curcpu];
-   uintptr_t stack0, stack1, stack2, stack3, stack4;
-   fbt_probe_t *fbt = fbt_probetab[FBT_ADDR2NDX(addr)];
-
-   for (; fbt != NULL; fbt = fbt->fbtp_hashnext) {
-   if ((uintptr_t)fbt->fbtp_patchpoint == addr) {
-   fbt->fbtp_invop_cnt++;
-   if (fbt->fbtp_roffset == 0) {
-   int i = 0;
-   /*
-* When accessing the arguments on the stack,
-* we must protect against accessing beyond
-* the stack.  We can safely set NOFAULT here
-* -- we know that interrupts are already
-* disabled.
-*/
-   DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
-   cpu->cpu_dtrace_caller = stack[i++];
-   stack0 = stack[i++];
-   stack1 = stack[i++];
-   stack2 = stack[i

svn commit: r270066 - stable/10/sys/fs/nfsserver

2014-08-16 Thread Rick Macklem
Author: rmacklem
Date: Sat Aug 16 21:36:22 2014
New Revision: 270066
URL: http://svnweb.freebsd.org/changeset/base/270066

Log:
  MFC: r269771
  Change the NFS server's printf related to hitting
  the DRC cache's flood level so that it suggests
  increasing vfs.nfsd.tcphighwater.

Modified:
  stable/10/sys/fs/nfsserver/nfs_nfsdsocket.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/nfsserver/nfs_nfsdsocket.c
==
--- stable/10/sys/fs/nfsserver/nfs_nfsdsocket.c Sat Aug 16 20:44:45 2014
(r270065)
+++ stable/10/sys/fs/nfsserver/nfs_nfsdsocket.c Sat Aug 16 21:36:22 2014
(r270066)
@@ -749,10 +749,9 @@ nfsrvd_compound(struct nfsrv_descript *n
nd->nd_rp->rc_refcnt == 0) &&
(nfsrv_mallocmget_limit() ||
 nfsrc_tcpsavedreplies > nfsrc_floodlevel)) {
-   if (nfsrc_tcpsavedreplies > nfsrc_floodlevel) {
-   printf("nfsd server cache flooded, try to");
-   printf(" increase nfsrc_floodlevel\n");
-   }
+   if (nfsrc_tcpsavedreplies > nfsrc_floodlevel)
+   printf("nfsd server cache flooded, try "
+   "increasing vfs.nfsd.tcphighwater\n");
nd->nd_repstat = NFSERR_RESOURCE;
*repp = nfsd_errmap(nd);
if (op == NFSV4OP_SETATTR) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270065 - head/sys/arm/freescale/imx

2014-08-16 Thread Ian Lepore
Author: ian
Date: Sat Aug 16 20:44:45 2014
New Revision: 270065
URL: http://svnweb.freebsd.org/changeset/base/270065

Log:
  Move the imx6 sysctl temperature info to hw.imx6 where all the other
  soc-wide info lives.  It was under dev.imx6_anatop.0.
  
  What does anatop mean anyway?  Nobody seems to know, so it's probably
  not where somebody will think to look for imx6 hardware info.

Modified:
  head/sys/arm/freescale/imx/imx6_anatop.c

Modified: head/sys/arm/freescale/imx/imx6_anatop.c
==
--- head/sys/arm/freescale/imx/imx6_anatop.cSat Aug 16 19:13:52 2014
(r270064)
+++ head/sys/arm/freescale/imx/imx6_anatop.cSat Aug 16 20:44:45 2014
(r270065)
@@ -558,7 +558,6 @@ static void
 initialize_tempmon(struct imx6_anatop_softc *sc)
 {
uint32_t cal;
-   struct sysctl_ctx_list *ctx;
 
/*
 * Fetch calibration data: a sensor count at room temperature (25C),
@@ -602,11 +601,10 @@ initialize_tempmon(struct imx6_anatop_so
callout_reset_sbt(&sc->temp_throttle_callout, sc->temp_throttle_delay, 
0, tempmon_throttle_check, sc, 0);
 
-   ctx = device_get_sysctl_ctx(sc->dev);
-   SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)),
+   SYSCTL_ADD_PROC(NULL, SYSCTL_STATIC_CHILDREN(_hw_imx6), 
OID_AUTO, "temperature", CTLTYPE_INT | CTLFLAG_RD, sc, 0,
temp_sysctl_handler, "IK", "Current die temperature");
-   SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)),
+   SYSCTL_ADD_PROC(NULL, SYSCTL_STATIC_CHILDREN(_hw_imx6), 
OID_AUTO, "throttle_temperature", CTLTYPE_INT | CTLFLAG_RW, sc,
0, temp_throttle_sysctl_handler, "IK", 
"Throttle CPU when exceeding this temperature");
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270064 - head/sbin/ifconfig

2014-08-16 Thread Alexander V. Chernikov
Author: melifaro
Date: Sat Aug 16 19:13:52 2014
New Revision: 270064
URL: http://svnweb.freebsd.org/changeset/base/270064

Log:
  Add support for reading i2c SFP/SFP+ data from NIC driver and
  presenting most interesting fields via ifconfig -v.
  This version supports Intel ixgbe driver only.
  
  Tested on:Cisco,Intel,Mellanox,ModuleTech,Molex transceivers
  MFC after:2 weeks

Added:
  head/sbin/ifconfig/sfp.c   (contents, props changed)
Modified:
  head/sbin/ifconfig/Makefile
  head/sbin/ifconfig/ifconfig.c
  head/sbin/ifconfig/ifconfig.h

Modified: head/sbin/ifconfig/Makefile
==
--- head/sbin/ifconfig/Makefile Sat Aug 16 15:00:01 2014(r270063)
+++ head/sbin/ifconfig/Makefile Sat Aug 16 19:13:52 2014(r270064)
@@ -33,6 +33,9 @@ SRCS+=ifvlan.c# SIOC[GS]ETVLAN suppor
 SRCS+= ifgre.c # GRE keys etc
 SRCS+= ifgif.c # GIF reversed header workaround
 
+SRCS+= sfp.c   # SFP/SFP+ information
+LDADD+=-lm
+
 SRCS+= ifieee80211.c regdomain.c # SIOC[GS]IEEE80211 support
 DPADD+=${LIBBSDXML} ${LIBSBUF}
 LDADD+=-lbsdxml -lsbuf

Modified: head/sbin/ifconfig/ifconfig.c
==
--- head/sbin/ifconfig/ifconfig.c   Sat Aug 16 15:00:01 2014
(r270063)
+++ head/sbin/ifconfig/ifconfig.c   Sat Aug 16 19:13:52 2014
(r270064)
@@ -1011,6 +1011,9 @@ status(const struct afswtch *afp, const 
if (ioctl(s, SIOCGIFSTATUS, &ifs) == 0) 
printf("%s", ifs.ascii);
 
+   if (verbose > 0)
+   sfp_status(s, &ifr, verbose);
+
close(s);
return;
 }

Modified: head/sbin/ifconfig/ifconfig.h
==
--- head/sbin/ifconfig/ifconfig.h   Sat Aug 16 15:00:01 2014
(r270063)
+++ head/sbin/ifconfig/ifconfig.h   Sat Aug 16 19:13:52 2014
(r270064)
@@ -143,6 +143,8 @@ voidifmaybeload(const char *name);
 typedef void clone_callback_func(int, struct ifreq *);
 void   clone_setdefcallback(const char *, clone_callback_func *);
 
+void   sfp_status(int s, struct ifreq *ifr, int verbose);
+
 /*
  * XXX expose this so modules that neeed to know of any pending
  * operations on ifmedia can avoid cmd line ordering confusion.

Added: head/sbin/ifconfig/sfp.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sbin/ifconfig/sfp.cSat Aug 16 19:13:52 2014(r270064)
@@ -0,0 +1,543 @@
+/*-
+ * Copyright (c) 2014 Alexander V. Chernikov. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE 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.
+ */
+
+#ifndef lint
+static const char rcsid[] =
+  "$FreeBSD$";
+#endif /* not lint */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "ifconfig.h"
+
+/* 2wire addresses */
+#defineSFP_ADDR_MSA0xA0/* Identification data */
+#defineSFP_ADDR_DDM0xA2/* digital monitoring interface */
+
+/* Definitions from Table 3.1 */
+#define SFP_MSA_IDENTIFIER 0   /* Type of transceiver (T. 3.2), 1B */
+#defineSFP_MSA_CONNECTOR   2   /* Connector type (T. 3.3), 1B 
*/
+
+#defineSFP_MSA_TRANSCEIVER_CLASS   3   /* Ethernet/Sonet/IB 
code, 1B */
+
+#defineSFP_MSA_VENDOR_NAME 20  /* ASCII vendor name, 16B */
+#defineSFP_MSA_VENDOR_PN   40  /* ASCII vendor partnum, 16B */
+#defineSFP_MSA_VENDOR_

Re: svn commit: r270063 - in head: sys/conf sys/dev/cxgbe sys/dev/e1000 sys/dev/ixgbe sys/dev/netmap sys/dev/virtio/network sys/net tools/tools/netmap

2014-08-16 Thread Bjoern A. Zeeb

On 16 Aug 2014, at 15:00 , Luigi Rizzo  wrote:

> Author: luigi
> Date: Sat Aug 16 15:00:01 2014
> New Revision: 270063
> URL: http://svnweb.freebsd.org/changeset/base/270063
> 
> Log:
>  Update to the current version of netmap.
>  Mostly bugfixes or features developed in the past 6 months,
>  so this is a 10.1 candidate.
> 
>  Basically no user API changes (some bugfixes in sys/net/netmap_user.h).
> …



>  MFC after:   3 days.
> 

Or not…


Sparc64:

netmap.c:(.text+0x2a74): undefined reference to `netmap_get_monitor_na'


i386.LINT and amd64.LINT and related:


In file included from 
/scratch/tmp/bz/head.svn/sys/modules/virtio/network/../../../dev/virtio/network/if_vtnet.c:293:
@/dev/netmap/if_vtnet_netmap.h:46:1: error: no previous prototype for function 
'vtnet_netmap_free_bufs' [-Werror,-Wmissing-prototypes]
vtnet_netmap_free_bufs(struct SOFTC_T* sc)
^
@/dev/netmap/if_vtnet_netmap.h:84:1: error: no previous prototype for function 
'vtnet_netmap_reg' [-Werror,-Wmissing-prototypes]
vtnet_netmap_reg(struct netmap_adapter *na, int onoff)
^
@/dev/netmap/if_vtnet_netmap.h:240:26: error: suggest braces around 
initialization of subobject [-Werror,-Wmissing-braces]
struct sglist sg[1] = { ss, 0, 0, 2};
^~~
{  }
3 errors generated.
--- if_vtnet.o ---
*** [if_vtnet.o] Error code 1



No idea what else; it’s all still compiling.


— 
Bjoern A. Zeeb "Come on. Learn, goddamn it.", WarGames, 1983

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


Re: svn commit: r270063 - in head: sys/conf sys/dev/cxgbe sys/dev/e1000 sys/dev/ixgbe sys/dev/netmap sys/dev/virtio/network sys/net tools/tools/netmap

2014-08-16 Thread Luigi Rizzo
On Sat, Aug 16, 2014 at 03:00:01PM +, Luigi Rizzo wrote:
> Author: luigi
...
>   5. if_lem.c: support for various paravirtualization features,
> experimental and disabled by default.
> Most of these are described in our ANCS'13 paper [1].
> Paravirtualized support in netmap mode is new, and beats the
> numbers in the paper by a large factor (under qemu-kvm,
> we measured gues-host throughput up to 10-12 Mpps).

ref. [1] is
Luigi Rizzo, Giuseppe Lettieri, Vincenzo Maffione, Speeding up
packet I/O in virtual machines, ACM/IEEE ANCS'13, October 2013, San Jose

you can find a draft of the pdf on my research page
http://info.iet.unipi.it/~luigi/research.html

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


svn commit: r270063 - in head: sys/conf sys/dev/cxgbe sys/dev/e1000 sys/dev/ixgbe sys/dev/netmap sys/dev/virtio/network sys/net tools/tools/netmap

2014-08-16 Thread Luigi Rizzo
Author: luigi
Date: Sat Aug 16 15:00:01 2014
New Revision: 270063
URL: http://svnweb.freebsd.org/changeset/base/270063

Log:
  Update to the current version of netmap.
  Mostly bugfixes or features developed in the past 6 months,
  so this is a 10.1 candidate.
  
  Basically no user API changes (some bugfixes in sys/net/netmap_user.h).
  
  In detail:
  
  1. netmap support for virtio-net, including in netmap mode.
Under bhyve and with a netmap backend [2] we reach over 1Mpps
with standard APIs (e.g. libpcap), and 5-8 Mpps in netmap mode.
  
  2. (kernel) add support for multiple memory allocators, so we can
better partition physical and virtual interfaces giving access
to separate users. The most visible effect is one additional
argument to the various kernel functions to compute buffer
addresses. All netmap-supported drivers are affected, but changes
are mechanical and trivial
  
  3. (kernel) simplify the prototype for *txsync() and *rxsync()
driver methods. All netmap drivers affected, changes mostly mechanical.
  
  4. add support for netmap-monitor ports. Think of it as a mirroring
port on a physical switch: a netmap monitor port replicates traffic
present on the main port. Restrictions apply. Drive carefully.
  
  5. if_lem.c: support for various paravirtualization features,
experimental and disabled by default.
Most of these are described in our ANCS'13 paper [1].
Paravirtualized support in netmap mode is new, and beats the
numbers in the paper by a large factor (under qemu-kvm,
we measured gues-host throughput up to 10-12 Mpps).
  
  A lot of refactoring and additional documentation in the files
  in sys/dev/netmap, but apart from #2 and #3 above, almost nothing
  of this stuff is visible to other kernel parts.
  
  Example programs in tools/tools/netmap have been updated with bugfixes
  and to support more of the existing features.
  
  This is meant to go into 10.1 so we plan an MFC before the Aug.22 deadline.
  
  A lot of this code has been contributed by my colleagues at UNIPI,
  including Giuseppe Lettieri, Vincenzo Maffione, Stefano Garzarella.
  
  MFC after:3 days.

Added:
  head/sys/dev/netmap/if_vtnet_netmap.h   (contents, props changed)
  head/sys/dev/netmap/netmap_monitor.c   (contents, props changed)
  head/sys/net/paravirt.h   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/cxgbe/t4_netmap.c
  head/sys/dev/e1000/if_em.c
  head/sys/dev/e1000/if_igb.c
  head/sys/dev/e1000/if_lem.c
  head/sys/dev/ixgbe/ixgbe.c
  head/sys/dev/netmap/if_em_netmap.h
  head/sys/dev/netmap/if_igb_netmap.h
  head/sys/dev/netmap/if_lem_netmap.h
  head/sys/dev/netmap/if_re_netmap.h
  head/sys/dev/netmap/ixgbe_netmap.h
  head/sys/dev/netmap/netmap.c
  head/sys/dev/netmap/netmap_freebsd.c
  head/sys/dev/netmap/netmap_generic.c
  head/sys/dev/netmap/netmap_kern.h
  head/sys/dev/netmap/netmap_mbq.h
  head/sys/dev/netmap/netmap_mem2.c
  head/sys/dev/netmap/netmap_mem2.h
  head/sys/dev/netmap/netmap_offloadings.c
  head/sys/dev/netmap/netmap_pipe.c
  head/sys/dev/netmap/netmap_vale.c
  head/sys/dev/virtio/network/if_vtnet.c
  head/sys/net/netmap.h
  head/sys/net/netmap_user.h
  head/tools/tools/netmap/pkt-gen.c
  head/tools/tools/netmap/vale-ctl.c

Modified: head/sys/conf/files
==
--- head/sys/conf/files Sat Aug 16 14:56:11 2014(r270062)
+++ head/sys/conf/files Sat Aug 16 15:00:01 2014(r270063)
@@ -1948,6 +1948,7 @@ dev/netmap/netmap_freebsd.c   optional net
 dev/netmap/netmap_generic.coptional netmap
 dev/netmap/netmap_mbq.coptional netmap
 dev/netmap/netmap_mem2.c   optional netmap
+dev/netmap/netmap_monitor.coptional netmap
 dev/netmap/netmap_offloadings.coptional netmap
 dev/netmap/netmap_pipe.c   optional netmap
 dev/netmap/netmap_vale.c   optional netmap

Modified: head/sys/dev/cxgbe/t4_netmap.c
==
--- head/sys/dev/cxgbe/t4_netmap.c  Sat Aug 16 14:56:11 2014
(r270062)
+++ head/sys/dev/cxgbe/t4_netmap.c  Sat Aug 16 15:00:01 2014
(r270063)
@@ -434,19 +434,18 @@ cxgbe_netmap_on(struct adapter *sc, stru
 
hwb = &sc->sge.hw_buf_info[0];
for (i = 0; i < SGE_FLBUF_SIZES; i++, hwb++) {
-   if (hwb->size == NETMAP_BUF_SIZE)
+   if (hwb->size == NETMAP_BUF_SIZE(na))
break;
}
if (i >= SGE_FLBUF_SIZES) {
if_printf(ifp, "no hwidx for netmap buffer size %d.\n",
-   NETMAP_BUF_SIZE);
+   NETMAP_BUF_SIZE(na));
return (ENXIO);
}
hwidx = i;
 
/* Must set caps before calling netmap_reset */
-   na->na_flags |= (NAF_NATIVE_ON | NAF_NETMAP_ON);
-   ifp->if_capenable |= IFCAP_NETMAP;
+   nm_set_native_flags(na);
 
for_each_n

svn commit: r270062 - in head: sbin/umount usr.bin/showmount

2014-08-16 Thread Peter Wemm
Author: peter
Date: Sat Aug 16 14:56:11 2014
New Revision: 270062
URL: http://svnweb.freebsd.org/changeset/base/270062

Log:
  Use mount protocol version 3 by default for showmount and umount.
  mount_nfs effectively uses mount protocol v3 by default already.
  v1 mount protocol is being removed along with nfsv2 by a high profile NFS
  appliance vendor and our legacy v1 mount protocol usage causes rpc errors.

Modified:
  head/sbin/umount/umount.c
  head/usr.bin/showmount/showmount.8
  head/usr.bin/showmount/showmount.c

Modified: head/sbin/umount/umount.c
==
--- head/sbin/umount/umount.c   Sat Aug 16 14:30:46 2014(r270061)
+++ head/sbin/umount/umount.c   Sat Aug 16 14:56:11 2014(r270062)
@@ -394,7 +394,7 @@ umountfs(struct statfs *sfs)
 * has been unmounted.
 */
if (ai != NULL && !(fflag & MNT_FORCE) && do_rpc) {
-   clp = clnt_create(hostp, MOUNTPROG, MOUNTVERS, "udp");
+   clp = clnt_create(hostp, MOUNTPROG, MOUNTVERS3, "udp");
if (clp  == NULL) {
warnx("%s: %s", hostp,
clnt_spcreateerror("MOUNTPROG"));

Modified: head/usr.bin/showmount/showmount.8
==
--- head/usr.bin/showmount/showmount.8  Sat Aug 16 14:30:46 2014
(r270061)
+++ head/usr.bin/showmount/showmount.8  Sat Aug 16 14:56:11 2014
(r270062)
@@ -31,7 +31,7 @@
 .\" @(#)showmount.88.3 (Berkeley) 3/29/95
 .\" $FreeBSD$
 .\"
-.Dd March 29, 1995
+.Dd August 16, 2014
 .Dt SHOWMOUNT 8
 .Os
 .Sh NAME
@@ -41,6 +41,7 @@
 .Nm
 .Op Fl a | d
 .Op Fl e
+.Op Fl 1
 .Op Fl 3
 .Op Ar host
 .Sh DESCRIPTION
@@ -76,10 +77,10 @@ List directory paths of mount points ins
 Show the
 .Ar host Ns 's
 exports list.
+.It Fl 1
+Use mount protocol Version 1, compatible with legacy servers.
 .It Fl 3
-Use mount protocol Version 3, compatible with
-.Tn NFS
-Version 3.
+Ignored for backwards compatibility.
 .El
 .Sh SEE ALSO
 .Xr mount 8 ,

Modified: head/usr.bin/showmount/showmount.c
==
--- head/usr.bin/showmount/showmount.c  Sat Aug 16 14:30:46 2014
(r270061)
+++ head/usr.bin/showmount/showmount.c  Sat Aug 16 14:56:11 2014
(r270062)
@@ -110,11 +110,11 @@ main(int argc, char **argv)
 {
register struct exportslist *exp;
register struct grouplist *grp;
-   register int rpcs = 0, mntvers = 1;
+   register int rpcs = 0, mntvers = 3;
const char *host;
int ch, estat;
 
-   while ((ch = getopt(argc, argv, "ade3")) != -1)
+   while ((ch = getopt(argc, argv, "ade13")) != -1)
switch (ch) {
case 'a':
if (type == 0) {
@@ -133,6 +133,9 @@ main(int argc, char **argv)
case 'e':
rpcs |= DOEXPORTS;
break;
+   case '1':
+   mntvers = 1;
+   break;
case '3':
mntvers = 3;
break;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270061 - in stable/10: share/man/man4 sys/boot/fdt/dts/mips sys/dev/netfpga10g sys/dev/netfpga10g/nf10bmac sys/mips/beri sys/mips/conf sys/modules sys/modules/netfpga10g

2014-08-16 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Aug 16 14:30:46 2014
New Revision: 270061
URL: http://svnweb.freebsd.org/changeset/base/270061

Log:
  MFC r264601,264646,265766,267918,267919,267920:
  
   Merge if_nf10bmac(4), a driver to support an NetFPGA-10G Embedded
   CPU Ethernet Core.
  
   The current version operates on a simple PIO based interface connected
   to a NetFPGA-10G port.
  
   To avoid confusion: this driver operates on a CPU running on the FPGA,
   e.g. BERI/mips, and is not suited for the PCI host interface.
  
   Adjust the register layout to allow for 64bit registers in the
   future for nf10bmac(4).  Also, add support for and enable RX interrupts.
  
   Allow switching between 32bit and 64bit bus width data access at compile
   time by setting NF10BMAC_64BIT and using a REGWTYPE #define to set correct
   variable and return value widths.
  
   Adjust comments to indicate the 32 or 64bit register widths.
  
  Relnotes: yes
  Sponsored by: DARPA/AFRL

Added:
  stable/10/share/man/man4/netfpga10g_nf10bmac.4
 - copied unchanged from r264601, head/share/man/man4/netfpga10g_nf10bmac.4
  stable/10/sys/dev/netfpga10g/
 - copied from r264601, head/sys/dev/netfpga10g/
  stable/10/sys/modules/netfpga10g/
 - copied from r264601, head/sys/modules/netfpga10g/
Modified:
  stable/10/share/man/man4/Makefile
  stable/10/sys/boot/fdt/dts/mips/beri-netfpga.dts
  stable/10/sys/dev/netfpga10g/nf10bmac/if_nf10bmac.c
  stable/10/sys/dev/netfpga10g/nf10bmac/if_nf10bmac_fdt.c
  stable/10/sys/dev/netfpga10g/nf10bmac/if_nf10bmacreg.h
  stable/10/sys/mips/beri/files.beri
  stable/10/sys/mips/conf/BERI_NETFPGA_MDROOT
  stable/10/sys/modules/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/Makefile
==
--- stable/10/share/man/man4/Makefile   Sat Aug 16 14:21:03 2014
(r270060)
+++ stable/10/share/man/man4/Makefile   Sat Aug 16 14:30:46 2014
(r270061)
@@ -282,6 +282,7 @@ MAN=aac.4 \
ncv.4 \
${_ndis.4} \
net80211.4 \
+   netfpga10g_nf10bmac.4 \
netgraph.4 \
netintro.4 \
netmap.4 \
@@ -678,6 +679,7 @@ MLINKS+=mwl.4 if_mwl.4
 MLINKS+=mxge.4 if_mxge.4
 MLINKS+=my.4 if_my.4
 MLINKS+=${_ndis.4} ${_if_ndis.4}
+MLINKS+=netfpga10g_nf10bmac.4 if_nf10bmac.4
 MLINKS+=netintro.4 net.4 \
netintro.4 networking.4
 MLINKS+=${_nfe.4} ${_if_nfe.4}

Copied: stable/10/share/man/man4/netfpga10g_nf10bmac.4 (from r264601, 
head/share/man/man4/netfpga10g_nf10bmac.4)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/10/share/man/man4/netfpga10g_nf10bmac.4  Sat Aug 16 14:30:46 
2014(r270061, copy of r264601, 
head/share/man/man4/netfpga10g_nf10bmac.4)
@@ -0,0 +1,70 @@
+.\"-
+.\" Copyright (c) 2014 Bjoern A. Zeeb
+.\" All rights reserved.
+.\"
+.\" This software was developed by SRI International and the University of
+.\" Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-11-C-0249
+.\" ("MRC2"), as part of the DARPA MRC research programme.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 17, 2014
+.Dt NETFPGA10G_NF10BMAC 4
+.Os
+.Sh NAME
+.Nm netfpga10g_nf10bmac
+.Nd driver for the NetFPGA-10G Embedded CPU Ethernet Core
+.Sh SYNOPSIS
+.Cd "device netfpga10g_nf10bmac"
+.Sh DESCRIPTION
+The
+.Nm
+device driver provides support for the NetFPGA-10G Embedded CPU Ethernet
+Core.
+.Sh HARDWARE
+The current version of the
+.Nm
+driver works with one PIO mode interface of the
+NetFPGA-10G Embedded CPU Ethernet Core version 1.00a.
+.

svn commit: r270060 - in stable/10/sys: boot/fdt/dts/mips mips/conf

2014-08-16 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Aug 16 14:21:03 2014
New Revision: 270060
URL: http://svnweb.freebsd.org/changeset/base/270060

Log:
  MFC r263632:
  
   For BERI on NetFPGA assume HZ=100 by default.
  
   Remove the uart support in favour of a "jtag-uart" interface imitation
   providing a much simpler interface, directly exported to the host,
   allowing the toolchain to be shared with BERI on Altera. [1]
  
   Submitted by:Jong Hun HAN (jong.han cl.cam.ac.uk) [1]
  Sponsored by: DARPA/AFRL

Modified:
  stable/10/sys/boot/fdt/dts/mips/beri-netfpga.dts
  stable/10/sys/mips/conf/BERI_NETFPGA_MDROOT
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/boot/fdt/dts/mips/beri-netfpga.dts
==
--- stable/10/sys/boot/fdt/dts/mips/beri-netfpga.dtsSat Aug 16 14:17:09 
2014(r270059)
+++ stable/10/sys/boot/fdt/dts/mips/beri-netfpga.dtsSat Aug 16 14:21:03 
2014(r270060)
@@ -113,6 +113,14 @@
soft-interrupt-sources = <64>;
};
 
+   serial0: serial@7f00 {
+   compatible = "altera,jtag_uart-11_0";
+   reg = <0x7f00 0x40>;
+   interrupts = <0>;
+   interrupt-parent = <&beripic>;
+   };
+
+/*
serial0: serial@7f002100 {
compatible = "ns16550";
reg = <0x7f002100 0x20>;
@@ -121,6 +129,7 @@
interrupts = <8>;
interrupt-parent = <&beripic>;
};
+*/
};
 
aliases { 

Modified: stable/10/sys/mips/conf/BERI_NETFPGA_MDROOT
==
--- stable/10/sys/mips/conf/BERI_NETFPGA_MDROOT Sat Aug 16 14:17:09 2014
(r270059)
+++ stable/10/sys/mips/conf/BERI_NETFPGA_MDROOT Sat Aug 16 14:21:03 2014
(r270060)
@@ -10,11 +10,14 @@ include "BERI_TEMPLATE"
 
 ident  BERI_NETFPGA_MDROOT
 
+optionsHZ=100
+
 optionsFDT
 optionsFDT_DTB_STATIC
 makeoptionsFDT_DTS_FILE=beri-netfpga.dts
 
-device uart
+#deviceuart
+device altera_jtag_uart
 
 #
 # This kernel configuration uses an embedded memory root file system.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270059 - stable/10/sys/dev/altera/atse

2014-08-16 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Aug 16 14:17:09 2014
New Revision: 270059
URL: http://svnweb.freebsd.org/changeset/base/270059

Log:
  MFC r264542:
  
   Use ETHER_ALIGN as argument to m_adj() to offset the beginning of packet
   rather than the magic number 2.
  
   While here fix a typo in a comment.
  
   No functional changes.
  
  Sponsored by: DARPA/AFRL

Modified:
  stable/10/sys/dev/altera/atse/if_atse.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/altera/atse/if_atse.c
==
--- stable/10/sys/dev/altera/atse/if_atse.c Sat Aug 16 14:14:29 2014
(r270058)
+++ stable/10/sys/dev/altera/atse/if_atse.c Sat Aug 16 14:17:09 2014
(r270059)
@@ -1179,7 +1179,7 @@ outer:
return (rx_npkts);
m->m_len = m->m_pkthdr.len = MCLBYTES;
/* Make sure upper layers will be aligned. */
-   m_adj(m, 2);
+   m_adj(m, ETHER_ALIGN);
sc->atse_rx_m = m;
}
 
@@ -1815,7 +1815,7 @@ atse_detach(device_t dev)
return (0);
 }
 
-/* Shared between nexus anf fdt implementation. */
+/* Shared between nexus and fdt implementation. */
 void
 atse_detach_resources(device_t dev)
 {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270058 - stable/10/sys/mips/beri

2014-08-16 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Aug 16 14:14:29 2014
New Revision: 270058
URL: http://svnweb.freebsd.org/changeset/base/270058

Log:
  MFC r264605:
  
   Based on xlp_machdep.c and completed the list of options based on
   boot/mips/beri/loader/metadata.c allow FDT configuration to set
   command line options.
   This leads to an interesting quesiton of future interactions with loader.
   However for configurations without loader this allows bootverbose or boot
   single user to be set by compiling a new kernel, which is good enough for
   testing and debugging.
  
   Reviewed by: rwatson
  Sponsored by: DARPA/AFRL

Modified:
  stable/10/sys/mips/beri/beri_machdep.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/mips/beri/beri_machdep.c
==
--- stable/10/sys/mips/beri/beri_machdep.c  Sat Aug 16 14:09:26 2014
(r270057)
+++ stable/10/sys/mips/beri/beri_machdep.c  Sat Aug 16 14:14:29 2014
(r270058)
@@ -131,6 +131,46 @@ platform_reset(void)
__asm__ __volatile("wait");
 }
 
+#ifdef FDT
+/* Parse cmd line args as env - copied from xlp_machdep. */
+/* XXX-BZ this should really be centrally provided for all (boot) code. */
+static void
+_parse_bootargs(char *cmdline)
+{
+   char *n, *v;
+
+   while ((v = strsep(&cmdline, " \n")) != NULL) {
+   if (*v == '\0')
+   continue;
+   if (*v == '-') {
+   while (*v != '\0') {
+   v++;
+   switch (*v) {
+   case 'a': boothowto |= RB_ASKNAME; break;
+   /* Someone should simulate that ;-) */
+   case 'C': boothowto |= RB_CDROM; break;
+   case 'd': boothowto |= RB_KDB; break;
+   case 'D': boothowto |= RB_MULTIPLE; break;
+   case 'm': boothowto |= RB_MUTE; break;
+   case 'g': boothowto |= RB_GDB; break;
+   case 'h': boothowto |= RB_SERIAL; break;
+   case 'p': boothowto |= RB_PAUSE; break;
+   case 'r': boothowto |= RB_DFLTROOT; break;
+   case 's': boothowto |= RB_SINGLE; break;
+   case 'v': boothowto |= RB_VERBOSE; break;
+   }
+   }
+   } else {
+   n = strsep(&v, "=");
+   if (v == NULL)
+   setenv(n, "1");
+   else
+   setenv(n, v);
+   }
+   }
+}
+#endif
+
 void
 platform_start(__register_t a0, __register_t a1,  __register_t a2, 
 __register_t a3)
@@ -142,7 +182,9 @@ platform_start(__register_t a0, __regist
char **envp = (char **)a2;
unsigned int memsize = a3;
 #ifdef FDT
+   char buf[2048]; /* early stack supposedly big enough */
vm_offset_t dtbp;
+   phandle_t chosen;
void *kmdp;
 #endif
int i;
@@ -180,6 +222,13 @@ platform_start(__register_t a0, __regist
while (1);
if (OF_init((void *)dtbp) != 0)
while (1);
+
+   /*
+* Get bootargs from FDT if specified.
+*/
+   chosen = OF_finddevice("/chosen");
+   if (OF_getprop(chosen, "bootargs", buf, sizeof(buf)) != -1)
+   _parse_bootargs(buf);
 #endif
 
/*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270057 - stable/10/sys/netinet

2014-08-16 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Aug 16 14:09:26 2014
New Revision: 270057
URL: http://svnweb.freebsd.org/changeset/base/270057

Log:
  MFC r266907:
  
   While PAWS is disabled, there are no consumers for the tcp options
   argument to tcp_twcheck();  thus mark it __unused.

Modified:
  stable/10/sys/netinet/tcp_timewait.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet/tcp_timewait.c
==
--- stable/10/sys/netinet/tcp_timewait.cSat Aug 16 14:05:31 2014
(r270056)
+++ stable/10/sys/netinet/tcp_timewait.cSat Aug 16 14:09:26 2014
(r270057)
@@ -350,7 +350,7 @@ tcp_twrecycleable(struct tcptw *tw)
  * looking for a pcb in the listen state.  Returns 0 otherwise.
  */
 int
-tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th,
+tcp_twcheck(struct inpcb *inp, struct tcpopt *to __unused, struct tcphdr *th,
 struct mbuf *m, int tlen)
 {
struct tcptw *tw;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270056 - stable/10/sys/netinet

2014-08-16 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Aug 16 14:05:31 2014
New Revision: 270056
URL: http://svnweb.freebsd.org/changeset/base/270056

Log:
  MFC r266620:
  
   Remove the prototpye for the static inline function
   tcp_signature_verify_input().
   The function is defined before first use already.

Modified:
  stable/10/sys/netinet/tcp_input.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet/tcp_input.c
==
--- stable/10/sys/netinet/tcp_input.c   Sat Aug 16 14:03:00 2014
(r270055)
+++ stable/10/sys/netinet/tcp_input.c   Sat Aug 16 14:05:31 2014
(r270056)
@@ -229,10 +229,6 @@ static void tcp_pulloutofband(struct so
 struct tcphdr *, struct mbuf *, int);
 static void tcp_xmit_timer(struct tcpcb *, int);
 static void tcp_newreno_partial_ack(struct tcpcb *, struct tcphdr *);
-#ifdef TCP_SIGNATURE
-static int inline  tcp_signature_verify_input(struct mbuf *, int, int,
-   int, struct tcpopt *, struct tcphdr *, u_int);
-#endif
 static void inline cc_ack_received(struct tcpcb *tp, struct tcphdr *th,
uint16_t type);
 static void inline cc_conn_init(struct tcpcb *tp);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270055 - stable/10/sys/netinet

2014-08-16 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Aug 16 14:03:00 2014
New Revision: 270055
URL: http://svnweb.freebsd.org/changeset/base/270055

Log:
  MFC r266619:
  
   syncache_lookup() is a file local function.  Make it static and
   take it out of the public KPI; seems it was never used elsewhere.

Modified:
  stable/10/sys/netinet/tcp_syncache.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet/tcp_syncache.c
==
--- stable/10/sys/netinet/tcp_syncache.cSat Aug 16 13:58:45 2014
(r270054)
+++ stable/10/sys/netinet/tcp_syncache.cSat Aug 16 14:03:00 2014
(r270055)
@@ -121,7 +121,6 @@ SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO,
 static void syncache_drop(struct syncache *, struct syncache_head *);
 static void syncache_free(struct syncache *);
 static void syncache_insert(struct syncache *, struct syncache_head *);
-struct syncache *syncache_lookup(struct in_conninfo *, struct syncache_head 
**);
 static int  syncache_respond(struct syncache *);
 static struct   socket *syncache_socket(struct syncache *, struct socket *,
struct mbuf *m);
@@ -492,7 +491,7 @@ syncache_timer(void *xsch)
  * Find an entry in the syncache.
  * Returns always with locked syncache_head plus a matching entry or NULL.
  */
-struct syncache *
+static struct syncache *
 syncache_lookup(struct in_conninfo *inc, struct syncache_head **schp)
 {
struct syncache *sc;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270054 - stable/10/sys/netinet

2014-08-16 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Aug 16 13:58:45 2014
New Revision: 270054
URL: http://svnweb.freebsd.org/changeset/base/270054

Log:
  MFC r266618:
  
   Make tcp_twrespond() file local private;  this removes it from the
   public KPI; it is not used anywhere else and seems it never was.

Modified:
  stable/10/sys/netinet/tcp_timewait.c
  stable/10/sys/netinet/tcp_var.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet/tcp_timewait.c
==
--- stable/10/sys/netinet/tcp_timewait.cSat Aug 16 13:55:44 2014
(r270053)
+++ stable/10/sys/netinet/tcp_timewait.cSat Aug 16 13:58:45 2014
(r270054)
@@ -105,6 +105,7 @@ static VNET_DEFINE(TAILQ_HEAD(, tcptw), 
 
 static voidtcp_tw_2msl_reset(struct tcptw *, int);
 static voidtcp_tw_2msl_stop(struct tcptw *);
+static int tcp_twrespond(struct tcptw *, int);
 
 static int
 tcptw_auto_size(void)
@@ -501,7 +502,7 @@ tcp_twclose(struct tcptw *tw, int reuse)
uma_zfree(V_tcptw_zone, tw);
 }
 
-int
+static int
 tcp_twrespond(struct tcptw *tw, int flags)
 {
struct inpcb *inp = tw->tw_inpcb;

Modified: stable/10/sys/netinet/tcp_var.h
==
--- stable/10/sys/netinet/tcp_var.h Sat Aug 16 13:55:44 2014
(r270053)
+++ stable/10/sys/netinet/tcp_var.h Sat Aug 16 13:58:45 2014
(r270054)
@@ -695,7 +695,6 @@ void tcp_tw_destroy(void);
 voidtcp_tw_zone_change(void);
 int tcp_twcheck(struct inpcb *, struct tcpopt *, struct tcphdr *,
struct mbuf *, int);
-int tcp_twrespond(struct tcptw *, int);
 voidtcp_setpersist(struct tcpcb *);
 #ifdef TCP_SIGNATURE
 int tcp_signature_compute(struct mbuf *, int, int, int, u_char *, u_int);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270053 - stable/10/sys/netipsec

2014-08-16 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Aug 16 13:55:44 2014
New Revision: 270053
URL: http://svnweb.freebsd.org/changeset/base/270053

Log:
  MFC r266606:
  
   Only do a ports check if this is a NAT-T SA.  Otherwise other
   lookups providing ports may get unexpected results.

Modified:
  stable/10/sys/netipsec/key.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netipsec/key.c
==
--- stable/10/sys/netipsec/key.cSat Aug 16 13:53:05 2014
(r270052)
+++ stable/10/sys/netipsec/key.cSat Aug 16 13:55:44 2014
(r270053)
@@ -1085,7 +1085,9 @@ key_allocsa(
struct secasvar *sav;
u_int stateidx, arraysize, state;
const u_int *saorder_state_valid;
-   int chkport;
+#ifdef IPSEC_NAT_T
+   int natt_chkport;
+#endif
 
IPSEC_ASSERT(dst != NULL, ("null dst address"));
 
@@ -1093,11 +1095,9 @@ key_allocsa(
printf("DP %s from %s:%u\n", __func__, where, tag));
 
 #ifdef IPSEC_NAT_T
-chkport = (dst->sa.sa_family == AF_INET &&
+natt_chkport = (dst->sa.sa_family == AF_INET &&
dst->sa.sa_len == sizeof(struct sockaddr_in) &&
dst->sin.sin_port != 0);
-#else
-   chkport = 0;
 #endif
 
/*
@@ -1115,6 +1115,8 @@ key_allocsa(
arraysize = _ARRAYLEN(saorder_state_valid_prefer_new);
}
LIST_FOREACH(sah, &V_sahtree, chain) {
+   int checkport;
+
/* search valid state */
for (stateidx = 0; stateidx < arraysize; stateidx++) {
state = saorder_state_valid[stateidx];
@@ -1129,13 +1131,25 @@ key_allocsa(
continue;
if (spi != sav->spi)
continue;
+   checkport = 0;
+#ifdef IPSEC_NAT_T
+   /*
+* Really only check ports when this is a NAT-T
+* SA.  Otherwise other lookups providing ports
+* might suffer.
+*/
+   if (sav->natt_type && natt_chkport)
+   checkport = 1;
+#endif
 #if 0  /* don't check src */
/* check src address */
-   if (key_sockaddrcmp(&src->sa, 
&sav->sah->saidx.src.sa, chkport) != 0)
+   if (key_sockaddrcmp(&src->sa,   
+   &sav->sah->saidx.src.sa, checkport) != 0)
continue;
 #endif
/* check dst address */
-   if (key_sockaddrcmp(&dst->sa, 
&sav->sah->saidx.dst.sa, chkport) != 0)
+   if (key_sockaddrcmp(&dst->sa,
+   &sav->sah->saidx.dst.sa, checkport) != 0)
continue;
sa_addref(sav);
goto done;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270052 - stable/10/sys/netinet

2014-08-16 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Aug 16 13:53:05 2014
New Revision: 270052
URL: http://svnweb.freebsd.org/changeset/base/270052

Log:
  MFC r266597:
  
   Remove the prototypes for things that are no longer file local but were
   moved to the header file.
  
   Was suppoed to be MFCed with: r266596
   Pointy hat to:   bz

Modified:
  stable/10/sys/netinet/tcp_input.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet/tcp_input.c
==
--- stable/10/sys/netinet/tcp_input.c   Sat Aug 16 13:50:15 2014
(r270051)
+++ stable/10/sys/netinet/tcp_input.c   Sat Aug 16 13:53:05 2014
(r270052)
@@ -229,9 +229,7 @@ static void  tcp_pulloutofband(struct so
 struct tcphdr *, struct mbuf *, int);
 static void tcp_xmit_timer(struct tcpcb *, int);
 static void tcp_newreno_partial_ack(struct tcpcb *, struct tcphdr *);
-static void inline tcp_fields_to_host(struct tcphdr *);
 #ifdef TCP_SIGNATURE
-static void inline tcp_fields_to_net(struct tcphdr *);
 static int inline  tcp_signature_verify_input(struct mbuf *, int, int,
int, struct tcpopt *, struct tcphdr *, u_int);
 #endif
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270051 - in stable/10/sys: dev/cxgbe/tom netinet

2014-08-16 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Aug 16 13:50:15 2014
New Revision: 270051
URL: http://svnweb.freebsd.org/changeset/base/270051

Log:
  MFC r266596:
  
   Move the tcp_fields_to_host() and tcp_fields_to_net() (inline)
   functions to the tcp_var.h header file in order to avoid further
   duplication with upcoming commits.
  
   Reviewed by: np

Modified:
  stable/10/sys/dev/cxgbe/tom/t4_listen.c
  stable/10/sys/netinet/tcp_input.c
  stable/10/sys/netinet/tcp_var.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/cxgbe/tom/t4_listen.c
==
--- stable/10/sys/dev/cxgbe/tom/t4_listen.c Sat Aug 16 13:47:04 2014
(r270050)
+++ stable/10/sys/dev/cxgbe/tom/t4_listen.c Sat Aug 16 13:50:15 2014
(r270051)
@@ -1052,17 +1052,6 @@ calc_opt2p(struct adapter *sc, struct po
return htobe32(opt2);
 }
 
-/* XXX: duplication. */
-static inline void
-tcp_fields_to_host(struct tcphdr *th)
-{
-
-   th->th_seq = ntohl(th->th_seq);
-   th->th_ack = ntohl(th->th_ack);
-   th->th_win = ntohs(th->th_win);
-   th->th_urp = ntohs(th->th_urp);
-}
-
 static void
 pass_accept_req_to_protohdrs(const struct mbuf *m, struct in_conninfo *inc,
 struct tcphdr *th)

Modified: stable/10/sys/netinet/tcp_input.c
==
--- stable/10/sys/netinet/tcp_input.c   Sat Aug 16 13:47:04 2014
(r270050)
+++ stable/10/sys/netinet/tcp_input.c   Sat Aug 16 13:50:15 2014
(r270051)
@@ -455,27 +455,7 @@ cc_post_recovery(struct tcpcb *tp, struc
tp->t_bytes_acked = 0;
 }
 
-static inline void
-tcp_fields_to_host(struct tcphdr *th)
-{
-
-   th->th_seq = ntohl(th->th_seq);
-   th->th_ack = ntohl(th->th_ack);
-   th->th_win = ntohs(th->th_win);
-   th->th_urp = ntohs(th->th_urp);
-}
-
 #ifdef TCP_SIGNATURE
-static inline void
-tcp_fields_to_net(struct tcphdr *th)
-{
-
-   th->th_seq = htonl(th->th_seq);
-   th->th_ack = htonl(th->th_ack);
-   th->th_win = htons(th->th_win);
-   th->th_urp = htons(th->th_urp);
-}
-
 static inline int
 tcp_signature_verify_input(struct mbuf *m, int off0, int tlen, int optlen,
 struct tcpopt *to, struct tcphdr *th, u_int tcpbflag)

Modified: stable/10/sys/netinet/tcp_var.h
==
--- stable/10/sys/netinet/tcp_var.h Sat Aug 16 13:47:04 2014
(r270050)
+++ stable/10/sys/netinet/tcp_var.h Sat Aug 16 13:50:15 2014
(r270051)
@@ -736,6 +736,27 @@ u_long  tcp_seq_subtract(u_long, u_long 
 
 void   cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type);
 
+static inline void
+tcp_fields_to_host(struct tcphdr *th)
+{
+
+   th->th_seq = ntohl(th->th_seq);
+   th->th_ack = ntohl(th->th_ack);
+   th->th_win = ntohs(th->th_win);
+   th->th_urp = ntohs(th->th_urp);
+}
+
+#ifdef TCP_SIGNATURE
+static inline void
+tcp_fields_to_net(struct tcphdr *th)
+{
+
+   th->th_seq = htonl(th->th_seq);
+   th->th_ack = htonl(th->th_ack);
+   th->th_win = htons(th->th_win);
+   th->th_urp = htons(th->th_urp);
+}
+#endif
 #endif /* _KERNEL */
 
 #endif /* _NETINET_TCP_VAR_H_ */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270050 - stable/10/sbin/route

2014-08-16 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Aug 16 13:47:04 2014
New Revision: 270050
URL: http://svnweb.freebsd.org/changeset/base/270050

Log:
  MFC r264539:
  
   When switching variables to flags in r243185 a few cases were missed.
   After r263152 (in head) this leaves unused variables if route(8) is
   compiled without INET support.
   Switch the remaining variable accesses to flags and remove now obsolete
   variables.
  
   Reviewed by: glebius

Modified:
  stable/10/sbin/route/route.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/route/route.c
==
--- stable/10/sbin/route/route.cSat Aug 16 13:25:49 2014
(r270049)
+++ stable/10/sbin/route/route.cSat Aug 16 13:47:04 2014
(r270050)
@@ -81,7 +81,7 @@ static struct keytab {
 static struct sockaddr_storage so[RTAX_MAX];
 static int pid, rtm_addrs;
 static int s;
-static int forcehost, forcenet, nflag, af, qflag, tflag;
+static int nflag, af, qflag, tflag;
 static int verbose, aflen;
 static int locking, lockrest, debugonly;
 static struct rt_metrics rt_metrics;
@@ -1235,7 +1235,7 @@ getaddr(int idx, char *str, struct hoste
 */
switch (idx) {
case RTAX_DST:
-   forcenet++;
+   nrflags |= F_FORCENET;
getaddr(RTAX_NETMASK, str, 0, nrflags);
break;
}
@@ -1275,7 +1275,7 @@ getaddr(int idx, char *str, struct hoste
if (!atalk_aton(str, &sat->sat_addr))
errx(EX_NOHOST, "bad address: %s", str);
rtm_addrs |= RTA_NETMASK;
-   return(forcehost || sat->sat_addr.s_node != 0);
+   return(nrflags & F_FORCEHOST || sat->sat_addr.s_node != 0);
}
case AF_LINK:
link_addr(str, (struct sockaddr_dl *)(void *)sa);
@@ -1308,10 +1308,10 @@ getaddr(int idx, char *str, struct hoste
}
*q = '/';
}
-   if ((idx != RTAX_DST || forcenet == 0) &&
+   if ((idx != RTAX_DST || (nrflags & F_FORCENET) == 0) &&
inet_aton(str, &sin->sin_addr)) {
val = sin->sin_addr.s_addr;
-   if (idx != RTAX_DST || forcehost ||
+   if (idx != RTAX_DST || nrflags & F_FORCEHOST ||
inet_lnaof(sin->sin_addr) != INADDR_ANY)
return (1);
else {
@@ -1319,7 +1319,7 @@ getaddr(int idx, char *str, struct hoste
goto netdone;
}
}
-   if (idx == RTAX_DST && forcehost == 0 &&
+   if (idx == RTAX_DST && (nrflags & F_FORCEHOST) == 0 &&
((val = inet_network(str)) != INADDR_NONE ||
((np = getnetbyname(str)) != NULL && (val = np->n_net) != 0))) {
 netdone:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270049 - stable/10/usr.bin/netstat

2014-08-16 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Aug 16 13:25:49 2014
New Revision: 270049
URL: http://svnweb.freebsd.org/changeset/base/270049

Log:
  MFC r261525:
  
   Print the MD5 signature information introduced in r221023 (head) in the
   TCP statistics output.

Modified:
  stable/10/usr.bin/netstat/inet.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/netstat/inet.c
==
--- stable/10/usr.bin/netstat/inet.cSat Aug 16 13:23:23 2014
(r270048)
+++ stable/10/usr.bin/netstat/inet.cSat Aug 16 13:25:49 2014
(r270049)
@@ -723,6 +723,17 @@ tcp_stats(u_long off, const char *name, 
p(tcps_ecn_ect1, "\t%ju packet%s with ECN ECT(1) bit set\n");
p(tcps_ecn_shs, "\t%ju successful ECN handshake%s\n");
p(tcps_ecn_rcwnd, "\t%ju time%s ECN reduced the congestion window\n");
+
+   p(tcps_sig_rcvgoodsig,
+"\t%ju packet%s with valid tcp-md5 signature received\n");
+   p(tcps_sig_rcvbadsig,
+"\t%ju packet%s with invalid tcp-md5 signature received\n");
+   p(tcps_sig_err_buildsig,
+"\t%ju packet%s with tcp-md5 signature mismatch\n");
+   p(tcps_sig_err_sigopt,
+"\t%ju packet%s with unexpected tcp-md5 signature received\n");
+   p(tcps_sig_err_nosigopt,
+"\t%ju packet%s without expected tcp-md5 signature received\n");
 #undef p
 #undef p1a
 #undef p2
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270048 - stable/10/sys/dev/ie

2014-08-16 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Aug 16 13:23:23 2014
New Revision: 270048
URL: http://svnweb.freebsd.org/changeset/base/270048

Log:
  MFC r259886:
  
   Bite the bullet and start removing the first compile time warnings
   by removing unsued file local functions and then unused callees.
   A lot more warnings to resolve but someone had to break the ice.
  
   X-Comment:   I am not the new maintainer; chime in, it's ours.

Modified:
  stable/10/sys/dev/ie/if_ie.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/ie/if_ie.c
==
--- stable/10/sys/dev/ie/if_ie.cSat Aug 16 13:20:44 2014
(r270047)
+++ stable/10/sys/dev/ie/if_ie.cSat Aug 16 13:23:23 2014
(r270048)
@@ -172,17 +172,12 @@ static void   iestart_locked  (struct ifne
 
 static __inline void
ee16_interrupt_enable   (struct ie_softc *);
-static voidee16_eeprom_outbits (struct ie_softc *, int, int);
-static voidee16_eeprom_clock   (struct ie_softc *, int);
-static u_short ee16_read_eeprom(struct ie_softc *, int);
-static int ee16_eeprom_inbits  (struct ie_softc *);
 
 static __inline void
ie_ack  (struct ie_softc *, u_int);
 static voidiereset (struct ie_softc *);
 static voidie_readframe(struct ie_softc *, int);
 static voidie_drop_packet_buffer   (struct ie_softc *);
-static voidfind_ie_mem_size(struct ie_softc *);
 static int command_and_wait(struct ie_softc *,
 int, void volatile *, int);
 static voidrun_tdr (struct ie_softc *,
@@ -1090,26 +1085,6 @@ check_ie_present(struct ie_softc *sc)
return (1);
 }
 
-/*
- * Divine the memory size of ie board UNIT.
- * Better hope there's nothing important hiding just below the ie card...
- */
-static void
-find_ie_mem_size(struct ie_softc *sc)
-{
-   unsigned size;
-
-   sc->iosize = 0;
-
-   for (size = 65536; size >= 8192; size -= 8192) {
-   if (check_ie_present(sc)) {
-   return;
-   }
-   }
-
-   return;
-}
-
 void
 el_reset_586(struct ie_softc *sc)
 {
@@ -1152,82 +1127,6 @@ ee16_chan_attn(struct ie_softc *sc)
outb(PORT(sc) + IEE16_ATTN, 0);
 }
 
-u_short
-ee16_read_eeprom(struct ie_softc *sc, int location)
-{
-   int ectrl, edata;
-
-   ectrl = inb(sc->port + IEE16_ECTRL);
-   ectrl &= IEE16_ECTRL_MASK;
-   ectrl |= IEE16_ECTRL_EECS;
-   outb(sc->port + IEE16_ECTRL, ectrl);
-
-   ee16_eeprom_outbits(sc, IEE16_EEPROM_READ, IEE16_EEPROM_OPSIZE1);
-   ee16_eeprom_outbits(sc, location, IEE16_EEPROM_ADDR_SIZE);
-   edata = ee16_eeprom_inbits(sc);
-   ectrl = inb(sc->port + IEE16_ECTRL);
-   ectrl &= ~(IEE16_RESET_ASIC | IEE16_ECTRL_EEDI | IEE16_ECTRL_EECS);
-   outb(sc->port + IEE16_ECTRL, ectrl);
-   ee16_eeprom_clock(sc, 1);
-   ee16_eeprom_clock(sc, 0);
-   return edata;
-}
-
-static void
-ee16_eeprom_outbits(struct ie_softc *sc, int edata, int count)
-{
-   int ectrl, i;
-
-   ectrl = inb(sc->port + IEE16_ECTRL);
-   ectrl &= ~IEE16_RESET_ASIC;
-   for (i = count - 1; i >= 0; i--) {
-   ectrl &= ~IEE16_ECTRL_EEDI;
-   if (edata & (1 << i)) {
-   ectrl |= IEE16_ECTRL_EEDI;
-   }
-   outb(sc->port + IEE16_ECTRL, ectrl);
-   DELAY(1);   /* eeprom data must be setup for 0.4 uSec */
-   ee16_eeprom_clock(sc, 1);
-   ee16_eeprom_clock(sc, 0);
-   }
-   ectrl &= ~IEE16_ECTRL_EEDI;
-   outb(sc->port + IEE16_ECTRL, ectrl);
-   DELAY(1);   /* eeprom data must be held for 0.4 uSec */
-}
-
-static int
-ee16_eeprom_inbits(struct ie_softc *sc)
-{
-   int ectrl, edata, i;
-
-   ectrl = inb(sc->port + IEE16_ECTRL);
-   ectrl &= ~IEE16_RESET_ASIC;
-   for (edata = 0, i = 0; i < 16; i++) {
-   edata = edata << 1;
-   ee16_eeprom_clock(sc, 1);
-   ectrl = inb(sc->port + IEE16_ECTRL);
-   if (ectrl & IEE16_ECTRL_EEDO) {
-   edata |= 1;
-   }
-   ee16_eeprom_clock(sc, 0);
-   }
-   return (edata);
-}
-
-static void
-ee16_eeprom_clock(struct ie_softc *sc, int state)
-{
-   int ectrl;
-
-   ectrl = inb(sc->port + IEE16_ECTRL);
-   ectrl &= ~(IEE16_RESET_ASIC | IEE16_ECTRL_EESK);
-   if (state) {
-   ectrl |= IEE16_ECTRL_EESK;
-   }
-   outb(sc->port + IEE16_ECTRL, ectrl);
-   DELAY(9);   /* EESK must be stable for 8.38 uSec */
-}
-
 static __inline void
 ee16_interrupt_enable(struct ie_softc *sc)
 {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-s

svn commit: r270047 - stable/10/sbin/pfctl

2014-08-16 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Aug 16 13:20:44 2014
New Revision: 270047
URL: http://svnweb.freebsd.org/changeset/base/270047

Log:
  MFC r259916:
  
   Use feature_present(3) to determine whether to open an INET or an
   INET6 socket when needed to allow pfctl to work on noinet and noinet6
   kernels (and try to provide a fallback using AF_LINK as best effort).
   Adjust the Makefile to also respect relevant src.conf(5) options
   for compile time decisions on INET and INET6 support.
  
   Reviewed by: glebius (no objections)

Modified:
  stable/10/sbin/pfctl/Makefile
  stable/10/sbin/pfctl/pfctl_altq.c
  stable/10/sbin/pfctl/pfctl_parser.c
  stable/10/sbin/pfctl/pfctl_parser.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/pfctl/Makefile
==
--- stable/10/sbin/pfctl/Makefile   Sat Aug 16 13:13:17 2014
(r270046)
+++ stable/10/sbin/pfctl/Makefile   Sat Aug 16 13:20:44 2014
(r270047)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 
+.include 
+
 # pf_ruleset.c is shared between kernel and pfctl
 .PATH: ${.CURDIR}/../../sys/netpfil/pf
 
@@ -16,6 +18,14 @@ CFLAGS+= -Wall -Wmissing-prototypes -Wno
 CFLAGS+= -Wstrict-prototypes
 CFLAGS+= -DENABLE_ALTQ -I${.CURDIR}
 
+# Need to use "WITH_" prefix to not conflict with the l/y INET/INET6 keywords
+.if ${MK_INET6_SUPPORT} != "no"
+CFLAGS+= -DWITH_INET6
+.endif
+.if ${MK_INET_SUPPORT} != "no"
+CFLAGS+= -DWITH_INET
+.endif
+
 YFLAGS=
 
 LDADD+=-lm -lmd

Modified: stable/10/sbin/pfctl/pfctl_altq.c
==
--- stable/10/sbin/pfctl/pfctl_altq.c   Sat Aug 16 13:13:17 2014
(r270046)
+++ stable/10/sbin/pfctl/pfctl_altq.c   Sat Aug 16 13:20:44 2014
(r270047)
@@ -1122,7 +1122,7 @@ getifspeed(char *ifname)
struct ifreqifr;
struct if_data  ifrdat;
 
-   if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+   if ((s = socket(get_socket_domain(), SOCK_DGRAM, 0)) < 0)
err(1, "socket");
bzero(&ifr, sizeof(ifr));
if (strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)) >=
@@ -1143,7 +1143,7 @@ getifmtu(char *ifname)
int s;
struct ifreqifr;
 
-   if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+   if ((s = socket(get_socket_domain(), SOCK_DGRAM, 0)) < 0)
err(1, "socket");
bzero(&ifr, sizeof(ifr));
if (strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)) >=

Modified: stable/10/sbin/pfctl/pfctl_parser.c
==
--- stable/10/sbin/pfctl/pfctl_parser.c Sat Aug 16 13:13:17 2014
(r270046)
+++ stable/10/sbin/pfctl/pfctl_parser.c Sat Aug 16 13:20:44 2014
(r270047)
@@ -1231,6 +1231,26 @@ ifa_load(void)
freeifaddrs(ifap);
 }
 
+int
+get_socket_domain(void)
+{
+   int sdom;
+
+   sdom = AF_UNSPEC;
+#ifdef WITH_INET6
+   if (sdom == AF_UNSPEC && feature_present("inet6"))
+   sdom = AF_INET6;
+#endif
+#ifdef WITH_INET
+   if (sdom == AF_UNSPEC && feature_present("inet"))
+   sdom = AF_INET;
+#endif
+   if (sdom == AF_UNSPEC)
+   sdom = AF_LINK;
+
+   return (sdom);
+}
+
 struct node_host *
 ifa_exists(const char *ifa_name)
 {
@@ -1242,7 +1262,7 @@ ifa_exists(const char *ifa_name)
ifa_load();
 
/* check wether this is a group */
-   if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
+   if ((s = socket(get_socket_domain(), SOCK_DGRAM, 0)) == -1)
err(1, "socket");
bzero(&ifgr, sizeof(ifgr));
strlcpy(ifgr.ifgr_name, ifa_name, sizeof(ifgr.ifgr_name));
@@ -1273,7 +1293,7 @@ ifa_grouplookup(const char *ifa_name, in
int  s, len;
struct node_host*n, *h = NULL;
 
-   if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
+   if ((s = socket(get_socket_domain(), SOCK_DGRAM, 0)) == -1)
err(1, "socket");
bzero(&ifgr, sizeof(ifgr));
strlcpy(ifgr.ifgr_name, ifa_name, sizeof(ifgr.ifgr_name));

Modified: stable/10/sbin/pfctl/pfctl_parser.h
==
--- stable/10/sbin/pfctl/pfctl_parser.h Sat Aug 16 13:13:17 2014
(r270046)
+++ stable/10/sbin/pfctl/pfctl_parser.h Sat Aug 16 13:20:44 2014
(r270047)
@@ -294,6 +294,7 @@ void set_ipmask(struct node_host *, 
u
 int check_netmask(struct node_host *, sa_family_t);
 int unmask(struct pf_addr *, sa_family_t);
 voidifa_load(void);
+int get_socket_domain(void);
 struct node_host   *ifa_exists(const char *);
 struct node_host   *ifa_lookup(const char *, int);
 struct node_host   *host(const char *);
___
svn-src-all@freebsd.org mail

Re: svn commit: r265946 - in stable/10: lib/libc/net sys/netinet sys/netinet6 sys/sys

2014-08-16 Thread Bjoern A. Zeeb

On 13 May 2014, at 06:05 , Kevin Lo  wrote:

> Author: kevlo
> Date: Tue May 13 06:05:53 2014
> New Revision: 265946
> URL: http://svnweb.freebsd.org/changeset/base/265946
> 
> Log:
>  MFC r264212,r264213,r264248,r265776,r265811,r265909:

Just for the records;  this commit also merged unrelated r259887:

 Add more (IPv6) related Internet Protocols:
 - Host Identity Protocol (RFC5201)
 - Shim6 Protocol (RFC5533)
 - 2x experimentation and testing (RFC3692, RFC4727)

 This does not indicate interest to implement/support these protocols,
 but they are part of the "IPv6 Extension Header Types" [1] based on RFC7045
 and might thus be needed by filtering and next header parsing
 implementations.

 References:[1] http://www.iana.org/assignments/ipv6-parameters
 Obtained from: http://www.iana.org/assignments/protocol-numbers

> 
>  - Add support for UDP-Lite protocol (RFC 3828) to IPv4 and IPv6 stacks.
>Tested with vlc and a test suite [1].
>[1] http://www.erg.abdn.ac.uk/~gerrit/udp-lite/files/udplite_linux.tar.gz
> 
>Reviewed by:   jhb, glebius, adrian
> 
>  - Fix a logic bug which prevented the sending of UDP packet with 0 checksum.
> 
>  - Disable TX checksum offload for UDP-Lite completely. It wasn't used for
>partial checksum coverage, but even for full checksum coverage it doesn't
>work.
> 
> Added:
>  stable/10/sys/netinet/udplite.h
> - copied unchanged from r264212, head/sys/netinet/udplite.h
> Modified:
>  stable/10/lib/libc/net/getaddrinfo.c
>  stable/10/sys/netinet/in.c
>  stable/10/sys/netinet/in.h
>  stable/10/sys/netinet/in_pcb.c
>  stable/10/sys/netinet/in_proto.c
>  stable/10/sys/netinet/udp_usrreq.c
>  stable/10/sys/netinet/udp_var.h
>  stable/10/sys/netinet6/in6_ifattach.c
>  stable/10/sys/netinet6/in6_proto.c
>  stable/10/sys/netinet6/udp6_usrreq.c
>  stable/10/sys/netinet6/udp6_var.h
>  stable/10/sys/sys/param.h
> Directory Properties:
>  stable/10/   (props changed)
> 
> Modified: stable/10/lib/libc/net/getaddrinfo.c
> ==
> --- stable/10/lib/libc/net/getaddrinfo.c  Tue May 13 05:26:43 2014
> (r265945)
> +++ stable/10/lib/libc/net/getaddrinfo.c  Tue May 13 06:05:53 2014
> (r265946)
> @@ -170,12 +170,14 @@ static const struct explore explore[] = 
>   { PF_INET6, SOCK_STREAM, IPPROTO_TCP, 0x07 },
>   { PF_INET6, SOCK_STREAM, IPPROTO_SCTP, 0x03 },
>   { PF_INET6, SOCK_SEQPACKET, IPPROTO_SCTP, 0x07 },
> + { PF_INET6, SOCK_DGRAM, IPPROTO_UDPLITE, 0x03 },
>   { PF_INET6, SOCK_RAW, ANY, 0x05 },
> #endif
>   { PF_INET, SOCK_DGRAM, IPPROTO_UDP, 0x07 },
>   { PF_INET, SOCK_STREAM, IPPROTO_TCP, 0x07 },
>   { PF_INET, SOCK_STREAM, IPPROTO_SCTP, 0x03 },
>   { PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP, 0x07 },
> + { PF_INET, SOCK_DGRAM, IPPROTO_UDPLITE, 0x03 },
>   { PF_INET, SOCK_RAW, ANY, 0x05 },
>   { -1, 0, 0, 0 },
> };
> @@ -1477,6 +1479,9 @@ get_port(struct addrinfo *ai, const char
>   case IPPROTO_SCTP:
>   proto = "sctp";
>   break;
> + case IPPROTO_UDPLITE:
> + proto = "udplite";
> + break;
>   default:
>   proto = NULL;
>   break;
> 
> Modified: stable/10/sys/netinet/in.c
> ==
> --- stable/10/sys/netinet/in.cTue May 13 05:26:43 2014
> (r265945)
> +++ stable/10/sys/netinet/in.cTue May 13 06:05:53 2014
> (r265946)
> @@ -1167,6 +1167,7 @@ in_ifdetach(struct ifnet *ifp)
> 
>   in_pcbpurgeif0(&V_ripcbinfo, ifp);
>   in_pcbpurgeif0(&V_udbinfo, ifp);
> + in_pcbpurgeif0(&V_ulitecbinfo, ifp);
>   in_purgemaddrs(ifp);
> }
> 
> 
> Modified: stable/10/sys/netinet/in.h
> ==
> --- stable/10/sys/netinet/in.hTue May 13 05:26:43 2014
> (r265945)
> +++ stable/10/sys/netinet/in.hTue May 13 06:05:53 2014
> (r265946)
> @@ -237,12 +237,17 @@ __END_DECLS
> #define   IPPROTO_IPCOMP  108 /* payload compression 
> (IPComp) */
> #define   IPPROTO_SCTP132 /* SCTP */
> #define   IPPROTO_MH  135 /* IPv6 Mobility Header 
> */
> +#define  IPPROTO_UDPLITE 136 /* UDP-Lite */
> +#define  IPPROTO_HIP 139 /* IP6 Host Identity 
> Protocol */
> +#define  IPPROTO_SHIM6   140 /* IP6 Shim6 Protocol */
> /* 101-254: Partly Unassigned */
> #define   IPPROTO_PIM 103 /* Protocol Independent 
> Mcast */
> #define   IPPROTO_CARP112 /* CARP */
> #define   IPPROTO_PGM 113 /* PGM */
> #define   IPPROTO_MPLS137 /* MPLS-in-IP */
> #de

svn commit: r270046 - head/sys/dev/virtio

2014-08-16 Thread Luigi Rizzo
Author: luigi
Date: Sat Aug 16 13:13:17 2014
New Revision: 270046
URL: http://svnweb.freebsd.org/changeset/base/270046

Log:
  print additional debugging info in virtqueue_dump()
  (not fundamental, but useful to debug performance issues on vtnet)
  
  MFC after:3 days

Modified:
  head/sys/dev/virtio/virtqueue.c

Modified: head/sys/dev/virtio/virtqueue.c
==
--- head/sys/dev/virtio/virtqueue.c Sat Aug 16 13:11:59 2014
(r270045)
+++ head/sys/dev/virtio/virtqueue.c Sat Aug 16 13:13:17 2014
(r270046)
@@ -605,11 +605,13 @@ virtqueue_dump(struct virtqueue *vq)
 
printf("VQ: %s - size=%d; free=%d; used=%d; queued=%d; "
"desc_head_idx=%d; avail.idx=%d; used_cons_idx=%d; "
-   "used.idx=%d; avail.flags=0x%x; used.flags=0x%x\n",
+   "used.idx=%d; used_event_idx=%d; avail.flags=0x%x; 
used.flags=0x%x\n",
vq->vq_name, vq->vq_nentries, vq->vq_free_cnt,
virtqueue_nused(vq), vq->vq_queued_cnt, vq->vq_desc_head_idx,
vq->vq_ring.avail->idx, vq->vq_used_cons_idx,
-   vq->vq_ring.used->idx, vq->vq_ring.avail->flags,
+   vq->vq_ring.used->idx,
+   vring_used_event(&vq->vq_ring),
+   vq->vq_ring.avail->flags,
vq->vq_ring.used->flags);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270045 - stable/10/sys/security/mac

2014-08-16 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Aug 16 13:11:59 2014
New Revision: 270045
URL: http://svnweb.freebsd.org/changeset/base/270045

Log:
  MFC r259885:
  
   As constantly reported during kernel compilation, m_buflen is unsigned so
   can never be < 0.  Remove the expression, which can never be true.

Modified:
  stable/10/sys/security/mac/mac_framework.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/security/mac/mac_framework.c
==
--- stable/10/sys/security/mac/mac_framework.c  Sat Aug 16 13:09:40 2014
(r270044)
+++ stable/10/sys/security/mac/mac_framework.c  Sat Aug 16 13:11:59 2014
(r270045)
@@ -587,8 +587,7 @@ int
 mac_check_structmac_consistent(struct mac *mac)
 {
 
-   if (mac->m_buflen < 0 ||
-   mac->m_buflen > MAC_MAX_LABEL_BUF_LEN)
+   if (mac->m_buflen > MAC_MAX_LABEL_BUF_LEN)
return (EINVAL);
 
return (0);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270044 - stable/10/sys/netinet6

2014-08-16 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Aug 16 13:09:40 2014
New Revision: 270044
URL: http://svnweb.freebsd.org/changeset/base/270044

Log:
  MFC r259884:
  
   Correct warnings comparing unsigned variables < 0 constantly reported
   while building kernels.  All instances removed are indeed unsigned so
   the expressions could not be true.

Modified:
  stable/10/sys/netinet6/in6_mcast.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet6/in6_mcast.c
==
--- stable/10/sys/netinet6/in6_mcast.c  Sat Aug 16 13:06:11 2014
(r270043)
+++ stable/10/sys/netinet6/in6_mcast.c  Sat Aug 16 13:09:40 2014
(r270044)
@@ -1849,8 +1849,7 @@ in6p_join_group(struct inpcb *inp, struc
if (mreq.ipv6mr_interface == 0) {
ifp = in6p_lookup_mcast_ifp(inp, &gsa->sin6);
} else {
-   if (mreq.ipv6mr_interface < 0 ||
-   V_if_index < mreq.ipv6mr_interface)
+   if (V_if_index < mreq.ipv6mr_interface)
return (EADDRNOTAVAIL);
ifp = ifnet_byindex(mreq.ipv6mr_interface);
}
@@ -2194,7 +2193,7 @@ in6p_leave_group(struct inpcb *inp, stru
 * XXX SCOPE6 lock potentially taken here.
 */
if (ifindex != 0) {
-   if (ifindex < 0 || V_if_index < ifindex)
+   if (V_if_index < ifindex)
return (EADDRNOTAVAIL);
ifp = ifnet_byindex(ifindex);
if (ifp == NULL)
@@ -2349,7 +2348,7 @@ in6p_set_multicast_if(struct inpcb *inp,
error = sooptcopyin(sopt, &ifindex, sizeof(u_int), sizeof(u_int));
if (error)
return (error);
-   if (ifindex < 0 || V_if_index < ifindex)
+   if (V_if_index < ifindex)
return (EINVAL);
 
ifp = ifnet_byindex(ifindex);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270043 - stable/10/sbin/mount_nfs

2014-08-16 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Aug 16 13:06:11 2014
New Revision: 270043
URL: http://svnweb.freebsd.org/changeset/base/270043

Log:
  MFC r269583:
  
   Provide -o vers= support for mount_nfs.
  
   Our mount_nfs does use -o nfsv<2|3|4> or -2 or -3 to specify the version.
   OSX (these days), Solaris, and Linux use -o vers=<2,3,4>.
  
   With the upcoming autofs support we can make a lot of (entrerprisy) setups
   getting mount options from LDAP just work by providing -o vers= 
compatibility.
  
   Reviewed by: wblock, bjk (man page), rmacklem, emaste
   Sponsored by:DARPA,AFRL
  PR:   192379

Modified:
  stable/10/sbin/mount_nfs/mount_nfs.8
  stable/10/sbin/mount_nfs/mount_nfs.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/mount_nfs/mount_nfs.8
==
--- stable/10/sbin/mount_nfs/mount_nfs.8Sat Aug 16 12:59:47 2014
(r270042)
+++ stable/10/sbin/mount_nfs/mount_nfs.8Sat Aug 16 13:06:11 2014
(r270043)
@@ -28,7 +28,7 @@
 .\"@(#)mount_nfs.8 8.3 (Berkeley) 3/29/95
 .\" $FreeBSD$
 .\"
-.Dd December 7, 2013
+.Dd August 5, 2014
 .Dt MOUNT_NFS 8
 .Os
 .Sh NAME
@@ -371,6 +371,14 @@ tune the timeout
 interval.)
 .It Cm udp
 Use UDP transport.
+.It Cm vers Ns = Ns Aq Ar vers_number
+Use the specified version number for NFS requests.
+See the
+.Cm nfsv2 ,
+.Cm nfsv3 ,
+and 
+.Cm nfsv4
+options for details.
 .It Cm wcommitsize Ns = Ns Aq Ar value
 Set the maximum pending write commit size to the specified value.
 This determines the maximum amount of pending write data that the NFS
@@ -466,6 +474,26 @@ Same as
 Same as
 .Fl o Cm retrans Ns = Ns Aq Ar value
 .El
+.Pp
+The following
+.Fl o
+named options are equivalent to other
+.Fl o
+named options and are supported for compatibility with other
+operating systems (e.g., Linux, Solaris, and OSX) to ease usage of
+.Xr autofs 5
+support.
+.Bl -tag -width indent
+.It Fl o Cm vers Ns = Ns 2
+Same as
+.Fl o Cm nfsv2
+.It Fl o Cm vers Ns = Ns 3
+Same as
+.Fl o Cm nfsv3
+.It Fl o Cm vers Ns = Ns 4
+Same as
+.Fl o Cm nfsv4
+.El
 .Sh SEE ALSO
 .Xr nmount 2 ,
 .Xr unmount 2 ,

Modified: stable/10/sbin/mount_nfs/mount_nfs.c
==
--- stable/10/sbin/mount_nfs/mount_nfs.cSat Aug 16 12:59:47 2014
(r270042)
+++ stable/10/sbin/mount_nfs/mount_nfs.cSat Aug 16 13:06:11 2014
(r270043)
@@ -310,6 +310,32 @@ main(int argc, char *argv[])
if (*p || num <= 0)
errx(1, "illegal maxgroups 
value -- %s", val);
//set_rpc_maxgrouplist(num);
+   } else if (strcmp(opt, "vers") == 0) {
+   num = strtol(val, &p, 10);
+   if (*p || num <= 0)
+   errx(1, "illegal vers value -- "
+   "%s", val);
+   switch (num) {
+   case 2:
+   mountmode = V2;
+   break;
+   case 3:
+   mountmode = V3;
+   build_iovec(&iov, &iovlen,
+   "nfsv3", NULL, 0);
+   break;
+   case 4:
+   mountmode = V4;
+   fstype = "nfs";
+   nfsproto = IPPROTO_TCP;
+   if (portspec == NULL)
+   portspec = "2049";
+   break;
+   default:
+   errx(1, "illegal nfs version "
+   "value -- %s", val);
+   }
+   pass_flag_to_nmount=0;
}
if (pass_flag_to_nmount)
build_iovec(&iov, &iovlen, opt, val,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270042 - in stable/10/sys: kern sys

2014-08-16 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Aug 16 12:59:47 2014
New Revision: 270042
URL: http://svnweb.freebsd.org/changeset/base/270042

Log:
  MFC r269669:
  
   Split up sys_ktimer_getoverrun() into a sys_ and a kern_ variant
   and export the kern_ version needed by an upcoming linuxolator change.
  
   Sponsored by:DARPA,AFRL

Modified:
  stable/10/sys/kern/kern_time.c
  stable/10/sys/sys/syscallsubr.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_time.c
==
--- stable/10/sys/kern/kern_time.c  Sat Aug 16 10:47:24 2014
(r270041)
+++ stable/10/sys/kern/kern_time.c  Sat Aug 16 12:59:47 2014
(r270042)
@@ -1361,13 +1361,20 @@ struct timer_getoverrun_args {
 int
 sys_ktimer_getoverrun(struct thread *td, struct ktimer_getoverrun_args *uap)
 {
+
+   return (kern_ktimer_getoverrun(td, uap->timerid));
+}
+
+int
+kern_ktimer_getoverrun(struct thread *td, int timer_id)
+{
struct proc *p = td->td_proc;
struct itimer *it;
int error ;
 
PROC_LOCK(p);
-   if (uap->timerid < 3 ||
-   (it = itimer_find(p, uap->timerid)) == NULL) {
+   if (timer_id < 3 ||
+   (it = itimer_find(p, timer_id)) == NULL) {
PROC_UNLOCK(p);
error = EINVAL;
} else {

Modified: stable/10/sys/sys/syscallsubr.h
==
--- stable/10/sys/sys/syscallsubr.h Sat Aug 16 10:47:24 2014
(r270041)
+++ stable/10/sys/sys/syscallsubr.h Sat Aug 16 12:59:47 2014
(r270042)
@@ -239,6 +239,7 @@ int kern_ktimer_settime(struct thread *t
struct itimerspec *val, struct itimerspec *oval);
 intkern_ktimer_gettime(struct thread *td, int timer_id,
struct itimerspec *val);
+intkern_ktimer_getoverrun(struct thread *td, int timer_id);
 intkern_thr_new(struct thread *td, struct thr_param *param);
 intkern_thr_suspend(struct thread *td, struct timespec *tsp);
 intkern_truncate(struct thread *td, char *path, enum uio_seg pathseg,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270041 - head/sys/net

2014-08-16 Thread Roger Pau Monné
Author: royger
Date: Sat Aug 16 10:47:24 2014
New Revision: 270041
URL: http://svnweb.freebsd.org/changeset/base/270041

Log:
  net: move interface removal notification up in if_detach_internal
  
  This is needed to prevent having interfaces with ifp->if_addr == NULL
  on bridge interfaces. Moving the notification event handlers up makes
  sure the interfaces are removed before doing any more cleanup.
  
  Sponsored by: Citrix Systems R&D
  Reviewed by: melifaro
  Differential Revision: https://reviews.freebsd.org/D598
  
  net/if.c
   - Move interface removal notification up in if_detach_internal.

Modified:
  head/sys/net/if.c

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Sat Aug 16 08:38:53 2014(r270040)
+++ head/sys/net/if.c   Sat Aug 16 10:47:24 2014(r270041)
@@ -874,6 +874,12 @@ if_detach_internal(struct ifnet *ifp, in
 #endif
if_purgemaddrs(ifp);
 
+   /* Announce that the interface is gone. */
+   rt_ifannouncemsg(ifp, IFAN_DEPARTURE);
+   EVENTHANDLER_INVOKE(ifnet_departure_event, ifp);
+   if (IS_DEFAULT_VNET(curvnet))
+   devctl_notify("IFNET", ifp->if_xname, "DETACH", NULL);
+
if (!vmove) {
/*
 * Prevent further calls into the device driver via ifnet.
@@ -911,11 +917,6 @@ if_detach_internal(struct ifnet *ifp, in
}
}
 
-   /* Announce that the interface is gone. */
-   rt_ifannouncemsg(ifp, IFAN_DEPARTURE);
-   EVENTHANDLER_INVOKE(ifnet_departure_event, ifp);
-   if (IS_DEFAULT_VNET(curvnet))
-   devctl_notify("IFNET", ifp->if_xname, "DETACH", NULL);
if_delgroups(ifp);
 
/*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270040 - stable/10/lib/libthr/thread

2014-08-16 Thread Konstantin Belousov
Author: kib
Date: Sat Aug 16 08:38:53 2014
New Revision: 270040
URL: http://svnweb.freebsd.org/changeset/base/270040

Log:
  MFC r269909:
  Add a knob LIBPTHREAD_BIGSTACK_MAIN, which instructs libthr to leave
  the whole RLIMIT_STACK-sized region of the kernel-allocated stack as
  the stack of main thread.

Modified:
  stable/10/lib/libthr/thread/thr_init.c
  stable/10/lib/libthr/thread/thr_stack.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libthr/thread/thr_init.c
==
--- stable/10/lib/libthr/thread/thr_init.c  Sat Aug 16 08:37:13 2014
(r270039)
+++ stable/10/lib/libthr/thread/thr_init.c  Sat Aug 16 08:38:53 2014
(r270040)
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -441,6 +442,7 @@ init_main_thread(struct pthread *thread)
 static void
 init_private(void)
 {
+   struct rlimit rlim;
size_t len;
int mib[2];
char *env;
@@ -471,6 +473,12 @@ init_private(void)
len = sizeof (_usrstack);
if (sysctl(mib, 2, &_usrstack, &len, NULL, 0) == -1)
PANIC("Cannot get kern.usrstack from sysctl");
+   env = getenv("LIBPTHREAD_BIGSTACK_MAIN");
+   if (env != NULL) {
+   if (getrlimit(RLIMIT_STACK, &rlim) == -1)
+   PANIC("Cannot get stack rlimit");
+   _thr_stack_initial = rlim.rlim_cur;
+   }
len = sizeof(_thr_is_smp);
sysctlbyname("kern.smp.cpus", &_thr_is_smp, &len, NULL, 0);
_thr_is_smp = (_thr_is_smp > 1);

Modified: stable/10/lib/libthr/thread/thr_stack.c
==
--- stable/10/lib/libthr/thread/thr_stack.c Sat Aug 16 08:37:13 2014
(r270039)
+++ stable/10/lib/libthr/thread/thr_stack.c Sat Aug 16 08:38:53 2014
(r270040)
@@ -246,7 +246,10 @@ _thr_stack_alloc(struct pthread_attr *at
THREAD_LIST_UNLOCK(curthread);
}
else {
-   /* Allocate a stack from usrstack. */
+   /*
+* Allocate a stack from or below usrstack, depending
+* on the LIBPTHREAD_BIGSTACK_MAIN env variable.
+*/
if (last_stack == NULL)
last_stack = _usrstack - _thr_stack_initial -
_thr_guard_default;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270039 - stable/10/lib/libthr/thread

2014-08-16 Thread Konstantin Belousov
Author: kib
Date: Sat Aug 16 08:37:13 2014
New Revision: 270039
URL: http://svnweb.freebsd.org/changeset/base/270039

Log:
  MFC r269908:
  Style.

Modified:
  stable/10/lib/libthr/thread/thr_stack.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libthr/thread/thr_stack.c
==
--- stable/10/lib/libthr/thread/thr_stack.c Sat Aug 16 08:31:25 2014
(r270038)
+++ stable/10/lib/libthr/thread/thr_stack.c Sat Aug 16 08:37:13 2014
(r270039)
@@ -268,7 +268,7 @@ _thr_stack_alloc(struct pthread_attr *at
 
/* Map the stack and guard page together, and split guard
   page from allocated space: */
-   if ((stackaddr = mmap(stackaddr, stacksize+guardsize,
+   if ((stackaddr = mmap(stackaddr, stacksize + guardsize,
 _rtld_get_stack_prot(), MAP_STACK,
 -1, 0)) != MAP_FAILED &&
(guardsize == 0 ||
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r270038 - in head/sys: i386/i386 i386/xen sparc64/sparc64

2014-08-16 Thread Konstantin Belousov
Author: kib
Date: Sat Aug 16 08:31:25 2014
New Revision: 270038
URL: http://svnweb.freebsd.org/changeset/base/270038

Log:
  Complete r254667, do not destroy pmap lock if KVA allocation failed.
  
  Submitted by: Svatopluk Kraus 
  MFC after:1 week

Modified:
  head/sys/i386/i386/pmap.c
  head/sys/i386/xen/pmap.c
  head/sys/sparc64/sparc64/pmap.c

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Sat Aug 16 07:01:42 2014(r270037)
+++ head/sys/i386/i386/pmap.c   Sat Aug 16 08:31:25 2014(r270038)
@@ -1755,10 +1755,8 @@ pmap_pinit(pmap_t pmap)
 */
if (pmap->pm_pdir == NULL) {
pmap->pm_pdir = (pd_entry_t *)kva_alloc(NBPTD);
-   if (pmap->pm_pdir == NULL) {
-   PMAP_LOCK_DESTROY(pmap);
+   if (pmap->pm_pdir == NULL)
return (0);
-   }
 #ifdef PAE
pmap->pm_pdpt = uma_zalloc(pdptzone, M_WAITOK | M_ZERO);
KASSERT(((vm_offset_t)pmap->pm_pdpt &

Modified: head/sys/i386/xen/pmap.c
==
--- head/sys/i386/xen/pmap.cSat Aug 16 07:01:42 2014(r270037)
+++ head/sys/i386/xen/pmap.cSat Aug 16 08:31:25 2014(r270038)
@@ -1459,7 +1459,6 @@ pmap_pinit(pmap_t pmap)
if (pmap->pm_pdir == NULL) {
pmap->pm_pdir = (pd_entry_t *)kva_alloc(NBPTD);
if (pmap->pm_pdir == NULL) {
-   PMAP_LOCK_DESTROY(pmap);
 #ifdef HAMFISTED_LOCKING
mtx_unlock(&createdelete_lock);
 #endif

Modified: head/sys/sparc64/sparc64/pmap.c
==
--- head/sys/sparc64/sparc64/pmap.c Sat Aug 16 07:01:42 2014
(r270037)
+++ head/sys/sparc64/sparc64/pmap.c Sat Aug 16 08:31:25 2014
(r270038)
@@ -1211,11 +1211,9 @@ pmap_pinit(pmap_t pm)
 */
if (pm->pm_tsb == NULL) {
pm->pm_tsb = (struct tte *)kva_alloc(TSB_BSIZE);
-   if (pm->pm_tsb == NULL) {
-   PMAP_LOCK_DESTROY(pm);
+   if (pm->pm_tsb == NULL)
return (0);
}
-   }
 
/*
 * Allocate an object for it.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"