svn commit: r311968 - head/contrib/netbsd-tests/lib/libc/sys

2017-01-12 Thread Ngie Cooper
Author: ngie
Date: Thu Jan 12 08:31:42 2017
New Revision: 311968
URL: https://svnweb.freebsd.org/changeset/base/311968

Log:
  Fix lib/libc/sys/access_test after r311925
  
  sys/param.h needs to be #included in order for __FreeBSD_version to be checked
  
  MFC after:13 days

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_access.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_access.c
==
--- head/contrib/netbsd-tests/lib/libc/sys/t_access.c   Thu Jan 12 08:12:11 
2017(r311967)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_access.c   Thu Jan 12 08:31:42 
2017(r311968)
@@ -1,4 +1,4 @@
-/* $NetBSD: t_access.c,v 1.2 2017/01/10 22:36:29 christos Exp $ */
+/* $NetBSD: t_access.c,v 2.2 2017/01/10 22:36:29 christos Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -31,6 +31,10 @@
 #include 
 __RCSID("$NetBSD: t_access.c,v 1.2 2017/01/10 22:36:29 christos Exp $");
 
+#ifdef __FreeBSD__
+#include  /* For __FreeBSD_version */
+#endif
+
 #include 
 
 #include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r311969 - in head: contrib/netbsd-tests/lib/libc/stdlib lib/libc/tests/stdlib

2017-01-12 Thread Ngie Cooper
Author: ngie
Date: Thu Jan 12 08:40:52 2017
New Revision: 311969
URL: https://svnweb.freebsd.org/changeset/base/311969

Log:
  Remove __HAVE_LONG_DOUBLE #define from t_strtod.c and place it in Makefile
  
  This is to enable support in other testcases
  
  Inspired by lib/msun/tests/Makefile .
  
  MFC after:1 week

Modified:
  head/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c
  head/lib/libc/tests/stdlib/Makefile

Modified: head/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c
==
--- head/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.cThu Jan 12 
08:31:42 2017(r311968)
+++ head/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.cThu Jan 12 
08:40:52 2017(r311969)
@@ -51,10 +51,6 @@ static const char * const inf_strings[] 
 const char *nan_string = "NaN(x)y";
 #endif
 
