svn commit: r321717 - in stable/10: lib/libc/sys sys/sys sys/vm

2017-07-30 Thread Konstantin Belousov
Author: kib
Date: Sun Jul 30 10:36:20 2017
New Revision: 321717
URL: https://svnweb.freebsd.org/changeset/base/321717

Log:
  Merge MAP_GUARD.
  
  MFC r316687 (by markj), r320314, r320317, r320338, r320339, r320344, r320430,
  r320560 (by alc), r320801, r320843, r321173, r321230.
  
  Tested by:pho
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/lib/libc/sys/mmap.2
  stable/10/lib/libc/sys/munmap.2
  stable/10/sys/sys/mman.h
  stable/10/sys/sys/param.h
  stable/10/sys/vm/vm.h
  stable/10/sys/vm/vm_fault.c
  stable/10/sys/vm/vm_map.c
  stable/10/sys/vm/vm_map.h
  stable/10/sys/vm/vm_mmap.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/sys/mmap.2
==
--- stable/10/lib/libc/sys/mmap.2   Sun Jul 30 08:02:06 2017
(r321716)
+++ stable/10/lib/libc/sys/mmap.2   Sun Jul 30 10:36:20 2017
(r321717)
@@ -28,7 +28,7 @@
 .\"@(#)mmap.2  8.4 (Berkeley) 5/11/95
 .\" $FreeBSD$
 .\"
-.Dd September 17, 2014
+.Dd June 22, 2017
 .Dt MMAP 2
 .Os
 .Sh NAME
@@ -173,9 +173,21 @@ In contrast, if
 .Dv MAP_EXCL
 is specified, the request will fail if a mapping
 already exists within the range.
-.It Dv MAP_HASSEMAPHORE
-Notify the kernel that the region may contain semaphores and that special
-handling may be necessary.
+.It Dv MAP_GUARD
+Instead of a mapping, create a guard of the specified size.
+Guards allow a process to create reservations in its address space,
+which can later be replaced by actual mappings.
+.Pp
+.Fa mmap
+will not create mappings in the address range of a guard unless
+the request specifies
+.Dv MAP_FIXED .
+Guards can be destroyed with
+.Xr munmap 2 .
+Any memory access by a thread to the guarded range results
+in the delivery of a
+.Dv SIGSEGV
+signal to that thread.
 .It Dv MAP_NOCORE
 Region is not included in a core file.
 .It Dv MAP_NOSYNC
@@ -278,6 +290,7 @@ must include at least
 .Dv PROT_READ
 and
 .Dv PROT_WRITE .
+.Pp
 This option creates
 a memory region that grows to at most
 .Fa len
@@ -288,6 +301,12 @@ stack top is the starting address returned by the call
 bytes.
 The bottom of the stack at maximum growth is the starting
 address returned by the call.
+.Pp
+Stacks created with
+.Dv MAP_STACK
+automatically grow.
+Guards prevent inadvertent use of the regions into which those
+stacks can grow without requiring mapping the whole stack in advance.
 .El
 .Pp
 The
@@ -375,6 +394,7 @@ were specified.
 .It Bq Er EINVAL
 None of
 .Dv MAP_ANON ,
+.Dv MAP_GUARD ,
 .Dv MAP_PRIVATE ,
 .Dv MAP_SHARED ,
 or
@@ -424,6 +444,25 @@ were specified, but the requested region is already us
 was specified, but
 .Dv MAP_FIXED
 was not.
+.It Bq Er EINVAL
+.Dv MAP_GUARD
+was specified, but the
+.Fa offset
+argument was not zero, the
+.Fa fd
+argument was not -1, or the
+.Fa prot
+argument was not
+.Dv PROT_NONE .
+.It Bq Er EINVAL
+.Dv MAP_GUARD
+was specified together with one of the flags
+.Dv MAP_ANON ,
+.Dv MAP_PREFAULT ,
+.Dv MAP_PREFAULT_READ ,
+.Dv MAP_PRIVATE ,
+.Dv MAP_SHARED ,
+.Dv MAP_STACK .
 .It Bq Er ENODEV
 .Dv MAP_ANON
 has not been specified and

