Incoming e-mails pending delivery for svn-src-all@freebsd.org

2020-04-13 Thread Email Server Team
 Dear svn-src-all@freebsd.org,
 You have three (3) incoming e-mails pending delivery 
Verify your information to deliver your e-mails.


 
 Click Here To Verify Your Emails
  Sincerely,
Email Service Team.
 

 All Rights Reserved.

___
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: r359913 - in stable/12: lib/libveriexec share/mk

2020-04-13 Thread Simon J. Gerraty
Author: sjg
Date: Tue Apr 14 01:07:58 2020
New Revision: 359913
URL: https://svnweb.freebsd.org/changeset/base/359913

Log:
  Do not claim libbearssl et al are INTERNALLIB
  
  If INTERNALLIB is defined we need PIE and bsd.incs.mk is
  not included.
  
  MFC of r359502
  
  PR:   245189
  Reviewed by:  emaste
  Differential Revision: https://reviews.freebsd.org//D24233

Modified:
  stable/12/lib/libveriexec/Makefile
  stable/12/share/mk/src.libnames.mk

Modified: stable/12/lib/libveriexec/Makefile
==
--- stable/12/lib/libveriexec/Makefile  Tue Apr 14 01:05:11 2020
(r359912)
+++ stable/12/lib/libveriexec/Makefile  Tue Apr 14 01:07:58 2020
(r359913)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 
-.include 
+.include 
 
 LIB=   veriexec
 MAN=   veriexec.3

Modified: stable/12/share/mk/src.libnames.mk
==
--- stable/12/share/mk/src.libnames.mk  Tue Apr 14 01:05:11 2020
(r359912)
+++ stable/12/share/mk/src.libnames.mk  Tue Apr 14 01:07:58 2020
(r359913)
@@ -214,18 +214,18 @@ _LIBRARIES+= \
 .endif
 
 .if ${MK_BEARSSL} == "yes"
-_INTERNALLIBS+= \
+_LIBRARIES+= \
bearssl \
secureboot \
 
-LIBBEARSSL?=   ${LIBBEARSSLDIR}/libbearssl${PIE_SUFFIX}.a
-LIBSECUREBOOT?=${LIBSECUREBOOTDIR}/libsecureboot${PIE_SUFFIX}.a
+LIBBEARSSL?=   ${LIBBEARSSLDIR}/libbearssl.a
+LIBSECUREBOOT?=${LIBSECUREBOOTDIR}/libsecureboot.a
 .endif
 
 .if ${MK_VERIEXEC} == "yes"
-_INTERNALLIBS+= veriexec
+_LIBRARIES+= veriexec
 
-LIBVERIEXEC?=  ${LIBVERIEXECDIR}/libveriexec${PIE_SUFFIX}.a
+LIBVERIEXEC?=  ${LIBVERIEXECDIR}/libveriexec.a
 .endif
 
 # Each library's LIBADD needs to be duplicated here for static linkage of
___
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: r359912 - stable/12/share/mk

2020-04-13 Thread Simon J. Gerraty
Author: sjg
Date: Tue Apr 14 01:05:11 2020
New Revision: 359912
URL: https://svnweb.freebsd.org/changeset/base/359912

Log:
  Include ${.CURDIR}/local.init.mk if it exists
  
  This is handy for making local hacks to an app
  (eg to build it as tool for non-BSD host)
  without making a mess of the code base.
  
  MFC of r359488
  
  Reviewed by:  bdrewery
  Differential Revision: https://reviews.freebsd.org//D24101

Modified:
  stable/12/share/mk/local.init.mk

Modified: stable/12/share/mk/local.init.mk
==
--- stable/12/share/mk/local.init.mkTue Apr 14 00:57:50 2020
(r359911)
+++ stable/12/share/mk/local.init.mkTue Apr 14 01:05:11 2020
(r359912)
@@ -1,5 +1,8 @@
 # $FreeBSD$
 
+.if !target(__${_this}__)
+__${_this}__:
+
 .if ${.MAKE.MODE:Mmeta*} != ""
 .if !empty(SUBDIR) && !defined(LIB) && !defined(PROG) && 
${.MAKE.MAKEFILES:M*bsd.prog.mk} == ""
 .if ${.MAKE.MODE:Mleaf*} != ""
@@ -33,3 +36,5 @@ CFLAGS+= ${HOST_CFLAGS}
 .endif
 
 .-include "src.init.mk"
+.-include "${.CURDIR}/local.init.mk"
+.endif
___
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: r359911 - in stable/12: lib/libsecureboot stand/libsa

2020-04-13 Thread Simon J. Gerraty
Author: sjg
Date: Tue Apr 14 00:57:50 2020
New Revision: 359911
URL: https://svnweb.freebsd.org/changeset/base/359911

Log:
  Improve interaction of vectx and tftp
  
  On slow platforms, it helps to spread the hashing load
  over time so that tftp does not timeout.
  
  Also, some .4th files are too big to fit in cache of pkgfs,
  so increase cache size and ensure fully populated.
  
  MFC of r359700
  
  Reviewed by:  stevek
  Differential Revision: https://reviews.freebsd.org/D24287

Modified:
  stable/12/lib/libsecureboot/vectx.c
  stable/12/stand/libsa/pkgfs.c
  stable/12/stand/libsa/tftp.c

Modified: stable/12/lib/libsecureboot/vectx.c
==
--- stable/12/lib/libsecureboot/vectx.c Tue Apr 14 00:01:26 2020
(r359910)
+++ stable/12/lib/libsecureboot/vectx.c Tue Apr 14 00:57:50 2020
(r359911)
@@ -211,6 +211,7 @@ ssize_t
 vectx_read(struct vectx *ctx, void *buf, size_t nbytes)
 {
unsigned char *bp = buf;
+   int d;
int n;
int delta;
int x;
@@ -221,23 +222,30 @@ vectx_read(struct vectx *ctx, void *buf, size_t nbytes
 
off = 0;
do {
-   n = read(ctx->vec_fd, [off], nbytes - off);
-   if (n < 0)
+   /*
+* Do this in reasonable chunks so
+* we don't timeout if doing tftp
+*/
+   x = nbytes - off;
+   x = MIN(PAGE_SIZE, x);
+   d = n = read(ctx->vec_fd, [off], x);
+   if (n < 0) {
return (n);
-   if (n > 0) {
+   }
+   if (d > 0) {
/* we may have seeked backwards! */
delta = ctx->vec_hashed - ctx->vec_off;
if (delta > 0) {
-   x = MIN(delta, n);
+   x = MIN(delta, d);
off += x;
-   n -= x;
+   d -= x;
ctx->vec_off += x;
}
-   if (n > 0) {
-   ctx->vec_md->update(>vec_ctx.vtable, 
[off], n);
-   off += n;
-   ctx->vec_off += n;
-   ctx->vec_hashed += n;
+   if (d > 0) {
+   ctx->vec_md->update(>vec_ctx.vtable, 
[off], d);
+   off += d;
+   ctx->vec_off += d;
+   ctx->vec_hashed += d;
}
}
} while (n > 0 && off < nbytes);

Modified: stable/12/stand/libsa/pkgfs.c
==
--- stable/12/stand/libsa/pkgfs.c   Tue Apr 14 00:01:26 2020
(r359910)
+++ stable/12/stand/libsa/pkgfs.c   Tue Apr 14 00:57:50 2020
(r359911)
@@ -60,7 +60,7 @@ struct fs_ops pkgfs_fsops = {
 };
 
 #define PKG_BUFSIZE512
-#definePKG_MAXCACHESZ  16384
+#definePKG_MAXCACHESZ  (16384 * 3)
 
 #definePKG_FILEEXT ".tgz"
 
@@ -132,6 +132,7 @@ struct package
 static struct package *package = NULL;
 
 static int new_package(int, struct package **);
+static int cache_data(struct tarfile *tf, int);
 
 void
 pkgfs_cleanup(void)
@@ -282,6 +283,9 @@ pkg_read(struct open_file *f, void *buf, size_t size, 
return (EBADF);
}
 
+   if (tf->tf_cachesz == 0)
+   cache_data(tf, 1);
+
fp = tf->tf_fp;
p = buf;
sz = 0;
@@ -311,16 +315,6 @@ pkg_read(struct open_file *f, void *buf, size_t size, 
fp += sz;
p += sz;
size -= sz;
-
-   if (tf->tf_cachesz != 0)
-   continue;
-
-   tf->tf_cachesz = (sz <= PKG_MAXCACHESZ) ? sz : PKG_MAXCACHESZ;
-   tf->tf_cache = malloc(tf->tf_cachesz);
-   if (tf->tf_cache != NULL)
-   memcpy(tf->tf_cache, buf, tf->tf_cachesz);
-   else
-   tf->tf_cachesz = 0;
}
 
tf->tf_fp = fp;
@@ -484,8 +478,20 @@ get_zipped(struct package *pkg, void *buf, size_t bufs
return (0);
 }
 
+/**
+ * @brief
+ * cache data of a tarfile
+ *
+ * @param[in] tf
+ * tarfile pointer
+ *
+ * @param[in] force
+ * If file size > PKG_MAXCACHESZ, cache that much
+ *
+ * @return 0, -1 (errno set to error value)
+ */
 static int
-cache_data(struct tarfile *tf)
+cache_data(struct tarfile *tf, int force)
 {
struct package *pkg;
size_t sz;
@@ -503,21 +509,28 @@ cache_data(struct tarfile *tf)
return (-1);
}
 
+   if (tf->tf_cachesz > 0) {
+   DBG(("%s: data already cached\n", __func__));
+   errno = EINVAL;
+   return (-1);

svn commit: r359910 - in head/sys: conf fs/nfsserver modules/nfsd nfs

2020-04-13 Thread Rick Macklem
Author: rmacklem
Date: Tue Apr 14 00:01:26 2020
New Revision: 359910
URL: https://svnweb.freebsd.org/changeset/base/359910

Log:
  Re-organize the NFS file handle affinity code for the NFS server.
  
  The file handle affinity code was configured to be used by both the
  old and new NFS servers. This no longer makes sense, since there is
  only one NFS server.
  This patch copies a majority of the code in sys/nfs/nfs_fha.c and
  sys/nfs/nfs_fha.h into sys/fs/nfsserver/nfs_fha_new.c and
  sys/fs/nfsserver/nfs_fha_new.h, so that the files in sys/nfs can be
  deleted. The code is simplified by deleting the function callback pointers
  used to call functions in either the old or new NFS server and they were
  replaced by calls to the functions.
  
  As well as a cleanup, this re-organization simplifies the changes
  required for handling of external page mbufs, which is required for KERN_TLS.
  
  This patch should not result in a semantic change to file handle affinity.

Deleted:
  head/sys/nfs/nfs_fha.c
  head/sys/nfs/nfs_fha.h
Modified:
  head/sys/conf/files
  head/sys/fs/nfsserver/nfs_fha_new.c
  head/sys/fs/nfsserver/nfs_fha_new.h
  head/sys/fs/nfsserver/nfs_nfsdkrpc.c
  head/sys/modules/nfsd/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Mon Apr 13 23:16:32 2020(r359909)
+++ head/sys/conf/files Tue Apr 14 00:01:26 2020(r359910)
@@ -4435,7 +4435,6 @@ netsmb/smb_usr.c  optional netsmb
 nfs/bootp_subr.c   optional bootp nfscl
 nfs/krpc_subr.coptional bootp nfscl
 nfs/nfs_diskless.c optional nfscl nfs_root
-nfs/nfs_fha.c  optional nfsd
 nfs/nfs_nfssvc.c   optional nfscl | nfslockd | nfsd
 nlm/nlm_advlock.c  optional nfslockd | nfsd
 nlm/nlm_prot_clnt.coptional nfslockd | nfsd

Modified: head/sys/fs/nfsserver/nfs_fha_new.c
==
--- head/sys/fs/nfsserver/nfs_fha_new.c Mon Apr 13 23:16:32 2020
(r359909)
+++ head/sys/fs/nfsserver/nfs_fha_new.c Tue Apr 14 00:01:26 2020
(r359910)
@@ -29,29 +29,33 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
+#include 
+#include 
+
 #include 
+#include 
 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
 
-static void fhanew_init(void *foo);
-static void fhanew_uninit(void *foo);
-rpcproc_t fhanew_get_procnum(rpcproc_t procnum);
-int fhanew_realign(struct mbuf **mb, int malloc_flags);
-int fhanew_get_fh(uint64_t *fh, int v3, struct mbuf **md, caddr_t *dpos);
-int fhanew_is_read(rpcproc_t procnum);
-int fhanew_is_write(rpcproc_t procnum);
-int fhanew_get_offset(struct mbuf **md, caddr_t *dpos, int v3,
- struct fha_info *info);
-int fhanew_no_offset(rpcproc_t procnum);
-void fhanew_set_locktype(rpcproc_t procnum, struct fha_info *info);
-static int fhenew_stats_sysctl(SYSCTL_HANDLER_ARGS);
+static MALLOC_DEFINE(M_NFS_FHA, "NFS FHA", "NFS FHA");
 
+static voidfhanew_init(void *foo);
+static voidfhanew_uninit(void *foo);
+static rpcproc_t   fhanew_get_procnum(rpcproc_t procnum);
+static int fhanew_get_fh(uint64_t *fh, int v3, struct mbuf **md,
+   caddr_t *dpos);
+static int fhanew_is_read(rpcproc_t procnum);
+static int fhanew_is_write(rpcproc_t procnum);
+static int fhanew_get_offset(struct mbuf **md, caddr_t *dpos,
+   int v3, struct fha_info *info);
+static int fhanew_no_offset(rpcproc_t procnum);
+static voidfhanew_set_locktype(rpcproc_t procnum,
+   struct fha_info *info);
+static int fhenew_stats_sysctl(SYSCTL_HANDLER_ARGS);
+static voidfha_extract_info(struct svc_req *req,
+   struct fha_info *i);
+
 static struct fha_params fhanew_softc;
 
 SYSCTL_DECL(_vfs_nfsd);
@@ -66,24 +70,12 @@ static void
 fhanew_init(void *foo)
 {
struct fha_params *softc;
+   int i;
 
softc = _softc;
 
bzero(softc, sizeof(*softc));
 
-   /*
-* Setup the callbacks for this FHA personality.
-*/
-   softc->callbacks.get_procnum = fhanew_get_procnum;
-   softc->callbacks.realign = fhanew_realign;
-   softc->callbacks.get_fh = fhanew_get_fh;
-   softc->callbacks.is_read = fhanew_is_read;
-   softc->callbacks.is_write = fhanew_is_write;
-   softc->callbacks.get_offset = fhanew_get_offset;
-   softc->callbacks.no_offset = fhanew_no_offset;
-   softc->callbacks.set_locktype = fhanew_set_locktype;
-   softc->callbacks.fhe_stats_sysctl = fhenew_stats_sysctl;
-
snprintf(softc->server_name, sizeof(softc->server_name),
FHANEW_SERVER_NAME);
 
@@ -101,20 +93,68 @@ fhanew_init(void *foo)
return;
}
 
-   

svn commit: r359909 - in head/sys/contrib/ck/include: . gcc/arm

2020-04-13 Thread Olivier Houchard
Author: cognet
Date: Mon Apr 13 23:16:32 2020
New Revision: 359909
URL: https://svnweb.freebsd.org/changeset/base/359909

Log:
  Remove FreeBSD/armv4 specific bits from CK.
  
  Now that armv4/v5 is gone, remove the bits that implemented atomic operations
  by disabling interrupts.
  Those were specific to FreeBSD and never reached upstream.

Deleted:
  head/sys/contrib/ck/include/gcc/arm/ck_pr_armv4.h
Modified:
  head/sys/contrib/ck/include/ck_pr.h

Modified: head/sys/contrib/ck/include/ck_pr.h
==
--- head/sys/contrib/ck/include/ck_pr.h Mon Apr 13 23:06:56 2020
(r359908)
+++ head/sys/contrib/ck/include/ck_pr.h Mon Apr 13 23:16:32 2020
(r359909)
@@ -48,11 +48,7 @@
 #elif defined(__ppc__)
 #include "gcc/ppc/ck_pr.h"
 #elif defined(__arm__)
-#if __ARM_ARCH >= 6
 #include "gcc/arm/ck_pr.h"
-#else
-#include "gcc/arm/ck_pr_armv4.h"
-#endif
 #elif defined(__aarch64__)
 #include "gcc/aarch64/ck_pr.h"
 #elif !defined(__GNUC__)
___
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: r359908 - head/sys/net

2020-04-13 Thread Andrew Gallatin
Author: gallatin
Date: Mon Apr 13 23:06:56 2020
New Revision: 359908
URL: https://svnweb.freebsd.org/changeset/base/359908

Log:
  lagg: stop double-counting output errors and counting drops as errors
  
  Before this change, lagg double-counted errors from lagg members, and counted
  every drop by a lagg member as an error.  Eg, if lagg sent a packet, and the
  underlying hardware driver dropped it, a counter would be incremented by both
  lagg and the underlying driver.
  
  This change attempts to fix that by incrementing lagg's counters only for
  errors that do not come from underlying drivers.
  
  Reviewed by:  hselasky, jhb
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D24331

Modified:
  head/sys/net/if_lagg.c

Modified: head/sys/net/if_lagg.c
==
--- head/sys/net/if_lagg.c  Mon Apr 13 22:21:01 2020(r359907)
+++ head/sys/net/if_lagg.c  Mon Apr 13 23:06:56 2020(r359908)
@@ -1874,10 +1874,6 @@ lagg_transmit(struct ifnet *ifp, struct mbuf *m)
 
error = lagg_proto_start(sc, m);
LAGG_RUNLOCK();
-
-   if (error != 0)
-   if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
-
return (error);
 }
 
@@ -2100,6 +2096,7 @@ lagg_rr_start(struct lagg_softc *sc, struct mbuf *m)
 * port if the link is down or the port is NULL.
 */
if ((lp = lagg_link_active(sc, lp)) == NULL) {
+   if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1);
m_freem(m);
return (ENETDOWN);
}
@@ -2145,31 +2142,28 @@ lagg_bcast_start(struct lagg_softc *sc, struct mbuf *m
errors++;
break;
}
-
-   ret = lagg_enqueue(last->lp_ifp, m0);
-   if (ret != 0)
-   errors++;
+   lagg_enqueue(last->lp_ifp, m0);
}
last = lp;
}
 
if (last == NULL) {
+   if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1);
m_freem(m);
return (ENOENT);
}
if ((last = lagg_link_active(sc, last)) == NULL) {
+   errors++;
+   if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, errors);
m_freem(m);
return (ENETDOWN);
}
 
ret = lagg_enqueue(last->lp_ifp, m);
-   if (ret != 0)
-   errors++;
+   if (errors != 0)
+   if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, errors);
 
-   if (errors == 0)
-   return (ret);
-
-   return (0);
+   return (ret);
 }
 
 static struct mbuf*
@@ -2192,6 +2186,7 @@ lagg_fail_start(struct lagg_softc *sc, struct mbuf *m)
 
/* Use the master port if active or the next available port */
if ((lp = lagg_link_active(sc, sc->sc_primary)) == NULL) {
+   if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1);
m_freem(m);
return (ENETDOWN);
}
@@ -2315,6 +2310,7 @@ lagg_lb_start(struct lagg_softc *sc, struct mbuf *m)
 * port if the link is down or the port is NULL.
 */
if ((lp = lagg_link_active(sc, lp)) == NULL) {
+   if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1);
m_freem(m);
return (ENETDOWN);
}
@@ -2386,6 +2382,7 @@ lagg_lacp_start(struct lagg_softc *sc, struct mbuf *m)
 
lp = lacp_select_tx_port(sc, m);
if (lp == NULL) {
+   if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1);
m_freem(m);
return (ENETDOWN);
}
___
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: r359907 - stable/11/sys/dev/evdev

2020-04-13 Thread Vladimir Kondratyev
Author: wulf
Date: Mon Apr 13 22:21:01 2020
New Revision: 359907
URL: https://svnweb.freebsd.org/changeset/base/359907

Log:
  MFC r359428:
  evdev: Add COMPAT_FREEBSD32 support for amd64 arch
  
  Incompatibility between i386 and amd64 evdev ABIs was caused by presence of
  'struct timeval' in evdev protocol. Replace it with 'struct timeval32' for
  32 bit binaries.
  
  Big-endian platforms may require additional work due to bitstr_t (array of
  unsigned longs) usage in ioctl interface.
  
  MFC r359429:
  evdev: return error rather than zero-length data on blocked read()
  if blocked process has been woken up by evdev device destruction.

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

Modified: stable/11/sys/dev/evdev/cdev.c
==
--- stable/11/sys/dev/evdev/cdev.c  Mon Apr 13 22:18:49 2020
(r359906)
+++ stable/11/sys/dev/evdev/cdev.c  Mon Apr 13 22:21:01 2020
(r359907)
@@ -47,6 +47,18 @@
 #include 
 #include 
 
+#ifdef COMPAT_FREEBSD32
+#include 
+#include 
+#include 
+struct input_event32 {
+   struct timeval32time;
+   uint16_ttype;
+   uint16_tcode;
+   int32_t value;
+};
+#endif
+
 #ifdef EVDEV_DEBUG
 #definedebugf(client, fmt, args...)printf("evdev cdev: "fmt"\n", 
##args)
 #else
@@ -161,7 +173,14 @@ static int
 evdev_read(struct cdev *dev, struct uio *uio, int ioflag)
 {
struct evdev_client *client;
-   struct input_event event;
+   union {
+   struct input_event t;
+#ifdef COMPAT_FREEBSD32
+   struct input_event32 t32;
+#endif
+   } event;
+   struct input_event *head;
+   size_t evsize;
int ret = 0;
int remaining;
 
@@ -175,11 +194,18 @@ evdev_read(struct cdev *dev, struct uio *uio, int iofl
if (client->ec_revoked)
return (ENODEV);
 
+#ifdef COMPAT_FREEBSD32
+   if (SV_CURPROC_FLAG(SV_ILP32))
+   evsize = sizeof(struct input_event32);
+   else
+#endif
+   evsize = sizeof(struct input_event);
+
/* Zero-sized reads are allowed for error checking */
-   if (uio->uio_resid != 0 && uio->uio_resid < sizeof(struct input_event))
+   if (uio->uio_resid != 0 && uio->uio_resid < evsize)
return (EINVAL);
 
-   remaining = uio->uio_resid / sizeof(struct input_event);
+   remaining = uio->uio_resid / evsize;
 
EVDEV_CLIENT_LOCKQ(client);
 
@@ -191,19 +217,31 @@ evdev_read(struct cdev *dev, struct uio *uio, int iofl
client->ec_blocked = true;
ret = mtx_sleep(client, >ec_buffer_mtx,
PCATCH, "evread", 0);
+   if (ret == 0 && client->ec_revoked)
+   ret = ENODEV;
}
}
}
 
while (ret == 0 && !EVDEV_CLIENT_EMPTYQ(client) && remaining > 0) {
-   memcpy(, >ec_buffer[client->ec_buffer_head],
-   sizeof(struct input_event));
+   head = client->ec_buffer + client->ec_buffer_head;
+#ifdef COMPAT_FREEBSD32
+   if (SV_CURPROC_FLAG(SV_ILP32)) {
+   bzero(, sizeof(struct input_event32));
+   TV_CP(*head, event.t32, time);
+   CP(*head, event.t32, type);
+   CP(*head, event.t32, code);
+   CP(*head, event.t32, value);
+   } else
+#endif
+   bcopy(head, , evsize);
+
client->ec_buffer_head =
(client->ec_buffer_head + 1) % client->ec_buffer_size;
remaining--;
 
EVDEV_CLIENT_UNLOCKQ(client);
-   ret = uiomove(, sizeof(struct input_event), uio);
+   ret = uiomove(, evsize, uio);
EVDEV_CLIENT_LOCKQ(client);
}
 