-#ifdef __FreeBSD__
-#define __HAVE_LONG_DOUBLE
-#endif
-
 ATF_TC(strtod_basic);
 ATF_TC_HEAD(strtod_basic, tc)
 {

Modified: head/lib/libc/tests/stdlib/Makefile
==
--- head/lib/libc/tests/stdlib/Makefile Thu Jan 12 08:31:42 2017
(r311968)
+++ head/lib/libc/tests/stdlib/Makefile Thu Jan 12 08:40:52 2017
(r311969)
@@ -11,6 +11,14 @@ ATF_TESTS_CXX+=  cxa_thread_atexit_test
 ATF_TESTS_CXX+=cxa_thread_atexit_nothr_test
 .endif
 
+# Not sure why this isn't defined for all architectures, since most
+# have long double.
+.if ${MACHINE_CPUARCH} == "aarch64" || \
+${MACHINE_CPUARCH} == "amd64" || \
+${MACHINE_CPUARCH} == "i386"
+CFLAGS+=   -D__HAVE_LONG_DOUBLE
+.endif
+
 # TODO: t_getenv_thread, t_mi_vector_hash, t_strtoi
 NETBSD_ATF_TESTS_C+=   abs_test
 NETBSD_ATF_TESTS_C+=   atoi_test
___
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: r311971 - in head/sys: cam/nvme dev/mmc dev/nand dev/nvd geom

2017-01-12 Thread Alexander Motin
Author: mav
Date: Thu Jan 12 08:53:10 2017
New Revision: 311971
URL: https://svnweb.freebsd.org/changeset/base/311971

Log:
  Report random flash storage as non-rotating to GEOM_DISK.
  
  While doing it, introduce respective constants in geom_disk.h.
  
  MFC after:1 week

Modified:
  head/sys/cam/nvme/nvme_da.c
  head/sys/dev/mmc/mmcsd.c
  head/sys/dev/nand/nand_geom.c
  head/sys/dev/nvd/nvd.c
  head/sys/geom/geom_disk.c
  head/sys/geom/geom_disk.h

Modified: head/sys/cam/nvme/nvme_da.c
==
--- head/sys/cam/nvme/nvme_da.c Thu Jan 12 08:46:19 2017(r311970)
+++ head/sys/cam/nvme/nvme_da.c Thu Jan 12 08:53:10 2017(r311971)
@@ -761,7 +761,7 @@ ndaregister(struct cam_periph *periph, v
MIN(sizeof(softc->disk->d_descr), sizeof(cd->mn)));
strlcpy(softc->disk->d_ident, cd->sn,
MIN(sizeof(softc->disk->d_ident), sizeof(cd->sn)));
-   disk->d_rotation_rate = 0;  /* Spinning rust need not apply */
+   disk->d_rotation_rate = DISK_RR_NON_ROTATING;
disk->d_open = ndaopen;
disk->d_close = ndaclose;
disk->d_strategy = ndastrategy;

Modified: head/sys/dev/mmc/mmcsd.c
==
--- head/sys/dev/mmc/mmcsd.cThu Jan 12 08:46:19 2017(r311970)
+++ head/sys/dev/mmc/mmcsd.cThu Jan 12 08:53:10 2017(r311971)
@@ -170,6 +170,7 @@ mmcsd_attach(device_t dev)
d->d_delmaxsize = mmc_get_erase_sector(dev) * d->d_sectorsize;
strlcpy(d->d_ident, mmc_get_card_sn_string(dev), sizeof(d->d_ident));
strlcpy(d->d_descr, mmc_get_card_id_string(dev), sizeof(d->d_descr));
+   d->d_rotation_rate = DISK_RR_NON_ROTATING;
 
/*
 * Display in most natural units.  There's no cards < 1MB.  The SD

Modified: head/sys/dev/nand/nand_geom.c
==
--- head/sys/dev/nand/nand_geom.c   Thu Jan 12 08:46:19 2017
(r311970)
+++ head/sys/dev/nand/nand_geom.c   Thu Jan 12 08:53:10 2017
(r311971)
@@ -394,6 +394,7 @@ create_geom_disk(struct nand_chip *chip)
 
snprintf(ndisk->d_ident, sizeof(ndisk->d_ident),
"nand: Man:0x%02x Dev:0x%02x", chip->id.man_id, chip->id.dev_id);
+   ndisk->d_rotation_rate = DISK_RR_NON_ROTATING;
 
disk_create(ndisk, DISK_VERSION);
 
@@ -415,6 +416,7 @@ create_geom_disk(struct nand_chip *chip)
snprintf(rdisk->d_ident, sizeof(rdisk->d_ident),
"nand_raw: Man:0x%02x Dev:0x%02x", chip->id.man_id,
chip->id.dev_id);
+   disk->d_rotation_rate = DISK_RR_NON_ROTATING;
 
disk_create(rdisk, DISK_VERSION);
 

Modified: head/sys/dev/nvd/nvd.c
==
--- head/sys/dev/nvd/nvd.c  Thu Jan 12 08:46:19 2017(r311970)
+++ head/sys/dev/nvd/nvd.c  Thu Jan 12 08:53:10 2017(r311971)
@@ -352,13 +352,11 @@ nvd_new_disk(struct nvme_namespace *ns, 
 */
nvme_strvis(disk->d_ident, nvme_ns_get_serial_number(ns),
sizeof(disk->d_ident), NVME_SERIAL_NUMBER_LENGTH);
-
nvme_strvis(descr, nvme_ns_get_model_number(ns), sizeof(descr),
NVME_MODEL_NUMBER_LENGTH);
-
-#if __FreeBSD_version >= 900034
strlcpy(disk->d_descr, descr, sizeof(descr));
-#endif
+
+   disk->d_rotation_rate = DISK_RR_NON_ROTATING;
 
ndisk->ns = ns;
ndisk->disk = disk;

Modified: head/sys/geom/geom_disk.c
==
--- head/sys/geom/geom_disk.c   Thu Jan 12 08:46:19 2017(r311970)
+++ head/sys/geom/geom_disk.c   Thu Jan 12 08:53:10 2017(r311971)
@@ -588,12 +588,12 @@ g_disk_dumpconf(struct sbuf *sb, const c
 * special cases, and there's also a valid range.
 */
sbuf_printf(sb, "%s", indent);
-   if (dp->d_rotation_rate == 0)   /* Old drives don't */
-   sbuf_printf(sb, "unknown"); /* report RPM. */
-   else if (dp->d_rotation_rate == 1)  /* Since 0 is used */
-   sbuf_printf(sb, "0");   /* above, SSDs use 1. */
-   else if ((dp->d_rotation_rate >= 0x041) &&
-   (dp->d_rotation_rate <= 0xfffe))
+   if (dp->d_rotation_rate == DISK_RR_UNKNOWN) /* Old drives */
+   sbuf_printf(sb, "unknown"); /* don't report RPM. */
+   else if (dp->d_rotation_rate == DISK_RR_NON_ROTATING)
+   sbuf_printf(sb, "0");
+   else if ((dp->d_rotation_rate >= DISK_RR_MIN) &&
+   (dp->d_rotation_rate <= DISK_RR_MAX))
sbuf_printf(sb, "%u", dp->d_rotation_rate);
else
sbuf_printf(sb, "invalid");

Modified: head/sys/geom/

svn commit: r311972 - head/lib/libnetbsd/sys

2017-01-12 Thread Ngie Cooper
Author: ngie
Date: Thu Jan 12 09:01:14 2017
New Revision: 311972
URL: https://svnweb.freebsd.org/changeset/base/311972

Log:
  Add __BIT and __BITS macros from NetBSD to help support new testcases
  
  MFC after:1 week

Modified:
  head/lib/libnetbsd/sys/cdefs.h

Modified: head/lib/libnetbsd/sys/cdefs.h
==
--- head/lib/libnetbsd/sys/cdefs.h  Thu Jan 12 08:53:10 2017
(r311971)
+++ head/lib/libnetbsd/sys/cdefs.h  Thu Jan 12 09:01:14 2017
(r311972)
@@ -71,4 +71,13 @@
  */
 #define__arraycount(__x)   (sizeof(__x) / sizeof(__x[0]))
 
+/* __BIT(n): nth bit, where __BIT(0) == 0x1. */
+#define__BIT(__n)  \
+(((uintmax_t)(__n) >= NBBY * sizeof(uintmax_t)) ? 0 : \
+((uintmax_t)1 << (uintmax_t)((__n) & (NBBY * sizeof(uintmax_t) - 1
+
+/* __BITS(m, n): bits m through n, m < n. */
+#define__BITS(__m, __n)\
+   ((__BIT(MAX((__m), (__n)) + 1) - 1) ^ (__BIT(MIN((__m), (__n))) - 1))
+
 #endif /* _LIBNETBSD_SYS_CDEFS_H_ */
___
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: r311974 - head/sys/netinet

2017-01-12 Thread Maxim Sobolev
Author: sobomax
Date: Thu Jan 12 10:14:54 2017
New Revision: 311974
URL: https://svnweb.freebsd.org/changeset/base/311974

Log:
  Fix slight type mismatch between so_options defined in sys/socketvar.h
  and tw_so_options defined here which is supposed to be a copy of the
  former (short vs u_short respectively).
  
  Switch tw_so_options to be "signed short" to match the type of the field
  it's inherited from.

Modified:
  head/sys/netinet/tcp_var.h

Modified: head/sys/netinet/tcp_var.h
==
--- head/sys/netinet/tcp_var.h  Thu Jan 12 09:38:14 2017(r311973)
+++ head/sys/netinet/tcp_var.h  Thu Jan 12 10:14:54 2017(r311974)
@@ -452,7 +452,7 @@ struct tcptw {
tcp_seq iss;
tcp_seq irs;
u_short last_win;   /* cached window value */
-   u_short tw_so_options;  /* copy of so_options */
+   short   tw_so_options;  /* copy of so_options */
struct ucred*tw_cred;   /* user credentials */
u_int32_t   t_recent;
u_int32_t   ts_offset;  /* our timestamp offset */
___
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: r309124 - in head: . contrib/compiler-rt contrib/compiler-rt/include/sanitizer contrib/compiler-rt/lib/asan contrib/compiler-rt/lib/builtins contrib/compiler-rt/lib/builtins/arm contri

2017-01-12 Thread Conrad Meyer
This appears to have broken Chromium[0]:

FAILED: obj/services/ui/ws/lib/window_manager_display_root.o
clang++39 -MMD -MF
obj/services/ui/ws/lib/window_manager_display_root.o.d
-D_LIBCPP_TRIVIAL_PAIR_COPY_CTOR=1 -DV8_DEPRECATION_WARNINGS
-DENABLE_MDNS=1 -DENABLE_NOTIFICATIONS -DENABLE_PEPPER_CDMS
-DENABLE_PLUGINS=1 -DENABLE_PDF=1 -DENABLE_PRINTING=1
-DENABLE_BASIC_PRINTING=1 -DENABLE_PRINT_PREVIEW=1
-DENABLE_SPELLCHECK=1 -DUI_COMPOSITOR_IMAGE_TRANSPORT -DUSE_AURA=1
-DUSE_PANGO=1 -DUSE_CAIRO=1 -DUSE_CLIPBOARD_AURAX11=1
-DUSE_DEFAULT_RENDER_THEME=1 -DUSE_GLIB=1 -DUSE_NSS_CERTS=1
-DUSE_X11=1 -DNO_TCMALLOC -DENABLE_WEBRTC=1 -DDISABLE_NACL
-DENABLE_EXTENSIONS=1 -DENABLE_TASK_MANAGER=1 -DENABLE_THEMES=1
-DENABLE_CAPTIVE_PORTAL_DETECTION=1 -DENABLE_SESSION_SERVICE=1
-DENABLE_SUPERVISED_USERS=1 -DENABLE_SERVICE_DISCOVERY=1
-DUSE_PROPRIETARY_CODECS -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD
-DSAFE_BROWSING_DB_LOCAL -DCHROMIUM_BUILD -DENABLE_MEDIA_ROUTER=1
-DFIELDTRIAL_TESTING_ENABLED -DCR_CLANG_REVISION=278861-1
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2
-DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0
-DGL_GLEXT_PROTOTYPES -DUSE_GLX -DUSE_EGL -DSK_IGNORE_DW_GRAY_FIX
-DSK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS -DSK_SUPPORT_GPU=1
-DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DU_NOEXCEPT=
-DU_STATIC_IMPLEMENTATION -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE
-I../.. -Igen -I/usr/local/include/glib-2.0
-I/usr/local/lib/glib-2.0/include -I/usr/local/include
-Igen/shim_headers/harfbuzz_shim -I../../third_party/khronos
-I../../gpu -I../../skia/config -I../../skia/ext
-I../../third_party/skia/include/c
-I../../third_party/skia/include/config
-I../../third_party/skia/include/core
-I../../third_party/skia/include/effects
-I../../third_party/skia/include/images
-I../../third_party/skia/include/lazy
-I../../third_party/skia/include/pathops
-I../../third_party/skia/include/pdf
-I../../third_party/skia/include/pipe
-I../../third_party/skia/include/ports
-I../../third_party/skia/include/utils
-I../../third_party/skia/include/gpu -I../../third_party/skia/src/gpu
-I../../third_party/icu/source/common
-I../../third_party/icu/source/i18n
-I../../third_party/mesa/src/include -fno-strict-aliasing
--param=ssp-buffer-size=4 -fstack-protector -funwind-tables -fPIC
-pipe -fcolor-diagnostics
-fdebug-prefix-map=/wrkdirs/usr/ports/www/chromium/work/chromium-54.0.2840.100=.
-pthread -m64 -march=x86-64 -Wall -Wextra
-Wno-missing-field-initializers -Wno-unused-parameter
-Wno-c++11-narrowing -Wno-covered-switch-default
-Wno-deprecated-register -Wno-unneeded-internal-declaration
-Wno-inconsistent-missing-override -Wno-shift-negative-value
-Wno-undefined-var-template -Wno-nonportable-include-path -O2
-fno-ident -fdata-sections -ffunction-sections -g0 -fvisibility=hidden
-Wheader-hygiene -Wstring-conversion -fno-threadsafe-statics
-fvisibility-inlines-hidden -std=gnu++11 -fno-rtti -fno-exceptions -c
../../services/ui/ws/window_manager_display_root.cc -o
obj/services/ui/ws/lib/window_manager_display_root.o
In file included from ../../services/ui/ws/window_manager_display_root.cc:5:
In file included from ../../services/ui/ws/window_manager_display_root.h:10:
In file included from /usr/include/c++/v1/memory:599:
/usr/include/c++/v1/__config:58:2: error:
"_LIBCPP_TRIVIAL_PAIR_COPY_CTOR" is no longer supported.use
_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR instead
#error "_LIBCPP_TRIVIAL_PAIR_COPY_CTOR" is no longer supported. \
 ^
1 error generated.


contrib/libc++/include/__config:
309124dim #ifdef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
309124dim #error "_LIBCPP_TRIVIAL_PAIR_COPY_CTOR" is no longer
supported. \
309124dimuse
_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR instead
309124dim #endif

Best,
Conrad


[0]: 
http://beefy12.nyi.freebsd.org/data/head-amd64-default/p431044_s311844/logs/errors/chromium-54.0.2840.100_1.log
(warning: BIG)

On Thu, Nov 24, 2016 at 2:54 PM, Dimitry Andric  wrote:
> Author: dim
> Date: Thu Nov 24 22:54:55 2016
> New Revision: 309124
> URL: https://svnweb.freebsd.org/changeset/base/309124
>
> Log:
>   Upgrade our copies of clang, llvm, lldb, compiler-rt and libc++ to 3.9.0
>   release, and add lld 3.9.0.  Also completely revamp the build system for
>   clang, llvm, lldb and their related tools.
>
>   Please note that from 3.5.0 onwards, clang, llvm and lldb require C++11
>   support to build; see UPDATING for more information.
>
>   Release notes for llvm, clang and lld are available here:
>   
>   
>   
>
>   Thanks to Ed Maste, Bryan Drewery, Andrew Turner, Antoine Brodin and Jan
>   Beich for their help.
___
svn-src-head@freebsd.org mailing list
htt

svn commit: r311977 - in head: share/man/man4 sys/dev/sfxge

2017-01-12 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Jan 12 13:00:17 2017
New Revision: 311977
URL: https://svnweb.freebsd.org/changeset/base/311977

Log:
  sfxge(4): add tunable to configure MAC stats update period
  
  Reviewed by:philip
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  2 days
  Differential Revision:  https://reviews.freebsd.org/D9151

Modified:
  head/share/man/man4/sfxge.4
  head/sys/dev/sfxge/sfxge.h
  head/sys/dev/sfxge/sfxge_port.c

Modified: head/share/man/man4/sfxge.4
==
--- head/share/man/man4/sfxge.4 Thu Jan 12 11:53:33 2017(r311976)
+++ head/share/man/man4/sfxge.4 Thu Jan 12 13:00:17 2017(r311977)
@@ -158,6 +158,14 @@ The default for each port will be the va
 .Va hw.sfxge.mcdi_logging.
 The logging may also be enabled or disabled after the driver is loaded using 
the sysctl
 .Va dev.sfxge.%d.mcdi_logging.
+.It Va hw.sfxge.stats_update_period_ms
+Period in milliseconds to refresh interface statistics from hardware.
+The accepted range is 0 to 65535, the default is 1000 (1 second).
+Use zero value to disable periodic statistics update.
+Supported on SFN8xxx series adapters with firmware v6.2.1.1033 and later and
+SFN5xxx and SFN6xxx series adapters.
+SFN7xxx series adapters and SFN8xxx series with earlier firmware use a
+fixed 1000 milliseconds statistics update period.
 .El
 .Sh SUPPORT
 For general information and support,

Modified: head/sys/dev/sfxge/sfxge.h
==
--- head/sys/dev/sfxge/sfxge.h  Thu Jan 12 11:53:33 2017(r311976)
+++ head/sys/dev/sfxge/sfxge.h  Thu Jan 12 13:00:17 2017(r311977)
@@ -248,6 +248,7 @@ struct sfxge_port {
 #endif
struct sfxge_hw_stats   phy_stats;
struct sfxge_hw_stats   mac_stats;
+   uint16_tstats_update_period_ms;
efx_link_mode_t link_mode;
uint8_t mcast_addrs[EFX_MAC_MULTICAST_LIST_MAX *
EFX_MAC_ADDR_LEN];

Modified: head/sys/dev/sfxge/sfxge_port.c
==
--- head/sys/dev/sfxge/sfxge_port.c Thu Jan 12 11:53:33 2017
(r311976)
+++ head/sys/dev/sfxge/sfxge_port.c Thu Jan 12 13:00:17 2017
(r311977)
@@ -43,6 +43,15 @@ __FBSDID("$FreeBSD$");
 
 #include "sfxge.h"
 
+#defineSFXGE_PARAM_STATS_UPDATE_PERIOD_MS \
+   SFXGE_PARAM(stats_update_period_ms)
+static int sfxge_stats_update_period_ms = SFXGE_STATS_UPDATE_PERIOD_MS;
+TUNABLE_INT(SFXGE_PARAM_STATS_UPDATE_PERIOD_MS,
+   &sfxge_stats_update_period_ms);
+SYSCTL_INT(_hw_sfxge, OID_AUTO, stats_update_period_ms, CTLFLAG_RDTUN,
+  &sfxge_stats_update_period_ms, 0,
+  "netstat interface statistics update period in milliseconds");
+
 static int sfxge_phy_cap_mask(struct sfxge_softc *, int, uint32_t *);
 
 static int
@@ -62,7 +71,7 @@ sfxge_mac_stat_update(struct sfxge_softc
goto out;
}
 
-   min_ticks = (unsigned int)hz * SFXGE_STATS_UPDATE_PERIOD_MS / 1000;
+   min_ticks = (unsigned int)hz * port->stats_update_period_ms / 1000;
 
now = ticks;
if ((unsigned int)(now - port->mac_stats.update_time) < min_ticks) {
@@ -515,7 +524,7 @@ sfxge_port_start(struct sfxge_softc *sc)
 
/* Update MAC stats by DMA every period */
if ((rc = efx_mac_stats_periodic(enp, &port->mac_stats.dma_buf,
-SFXGE_STATS_UPDATE_PERIOD_MS,
+port->stats_update_period_ms,
 B_FALSE)) != 0)
goto fail6;
 
@@ -673,6 +682,26 @@ sfxge_port_fini(struct sfxge_softc *sc)
port->sc = NULL;
 }
 
+static uint16_t
+sfxge_port_stats_update_period_ms(struct sfxge_softc *sc)
+{
+   int period_ms = sfxge_stats_update_period_ms;
+
+   if (period_ms < 0) {
+   device_printf(sc->dev,
+   "treat negative stats update period %d as 0 
(disable)\n",
+period_ms);
+   period_ms = 0;
+   } else if (period_ms > UINT16_MAX) {
+   device_printf(sc->dev,
+   "treat too big stats update period %d as %u\n",
+   period_ms, UINT16_MAX);
+   period_ms = UINT16_MAX;
+   }
+
+   return period_ms;
+}
+
 int
 sfxge_port_init(struct sfxge_softc *sc)
 {
@@ -721,6 +750,7 @@ sfxge_port_init(struct sfxge_softc *sc)
M_SFXGE, M_WAITOK | M_ZERO);
if ((rc = sfxge_dma_alloc(sc, EFX_MAC_STATS_SIZE, mac_stats_buf)) != 0)
goto fail2;
+   port->stats_update_period_ms = sfxge_port_stats_update_period_ms(sc);
sfxge_mac_stat_init(sc);
 
port->init_state = SFXGE_PORT_INITIALIZED;
___
svn-src-h

svn commit: r311978 - head/sys/dev/e1000

2017-01-12 Thread Sean Bruno
Author: sbruno
Date: Thu Jan 12 14:18:52 2017
New Revision: 311978
URL: https://svnweb.freebsd.org/changeset/base/311978

Log:
  Attempt to use the "new" BAR address for newer igb(4) devices.  This code
  was dropped during the IFLIB migration.
  
  Reported by:  olivier
  Reviewed by:  mm...@nextbsd.org

Modified:
  head/sys/dev/e1000/if_em.c

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Thu Jan 12 13:00:17 2017(r311977)
+++ head/sys/dev/e1000/if_em.c  Thu Jan 12 14:18:52 2017(r311978)
@@ -770,6 +770,8 @@ em_if_attach_pre(if_ctx_t ctx) 
 
 
if (adapter->hw.mac.type >= igb_mac_min) {
+   int try_second_bar;
+
scctx->isc_txqsizes[0] = roundup2(scctx->isc_ntxd[0] * 
sizeof(union e1000_adv_tx_desc), EM_DBA_ALIGN);
scctx->isc_rxqsizes[0] = roundup2(scctx->isc_nrxd[0] * 
sizeof(union e1000_adv_rx_desc), EM_DBA_ALIGN);
scctx->isc_txrx = &igb_txrx;
@@ -779,6 +781,15 @@ em_if_attach_pre(if_ctx_t ctx) 
if (adapter->hw.mac.type != e1000_82575)
scctx->isc_tx_csum_flags |= CSUM_SCTP | CSUM_IP6_SCTP;
 
+   /*
+   ** Some new devices, as with ixgbe, now may
+   ** use a different BAR, so we need to keep
+   ** track of which is used.
+   */
+   try_second_bar = pci_read_config(dev, scctx->isc_msix_bar, 4);
+   if (try_second_bar == 0)
+   scctx->isc_msix_bar += 4;
+
} else if (adapter->hw.mac.type >= em_mac_min) {
scctx->isc_txqsizes[0] = roundup2(scctx->isc_ntxd[0]* 
sizeof(struct e1000_tx_desc), EM_DBA_ALIGN);
scctx->isc_rxqsizes[0] = roundup2(scctx->isc_nrxd[0] * 
sizeof(union e1000_rx_desc_extended), EM_DBA_ALIGN);
___
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: r311979 - head/sys/dev/e1000

2017-01-12 Thread Sean Bruno
Author: sbruno
Date: Thu Jan 12 14:28:32 2017
New Revision: 311979
URL: https://svnweb.freebsd.org/changeset/base/311979

Log:
  Reset the EIAC register to include the LINK status bit and restore
  link up/down notifications.
  
  Submitted by: Franco Fichtner 

Modified:
  head/sys/dev/e1000/if_em.c

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Thu Jan 12 14:18:52 2017(r311978)
+++ head/sys/dev/e1000/if_em.c  Thu Jan 12 14:28:32 2017(r311979)
@@ -3117,7 +3117,7 @@ em_if_enable_intr(if_ctx_t ctx)
u32 ims_mask = IMS_ENABLE_MASK;
 
if (hw->mac.type == e1000_82574) {
-   E1000_WRITE_REG(hw, EM_EIAC, adapter->ims);
+   E1000_WRITE_REG(hw, EM_EIAC, EM_MSIX_MASK);
ims_mask |= adapter->ims;
} if (adapter->intr_type == IFLIB_INTR_MSIX && hw->mac.type >= 
igb_mac_min)  {
u32 mask = (adapter->que_mask | adapter->link_mask);
___
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: r311980 - in head: . sys/conf sys/dev/e1000 sys/modules/em

2017-01-12 Thread Sean Bruno
Author: sbruno
Date: Thu Jan 12 14:38:18 2017
New Revision: 311980
URL: https://svnweb.freebsd.org/changeset/base/311980

Log:
  Deprecate kernel configuration option EM_MULTIQUEUE now that the em(4)
  driver conforms to iflib.

Modified:
  head/UPDATING
  head/sys/conf/NOTES
  head/sys/conf/files
  head/sys/conf/options
  head/sys/dev/e1000/if_em.h
  head/sys/modules/em/Makefile

Modified: head/UPDATING
==
--- head/UPDATING   Thu Jan 12 14:28:32 2017(r311979)
+++ head/UPDATING   Thu Jan 12 14:38:18 2017(r311980)
@@ -51,6 +51,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12
 
 ** SPECIAL WARNING: **
 
+20170112:
+   The EM_MULTIQUEUE kernel configuration option is deprecated now that
+   the em(4) driver conforms to iflib specifications.
+
 20170109:
The igb(4), em(4) and lem(4) ethernet drivers are now implemented via
IFLIB.  If you have a custom kernel configuration that excludes em(4)

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Thu Jan 12 14:28:32 2017(r311979)
+++ head/sys/conf/NOTES Thu Jan 12 14:38:18 2017(r311980)
@@ -3055,9 +3055,6 @@ options   RANDOM_ENABLE_UMA   # slab alloca
 # Module to enable execution of application via emulators like QEMU
 options IMAGACT_BINMISC
 
-# Intel em(4) driver
-optionsEM_MULTIQUEUE # Activate multiqueue features/disable 
MSI-X
-
 # zlib I/O stream support
 # This enables support for compressed core dumps.
 optionsGZIO

Modified: head/sys/conf/files
==
--- head/sys/conf/files Thu Jan 12 14:28:32 2017(r311979)
+++ head/sys/conf/files Thu Jan 12 14:38:18 2017(r311980)
@@ -2139,6 +2139,8 @@ dev/ixgbe/ix_txrx.c   optional ix inet | 
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
 dev/ixgbe/ixgbe_osdep.coptional ix inet | ixv inet \
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
+dev/ixgbe/ixgbe_sysctl.c   optional ix inet | ixv inet \
+   compile-with "${NORMAL_C} -I$S/dev/ixgbe"
 dev/ixgbe/ixgbe_phy.c  optional ix inet | ixv inet \
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
 dev/ixgbe/ixgbe_api.c  optional ix inet | ixv inet \

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Thu Jan 12 14:28:32 2017(r311979)
+++ head/sys/conf/options   Thu Jan 12 14:38:18 2017(r311980)
@@ -986,9 +986,6 @@ RANDOM_LOADABLE opt_global.h
 # the uma slab allocator.
 RANDOM_ENABLE_UMA  opt_global.h
 
-# Intel em(4) driver
-EM_MULTIQUEUE  opt_em.h
-
 # BHND(4) driver
 BHND_LOGLEVEL  opt_global.h
 

Modified: head/sys/dev/e1000/if_em.h
==
--- head/sys/dev/e1000/if_em.h  Thu Jan 12 14:28:32 2017(r311979)
+++ head/sys/dev/e1000/if_em.h  Thu Jan 12 14:38:18 2017(r311980)
@@ -25,7 +25,6 @@
  */
 
 /*$FreeBSD$*/
-#include "opt_em.h"
 #include "opt_ddb.h"
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -176,11 +175,7 @@
  *restoring the network connection. To eliminate the potential
  *for the hang ensure that EM_RDTR is set to 0.
  */
-#ifdef EM_MULTIQUEUE
-#define EM_RDTR 64
-#else
 #define EM_RDTR 0
-#endif
 
 /*
  * Receive Interrupt Absolute Delay Timer (Not valid for 82542/82543/82544)
@@ -193,11 +188,7 @@
  *   along with EM_RDTR, may improve traffic throughput in specific network
  *   conditions.
  */
-#ifdef EM_MULTIQUEUE
-#define EM_RADV 128
-#else
 #define EM_RADV 64
-#endif
 
 /*
  * This parameter controls whether or not autonegotation is enabled.

Modified: head/sys/modules/em/Makefile
==
--- head/sys/modules/em/MakefileThu Jan 12 14:28:32 2017
(r311979)
+++ head/sys/modules/em/MakefileThu Jan 12 14:38:18 2017
(r311980)
@@ -3,7 +3,7 @@
 
 .PATH:  ${.CURDIR}/../../dev/e1000
 KMOD= if_em
-SRCS= device_if.h bus_if.h pci_if.h opt_ddb.h opt_em.h opt_inet.h \
+SRCS= device_if.h bus_if.h pci_if.h opt_ddb.h opt_inet.h \
  opt_inet6.h ifdi_if.h
 SRCS+= $(CORE_SRC) $(LEGACY_SRC)
 SRCS   += $(COMMON_SHARED) $(LEGACY_SHARED) $(PCIE_SHARED)
___
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: r311981 - head/usr.bin/rpcgen

2017-01-12 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Jan 12 14:44:41 2017
New Revision: 311981
URL: https://svnweb.freebsd.org/changeset/base/311981

Log:
  rpcgen(1): Check getrlimit() return for generated code.
  
  Obtained from:NetBSD (CVS rev 1.27, 1.28)
  MFC after:1 week

Modified:
  head/usr.bin/rpcgen/rpc_svcout.c

Modified: head/usr.bin/rpcgen/rpc_svcout.c
==
--- head/usr.bin/rpcgen/rpc_svcout.cThu Jan 12 14:38:18 2017
(r311980)
+++ head/usr.bin/rpcgen/rpc_svcout.cThu Jan 12 14:44:41 2017
(r311981)
@@ -728,7 +728,8 @@ write_timeout_func(void)
if (tirpcflag) {
f_print(fout, "\t\t\tstruct rlimit rl;\n\n");
f_print(fout, "\t\t\trl.rlim_max = 0;\n");
-   f_print(fout, "\t\t\tgetrlimit(RLIMIT_NOFILE, &rl);\n");
+   f_print(fout, "\t\t\tif (getrlimit(RLIMIT_NOFILE, &rl) == 
-1)\n");
+   f_print(fout, "\t\t\t\treturn;\n");
f_print(fout, "\t\t\tif ((size = rl.rlim_max) == 0) {\n");

if (mtflag)
@@ -902,7 +903,11 @@ write_rpc_svc_fg(const char *infile, con
/* get number of file descriptors */
if (tirpcflag) {
f_print(fout, "%srl.rlim_max = 0;\n", sp);
-   f_print(fout, "%sgetrlimit(RLIMIT_NOFILE, &rl);\n", sp);
+   f_print(fout, "%sif (getrlimit(RLIMIT_NOFILE, &rl) == -1) {\n",
+   sp);
+   f_print(fout, "%s\tperror(\"getrlimit\");\n", sp);
+   f_print(fout, "%s\texit(1);\n", sp);
+   f_print(fout, "%s}\n", sp);
f_print(fout, "%sif ((size = rl.rlim_max) == 0)\n", sp);
f_print(fout, "%s\texit(1);\n", sp);
} else {
___
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: r311982 - head/sys/dev/e1000

2017-01-12 Thread Sean Bruno
Author: sbruno
Date: Thu Jan 12 14:47:44 2017
New Revision: 311982
URL: https://svnweb.freebsd.org/changeset/base/311982

Log:
  Restore fixup for newer em(4) devices WOL capabilities post iflib integration.
  
  PR:   208343

Modified:
  head/sys/dev/e1000/if_em.c

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Thu Jan 12 14:44:41 2017(r311981)
+++ head/sys/dev/e1000/if_em.c  Thu Jan 12 14:47:44 2017(r311982)
@@ -3308,6 +3308,8 @@ em_get_wakeup(if_ctx_t ctx)
case e1000_ich10lan:
case e1000_pchlan:
case e1000_pch2lan:
+   case e1000_pch_lpt:
+   case e1000_pch_spt:
apme_mask = E1000_WUC_APME;
adapter->has_amt = TRUE;
eeprom_data = E1000_READ_REG(&adapter->hw, E1000_WUC);
@@ -3376,7 +3378,7 @@ em_enable_wakeup(if_ctx_t ctx)
struct adapter  *adapter = iflib_get_softc(ctx);
device_t dev = iflib_get_dev(ctx);
if_t ifp = iflib_get_ifp(ctx);
-   u32 pmc, ctrl, ctrl_ext, rctl;
+   u32 pmc, ctrl, ctrl_ext, rctl, wuc;
u16 status;
 
if ((pci_find_cap(dev, PCIY_PMG, &pmc) != 0))
@@ -3386,7 +3388,9 @@ em_enable_wakeup(if_ctx_t ctx)
ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL);
ctrl |= (E1000_CTRL_SWDPIN2 | E1000_CTRL_SWDPIN3);
E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl);
-   E1000_WRITE_REG(&adapter->hw, E1000_WUC, E1000_WUC_PME_EN);
+   wuc = E1000_READ_REG(&adapter->hw, E1000_WUC);
+   wuc |= E1000_WUC_PME_EN ;
+   E1000_WRITE_REG(&adapter->hw, E1000_WUC, wuc);
 
if ((adapter->hw.mac.type == e1000_ich8lan) ||
(adapter->hw.mac.type == e1000_pchlan) ||
@@ -3418,7 +3422,9 @@ em_enable_wakeup(if_ctx_t ctx)
}
 
if ((adapter->hw.mac.type == e1000_pchlan) ||
-   (adapter->hw.mac.type == e1000_pch2lan)) {
+   (adapter->hw.mac.type == e1000_pch2lan) ||
+   (adapter->hw.mac.type == e1000_pch_lpt) ||
+   (adapter->hw.mac.type == e1000_pch_spt)) {
if (em_enable_phy_wakeup(adapter))
return;
} else {
___
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: r311983 - in head: share/man/man4 sys/dev/sfxge

2017-01-12 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Jan 12 15:26:23 2017
New Revision: 311983
URL: https://svnweb.freebsd.org/changeset/base/311983

Log:
  sfxge(4): add sysctl to change MAC stats update period
  
  The sysctl controls the period per interface.
  
  Reviewed by:gnn
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  2 days
  Differential Revision:  https://reviews.freebsd.org/D9153

Modified:
  head/share/man/man4/sfxge.4
  head/sys/dev/sfxge/sfxge_port.c

Modified: head/share/man/man4/sfxge.4
==
--- head/share/man/man4/sfxge.4 Thu Jan 12 14:47:44 2017(r311982)
+++ head/share/man/man4/sfxge.4 Thu Jan 12 15:26:23 2017(r311983)
@@ -166,6 +166,8 @@ Supported on SFN8xxx series adapters wit
 SFN5xxx and SFN6xxx series adapters.
 SFN7xxx series adapters and SFN8xxx series with earlier firmware use a
 fixed 1000 milliseconds statistics update period.
+The period may also be changed after the driver is loaded using the sysctl
+.Va dev.sfxge.%d.stats_update_period_ms .
 .El
 .Sh SUPPORT
 For general information and support,

Modified: head/sys/dev/sfxge/sfxge_port.c
==
--- head/sys/dev/sfxge/sfxge_port.c Thu Jan 12 14:47:44 2017
(r311982)
+++ head/sys/dev/sfxge/sfxge_port.c Thu Jan 12 15:26:23 2017
(r311983)
@@ -702,6 +702,48 @@ sfxge_port_stats_update_period_ms(struct
return period_ms;
 }
 
+static int
+sfxge_port_stats_update_period_ms_handler(SYSCTL_HANDLER_ARGS)
+{
+   struct sfxge_softc *sc;
+   struct sfxge_port *port;
+   unsigned int period_ms;
+   int error;
+
+   sc = arg1;
+   port = &sc->port;
+
+   if (req->newptr != NULL) {
+   error = SYSCTL_IN(req, &period_ms, sizeof(period_ms));
+   if (error != 0)
+   return (error);
+
+   if (period_ms > UINT16_MAX)
+   return (EINVAL);
+
+   SFXGE_PORT_LOCK(port);
+
+   if (port->stats_update_period_ms != period_ms) {
+   if (port->init_state == SFXGE_PORT_STARTED)
+   error = efx_mac_stats_periodic(sc->enp,
+   &port->mac_stats.dma_buf,
+   period_ms, B_FALSE);
+   if (error == 0)
+   port->stats_update_period_ms = period_ms;
+   }
+
+   SFXGE_PORT_UNLOCK(port);
+   } else {
+   SFXGE_PORT_LOCK(port);
+   period_ms = port->stats_update_period_ms;
+   SFXGE_PORT_UNLOCK(port);
+
+   error = SYSCTL_OUT(req, &period_ms, sizeof(period_ms));
+   }
+
+   return (error);
+}
+
 int
 sfxge_port_init(struct sfxge_softc *sc)
 {
@@ -753,6 +795,11 @@ sfxge_port_init(struct sfxge_softc *sc)
port->stats_update_period_ms = sfxge_port_stats_update_period_ms(sc);
sfxge_mac_stat_init(sc);
 
+   SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO,
+   "stats_update_period_ms", CTLTYPE_UINT|CTLFLAG_RW, sc, 0,
+   sfxge_port_stats_update_period_ms_handler, "IU",
+   "interface statistics refresh period");
+
port->init_state = SFXGE_PORT_INITIALIZED;
 
DBGPRINT(sc->dev, "success");
___
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: r311984 - head/libexec/rtld-elf

2017-01-12 Thread Konstantin Belousov
Author: kib
Date: Thu Jan 12 15:54:03 2017
New Revision: 311984
URL: https://svnweb.freebsd.org/changeset/base/311984

Log:
  For the main binary, postpone enforcing relro read-only protection
  until copy relocations are done.
  
  Newer binutils and lld seems to output copy into relro-protected range.
  
  Reported by: Rafael Espц╜ndola via emaste
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/rtld.c
==
--- head/libexec/rtld-elf/rtld.cThu Jan 12 15:26:23 2017
(r311983)
+++ head/libexec/rtld-elf/rtld.cThu Jan 12 15:54:03 2017
(r311984)
@@ -103,6 +103,7 @@ static int load_needed_objects(Obj_Entry
 static int load_preload_objects(void);
 static Obj_Entry *load_object(const char *, int fd, const Obj_Entry *, int);
 static void map_stacks_exec(RtldLockState *);
+static int obj_enforce_relro(Obj_Entry *);
 static Obj_Entry *obj_from_addr(const void *);
 static void objlist_call_fini(Objlist *, Obj_Entry *, RtldLockState *);
 static void objlist_call_init(Objlist *, RtldLockState *);
@@ -617,6 +618,10 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
 if (do_copy_relocations(obj_main) == -1)
rtld_die();
 
+dbg("enforcing main obj relro");
+if (obj_enforce_relro(obj_main) == -1)
+   rtld_die();
+
 if (getenv(_LD("DUMP_REL_POST")) != NULL) {
dump_relocations(obj_main);
exit (0);
@@ -2746,14 +2751,8 @@ relocate_object(Obj_Entry *obj, bool bin
reloc_non_plt(obj, rtldobj, flags | SYMLOOK_IFUNC, lockstate))
return (-1);
 
-   if (obj->relro_size > 0) {
-   if (mprotect(obj->relro_page, obj->relro_size,
-   PROT_READ) == -1) {
-   _rtld_error("%s: Cannot enforce relro protection: %s",
-   obj->path, rtld_strerror(errno));
-   return (-1);
-   }
-   }
+   if (!obj->mainprog && obj_enforce_relro(obj) == -1)
+   return (-1);
 
/*
 * Set up the magic number and version in the Obj_Entry.  These
@@ -5124,6 +5123,19 @@ _rtld_is_dlopened(void *arg)
return (res);
 }
 
+int
+obj_enforce_relro(Obj_Entry *obj)
+{
+
+   if (obj->relro_size > 0 && mprotect(obj->relro_page, obj->relro_size,
+   PROT_READ) == -1) {
+   _rtld_error("%s: Cannot enforce relro protection: %s",
+   obj->path, rtld_strerror(errno));
+   return (-1);
+   }
+   return (0);
+}
+
 static void
 map_stacks_exec(RtldLockState *lockstate)
 {
___
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: r311984 - head/libexec/rtld-elf

2017-01-12 Thread Ed Maste
On 12 January 2017 at 10:54, Konstantin Belousov  wrote:
> Author: kib
> Date: Thu Jan 12 15:54:03 2017
> New Revision: 311984
> URL: https://svnweb.freebsd.org/changeset/base/311984
>
> Log:
>   For the main binary, postpone enforcing relro read-only protection
>   until copy relocations are done.
>
>   Newer binutils and lld seems to output copy into relro-protected range.

AFAIK no released version of GNU BFD ld or gold have this change yet,
but it has been committed to both. There's a long thread with details
at https://sourceware.org/ml/libc-alpha/2016-12/msg00914.html
___
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: r311985 - head/usr.sbin/route6d

2017-01-12 Thread Alan Somers
Author: asomers
Date: Thu Jan 12 16:22:28 2017
New Revision: 311985
URL: https://svnweb.freebsd.org/changeset/base/311985

Log:
  Fix uninitialized variable CIDs in route6d
  
  The variables in question are actually return arguments, but it's still good
  form to initialize them.
  
  Reported by:  Coverity
  CID:  979679 979680
  MFC after:4 weeks
  Sponsored by: Spectra Logic Corp

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

Modified: head/usr.sbin/route6d/route6d.c
==
--- head/usr.sbin/route6d/route6d.c Thu Jan 12 15:54:03 2017
(r311984)
+++ head/usr.sbin/route6d/route6d.c Thu Jan 12 16:22:28 2017
(r311985)
@@ -1062,6 +1062,7 @@ sendpacket(struct sockaddr_in6 *sin6, in
iov[0].iov_len = len;
m.msg_iov = iov;
m.msg_iovlen = 1;
+   m.msg_flags = 0;
if (!idx) {
m.msg_control = NULL;
m.msg_controllen = 0;
@@ -1126,6 +1127,7 @@ riprecv(void)
cm = (struct cmsghdr *)cmsgbuf;
m.msg_control = (caddr_t)cm;
m.msg_controllen = sizeof(cmsgbuf);
+   m.msg_flags = 0;
if ((len = recvmsg(ripsock, &m, 0)) < 0) {
fatal("recvmsg");
/*NOTREACHED*/
___
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: r311986 - head/sys/dev/netmap

2017-01-12 Thread Sean Bruno
Author: sbruno
Date: Thu Jan 12 16:24:10 2017
New Revision: 311986
URL: https://svnweb.freebsd.org/changeset/base/311986

Log:
  Fix panic on mb_free_ext() due to NULL destructor.
  
  This used to happen because of the SET_MBUF_DESTRUCTOR() called
  on unregif.
  
  Submitted by: Vincenzo Maffione 

Modified:
  head/sys/dev/netmap/netmap_generic.c

Modified: head/sys/dev/netmap/netmap_generic.c
==
--- head/sys/dev/netmap/netmap_generic.cThu Jan 12 16:22:28 2017
(r311985)
+++ head/sys/dev/netmap/netmap_generic.cThu Jan 12 16:24:10 2017
(r311986)
@@ -165,12 +165,12 @@ nm_os_get_mbuf(struct ifnet *ifp, int le
  * has a KASSERT(), checking that the mbuf dtor function is not NULL.
  */
 
+static void void_mbuf_dtor(struct mbuf *m, void *arg1, void *arg2) { }
+
 #define SET_MBUF_DESTRUCTOR(m, fn) do {\
-   (m)->m_ext.ext_free = (void *)fn;   \
+   (m)->m_ext.ext_free = fn ? (void *)fn : (void *)void_mbuf_dtor; \
 } while (0)
 
-static void void_mbuf_dtor(struct mbuf *m, void *arg1, void *arg2) { }
-
 static inline struct mbuf *
 nm_os_get_mbuf(struct ifnet *ifp, int len)
 {
___
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: r311987 - head/sys/dev/uart

2017-01-12 Thread Bruce M Simpson
Author: bms
Date: Thu Jan 12 16:30:27 2017
New Revision: 311987
URL: https://svnweb.freebsd.org/changeset/base/311987

Log:
  Allow uart(4) to use MSI interrupts on single-port PCI instances.
  
  Do this here as puc(4) disallows single-port instances; at least
  one multi-port PCIe UART chip (in this case, the ASIX MCS9922)
  present separate PCI configuration space (functions) for each UART.
  
  Tested using lrzsz and a null-modem cable. The ExpressCard/34
  variants containing the MCS9922 should also use MSI with this change.
  
  Reviewed by:  jhb, imp, rpokala
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D9123

Modified:
  head/sys/dev/uart/uart_bus_pci.c
  head/sys/dev/uart/uart_core.c

Modified: head/sys/dev/uart/uart_bus_pci.c
==
--- head/sys/dev/uart/uart_bus_pci.cThu Jan 12 16:24:10 2017
(r311986)
+++ head/sys/dev/uart/uart_bus_pci.cThu Jan 12 16:30:27 2017
(r311987)
@@ -45,12 +45,14 @@ __FBSDID("$FreeBSD$");
 #defineDEFAULT_RCLK1843200
 
 static int uart_pci_probe(device_t dev);
+static int uart_pci_attach(device_t dev);
+static int uart_pci_detach(device_t dev);
 
 static device_method_t uart_pci_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, uart_pci_probe),
-   DEVMETHOD(device_attach,uart_bus_attach),
-   DEVMETHOD(device_detach,uart_bus_detach),
+   DEVMETHOD(device_attach,uart_pci_attach),
+   DEVMETHOD(device_detach,uart_pci_detach),
DEVMETHOD(device_resume,uart_bus_resume),
DEVMETHOD_END
 };
@@ -209,4 +211,40 @@ uart_pci_probe(device_t dev)
return (result);
 }
 
+static int
+uart_pci_attach(device_t dev)
+{
+   struct uart_softc *sc;
+   int count;
+
+   sc = device_get_softc(dev);
+
+   /*
+* Use MSI in preference to legacy IRQ if available.
+* Whilst some PCIe UARTs support >1 MSI vector, use only the first.
+*/
+   if (pci_msi_count(dev) > 0) {
+   count = 1;
+   if (pci_alloc_msi(dev, &count) == 0) {
+   sc->sc_irid = 1;
+   device_printf(dev, "Using %d MSI message\n", count);
+   }
+   }
+
+   return (uart_bus_attach(dev));
+}
+
+static int
+uart_pci_detach(device_t dev)
+{
+   struct uart_softc *sc;
+
+   sc = device_get_softc(dev);
+
+   if (sc->sc_irid != 0)
+   pci_release_msi(dev);
+
+   return (uart_bus_detach(dev));
+}
+
 DRIVER_MODULE(uart, pci, uart_pci_driver, uart_devclass, NULL, NULL);

Modified: head/sys/dev/uart/uart_core.c
==
--- head/sys/dev/uart/uart_core.c   Thu Jan 12 16:24:10 2017
(r311986)
+++ head/sys/dev/uart/uart_core.c   Thu Jan 12 16:30:27 2017
(r311987)
@@ -677,7 +677,6 @@ uart_bus_attach(device_t dev)
 * safest thing to do.
 */
if (filt != FILTER_SCHEDULE_THREAD && !uart_force_poll) {
-   sc->sc_irid = 0;
sc->sc_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ,
&sc->sc_irid, RF_ACTIVE | RF_SHAREABLE);
}
___
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: r311988 - head/share/man/man4

2017-01-12 Thread Sean Bruno
Author: sbruno
Date: Thu Jan 12 16:44:40 2017
New Revision: 311988
URL: https://svnweb.freebsd.org/changeset/base/311988

Log:
  Purge EM_MULTIQUEUE references from the man page for em(4).

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

Modified: head/share/man/man4/em.4
==
--- head/share/man/man4/em.4Thu Jan 12 16:30:27 2017(r311987)
+++ head/share/man/man4/em.4Thu Jan 12 16:44:40 2017(r311988)
@@ -31,7 +31,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 16, 2015
+.Dd January 12, 2016
 .Dt EM 4
 .Os
 .Sh NAME
@@ -45,14 +45,6 @@ kernel configuration file:
 .Cd "device em"
 .Ed
 .Pp
-Optional multiqueue support is available via the following kernel
-compile options:
-.Bd -ragged -offset indent
-.Cd "options EM_MULTIQUEUE"
-.Ed
-.Pp
-Note:  Activating EM_MULTIQUEUE support is not supported by Intel.
-.Pp
 Alternatively, to load the driver as a
 module at boot time, place the following line in
 .Xr loader.conf 5 :
@@ -253,12 +245,6 @@ If
 .Va hw.em.tx_int_delay
 is non-zero, this tunable limits the maximum delay in which a transmit
 interrupt is generated.
-.It Va hw.em.num_queues
-Number of hardware queues that will be configured on this adapter (maximum of 
2)
-Defaults to 1.
-Only valid with kernel configuration
-.Cd "options EM_MULTIQUEUE".
-.El
 .Sh FILES
 .Bl -tag -width /dev/led/em*
 .It Pa /dev/led/em*
@@ -311,5 +297,3 @@ The
 .Nm
 driver was written by
 .An Intel Corporation Aq Mt free...@intel.com .
-.Sh BUGS
-Activating EM_MULTIQUEUE support requires MSI-X features.
___
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: r311989 - head/sys/libkern

2017-01-12 Thread Conrad E. Meyer
Author: cem
Date: Thu Jan 12 17:02:29 2017
New Revision: 311989
URL: https://svnweb.freebsd.org/changeset/base/311989

Log:
  libkern: Remove obsolete 'register' keyword
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/libkern/bcmp.c
  head/sys/libkern/bsearch.c
  head/sys/libkern/iconv_ucs.c
  head/sys/libkern/iconv_xlat16.c
  head/sys/libkern/memmem.c
  head/sys/libkern/qdivrem.c
  head/sys/libkern/qsort.c
  head/sys/libkern/random.c
  head/sys/libkern/scanc.c
  head/sys/libkern/strcmp.c
  head/sys/libkern/strncpy.c

Modified: head/sys/libkern/bcmp.c
==
--- head/sys/libkern/bcmp.c Thu Jan 12 16:44:40 2017(r311988)
+++ head/sys/libkern/bcmp.c Thu Jan 12 17:02:29 2017(r311989)
@@ -44,7 +44,7 @@ typedef const unsigned long   *culp;
 int
 bcmp(b1, b2, length)
const void *b1, *b2;
-   register size_t length;
+   size_t length;
 {
 #if BYTE_ORDER == LITTLE_ENDIAN
/*

Modified: head/sys/libkern/bsearch.c
==
--- head/sys/libkern/bsearch.c  Thu Jan 12 16:44:40 2017(r311988)
+++ head/sys/libkern/bsearch.c  Thu Jan 12 17:02:29 2017(r311989)
@@ -54,16 +54,16 @@ __FBSDID("$FreeBSD$");
  */
 void *
 bsearch(key, base0, nmemb, size, compar)
-   register const void *key;
+   const void *key;
const void *base0;
size_t nmemb;
-   register size_t size;
-   register int (*compar)(const void *, const void *);
+   size_t size;
+   int (*compar)(const void *, const void *);
 {
-   register const char *base = base0;
-   register size_t lim;
-   register int cmp;
-   register const void *p;
+   const char *base = base0;
+   size_t lim;
+   int cmp;
+   const void *p;
 
for (lim = nmemb; lim != 0; lim >>= 1) {
p = base + (lim >> 1) * size;

Modified: head/sys/libkern/iconv_ucs.c
==
--- head/sys/libkern/iconv_ucs.cThu Jan 12 16:44:40 2017
(r311988)
+++ head/sys/libkern/iconv_ucs.cThu Jan 12 17:02:29 2017
(r311989)
@@ -523,14 +523,14 @@ ucs4_to_utf8(uint32_t ucs4, char *dst, s
 }
 
 static uint32_t
-encode_surrogate(register uint32_t code)
+encode_surrogate(uint32_t code)
 {
return code - 0x1) << 6) & 0x3ff) |
((code - 0x1) & 0x3ff) | 0xd800dc00);
 }
 
 static uint32_t
-decode_surrogate(register const u_char *ucs)
+decode_surrogate(const u_char *ucs)
 {
return ucs[0] & 0x3) << 18) | (ucs[1] << 10) |
((ucs[2] & 0x3) << 8) | ucs[3]) + 0x1);

Modified: head/sys/libkern/iconv_xlat16.c
==
--- head/sys/libkern/iconv_xlat16.c Thu Jan 12 16:44:40 2017
(r311988)
+++ head/sys/libkern/iconv_xlat16.c Thu Jan 12 17:02:29 2017
(r311989)
@@ -298,10 +298,10 @@ iconv_xlat16_name(struct iconv_converter
 }
 
 static int
-iconv_xlat16_tolower(void *d2p, register int c)
+iconv_xlat16_tolower(void *d2p, int c)
 {
 struct iconv_xlat16 *dp = (struct iconv_xlat16*)d2p;
-   register int c1, c2, out;
+   int c1, c2, out;
 
if (c < 0x100) {
c1 = C2I1(c << 8);
@@ -323,10 +323,10 @@ iconv_xlat16_tolower(void *d2p, register
 }
 
 static int
-iconv_xlat16_toupper(void *d2p, register int c)
+iconv_xlat16_toupper(void *d2p, int c)
 {
 struct iconv_xlat16 *dp = (struct iconv_xlat16*)d2p;
-   register int c1, c2, out;
+   int c1, c2, out;
 
if (c < 0x100) {
c1 = C2I1(c << 8);

Modified: head/sys/libkern/memmem.c
==
--- head/sys/libkern/memmem.c   Thu Jan 12 16:44:40 2017(r311988)
+++ head/sys/libkern/memmem.c   Thu Jan 12 17:02:29 2017(r311989)
@@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$");
 void *
 memmem(const void *l, size_t l_len, const void *s, size_t s_len)
 {
-register char *cur, *last;
+char *cur, *last;
 const char *cl = (const char *)l;
 const char *cs = (const char *)s;
 

Modified: head/sys/libkern/qdivrem.c
==
--- head/sys/libkern/qdivrem.c  Thu Jan 12 16:44:40 2017(r311988)
+++ head/sys/libkern/qdivrem.c  Thu Jan 12 17:02:29 2017(r311989)
@@ -59,9 +59,9 @@ typedef u_long digit;
  * We may assume len >= 0.  NOTE THAT THIS WRITES len+1 DIGITS.
  */
 static void
-__shl(register digit *p, register int len, register int sh)
+__shl(digit *p, int len, int sh)
 {
-   register int i;
+   int i;
 
for (i = 0; i < len; i++)
p[i] = LHALF(p[i] << sh) | (p[i + 1] >> (HALF_BITS - sh));
@@ -82,7 +82,7 @@ __qdivrem(uq, vq, arq)
 {
union uu tmp;
digit *u, *v,

svn commit: r311990 - head/sys/conf

2017-01-12 Thread Sean Bruno
Author: sbruno
Date: Thu Jan 12 17:18:25 2017
New Revision: 311990
URL: https://svnweb.freebsd.org/changeset/base/311990

Log:
  Purge surprise change to sys/conf/files for ixgbe(4).
  
  Reported by:  imp

Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==
--- head/sys/conf/files Thu Jan 12 17:02:29 2017(r311989)
+++ head/sys/conf/files Thu Jan 12 17:18:25 2017(r311990)
@@ -2139,8 +2139,6 @@ dev/ixgbe/ix_txrx.c   optional ix inet | 
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
 dev/ixgbe/ixgbe_osdep.coptional ix inet | ixv inet \
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
-dev/ixgbe/ixgbe_sysctl.c   optional ix inet | ixv inet \
-   compile-with "${NORMAL_C} -I$S/dev/ixgbe"
 dev/ixgbe/ixgbe_phy.c  optional ix inet | ixv inet \
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
 dev/ixgbe/ixgbe_api.c  optional ix inet | ixv inet \
___
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: r311993 - head/sys/dev/nand

2017-01-12 Thread Alexander Kabaev
Author: kan
Date: Thu Jan 12 18:05:12 2017
New Revision: 311993
URL: https://svnweb.freebsd.org/changeset/base/311993

Log:
  Fix typo in r311971.
  
  Reported by:  ohartmann at walstatt.org

Modified:
  head/sys/dev/nand/nand_geom.c

Modified: head/sys/dev/nand/nand_geom.c
==
--- head/sys/dev/nand/nand_geom.c   Thu Jan 12 17:54:55 2017
(r311992)
+++ head/sys/dev/nand/nand_geom.c   Thu Jan 12 18:05:12 2017
(r311993)
@@ -416,7 +416,7 @@ create_geom_disk(struct nand_chip *chip)
snprintf(rdisk->d_ident, sizeof(rdisk->d_ident),
"nand_raw: Man:0x%02x Dev:0x%02x", chip->id.man_id,
chip->id.dev_id);
-   disk->d_rotation_rate = DISK_RR_NON_ROTATING;
+   rdisk->d_rotation_rate = DISK_RR_NON_ROTATING;
 
disk_create(rdisk, DISK_VERSION);
 
___
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: r311994 - head/usr.sbin/route6d

2017-01-12 Thread Hiroki Sato
Author: hrs
Date: Thu Jan 12 18:44:58 2017
New Revision: 311994
URL: https://svnweb.freebsd.org/changeset/base/311994

Log:
  - Fix dereference of NULL pointer which could cause a crash [1]
  - Fix memory leak due to lack of freeaddrinfo() [2]
  
  CID:  1018281 [1]
  CID:  1225057 [2]
  MFC after:3 days

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

Modified: head/usr.sbin/route6d/route6d.c
==
--- head/usr.sbin/route6d/route6d.c Thu Jan 12 18:05:12 2017
(r311993)
+++ head/usr.sbin/route6d/route6d.c Thu Jan 12 18:44:58 2017
(r311994)
@@ -684,6 +684,7 @@ init(void)
/*NOTREACHED*/
}
 #endif
+   freeaddrinfo(res);
 
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_INET6;
@@ -699,6 +700,7 @@ init(void)
/*NOTREACHED*/
}
memcpy(&ripsin, res->ai_addr, res->ai_addrlen);
+   freeaddrinfo(res);
 
 #ifdef HAVE_POLL_H
set[0].fd = ripsock;
@@ -788,10 +790,17 @@ ripflush(struct ifc *ifcp, struct sockad
error = sendpacket(sin6, RIPSIZE(nrt));
if (error == EAFNOSUPPORT) {
/* Protocol not supported */
-   tracet(1, "Could not send info to %s (%s): "
-   "set IFF_UP to 0\n",
-   ifcp->ifc_name, inet6_n2p(&ifcp->ifc_ripsin.sin6_addr));
-   ifcp->ifc_flags &= ~IFF_UP; /* As if down for AF_INET6 */
+   if (ifcp != NULL) {
+   tracet(1, "Could not send info to %s (%s): "
+   "set IFF_UP to 0\n",
+   ifcp->ifc_name,
+   inet6_n2p(&ifcp->ifc_ripsin.sin6_addr));
+   /* As if down for AF_INET6 */
+   ifcp->ifc_flags &= ~IFF_UP;
+   } else {
+   tracet(1, "Could not send info to %s\n",
+   inet6_n2p(&sin6->sin6_addr));
+   }
}
 }
 
___
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: r311995 - head/sys/vm

2017-01-12 Thread Gleb Smirnoff
Author: glebius
Date: Thu Jan 12 20:26:02 2017
New Revision: 311995
URL: https://svnweb.freebsd.org/changeset/base/311995

Log:
  Fix the contiguity once more.

Modified:
  head/sys/vm/vnode_pager.c

Modified: head/sys/vm/vnode_pager.c
==
--- head/sys/vm/vnode_pager.c   Thu Jan 12 18:44:58 2017(r311994)
+++ head/sys/vm/vnode_pager.c   Thu Jan 12 20:26:02 2017(r311995)
@@ -974,7 +974,7 @@ vnode_pager_generic_getpages(struct vnod
 #ifdef INVARIANTS
KASSERT(bp->b_npages <= nitems(bp->b_pages),
("%s: buf %p overflowed", __func__, bp));
-   for (int j = 1, prev = 1; j < bp->b_npages; j++) {
+   for (int j = 1, prev = 0; j < bp->b_npages; j++) {
if (bp->b_pages[j] == bogus_page)
continue;
KASSERT(bp->b_pages[j]->pindex - bp->b_pages[prev]->pindex ==
___
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: r311996 - head/sys/kern

2017-01-12 Thread Ian Lepore
Author: ian
Date: Thu Jan 12 21:18:43 2017
New Revision: 311996
URL: https://svnweb.freebsd.org/changeset/base/311996

Log:
  Restructure the tty_drain loop so that device-busy is checked one more time
  after tty_timedwait() returns an error only if the error is EWOULDBLOCK;
  other errors cause an immediate return.  This fixes the case of the tty
  disappearing while in tty_drain().
  
  Reported by:  pho

Modified:
  head/sys/kern/tty.c

Modified: head/sys/kern/tty.c
==
--- head/sys/kern/tty.c Thu Jan 12 20:26:02 2017(r311995)
+++ head/sys/kern/tty.c Thu Jan 12 21:18:43 2017(r311996)
@@ -166,11 +166,9 @@ tty_drain(struct tty *tp, int leaving)
return (error);
ttydevsw_outwakeup(tp);
error = tty_timedwait(tp, &tp->t_outwait, hz / 10);
-   if (timeout_at == 0 && error == EWOULDBLOCK)
-   error = 0;
-   if (error != EWOULDBLOCK)
-   continue;
-   if (getsbinuptime() < timeout_at)
+   if (error != 0 && error != EWOULDBLOCK)
+   return (error);
+   else if (timeout_at == 0 || getsbinuptime() < timeout_at)
error = 0;
else if (leaving && ttyoutq_bytesused(&tp->t_outq) < bytes) {
/* In close, making progress, grant an extra second. */
___
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: r312001 - head/sys/x86/x86

2017-01-12 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Jan 13 01:39:19 2017
New Revision: 312001
URL: https://svnweb.freebsd.org/changeset/base/312001

Log:
  Remove __nonnull() attributes from x86 machine check architecture.
  
  These are of the few cases where we use the GCC non-null attributes in
  non-header code. As part of a review [1] of our use of such attributes we
  are replacing such uses of the overly aggressive GCC attribute with clang's
  _Nonnull attribute.
  
  In this case the attributes serve little purpose as they just don't
  enforce run time checks, If anything the attributes would cause NULL pointer
  checks to be ignored but there are no such checks so only effect is
  cosmetic.
  
  The references appear to be left over from code development and likely
  already fulfilled their purpose.
  
  Reference [1]:
  https://reviews.freebsd.org/D9004
  
  Reviewed by:  jhb
  MFC after:3 weeks

Modified:
  head/sys/x86/x86/mca.c

Modified: head/sys/x86/x86/mca.c
==
--- head/sys/x86/x86/mca.c  Thu Jan 12 22:36:25 2017(r312000)
+++ head/sys/x86/x86/mca.c  Fri Jan 13 01:39:19 2017(r312001)
@@ -247,7 +247,7 @@ mca_error_mmtype(uint16_t mca_error)
return ("???");
 }
 
-static int __nonnull(1)
+static int
 mca_mute(const struct mca_record *rec)
 {
 
@@ -276,7 +276,7 @@ mca_mute(const struct mca_record *rec)
 }
 
 /* Dump details about a single machine check. */
-static void __nonnull(1)
+static void
 mca_log(const struct mca_record *rec)
 {
uint16_t mca_error;
@@ -415,7 +415,7 @@ mca_log(const struct mca_record *rec)
printf("MCA: Misc 0x%llx\n", (long long)rec->mr_misc);
 }
 
-static int __nonnull(2)
+static int
 mca_check_status(int bank, struct mca_record *rec)
 {
uint64_t status;
@@ -482,7 +482,7 @@ mca_refill(void *context, int pending)
mca_fill_freelist();
 }
 
-static void __nonnull(2)
+static void
 mca_record_entry(enum scan_mode mode, const struct mca_record *record)
 {
struct mca_internal *rec;
___
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: r312002 - in head/sys/dev/rtwn: rtl8188e rtl8192c

2017-01-12 Thread Kevin Lo
Author: kevlo
Date: Fri Jan 13 02:11:16 2017
New Revision: 312002
URL: https://svnweb.freebsd.org/changeset/base/312002

Log:
  Increase retry count to 100 in r88e_fw_cmd() and r92c_fw_cmd().

Modified:
  head/sys/dev/rtwn/rtl8188e/r88e_fw.c
  head/sys/dev/rtwn/rtl8192c/r92c_fw.c

Modified: head/sys/dev/rtwn/rtl8188e/r88e_fw.c
==
--- head/sys/dev/rtwn/rtl8188e/r88e_fw.cFri Jan 13 01:39:19 2017
(r312001)
+++ head/sys/dev/rtwn/rtl8188e/r88e_fw.cFri Jan 13 02:11:16 2017
(r312002)
@@ -69,7 +69,7 @@ r88e_fw_cmd(struct rtwn_softc *sc, uint8
}
 
/* Wait for current FW box to be empty. */
-   for (ntries = 0; ntries < 50; ntries++) {
+   for (ntries = 0; ntries < 100; ntries++) {
if (!(rtwn_read_1(sc, R92C_HMETFR) & (1 << sc->fwcur)))
break;
rtwn_delay(sc, 2000);

Modified: head/sys/dev/rtwn/rtl8192c/r92c_fw.c
==
--- head/sys/dev/rtwn/rtl8192c/r92c_fw.cFri Jan 13 01:39:19 2017
(r312001)
+++ head/sys/dev/rtwn/rtl8192c/r92c_fw.cFri Jan 13 02:11:16 2017
(r312002)
@@ -80,7 +80,7 @@ r92c_fw_cmd(struct rtwn_softc *sc, uint8
}
 
/* Wait for current FW box to be empty. */
-   for (ntries = 0; ntries < 50; ntries++) {
+   for (ntries = 0; ntries < 100; ntries++) {
if (!(rtwn_read_1(sc, R92C_HMETFR) & (1 << sc->fwcur)))
break;
rtwn_delay(sc, 2000);
___
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: r312003 - head/usr.sbin/fstyp

2017-01-12 Thread Conrad E. Meyer
Author: cem
Date: Fri Jan 13 02:12:58 2017
New Revision: 312003
URL: https://svnweb.freebsd.org/changeset/base/312003

Log:
  fstyp(8): Detect exFAT filesystems
  
  Simply detect the exFAT filesystem name in the Volume Boot Record
  (superblock).
  
  PR:   214908
  Reported by:  

Added:
  head/usr.sbin/fstyp/exfat.c   (contents, props changed)
Modified:
  head/usr.sbin/fstyp/Makefile
  head/usr.sbin/fstyp/fstyp.8
  head/usr.sbin/fstyp/fstyp.c
  head/usr.sbin/fstyp/fstyp.h

Modified: head/usr.sbin/fstyp/Makefile
==
--- head/usr.sbin/fstyp/MakefileFri Jan 13 02:11:16 2017
(r312002)
+++ head/usr.sbin/fstyp/MakefileFri Jan 13 02:12:58 2017
(r312003)
@@ -3,7 +3,7 @@
 .include 
 
 PROG=  fstyp
-SRCS=  cd9660.c ext2fs.c fstyp.c geli.c msdosfs.c ntfs.c ufs.c
+SRCS=  cd9660.c exfat.c ext2fs.c fstyp.c geli.c msdosfs.c ntfs.c ufs.c
 
 .if ${MK_ZFS} != "no"
 SRCS +=zfs.c

Added: head/usr.sbin/fstyp/exfat.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/fstyp/exfat.c Fri Jan 13 02:12:58 2017(r312003)
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2017 Conrad Meyer 
+ * 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.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+
+#include "fstyp.h"
+
+struct exfat_vbr {
+   charev_jmp[3];
+   charev_fsname[8];
+   charev_zeros[53];
+   uint64_tev_part_offset;
+   uint64_tev_vol_length;
+   uint32_tev_fat_offset;
+   uint32_tev_fat_length;
+   uint32_tev_cluster_offset;
+   uint32_tev_cluster_count;
+   uint32_tev_rootdir_cluster;
+   uint32_tev_vol_serial;
+   uint16_tev_fs_revision;
+   uint16_tev_vol_flags;
+   uint8_t ev_log_bytes_per_sect;
+   uint8_t ev_log_sect_per_clust;
+   uint8_t ev_num_fats;
+   uint8_t ev_drive_sel;
+   uint8_t ev_percent_used;
+} __packed;
+
+int
+fstyp_exfat(FILE *fp, char *label, size_t size)
+{
+   struct exfat_vbr *ev;
+
+   ev = (struct exfat_vbr *)read_buf(fp, 0, 512);
+   if (ev == NULL || strncmp(ev->ev_fsname, "EXFAT   ", 8) != 0)
+   goto fail;
+
+   /*
+* Reading the volume label requires walking the root directory to look
+* for a special label file.  Left as an exercise for the reader.
+*/
+   free(ev);
+   return (0);
+
+fail:
+   free(ev);
+   return (1);
+}

Modified: head/usr.sbin/fstyp/fstyp.8
==
--- head/usr.sbin/fstyp/fstyp.8 Fri Jan 13 02:11:16 2017(r312002)
+++ head/usr.sbin/fstyp/fstyp.8 Fri Jan 13 02:12:58 2017(r312003)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 28, 2016
+.Dd January 12, 2017
 .Dt FSTYP 8
 .Os
 .Sh NAME
@@ -43,7 +43,7 @@
 The
 .Nm
 utility is used to determine the filesystem type on a given device.
-It can recognize ISO-9660, Ext2, FAT, NTFS, and UFS filesystems.
+It can recognize ISO-9660, exFAT, Ext2, FAT, NTFS, and UFS filesystems.
 When the
 .Fl u
 flag is specified,
@@ -61,6 +61,8 @@ as, respectively:
 .It
 cd9660
 .It
+exfat
+.It
 ext2fs
 .It
 geli

Modified: head/usr.sbin/fstyp/fstyp.c
==
--- head/usr.sbin/fstyp/fstyp.c Fri Jan 13 02:11:16 2017(r312002)
+++ head/usr.sbin/fstyp/fstyp.c Fri Jan 

Re: svn commit: r312003 - head/usr.sbin/fstyp

2017-01-12 Thread Conrad Meyer
Forgot to mention:

Documentation: 
https://www.sans.org/reading-room/whitepapers/forensics/reverse-engineering-microsoft-exfat-file-system-33274

Images for testing: http://www.cfreds.nist.gov/dfr-test-images.html
(raw disk images, include partition tables)


On Thu, Jan 12, 2017 at 6:12 PM, Conrad E. Meyer  wrote:
> Author: cem
> Date: Fri Jan 13 02:12:58 2017
> New Revision: 312003
> URL: https://svnweb.freebsd.org/changeset/base/312003
>
> Log:
>   fstyp(8): Detect exFAT filesystems
>
>   Simply detect the exFAT filesystem name in the Volume Boot Record
>   (superblock).
>
>   PR:   214908
>   Reported by:  
>
> Added:
>   head/usr.sbin/fstyp/exfat.c   (contents, props changed)
> Modified:
>   head/usr.sbin/fstyp/Makefile
>   head/usr.sbin/fstyp/fstyp.8
>   head/usr.sbin/fstyp/fstyp.c
>   head/usr.sbin/fstyp/fstyp.h
>
> Modified: head/usr.sbin/fstyp/Makefile
> ==
> --- head/usr.sbin/fstyp/MakefileFri Jan 13 02:11:16 2017
> (r312002)
> +++ head/usr.sbin/fstyp/MakefileFri Jan 13 02:12:58 2017
> (r312003)
> @@ -3,7 +3,7 @@
>  .include 
>
>  PROG=  fstyp
> -SRCS=  cd9660.c ext2fs.c fstyp.c geli.c msdosfs.c ntfs.c ufs.c
> +SRCS=  cd9660.c exfat.c ext2fs.c fstyp.c geli.c msdosfs.c ntfs.c ufs.c
>
>  .if ${MK_ZFS} != "no"
>  SRCS +=zfs.c
>
> Added: head/usr.sbin/fstyp/exfat.c
> ==
> --- /dev/null   00:00:00 1970   (empty, because file is newly added)
> +++ head/usr.sbin/fstyp/exfat.c Fri Jan 13 02:12:58 2017(r312003)
> @@ -0,0 +1,77 @@
> +/*
> + * Copyright (c) 2017 Conrad Meyer 
> + * 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.
> + */
> +
> +#include 
> +__FBSDID("$FreeBSD$");
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "fstyp.h"
> +
> +struct exfat_vbr {
> +   charev_jmp[3];
> +   charev_fsname[8];
> +   charev_zeros[53];
> +   uint64_tev_part_offset;
> +   uint64_tev_vol_length;
> +   uint32_tev_fat_offset;
> +   uint32_tev_fat_length;
> +   uint32_tev_cluster_offset;
> +   uint32_tev_cluster_count;
> +   uint32_tev_rootdir_cluster;
> +   uint32_tev_vol_serial;
> +   uint16_tev_fs_revision;
> +   uint16_tev_vol_flags;
> +   uint8_t ev_log_bytes_per_sect;
> +   uint8_t ev_log_sect_per_clust;
> +   uint8_t ev_num_fats;
> +   uint8_t ev_drive_sel;
> +   uint8_t ev_percent_used;
> +} __packed;
> +
> +int
> +fstyp_exfat(FILE *fp, char *label, size_t size)
> +{
> +   struct exfat_vbr *ev;
> +
> +   ev = (struct exfat_vbr *)read_buf(fp, 0, 512);
> +   if (ev == NULL || strncmp(ev->ev_fsname, "EXFAT   ", 8) != 0)
> +   goto fail;
> +
> +   /*
> +* Reading the volume label requires walking the root directory to 
> look
> +* for a special label file.  Left as an exercise for the reader.
> +*/
> +   free(ev);
> +   return (0);
> +
> +fail:
> +   free(ev);
> +   return (1);
> +}
>
> Modified: head/usr.sbin/fstyp/fstyp.8
> ==
> --- head/usr.sbin/fstyp/fstyp.8 Fri Jan 13 02:11:16 2017(r312002)
> +++ head/usr.sbin/fstyp/fstyp.8 Fri Jan 13 02:12:58 2017(r312003)
> @@ -27,7 +27,7 @@
>  .\"
>  .\" $FreeBSD$
>  .\"
> -.Dd February 28, 2016
> +.Dd January 12, 2017
>  .Dt FSTYP 8
>  .Os
>  .Sh NAME
> @@ -43,7 +43,7

svn commit: r312008 - in head: contrib/netbsd-tests contrib/netbsd-tests/crypto/libcrypto contrib/netbsd-tests/dev/audio contrib/netbsd-tests/dev/cgd contrib/netbsd-tests/fs/ffs contrib/netbsd-test...

2017-01-12 Thread Ngie Cooper
Author: ngie
Date: Fri Jan 13 03:33:57 2017
New Revision: 312008
URL: https://svnweb.freebsd.org/changeset/base/312008

Log:
  Upgrade NetBSD tests to 01.11.2017_23.20 snapshot
  
  This contains some new testcases in /usr/tests/...:
  
  - .../lib/libc
  - .../lib/libthr
  - .../lib/msun
  - .../sys/kern
  
  Tested on:amd64, i386
  MFC after:1 month

Added:
  head/contrib/netbsd-tests/dev/cgd/t_cgd_3des.c
 - copied unchanged from r311966, 
vendor/NetBSD/tests/dist/dev/cgd/t_cgd_3des.c
  head/contrib/netbsd-tests/dev/cgd/t_cgd_aes.c
 - copied unchanged from r311966, 
vendor/NetBSD/tests/dist/dev/cgd/t_cgd_aes.c
  head/contrib/netbsd-tests/dev/cgd/t_cgd_blowfish.c
 - copied unchanged from r311966, 
vendor/NetBSD/tests/dist/dev/cgd/t_cgd_blowfish.c
  head/contrib/netbsd-tests/kernel/msg.h
 - copied unchanged from r311966, vendor/NetBSD/tests/dist/kernel/msg.h
  head/contrib/netbsd-tests/kernel/t_ptrace.c
 - copied unchanged from r311966, vendor/NetBSD/tests/dist/kernel/t_ptrace.c
  head/contrib/netbsd-tests/kernel/t_ptrace_wait.c
 - copied unchanged from r311966, 
vendor/NetBSD/tests/dist/kernel/t_ptrace_wait.c
  head/contrib/netbsd-tests/kernel/t_ptrace_wait.h
 - copied unchanged from r311966, 
vendor/NetBSD/tests/dist/kernel/t_ptrace_wait.h
  head/contrib/netbsd-tests/kernel/t_ptrace_wait3.c
 - copied unchanged from r311966, 
vendor/NetBSD/tests/dist/kernel/t_ptrace_wait3.c
  head/contrib/netbsd-tests/kernel/t_ptrace_wait4.c
 - copied unchanged from r311966, 
vendor/NetBSD/tests/dist/kernel/t_ptrace_wait4.c
  head/contrib/netbsd-tests/kernel/t_ptrace_wait6.c
 - copied unchanged from r311966, 
vendor/NetBSD/tests/dist/kernel/t_ptrace_wait6.c
  head/contrib/netbsd-tests/kernel/t_ptrace_waitid.c
 - copied unchanged from r311966, 
vendor/NetBSD/tests/dist/kernel/t_ptrace_waitid.c
  head/contrib/netbsd-tests/kernel/t_ptrace_waitpid.c
 - copied unchanged from r311966, 
vendor/NetBSD/tests/dist/kernel/t_ptrace_waitpid.c
  head/contrib/netbsd-tests/lib/libc/sys/t_clock_nanosleep.c
 - copied unchanged from r311966, 
vendor/NetBSD/tests/dist/lib/libc/sys/t_clock_nanosleep.c
  head/contrib/netbsd-tests/lib/libc/sys/t_wait_noproc.c
 - copied, changed from r311966, 
vendor/NetBSD/tests/dist/lib/libc/sys/t_wait_noproc.c
  head/contrib/netbsd-tests/lib/libc/sys/t_wait_noproc_wnohang.c
 - copied unchanged from r311966, 
vendor/NetBSD/tests/dist/lib/libc/sys/t_wait_noproc_wnohang.c
  head/contrib/netbsd-tests/lib/libm/t_casinh.c
 - copied unchanged from r311970, 
vendor/NetBSD/tests/dist/lib/libm/t_casinh.c
  head/contrib/netbsd-tests/lib/libm/t_fe_round.c
 - copied unchanged from r311970, 
vendor/NetBSD/tests/dist/lib/libm/t_fe_round.c
  head/contrib/netbsd-tests/lib/libm/t_ilogb.c
 - copied, changed from r311970, vendor/NetBSD/tests/dist/lib/libm/t_ilogb.c
  head/contrib/netbsd-tests/lib/libpthread/t_timedmutex.c
 - copied unchanged from r311970, 
vendor/NetBSD/tests/dist/lib/libpthread/t_timedmutex.c
  head/contrib/netbsd-tests/net/net/t_mtudisc.sh
 - copied unchanged from r311966, 
vendor/NetBSD/tests/dist/net/net/t_mtudisc.sh
  head/contrib/netbsd-tests/net/net/t_mtudisc6.sh
 - copied unchanged from r311966, 
vendor/NetBSD/tests/dist/net/net/t_mtudisc6.sh
  head/contrib/netbsd-tests/net/net/t_ping6_opts.sh
 - copied unchanged from r311966, 
vendor/NetBSD/tests/dist/net/net/t_ping6_opts.sh
  head/contrib/netbsd-tests/net/net_common.sh
 - copied unchanged from r311966, vendor/NetBSD/tests/dist/net/net_common.sh
  head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_union.c
 - copied unchanged from r311966, 
vendor/NetBSD/tests/dist/usr.bin/xlint/lint1/d_c99_anon_union.c
  head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_cast.c
 - copied unchanged from r311966, 
vendor/NetBSD/tests/dist/usr.bin/xlint/lint1/d_c99_union_cast.c
Modified:
  head/contrib/netbsd-tests/crypto/libcrypto/t_libcrypto.sh
  head/contrib/netbsd-tests/crypto/libcrypto/t_pubkey.sh
  head/contrib/netbsd-tests/dev/audio/h_pad.c
  head/contrib/netbsd-tests/dev/audio/t_pad_output.bz2.uue
  head/contrib/netbsd-tests/fs/ffs/ffs_common.sh
  head/contrib/netbsd-tests/fs/fifofs/t_fifo.c
  head/contrib/netbsd-tests/fs/psshfs/t_psshfs.sh
  head/contrib/netbsd-tests/fs/puffs/t_basic.c
  head/contrib/netbsd-tests/fs/vfs/t_vnops.c
  head/contrib/netbsd-tests/h_macros.h
  head/contrib/netbsd-tests/kernel/t_mqueue.c
  head/contrib/netbsd-tests/lib/libc/arch/sparc64/exec_prot_support.c
  head/contrib/netbsd-tests/lib/libc/arch/sparc64/return_one.S
  head/contrib/netbsd-tests/lib/libc/db/h_db.c
  head/contrib/netbsd-tests/lib/libc/db/t_db.sh
  head/contrib/netbsd-tests/lib/libc/gen/t_dir.c
  head/contrib/netbsd-tests/lib/libc/gen/t_fnmatch.c
  head/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c
  head/contrib/netbsd-tests/lib/libc/string/t_memcpy.c
  head/contrib/netbsd-tests/lib/libc/string/t_memmem.c
  head/contrib/netbsd-tests/lib/libc/sync/cpp_atomic_

svn commit: r312009 - head/usr.sbin/fstyp/tests

2017-01-12 Thread Ngie Cooper
Author: ngie
Date: Fri Jan 13 03:42:51 2017
New Revision: 312009
URL: https://svnweb.freebsd.org/changeset/base/312009

Log:
  Add license preamble for r286964; credit to asomers
  
  While here, clean up trailing whitespace
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/usr.sbin/fstyp/tests/fstyp_test.sh

Modified: head/usr.sbin/fstyp/tests/fstyp_test.sh
==
--- head/usr.sbin/fstyp/tests/fstyp_test.sh Fri Jan 13 03:33:57 2017
(r312008)
+++ head/usr.sbin/fstyp/tests/fstyp_test.sh Fri Jan 13 03:42:51 2017
(r312009)
@@ -1,3 +1,29 @@
+#!/bin/sh
+#
+# Copyright (c) 2015 Alan Somers
+# 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.
+
 # $FreeBSD$
 
 atf_test_case cd9660
@@ -9,7 +35,7 @@ cd9660_body() {
atf_check -s exit:0 -o ignore makefs -t cd9660 -Z -s 64m cd9660.img dir
atf_check -s exit:0 -o inline:"cd9660\n" fstyp cd9660.img
atf_check -s exit:0 -o inline:"cd9660\n" fstyp -l cd9660.img
-}  
+}
 
 atf_test_case cd9660_label
 cd9660_label_head() {
@@ -21,7 +47,7 @@ cd9660_label_body() {
atf_check -s exit:0 -o inline:"cd9660\n" fstyp cd9660.img
# Note: cd9660 labels are always upper case
atf_check -s exit:0 -o inline:"cd9660 FOO\n" fstyp -l cd9660.img
-}  
+}
 
 atf_test_case dir
 dir_head() {
@@ -177,7 +203,7 @@ ufs2_label_body() {
atf_check -s exit:0 mkdir dir
atf_check -s exit:0 -o ignore makefs -o version=2,label="foo" -Z -s 64m 
ufs.img dir
atf_check -s exit:0 -o inline:"ufs foo\n" fstyp -l ufs.img
-}  
+}
 
 atf_test_case ufs_on_device cleanup
 ufs_on_device_head() {
___
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: r312003 - head/usr.sbin/fstyp

2017-01-12 Thread Ngie Cooper (yaneurabeya)

> On Jan 12, 2017, at 18:14, Conrad Meyer  wrote:
> 
> Forgot to mention:
> 
> Documentation: 
> https://www.sans.org/reading-room/whitepapers/forensics/reverse-engineering-microsoft-exfat-file-system-33274
> 
> Images for testing: http://www.cfreds.nist.gov/dfr-test-images.html
> (raw disk images, include partition tables)

This commit doesn’t work as advertised:

$ fstyp dfr-01-xfat.img
fstyp: dfr-01-xfat.img: filesystem not recognized
$ grep exfat `which fstyp`
Binary file /usr/sbin/fstyp matches

-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r312003 - head/usr.sbin/fstyp

2017-01-12 Thread Ngie Cooper (yaneurabeya)

> On Jan 12, 2017, at 19:57, Ngie Cooper (yaneurabeya)  
> wrote:
> 
> 
>> On Jan 12, 2017, at 18:14, Conrad Meyer  wrote:
>> 
>> Forgot to mention:
>> 
>> Documentation: 
>> https://www.sans.org/reading-room/whitepapers/forensics/reverse-engineering-microsoft-exfat-file-system-33274
>> 
>> Images for testing: http://www.cfreds.nist.gov/dfr-test-images.html
>> (raw disk images, include partition tables)
> 
> This commit doesn’t work as advertised:
> 
> $ fstyp dfr-01-xfat.img
> fstyp: dfr-01-xfat.img: filesystem not recognized
> $ grep exfat `which fstyp`
> Binary file /usr/sbin/fstyp matches
> 
> -Ngie

Also:

$ file dfr-01-xfat.img
dfr-01-xfat.img: DOS/MBR boot sector
$ hexdump -C dfr-01-xfat.img | head -n 2
  eb 76 90 45 58 46 41 54  20 20 20 00 00 00 00 00  |.v.EXFAT   .|
0010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ||


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r312010 - head/usr.sbin/fstyp/tests

2017-01-12 Thread Ngie Cooper
Author: ngie
Date: Fri Jan 13 04:02:09 2017
New Revision: 312010
URL: https://svnweb.freebsd.org/changeset/base/312010

Log:
  Add testcase for exFAT that currently fails
  
  Disk image obtained from:
  http://www.cfreds.nist.gov/dfr-images/dfr-01-xfat.dd.bz2 -- was ripped off the
  first GPT partition and verified to be a FAT-like partition with 
file(1)/hexdump.
  
  This testcase currently fails
  
  PR:   214908
  Sponsored by: Dell EMC Isilon

Added:
  head/usr.sbin/fstyp/tests/dfr-01-xfat.img.bz2   (contents, props changed)
Modified:
  head/usr.sbin/fstyp/tests/Makefile
  head/usr.sbin/fstyp/tests/fstyp_test.sh

Modified: head/usr.sbin/fstyp/tests/Makefile
==
--- head/usr.sbin/fstyp/tests/Makefile  Fri Jan 13 03:42:51 2017
(r312009)
+++ head/usr.sbin/fstyp/tests/Makefile  Fri Jan 13 04:02:09 2017
(r312010)
@@ -4,6 +4,7 @@ PACKAGE=tests
 
 ATF_TESTS_SH=  fstyp_test
 
+${PACKAGE}FILES+=  dfr-01-xfat.img.bz2
 ${PACKAGE}FILES+=  ext2.img.bz2
 ${PACKAGE}FILES+=  ext3.img.bz2
 ${PACKAGE}FILES+=  ext4.img.bz2

Added: head/usr.sbin/fstyp/tests/dfr-01-xfat.img.bz2
==
Binary file. No diff available.

Modified: head/usr.sbin/fstyp/tests/fstyp_test.sh
==
--- head/usr.sbin/fstyp/tests/fstyp_test.sh Fri Jan 13 03:42:51 2017
(r312009)
+++ head/usr.sbin/fstyp/tests/fstyp_test.sh Fri Jan 13 04:02:09 2017
(r312010)
@@ -58,6 +58,15 @@ dir_body() {
atf_check -s exit:1 -e match:"not a disk" fstyp dir
 }
 
+atf_test_case exfat
+exfat_head() {
+   atf_set "descr" "fstyp(8) can detect exFAT filesystems"
+}
+exfat_body() {
+   bzcat $(atf_get_srcdir)/dfr-01-xfat.dd.bz2 > exfat.img
+   atf_check -s exit:0 -o inline:"exfat\n" fstyp exfat.img
+}
+
 atf_test_case empty
 empty_head() {
atf_set "descr" "fstyp(8) should fail on an empty file"
@@ -242,6 +251,7 @@ atf_init_test_cases() {
atf_add_test_case cd9660_label
atf_add_test_case dir
atf_add_test_case empty
+   atf_add_test_case exfat
atf_add_test_case ext2
atf_add_test_case ext3
atf_add_test_case ext4
___
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: r312011 - head/usr.sbin/fstyp/tests

2017-01-12 Thread Ngie Cooper
Author: ngie
Date: Fri Jan 13 04:04:48 2017
New Revision: 312011
URL: https://svnweb.freebsd.org/changeset/base/312011

Log:
  Use dfr-01-xfat.img.bz2, not dfr-01-xfat.dd.bz2 (the latter
  case was the full disk image from the website, which was never
  checked in to svn)
  
  Regardless, the testcase still fails
  
  PR:   214908
  Sponsored by: Dell EMC Isilon

Modified:
  head/usr.sbin/fstyp/tests/fstyp_test.sh

Modified: head/usr.sbin/fstyp/tests/fstyp_test.sh
==
--- head/usr.sbin/fstyp/tests/fstyp_test.sh Fri Jan 13 04:02:09 2017
(r312010)
+++ head/usr.sbin/fstyp/tests/fstyp_test.sh Fri Jan 13 04:04:48 2017
(r312011)
@@ -63,7 +63,7 @@ exfat_head() {
atf_set "descr" "fstyp(8) can detect exFAT filesystems"
 }
 exfat_body() {
-   bzcat $(atf_get_srcdir)/dfr-01-xfat.dd.bz2 > exfat.img
+   bzcat $(atf_get_srcdir)/dfr-01-xfat.img.bz2 > exfat.img
atf_check -s exit:0 -o inline:"exfat\n" fstyp exfat.img
 }
 
___
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: r311950 - head/sys/contrib/ipfilter/netinet

2017-01-12 Thread Cy Schubert
In message <201701120001.v0c012xl041...@repo.freebsd.org>, "Bjoern A. Zeeb" 
wri
tes:
> Author: bz
> Date: Thu Jan 12 00:01:02 2017
> New Revision: 311950
> URL: https://svnweb.freebsd.org/changeset/base/311950
> 
> Log:
>   Get rid of a compiler warning which I saw too often.
>   Include netinet/in.h before ip_compat.t which will then check if
>   IPPROTO_IPIP is defined or not.  Doing it the other way round,
>   ip_compat.h would not find it defined and netinet/in.h then
>   redefine it.
> 
> Modified:
>   head/sys/contrib/ipfilter/netinet/ip_fil.h
> 
> Modified: head/sys/contrib/ipfilter/netinet/ip_fil.h
> =
> =
> --- head/sys/contrib/ipfilter/netinet/ip_fil.hWed Jan 11 23:48:17 201
> 7 (r311949)
> +++ head/sys/contrib/ipfilter/netinet/ip_fil.hThu Jan 12 00:01:02 201
> 7 (r311950)
> @@ -11,6 +11,10 @@
>  #ifndef  __IP_FIL_H__
>  #define  __IP_FIL_H__
>  
> +#if !defined(linux) || !defined(_KERNEL)
> +# include 
> +#endif
> +
>  #include "netinet/ip_compat.h"
>  #include "netinet/ipf_rb.h"
>  #if NETBSD_GE_REV(10404)
> @@ -24,10 +28,6 @@
>  # endif
>  #endif
>  
> -#if !defined(linux) || !defined(_KERNEL)
> -# include 
> -#endif
> -
>  #ifndef  SOLARIS
>  # if defined(sun) && (defined(__svr4__) || defined(__SVR4))
>  #  defineSOLARIS 1
> 
> 

Thanks Bjoern.

Would you mind MFCing this at some point?


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX: Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.



___
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: r311952 - head/sys/ddb

2017-01-12 Thread Bruce Evans

On Thu, 12 Jan 2017, Mark Johnston wrote:


Log:
 Enable the use of ^C and ^S/^Q in DDB.

 This lets one interrupt DDB's output, which is useful if paging is
 disabled and the output device is slow.


This is quite broken.  It removes the code that was necessary for avoiding
loss of input.


Modified: head/sys/ddb/db_input.c
==
--- head/sys/ddb/db_input.c Thu Jan 12 00:09:31 2017(r311951)
+++ head/sys/ddb/db_input.c Thu Jan 12 00:22:36 2017(r311952)
@@ -63,7 +63,6 @@ static intdb_lhist_nlines;
#define BLANK   ' '
#define BACKUP  '\b'

-static int cnmaygetc(void);
static void db_delete(int n, int bwd);
static int  db_inputchar(int c);
static void db_putnchars(int c, int count);
@@ -291,12 +290,6 @@ db_inputchar(c)
return (0);
}

-static int
-cnmaygetc()
-{
-   return (-1);
-}
-


BSD never had a usable console API (function) for checking for input.
cncheckc() is the correct name for such a function.  The actual
cncheckc() returns any input that it finds.  This is not the main
problem here.  The input will have to be read here anyway to determine
what it is.  The problems are that there is no console API at all for
ungetting characters in the input stream, and this function doesn't
even use a stub cnungetc(), but drops the input on the floor.  It does
document this behaviour in a comment, but doesn't say that it is wrong.


int
db_readline(lstart, lsize)
char *  lstart;
@@ -350,7 +343,7 @@ db_check_interrupt(void)
{
int c;

-   c = cnmaygetc();
+   c = cncheckc();
switch (c) {
case -1:/* no character */
return;


The stub function always returns -1, so db_check_interrupt() is turned into
a no-op.

db_check_interrupt() now eats the first byte of any input on every call.


@@ -361,7 +354,7 @@ db_check_interrupt(void)

case CTRL('s'):
do {
-   c = cnmaygetc();
+   c = cncheckc();
if (c == CTRL('c'))
db_error((char *)0);
} while (c != CTRL('q'));


This is now a bad implementation of xon/xoff.  It doesn't support ixany,
but busy-waits for ^Q or ^C using cncheckc().  It should at least
busy-wait using cngetc(), since that might be do a smarter busy wait.
cngetc() is actually only slightly smarter -- it uses busy-waiting too,
but with cpu_spinwait() in the loop.  This cpu_spinwait() makes little
difference since cncheckc() tends to be a heavyweight function.  Only
cpu_spinwait()s in the innermost loops of cncheckc(), if any, are likely
to have much effect.

Multiple consoles complicate this a bit.

db_check_interrupt() is called after every db_putc() of a newline.  So
the breakage is mainly for type-ahead while writing many lines.

Control processing belongs in the lowest level of console drivers, and
at least the xon/xoff part is very easy to do.  This makes it work for
contexts like boot messages -- this can only be controlled now by booting
with -p, which gives something like an automatic ^S after every line,
but the control characters for this mode are unusual and there is no
way to get back to -p mode after turning it off or not starting with it.

-p mode also crashes if you don't turn it off before the (syscons)
keyboard is attached, since attachment temporarily breaks the input needed
to control the mode.  ddb control should worry about this even more.
Multiple consoles complicate this more than a bit.

For console driver development/debugging, I needed xon-xoff type control
and more (discard) at the driver level, especially when i/o to one of
the multiple consoles is unreachable to avoid deadlock, or too active.
It was easy to write primitive xon/xoff but not to avoid deadlocks in
this.  Hackish code looks like this:
diff -u2 syscons.c~ syscons.c

X --- syscons.c~2016-09-01 19:20:38.263745000 +
X +++ syscons.c 2016-10-14 07:12:18.947461000 +
X ...
X +static void
X +ec_wait(void)

ec_wait() is called to give time to read transient output about certain
errors (mainly in near-deadlock conditions).  The error message is written
directly to the frame buffer and will be overwritten if the deadlock
condition clears enough to allow normal output.

X +{
X + int c;
X + int timeout;
X +
X + if (ec_kill_ec_wait)
X + return;
X + c = inb(0xe060);

0xe060 is an otherwise-unused serial port which I can write control characters
too.

X + if (ec_wait_verbose)
X + ec_puts("\r\nec: hit any key to abort wait of 10 seconds...");
X + for (timeout = 0; timeout < ec_wait_delay; timeout++) {
X + // if (cncheckc() != -1)
X + // break;

Early versions used simply cncheckc().  This checks all consoles, so can
deadlock too easily, and it doesn't keep the input streams separate enough
for easy control of

svn commit: r312012 - head/lib/msun/tests

2017-01-12 Thread Ngie Cooper
Author: ngie
Date: Fri Jan 13 04:21:09 2017
New Revision: 312012
URL: https://svnweb.freebsd.org/changeset/base/312012

Log:
  fmaxmin_test still fails with clang 3.9.x.. bypass the test
  
  MFC after:3 days
  PR:   208703
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/msun/tests/Makefile

Modified: head/lib/msun/tests/Makefile
==
--- head/lib/msun/tests/MakefileFri Jan 13 04:04:48 2017
(r312011)
+++ head/lib/msun/tests/MakefileFri Jan 13 04:21:09 2017
(r312012)
@@ -56,7 +56,7 @@ TAP_TESTS_C+= exponential_test
 TAP_TESTS_C+=  fenv_test
 TAP_TESTS_C+=  fma_test
 # clang 3.8.0 fails always fails this test. See: bug 208703
-.if ! (${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} == 30800)
+.if ! (${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 30800)
 TAP_TESTS_C+=  fmaxmin_test
 .endif
 TAP_TESTS_C+=  ilogb2_test
___
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: r312013 - head/usr.sbin/route6d

2017-01-12 Thread Hiroki Sato
Author: hrs
Date: Fri Jan 13 06:22:49 2017
New Revision: 312013
URL: https://svnweb.freebsd.org/changeset/base/312013

Log:
  - Add static for functions and variables with internal linkage.
  - Quiet down -Wcast-align warnings.
  - Remove dead code.
  
  There is no functionality change.

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

Modified: head/usr.sbin/route6d/route6d.c
==
--- head/usr.sbin/route6d/route6d.c Fri Jan 13 04:21:09 2017
(r312012)
+++ head/usr.sbin/route6d/route6d.c Fri Jan 13 06:22:49 2017
(r312013)
@@ -100,7 +100,7 @@ struct ifc {/* Configuration of an 
in
TAILQ_HEAD(, iff) ifc_iff_head; /* list of filters */
int ifc_joined; /* joined to ff02::9 */
 };
-TAILQ_HEAD(, ifc) ifc_head = TAILQ_HEAD_INITIALIZER(ifc_head);
+static TAILQ_HEAD(, ifc) ifc_head = TAILQ_HEAD_INITIALIZER(ifc_head);
 
 struct ifac {  /* Adddress associated to an interface */
TAILQ_ENTRY(ifac) ifac_next;
@@ -120,21 +120,21 @@ struct iff {  /* Filters for an 
interfa
int iff_plen;
 };
 
-struct ifc **index2ifc;
-unsigned int   nindex2ifc;
-struct ifc *loopifcp = NULL;   /* pointing to loopback */
+static struct  ifc **index2ifc;
+static unsigned intnindex2ifc;
+static struct  ifc *loopifcp = NULL;   /* pointing to loopback */
 #ifdef HAVE_POLL_H
-struct pollfd set[2];
+static struct  pollfd set[2];
 #else
-fd_set *sockvecp;  /* vector to select() for receiving */
-fd_set *recvecp;
-intfdmasks;
-intmaxfd;  /* maximum fd for select() */
+static fd_set  *sockvecp;  /* vector to select() for receiving */
+static fd_set  *recvecp;
+static int fdmasks;
+static int maxfd;  /* maximum fd for select() */
 #endif
-intrtsock; /* the routing socket */
-intripsock;/* socket to send/receive RIP datagram */
+static int rtsock; /* the routing socket */
+static int ripsock;/* socket to send/receive RIP datagram */
 
-struct rip6 *ripbuf;   /* packet buffer for sending */
+static struct  rip6 *ripbuf;   /* packet buffer for sending */
 
 /*
  * Maintain the routes in a linked list.  When the number of the routes
@@ -159,41 +159,43 @@ struct riprt {
time_t  rrt_t;  /* when the route validated */
int rrt_index;  /* ifindex from which this route got */
 };
-TAILQ_HEAD(, riprt) riprt_head = TAILQ_HEAD_INITIALIZER(riprt_head);
+static TAILQ_HEAD(, riprt) riprt_head = TAILQ_HEAD_INITIALIZER(riprt_head);
 
-intdflag = 0;  /* debug flag */
-intqflag = 0;  /* quiet flag */
-intnflag = 0;  /* don't update kernel routing table */
-intaflag = 0;  /* age out even the statically defined routes */
-inthflag = 0;  /* don't split horizon */
-intlflag = 0;  /* exchange site local routes */
-intPflag = 0;  /* don't age out routes with RTF_PROTO[123] */
-intQflag = RTF_PROTO2; /* set RTF_PROTO[123] flag to routes by RIPng */
-intsflag = 0;  /* announce static routes w/ split horizon */
-intSflag = 0;  /* announce static routes to every interface */
-unsigned long routetag = 0;/* route tag attached on originating case */
-
-char   *filter[MAXFILTER];
-intfiltertype[MAXFILTER];
-intnfilter = 0;
-
-pid_t  pid;
-
-struct sockaddr_storage ripsin;
-
-intinterval = 1;
-time_t nextalarm = 0;
-time_t sup_trig_update = 0;
+static int dflag = 0;  /* debug flag */
+static int qflag = 0;  /* quiet flag */
+static int nflag = 0;  /* don't update kernel routing table */
+static int aflag = 0;  /* age out even the statically defined routes */
+static int hflag = 0;  /* don't split horizon */
+static int lflag = 0;  /* exchange site local routes */
+static int Pflag = 0;  /* don't age out routes with RTF_PROTO[123] */
+static int Qflag = RTF_PROTO2; /* set RTF_PROTO[123] flag to routes by 
RIPng */
+static int sflag = 0;  /* announce static routes w/ split horizon */
+static int Sflag = 0;  /* announce static routes to every interface */
+static unsigned long routetag = 0; /* route tag attached on originating 
case */
+
+static char*filter[MAXFILTER];
+static int filtertype[MAXFILTER];
+static int nfilter = 0;
 
-FILE   *rtlog = NULL;
+static pid_t   pid;
 
-int logopened = 0;
+static struct  sockaddr_storage ripsin;
+
+static int interval = 1;
+static time_t  nextalarm = 0;
+#if 0
+static time_t  sup_trig_update = 0;
+#endif
+
+static FILE*rtlog = NULL;
+
+static int logopened = 0;
 
 static int seq = 0;
 
-volatile sig_atomic_t seenalrm;
-volatile sig_atomic_t seenquit;
-volatile sig_atomic_t seenusr1;
+static volatile sig_atomic_t seenalrm;
+static volatile sig_atomic_t seenquit;
+static volatile sig_atomic_t se

svn commit: r312014 - head/sys/net80211

2017-01-12 Thread Adrian Chadd
Author: adrian
Date: Fri Jan 13 06:53:56 2017
New Revision: 312014
URL: https://svnweb.freebsd.org/changeset/base/312014

Log:
  [net80211] initial, somewhat incomplete VHT channel setup code and attach 
path.
  
  This sets up:
  
  * vht capabilities in vaps;
  * calls vht_announce to announce VHT capabilities if any;
  * sets up vht20, vht40 and vht80 channels, assuming the regulatory code
does the right thing with 80MHz available ranges;
  * adds support to the ieee80211_add_channel_list_5ghz() code to populate
VHT channels, as this is the API my ath10k driver is using;
  * add support for the freq1/freq2 field population and lookup that
VHT channels require.
  
  The VHT80 code assumes that the regulatory domain already has limited VHT80
  bands to, well, 80MHz wide chunks.

Modified:
  head/sys/net80211/ieee80211.c

Modified: head/sys/net80211/ieee80211.c
==
--- head/sys/net80211/ieee80211.c   Fri Jan 13 06:22:49 2017
(r312013)
+++ head/sys/net80211/ieee80211.c   Fri Jan 13 06:53:56 2017
(r312014)
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 #include 
+#include 
 
 #include 
 
@@ -119,6 +120,8 @@ static const struct ieee80211_rateset ie
{ 12, { B(2), B(4), B(11), B(22), 12, 18, 24, 36, 48, 72, 96, 108 } };
 #undef B
 
+static int set_vht_extchan(struct ieee80211_channel *c);
+
 /*
  * Fill in 802.11 available channel set, mark
  * all available channels as active, and pick
@@ -150,10 +153,23 @@ ieee80211_chan_init(struct ieee80211com 
 */
if (c->ic_ieee == 0)
c->ic_ieee = ieee80211_mhz2ieee(c->ic_freq,c->ic_flags);
+
+   /*
+* Setup the HT40/VHT40 upper/lower bits.
+* The VHT80 math is done elsewhere.
+*/
if (IEEE80211_IS_CHAN_HT40(c) && c->ic_extieee == 0)
c->ic_extieee = ieee80211_mhz2ieee(c->ic_freq +
(IEEE80211_IS_CHAN_HT40U(c) ? 20 : -20),
c->ic_flags);
+
+   /* Update VHT math */
+   /*
+* XXX VHT again, note that this assumes VHT80 channels
+* are legit already
+*/
+   set_vht_extchan(c);
+
/* default max tx power to max regulatory */
if (c->ic_maxpower == 0)
c->ic_maxpower = 2*c->ic_maxregpower;
@@ -343,6 +359,7 @@ ieee80211_ifattach(struct ieee80211com *
ieee80211_superg_attach(ic);
 #endif
ieee80211_ht_attach(ic);
+   ieee80211_vht_attach(ic);
ieee80211_scan_attach(ic);
ieee80211_regdomain_attach(ic);
ieee80211_dfs_attach(ic);
@@ -386,6 +403,7 @@ ieee80211_ifdetach(struct ieee80211com *
 #ifdef IEEE80211_SUPPORT_SUPERG
ieee80211_superg_detach(ic);
 #endif
+   ieee80211_vht_detach(ic);
ieee80211_ht_detach(ic);
/* NB: must be called before ieee80211_node_detach */
ieee80211_proto_detach(ic);
@@ -515,8 +533,15 @@ ieee80211_vap_setup(struct ieee80211com 
vap->iv_flags_ext = ic->ic_flags_ext;
vap->iv_flags_ven = ic->ic_flags_ven;
vap->iv_caps = ic->ic_caps &~ IEEE80211_C_OPMODE;
+
+   /* 11n capabilities - XXX methodize */
vap->iv_htcaps = ic->ic_htcaps;
vap->iv_htextcaps = ic->ic_htextcaps;
+
+   /* 11ac capabilities - XXX methodize */
+   vap->iv_vhtcaps = ic->ic_vhtcaps;
+   vap->iv_vhtextcaps = ic->ic_vhtextcaps;
+
vap->iv_opmode = opmode;
vap->iv_caps |= ieee80211_opcap[opmode];
IEEE80211_ADDR_COPY(vap->iv_myaddr, ic->ic_macaddr);
@@ -601,6 +626,7 @@ ieee80211_vap_setup(struct ieee80211com 
ieee80211_superg_vattach(vap);
 #endif
ieee80211_ht_vattach(vap);
+   ieee80211_vht_vattach(vap);
ieee80211_scan_vattach(vap);
ieee80211_regdomain_vattach(vap);
ieee80211_radiotap_vattach(vap);
@@ -737,6 +763,7 @@ ieee80211_vap_detach(struct ieee80211vap
 #ifdef IEEE80211_SUPPORT_SUPERG
ieee80211_superg_vdetach(vap);
 #endif
+   ieee80211_vht_vdetach(vap);
ieee80211_ht_vdetach(vap);
/* NB: must be before ieee80211_node_vdetach */
ieee80211_proto_vdetach(vap);
@@ -1081,6 +1108,110 @@ set_extchan(struct ieee80211_channel *c)
c->ic_extieee = 0;
 }
 
+/*
+ * Populate the freq1/freq2 fields as appropriate for VHT channels.
+ *
+ * This for now uses a hard-coded list of 80MHz wide channels.
+ *
+ * For HT20/HT40, freq1 just is the centre frequency of the 40MHz
+ * wide channel we've already decided upon.
+ *
+ * For VHT80 and VHT160, there are only a small number of fixed
+ * 80/160MHz wide channels, so we just use those.
+ *
+ * This is all likely very very wrong - both the regulatory code
+ * and this code needs to ensure that all four channels are
+ * available and valid before

svn commit: r312015 - head/sys/net80211

2017-01-12 Thread Adrian Chadd
Author: adrian
Date: Fri Jan 13 07:02:04 2017
New Revision: 312015
URL: https://svnweb.freebsd.org/changeset/base/312015

Log:
  [net80211] Initial VHT node upgrade/downgrade support and initial IE parsing.
  
  This is the bulk of the magic to start enabling VHT channel negotiation.
  It is absolutely, positively not yet even a complete VHT wave-1 
implementation.
  
  * parse IEs in scan, assoc req/resp, probe req/resp;
  * break apart the channel upgrade from the HT IE parsing - do it after the
VHT IEs are parsed;
  * (dirty! sigh) add channel width decision making in ieee80211_ht.c 
htinfo_update_chw().
This is the main bit where negotiated channel promotion through IEs occur.
  * Shoehorn in VHT node init ,teardown, rate control, etc calls like the HT
versions;
  * Do VHT channel adjustment where appropriate
  
  Tested:
  
  * monitor mode, ath10k port
  * STA mode, ath10k port - VHT20, VHT40, VHT80 modes
  
  TODO:
  
  * IBSS;
  * hostap;
  * (ignore mesh, wds for now);
  * finish 11n state engine - channel width change, opmode notifications, SMPS, 
etc;
  * VHT basic rate negotiation and acceptance criteria when scanning, 
associating, etc;
  * VHT control/management frame handling (group managment and operating mode 
being
the two big ones);
  * Verify TX/RX VHT rate negotiation is actually working correctly.
  
  Whilst here, add some comments about seqno allocation and locking.  To achieve
  the full VHT rates I need to push seqno allocation into the drivers and
  finally remove the IEEE80211_TX_LOCK() I added years ago to fix issues. :/

Modified:
  head/sys/net80211/ieee80211_adhoc.c
  head/sys/net80211/ieee80211_hostap.c
  head/sys/net80211/ieee80211_ht.c
  head/sys/net80211/ieee80211_ht.h
  head/sys/net80211/ieee80211_input.c
  head/sys/net80211/ieee80211_node.c
  head/sys/net80211/ieee80211_output.c
  head/sys/net80211/ieee80211_scan_sta.c
  head/sys/net80211/ieee80211_sta.c

Modified: head/sys/net80211/ieee80211_adhoc.c
==
--- head/sys/net80211/ieee80211_adhoc.c Fri Jan 13 06:53:56 2017
(r312014)
+++ head/sys/net80211/ieee80211_adhoc.c Fri Jan 13 07:02:04 2017
(r312015)
@@ -822,10 +822,14 @@ adhoc_recv_mgmt(struct ieee80211_node *n
 #if 0
if (scan.htcap != NULL && scan.htinfo != NULL &&
(vap->iv_flags_ht & IEEE80211_FHT_HT)) {
-   if (ieee80211_ht_updateparams(ni,
+   ieee80211_ht_updateparams(ni,
+   scan.htcap, scan.htinfo));
+   if (ieee80211_ht_updateparams_final(ni,
scan.htcap, scan.htinfo))
ht_state_change = 1;
}
+
+   /* XXX same for VHT? */
 #endif
if (ni != NULL) {
IEEE80211_RSSI_LPF(ni->ni_avgrssi, rssi);

Modified: head/sys/net80211/ieee80211_hostap.c
==
--- head/sys/net80211/ieee80211_hostap.cFri Jan 13 06:53:56 2017
(r312014)
+++ head/sys/net80211/ieee80211_hostap.cFri Jan 13 07:02:04 2017
(r312015)
@@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 #include 
+#include 
 
 #defineIEEE80211_RATE2MBS(r)   (((r) & IEEE80211_RATE_VAL) / 2)
 
@@ -1745,6 +1746,7 @@ hostap_recv_mgmt(struct ieee80211_node *
struct ieee80211_frame *wh;
uint8_t *frm, *efrm, *sfrm;
uint8_t *ssid, *rates, *xrates, *wpa, *rsn, *wme, *ath, *htcap;
+   uint8_t *vhtcap, *vhtinfo;
int reassoc, resp;
uint8_t rate;
 
@@ -2042,6 +2044,7 @@ hostap_recv_mgmt(struct ieee80211_node *
if (reassoc)
frm += 6;   /* ignore current AP info */
ssid = rates = xrates = wpa = rsn = wme = ath = htcap = NULL;
+   vhtcap = vhtinfo = NULL;
sfrm = frm;
while (efrm - frm > 1) {
IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2, return);
@@ -2061,6 +2064,12 @@ hostap_recv_mgmt(struct ieee80211_node *
case IEEE80211_ELEMID_HTCAP:
htcap = frm;
break;
+   case IEEE80211_ELEMID_VHT_CAP:
+   vhtcap = frm;
+   break;
+   case IEEE80211_ELEMID_VHT_OPMODE:
+   vhtinfo = frm;
+   break;
case IEEE80211_ELEMID_VENDOR:
if (iswpaoui(frm))
wpa = frm;
@@ -2135,10 +2144,22 @@ hostap_recv_mgmt(struct ieee80211_node *
vap->iv_stats.is_rx_assoc_norate++;
   

svn commit: r312016 - head/sys/net80211

2017-01-12 Thread Adrian Chadd
Author: adrian
Date: Fri Jan 13 07:08:14 2017
New Revision: 312016
URL: https://svnweb.freebsd.org/changeset/base/312016

Log:
  [net80211] begin laying the groundwork for drivers to do their own sequence 
number management.
  
  I added IEEE80211_TX_LOCK() a few years ago because there were races between
  seqno allocation, driver queuing and crypto IV allocation.  This meant that
  they'd appear out of sequence and the receiver would drop them, leading to
  terrible performance or flat out traffic hangs.
  
  This flag should be set by drivers that do their own sequence number
  allocation for all frames it needs to happen for, including beacon frames.
  
  Eventually this should lead to the driver taking care of locking for
  allocating seqno and other traffic-triggered events (eg addba setup.)

Modified:
  head/sys/net80211/ieee80211_var.h

Modified: head/sys/net80211/ieee80211_var.h
==
--- head/sys/net80211/ieee80211_var.h   Fri Jan 13 07:02:04 2017
(r312015)
+++ head/sys/net80211/ieee80211_var.h   Fri Jan 13 07:08:14 2017
(r312016)
@@ -629,11 +629,12 @@ MALLOC_DECLARE(M_80211_VAP);
 #defineIEEE80211_FEXT_PROBECHAN 0x0002 /* CONF: probe passive 
channel*/
 #defineIEEE80211_FEXT_UNIQMAC   0x0004 /* CONF: user or 
computed mac */
 #defineIEEE80211_FEXT_SCAN_OFFLOAD 0x0008  /* CONF: scan 
is fully offloaded */
+#defineIEEE80211_FEXT_SEQNO_OFFLOAD0x0010  /* CONF: driver 
does seqno insertion/allocation */
 
 #defineIEEE80211_FEXT_BITS \
"\20\2INACT\3SCANWAIT\4BGSCAN\5WPS\6TSN\7SCANREQ\10RESUME" \
"\0114ADDR\12NONEPR_PR\13SWBMISS\14DFS\15DOTD\16STATEWAIT\17REINIT" \
-   "\20BPF\21WDSLEGACY\22PROBECHAN\23UNIQMAC\24SCAN_OFFLOAD"
+   
"\20BPF\21WDSLEGACY\22PROBECHAN\23UNIQMAC\24SCAN_OFFLOAD\25SEQNO_OFFLOAD"
 
 /* ic_flags_ht/iv_flags_ht */
 #defineIEEE80211_FHT_NONHT_PR   0x0001 /* STATUS: non-HT sta 
present */
___
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: r312017 - head/sys/net80211

2017-01-12 Thread Adrian Chadd
Author: adrian
Date: Fri Jan 13 07:24:58 2017
New Revision: 312017
URL: https://svnweb.freebsd.org/changeset/base/312017

Log:
  [net80211] add a macro to check this configuration option.

Modified:
  head/sys/net80211/ieee80211_var.h

Modified: head/sys/net80211/ieee80211_var.h
==
--- head/sys/net80211/ieee80211_var.h   Fri Jan 13 07:08:14 2017
(r312016)
+++ head/sys/net80211/ieee80211_var.h   Fri Jan 13 07:24:58 2017
(r312017)
@@ -95,6 +95,9 @@
  */
 #defineIEEE80211_CONF_VHT(ic)  ((ic)->ic_vhtcaps != 0)
 
+#defineIEEE80211_CONF_SEQNO_OFFLOAD(ic)\
+   ((ic)->ic_flags_ext & IEEE80211_FEXT_SEQNO_OFFLOAD)
+
 /*
  * 802.11 control state is split into a common portion that maps
  * 1-1 to a physical device and one or more "Virtual AP's" (VAP)
___
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"