svn commit: r339905 - stable/12/sys/dev/cxgbe

2018-10-29 Thread Navdeep Parhar
Author: np
Date: Tue Oct 30 05:04:18 2018
New Revision: 339905
URL: https://svnweb.freebsd.org/changeset/base/339905

Log:
  MFC r339626:
  
  cxgbe(4): Use automatic cidx updates with ofld and ctrl queues.
  
  The bits that explicitly request cidx updates do not work reliably with
  all possible WRs that can be sent over the queue.  The F_FW_WR_EQUIQ
  requests that still remain may also have to be replaced with explicit
  credit flush WRs in the future.
  
  Approved by:  re@ (rgrimes@)
  Sponsored by: Chelsio Communications

Modified:
  stable/12/sys/dev/cxgbe/t4_sge.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/cxgbe/t4_sge.c
==
--- stable/12/sys/dev/cxgbe/t4_sge.cTue Oct 30 02:37:23 2018
(r339904)
+++ stable/12/sys/dev/cxgbe/t4_sge.cTue Oct 30 05:04:18 2018
(r339905)
@@ -2089,12 +2089,13 @@ drain_wrq_wr_list(struct adapter *sc, struct sge_wrq *
 
if (available < eq->sidx / 4 &&
atomic_cmpset_int(>equiq, 0, 1)) {
+   /*
+* XXX: This is not 100% reliable with some
+* types of WRs.  But this is a very unusual
+* situation for an ofld/ctrl queue anyway.
+*/
dst->equiq_to_len16 |= htobe32(F_FW_WR_EQUIQ |
F_FW_WR_EQUEQ);
-   eq->equeqidx = eq->pidx;
-   } else if (IDXDIFF(eq->pidx, eq->equeqidx, eq->sidx) >= 32) {
-   dst->equiq_to_len16 |= htobe32(F_FW_WR_EQUEQ);
-   eq->equeqidx = eq->pidx;
}
 
dbdiff += n;
@@ -2644,12 +2645,13 @@ commit_wrq_wr(struct sge_wrq *wrq, void *w, struct wrq
available = IDXDIFF(eq->cidx, eq->pidx, eq->sidx) - 1;
if (available < eq->sidx / 4 &&
atomic_cmpset_int(>equiq, 0, 1)) {
+   /*
+* XXX: This is not 100% reliable with some
+* types of WRs.  But this is a very unusual
+* situation for an ofld/ctrl queue anyway.
+*/
dst->equiq_to_len16 |= htobe32(F_FW_WR_EQUIQ |
F_FW_WR_EQUEQ);
-   eq->equeqidx = pidx;
-   } else if (IDXDIFF(eq->pidx, eq->equeqidx, eq->sidx) >= 
32) {
-   dst->equiq_to_len16 |= htobe32(F_FW_WR_EQUEQ);
-   eq->equeqidx = pidx;
}
 
ring_eq_db(wrq->adapter, eq, ndesc);
@@ -3584,6 +3586,23 @@ free_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm_
 }
 #endif
 
+/*
+ * Returns a reasonable automatic cidx flush threshold for a given queue size.
+ */
+static u_int
+qsize_to_fthresh(int qsize)
+{
+   u_int fthresh;
+
+   while (!powerof2(qsize))
+   qsize++;
+   fthresh = ilog2(qsize);
+   if (fthresh > X_CIDXFLUSHTHRESH_128)
+   fthresh = X_CIDXFLUSHTHRESH_128;
+
+   return (fthresh);
+}
+
 static int
 ctrl_eq_alloc(struct adapter *sc, struct sge_eq *eq)
 {
@@ -3607,7 +3626,7 @@ ctrl_eq_alloc(struct adapter *sc, struct sge_eq *eq)
c.dcaen_to_eqsize =
htobe32(V_FW_EQ_CTRL_CMD_FBMIN(X_FETCHBURSTMIN_64B) |
V_FW_EQ_CTRL_CMD_FBMAX(X_FETCHBURSTMAX_512B) |
-   V_FW_EQ_CTRL_CMD_CIDXFTHRESH(X_CIDXFLUSHTHRESH_32) |
+   V_FW_EQ_CTRL_CMD_CIDXFTHRESH(qsize_to_fthresh(qsize)) |
V_FW_EQ_CTRL_CMD_EQSIZE(qsize));
c.eqaddr = htobe64(eq->ba);
 
@@ -3689,12 +3708,13 @@ ofld_eq_alloc(struct adapter *sc, struct vi_info *vi, 
c.alloc_to_len16 = htonl(F_FW_EQ_OFLD_CMD_ALLOC |
F_FW_EQ_OFLD_CMD_EQSTART | FW_LEN16(c));
c.fetchszm_to_iqid =
-   htonl(V_FW_EQ_OFLD_CMD_HOSTFCMODE(X_HOSTFCMODE_NONE) |
+   htonl(V_FW_EQ_OFLD_CMD_HOSTFCMODE(X_HOSTFCMODE_STATUS_PAGE) |
V_FW_EQ_OFLD_CMD_PCIECHN(eq->tx_chan) |
F_FW_EQ_OFLD_CMD_FETCHRO | V_FW_EQ_OFLD_CMD_IQID(eq->iqid));
c.dcaen_to_eqsize =
htobe32(V_FW_EQ_OFLD_CMD_FBMIN(X_FETCHBURSTMIN_64B) |
V_FW_EQ_OFLD_CMD_FBMAX(X_FETCHBURSTMAX_512B) |
+   V_FW_EQ_OFLD_CMD_CIDXFTHRESH(qsize_to_fthresh(qsize)) |
V_FW_EQ_OFLD_CMD_EQSIZE(qsize));
c.eqaddr = htobe64(eq->ba);
 
@@ -3732,8 +3752,9 @@ alloc_eq(struct adapter *sc, struct vi_info *vi, struc
if (rc)
return (rc);
 
-   eq->pidx = eq->cidx = 0;
-   eq->equeqidx = eq->dbidx = 0;
+   eq->pidx = eq->cidx = eq->dbidx = 0;
+   /* Note that equeqidx is not used with 

svn commit: r339904 - in head: contrib/netbsd-tests/lib/libc/time lib/libc/tests

2018-10-29 Thread Yuri Pankov
Author: yuripv
Date: Tue Oct 30 02:37:23 2018
New Revision: 339904
URL: https://svnweb.freebsd.org/changeset/base/339904

Log:
  Connect libc/tests/time to the build, adding test cases for strptime()
  issues fixed recently, and disabling the failing ones (mostly due to TZ
  parsing differences with NetBSD).
  
  Reviewed by:  ngie
  Approved by:  kib (mentor)
  Differential Revision:https://reviews.freebsd.org/D17546

Modified:
  head/contrib/netbsd-tests/lib/libc/time/t_mktime.c
  head/contrib/netbsd-tests/lib/libc/time/t_strptime.c
  head/lib/libc/tests/Makefile

Modified: head/contrib/netbsd-tests/lib/libc/time/t_mktime.c
==
--- head/contrib/netbsd-tests/lib/libc/time/t_mktime.c  Tue Oct 30 01:39:22 
2018(r339903)
+++ head/contrib/netbsd-tests/lib/libc/time/t_mktime.c  Tue Oct 30 02:37:23 
2018(r339904)
@@ -64,6 +64,9 @@ ATF_TC_HEAD(mktime_negyear, tc)
 
 ATF_TC_BODY(mktime_negyear, tc)
 {
+#ifdef __FreeBSD__
+   atf_tc_expect_fail("needs work");
+#endif
struct tm tms;
time_t t;
 

Modified: head/contrib/netbsd-tests/lib/libc/time/t_strptime.c
==
--- head/contrib/netbsd-tests/lib/libc/time/t_strptime.cTue Oct 30 
01:39:22 2018(r339903)
+++ head/contrib/netbsd-tests/lib/libc/time/t_strptime.cTue Oct 30 
02:37:23 2018(r339904)
@@ -103,6 +103,7 @@ static struct {
const char *name;
long offs;
 } zt[] = {
+#ifndef __FreeBSD__
{ "Z",  0 },
{ "UT", 0 },
{ "UTC",0 },
@@ -173,6 +174,7 @@ static struct {
{ "EST4EDT",-14400 },
 
{ "Bogus",  -1 },
+#endif
 };
 
 static void
@@ -188,9 +190,11 @@ ztest1(const char *name, const char *fmt, long value)
value = 0;
 
switch (value) {
+#ifndef __FreeBSD__
case -2:
value = -timezone;
break;
+#endif
case -1:
if (fmt[1] == 'Z')
value = 0;
@@ -210,9 +214,11 @@ static void
 ztest(const char *fmt)
 {
setenv("TZ", "US/Eastern", 1);
+#ifndef __FreeBSD__
ztest1("GMT", fmt, 0);
ztest1("UTC", fmt, 0);
ztest1("US/Eastern", fmt, -18000);
+#endif
for (size_t i = 0; i < __arraycount(zt); i++)
ztest1(zt[i].name, fmt, zt[i].offs);
 }
@@ -228,10 +234,6 @@ ATF_TC_HEAD(common, tc)
 ATF_TC_BODY(common, tc)
 {
 
-#ifdef __FreeBSD__
-   atf_tc_expect_fail("There are various issues with strptime on FreeBSD");
-#endif
-
h_pass("Tue Jan 20 23:27:46 1998", "%a %b %d %T %Y",
24, 46, 27, 23, 20, 0, 98, 2, 19);
h_pass("Tue Jan 20 23:27:46 1998", "%a %b %d %H:%M:%S %Y",
@@ -305,6 +307,10 @@ ATF_TC_BODY(day, tc)
 #else
h_pass("SaturDay", "%OA", 8, -1, -1, -1, -1, -1, -1, 6, -1);
 #endif
+
+#ifdef __FreeBSD__
+   h_fail("00", "%d");
+#endif
 }
 
 ATF_TC(hour);
@@ -313,7 +319,11 @@ ATF_TC_HEAD(hour, tc)
 {
 
atf_tc_set_md_var(tc, "descr",
+#ifdef __FreeBSD__
+ "Checks strptime(3) hour conversions [HIkl]");
+#else
  "Checks strptime(3) hour conversions [IH]");
+#endif
 }
 
 ATF_TC_BODY(hour, tc)
@@ -321,6 +331,10 @@ ATF_TC_BODY(hour, tc)
 
h_fail("00", "%I");
h_fail("13", "%I");
+#ifdef __FreeBSD__
+   h_fail("00", "%l");
+   h_fail("13", "%l");
+#endif
 
h_pass("00", "%H", 2, -1, -1, 0, -1, -1, -1, -1, -1);
h_pass("12", "%H", 2, -1, -1, 12, -1, -1, -1, -1, -1);
@@ -413,7 +427,18 @@ ATF_TC_BODY(seconds, tc)
h_pass("0", "%S", 1, 0, -1, -1, -1, -1, -1, -1, -1);
h_pass("59", "%S", 2, 59, -1, -1, -1, -1, -1, -1, -1);
h_pass("60", "%S", 2, 60, -1, -1, -1, -1, -1, -1, -1);
+#ifdef __FreeBSD__
+   /*
+* (Much) older versions of the standard (up to the Issue 6) allowed for
+* [0;61] range in %S conversion for double-leap seconds, and it's
+* apparently what NetBSD and glibc are expecting, however current
+* version defines allowed values to be [0;60], and that is what our
+* strptime() implementation expects.
+*/
+   h_fail("61", "%S");
+#else
h_pass("61", "%S", 2, 61, -1, -1, -1, -1, -1, -1, -1);
+#endif
h_fail("62", "%S");
 }
 
@@ -434,7 +459,9 @@ ATF_TC_BODY(year, tc)
h_pass("x2084y", "x%C%yy", 6, -1, -1, -1, -1, -1, 184, -1, -1);
h_pass("x8420y", "x%y%Cy", 6, -1, -1, -1, -1, -1, 184, -1, -1);
h_pass("%20845", "%%%C%y5", 6, -1, -1, -1, -1, -1, 184, -1, -1);
+#ifndef __FreeBSD__
h_fail("%", "%E%");
+#endif
 
h_pass("1980", "%Y", 4, -1, -1, -1, -1, -1, 80, -1, -1);
h_pass("1980", "%EY", 4, -1, -1, -1, -1, -1, 80, -1, -1);
@@ -467,7 +494,7 @@ ATF_TC_HEAD(Zone, tc)
 
 

svn commit: r339902 - head/sys/powerpc/mpc85xx

2018-10-29 Thread Justin Hibbits
Author: jhibbits
Date: Tue Oct 30 00:47:40 2018
New Revision: 339902
URL: https://svnweb.freebsd.org/changeset/base/339902

Log:
  powerpc/mpc85xx: Reset the PCIe bus on attach
  
  It seems if a Radeon card is already initialized by u-boot, it won't be
  reinitialized by the kernel, and the DRM module will fail to attach.  This
  steals the reset code from mips/octopci.c to blindly reset the bus on attach.
  This was tested on a AmigaOne X5000/20, such that it can be booted from the
  local video console, and get a video console in FreeBSD.

Modified:
  head/sys/powerpc/mpc85xx/pci_mpc85xx.c

Modified: head/sys/powerpc/mpc85xx/pci_mpc85xx.c
==
--- head/sys/powerpc/mpc85xx/pci_mpc85xx.c  Tue Oct 30 00:23:37 2018
(r339901)
+++ head/sys/powerpc/mpc85xx/pci_mpc85xx.c  Tue Oct 30 00:47:40 2018
(r339902)
@@ -562,7 +562,7 @@ fsl_pcib_init(struct fsl_pcib_softc *sc, int bus, int 
int new_pribus, new_secbus, new_subbus;
int slot, func, maxfunc;
uint16_t vendor, device;
-   uint8_t command, hdrtype, subclass;
+   uint8_t brctl, command, hdrtype, subclass;
 
secbus = bus;
for (slot = 0; slot <= maxslot; slot++) {
@@ -605,6 +605,17 @@ fsl_pcib_init(struct fsl_pcib_softc *sc, int bus, int 
/* Allow all DEVTYPE 1 devices */
if (hdrtype != PCIM_HDRTYPE_BRIDGE)
continue;
+
+   brctl = fsl_pcib_read_config(sc->sc_dev, bus, slot, 
func,
+   PCIR_BRIDGECTL_1, 1);
+   brctl |= PCIB_BCR_SECBUS_RESET;
+   fsl_pcib_write_config(sc->sc_dev, bus, slot, func,
+   PCIR_BRIDGECTL_1, brctl, 1);
+   DELAY(10);
+   brctl &= ~PCIB_BCR_SECBUS_RESET;
+   fsl_pcib_write_config(sc->sc_dev, bus, slot, func,
+   PCIR_BRIDGECTL_1, brctl, 1);
+   DELAY(10);
 
secbus++;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339901 - head/sys/conf

2018-10-29 Thread John Baldwin
Author: jhb
Date: Tue Oct 30 00:23:37 2018
New Revision: 339901
URL: https://svnweb.freebsd.org/changeset/base/339901

Log:
  Permit local kernel modules to be built as part of a kernel build.
  
  Add support for "local" modules.  By default, these modules are
  located in LOCALBASE/sys/modules (where LOCALBASE defaults to
  /usr/local).  Individual modules can be built along with a kernel by
  defining LOCAL_MODULES to the list of modules.  Each is assumed to be
  a subdirectory containing a valid Makefile.  If LOCAL_MODULES is not
  specified, all of the modules present in LOCALBASE/sys/modules are
  built and installed along with the kernel.
  
  This means that a port that installs a kernel module can choose to
  install its source along with a suitable Makefile to
  /usr/local/sys/modules/.  Future kernel builds will then include
  that kernel module using the kernel configuration's opt_*.h headers
  and install it into /boot/kernel along with other kernel-specific
  modules.
  
  This is not trying to solve the issue of folks running GENERIC release
  kernels, but is instead aimed at folks who build their own kernels.
  For those folks this ensures that kernel modules from ports will
  always be using the right KBI, etc.  This includes folks running any
  KBI-breaking kernel configs (such as PAE).
  
  There are still some kinks to be worked out with cross-building (we
  probably shouldn't include local modules in cross-built kernels by
  default), but this is a sufficient starting point.
  
  Reviewed by:  imp
  MFC after:3 months
  Relnotes: yes
  Differential Revision:https://reviews.freebsd.org/D16966

Modified:
  head/sys/conf/kern.post.mk

Modified: head/sys/conf/kern.post.mk
==
--- head/sys/conf/kern.post.mk  Tue Oct 30 00:22:14 2018(r339900)
+++ head/sys/conf/kern.post.mk  Tue Oct 30 00:23:37 2018(r339901)
@@ -35,24 +35,41 @@ KERN_DEBUGDIR?= ${DEBUGDIR}
 
 .MAIN: all
 
+.if !defined(NO_MODULES)
+# Default prefix used for modules installed from ports
+LOCALBASE?=/usr/local
+
+LOCAL_MODULES_DIR?= ${LOCALBASE}/sys/modules
+
+# Default to installing all modules installed by ports unless overridden
+# by the user.
+.if !defined(LOCAL_MODULES)
+LOCAL_MODULES!= ls ${LOCAL_MODULES_DIR}
+.endif
+.endif
+
 .for target in all clean cleandepend cleandir clobber depend install \
 ${_obj} reinstall tags
 ${target}: kernel-${target}
-.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists($S/modules)
+.if !defined(NO_MODULES)
 ${target}: modules-${target}
 modules-${target}:
+.if !defined(MODULES_WITH_WORLD) && exists($S/modules)
cd $S/modules; ${MKMODULESENV} ${MAKE} \
${target:S/^reinstall$/install/:S/^clobber$/cleandir/}
 .endif
+.for module in ${LOCAL_MODULES}
+   cd ${LOCAL_MODULES_DIR}/${module}; ${MKMODULESENV} ${MAKE} \
+   ${target:S/^reinstall$/install/:S/^clobber$/cleandir/}
 .endfor
+.endif
+.endfor
 
 # Handle ports (as defined by the user) that build kernel modules
 .if !defined(NO_MODULES) && defined(PORTS_MODULES)
 #
 # The ports tree needs some environment variables defined to match the new 
kernel
 #
-# Ports search for some dependencies in PATH, so add the location of the 
installed files
-LOCALBASE?=/usr/local
 # SRC_BASE is how the ports tree refers to the location of the base source 
files
 .if !defined(SRC_BASE)
 SRC_BASE=  ${SYSDIR:H:tA}
@@ -64,6 +81,9 @@ OSRELDATE!=   awk '/^\#define[[:space:]]*__FreeBSD_versi
${MAKEOBJDIRPREFIX}${SRC_BASE}/include/osreldate.h
 .endif
 # Keep the related ports builds in the obj directory so that they are only 
rebuilt once per kernel build
+#
+# Ports search for some dependencies in PATH, so add the location of the
+# installed files
 WRKDIRPREFIX?= ${.OBJDIR}
 PORTSMODULESENV=\
env \
@@ -110,7 +130,7 @@ kernel-clobber:
 
 kernel-obj:
 
-.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists($S/modules)
+.if !defined(NO_MODULES)
 modules: modules-all
 
 .if !defined(NO_MODULES_OBJ)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339900 - head/sys/geom/concat

2018-10-29 Thread Mark Johnston
Author: markj
Date: Tue Oct 30 00:22:14 2018
New Revision: 339900
URL: https://svnweb.freebsd.org/changeset/base/339900

Log:
  Have gconcat advertise delete support if one of its disks does.
  
  This follows the example set by other multi-disk GEOM classes.
  
  PR:   232676
  Tested by:noah.bergba...@tum.de
  MFC after:1 month

Modified:
  head/sys/geom/concat/g_concat.c
  head/sys/geom/concat/g_concat.h

Modified: head/sys/geom/concat/g_concat.c
==
--- head/sys/geom/concat/g_concat.c Tue Oct 30 00:19:44 2018
(r339899)
+++ head/sys/geom/concat/g_concat.c Tue Oct 30 00:22:14 2018
(r339900)
@@ -206,6 +206,27 @@ fail:
 }
 
 static void
+g_concat_candelete(struct bio *bp)
+{
+   struct g_concat_softc *sc;
+   struct g_concat_disk *disk;
+   int i, *val;
+
+   val = (int *)bp->bio_data;
+   *val = 0;
+
+   sc = bp->bio_to->geom->softc;
+   for (i = 0; i < sc->sc_ndisks; i++) {
+   disk = >sc_disks[i];
+   if (!disk->d_removed && disk->d_candelete) {
+   *val = 1;
+   break;
+   }
+   }
+   g_io_deliver(bp, 0);
+}
+
+static void
 g_concat_kernel_dump(struct bio *bp)
 {
struct g_concat_softc *sc;
@@ -327,6 +348,9 @@ g_concat_start(struct bio *bp)
if (strcmp("GEOM::kerneldump", bp->bio_attribute) == 0) {
g_concat_kernel_dump(bp);
return;
+   } else if (strcmp("GEOM::candelete", bp->bio_attribute) == 0) {
+   g_concat_candelete(bp);
+   return;
}
/* To which provider it should be delivered? */
/* FALLTHROUGH */
@@ -408,6 +432,7 @@ g_concat_check_and_run(struct g_concat_softc *sc)
struct g_provider *dp, *pp;
u_int no, sectorsize = 0;
off_t start;
+   int error;
 
g_topology_assert();
if (g_concat_nvalid(sc) != sc->sc_ndisks)
@@ -425,6 +450,16 @@ g_concat_check_and_run(struct g_concat_softc *sc)
if (sc->sc_type == G_CONCAT_TYPE_AUTOMATIC)
disk->d_end -= dp->sectorsize;
start = disk->d_end;
+   error = g_access(disk->d_consumer, 1, 0, 0);
+   if (error == 0) {
+   error = g_getattr("GEOM::candelete", disk->d_consumer,
+   >d_candelete);
+   if (error != 0)
+   disk->d_candelete = 0;
+   (void)g_access(disk->d_consumer, -1, 0, 0);
+   } else
+   G_CONCAT_DEBUG(1, "Failed to access disk %s, error %d.",
+   dp->name, error);
if (no == 0)
sectorsize = dp->sectorsize;
else

Modified: head/sys/geom/concat/g_concat.h
==
--- head/sys/geom/concat/g_concat.h Tue Oct 30 00:19:44 2018
(r339899)
+++ head/sys/geom/concat/g_concat.h Tue Oct 30 00:22:14 2018
(r339900)
@@ -74,6 +74,7 @@ struct g_concat_disk {
struct g_concat_softc   *d_softc;
off_td_start;
off_td_end;
+   int  d_candelete;
int  d_removed;
 };
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339899 - head/sys/dev/acpica

2018-10-29 Thread John Baldwin
Author: jhb
Date: Tue Oct 30 00:19:44 2018
New Revision: 339899
URL: https://svnweb.freebsd.org/changeset/base/339899

Log:
  Make battery emptying rate available as sysctl variable.
  
  Curiously, the in-kernel routines always use the design voltage to
  convert from mA to mW, but acpiconf in userland uses the current
  voltage.  As a result, this can report a different mW rate than
  acpiconf.
  
  Submitted by: Manuel Stühn 
  MFC after:2 months
  Differential Revision:https://reviews.freebsd.org/D17077

Modified:
  head/sys/dev/acpica/acpi_battery.c

Modified: head/sys/dev/acpica/acpi_battery.c
==
--- head/sys/dev/acpica/acpi_battery.c  Tue Oct 30 00:11:30 2018
(r339898)
+++ head/sys/dev/acpica/acpi_battery.c  Tue Oct 30 00:19:44 2018
(r339899)
@@ -487,6 +487,11 @@ acpi_battery_init(void)
"remaining time in minutes");
 SYSCTL_ADD_PROC(_battery_sysctl_ctx,
SYSCTL_CHILDREN(acpi_battery_sysctl_tree),
+   OID_AUTO, "rate", CTLTYPE_INT | CTLFLAG_RD,
+   _battery_battinfo.rate, 0, acpi_battery_sysctl, "I",
+   "present rate in mW");
+SYSCTL_ADD_PROC(_battery_sysctl_ctx,
+   SYSCTL_CHILDREN(acpi_battery_sysctl_tree),
OID_AUTO, "state", CTLTYPE_INT | CTLFLAG_RD,
_battery_battinfo.state, 0, acpi_battery_sysctl, "I",
"current status flags");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339898 - head/lib/libc/amd64/sys

2018-10-29 Thread Konstantin Belousov
Author: kib
Date: Tue Oct 30 00:11:30 2018
New Revision: 339898
URL: https://svnweb.freebsd.org/changeset/base/339898

Log:
  Convert amd64_get/set_fs/gsbase to ifunc.
  
  Note that this is the first use of ifuncs in our userspace.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 month

Deleted:
  head/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.c
  head/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.h
Modified:
  head/lib/libc/amd64/sys/Makefile.inc
  head/lib/libc/amd64/sys/amd64_get_fsbase.c
  head/lib/libc/amd64/sys/amd64_get_gsbase.c
  head/lib/libc/amd64/sys/amd64_set_fsbase.c
  head/lib/libc/amd64/sys/amd64_set_gsbase.c

Modified: head/lib/libc/amd64/sys/Makefile.inc
==
--- head/lib/libc/amd64/sys/Makefile.incMon Oct 29 23:59:26 2018
(r339897)
+++ head/lib/libc/amd64/sys/Makefile.incTue Oct 30 00:11:30 2018
(r339898)
@@ -2,7 +2,6 @@
 # $FreeBSD$
 
 SRCS+= \
-   amd64_detect_rdfsgsbase.c \
amd64_get_fsbase.c \
amd64_get_gsbase.c \
amd64_set_fsbase.c \

Modified: head/lib/libc/amd64/sys/amd64_get_fsbase.c
==
--- head/lib/libc/amd64/sys/amd64_get_fsbase.c  Mon Oct 29 23:59:26 2018
(r339897)
+++ head/lib/libc/amd64/sys/amd64_get_fsbase.c  Tue Oct 30 00:11:30 2018
(r339898)
@@ -2,7 +2,7 @@
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
  * Copyright (c) 2003 Peter Wemm
- * Copyright (c) 2017 The FreeBSD Foundation
+ * Copyright (c) 2017, 2018 The FreeBSD Foundation
  * All rights reserved.
  *
  * Portions of this software were developed by Konstantin Belousov
@@ -33,18 +33,35 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include 
+#defineIN_RTLD 1
+#include 
+#undef IN_RTLD
 #include 
+#include 
 #include 
-#include "amd64_detect_rdfsgsbase.h"
+#include 
+#include "libc_private.h"
 
-int
-amd64_get_fsbase(void **addr)
+static int
+amd64_get_fsbase_cpu(void **addr)
 {
 
-   if (amd64_detect_rdfsgsbase() == RDFSGS_SUPPORTED) {
-   *addr = (void *)rdfsbase();
-   return (0);
-   }
+   *addr = (void *)rdfsbase();
+   return (0);
+}
+
+static int
+amd64_get_fsbase_syscall(void **addr)
+{
+
return (sysarch(AMD64_GET_FSBASE, addr));
+}
+
+DEFINE_UIFUNC(, int, amd64_get_fsbase, (void **), static)
+{
+
+   if (__getosreldate() >= P_OSREL_WRFSBASE &&
+   (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0)
+   return (amd64_get_fsbase_cpu);
+   return (amd64_get_fsbase_syscall);
 }

Modified: head/lib/libc/amd64/sys/amd64_get_gsbase.c
==
--- head/lib/libc/amd64/sys/amd64_get_gsbase.c  Mon Oct 29 23:59:26 2018
(r339897)
+++ head/lib/libc/amd64/sys/amd64_get_gsbase.c  Tue Oct 30 00:11:30 2018
(r339898)
@@ -2,7 +2,7 @@
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
  * Copyright (c) 2003 Peter Wemm
- * Copyright (c) 2017 The FreeBSD Foundation
+ * Copyright (c) 2017, 2018 The FreeBSD Foundation
  * All rights reserved.
  *
  * Portions of this software were developed by Konstantin Belousov
@@ -33,18 +33,35 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include 
+#defineIN_RTLD 1
+#include 
+#undef IN_RTLD
 #include 
+#include 
 #include 
-#include "amd64_detect_rdfsgsbase.h"
+#include 
+#include "libc_private.h"
 
-int
-amd64_get_gsbase(void **addr)
+static int
+amd64_get_gsbase_cpu(void **addr)
 {
 
-   if  (amd64_detect_rdfsgsbase() == RDFSGS_SUPPORTED) {
-   *addr = (void *)rdgsbase();
-   return (0);
-   }
+   *addr = (void *)rdgsbase();
+   return (0);
+}
+
+static int
+amd64_get_gsbase_syscall(void **addr)
+{
+
return (sysarch(AMD64_GET_GSBASE, addr));
+}
+
+DEFINE_UIFUNC(, int, amd64_get_gsbase, (void **), static)
+{
+
+   if (__getosreldate() >= P_OSREL_WRFSBASE &&
+   (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0)
+   return (amd64_get_gsbase_cpu);
+   return (amd64_get_gsbase_syscall);
 }

Modified: head/lib/libc/amd64/sys/amd64_set_fsbase.c
==
--- head/lib/libc/amd64/sys/amd64_set_fsbase.c  Mon Oct 29 23:59:26 2018
(r339897)
+++ head/lib/libc/amd64/sys/amd64_set_fsbase.c  Tue Oct 30 00:11:30 2018
(r339898)
@@ -2,7 +2,7 @@
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
  * Copyright (c) 2003 Peter Wemm
- * Copyright (c) 2017 The FreeBSD Foundation
+ * Copyright (c) 2017, 2018 The FreeBSD Foundation
  * All rights reserved.
  *
  * Portions of this software were developed by Konstantin Belousov
@@ -33,18 +33,35 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include 
+#defineIN_RTLD 1
+#include 
+#undef IN_RTLD
 #include 
+#include 
 #include 
-#include "amd64_detect_rdfsgsbase.h"
+#include 
+#include 

svn commit: r339897 - head/libexec/rtld-elf/amd64

2018-10-29 Thread Konstantin Belousov
Author: kib
Date: Mon Oct 29 23:59:26 2018
New Revision: 339897
URL: https://svnweb.freebsd.org/changeset/base/339897

Log:
  Remove rtld use of libc amd64_set_fsbase().
  
  One less non-trivial dependency of rtld on libc.  Also,
  amd64_set_fsbase() is to be converted to ifunc, which I do not want to
  support inside rtld.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

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

Modified: head/libexec/rtld-elf/amd64/reloc.c
==
--- head/libexec/rtld-elf/amd64/reloc.c Mon Oct 29 23:56:39 2018
(r339896)
+++ head/libexec/rtld-elf/amd64/reloc.c Mon Oct 29 23:59:26 2018
(r339897)
@@ -35,8 +35,9 @@
 
 #include 
 #include 
-#include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -495,17 +496,26 @@ pre_init(void)
 
 }
 
+int __getosreldate(void);
+
 void
 allocate_initial_tls(Obj_Entry *objs)
 {
-/*
- * Fix the size of the static TLS block by using the maximum
- * offset allocated so far and adding a bit for dynamic modules to
- * use.
- */
-tls_static_space = tls_last_offset + RTLD_STATIC_TLS_EXTRA;
-amd64_set_fsbase(allocate_tls(objs, 0,
- 3*sizeof(Elf_Addr), sizeof(Elf_Addr)));
+   void *addr;
+
+   /*
+* Fix the size of the static TLS block by using the maximum
+* offset allocated so far and adding a bit for dynamic
+* modules to use.
+*/
+   tls_static_space = tls_last_offset + RTLD_STATIC_TLS_EXTRA;
+
+   addr = allocate_tls(objs, 0, 3 * sizeof(Elf_Addr), sizeof(Elf_Addr));
+   if (__getosreldate() >= P_OSREL_WRFSBASE &&
+   (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0)
+   wrfsbase((uintptr_t)addr);
+   else
+   sysarch(AMD64_SET_FSBASE, );
 }
 
 void *__tls_get_addr(tls_index *ti)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339896 - head/libexec/rtld-elf

2018-10-29 Thread Konstantin Belousov
Author: kib
Date: Mon Oct 29 23:56:39 2018
New Revision: 339896
URL: https://svnweb.freebsd.org/changeset/base/339896

Log:
  Initialize ifunc calling machinery earlier.
  
  In particular, do it before the first call to allocate_initial_tls(),
  which contains MD parts to set the initial thread' TLS pointer.
  
  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.cMon Oct 29 23:52:31 2018
(r339895)
+++ head/libexec/rtld-elf/rtld.cMon Oct 29 23:56:39 2018
(r339896)
@@ -709,6 +709,8 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr
exit (0);
 }
 
+ifunc_init(aux);
+
 /*
  * Setup TLS for main thread.  This must be done after the
  * relocations are processed, since tls initialization section
@@ -730,7 +732,6 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr
 r_debug_state(NULL, _main->linkmap); /* say hello to gdb! */
 
 map_stacks_exec(NULL);
-ifunc_init(aux);
 
 dbg("resolving ifuncs");
 if (resolve_objects_ifunc(obj_main,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339895 - head/sys/amd64/amd64

2018-10-29 Thread Konstantin Belousov
Author: kib
Date: Mon Oct 29 23:52:31 2018
New Revision: 339895
URL: https://svnweb.freebsd.org/changeset/base/339895

Log:
  amd64: Use ifuncs to select suitable implementation of set_pcb_flags().
  
  There is no reason to check for PCB_FULL_IRET if FSGSBASE instructions
  are not supported.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/amd64/amd64/machdep.c

Modified: head/sys/amd64/amd64/machdep.c
==
--- head/sys/amd64/amd64/machdep.c  Mon Oct 29 23:48:20 2018
(r339894)
+++ head/sys/amd64/amd64/machdep.c  Mon Oct 29 23:52:31 2018
(r339895)
@@ -2616,15 +2616,14 @@ set_pcb_flags_raw(struct pcb *pcb, const u_int flags)
  * the PCB_FULL_IRET flag is set.  We disable interrupts to sync with
  * context switches.
  */
-void
-set_pcb_flags(struct pcb *pcb, const u_int flags)
+static void
+set_pcb_flags_fsgsbase(struct pcb *pcb, const u_int flags)
 {
register_t r;
 
if (curpcb == pcb &&
(flags & PCB_FULL_IRET) != 0 &&
-   (pcb->pcb_flags & PCB_FULL_IRET) == 0 &&
-   (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0) {
+   (pcb->pcb_flags & PCB_FULL_IRET) == 0) {
r = intr_disable();
if ((pcb->pcb_flags & PCB_FULL_IRET) == 0) {
if (rfs() == _ufssel)
@@ -2637,6 +2636,13 @@ set_pcb_flags(struct pcb *pcb, const u_int flags)
} else {
set_pcb_flags_raw(pcb, flags);
}
+}
+
+DEFINE_IFUNC(, void, set_pcb_flags, (struct pcb *, const u_int), static)
+{
+
+   return ((cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0 ?
+   set_pcb_flags_fsgsbase : set_pcb_flags_raw);
 }
 
 void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339894 - head/usr.bin/procstat

2018-10-29 Thread John Baldwin
Author: jhb
Date: Mon Oct 29 23:48:20 2018
New Revision: 339894
URL: https://svnweb.freebsd.org/changeset/base/339894

Log:
  Teach procstat -x about the AT_EHDRFLAGS ELF auxiliary vector.
  
  Submitted by: Shawn Webb 
  Reviewed by:  brooks
  Obtained from:HardenedBSD (bb71e9889d1362df01c2e5162e84cd7a4fc029c8)
  MFC after:2 months
  Differential Revision:https://reviews.freebsd.org/D17067

Modified:
  head/usr.bin/procstat/procstat_auxv.c

Modified: head/usr.bin/procstat/procstat_auxv.c
==
--- head/usr.bin/procstat/procstat_auxv.c   Mon Oct 29 23:45:17 2018
(r339893)
+++ head/usr.bin/procstat/procstat_auxv.c   Mon Oct 29 23:48:20 2018
(r339894)
@@ -179,6 +179,12 @@ procstat_auxv(struct procstat *procstat, struct kinfo_
prefix, "AT_TIMEKEEP", auxv[i].a_un.a_ptr);
break;
 #endif
+#ifdef AT_EHDRFLAGS
+   case AT_EHDRFLAGS:
+   xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_EHDRFLAGS/%#lx}\n",
+   prefix, "AT_EHDRFLAGS", (u_long)auxv[i].a_un.a_val);
+   break;
+#endif
default:
xo_emit("{dw:/%s}{Lw:/%16ld/%ld}{:UNKNOWN/%#lx}\n",
prefix, auxv[i].a_type, auxv[i].a_un.a_val);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339893 - head/sys/amd64/amd64

2018-10-29 Thread Konstantin Belousov
Author: kib
Date: Mon Oct 29 23:45:17 2018
New Revision: 339893
URL: https://svnweb.freebsd.org/changeset/base/339893

Log:
  Style.
  
  Wrap long lines, use +4 spaces for continuation indent.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/amd64/amd64/machdep.c

Modified: head/sys/amd64/amd64/machdep.c
==
--- head/sys/amd64/amd64/machdep.c  Mon Oct 29 23:43:17 2018
(r339892)
+++ head/sys/amd64/amd64/machdep.c  Mon Oct 29 23:45:17 2018
(r339893)
@@ -2683,25 +2683,31 @@ DEFINE_IFUNC(, void *, memset, (void *, int, size_t), 
 {
 
return ((cpu_stdext_feature & CPUID_STDEXT_ERMS) != 0 ?
-   memset_erms : memset_std);
+   memset_erms : memset_std);
 }
 
-void*memmove_std(void * _Nonnull dst, const void * _Nonnull src, size_t 
len);
-void*memmove_erms(void * _Nonnull dst, const void * _Nonnull src, size_t 
len);
-DEFINE_IFUNC(, void *, memmove, (void * _Nonnull, const void * _Nonnull, 
size_t), static)
+void*memmove_std(void * _Nonnull dst, const void * _Nonnull src,
+   size_t len);
+void*memmove_erms(void * _Nonnull dst, const void * _Nonnull src,
+   size_t len);
+DEFINE_IFUNC(, void *, memmove, (void * _Nonnull, const void * _Nonnull,
+size_t), static)
 {
 
return ((cpu_stdext_feature & CPUID_STDEXT_ERMS) != 0 ?
-   memmove_erms : memmove_std);
+   memmove_erms : memmove_std);
 }
 
-void*memcpy_std(void * _Nonnull dst, const void * _Nonnull src, size_t 
len);
-void*memcpy_erms(void * _Nonnull dst, const void * _Nonnull src, size_t 
len);
-DEFINE_IFUNC(, void *, memcpy, (void * _Nonnull, const void * _Nonnull, 
size_t), static)
+void*memcpy_std(void * _Nonnull dst, const void * _Nonnull src,
+   size_t len);
+void*memcpy_erms(void * _Nonnull dst, const void * _Nonnull src,
+   size_t len);
+DEFINE_IFUNC(, void *, memcpy, (void * _Nonnull, const void * _Nonnull,size_t),
+static)
 {
 
return ((cpu_stdext_feature & CPUID_STDEXT_ERMS) != 0 ?
-   memcpy_erms : memcpy_std);
+   memcpy_erms : memcpy_std);
 }
 
 void   pagezero_std(void *addr);
@@ -2710,5 +2716,5 @@ DEFINE_IFUNC(, void , pagezero, (void *), static)
 {
 
return ((cpu_stdext_feature & CPUID_STDEXT_ERMS) != 0 ?
-   pagezero_erms : pagezero_std);
+   pagezero_erms : pagezero_std);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339892 - head/sys/sys

2018-10-29 Thread Konstantin Belousov
Author: kib
Date: Mon Oct 29 23:43:17 2018
New Revision: 339892
URL: https://svnweb.freebsd.org/changeset/base/339892

Log:
  Clarify explanation of VFCF_SBDRY.
  
  Requested by: mckusick
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

Modified:
  head/sys/sys/mount.h

Modified: head/sys/sys/mount.h
==
--- head/sys/sys/mount.hMon Oct 29 22:35:46 2018(r339891)
+++ head/sys/sys/mount.hMon Oct 29 23:43:17 2018(r339892)
@@ -554,7 +554,8 @@ struct ovfsconf {
 #defineVFCF_UNICODE0x0020  /* stores file names as Unicode 
*/
 #defineVFCF_JAIL   0x0040  /* can be mounted from within a 
jail */
 #defineVFCF_DELEGADMIN 0x0080  /* supports delegated 
administration */
-#defineVFCF_SBDRY  0x0100  /* defer stop requests */
+#defineVFCF_SBDRY  0x0100  /* Stop at Boundary: defer stop 
requests
+  to kernel->user (AST) transition */
 
 typedef uint32_t fsctlop_t;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339891 - head/sys/dev/cxgbe/iw_cxgbe

2018-10-29 Thread Navdeep Parhar
Author: np
Date: Mon Oct 29 22:35:46 2018
New Revision: 339891
URL: https://svnweb.freebsd.org/changeset/base/339891

Log:
  cxgbe/iw_cxgbe: Install the socket upcall before calling soconnect to
  ensure that it always runs when soisconnected does.
  
  Submitted by: Krishnamraju Eraparaju @ Chelsio
  MFC after:1 month
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/iw_cxgbe/cm.c

Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c
==
--- head/sys/dev/cxgbe/iw_cxgbe/cm.cMon Oct 29 22:24:31 2018
(r339890)
+++ head/sys/dev/cxgbe/iw_cxgbe/cm.cMon Oct 29 22:35:46 2018
(r339891)
@@ -2601,22 +2601,24 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_
goto fail;
 
setiwsockopt(ep->com.so);
+   init_iwarp_socket(ep->com.so, >com);
err = -soconnect(ep->com.so, (struct sockaddr *)>com.remote_addr,
ep->com.thread);
-   if (!err) {
-   init_iwarp_socket(ep->com.so, >com);
-   goto out;
-   } else
+   if (err)
goto fail_free_so;
+   CTR2(KTR_IW_CXGBE, "%s:ccE, ep %p", __func__, ep);
+   return 0;
 
 fail_free_so:
+   uninit_iwarp_socket(ep->com.so);
+   ep->com.state = DEAD;
sock_release(ep->com.so);
 fail:
deref_cm_id(>com);
c4iw_put_ep(>com);
ep = NULL;
 out:
-   CTR2(KTR_IW_CXGBE, "%s:ccE ret:%d", __func__, err);
+   CTR2(KTR_IW_CXGBE, "%s:ccE Error %d", __func__, err);
return err;
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339890 - head/sys/dev/cxgbe/crypto

2018-10-29 Thread John Baldwin
Author: jhb
Date: Mon Oct 29 22:24:31 2018
New Revision: 339890
URL: https://svnweb.freebsd.org/changeset/base/339890

Log:
  Add support for "plain" (non-HMAC) SHA digests.
  
  MFC after:2 months
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/crypto/t4_crypto.c

Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c
==
--- head/sys/dev/cxgbe/crypto/t4_crypto.c   Mon Oct 29 22:10:52 2018
(r339889)
+++ head/sys/dev/cxgbe/crypto/t4_crypto.c   Mon Oct 29 22:24:31 2018
(r339890)
@@ -61,6 +61,8 @@ __FBSDID("$FreeBSD$");
  * | key context header|
  * +---+
  * | AES key   |  - For requests with AES
+ * +---+
+ * | Hash state|  - For hash-only requests
  * +---+ -
  * | IPAD (16-byte aligned)|  \
  * +---+  + For requests with HMAC
@@ -72,7 +74,7 @@ __FBSDID("$FreeBSD$");
  * +---+  + Destination buffer for
  * | PHYS_DSGL entries |  / non-hash-only requests
  * +---+ -
- * | 16 dummy bytes|  - Only for hash-only requests
+ * | 16 dummy bytes|  - Only for HMAC/hash-only requests
  * +---+
  * | IV|  - If immediate IV
  * +---+
@@ -160,7 +162,7 @@ struct ccr_session_blkcipher {
 struct ccr_session {
bool active;
int pending;
-   enum { HMAC, BLKCIPHER, AUTHENC, GCM } mode;
+   enum { HASH, HMAC, BLKCIPHER, AUTHENC, GCM } mode;
union {
struct ccr_session_hmac hmac;
struct ccr_session_gmac gmac;
@@ -200,6 +202,7 @@ struct ccr_softc {
/* Statistics. */
uint64_t stats_blkcipher_encrypt;
uint64_t stats_blkcipher_decrypt;
+   uint64_t stats_hash;
uint64_t stats_hmac;
uint64_t stats_authenc_encrypt;
uint64_t stats_authenc_decrypt;
@@ -420,7 +423,7 @@ ccr_populate_wreq(struct ccr_softc *sc, struct chcr_wr
 }
 
 static int
-ccr_hmac(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp)
+ccr_hash(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp)
 {
struct chcr_wr *crwr;
struct wrqe *wr;
@@ -428,8 +431,8 @@ ccr_hmac(struct ccr_softc *sc, struct ccr_session *s, 
struct cryptodesc *crd;
char *dst;
u_int hash_size_in_response, kctx_flits, kctx_len, transhdr_len, wr_len;
-   u_int imm_len, iopad_size;
-   int error, sgl_nsegs, sgl_len;
+   u_int hmac_ctrl, imm_len, iopad_size;
+   int error, sgl_nsegs, sgl_len, use_opad;
 
crd = crp->crp_desc;
 
@@ -439,6 +442,14 @@ ccr_hmac(struct ccr_softc *sc, struct ccr_session *s, 
 
axf = s->hmac.auth_hash;
 
+   if (s->mode == HMAC) {
+   use_opad = 1;
+   hmac_ctrl = CHCR_SCMD_HMAC_CTRL_NO_TRUNC;
+   } else {
+   use_opad = 0;
+   hmac_ctrl = CHCR_SCMD_HMAC_CTRL_NOP;
+   }
+
/* PADs must be 128-bit aligned. */
iopad_size = roundup2(s->hmac.partial_digest_len, 16);
 
@@ -446,7 +457,9 @@ ccr_hmac(struct ccr_softc *sc, struct ccr_session *s, 
 * The 'key' part of the context includes the aligned IPAD and
 * OPAD.
 */
-   kctx_len = iopad_size * 2;
+   kctx_len = iopad_size;
+   if (use_opad)
+   kctx_len += iopad_size;
hash_size_in_response = axf->hashsize;
transhdr_len = HASH_TRANSHDR_SIZE(kctx_len);
 
@@ -503,19 +516,21 @@ ccr_hmac(struct ccr_softc *sc, struct ccr_session *s, 
V_SCMD_PROTO_VERSION(CHCR_SCMD_PROTO_VERSION_GENERIC) |
V_SCMD_CIPH_MODE(CHCR_SCMD_CIPHER_MODE_NOP) |
V_SCMD_AUTH_MODE(s->hmac.auth_mode) |
-   V_SCMD_HMAC_CTRL(CHCR_SCMD_HMAC_CTRL_NO_TRUNC));
+   V_SCMD_HMAC_CTRL(hmac_ctrl));
crwr->sec_cpl.ivgen_hdrlen = htobe32(
V_SCMD_LAST_FRAG(0) |
V_SCMD_MORE_FRAGS(crd->crd_len == 0 ? 1 : 0) | V_SCMD_MAC_ONLY(1));
 
memcpy(crwr->key_ctx.key, s->hmac.ipad, s->hmac.partial_digest_len);
-   memcpy(crwr->key_ctx.key + iopad_size, s->hmac.opad,
-   s->hmac.partial_digest_len);
+   if (use_opad)
+   memcpy(crwr->key_ctx.key + iopad_size, s->hmac.opad,
+   s->hmac.partial_digest_len);
 
/* XXX: F_KEY_CONTEXT_SALT_PRESENT set, but 'salt' not set. */
kctx_flits = (sizeof(struct _key_ctx) + kctx_len) / 16;
crwr->key_ctx.ctx_hdr = htobe32(V_KEY_CONTEXT_CTX_LEN(kctx_flits) |
-   V_KEY_CONTEXT_OPAD_PRESENT(1) | V_KEY_CONTEXT_SALT_PRESENT(1) |
+   V_KEY_CONTEXT_OPAD_PRESENT(use_opad) |
+   V_KEY_CONTEXT_SALT_PRESENT(1) |

svn commit: r339889 - head/share/man/man9

2018-10-29 Thread Gleb Smirnoff
Author: glebius
Date: Mon Oct 29 22:10:52 2018
New Revision: 339889
URL: https://svnweb.freebsd.org/changeset/base/339889

Log:
  Add a note that epoch(9) may change, to untie our hands for any future MFCs.

Modified:
  head/share/man/man9/epoch.9

Modified: head/share/man/man9/epoch.9
==
--- head/share/man/man9/epoch.9 Mon Oct 29 22:08:45 2018(r339888)
+++ head/share/man/man9/epoch.9 Mon Oct 29 22:10:52 2018(r339889)
@@ -185,6 +185,10 @@ free would have to follow a call to
 .Fn epoch_wait .
 .Sh ERRORS
 None.
+.Sh NOTES
+The
+.Nm
+kernel programming interface is under development and is subject to change.
 .El
 .Sh SEE ALSO
 .Xr locking 9 ,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339888 - svnadmin/conf

2018-10-29 Thread Justin Hibbits
Author: jhibbits
Date: Mon Oct 29 22:08:45 2018
New Revision: 339888
URL: https://svnweb.freebsd.org/changeset/base/339888

Log:
  Let luporl fly free.  Keep up the good work!

Modified:
  svnadmin/conf/mentors

Modified: svnadmin/conf/mentors
==
--- svnadmin/conf/mentors   Mon Oct 29 21:46:12 2018(r339887)
+++ svnadmin/conf/mentors   Mon Oct 29 22:08:45 2018(r339888)
@@ -25,7 +25,6 @@ jkh   rwatson
 jwdrmacklem
 kadesaiken Co-mentor: scottl, ambrisko
 leitao jhibbitsCo-mentor: nwhitehorn
-luporl jhibbitsCo-mentor: nwhitehorn
 lwhsu  markj   Co-mentor: emaste
 mahrensmckusick
 miwi   araujo
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339886 - head/contrib/ofed/librdmacm/examples

2018-10-29 Thread Navdeep Parhar
Author: np
Date: Mon Oct 29 21:46:05 2018
New Revision: 339886
URL: https://svnweb.freebsd.org/changeset/base/339886

Log:
  rping(1): Make sure the socket address defaults to something reasonable
  when running as the server.
  
  Submitted by: Krishnamraju Eraparaju @ Chelsio
  Reviewed by:  hselasky@, np@
  MFC after:1 month
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D17707

Modified:
  head/contrib/ofed/librdmacm/examples/rping.c

Modified: head/contrib/ofed/librdmacm/examples/rping.c
==
--- head/contrib/ofed/librdmacm/examples/rping.cMon Oct 29 21:36:10 
2018(r339885)
+++ head/contrib/ofed/librdmacm/examples/rping.cMon Oct 29 21:46:05 
2018(r339886)
@@ -1177,9 +1177,13 @@ int main(int argc, char *argv[])
cb->server = -1;
cb->state = IDLE;
cb->size = 64;
-   cb->sin.ss_family = PF_INET;
cb->port = htobe16(7174);
sem_init(>sem, 0, 0);
+
+   /* initialize sockaddr structure with defaults */
+   ret = get_addr("0.0.0.0", (struct sockaddr *) >sin);
+   if (ret)
+   goto out;
 
opterr = 0;
while ((op=getopt(argc, argv, "a:I:Pp:C:S:t:scvVd")) != -1) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339887 - stable/9/sys/dev/bxe

2018-10-29 Thread David C Somayajulu
Author: davidcs
Date: Mon Oct 29 21:46:12 2018
New Revision: 339887
URL: https://svnweb.freebsd.org/changeset/base/339887

Log:
  MFC r339366
  Add support for Error Recovery
  
  Submitted by:vaishali.kulka...@cavium.com

Modified:
  stable/9/sys/dev/bxe/bxe.c
  stable/9/sys/dev/bxe/bxe.h
  stable/9/sys/dev/bxe/bxe_stats.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/dev/bxe/bxe.c
==
--- stable/9/sys/dev/bxe/bxe.c  Mon Oct 29 21:46:05 2018(r339886)
+++ stable/9/sys/dev/bxe/bxe.c  Mon Oct 29 21:46:12 2018(r339887)
@@ -188,6 +188,7 @@ static int bxe_attach(device_t);
 static int bxe_detach(device_t);
 static int bxe_shutdown(device_t);
 
+
 /*
  * FreeBSD KLD module/device interface event handler method.
  */
@@ -700,6 +701,9 @@ static voidbxe_interrupt_detach(struct bxe_softc *
 static voidbxe_set_rx_mode(struct bxe_softc *sc);
 static int bxe_init_locked(struct bxe_softc *sc);
 static int bxe_stop_locked(struct bxe_softc *sc);
+static voidbxe_sp_err_timeout_task(void *arg, int pending);
+void   bxe_parity_recover(struct bxe_softc *sc);
+void   bxe_handle_error(struct bxe_softc *sc);
 static __noinline int bxe_nic_load(struct bxe_softc *sc,
int  load_mode);
 static __noinline int bxe_nic_unload(struct bxe_softc *sc,
@@ -3488,16 +3492,12 @@ bxe_watchdog(struct bxe_softc*sc,
 }
 
 BLOGE(sc, "TX watchdog timeout on fp[%02d], resetting!\n", fp->index);
-if(sc->trigger_grcdump) {
- /* taking grcdump */
- bxe_grc_dump(sc);
-}
 
 BXE_FP_TX_UNLOCK(fp);
+BXE_SET_ERROR_BIT(sc, BXE_ERR_TXQ_STUCK);
+taskqueue_enqueue_timeout(taskqueue_thread,
+>sp_err_timeout_task, hz/10);
 
-atomic_store_rel_long(>chip_tq_flags, CHIP_TQ_REINIT);
-taskqueue_enqueue(sc->chip_tq, >chip_tq_task);
-
 return (-1);
 }
 
@@ -4252,6 +4252,7 @@ bxe_nic_unload(struct bxe_softc *sc,
 struct bxe_fastpath *fp;
 
 fp = >fp[i];
+   fp->watchdog_timer = 0;
 BXE_FP_TX_LOCK(fp);
 BXE_FP_TX_UNLOCK(fp);
 }
@@ -4267,20 +4268,22 @@ bxe_nic_unload(struct bxe_softc *sc,
 
 if (IS_PF(sc) && sc->recovery_state != BXE_RECOVERY_DONE &&
 (sc->state == BXE_STATE_CLOSED || sc->state == BXE_STATE_ERROR)) {
-/*
- * We can get here if the driver has been unloaded
- * during parity error recovery and is either waiting for a
- * leader to complete or for other functions to unload and
- * then ifconfig down has been issued. In this case we want to
- * unload and let other functions to complete a recovery
- * process.
- */
-sc->recovery_state = BXE_RECOVERY_DONE;
-sc->is_leader = 0;
-bxe_release_leader_lock(sc);
-mb();
 
-BLOGD(sc, DBG_LOAD, "Releasing a leadership...\n");
+   if(CHIP_PORT_MODE(sc) == CHIP_4_PORT_MODE) {
+/*
+ * We can get here if the driver has been unloaded
+ * during parity error recovery and is either waiting for a
+ * leader to complete or for other functions to unload and
+ * then ifconfig down has been issued. In this case we want to
+ * unload and let other functions to complete a recovery
+ * process.
+ */
+sc->recovery_state = BXE_RECOVERY_DONE;
+sc->is_leader = 0;
+bxe_release_leader_lock(sc);
+mb();
+BLOGD(sc, DBG_LOAD, "Releasing a leadership...\n");
+   }
 BLOGE(sc, "Can't unload in closed or error state recover_state 0x%x"
 " state = 0x%x\n", sc->recovery_state, sc->state);
 return (-1);
@@ -7575,6 +7578,10 @@ bxe_parity_attn(struct bxe_softc *sc,
 if (print)
 BLOGI(sc, "\n");
 
+   if( *global == TRUE ) {
+BXE_SET_ERROR_BIT(sc, BXE_ERR_GLOBAL);
+}
+
 return (TRUE);
 }
 
@@ -7589,6 +7596,9 @@ bxe_chk_parity_attn(struct bxe_softc *sc,
 struct attn_route attn = { {0} };
 int port = SC_PORT(sc);
 
+if(sc->state != BXE_STATE_OPEN)
+return FALSE;
+
 attn.sig[0] = REG_RD(sc, MISC_REG_AEU_AFTER_INVERT_1_FUNC_0 + port*4);
 attn.sig[1] = REG_RD(sc, MISC_REG_AEU_AFTER_INVERT_2_FUNC_0 + port*4);
 attn.sig[2] = REG_RD(sc, MISC_REG_AEU_AFTER_INVERT_3_FUNC_0 + port*4);
@@ -7615,10 +7625,12 @@ bxe_attn_int_deasserted4(struct bxe_softc *sc,
  uint32_t attn)
 {
 uint32_t val;
+boolean_t err_flg = FALSE;
 
 if (attn & AEU_INPUTS_ATTN_BITS_PGLUE_HW_INTERRUPT) {
 val = REG_RD(sc, PGLUE_B_REG_PGLUE_B_INT_STS_CLR);
 BLOGE(sc, "PGLUE hw attention 0x%08x\n", val);
+err_flg = TRUE;
 if (val & PGLUE_B_PGLUE_B_INT_STS_REG_ADDRESS_ERROR)
 

svn commit: r339885 - stable/9/sys/dev/bxe

2018-10-29 Thread David C Somayajulu
Author: davidcs
Date: Mon Oct 29 21:36:10 2018
New Revision: 339885
URL: https://svnweb.freebsd.org/changeset/base/339885

Log:
  MFC r338734
  
  Fixed isses:
State check before enqueuing transmit task in bxe_link_attn() routine.
State check before invoking bxe_nic_unload in bxe_shutdown().
  
  Submitted by:vaishali.kulka...@cavium.com

Modified:
  stable/9/sys/dev/bxe/bxe.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/dev/bxe/bxe.c
==
--- stable/9/sys/dev/bxe/bxe.c  Mon Oct 29 21:31:23 2018(r339884)
+++ stable/9/sys/dev/bxe/bxe.c  Mon Oct 29 21:36:10 2018(r339885)
@@ -7081,13 +7081,13 @@ bxe_link_attn(struct bxe_softc *sc)
 
 if (sc->state == BXE_STATE_OPEN) {
 bxe_stats_handle(sc, STATS_EVENT_LINK_UP);
+   /* Restart tx when the link comes back. */
+   FOR_EACH_ETH_QUEUE(sc, i) {
+   fp = >fp[i];
+   taskqueue_enqueue(fp->tq, >tx_task);
+   }
 }
 
-   /* Restart tx when the link comes back. */
-FOR_EACH_ETH_QUEUE(sc, i) {
-fp = >fp[i];
-taskqueue_enqueue(fp->tq, >tx_task);
-   }
 }
 
 if (sc->link_vars.link_up && sc->link_vars.line_speed) {
@@ -16284,9 +16284,11 @@ bxe_shutdown(device_t dev)
 /* stop the periodic callout */
 bxe_periodic_stop(sc);
 
-BXE_CORE_LOCK(sc);
-bxe_nic_unload(sc, UNLOAD_NORMAL, FALSE);
-BXE_CORE_UNLOCK(sc);
+if (sc->state != BXE_STATE_CLOSED) {
+   BXE_CORE_LOCK(sc);
+   bxe_nic_unload(sc, UNLOAD_NORMAL, FALSE);
+   BXE_CORE_UNLOCK(sc);
+}
 
 return (0);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339884 - stable/10/sys/dev/bxe

2018-10-29 Thread David C Somayajulu
Author: davidcs
Date: Mon Oct 29 21:31:23 2018
New Revision: 339884
URL: https://svnweb.freebsd.org/changeset/base/339884

Log:
  MFC r339366
  Add support for Error Recovery
  
  Submitted by:vaishali.kulka...@cavium.com

Modified:
  stable/10/sys/dev/bxe/bxe.c
  stable/10/sys/dev/bxe/bxe.h
  stable/10/sys/dev/bxe/bxe_stats.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/bxe/bxe.c
==
--- stable/10/sys/dev/bxe/bxe.c Mon Oct 29 21:16:26 2018(r339883)
+++ stable/10/sys/dev/bxe/bxe.c Mon Oct 29 21:31:23 2018(r339884)
@@ -194,6 +194,7 @@ static int bxe_attach(device_t);
 static int bxe_detach(device_t);
 static int bxe_shutdown(device_t);
 
+
 /*
  * FreeBSD KLD module/device interface event handler method.
  */
@@ -706,6 +707,9 @@ static voidbxe_interrupt_detach(struct bxe_softc *
 static voidbxe_set_rx_mode(struct bxe_softc *sc);
 static int bxe_init_locked(struct bxe_softc *sc);
 static int bxe_stop_locked(struct bxe_softc *sc);
+static voidbxe_sp_err_timeout_task(void *arg, int pending);
+void   bxe_parity_recover(struct bxe_softc *sc);
+void   bxe_handle_error(struct bxe_softc *sc);
 static __noinline int bxe_nic_load(struct bxe_softc *sc,
int  load_mode);
 static __noinline int bxe_nic_unload(struct bxe_softc *sc,
@@ -3494,16 +3498,12 @@ bxe_watchdog(struct bxe_softc*sc,
 }
 
 BLOGE(sc, "TX watchdog timeout on fp[%02d], resetting!\n", fp->index);
-if(sc->trigger_grcdump) {
- /* taking grcdump */
- bxe_grc_dump(sc);
-}
 
 BXE_FP_TX_UNLOCK(fp);
+BXE_SET_ERROR_BIT(sc, BXE_ERR_TXQ_STUCK);
+taskqueue_enqueue_timeout(taskqueue_thread,
+>sp_err_timeout_task, hz/10);
 
-atomic_store_rel_long(>chip_tq_flags, CHIP_TQ_REINIT);
-taskqueue_enqueue(sc->chip_tq, >chip_tq_task);
-
 return (-1);
 }
 
@@ -4258,6 +4258,7 @@ bxe_nic_unload(struct bxe_softc *sc,
 struct bxe_fastpath *fp;
 
 fp = >fp[i];
+   fp->watchdog_timer = 0;
 BXE_FP_TX_LOCK(fp);
 BXE_FP_TX_UNLOCK(fp);
 }
@@ -4273,20 +4274,22 @@ bxe_nic_unload(struct bxe_softc *sc,
 
 if (IS_PF(sc) && sc->recovery_state != BXE_RECOVERY_DONE &&
 (sc->state == BXE_STATE_CLOSED || sc->state == BXE_STATE_ERROR)) {
-/*
- * We can get here if the driver has been unloaded
- * during parity error recovery and is either waiting for a
- * leader to complete or for other functions to unload and
- * then ifconfig down has been issued. In this case we want to
- * unload and let other functions to complete a recovery
- * process.
- */
-sc->recovery_state = BXE_RECOVERY_DONE;
-sc->is_leader = 0;
-bxe_release_leader_lock(sc);
-mb();
 
-BLOGD(sc, DBG_LOAD, "Releasing a leadership...\n");
+   if(CHIP_PORT_MODE(sc) == CHIP_4_PORT_MODE) {
+/*
+ * We can get here if the driver has been unloaded
+ * during parity error recovery and is either waiting for a
+ * leader to complete or for other functions to unload and
+ * then ifconfig down has been issued. In this case we want to
+ * unload and let other functions to complete a recovery
+ * process.
+ */
+sc->recovery_state = BXE_RECOVERY_DONE;
+sc->is_leader = 0;
+bxe_release_leader_lock(sc);
+mb();
+BLOGD(sc, DBG_LOAD, "Releasing a leadership...\n");
+   }
 BLOGE(sc, "Can't unload in closed or error state recover_state 0x%x"
 " state = 0x%x\n", sc->recovery_state, sc->state);
 return (-1);
@@ -7573,6 +7576,10 @@ bxe_parity_attn(struct bxe_softc *sc,
 if (print)
 BLOGI(sc, "\n");
 
+   if( *global == TRUE ) {
+BXE_SET_ERROR_BIT(sc, BXE_ERR_GLOBAL);
+}
+
 return (TRUE);
 }
 
@@ -7587,6 +7594,9 @@ bxe_chk_parity_attn(struct bxe_softc *sc,
 struct attn_route attn = { {0} };
 int port = SC_PORT(sc);
 
+if(sc->state != BXE_STATE_OPEN)
+return FALSE;
+
 attn.sig[0] = REG_RD(sc, MISC_REG_AEU_AFTER_INVERT_1_FUNC_0 + port*4);
 attn.sig[1] = REG_RD(sc, MISC_REG_AEU_AFTER_INVERT_2_FUNC_0 + port*4);
 attn.sig[2] = REG_RD(sc, MISC_REG_AEU_AFTER_INVERT_3_FUNC_0 + port*4);
@@ -7613,10 +7623,12 @@ bxe_attn_int_deasserted4(struct bxe_softc *sc,
  uint32_t attn)
 {
 uint32_t val;
+boolean_t err_flg = FALSE;
 
 if (attn & AEU_INPUTS_ATTN_BITS_PGLUE_HW_INTERRUPT) {
 val = REG_RD(sc, PGLUE_B_REG_PGLUE_B_INT_STS_CLR);
 BLOGE(sc, "PGLUE hw attention 0x%08x\n", val);
+err_flg = TRUE;
 if (val & PGLUE_B_PGLUE_B_INT_STS_REG_ADDRESS_ERROR)
 BLOGE(sc, 

svn commit: r339883 - in head: share/man/man4 sys/netinet/netdump

2018-10-29 Thread Mark Johnston
Author: markj
Date: Mon Oct 29 21:16:26 2018
New Revision: 339883
URL: https://svnweb.freebsd.org/changeset/base/339883

Log:
  Expose some netdump configuration parameters through sysctl.
  
  Reviewed by:  cem
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D17755

Modified:
  head/share/man/man4/netdump.4
  head/sys/netinet/netdump/netdump_client.c

Modified: head/share/man/man4/netdump.4
==
--- head/share/man/man4/netdump.4   Mon Oct 29 21:14:48 2018
(r339882)
+++ head/share/man/man4/netdump.4   Mon Oct 29 21:16:26 2018
(r339883)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 8, 2018
+.Dd October 29, 2018
 .Dt NETDUMP 4
 .Os
 .Sh NAME
@@ -130,6 +130,19 @@ a path of
 will cause the server to attempt to store dumps from the client in
 .Pa /var/crash/foo .
 The server will not automatically create the relative directory.
+.It Va net.netdump.polls
+The client will poll the configured network interface while waiting for
+acknowledgements.
+This parameter controls the maximum number of poll attempts before giving
+up, which typically results in a re-transmit.
+Each poll attempt takes 0.5ms.
+.It Va net.netdump.retries
+The number of times the client will re-transmit a packet before aborting
+a dump due to a lack of acknowledgement.
+The default may be too small in environments with lots of packet loss.
+.It Va net.netdump.arp_retries
+The number of times the client will attempt to learn the MAC address of
+the configured gateway or server before giving up and aborting the dump.
 .El
 .Sh SEE ALSO
 .Xr decryptcore 8 ,

Modified: head/sys/netinet/netdump/netdump_client.c
==
--- head/sys/netinet/netdump/netdump_client.c   Mon Oct 29 21:14:48 2018
(r339882)
+++ head/sys/netinet/netdump/netdump_client.c   Mon Oct 29 21:16:26 2018
(r339883)
@@ -117,18 +117,6 @@ static int restore_gw_addr;
 static uint64_t rcvd_acks;
 CTASSERT(sizeof(rcvd_acks) * NBBY == NETDUMP_MAX_IN_FLIGHT);
 
-/*
- * Times to poll the NIC (0.5ms each poll) before assuming packetloss
- * occurred (default to 1s).
- */
-static int nd_polls = 2000;
-
-/* Times to retransmit lost packets. */
-static int nd_retries = 10;
-
-/* Number of ARP retries. */
-static int nd_arp_retries = 3;
-
 /* Configuration parameters. */
 static struct netdump_conf nd_conf;
 #definend_server   nd_conf.ndc_server
@@ -157,6 +145,18 @@ static char nd_path[MAXPATHLEN];
 SYSCTL_STRING(_net_netdump, OID_AUTO, path, CTLFLAG_RW,
 nd_path, sizeof(nd_path),
 "Server path for output files");
+static int nd_polls = 2000;
+SYSCTL_INT(_net_netdump, OID_AUTO, polls, CTLFLAG_RWTUN,
+_polls, 0,
+"Number of times to poll before assuming packet loss (0.5ms per poll)");
+static int nd_retries = 10;
+SYSCTL_INT(_net_netdump, OID_AUTO, retries, CTLFLAG_RWTUN,
+_retries, 0,
+"Number of retransmit attempts before giving up");
+static int nd_arp_retries = 3;
+SYSCTL_INT(_net_netdump, OID_AUTO, arp_retries, CTLFLAG_RWTUN,
+_arp_retries, 0,
+"Number of ARP attempts before giving up");
 
 /*
  * Checks for netdump support on a network interface
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339882 - stable/10/sys/dev/bxe

2018-10-29 Thread David C Somayajulu
Author: davidcs
Date: Mon Oct 29 21:14:48 2018
New Revision: 339882
URL: https://svnweb.freebsd.org/changeset/base/339882

Log:
  MFC r338734
  
  Fixed isses:
State check before enqueuing transmit task in bxe_link_attn() routine.
State check before invoking bxe_nic_unload in bxe_shutdown().
  
  Submitted by:vaishali.kulka...@cavium.com

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

Modified: stable/10/sys/dev/bxe/bxe.c
==
--- stable/10/sys/dev/bxe/bxe.c Mon Oct 29 21:09:39 2018(r339881)
+++ stable/10/sys/dev/bxe/bxe.c Mon Oct 29 21:14:48 2018(r339882)
@@ -7079,13 +7079,13 @@ bxe_link_attn(struct bxe_softc *sc)
 
 if (sc->state == BXE_STATE_OPEN) {
 bxe_stats_handle(sc, STATS_EVENT_LINK_UP);
+   /* Restart tx when the link comes back. */
+   FOR_EACH_ETH_QUEUE(sc, i) {
+   fp = >fp[i];
+   taskqueue_enqueue(fp->tq, >tx_task);
+   }
 }
 
-   /* Restart tx when the link comes back. */
-FOR_EACH_ETH_QUEUE(sc, i) {
-fp = >fp[i];
-taskqueue_enqueue(fp->tq, >tx_task);
-   }
 }
 
 if (sc->link_vars.link_up && sc->link_vars.line_speed) {
@@ -16281,9 +16281,11 @@ bxe_shutdown(device_t dev)
 /* stop the periodic callout */
 bxe_periodic_stop(sc);
 
-BXE_CORE_LOCK(sc);
-bxe_nic_unload(sc, UNLOAD_NORMAL, FALSE);
-BXE_CORE_UNLOCK(sc);
+if (sc->state != BXE_STATE_CLOSED) {
+   BXE_CORE_LOCK(sc);
+   bxe_nic_unload(sc, UNLOAD_NORMAL, FALSE);
+   BXE_CORE_UNLOCK(sc);
+}
 
 return (0);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339879 - in head/libexec/rtld-elf: . riscv

2018-10-29 Thread Alex Richardson
Author: arichardson
Date: Mon Oct 29 21:08:28 2018
New Revision: 339879
URL: https://svnweb.freebsd.org/changeset/base/339879

Log:
  rtld-elf: fix more warnings to allow compiling with WARNS=6
  
  Reviewed By:  kib
  Approved By:  brooks (mentor)
  Differential Revision: https://reviews.freebsd.org/D17154

Modified:
  head/libexec/rtld-elf/Makefile
  head/libexec/rtld-elf/libmap.c
  head/libexec/rtld-elf/malloc.c
  head/libexec/rtld-elf/map_object.c
  head/libexec/rtld-elf/riscv/reloc.c
  head/libexec/rtld-elf/rtld.c
  head/libexec/rtld-elf/rtld_lock.c
  head/libexec/rtld-elf/rtld_printf.c

Modified: head/libexec/rtld-elf/Makefile
==
--- head/libexec/rtld-elf/Makefile  Mon Oct 29 21:08:19 2018
(r339878)
+++ head/libexec/rtld-elf/Makefile  Mon Oct 29 21:08:28 2018
(r339879)
@@ -33,7 +33,7 @@ LDFLAGS+= -nostdlib -e .rtld_start
 .endif
 
 NO_WCAST_ALIGN=yes
-WARNS?=4
+WARNS?=6
 INSTALLFLAGS=  -C -b
 PRECIOUSPROG=
 BINDIR=/libexec
@@ -98,7 +98,12 @@ SUBDIR.${MK_TESTS}+= tests
 ${PROG_FULL}:  ${VERSION_MAP}
 .include 
 
-.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} < 40300
+.if ${COMPILER_TYPE} == "gcc"
+# GCC warns about redeclarations even though they have __exported
+# and are therefore not identical to the ones from the system headers.
+CFLAGS+=   -Wno-redundant-decls
+.if ${COMPILER_VERSION} < 40300
 # Silence -Wshadow false positives in ancient GCC
 CFLAGS+=   -Wno-shadow
+.endif
 .endif

Modified: head/libexec/rtld-elf/libmap.c
==
--- head/libexec/rtld-elf/libmap.c  Mon Oct 29 21:08:19 2018
(r339878)
+++ head/libexec/rtld-elf/libmap.c  Mon Oct 29 21:08:28 2018
(r339879)
@@ -25,7 +25,7 @@ struct lm {
TAILQ_ENTRY(lm) lm_link;
 };
 
-TAILQ_HEAD(lmp_list, lmp) lmp_head = TAILQ_HEAD_INITIALIZER(lmp_head);
+static TAILQ_HEAD(lmp_list, lmp) lmp_head = TAILQ_HEAD_INITIALIZER(lmp_head);
 struct lmp {
char *p;
enum { T_EXACT=0, T_BASENAME, T_DIRECTORY } type;

Modified: head/libexec/rtld-elf/malloc.c
==
--- head/libexec/rtld-elf/malloc.c  Mon Oct 29 21:08:19 2018
(r339878)
+++ head/libexec/rtld-elf/malloc.c  Mon Oct 29 21:08:28 2018
(r339879)
@@ -151,7 +151,6 @@ botch(s)
  * must contain at least one page size.  The page sizes must be stored in
  * increasing order.
  */
-extern size_t *pagesizes;
 
 void *
 malloc(size_t nbytes)
@@ -256,8 +255,7 @@ calloc(size_t num, size_t size)
  * Allocate more memory to the indicated bucket.
  */
 static void
-morecore(bucket)
-   int bucket;
+morecore(int bucket)
 {
union overhead *op;
int sz; /* size of desired block */
@@ -300,8 +298,7 @@ morecore(bucket)
 }
 
 void
-free(cp)
-   void *cp;
+free(void * cp)
 {
int size;
union overhead *op;
@@ -339,12 +336,10 @@ free(cp)
  * is extern so the caller can modify it).  If that fails we just copy
  * however many bytes was given to realloc() and hope it's not huge.
  */
-int realloc_srchlen = 4;   /* 4 should be plenty, -1 =>'s whole list */
+static int realloc_srchlen = 4;/* 4 should be plenty, -1 =>'s whole 
list */
 
 void *
-realloc(cp, nbytes)
-   void *cp;
-   size_t nbytes;
+realloc(void *cp, size_t nbytes)
 {
u_int onb;
int i;
@@ -413,9 +408,7 @@ realloc(cp, nbytes)
  * Return bucket number, or -1 if not found.
  */
 static int
-findbucket(freep, srchlen)
-   union overhead *freep;
-   int srchlen;
+findbucket(union overhead *freep, int srchlen)
 {
union overhead *p;
int i, j;
@@ -439,8 +432,7 @@ findbucket(freep, srchlen)
  * for each size category, the second showing the number of mallocs -
  * frees for each size category.
  */
-mstats(s)
-   char *s;
+mstats(char * s)
 {
int i, j;
union overhead *p;
@@ -466,8 +458,7 @@ mstats(s)
 
 
 static int
-morepages(n)
-intn;
+morepages(int n)
 {
int fd = -1;
int offset;

Modified: head/libexec/rtld-elf/map_object.c
==
--- head/libexec/rtld-elf/map_object.c  Mon Oct 29 21:08:19 2018
(r339878)
+++ head/libexec/rtld-elf/map_object.c  Mon Oct 29 21:08:28 2018
(r339879)
@@ -115,6 +115,7 @@ map_object(int fd, const char *path, const struct stat
 note_start = 0;
 note_end = 0;
 note_map = NULL;
+note_map_len = 0;
 segs = alloca(sizeof(segs[0]) * hdr->e_phnum);
 stack_flags = RTLD_DEFAULT_STACK_PF_EXEC | PF_R | PF_W;
 text_end = 0;

Modified: head/libexec/rtld-elf/riscv/reloc.c
==
--- head/libexec/rtld-elf/riscv/reloc.c Mon Oct 29 21:08:19 2018  

svn commit: r339881 - stable/11/sys/dev/bxe

2018-10-29 Thread David C Somayajulu
Author: davidcs
Date: Mon Oct 29 21:09:39 2018
New Revision: 339881
URL: https://svnweb.freebsd.org/changeset/base/339881

Log:
  MFC r339366
  Add support for Error Recovery
  
  Submitted by:vaishali.kulka...@cavium.com

Modified:
  stable/11/sys/dev/bxe/bxe.c
  stable/11/sys/dev/bxe/bxe.h
  stable/11/sys/dev/bxe/bxe_stats.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/bxe/bxe.c
==
--- stable/11/sys/dev/bxe/bxe.c Mon Oct 29 21:08:34 2018(r339880)
+++ stable/11/sys/dev/bxe/bxe.c Mon Oct 29 21:09:39 2018(r339881)
@@ -200,6 +200,7 @@ static int bxe_attach(device_t);
 static int bxe_detach(device_t);
 static int bxe_shutdown(device_t);
 
+
 /*
  * FreeBSD KLD module/device interface event handler method.
  */
@@ -701,6 +702,9 @@ static voidbxe_interrupt_detach(struct bxe_softc *
 static voidbxe_set_rx_mode(struct bxe_softc *sc);
 static int bxe_init_locked(struct bxe_softc *sc);
 static int bxe_stop_locked(struct bxe_softc *sc);
+static voidbxe_sp_err_timeout_task(void *arg, int pending);
+void   bxe_parity_recover(struct bxe_softc *sc);
+void   bxe_handle_error(struct bxe_softc *sc);
 static __noinline int bxe_nic_load(struct bxe_softc *sc,
int  load_mode);
 static __noinline int bxe_nic_unload(struct bxe_softc *sc,
@@ -3482,16 +3486,12 @@ bxe_watchdog(struct bxe_softc*sc,
 }
 
 BLOGE(sc, "TX watchdog timeout on fp[%02d], resetting!\n", fp->index);
-if(sc->trigger_grcdump) {
- /* taking grcdump */
- bxe_grc_dump(sc);
-}
 
 BXE_FP_TX_UNLOCK(fp);
+BXE_SET_ERROR_BIT(sc, BXE_ERR_TXQ_STUCK);
+taskqueue_enqueue_timeout(taskqueue_thread,
+>sp_err_timeout_task, hz/10);
 
-atomic_store_rel_long(>chip_tq_flags, CHIP_TQ_REINIT);
-taskqueue_enqueue(sc->chip_tq, >chip_tq_task);
-
 return (-1);
 }
 
@@ -4246,6 +4246,7 @@ bxe_nic_unload(struct bxe_softc *sc,
 struct bxe_fastpath *fp;
 
 fp = >fp[i];
+   fp->watchdog_timer = 0;
 BXE_FP_TX_LOCK(fp);
 BXE_FP_TX_UNLOCK(fp);
 }
@@ -4261,20 +4262,22 @@ bxe_nic_unload(struct bxe_softc *sc,
 
 if (IS_PF(sc) && sc->recovery_state != BXE_RECOVERY_DONE &&
 (sc->state == BXE_STATE_CLOSED || sc->state == BXE_STATE_ERROR)) {
-/*
- * We can get here if the driver has been unloaded
- * during parity error recovery and is either waiting for a
- * leader to complete or for other functions to unload and
- * then ifconfig down has been issued. In this case we want to
- * unload and let other functions to complete a recovery
- * process.
- */
-sc->recovery_state = BXE_RECOVERY_DONE;
-sc->is_leader = 0;
-bxe_release_leader_lock(sc);
-mb();
 
-BLOGD(sc, DBG_LOAD, "Releasing a leadership...\n");
+   if(CHIP_PORT_MODE(sc) == CHIP_4_PORT_MODE) {
+/*
+ * We can get here if the driver has been unloaded
+ * during parity error recovery and is either waiting for a
+ * leader to complete or for other functions to unload and
+ * then ifconfig down has been issued. In this case we want to
+ * unload and let other functions to complete a recovery
+ * process.
+ */
+sc->recovery_state = BXE_RECOVERY_DONE;
+sc->is_leader = 0;
+bxe_release_leader_lock(sc);
+mb();
+BLOGD(sc, DBG_LOAD, "Releasing a leadership...\n");
+   }
 BLOGE(sc, "Can't unload in closed or error state recover_state 0x%x"
 " state = 0x%x\n", sc->recovery_state, sc->state);
 return (-1);
@@ -7566,6 +7569,10 @@ bxe_parity_attn(struct bxe_softc *sc,
 if (print)
 BLOGI(sc, "\n");
 
+   if( *global == TRUE ) {
+BXE_SET_ERROR_BIT(sc, BXE_ERR_GLOBAL);
+}
+
 return (TRUE);
 }
 
@@ -7580,6 +7587,9 @@ bxe_chk_parity_attn(struct bxe_softc *sc,
 struct attn_route attn = { {0} };
 int port = SC_PORT(sc);
 
+if(sc->state != BXE_STATE_OPEN)
+return FALSE;
+
 attn.sig[0] = REG_RD(sc, MISC_REG_AEU_AFTER_INVERT_1_FUNC_0 + port*4);
 attn.sig[1] = REG_RD(sc, MISC_REG_AEU_AFTER_INVERT_2_FUNC_0 + port*4);
 attn.sig[2] = REG_RD(sc, MISC_REG_AEU_AFTER_INVERT_3_FUNC_0 + port*4);
@@ -7606,10 +7616,12 @@ bxe_attn_int_deasserted4(struct bxe_softc *sc,
  uint32_t attn)
 {
 uint32_t val;
+boolean_t err_flg = FALSE;
 
 if (attn & AEU_INPUTS_ATTN_BITS_PGLUE_HW_INTERRUPT) {
 val = REG_RD(sc, PGLUE_B_REG_PGLUE_B_INT_STS_CLR);
 BLOGE(sc, "PGLUE hw attention 0x%08x\n", val);
+err_flg = TRUE;
 if (val & PGLUE_B_PGLUE_B_INT_STS_REG_ADDRESS_ERROR)
 BLOGE(sc, 

svn commit: r339878 - in head/libexec/rtld-elf: . aarch64 amd64 arm i386 mips powerpc powerpc64 riscv sparc64

2018-10-29 Thread Alex Richardson
Author: arichardson
Date: Mon Oct 29 21:08:19 2018
New Revision: 339878
URL: https://svnweb.freebsd.org/changeset/base/339878

Log:
  rtld-elf: compile with WANRS=4 warnings other than -Wcast-align
  
  Reviewed By:  kib
  Approved By:  brooks (mentor)
  Differential Revision: https://reviews.freebsd.org/D17153

Modified:
  head/libexec/rtld-elf/Makefile
  head/libexec/rtld-elf/aarch64/reloc.c
  head/libexec/rtld-elf/amd64/reloc.c
  head/libexec/rtld-elf/arm/reloc.c
  head/libexec/rtld-elf/i386/reloc.c
  head/libexec/rtld-elf/i386/rtld_machdep.h
  head/libexec/rtld-elf/libmap.c
  head/libexec/rtld-elf/malloc.c
  head/libexec/rtld-elf/map_object.c
  head/libexec/rtld-elf/mips/reloc.c
  head/libexec/rtld-elf/mips/rtld_machdep.h
  head/libexec/rtld-elf/paths.h
  head/libexec/rtld-elf/powerpc/reloc.c
  head/libexec/rtld-elf/powerpc/rtld_machdep.h
  head/libexec/rtld-elf/powerpc64/reloc.c
  head/libexec/rtld-elf/powerpc64/rtld_machdep.h
  head/libexec/rtld-elf/riscv/reloc.c
  head/libexec/rtld-elf/rtld.c
  head/libexec/rtld-elf/rtld.h
  head/libexec/rtld-elf/sparc64/reloc.c

Modified: head/libexec/rtld-elf/Makefile
==
--- head/libexec/rtld-elf/Makefile  Mon Oct 29 21:08:11 2018
(r339877)
+++ head/libexec/rtld-elf/Makefile  Mon Oct 29 21:08:19 2018
(r339878)
@@ -31,7 +31,9 @@ LDFLAGS+= -nostdlib -e _rtld_start
 .else
 LDFLAGS+=  -nostdlib -e .rtld_start
 .endif
-WARNS?=2
+
+NO_WCAST_ALIGN=yes
+WARNS?=4
 INSTALLFLAGS=  -C -b
 PRECIOUSPROG=
 BINDIR=/libexec
@@ -95,3 +97,8 @@ SUBDIR.${MK_TESTS}+= tests
 .include 
 ${PROG_FULL}:  ${VERSION_MAP}
 .include 
+
+.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} < 40300
+# Silence -Wshadow false positives in ancient GCC
+CFLAGS+=   -Wno-shadow
+.endif

Modified: head/libexec/rtld-elf/aarch64/reloc.c
==
--- head/libexec/rtld-elf/aarch64/reloc.c   Mon Oct 29 21:08:11 2018
(r339877)
+++ head/libexec/rtld-elf/aarch64/reloc.c   Mon Oct 29 21:08:19 2018
(r339878)
@@ -84,7 +84,7 @@ do_copy_relocations(Obj_Entry *dstobj)
 */
assert(dstobj->mainprog);
 
-   relalim = (const Elf_Rela *)((char *)dstobj->rela +
+   relalim = (const Elf_Rela *)((const char *)dstobj->rela +
dstobj->relasize);
for (rela = dstobj->rela; rela < relalim; rela++) {
if (ELF_R_TYPE(rela->r_info) != R_AARCH64_COPY)
@@ -128,6 +128,8 @@ struct tls_data {
const Elf_Rela *rela;
 };
 
+int64_t rtld_tlsdesc_handle(struct tls_data *tlsdesc, int flags);
+
 static struct tls_data *
 reloc_tlsdesc_alloc(Obj_Entry *obj, const Elf_Rela *rela)
 {
@@ -205,7 +207,7 @@ reloc_plt(Obj_Entry *obj)
const Elf_Rela *relalim;
const Elf_Rela *rela;
 
-   relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize);
+   relalim = (const Elf_Rela *)((const char *)obj->pltrela + 
obj->pltrelasize);
for (rela = obj->pltrela; rela < relalim; rela++) {
Elf_Addr *where;
 
@@ -243,7 +245,7 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat
const Elf_Sym *def;
struct tls_data *tlsdesc;
 
-   relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize);
+   relalim = (const Elf_Rela *)((const char *)obj->pltrela + 
obj->pltrelasize);
for (rela = obj->pltrela; rela < relalim; rela++) {
Elf_Addr *where, target;
 
@@ -289,7 +291,7 @@ reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockS
 
if (!obj->irelative)
return (0);
-   relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize);
+   relalim = (const Elf_Rela *)((const char *)obj->pltrela + 
obj->pltrelasize);
for (rela = obj->pltrela;  rela < relalim;  rela++) {
if (ELF_R_TYPE(rela->r_info) == R_AARCH64_IRELATIVE) {
ptr = (Elf_Addr *)(obj->relocbase + rela->r_addend);
@@ -316,7 +318,7 @@ reloc_gnu_ifunc(Obj_Entry *obj, int flags,
 
if (!obj->gnu_ifunc)
return (0);
-   relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize);
+   relalim = (const Elf_Rela *)((const char *)obj->pltrela + 
obj->pltrelasize);
for (rela = obj->pltrela;  rela < relalim;  rela++) {
if (ELF_R_TYPE(rela->r_info) == R_AARCH64_JUMP_SLOT) {
where = (Elf_Addr *)(obj->relocbase + rela->r_offset);
@@ -338,8 +340,9 @@ reloc_gnu_ifunc(Obj_Entry *obj, int flags,
 }
 
 Elf_Addr
-reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const Obj_Entry *defobj,
-const Obj_Entry *obj, const Elf_Rel *rel)
+reloc_jmpslot(Elf_Addr *where, Elf_Addr target,
+const Obj_Entry *defobj __unused, const Obj_Entry *obj __unused,
+const Elf_Rel *rel)
 {
 
assert(ELF_R_TYPE(rel->r_info) == 

svn commit: r339880 - head/lib/libpmc/pmu-events

2018-10-29 Thread Alex Richardson
Author: arichardson
Date: Mon Oct 29 21:08:34 2018
New Revision: 339880
URL: https://svnweb.freebsd.org/changeset/base/339880

Log:
  Fix get_maxfds() in jevents
  
  If RLIM_INFINITY == -1ULL (such as on macOS) the min() call will result
  in a value of less than 1 being returned. This causes nftw() to fail
  with EINVAL.
  
  While touching this file also fix includes to work on Linux/macOS and don't
  declare snprintf since it may have different attributes in the system
  headers there.
  
  Reviewed By:  mmacy
  Approved By:  brooks (mentor)
  Differential Revision: https://reviews.freebsd.org/D17682

Modified:
  head/lib/libpmc/pmu-events/jevents.c

Modified: head/lib/libpmc/pmu-events/jevents.c
==
--- head/lib/libpmc/pmu-events/jevents.cMon Oct 29 21:08:28 2018
(r339879)
+++ head/lib/libpmc/pmu-events/jevents.cMon Oct 29 21:08:34 2018
(r339880)
@@ -34,7 +34,7 @@
 */
 
 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -54,8 +54,6 @@
 #include "json.h"
 #include "jevents.h"
 
-int snprintf(char * __restrict, size_t, const char * __restrict,
-   ...) __printflike(3, 4);
 _Noreturn void  _Exit(int);
 
 int verbose;
@@ -859,8 +857,11 @@ static int get_maxfds(void)
 {
struct rlimit rlim;
 
-   if (getrlimit(RLIMIT_NOFILE, ) == 0)
-   return min((int)rlim.rlim_max / 2, 512);
+   if (getrlimit(RLIMIT_NOFILE, ) == 0) {
+   if (rlim.rlim_max == RLIM_INFINITY)
+   return 512;
+   return min((unsigned)rlim.rlim_max / 2, 512);
+   }
 
return 512;
 }
@@ -1121,8 +1122,8 @@ int main(int argc, char *argv[])
mapfile = NULL;
rc = nftw(ldirname, preprocess_arch_std_files, maxfds, 0);
if (rc && verbose) {
-   pr_info("%s: Error preprocessing arch standard files %s\n",
-   prog, ldirname);
+   pr_info("%s: Error preprocessing arch standard files %s: %s\n",
+   prog, ldirname, strerror(errno));
goto empty_map;
} else if (rc < 0) {
/* Make build fail */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339877 - head/libexec/rtld-elf

2018-10-29 Thread Alex Richardson
Author: arichardson
Date: Mon Oct 29 21:08:11 2018
New Revision: 339877
URL: https://svnweb.freebsd.org/changeset/base/339877

Log:
  rtld-elf: make it compile with WARNS=3
  
  Reviewed By:  kib
  Approved By:  brooks (mentor)
  Differential Revision: https://reviews.freebsd.org/D17150

Modified:
  head/libexec/rtld-elf/libmap.c
  head/libexec/rtld-elf/libmap.h
  head/libexec/rtld-elf/malloc.c
  head/libexec/rtld-elf/map_object.c
  head/libexec/rtld-elf/rtld.c
  head/libexec/rtld-elf/rtld.h

Modified: head/libexec/rtld-elf/libmap.c
==
--- head/libexec/rtld-elf/libmap.c  Mon Oct 29 21:08:02 2018
(r339876)
+++ head/libexec/rtld-elf/libmap.c  Mon Oct 29 21:08:11 2018
(r339877)
@@ -199,8 +199,7 @@ lmc_parse(char *lm_p, size_t lm_len)
char prog[MAXPATHLEN];
/* allow includedir + full length path */
char line[MAXPATHLEN + 13];
-   size_t cnt;
-   int i;
+   size_t cnt, i;
 
cnt = 0;
p = NULL;
@@ -403,7 +402,7 @@ lm_find(const char *p, const char *f)
  * replacement library, or NULL.
  */
 char *
-lm_findn(const char *p, const char *f, const int n)
+lm_findn(const char *p, const char *f, const size_t n)
 {
char pathbuf[64], *s, *t;
 

Modified: head/libexec/rtld-elf/libmap.h
==
--- head/libexec/rtld-elf/libmap.h  Mon Oct 29 21:08:02 2018
(r339876)
+++ head/libexec/rtld-elf/libmap.h  Mon Oct 29 21:08:11 2018
(r339877)
@@ -5,4 +5,4 @@
 intlm_init (char *);
 void   lm_fini (void);
 char * lm_find (const char *, const char *);
-char * lm_findn (const char *, const char *, const int);
+char * lm_findn (const char *, const char *, const size_t);

Modified: head/libexec/rtld-elf/malloc.c
==
--- head/libexec/rtld-elf/malloc.c  Mon Oct 29 21:08:02 2018
(r339876)
+++ head/libexec/rtld-elf/malloc.c  Mon Oct 29 21:08:11 2018
(r339877)
@@ -60,15 +60,11 @@ static char *rcsid = "$FreeBSD$";
 #include "rtld_printf.h"
 #include "paths.h"
 
-static void morecore();
-static int findbucket();
-
 /*
  * Pre-allocate mmap'ed pages
  */
 #defineNPOOLPAGES  (128*1024/pagesz)
 static caddr_t pagepool_start, pagepool_end;
-static int morepages();
 
 /*
  * The overhead on a block is at least 4 bytes.  When free, this space
@@ -96,6 +92,11 @@ unionoverhead {
 #defineov_size ovu.ovu_size
 };
 
+static void morecore(int bucket);
+static int morepages(int n);
+static int findbucket(union overhead *freep, int srchlen);
+
+
 #defineMAGIC   0xef/* magic # on accounting info */
 #define RMAGIC 0x  /* magic # on range info */
 
@@ -156,10 +157,10 @@ void *
 malloc(nbytes)
size_t nbytes;
 {
-   register union overhead *op;
-   register int bucket;
-   register long n;
-   register unsigned amt;
+   union overhead *op;
+   int bucket;
+   size_t n;
+   unsigned amt;
 
/*
 * First time malloc is called, setup page size and
@@ -259,8 +260,8 @@ static void
 morecore(bucket)
int bucket;
 {
-   register union overhead *op;
-   register int sz;/* size of desired block */
+   union overhead *op;
+   int sz; /* size of desired block */
int amt;/* amount to allocate */
int nblks;  /* how many blocks we get */
 
@@ -303,8 +304,8 @@ void
 free(cp)
void *cp;
 {
-   register int size;
-   register union overhead *op;
+   int size;
+   union overhead *op;
 
if (cp == NULL)
return;
@@ -346,8 +347,8 @@ realloc(cp, nbytes)
void *cp;
size_t nbytes;
 {
-   register u_int onb;
-   register int i;
+   u_int onb;
+   int i;
union overhead *op;
char *res;
int was_alloced = 0;
@@ -417,8 +418,8 @@ findbucket(freep, srchlen)
union overhead *freep;
int srchlen;
 {
-   register union overhead *p;
-   register int i, j;
+   union overhead *p;
+   int i, j;
 
for (i = 0; i < NBUCKETS; i++) {
j = 0;
@@ -442,8 +443,8 @@ findbucket(freep, srchlen)
 mstats(s)
char *s;
 {
-   register int i, j;
-   register union overhead *p;
+   int i, j;
+   union overhead *p;
int totfree = 0,
totused = 0;
 

Modified: head/libexec/rtld-elf/map_object.c
==
--- head/libexec/rtld-elf/map_object.c  Mon Oct 29 21:08:02 2018
(r339876)
+++ head/libexec/rtld-elf/map_object.c  Mon Oct 29 21:08:11 2018
(r339877)
@@ -340,7 +340,7 @@ get_elf_header(int fd, const char *path, const struct 

svn commit: r339876 - head/libexec/rtld-elf

2018-10-29 Thread Alex Richardson
Author: arichardson
Date: Mon Oct 29 21:08:02 2018
New Revision: 339876
URL: https://svnweb.freebsd.org/changeset/base/339876

Log:
  rtld: set obj->textsize correctly
  
  With lld-generated binaries the first PT_LOAD will usually be a read-only
  segment unless you pass --no-rosegment. For those binaries the textsize is
  determined by the next PT_LOAD. To allow both LLD and bfd 2.17 binaries to
  be parsed correctly use the end of the last PT_LOAD that is marked as
  executable instead.
  
  I noticed that the value was wrong while adding some debug prints for some 
rtld
  changes for CHERI binaries. `obj->textsize` only seems to be used by PPC so 
the
  effect is untested. However, the value before was definitely wrong and the new
  result matches the phdrs.
  
  Reviewed By:  kib
  Approved By:  brooks (mentor)
  Differential Revision: https://reviews.freebsd.org/D17117

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

Modified: head/libexec/rtld-elf/map_object.c
==
--- head/libexec/rtld-elf/map_object.c  Mon Oct 29 21:03:43 2018
(r339875)
+++ head/libexec/rtld-elf/map_object.c  Mon Oct 29 21:08:02 2018
(r339876)
@@ -93,6 +93,7 @@ map_object(int fd, const char *path, const struct stat
 Elf_Addr note_end;
 char *note_map;
 size_t note_map_len;
+Elf_Addr text_end;
 
 hdr = get_elf_header(fd, path, sb);
 if (hdr == NULL)
@@ -116,6 +117,7 @@ map_object(int fd, const char *path, const struct stat
 note_map = NULL;
 segs = alloca(sizeof(segs[0]) * hdr->e_phnum);
 stack_flags = RTLD_DEFAULT_STACK_PF_EXEC | PF_R | PF_W;
+text_end = 0;
 while (phdr < phlimit) {
switch (phdr->p_type) {
 
@@ -130,6 +132,10 @@ map_object(int fd, const char *path, const struct stat
path, nsegs);
goto error;
}
+   if ((segs[nsegs]->p_flags & PF_X) == PF_X) {
+   text_end = MAX(text_end,
+   round_page(segs[nsegs]->p_vaddr + segs[nsegs]->p_memsz));
+   }
break;
 
case PT_PHDR:
@@ -280,8 +286,7 @@ map_object(int fd, const char *path, const struct stat
 }
 obj->mapbase = mapbase;
 obj->mapsize = mapsize;
-obj->textsize = round_page(segs[0]->p_vaddr + segs[0]->p_memsz) -
-  base_vaddr;
+obj->textsize = text_end - base_vaddr;
 obj->vaddrbase = base_vaddr;
 obj->relocbase = mapbase - base_vaddr;
 obj->dynamic = (const Elf_Dyn *) (obj->relocbase + phdyn->p_vaddr);

Modified: head/libexec/rtld-elf/rtld.c
==
--- head/libexec/rtld-elf/rtld.cMon Oct 29 21:03:43 2018
(r339875)
+++ head/libexec/rtld-elf/rtld.cMon Oct 29 21:08:02 2018
(r339876)
@@ -1390,13 +1390,15 @@ digest_phdr(const Elf_Phdr *phdr, int phnum, caddr_t e
if (nsegs == 0) {   /* First load segment */
obj->vaddrbase = trunc_page(ph->p_vaddr);
obj->mapbase = obj->vaddrbase + obj->relocbase;
-   obj->textsize = round_page(ph->p_vaddr + ph->p_memsz) -
- obj->vaddrbase;
} else {/* Last load segment */
obj->mapsize = round_page(ph->p_vaddr + ph->p_memsz) -
  obj->vaddrbase;
}
nsegs++;
+   if ((ph->p_flags & PF_X) == PF_X) {
+   obj->textsize = MAX(obj->textsize,
+   round_page(ph->p_vaddr + ph->p_memsz) - obj->vaddrbase);
+   }
break;
 
case PT_DYNAMIC:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339875 - head/release

2018-10-29 Thread Glen Barber
Author: gjb
Date: Mon Oct 29 21:03:43 2018
New Revision: 339875
URL: https://svnweb.freebsd.org/changeset/base/339875

Log:
  Pass _BRANCH in the reldoc target to ensure the correct
  src branch is used when generating the hardware.html page.
  
  MFC after:3 days
  MFC before:   12.0-BETA3
  MFC with: r339873
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/Makefile

Modified: head/release/Makefile
==
--- head/release/Makefile   Mon Oct 29 21:00:16 2018(r339874)
+++ head/release/Makefile   Mon Oct 29 21:03:43 2018(r339875)
@@ -174,6 +174,7 @@ reldoc:
cd ${DOCDIR}/en_US.ISO8859-1/htdocs/releases/${REVISION}R && \
env MAN4DIR=${WORLDDIR}/share/man/man4 \
SVN=${SVN} \
+   _BRANCH=${BRANCH} \
${MAKE} all install clean "FORMATS=html txt" \
INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${.OBJDIR}/rdoc \
WEBDIR=${DOCDIR} DESTDIR=${.OBJDIR}/rdoc
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339874 - stable/11/sys/dev/bxe

2018-10-29 Thread David C Somayajulu
Author: davidcs
Date: Mon Oct 29 21:00:16 2018
New Revision: 339874
URL: https://svnweb.freebsd.org/changeset/base/339874

Log:
  MFC r338734
  
  Fixed isses:
 State check before enqueuing transmit task in bxe_link_attn() routine.
 State check before invoking bxe_nic_unload in bxe_shutdown().
  
  Submitted by:vaishali.kulka...@cavium.com

Modified:
  stable/11/sys/dev/bxe/bxe.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/bxe/bxe.c
==
--- stable/11/sys/dev/bxe/bxe.c Mon Oct 29 20:53:05 2018(r339873)
+++ stable/11/sys/dev/bxe/bxe.c Mon Oct 29 21:00:16 2018(r339874)
@@ -7072,13 +7072,13 @@ bxe_link_attn(struct bxe_softc *sc)
 
 if (sc->state == BXE_STATE_OPEN) {
 bxe_stats_handle(sc, STATS_EVENT_LINK_UP);
+   /* Restart tx when the link comes back. */
+   FOR_EACH_ETH_QUEUE(sc, i) {
+   fp = >fp[i];
+   taskqueue_enqueue(fp->tq, >tx_task);
+   }
 }
 
-   /* Restart tx when the link comes back. */
-FOR_EACH_ETH_QUEUE(sc, i) {
-fp = >fp[i];
-taskqueue_enqueue(fp->tq, >tx_task);
-   }
 }
 
 if (sc->link_vars.link_up && sc->link_vars.line_speed) {
@@ -16272,9 +16272,11 @@ bxe_shutdown(device_t dev)
 /* stop the periodic callout */
 bxe_periodic_stop(sc);
 
-BXE_CORE_LOCK(sc);
-bxe_nic_unload(sc, UNLOAD_NORMAL, FALSE);
-BXE_CORE_UNLOCK(sc);
+if (sc->state != BXE_STATE_CLOSED) {
+   BXE_CORE_LOCK(sc);
+   bxe_nic_unload(sc, UNLOAD_NORMAL, FALSE);
+   BXE_CORE_UNLOCK(sc);
+}
 
 return (0);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339873 - head/release

2018-10-29 Thread Glen Barber
Author: gjb
Date: Mon Oct 29 20:53:05 2018
New Revision: 339873
URL: https://svnweb.freebsd.org/changeset/base/339873

Log:
  Set OPTIONS_UNSET in the argument list to env(1), and add
  AVAHI to the list.  This fixes the textproc/docproj build
  seemingly following FLAVORS being added.
  
  Specifically, the problem with the dependency chain here is:
  - textproc/docproj depends on print/cups, which sets AVAHI=on
by default;
  - net/avahi-app depends on devel/gobject-introspection, which
requires python3+;
  - graphics/netpbm depends on graphics/mesa-libs, which can
only be built with python2.7;
  - textproc/docproj depends on a number of graphics ports for
font rendering, etc.
  
  MFC after:3 days
  MFC before:   12.0-BETA3
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/release.sh

Modified: head/release/release.sh
==
--- head/release/release.sh Mon Oct 29 20:21:10 2018(r339872)
+++ head/release/release.sh Mon Oct 29 20:53:05 2018(r339873)
@@ -287,9 +287,9 @@ extra_chroot_setup() {
PBUILD_FLAGS="${PBUILD_FLAGS} OSREL=${REVISION}"
PBUILD_FLAGS="${PBUILD_FLAGS} WRKDIRPREFIX=/tmp/ports"
PBUILD_FLAGS="${PBUILD_FLAGS} DISTDIR=/tmp/distfiles"
-   chroot ${CHROOTDIR} env ${PBUILD_FLAGS} make -C \
+   chroot ${CHROOTDIR} env ${PBUILD_FLAGS} \
+   OPTIONS_UNSET="AVAHI FOP IGOR" make -C \
/usr/ports/textproc/docproj \
-   OPTIONS_UNSET="FOP IGOR" \
FORCE_PKG_REGISTER=1 \
install clean distclean
fi
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r339826 - in head: sys/amd64/vmm/intel usr.sbin/bhyve

2018-10-29 Thread Yuri Pankov
John Baldwin wrote:
> On 10/27/18 2:24 PM, Yuri Pankov wrote:
>> Author: yuripv
>> Date: Sat Oct 27 21:24:28 2018
>> New Revision: 339826
>> URL: https://svnweb.freebsd.org/changeset/base/339826
>>
>> Log:
>>   Provide basic descriptions for VMX exit reason (from "Intel 64 and IA-32
>>   Architectures Software Developer’s Manual Volume 3").  Add the document
>>   to SEE ALSO in bhyve.8 (and pet manlint here a bit).
>>   
>>   Reviewed by:   jhb, rgrimes, 0mp
>>   Approved by:   kib (mentor)
>>   Differential Revision: https://reviews.freebsd.org/D17531
> 
> I did ask you to commit the bhyve.8 style fixes separately from the content
> changes in the review.  While it is true we don't currently have active
> translations of manpages, it is still a good practice to follow to not mix
> style changes with content changes even in code commits as it obfuscates
> the content changes.

Understood, will do.  I just (incorrectly) assumed your review approval
to be "go ahead with this one, but next time don't mix content changes
and cleanups", sorry about that.



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r339826 - in head: sys/amd64/vmm/intel usr.sbin/bhyve

2018-10-29 Thread John Baldwin
On 10/27/18 2:24 PM, Yuri Pankov wrote:
> Author: yuripv
> Date: Sat Oct 27 21:24:28 2018
> New Revision: 339826
> URL: https://svnweb.freebsd.org/changeset/base/339826
> 
> Log:
>   Provide basic descriptions for VMX exit reason (from "Intel 64 and IA-32
>   Architectures Software Developer’s Manual Volume 3").  Add the document
>   to SEE ALSO in bhyve.8 (and pet manlint here a bit).
>   
>   Reviewed by:jhb, rgrimes, 0mp
>   Approved by:kib (mentor)
>   Differential Revision:  https://reviews.freebsd.org/D17531

I did ask you to commit the bhyve.8 style fixes separately from the content
changes in the review.  While it is true we don't currently have active
translations of manpages, it is still a good practice to follow to not mix
style changes with content changes even in code commits as it obfuscates
the content changes.

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


svn commit: r339872 - in stable/11/sys: amd64/include i386/include x86/include

2018-10-29 Thread John Baldwin
Author: jhb
Date: Mon Oct 29 20:21:10 2018
New Revision: 339872
URL: https://svnweb.freebsd.org/changeset/base/339872

Log:
  MFC 338101: Merge amd64 and i386  headers.

Added:
  stable/11/sys/x86/include/intr_machdep.h
 - copied, changed from r338101, head/sys/x86/include/intr_machdep.h
Modified:
  stable/11/sys/amd64/include/intr_machdep.h
  stable/11/sys/i386/include/intr_machdep.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/include/intr_machdep.h
==
--- stable/11/sys/amd64/include/intr_machdep.h  Mon Oct 29 20:08:19 2018
(r339871)
+++ stable/11/sys/amd64/include/intr_machdep.h  Mon Oct 29 20:21:10 2018
(r339872)
@@ -29,112 +29,9 @@
 #ifndef __MACHINE_INTR_MACHDEP_H__
 #define__MACHINE_INTR_MACHDEP_H__
 
-#ifdef _KERNEL
+#include 
 
 /*
- * The maximum number of I/O interrupts we allow.  This number is rather
- * arbitrary as it is just the maximum IRQ resource value.  The interrupt
- * source for a given IRQ maps that I/O interrupt to device interrupt
- * source whether it be a pin on an interrupt controller or an MSI interrupt.
- * The 16 ISA IRQs are assigned fixed IDT vectors, but all other device
- * interrupts allocate IDT vectors on demand.  Currently we have 191 IDT
- * vectors available for device interrupts.  On many systems with I/O APICs,
- * a lot of the IRQs are not used, so this number can be much larger than
- * 191 and still be safe since only interrupt sources in actual use will
- * allocate IDT vectors.
- *
- * The first 255 IRQs (0 - 254) are reserved for ISA IRQs and PCI intline IRQs.
- * IRQ values from 256 to 767 are used by MSI.  When running under the Xen
- * Hypervisor, IRQ values from 768 to 4863 are available for binding to
- * event channel events.  We leave 255 unused to avoid confusion since 255 is
- * used in PCI to indicate an invalid IRQ.
- */
-#defineNUM_MSI_INTS512
-#defineFIRST_MSI_INT   256
-#ifdef XENHVM
-#include 
-#include 
-#defineNUM_EVTCHN_INTS NR_EVENT_CHANNELS
-#defineFIRST_EVTCHN_INT \
-(FIRST_MSI_INT + NUM_MSI_INTS)
-#defineLAST_EVTCHN_INT \
-(FIRST_EVTCHN_INT + NUM_EVTCHN_INTS - 1)
-#else
-#defineNUM_EVTCHN_INTS 0
-#endif
-#defineNUM_IO_INTS (FIRST_MSI_INT + NUM_MSI_INTS + NUM_EVTCHN_INTS)
-
-/*
- * Default base address for MSI messages on x86 platforms.
- */
-#defineMSI_INTEL_ADDR_BASE 0xfee0
-
-/*
- * - 1 ??? dummy counter.
- * - 2 counters for each I/O interrupt.
- * - 1 counter for each CPU for lapic timer.
- * - 8 counters for each CPU for IPI counters for SMP.
- */
-#ifdef SMP
-#defineINTRCNT_COUNT   (1 + NUM_IO_INTS * 2 + (1 + 8) * MAXCPU)
-#else
-#defineINTRCNT_COUNT   (1 + NUM_IO_INTS * 2 + 1)
-#endif
-
-#ifndef LOCORE
-
-typedef void inthand_t(void);
-
-#defineIDTVEC(name)__CONCAT(X,name)
-
-struct intsrc;
-
-/*
- * Methods that a PIC provides to mask/unmask a given interrupt source,
- * "turn on" the interrupt on the CPU side by setting up an IDT entry, and
- * return the vector associated with this source.
- */
-struct pic {
-   void (*pic_enable_source)(struct intsrc *);
-   void (*pic_disable_source)(struct intsrc *, int);
-   void (*pic_eoi_source)(struct intsrc *);
-   void (*pic_enable_intr)(struct intsrc *);
-   void (*pic_disable_intr)(struct intsrc *);
-   int (*pic_vector)(struct intsrc *);
-   int (*pic_source_pending)(struct intsrc *);
-   void (*pic_suspend)(struct pic *);
-   void (*pic_resume)(struct pic *, bool suspend_cancelled);
-   int (*pic_config_intr)(struct intsrc *, enum intr_trigger,
-   enum intr_polarity);
-   int (*pic_assign_cpu)(struct intsrc *, u_int apic_id);
-   void (*pic_reprogram_pin)(struct intsrc *);
-   TAILQ_ENTRY(pic) pics;
-};
-
-/* Flags for pic_disable_source() */
-enum {
-   PIC_EOI,
-   PIC_NO_EOI,
-};
-
-/*
- * An interrupt source.  The upper-layer code uses the PIC methods to
- * control a given source.  The lower-layer PIC drivers can store additional
- * private data in a given interrupt source such as an interrupt pin number
- * or an I/O APIC pointer.
- */
-struct intsrc {
-   struct pic *is_pic;
-   struct intr_event *is_event;
-   u_long *is_count;
-   u_long *is_straycount;
-   u_int is_index;
-   u_int is_handlers;
-};
-
-struct trapframe;
-
-/*
  * The following data structure holds per-cpu data, and is placed just
  * above the top of the space used for the NMI and MC# stacks.
  */
@@ -143,53 +40,4 @@ struct nmi_pcpu {
register_t  __padding;  /* pad to 16 bytes */
 };
 
-#ifdef SMP
-extern cpuset_t intr_cpus;
-#endif
-extern struct mtx icu_lock;
-extern int elcr_found;
-#ifdef SMP
-extern int msix_disable_migration;
-#endif
-
-#ifndef DEV_ATPIC
-void   atpic_reset(void);
-#endif
-/* XXX: The elcr_* prototypes probably 

svn commit: r339871 - stable/12/share/man/man4

2018-10-29 Thread Michael Tuexen
Author: tuexen
Date: Mon Oct 29 20:08:19 2018
New Revision: 339871
URL: https://svnweb.freebsd.org/changeset/base/339871

Log:
  MFC r339869,r339870:
  
  Remove empty line.
  
  Reported by:  gjb@
  Approved by:  re (gjb@)

Modified:
  stable/12/share/man/man4/sctp.4
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/sctp.4
==
--- stable/12/share/man/man4/sctp.4 Mon Oct 29 19:25:30 2018
(r339870)
+++ stable/12/share/man/man4/sctp.4 Mon Oct 29 20:08:19 2018
(r339871)
@@ -593,7 +593,6 @@ Maximum incoming SCTP buffer size.
 Maximum outgoing SCTP buffer size.
 .El
 .El
-
 .Sh SEE ALSO
 .Xr accept 2 ,
 .Xr bind 2 ,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-10-29 Thread Michael Tuexen
Author: tuexen
Date: Mon Oct 29 19:25:30 2018
New Revision: 339870
URL: https://svnweb.freebsd.org/changeset/base/339870

Log:
  Insert a .El line accidently committed in r339869.
  
  Reported by:  gjb@
  MFC after:3 days

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

Modified: head/share/man/man4/sctp.4
==
--- head/share/man/man4/sctp.4  Mon Oct 29 19:14:56 2018(r339869)
+++ head/share/man/man4/sctp.4  Mon Oct 29 19:25:30 2018(r339870)
@@ -592,6 +592,7 @@ Maximum incoming SCTP buffer size.
 .It Va sendspace
 Maximum outgoing SCTP buffer size.
 .El
+.El
 .Sh SEE ALSO
 .Xr accept 2 ,
 .Xr bind 2 ,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-10-29 Thread Michael Tuexen
Author: tuexen
Date: Mon Oct 29 19:14:56 2018
New Revision: 339869
URL: https://svnweb.freebsd.org/changeset/base/339869

Log:
  Fix a nit
  
  Reported by:  gjb@
  MFC after:3 days

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

Modified: head/share/man/man4/sctp.4
==
--- head/share/man/man4/sctp.4  Mon Oct 29 19:02:36 2018(r339868)
+++ head/share/man/man4/sctp.4  Mon Oct 29 19:14:56 2018(r339869)
@@ -592,8 +592,6 @@ Maximum incoming SCTP buffer size.
 .It Va sendspace
 Maximum outgoing SCTP buffer size.
 .El
-.El
-
 .Sh SEE ALSO
 .Xr accept 2 ,
 .Xr bind 2 ,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339868 - head/sys/compat/linuxkpi/common/include/linux

2018-10-29 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Oct 29 19:02:36 2018
New Revision: 339868
URL: https://svnweb.freebsd.org/changeset/base/339868

Log:
  Implement dma_pool_zalloc() in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  MFC after:3 days
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/dmapool.h

Modified: head/sys/compat/linuxkpi/common/include/linux/dmapool.h
==
--- head/sys/compat/linuxkpi/common/include/linux/dmapool.h Mon Oct 29 
19:01:47 2018(r339867)
+++ head/sys/compat/linuxkpi/common/include/linux/dmapool.h Mon Oct 29 
19:02:36 2018(r339868)
@@ -77,6 +77,13 @@ dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags,
return (vaddr);
 }
 
+static inline void *
+dma_pool_zalloc(struct dma_pool *pool, gfp_t mem_flags, dma_addr_t *handle)
+{
+
+   return (dma_pool_alloc(pool, mem_flags | __GFP_ZERO, handle));
+}
+
 static inline void
 dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339867 - in stable/12: share/man/man4 sys/netinet

2018-10-29 Thread Michael Tuexen
Author: tuexen
Date: Mon Oct 29 19:01:47 2018
New Revision: 339867
URL: https://svnweb.freebsd.org/changeset/base/339867

Log:
  MFC r339791:
  
  Add initial descriptions for SCTP related MIB variable.
  This work was mostly done by Marie-Helene Kvello-Aune.
  
  Approved by:  re (gjb)
  Differential Revision:https://reviews.freebsd.org/D3583

Modified:
  stable/12/share/man/man4/sctp.4
  stable/12/sys/netinet/sctp_sysctl.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/sctp.4
==
--- stable/12/share/man/man4/sctp.4 Mon Oct 29 17:55:26 2018
(r339866)
+++ stable/12/share/man/man4/sctp.4 Mon Oct 29 19:01:47 2018
(r339867)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 15, 2006
+.Dd October 10, 2018
 .Dt SCTP 4
 .Os
 .Sh NAME
@@ -145,7 +145,7 @@ with no regard to the ordering of any other message.
 The FreeBSD implementation of
 .Tn SCTP
 also supports the following extensions:
-.Bl -hang -width indent
+.Bl -tag -width "sctp partial reliability"
 .It "sctp partial reliability"
 This extension allows one to have message be skipped and
 not delivered based on some user specified parameters.
@@ -168,7 +168,7 @@ utilization.
 This extension allows a user on either side to reset the
 stream sequence numbers used by any or all streams.
 .El
-.Pp
+.Ss Socket Options
 .Tn SCTP
 supports a number of socket options which can be set with
 .Xr setsockopt 2
@@ -176,7 +176,7 @@ and tested with
 .Xr getsockopt 2
 or
 .Xr sctp_opt_info 3 :
-.Bl -tag -width ".Dv SCTP_SET_PEER_PRIMARY_ADDR"
+.Bl -tag -indent
 .It Dv SCTP_NODELAY
 Under most circumstances,
 .Tn SCTP
@@ -409,6 +409,191 @@ Note that the peer
 endpoint must also support the stream reset extension
 as well.
 .El
+.Ss MIB Variables
+The
+.Tn SCTP
+protocol implements a number of variables in the
+.Va net.inet.sctp
+branch of the
+.Xr sysctl 3
+MIB.
+.Bl -ohang
+.It Sy Congestion Control
+.Bl -tag -width indent
+.It Va default_cc_module
+Default congestion control module.
+Default value is 0.
+The minimum is 0, and the maximum is 3.
+A value of 0 enables the default congestion control algorithm.
+A value of 1 enables the High Speed congestion control algorithm.
+A value of 2 enables the HTCP congestion control algorithm.
+A value of 3 enables the data center congestion control (DCCC) algorithm.
+.It Va initial_cwnd
+Defines the initial congestion window size in MTUs.
+.It Va cwnd_maxburst
+Use congestion control instead of 'blind' logic to limit maximum burst when 
sending.
+Default value is 1. May be set to 0 or 1.
+.It Va ecn_enable
+Enable Explicit Congestion Notification (ECN).
+Default value is 1. May be set to 0 or 1.
+.It Va rttvar_steady_step
+Number of identical bandwidth measurements DCCC takes to try step down the 
congestion window.
+Default value is 20.
+The minimum is 0, and the maximum is 65535.
+.It Va rttvar_eqret
+Whether DCCC reduces the congestion window size when round-trip time and 
bandwidth remain unchanged.
+Default value is 0.
+May be set to 0 or 1.
+.It Va rttvar_bw
+Shift amount DCCC uses for bandwidth smoothing on round-trip-time calculation.
+Default value is 4.
+The minimum is 0, and the maximum is 32.
+.It Va rttvar_rtt
+Shift amount DCCC uses for round-trip-time smoothing on round-trip-time 
calculation.
+Default value is 5.
+The minimum is 0, and the maximum is 32.
+.It Va use_dcccecn
+Enable ECN when using DCCC.
+Default value is 1.
+May be set to 0 or 1.
+.El
+.It Sy Misc
+.Bl -tag -width indent
+.It Va getcred
+Get the ucred of a SCTP connection.
+.It Va assoclist
+List of active SCTP associations.
+.It Va stats
+SCTP statistics (struct sctp_stat).
+.It Va diag_info_code
+Diagnostic information error cause code.
+.It Va blackhole
+Enable SCTP blackholing.
+See
+.Xr blackhole 4
+for more details.
+.It Va buffer_splitting
+Enable send/receive buffer splitting.
+.It Va vtag_time_wait
+Vtag wait time in seconds, 0 to disable.
+.It Va nat_friendly_init
+Enable sending of the NAT-friendly SCTP option on INITs.
+.It Va enable_sack_immediately
+Enable sending of the SACK-IMMEDIATELY bit.
+.It Va udp_tunneling_port
+Set the SCTP/UDP tunneling port.
+.It Va mobility_fasthandoff
+Enable SCTP fast handoff.
+.It Va mobility_base
+Enable SCTP base mobility
+.It Va default_frag_interleave
+Default fragment interleave level.
+.It Va default_ss_module
+Default stream scheduling module.
+.It Va log_level
+Ltrace/KTR trace logging level.
+.It Va max_retran_chunk
+Number of retransmissions of a DATA chunk before an association is aborted.
+.It Va min_residual
+Minimum residual data chunk in second part of split.
+.It Va strict_data_order
+Enforce strict data ordering, abort if control inside data.
+.It Va abort_at_limit
+Abort when one-to-one hits qlimit.
+.It Va hb_max_burst
+Confirmation heartbeat max burst.
+.It Va do_sctp_drain
+Flush chunks in receive queues with TSN higher than 

svn commit: r339866 - head/lib/csu/common

2018-10-29 Thread Andrew Turner
Author: andrew
Date: Mon Oct 29 17:55:26 2018
New Revision: 339866
URL: https://svnweb.freebsd.org/changeset/base/339866

Log:
  Make the .ctors, .dtors, and .jcr markers as static. They shouldn't be
  accessible from out of the files they are defined in.
  
  MFC with: r339738
  Sponsored by: DARPA, AFRL

Modified:
  head/lib/csu/common/crtbegin.c
  head/lib/csu/common/crtend.c

Modified: head/lib/csu/common/crtbegin.c
==
--- head/lib/csu/common/crtbegin.c  Mon Oct 29 17:13:12 2018
(r339865)
+++ head/lib/csu/common/crtbegin.c  Mon Oct 29 17:55:26 2018
(r339866)
@@ -45,10 +45,10 @@ void *__dso_handle = 0;
 #ifdef HAVE_CTORS
 static void __do_global_dtors_aux(void) __used;
 
-crt_func __CTOR_LIST__[] __section(".ctors") __hidden = {
+static crt_func __CTOR_LIST__[] __section(".ctors") = {
(crt_func)-1
 };
-crt_func __DTOR_LIST__[] __section(".dtors") __hidden = {
+static crt_func __DTOR_LIST__[] __section(".dtors") = {
(crt_func)-1
 };
 
@@ -81,7 +81,7 @@ asm (
 extern void _Jv_RegisterClasses(void *) __weak_symbol;
 static void register_classes(void) __used;
 
-crt_func __JCR_LIST__[] __section(".jcr") __used __hidden = { };
+static crt_func __JCR_LIST__[] __section(".jcr") __used = { };
 
 #ifndef CTORS_CONSTRUCTORS
 __attribute__((constructor))

Modified: head/lib/csu/common/crtend.c
==
--- head/lib/csu/common/crtend.cMon Oct 29 17:13:12 2018
(r339865)
+++ head/lib/csu/common/crtend.cMon Oct 29 17:55:26 2018
(r339866)
@@ -35,10 +35,10 @@ typedef void (*crt_func)(void);
  */
 static void __do_global_ctors_aux(void) __used;
 
-crt_func __CTOR_END__[] __section(".ctors") __used __hidden = {
+static crt_func __CTOR_END__[] __section(".ctors") __used = {
(crt_func)0
 };
-crt_func __DTOR_END__[] __section(".dtors") __used __hidden = {
+static crt_func __DTOR_END__[] __section(".dtors") __used = {
(crt_func)0
 };
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339865 - head/etc/mtree

2018-10-29 Thread Andrew Turner
Author: andrew
Date: Mon Oct 29 17:13:12 2018
New Revision: 339865
URL: https://svnweb.freebsd.org/changeset/base/339865

Log:
  Include the csu test directories in BSD.tests.dist
  
  MFC with: r339738
  Sponsored by: DARPA, AFRL

Modified:
  head/etc/mtree/BSD.tests.dist

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Mon Oct 29 17:03:20 2018
(r339864)
+++ head/etc/mtree/BSD.tests.dist   Mon Oct 29 17:13:12 2018
(r339865)
@@ -270,6 +270,12 @@
 test-programs
 ..
 ..
+csu
+dynamic
+..
+static
+..
+..
 libarchive
 ..
 libc
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339864 - head/lib/csu/tests

2018-10-29 Thread Andrew Turner
Author: andrew
Date: Mon Oct 29 17:03:20 2018
New Revision: 339864
URL: https://svnweb.freebsd.org/changeset/base/339864

Log:
  Check __dso_handle is NULL in non-DSO objects. It should only be non-NULL
  when accessed from a shared object.
  
  MFC with: r339738
  Sponsored by: DARPA, AFRL

Modified:
  head/lib/csu/tests/fini_test.c

Modified: head/lib/csu/tests/fini_test.c
==
--- head/lib/csu/tests/fini_test.c  Mon Oct 29 15:12:15 2018
(r339863)
+++ head/lib/csu/tests/fini_test.c  Mon Oct 29 17:03:20 2018
(r339864)
@@ -119,11 +119,22 @@ ATF_TC_BODY(fini_array_test, tc)
}
 }
 
+extern void *__dso_handle;
+
+ATF_TC_WITHOUT_HEAD(dso_handle_test);
+ATF_TC_BODY(dso_handle_test, tc)
+{
+
+   ATF_REQUIRE_MSG(__dso_handle == NULL,
+   "Invalid __dso_handle in non-DSO");
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 
ATF_TP_ADD_TC(tp, dtors_test);
ATF_TP_ADD_TC(tp, fini_array_test);
+   ATF_TP_ADD_TC(tp, dso_handle_test);
 
return (atf_no_error());
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339863 - stable/11/sys/dev/hyperv/netvsc

2018-10-29 Thread Wei Hu
Author: whu
Date: Mon Oct 29 15:12:15 2018
New Revision: 339863
URL: https://svnweb.freebsd.org/changeset/base/339863

Log:
  MFC: 339585
  
  r339585:
  Do not drop UDP traffic when TXCSUM_IPV6 flag is on
  
  PR: 231797
  Submitted by:   whu
  Reviewed by:dexuan
  Obtained from:  Kevin Morse
  Sponsored by:   Microsoft
  Differential Revision:  
https://bugs.freebsd.org/bugzilla/attachment.cgi?id=198333=diff

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

Modified: stable/11/sys/dev/hyperv/netvsc/if_hn.c
==
--- stable/11/sys/dev/hyperv/netvsc/if_hn.c Mon Oct 29 14:37:27 2018
(r339862)
+++ stable/11/sys/dev/hyperv/netvsc/if_hn.c Mon Oct 29 15:12:15 2018
(r339863)
@@ -861,7 +861,8 @@ hn_set_hlen(struct mbuf *m_head)
 
PULLUP_HDR(m_head, ehlen + sizeof(*ip6));
ip6 = mtodo(m_head, ehlen);
-   if (ip6->ip6_nxt != IPPROTO_TCP) {
+   if (ip6->ip6_nxt != IPPROTO_TCP &&
+   ip6->ip6_nxt != IPPROTO_UDP) {
m_freem(m_head);
return (NULL);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339862 - stable/11/sys/sys

2018-10-29 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Oct 29 14:37:27 2018
New Revision: 339862
URL: https://svnweb.freebsd.org/changeset/base/339862

Log:
  MFC r339600:
  Make sure returned value is checked and assert a valid refcount.
  While at it fix a print: Unsigned types cannot be negative.
  
  Reviewed by:  kib, mjg
  Differential revision:https://reviews.freebsd.org/D17616
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/sys/refcount.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/sys/refcount.h
==
--- stable/11/sys/sys/refcount.hMon Oct 29 14:36:03 2018
(r339861)
+++ stable/11/sys/sys/refcount.hMon Oct 29 14:37:27 2018
(r339862)
@@ -60,7 +60,7 @@ refcount_release(volatile u_int *count)
 
atomic_thread_fence_rel();
old = atomic_fetchadd_int(count, -1);
-   KASSERT(old > 0, ("negative refcount %p", count));
+   KASSERT(old > 0, ("refcount %p is zero", count));
if (old > 1)
return (0);
 
@@ -75,15 +75,19 @@ refcount_release(volatile u_int *count)
 }
 
 /*
+ * This functions returns non-zero if the refcount was
+ * incremented. Else zero is returned.
+ *
  * A temporary hack until refcount_* APIs are sorted out.
  */
-static __inline int
+static __inline __result_use_check int
 refcount_acquire_if_not_zero(volatile u_int *count)
 {
u_int old;
 
old = *count;
for (;;) {
+   KASSERT(old < UINT_MAX, ("refcount %p overflowed", count));
if (old == 0)
return (0);
if (atomic_fcmpset_int(count, , old + 1))
@@ -91,13 +95,14 @@ refcount_acquire_if_not_zero(volatile u_int *count)
}
 }
 
-static __inline int
+static __inline __result_use_check int
 refcount_release_if_not_last(volatile u_int *count)
 {
u_int old;
 
old = *count;
for (;;) {
+   KASSERT(old > 0, ("refcount %p is zero", count));
if (old == 1)
return (0);
if (atomic_fcmpset_int(count, , old - 1))
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339861 - in head/sys: kern sys

2018-10-29 Thread Stephen Hurd
Author: shurd
Date: Mon Oct 29 14:36:03 2018
New Revision: 339861
URL: https://svnweb.freebsd.org/changeset/base/339861

Log:
  Drain grouptaskqueue of the gtask before detaching it.
  
  taskqgroup_detach() would remove the task even if it was running or
  enqueued, which could lead to panics (see D17404). With this change,
  taskqgroup_detach() drains the task and sets a new flag which prevents the
  task from being scheduled again.
  
  I've added grouptask_block() and grouptask_unblock() to allow control
  over the flag from other locations as well.
  
  Reviewed by:  Jeffrey Pieper 
  MFC after:1 week
  Sponsored by: Limelight Networks
  Differential Revision:https://reviews.freebsd.org/D17674

Modified:
  head/sys/kern/subr_gtaskqueue.c
  head/sys/sys/gtaskqueue.h

Modified: head/sys/kern/subr_gtaskqueue.c
==
--- head/sys/kern/subr_gtaskqueue.c Mon Oct 29 14:06:20 2018
(r339860)
+++ head/sys/kern/subr_gtaskqueue.c Mon Oct 29 14:36:03 2018
(r339861)
@@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$");
 static MALLOC_DEFINE(M_GTASKQUEUE, "gtaskqueue", "Group Task Queues");
 static voidgtaskqueue_thread_enqueue(void *);
 static voidgtaskqueue_thread_loop(void *arg);
+static int task_is_running(struct gtaskqueue *queue, struct gtask *gtask);
+static voidgtaskqueue_drain_locked(struct gtaskqueue *queue, struct gtask 
*gtask);
 
 TASKQGROUP_DEFINE(softirq, mp_ncpus, 1);
 TASKQGROUP_DEFINE(config, 1, 1);
@@ -183,6 +185,44 @@ gtaskqueue_free(struct gtaskqueue *queue)
free(queue, M_GTASKQUEUE);
 }
 
+/*
+ * Wait for all to complete, then prevent it from being enqueued
+ */
+void
+grouptask_block(struct grouptask *grouptask)
+{
+   struct gtaskqueue *queue = grouptask->gt_taskqueue;
+   struct gtask *gtask = >gt_task;
+
+#ifdef INVARIANTS
+   if (queue == NULL) {
+   gtask_dump(gtask);
+   panic("queue == NULL");
+   }
+#endif
+   TQ_LOCK(queue);
+   gtask->ta_flags |= TASK_NOENQUEUE;
+   gtaskqueue_drain_locked(queue, gtask);
+   TQ_UNLOCK(queue);
+}
+
+void
+grouptask_unblock(struct grouptask *grouptask)
+{
+   struct gtaskqueue *queue = grouptask->gt_taskqueue;
+   struct gtask *gtask = >gt_task;
+
+#ifdef INVARIANTS
+   if (queue == NULL) {
+   gtask_dump(gtask);
+   panic("queue == NULL");
+   }
+#endif
+   TQ_LOCK(queue);
+   gtask->ta_flags &= ~TASK_NOENQUEUE;
+   TQ_UNLOCK(queue);
+}
+
 int
 grouptaskqueue_enqueue(struct gtaskqueue *queue, struct gtask *gtask)
 {
@@ -197,6 +237,10 @@ grouptaskqueue_enqueue(struct gtaskqueue *queue, struc
TQ_UNLOCK(queue);
return (0);
}
+   if (gtask->ta_flags & TASK_NOENQUEUE) {
+   TQ_UNLOCK(queue);
+   return (EAGAIN);
+   }
STAILQ_INSERT_TAIL(>tq_queue, gtask, ta_link);
gtask->ta_flags |= TASK_ENQUEUED;
TQ_UNLOCK(queue);
@@ -378,6 +422,13 @@ gtaskqueue_cancel(struct gtaskqueue *queue, struct gta
return (error);
 }
 
+static void
+gtaskqueue_drain_locked(struct gtaskqueue *queue, struct gtask *gtask)
+{
+   while ((gtask->ta_flags & TASK_ENQUEUED) || task_is_running(queue, 
gtask))
+   TQ_SLEEP(queue, gtask, >tq_mutex, PWAIT, "-", 0);
+}
+
 void
 gtaskqueue_drain(struct gtaskqueue *queue, struct gtask *gtask)
 {
@@ -386,8 +437,7 @@ gtaskqueue_drain(struct gtaskqueue *queue, struct gtas
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__);
 
TQ_LOCK(queue);
-   while ((gtask->ta_flags & TASK_ENQUEUED) || task_is_running(queue, 
gtask))
-   TQ_SLEEP(queue, gtask, >tq_mutex, PWAIT, "-", 0);
+   gtaskqueue_drain_locked(queue, gtask);
TQ_UNLOCK(queue);
 }
 
@@ -803,6 +853,7 @@ taskqgroup_detach(struct taskqgroup *qgroup, struct gr
 {
int i;
 
+   grouptask_block(gtask);
mtx_lock(>tqg_lock);
for (i = 0; i < qgroup->tqg_cnt; i++)
if (qgroup->tqg_queue[i].tgc_taskq == gtask->gt_taskqueue)
@@ -813,6 +864,7 @@ taskqgroup_detach(struct taskqgroup *qgroup, struct gr
LIST_REMOVE(gtask, gt_list);
mtx_unlock(>tqg_lock);
gtask->gt_taskqueue = NULL;
+   gtask->gt_task.ta_flags &= ~TASK_NOENQUEUE;
 }
 
 static void

Modified: head/sys/sys/gtaskqueue.h
==
--- head/sys/sys/gtaskqueue.h   Mon Oct 29 14:06:20 2018(r339860)
+++ head/sys/sys/gtaskqueue.h   Mon Oct 29 14:36:03 2018(r339861)
@@ -52,7 +52,9 @@ int   gtaskqueue_cancel(struct gtaskqueue *queue, struct
 void   gtaskqueue_drain(struct gtaskqueue *queue, struct gtask *task);
 void   gtaskqueue_drain_all(struct gtaskqueue *queue);
 
-int grouptaskqueue_enqueue(struct gtaskqueue *queue, struct gtask *task);
+void   grouptask_block(struct grouptask *grouptask);
+void   

svn commit: r339860 - stable/12/sys/sys

2018-10-29 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Oct 29 14:06:20 2018
New Revision: 339860
URL: https://svnweb.freebsd.org/changeset/base/339860

Log:
  MFC r339600:
  Make sure returned value is checked and assert a valid refcount.
  While at it fix a print: Unsigned types cannot be negative.
  
  Reviewed by:  kib, mjg
  Approved by:  re (gjb)
  Differential revision:https://reviews.freebsd.org/D17616
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/sys/sys/refcount.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/sys/refcount.h
==
--- stable/12/sys/sys/refcount.hMon Oct 29 13:17:41 2018
(r339859)
+++ stable/12/sys/sys/refcount.hMon Oct 29 14:06:20 2018
(r339860)
@@ -62,7 +62,7 @@ refcount_release(volatile u_int *count)
 
atomic_thread_fence_rel();
old = atomic_fetchadd_int(count, -1);
-   KASSERT(old > 0, ("negative refcount %p", count));
+   KASSERT(old > 0, ("refcount %p is zero", count));
if (old > 1)
return (0);
 
@@ -77,15 +77,19 @@ refcount_release(volatile u_int *count)
 }
 
 /*
+ * This functions returns non-zero if the refcount was
+ * incremented. Else zero is returned.
+ *
  * A temporary hack until refcount_* APIs are sorted out.
  */
-static __inline int
+static __inline __result_use_check int
 refcount_acquire_if_not_zero(volatile u_int *count)
 {
u_int old;
 
old = *count;
for (;;) {
+   KASSERT(old < UINT_MAX, ("refcount %p overflowed", count));
if (old == 0)
return (0);
if (atomic_fcmpset_int(count, , old + 1))
@@ -93,13 +97,14 @@ refcount_acquire_if_not_zero(volatile u_int *count)
}
 }
 
-static __inline int
+static __inline __result_use_check int
 refcount_release_if_not_last(volatile u_int *count)
 {
u_int old;
 
old = *count;
for (;;) {
+   KASSERT(old > 0, ("refcount %p is zero", count));
if (old == 1)
return (0);
if (atomic_fcmpset_int(count, , old - 1))
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339859 - stable/12/sys/net

2018-10-29 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Oct 29 13:17:41 2018
New Revision: 339859
URL: https://svnweb.freebsd.org/changeset/base/339859

Log:
  MFC r339588:
  Resolve deadlock between epoch(9) and various network interface
  SX-locks, during if_purgeaddrs(), by not allowing to hold the epoch
  read lock over typical network IOCTL code paths. This is a regression
  issue after r334305.
  
  Reviewed by:  ae (network)
  Approved by:  re (kib)
  Differential revision:https://reviews.freebsd.org/D17647
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/sys/net/if.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/net/if.c
==
--- stable/12/sys/net/if.c  Mon Oct 29 12:48:30 2018(r339858)
+++ stable/12/sys/net/if.c  Mon Oct 29 13:17:41 2018(r339859)
@@ -964,12 +964,18 @@ if_attachdomain1(struct ifnet *ifp)
 void
 if_purgeaddrs(struct ifnet *ifp)
 {
-   struct ifaddr *ifa, *next;
+   struct ifaddr *ifa;
 
-   NET_EPOCH_ENTER();
-   CK_STAILQ_FOREACH_SAFE(ifa, >if_addrhead, ifa_link, next) {
-   if (ifa->ifa_addr->sa_family == AF_LINK)
-   continue;
+   while (1) {
+   NET_EPOCH_ENTER();
+   CK_STAILQ_FOREACH(ifa, >if_addrhead, ifa_link) {
+   if (ifa->ifa_addr->sa_family != AF_LINK)
+   break;
+   }
+   NET_EPOCH_EXIT();
+
+   if (ifa == NULL)
+   break;
 #ifdef INET
/* XXX: Ugly!! ad hoc just for INET */
if (ifa->ifa_addr->sa_family == AF_INET) {
@@ -996,7 +1002,6 @@ if_purgeaddrs(struct ifnet *ifp)
IF_ADDR_WUNLOCK(ifp);
ifa_free(ifa);
}
-   NET_EPOCH_EXIT();
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339858 - in stable/10: share/man/man4 sys/ddb

2018-10-29 Thread Andriy Gapon
Author: avg
Date: Mon Oct 29 12:48:30 2018
New Revision: 339858
URL: https://svnweb.freebsd.org/changeset/base/339858

Log:
  MFC r337528: add an option for ddb ps command to print process arguments
  
  Sponsored by: Panzura

Modified:
  stable/10/share/man/man4/ddb.4
  stable/10/sys/ddb/db_ps.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/ddb.4
==
--- stable/10/share/man/man4/ddb.4  Mon Oct 29 12:47:15 2018
(r339857)
+++ stable/10/share/man/man4/ddb.4  Mon Oct 29 12:48:30 2018
(r339858)
@@ -535,16 +535,15 @@ If the thread is not found, search the thread stack ca
 cached stack address.
 Otherwise, prints nothing.
 .Pp
-.It Ic show Cm all procs Ns Op Li / Ns Cm m
-.It Ic ps Ns Op Li / Ns Cm m
+.It Ic show Cm all procs Ns Op Li / Ns Cm a
+.It Ic ps Ns Op Li / Ns Cm a
 Display all process information.
 The process information may not be shown if it is not
 supported in the machine, or the bottom of the stack of the
 target process is not in the main memory at that time.
 The
-.Cm m
-modifier will alter the display to show VM map
-addresses for the process and not show other information.
+.Cm a
+modifier will print command line arguments for each process.
 .\"
 .Pp
 .It Ic show Cm all trace

Modified: stable/10/sys/ddb/db_ps.c
==
--- stable/10/sys/ddb/db_ps.c   Mon Oct 29 12:47:15 2018(r339857)
+++ stable/10/sys/ddb/db_ps.c   Mon Oct 29 12:48:30 2018(r339858)
@@ -44,8 +44,13 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#define PRINT_NONE 0
+#define PRINT_ARGS 1
+
 static voiddumpthread(volatile struct proc *p, volatile struct thread *td,
int all);
+static int ps_mode;
+
 /*
  * At least one non-optional show-command must be implemented using
  * DB_SHOW_ALL_COMMAND() so that db_show_all_cmd_set gets created.
@@ -56,6 +61,24 @@ DB_SHOW_ALL_COMMAND(procs, db_procs_cmd)
db_ps(addr, have_addr, count, modif);
 }
 
+static void
+dump_args(volatile struct proc *p)
+{
+   char *args;
+   int i, len;
+
+   if (p->p_args == NULL)
+   return;
+   args = p->p_args->ar_args;
+   len = (int)p->p_args->ar_length;
+   for (i = 0; i < len; i++) {
+   if (args[i] == '\0')
+   db_printf(" ");
+   else
+   db_printf("%c", args[i]);
+   }
+}
+
 /*
  * Layout:
  * - column counts
@@ -84,6 +107,7 @@ db_ps(db_expr_t addr, boolean_t hasaddr, db_expr_t cou
char state[9];
int np, rflag, sflag, dflag, lflag, wflag;
 
+   ps_mode = modif[0] == 'a' ? PRINT_ARGS : PRINT_NONE;
np = nprocs;
 
if (!LIST_EMPTY())
@@ -201,6 +225,10 @@ db_ps(db_expr_t addr, boolean_t hasaddr, db_expr_t cou
db_printf("%s", p->p_comm);
if (p->p_flag & P_SYSTEM)
db_printf("]");
+   if (ps_mode == PRINT_ARGS) {
+   db_printf(" ");
+   dump_args(p);
+   }
db_printf("\n");
}
FOREACH_THREAD_IN_PROC(p, td) {
@@ -293,6 +321,10 @@ dumpthread(volatile struct proc *p, volatile struct th
db_printf("%s", td->td_proc->p_comm);
if (p->p_flag & P_SYSTEM)
db_printf("]");
+   if (ps_mode == PRINT_ARGS && all == 0) {
+   db_printf(" ");
+   dump_args(p);
+   }
db_printf("\n");
 }
 
@@ -428,12 +460,7 @@ DB_SHOW_COMMAND(proc, db_show_proc)
db_printf(" ABI: %s\n", p->p_sysent->sv_name);
if (p->p_args != NULL) {
db_printf(" arguments: ");
-   for (i = 0; i < (int)p->p_args->ar_length; i++) {
-   if (p->p_args->ar_args[i] == '\0')
-   db_printf(" ");
-   else
-   db_printf("%c", p->p_args->ar_args[i]);
-   }
+   dump_args(p);
db_printf("\n");
}
db_printf(" threads: %d\n", p->p_numthreads);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339857 - in stable/11: share/man/man4 sys/ddb

2018-10-29 Thread Andriy Gapon
Author: avg
Date: Mon Oct 29 12:47:15 2018
New Revision: 339857
URL: https://svnweb.freebsd.org/changeset/base/339857

Log:
  MFC r337528: add an option for ddb ps command to print process arguments
  
  Sponsored by: Panzura

Modified:
  stable/11/share/man/man4/ddb.4
  stable/11/sys/ddb/db_ps.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man4/ddb.4
==
--- stable/11/share/man/man4/ddb.4  Mon Oct 29 12:45:08 2018
(r339856)
+++ stable/11/share/man/man4/ddb.4  Mon Oct 29 12:47:15 2018
(r339857)
@@ -537,16 +537,15 @@ If the thread is not found, search the thread stack ca
 cached stack address.
 Otherwise, prints nothing.
 .Pp
-.It Ic show Cm all procs Ns Op Li / Ns Cm m
-.It Ic ps Ns Op Li / Ns Cm m
+.It Ic show Cm all procs Ns Op Li / Ns Cm a
+.It Ic ps Ns Op Li / Ns Cm a
 Display all process information.
 The process information may not be shown if it is not
 supported in the machine, or the bottom of the stack of the
 target process is not in the main memory at that time.
 The
-.Cm m
-modifier will alter the display to show VM map
-addresses for the process and not show other information.
+.Cm a
+modifier will print command line arguments for each process.
 .\"
 .Pp
 .It Ic show Cm all trace

Modified: stable/11/sys/ddb/db_ps.c
==
--- stable/11/sys/ddb/db_ps.c   Mon Oct 29 12:45:08 2018(r339856)
+++ stable/11/sys/ddb/db_ps.c   Mon Oct 29 12:47:15 2018(r339857)
@@ -47,8 +47,13 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#define PRINT_NONE 0
+#define PRINT_ARGS 1
+
 static voiddumpthread(volatile struct proc *p, volatile struct thread *td,
int all);
+static int ps_mode;
+
 /*
  * At least one non-optional show-command must be implemented using
  * DB_SHOW_ALL_COMMAND() so that db_show_all_cmd_set gets created.
@@ -59,6 +64,24 @@ DB_SHOW_ALL_COMMAND(procs, db_procs_cmd)
db_ps(addr, have_addr, count, modif);
 }
 
+static void
+dump_args(volatile struct proc *p)
+{
+   char *args;
+   int i, len;
+
+   if (p->p_args == NULL)
+   return;
+   args = p->p_args->ar_args;
+   len = (int)p->p_args->ar_length;
+   for (i = 0; i < len; i++) {
+   if (args[i] == '\0')
+   db_printf(" ");
+   else
+   db_printf("%c", args[i]);
+   }
+}
+
 /*
  * Layout:
  * - column counts
@@ -87,6 +110,7 @@ db_ps(db_expr_t addr, bool hasaddr, db_expr_t count, c
char state[9];
int np, rflag, sflag, dflag, lflag, wflag;
 
+   ps_mode = modif[0] == 'a' ? PRINT_ARGS : PRINT_NONE;
np = nprocs;
 
if (!LIST_EMPTY())
@@ -204,6 +228,10 @@ db_ps(db_expr_t addr, bool hasaddr, db_expr_t count, c
db_printf("%s", p->p_comm);
if (p->p_flag & P_SYSTEM)
db_printf("]");
+   if (ps_mode == PRINT_ARGS) {
+   db_printf(" ");
+   dump_args(p);
+   }
db_printf("\n");
}
FOREACH_THREAD_IN_PROC(p, td) {
@@ -296,6 +324,10 @@ dumpthread(volatile struct proc *p, volatile struct th
db_printf("%s", td->td_proc->p_comm);
if (p->p_flag & P_SYSTEM)
db_printf("]");
+   if (ps_mode == PRINT_ARGS && all == 0) {
+   db_printf(" ");
+   dump_args(p);
+   }
db_printf("\n");
 }
 
@@ -442,12 +474,7 @@ DB_SHOW_COMMAND(proc, db_show_proc)
db_printf(" ABI: %s\n", p->p_sysent->sv_name);
if (p->p_args != NULL) {
db_printf(" arguments: ");
-   for (i = 0; i < (int)p->p_args->ar_length; i++) {
-   if (p->p_args->ar_args[i] == '\0')
-   db_printf(" ");
-   else
-   db_printf("%c", p->p_args->ar_args[i]);
-   }
+   dump_args(p);
db_printf("\n");
}
db_printf(" threads: %d\n", p->p_numthreads);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339856 - stable/10/sys/ddb

2018-10-29 Thread Andriy Gapon
Author: avg
Date: Mon Oct 29 12:45:08 2018
New Revision: 339856
URL: https://svnweb.freebsd.org/changeset/base/339856

Log:
  MFC r303648: Fix ddb "show proc" to show full arguments
  
  PR:   200052

Modified:
  stable/10/sys/ddb/db_ps.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ddb/db_ps.c
==
--- stable/10/sys/ddb/db_ps.c   Mon Oct 29 12:41:49 2018(r339855)
+++ stable/10/sys/ddb/db_ps.c   Mon Oct 29 12:45:08 2018(r339856)
@@ -426,9 +426,16 @@ DB_SHOW_COMMAND(proc, db_show_proc)
p->p_leader);
if (p->p_sysent != NULL)
db_printf(" ABI: %s\n", p->p_sysent->sv_name);
-   if (p->p_args != NULL)
-   db_printf(" arguments: %.*s\n", (int)p->p_args->ar_length,
-   p->p_args->ar_args);
+   if (p->p_args != NULL) {
+   db_printf(" arguments: ");
+   for (i = 0; i < (int)p->p_args->ar_length; i++) {
+   if (p->p_args->ar_args[i] == '\0')
+   db_printf(" ");
+   else
+   db_printf("%c", p->p_args->ar_args[i]);
+   }
+   db_printf("\n");
+   }
db_printf(" threads: %d\n", p->p_numthreads);
FOREACH_THREAD_IN_PROC(p, td) {
dumpthread(p, td, 1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339855 - stable/11/sys/ddb

2018-10-29 Thread Andriy Gapon
Author: avg
Date: Mon Oct 29 12:41:49 2018
New Revision: 339855
URL: https://svnweb.freebsd.org/changeset/base/339855

Log:
  MFC r303648: Fix ddb "show proc" to show full arguments
  
  PR:   200052

Modified:
  stable/11/sys/ddb/db_ps.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/ddb/db_ps.c
==
--- stable/11/sys/ddb/db_ps.c   Mon Oct 29 12:13:05 2018(r339854)
+++ stable/11/sys/ddb/db_ps.c   Mon Oct 29 12:41:49 2018(r339855)
@@ -440,9 +440,16 @@ DB_SHOW_COMMAND(proc, db_show_proc)
p->p_leader);
if (p->p_sysent != NULL)
db_printf(" ABI: %s\n", p->p_sysent->sv_name);
-   if (p->p_args != NULL)
-   db_printf(" arguments: %.*s\n", (int)p->p_args->ar_length,
-   p->p_args->ar_args);
+   if (p->p_args != NULL) {
+   db_printf(" arguments: ");
+   for (i = 0; i < (int)p->p_args->ar_length; i++) {
+   if (p->p_args->ar_args[i] == '\0')
+   db_printf(" ");
+   else
+   db_printf("%c", p->p_args->ar_args[i]);
+   }
+   db_printf("\n");
+   }
db_printf(" threads: %d\n", p->p_numthreads);
FOREACH_THREAD_IN_PROC(p, td) {
dumpthread(p, td, 1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339854 - stable/9/sys/dev/usb/serial

2018-10-29 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Oct 29 12:13:05 2018
New Revision: 339854
URL: https://svnweb.freebsd.org/changeset/base/339854

Log:
  MFC r339587:
  Added support for formula-based arbitrary baud rates, in contrast to
  the current fixed values, which enables use of rates above 1 Mbps.
  Improved the detection of HXD chips, and the status flag handling as
  well.
  
  Submitted by: Gabor Simon 
  PR:   225932
  Differential revision:https://reviews.freebsd.org/D16639
  Sponsored by: Mellanox Technologies

Modified:
  stable/9/sys/dev/usb/serial/uplcom.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/dev/usb/serial/uplcom.c
==
--- stable/9/sys/dev/usb/serial/uplcom.cMon Oct 29 12:11:27 2018
(r339853)
+++ stable/9/sys/dev/usb/serial/uplcom.cMon Oct 29 12:13:05 2018
(r339854)
@@ -132,12 +132,20 @@ SYSCTL_INT(_hw_usb_uplcom, OID_AUTO, debug, CTLFLAG_RW
 #defineUPLCOM_SET_CRTSCTS  0x41
 #defineUPLCOM_SET_CRTSCTS_PL2303X  0x61
 #defineRSAQ_STATUS_CTS 0x80
+#defineRSAQ_STATUS_OVERRUN_ERROR   0x40
+#defineRSAQ_STATUS_PARITY_ERROR0x20 
+#defineRSAQ_STATUS_FRAME_ERROR 0x10
+#defineRSAQ_STATUS_RING0x08
+#defineRSAQ_STATUS_BREAK_ERROR 0x04
 #defineRSAQ_STATUS_DSR 0x02
 #defineRSAQ_STATUS_DCD 0x01
 
 #defineTYPE_PL2303 0
 #defineTYPE_PL2303HX   1
+#defineTYPE_PL2303HXD  2
 
+#defineUPLCOM_STATE_INDEX  8
+
 enum {
UPLCOM_BULK_DT_WR,
UPLCOM_BULK_DT_RD,
@@ -366,18 +374,49 @@ uplcom_attach(device_t dev)
 
sc->sc_udev = uaa->device;
 
-   /* Determine the chip type.  This algorithm is taken from Linux. */
dd = usbd_get_device_descriptor(sc->sc_udev);
-   if (dd->bDeviceClass == 0x02)
-   sc->sc_chiptype = TYPE_PL2303;
-   else if (dd->bMaxPacketSize == 0x40)
+
+   switch (UGETW(dd->bcdDevice)) {
+   case 0x0300:
sc->sc_chiptype = TYPE_PL2303HX;
-   else
-   sc->sc_chiptype = TYPE_PL2303;
+   /* or TA, that is HX with external crystal */
+   break;
+   case 0x0400:
+   sc->sc_chiptype = TYPE_PL2303HXD;
+   /* or EA, that is HXD with ESD protection */
+   /* or RA, that has internal voltage level converter that works 
only up to 1Mbaud (!) */
+   break;
+   case 0x0500:
+   sc->sc_chiptype = TYPE_PL2303HXD;
+   /* in fact it's TB, that is HXD with external crystal */
+   break;
+   default:
+   /* NOTE: I have no info about the bcdDevice for the base PL2303 
(up to 1.2Mbaud,
+  only fixed rates) and for PL2303SA (8-pin chip, up to 115200 
baud */
+   /* Determine the chip type.  This algorithm is taken from 
Linux. */
+   if (dd->bDeviceClass == 0x02)
+   sc->sc_chiptype = TYPE_PL2303;
+   else if (dd->bMaxPacketSize == 0x40)
+   sc->sc_chiptype = TYPE_PL2303HX;
+   else
+   sc->sc_chiptype = TYPE_PL2303;
+   break;
+   }
 
-   DPRINTF("chiptype: %s\n",
-   (sc->sc_chiptype == TYPE_PL2303HX) ?
-   "2303X" : "2303");
+   switch (sc->sc_chiptype) {
+   case TYPE_PL2303:
+   DPRINTF("chiptype: 2303\n");
+   break;
+   case TYPE_PL2303HX:
+   DPRINTF("chiptype: 2303HX/TA\n");
+   break;
+   case TYPE_PL2303HXD:
+   DPRINTF("chiptype: 2303HXD/TB/RA/EA\n");
+   break;
+   default:
+   DPRINTF("chiptype: unknown %d\n", sc->sc_chiptype);
+   break;
+   }
 
/*
 * USB-RSAQ1 has two interface
@@ -426,13 +465,14 @@ uplcom_attach(device_t dev)
goto detach;
}
 
-   if (sc->sc_chiptype != TYPE_PL2303HX) {
+   if (sc->sc_chiptype == TYPE_PL2303) {
/* HX variants seem to lock up after a clear stall request. */
mtx_lock(>sc_mtx);
usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_WR]);
usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_RD]);
mtx_unlock(>sc_mtx);
} else {
+   /* reset upstream data pipes */
if (uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE,
UPLCOM_SET_REQUEST, 8, 0, 0) ||
uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE,
@@ -551,7 +591,7 @@ uplcom_pl2303_init(struct usb_device *udev, uint8_t ch
|| uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, 
UPLCOM_SET_REQUEST, 1, 0, 0))
   

svn commit: r339853 - stable/10/sys/dev/usb/serial

2018-10-29 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Oct 29 12:11:27 2018
New Revision: 339853
URL: https://svnweb.freebsd.org/changeset/base/339853

Log:
  MFC r339587:
  Added support for formula-based arbitrary baud rates, in contrast to
  the current fixed values, which enables use of rates above 1 Mbps.
  Improved the detection of HXD chips, and the status flag handling as
  well.
  
  Submitted by: Gabor Simon 
  PR:   225932
  Differential revision:https://reviews.freebsd.org/D16639
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/dev/usb/serial/uplcom.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/serial/uplcom.c
==
--- stable/10/sys/dev/usb/serial/uplcom.c   Mon Oct 29 12:10:06 2018
(r339852)
+++ stable/10/sys/dev/usb/serial/uplcom.c   Mon Oct 29 12:11:27 2018
(r339853)
@@ -132,12 +132,20 @@ SYSCTL_INT(_hw_usb_uplcom, OID_AUTO, debug, CTLFLAG_RW
 #defineUPLCOM_SET_CRTSCTS  0x41
 #defineUPLCOM_SET_CRTSCTS_PL2303X  0x61
 #defineRSAQ_STATUS_CTS 0x80
+#defineRSAQ_STATUS_OVERRUN_ERROR   0x40
+#defineRSAQ_STATUS_PARITY_ERROR0x20 
+#defineRSAQ_STATUS_FRAME_ERROR 0x10
+#defineRSAQ_STATUS_RING0x08
+#defineRSAQ_STATUS_BREAK_ERROR 0x04
 #defineRSAQ_STATUS_DSR 0x02
 #defineRSAQ_STATUS_DCD 0x01
 
 #defineTYPE_PL2303 0
 #defineTYPE_PL2303HX   1
+#defineTYPE_PL2303HXD  2
 
+#defineUPLCOM_STATE_INDEX  8
+
 enum {
UPLCOM_BULK_DT_WR,
UPLCOM_BULK_DT_RD,
@@ -366,18 +374,49 @@ uplcom_attach(device_t dev)
 
sc->sc_udev = uaa->device;
 
-   /* Determine the chip type.  This algorithm is taken from Linux. */
dd = usbd_get_device_descriptor(sc->sc_udev);
-   if (dd->bDeviceClass == 0x02)
-   sc->sc_chiptype = TYPE_PL2303;
-   else if (dd->bMaxPacketSize == 0x40)
+
+   switch (UGETW(dd->bcdDevice)) {
+   case 0x0300:
sc->sc_chiptype = TYPE_PL2303HX;
-   else
-   sc->sc_chiptype = TYPE_PL2303;
+   /* or TA, that is HX with external crystal */
+   break;
+   case 0x0400:
+   sc->sc_chiptype = TYPE_PL2303HXD;
+   /* or EA, that is HXD with ESD protection */
+   /* or RA, that has internal voltage level converter that works 
only up to 1Mbaud (!) */
+   break;
+   case 0x0500:
+   sc->sc_chiptype = TYPE_PL2303HXD;
+   /* in fact it's TB, that is HXD with external crystal */
+   break;
+   default:
+   /* NOTE: I have no info about the bcdDevice for the base PL2303 
(up to 1.2Mbaud,
+  only fixed rates) and for PL2303SA (8-pin chip, up to 115200 
baud */
+   /* Determine the chip type.  This algorithm is taken from 
Linux. */
+   if (dd->bDeviceClass == 0x02)
+   sc->sc_chiptype = TYPE_PL2303;
+   else if (dd->bMaxPacketSize == 0x40)
+   sc->sc_chiptype = TYPE_PL2303HX;
+   else
+   sc->sc_chiptype = TYPE_PL2303;
+   break;
+   }
 
-   DPRINTF("chiptype: %s\n",
-   (sc->sc_chiptype == TYPE_PL2303HX) ?
-   "2303X" : "2303");
+   switch (sc->sc_chiptype) {
+   case TYPE_PL2303:
+   DPRINTF("chiptype: 2303\n");
+   break;
+   case TYPE_PL2303HX:
+   DPRINTF("chiptype: 2303HX/TA\n");
+   break;
+   case TYPE_PL2303HXD:
+   DPRINTF("chiptype: 2303HXD/TB/RA/EA\n");
+   break;
+   default:
+   DPRINTF("chiptype: unknown %d\n", sc->sc_chiptype);
+   break;
+   }
 
/*
 * USB-RSAQ1 has two interface
@@ -426,13 +465,14 @@ uplcom_attach(device_t dev)
goto detach;
}
 
-   if (sc->sc_chiptype != TYPE_PL2303HX) {
+   if (sc->sc_chiptype == TYPE_PL2303) {
/* HX variants seem to lock up after a clear stall request. */
mtx_lock(>sc_mtx);
usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_WR]);
usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_RD]);
mtx_unlock(>sc_mtx);
} else {
+   /* reset upstream data pipes */
if (uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE,
UPLCOM_SET_REQUEST, 8, 0, 0) ||
uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE,
@@ -551,7 +591,7 @@ uplcom_pl2303_init(struct usb_device *udev, uint8_t ch
|| uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, 
UPLCOM_SET_REQUEST, 1, 0, 0))

svn commit: r339852 - stable/11/sys/dev/usb/serial

2018-10-29 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Oct 29 12:10:06 2018
New Revision: 339852
URL: https://svnweb.freebsd.org/changeset/base/339852

Log:
  MFC r339587:
  Added support for formula-based arbitrary baud rates, in contrast to
  the current fixed values, which enables use of rates above 1 Mbps.
  Improved the detection of HXD chips, and the status flag handling as
  well.
  
  Submitted by: Gabor Simon 
  PR:   225932
  Differential revision:https://reviews.freebsd.org/D16639
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/dev/usb/serial/uplcom.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/usb/serial/uplcom.c
==
--- stable/11/sys/dev/usb/serial/uplcom.c   Mon Oct 29 12:08:15 2018
(r339851)
+++ stable/11/sys/dev/usb/serial/uplcom.c   Mon Oct 29 12:10:06 2018
(r339852)
@@ -132,12 +132,20 @@ SYSCTL_INT(_hw_usb_uplcom, OID_AUTO, debug, CTLFLAG_RW
 #defineUPLCOM_SET_CRTSCTS  0x41
 #defineUPLCOM_SET_CRTSCTS_PL2303X  0x61
 #defineRSAQ_STATUS_CTS 0x80
+#defineRSAQ_STATUS_OVERRUN_ERROR   0x40
+#defineRSAQ_STATUS_PARITY_ERROR0x20 
+#defineRSAQ_STATUS_FRAME_ERROR 0x10
+#defineRSAQ_STATUS_RING0x08
+#defineRSAQ_STATUS_BREAK_ERROR 0x04
 #defineRSAQ_STATUS_DSR 0x02
 #defineRSAQ_STATUS_DCD 0x01
 
 #defineTYPE_PL2303 0
 #defineTYPE_PL2303HX   1
+#defineTYPE_PL2303HXD  2
 
+#defineUPLCOM_STATE_INDEX  8
+
 enum {
UPLCOM_BULK_DT_WR,
UPLCOM_BULK_DT_RD,
@@ -367,18 +375,49 @@ uplcom_attach(device_t dev)
 
sc->sc_udev = uaa->device;
 
-   /* Determine the chip type.  This algorithm is taken from Linux. */
dd = usbd_get_device_descriptor(sc->sc_udev);
-   if (dd->bDeviceClass == 0x02)
-   sc->sc_chiptype = TYPE_PL2303;
-   else if (dd->bMaxPacketSize == 0x40)
+
+   switch (UGETW(dd->bcdDevice)) {
+   case 0x0300:
sc->sc_chiptype = TYPE_PL2303HX;
-   else
-   sc->sc_chiptype = TYPE_PL2303;
+   /* or TA, that is HX with external crystal */
+   break;
+   case 0x0400:
+   sc->sc_chiptype = TYPE_PL2303HXD;
+   /* or EA, that is HXD with ESD protection */
+   /* or RA, that has internal voltage level converter that works 
only up to 1Mbaud (!) */
+   break;
+   case 0x0500:
+   sc->sc_chiptype = TYPE_PL2303HXD;
+   /* in fact it's TB, that is HXD with external crystal */
+   break;
+   default:
+   /* NOTE: I have no info about the bcdDevice for the base PL2303 
(up to 1.2Mbaud,
+  only fixed rates) and for PL2303SA (8-pin chip, up to 115200 
baud */
+   /* Determine the chip type.  This algorithm is taken from 
Linux. */
+   if (dd->bDeviceClass == 0x02)
+   sc->sc_chiptype = TYPE_PL2303;
+   else if (dd->bMaxPacketSize == 0x40)
+   sc->sc_chiptype = TYPE_PL2303HX;
+   else
+   sc->sc_chiptype = TYPE_PL2303;
+   break;
+   }
 
-   DPRINTF("chiptype: %s\n",
-   (sc->sc_chiptype == TYPE_PL2303HX) ?
-   "2303X" : "2303");
+   switch (sc->sc_chiptype) {
+   case TYPE_PL2303:
+   DPRINTF("chiptype: 2303\n");
+   break;
+   case TYPE_PL2303HX:
+   DPRINTF("chiptype: 2303HX/TA\n");
+   break;
+   case TYPE_PL2303HXD:
+   DPRINTF("chiptype: 2303HXD/TB/RA/EA\n");
+   break;
+   default:
+   DPRINTF("chiptype: unknown %d\n", sc->sc_chiptype);
+   break;
+   }
 
/*
 * USB-RSAQ1 has two interface
@@ -427,13 +466,14 @@ uplcom_attach(device_t dev)
goto detach;
}
 
-   if (sc->sc_chiptype != TYPE_PL2303HX) {
+   if (sc->sc_chiptype == TYPE_PL2303) {
/* HX variants seem to lock up after a clear stall request. */
mtx_lock(>sc_mtx);
usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_WR]);
usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_RD]);
mtx_unlock(>sc_mtx);
} else {
+   /* reset upstream data pipes */
if (uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE,
UPLCOM_SET_REQUEST, 8, 0, 0) ||
uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE,
@@ -552,7 +592,7 @@ uplcom_pl2303_init(struct usb_device *udev, uint8_t ch
|| uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, 
UPLCOM_SET_REQUEST, 1, 0, 0))

svn commit: r339851 - stable/12/sys/dev/usb/serial

2018-10-29 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Oct 29 12:08:15 2018
New Revision: 339851
URL: https://svnweb.freebsd.org/changeset/base/339851

Log:
  MFC r339587:
  Added support for formula-based arbitrary baud rates, in contrast to
  the current fixed values, which enables use of rates above 1 Mbps.
  Improved the detection of HXD chips, and the status flag handling as
  well.
  
  Submitted by: Gabor Simon 
  PR:   225932
  Approved by:  re (kib)
  Differential revision:https://reviews.freebsd.org/D16639
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/sys/dev/usb/serial/uplcom.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/usb/serial/uplcom.c
==
--- stable/12/sys/dev/usb/serial/uplcom.c   Mon Oct 29 09:06:20 2018
(r339850)
+++ stable/12/sys/dev/usb/serial/uplcom.c   Mon Oct 29 12:08:15 2018
(r339851)
@@ -134,12 +134,20 @@ SYSCTL_INT(_hw_usb_uplcom, OID_AUTO, debug, CTLFLAG_RW
 #defineUPLCOM_SET_CRTSCTS  0x41
 #defineUPLCOM_SET_CRTSCTS_PL2303X  0x61
 #defineRSAQ_STATUS_CTS 0x80
+#defineRSAQ_STATUS_OVERRUN_ERROR   0x40
+#defineRSAQ_STATUS_PARITY_ERROR0x20 
+#defineRSAQ_STATUS_FRAME_ERROR 0x10
+#defineRSAQ_STATUS_RING0x08
+#defineRSAQ_STATUS_BREAK_ERROR 0x04
 #defineRSAQ_STATUS_DSR 0x02
 #defineRSAQ_STATUS_DCD 0x01
 
 #defineTYPE_PL2303 0
 #defineTYPE_PL2303HX   1
+#defineTYPE_PL2303HXD  2
 
+#defineUPLCOM_STATE_INDEX  8
+
 enum {
UPLCOM_BULK_DT_WR,
UPLCOM_BULK_DT_RD,
@@ -369,18 +377,49 @@ uplcom_attach(device_t dev)
 
sc->sc_udev = uaa->device;
 
-   /* Determine the chip type.  This algorithm is taken from Linux. */
dd = usbd_get_device_descriptor(sc->sc_udev);
-   if (dd->bDeviceClass == 0x02)
-   sc->sc_chiptype = TYPE_PL2303;
-   else if (dd->bMaxPacketSize == 0x40)
+
+   switch (UGETW(dd->bcdDevice)) {
+   case 0x0300:
sc->sc_chiptype = TYPE_PL2303HX;
-   else
-   sc->sc_chiptype = TYPE_PL2303;
+   /* or TA, that is HX with external crystal */
+   break;
+   case 0x0400:
+   sc->sc_chiptype = TYPE_PL2303HXD;
+   /* or EA, that is HXD with ESD protection */
+   /* or RA, that has internal voltage level converter that works 
only up to 1Mbaud (!) */
+   break;
+   case 0x0500:
+   sc->sc_chiptype = TYPE_PL2303HXD;
+   /* in fact it's TB, that is HXD with external crystal */
+   break;
+   default:
+   /* NOTE: I have no info about the bcdDevice for the base PL2303 
(up to 1.2Mbaud,
+  only fixed rates) and for PL2303SA (8-pin chip, up to 115200 
baud */
+   /* Determine the chip type.  This algorithm is taken from 
Linux. */
+   if (dd->bDeviceClass == 0x02)
+   sc->sc_chiptype = TYPE_PL2303;
+   else if (dd->bMaxPacketSize == 0x40)
+   sc->sc_chiptype = TYPE_PL2303HX;
+   else
+   sc->sc_chiptype = TYPE_PL2303;
+   break;
+   }
 
-   DPRINTF("chiptype: %s\n",
-   (sc->sc_chiptype == TYPE_PL2303HX) ?
-   "2303X" : "2303");
+   switch (sc->sc_chiptype) {
+   case TYPE_PL2303:
+   DPRINTF("chiptype: 2303\n");
+   break;
+   case TYPE_PL2303HX:
+   DPRINTF("chiptype: 2303HX/TA\n");
+   break;
+   case TYPE_PL2303HXD:
+   DPRINTF("chiptype: 2303HXD/TB/RA/EA\n");
+   break;
+   default:
+   DPRINTF("chiptype: unknown %d\n", sc->sc_chiptype);
+   break;
+   }
 
/*
 * USB-RSAQ1 has two interface
@@ -429,13 +468,14 @@ uplcom_attach(device_t dev)
goto detach;
}
 
-   if (sc->sc_chiptype != TYPE_PL2303HX) {
+   if (sc->sc_chiptype == TYPE_PL2303) {
/* HX variants seem to lock up after a clear stall request. */
mtx_lock(>sc_mtx);
usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_WR]);
usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_RD]);
mtx_unlock(>sc_mtx);
} else {
+   /* reset upstream data pipes */
if (uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE,
UPLCOM_SET_REQUEST, 8, 0, 0) ||
uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE,
@@ -554,7 +594,7 @@ uplcom_pl2303_init(struct usb_device *udev, uint8_t ch
|| uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE,