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

2017-04-29 Thread Dmitry Chagin
Author: dchagin
Date: Sun Apr 30 05:56:57 2017
New Revision: 317601
URL: https://svnweb.freebsd.org/changeset/base/317601

Log:
  Fix symlinkat() which use the newdfd argument to look up the old path,
  while it should use it for the new path instead.
  
  Reported by:  trasz@
  MFC after:1 month

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

Modified: head/sys/compat/linux/linux_file.c
==
--- head/sys/compat/linux/linux_file.c  Sun Apr 30 02:08:46 2017
(r317600)
+++ head/sys/compat/linux/linux_file.c  Sun Apr 30 05:56:57 2017
(r317601)
@@ -826,7 +826,7 @@ linux_symlinkat(struct thread *td, struc
int error, dfd;
 
dfd = (args->newdfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->newdfd;
-   LCONVPATHEXIST_AT(td, args->oldname, , dfd);
+   LCONVPATHEXIST(td, args->oldname, );
/* Expand LCONVPATHCREATE so that `path' can be freed on errors */
error = linux_emul_convpath(td, args->newname, UIO_USERSPACE, , 1, 
dfd);
if (to == NULL) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317600 - in head/sys: amd64/vmm/amd modules/vmm

2017-04-29 Thread Anish Gupta
Author: anish
Date: Sun Apr 30 02:08:46 2017
New Revision: 317600
URL: https://svnweb.freebsd.org/changeset/base/317600

Log:
  Add AMD IOMMU/AMD-Vi support in bhyve for passthrough/direct assignment to 
VMs. To enable AMD-Vi, set hw.vmm.amdvi.enable=1.
  
  Reviewed by:bcr
  Approved by:grehan
  Tested by:rgrimes
  Differential Revision:https://reviews.freebsd.org/D10049

Added:
  head/sys/amd64/vmm/amd/amdvi_hw.c   (contents, props changed)
  head/sys/amd64/vmm/amd/amdvi_priv.h   (contents, props changed)
  head/sys/amd64/vmm/amd/ivrs_drv.c   (contents, props changed)
Modified:
  head/sys/modules/vmm/Makefile

Added: head/sys/amd64/vmm/amd/amdvi_hw.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/amd64/vmm/amd/amdvi_hw.c   Sun Apr 30 02:08:46 2017
(r317600)
@@ -0,0 +1,1509 @@
+/*-
+ * Copyright (c) 2016, Anish Gupta (an...@freebsd.org)
+ * 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 unmodified, 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 ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "pcib_if.h"
+
+#include "io/iommu.h"
+#include "amdvi_priv.h"
+
+SYSCTL_DECL(_hw_vmm);
+SYSCTL_NODE(_hw_vmm, OID_AUTO, amdvi, CTLFLAG_RW, NULL, NULL);
+
+#define MOD_INC(a, s, m) (((a) + (s)) % ((m) * (s)))
+#define MOD_DEC(a, s, m) (((a) - (s)) % ((m) * (s)))
+
+/* Print RID or device ID in PCI string format. */
+#define RID2PCI_STR(d) PCI_RID2BUS(d), PCI_RID2SLOT(d), PCI_RID2FUNC(d)
+
+static void amdvi_dump_cmds(struct amdvi_softc *softc);
+static void amdvi_print_dev_cap(struct amdvi_softc *softc);
+
+MALLOC_DEFINE(M_AMDVI, "amdvi", "amdvi");
+
+extern device_t *ivhd_devs;
+
+extern int ivhd_count;
+SYSCTL_INT(_hw_vmm_amdvi, OID_AUTO, count, CTLFLAG_RDTUN, _count,
+0, NULL);
+
+static int amdvi_enable_user = 0;
+SYSCTL_INT(_hw_vmm_amdvi, OID_AUTO, enable, CTLFLAG_RDTUN,
+_enable_user, 0, NULL);
+TUNABLE_INT("hw.vmm.amdvi_enable", _enable_user);
+
+#ifdef AMDVI_ATS_ENABLE
+/* XXX: ATS is not tested. */
+static int amdvi_enable_iotlb = 1;
+SYSCTL_INT(_hw_vmm_amdvi, OID_AUTO, iotlb_enabled, CTLFLAG_RDTUN,
+_enable_iotlb, 0, NULL);
+TUNABLE_INT("hw.vmm.enable_iotlb", _enable_iotlb);
+#endif
+
+static int amdvi_host_ptp = 1; /* Use page tables for host. */
+SYSCTL_INT(_hw_vmm_amdvi, OID_AUTO, host_ptp, CTLFLAG_RDTUN,
+_host_ptp, 0, NULL);
+TUNABLE_INT("hw.vmm.amdvi.host_ptp", _host_ptp);
+
+/* Page table level used <= supported by h/w[v1=7]. */
+static int amdvi_ptp_level = 4;
+SYSCTL_INT(_hw_vmm_amdvi, OID_AUTO, ptp_level, CTLFLAG_RDTUN,
+_ptp_level, 0, NULL);
+TUNABLE_INT("hw.vmm.amdvi.ptp_level", _ptp_level);
+
+/* Disable fault event reporting. */
+static int amdvi_disable_io_fault = 0;
+SYSCTL_INT(_hw_vmm_amdvi, OID_AUTO, disable_io_fault, CTLFLAG_RDTUN,
+_disable_io_fault, 0, NULL);
+TUNABLE_INT("hw.vmm.amdvi.disable_io_fault", _disable_io_fault);
+
+static uint32_t amdvi_dom_id = 0;  /* 0 is reserved for host. */
+SYSCTL_UINT(_hw_vmm_amdvi, OID_AUTO, domain_id, CTLFLAG_RD,
+_dom_id, 0, NULL);
+/*
+ * Device table entry.
+ * Bus(256) x Dev(32) x Fun(8) x DTE(256 bits or 32 bytes).
+ * = 256 * 2 * PAGE_SIZE.
+ */
+static struct amdvi_dte amdvi_dte[PCI_NUM_DEV_MAX] __aligned(PAGE_SIZE);
+CTASSERT(PCI_NUM_DEV_MAX == 0x1);
+CTASSERT(sizeof(amdvi_dte) == 0x20);
+
+static SLIST_HEAD (, amdvi_domain) dom_head;
+
+static inline void
+amdvi_pci_write(struct amdvi_softc *softc, int off, uint32_t data)
+{
+
+   pci_cfgregwrite(PCI_RID2BUS(softc->pci_rid),
+ 

Re: svn commit: r317169 - head/release/tools

2017-04-29 Thread Mark Millard
> Author: gjb
> Date: Wed Apr 19 21:18:06 2017
> New Revision: 317169
> URL: 
> https://svnweb.freebsd.org/changeset/base/317169
> 
> 
> Log:
>   Trim trailing '/release/..' when setting _OBJDIR so arm64/aarch64
>   boot1.efifat is properly located when creating virtual machine images.
>   
>   Sponsored by:   The FreeBSD Foundation
> 
> Modified:
>   head/release/tools/vmimage.subr
> 
> Modified: head/release/tools/vmimage.subr
> ==
> --- head/release/tools/vmimage.subr   Wed Apr 19 20:45:46 2017
> (r317168)
> +++ head/release/tools/vmimage.subr   Wed Apr 19 21:18:06 2017
> (r317169)
> @@ -15,6 +15,7 @@ write_partition_layout() {
>   fi
>  
>   _OBJDIR="$(make -C ${WORLDDIR} -V .OBJDIR)"
> + _OBJDIR="$(realpath ${_OBJDIR})"
>   if [ -d "${_OBJDIR%%/usr/src}/${TARGET}.${TARGET_ARCH}" ]; then
>   
> BOOTFILES="/${_OBJDIR%%/usr/src}/${TARGET}.${TARGET_ARCH}/usr/src/sys/boot"
>   else


In my experiments with making my own vmimage I had to
make another change. Instead of just:

_OBJDIR="$(make -C ${WORLDDIR} -V .OBJDIR)"

I had to add a use of realpath around ${WORLDDIR} to
get the make -V .OBJDIR output to be correct:

_OBJDIR="$(make -C $(realpath ${WORLDDIR}) -V .OBJDIR)"

The .. use in WORLDDIR blocked the -V .OBJDIR from
returning the relevant/correct path. This in turn
lead to

-p efi:=${BOOTFILES}/efi/boot1/boot1.efifat \

reporting the boot1.efifat as not found. With
the additional realpath use the relevant/correct
path was returned by -V .OBJDIR and boot1.efifat
was found.

(This is among other more experimental personal-use
changes not appropriate to be checked-in. But the
additional realpath use seemed to be appropriate
svn content.)


Other minor notes:

BOOTFILES ends up with a leading // in a lot of
contexts (including via the else clause assignment
not shown). (Not a problem for me.)

Use of /usr/src as the source tree is effectively
required? (Not a problem for me.)

For some reason aarch64 always has NOSWAP=1 and no
provision for a swap partition. (This is part of
why I was experimenting.)

While Makefile.vm has "SWAPSIZE?=  1G", much like it
has "VMSIZE?=20G", SWAPSIZE does not have an
equivalent of:

scripts/mk-vmimage.sh:  VMSIZE="${OPTARG}"

and so any SWAPSIZE control is external and implicit.


===
Mark Millard
markmi at dsl-only.net

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


svn commit: r317598 - head/usr.bin/printf

2017-04-29 Thread Jilles Tjoelker
Author: jilles
Date: Sat Apr 29 21:48:11 2017
New Revision: 317598
URL: https://svnweb.freebsd.org/changeset/base/317598

Log:
  printf: Output formatted data directly, instead of via asprintf.
  
  Long ago, sh used to have its own optimized and restricted string formatting
  implementation, which the printf builtin had to bypass via asprintf() to a
  temporary buffer. Since sh has used libc's string formatting implementation
  for a long time, remove the workaround.
  
  Add a check to keep  printf %c ''  working the same way (output nothing);
  POSIX allows both outputting nothing and outputting a NUL byte.
  
  Also, this change avoids silently discarding format directives for whose
  output asprintf() cannot allocate memory.

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

Modified: head/usr.bin/printf/printf.c
==
--- head/usr.bin/printf/printf.cSat Apr 29 19:20:50 2017
(r317597)
+++ head/usr.bin/printf/printf.cSat Apr 29 21:48:11 2017
(r317598)
@@ -70,20 +70,15 @@ static const char rcsid[] =
 #endif
 
 #definePF(f, func) do {
\
-   char *b = NULL; \
if (havewidth)  \
if (haveprec)   \
-   (void)asprintf(, f, fieldwidth, precision, func); \
+   (void)printf(f, fieldwidth, precision, func);   \
else\
-   (void)asprintf(, f, fieldwidth, func);\
+   (void)printf(f, fieldwidth, func);  \
else if (haveprec)  \
-   (void)asprintf(, f, precision, func); \
+   (void)printf(f, precision, func);   \
else\
-   (void)asprintf(, f, func);\
-   if (b) {\
-   (void)fputs(b, stdout); \
-   free(b);\
-   }   \
+   (void)printf(f, func);  \
 } while (0)
 
 static int  asciicode(void);
@@ -394,7 +389,8 @@ printf_doformat(char *fmt, int *rval)
char p;
 
p = getchr();
-   PF(start, p);
+   if (p != '\0')
+   PF(start, p);
break;
}
case 's': {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317597 - head/sys/netinet

2017-04-29 Thread Michael Tuexen
Author: tuexen
Date: Sat Apr 29 19:20:50 2017
New Revision: 317597
URL: https://svnweb.freebsd.org/changeset/base/317597

Log:
  Allow SCTP to use the hostcache.
  
  This patch allows the MTU stored in the hostcache to be used as an
  initial value for SCTP paths. When an ICMP PTB message is received,
  store the MTU in the hostcache.
  
  MFC after:1 week

Modified:
  head/sys/netinet/sctp_pcb.c
  head/sys/netinet/sctp_usrreq.c
  head/sys/netinet/sctputil.c
  head/sys/netinet/sctputil.h

Modified: head/sys/netinet/sctp_pcb.c
==
--- head/sys/netinet/sctp_pcb.c Sat Apr 29 19:12:44 2017(r317596)
+++ head/sys/netinet/sctp_pcb.c Sat Apr 29 19:20:50 2017(r317597)
@@ -3933,6 +3933,7 @@ sctp_add_remote_addr(struct sctp_tcb *st
stcb->asoc.vrf_id,
stcb->sctp_ep->fibnum);
 
+   net->src_addr_selected = 0;
if (SCTP_ROUTE_HAS_VALID_IFN(>ro)) {
/* Get source address */
net->ro._s_addr = sctp_source_address_selection(stcb->sctp_ep,
@@ -3942,18 +3943,18 @@ sctp_add_remote_addr(struct sctp_tcb *st
0,
stcb->asoc.vrf_id);
if (net->ro._s_addr != NULL) {
+   uint32_t imtu, rmtu, hcmtu;
+
net->src_addr_selected = 1;
/* Now get the interface MTU */
if (net->ro._s_addr->ifn_p != NULL) {
-   net->mtu = 
SCTP_GATHER_MTU_FROM_INTFC(net->ro._s_addr->ifn_p);
+   imtu = 
SCTP_GATHER_MTU_FROM_INTFC(net->ro._s_addr->ifn_p);
+   } else {
+   imtu = 0;
}
-   } else {
-   net->src_addr_selected = 0;
-   }
-   if (net->mtu > 0) {
-   uint32_t rmtu;
-
rmtu = SCTP_GATHER_MTU_FROM_ROUTE(net->ro._s_addr, 
>ro._l_addr.sa, net->ro.ro_rt);
+   hcmtu = sctp_hc_get_mtu(>ro._l_addr, 
stcb->sctp_ep->fibnum);
+   net->mtu = sctp_min_mtu(hcmtu, rmtu, imtu);
if (rmtu == 0) {
/*
 * Start things off to match mtu of
@@ -3961,17 +3962,8 @@ sctp_add_remote_addr(struct sctp_tcb *st
 */
SCTP_SET_MTU_OF_ROUTE(>ro._l_addr.sa,
net->ro.ro_rt, net->mtu);
-   } else {
-   /*
-* we take the route mtu over the interface,
-* since the route may be leading out the
-* loopback, or a different interface.
-*/
-   net->mtu = rmtu;
}
}
-   } else {
-   net->src_addr_selected = 0;
}
if (net->mtu == 0) {
switch (newaddr->sa_family) {

Modified: head/sys/netinet/sctp_usrreq.c
==
--- head/sys/netinet/sctp_usrreq.c  Sat Apr 29 19:12:44 2017
(r317596)
+++ head/sys/netinet/sctp_usrreq.c  Sat Apr 29 19:20:50 2017
(r317597)
@@ -225,6 +225,11 @@ sctp_notify(struct sctp_inpcb *inp,
}
if (net->mtu > next_mtu) {
net->mtu = next_mtu;
+   if (net->port) {
+   sctp_hc_set_mtu(>ro._l_addr, inp->fibnum, 
next_mtu + sizeof(struct udphdr));
+   } else {
+   sctp_hc_set_mtu(>ro._l_addr, inp->fibnum, 
next_mtu);
+   }
}
/* Update the association MTU */
if (stcb->asoc.smallest_mtu > next_mtu) {

Modified: head/sys/netinet/sctputil.c
==
--- head/sys/netinet/sctputil.c Sat Apr 29 19:12:44 2017(r317596)
+++ head/sys/netinet/sctputil.c Sat Apr 29 19:20:50 2017(r317597)
@@ -49,6 +49,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#if defined(INET6) || defined(INET)
+#include 
+#endif
 #include 
 #include 
 #include 
@@ -7235,3 +7238,90 @@ sctp_over_udp_start(void)
 #endif
return (0);
 }
+
+#if defined(INET6) || defined(INET)
+
+/*
+ * sctp_min_mtu ()returns the minimum of all non-zero arguments.
+ * If all arguments are zero, zero is returned.
+ */
+uint32_t
+sctp_min_mtu(uint32_t mtu1, uint32_t mtu2, uint32_t mtu3)
+{
+   if (mtu1 > 0) {
+   if (mtu2 > 0) {
+   if (mtu3 > 0) {
+   return (min(mtu1, min(mtu2, mtu3)));
+   } else {
+   

svn commit: r317596 - head/usr.sbin/mixer

2017-04-29 Thread Pedro F. Giffuni
Author: pfg
Date: Sat Apr 29 19:12:44 2017
New Revision: 317596
URL: https://svnweb.freebsd.org/changeset/base/317596

Log:
  mixer(8): Prevent possible sscanf() overflow.
  
  Fix %s buffer sizes in sscanf().
  
  Obtained from:DragonflyBSD (git dab952e2)
  MFC after:5 days

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

Modified: head/usr.sbin/mixer/mixer.c
==
--- head/usr.sbin/mixer/mixer.c Sat Apr 29 18:48:05 2017(r317595)
+++ head/usr.sbin/mixer/mixer.c Sat Apr 29 19:12:44 2017(r317596)
@@ -102,7 +102,7 @@ int
 main(int argc, char *argv[])
 {
charmixer[PATH_MAX] = "/dev/mixer";
-   charlstr[5], rstr[5];
+   charlstr[8], rstr[8];
char*name, *eptr;
int devmask = 0, recmask = 0, recsrc = 0, orecsrc;
int dusage = 0, drecsrc = 0, sflag = 0, Sflag = 0;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317595 - head/include

2017-04-29 Thread Pedro F. Giffuni
Author: pfg
Date: Sat Apr 29 18:48:05 2017
New Revision: 317595
URL: https://svnweb.freebsd.org/changeset/base/317595

Log:
  : ftello() and fseeko() were in SUSv2, so extend visibility.
  
  See:
  
  http://pubs.opengroup.org/onlinepubs/007908799/xsh/fseek.html
  http://pubs.opengroup.org/onlinepubs/007908799/xsh/ftell.html
  
  Hinted from:  DragonFlyBSD (git 58696e28)

Modified:
  head/include/stdio.h

Modified: head/include/stdio.h
==
--- head/include/stdio.hSat Apr 29 16:44:36 2017(r317594)
+++ head/include/stdio.hSat Apr 29 18:48:05 2017(r317595)
@@ -338,7 +338,7 @@ int  ferror_unlocked(FILE *);
 int fileno_unlocked(FILE *);
 #endif
 
-#if __POSIX_VISIBLE >= 200112
+#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500
 int fseeko(FILE *, __off_t, int);
 __off_t ftello(FILE *);
 #endif
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2017-04-29 Thread Ngie Cooper
Author: ngie
Date: Sat Apr 29 16:44:36 2017
New Revision: 317594
URL: https://svnweb.freebsd.org/changeset/base/317594

Log:
  usb(4): manpage cleanup
  
  1. Wrap at <80 columns for readability when editing. Rewrap some lines
 prematurely wrapped to better fit in <80 columns and not waste
 vertical space.
  2. Fix SEE ALSO sorting (sort by section first, then manpage name).
  3. Tweak the compound device description slightly by adding soft stops
 via commas.
  
  MFC after:1 week
  Reported by:  igor [3], manlint [2]
  Sponsored by Dell EMC Isilon

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

Modified: head/share/man/man4/usb.4
==
--- head/share/man/man4/usb.4   Sat Apr 29 15:35:30 2017(r317593)
+++ head/share/man/man4/usb.4   Sat Apr 29 16:44:36 2017(r317594)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 26, 2013
+.Dd April 29, 2017
 .Dt USB 4
 .Os
 .Sh NAME
@@ -78,8 +78,7 @@ bus.
 .Pp
 The
 .Nm uhub
-device will always be present as it is needed for the
-root hub.
+device will always be present as it is needed for the root hub.
 .Sh INTRODUCTION TO USB
 The
 .Tn USB
@@ -94,38 +93,34 @@ The most common USB speeds are:
 Each
 .Tn USB
 has a USB controller that is the master of the bus.
-The physical communication is simplex which means the host controller only 
communicates with one USB device at a time.
+The physical communication is simplex which means the host controller only
+communicates with one USB device at a time.
 .Pp
 There can be up to 127 devices connected to an USB HUB tree.
-The addresses are assigned
-dynamically by the host when each device is attached to the bus.
+The addresses are assigned dynamically by the host when each device is
+attached to the bus.
 .Pp
 Within each device there can be up to 16 endpoints.
-Each endpoint
-is individually addressed and the addresses are static.
+Each endpoint is individually addressed and the addresses are static.
 Each of these endpoints will communicate in one of four different modes:
 .Em control , isochronous , bulk ,
 or
 .Em interrupt .
 A device always has at least one endpoint.
-This endpoint has address 0 and is a control
-endpoint and is used to give commands to and extract basic data,
-such as descriptors, from the device.
+This endpoint has address 0 and is a control endpoint and is used to give
+commands to and extract basic data, such as descriptors, from the device.
 Each endpoint, except the control endpoint, is unidirectional.
 .Pp
 The endpoints in a device are grouped into interfaces.
-An interface is a logical unit within a device; e.g.\&
-a compound device with both a keyboard and a trackball would present
-one interface for each.
-An interface can sometimes be set into different modes,
-called alternate settings, which affects how it operates.
-Different alternate settings can have different endpoints
-within it.
+An interface is a logical unit within a device, e.g., a compound device with
+both a keyboard and a trackball, would present one interface for each.
+An interface can sometimes be set into different modes, called alternate
+settings, which affects how it operates.
+Different alternate settings can have different endpoints within it.
 .Pp
 A device may operate in different configurations.
-Depending on the
-configuration, the device may present different sets of endpoints
-and interfaces.
+Depending on the configuration, the device may present different sets of
+endpoints and interfaces.
 .Pp
 The bus enumeration of the
 .Tn USB
@@ -144,7 +139,6 @@ specifications can be found at:
 .D1 Pa http://www.usb.org/developers/docs/
 .Pp
 .Xr libusb 3 ,
-.Xr usbdi 9 ,
 .Xr aue 4 ,
 .Xr axe 4 ,
 .Xr axge 4 ,
@@ -166,8 +160,9 @@ specifications can be found at:
 .Xr uplcom 4 ,
 .Xr urio 4 ,
 .Xr uvscom 4 ,
-.Xr usbconfig 8 ,
 .Xr xhci 4
+.Xr usbconfig 8 ,
+.Xr usbdi 9 ,
 .Sh STANDARDS
 The
 .Nm
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317593 - head/sbin/ifconfig

2017-04-29 Thread Mark Felder
Author: feld (ports committer)
Date: Sat Apr 29 15:35:30 2017
New Revision: 317593
URL: https://svnweb.freebsd.org/changeset/base/317593

Log:
  Document in ifconfig(8) that gre(4) accepts tunnel commands
  
  - Also ensure wording is consistent for gif and gre
  
  Reviewed by:  wblock
  Differential Revision:https://reviews.freebsd.org/D5667

Modified:
  head/sbin/ifconfig/ifconfig.8

Modified: head/sbin/ifconfig/ifconfig.8
==
--- head/sbin/ifconfig/ifconfig.8   Sat Apr 29 09:57:27 2017
(r317592)
+++ head/sbin/ifconfig/ifconfig.8   Sat Apr 29 15:35:30 2017
(r317593)
@@ -28,7 +28,7 @@
 .\" From: @(#)ifconfig.8   8.3 (Berkeley) 1/5/94
 .\" $FreeBSD$
 .\"
-.Dd January 18, 2017
+.Dd April 29, 2017
 .Dt IFCONFIG 8
 .Os
 .Sh NAME
@@ -2518,7 +2518,7 @@ means
 Disable lacp strict compliance on the interface.
 .El
 .Pp
-The following parameters are specific to IP tunnel interfaces,
+The following parameters apply to IP tunnel interfaces,
 .Xr gif 4 :
 .Bl -tag -width indent
 .It Cm tunnel Ar src_addr dest_addr
@@ -2568,9 +2568,26 @@ Clear a flag
 .Cm send_rev_ethip_ver .
 .El
 .Pp
-The following parameters are specific to GRE tunnel interfaces,
+The following parameters apply to GRE tunnel interfaces,
 .Xr gre 4 :
 .Bl -tag -width indent
+.It Cm tunnel Ar src_addr dest_addr
+Configure the physical source and destination address for GRE tunnel
+interfaces.
+The arguments
+.Ar src_addr
+and
+.Ar dest_addr
+are interpreted as the outer source/destination for the encapsulating
+IPv4/IPv6 header.
+.It Fl tunnel
+Unconfigure the physical source and destination address for GRE tunnel
+interfaces previously configured with
+.Cm tunnel .
+.It Cm deletetunnel
+Another name for the
+.Fl tunnel
+parameter.
 .It Cm grekey Ar key
 Configure the GRE key to be used for outgoing packets.
 Note that
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r315526 - in head: contrib/netbsd-tests/lib/libc/sys include lib/libc/include lib/libc/sys lib/libc/tests/sys lib/libthr/thread share/man/man3 sys/compat/freebsd32 sys/kern sys/sys

2017-04-29 Thread Chagin Dmitry
On Sun, Mar 19, 2017 at 12:51:13AM +, Eric van Gyzen wrote:
> Author: vangyzen
> Date: Sun Mar 19 00:51:12 2017
> New Revision: 315526
> URL: https://svnweb.freebsd.org/changeset/base/315526
> 
> Log:
>   Add clock_nanosleep()

hi, why it is not merged still?

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


svn commit: r317592 - head/sys/netinet

2017-04-29 Thread Michael Tuexen
Author: tuexen
Date: Sat Apr 29 09:57:27 2017
New Revision: 317592
URL: https://svnweb.freebsd.org/changeset/base/317592

Log:
  Don't set the DF-bit on timer based retransmissions.
  
  MFC after:1 week

Modified:
  head/sys/netinet/sctp_timer.c

Modified: head/sys/netinet/sctp_timer.c
==
--- head/sys/netinet/sctp_timer.c   Sat Apr 29 09:47:15 2017
(r317591)
+++ head/sys/netinet/sctp_timer.c   Sat Apr 29 09:57:27 2017
(r317592)
@@ -667,6 +667,7 @@ start_again:
stcb->asoc.peers_rwnd += 
SCTP_BASE_SYSCTL(sctp_peer_chunk_oh);
}
chk->sent = SCTP_DATAGRAM_RESEND;
+   chk->flags |= CHUNK_FLAGS_FRAGMENT_OK;
SCTP_STAT_INCR(sctps_markedretrans);
 
/* reset the TSN for striking and other FR stuff */
@@ -740,6 +741,7 @@ start_again:
chk->whoTo = alt;
if (chk->sent != SCTP_DATAGRAM_RESEND) {
chk->sent = SCTP_DATAGRAM_RESEND;
+   chk->flags |= CHUNK_FLAGS_FRAGMENT_OK;

sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);
cnt_mk++;
}
@@ -1084,6 +1086,7 @@ sctp_cookie_timer(struct sctp_inpcb *inp
sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);
}
cookie->sent = SCTP_DATAGRAM_RESEND;
+   cookie->flags |= CHUNK_FLAGS_FRAGMENT_OK;
/*
 * Now call the output routine to kick out the cookie again, Note we
 * don't mark any chunks for retran so that FR will need to kick in
@@ -1130,6 +1133,7 @@ sctp_strreset_timer(struct sctp_inpcb *i
sctp_free_remote_addr(chk->whoTo);
if (chk->sent != SCTP_DATAGRAM_RESEND) {
chk->sent = SCTP_DATAGRAM_RESEND;
+   chk->flags |= CHUNK_FLAGS_FRAGMENT_OK;

sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);
}
chk->whoTo = alt;
@@ -1147,6 +1151,7 @@ sctp_strreset_timer(struct sctp_inpcb *i
if (strrst->sent != SCTP_DATAGRAM_RESEND)
sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);
strrst->sent = SCTP_DATAGRAM_RESEND;
+   strrst->flags |= CHUNK_FLAGS_FRAGMENT_OK;
 
/* restart the timer */
sctp_timer_start(SCTP_TIMER_TYPE_STRRESET, inp, stcb, strrst->whoTo);
@@ -1211,6 +1216,7 @@ sctp_asconf_timer(struct sctp_inpcb *inp
chk->whoTo = alt;
if (chk->sent != SCTP_DATAGRAM_RESEND) {
chk->sent = SCTP_DATAGRAM_RESEND;
+   chk->flags |= CHUNK_FLAGS_FRAGMENT_OK;

sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);
}
atomic_add_int(>ref_count, 1);
@@ -1225,6 +1231,7 @@ sctp_asconf_timer(struct sctp_inpcb *inp
if (asconf->sent != SCTP_DATAGRAM_RESEND && chk->sent 
!= SCTP_DATAGRAM_UNSENT)

sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);
chk->sent = SCTP_DATAGRAM_RESEND;
+   chk->flags |= CHUNK_FLAGS_FRAGMENT_OK;
}
if (!(net->dest_state & SCTP_ADDR_REACHABLE)) {
/*
@@ -1237,6 +1244,7 @@ sctp_asconf_timer(struct sctp_inpcb *inp
if (asconf->sent != SCTP_DATAGRAM_RESEND)
sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);
asconf->sent = SCTP_DATAGRAM_RESEND;
+   asconf->flags |= CHUNK_FLAGS_FRAGMENT_OK;
 
/* send another ASCONF if any and we can do */
sctp_send_asconf(stcb, alt, SCTP_ADDR_NOT_LOCKED);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317591 - head/sys/dev/drm2/radeon

2017-04-29 Thread Takahashi Yoshihiro
Author: nyan
Date: Sat Apr 29 09:47:15 2017
New Revision: 317591
URL: https://svnweb.freebsd.org/changeset/base/317591

Log:
  Add TUNABLE_INT to radeonkms driver parameters.
  They are required by PowerMac G5 DP.
  
  PR:   217852
  Submitted by: Hiroo Ono
  MFC after:1 week

Modified:
  head/sys/dev/drm2/radeon/radeon_drv.c

Modified: head/sys/dev/drm2/radeon/radeon_drv.c
==
--- head/sys/dev/drm2/radeon/radeon_drv.c   Sat Apr 29 09:26:30 2017
(r317590)
+++ head/sys/dev/drm2/radeon/radeon_drv.c   Sat Apr 29 09:47:15 2017
(r317591)
@@ -127,54 +127,71 @@ int radeon_pcie_gen2 = -1;
 int radeon_msi = -1;
 int radeon_lockup_timeout = 1;
 
+TUNABLE_INT("drm.radeon.no_wb", _no_wb);
 MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers");
 module_param_named(no_wb, radeon_no_wb, int, 0444);
 
+TUNABLE_INT("drm.radeon.modeset", _modeset);
 MODULE_PARM_DESC(modeset, "Disable/Enable modesetting");
 module_param_named(modeset, radeon_modeset, int, 0400);
 
+TUNABLE_INT("drm.radeon.dynclks", _dynclks);
 MODULE_PARM_DESC(dynclks, "Disable/Enable dynamic clocks");
 module_param_named(dynclks, radeon_dynclks, int, 0444);
 
+TUNABLE_INT("drm.radeon.r4xx_atom", _r4xx_atom);
 MODULE_PARM_DESC(r4xx_atom, "Enable ATOMBIOS modesetting for R4xx");
 module_param_named(r4xx_atom, radeon_r4xx_atom, int, 0444);
 
+TUNABLE_INT("drm.radeon.vramlimit", _vram_limit);
 MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing");
 module_param_named(vramlimit, radeon_vram_limit, int, 0600);
 
+TUNABLE_INT("drm.radeon.agpmode", _agpmode);
 MODULE_PARM_DESC(agpmode, "AGP Mode (-1 == PCI)");
 module_param_named(agpmode, radeon_agpmode, int, 0444);
 
+TUNABLE_INT("drm.radeon.gartsize", _gart_size);
 MODULE_PARM_DESC(gartsize, "Size of PCIE/IGP gart to setup in megabytes (32, 
64, etc)");
 module_param_named(gartsize, radeon_gart_size, int, 0600);
 
+TUNABLE_INT("drm.radeon.benchmark", _benchmarking);
 MODULE_PARM_DESC(benchmark, "Run benchmark");
 module_param_named(benchmark, radeon_benchmarking, int, 0444);
 
+TUNABLE_INT("drm.radeon.test", _testing);
 MODULE_PARM_DESC(test, "Run tests");
 module_param_named(test, radeon_testing, int, 0444);
 
+TUNABLE_INT("drm.radeon.connector_table", _connector_table);
 MODULE_PARM_DESC(connector_table, "Force connector table");
 module_param_named(connector_table, radeon_connector_table, int, 0444);
 
+TUNABLE_INT("drm.radeon.tv", _tv);
 MODULE_PARM_DESC(tv, "TV enable (0 = disable)");
 module_param_named(tv, radeon_tv, int, 0444);
 
+TUNABLE_INT("drm.radeon.audio", _audio);
 MODULE_PARM_DESC(audio, "Audio enable (1 = enable)");
 module_param_named(audio, radeon_audio, int, 0444);
 
+TUNABLE_INT("drm.radeon.disp_priority", _disp_priority);
 MODULE_PARM_DESC(disp_priority, "Display Priority (0 = auto, 1 = normal, 2 = 
high)");
 module_param_named(disp_priority, radeon_disp_priority, int, 0444);
 
+TUNABLE_INT("drm.radeon.hw_i2c", _hw_i2c);
 MODULE_PARM_DESC(hw_i2c, "hw i2c engine enable (0 = disable)");
 module_param_named(hw_i2c, radeon_hw_i2c, int, 0444);
 
+TUNABLE_INT("drm.radeon.pcie_gen2", _pcie_gen2);
 MODULE_PARM_DESC(pcie_gen2, "PCIE Gen2 mode (-1 = auto, 0 = disable, 1 = 
enable)");
 module_param_named(pcie_gen2, radeon_pcie_gen2, int, 0444);
 
+TUNABLE_INT("drm.radeon.msi", _msi);
 MODULE_PARM_DESC(msi, "MSI support (1 = enable, 0 = disable, -1 = auto)");
 module_param_named(msi, radeon_msi, int, 0444);
 
+TUNABLE_INT("drm.radeon.lockup_timeout", _lockup_timeout);
 MODULE_PARM_DESC(lockup_timeout, "GPU lockup timeout in ms (defaul 1 = 10 
seconds, 0 = disable)");
 module_param_named(lockup_timeout, radeon_lockup_timeout, int, 0444);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317586 - head/sys/net

2017-04-29 Thread Alexander Motin
Author: mav
Date: Sat Apr 29 08:52:07 2017
New Revision: 317586
URL: https://svnweb.freebsd.org/changeset/base/317586

Log:
  Make if_bridge complain if it can't disable some capabilities.
  
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/net/if_bridge.c

Modified: head/sys/net/if_bridge.c
==
--- head/sys/net/if_bridge.cSat Apr 29 08:28:59 2017(r317585)
+++ head/sys/net/if_bridge.cSat Apr 29 08:52:07 2017(r317586)
@@ -940,8 +940,12 @@ bridge_set_ifcap(struct bridge_softc *sc
error = (*ifp->if_ioctl)(ifp, SIOCSIFCAP, (caddr_t));
if (error)
if_printf(sc->sc_ifp,
-   "error setting interface capabilities on %s\n",
-   ifp->if_xname);
+   "error setting capabilities on %s: %d\n",
+   ifp->if_xname, error);
+   if ((ifp->if_capenable & ~set) != 0)
+   if_printf(sc->sc_ifp,
+   "can't disable some capabilities on %s: 0x%x\n",
+   ifp->if_xname, ifp->if_capenable & ~set);
}
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317585 - head/sys/net

2017-04-29 Thread Alexander Motin
Author: mav
Date: Sat Apr 29 08:28:59 2017
New Revision: 317585
URL: https://svnweb.freebsd.org/changeset/base/317585

Log:
  Propagate IFCAP_LRO from trunk to vlan interface.
  
  False positive here cost nothing, while false negative may lead to some
  confusions.
  
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/net/if_vlan.c

Modified: head/sys/net/if_vlan.c
==
--- head/sys/net/if_vlan.c  Sat Apr 29 07:59:09 2017(r317584)
+++ head/sys/net/if_vlan.c  Sat Apr 29 08:28:59 2017(r317585)
@@ -1591,6 +1591,16 @@ vlan_capabilities(struct ifvlan *ifv)
}
 
/*
+* If the parent interface can do LRO and checksum offloading on
+* VLANs, then guess it may do LRO on VLANs.  False positive here
+* cost nothing, while false negative may lead to some confusions.
+*/
+   if (p->if_capabilities & IFCAP_VLAN_HWCSUM)
+   cap |= p->if_capabilities & IFCAP_LRO;
+   if (p->if_capenable & IFCAP_VLAN_HWCSUM)
+   ena |= p->if_capenable & IFCAP_LRO;
+
+   /*
 * If the parent interface can offload TCP connections over VLANs then
 * propagate its TOE capability to the VLAN interface.
 *
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2017-04-29 Thread Hans Petter Selasky
Author: hselasky
Date: Sat Apr 29 07:59:09 2017
New Revision: 317584
URL: https://svnweb.freebsd.org/changeset/base/317584

Log:
  Correct manual page link to usbdi(9).
  
  MFC after:1 week

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

Modified: head/share/man/man4/usb.4
==
--- head/share/man/man4/usb.4   Sat Apr 29 06:41:51 2017(r317583)
+++ head/share/man/man4/usb.4   Sat Apr 29 07:59:09 2017(r317584)
@@ -144,7 +144,7 @@ specifications can be found at:
 .D1 Pa http://www.usb.org/developers/docs/
 .Pp
 .Xr libusb 3 ,
-.Xr usbdi 4 ,
+.Xr usbdi 9 ,
 .Xr aue 4 ,
 .Xr axe 4 ,
 .Xr axge 4 ,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317583 - in head: sys/dev/sound/pcm usr.bin/unexpand

2017-04-29 Thread Pedro F. Giffuni
Author: pfg
Date: Sat Apr 29 06:41:51 2017
New Revision: 317583
URL: https://svnweb.freebsd.org/changeset/base/317583

Log:
  Fix some cases where an index was used before its limits check.
  
  Obtained from:DragonFlyBSD (git 799ba435)
  MFC after:5 days

Modified:
  head/sys/dev/sound/pcm/feeder_matrix.c
  head/usr.bin/unexpand/unexpand.c

Modified: head/sys/dev/sound/pcm/feeder_matrix.c
==
--- head/sys/dev/sound/pcm/feeder_matrix.c  Sat Apr 29 06:33:37 2017
(r317582)
+++ head/sys/dev/sound/pcm/feeder_matrix.c  Sat Apr 29 06:41:51 2017
(r317583)
@@ -750,8 +750,8 @@ feeder_matrix_oss_get_channel_order(stru
 
tmpmap = 0xULL;
 
-   for (i = 0; m->map[i].type != SND_CHN_T_MAX &&
-   i < SND_CHN_OSS_MAX; i++) {
+   for (i = 0; i < SND_CHN_OSS_MAX && m->map[i].type != SND_CHN_T_MAX;
+   i++) {
if ((1 << m->map[i].type) & ~SND_CHN_OSS_VALIDMASK)
return (EINVAL);
tmpmap |=

Modified: head/usr.bin/unexpand/unexpand.c
==
--- head/usr.bin/unexpand/unexpand.cSat Apr 29 06:33:37 2017
(r317582)
+++ head/usr.bin/unexpand/unexpand.cSat Apr 29 06:41:51 2017
(r317583)
@@ -132,8 +132,8 @@ tabify(const char *curfile)
tabstops[0];
continue;
} else {
-   for (n = 0; tabstops[n] - 1 < dcol &&
-   n < nstops; n++)
+   for (n = 0; n < nstops &&
+   tabstops[n] - 1 < dcol; n++)
;
if (n < nstops - 1 && tabstops[n] - 1 < limit) {
dcol = tabstops[n];
@@ -154,7 +154,7 @@ tabify(const char *curfile)
tabstops[0];
}
} else {
-   for (n = 0; tabstops[n] - 1 < ocol && n < nstops; n++)
+   for (n = 0; n < nstops && tabstops[n] - 1 < ocol; n++)
;
while (ocol < dcol && n < nstops && ocol < limit) {
putwchar('\t');
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r317547 - head/sys/net

2017-04-29 Thread Alexander Motin
On 29.04.2017 05:16, Gleb Smirnoff wrote:
> On Fri, Apr 28, 2017 at 11:00:58AM +, Alexander Motin wrote:
> A> Author: mav
> A> Date: Fri Apr 28 11:00:58 2017
> A> New Revision: 317547
> A> URL: https://svnweb.freebsd.org/changeset/base/317547
> A> 
> A> Log:
> A>   Allow some control over enabled capabilities for if_vlan.
> A>   
> A>   It improves interoperability with if_bridge, which may need to disable
> A>   some capabilities not supported by other members.  IMHO there is still
> A>   open question about LRO capability, which may need to be disabled on
> A>   physical interface.
> A>   
> A>   MFC after:   2 weeks
> A>   Sponsored by:iXsystems, Inc.
> 
> On quick glance this looks like the opposite to what was done in r281885.
> 
> As discussed back 2 years ago:
> 
> - There are no NICs that are able to have different set of capabilities
> turned on on different VLANs, and unlikely such will appear.
> - Capabilities should be switched on VLAN trunk.
> - Allowing to switch capabilities on a VLAN with magical flip of properties
>   of all the VLANs on the same trunk is an ugly design. This is something
>   unexpected for a sysadmin. Better refuse that and make him toggle properties
>   on the trunk explicitily.

Thanks for looking.  I agree that all those arguments are valid for code
removed in r281885.  But if you look closer, my code is different.  In
its present state it does not propagate any capabilities change to the
trunk or other vlans, affecting only the specified vlan.

With my code there also may be some collisions, for example, if somebody
first disable capability X for vlanN and then enable Y for trunk, Y may
not get propagated to the vlanN since it wasn't present in the mask set
there while disabling X.  But I think it is a minor price to pay.

I've made additional experiments with LRO flag, and they shown me that
1) that flag should be passed through from trunk to vlans, and 2) I do
want to propagate that flag disable from vlan back to trunk, since its
absence or disable for vlan does not change anything -- trunk continues
feeding aggregated packets, which may not be welcome in case of later
bridging.  But I am not going to do it in so straightforward way it was
done there previous time, since it was clearly broken, for example, for
IFCAP_VLAN_HWTAGGING.

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