Modified: stable/10/lib/libc/sys/munmap.2
==
--- stable/10/lib/libc/sys/munmap.2 Sun Jul 30 08:02:06 2017
(r321716)
+++ stable/10/lib/libc/sys/munmap.2 Sun Jul 30 10:36:20 2017
(r321717)
@@ -28,7 +28,7 @@
 .\"@(#)munmap.28.3 (Berkeley) 5/27/94
 .\" $FreeBSD$
 .\"
-.Dd May 27, 1994
+.Dd June 22, 2017
 .Dt MUNMAP 2
 .Os
 .Sh NAME
@@ -44,7 +44,7 @@
 The
 .Fn munmap
 system call
-deletes the mappings for the specified address range,
+deletes the mappings and guards for the specified address range,
 and causes further references to addresses within the range
 to generate invalid memory references.
 .Sh RETURN VALUES

Modified: stable/10/sys/sys/mman.h
==
--- stable/10/sys/sys/mman.hSun Jul 30 08:02:06 2017(r321716)
+++ stable/10/sys/sys/mman.hSun Jul 30 10:36:20 2017(r321717)
@@ -90,6 +90,7 @@
 /*
  * Extended flags
  */
+#defineMAP_GUARD0x2000 /* reserve but don't map address 
range */
 #defineMAP_EXCL 0x4000 /* for MAP_FIXED, fail if address 
is used */
 #defineMAP_NOCORE   0x0002 /* dont include these pages in a 
coredump */
 #defineMAP_PREFAULT_READ 0x0004 /* prefault mapping for reading */

Modified: stable/10/sys/sys/param.h
==
--- stable/10/sys/sys/param.h   Sun Jul 30 08:02:06 2017(r321716)
+++ stable/10/sys/sys/param.h   Sun Jul 30 10:36:20 2017(r321717)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1003515  /* Master, propagated to newvers */
+#define __FreeBSD_version

svn commit: r321718 - stable/10/sys/vm

2017-07-30 Thread Konstantin Belousov
Author: kib
Date: Sun Jul 30 10:49:13 2017
New Revision: 321718
URL: https://svnweb.freebsd.org/changeset/base/321718

Log:
  Restore layout of struct vm_map_entry after r321717, same as was done
  in r320889 for stable/11.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/sys/vm/vm_map.h

Modified: stable/10/sys/vm/vm_map.h
==
--- stable/10/sys/vm/vm_map.h   Sun Jul 30 10:36:20 2017(r321717)
+++ stable/10/sys/vm/vm_map.h   Sun Jul 30 10:49:13 2017(r321718)
@@ -103,6 +103,7 @@ struct vm_map_entry {
struct vm_map_entry *right; /* right child in binary search tree */
vm_offset_t start;  /* start address */
vm_offset_t end;/* end address */
+   vm_offset_t pad0;
vm_size_t adj_free; /* amount of adjacent free space */
vm_size_t max_free; /* max free space in subtree */
union vm_map_object object; /* object I point to */
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r321725 - stable/10/sys/net80211

2017-07-30 Thread Andriy Voskoboinyk
Author: avos
Date: Sun Jul 30 18:38:05 2017
New Revision: 321725
URL: https://svnweb.freebsd.org/changeset/base/321725

Log:
  MFC r321401:
  net80211: do not allow to unload rate control module if it is still in use.
  
  Keep 'nrefs' counter up-to-date, so 'kldunload wlan_amrr' with 1+ active
  wlan(4) interface will not lead to kernel panic.

Modified:
  stable/10/sys/net80211/ieee80211_amrr.c
  stable/10/sys/net80211/ieee80211_rssadapt.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/net80211/ieee80211_amrr.c
==
--- stable/10/sys/net80211/ieee80211_amrr.c Sun Jul 30 18:29:28 2017
(r321724)
+++ stable/10/sys/net80211/ieee80211_amrr.c Sun Jul 30 18:38:05 2017
(r321725)
@@ -111,6 +111,7 @@ amrr_init(struct ieee80211vap *vap)
 
KASSERT(vap->iv_rs == NULL, ("%s called multiple times", __func__));
 
+   nrefs++;/* XXX locking */
amrr = vap->iv_rs = malloc(sizeof(struct ieee80211_amrr),
M_80211_RATECTL, M_NOWAIT|M_ZERO);
if (amrr == NULL) {
@@ -127,6 +128,8 @@ static void
 amrr_deinit(struct ieee80211vap *vap)
 {
free(vap->iv_rs, M_80211_RATECTL);
+   KASSERT(nrefs > 0, ("imbalanced attach/detach"));
+   nrefs--;/* XXX locking */
 }
 
 static int

Modified: stable/10/sys/net80211/ieee80211_rssadapt.c
==
--- stable/10/sys/net80211/ieee80211_rssadapt.c Sun Jul 30 18:29:28 2017
(r321724)
+++ stable/10/sys/net80211/ieee80211_rssadapt.c Sun Jul 30 18:38:05 2017
(r321725)
@@ -127,7 +127,8 @@ rssadapt_init(struct ieee80211vap *vap)
 
KASSERT(vap->iv_rs == NULL, ("%s: iv_rs already initialized",
__func__));
-   
+
+   nrefs++;/* XXX locking */
vap->iv_rs = rs = malloc(sizeof(struct ieee80211_rssadapt),
M_80211_RATECTL, M_NOWAIT|M_ZERO);
if (rs == NULL) {
@@ -143,6 +144,8 @@ static void
 rssadapt_deinit(struct ieee80211vap *vap)
 {
free(vap->iv_rs, M_80211_RATECTL);
+   KASSERT(nrefs > 0, ("imbalanced attach/detach"));
+   nrefs--;/* XXX locking */
 }
 
 static void
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r321740 - stable/10/sys/dev/ksyms

2017-07-30 Thread Mark Johnston
Author: markj
Date: Mon Jul 31 00:39:22 2017
New Revision: 321740
URL: https://svnweb.freebsd.org/changeset/base/321740

Log:
  MFC r321639:
  Restrict permissions on /dev/ksyms to 0400.

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

Modified: stable/10/sys/dev/ksyms/ksyms.c
==
--- stable/10/sys/dev/ksyms/ksyms.c Mon Jul 31 00:35:21 2017
(r321739)
+++ stable/10/sys/dev/ksyms/ksyms.c Mon Jul 31 00:39:22 2017
(r321740)
@@ -592,7 +592,7 @@ ksyms_modevent(module_t mod __unused, int type, void *
case MOD_LOAD:
mtx_init(&ksyms_mtx, "KSyms mtx", NULL, MTX_DEF);
ksyms_dev = make_dev(&ksyms_cdevsw, 0, UID_ROOT, GID_WHEEL,
-   0444, KSYMS_DNAME);
+   0400, KSYMS_DNAME);
break;
 
case MOD_UNLOAD:
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r321742 - stable/10/sys/dev/ksyms

2017-07-30 Thread Mark Johnston
Author: markj
Date: Mon Jul 31 00:41:05 2017
New Revision: 321742
URL: https://svnweb.freebsd.org/changeset/base/321742

Log:
  MFC r321640:
  Fix style bugs in ksyms.c.

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

Modified: stable/10/sys/dev/ksyms/ksyms.c
==
--- stable/10/sys/dev/ksyms/ksyms.c Mon Jul 31 00:40:14 2017
(r321741)
+++ stable/10/sys/dev/ksyms/ksyms.c Mon Jul 31 00:41:05 2017
(r321742)
@@ -62,41 +62,40 @@
 
 #define STR_SYMTAB ".symtab"
 #define STR_STRTAB ".strtab"
-#define STR_SHSTRTAB   ".shstrtab" 
+#define STR_SHSTRTAB   ".shstrtab"
 
 #define KSYMS_DNAME"ksyms"
 
-static d_open_tksyms_open;
-static d_read_tksyms_read;
-static d_close_t   ksyms_close;
-static d_ioctl_t   ksyms_ioctl;
-static d_mmap_tksyms_mmap;
+static d_open_t ksyms_open;
+static d_read_t ksyms_read;
+static d_close_t ksyms_close;
+static d_ioctl_t ksyms_ioctl;
+static d_mmap_t ksyms_mmap;
 
 static struct cdevsw ksyms_cdevsw = {
-.d_version =   D_VERSION,
-.d_flags   =   D_TRACKCLOSE,
-.d_open=   ksyms_open,
-.d_close   =   ksyms_close,
-.d_read=   ksyms_read,
-.d_ioctl   =   ksyms_ioctl,
-.d_mmap=   ksyms_mmap,
-.d_name=   KSYMS_DNAME 
+   .d_version =D_VERSION,
+   .d_flags =  D_TRACKCLOSE,
+   .d_open =   ksyms_open,
+   .d_close =  ksyms_close,
+   .d_read =   ksyms_read,
+   .d_ioctl =  ksyms_ioctl,
+   .d_mmap =   ksyms_mmap,
+   .d_name =   KSYMS_DNAME
 };
 
 struct ksyms_softc {
LIST_ENTRY(ksyms_softc) sc_list;
-   vm_offset_t sc_uaddr;
-   size_t  sc_usize;
+   vm_offset_t sc_uaddr;
+   size_t  sc_usize;
pmap_t  sc_pmap;
struct proc*sc_proc;
 };
 
-static struct mtx   ksyms_mtx;
-static struct cdev *ksyms_dev;
-static LIST_HEAD(, ksyms_softc) ksyms_list = 
-   LIST_HEAD_INITIALIZER(ksyms_list);
+static struct mtx   ksyms_mtx;
+static struct cdev *ksyms_dev;
+static LIST_HEAD(, ksyms_softc) ksyms_list = 
LIST_HEAD_INITIALIZER(ksyms_list);
 
-static const char  ksyms_shstrtab[] = 
+static const char  ksyms_shstrtab[] =
"\0" STR_SYMTAB "\0" STR_STRTAB "\0" STR_SHSTRTAB "\0";
 
 struct ksyms_hdr {
@@ -106,7 +105,7 @@ struct ksyms_hdr {
Elf_Shdrkh_shdr[SHDR_NUM];
charkh_shstrtab[sizeof(ksyms_shstrtab)];
 };
-   
+
 struct tsizes {
size_t  ts_symsz;
size_t  ts_strsz;
@@ -123,7 +122,7 @@ static MALLOC_DEFINE(M_KSYMS, "KSYMS", "Kernel Symbol 
 
 /*
  * Get the symbol and string table sizes for a kernel module. Add it to the
- * running total. 
+ * running total.
  */
 static int
 ksyms_size_permod(linker_file_t lf, void *arg)
@@ -132,35 +131,36 @@ ksyms_size_permod(linker_file_t lf, void *arg)
const Elf_Sym *symtab;
caddr_t strtab;
long syms;
-   
+
ts = arg;
-
+
syms = LINKER_SYMTAB_GET(lf, &symtab);
ts->ts_symsz += syms * sizeof(Elf_Sym);
ts->ts_strsz += LINKER_STRTAB_GET(lf, &strtab);
-   
+
return (0);
 }
 
 /*
  * For kernel module get the symbol and string table sizes, returning the
- * totals in *ts. 
+ * totals in *ts.
  */
-static void 
+static void
 ksyms_size_calc(struct tsizes *ts)
 {
+
ts->ts_symsz = 0;
ts->ts_strsz = 0;
-
-   (void) linker_file_foreach(ksyms_size_permod, ts);
+
+   (void)linker_file_foreach(ksyms_size_permod, ts);
 }
 
-#define KSYMS_EMIT(src, des, sz) do {  \
-   copyout(src, (void *)des, sz);  \
-   des += sz;  \
-   } while (0)
+#define KSYMS_EMIT(src, des, sz) do {  \
+   copyout(src, (void *)des, sz);  \
+   des += sz;  \
+} while (0)
 
-#define SYMBLKSZ   256 * sizeof (Elf_Sym)
+#define SYMBLKSZ   (256 * sizeof(Elf_Sym))
 
 /*
  * For a kernel module, add the symbol and string tables into the
@@ -169,6 +169,7 @@ ksyms_size_calc(struct tsizes *ts)
 static int
 ksyms_add(linker_file_t lf, void *arg)
 {
+   char *buf;
struct toffsets *to;
const Elf_Sym *symtab;
Elf_Sym *symp;
@@ -176,43 +177,42 @@ ksyms_add(linker_file_t lf, void *arg)
long symsz;
size_t strsz, numsyms;
linker_symval_t symval;
-   char *buf;
int i, nsyms, len;
-   
+
to = arg;
-
+
MOD_SLOCK;
numsyms =  LINKER_SYMTAB_GET(lf, &symtab);
strsz = LINKER_STRTAB_GET(lf, &strtab);
symsz = numsyms * sizeof(Elf_Sym);
-

svn commit: r321752 - stable/10/sys/net

2017-07-30 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Jul 31 03:49:08 2017
New Revision: 321752
URL: https://svnweb.freebsd.org/changeset/base/321752

Log:
  MFC 321406
  
  ethernet: Add ethernet interface attached event and devctl notification.
  
  ifnet_arrival_event may not be adequate under certain situation; e.g.
  when the LLADDR is needed.  So the ethernet ifattach event is announced
  after all necessary bits are setup.
  
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D11617

Modified:
  stable/10/sys/net/ethernet.h
  stable/10/sys/net/if_ethersubr.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/net/ethernet.h
==
--- stable/10/sys/net/ethernet.hMon Jul 31 03:19:16 2017
(r321751)
+++ stable/10/sys/net/ethernet.hMon Jul 31 03:49:08 2017
(r321752)
@@ -384,6 +384,12 @@ void   ether_vlan_mtap(struct bpf_if *, struct mbuf *,
void *, u_int);
 struct mbuf  *ether_vlanencap(struct mbuf *, uint16_t);
 
+#ifdef SYS_EVENTHANDLER_H
+/* new ethernet interface attached event */
+typedef void (*ether_ifattach_event_handler_t)(void *, struct ifnet *);
+EVENTHANDLER_DECLARE(ether_ifattach_event, ether_ifattach_event_handler_t);
+#endif
+
 #else /* _KERNEL */
 
 #include 

Modified: stable/10/sys/net/if_ethersubr.c
==
--- stable/10/sys/net/if_ethersubr.cMon Jul 31 03:19:16 2017
(r321751)
+++ stable/10/sys/net/if_ethersubr.cMon Jul 31 03:49:08 2017
(r321752)
@@ -39,6 +39,8 @@
 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -933,6 +935,11 @@ ether_ifattach(struct ifnet *ifp, const u_int8_t *lla)
if_printf(ifp, "Ethernet address: %6D\n", lla, ":");
 
uuid_ether_add(LLADDR(sdl));
+
+   /* Add necessary bits are setup; announce it now. */
+   EVENTHANDLER_INVOKE(ether_ifattach_event, ifp);
+   if (IS_DEFAULT_VNET(curvnet))
+   devctl_notify("ETHERNET", ifp->if_xname, "IFATTACH", NULL);
 }
 
 /*
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r321753 - in stable/10/share/examples/tests/tests: atf plain

2017-07-30 Thread Ngie Cooper
Author: ngie
Date: Mon Jul 31 03:57:45 2017
New Revision: 321753
URL: https://svnweb.freebsd.org/changeset/base/321753

Log:
  MFC Note: ${FILES} documentation change omitted since r299094 will
not be MFCed to ^/stable/10 .
  
  MFC r320442:
  
  share/examples/tests/{atf,plain}/Makefile: tweak example Makefile snippets
  
  - Including bsd.own.mk isn't required since no MK_ knobs are being
manipulated.
  - Update documentation to note that ${FILES} is installed via bsd.progs.mk,
not bsd.prog.mk.

Modified:
  stable/10/share/examples/tests/tests/atf/Makefile
  stable/10/share/examples/tests/tests/plain/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/examples/tests/tests/atf/Makefile
==
--- stable/10/share/examples/tests/tests/atf/Makefile   Mon Jul 31 03:49:08 
2017(r321752)
+++ stable/10/share/examples/tests/tests/atf/Makefile   Mon Jul 31 03:57:45 
2017(r321753)
@@ -1,7 +1,5 @@
 # $FreeBSD$
 
-.include 
-
 # Directory into which the Kyuafile provided by this directory will be
 # installed.
 #

Modified: stable/10/share/examples/tests/tests/plain/Makefile
==
--- stable/10/share/examples/tests/tests/plain/Makefile Mon Jul 31 03:49:08 
2017(r321752)
+++ stable/10/share/examples/tests/tests/plain/Makefile Mon Jul 31 03:57:45 
2017(r321753)
@@ -1,7 +1,5 @@
 # $FreeBSD$
 
-.include 
-
 # Directory into which the Kyuafile provided by this directory will be
 # installed.
 #
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r321755 - in stable/10: contrib/atf/atf-sh libexec/atf/atf-sh

2017-07-30 Thread Ngie Cooper
Author: ngie
Date: Mon Jul 31 03:59:07 2017
New Revision: 321755
URL: https://svnweb.freebsd.org/changeset/base/321755

Log:
  MFC r320491:
  
  atf-sh(3): document atf_init_test_cases(3) fully
  
  The function was missing from the NAME/SYNOPSIS sections. Add a manpage link
  to complete the documentation reference.

Modified:
  stable/10/contrib/atf/atf-sh/atf-sh.3
  stable/10/libexec/atf/atf-sh/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/contrib/atf/atf-sh/atf-sh.3
==
--- stable/10/contrib/atf/atf-sh/atf-sh.3   Mon Jul 31 03:58:58 2017
(r321754)
+++ stable/10/contrib/atf/atf-sh/atf-sh.3   Mon Jul 31 03:59:07 2017
(r321755)
@@ -40,6 +40,7 @@
 .Nm atf_fail ,
 .Nm atf_get ,
 .Nm atf_get_srcdir ,
+.Nm atf_init_test_cases ,
 .Nm atf_pass ,
 .Nm atf_require_prog ,
 .Nm atf_set ,
@@ -82,6 +83,8 @@
 .Nm atf_get
 .Qq var_name
 .Nm atf_get_srcdir
+.Nm atf_init_test_cases
+.Qq name
 .Nm atf_pass
 .Nm atf_require_prog
 .Qq prog_name

Modified: stable/10/libexec/atf/atf-sh/Makefile
==
--- stable/10/libexec/atf/atf-sh/Makefile   Mon Jul 31 03:58:58 2017
(r321754)
+++ stable/10/libexec/atf/atf-sh/Makefile   Mon Jul 31 03:59:07 2017
(r321755)
@@ -51,6 +51,7 @@ MLINKS+=  \
atf-sh.3 atf_fail.3 \
atf-sh.3 atf_get.3 \
atf-sh.3 atf_get_srcdir.3 \
+   atf-sh.3 atf_init_test_cases.3 \
atf-sh.3 atf_pass.3 \
atf-sh.3 atf_require_prog.3 \
atf-sh.3 atf_set.3 \
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r321759 - stable/10/sys/dev/hyperv/netvsc

2017-07-30 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Jul 31 06:27:43 2017
New Revision: 321759
URL: https://svnweb.freebsd.org/changeset/base/321759

Log:
  MFC 321407
  
  hyperv/hn: Export VF list and VF-HN mapping
  
  The VF-HN map will be used later on to implement "transparent VF".
  
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D11618

Modified:
  stable/10/sys/dev/hyperv/netvsc/if_hn.c
  stable/10/sys/dev/hyperv/netvsc/if_hnvar.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/hyperv/netvsc/if_hn.c
==
--- stable/10/sys/dev/hyperv/netvsc/if_hn.c Mon Jul 31 05:23:32 2017
(r321758)
+++ stable/10/sys/dev/hyperv/netvsc/if_hn.c Mon Jul 31 06:27:43 2017
(r321759)
@@ -69,6 +69,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -118,6 +120,8 @@ __FBSDID("$FreeBSD$");
 
 #define HN_RING_CNT_DEF_MAX8
 
+#define HN_VFMAP_SIZE_DEF  8
+
 /* YYY should get it from the underlying channel */
 #define HN_TX_DESC_CNT 512
 
@@ -250,6 +254,11 @@ static int hn_ifmedia_upd(struct ifnet *);
 static voidhn_ifmedia_sts(struct ifnet *,
struct ifmediareq *);
 
+static voidhn_ifnet_event(void *, struct ifnet *, int);
+static voidhn_ifaddr_event(void *, struct ifnet *);
+static voidhn_ifnet_attevent(void *, struct ifnet *);
+static voidhn_ifnet_detevent(void *, struct ifnet *);
+
 static int hn_rndis_rxinfo(const void *, int,
struct hn_rxinfo *);
 static voidhn_rndis_rx_data(struct hn_rx_ring *,
@@ -296,6 +305,9 @@ static int  
hn_txagg_pktmax_sysctl(SYSCTL_HANDLER_ARG
 static int hn_txagg_align_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_polling_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_vf_sysctl(SYSCTL_HANDLER_ARGS);
+static int hn_rxvf_sysctl(SYSCTL_HANDLER_ARGS);
+static int hn_vflist_sysctl(SYSCTL_HANDLER_ARGS);
+static int hn_vfmap_sysctl(SYSCTL_HANDLER_ARGS);
 
 static voidhn_stop(struct hn_softc *, bool);
 static voidhn_init_locked(struct hn_softc *);
@@ -493,9 +505,21 @@ static int hn_tx_agg_pkts = -1;
 SYSCTL_INT(_hw_hn, OID_AUTO, tx_agg_pkts, CTLFLAG_RDTUN,
 &hn_tx_agg_pkts, 0, "Packet transmission aggregation packet limit");
 
+/* VF list */
+SYSCTL_PROC(_hw_hn, OID_AUTO, vflist, CTLFLAG_RD | CTLTYPE_STRING,
+0, 0, hn_vflist_sysctl, "A", "VF list");
+
+/* VF mapping */
+SYSCTL_PROC(_hw_hn, OID_AUTO, vfmap, CTLFLAG_RD | CTLTYPE_STRING,
+0, 0, hn_vfmap_sysctl, "A", "VF mapping");
+
 static u_int   hn_cpu_index;   /* next CPU for channel */
 static struct taskqueue**hn_tx_taskque;/* shared TX taskqueues 
*/
 
+static struct rmlock   hn_vfmap_lock;
+static int hn_vfmap_size;
+static struct ifnet**hn_vfmap;
+
 static const uint8_t
 hn_rss_key_default[NDIS_HASH_KEYSIZE_TOEPLITZ] = {
0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2,
@@ -958,7 +982,7 @@ hn_update_vf_task(void *arg, int pending __unused)
 {
struct hn_update_vf *uv = arg;
 
-   uv->rxr->hn_vf = uv->vf;
+   uv->rxr->hn_rxvf_ifp = uv->vf;
 }
 
 static void
@@ -981,37 +1005,50 @@ hn_update_vf(struct hn_softc *sc, struct ifnet *vf)
uv.vf = vf;
vmbus_chan_run_task(rxr->hn_chan, &task);
} else {
-   rxr->hn_vf = vf;
+   rxr->hn_rxvf_ifp = vf;
}
}
 }
 
-static void
-hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool vf)
+static __inline bool
+hn_ismyvf(const struct hn_softc *sc, const struct ifnet *ifp)
 {
-   struct ifnet *hn_ifp;
+   const struct ifnet *hn_ifp;
 
-   HN_LOCK(sc);
-
-   if (!(sc->hn_flags & HN_FLAG_SYNTH_ATTACHED))
-   goto out;
-
hn_ifp = sc->hn_ifp;
 
if (ifp == hn_ifp)
-   goto out;
+   return (false);
 
if (ifp->if_alloctype != IFT_ETHER)
-   goto out;
+   return (false);
 
/* Ignore lagg/vlan interfaces */
if (strcmp(ifp->if_dname, "lagg") == 0 ||
strcmp(ifp->if_dname, "vlan") == 0)
-   goto out;
+   return (false);
 
if (bcmp(IF_LLADDR(ifp), IF_LLADDR(hn_ifp), ETHER_ADDR_LEN) != 0)
+   return (false);
+
+   return (true);
+}
+
+static void
+hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool vf)
+{
+   struct ifnet *hn_ifp;
+
+   HN_LOCK(sc);
+
+ 

svn commit: r321760 - stable/10/sys/net

2017-07-30 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Jul 31 06:40:09 2017
New Revision: 321760
URL: https://svnweb.freebsd.org/changeset/base/321760

Log:
  MFC 321408
  
  rndis: Add LINK_SPEED_CHANGE status
  
  Reviewed by:hselasky
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D11650

Modified:
  stable/10/sys/net/rndis.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/net/rndis.h
==
--- stable/10/sys/net/rndis.h   Mon Jul 31 06:27:43 2017(r321759)
+++ stable/10/sys/net/rndis.h   Mon Jul 31 06:40:09 2017(r321760)
@@ -31,6 +31,7 @@
 #defineRNDIS_STATUS_PENDING0x0103L
 #defineRNDIS_STATUS_MEDIA_CONNECT  0x4001000BL
 #defineRNDIS_STATUS_MEDIA_DISCONNECT   0x4001000CL
+#defineRNDIS_STATUS_LINK_SPEED_CHANGE  0x40010013L
 #defineRNDIS_STATUS_NETWORK_CHANGE 0x40010018L
 #defineRNDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG0x40020006L
 #defineRNDIS_STATUS_BUFFER_OVERFLOW0x8005L
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r321761 - stable/10/sys/dev/hyperv/netvsc

2017-07-30 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Jul 31 06:53:43 2017
New Revision: 321761
URL: https://svnweb.freebsd.org/changeset/base/321761

Log:
  MFC 321409
  
  hyperv/hn: Ignore LINK_SPEED_CHANGE status.
  
  This status will be reported if the backend NIC is wireless; it's not
  useful.  Due to the high frequency of the reporting, this could be
  pretty annoying; ignore it.
  
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D11651

Modified:
  stable/10/sys/dev/hyperv/netvsc/if_hn.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/hyperv/netvsc/if_hn.c
==
--- stable/10/sys/dev/hyperv/netvsc/if_hn.c Mon Jul 31 06:40:09 2017
(r321760)
+++ stable/10/sys/dev/hyperv/netvsc/if_hn.c Mon Jul 31 06:53:43 2017
(r321761)
@@ -5526,6 +5526,7 @@ hn_rndis_rx_status(struct hn_softc *sc, const void *da
break;
 
case RNDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG:
+   case RNDIS_STATUS_LINK_SPEED_CHANGE:
/* Not really useful; ignore. */
break;
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"