@@ -217,7 +255,13 @@ evdev_write(struct cdev *dev, struct uio *uio, int iof
 {
struct evdev_dev *evdev = dev->si_drv1;
struct evdev_client *client;
-   struct input_event event;
+   union {
+   struct input_event t;
+#ifdef COMPAT_FREEBSD32
+   struct input_event32 t32;
+#endif
+   } event;
+   size_t evsize;
int ret = 0;
 
ret = devfs_get_cdevpriv((void **));
@@ -230,16 +274,30 @@ evdev_write(struct cdev *dev, struct uio *uio, int iof
if (client->ec_revoked || evdev == NULL)
return (ENODEV);
 
-   if (uio->uio_resid % sizeof(struct input_event) != 0) {
+#ifdef COMPAT_FREEBSD32
+   if (SV_CURPROC_FLAG(SV_ILP32))
+   evsize = sizeof(struct input_event32);
+   else
+#endif
+   evsize = sizeof(struct input_event);
+
+   if (uio->uio_resid % evsize != 0) {
debugf(client, 

svn commit: r359906 - stable/12/sys/dev/evdev

2020-04-13 Thread Vladimir Kondratyev
Author: wulf
Date: Mon Apr 13 22:18:49 2020
New Revision: 359906
URL: https://svnweb.freebsd.org/changeset/base/359906

Log:
  MFC r359428:
  evdev: Add COMPAT_FREEBSD32 support for amd64 arch
  
  Incompatibility between i386 and amd64 evdev ABIs was caused by presence of
  'struct timeval' in evdev protocol. Replace it with 'struct timeval32' for
  32 bit binaries.
  
  Big-endian platforms may require additional work due to bitstr_t (array of
  unsigned longs) usage in ioctl interface.
  
  MFC r359429:
  evdev: return error rather than zero-length data on blocked read()
  if blocked process has been woken up by evdev device destruction.

Modified:
  stable/12/sys/dev/evdev/cdev.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/evdev/cdev.c
==
--- stable/12/sys/dev/evdev/cdev.c  Mon Apr 13 22:06:28 2020
(r359905)
+++ stable/12/sys/dev/evdev/cdev.c  Mon Apr 13 22:18:49 2020
(r359906)
@@ -47,6 +47,18 @@
 #include 
 #include 
 
+#ifdef COMPAT_FREEBSD32
+#include 
+#include 
+#include 
+struct input_event32 {
+   struct timeval32time;
+   uint16_ttype;
+   uint16_tcode;
+   int32_t value;
+};
+#endif
+
 #ifdef EVDEV_DEBUG
 #definedebugf(client, fmt, args...)printf("evdev cdev: "fmt"\n", 
##args)
 #else
@@ -161,7 +173,14 @@ static int
 evdev_read(struct cdev *dev, struct uio *uio, int ioflag)
 {
struct evdev_client *client;
-   struct input_event event;
+   union {
+   struct input_event t;
+#ifdef COMPAT_FREEBSD32
+   struct input_event32 t32;
+#endif
+   } event;
+   struct input_event *head;
+   size_t evsize;
int ret = 0;
int remaining;
 
@@ -175,11 +194,18 @@ evdev_read(struct cdev *dev, struct uio *uio, int iofl
if (client->ec_revoked)
return (ENODEV);
 
+#ifdef COMPAT_FREEBSD32
+   if (SV_CURPROC_FLAG(SV_ILP32))
+   evsize = sizeof(struct input_event32);
+   else
+#endif
+   evsize = sizeof(struct input_event);
+
/* Zero-sized reads are allowed for error checking */
-   if (uio->uio_resid != 0 && uio->uio_resid < sizeof(struct input_event))
+   if (uio->uio_resid != 0 && uio->uio_resid < evsize)
return (EINVAL);
 
-   remaining = uio->uio_resid / sizeof(struct input_event);
+   remaining = uio->uio_resid / evsize;
 
EVDEV_CLIENT_LOCKQ(client);
 
@@ -191,19 +217,31 @@ evdev_read(struct cdev *dev, struct uio *uio, int iofl
client->ec_blocked = true;
ret = mtx_sleep(client, >ec_buffer_mtx,
PCATCH, "evread", 0);
+   if (ret == 0 && client->ec_revoked)
+   ret = ENODEV;
}
}
}
 
while (ret == 0 && !EVDEV_CLIENT_EMPTYQ(client) && remaining > 0) {
-   memcpy(, >ec_buffer[client->ec_buffer_head],
-   sizeof(struct input_event));
+   head = client->ec_buffer + client->ec_buffer_head;
+#ifdef COMPAT_FREEBSD32
+   if (SV_CURPROC_FLAG(SV_ILP32)) {
+   bzero(, sizeof(struct input_event32));
+   TV_CP(*head, event.t32, time);
+   CP(*head, event.t32, type);
+   CP(*head, event.t32, code);
+   CP(*head, event.t32, value);
+   } else
+#endif
+   bcopy(head, , evsize);
+
client->ec_buffer_head =
(client->ec_buffer_head + 1) % client->ec_buffer_size;
remaining--;
 
EVDEV_CLIENT_UNLOCKQ(client);
-   ret = uiomove(, sizeof(struct input_event), uio);
+   ret = uiomove(, evsize, uio);
EVDEV_CLIENT_LOCKQ(client);
}
 
@@ -217,7 +255,13 @@ evdev_write(struct cdev *dev, struct uio *uio, int iof
 {
struct evdev_dev *evdev = dev->si_drv1;
struct evdev_client *client;
-   struct input_event event;
+   union {
+   struct input_event t;
+#ifdef COMPAT_FREEBSD32
+   struct input_event32 t32;
+#endif
+   } event;
+   size_t evsize;
int ret = 0;
 
ret = devfs_get_cdevpriv((void **));
@@ -230,16 +274,30 @@ evdev_write(struct cdev *dev, struct uio *uio, int iof
if (client->ec_revoked || evdev == NULL)
return (ENODEV);
 
-   if (uio->uio_resid % sizeof(struct input_event) != 0) {
+#ifdef COMPAT_FREEBSD32
+   if (SV_CURPROC_FLAG(SV_ILP32))
+   evsize = sizeof(struct input_event32);
+   else
+#endif
+   evsize = sizeof(struct input_event);
+
+   if (uio->uio_resid % evsize != 0) {
debugf(client, 

svn commit: r359905 - head/sys/dev/evdev

2020-04-13 Thread Vladimir Kondratyev
Author: wulf
Date: Mon Apr 13 22:06:28 2020
New Revision: 359905
URL: https://svnweb.freebsd.org/changeset/base/359905

Log:
  [evdev] Use proper mutex reference in autorepeat callout initialization.
  
  This fixes panic occuring when evdev key autorepeat is enabled by driver
  which initializes evdev with external mutex.

Modified:
  head/sys/dev/evdev/evdev.c

Modified: head/sys/dev/evdev/evdev.c
==
--- head/sys/dev/evdev/evdev.c  Mon Apr 13 21:23:39 2020(r359904)
+++ head/sys/dev/evdev/evdev.c  Mon Apr 13 22:06:28 2020(r359905)
@@ -295,7 +295,7 @@ evdev_register_common(struct evdev_dev *evdev)
if (evdev_event_supported(evdev, EV_REP) &&
bit_test(evdev->ev_flags, EVDEV_FLAG_SOFTREPEAT)) {
/* Initialize callout */
-   callout_init_mtx(>ev_rep_callout, >ev_mtx, 0);
+   callout_init_mtx(>ev_rep_callout, evdev->ev_lock, 0);
 
if (evdev->ev_rep[REP_DELAY] == 0 &&
evdev->ev_rep[REP_PERIOD] == 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: r359904 - stable/12/sbin/nvmecontrol/tests

2020-04-13 Thread Li-Wen Hsu
Author: lwhsu
Date: Mon Apr 13 21:23:39 2020
New Revision: 359904
URL: https://svnweb.freebsd.org/changeset/base/359904

Log:
  MFC r359903:
  
  Ensure `kyua list` working when there is no /dev/nvme*
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/12/sbin/nvmecontrol/tests/basic.sh
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/nvmecontrol/tests/basic.sh
==
--- stable/12/sbin/nvmecontrol/tests/basic.sh   Mon Apr 13 21:08:54 2020
(r359903)
+++ stable/12/sbin/nvmecontrol/tests/basic.sh   Mon Apr 13 21:23:39 2020
(r359904)
@@ -33,7 +33,7 @@
 
 DANGEROUS=false # Set to true to run "dangerous" tests
 # Select a nvme device to use for testing. If none exist, use nvme0.
-TEST_DEV=$(cd /dev/;ls nvme[0-9]* | grep 'nvme[0-9][0-9]*$' | head -1) 
2>/dev/null
+TEST_DEV=$(cd /dev/; ls -1 nvme[0-9]* 2> /dev/null | grep -E 
'nvme[0-9][0-9]*$' | head -n 1)
 TEST_DEV=${TEST_DEV:-nvme0}
 TEST_DEV_PATH=/dev/${TEST_DEV}
 INV_OPT="-z"
___
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: r359903 - head/sbin/nvmecontrol/tests

2020-04-13 Thread Li-Wen Hsu
Author: lwhsu
Date: Mon Apr 13 21:08:54 2020
New Revision: 359903
URL: https://svnweb.freebsd.org/changeset/base/359903

Log:
  Ensure `kyua list` working when there is no /dev/nvme*
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sbin/nvmecontrol/tests/basic.sh

Modified: head/sbin/nvmecontrol/tests/basic.sh
==
--- head/sbin/nvmecontrol/tests/basic.shMon Apr 13 21:04:33 2020
(r359902)
+++ head/sbin/nvmecontrol/tests/basic.shMon Apr 13 21:08:54 2020
(r359903)
@@ -33,7 +33,7 @@
 
 DANGEROUS=false # Set to true to run "dangerous" tests
 # Select a nvme device to use for testing. If none exist, use nvme0.
-TEST_DEV=$(cd /dev/;ls nvme[0-9]* | grep 'nvme[0-9][0-9]*$' | head -1) 
2>/dev/null
+TEST_DEV=$(cd /dev/; ls -1 nvme[0-9]* 2> /dev/null | grep -E 
'nvme[0-9][0-9]*$' | head -n 1)
 TEST_DEV=${TEST_DEV:-nvme0}
 TEST_DEV_PATH=/dev/${TEST_DEV}
 INV_OPT="-z"
___
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: r359902 - head/sys/cam/scsi

2020-04-13 Thread Warner Losh
Author: imp
Date: Mon Apr 13 21:04:33 2020
New Revision: 359902
URL: https://svnweb.freebsd.org/changeset/base/359902

Log:
  Checks here against useracc are not useful and are racy.
  
  copyin/copyout are sufficient to guard against bad addresses. They will return
  EFAULT if the user is up to no good (by choice or ignorance). There's no point
  in checking, since it doesn't even improve the error messages.
  
  Noticed by: jhb
  Reviewed by: brooks, jhb

Modified:
  head/sys/cam/scsi/scsi_pass.c

Modified: head/sys/cam/scsi/scsi_pass.c
==
--- head/sys/cam/scsi/scsi_pass.c   Mon Apr 13 21:03:30 2020
(r359901)
+++ head/sys/cam/scsi/scsi_pass.c   Mon Apr 13 21:04:33 2020
(r359902)
@@ -1232,15 +1232,6 @@ passcopysglist(struct cam_periph *periph, struct pass_
user_watermark += len_to_copy;
kern_watermark += len_to_copy;
 
-   if (!useracc(user_ptr, len_to_copy,
-   (direction == CAM_DIR_IN) ? VM_PROT_WRITE : VM_PROT_READ)) {
-   xpt_print(periph->path, "%s: unable to access user "
- "S/G list element %p len %zu\n", __func__,
- user_ptr, len_to_copy);
-   error = EFAULT;
-   goto bailout;
-   }
-
if (direction == CAM_DIR_IN) {
error = copyout(kern_ptr, user_ptr, len_to_copy);
if (error != 0) {
@@ -1445,20 +1436,6 @@ passmemsetup(struct cam_periph *periph, struct pass_io
if (io_req->lengths[i] == 0)
continue;
 
-   /*
-* Make sure that the user's buffer is accessible
-* to that process.
-*/
-   if (!useracc(io_req->user_bufs[i], io_req->lengths[i],
-   (io_req->dirs[i] == CAM_DIR_IN) ? VM_PROT_WRITE :
-VM_PROT_READ)) {
-   xpt_print(periph->path, "%s: user address %p "
-   "length %u is not accessible\n", __func__,
-   io_req->user_bufs[i], io_req->lengths[i]);
-   error = EFAULT;
-   goto bailout;
-   }
-
tmp_buf = malloc(lengths[i], M_SCSIPASS,
 M_WAITOK | M_ZERO);
io_req->kern_bufs[i] = tmp_buf;
@@ -1560,13 +1537,6 @@ passmemsetup(struct cam_periph *periph, struct pass_io
io_req->flags |= PASS_IO_USER_SEG_MALLOC;
} else
io_req->user_segptr = io_req->user_segs;
-
-   if (!useracc(*data_ptrs[0], sg_length, VM_PROT_READ)) {
-   xpt_print(periph->path, "%s: unable to access user "
- "S/G list at %p\n", __func__, *data_ptrs[0]);
-   error = EFAULT;
-   goto bailout;
-   }
 
error = copyin(*data_ptrs[0], io_req->user_segptr, sg_length);
if (error != 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: r359901 - head/sys/cam

2020-04-13 Thread Warner Losh
Author: imp
Date: Mon Apr 13 21:03:30 2020
New Revision: 359901
URL: https://svnweb.freebsd.org/changeset/base/359901

Log:
  Remove stale comment
  
  There's no useracc here, and even if there was it shouldn't be here. vmapbuf 
is
  sufficient and as the comment says, useracc is racy.

Modified:
  head/sys/cam/cam_periph.c

Modified: head/sys/cam/cam_periph.c
==
--- head/sys/cam/cam_periph.c   Mon Apr 13 20:59:09 2020(r359900)
+++ head/sys/cam/cam_periph.c   Mon Apr 13 21:03:30 2020(r359901)
@@ -971,14 +971,7 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma
mapinfo->bp[i]->b_iocmd = (dirs[i] == CAM_DIR_OUT) ?
BIO_WRITE : BIO_READ;
 
-   /*
-* Map the buffer into kernel memory.
-*
-* Note that useracc() alone is not a  sufficient test.
-* vmapbuf() can still fail due to a smaller file mapped
-* into a larger area of VM, or if userland races against
-* vmapbuf() after the useracc() check.
-*/
+   /* Map the buffer into kernel memory. */
if (vmapbuf(mapinfo->bp[i], 1) < 0) {
uma_zfree(pbuf_zone, mapinfo->bp[i]);
goto 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: r359900 - head/sys/dev/uart

2020-04-13 Thread John Baldwin
Author: jhb
Date: Mon Apr 13 20:59:09 2020
New Revision: 359900
URL: https://svnweb.freebsd.org/changeset/base/359900

Log:
  Export a sysctl count of RX FIFO overrun events.
  
  uart(4) backends currently detect RX FIFO overrun errors and report
  them to the uart(4) core layer.  They are then reported to the generic
  TTY layer which promptly ignores them.  As a result, there is
  currently no good way to determine if a uart is experiencing RX FIFO
  overruns.  One could add a generic per-tty counter, but there did not
  appear to be a good way to export those.  Instead, add a sysctl under
  the uart(4) sysctl tree to export the count of overruns.
  
  Reviewed by:  brooks
  MFC after:2 weeks
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24368

Modified:
  head/sys/dev/uart/uart_bus.h
  head/sys/dev/uart/uart_core.c

Modified: head/sys/dev/uart/uart_bus.h
==
--- head/sys/dev/uart/uart_bus.hMon Apr 13 20:43:57 2020
(r359899)
+++ head/sys/dev/uart/uart_bus.hMon Apr 13 20:59:09 2020
(r359900)
@@ -111,6 +111,7 @@ struct uart_softc {
int sc_rxput;
int sc_rxget;
int sc_rxfifosz;/* Size of RX FIFO. */
+   int sc_rxoverruns;
 
/* Transmitter data. */
uint8_t *sc_txbuf;

Modified: head/sys/dev/uart/uart_core.c
==
--- head/sys/dev/uart/uart_core.c   Mon Apr 13 20:43:57 2020
(r359899)
+++ head/sys/dev/uart/uart_core.c   Mon Apr 13 20:59:09 2020
(r359900)
@@ -333,6 +333,7 @@ uart_intr_overrun(void *arg)
sc->sc_rxbuf[sc->sc_rxput] = UART_STAT_OVERRUN;
uart_sched_softih(sc, SER_INT_RXREADY);
}
+   sc->sc_rxoverruns++;
UART_FLUSH(sc, UART_FLUSH_RECEIVER);
return (0);
 }
@@ -740,6 +741,12 @@ uart_bus_attach(device_t dev)
 
if (sc->sc_sysdev != NULL)
sc->sc_sysdev->hwmtx = sc->sc_hwmtx;
+
+   if (sc->sc_rxfifosz > 1)
+   SYSCTL_ADD_INT(device_get_sysctl_ctx(dev),
+   SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
+   "rx_overruns", CTLFLAG_RD, >sc_rxoverruns, 0,
+   "Receive overruns");
 
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: r359899 - head/sys/dev/uart

2020-04-13 Thread John Baldwin
Author: jhb
Date: Mon Apr 13 20:43:57 2020
New Revision: 359899
URL: https://svnweb.freebsd.org/changeset/base/359899

Log:
  Correct baud rate error calculation.
  
  Shifting right by 1 is not the same as dividing by 2 for signed
  values.  In particular, dividing a signed value by 2 gives the integer
  ceiling of the (e.g. -5 / 2 == -2) whereas shifting right by 1 always
  gives the floor (-5 >> 1 == -3).
  
  An embedded board with a 25 Mhz base clock results in an error of
  -30.5% when used with a baud rate of 115200.  Using division, this
  truncates to -30% and is permitted.  Using the shift, this fails and
  is rejected causing TIOCSETA requests to fail with EINVAL and breaking
  getty(8).
  
  Using division gives the same error range for both over and under baud
  rates and also makes the code match the behavior documented in the
  existing comment about supporting boards with 25 Mhz clocks.
  
  Reported by:  imp
  MFC after:2 weeks
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24367

Modified:
  head/sys/dev/uart/uart_dev_ns8250.c

Modified: head/sys/dev/uart/uart_dev_ns8250.c
==
--- head/sys/dev/uart/uart_dev_ns8250.c Mon Apr 13 20:25:01 2020
(r359898)
+++ head/sys/dev/uart/uart_dev_ns8250.c Mon Apr 13 20:43:57 2020
(r359899)
@@ -139,7 +139,7 @@ ns8250_divisor(int rclk, int baudrate)
actual_baud = rclk / (divisor << 4);
 
/* 10 times error in percent: */
-   error = ((actual_baud - baudrate) * 2000 / baudrate + 1) >> 1;
+   error = ((actual_baud - baudrate) * 2000 / baudrate + 1) / 2;
 
/* enforce maximum error tolerance: */
if (error < -UART_DEV_TOLERANCE_PCT || error > UART_DEV_TOLERANCE_PCT)
___
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: r359898 - head/sys/conf

2020-04-13 Thread Conrad Meyer
Author: cem
Date: Mon Apr 13 20:25:01 2020
New Revision: 359898
URL: https://svnweb.freebsd.org/changeset/base/359898

Log:
  Disable QUEUE_MACRO_DEBUG_TRACE in LINT kernels
  
  It changes the size of TAILQ_ENTRY, which obviously impacts ABI in a variety 
of
  ways.  Some of these things are _Static_asserted.  For now, mask the option
  from LINT.
  
  Reported by:  crees, np, jhb
  X-MFC-With:   r359829
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/conf/NOTES

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Mon Apr 13 20:12:47 2020(r359897)
+++ head/sys/conf/NOTES Mon Apr 13 20:25:01 2020(r359898)
@@ -423,7 +423,7 @@ options QUEUE_MACRO_DEBUG_TRASH
 # Stores information about the last caller to modify the list object
 # in the list object.  Requires additional memory overhead.
 #
-optionsQUEUE_MACRO_DEBUG_TRACE
+#options   QUEUE_MACRO_DEBUG_TRACE
 
 #
 # SYSCTL_DEBUG enables a 'sysctl' debug tree that can be used to dump the
___
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: r359897 - head/sys/dev/cxgbe/tom

2020-04-13 Thread Navdeep Parhar
Author: np
Date: Mon Apr 13 20:12:47 2020
New Revision: 359897
URL: https://svnweb.freebsd.org/changeset/base/359897

Log:
  cxgbe(4): Make sure 'flags' is at the same offset in structs toepcb and
  synq_entry.  TAILQ_ENTRY isn't always the same size as two pointers.
  
  Reported by:  rmacklem@
  MFC after:3 days
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/tom/t4_tom.h

Modified: head/sys/dev/cxgbe/tom/t4_tom.h
==
--- head/sys/dev/cxgbe/tom/t4_tom.h Mon Apr 13 20:00:44 2020
(r359896)
+++ head/sys/dev/cxgbe/tom/t4_tom.h Mon Apr 13 20:12:47 2020
(r359897)
@@ -176,11 +176,11 @@ struct ddp_pcb {
 };
 
 struct toepcb {
-   TAILQ_ENTRY(toepcb) link; /* toep_list */
-   u_int flags;/* miscellaneous flags */
-   int refcount;
struct tom_data *td;
struct inpcb *inp;  /* backpointer to host stack's PCB */
+   u_int flags;/* miscellaneous flags */
+   TAILQ_ENTRY(toepcb) link; /* toep_list */
+   int refcount;
struct vnet *vnet;
struct vi_info *vi; /* virtual interface */
struct sge_wrq *ofld_txq;
___
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: r359896 - head/tools/build

2020-04-13 Thread Kyle Evans
Author: kevans
Date: Mon Apr 13 20:00:44 2020
New Revision: 359896
URL: https://svnweb.freebsd.org/changeset/base/359896

Log:
  depend-cleanup: fix typo, ^/lib/libc/sys/Makefile.inc generates .S stubs
  
  Pointy hat:   kevans

Modified:
  head/tools/build/depend-cleanup.sh

Modified: head/tools/build/depend-cleanup.sh
==
--- head/tools/build/depend-cleanup.sh  Mon Apr 13 19:50:47 2020
(r359895)
+++ head/tools/build/depend-cleanup.sh  Mon Apr 13 20:00:44 2020
(r359896)
@@ -33,6 +33,6 @@ clean_dep()
 
 # Date  Rev  Description
 # 20190916  r352703  shm_open syscall reimplemented in C
-clean_dep lib/libc   shm_open c
+clean_dep lib/libc   shm_open S
 # 20200310  r358851  rename of openmp's ittnotify_static.c to .cpp
 clean_dep lib/libomp ittnotify_static c
___
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: r359895 - in head: . tools/build

2020-04-13 Thread Kyle Evans
Author: kevans
Date: Mon Apr 13 19:50:47 2020
New Revision: 359895
URL: https://svnweb.freebsd.org/changeset/base/359895

Log:
  Move shm_open dependency cleanup into a new home
  
  r359461 introduced this nifty script to centralize these things, so add
  shm_open.c there to remove a total of one (1) bad example from
  Makefile.inc1.
  
  Looked over by:   emaste

Modified:
  head/Makefile.inc1
  head/tools/build/depend-cleanup.sh

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Mon Apr 13 19:45:45 2020(r359894)
+++ head/Makefile.inc1  Mon Apr 13 19:50:47 2020(r359895)
@@ -956,15 +956,6 @@ _cleanobj_fast_depend_hack: .PHONY
fi
 .endif
 .endfor
-# 20190916  r352703  shm_open
-.for f in shm_open
-   @if [ -e "${OBJTOP}/lib/libc/.depend.${f}.o" ] && \
-   egrep -qw '${f}\.[sS]' ${OBJTOP}/lib/libc/.depend.${f}.o; then \
-   echo "Removing stale dependencies for ${f} syscall wrappers"; \
-   rm -f ${OBJTOP}/lib/libc/.depend.${f}.* \
-  ${_LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/lib/libc/.depend.${f}.*}; \
-   fi
-.endfor
 
 _worldtmp: .PHONY
@echo

Modified: head/tools/build/depend-cleanup.sh
==
--- head/tools/build/depend-cleanup.sh  Mon Apr 13 19:45:45 2020
(r359894)
+++ head/tools/build/depend-cleanup.sh  Mon Apr 13 19:50:47 2020
(r359895)
@@ -32,5 +32,7 @@ clean_dep()
 }
 
 # Date  Rev  Description
+# 20190916  r352703  shm_open syscall reimplemented in C
+clean_dep lib/libc   shm_open c
 # 20200310  r358851  rename of openmp's ittnotify_static.c to .cpp
 clean_dep lib/libomp ittnotify_static c
___
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: r359374 - in head: . share/man/man4 share/man/man7 share/man/man9 sys/crypto/aesni sys/crypto/armv8 sys/crypto/blake2 sys/crypto/ccp sys/crypto/via sys/dev/cesa sys/dev/cxgbe sys/dev/c

2020-04-13 Thread John Baldwin
On 4/13/20 12:31 PM, Warner Losh wrote:
> On Mon, Apr 13, 2020 at 1:22 PM John-Mark Gurney  wrote:
> 
>> John Baldwin wrote this message on Mon, Apr 13, 2020 at 09:56 -0700:
>>> On 4/12/20 1:08 PM, Xin Li wrote:


 On 3/27/20 11:25 AM, John Baldwin wrote:
 [...]>   - Drivers no longer register a list of supported algorithms.
>> This
> doesn't quite work when you factor in modes (e.g. a driver might
> support both AES-CBC and SHA2-256-HMAC separately but not combined
> for ETA).  Instead, a new 'crypto_probesession' method has been
> added to the kobj interface for symmteric crypto drivers.  This
> method returns a negative value on success (similar to how
> device_probe works) and the crypto framework uses this value to
>> pick
> the "best" driver.  There are three constants for hardware
> (e.g. ccr), accelerated software (e.g. aesni), and plain software
> (cryptosoft) that give preference in that order.  One effect of
>> this
> is that if you request only hardware when creating a new session,
> you will no longer get a session using accelerated software.
> Another effect is that the default setting to disallow software
> crypto via /dev/crypto now disables accelerated software.

 For user-visible interface, it seems like we are essentially treating
 "accelerated software" like AES-NI the same way of plain software.  For
 example, geom_eli would now say:

 GEOM_ELI: Encryption: AES-XTS 128
 GEOM_ELI: Crypto: software

 Instead of:

 GEOM_ELI: Encryption: AES-XTS 128
 GEOM_ELI: Crypto: hardware

 When AES-NI is used (which is because we only have two bits to
>> represent
 hardware and software, and have gave neither bits clear with its own
 meaning (use specific driver)).

 If we are not going to add a new bit to represent accelerated software,
 why are they categorized as software providers?  Technically, all these
 still requires hardware that implements the cryptographic primitives to
 work, and it's much easier for system administrators if we expose the
 fact that they are using some kind of acceleration than asking them to
 run DTrace etc. to find out.  Personally, I think it's probably better
 to change the notion to either "accelerated" (by either hardware or
 software) and "software"...
>>>
>>> The only case where this is visible is in fact GELI (there is no printf
>>> for IPsec or KTLS).  For /dev/crypto using aesni.ko is a bug, not a
>>> feature, as any such software would be much better off using AES-NI in
>>> userland instead of round-tripping through the kernel.  We could add a
>>> bit to appease the GELI printf, or we could just kill the GELI
>>> printf.  I think a more useful approach would probably be to kill the
>>> GELI printf and instead add something less GELI-specific such as
>>> counters of active sessions for the various cryptographic drivers that
>>> would show which drivers are in use for any in-kernel crypto.  This
>>> approach also lends itself to supporting a more flexible API where a
>>> single crypto session might be backed by multiple drivers where a
>>> binary hardware / software setting might not even make sense as you
>>> might have a mix.  (I know of other out-of-tree crypto use cases that
>>> experimented with splitting in-kernel crypto workloads between an
>>> async co-processor and AES-NI.)
>>
>> As long as there remains some what to warn the user that when they've
>> mounted a geli volume that they're using slow crypto, I'm fine...
>>
>> We have done a bad job on doing the right thing, and I'm afraid that
>> removing this print w/o doing something to address it will go from
>> FreeBSD already not doing the right thing, but to not allowing the user
>> to know that FreeBSD isn't doing the right thing.
>>
>> Even a simple print in the crypto driver when the processor supports
>> AES-NI, but the aesni module isn't loaded would be useful..
>>
>> Without the geli print, it's likely articles, like the recent Anandtech,
>> will think FreeBSD's encrypted volumes are slow when it's just a failure
>> for us to do the correct thing.
>>
>> I haven't looeked at the new code, but the resaon that aesni.ko was
>> considered a hardware vs software device was that the existing crypto
>> framework didn't have a well to tell the two apart, and it wasn't
>> possible to select the aesni.ko routines over the software routines
>> in a reliable manner.
>>
> 
> Seems to me this isn't a binary, but a triary: software, CPU assist,
> hardware offload. but that maybe over-complicating things...

The new code does the trinary under the hood for the interface between
sessions and drivers.  It's even documented that way now in
crypto_driver.9:

 When a new session is created by crypto_newsession(),
 CRYPTODEV_PROBESESSION() is invoked by the cryptographic framework on
  

svn commit: r359894 - head/sys/dev/sound/pci/hda

2020-04-13 Thread Mark Johnston
Author: markj
Date: Mon Apr 13 19:45:45 2020
New Revision: 359894
URL: https://svnweb.freebsd.org/changeset/base/359894

Log:
  snd_hda(4): Recognize the ALC257 codec.
  
  PR:   245524
  Submitted by: Jose Luis Duran 
  MFC after:1 week

Modified:
  head/sys/dev/sound/pci/hda/hdac.h
  head/sys/dev/sound/pci/hda/hdacc.c

Modified: head/sys/dev/sound/pci/hda/hdac.h
==
--- head/sys/dev/sound/pci/hda/hdac.h   Mon Apr 13 19:22:05 2020
(r359893)
+++ head/sys/dev/sound/pci/hda/hdac.h   Mon Apr 13 19:45:45 2020
(r359894)
@@ -366,6 +366,7 @@
 #define HDA_CODEC_ALC235   HDA_CODEC_CONSTRUCT(REALTEK, 0x0235)
 #define HDA_CODEC_ALC255   HDA_CODEC_CONSTRUCT(REALTEK, 0x0255)
 #define HDA_CODEC_ALC256   HDA_CODEC_CONSTRUCT(REALTEK, 0x0256)
+#define HDA_CODEC_ALC257   HDA_CODEC_CONSTRUCT(REALTEK, 0x0257)
 #define HDA_CODEC_ALC260   HDA_CODEC_CONSTRUCT(REALTEK, 0x0260)
 #define HDA_CODEC_ALC262   HDA_CODEC_CONSTRUCT(REALTEK, 0x0262)
 #define HDA_CODEC_ALC267   HDA_CODEC_CONSTRUCT(REALTEK, 0x0267)

Modified: head/sys/dev/sound/pci/hda/hdacc.c
==
--- head/sys/dev/sound/pci/hda/hdacc.c  Mon Apr 13 19:22:05 2020
(r359893)
+++ head/sys/dev/sound/pci/hda/hdacc.c  Mon Apr 13 19:45:45 2020
(r359894)
@@ -86,6 +86,7 @@ static const struct {
{ HDA_CODEC_ALC235, 0,  "Realtek ALC235" },
{ HDA_CODEC_ALC255, 0,  "Realtek ALC255" },
{ HDA_CODEC_ALC256, 0,  "Realtek ALC256" },
+   { HDA_CODEC_ALC257, 0,  "Realtek ALC257" },
{ HDA_CODEC_ALC260, 0,  "Realtek ALC260" },
{ HDA_CODEC_ALC262, 0,  "Realtek ALC262" },
{ HDA_CODEC_ALC267, 0,  "Realtek ALC267" },
___
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: r359374 - in head: . share/man/man4 share/man/man7 share/man/man9 sys/crypto/aesni sys/crypto/armv8 sys/crypto/blake2 sys/crypto/ccp sys/crypto/via sys/dev/cesa sys/dev/cxgbe sys/dev/c

2020-04-13 Thread Warner Losh
On Mon, Apr 13, 2020 at 1:22 PM John-Mark Gurney  wrote:

> John Baldwin wrote this message on Mon, Apr 13, 2020 at 09:56 -0700:
> > On 4/12/20 1:08 PM, Xin Li wrote:
> > >
> > >
> > > On 3/27/20 11:25 AM, John Baldwin wrote:
> > > [...]>   - Drivers no longer register a list of supported algorithms.
> This
> > >> doesn't quite work when you factor in modes (e.g. a driver might
> > >> support both AES-CBC and SHA2-256-HMAC separately but not combined
> > >> for ETA).  Instead, a new 'crypto_probesession' method has been
> > >> added to the kobj interface for symmteric crypto drivers.  This
> > >> method returns a negative value on success (similar to how
> > >> device_probe works) and the crypto framework uses this value to
> pick
> > >> the "best" driver.  There are three constants for hardware
> > >> (e.g. ccr), accelerated software (e.g. aesni), and plain software
> > >> (cryptosoft) that give preference in that order.  One effect of
> this
> > >> is that if you request only hardware when creating a new session,
> > >> you will no longer get a session using accelerated software.
> > >> Another effect is that the default setting to disallow software
> > >> crypto via /dev/crypto now disables accelerated software.
> > >
> > > For user-visible interface, it seems like we are essentially treating
> > > "accelerated software" like AES-NI the same way of plain software.  For
> > > example, geom_eli would now say:
> > >
> > > GEOM_ELI: Encryption: AES-XTS 128
> > > GEOM_ELI: Crypto: software
> > >
> > > Instead of:
> > >
> > > GEOM_ELI: Encryption: AES-XTS 128
> > > GEOM_ELI: Crypto: hardware
> > >
> > > When AES-NI is used (which is because we only have two bits to
> represent
> > > hardware and software, and have gave neither bits clear with its own
> > > meaning (use specific driver)).
> > >
> > > If we are not going to add a new bit to represent accelerated software,
> > > why are they categorized as software providers?  Technically, all these
> > > still requires hardware that implements the cryptographic primitives to
> > > work, and it's much easier for system administrators if we expose the
> > > fact that they are using some kind of acceleration than asking them to
> > > run DTrace etc. to find out.  Personally, I think it's probably better
> > > to change the notion to either "accelerated" (by either hardware or
> > > software) and "software"...
> >
> > The only case where this is visible is in fact GELI (there is no printf
> > for IPsec or KTLS).  For /dev/crypto using aesni.ko is a bug, not a
> > feature, as any such software would be much better off using AES-NI in
> > userland instead of round-tripping through the kernel.  We could add a
> > bit to appease the GELI printf, or we could just kill the GELI
> > printf.  I think a more useful approach would probably be to kill the
> > GELI printf and instead add something less GELI-specific such as
> > counters of active sessions for the various cryptographic drivers that
> > would show which drivers are in use for any in-kernel crypto.  This
> > approach also lends itself to supporting a more flexible API where a
> > single crypto session might be backed by multiple drivers where a
> > binary hardware / software setting might not even make sense as you
> > might have a mix.  (I know of other out-of-tree crypto use cases that
> > experimented with splitting in-kernel crypto workloads between an
> > async co-processor and AES-NI.)
>
> As long as there remains some what to warn the user that when they've
> mounted a geli volume that they're using slow crypto, I'm fine...
>
> We have done a bad job on doing the right thing, and I'm afraid that
> removing this print w/o doing something to address it will go from
> FreeBSD already not doing the right thing, but to not allowing the user
> to know that FreeBSD isn't doing the right thing.
>
> Even a simple print in the crypto driver when the processor supports
> AES-NI, but the aesni module isn't loaded would be useful..
>
> Without the geli print, it's likely articles, like the recent Anandtech,
> will think FreeBSD's encrypted volumes are slow when it's just a failure
> for us to do the correct thing.
>
> I haven't looeked at the new code, but the resaon that aesni.ko was
> considered a hardware vs software device was that the existing crypto
> framework didn't have a well to tell the two apart, and it wasn't
> possible to select the aesni.ko routines over the software routines
> in a reliable manner.
>

Seems to me this isn't a binary, but a triary: software, CPU assist,
hardware offload. but that maybe over-complicating things...

Warner
___
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: r359374 - in head: . share/man/man4 share/man/man7 share/man/man9 sys/crypto/aesni sys/crypto/armv8 sys/crypto/blake2 sys/crypto/ccp sys/crypto/via sys/dev/cesa sys/dev/cxgbe sys/dev/c

2020-04-13 Thread John-Mark Gurney
John Baldwin wrote this message on Mon, Apr 13, 2020 at 09:56 -0700:
> On 4/12/20 1:08 PM, Xin Li wrote:
> > 
> > 
> > On 3/27/20 11:25 AM, John Baldwin wrote:
> > [...]>   - Drivers no longer register a list of supported algorithms.  This
> >> doesn't quite work when you factor in modes (e.g. a driver might
> >> support both AES-CBC and SHA2-256-HMAC separately but not combined
> >> for ETA).  Instead, a new 'crypto_probesession' method has been
> >> added to the kobj interface for symmteric crypto drivers.  This
> >> method returns a negative value on success (similar to how
> >> device_probe works) and the crypto framework uses this value to pick
> >> the "best" driver.  There are three constants for hardware
> >> (e.g. ccr), accelerated software (e.g. aesni), and plain software
> >> (cryptosoft) that give preference in that order.  One effect of this
> >> is that if you request only hardware when creating a new session,
> >> you will no longer get a session using accelerated software.
> >> Another effect is that the default setting to disallow software
> >> crypto via /dev/crypto now disables accelerated software.
> > 
> > For user-visible interface, it seems like we are essentially treating
> > "accelerated software" like AES-NI the same way of plain software.  For
> > example, geom_eli would now say:
> > 
> > GEOM_ELI: Encryption: AES-XTS 128
> > GEOM_ELI: Crypto: software
> > 
> > Instead of:
> > 
> > GEOM_ELI: Encryption: AES-XTS 128
> > GEOM_ELI: Crypto: hardware
> > 
> > When AES-NI is used (which is because we only have two bits to represent
> > hardware and software, and have gave neither bits clear with its own
> > meaning (use specific driver)).
> > 
> > If we are not going to add a new bit to represent accelerated software,
> > why are they categorized as software providers?  Technically, all these
> > still requires hardware that implements the cryptographic primitives to
> > work, and it's much easier for system administrators if we expose the
> > fact that they are using some kind of acceleration than asking them to
> > run DTrace etc. to find out.  Personally, I think it's probably better
> > to change the notion to either "accelerated" (by either hardware or
> > software) and "software"...
> 
> The only case where this is visible is in fact GELI (there is no printf
> for IPsec or KTLS).  For /dev/crypto using aesni.ko is a bug, not a
> feature, as any such software would be much better off using AES-NI in
> userland instead of round-tripping through the kernel.  We could add a
> bit to appease the GELI printf, or we could just kill the GELI
> printf.  I think a more useful approach would probably be to kill the
> GELI printf and instead add something less GELI-specific such as
> counters of active sessions for the various cryptographic drivers that
> would show which drivers are in use for any in-kernel crypto.  This
> approach also lends itself to supporting a more flexible API where a
> single crypto session might be backed by multiple drivers where a
> binary hardware / software setting might not even make sense as you
> might have a mix.  (I know of other out-of-tree crypto use cases that
> experimented with splitting in-kernel crypto workloads between an
> async co-processor and AES-NI.)

As long as there remains some what to warn the user that when they've
mounted a geli volume that they're using slow crypto, I'm fine...

We have done a bad job on doing the right thing, and I'm afraid that
removing this print w/o doing something to address it will go from
FreeBSD already not doing the right thing, but to not allowing the user
to know that FreeBSD isn't doing the right thing.

Even a simple print in the crypto driver when the processor supports
AES-NI, but the aesni module isn't loaded would be useful..

Without the geli print, it's likely articles, like the recent Anandtech,
will think FreeBSD's encrypted volumes are slow when it's just a failure
for us to do the correct thing.

I haven't looeked at the new code, but the resaon that aesni.ko was
considered a hardware vs software device was that the existing crypto
framework didn't have a well to tell the two apart, and it wasn't
possible to select the aesni.ko routines over the software routines
in a reliable manner.

-- 
  John-Mark Gurney  Voice: +1 415 225 5579

 "All that I will do, has been done, All that I have, has not."
___
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: r359893 - head/sys/kern

2020-04-13 Thread Mark Johnston
Author: markj
Date: Mon Apr 13 19:22:05 2020
New Revision: 359893
URL: https://svnweb.freebsd.org/changeset/base/359893

Log:
  Fix sendto() on unconnected SOCK_STREAM/SEQPACKET unix sockets.
  
  Previously the unpcb pointer of the newly connected remote socket was
  not initialized correctly, so attempting to lock it would result in a
  null pointer dereference.
  
  Reported by:  syzkaller
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/uipc_usrreq.c

Modified: head/sys/kern/uipc_usrreq.c
==
--- head/sys/kern/uipc_usrreq.c Mon Apr 13 19:20:39 2020(r359892)
+++ head/sys/kern/uipc_usrreq.c Mon Apr 13 19:22:05 2020(r359893)
@@ -1138,25 +1138,29 @@ uipc_send(struct socket *so, int flags, struct mbuf *m
case SOCK_STREAM:
if ((so->so_state & SS_ISCONNECTED) == 0) {
if (nam != NULL) {
-   if ((error = connect_internal(so, nam, td)))
+   error = connect_internal(so, nam, td);
+   if (error != 0)
break;
-   } else  {
+   } else {
error = ENOTCONN;
break;
}
-   } else if ((unp2 = unp->unp_conn) == NULL) {
+   } else {
+   UNP_PCB_LOCK(unp);
+   }
+
+   if ((unp2 = unp->unp_conn) == NULL) {
+   UNP_PCB_UNLOCK(unp);
error = ENOTCONN;
break;
} else if (so->so_snd.sb_state & SBS_CANTSENDMORE) {
+   UNP_PCB_UNLOCK(unp);
error = EPIPE;
break;
-   } else {
-   UNP_PCB_LOCK(unp);
-   if ((unp2 = unp->unp_conn) == NULL) {
-   UNP_PCB_UNLOCK(unp);
-   error = ENOTCONN;
-   break;
-   }
+   } else if ((unp2 = unp->unp_conn) == NULL) {
+   UNP_PCB_UNLOCK(unp);
+   error = ENOTCONN;
+   break;
}
unp_pcb_owned_lock2(unp, unp2, freed);
UNP_PCB_UNLOCK(unp);
@@ -1198,15 +1202,11 @@ uipc_send(struct socket *so, int flags, struct mbuf *m
sbappend_locked(>so_rcv, m, flags);
break;
 
-   case SOCK_SEQPACKET: {
-   const struct sockaddr *from;
-
-   from = _noname;
+   case SOCK_SEQPACKET:
if (sbappendaddr_nospacecheck_locked(>so_rcv,
-   from, m, control))
+   _noname, m, control))
control = NULL;
break;
-   }
}
 
mbcnt = so2->so_rcv.sb_mbcnt;
___
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: r359892 - head/sys/kern

2020-04-13 Thread Mark Johnston
Author: markj
Date: Mon Apr 13 19:20:39 2020
New Revision: 359892
URL: https://svnweb.freebsd.org/changeset/base/359892

Log:
  Relax restrictions on private mappings of POSIX shm objects.
  
  When creating a private mapping of a POSIX shared memory object,
  VM_PROT_WRITE should always be included in maxprot regardless of
  permissions on the underlying FD.  Otherwise it is possible to open a
  shm object read-only, map it with MAP_PRIVATE and PROT_WRITE, and
  violate the invariant in vm_map_insert() that (prot & maxprot) == prot.
  
  Reported by:  syzkaller
  Reviewed by:  kevans, kib
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D24398

Modified:
  head/sys/kern/uipc_shm.c

Modified: head/sys/kern/uipc_shm.c
==
--- head/sys/kern/uipc_shm.cMon Apr 13 17:55:31 2020(r359891)
+++ head/sys/kern/uipc_shm.cMon Apr 13 19:20:39 2020(r359892)
@@ -1136,23 +1136,28 @@ shm_mmap(struct file *fp, vm_map_t map, vm_offset_t *a
 
/*
 * If FWRITE's set, we can allow VM_PROT_WRITE unless it's a shared
-* mapping with a write seal applied.
+* mapping with a write seal applied.  Private mappings are always
+* writeable.
 */
-   if ((fp->f_flag & FWRITE) != 0 && ((flags & MAP_SHARED) == 0 ||
-   (shmfd->shm_seals & F_SEAL_WRITE) == 0))
+   if ((flags & MAP_SHARED) == 0) {
+   cap_maxprot |= VM_PROT_WRITE;
maxprot |= VM_PROT_WRITE;
+   writecnt = false;
+   } else {
+   if ((fp->f_flag & FWRITE) != 0 &&
+   (shmfd->shm_seals & F_SEAL_WRITE) == 0)
+   maxprot |= VM_PROT_WRITE;
+   writecnt = (prot & VM_PROT_WRITE) != 0;
+   if (writecnt && (shmfd->shm_seals & F_SEAL_WRITE) != 0) {
+   error = EPERM;
+   goto out;
+   }
 
-   writecnt = (flags & MAP_SHARED) != 0 && (prot & VM_PROT_WRITE) != 0;
-
-   if (writecnt && (shmfd->shm_seals & F_SEAL_WRITE) != 0) {
-   error = EPERM;
-   goto out;
-   }
-
-   /* Don't permit shared writable mappings on read-only descriptors. */
-   if (writecnt && (maxprot & VM_PROT_WRITE) == 0) {
-   error = EACCES;
-   goto out;
+   /* Don't permit shared writable mappings on read-only 
descriptors. */
+   if (writecnt && (maxprot & VM_PROT_WRITE) == 0) {
+   error = EACCES;
+   goto out;
+   }
}
maxprot &= cap_maxprot;
 
___
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: r359891 - in head: sys/kern tests/sys/file

2020-04-13 Thread Kyle Evans
Author: kevans
Date: Mon Apr 13 17:55:31 2020
New Revision: 359891
URL: https://svnweb.freebsd.org/changeset/base/359891

Log:
  close_range/closefrom: fix regression from close_range introduction
  
  close_range will clamp the range between [0, fdp->fd_lastfile], but failed
  to take into account that fdp->fd_lastfile can become -1 if all fds are
  closed. =-( In this scenario, just return because there's nothing further we
  can do at the moment.
  
  Add a test case for this, fork() and simply closefrom(0) twice in the child;
  on the second invocation, fdp->fd_lastfile == -1 and will trigger a panic
  before this change.
  
  X-MFC-With:   r359836

Modified:
  head/sys/kern/kern_descrip.c
  head/tests/sys/file/closefrom_test.c

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cMon Apr 13 16:34:21 2020
(r359890)
+++ head/sys/kern/kern_descrip.cMon Apr 13 17:55:31 2020
(r359891)
@@ -1333,6 +1333,14 @@ kern_close_range(struct thread *td, u_int lowfd, u_int
ret = EINVAL;
goto out;
}
+
+   /*
+* If fdp->fd_lastfile == -1, we're dealing with either a fresh file
+* table or one in which every fd has been closed.  Just return
+* successful; there's nothing left to do.
+*/
+   if (fdp->fd_lastfile == -1)
+   goto out;
/* Clamped to [lowfd, fd_lastfile] */
highfd = MIN(highfd, fdp->fd_lastfile);
for (fd = lowfd; fd <= highfd; fd++) {

Modified: head/tests/sys/file/closefrom_test.c
==
--- head/tests/sys/file/closefrom_test.cMon Apr 13 16:34:21 2020
(r359890)
+++ head/tests/sys/file/closefrom_test.cMon Apr 13 17:55:31 2020
(r359891)
@@ -146,7 +146,7 @@ main(void)
pid_t pid;
int fd, i, start;
 
-   printf("1..19\n");
+   printf("1..20\n");
 
/* We better start up with fd's 0, 1, and 2 open. */
start = devnull();
@@ -308,6 +308,22 @@ main(void)
if (fd != 3)
fail("close_range", "highest fd %d", fd);
ok("close_range");
+
+   /* Fork a child process to test closefrom(0) twice. */
+   pid = fork();
+   if (pid < 0)
+   fail_err("fork");
+   if (pid == 0) {
+   /* Child. */
+   closefrom(0);
+   closefrom(0);
+   cok(info, "closefrom(0)");
+   }
+   if (wait(NULL) < 0)
+   fail_err("wait");
+   if (info->failed)
+   fail(info->tag, "%s", info->message);
+   ok(info->tag);
 
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"


Re: svn commit: r359374 - in head: . share/man/man4 share/man/man7 share/man/man9 sys/crypto/aesni sys/crypto/armv8 sys/crypto/blake2 sys/crypto/ccp sys/crypto/via sys/dev/cesa sys/dev/cxgbe sys/dev/c

2020-04-13 Thread John Baldwin
On 4/12/20 1:08 PM, Xin Li wrote:
> 
> 
> On 3/27/20 11:25 AM, John Baldwin wrote:
> [...]>   - Drivers no longer register a list of supported algorithms.  This
>> doesn't quite work when you factor in modes (e.g. a driver might
>> support both AES-CBC and SHA2-256-HMAC separately but not combined
>> for ETA).  Instead, a new 'crypto_probesession' method has been
>> added to the kobj interface for symmteric crypto drivers.  This
>> method returns a negative value on success (similar to how
>> device_probe works) and the crypto framework uses this value to pick
>> the "best" driver.  There are three constants for hardware
>> (e.g. ccr), accelerated software (e.g. aesni), and plain software
>> (cryptosoft) that give preference in that order.  One effect of this
>> is that if you request only hardware when creating a new session,
>> you will no longer get a session using accelerated software.
>> Another effect is that the default setting to disallow software
>> crypto via /dev/crypto now disables accelerated software.
> 
> For user-visible interface, it seems like we are essentially treating
> "accelerated software" like AES-NI the same way of plain software.  For
> example, geom_eli would now say:
> 
> GEOM_ELI: Encryption: AES-XTS 128
> GEOM_ELI: Crypto: software
> 
> Instead of:
> 
> GEOM_ELI: Encryption: AES-XTS 128
> GEOM_ELI: Crypto: hardware
> 
> When AES-NI is used (which is because we only have two bits to represent
> hardware and software, and have gave neither bits clear with its own
> meaning (use specific driver)).
> 
> If we are not going to add a new bit to represent accelerated software,
> why are they categorized as software providers?  Technically, all these
> still requires hardware that implements the cryptographic primitives to
> work, and it's much easier for system administrators if we expose the
> fact that they are using some kind of acceleration than asking them to
> run DTrace etc. to find out.  Personally, I think it's probably better
> to change the notion to either "accelerated" (by either hardware or
> software) and "software"...

The only case where this is visible is in fact GELI (there is no printf
for IPsec or KTLS).  For /dev/crypto using aesni.ko is a bug, not a
feature, as any such software would be much better off using AES-NI in
userland instead of round-tripping through the kernel.  We could add a
bit to appease the GELI printf, or we could just kill the GELI
printf.  I think a more useful approach would probably be to kill the
GELI printf and instead add something less GELI-specific such as
counters of active sessions for the various cryptographic drivers that
would show which drivers are in use for any in-kernel crypto.  This
approach also lends itself to supporting a more flexible API where a
single crypto session might be backed by multiple drivers where a
binary hardware / software setting might not even make sense as you
might have a mix.  (I know of other out-of-tree crypto use cases that
experimented with splitting in-kernel crypto workloads between an
async co-processor and AES-NI.)

Also, while AES-NI instructions are faster than plain C, they are still
very much software rather than an engine like QAT or ccr(4).  They run
synchronously using host CPU cycles rather than async on a separate
co-processor.  This means that if you tweak the various geli sysctls for
batching vs non-batching, etc. you need to make the same choices for
both accelerated software and "plain" software vs possibly different
choices for an async co-processor.

-- 
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: r359889 - stable/11/sys/dev/sound/usb

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:33:45 2020
New Revision: 359889
URL: https://svnweb.freebsd.org/changeset/base/359889

Log:
  MFC r359446:
  Add support for multiple playback and recording devices per physical USB audio
  device. This requires some structural refactoring inside the driver, mostly
  about converting existing audio channel structures into arrays.
  
  The main audio mixer is provided by the first PCM instance.
  The non-first audio instances may only have a software mixer for PCM playback.
  
  Tested by:Horse Ma 
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/dev/sound/usb/uaudio.c
  stable/11/sys/dev/sound/usb/uaudio.h
  stable/11/sys/dev/sound/usb/uaudio_pcm.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/sound/usb/uaudio.c
==
--- stable/11/sys/dev/sound/usb/uaudio.cMon Apr 13 16:33:10 2020
(r359888)
+++ stable/11/sys/dev/sound/usb/uaudio.cMon Apr 13 16:33:45 2020
(r359889)
@@ -258,6 +258,8 @@ struct uaudio_chan {
 #defineCHAN_OP_START 1
 #defineCHAN_OP_STOP 2
 #defineCHAN_OP_DRAIN 3
+
+   uint8_t iface_index;
 };
 
 #defineUMIDI_EMB_JACK_MAX   16 /* units */
@@ -343,37 +345,45 @@ struct uaudio_hid {
 #defineUAUDIO_SPDIF_OUT_96K0x04/* Out sample rate = 96K */
 #defineUAUDIO_SPDIF_IN_MIX 0x10/* Input mix enable */
 
+#defineUAUDIO_MAX_CHILD 2
+
+struct uaudio_softc_child {
+   device_t pcm_device;
+   struct mtx *mixer_lock;
+   struct snd_mixer *mixer_dev;
+
+   uint32_t mix_info;
+   uint32_t recsrc_info;
+
+   uint8_t pcm_registered:1;
+   uint8_t mixer_init:1;
+};
+
 struct uaudio_softc {
struct sbuf sc_sndstat;
struct sndcard_func sc_sndcard_func;
-   struct uaudio_chan sc_rec_chan;
-   struct uaudio_chan sc_play_chan;
+   struct uaudio_chan sc_rec_chan[UAUDIO_MAX_CHILD];
+   struct uaudio_chan sc_play_chan[UAUDIO_MAX_CHILD];
struct umidi_chan sc_midi_chan;
struct uaudio_hid sc_hid;
struct uaudio_search_result sc_mixer_clocks;
struct uaudio_mixer_node sc_mixer_node;
struct uaudio_configure_msg sc_config_msg[2];
+   struct uaudio_softc_child sc_child[UAUDIO_MAX_CHILD];
 
-   struct mtx *sc_mixer_lock;
-   struct snd_mixer *sc_mixer_dev;
struct usb_device *sc_udev;
struct usb_xfer *sc_mixer_xfer[1];
struct uaudio_mixer_node *sc_mixer_root;
struct uaudio_mixer_node *sc_mixer_curr;
int (*sc_set_spdif_fn) (struct uaudio_softc *, int);
 
-   uint32_t sc_mix_info;
-   uint32_t sc_recsrc_info;
-
uint16_t sc_audio_rev;
uint16_t sc_mixer_count;
 
-   uint8_t sc_sndstat_valid;
uint8_t sc_mixer_iface_index;
uint8_t sc_mixer_iface_no;
uint8_t sc_mixer_chan;
-   uint8_t sc_pcm_registered:1;
-   uint8_t sc_mixer_init:1;
+   uint8_t sc_sndstat_valid:1;
uint8_t sc_uq_audio_swap_lr:1;
uint8_t sc_uq_au_inp_async:1;
uint8_t sc_uq_au_no_xu:1;
@@ -473,7 +483,7 @@ static usb_proc_callback_t uaudio_configure_msg;
 
 static int uaudio_mixer_sysctl_handler(SYSCTL_HANDLER_ARGS);
 static void uaudio_mixer_ctl_free(struct uaudio_softc *);
-static void uaudio_mixer_register_sysctl(struct uaudio_softc *, device_t);
+static void uaudio_mixer_register_sysctl(struct uaudio_softc *, device_t, 
unsigned);
 static void uaudio_mixer_reload_all(struct uaudio_softc *);
 static void uaudio_mixer_controls_create_ftu(struct uaudio_softc *);
 
@@ -533,7 +543,7 @@ static void uaudio_mixer_add_ctl(struct uaudio_softc *
 static voiduaudio_mixer_fill_info(struct uaudio_softc *,
struct usb_device *, void *);
 static int uaudio_mixer_signext(uint8_t, int);
-static voiduaudio_mixer_init(struct uaudio_softc *);
+static voiduaudio_mixer_init(struct uaudio_softc *, unsigned);
 static uint8_t umidi_convert_to_usb(struct umidi_sub_chan *, uint8_t, uint8_t);
 static struct  umidi_sub_chan *umidi_sub_by_fifo(struct usb_fifo *);
 static voidumidi_start_read(struct usb_fifo *);
@@ -823,6 +833,33 @@ static const STRUCT_USB_HOST_ID __used uaudio_devs[] =
 USB_IFACE_SUBCLASS(UISUBCLASS_MIDISTREAM),},
 };
 
+static unsigned
+uaudio_get_child_index_by_dev(struct uaudio_softc *sc, device_t dev)
+{
+   unsigned i;
+
+   for (i = 0; i != UAUDIO_MAX_CHILD; i++) {
+   if (dev == sc->sc_child[i].pcm_device)
+   return (i);
+   }
+   panic("uaudio_get_child_index_dev: Invalid device: %p\n", dev);
+   return (0);
+}
+
+static unsigned
+uaudio_get_child_index_by_chan(struct uaudio_softc *sc, struct uaudio_chan *ch)
+{
+   unsigned i;
+
+   for (i = 0; i != UAUDIO_MAX_CHILD; i++) {
+   if ((sc->sc_play_chan + i) == ch ||
+   

svn commit: r359890 - stable/10/sys/dev/sound/usb

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:34:21 2020
New Revision: 359890
URL: https://svnweb.freebsd.org/changeset/base/359890

Log:
  MFC r359446:
  Add support for multiple playback and recording devices per physical USB audio
  device. This requires some structural refactoring inside the driver, mostly
  about converting existing audio channel structures into arrays.
  
  The main audio mixer is provided by the first PCM instance.
  The non-first audio instances may only have a software mixer for PCM playback.
  
  Tested by:Horse Ma 
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/dev/sound/usb/uaudio.c
  stable/10/sys/dev/sound/usb/uaudio.h
  stable/10/sys/dev/sound/usb/uaudio_pcm.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sound/usb/uaudio.c
==
--- stable/10/sys/dev/sound/usb/uaudio.cMon Apr 13 16:33:45 2020
(r359889)
+++ stable/10/sys/dev/sound/usb/uaudio.cMon Apr 13 16:34:21 2020
(r359890)
@@ -264,6 +264,8 @@ struct uaudio_chan {
 #defineCHAN_OP_START 1
 #defineCHAN_OP_STOP 2
 #defineCHAN_OP_DRAIN 3
+
+   uint8_t iface_index;
 };
 
 #defineUMIDI_EMB_JACK_MAX   16 /* units */
@@ -349,37 +351,45 @@ struct uaudio_hid {
 #defineUAUDIO_SPDIF_OUT_96K0x04/* Out sample rate = 96K */
 #defineUAUDIO_SPDIF_IN_MIX 0x10/* Input mix enable */
 
+#defineUAUDIO_MAX_CHILD 2
+
+struct uaudio_softc_child {
+   device_t pcm_device;
+   struct mtx *mixer_lock;
+   struct snd_mixer *mixer_dev;
+
+   uint32_t mix_info;
+   uint32_t recsrc_info;
+
+   uint8_t pcm_registered:1;
+   uint8_t mixer_init:1;
+};
+
 struct uaudio_softc {
struct sbuf sc_sndstat;
struct sndcard_func sc_sndcard_func;
-   struct uaudio_chan sc_rec_chan;
-   struct uaudio_chan sc_play_chan;
+   struct uaudio_chan sc_rec_chan[UAUDIO_MAX_CHILD];
+   struct uaudio_chan sc_play_chan[UAUDIO_MAX_CHILD];
struct umidi_chan sc_midi_chan;
struct uaudio_hid sc_hid;
struct uaudio_search_result sc_mixer_clocks;
struct uaudio_mixer_node sc_mixer_node;
struct uaudio_configure_msg sc_config_msg[2];
+   struct uaudio_softc_child sc_child[UAUDIO_MAX_CHILD];
 
-   struct mtx *sc_mixer_lock;
-   struct snd_mixer *sc_mixer_dev;
struct usb_device *sc_udev;
struct usb_xfer *sc_mixer_xfer[1];
struct uaudio_mixer_node *sc_mixer_root;
struct uaudio_mixer_node *sc_mixer_curr;
int (*sc_set_spdif_fn) (struct uaudio_softc *, int);
 
-   uint32_t sc_mix_info;
-   uint32_t sc_recsrc_info;
-
uint16_t sc_audio_rev;
uint16_t sc_mixer_count;
 
-   uint8_t sc_sndstat_valid;
uint8_t sc_mixer_iface_index;
uint8_t sc_mixer_iface_no;
uint8_t sc_mixer_chan;
-   uint8_t sc_pcm_registered:1;
-   uint8_t sc_mixer_init:1;
+   uint8_t sc_sndstat_valid:1;
uint8_t sc_uq_audio_swap_lr:1;
uint8_t sc_uq_au_inp_async:1;
uint8_t sc_uq_au_no_xu:1;
@@ -479,7 +489,7 @@ static usb_proc_callback_t uaudio_configure_msg;
 
 static int uaudio_mixer_sysctl_handler(SYSCTL_HANDLER_ARGS);
 static void uaudio_mixer_ctl_free(struct uaudio_softc *);
-static void uaudio_mixer_register_sysctl(struct uaudio_softc *, device_t);
+static void uaudio_mixer_register_sysctl(struct uaudio_softc *, device_t, 
unsigned);
 static void uaudio_mixer_reload_all(struct uaudio_softc *);
 static void uaudio_mixer_controls_create_ftu(struct uaudio_softc *);
 
@@ -539,7 +549,7 @@ static void uaudio_mixer_add_ctl(struct uaudio_softc *
 static voiduaudio_mixer_fill_info(struct uaudio_softc *,
struct usb_device *, void *);
 static int uaudio_mixer_signext(uint8_t, int);
-static voiduaudio_mixer_init(struct uaudio_softc *);
+static voiduaudio_mixer_init(struct uaudio_softc *, unsigned);
 static uint8_t umidi_convert_to_usb(struct umidi_sub_chan *, uint8_t, uint8_t);
 static struct  umidi_sub_chan *umidi_sub_by_fifo(struct usb_fifo *);
 static voidumidi_start_read(struct usb_fifo *);
@@ -829,6 +839,33 @@ static const STRUCT_USB_HOST_ID __used uaudio_devs[] =
 USB_IFACE_SUBCLASS(UISUBCLASS_MIDISTREAM),},
 };
 
+static unsigned
+uaudio_get_child_index_by_dev(struct uaudio_softc *sc, device_t dev)
+{
+   unsigned i;
+
+   for (i = 0; i != UAUDIO_MAX_CHILD; i++) {
+   if (dev == sc->sc_child[i].pcm_device)
+   return (i);
+   }
+   panic("uaudio_get_child_index_dev: Invalid device: %p\n", dev);
+   return (0);
+}
+
+static unsigned
+uaudio_get_child_index_by_chan(struct uaudio_softc *sc, struct uaudio_chan *ch)
+{
+   unsigned i;
+
+   for (i = 0; i != UAUDIO_MAX_CHILD; i++) {
+   if ((sc->sc_play_chan + i) == ch ||
+   

svn commit: r359888 - stable/12/sys/dev/sound/usb

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:33:10 2020
New Revision: 359888
URL: https://svnweb.freebsd.org/changeset/base/359888

Log:
  MFC r359446:
  Add support for multiple playback and recording devices per physical USB audio
  device. This requires some structural refactoring inside the driver, mostly
  about converting existing audio channel structures into arrays.
  
  The main audio mixer is provided by the first PCM instance.
  The non-first audio instances may only have a software mixer for PCM playback.
  
  Tested by:Horse Ma 
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/sys/dev/sound/usb/uaudio.c
  stable/12/sys/dev/sound/usb/uaudio.h
  stable/12/sys/dev/sound/usb/uaudio_pcm.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/sound/usb/uaudio.c
==
--- stable/12/sys/dev/sound/usb/uaudio.cMon Apr 13 16:32:18 2020
(r359887)
+++ stable/12/sys/dev/sound/usb/uaudio.cMon Apr 13 16:33:10 2020
(r359888)
@@ -260,6 +260,8 @@ struct uaudio_chan {
 #defineCHAN_OP_START 1
 #defineCHAN_OP_STOP 2
 #defineCHAN_OP_DRAIN 3
+
+   uint8_t iface_index;
 };
 
 #defineUMIDI_EMB_JACK_MAX   16 /* units */
@@ -345,37 +347,45 @@ struct uaudio_hid {
 #defineUAUDIO_SPDIF_OUT_96K0x04/* Out sample rate = 96K */
 #defineUAUDIO_SPDIF_IN_MIX 0x10/* Input mix enable */
 
+#defineUAUDIO_MAX_CHILD 2
+
+struct uaudio_softc_child {
+   device_t pcm_device;
+   struct mtx *mixer_lock;
+   struct snd_mixer *mixer_dev;
+
+   uint32_t mix_info;
+   uint32_t recsrc_info;
+
+   uint8_t pcm_registered:1;
+   uint8_t mixer_init:1;
+};
+
 struct uaudio_softc {
struct sbuf sc_sndstat;
struct sndcard_func sc_sndcard_func;
-   struct uaudio_chan sc_rec_chan;
-   struct uaudio_chan sc_play_chan;
+   struct uaudio_chan sc_rec_chan[UAUDIO_MAX_CHILD];
+   struct uaudio_chan sc_play_chan[UAUDIO_MAX_CHILD];
struct umidi_chan sc_midi_chan;
struct uaudio_hid sc_hid;
struct uaudio_search_result sc_mixer_clocks;
struct uaudio_mixer_node sc_mixer_node;
struct uaudio_configure_msg sc_config_msg[2];
+   struct uaudio_softc_child sc_child[UAUDIO_MAX_CHILD];
 
-   struct mtx *sc_mixer_lock;
-   struct snd_mixer *sc_mixer_dev;
struct usb_device *sc_udev;
struct usb_xfer *sc_mixer_xfer[1];
struct uaudio_mixer_node *sc_mixer_root;
struct uaudio_mixer_node *sc_mixer_curr;
int (*sc_set_spdif_fn) (struct uaudio_softc *, int);
 
-   uint32_t sc_mix_info;
-   uint32_t sc_recsrc_info;
-
uint16_t sc_audio_rev;
uint16_t sc_mixer_count;
 
-   uint8_t sc_sndstat_valid;
uint8_t sc_mixer_iface_index;
uint8_t sc_mixer_iface_no;
uint8_t sc_mixer_chan;
-   uint8_t sc_pcm_registered:1;
-   uint8_t sc_mixer_init:1;
+   uint8_t sc_sndstat_valid:1;
uint8_t sc_uq_audio_swap_lr:1;
uint8_t sc_uq_au_inp_async:1;
uint8_t sc_uq_au_no_xu:1;
@@ -475,7 +485,7 @@ static usb_proc_callback_t uaudio_configure_msg;
 
 static int uaudio_mixer_sysctl_handler(SYSCTL_HANDLER_ARGS);
 static void uaudio_mixer_ctl_free(struct uaudio_softc *);
-static void uaudio_mixer_register_sysctl(struct uaudio_softc *, device_t);
+static void uaudio_mixer_register_sysctl(struct uaudio_softc *, device_t, 
unsigned);
 static void uaudio_mixer_reload_all(struct uaudio_softc *);
 static void uaudio_mixer_controls_create_ftu(struct uaudio_softc *);
 
@@ -535,7 +545,7 @@ static void uaudio_mixer_add_ctl(struct uaudio_softc *
 static voiduaudio_mixer_fill_info(struct uaudio_softc *,
struct usb_device *, void *);
 static int uaudio_mixer_signext(uint8_t, int);
-static voiduaudio_mixer_init(struct uaudio_softc *);
+static voiduaudio_mixer_init(struct uaudio_softc *, unsigned);
 static uint8_t umidi_convert_to_usb(struct umidi_sub_chan *, uint8_t, uint8_t);
 static struct  umidi_sub_chan *umidi_sub_by_fifo(struct usb_fifo *);
 static voidumidi_start_read(struct usb_fifo *);
@@ -825,6 +835,33 @@ static const STRUCT_USB_HOST_ID __used uaudio_devs[] =
 USB_IFACE_SUBCLASS(UISUBCLASS_MIDISTREAM),},
 };
 
+static unsigned
+uaudio_get_child_index_by_dev(struct uaudio_softc *sc, device_t dev)
+{
+   unsigned i;
+
+   for (i = 0; i != UAUDIO_MAX_CHILD; i++) {
+   if (dev == sc->sc_child[i].pcm_device)
+   return (i);
+   }
+   panic("uaudio_get_child_index_dev: Invalid device: %p\n", dev);
+   return (0);
+}
+
+static unsigned
+uaudio_get_child_index_by_chan(struct uaudio_softc *sc, struct uaudio_chan *ch)
+{
+   unsigned i;
+
+   for (i = 0; i != UAUDIO_MAX_CHILD; i++) {
+   if ((sc->sc_play_chan + i) == ch ||
+   

svn commit: r359887 - stable/10/sys/dev/sound/pcm

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:32:18 2020
New Revision: 359887
URL: https://svnweb.freebsd.org/changeset/base/359887

Log:
  MFC r359440:
  Implement new mixer API to return the device pointer based on the mixer 
pointer.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/dev/sound/pcm/mixer.c
  stable/10/sys/dev/sound/pcm/mixer.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sound/pcm/mixer.c
==
--- stable/10/sys/dev/sound/pcm/mixer.c Mon Apr 13 16:31:46 2020
(r359886)
+++ stable/10/sys/dev/sound/pcm/mixer.c Mon Apr 13 16:32:18 2020
(r359887)
@@ -1031,6 +1031,14 @@ mix_get_type(struct snd_mixer *m)
return (m->type);
 }
 
+device_t
+mix_get_dev(struct snd_mixer *m)
+{
+   KASSERT(m != NULL, ("NULL snd_mixer"));
+
+   return (m->dev);
+}
+
 /* --- */
 
 static int

Modified: stable/10/sys/dev/sound/pcm/mixer.h
==
--- stable/10/sys/dev/sound/pcm/mixer.h Mon Apr 13 16:31:46 2020
(r359886)
+++ stable/10/sys/dev/sound/pcm/mixer.h Mon Apr 13 16:32:18 2020
(r359887)
@@ -54,6 +54,7 @@ int mix_get(struct snd_mixer *m, u_int dev);
 int mix_setrecsrc(struct snd_mixer *m, u_int32_t src);
 u_int32_t mix_getrecsrc(struct snd_mixer *m);
 int mix_get_type(struct snd_mixer *m);
+device_t mix_get_dev(struct snd_mixer *m);
 
 void mix_setdevs(struct snd_mixer *m, u_int32_t v);
 void mix_setrecdevs(struct snd_mixer *m, u_int32_t v);
___
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: r359886 - stable/11/sys/dev/sound/pcm

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:31:46 2020
New Revision: 359886
URL: https://svnweb.freebsd.org/changeset/base/359886

Log:
  MFC r359440:
  Implement new mixer API to return the device pointer based on the mixer 
pointer.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/dev/sound/pcm/mixer.c
  stable/11/sys/dev/sound/pcm/mixer.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/sound/pcm/mixer.c
==
--- stable/11/sys/dev/sound/pcm/mixer.c Mon Apr 13 16:31:13 2020
(r359885)
+++ stable/11/sys/dev/sound/pcm/mixer.c Mon Apr 13 16:31:46 2020
(r359886)
@@ -1030,6 +1030,14 @@ mix_get_type(struct snd_mixer *m)
return (m->type);
 }
 
+device_t
+mix_get_dev(struct snd_mixer *m)
+{
+   KASSERT(m != NULL, ("NULL snd_mixer"));
+
+   return (m->dev);
+}
+
 /* --- */
 
 static int

Modified: stable/11/sys/dev/sound/pcm/mixer.h
==
--- stable/11/sys/dev/sound/pcm/mixer.h Mon Apr 13 16:31:13 2020
(r359885)
+++ stable/11/sys/dev/sound/pcm/mixer.h Mon Apr 13 16:31:46 2020
(r359886)
@@ -54,6 +54,7 @@ int mix_get(struct snd_mixer *m, u_int dev);
 int mix_setrecsrc(struct snd_mixer *m, u_int32_t src);
 u_int32_t mix_getrecsrc(struct snd_mixer *m);
 int mix_get_type(struct snd_mixer *m);
+device_t mix_get_dev(struct snd_mixer *m);
 
 void mix_setdevs(struct snd_mixer *m, u_int32_t v);
 void mix_setrecdevs(struct snd_mixer *m, u_int32_t v);
___
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: r359885 - stable/12/sys/dev/sound/pcm

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:31:13 2020
New Revision: 359885
URL: https://svnweb.freebsd.org/changeset/base/359885

Log:
  MFC r359440:
  Implement new mixer API to return the device pointer based on the mixer 
pointer.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/sys/dev/sound/pcm/mixer.c
  stable/12/sys/dev/sound/pcm/mixer.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/sound/pcm/mixer.c
==
--- stable/12/sys/dev/sound/pcm/mixer.c Mon Apr 13 16:30:10 2020
(r359884)
+++ stable/12/sys/dev/sound/pcm/mixer.c Mon Apr 13 16:31:13 2020
(r359885)
@@ -1032,6 +1032,14 @@ mix_get_type(struct snd_mixer *m)
return (m->type);
 }
 
+device_t
+mix_get_dev(struct snd_mixer *m)
+{
+   KASSERT(m != NULL, ("NULL snd_mixer"));
+
+   return (m->dev);
+}
+
 /* --- */
 
 static int

Modified: stable/12/sys/dev/sound/pcm/mixer.h
==
--- stable/12/sys/dev/sound/pcm/mixer.h Mon Apr 13 16:30:10 2020
(r359884)
+++ stable/12/sys/dev/sound/pcm/mixer.h Mon Apr 13 16:31:13 2020
(r359885)
@@ -56,6 +56,7 @@ int mix_get(struct snd_mixer *m, u_int dev);
 int mix_setrecsrc(struct snd_mixer *m, u_int32_t src);
 u_int32_t mix_getrecsrc(struct snd_mixer *m);
 int mix_get_type(struct snd_mixer *m);
+device_t mix_get_dev(struct snd_mixer *m);
 
 void mix_setdevs(struct snd_mixer *m, u_int32_t v);
 void mix_setrecdevs(struct snd_mixer *m, u_int32_t v);
___
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: r359884 - stable/10/sys/dev/sound/pcm

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:30:10 2020
New Revision: 359884
URL: https://svnweb.freebsd.org/changeset/base/359884

Log:
  MFC r359356:
  Change default microphone level from 0 to 25.
  
  Discussed with:   Horse Ma 
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/dev/sound/pcm/mixer.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sound/pcm/mixer.c
==
--- stable/10/sys/dev/sound/pcm/mixer.c Mon Apr 13 16:29:35 2020
(r359883)
+++ stable/10/sys/dev/sound/pcm/mixer.c Mon Apr 13 16:30:10 2020
(r359884)
@@ -82,7 +82,7 @@ static u_int16_t snd_mixerdefaults[SOUND_MIXER_NRDEVIC
[SOUND_MIXER_PCM]   = 75,
[SOUND_MIXER_SPEAKER]   = 75,
[SOUND_MIXER_LINE]  = 75,
-   [SOUND_MIXER_MIC]   = 0,
+   [SOUND_MIXER_MIC]   = 25,
[SOUND_MIXER_CD]= 75,
[SOUND_MIXER_IGAIN] = 0,
[SOUND_MIXER_LINE1] = 75,
___
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: r359883 - stable/11/sys/dev/sound/pcm

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:29:35 2020
New Revision: 359883
URL: https://svnweb.freebsd.org/changeset/base/359883

Log:
  MFC r359356:
  Change default microphone level from 0 to 25.
  
  Discussed with:   Horse Ma 
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/dev/sound/pcm/mixer.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/sound/pcm/mixer.c
==
--- stable/11/sys/dev/sound/pcm/mixer.c Mon Apr 13 16:29:03 2020
(r359882)
+++ stable/11/sys/dev/sound/pcm/mixer.c Mon Apr 13 16:29:35 2020
(r359883)
@@ -81,7 +81,7 @@ static u_int16_t snd_mixerdefaults[SOUND_MIXER_NRDEVIC
[SOUND_MIXER_PCM]   = 75,
[SOUND_MIXER_SPEAKER]   = 75,
[SOUND_MIXER_LINE]  = 75,
-   [SOUND_MIXER_MIC]   = 0,
+   [SOUND_MIXER_MIC]   = 25,
[SOUND_MIXER_CD]= 75,
[SOUND_MIXER_IGAIN] = 0,
[SOUND_MIXER_LINE1] = 75,
___
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: r359882 - stable/12/sys/dev/sound/pcm

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:29:03 2020
New Revision: 359882
URL: https://svnweb.freebsd.org/changeset/base/359882

Log:
  MFC r359356:
  Change default microphone level from 0 to 25.
  
  Discussed with:   Horse Ma 
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/sys/dev/sound/pcm/mixer.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/sound/pcm/mixer.c
==
--- stable/12/sys/dev/sound/pcm/mixer.c Mon Apr 13 16:28:15 2020
(r359881)
+++ stable/12/sys/dev/sound/pcm/mixer.c Mon Apr 13 16:29:03 2020
(r359882)
@@ -83,7 +83,7 @@ static u_int16_t snd_mixerdefaults[SOUND_MIXER_NRDEVIC
[SOUND_MIXER_PCM]   = 75,
[SOUND_MIXER_SPEAKER]   = 75,
[SOUND_MIXER_LINE]  = 75,
-   [SOUND_MIXER_MIC]   = 0,
+   [SOUND_MIXER_MIC]   = 25,
[SOUND_MIXER_CD]= 75,
[SOUND_MIXER_IGAIN] = 0,
[SOUND_MIXER_LINE1] = 75,
___
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: r359881 - stable/10/sys/dev/sound/usb

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:28:15 2020
New Revision: 359881
URL: https://svnweb.freebsd.org/changeset/base/359881

Log:
  MFC r359355:
  Improve USB audio mixer support for USB audio class 1 and 2.
  - make sure volume controls are correctly mapped to "pcm" and "rec" depending
on how they deliver audio to the USB host.
  - make sure there are no duplicate record selections.
  - remove internal only mixer class type.
  - don't add software volume controls for recording only.
  - some minor mixer code cleanup.
  
  Tested by:Horse Ma 
  Sponsored by: Mellanox Technologies

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

Modified: stable/10/sys/dev/sound/usb/uaudio.c
==
--- stable/10/sys/dev/sound/usb/uaudio.cMon Apr 13 16:27:40 2020
(r359880)
+++ stable/10/sys/dev/sound/usb/uaudio.cMon Apr 13 16:28:15 2020
(r359881)
@@ -198,7 +198,6 @@ struct uaudio_mixer_node {
 
 #defineMAX_SELECTOR_INPUT_PIN 256
uint8_t slctrtype[MAX_SELECTOR_INPUT_PIN];
-   uint8_t class;
uint8_t val_default;
 
uint8_t desc[64];
@@ -459,19 +458,6 @@ static const struct uaudio_format uaudio20_formats[] =
{0, 0, 0, NULL}
 };
 
-#defineUAC_OUTPUT  0
-#defineUAC_INPUT   1
-#defineUAC_EQUAL   2
-#defineUAC_RECORD  3
-#defineUAC_NCLASSES4
-
-#ifdef USB_DEBUG
-static const char *uac_names[] = {
-   "outputs", "inputs", "equalization", "record"
-};
-
-#endif
-
 /* prototypes */
 
 static device_probe_t uaudio_probe;
@@ -515,10 +501,7 @@ static voiduaudio_mixer_add_extension(struct 
uaudio_s
const struct uaudio_terminal_node *, int);
 static struct  usb_audio_cluster uaudio_mixer_get_cluster(uint8_t,
const struct uaudio_terminal_node *);
-static uint16_tuaudio_mixer_determine_class(const struct 
uaudio_terminal_node *,
-   struct uaudio_mixer_node *);
-static uint16_tuaudio_mixer_feature_name(const struct 
uaudio_terminal_node *,
-   struct uaudio_mixer_node *);
+static uint16_tuaudio_mixer_determine_class(const struct 
uaudio_terminal_node *);
 static voiduaudio_mixer_find_inputs_sub(struct uaudio_terminal_node *,
const uint8_t *, uint8_t, struct uaudio_search_result *);
 static const void *uaudio_mixer_verify_desc(const void *, uint32_t);
@@ -536,10 +519,7 @@ static voiduaudio20_mixer_add_feature(struct 
uaudio_s
const struct uaudio_terminal_node *, int);
 static struct  usb_audio20_cluster uaudio20_mixer_get_cluster(uint8_t,
const struct uaudio_terminal_node *);
-static uint16_tuaudio20_mixer_determine_class(const struct 
uaudio_terminal_node *,
-   struct uaudio_mixer_node *);
-static uint16_tuaudio20_mixer_feature_name(const struct 
uaudio_terminal_node *,
-   struct uaudio_mixer_node *);
+static uint16_tuaudio20_mixer_determine_class(const struct 
uaudio_terminal_node *);
 static voiduaudio20_mixer_find_inputs_sub(struct uaudio_terminal_node *,
const uint8_t *, uint8_t, struct uaudio_search_result *);
 static const void *uaudio20_mixer_verify_desc(const void *, uint32_t);
@@ -560,12 +540,6 @@ static voiduaudio_mixer_fill_info(struct 
uaudio_softc
struct usb_device *, void *);
 static int uaudio_mixer_signext(uint8_t, int);
 static voiduaudio_mixer_init(struct uaudio_softc *);
-static const struct uaudio_terminal_node *uaudio_mixer_get_input(
-   const struct uaudio_terminal_node *, uint8_t);
-static const struct uaudio_terminal_node *uaudio_mixer_get_output(
-   const struct uaudio_terminal_node *, uint8_t);
-static voiduaudio_mixer_find_outputs_sub(struct uaudio_terminal_node *,
-   uint8_t, uint8_t, struct uaudio_search_result *);
 static uint8_t umidi_convert_to_usb(struct umidi_sub_chan *, uint8_t, uint8_t);
 static struct  umidi_sub_chan *umidi_sub_by_fifo(struct usb_fifo *);
 static voidumidi_start_read(struct usb_fifo *);
@@ -1142,7 +1116,8 @@ uaudio_attach_sub(device_t dev, kobj_class_t mixer_cla
DPRINTF("hardware has swapped left and right\n");
/* uaudio_pcm_setflags(dev, SD_F_PSWAPLR); */
}
-   if (!(sc->sc_mix_info & SOUND_MASK_PCM)) {
+   if (sc->sc_play_chan.num_alt > 0 &&
+   (sc->sc_mix_info & SOUND_MASK_PCM) == 0) {
 
DPRINTF("emulating master volume\n");
 
@@ -2966,7 +2941,6 @@ uaudio_mixer_controls_create_ftu(struct uaudio_softc *
memset((sc), 0, sizeof(MIX(sc)));
MIX(sc).wIndex = MAKE_WORD(6, sc->sc_mixer_iface_no);
MIX(sc).wValue[0] = MAKE_WORD(8, 0);
-   MIX(sc).class = UAC_OUTPUT;

svn commit: r359879 - stable/12/sys/dev/sound/usb

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:27:05 2020
New Revision: 359879
URL: https://svnweb.freebsd.org/changeset/base/359879

Log:
  MFC r359355:
  Improve USB audio mixer support for USB audio class 1 and 2.
  - make sure volume controls are correctly mapped to "pcm" and "rec" depending
on how they deliver audio to the USB host.
  - make sure there are no duplicate record selections.
  - remove internal only mixer class type.
  - don't add software volume controls for recording only.
  - some minor mixer code cleanup.
  
  Tested by:Horse Ma 
  Sponsored by: Mellanox Technologies

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

Modified: stable/12/sys/dev/sound/usb/uaudio.c
==
--- stable/12/sys/dev/sound/usb/uaudio.cMon Apr 13 16:26:15 2020
(r359878)
+++ stable/12/sys/dev/sound/usb/uaudio.cMon Apr 13 16:27:05 2020
(r359879)
@@ -194,7 +194,6 @@ struct uaudio_mixer_node {
 
 #defineMAX_SELECTOR_INPUT_PIN 256
uint8_t slctrtype[MAX_SELECTOR_INPUT_PIN];
-   uint8_t class;
uint8_t val_default;
 
uint8_t desc[64];
@@ -455,19 +454,6 @@ static const struct uaudio_format uaudio20_formats[] =
{0, 0, 0, NULL}
 };
 
-#defineUAC_OUTPUT  0
-#defineUAC_INPUT   1
-#defineUAC_EQUAL   2
-#defineUAC_RECORD  3
-#defineUAC_NCLASSES4
-
-#ifdef USB_DEBUG
-static const char *uac_names[] = {
-   "outputs", "inputs", "equalization", "record"
-};
-
-#endif
-
 /* prototypes */
 
 static device_probe_t uaudio_probe;
@@ -511,10 +497,7 @@ static voiduaudio_mixer_add_extension(struct 
uaudio_s
const struct uaudio_terminal_node *, int);
 static struct  usb_audio_cluster uaudio_mixer_get_cluster(uint8_t,
const struct uaudio_terminal_node *);
-static uint16_tuaudio_mixer_determine_class(const struct 
uaudio_terminal_node *,
-   struct uaudio_mixer_node *);
-static uint16_tuaudio_mixer_feature_name(const struct 
uaudio_terminal_node *,
-   struct uaudio_mixer_node *);
+static uint16_tuaudio_mixer_determine_class(const struct 
uaudio_terminal_node *);
 static voiduaudio_mixer_find_inputs_sub(struct uaudio_terminal_node *,
const uint8_t *, uint8_t, struct uaudio_search_result *);
 static const void *uaudio_mixer_verify_desc(const void *, uint32_t);
@@ -532,10 +515,7 @@ static voiduaudio20_mixer_add_feature(struct 
uaudio_s
const struct uaudio_terminal_node *, int);
 static struct  usb_audio20_cluster uaudio20_mixer_get_cluster(uint8_t,
const struct uaudio_terminal_node *);
-static uint16_tuaudio20_mixer_determine_class(const struct 
uaudio_terminal_node *,
-   struct uaudio_mixer_node *);
-static uint16_tuaudio20_mixer_feature_name(const struct 
uaudio_terminal_node *,
-   struct uaudio_mixer_node *);
+static uint16_tuaudio20_mixer_determine_class(const struct 
uaudio_terminal_node *);
 static voiduaudio20_mixer_find_inputs_sub(struct uaudio_terminal_node *,
const uint8_t *, uint8_t, struct uaudio_search_result *);
 static const void *uaudio20_mixer_verify_desc(const void *, uint32_t);
@@ -556,12 +536,6 @@ static voiduaudio_mixer_fill_info(struct 
uaudio_softc
struct usb_device *, void *);
 static int uaudio_mixer_signext(uint8_t, int);
 static voiduaudio_mixer_init(struct uaudio_softc *);
-static const struct uaudio_terminal_node *uaudio_mixer_get_input(
-   const struct uaudio_terminal_node *, uint8_t);
-static const struct uaudio_terminal_node *uaudio_mixer_get_output(
-   const struct uaudio_terminal_node *, uint8_t);
-static voiduaudio_mixer_find_outputs_sub(struct uaudio_terminal_node *,
-   uint8_t, uint8_t, struct uaudio_search_result *);
 static uint8_t umidi_convert_to_usb(struct umidi_sub_chan *, uint8_t, uint8_t);
 static struct  umidi_sub_chan *umidi_sub_by_fifo(struct usb_fifo *);
 static voidumidi_start_read(struct usb_fifo *);
@@ -1138,7 +1112,8 @@ uaudio_attach_sub(device_t dev, kobj_class_t mixer_cla
DPRINTF("hardware has swapped left and right\n");
/* uaudio_pcm_setflags(dev, SD_F_PSWAPLR); */
}
-   if (!(sc->sc_mix_info & SOUND_MASK_PCM)) {
+   if (sc->sc_play_chan.num_alt > 0 &&
+   (sc->sc_mix_info & SOUND_MASK_PCM) == 0) {
 
DPRINTF("emulating master volume\n");
 
@@ -2962,7 +2937,6 @@ uaudio_mixer_controls_create_ftu(struct uaudio_softc *
memset((sc), 0, sizeof(MIX(sc)));
MIX(sc).wIndex = MAKE_WORD(6, sc->sc_mixer_iface_no);
MIX(sc).wValue[0] = MAKE_WORD(8, 0);
-   MIX(sc).class = UAC_OUTPUT;

svn commit: r359880 - stable/11/sys/dev/sound/usb

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:27:40 2020
New Revision: 359880
URL: https://svnweb.freebsd.org/changeset/base/359880

Log:
  MFC r359355:
  Improve USB audio mixer support for USB audio class 1 and 2.
  - make sure volume controls are correctly mapped to "pcm" and "rec" depending
on how they deliver audio to the USB host.
  - make sure there are no duplicate record selections.
  - remove internal only mixer class type.
  - don't add software volume controls for recording only.
  - some minor mixer code cleanup.
  
  Tested by:Horse Ma 
  Sponsored by: Mellanox Technologies

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

Modified: stable/11/sys/dev/sound/usb/uaudio.c
==
--- stable/11/sys/dev/sound/usb/uaudio.cMon Apr 13 16:27:05 2020
(r359879)
+++ stable/11/sys/dev/sound/usb/uaudio.cMon Apr 13 16:27:40 2020
(r359880)
@@ -192,7 +192,6 @@ struct uaudio_mixer_node {
 
 #defineMAX_SELECTOR_INPUT_PIN 256
uint8_t slctrtype[MAX_SELECTOR_INPUT_PIN];
-   uint8_t class;
uint8_t val_default;
 
uint8_t desc[64];
@@ -453,19 +452,6 @@ static const struct uaudio_format uaudio20_formats[] =
{0, 0, 0, NULL}
 };
 
-#defineUAC_OUTPUT  0
-#defineUAC_INPUT   1
-#defineUAC_EQUAL   2
-#defineUAC_RECORD  3
-#defineUAC_NCLASSES4
-
-#ifdef USB_DEBUG
-static const char *uac_names[] = {
-   "outputs", "inputs", "equalization", "record"
-};
-
-#endif
-
 /* prototypes */
 
 static device_probe_t uaudio_probe;
@@ -509,10 +495,7 @@ static voiduaudio_mixer_add_extension(struct 
uaudio_s
const struct uaudio_terminal_node *, int);
 static struct  usb_audio_cluster uaudio_mixer_get_cluster(uint8_t,
const struct uaudio_terminal_node *);
-static uint16_tuaudio_mixer_determine_class(const struct 
uaudio_terminal_node *,
-   struct uaudio_mixer_node *);
-static uint16_tuaudio_mixer_feature_name(const struct 
uaudio_terminal_node *,
-   struct uaudio_mixer_node *);
+static uint16_tuaudio_mixer_determine_class(const struct 
uaudio_terminal_node *);
 static voiduaudio_mixer_find_inputs_sub(struct uaudio_terminal_node *,
const uint8_t *, uint8_t, struct uaudio_search_result *);
 static const void *uaudio_mixer_verify_desc(const void *, uint32_t);
@@ -530,10 +513,7 @@ static voiduaudio20_mixer_add_feature(struct 
uaudio_s
const struct uaudio_terminal_node *, int);
 static struct  usb_audio20_cluster uaudio20_mixer_get_cluster(uint8_t,
const struct uaudio_terminal_node *);
-static uint16_tuaudio20_mixer_determine_class(const struct 
uaudio_terminal_node *,
-   struct uaudio_mixer_node *);
-static uint16_tuaudio20_mixer_feature_name(const struct 
uaudio_terminal_node *,
-   struct uaudio_mixer_node *);
+static uint16_tuaudio20_mixer_determine_class(const struct 
uaudio_terminal_node *);
 static voiduaudio20_mixer_find_inputs_sub(struct uaudio_terminal_node *,
const uint8_t *, uint8_t, struct uaudio_search_result *);
 static const void *uaudio20_mixer_verify_desc(const void *, uint32_t);
@@ -554,12 +534,6 @@ static voiduaudio_mixer_fill_info(struct 
uaudio_softc
struct usb_device *, void *);
 static int uaudio_mixer_signext(uint8_t, int);
 static voiduaudio_mixer_init(struct uaudio_softc *);
-static const struct uaudio_terminal_node *uaudio_mixer_get_input(
-   const struct uaudio_terminal_node *, uint8_t);
-static const struct uaudio_terminal_node *uaudio_mixer_get_output(
-   const struct uaudio_terminal_node *, uint8_t);
-static voiduaudio_mixer_find_outputs_sub(struct uaudio_terminal_node *,
-   uint8_t, uint8_t, struct uaudio_search_result *);
 static uint8_t umidi_convert_to_usb(struct umidi_sub_chan *, uint8_t, uint8_t);
 static struct  umidi_sub_chan *umidi_sub_by_fifo(struct usb_fifo *);
 static voidumidi_start_read(struct usb_fifo *);
@@ -1136,7 +1110,8 @@ uaudio_attach_sub(device_t dev, kobj_class_t mixer_cla
DPRINTF("hardware has swapped left and right\n");
/* uaudio_pcm_setflags(dev, SD_F_PSWAPLR); */
}
-   if (!(sc->sc_mix_info & SOUND_MASK_PCM)) {
+   if (sc->sc_play_chan.num_alt > 0 &&
+   (sc->sc_mix_info & SOUND_MASK_PCM) == 0) {
 
DPRINTF("emulating master volume\n");
 
@@ -2960,7 +2935,6 @@ uaudio_mixer_controls_create_ftu(struct uaudio_softc *
memset((sc), 0, sizeof(MIX(sc)));
MIX(sc).wIndex = MAKE_WORD(6, sc->sc_mixer_iface_no);
MIX(sc).wValue[0] = MAKE_WORD(8, 0);
-   MIX(sc).class = UAC_OUTPUT;

svn commit: r359878 - stable/10/sys/dev/sound/usb

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:26:15 2020
New Revision: 359878
URL: https://svnweb.freebsd.org/changeset/base/359878

Log:
  MFC r359323:
  Be more intelligent when classifying USB audio terminal types, so that we
  don't end up using SOUND_MIXER_VOLUME for all undefined types.
  
  Sponsored by: Mellanox Technologies

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

Modified: stable/10/sys/dev/sound/usb/uaudio.c
==
--- stable/10/sys/dev/sound/usb/uaudio.cMon Apr 13 16:25:44 2020
(r359877)
+++ stable/10/sys/dev/sound/usb/uaudio.cMon Apr 13 16:26:15 2020
(r359878)
@@ -4515,52 +4515,61 @@ static const struct uaudio_tt_to_feature uaudio_tt_to_
{UATF_MULTITRACK, SOUND_MIXER_VOLUME},
{0x, SOUND_MIXER_VOLUME},
 
-   /* default */
-   {0x, SOUND_MIXER_VOLUME},
+   /* end */
+   {}
 };
 
 static uint16_t
-uaudio_mixer_feature_name(const struct uaudio_terminal_node *iot,
-struct uaudio_mixer_node *mix)
+uaudio_mixer_feature_name_sub(uint16_t terminal_type)
 {
const struct uaudio_tt_to_feature *uat = uaudio_tt_to_feature;
-   uint16_t terminal_type = uaudio_mixer_determine_class(iot, mix);
+   uint16_t retval;
 
-   if ((mix->class == UAC_RECORD) && (terminal_type == 0)) {
-   return (SOUND_MIXER_IMIX);
-   }
-   while (uat->terminal_type) {
-   if (uat->terminal_type == terminal_type) {
-   break;
+   while (1) {
+   if (uat->terminal_type == 0) {
+   switch (terminal_type >> 8) {
+   case UATI_UNDEFINED >> 8:
+   retval = SOUND_MIXER_RECLEV;
+   goto done;
+   case UATO_UNDEFINED >> 8:
+   retval = SOUND_MIXER_PCM;
+   goto done;
+   default:
+   retval = SOUND_MIXER_VOLUME;
+   goto done;
+   }
+   } else if (uat->terminal_type == terminal_type) {
+   retval = uat->feature;
+   goto done;
}
uat++;
}
-
+done:
DPRINTF("terminal_type=0x%04x -> %d\n",
-   terminal_type, uat->feature);
+   terminal_type, retval);
+   return (retval);
+}
 
-   return (uat->feature);
+static uint16_t
+uaudio_mixer_feature_name(const struct uaudio_terminal_node *iot,
+struct uaudio_mixer_node *mix)
+{
+   uint16_t terminal_type = uaudio_mixer_determine_class(iot, mix);
+
+   if (mix->class == UAC_RECORD && terminal_type == 0)
+   return (SOUND_MIXER_IMIX);
+   return (uaudio_mixer_feature_name_sub(terminal_type));
 }
 
 static uint16_t
 uaudio20_mixer_feature_name(const struct uaudio_terminal_node *iot,
 struct uaudio_mixer_node *mix)
 {
-   const struct uaudio_tt_to_feature *uat;
uint16_t terminal_type = uaudio20_mixer_determine_class(iot, mix);
 
-   if ((mix->class == UAC_RECORD) && (terminal_type == 0))
+   if (mix->class == UAC_RECORD && terminal_type == 0)
return (SOUND_MIXER_IMIX);
-   
-   for (uat = uaudio_tt_to_feature; uat->terminal_type != 0; uat++) {
-   if (uat->terminal_type == terminal_type)
-   break;
-   }
-
-   DPRINTF("terminal_type=0x%04x -> %d\n",
-   terminal_type, uat->feature);
-
-   return (uat->feature);
+   return (uaudio_mixer_feature_name_sub(terminal_type));
 }
 
 static const struct uaudio_terminal_node *
___
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: r359877 - stable/11/sys/dev/sound/usb

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:25:44 2020
New Revision: 359877
URL: https://svnweb.freebsd.org/changeset/base/359877

Log:
  MFC r359323:
  Be more intelligent when classifying USB audio terminal types, so that we
  don't end up using SOUND_MIXER_VOLUME for all undefined types.
  
  Sponsored by: Mellanox Technologies

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

Modified: stable/11/sys/dev/sound/usb/uaudio.c
==
--- stable/11/sys/dev/sound/usb/uaudio.cMon Apr 13 16:25:11 2020
(r359876)
+++ stable/11/sys/dev/sound/usb/uaudio.cMon Apr 13 16:25:44 2020
(r359877)
@@ -4509,52 +4509,61 @@ static const struct uaudio_tt_to_feature uaudio_tt_to_
{UATF_MULTITRACK, SOUND_MIXER_VOLUME},
{0x, SOUND_MIXER_VOLUME},
 
-   /* default */
-   {0x, SOUND_MIXER_VOLUME},
+   /* end */
+   {}
 };
 
 static uint16_t
-uaudio_mixer_feature_name(const struct uaudio_terminal_node *iot,
-struct uaudio_mixer_node *mix)
+uaudio_mixer_feature_name_sub(uint16_t terminal_type)
 {
const struct uaudio_tt_to_feature *uat = uaudio_tt_to_feature;
-   uint16_t terminal_type = uaudio_mixer_determine_class(iot, mix);
+   uint16_t retval;
 
-   if ((mix->class == UAC_RECORD) && (terminal_type == 0)) {
-   return (SOUND_MIXER_IMIX);
-   }
-   while (uat->terminal_type) {
-   if (uat->terminal_type == terminal_type) {
-   break;
+   while (1) {
+   if (uat->terminal_type == 0) {
+   switch (terminal_type >> 8) {
+   case UATI_UNDEFINED >> 8:
+   retval = SOUND_MIXER_RECLEV;
+   goto done;
+   case UATO_UNDEFINED >> 8:
+   retval = SOUND_MIXER_PCM;
+   goto done;
+   default:
+   retval = SOUND_MIXER_VOLUME;
+   goto done;
+   }
+   } else if (uat->terminal_type == terminal_type) {
+   retval = uat->feature;
+   goto done;
}
uat++;
}
-
+done:
DPRINTF("terminal_type=0x%04x -> %d\n",
-   terminal_type, uat->feature);
+   terminal_type, retval);
+   return (retval);
+}
 
-   return (uat->feature);
+static uint16_t
+uaudio_mixer_feature_name(const struct uaudio_terminal_node *iot,
+struct uaudio_mixer_node *mix)
+{
+   uint16_t terminal_type = uaudio_mixer_determine_class(iot, mix);
+
+   if (mix->class == UAC_RECORD && terminal_type == 0)
+   return (SOUND_MIXER_IMIX);
+   return (uaudio_mixer_feature_name_sub(terminal_type));
 }
 
 static uint16_t
 uaudio20_mixer_feature_name(const struct uaudio_terminal_node *iot,
 struct uaudio_mixer_node *mix)
 {
-   const struct uaudio_tt_to_feature *uat;
uint16_t terminal_type = uaudio20_mixer_determine_class(iot, mix);
 
-   if ((mix->class == UAC_RECORD) && (terminal_type == 0))
+   if (mix->class == UAC_RECORD && terminal_type == 0)
return (SOUND_MIXER_IMIX);
-   
-   for (uat = uaudio_tt_to_feature; uat->terminal_type != 0; uat++) {
-   if (uat->terminal_type == terminal_type)
-   break;
-   }
-
-   DPRINTF("terminal_type=0x%04x -> %d\n",
-   terminal_type, uat->feature);
-
-   return (uat->feature);
+   return (uaudio_mixer_feature_name_sub(terminal_type));
 }
 
 static const struct uaudio_terminal_node *
___
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: r359876 - stable/12/sys/dev/sound/usb

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:25:11 2020
New Revision: 359876
URL: https://svnweb.freebsd.org/changeset/base/359876

Log:
  MFC r359323:
  Be more intelligent when classifying USB audio terminal types, so that we
  don't end up using SOUND_MIXER_VOLUME for all undefined types.
  
  Sponsored by: Mellanox Technologies

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

Modified: stable/12/sys/dev/sound/usb/uaudio.c
==
--- stable/12/sys/dev/sound/usb/uaudio.cMon Apr 13 16:24:21 2020
(r359875)
+++ stable/12/sys/dev/sound/usb/uaudio.cMon Apr 13 16:25:11 2020
(r359876)
@@ -4511,52 +4511,61 @@ static const struct uaudio_tt_to_feature uaudio_tt_to_
{UATF_MULTITRACK, SOUND_MIXER_VOLUME},
{0x, SOUND_MIXER_VOLUME},
 
-   /* default */
-   {0x, SOUND_MIXER_VOLUME},
+   /* end */
+   {}
 };
 
 static uint16_t
-uaudio_mixer_feature_name(const struct uaudio_terminal_node *iot,
-struct uaudio_mixer_node *mix)
+uaudio_mixer_feature_name_sub(uint16_t terminal_type)
 {
const struct uaudio_tt_to_feature *uat = uaudio_tt_to_feature;
-   uint16_t terminal_type = uaudio_mixer_determine_class(iot, mix);
+   uint16_t retval;
 
-   if ((mix->class == UAC_RECORD) && (terminal_type == 0)) {
-   return (SOUND_MIXER_IMIX);
-   }
-   while (uat->terminal_type) {
-   if (uat->terminal_type == terminal_type) {
-   break;
+   while (1) {
+   if (uat->terminal_type == 0) {
+   switch (terminal_type >> 8) {
+   case UATI_UNDEFINED >> 8:
+   retval = SOUND_MIXER_RECLEV;
+   goto done;
+   case UATO_UNDEFINED >> 8:
+   retval = SOUND_MIXER_PCM;
+   goto done;
+   default:
+   retval = SOUND_MIXER_VOLUME;
+   goto done;
+   }
+   } else if (uat->terminal_type == terminal_type) {
+   retval = uat->feature;
+   goto done;
}
uat++;
}
-
+done:
DPRINTF("terminal_type=0x%04x -> %d\n",
-   terminal_type, uat->feature);
+   terminal_type, retval);
+   return (retval);
+}
 
-   return (uat->feature);
+static uint16_t
+uaudio_mixer_feature_name(const struct uaudio_terminal_node *iot,
+struct uaudio_mixer_node *mix)
+{
+   uint16_t terminal_type = uaudio_mixer_determine_class(iot, mix);
+
+   if (mix->class == UAC_RECORD && terminal_type == 0)
+   return (SOUND_MIXER_IMIX);
+   return (uaudio_mixer_feature_name_sub(terminal_type));
 }
 
 static uint16_t
 uaudio20_mixer_feature_name(const struct uaudio_terminal_node *iot,
 struct uaudio_mixer_node *mix)
 {
-   const struct uaudio_tt_to_feature *uat;
uint16_t terminal_type = uaudio20_mixer_determine_class(iot, mix);
 
-   if ((mix->class == UAC_RECORD) && (terminal_type == 0))
+   if (mix->class == UAC_RECORD && terminal_type == 0)
return (SOUND_MIXER_IMIX);
-   
-   for (uat = uaudio_tt_to_feature; uat->terminal_type != 0; uat++) {
-   if (uat->terminal_type == terminal_type)
-   break;
-   }
-
-   DPRINTF("terminal_type=0x%04x -> %d\n",
-   terminal_type, uat->feature);
-
-   return (uat->feature);
+   return (uaudio_mixer_feature_name_sub(terminal_type));
 }
 
 static const struct uaudio_terminal_node *
___
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: r359875 - stable/10/sys/dev/sound/usb

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:24:21 2020
New Revision: 359875
URL: https://svnweb.freebsd.org/changeset/base/359875

Log:
  MFC r359322:
  Make mute controls available for USB audio mixers.
  
  Submitted by: Horse Ma 
  Sponsored by: Mellanox Technologies

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

Modified: stable/10/sys/dev/sound/usb/uaudio.c
==
--- stable/10/sys/dev/sound/usb/uaudio.cMon Apr 13 16:23:46 2020
(r359874)
+++ stable/10/sys/dev/sound/usb/uaudio.cMon Apr 13 16:24:21 2020
(r359875)
@@ -3579,7 +3579,7 @@ uaudio_mixer_add_feature(struct uaudio_softc *sc,
switch (ctl) {
case MUTE_CONTROL:
MIX(sc).type = MIX_ON_OFF;
-   MIX(sc).ctl = SOUND_MIXER_NRDEVICES;
+   MIX(sc).ctl = SOUND_MIXER_MUTE;
MIX(sc).name = "mute";
break;
 
@@ -3694,7 +3694,7 @@ uaudio20_mixer_add_feature(struct uaudio_softc *sc,
switch (ctl) {
case (3 << 0):
MIX(sc).type = MIX_ON_OFF;
-   MIX(sc).ctl = SOUND_MIXER_NRDEVICES;
+   MIX(sc).ctl = SOUND_MIXER_MUTE;
MIX(sc).name = "mute";
what = MUTE_CONTROL;
break;
___
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: r359873 - stable/12/sys/dev/sound/usb

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:23:10 2020
New Revision: 359873
URL: https://svnweb.freebsd.org/changeset/base/359873

Log:
  MFC r359322:
  Make mute controls available for USB audio mixers.
  
  Submitted by: Horse Ma 
  Sponsored by: Mellanox Technologies

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

Modified: stable/12/sys/dev/sound/usb/uaudio.c
==
--- stable/12/sys/dev/sound/usb/uaudio.cMon Apr 13 16:22:15 2020
(r359872)
+++ stable/12/sys/dev/sound/usb/uaudio.cMon Apr 13 16:23:10 2020
(r359873)
@@ -3575,7 +3575,7 @@ uaudio_mixer_add_feature(struct uaudio_softc *sc,
switch (ctl) {
case MUTE_CONTROL:
MIX(sc).type = MIX_ON_OFF;
-   MIX(sc).ctl = SOUND_MIXER_NRDEVICES;
+   MIX(sc).ctl = SOUND_MIXER_MUTE;
MIX(sc).name = "mute";
break;
 
@@ -3690,7 +3690,7 @@ uaudio20_mixer_add_feature(struct uaudio_softc *sc,
switch (ctl) {
case (3 << 0):
MIX(sc).type = MIX_ON_OFF;
-   MIX(sc).ctl = SOUND_MIXER_NRDEVICES;
+   MIX(sc).ctl = SOUND_MIXER_MUTE;
MIX(sc).name = "mute";
what = MUTE_CONTROL;
break;
___
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: r359874 - stable/11/sys/dev/sound/usb

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:23:46 2020
New Revision: 359874
URL: https://svnweb.freebsd.org/changeset/base/359874

Log:
  MFC r359322:
  Make mute controls available for USB audio mixers.
  
  Submitted by: Horse Ma 
  Sponsored by: Mellanox Technologies

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

Modified: stable/11/sys/dev/sound/usb/uaudio.c
==
--- stable/11/sys/dev/sound/usb/uaudio.cMon Apr 13 16:23:10 2020
(r359873)
+++ stable/11/sys/dev/sound/usb/uaudio.cMon Apr 13 16:23:46 2020
(r359874)
@@ -3573,7 +3573,7 @@ uaudio_mixer_add_feature(struct uaudio_softc *sc,
switch (ctl) {
case MUTE_CONTROL:
MIX(sc).type = MIX_ON_OFF;
-   MIX(sc).ctl = SOUND_MIXER_NRDEVICES;
+   MIX(sc).ctl = SOUND_MIXER_MUTE;
MIX(sc).name = "mute";
break;
 
@@ -3688,7 +3688,7 @@ uaudio20_mixer_add_feature(struct uaudio_softc *sc,
switch (ctl) {
case (3 << 0):
MIX(sc).type = MIX_ON_OFF;
-   MIX(sc).ctl = SOUND_MIXER_NRDEVICES;
+   MIX(sc).ctl = SOUND_MIXER_MUTE;
MIX(sc).name = "mute";
what = MUTE_CONTROL;
break;
___
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: r359872 - stable/10/sys/dev/sound/usb

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:22:15 2020
New Revision: 359872
URL: https://svnweb.freebsd.org/changeset/base/359872

Log:
  MFC r359321:
  Factor out USB audio mixer value range check.
  
  Sponsored by: Mellanox Technologies

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

Modified: stable/10/sys/dev/sound/usb/uaudio.c
==
--- stable/10/sys/dev/sound/usb/uaudio.cMon Apr 13 16:21:38 2020
(r359871)
+++ stable/10/sys/dev/sound/usb/uaudio.cMon Apr 13 16:22:15 2020
(r359872)
@@ -5380,25 +5380,19 @@ uaudio_mixer_bsd2value(struct uaudio_mixer_node *mc, i
 {
if (mc->type == MIX_ON_OFF) {
val = (val != 0);
-   } else if (mc->type == MIX_SELECTOR) {
-   if ((val < mc->minval) ||
-   (val > mc->maxval)) {
-   val = mc->minval;
-   }
-   } else {
+   } else if (mc->type != MIX_SELECTOR) {
 
/* compute actual volume */
val = (val * mc->mul) / 100;
 
/* add lower offset */
val = val + mc->minval;
-
-   /* make sure we don't write a value out of range */
-   if (val > mc->maxval)
-   val = mc->maxval;
-   else if (val < mc->minval)
-   val = mc->minval;
}
+   /* make sure we don't write a value out of range */
+   if (val > mc->maxval)
+   val = mc->maxval;
+   else if (val < mc->minval)
+   val = mc->minval;
 
DPRINTFN(6, "type=0x%03x val=%d min=%d max=%d val=%d\n",
mc->type, val, mc->minval, mc->maxval, 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: r359871 - stable/11/sys/dev/sound/usb

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:21:38 2020
New Revision: 359871
URL: https://svnweb.freebsd.org/changeset/base/359871

Log:
  MFC r359321:
  Factor out USB audio mixer value range check.
  
  Sponsored by: Mellanox Technologies

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

Modified: stable/11/sys/dev/sound/usb/uaudio.c
==
--- stable/11/sys/dev/sound/usb/uaudio.cMon Apr 13 16:21:03 2020
(r359870)
+++ stable/11/sys/dev/sound/usb/uaudio.cMon Apr 13 16:21:38 2020
(r359871)
@@ -5374,25 +5374,19 @@ uaudio_mixer_bsd2value(struct uaudio_mixer_node *mc, i
 {
if (mc->type == MIX_ON_OFF) {
val = (val != 0);
-   } else if (mc->type == MIX_SELECTOR) {
-   if ((val < mc->minval) ||
-   (val > mc->maxval)) {
-   val = mc->minval;
-   }
-   } else {
+   } else if (mc->type != MIX_SELECTOR) {
 
/* compute actual volume */
val = (val * mc->mul) / 100;
 
/* add lower offset */
val = val + mc->minval;
-
-   /* make sure we don't write a value out of range */
-   if (val > mc->maxval)
-   val = mc->maxval;
-   else if (val < mc->minval)
-   val = mc->minval;
}
+   /* make sure we don't write a value out of range */
+   if (val > mc->maxval)
+   val = mc->maxval;
+   else if (val < mc->minval)
+   val = mc->minval;
 
DPRINTFN(6, "type=0x%03x val=%d min=%d max=%d val=%d\n",
mc->type, val, mc->minval, mc->maxval, 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: r359870 - stable/12/sys/dev/sound/usb

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:21:03 2020
New Revision: 359870
URL: https://svnweb.freebsd.org/changeset/base/359870

Log:
  MFC r359321:
  Factor out USB audio mixer value range check.
  
  Sponsored by: Mellanox Technologies

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

Modified: stable/12/sys/dev/sound/usb/uaudio.c
==
--- stable/12/sys/dev/sound/usb/uaudio.cMon Apr 13 16:19:45 2020
(r359869)
+++ stable/12/sys/dev/sound/usb/uaudio.cMon Apr 13 16:21:03 2020
(r359870)
@@ -5376,25 +5376,19 @@ uaudio_mixer_bsd2value(struct uaudio_mixer_node *mc, i
 {
if (mc->type == MIX_ON_OFF) {
val = (val != 0);
-   } else if (mc->type == MIX_SELECTOR) {
-   if ((val < mc->minval) ||
-   (val > mc->maxval)) {
-   val = mc->minval;
-   }
-   } else {
+   } else if (mc->type != MIX_SELECTOR) {
 
/* compute actual volume */
val = (val * mc->mul) / 100;
 
/* add lower offset */
val = val + mc->minval;
-
-   /* make sure we don't write a value out of range */
-   if (val > mc->maxval)
-   val = mc->maxval;
-   else if (val < mc->minval)
-   val = mc->minval;
}
+   /* make sure we don't write a value out of range */
+   if (val > mc->maxval)
+   val = mc->maxval;
+   else if (val < mc->minval)
+   val = mc->minval;
 
DPRINTFN(6, "type=0x%03x val=%d min=%d max=%d val=%d\n",
mc->type, val, mc->minval, mc->maxval, 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: r359869 - stable/10/sys/dev/sound/usb

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:19:45 2020
New Revision: 359869
URL: https://svnweb.freebsd.org/changeset/base/359869

Log:
  MFC r359320:
  Avoid scaling USB audio mixer values twice.
  
  Sponsored by: Mellanox Technologies

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

Modified: stable/10/sys/dev/sound/usb/uaudio.c
==
--- stable/10/sys/dev/sound/usb/uaudio.cMon Apr 13 16:19:12 2020
(r359868)
+++ stable/10/sys/dev/sound/usb/uaudio.cMon Apr 13 16:19:45 2020
(r359869)
@@ -558,10 +558,7 @@ static voiduaudio_mixer_add_ctl(struct 
uaudio_softc *
struct uaudio_mixer_node *);
 static voiduaudio_mixer_fill_info(struct uaudio_softc *,
struct usb_device *, void *);
-static voiduaudio_mixer_ctl_set(struct uaudio_softc *,
-   struct uaudio_mixer_node *, uint8_t, int32_t val);
 static int uaudio_mixer_signext(uint8_t, int);
-static int uaudio_mixer_bsd2value(struct uaudio_mixer_node *, int32_t val);
 static voiduaudio_mixer_init(struct uaudio_softc *);
 static const struct uaudio_terminal_node *uaudio_mixer_get_input(
const struct uaudio_terminal_node *, uint8_t);
@@ -5379,7 +5376,7 @@ uaudio_mixer_signext(uint8_t type, int val)
 }
 
 static int
-uaudio_mixer_bsd2value(struct uaudio_mixer_node *mc, int32_t val)
+uaudio_mixer_bsd2value(struct uaudio_mixer_node *mc, int val)
 {
if (mc->type == MIX_ON_OFF) {
val = (val != 0);
@@ -5391,7 +5388,7 @@ uaudio_mixer_bsd2value(struct uaudio_mixer_node *mc, i
} else {
 
/* compute actual volume */
-   val = (val * mc->mul) / 255;
+   val = (val * mc->mul) / 100;
 
/* add lower offset */
val = val + mc->minval;
@@ -5410,7 +5407,7 @@ uaudio_mixer_bsd2value(struct uaudio_mixer_node *mc, i
 
 static void
 uaudio_mixer_ctl_set(struct uaudio_softc *sc, struct uaudio_mixer_node *mc,
-uint8_t chan, int32_t val)
+uint8_t chan, int val)
 {
val = uaudio_mixer_bsd2value(mc, val);
 
@@ -5499,8 +5496,7 @@ uaudio_mixer_set(struct uaudio_softc *sc, unsigned typ
if (mc->ctl == type) {
for (chan = 0; chan < mc->nchan; chan++) {
uaudio_mixer_ctl_set(sc, mc, chan,
-   (int)((chan == 0 ? left : right) *
-   255) / 100);
+   chan == 0 ? left : right);
}
}
}
___
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: r359868 - stable/11/sys/dev/sound/usb

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:19:12 2020
New Revision: 359868
URL: https://svnweb.freebsd.org/changeset/base/359868

Log:
  MFC r359320:
  Avoid scaling USB audio mixer values twice.
  
  Sponsored by: Mellanox Technologies

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

Modified: stable/11/sys/dev/sound/usb/uaudio.c
==
--- stable/11/sys/dev/sound/usb/uaudio.cMon Apr 13 16:18:38 2020
(r359867)
+++ stable/11/sys/dev/sound/usb/uaudio.cMon Apr 13 16:19:12 2020
(r359868)
@@ -552,10 +552,7 @@ static voiduaudio_mixer_add_ctl(struct 
uaudio_softc *
struct uaudio_mixer_node *);
 static voiduaudio_mixer_fill_info(struct uaudio_softc *,
struct usb_device *, void *);
-static voiduaudio_mixer_ctl_set(struct uaudio_softc *,
-   struct uaudio_mixer_node *, uint8_t, int32_t val);
 static int uaudio_mixer_signext(uint8_t, int);
-static int uaudio_mixer_bsd2value(struct uaudio_mixer_node *, int32_t val);
 static voiduaudio_mixer_init(struct uaudio_softc *);
 static const struct uaudio_terminal_node *uaudio_mixer_get_input(
const struct uaudio_terminal_node *, uint8_t);
@@ -5373,7 +5370,7 @@ uaudio_mixer_signext(uint8_t type, int val)
 }
 
 static int
-uaudio_mixer_bsd2value(struct uaudio_mixer_node *mc, int32_t val)
+uaudio_mixer_bsd2value(struct uaudio_mixer_node *mc, int val)
 {
if (mc->type == MIX_ON_OFF) {
val = (val != 0);
@@ -5385,7 +5382,7 @@ uaudio_mixer_bsd2value(struct uaudio_mixer_node *mc, i
} else {
 
/* compute actual volume */
-   val = (val * mc->mul) / 255;
+   val = (val * mc->mul) / 100;
 
/* add lower offset */
val = val + mc->minval;
@@ -5404,7 +5401,7 @@ uaudio_mixer_bsd2value(struct uaudio_mixer_node *mc, i
 
 static void
 uaudio_mixer_ctl_set(struct uaudio_softc *sc, struct uaudio_mixer_node *mc,
-uint8_t chan, int32_t val)
+uint8_t chan, int val)
 {
val = uaudio_mixer_bsd2value(mc, val);
 
@@ -5493,8 +5490,7 @@ uaudio_mixer_set(struct uaudio_softc *sc, unsigned typ
if (mc->ctl == type) {
for (chan = 0; chan < mc->nchan; chan++) {
uaudio_mixer_ctl_set(sc, mc, chan,
-   (int)((chan == 0 ? left : right) *
-   255) / 100);
+   chan == 0 ? left : right);
}
}
}
___
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: r359867 - stable/12/sys/dev/sound/usb

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:18:38 2020
New Revision: 359867
URL: https://svnweb.freebsd.org/changeset/base/359867

Log:
  MFC r359320:
  Avoid scaling USB audio mixer values twice.
  
  Sponsored by: Mellanox Technologies

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

Modified: stable/12/sys/dev/sound/usb/uaudio.c
==
--- stable/12/sys/dev/sound/usb/uaudio.cMon Apr 13 16:14:21 2020
(r359866)
+++ stable/12/sys/dev/sound/usb/uaudio.cMon Apr 13 16:18:38 2020
(r359867)
@@ -554,10 +554,7 @@ static voiduaudio_mixer_add_ctl(struct 
uaudio_softc *
struct uaudio_mixer_node *);
 static voiduaudio_mixer_fill_info(struct uaudio_softc *,
struct usb_device *, void *);
-static voiduaudio_mixer_ctl_set(struct uaudio_softc *,
-   struct uaudio_mixer_node *, uint8_t, int32_t val);
 static int uaudio_mixer_signext(uint8_t, int);
-static int uaudio_mixer_bsd2value(struct uaudio_mixer_node *, int32_t val);
 static voiduaudio_mixer_init(struct uaudio_softc *);
 static const struct uaudio_terminal_node *uaudio_mixer_get_input(
const struct uaudio_terminal_node *, uint8_t);
@@ -5375,7 +5372,7 @@ uaudio_mixer_signext(uint8_t type, int val)
 }
 
 static int
-uaudio_mixer_bsd2value(struct uaudio_mixer_node *mc, int32_t val)
+uaudio_mixer_bsd2value(struct uaudio_mixer_node *mc, int val)
 {
if (mc->type == MIX_ON_OFF) {
val = (val != 0);
@@ -5387,7 +5384,7 @@ uaudio_mixer_bsd2value(struct uaudio_mixer_node *mc, i
} else {
 
/* compute actual volume */
-   val = (val * mc->mul) / 255;
+   val = (val * mc->mul) / 100;
 
/* add lower offset */
val = val + mc->minval;
@@ -5406,7 +5403,7 @@ uaudio_mixer_bsd2value(struct uaudio_mixer_node *mc, i
 
 static void
 uaudio_mixer_ctl_set(struct uaudio_softc *sc, struct uaudio_mixer_node *mc,
-uint8_t chan, int32_t val)
+uint8_t chan, int val)
 {
val = uaudio_mixer_bsd2value(mc, val);
 
@@ -5495,8 +5492,7 @@ uaudio_mixer_set(struct uaudio_softc *sc, unsigned typ
if (mc->ctl == type) {
for (chan = 0; chan < mc->nchan; chan++) {
uaudio_mixer_ctl_set(sc, mc, chan,
-   (int)((chan == 0 ? left : right) *
-   255) / 100);
+   chan == 0 ? left : right);
}
}
}
___
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: r359866 - in stable/12/sys/dev: rtwn/usb usb

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 16:14:21 2020
New Revision: 359866
URL: https://svnweb.freebsd.org/changeset/base/359866

Log:
  MFC r359209:
  Add new USB ID.
  
  Submitted by: Konrad Jopek 
  Differential Revision:https://reviews.freebsd.org/D24142
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/sys/dev/rtwn/usb/rtwn_usb_attach.h
  stable/12/sys/dev/usb/usbdevs
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/rtwn/usb/rtwn_usb_attach.h
==
--- stable/12/sys/dev/rtwn/usb/rtwn_usb_attach.hMon Apr 13 15:59:15 
2020(r359865)
+++ stable/12/sys/dev/rtwn/usb/rtwn_usb_attach.hMon Apr 13 16:14:21 
2020(r359866)
@@ -159,7 +159,8 @@ static const STRUCT_USB_HOST_ID rtwn_devs[] = {
RTWN_RTL8821AU_DEV(NETGEAR, A6100),
RTWN_RTL8821AU_DEV(REALTEK, RTL8821AU_1),
RTWN_RTL8821AU_DEV(REALTEK, RTL8821AU_2),
-   RTWN_RTL8821AU_DEV(TPLINK,  T2UNANO)
+   RTWN_RTL8821AU_DEV(TPLINK,  T2UNANO),
+   RTWN_RTL8821AU_DEV(TPLINK,  T2UPLUS),
 #undef RTWN_RTL8821AU_DEV
 };
 

Modified: stable/12/sys/dev/usb/usbdevs
==
--- stable/12/sys/dev/usb/usbdevs   Mon Apr 13 15:59:15 2020
(r359865)
+++ stable/12/sys/dev/usb/usbdevs   Mon Apr 13 16:14:21 2020
(r359866)
@@ -4666,6 +4666,7 @@ product TPLINK T4UV2  0x010d  Archer T4U ver 2
 product TPLINK T4UHV1  0x0103  Archer T4UH ver 1
 product TPLINK T4UHV2  0x010e  Archer T4UH ver 2
 product TPLINK T2UNANO 0x011e  Archer T2U Nano
+product TPLINK T2UPLUS 0x0120  Archer T2U Plus
 product TPLINK RTL8153 0x0601  RTL8153 USB 10/100/1000 LAN
 
 /* Trek Technology products */
___
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: r359865 - head/lib/libc/sys

2020-04-13 Thread Kyle Evans
Author: kevans
Date: Mon Apr 13 15:59:15 2020
New Revision: 359865
URL: https://svnweb.freebsd.org/changeset/base/359865

Log:
  libc: remove shm_open(2)'s compat fallback
  
  This had been introduced to ease any pain for using slightly older kernels
  with a newer libc, e.g., for bisecting a kernel across the introduction of
  shm_open2(2). 6 months has passed, retire the fallback and let shm_open()
  unconditionally call shm_open2().
  
  Stale includes are removed as well.

Modified:
  head/lib/libc/sys/shm_open.c

Modified: head/lib/libc/sys/shm_open.c
==
--- head/lib/libc/sys/shm_open.cMon Apr 13 14:44:44 2020
(r359864)
+++ head/lib/libc/sys/shm_open.cMon Apr 13 15:59:15 2020
(r359865)
@@ -33,12 +33,10 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -47,25 +45,13 @@ __FBSDID("$FreeBSD$");
 __weak_reference(shm_open, _shm_open);
 __weak_reference(shm_open, __sys_shm_open);
 
-#defineSHM_OPEN2_OSREL 1300048
-
 #defineMEMFD_NAME_PREFIX   "memfd:"
 
 int
 shm_open(const char *path, int flags, mode_t mode)
 {
 
-   if (__getosreldate() >= SHM_OPEN2_OSREL)
-   return (__sys_shm_open2(path, flags | O_CLOEXEC, mode, 0,
-   NULL));
-
-   /*
-* Fallback to shm_open(2) on older kernels.  The kernel will enforce
-* O_CLOEXEC in this interface, unlike the newer shm_open2 which does
-* not enforce it.  The newer interface allows memfd_create(), for
-* instance, to not have CLOEXEC on the returned fd.
-*/
-   return (syscall(SYS_freebsd12_shm_open, path, flags, mode));
+   return (__sys_shm_open2(path, flags | O_CLOEXEC, mode, 0, 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: r359864 - stable/11/usr.bin/calendar/tests

2020-04-13 Thread Li-Wen Hsu
Author: lwhsu
Date: Mon Apr 13 14:44:44 2020
New Revision: 359864
URL: https://svnweb.freebsd.org/changeset/base/359864

Log:
  MFC r359862:
  
  Install expected output file of test missed in r359585
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/usr.bin/calendar/tests/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/calendar/tests/Makefile
==
--- stable/11/usr.bin/calendar/tests/Makefile   Mon Apr 13 14:43:35 2020
(r359863)
+++ stable/11/usr.bin/calendar/tests/Makefile   Mon Apr 13 14:44:44 2020
(r359864)
@@ -19,6 +19,7 @@ ${PACKAGE}FILES+= regress.s1.out
 ${PACKAGE}FILES+=  regress.s2.out
 ${PACKAGE}FILES+=  regress.s3.out
 ${PACKAGE}FILES+=  regress.s4.out
+${PACKAGE}FILES+=  regress.s5.out
 ${PACKAGE}FILES+=  regress.sh
 ${PACKAGE}FILES+=  regress.w0-1.out
 ${PACKAGE}FILES+=  regress.w0-2.out
___
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: r359863 - stable/12/usr.bin/calendar/tests

2020-04-13 Thread Li-Wen Hsu
Author: lwhsu
Date: Mon Apr 13 14:43:35 2020
New Revision: 359863
URL: https://svnweb.freebsd.org/changeset/base/359863

Log:
  MFC r359862:
  
  Install expected output file of test missed in r359585
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/12/usr.bin/calendar/tests/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.bin/calendar/tests/Makefile
==
--- stable/12/usr.bin/calendar/tests/Makefile   Mon Apr 13 14:35:07 2020
(r359862)
+++ stable/12/usr.bin/calendar/tests/Makefile   Mon Apr 13 14:43:35 2020
(r359863)
@@ -21,6 +21,7 @@ ${PACKAGE}FILES+= regress.s1.out
 ${PACKAGE}FILES+=  regress.s2.out
 ${PACKAGE}FILES+=  regress.s3.out
 ${PACKAGE}FILES+=  regress.s4.out
+${PACKAGE}FILES+=  regress.s5.out
 ${PACKAGE}FILES+=  regress.sh
 ${PACKAGE}FILES+=  regress.w0-1.out
 ${PACKAGE}FILES+=  regress.w0-2.out
___
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: r359862 - head/usr.bin/calendar/tests

2020-04-13 Thread Li-Wen Hsu
Author: lwhsu
Date: Mon Apr 13 14:35:07 2020
New Revision: 359862
URL: https://svnweb.freebsd.org/changeset/base/359862

Log:
  Install expected output file of test missed in r359585
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.bin/calendar/tests/Makefile

Modified: head/usr.bin/calendar/tests/Makefile
==
--- head/usr.bin/calendar/tests/MakefileMon Apr 13 13:33:24 2020
(r359861)
+++ head/usr.bin/calendar/tests/MakefileMon Apr 13 14:35:07 2020
(r359862)
@@ -21,6 +21,7 @@ ${PACKAGE}FILES+= regress.s1.out
 ${PACKAGE}FILES+=  regress.s2.out
 ${PACKAGE}FILES+=  regress.s3.out
 ${PACKAGE}FILES+=  regress.s4.out
+${PACKAGE}FILES+=  regress.s5.out
 ${PACKAGE}FILES+=  regress.sh
 ${PACKAGE}FILES+=  regress.w0-1.out
 ${PACKAGE}FILES+=  regress.w0-2.out
___
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: r359844 - head/sys/netinet6

2020-04-13 Thread Mark Linimon
On Mon, Apr 13, 2020 at 08:26:11AM +, Alexander V. Chernikov wrote:
>   Remove tcp_rtlookup6() function signature.
>The function itself was removed in r122922 16 years ago.

I nominate this for "most amusing commit of the month" :-)

Who knows what other cobwebs lurk in our src tree ...

mcl
___
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: r359861 - stable/11/sys/cam/scsi

2020-04-13 Thread Alexander Motin
Author: mav
Date: Mon Apr 13 13:33:24 2020
New Revision: 359861
URL: https://svnweb.freebsd.org/changeset/base/359861

Log:
  MFC r359662: Relax too strict SES element descriptors check in r355430.
  
  SES specifications allows the string to be NULL-terminated, while previous
  code was considering it as invalid due to incorrectly ordered conditions.

Modified:
  stable/11/sys/cam/scsi/scsi_enc_ses.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/scsi/scsi_enc_ses.c
==
--- stable/11/sys/cam/scsi/scsi_enc_ses.c   Mon Apr 13 13:33:01 2020
(r359860)
+++ stable/11/sys/cam/scsi/scsi_enc_ses.c   Mon Apr 13 13:33:24 2020
(r359861)
@@ -2002,11 +2002,11 @@ ses_sanitize_elm_desc(const char *desc, uint16_t *len)
int i;
 
for (i = 0; i < *len; i++) {
-   if (desc[i] < 0x20 || desc[i] > 0x7e) {
+   if (desc[i] == 0) {
+   break;
+   } else if (desc[i] < 0x20 || desc[i] > 0x7e) {
*len = strlen(invalid);
return (invalid);
-   } else if (desc[i] == 0) {
-   break;
}
}
return (desc);
___
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: r359860 - stable/12/sys/cam/scsi

2020-04-13 Thread Alexander Motin
Author: mav
Date: Mon Apr 13 13:33:01 2020
New Revision: 359860
URL: https://svnweb.freebsd.org/changeset/base/359860

Log:
  MFC r359662: Relax too strict SES element descriptors check in r355430.
  
  SES specifications allows the string to be NULL-terminated, while previous
  code was considering it as invalid due to incorrectly ordered conditions.

Modified:
  stable/12/sys/cam/scsi/scsi_enc_ses.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/scsi/scsi_enc_ses.c
==
--- stable/12/sys/cam/scsi/scsi_enc_ses.c   Mon Apr 13 09:09:28 2020
(r359859)
+++ stable/12/sys/cam/scsi/scsi_enc_ses.c   Mon Apr 13 13:33:01 2020
(r359860)
@@ -2004,11 +2004,11 @@ ses_sanitize_elm_desc(const char *desc, uint16_t *len)
int i;
 
for (i = 0; i < *len; i++) {
-   if (desc[i] < 0x20 || desc[i] > 0x7e) {
+   if (desc[i] == 0) {
+   break;
+   } else if (desc[i] < 0x20 || desc[i] > 0x7e) {
*len = strlen(invalid);
return (invalid);
-   } else if (desc[i] == 0) {
-   break;
}
}
return (desc);
___
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: r359859 - stable/11/sys/dev/mlx5/mlx5_en

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 09:09:28 2020
New Revision: 359859
URL: https://svnweb.freebsd.org/changeset/base/359859

Log:
  MFC r359724:
  Account out of buffer as dropped packets in mlx5en(4).
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Apr 13 09:08:47 
2020(r359858)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Apr 13 09:09:28 
2020(r359859)
@@ -890,6 +890,7 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv)
tso_packets += sq_stats->tso_packets;
tso_bytes += sq_stats->tso_bytes;
tx_queue_dropped += sq_stats->dropped;
+   tx_queue_dropped += sq_stats->enobuf;
tx_defragged += sq_stats->defragged;
tx_offload_none += sq_stats->csum_offload_none;
}
___
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: r359858 - stable/12/sys/dev/mlx5/mlx5_en

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 09:08:47 2020
New Revision: 359858
URL: https://svnweb.freebsd.org/changeset/base/359858

Log:
  MFC r359724:
  Account out of buffer as dropped packets in mlx5en(4).
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Apr 13 09:05:21 
2020(r359857)
+++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Apr 13 09:08:47 
2020(r359858)
@@ -898,6 +898,7 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv)
tso_packets += sq_stats->tso_packets;
tso_bytes += sq_stats->tso_bytes;
tx_queue_dropped += sq_stats->dropped;
+   tx_queue_dropped += sq_stats->enobuf;
tx_defragged += sq_stats->defragged;
tx_offload_none += sq_stats->csum_offload_none;
}
___
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: r359857 - stable/11/sys/dev/mlx5/mlx5_en

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 09:05:21 2020
New Revision: 359857
URL: https://svnweb.freebsd.org/changeset/base/359857

Log:
  MFC r359723:
  Remove obsolete bufring stats in mlx5en(4).
  
  Leftover from when DRBR was removed.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/dev/mlx5/mlx5_en/en.h
  stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h
==
--- stable/11/sys/dev/mlx5/mlx5_en/en.h Mon Apr 13 09:04:32 2020
(r359856)
+++ stable/11/sys/dev/mlx5/mlx5_en/en.h Mon Apr 13 09:05:21 2020
(r359857)
@@ -816,7 +816,6 @@ struct mlx5e_sq {
 
/* pointers to per packet info: write@xmit, read@completion */
struct  mlx5e_sq_mbuf *mbuf;
-   struct  buf_ring *br;
 
/* read only */
struct  mlx5_wq_cyc wq;

Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Apr 13 09:04:32 
2020(r359856)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Apr 13 09:05:21 
2020(r359857)
@@ -837,7 +837,6 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv)
struct mlx5_core_dev *mdev = priv->mdev;
struct mlx5e_vport_stats *s = >stats.vport;
struct mlx5e_sq_stats *sq_stats;
-   struct buf_ring *sq_br;
 #if (__FreeBSD_version < 110)
struct ifnet *ifp = priv->ifp;
 #endif
@@ -887,13 +886,10 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv)
 
for (j = 0; j < priv->num_tc; j++) {
sq_stats = >sq[j].stats;
-   sq_br = pch->sq[j].br;
 
tso_packets += sq_stats->tso_packets;
tso_bytes += sq_stats->tso_bytes;
tx_queue_dropped += sq_stats->dropped;
-   if (sq_br != NULL)
-   tx_queue_dropped += sq_br->br_drops;
tx_defragged += sq_stats->defragged;
tx_offload_none += sq_stats->csum_offload_none;
}
___
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: r359856 - stable/12/sys/dev/mlx5/mlx5_en

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 09:04:32 2020
New Revision: 359856
URL: https://svnweb.freebsd.org/changeset/base/359856

Log:
  MFC r359723:
  Remove obsolete bufring stats in mlx5en(4).
  
  Leftover from when DRBR was removed.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/sys/dev/mlx5/mlx5_en/en.h
  stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h
==
--- stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Apr 13 09:02:17 2020
(r359855)
+++ stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Apr 13 09:04:32 2020
(r359856)
@@ -822,7 +822,6 @@ struct mlx5e_sq {
 
/* pointers to per packet info: write@xmit, read@completion */
struct  mlx5e_sq_mbuf *mbuf;
-   struct  buf_ring *br;
 
/* read only */
struct  mlx5_wq_cyc wq;

Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Apr 13 09:02:17 
2020(r359855)
+++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Apr 13 09:04:32 
2020(r359856)
@@ -845,7 +845,6 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv)
struct mlx5_core_dev *mdev = priv->mdev;
struct mlx5e_vport_stats *s = >stats.vport;
struct mlx5e_sq_stats *sq_stats;
-   struct buf_ring *sq_br;
 #if (__FreeBSD_version < 110)
struct ifnet *ifp = priv->ifp;
 #endif
@@ -895,13 +894,10 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv)
 
for (j = 0; j < priv->num_tc; j++) {
sq_stats = >sq[j].stats;
-   sq_br = pch->sq[j].br;
 
tso_packets += sq_stats->tso_packets;
tso_bytes += sq_stats->tso_bytes;
tx_queue_dropped += sq_stats->dropped;
-   if (sq_br != NULL)
-   tx_queue_dropped += sq_br->br_drops;
tx_defragged += sq_stats->defragged;
tx_offload_none += sq_stats->csum_offload_none;
}
___
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: r359854 - head/sys/dev/mn

2020-04-13 Thread Alexander V. Chernikov
Author: melifaro
Date: Mon Apr 13 09:01:46 2020
New Revision: 359854
URL: https://svnweb.freebsd.org/changeset/base/359854

Log:
  Remove unused 'struct rtentry' definition.

Modified:
  head/sys/dev/mn/if_mn.c

Modified: head/sys/dev/mn/if_mn.c
==
--- head/sys/dev/mn/if_mn.c Mon Apr 13 08:58:35 2020(r359853)
+++ head/sys/dev/mn/if_mn.c Mon Apr 13 09:01:46 2020(r359854)
@@ -165,7 +165,6 @@ struct m32_mem {
 
 struct mn_softc;
 struct sockaddr;
-struct rtentry;
 
 static int mn_probe(device_t self);
 static int mn_attach(device_t self);
___
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: r359855 - stable/10/sys/dev/mlx5/mlx5_en

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 09:02:17 2020
New Revision: 359855
URL: https://svnweb.freebsd.org/changeset/base/359855

Log:
  MFC r359653:
  Count number of times transmit ring is out of buffers in mlx5en(4).
  
  Differential Revision:https://reviews.freebsd.org/D24273
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/en.h
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/mlx5_en/en.h
==
--- stable/10/sys/dev/mlx5/mlx5_en/en.h Mon Apr 13 09:01:46 2020
(r359854)
+++ stable/10/sys/dev/mlx5/mlx5_en/en.h Mon Apr 13 09:02:17 2020
(r359855)
@@ -355,6 +355,7 @@ struct mlx5e_rq_stats {
   m(+1, u64 csum_offload_none, "csum_offload_none", "Transmitted packets") 
\
   m(+1, u64 defragged, "defragged", "Transmitted packets") \
   m(+1, u64 dropped, "dropped", "Transmitted packets") \
+  m(+1, u64 enobuf, "enobuf", "Transmitted packets")   \
   m(+1, u64 nop, "nop", "Transmitted packets")
 
 #defineMLX5E_SQ_STATS_NUM (0 MLX5E_SQ_STATS(MLX5E_STATS_COUNT))

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Mon Apr 13 09:01:46 2020
(r359854)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Mon Apr 13 09:02:17 2020
(r359855)
@@ -255,6 +255,7 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp)
 * of the mbuf into the drbr (see mlx5e_xmit_locked)
 */
if (unlikely(!mlx5e_sq_has_room_for(sq, 2 * MLX5_SEND_WQE_MAX_WQEBBS))) 
{
+   sq->stats.enobuf++;
return (ENOBUFS);
}
 
@@ -264,8 +265,10 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp)
/* Send one multi NOP message instead of many */
mlx5e_send_nop(sq, (pi + 1) * MLX5_SEND_WQEBB_NUM_DS);
pi = ((~sq->pc) & sq->wq.sz_m1);
-   if (pi < (MLX5_SEND_WQE_MAX_WQEBBS - 1))
+   if (pi < (MLX5_SEND_WQE_MAX_WQEBBS - 1)) {
+   sq->stats.enobuf++;
return (ENOMEM);
+   }
}
 
/* Setup local variables */
___
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: r359853 - stable/11/sys/dev/mlx5/mlx5_en

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 08:58:35 2020
New Revision: 359853
URL: https://svnweb.freebsd.org/changeset/base/359853

Log:
  MFC r359653:
  Count number of times transmit ring is out of buffers in mlx5en(4).
  
  Differential Revision:https://reviews.freebsd.org/D24273
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/dev/mlx5/mlx5_en/en.h
  stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h
==
--- stable/11/sys/dev/mlx5/mlx5_en/en.h Mon Apr 13 08:56:48 2020
(r359852)
+++ stable/11/sys/dev/mlx5/mlx5_en/en.h Mon Apr 13 08:58:35 2020
(r359853)
@@ -623,6 +623,7 @@ struct mlx5e_rq_stats {
   m(+1, u64, csum_offload_none, "csum_offload_none", "Transmitted packets")
\
   m(+1, u64, defragged, "defragged", "Transmitted packets")\
   m(+1, u64, dropped, "dropped", "Transmitted packets")
\
+  m(+1, u64, enobuf, "enobuf", "Transmitted packets")  \
   m(+1, u64, nop, "nop", "Transmitted packets")
 
 #defineMLX5E_SQ_STATS_NUM (0 MLX5E_SQ_STATS(MLX5E_STATS_COUNT))

Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
==
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Mon Apr 13 08:56:48 2020
(r359852)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Mon Apr 13 08:58:35 2020
(r359853)
@@ -265,8 +265,10 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp)
u8 opcode;
 
/* Return ENOBUFS if the queue is full */
-   if (unlikely(!mlx5e_sq_has_room_for(sq, 2 * MLX5_SEND_WQE_MAX_WQEBBS)))
+   if (unlikely(!mlx5e_sq_has_room_for(sq, 2 * MLX5_SEND_WQE_MAX_WQEBBS))) 
{
+   sq->stats.enobuf++;
return (ENOBUFS);
+   }
 
/* Align SQ edge with NOPs to avoid WQE wrap around */
pi = ((~sq->pc) & sq->wq.sz_m1);
@@ -274,8 +276,10 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp)
/* Send one multi NOP message instead of many */
mlx5e_send_nop(sq, (pi + 1) * MLX5_SEND_WQEBB_NUM_DS);
pi = ((~sq->pc) & sq->wq.sz_m1);
-   if (pi < (MLX5_SEND_WQE_MAX_WQEBBS - 1))
+   if (pi < (MLX5_SEND_WQE_MAX_WQEBBS - 1)) {
+   sq->stats.enobuf++;
return (ENOMEM);
+   }
}
 
/* Setup local variables */
___
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: r359851 - stable/12/sys/dev/mlx5/mlx5_en

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 08:56:19 2020
New Revision: 359851
URL: https://svnweb.freebsd.org/changeset/base/359851

Log:
  MFC r359653:
  Count number of times transmit ring is out of buffers in mlx5en(4).
  
  Differential Revision:https://reviews.freebsd.org/D24273
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/sys/dev/mlx5/mlx5_en/en.h
  stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h
==
--- stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Apr 13 08:45:05 2020
(r359850)
+++ stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Apr 13 08:56:19 2020
(r359851)
@@ -624,6 +624,7 @@ struct mlx5e_rq_stats {
   m(+1, u64, csum_offload_none, "csum_offload_none", "Transmitted packets")
\
   m(+1, u64, defragged, "defragged", "Transmitted packets")\
   m(+1, u64, dropped, "dropped", "Transmitted packets")
\
+  m(+1, u64, enobuf, "enobuf", "Transmitted packets")  \
   m(+1, u64, nop, "nop", "Transmitted packets")
 
 #defineMLX5E_SQ_STATS_NUM (0 MLX5E_SQ_STATS(MLX5E_STATS_COUNT))

Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
==
--- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Mon Apr 13 08:45:05 2020
(r359850)
+++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Mon Apr 13 08:56:19 2020
(r359851)
@@ -306,8 +306,10 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp)
u8 opcode;
 
/* Return ENOBUFS if the queue is full */
-   if (unlikely(!mlx5e_sq_has_room_for(sq, 2 * MLX5_SEND_WQE_MAX_WQEBBS)))
+   if (unlikely(!mlx5e_sq_has_room_for(sq, 2 * MLX5_SEND_WQE_MAX_WQEBBS))) 
{
+   sq->stats.enobuf++;
return (ENOBUFS);
+   }
 
/* Align SQ edge with NOPs to avoid WQE wrap around */
pi = ((~sq->pc) & sq->wq.sz_m1);
@@ -315,8 +317,10 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp)
/* Send one multi NOP message instead of many */
mlx5e_send_nop(sq, (pi + 1) * MLX5_SEND_WQEBB_NUM_DS);
pi = ((~sq->pc) & sq->wq.sz_m1);
-   if (pi < (MLX5_SEND_WQE_MAX_WQEBBS - 1))
+   if (pi < (MLX5_SEND_WQE_MAX_WQEBBS - 1)) {
+   sq->stats.enobuf++;
return (ENOMEM);
+   }
}
 
/* Setup local variables */
___
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: r359850 - stable/11/sys/dev/mlx5/mlx5_en

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 08:45:05 2020
New Revision: 359850
URL: https://svnweb.freebsd.org/changeset/base/359850

Log:
  MFC r359655:
  Don't drop packets having too many TCP option headers in mlx5en(4).
  
  When using SACK it can happen there are multiple option headers.
  Don't drop these packets, but instead limit the amount of inlining
  to the maximum supported.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
==
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Mon Apr 13 08:42:13 2020
(r359849)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Mon Apr 13 08:45:05 2020
(r359850)
@@ -357,18 +357,18 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp)
 
if (likely(ihs == 0)) {
/* nothing to inline */
-   } else if (unlikely(ihs > sq->max_inline)) {
-   /* inline header size is too big */
-   err = EINVAL;
-   goto tx_drop;
} else if ((mb->m_flags & M_VLANTAG) != 0) {
struct ether_vlan_header *eh = (struct ether_vlan_header *)
wqe->eth.inline_hdr_start;
 
/* Range checks */
-   if (unlikely(ihs > (MLX5E_MAX_TX_INLINE - 
ETHER_VLAN_ENCAP_LEN)))
-   ihs = (MLX5E_MAX_TX_INLINE - ETHER_VLAN_ENCAP_LEN);
-   else if (unlikely(ihs < ETHER_HDR_LEN)) {
+   if (unlikely(ihs > (sq->max_inline - ETHER_VLAN_ENCAP_LEN))) {
+   if (mb->m_pkthdr.csum_flags & CSUM_TSO) {
+   err = EINVAL;
+   goto tx_drop;
+   }
+   ihs = (sq->max_inline - ETHER_VLAN_ENCAP_LEN);
+   } else if (unlikely(ihs < ETHER_HDR_LEN)) {
err = EINVAL;
goto tx_drop;
}
@@ -385,6 +385,14 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp)
ihs += ETHER_VLAN_ENCAP_LEN;
wqe->eth.inline_hdr_sz = cpu_to_be16(ihs);
} else {
+   /* check if inline header size is too big */
+   if (unlikely(ihs > sq->max_inline)) {
+   if (unlikely(mb->m_pkthdr.csum_flags & CSUM_TSO)) {
+   err = EINVAL;
+   goto tx_drop;
+   }
+   ihs = sq->max_inline;
+   }
m_copydata(mb, 0, ihs, wqe->eth.inline_hdr_start);
m_adj(mb, ihs);
wqe->eth.inline_hdr_sz = cpu_to_be16(ihs);
___
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: r359849 - head/lib/libc/gen

2020-04-13 Thread Xin LI
Author: delphij
Date: Mon Apr 13 08:42:13 2020
New Revision: 359849
URL: https://svnweb.freebsd.org/changeset/base/359849

Log:
  Sync with OpenBSD:
  
  arc4random.c: In the incredibly unbelievable circumstance where
  _rs_init() fails to allocate pages, don't call abort() because of
  corefile data leakage concerns, but simply _exit().  The reasoning
  is _rs_init() will only fail if someone finds a way to apply
  specific pressure against this failure point, for the purpose of
  leaking information into a core which they can read.  We don't
  need a corefile in this instance to debug that.  So take this
  "lever" away from whoever in the future wants to do that.
  
  arc4random.3: reference random(4)
  
  arc4random_uniform.c: include stdint.h over sys/types.h

Modified:
  head/lib/libc/gen/arc4random.3
  head/lib/libc/gen/arc4random.c
  head/lib/libc/gen/arc4random_uniform.c

Modified: head/lib/libc/gen/arc4random.3
==
--- head/lib/libc/gen/arc4random.3  Mon Apr 13 08:41:24 2020
(r359848)
+++ head/lib/libc/gen/arc4random.3  Mon Apr 13 08:42:13 2020
(r359849)
@@ -1,4 +1,4 @@
-.\" $OpenBSD: arc4random.3,v 1.35 2014/11/25 16:45:24 millert Exp $
+.\" $OpenBSD: arc4random.3,v 1.37 2019/09/29 16:30:35 jmc Exp $
 .\"
 .\" Copyright 1997 Niels Provos 
 .\" All rights reserved.
@@ -31,7 +31,7 @@
 .\" Manual page, using -mandoc macros
 .\" $FreeBSD$
 .\"
-.Dd April 10, 2020
+.Dd April 13, 2020
 .Dt ARC4RANDOM 3
 .Os
 .Sh NAME
@@ -71,7 +71,9 @@ On each call, a cryptographic pseudo-random number gen
 to generate a new result.
 One data pool is used for all consumers in a process, so that consumption
 under program flow can act as additional stirring.
-The subsystem is re-seeded from the kernel random number subsystem using
+The subsystem is re-seeded from the kernel
+.Xr random 4
+subsystem using
 .Xr getentropy 2
 on a regular basis, and also upon
 .Xr fork 2 .

Modified: head/lib/libc/gen/arc4random.c
==
--- head/lib/libc/gen/arc4random.c  Mon Apr 13 08:41:24 2020
(r359848)
+++ head/lib/libc/gen/arc4random.c  Mon Apr 13 08:42:13 2020
(r359849)
@@ -1,4 +1,4 @@
-/* $OpenBSD: arc4random.c,v 1.54 2015/09/13 08:31:47 guenther Exp $
*/
+/* $OpenBSD: arc4random.c,v 1.55 2019/03/24 17:56:54 deraadt Exp $ */
 
 /*
  * Copyright (c) 1996, David Mazieres 
@@ -84,7 +84,7 @@ _rs_init(u_char *buf, size_t n)
 
if (rs == NULL) {
if (_rs_allocate(, ) == -1)
-   abort();
+   _exit(1);
}
 
chacha_keysetup(>rs_chacha, buf, KEYSZ * 8);

Modified: head/lib/libc/gen/arc4random_uniform.c
==
--- head/lib/libc/gen/arc4random_uniform.c  Mon Apr 13 08:41:24 2020
(r359848)
+++ head/lib/libc/gen/arc4random_uniform.c  Mon Apr 13 08:42:13 2020
(r359849)
@@ -1,4 +1,4 @@
-/* $OpenBSD: arc4random_uniform.c,v 1.2 2015/09/13 08:31:47 guenther Exp $ 
*/
+/* $OpenBSD: arc4random_uniform.c,v 1.3 2019/01/20 02:59:07 bcook Exp $
*/
 
 /*
  * Copyright (c) 2008, Damien Miller 
@@ -18,7 +18,7 @@
  * $FreeBSD$
  */
 
-#include 
+#include 
 #include 
 
 /*
___
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: r359848 - stable/12/sys/dev/mlx5/mlx5_en

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 08:41:24 2020
New Revision: 359848
URL: https://svnweb.freebsd.org/changeset/base/359848

Log:
  MFC r359655:
  Don't drop packets having too many TCP option headers in mlx5en(4).
  
  When using SACK it can happen there are multiple option headers.
  Don't drop these packets, but instead limit the amount of inlining
  to the maximum supported.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
==
--- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Mon Apr 13 08:33:49 2020
(r359847)
+++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Mon Apr 13 08:41:24 2020
(r359848)
@@ -398,18 +398,18 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp)
 
if (likely(ihs == 0)) {
/* nothing to inline */
-   } else if (unlikely(ihs > sq->max_inline)) {
-   /* inline header size is too big */
-   err = EINVAL;
-   goto tx_drop;
} else if ((mb->m_flags & M_VLANTAG) != 0) {
struct ether_vlan_header *eh = (struct ether_vlan_header *)
wqe->eth.inline_hdr_start;
 
/* Range checks */
-   if (unlikely(ihs > (MLX5E_MAX_TX_INLINE - 
ETHER_VLAN_ENCAP_LEN)))
-   ihs = (MLX5E_MAX_TX_INLINE - ETHER_VLAN_ENCAP_LEN);
-   else if (unlikely(ihs < ETHER_HDR_LEN)) {
+   if (unlikely(ihs > (sq->max_inline - ETHER_VLAN_ENCAP_LEN))) {
+   if (mb->m_pkthdr.csum_flags & CSUM_TSO) {
+   err = EINVAL;
+   goto tx_drop;
+   }
+   ihs = (sq->max_inline - ETHER_VLAN_ENCAP_LEN);
+   } else if (unlikely(ihs < ETHER_HDR_LEN)) {
err = EINVAL;
goto tx_drop;
}
@@ -426,6 +426,14 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp)
ihs += ETHER_VLAN_ENCAP_LEN;
wqe->eth.inline_hdr_sz = cpu_to_be16(ihs);
} else {
+   /* check if inline header size is too big */
+   if (unlikely(ihs > sq->max_inline)) {
+   if (unlikely(mb->m_pkthdr.csum_flags & CSUM_TSO)) {
+   err = EINVAL;
+   goto tx_drop;
+   }
+   ihs = sq->max_inline;
+   }
m_copydata(mb, 0, ihs, wqe->eth.inline_hdr_start);
m_adj(mb, ihs);
wqe->eth.inline_hdr_sz = cpu_to_be16(ihs);
___
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: r359847 - stable/10/sys/dev/mlx5/mlx5_en

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 08:33:49 2020
New Revision: 359847
URL: https://svnweb.freebsd.org/changeset/base/359847

Log:
  MFC r359654:
  Ensure a minimum inline size of 16 bytes in mlx5en(4).
  
  This includes 14 bytes of ethernet header and 2 bytes of VLAN header.
  
  This allows for making assumptions about the inline size limit
  in the fast transmit path later on.
  
  Use a signed integer variable to catch underflow.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Apr 13 08:28:02 
2020(r359846)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Apr 13 08:33:49 
2020(r359847)
@@ -2880,11 +2880,19 @@ mlx5e_check_required_hca_cap(struct mlx5_core_dev *mde
 static u16
 mlx5e_get_max_inline_cap(struct mlx5_core_dev *mdev)
 {
-   int bf_buf_size = (1 << MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2;
+   const int min_size = ETHER_VLAN_ENCAP_LEN + ETHER_HDR_LEN;
+   const int max_size = MLX5E_MAX_TX_INLINE;
+   const int bf_buf_size =
+   ((1U << MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2U) -
+   (sizeof(struct mlx5e_tx_wqe) - 2);
 
-   return bf_buf_size -
-  sizeof(struct mlx5e_tx_wqe) +
-  2 /*sizeof(mlx5e_tx_wqe.inline_hdr_start)*/;
+   /* verify against driver limits */
+   if (bf_buf_size > max_size)
+   return (max_size);
+   else if (bf_buf_size < min_size)
+   return (min_size);
+   else
+   return (bf_buf_size);
 }
 
 static 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: r359846 - stable/11/sys/dev/mlx5/mlx5_en

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 08:28:02 2020
New Revision: 359846
URL: https://svnweb.freebsd.org/changeset/base/359846

Log:
  MFC r359654:
  Ensure a minimum inline size of 16 bytes in mlx5en(4).
  
  This includes 14 bytes of ethernet header and 2 bytes of VLAN header.
  
  This allows for making assumptions about the inline size limit
  in the fast transmit path later on.
  
  Use a signed integer variable to catch underflow.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Apr 13 08:27:19 
2020(r359845)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Apr 13 08:28:02 
2020(r359846)
@@ -3351,15 +3351,19 @@ mlx5e_check_required_hca_cap(struct mlx5_core_dev *mde
 static u16
 mlx5e_get_max_inline_cap(struct mlx5_core_dev *mdev)
 {
-   uint32_t bf_buf_size = (1U << MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2U;
+   const int min_size = ETHER_VLAN_ENCAP_LEN + ETHER_HDR_LEN;
+   const int max_size = MLX5E_MAX_TX_INLINE;
+   const int bf_buf_size =
+   ((1U << MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2U) -
+   (sizeof(struct mlx5e_tx_wqe) - 2);
 
-   bf_buf_size -= sizeof(struct mlx5e_tx_wqe) - 2;
-
-   /* verify against driver hardware limit */
-   if (bf_buf_size > MLX5E_MAX_TX_INLINE)
-   bf_buf_size = MLX5E_MAX_TX_INLINE;
-
-   return (bf_buf_size);
+   /* verify against driver limits */
+   if (bf_buf_size > max_size)
+   return (max_size);
+   else if (bf_buf_size < min_size)
+   return (min_size);
+   else
+   return (bf_buf_size);
 }
 
 static int
___
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: r359845 - stable/12/sys/dev/mlx5/mlx5_en

2020-04-13 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 13 08:27:19 2020
New Revision: 359845
URL: https://svnweb.freebsd.org/changeset/base/359845

Log:
  MFC r359654:
  Ensure a minimum inline size of 16 bytes in mlx5en(4).
  
  This includes 14 bytes of ethernet header and 2 bytes of VLAN header.
  
  This allows for making assumptions about the inline size limit
  in the fast transmit path later on.
  
  Use a signed integer variable to catch underflow.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Apr 13 08:26:11 
2020(r359844)
+++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Apr 13 08:27:19 
2020(r359845)
@@ -3479,15 +3479,19 @@ mlx5e_check_required_hca_cap(struct mlx5_core_dev *mde
 static u16
 mlx5e_get_max_inline_cap(struct mlx5_core_dev *mdev)
 {
-   uint32_t bf_buf_size = (1U << MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2U;
+   const int min_size = ETHER_VLAN_ENCAP_LEN + ETHER_HDR_LEN;
+   const int max_size = MLX5E_MAX_TX_INLINE;
+   const int bf_buf_size =
+   ((1U << MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2U) -
+   (sizeof(struct mlx5e_tx_wqe) - 2);
 
-   bf_buf_size -= sizeof(struct mlx5e_tx_wqe) - 2;
-
-   /* verify against driver hardware limit */
-   if (bf_buf_size > MLX5E_MAX_TX_INLINE)
-   bf_buf_size = MLX5E_MAX_TX_INLINE;
-
-   return (bf_buf_size);
+   /* verify against driver limits */
+   if (bf_buf_size > max_size)
+   return (max_size);
+   else if (bf_buf_size < min_size)
+   return (min_size);
+   else
+   return (bf_buf_size);
 }
 
 static int
___
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: r359844 - head/sys/netinet6

2020-04-13 Thread Alexander V. Chernikov
Author: melifaro
Date: Mon Apr 13 08:26:11 2020
New Revision: 359844
URL: https://svnweb.freebsd.org/changeset/base/359844

Log:
  Remove tcp_rtlookup6() function signature.
   The function itself was removed in r122922 16 years ago.

Modified:
  head/sys/netinet6/tcp6_var.h

Modified: head/sys/netinet6/tcp6_var.h
==
--- head/sys/netinet6/tcp6_var.hMon Apr 13 00:50:35 2020
(r359843)
+++ head/sys/netinet6/tcp6_var.hMon Apr 13 08:26:11 2020
(r359844)
@@ -76,7 +76,6 @@ structip6_hdr;
 void   tcp6_ctlinput(int, struct sockaddr *, void *);
 void   tcp6_init(void);
 inttcp6_input(struct mbuf **, int *, int);
-struct rtentry *tcp_rtlookup6(struct in_conninfo *);
 
 extern struct  pr_usrreqs tcp6_usrreqs;
 
___
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"