svn commit: r306227 - svnadmin/conf

2016-09-23 Thread Matthew Seaman
Author: matthew (ports committer)
Date: Fri Sep 23 07:06:39 2016
New Revision: 306227
URL: https://svnweb.freebsd.org/changeset/base/306227

Log:
  Take in erwin's commit bit at his own request
  
  Approved by:  core (implicit)

Modified:
  svnadmin/conf/access

Modified: svnadmin/conf/access
==
--- svnadmin/conf/accessFri Sep 23 06:51:46 2016(r306226)
+++ svnadmin/conf/accessFri Sep 23 07:06:39 2016(r306227)
@@ -81,7 +81,6 @@ emaste
 emax
 eri
 erj
-erwin
 fabient
 fanf
 fjoe
___
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: r306228 - head/sys/fs/cuse

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 07:41:23 2016
New Revision: 306228
URL: https://svnweb.freebsd.org/changeset/base/306228

Log:
  Prevent cuse4bsd.ko and cuse.ko from loading at the same time by
  declaring support for the cuse4bsd interface in cuse.ko.
  
  Found by: Sergey V. Dyatko 
  MFC after:1 week

Modified:
  head/sys/fs/cuse/cuse.c

Modified: head/sys/fs/cuse/cuse.c
==
--- head/sys/fs/cuse/cuse.c Fri Sep 23 07:06:39 2016(r306227)
+++ head/sys/fs/cuse/cuse.c Fri Sep 23 07:41:23 2016(r306228)
@@ -63,6 +63,12 @@
 
 MODULE_VERSION(cuse, 1);
 
+/*
+ * Prevent cuse4bsd.ko and cuse.ko from loading at the same time by
+ * declaring support for the cuse4bsd interface in cuse.ko:
+ */
+MODULE_VERSION(cuse4bsd, 1);
+
 #defineNBUSY   ((uint8_t *)1)
 
 #ifdef FEATURE
___
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: r306229 - in stable/9/crypto/openssl: crypto/bn crypto/dsa crypto/mdc2 ssl

2016-09-23 Thread Xin LI
Author: delphij
Date: Fri Sep 23 07:44:10 2016
New Revision: 306229
URL: https://svnweb.freebsd.org/changeset/base/306229

Log:
  Fix multiple OpenSSL vulnerabilities.
  
  Security: FreeBSD-SA-16:26.openssl

Modified:
  stable/9/crypto/openssl/crypto/bn/bn_print.c
  stable/9/crypto/openssl/crypto/dsa/dsa_ossl.c
  stable/9/crypto/openssl/crypto/mdc2/mdc2dgst.c
  stable/9/crypto/openssl/ssl/d1_both.c
  stable/9/crypto/openssl/ssl/d1_clnt.c
  stable/9/crypto/openssl/ssl/d1_lib.c
  stable/9/crypto/openssl/ssl/d1_pkt.c
  stable/9/crypto/openssl/ssl/d1_srvr.c
  stable/9/crypto/openssl/ssl/s3_clnt.c
  stable/9/crypto/openssl/ssl/s3_srvr.c
  stable/9/crypto/openssl/ssl/ssl.h
  stable/9/crypto/openssl/ssl/ssl_err.c
  stable/9/crypto/openssl/ssl/ssl_locl.h
  stable/9/crypto/openssl/ssl/ssl_sess.c
  stable/9/crypto/openssl/ssl/t1_lib.c

Modified: stable/9/crypto/openssl/crypto/bn/bn_print.c
==
--- stable/9/crypto/openssl/crypto/bn/bn_print.cFri Sep 23 07:41:23 
2016(r306228)
+++ stable/9/crypto/openssl/crypto/bn/bn_print.cFri Sep 23 07:44:10 
2016(r306229)
@@ -111,6 +111,7 @@ char *BN_bn2dec(const BIGNUM *a)
 char *p;
 BIGNUM *t = NULL;
 BN_ULONG *bn_data = NULL, *lp;
+int bn_data_num;
 
 /*-
  * get an upper bound for the length of the decimal integer
@@ -120,8 +121,8 @@ char *BN_bn2dec(const BIGNUM *a)
  */
 i = BN_num_bits(a) * 3;
 num = (i / 10 + i / 1000 + 1) + 1;
-bn_data =
-(BN_ULONG *)OPENSSL_malloc((num / BN_DEC_NUM + 1) * sizeof(BN_ULONG));
+bn_data_num = num / BN_DEC_NUM + 1;
+bn_data = OPENSSL_malloc(bn_data_num * sizeof(BN_ULONG));
 buf = (char *)OPENSSL_malloc(num + 3);
 if ((buf == NULL) || (bn_data == NULL)) {
 BNerr(BN_F_BN_BN2DEC, ERR_R_MALLOC_FAILURE);
@@ -143,7 +144,11 @@ char *BN_bn2dec(const BIGNUM *a)
 i = 0;
 while (!BN_is_zero(t)) {
 *lp = BN_div_word(t, BN_DEC_CONV);
+if (*lp == (BN_ULONG)-1)
+goto err;
 lp++;
+if (lp - bn_data >= bn_data_num)
+goto err;
 }
 lp--;
 /*

Modified: stable/9/crypto/openssl/crypto/dsa/dsa_ossl.c
==
--- stable/9/crypto/openssl/crypto/dsa/dsa_ossl.c   Fri Sep 23 07:41:23 
2016(r306228)
+++ stable/9/crypto/openssl/crypto/dsa/dsa_ossl.c   Fri Sep 23 07:44:10 
2016(r306229)
@@ -235,11 +235,13 @@ static int dsa_sign_setup(DSA *dsa, BN_C
 do
 if (!BN_rand_range(&k, dsa->q))
 goto err;
-while (BN_is_zero(&k)) ;
+while (BN_is_zero(&k));
+
 if ((dsa->flags & DSA_FLAG_NO_EXP_CONSTTIME) == 0) {
 BN_set_flags(&k, BN_FLG_CONSTTIME);
 }
 
+
 if (dsa->flags & DSA_FLAG_CACHE_MONT_P) {
 if (!BN_MONT_CTX_set_locked(&dsa->method_mont_p,
 CRYPTO_LOCK_DSA, dsa->p, ctx))
@@ -252,6 +254,8 @@ static int dsa_sign_setup(DSA *dsa, BN_C
 if (!BN_copy(&kq, &k))
 goto err;
 
+BN_set_flags(&kq, BN_FLG_CONSTTIME);
+
 /*
  * We do not want timing information to leak the length of k, so we
  * compute g^k using an equivalent exponent of fixed length. (This
@@ -270,6 +274,7 @@ static int dsa_sign_setup(DSA *dsa, BN_C
 } else {
 K = &k;
 }
+
 DSA_BN_MOD_EXP(goto err, dsa, r, dsa->g, K, dsa->p, ctx,
dsa->method_mont_p);
 if (!BN_mod(r, r, dsa->q, ctx))

Modified: stable/9/crypto/openssl/crypto/mdc2/mdc2dgst.c
==
--- stable/9/crypto/openssl/crypto/mdc2/mdc2dgst.c  Fri Sep 23 07:41:23 
2016(r306228)
+++ stable/9/crypto/openssl/crypto/mdc2/mdc2dgst.c  Fri Sep 23 07:44:10 
2016(r306229)
@@ -94,7 +94,7 @@ int MDC2_Update(MDC2_CTX *c, const unsig
 
 i = c->num;
 if (i != 0) {
-if (i + len < MDC2_BLOCK) {
+if (len < MDC2_BLOCK - i) {
 /* partial block */
 memcpy(&(c->data[i]), in, len);
 c->num += (int)len;

Modified: stable/9/crypto/openssl/ssl/d1_both.c
==
--- stable/9/crypto/openssl/ssl/d1_both.c   Fri Sep 23 07:41:23 2016
(r306228)
+++ stable/9/crypto/openssl/ssl/d1_both.c   Fri Sep 23 07:44:10 2016
(r306229)
@@ -543,11 +543,23 @@ static int dtls1_retrieve_buffered_fragm
 int al;
 
 *ok = 0;
-item = pqueue_peek(s->d1->buffered_messages);
-if (item == NULL)
-return 0;
+do {
+item = pqueue_peek(s->d1->buffered_messages);
+if (item == NULL)
+return 0;
+
+frag = (hm_fragment *)item->data;
+
+if (frag->msg_header.seq < s->d1->handshake_read_seq) {
+/* This is a stale message that has b

Re: svn commit: r306174 - in head/sys: compat/cloudabi compat/linux kern netinet sys

2016-09-23 Thread Ruslan Bukin
Hi

It is booting fine with patch.

Thanks!

Ruslan

On Fri, Sep 23, 2016 at 12:34:40AM +0200, Mariusz Zaborski wrote:
> Thanks, I was able to reproduce that :)
> I attached the patch. Could you please confirm that it fix the problem?
> 
> Thank you and sorry for inconveniences,
> Mariusz
> 
> On 22 September 2016 at 18:11, Ruslan Bukin  wrote:
> > I have just tested this with MIPS64EL and the result is the same.
> > So you can try both EL or EB
> >
> > e.g. make -j16 TARGET=mips TARGET_ARCH=mips64el KERNCONF=MALTA64 buildkernel
> >
> > Ruslan
> >
> > On Thu, Sep 22, 2016 at 03:21:53PM +, Ruslan Bukin wrote:
> >> Hi
> >>
> >> It reports nothing. Yes I use qemu:
> >> /home/rb743/dev/qemu/qemu/build1/mips64-softmmu/qemu-system-mips64 -M 
> >> malta -kernel 
> >> ~/obj/mips.mips64/home/rb743/dev/freebsd-mips/sys/MALTA64/kernel -hda 
> >> /home/rb743/world-mips64eb/mips64eb.img -nographic -smp 1 -cpu 5kf -net 
> >> nic -net user -m 2048M -redir tcp:4022::22
> >>
> >> Ruslan
> >>
> >> On Thu, Sep 22, 2016 at 05:11:07PM +0200, Mariusz Zaborski wrote:
> >> > I tested it on the mips for Malta kernel and it's works fine. I will
> >> > try to do it on mips64, are you using qemu to test it?
> >> > What is ctrl + t reporting you?
> >> >
> >> >
> >> > On 22 September 2016 at 16:56, Ruslan Bukin  
> >> > wrote:
> >> > > May be. The next line should be
> >> > > /etc/rc: WARNING: $hostname is not set -- see rc.conf(5).
> >> > >
> >> > > but it hangs before this line
> >> > >
> >> > > Ruslan
> >> > >
> >> > > On Thu, Sep 22, 2016 at 04:39:16PM +0200, Mariusz Zaborski wrote:
> >> > >> Hi Ruslan,
> >> > >>
> >> > >> Does it hang on some network script?
> >> > >>
> >> > >> Thanks,
> >> > >> Mariusz
> >> > >>
> >> > >>
> >> > >> On 22 September 2016 at 16:34, Ruslan Bukin 
> >> > >>  wrote:
> >> > >> > Hi Mariusz
> >> > >> >
> >> > >> > my MIPS64EB kernel stops booting with this
> >> > >> >
> >> > >> > somewhere here:
> >> > >> > [...]
> >> > >> > Starting file system checks:
> >> > >> > /dev/ada0: 20369 files, 794696 used, 7573573 free (933 frags, 
> >> > >> > 946580 blocks, 0.0% fragmentation)
> >> > >> > Mounting local filesystems:.
> >> > >> > ELF ldconfig path: /lib /usr/lib /usr/lib/compat
> >> > >> > random: unblocking device.
> >> > >> >
> >> > >> > any idea ? (should I rebuild something?)
> >> > >> >
> >> > >> > thanks!
> >> > >> >
> >> > >> > Ruslan
> >> > >> >
> >> > >> > On Thu, Sep 22, 2016 at 09:58:46AM +, Mariusz Zaborski wrote:
> >> > >> >> Author: oshogbo
> >> > >> >> Date: Thu Sep 22 09:58:46 2016
> >> > >> >> New Revision: 306174
> >> > >> >> URL: https://svnweb.freebsd.org/changeset/base/306174
> >> > >> >>
> >> > >> >> Log:
> >> > >> >>   capsicum: propagate rights on accept(2)
> >> > >> >>
> >> > >> >>   Descriptor returned by accept(2) should inherits capabilities 
> >> > >> >> rights from
> >> > >> >>   the listening socket.
> >> > >> >>
> >> > >> >>   PR: 201052
> >> > >> >>   Reviewed by:emaste, jonathan
> >> > >> >>   Discussed with: many
> >> > >> >>   Differential Revision:  https://reviews.freebsd.org/D7724
> >> > >> >>
> >> > >> >> Modified:
> >> > >> >>   head/sys/compat/cloudabi/cloudabi_sock.c
> >> > >> >>   head/sys/compat/linux/linux_socket.c
> >> > >> >>   head/sys/kern/kern_sendfile.c
> >> > >> >>   head/sys/kern/uipc_syscalls.c
> >> > >> >>   head/sys/netinet/sctp_syscalls.c
> >> > >> >>   head/sys/sys/socketvar.h
> >> > >> >>
> >> > >> >> Modified: head/sys/compat/cloudabi/cloudabi_sock.c
> >> > >> >> ==
> >> > >> >> --- head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:33:22 
> >> > >> >> 2016(r306173)
> >> > >> >> +++ head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:58:46 
> >> > >> >> 2016(r306174)
> >> > >> >> @@ -210,7 +210,7 @@ cloudabi_sys_sock_stat_get(struct thread
> >> > >> >>   int error;
> >> > >> >>
> >> > >> >>   error = getsock_cap(td, uap->sock, cap_rights_init(&rights,
> >> > >> >> - CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), &fp, 
> >> > >> >> NULL);
> >> > >> >> + CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), &fp, 
> >> > >> >> NULL, NULL);
> >> > >> >>   if (error != 0)
> >> > >> >>   return (error);
> >> > >> >>   so = fp->f_data;
> >> > >> >>
> >> > >> >> Modified: head/sys/compat/linux/linux_socket.c
> >> > >> >> ==
> >> > >> >> --- head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:33:22 
> >> > >> >> 2016(r306173)
> >> > >> >> +++ head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:58:46 
> >> > >> >> 2016(r306174)
> >> > >> >> @@ -855,7 +855,7 @@ linux_accept_common(struct thread *td, i
> >> > >> >>   if (error == EFAULT && namelen != sizeof(struct 
> >> > >> >> sockaddr_in))
> >> > >> >>   return (EINVAL);
> >> > >> >>   if (err

svn commit: r306230 - in releng: 10.1 10.1/crypto/openssl/crypto/bn 10.1/crypto/openssl/crypto/dsa 10.1/crypto/openssl/crypto/mdc2 10.1/crypto/openssl/crypto/ts 10.1/crypto/openssl/ssl 10.1/sys/con...

2016-09-23 Thread Xin LI
Author: delphij
Date: Fri Sep 23 07:48:34 2016
New Revision: 306230
URL: https://svnweb.freebsd.org/changeset/base/306230

Log:
  Fix multiple OpenSSL vulnerabilitites.
  
  Approved by:  so
  Security: FreeBSD-SA-16:26.openssl

Modified:
  releng/10.1/UPDATING
  releng/10.1/crypto/openssl/crypto/bn/bn_print.c
  releng/10.1/crypto/openssl/crypto/dsa/dsa_ossl.c
  releng/10.1/crypto/openssl/crypto/mdc2/mdc2dgst.c
  releng/10.1/crypto/openssl/crypto/ts/ts_lib.c
  releng/10.1/crypto/openssl/ssl/d1_both.c
  releng/10.1/crypto/openssl/ssl/d1_clnt.c
  releng/10.1/crypto/openssl/ssl/d1_lib.c
  releng/10.1/crypto/openssl/ssl/d1_pkt.c
  releng/10.1/crypto/openssl/ssl/d1_srvr.c
  releng/10.1/crypto/openssl/ssl/s3_clnt.c
  releng/10.1/crypto/openssl/ssl/s3_srvr.c
  releng/10.1/crypto/openssl/ssl/ssl.h
  releng/10.1/crypto/openssl/ssl/ssl_err.c
  releng/10.1/crypto/openssl/ssl/ssl_locl.h
  releng/10.1/crypto/openssl/ssl/ssl_sess.c
  releng/10.1/crypto/openssl/ssl/t1_lib.c
  releng/10.1/sys/conf/newvers.sh
  releng/10.2/UPDATING
  releng/10.2/crypto/openssl/crypto/bn/bn_print.c
  releng/10.2/crypto/openssl/crypto/dsa/dsa_ossl.c
  releng/10.2/crypto/openssl/crypto/mdc2/mdc2dgst.c
  releng/10.2/crypto/openssl/crypto/ts/ts_lib.c
  releng/10.2/crypto/openssl/ssl/d1_both.c
  releng/10.2/crypto/openssl/ssl/d1_clnt.c
  releng/10.2/crypto/openssl/ssl/d1_lib.c
  releng/10.2/crypto/openssl/ssl/d1_pkt.c
  releng/10.2/crypto/openssl/ssl/d1_srvr.c
  releng/10.2/crypto/openssl/ssl/s3_clnt.c
  releng/10.2/crypto/openssl/ssl/s3_srvr.c
  releng/10.2/crypto/openssl/ssl/ssl.h
  releng/10.2/crypto/openssl/ssl/ssl_err.c
  releng/10.2/crypto/openssl/ssl/ssl_locl.h
  releng/10.2/crypto/openssl/ssl/ssl_sess.c
  releng/10.2/crypto/openssl/ssl/t1_lib.c
  releng/10.2/sys/conf/newvers.sh
  releng/10.3/UPDATING
  releng/10.3/crypto/openssl/crypto/bn/bn_print.c
  releng/10.3/crypto/openssl/crypto/dsa/dsa_ossl.c
  releng/10.3/crypto/openssl/crypto/mdc2/mdc2dgst.c
  releng/10.3/crypto/openssl/crypto/ts/ts_lib.c
  releng/10.3/crypto/openssl/ssl/d1_both.c
  releng/10.3/crypto/openssl/ssl/d1_clnt.c
  releng/10.3/crypto/openssl/ssl/d1_lib.c
  releng/10.3/crypto/openssl/ssl/d1_pkt.c
  releng/10.3/crypto/openssl/ssl/d1_srvr.c
  releng/10.3/crypto/openssl/ssl/s3_clnt.c
  releng/10.3/crypto/openssl/ssl/s3_srvr.c
  releng/10.3/crypto/openssl/ssl/ssl.h
  releng/10.3/crypto/openssl/ssl/ssl_err.c
  releng/10.3/crypto/openssl/ssl/ssl_locl.h
  releng/10.3/crypto/openssl/ssl/ssl_sess.c
  releng/10.3/crypto/openssl/ssl/t1_lib.c
  releng/10.3/sys/conf/newvers.sh
  releng/9.3/UPDATING
  releng/9.3/crypto/openssl/crypto/bn/bn_print.c
  releng/9.3/crypto/openssl/crypto/dsa/dsa_ossl.c
  releng/9.3/crypto/openssl/crypto/mdc2/mdc2dgst.c
  releng/9.3/crypto/openssl/ssl/d1_both.c
  releng/9.3/crypto/openssl/ssl/d1_clnt.c
  releng/9.3/crypto/openssl/ssl/d1_lib.c
  releng/9.3/crypto/openssl/ssl/d1_pkt.c
  releng/9.3/crypto/openssl/ssl/d1_srvr.c
  releng/9.3/crypto/openssl/ssl/s3_clnt.c
  releng/9.3/crypto/openssl/ssl/s3_srvr.c
  releng/9.3/crypto/openssl/ssl/ssl.h
  releng/9.3/crypto/openssl/ssl/ssl_err.c
  releng/9.3/crypto/openssl/ssl/ssl_locl.h
  releng/9.3/crypto/openssl/ssl/ssl_sess.c
  releng/9.3/crypto/openssl/ssl/t1_lib.c
  releng/9.3/sys/conf/newvers.sh

Modified: releng/10.1/UPDATING
==
--- releng/10.1/UPDATINGFri Sep 23 07:44:10 2016(r306229)
+++ releng/10.1/UPDATINGFri Sep 23 07:48:34 2016(r306230)
@@ -16,6 +16,10 @@ from older versions of FreeBSD, try WITH
 stable/10, and then rebuild without this option. The bootstrap process from
 older version of current is a bit fragile.
 
+20160923   p38 FreeBSD-SA-16:26.openssl
+
+   Fix multiple OpenSSL vulnerabilitites.
+
 20160725   p37 FreeBSD-SA-16:25.bspatch
FreeBSD-EN-16:09.freebsd-update
 

Modified: releng/10.1/crypto/openssl/crypto/bn/bn_print.c
==
--- releng/10.1/crypto/openssl/crypto/bn/bn_print.c Fri Sep 23 07:44:10 
2016(r306229)
+++ releng/10.1/crypto/openssl/crypto/bn/bn_print.c Fri Sep 23 07:48:34 
2016(r306230)
@@ -111,6 +111,7 @@ char *BN_bn2dec(const BIGNUM *a)
 char *p;
 BIGNUM *t = NULL;
 BN_ULONG *bn_data = NULL, *lp;
+int bn_data_num;
 
 /*-
  * get an upper bound for the length of the decimal integer
@@ -120,8 +121,8 @@ char *BN_bn2dec(const BIGNUM *a)
  */
 i = BN_num_bits(a) * 3;
 num = (i / 10 + i / 1000 + 1) + 1;
-bn_data =
-(BN_ULONG *)OPENSSL_malloc((num / BN_DEC_NUM + 1) * sizeof(BN_ULONG));
+bn_data_num = num / BN_DEC_NUM + 1;
+bn_data = OPENSSL_malloc(bn_data_num * sizeof(BN_ULONG));
 buf = (char *)OPENSSL_malloc(num + 3);
 if ((buf == NULL) || (bn_data == NULL)) {
 BNerr(BN_F_BN_BN2DEC, ERR_R_MALLOC_FAILURE);
@@ -143,7 +144,11 @@ char *BN_bn2dec(const BIGNUM *a

svn commit: r306231 - head/tests/etc/rc.d

2016-09-23 Thread Ruslan Bukin
Author: br
Date: Fri Sep 23 07:51:01 2016
New Revision: 306231
URL: https://svnweb.freebsd.org/changeset/base/306231

Log:
  Check if IPv6 supported before running the test, skip otherwise.
  
  Sponsored by: DARPA, AFRL
  Sponsored by: HEIF5

Modified:
  head/tests/etc/rc.d/routing_test.sh

Modified: head/tests/etc/rc.d/routing_test.sh
==
--- head/tests/etc/rc.d/routing_test.sh Fri Sep 23 07:48:34 2016
(r306230)
+++ head/tests/etc/rc.d/routing_test.sh Fri Sep 23 07:51:01 2016
(r306231)
@@ -58,6 +58,10 @@ static_ipv6_loopback_route_for_each_fib_
local nfibs fib
nfibs=`sysctl -n net.fibs`
 
+   if [ "`sysctl -in kern.features.inet6`" != "1" ]; then
+   atf_skip "This test requires IPv6 support"
+   fi
+
# Check for an IPv6 loopback route
for fib in `seq 0 $((${nfibs} - 1))`; do
atf_check -o match:"interface: lo0" -s exit: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: r306232 - head/sys/kern

2016-09-23 Thread Mariusz Zaborski
Author: oshogbo
Date: Fri Sep 23 08:13:46 2016
New Revision: 306232
URL: https://svnweb.freebsd.org/changeset/base/306232

Log:
  fd: fix up fget_cap
  
  If the kernel is not compiled with the CAPABILITIES kernel options
  fget_unlocked doesn't return the sequence number so fd_modify will
  always report modification, in that case we got infinity loop.
  
  Reported by:  br
  Reviewed by:  mjg
  Tested by:br, def

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cFri Sep 23 07:51:01 2016
(r306231)
+++ head/sys/kern/kern_descrip.cFri Sep 23 08:13:46 2016
(r306232)
@@ -2480,12 +2480,16 @@ int
 fget_cap(struct thread *td, int fd, cap_rights_t *needrightsp,
 struct file **fpp, struct filecaps *havecapsp)
 {
-   struct filedesc *fdp;
-   struct file *fp;
+   struct filedesc *fdp = td->td_proc->p_fd;
int error;
+#ifndef CAPABILITIES
+   error = fget_unlocked(fdp, fd, needrightsp, fpp, NULL);
+   if (error == 0 && havecapsp != NULL)
+   filecaps_fill(havecapsp);
+#else
+   struct file *fp;
seq_t seq;
 
-   fdp = td->td_proc->p_fd;
for (;;) {
error = fget_unlocked(fdp, fd, needrightsp, &fp, &seq);
if (error != 0)
@@ -2513,7 +2517,7 @@ get_locked:
if (error == 0)
fhold(*fpp);
FILEDESC_SUNLOCK(fdp);
-
+#endif
return (error);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r306233 - in stable/11/sys/dev/mlx5: . mlx5_core mlx5_en

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 08:17:51 2016
New Revision: 306233
URL: https://svnweb.freebsd.org/changeset/base/306233

Log:
  MFC r305867:
  Update the MLX5 core module:
  - Add new firmware commands and update existing ones.
  - Add more firmware related structures and update existing ones.
  - Some minor fixes, like adding missing \n to some prints.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/dev/mlx5/cq.h
  stable/11/sys/dev/mlx5/device.h
  stable/11/sys/dev/mlx5/driver.h
  stable/11/sys/dev/mlx5/flow_table.h
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_cq.c
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_eswitch_vacl.c
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_flow_table.c
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_fw.c
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_mr.c
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_qp.c
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_srq.c
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_transobj.c
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_uar.c
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c
  stable/11/sys/dev/mlx5/mlx5_core/transobj.h
  stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c
  stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  stable/11/sys/dev/mlx5/mlx5_ifc.h
  stable/11/sys/dev/mlx5/qp.h
  stable/11/sys/dev/mlx5/vport.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mlx5/cq.h
==
--- stable/11/sys/dev/mlx5/cq.h Fri Sep 23 08:13:46 2016(r306232)
+++ stable/11/sys/dev/mlx5/cq.h Fri Sep 23 08:17:51 2016(r306233)
@@ -49,6 +49,8 @@ struct mlx5_core_cq {
unsignedarm_sn;
struct mlx5_rsc_debug   *dbg;
int pid;
+   int reset_notify_added;
+   struct list_headreset_notify;
 };
 
 

Modified: stable/11/sys/dev/mlx5/device.h
==
--- stable/11/sys/dev/mlx5/device.h Fri Sep 23 08:13:46 2016
(r306232)
+++ stable/11/sys/dev/mlx5/device.h Fri Sep 23 08:17:51 2016
(r306233)
@@ -57,6 +57,7 @@
 #define MLX5_FLD_SZ_BYTES(typ, fld) (__mlx5_bit_sz(typ, fld) / 8)
 #define MLX5_ST_SZ_BYTES(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 8)
 #define MLX5_ST_SZ_DW(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 32)
+#define MLX5_ST_SZ_QW(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 64)
 #define MLX5_UN_SZ_BYTES(typ) (sizeof(union mlx5_ifc_##typ##_bits) / 8)
 #define MLX5_UN_SZ_DW(typ) (sizeof(union mlx5_ifc_##typ##_bits) / 32)
 #define MLX5_BYTE_OFF(typ, fld) (__mlx5_bit_off(typ, fld) / 8)
@@ -112,6 +113,10 @@ enum {
 };
 
 enum {
+   MLX5_CQ_FLAGS_OI= 2,
+};
+
+enum {
MLX5_STAT_RATE_OFFSET   = 5,
 };
 
@@ -129,6 +134,10 @@ enum {
 };
 
 enum {
+   MLX5_MKEY_INBOX_PG_ACCESS = 1 << 31
+};
+
+enum {
MLX5_PERM_LOCAL_READ= 1 << 2,
MLX5_PERM_LOCAL_WRITE   = 1 << 3,
MLX5_PERM_REMOTE_READ   = 1 << 4,
@@ -184,6 +193,25 @@ enum {
 };
 
 enum {
+   MLX5_UMR_TRANSLATION_OFFSET_EN  = (1 << 4),
+
+   MLX5_UMR_CHECK_NOT_FREE = (1 << 5),
+   MLX5_UMR_CHECK_FREE = (2 << 5),
+
+   MLX5_UMR_INLINE = (1 << 7),
+};
+
+#define MLX5_UMR_MTT_ALIGNMENT 0x40
+#define MLX5_UMR_MTT_MASK  (MLX5_UMR_MTT_ALIGNMENT - 1)
+#define MLX5_UMR_MTT_MIN_CHUNK_SIZE MLX5_UMR_MTT_ALIGNMENT
+
+enum {
+   MLX5_EVENT_QUEUE_TYPE_QP = 0,
+   MLX5_EVENT_QUEUE_TYPE_RQ = 1,
+   MLX5_EVENT_QUEUE_TYPE_SQ = 2,
+};
+
+enum {
MLX5_PORT_CHANGE_SUBTYPE_DOWN   = 1,
MLX5_PORT_CHANGE_SUBTYPE_ACTIVE = 4,
MLX5_PORT_CHANGE_SUBTYPE_INITIALIZED= 5,
@@ -194,19 +222,28 @@ enum {
 };
 
 enum {
+   MLX5_DCBX_EVENT_SUBTYPE_ERROR_STATE_DCBX = 1,
+   MLX5_DCBX_EVENT_SUBTYPE_REMOTE_CONFIG_CHANGE,
+   MLX5_DCBX_EVENT_SUBTYPE_LOCAL_OPER_CHANGE,
+   MLX5_DCBX_EVENT_SUBTYPE_REMOTE_CONFIG_APP_PRIORITY_CHANGE,
+   MLX5_MAX_INLINE_RECEIVE_SIZE= 64
+};
+
+enum {
MLX5_DEV_CAP_FLAG_XRC   = 1LL <<  3,
MLX5_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1LL <<  8,
MLX5_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1LL <<  9,
MLX5_DEV_CAP_FLAG_APM   = 1LL << 17,
-   MLX5_DEV_CAP_FLAG_ATOMIC= 1LL << 18,
MLX5_DEV_CAP_FLAG_SCQE_BRK_MOD  = 1LL << 21,
MLX5_DEV_CAP_FLAG_BLOCK_MCAST   = 1LL << 23,
MLX5_DEV_CAP_FLAG_CQ_MODER  = 1LL << 29,
MLX5_DEV_CAP_FLAG_RESIZE_CQ = 1LL << 30,
+   MLX5_DEV_CAP_FLAG_ATOMIC= 1LL << 33,
MLX5_DEV_CAP_FLAG_ROCE  = 1LL << 34,
MLX5_DEV_CAP_FLAG_DCT   = 1LL << 37,
MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40,
MLX5_

svn commit: r306234 - stable/11/sys/dev/mlx5/mlx5_en

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 08:19:22 2016
New Revision: 306234
URL: https://svnweb.freebsd.org/changeset/base/306234

Log:
  MFC r305868:
  mlx5en: Separate the sendqueue from using the mlx5e_channel structure.
  
  This change allows for reusing the transmit path for so called
  rate limited senqueues. While at it optimise some pointer lookups
  in the fast path.
  
  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
  stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
  stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.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 Fri Sep 23 08:17:51 2016
(r306233)
+++ stable/11/sys/dev/mlx5/mlx5_en/en.h Fri Sep 23 08:19:22 2016
(r306234)
@@ -433,9 +433,9 @@ struct mlx5e_cq {
 
/* data path - accessed per HW polling */
struct mlx5_core_cq mcq;
-   struct mlx5e_channel *channel;
 
/* control */
+   struct mlx5e_priv *priv;
struct mlx5_wq_ctrl wq_ctrl;
 } __aligned(MLX5E_CACHELINE_SIZE);
 
@@ -515,6 +515,7 @@ struct mlx5e_sq {
struct  mlx5_wq_cyc wq;
void__iomem *uar_map;
void__iomem *uar_bf_map;
+   struct  ifnet *ifp;
u32 sqn;
u32 bf_buf_size;
struct  device *pdev;
@@ -523,7 +524,7 @@ struct mlx5e_sq {
/* control path */
struct  mlx5_wq_ctrl wq_ctrl;
struct  mlx5_uar uar;
-   struct  mlx5e_channel *channel;
+   struct  mlx5e_priv *priv;
int tc;
unsigned int queue_state;
 } __aligned(MLX5E_CACHELINE_SIZE);

Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:17:51 
2016(r306233)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:19:22 
2016(r306234)
@@ -982,7 +982,8 @@ mlx5e_create_sq(struct mlx5e_channel *c,
 
sq->pdev = c->pdev;
sq->mkey_be = c->mkey_be;
-   sq->channel = c;
+   sq->ifp = priv->ifp;
+   sq->priv = priv;
sq->tc = tc;
 
sq->br = buf_ring_alloc(MLX5E_SQ_TX_QUEUE_SIZE, M_MLX5EN,
@@ -1039,15 +1040,12 @@ done:
 static void
 mlx5e_destroy_sq(struct mlx5e_sq *sq)
 {
-   struct mlx5e_channel *c = sq->channel;
-   struct mlx5e_priv *priv = c->priv;
-
/* destroy all sysctl nodes */
sysctl_ctx_free(&sq->stats.ctx);
 
mlx5e_free_sq_db(sq);
mlx5_wq_destroy(&sq->wq_ctrl);
-   mlx5_unmap_free_uar(priv->mdev, &sq->uar);
+   mlx5_unmap_free_uar(sq->priv->mdev, &sq->uar);
taskqueue_drain(sq->sq_tq, &sq->sq_task);
taskqueue_free(sq->sq_tq);
buf_ring_free(sq->br, M_MLX5EN);
@@ -1056,10 +1054,6 @@ mlx5e_destroy_sq(struct mlx5e_sq *sq)
 static int
 mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param)
 {
-   struct mlx5e_channel *c = sq->channel;
-   struct mlx5e_priv *priv = c->priv;
-   struct mlx5_core_dev *mdev = priv->mdev;
-
void *in;
void *sqc;
void *wq;
@@ -1077,8 +1071,8 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, str
 
memcpy(sqc, param->sqc, sizeof(param->sqc));
 
-   MLX5_SET(sqc, sqc, tis_num_0, priv->tisn[sq->tc]);
-   MLX5_SET(sqc, sqc, cqn, c->sq[sq->tc].cq.mcq.cqn);
+   MLX5_SET(sqc, sqc, tis_num_0, sq->priv->tisn[sq->tc]);
+   MLX5_SET(sqc, sqc, cqn, sq->cq.mcq.cqn);
MLX5_SET(sqc, sqc, state, MLX5_SQC_STATE_RST);
MLX5_SET(sqc, sqc, tis_lst_sz, 1);
MLX5_SET(sqc, sqc, flush_in_error_en, 1);
@@ -1092,7 +1086,7 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, str
mlx5_fill_page_array(&sq->wq_ctrl.buf,
(__be64 *) MLX5_ADDR_OF(wq, wq, pas));
 
-   err = mlx5_core_create_sq(mdev, in, inlen, &sq->sqn);
+   err = mlx5_core_create_sq(sq->priv->mdev, in, inlen, &sq->sqn);
 
kvfree(in);
 
@@ -1102,10 +1096,6 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, str
 static int
 mlx5e_modify_sq(struct mlx5e_sq *sq, int curr_state, int next_state)
 {
-   struct mlx5e_channel *c = sq->channel;
-   struct mlx5e_priv *priv = c->priv;
-   struct mlx5_core_dev *mdev = priv->mdev;
-
void *in;
void *sqc;
int inlen;
@@ -1122,7 +1112,7 @@ mlx5e_modify_sq(struct mlx5e_sq *sq, int
MLX5_SET(modify_sq_in, in, sq_state, curr_state);
MLX5_SET(sqc, sqc, state, next_state);
 
-   err = mlx5_core_modify_sq(mdev, in, inlen);
+   err = mlx5_core_modify_sq(sq->priv->mdev, in, inlen);
 
kvfree(in);
 
@@ -1132,11 +1122,8 @@ mlx5e_modify_sq(struct mlx5e_sq *sq, int
 static void
 mlx5e_disable_sq(struct mlx5e_sq *sq)
 {
-   struct mlx5e_channel *c = sq->channel;
-   struct mlx5e_priv *priv = c->priv;

svn commit: r306235 - stable/11/sys/dev/mlx5/mlx5_en

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 08:20:16 2016
New Revision: 306235
URL: https://svnweb.freebsd.org/changeset/base/306235

Log:
  MFC r305869:
  mlx5en: Minor completion queue control path code refactor.
  
  Move setting of CQ moderation mode together with the other
  CQ moderation parameters. Pass completion event vector as
  a separate argument to mlx5e_open_cq(), because its value is
  different for each call. Pass mlx5e_priv pointer instead of
  mlx5e_channel pointer so that code can be used by rate
  limiting sendqueues.
  
  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   Fri Sep 23 08:19:22 
2016(r306234)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:20:16 
2016(r306235)
@@ -47,7 +47,6 @@ struct mlx5e_sq_param {
 struct mlx5e_cq_param {
u32 cqc [MLX5_ST_SZ_DW(cqc)];
struct mlx5_wq_param wq;
-   u16 eq_ix;
 };
 
 struct mlx5e_channel_param {
@@ -1248,12 +1247,12 @@ mlx5e_close_sq_wait(struct mlx5e_sq *sq)
 }
 
 static int
-mlx5e_create_cq(struct mlx5e_channel *c,
+mlx5e_create_cq(struct mlx5e_priv *priv,
 struct mlx5e_cq_param *param,
 struct mlx5e_cq *cq,
-mlx5e_cq_comp_t *comp)
+mlx5e_cq_comp_t *comp,
+int eq_ix)
 {
-   struct mlx5e_priv *priv = c->priv;
struct mlx5_core_dev *mdev = priv->mdev;
struct mlx5_core_cq *mcq = &cq->mcq;
int eqn_not_used;
@@ -1263,21 +1262,20 @@ mlx5e_create_cq(struct mlx5e_channel *c,
 
param->wq.buf_numa_node = 0;
param->wq.db_numa_node = 0;
-   param->eq_ix = c->ix;
 
err = mlx5_cqwq_create(mdev, ¶m->wq, param->cqc, &cq->wq,
&cq->wq_ctrl);
if (err)
return (err);
 
-   mlx5_vector2eqn(mdev, param->eq_ix, &eqn_not_used, &irqn);
+   mlx5_vector2eqn(mdev, eq_ix, &eqn_not_used, &irqn);
 
mcq->cqe_sz = 64;
mcq->set_ci_db = cq->wq_ctrl.db.db;
mcq->arm_db = cq->wq_ctrl.db.db + 1;
*mcq->set_ci_db = 0;
*mcq->arm_db = 0;
-   mcq->vector = param->eq_ix;
+   mcq->vector = eq_ix;
mcq->comp = comp;
mcq->event = mlx5e_cq_error_event;
mcq->irqn = irqn;
@@ -1301,8 +1299,7 @@ mlx5e_destroy_cq(struct mlx5e_cq *cq)
 }
 
 static int
-mlx5e_enable_cq(struct mlx5e_cq *cq, struct mlx5e_cq_param *param,
-u8 moderation_mode)
+mlx5e_enable_cq(struct mlx5e_cq *cq, struct mlx5e_cq_param *param, int eq_ix)
 {
struct mlx5_core_cq *mcq = &cq->mcq;
void *in;
@@ -1325,9 +1322,8 @@ mlx5e_enable_cq(struct mlx5e_cq *cq, str
mlx5_fill_page_array(&cq->wq_ctrl.buf,
(__be64 *) MLX5_ADDR_OF(create_cq_in, in, pas));
 
-   mlx5_vector2eqn(cq->priv->mdev, param->eq_ix, &eqn, &irqn_not_used);
+   mlx5_vector2eqn(cq->priv->mdev, eq_ix, &eqn, &irqn_not_used);
 
-   MLX5_SET(cqc, cqc, cq_period_mode, moderation_mode);
MLX5_SET(cqc, cqc, c_eqn, eqn);
MLX5_SET(cqc, cqc, uar_page, mcq->uar->index);
MLX5_SET(cqc, cqc, log_page_size, cq->wq_ctrl.buf.page_shift -
@@ -1354,19 +1350,19 @@ mlx5e_disable_cq(struct mlx5e_cq *cq)
 }
 
 static int
-mlx5e_open_cq(struct mlx5e_channel *c,
+mlx5e_open_cq(struct mlx5e_priv *priv,
 struct mlx5e_cq_param *param,
 struct mlx5e_cq *cq,
 mlx5e_cq_comp_t *comp,
-u8 moderation_mode)
+int eq_ix)
 {
int err;
 
-   err = mlx5e_create_cq(c, param, cq, comp);
+   err = mlx5e_create_cq(priv, param, cq, comp, eq_ix);
if (err)
return (err);
 
-   err = mlx5e_enable_cq(cq, param, moderation_mode);
+   err = mlx5e_enable_cq(cq, param, eq_ix);
if (err)
goto err_destroy_cq;
 
@@ -1389,25 +1385,13 @@ static int
 mlx5e_open_tx_cqs(struct mlx5e_channel *c,
 struct mlx5e_channel_param *cparam)
 {
-   u8 tx_moderation_mode;
int err;
int tc;
 
-   switch (c->priv->params.tx_cq_moderation_mode) {
-   case 0:
-   tx_moderation_mode = MLX5_CQ_PERIOD_MODE_START_FROM_EQE;
-   break;
-   default:
-   if (MLX5_CAP_GEN(c->priv->mdev, cq_period_start_from_cqe))
-   tx_moderation_mode = MLX5_CQ_PERIOD_MODE_START_FROM_CQE;
-   else
-   tx_moderation_mode = MLX5_CQ_PERIOD_MODE_START_FROM_EQE;
-   break;
-   }
for (tc = 0; tc < c->num_tc; tc++) {
/* open completion queue */
-   err = mlx5e_open_cq(c, &cparam->tx_cq, &c->sq[tc].cq,
-   &mlx5e_tx_cq_comp, tx_moderation_mode);
+   err = mlx5e_open_cq(c->priv, &cparam->tx_cq, &c->sq[tc].cq,
+   &mlx5e_tx_cq_comp, c->ix);
if (err)
  

svn commit: r306237 - stable/11/sys/dev/mlx5/mlx5_en

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 08:22:30 2016
New Revision: 306237
URL: https://svnweb.freebsd.org/changeset/base/306237

Log:
  MFC r305871:
  mlx5en: Optimise away duplicate UAR pointers.
  
  This change also reduces the size of the mlx5e_sq structure so that the last
  queue_state element will fit into the previous cacheline and then the mlx5e_sq
  structure becomes one cacheline less for amd64.
  
  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 Fri Sep 23 08:21:45 2016
(r306236)
+++ stable/11/sys/dev/mlx5/mlx5_en/en.h Fri Sep 23 08:22:30 2016
(r306237)
@@ -528,8 +528,7 @@ struct mlx5e_sq {
 
/* read only */
struct  mlx5_wq_cyc wq;
-   void__iomem *uar_map;
-   void__iomem *uar_bf_map;
+   struct  mlx5_uar uar;
struct  ifnet *ifp;
u32 sqn;
u32 bf_buf_size;
@@ -538,7 +537,6 @@ struct mlx5e_sq {
 
/* control path */
struct  mlx5_wq_ctrl wq_ctrl;
-   struct  mlx5_uar uar;
struct  mlx5e_priv *priv;
int tc;
unsigned int queue_state;
@@ -780,13 +778,13 @@ mlx5e_tx_notify_hw(struct mlx5e_sq *sq, 
wmb();
 
if (bf_sz) {
-   __iowrite64_copy(sq->uar_bf_map + ofst, wqe, bf_sz);
+   __iowrite64_copy(sq->uar.bf_map + ofst, wqe, bf_sz);
 
/* flush the write-combining mapped buffer */
wmb();
 
} else {
-   mlx5_write64(wqe, sq->uar_map + ofst, NULL);
+   mlx5_write64(wqe, sq->uar.map + ofst, NULL);
}
 
sq->bf_offset ^= sq->bf_buf_size;

Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:21:45 
2016(r306236)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:22:30 
2016(r306237)
@@ -956,8 +956,6 @@ mlx5e_create_sq(struct mlx5e_channel *c,
goto err_unmap_free_uar;
 
sq->wq.db = &sq->wq.db[MLX5_SND_DBR];
-   sq->uar_map = sq->uar.map;
-   sq->uar_bf_map = sq->uar.bf_map;
sq->bf_buf_size = (1 << MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2;
 
err = mlx5e_alloc_sq_db(sq);
___
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: r306236 - stable/11/sys/dev/mlx5/mlx5_en

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 08:21:45 2016
New Revision: 306236
URL: https://svnweb.freebsd.org/changeset/base/306236

Log:
  MFC r305870:
  mlx5en: Make the mlx5e_open_cq() and mlx5e_close_cq() functions global.
  
  Make some functions and structures global to allow for code reuse
  when creating rate limiting sendqueues.
  
  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 Fri Sep 23 08:20:16 2016
(r306235)
+++ stable/11/sys/dev/mlx5/mlx5_en/en.h Fri Sep 23 08:21:45 2016
(r306236)
@@ -352,6 +352,21 @@ struct mlx5e_stats {
struct mlx5e_port_stats_debug port_stats_debug;
 };
 
+struct mlx5e_rq_param {
+   u32 rqc [MLX5_ST_SZ_DW(rqc)];
+   struct mlx5_wq_param wq;
+};
+
+struct mlx5e_sq_param {
+   u32 sqc [MLX5_ST_SZ_DW(sqc)];
+   struct mlx5_wq_param wq;
+};
+
+struct mlx5e_cq_param {
+   u32 cqc [MLX5_ST_SZ_DW(cqc)];
+   struct mlx5_wq_param wq;
+};
+
 struct mlx5e_params {
u8  log_sq_size;
u8  log_rq_size;
@@ -794,5 +809,8 @@ voidmlx5e_create_stats(struct sysctl_ct
 void   mlx5e_send_nop(struct mlx5e_sq *, u32);
 void   mlx5e_sq_cev_timeout(void *);
 intmlx5e_refresh_channel_params(struct mlx5e_priv *);
+intmlx5e_open_cq(struct mlx5e_priv *, struct mlx5e_cq_param *,
+struct mlx5e_cq *, mlx5e_cq_comp_t *, int eq_ix);
+void   mlx5e_close_cq(struct mlx5e_cq *);
 
 #endif /* _MLX5_EN_H_ */

Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:20:16 
2016(r306235)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:21:45 
2016(r306236)
@@ -34,21 +34,6 @@
 char mlx5e_version[] = "Mellanox Ethernet driver"
 " (" ETH_DRIVER_VERSION ")";
 
-struct mlx5e_rq_param {
-   u32 rqc [MLX5_ST_SZ_DW(rqc)];
-   struct mlx5_wq_param wq;
-};
-
-struct mlx5e_sq_param {
-   u32 sqc [MLX5_ST_SZ_DW(sqc)];
-   struct mlx5_wq_param wq;
-};
-
-struct mlx5e_cq_param {
-   u32 cqc [MLX5_ST_SZ_DW(cqc)];
-   struct mlx5_wq_param wq;
-};
-
 struct mlx5e_channel_param {
struct mlx5e_rq_param rq;
struct mlx5e_sq_param sq;
@@ -1349,7 +1334,7 @@ mlx5e_disable_cq(struct mlx5e_cq *cq)
mlx5_core_destroy_cq(cq->priv->mdev, &cq->mcq);
 }
 
-static int
+int
 mlx5e_open_cq(struct mlx5e_priv *priv,
 struct mlx5e_cq_param *param,
 struct mlx5e_cq *cq,
@@ -1374,7 +1359,7 @@ err_destroy_cq:
return (err);
 }
 
-static void
+void
 mlx5e_close_cq(struct mlx5e_cq *cq)
 {
mlx5e_disable_cq(cq);
___
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: r306238 - stable/11/sys/dev/mlx5/mlx5_en

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 08:23:11 2016
New Revision: 306238
URL: https://svnweb.freebsd.org/changeset/base/306238

Log:
  MFC r305872:
  mlx5en: Properly declare doorbell lock for 32-bit CPUs.
  
  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 Fri Sep 23 08:22:30 2016
(r306237)
+++ stable/11/sys/dev/mlx5/mlx5_en/en.h Fri Sep 23 08:23:11 2016
(r306238)
@@ -662,6 +662,7 @@ struct mlx5e_priv {
struct work_struct update_stats_work;
struct work_struct update_carrier_work;
struct work_struct set_rx_mode_work;
+   MLX5_DECLARE_DOORBELL_LOCK(doorbell_lock)
 
struct mlx5_core_dev *mdev;
struct ifnet *ifp;
@@ -784,7 +785,8 @@ mlx5e_tx_notify_hw(struct mlx5e_sq *sq, 
wmb();
 
} else {
-   mlx5_write64(wqe, sq->uar.map + ofst, NULL);
+   mlx5_write64(wqe, sq->uar.map + ofst,
+   MLX5_GET_DOORBELL_LOCK(&sq->priv->doorbell_lock));
}
 
sq->bf_offset ^= sq->bf_buf_size;

Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:22:30 
2016(r306237)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:23:11 
2016(r306238)
@@ -2753,6 +2753,7 @@ mlx5e_priv_mtx_init(struct mlx5e_priv *p
mtx_init(&priv->async_events_mtx, "mlx5async", MTX_NETWORK_LOCK, 
MTX_DEF);
sx_init(&priv->state_lock, "mlx5state");
callout_init_mtx(&priv->watchdog, &priv->async_events_mtx, 0);
+   MLX5_INIT_DOORBELL_LOCK(&priv->doorbell_lock);
 }
 
 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: r306239 - stable/11/sys/dev/mlx5/mlx5_en

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 08:23:57 2016
New Revision: 306239
URL: https://svnweb.freebsd.org/changeset/base/306239

Log:
  MFC r305873:
  mlx5en: Factor out common sendqueue code for use with rate limiting SQs.
  
  Try to reuse code to setup sendqueues when possible by making some static
  functions global. Further split the mlx5e_close_sq_wait() function to
  separate out reusable parts.
  
  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 Fri Sep 23 08:23:11 2016
(r306238)
+++ stable/11/sys/dev/mlx5/mlx5_en/en.h Fri Sep 23 08:23:57 2016
(r306239)
@@ -812,5 +812,11 @@ intmlx5e_refresh_channel_params(struct 
 intmlx5e_open_cq(struct mlx5e_priv *, struct mlx5e_cq_param *,
 struct mlx5e_cq *, mlx5e_cq_comp_t *, int eq_ix);
 void   mlx5e_close_cq(struct mlx5e_cq *);
+void   mlx5e_free_sq_db(struct mlx5e_sq *);
+intmlx5e_alloc_sq_db(struct mlx5e_sq *);
+intmlx5e_enable_sq(struct mlx5e_sq *, struct mlx5e_sq_param *, int 
tis_num);
+intmlx5e_modify_sq(struct mlx5e_sq *, int curr_state, int next_state);
+void   mlx5e_disable_sq(struct mlx5e_sq *);
+void   mlx5e_drain_sq(struct mlx5e_sq *);
 
 #endif /* _MLX5_EN_H_ */

Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:23:11 
2016(r306238)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:23:57 
2016(r306239)
@@ -873,7 +873,7 @@ mlx5e_close_rq_wait(struct mlx5e_rq *rq)
mlx5e_destroy_rq(rq);
 }
 
-static void
+void
 mlx5e_free_sq_db(struct mlx5e_sq *sq)
 {
int wq_sz = mlx5_wq_cyc_get_size(&sq->wq);
@@ -884,7 +884,7 @@ mlx5e_free_sq_db(struct mlx5e_sq *sq)
free(sq->mbuf, M_MLX5EN);
 }
 
-static int
+int
 mlx5e_alloc_sq_db(struct mlx5e_sq *sq)
 {
int wq_sz = mlx5_wq_cyc_get_size(&sq->wq);
@@ -1033,8 +1033,9 @@ mlx5e_destroy_sq(struct mlx5e_sq *sq)
buf_ring_free(sq->br, M_MLX5EN);
 }
 
-static int
-mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param)
+int
+mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param,
+int tis_num)
 {
void *in;
void *sqc;
@@ -1053,7 +1054,7 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, str
 
memcpy(sqc, param->sqc, sizeof(param->sqc));
 
-   MLX5_SET(sqc, sqc, tis_num_0, sq->priv->tisn[sq->tc]);
+   MLX5_SET(sqc, sqc, tis_num_0, tis_num);
MLX5_SET(sqc, sqc, cqn, sq->cq.mcq.cqn);
MLX5_SET(sqc, sqc, state, MLX5_SQC_STATE_RST);
MLX5_SET(sqc, sqc, tis_lst_sz, 1);
@@ -1075,7 +1076,7 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, str
return (err);
 }
 
-static int
+int
 mlx5e_modify_sq(struct mlx5e_sq *sq, int curr_state, int next_state)
 {
void *in;
@@ -1101,7 +1102,7 @@ mlx5e_modify_sq(struct mlx5e_sq *sq, int
return (err);
 }
 
-static void
+void
 mlx5e_disable_sq(struct mlx5e_sq *sq)
 {
 
@@ -1120,7 +1121,7 @@ mlx5e_open_sq(struct mlx5e_channel *c,
if (err)
return (err);
 
-   err = mlx5e_enable_sq(sq, param);
+   err = mlx5e_enable_sq(sq, param, c->priv->tisn[tc]);
if (err)
goto err_destroy_sq;
 
@@ -1196,8 +1197,8 @@ mlx5e_sq_cev_timeout(void *arg)
callout_reset_curcpu(&sq->cev_callout, hz, mlx5e_sq_cev_timeout, sq);
 }
 
-static void
-mlx5e_close_sq_wait(struct mlx5e_sq *sq)
+void
+mlx5e_drain_sq(struct mlx5e_sq *sq)
 {
 
mtx_lock(&sq->lock);
@@ -1224,7 +1225,13 @@ mlx5e_close_sq_wait(struct mlx5e_sq *sq)
mtx_lock(&sq->lock);
}
mtx_unlock(&sq->lock);
+}
+
+static void
+mlx5e_close_sq_wait(struct mlx5e_sq *sq)
+{
 
+   mlx5e_drain_sq(sq);
mlx5e_disable_sq(sq);
mlx5e_destroy_sq(sq);
 }
___
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: r306240 - stable/11/sys/dev/mlx5/mlx5_en

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 08:24:41 2016
New Revision: 306240
URL: https://svnweb.freebsd.org/changeset/base/306240

Log:
  MFC r305874:
  mlx5en: Allow setting the software MTU size below 1500 bytes
  
  The hardware MTU size can't be set to a value less than 1500 bytes due
  to side-band management support. Allow setting the software MTU size
  below 1500 bytes, thus creating a mismatch between hardware and
  software MTU sizes.
  
  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   Fri Sep 23 08:23:57 
2016(r306239)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:24:41 
2016(r306240)
@@ -2173,7 +2173,6 @@ mlx5e_set_dev_port_mtu(struct ifnet *ifp
int hw_mtu;
int err;
 
-
err = mlx5_set_port_mtu(mdev, MLX5E_SW2HW_MTU(sw_mtu));
if (err) {
if_printf(ifp, "%s: mlx5_set_port_mtu failed setting %d, 
err=%d\n",
@@ -2181,19 +2180,20 @@ mlx5e_set_dev_port_mtu(struct ifnet *ifp
return (err);
}
err = mlx5_query_port_oper_mtu(mdev, &hw_mtu);
-   if (!err) {
-   ifp->if_mtu = MLX5E_HW2SW_MTU(hw_mtu);
-
-   if (ifp->if_mtu != sw_mtu) {
-   if_printf(ifp, "Port MTU %d is different than "
-   "ifp mtu %d\n", sw_mtu, (int)ifp->if_mtu);
-   }
-   } else {
+   if (err) {
if_printf(ifp, "Query port MTU, after setting new "
"MTU value, failed\n");
-   ifp->if_mtu = sw_mtu;
+   } else if (MLX5E_HW2SW_MTU(hw_mtu) < sw_mtu) {
+   err = -E2BIG,
+   if_printf(ifp, "Port MTU %d is smaller than "
+"ifp mtu %d\n", hw_mtu, sw_mtu);
+   } else if (MLX5E_HW2SW_MTU(hw_mtu) > sw_mtu) {
+   err = -EINVAL;
+if_printf(ifp, "Port MTU %d is bigger than "
+"ifp mtu %d\n", hw_mtu, sw_mtu);
}
-   return (0);
+   ifp->if_mtu = sw_mtu;
+   return (err);
 }
 
 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: r306241 - stable/11/sys/dev/mlx5/mlx5_en

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 08:25:23 2016
New Revision: 306241
URL: https://svnweb.freebsd.org/changeset/base/306241

Log:
  MFC r305875:
  mlx5en: Verify port type is ethernet before creating network device
  
  Else the mlx5en driver might attach to infiniband ports.
  
  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   Fri Sep 23 08:24:41 
2016(r306240)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:25:23 
2016(r306241)
@@ -2654,6 +2654,9 @@ mlx5e_check_required_hca_cap(struct mlx5
 
/* TODO: add more must-to-have features */
 
+   if (MLX5_CAP_GEN(mdev, port_type) != MLX5_CAP_PORT_TYPE_ETH)
+   return (-ENODEV);
+
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: r306242 - stable/11/sys/dev/mlx5/mlx5_en

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 08:26:02 2016
New Revision: 306242
URL: https://svnweb.freebsd.org/changeset/base/306242

Log:
  MFC r305876:
  mlx5en: Remove unused pdev pointer.
  
  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 Fri Sep 23 08:25:23 2016
(r306241)
+++ stable/11/sys/dev/mlx5/mlx5_en/en.h Fri Sep 23 08:26:02 2016
(r306242)
@@ -467,7 +467,6 @@ struct mlx5e_rq {
bus_dma_tag_t dma_tag;
u32 wqe_sz;
struct mlx5e_rq_mbuf *mbuf;
-   struct device *pdev;
struct ifnet *ifp;
struct mlx5e_rq_stats stats;
struct mlx5e_cq cq;
@@ -532,7 +531,6 @@ struct mlx5e_sq {
struct  ifnet *ifp;
u32 sqn;
u32 bf_buf_size;
-   struct  device *pdev;
u32 mkey_be;
 
/* control path */
@@ -553,7 +551,6 @@ struct mlx5e_channel {
/* data path */
struct mlx5e_rq rq;
struct mlx5e_sq sq[MLX5E_MAX_TX_NUM_TC];
-   struct device *pdev;
struct ifnet *ifp;
u32 mkey_be;
u8  num_tc;

Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:25:23 
2016(r306241)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:26:02 
2016(r306242)
@@ -674,7 +674,6 @@ mlx5e_create_rq(struct mlx5e_channel *c,
wqe->data.byte_count = cpu_to_be32(byte_count | 
MLX5_HW_START_PADDING);
}
 
-   rq->pdev = c->pdev;
rq->ifp = c->ifp;
rq->channel = c;
rq->ix = c->ix;
@@ -962,7 +961,6 @@ mlx5e_create_sq(struct mlx5e_channel *c,
if (err)
goto err_sq_wq_destroy;
 
-   sq->pdev = c->pdev;
sq->mkey_be = c->mkey_be;
sq->ifp = priv->ifp;
sq->priv = priv;
@@ -1486,7 +1484,6 @@ mlx5e_open_channel(struct mlx5e_priv *pr
c->priv = priv;
c->ix = ix;
c->cpu = 0;
-   c->pdev = &priv->mdev->pdev->dev;
c->ifp = priv->ifp;
c->mkey_be = cpu_to_be32(priv->mr.key);
c->num_tc = priv->num_tc;
___
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: r306243 - stable/11/sys/dev/mlx5/mlx5_en

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 08:26:45 2016
New Revision: 306243
URL: https://svnweb.freebsd.org/changeset/base/306243

Log:
  MFC r305877:
  mlx5en: Fix duplicate mbuf free-by-code.
  
  When mlx5e_sq_xmit() returns an error code and the mbuf pointer is set,
  we should not free the mbuf, because the caller will keep the mbuf in
  the drbr. Make sure the mbuf pointer is correctly set upon function
  exit.
  
  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 Fri Sep 23 08:26:02 2016
(r306242)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Fri Sep 23 08:26:45 2016
(r306243)
@@ -224,10 +224,8 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struc
/* 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)) {
-   m_freem(mb);
+   if (pi < (MLX5_SEND_WQE_MAX_WQEBBS - 1))
return (ENOMEM);
-   }
}
 
/* Setup local variables */
@@ -338,10 +336,8 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struc
mb, segs, &nsegs, BUS_DMA_NOWAIT);
}
/* Catch errors */
-   if (err != 0) {
+   if (err != 0)
goto tx_drop;
-   }
-   *mbp = mb;
 
for (x = 0; x != nsegs; x++) {
if (segs[x].ds_len == 0)
@@ -374,6 +370,7 @@ skip_dma:
bus_dmamap_sync(sq->dma_tag, sq->mbuf[pi].dma_map, 
BUS_DMASYNC_PREWRITE);
 
sq->stats.packets++;
+   *mbp = NULL;/* safety clear */
return (0);
 
 tx_drop:
___
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: r306244 - in stable/10/sys/dev/mlx5: . mlx5_core mlx5_en

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 08:28:44 2016
New Revision: 306244
URL: https://svnweb.freebsd.org/changeset/base/306244

Log:
  MFC r305867:
  Update the MLX5 core module:
  - Add new firmware commands and update existing ones.
  - Add more firmware related structures and update existing ones.
  - Some minor fixes, like adding missing \n to some prints.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/dev/mlx5/cq.h
  stable/10/sys/dev/mlx5/device.h
  stable/10/sys/dev/mlx5/driver.h
  stable/10/sys/dev/mlx5/flow_table.h
  stable/10/sys/dev/mlx5/mlx5_core/mlx5_cmd.c
  stable/10/sys/dev/mlx5/mlx5_core/mlx5_core.h
  stable/10/sys/dev/mlx5/mlx5_core/mlx5_cq.c
  stable/10/sys/dev/mlx5/mlx5_core/mlx5_eq.c
  stable/10/sys/dev/mlx5/mlx5_core/mlx5_eswitch_vacl.c
  stable/10/sys/dev/mlx5/mlx5_core/mlx5_flow_table.c
  stable/10/sys/dev/mlx5/mlx5_core/mlx5_fw.c
  stable/10/sys/dev/mlx5/mlx5_core/mlx5_main.c
  stable/10/sys/dev/mlx5/mlx5_core/mlx5_mr.c
  stable/10/sys/dev/mlx5/mlx5_core/mlx5_port.c
  stable/10/sys/dev/mlx5/mlx5_core/mlx5_qp.c
  stable/10/sys/dev/mlx5/mlx5_core/mlx5_srq.c
  stable/10/sys/dev/mlx5/mlx5_core/mlx5_transobj.c
  stable/10/sys/dev/mlx5/mlx5_core/mlx5_uar.c
  stable/10/sys/dev/mlx5/mlx5_core/mlx5_vport.c
  stable/10/sys/dev/mlx5/mlx5_core/transobj.h
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  stable/10/sys/dev/mlx5/mlx5_ifc.h
  stable/10/sys/dev/mlx5/qp.h
  stable/10/sys/dev/mlx5/vport.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/cq.h
==
--- stable/10/sys/dev/mlx5/cq.h Fri Sep 23 08:26:45 2016(r306243)
+++ stable/10/sys/dev/mlx5/cq.h Fri Sep 23 08:28:44 2016(r306244)
@@ -49,6 +49,8 @@ struct mlx5_core_cq {
unsignedarm_sn;
struct mlx5_rsc_debug   *dbg;
int pid;
+   int reset_notify_added;
+   struct list_headreset_notify;
 };
 
 

Modified: stable/10/sys/dev/mlx5/device.h
==
--- stable/10/sys/dev/mlx5/device.h Fri Sep 23 08:26:45 2016
(r306243)
+++ stable/10/sys/dev/mlx5/device.h Fri Sep 23 08:28:44 2016
(r306244)
@@ -57,6 +57,7 @@
 #define MLX5_FLD_SZ_BYTES(typ, fld) (__mlx5_bit_sz(typ, fld) / 8)
 #define MLX5_ST_SZ_BYTES(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 8)
 #define MLX5_ST_SZ_DW(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 32)
+#define MLX5_ST_SZ_QW(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 64)
 #define MLX5_UN_SZ_BYTES(typ) (sizeof(union mlx5_ifc_##typ##_bits) / 8)
 #define MLX5_UN_SZ_DW(typ) (sizeof(union mlx5_ifc_##typ##_bits) / 32)
 #define MLX5_BYTE_OFF(typ, fld) (__mlx5_bit_off(typ, fld) / 8)
@@ -112,6 +113,10 @@ enum {
 };
 
 enum {
+   MLX5_CQ_FLAGS_OI= 2,
+};
+
+enum {
MLX5_STAT_RATE_OFFSET   = 5,
 };
 
@@ -129,6 +134,10 @@ enum {
 };
 
 enum {
+   MLX5_MKEY_INBOX_PG_ACCESS = 1 << 31
+};
+
+enum {
MLX5_PERM_LOCAL_READ= 1 << 2,
MLX5_PERM_LOCAL_WRITE   = 1 << 3,
MLX5_PERM_REMOTE_READ   = 1 << 4,
@@ -184,6 +193,25 @@ enum {
 };
 
 enum {
+   MLX5_UMR_TRANSLATION_OFFSET_EN  = (1 << 4),
+
+   MLX5_UMR_CHECK_NOT_FREE = (1 << 5),
+   MLX5_UMR_CHECK_FREE = (2 << 5),
+
+   MLX5_UMR_INLINE = (1 << 7),
+};
+
+#define MLX5_UMR_MTT_ALIGNMENT 0x40
+#define MLX5_UMR_MTT_MASK  (MLX5_UMR_MTT_ALIGNMENT - 1)
+#define MLX5_UMR_MTT_MIN_CHUNK_SIZE MLX5_UMR_MTT_ALIGNMENT
+
+enum {
+   MLX5_EVENT_QUEUE_TYPE_QP = 0,
+   MLX5_EVENT_QUEUE_TYPE_RQ = 1,
+   MLX5_EVENT_QUEUE_TYPE_SQ = 2,
+};
+
+enum {
MLX5_PORT_CHANGE_SUBTYPE_DOWN   = 1,
MLX5_PORT_CHANGE_SUBTYPE_ACTIVE = 4,
MLX5_PORT_CHANGE_SUBTYPE_INITIALIZED= 5,
@@ -194,19 +222,28 @@ enum {
 };
 
 enum {
+   MLX5_DCBX_EVENT_SUBTYPE_ERROR_STATE_DCBX = 1,
+   MLX5_DCBX_EVENT_SUBTYPE_REMOTE_CONFIG_CHANGE,
+   MLX5_DCBX_EVENT_SUBTYPE_LOCAL_OPER_CHANGE,
+   MLX5_DCBX_EVENT_SUBTYPE_REMOTE_CONFIG_APP_PRIORITY_CHANGE,
+   MLX5_MAX_INLINE_RECEIVE_SIZE= 64
+};
+
+enum {
MLX5_DEV_CAP_FLAG_XRC   = 1LL <<  3,
MLX5_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1LL <<  8,
MLX5_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1LL <<  9,
MLX5_DEV_CAP_FLAG_APM   = 1LL << 17,
-   MLX5_DEV_CAP_FLAG_ATOMIC= 1LL << 18,
MLX5_DEV_CAP_FLAG_SCQE_BRK_MOD  = 1LL << 21,
MLX5_DEV_CAP_FLAG_BLOCK_MCAST   = 1LL << 23,
MLX5_DEV_CAP_FLAG_CQ_MODER  = 1LL << 29,
MLX5_DEV_CAP_FLAG_RESIZE_CQ = 1LL << 30,
+   MLX5_DEV_CAP_FLAG_ATOMIC= 1LL << 33,
MLX5_DEV_CAP_FLAG_ROCE  = 1LL << 34,
MLX5_DEV_CAP_FLAG_DCT   = 1LL << 37,
MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40,
MLX5_

svn commit: r306245 - stable/10/sys/dev/mlx5/mlx5_en

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 08:29:27 2016
New Revision: 306245
URL: https://svnweb.freebsd.org/changeset/base/306245

Log:
  MFC r305868:
  mlx5en: Separate the sendqueue from using the mlx5e_channel structure.
  
  This change allows for reusing the transmit path for so called
  rate limited senqueues. While at it optimise some pointer lookups
  in the fast path.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/en.h
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.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 Fri Sep 23 08:28:44 2016
(r306244)
+++ stable/10/sys/dev/mlx5/mlx5_en/en.h Fri Sep 23 08:29:27 2016
(r306245)
@@ -439,9 +439,9 @@ struct mlx5e_cq {
 
/* data path - accessed per HW polling */
struct mlx5_core_cq mcq;
-   struct mlx5e_channel *channel;
 
/* control */
+   struct mlx5e_priv *priv;
struct mlx5_wq_ctrl wq_ctrl;
 } __aligned(MLX5E_CACHELINE_SIZE);
 
@@ -525,6 +525,7 @@ struct mlx5e_sq {
struct  mlx5_wq_cyc wq;
void__iomem *uar_map;
void__iomem *uar_bf_map;
+   struct  ifnet *ifp;
u32 sqn;
u32 bf_buf_size;
struct  device *pdev;
@@ -533,7 +534,7 @@ struct mlx5e_sq {
/* control path */
struct  mlx5_wq_ctrl wq_ctrl;
struct  mlx5_uar uar;
-   struct  mlx5e_channel *channel;
+   struct  mlx5e_priv *priv;
int tc;
unsigned int queue_state;
 } __aligned(MLX5E_CACHELINE_SIZE);

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:28:44 
2016(r306244)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:29:27 
2016(r306245)
@@ -988,7 +988,8 @@ mlx5e_create_sq(struct mlx5e_channel *c,
 
sq->pdev = c->pdev;
sq->mkey_be = c->mkey_be;
-   sq->channel = c;
+   sq->ifp = priv->ifp;
+   sq->priv = priv;
sq->tc = tc;
 
sq->br = buf_ring_alloc(MLX5E_SQ_TX_QUEUE_SIZE, M_MLX5EN,
@@ -1045,15 +1046,12 @@ done:
 static void
 mlx5e_destroy_sq(struct mlx5e_sq *sq)
 {
-   struct mlx5e_channel *c = sq->channel;
-   struct mlx5e_priv *priv = c->priv;
-
/* destroy all sysctl nodes */
sysctl_ctx_free(&sq->stats.ctx);
 
mlx5e_free_sq_db(sq);
mlx5_wq_destroy(&sq->wq_ctrl);
-   mlx5_unmap_free_uar(priv->mdev, &sq->uar);
+   mlx5_unmap_free_uar(sq->priv->mdev, &sq->uar);
taskqueue_drain(sq->sq_tq, &sq->sq_task);
taskqueue_free(sq->sq_tq);
buf_ring_free(sq->br, M_MLX5EN);
@@ -1062,10 +1060,6 @@ mlx5e_destroy_sq(struct mlx5e_sq *sq)
 static int
 mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param)
 {
-   struct mlx5e_channel *c = sq->channel;
-   struct mlx5e_priv *priv = c->priv;
-   struct mlx5_core_dev *mdev = priv->mdev;
-
void *in;
void *sqc;
void *wq;
@@ -1083,8 +1077,8 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, str
 
memcpy(sqc, param->sqc, sizeof(param->sqc));
 
-   MLX5_SET(sqc, sqc, tis_num_0, priv->tisn[sq->tc]);
-   MLX5_SET(sqc, sqc, cqn, c->sq[sq->tc].cq.mcq.cqn);
+   MLX5_SET(sqc, sqc, tis_num_0, sq->priv->tisn[sq->tc]);
+   MLX5_SET(sqc, sqc, cqn, sq->cq.mcq.cqn);
MLX5_SET(sqc, sqc, state, MLX5_SQC_STATE_RST);
MLX5_SET(sqc, sqc, tis_lst_sz, 1);
MLX5_SET(sqc, sqc, flush_in_error_en, 1);
@@ -1098,7 +1092,7 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, str
mlx5_fill_page_array(&sq->wq_ctrl.buf,
(__be64 *) MLX5_ADDR_OF(wq, wq, pas));
 
-   err = mlx5_core_create_sq(mdev, in, inlen, &sq->sqn);
+   err = mlx5_core_create_sq(sq->priv->mdev, in, inlen, &sq->sqn);
 
kvfree(in);
 
@@ -1108,10 +1102,6 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, str
 static int
 mlx5e_modify_sq(struct mlx5e_sq *sq, int curr_state, int next_state)
 {
-   struct mlx5e_channel *c = sq->channel;
-   struct mlx5e_priv *priv = c->priv;
-   struct mlx5_core_dev *mdev = priv->mdev;
-
void *in;
void *sqc;
int inlen;
@@ -1128,7 +1118,7 @@ mlx5e_modify_sq(struct mlx5e_sq *sq, int
MLX5_SET(modify_sq_in, in, sq_state, curr_state);
MLX5_SET(sqc, sqc, state, next_state);
 
-   err = mlx5_core_modify_sq(mdev, in, inlen);
+   err = mlx5_core_modify_sq(sq->priv->mdev, in, inlen);
 
kvfree(in);
 
@@ -1138,11 +1128,8 @@ mlx5e_modify_sq(struct mlx5e_sq *sq, int
 static void
 mlx5e_disable_sq(struct mlx5e_sq *sq)
 {
-   struct mlx5e_channel *c = sq->channel;
-   struct mlx5e_priv *priv = c->priv;

svn commit: r306246 - stable/10/sys/dev/mlx5/mlx5_en

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 08:30:09 2016
New Revision: 306246
URL: https://svnweb.freebsd.org/changeset/base/306246

Log:
  MFC r305869:
  mlx5en: Minor completion queue control path code refactor.
  
  Move setting of CQ moderation mode together with the other
  CQ moderation parameters. Pass completion event vector as
  a separate argument to mlx5e_open_cq(), because its value is
  different for each call. Pass mlx5e_priv pointer instead of
  mlx5e_channel pointer so that code can be used by rate
  limiting sendqueues.
  
  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   Fri Sep 23 08:29:27 
2016(r306245)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:30:09 
2016(r306246)
@@ -47,7 +47,6 @@ struct mlx5e_sq_param {
 struct mlx5e_cq_param {
u32 cqc [MLX5_ST_SZ_DW(cqc)];
struct mlx5_wq_param wq;
-   u16 eq_ix;
 };
 
 struct mlx5e_channel_param {
@@ -1254,12 +1253,12 @@ mlx5e_close_sq_wait(struct mlx5e_sq *sq)
 }
 
 static int
-mlx5e_create_cq(struct mlx5e_channel *c,
+mlx5e_create_cq(struct mlx5e_priv *priv,
 struct mlx5e_cq_param *param,
 struct mlx5e_cq *cq,
-mlx5e_cq_comp_t *comp)
+mlx5e_cq_comp_t *comp,
+int eq_ix)
 {
-   struct mlx5e_priv *priv = c->priv;
struct mlx5_core_dev *mdev = priv->mdev;
struct mlx5_core_cq *mcq = &cq->mcq;
int eqn_not_used;
@@ -1269,21 +1268,20 @@ mlx5e_create_cq(struct mlx5e_channel *c,
 
param->wq.buf_numa_node = 0;
param->wq.db_numa_node = 0;
-   param->eq_ix = c->ix;
 
err = mlx5_cqwq_create(mdev, ¶m->wq, param->cqc, &cq->wq,
&cq->wq_ctrl);
if (err)
return (err);
 
-   mlx5_vector2eqn(mdev, param->eq_ix, &eqn_not_used, &irqn);
+   mlx5_vector2eqn(mdev, eq_ix, &eqn_not_used, &irqn);
 
mcq->cqe_sz = 64;
mcq->set_ci_db = cq->wq_ctrl.db.db;
mcq->arm_db = cq->wq_ctrl.db.db + 1;
*mcq->set_ci_db = 0;
*mcq->arm_db = 0;
-   mcq->vector = param->eq_ix;
+   mcq->vector = eq_ix;
mcq->comp = comp;
mcq->event = mlx5e_cq_error_event;
mcq->irqn = irqn;
@@ -1307,8 +1305,7 @@ mlx5e_destroy_cq(struct mlx5e_cq *cq)
 }
 
 static int
-mlx5e_enable_cq(struct mlx5e_cq *cq, struct mlx5e_cq_param *param,
-u8 moderation_mode)
+mlx5e_enable_cq(struct mlx5e_cq *cq, struct mlx5e_cq_param *param, int eq_ix)
 {
struct mlx5_core_cq *mcq = &cq->mcq;
void *in;
@@ -1331,9 +1328,8 @@ mlx5e_enable_cq(struct mlx5e_cq *cq, str
mlx5_fill_page_array(&cq->wq_ctrl.buf,
(__be64 *) MLX5_ADDR_OF(create_cq_in, in, pas));
 
-   mlx5_vector2eqn(cq->priv->mdev, param->eq_ix, &eqn, &irqn_not_used);
+   mlx5_vector2eqn(cq->priv->mdev, eq_ix, &eqn, &irqn_not_used);
 
-   MLX5_SET(cqc, cqc, cq_period_mode, moderation_mode);
MLX5_SET(cqc, cqc, c_eqn, eqn);
MLX5_SET(cqc, cqc, uar_page, mcq->uar->index);
MLX5_SET(cqc, cqc, log_page_size, cq->wq_ctrl.buf.page_shift -
@@ -1360,19 +1356,19 @@ mlx5e_disable_cq(struct mlx5e_cq *cq)
 }
 
 static int
-mlx5e_open_cq(struct mlx5e_channel *c,
+mlx5e_open_cq(struct mlx5e_priv *priv,
 struct mlx5e_cq_param *param,
 struct mlx5e_cq *cq,
 mlx5e_cq_comp_t *comp,
-u8 moderation_mode)
+int eq_ix)
 {
int err;
 
-   err = mlx5e_create_cq(c, param, cq, comp);
+   err = mlx5e_create_cq(priv, param, cq, comp, eq_ix);
if (err)
return (err);
 
-   err = mlx5e_enable_cq(cq, param, moderation_mode);
+   err = mlx5e_enable_cq(cq, param, eq_ix);
if (err)
goto err_destroy_cq;
 
@@ -1395,25 +1391,13 @@ static int
 mlx5e_open_tx_cqs(struct mlx5e_channel *c,
 struct mlx5e_channel_param *cparam)
 {
-   u8 tx_moderation_mode;
int err;
int tc;
 
-   switch (c->priv->params.tx_cq_moderation_mode) {
-   case 0:
-   tx_moderation_mode = MLX5_CQ_PERIOD_MODE_START_FROM_EQE;
-   break;
-   default:
-   if (MLX5_CAP_GEN(c->priv->mdev, cq_period_start_from_cqe))
-   tx_moderation_mode = MLX5_CQ_PERIOD_MODE_START_FROM_CQE;
-   else
-   tx_moderation_mode = MLX5_CQ_PERIOD_MODE_START_FROM_EQE;
-   break;
-   }
for (tc = 0; tc < c->num_tc; tc++) {
/* open completion queue */
-   err = mlx5e_open_cq(c, &cparam->tx_cq, &c->sq[tc].cq,
-   &mlx5e_tx_cq_comp, tx_moderation_mode);
+   err = mlx5e_open_cq(c->priv, &cparam->tx_cq, &c->sq[tc].cq,
+   &mlx5e_tx_cq_comp, c->ix);
if (err)
  

svn commit: r306248 - stable/10/sys/dev/mlx5/mlx5_en

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 08:31:38 2016
New Revision: 306248
URL: https://svnweb.freebsd.org/changeset/base/306248

Log:
  MFC r305871:
  mlx5en: Optimise away duplicate UAR pointers.
  
  This change also reduces the size of the mlx5e_sq structure so that the last
  queue_state element will fit into the previous cacheline and then the mlx5e_sq
  structure becomes one cacheline less for amd64.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/en.h
  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/en.h
==
--- stable/10/sys/dev/mlx5/mlx5_en/en.h Fri Sep 23 08:30:53 2016
(r306247)
+++ stable/10/sys/dev/mlx5/mlx5_en/en.h Fri Sep 23 08:31:38 2016
(r306248)
@@ -538,8 +538,7 @@ struct mlx5e_sq {
 
/* read only */
struct  mlx5_wq_cyc wq;
-   void__iomem *uar_map;
-   void__iomem *uar_bf_map;
+   struct  mlx5_uar uar;
struct  ifnet *ifp;
u32 sqn;
u32 bf_buf_size;
@@ -548,7 +547,6 @@ struct mlx5e_sq {
 
/* control path */
struct  mlx5_wq_ctrl wq_ctrl;
-   struct  mlx5_uar uar;
struct  mlx5e_priv *priv;
int tc;
unsigned int queue_state;
@@ -790,13 +788,13 @@ mlx5e_tx_notify_hw(struct mlx5e_sq *sq, 
wmb();
 
if (bf_sz) {
-   __iowrite64_copy(sq->uar_bf_map + ofst, wqe, bf_sz);
+   __iowrite64_copy(sq->uar.bf_map + ofst, wqe, bf_sz);
 
/* flush the write-combining mapped buffer */
wmb();
 
} else {
-   mlx5_write64(wqe, sq->uar_map + ofst, NULL);
+   mlx5_write64(wqe, sq->uar.map + ofst, NULL);
}
 
sq->bf_offset ^= sq->bf_buf_size;

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:30:53 
2016(r306247)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:31:38 
2016(r306248)
@@ -962,8 +962,6 @@ mlx5e_create_sq(struct mlx5e_channel *c,
goto err_unmap_free_uar;
 
sq->wq.db = &sq->wq.db[MLX5_SND_DBR];
-   sq->uar_map = sq->uar.map;
-   sq->uar_bf_map = sq->uar.bf_map;
sq->bf_buf_size = (1 << MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2;
 
err = mlx5e_alloc_sq_db(sq);
___
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: r306247 - stable/10/sys/dev/mlx5/mlx5_en

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 08:30:53 2016
New Revision: 306247
URL: https://svnweb.freebsd.org/changeset/base/306247

Log:
  MFC r305870:
  mlx5en: Make the mlx5e_open_cq() and mlx5e_close_cq() functions global.
  
  Make some functions and structures global to allow for code reuse
  when creating rate limiting sendqueues.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/en.h
  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/en.h
==
--- stable/10/sys/dev/mlx5/mlx5_en/en.h Fri Sep 23 08:30:09 2016
(r306246)
+++ stable/10/sys/dev/mlx5/mlx5_en/en.h Fri Sep 23 08:30:53 2016
(r306247)
@@ -358,6 +358,21 @@ struct mlx5e_stats {
struct mlx5e_port_stats_debug port_stats_debug;
 };
 
+struct mlx5e_rq_param {
+   u32 rqc [MLX5_ST_SZ_DW(rqc)];
+   struct mlx5_wq_param wq;
+};
+
+struct mlx5e_sq_param {
+   u32 sqc [MLX5_ST_SZ_DW(sqc)];
+   struct mlx5_wq_param wq;
+};
+
+struct mlx5e_cq_param {
+   u32 cqc [MLX5_ST_SZ_DW(cqc)];
+   struct mlx5_wq_param wq;
+};
+
 struct mlx5e_params {
u8  log_sq_size;
u8  log_rq_size;
@@ -804,5 +819,8 @@ voidmlx5e_create_stats(struct sysctl_ct
 void   mlx5e_send_nop(struct mlx5e_sq *, u32);
 void   mlx5e_sq_cev_timeout(void *);
 intmlx5e_refresh_channel_params(struct mlx5e_priv *);
+intmlx5e_open_cq(struct mlx5e_priv *, struct mlx5e_cq_param *,
+struct mlx5e_cq *, mlx5e_cq_comp_t *, int eq_ix);
+void   mlx5e_close_cq(struct mlx5e_cq *);
 
 #endif /* _MLX5_EN_H_ */

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:30:09 
2016(r306246)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:30:53 
2016(r306247)
@@ -34,21 +34,6 @@
 char mlx5e_version[] = "Mellanox Ethernet driver"
 " (" ETH_DRIVER_VERSION ")";
 
-struct mlx5e_rq_param {
-   u32 rqc [MLX5_ST_SZ_DW(rqc)];
-   struct mlx5_wq_param wq;
-};
-
-struct mlx5e_sq_param {
-   u32 sqc [MLX5_ST_SZ_DW(sqc)];
-   struct mlx5_wq_param wq;
-};
-
-struct mlx5e_cq_param {
-   u32 cqc [MLX5_ST_SZ_DW(cqc)];
-   struct mlx5_wq_param wq;
-};
-
 struct mlx5e_channel_param {
struct mlx5e_rq_param rq;
struct mlx5e_sq_param sq;
@@ -1355,7 +1340,7 @@ mlx5e_disable_cq(struct mlx5e_cq *cq)
mlx5_core_destroy_cq(cq->priv->mdev, &cq->mcq);
 }
 
-static int
+int
 mlx5e_open_cq(struct mlx5e_priv *priv,
 struct mlx5e_cq_param *param,
 struct mlx5e_cq *cq,
@@ -1380,7 +1365,7 @@ err_destroy_cq:
return (err);
 }
 
-static void
+void
 mlx5e_close_cq(struct mlx5e_cq *cq)
 {
mlx5e_disable_cq(cq);
___
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: r306249 - stable/10/sys/dev/mlx5/mlx5_en

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 08:32:18 2016
New Revision: 306249
URL: https://svnweb.freebsd.org/changeset/base/306249

Log:
  MFC r305872:
  mlx5en: Properly declare doorbell lock for 32-bit CPUs.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/en.h
  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/en.h
==
--- stable/10/sys/dev/mlx5/mlx5_en/en.h Fri Sep 23 08:31:38 2016
(r306248)
+++ stable/10/sys/dev/mlx5/mlx5_en/en.h Fri Sep 23 08:32:18 2016
(r306249)
@@ -672,6 +672,7 @@ struct mlx5e_priv {
struct work_struct update_stats_work;
struct work_struct update_carrier_work;
struct work_struct set_rx_mode_work;
+   MLX5_DECLARE_DOORBELL_LOCK(doorbell_lock)
 
struct mlx5_core_dev *mdev;
struct ifnet *ifp;
@@ -794,7 +795,8 @@ mlx5e_tx_notify_hw(struct mlx5e_sq *sq, 
wmb();
 
} else {
-   mlx5_write64(wqe, sq->uar.map + ofst, NULL);
+   mlx5_write64(wqe, sq->uar.map + ofst,
+   MLX5_GET_DOORBELL_LOCK(&sq->priv->doorbell_lock));
}
 
sq->bf_offset ^= sq->bf_buf_size;

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:31:38 
2016(r306248)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:32:18 
2016(r306249)
@@ -2759,6 +2759,7 @@ mlx5e_priv_mtx_init(struct mlx5e_priv *p
mtx_init(&priv->async_events_mtx, "mlx5async", MTX_NETWORK_LOCK, 
MTX_DEF);
sx_init(&priv->state_lock, "mlx5state");
callout_init_mtx(&priv->watchdog, &priv->async_events_mtx, 0);
+   MLX5_INIT_DOORBELL_LOCK(&priv->doorbell_lock);
 }
 
 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: r306250 - stable/10/sys/dev/mlx5/mlx5_en

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 08:33:03 2016
New Revision: 306250
URL: https://svnweb.freebsd.org/changeset/base/306250

Log:
  MFC r305873:
  mlx5en: Factor out common sendqueue code for use with rate limiting SQs.
  
  Try to reuse code to setup sendqueues when possible by making some static
  functions global. Further split the mlx5e_close_sq_wait() function to
  separate out reusable parts.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/en.h
  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/en.h
==
--- stable/10/sys/dev/mlx5/mlx5_en/en.h Fri Sep 23 08:32:18 2016
(r306249)
+++ stable/10/sys/dev/mlx5/mlx5_en/en.h Fri Sep 23 08:33:03 2016
(r306250)
@@ -822,5 +822,11 @@ intmlx5e_refresh_channel_params(struct 
 intmlx5e_open_cq(struct mlx5e_priv *, struct mlx5e_cq_param *,
 struct mlx5e_cq *, mlx5e_cq_comp_t *, int eq_ix);
 void   mlx5e_close_cq(struct mlx5e_cq *);
+void   mlx5e_free_sq_db(struct mlx5e_sq *);
+intmlx5e_alloc_sq_db(struct mlx5e_sq *);
+intmlx5e_enable_sq(struct mlx5e_sq *, struct mlx5e_sq_param *, int 
tis_num);
+intmlx5e_modify_sq(struct mlx5e_sq *, int curr_state, int next_state);
+void   mlx5e_disable_sq(struct mlx5e_sq *);
+void   mlx5e_drain_sq(struct mlx5e_sq *);
 
 #endif /* _MLX5_EN_H_ */

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:32:18 
2016(r306249)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:33:03 
2016(r306250)
@@ -879,7 +879,7 @@ mlx5e_close_rq_wait(struct mlx5e_rq *rq)
mlx5e_destroy_rq(rq);
 }
 
-static void
+void
 mlx5e_free_sq_db(struct mlx5e_sq *sq)
 {
int wq_sz = mlx5_wq_cyc_get_size(&sq->wq);
@@ -890,7 +890,7 @@ mlx5e_free_sq_db(struct mlx5e_sq *sq)
free(sq->mbuf, M_MLX5EN);
 }
 
-static int
+int
 mlx5e_alloc_sq_db(struct mlx5e_sq *sq)
 {
int wq_sz = mlx5_wq_cyc_get_size(&sq->wq);
@@ -1039,8 +1039,9 @@ mlx5e_destroy_sq(struct mlx5e_sq *sq)
buf_ring_free(sq->br, M_MLX5EN);
 }
 
-static int
-mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param)
+int
+mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param,
+int tis_num)
 {
void *in;
void *sqc;
@@ -1059,7 +1060,7 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, str
 
memcpy(sqc, param->sqc, sizeof(param->sqc));
 
-   MLX5_SET(sqc, sqc, tis_num_0, sq->priv->tisn[sq->tc]);
+   MLX5_SET(sqc, sqc, tis_num_0, tis_num);
MLX5_SET(sqc, sqc, cqn, sq->cq.mcq.cqn);
MLX5_SET(sqc, sqc, state, MLX5_SQC_STATE_RST);
MLX5_SET(sqc, sqc, tis_lst_sz, 1);
@@ -1081,7 +1082,7 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, str
return (err);
 }
 
-static int
+int
 mlx5e_modify_sq(struct mlx5e_sq *sq, int curr_state, int next_state)
 {
void *in;
@@ -1107,7 +1108,7 @@ mlx5e_modify_sq(struct mlx5e_sq *sq, int
return (err);
 }
 
-static void
+void
 mlx5e_disable_sq(struct mlx5e_sq *sq)
 {
 
@@ -1126,7 +1127,7 @@ mlx5e_open_sq(struct mlx5e_channel *c,
if (err)
return (err);
 
-   err = mlx5e_enable_sq(sq, param);
+   err = mlx5e_enable_sq(sq, param, c->priv->tisn[tc]);
if (err)
goto err_destroy_sq;
 
@@ -1202,8 +1203,8 @@ mlx5e_sq_cev_timeout(void *arg)
callout_reset_curcpu(&sq->cev_callout, hz, mlx5e_sq_cev_timeout, sq);
 }
 
-static void
-mlx5e_close_sq_wait(struct mlx5e_sq *sq)
+void
+mlx5e_drain_sq(struct mlx5e_sq *sq)
 {
 
mtx_lock(&sq->lock);
@@ -1230,7 +1231,13 @@ mlx5e_close_sq_wait(struct mlx5e_sq *sq)
mtx_lock(&sq->lock);
}
mtx_unlock(&sq->lock);
+}
+
+static void
+mlx5e_close_sq_wait(struct mlx5e_sq *sq)
+{
 
+   mlx5e_drain_sq(sq);
mlx5e_disable_sq(sq);
mlx5e_destroy_sq(sq);
 }
___
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: r306251 - stable/10/sys/dev/mlx5/mlx5_en

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 08:33:47 2016
New Revision: 306251
URL: https://svnweb.freebsd.org/changeset/base/306251

Log:
  MFC r305874:
  mlx5en: Allow setting the software MTU size below 1500 bytes
  
  The hardware MTU size can't be set to a value less than 1500 bytes due
  to side-band management support. Allow setting the software MTU size
  below 1500 bytes, thus creating a mismatch between hardware and
  software MTU sizes.
  
  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   Fri Sep 23 08:33:03 
2016(r306250)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:33:47 
2016(r306251)
@@ -2179,7 +2179,6 @@ mlx5e_set_dev_port_mtu(struct ifnet *ifp
int hw_mtu;
int err;
 
-
err = mlx5_set_port_mtu(mdev, MLX5E_SW2HW_MTU(sw_mtu));
if (err) {
if_printf(ifp, "%s: mlx5_set_port_mtu failed setting %d, 
err=%d\n",
@@ -2187,19 +2186,20 @@ mlx5e_set_dev_port_mtu(struct ifnet *ifp
return (err);
}
err = mlx5_query_port_oper_mtu(mdev, &hw_mtu);
-   if (!err) {
-   ifp->if_mtu = MLX5E_HW2SW_MTU(hw_mtu);
-
-   if (ifp->if_mtu != sw_mtu) {
-   if_printf(ifp, "Port MTU %d is different than "
-   "ifp mtu %d\n", sw_mtu, (int)ifp->if_mtu);
-   }
-   } else {
+   if (err) {
if_printf(ifp, "Query port MTU, after setting new "
"MTU value, failed\n");
-   ifp->if_mtu = sw_mtu;
+   } else if (MLX5E_HW2SW_MTU(hw_mtu) < sw_mtu) {
+   err = -E2BIG,
+   if_printf(ifp, "Port MTU %d is smaller than "
+"ifp mtu %d\n", hw_mtu, sw_mtu);
+   } else if (MLX5E_HW2SW_MTU(hw_mtu) > sw_mtu) {
+   err = -EINVAL;
+if_printf(ifp, "Port MTU %d is bigger than "
+"ifp mtu %d\n", hw_mtu, sw_mtu);
}
-   return (0);
+   ifp->if_mtu = sw_mtu;
+   return (err);
 }
 
 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: r306252 - stable/10/sys/dev/mlx5/mlx5_en

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 08:34:28 2016
New Revision: 306252
URL: https://svnweb.freebsd.org/changeset/base/306252

Log:
  MFC r305875:
  mlx5en: Verify port type is ethernet before creating network device
  
  Else the mlx5en driver might attach to infiniband ports.
  
  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   Fri Sep 23 08:33:47 
2016(r306251)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:34:28 
2016(r306252)
@@ -2660,6 +2660,9 @@ mlx5e_check_required_hca_cap(struct mlx5
 
/* TODO: add more must-to-have features */
 
+   if (MLX5_CAP_GEN(mdev, port_type) != MLX5_CAP_PORT_TYPE_ETH)
+   return (-ENODEV);
+
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: r306253 - stable/10/sys/dev/mlx5/mlx5_en

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 08:35:11 2016
New Revision: 306253
URL: https://svnweb.freebsd.org/changeset/base/306253

Log:
  MFC r305876:
  mlx5en: Remove unused pdev pointer.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/en.h
  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/en.h
==
--- stable/10/sys/dev/mlx5/mlx5_en/en.h Fri Sep 23 08:34:28 2016
(r306252)
+++ stable/10/sys/dev/mlx5/mlx5_en/en.h Fri Sep 23 08:35:11 2016
(r306253)
@@ -473,7 +473,6 @@ struct mlx5e_rq {
bus_dma_tag_t dma_tag;
u32 wqe_sz;
struct mlx5e_rq_mbuf *mbuf;
-   struct device *pdev;
struct ifnet *ifp;
struct mlx5e_rq_stats stats;
struct mlx5e_cq cq;
@@ -542,7 +541,6 @@ struct mlx5e_sq {
struct  ifnet *ifp;
u32 sqn;
u32 bf_buf_size;
-   struct  device *pdev;
u32 mkey_be;
 
/* control path */
@@ -563,7 +561,6 @@ struct mlx5e_channel {
/* data path */
struct mlx5e_rq rq;
struct mlx5e_sq sq[MLX5E_MAX_TX_NUM_TC];
-   struct device *pdev;
struct ifnet *ifp;
u32 mkey_be;
u8  num_tc;

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:34:28 
2016(r306252)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Sep 23 08:35:11 
2016(r306253)
@@ -669,7 +669,6 @@ mlx5e_create_rq(struct mlx5e_channel *c,
wqe->data.byte_count = cpu_to_be32(byte_count | 
MLX5_HW_START_PADDING);
}
 
-   rq->pdev = c->pdev;
rq->ifp = c->ifp;
rq->channel = c;
rq->ix = c->ix;
@@ -968,7 +967,6 @@ mlx5e_create_sq(struct mlx5e_channel *c,
if (err)
goto err_sq_wq_destroy;
 
-   sq->pdev = c->pdev;
sq->mkey_be = c->mkey_be;
sq->ifp = priv->ifp;
sq->priv = priv;
@@ -1492,7 +1490,6 @@ mlx5e_open_channel(struct mlx5e_priv *pr
c->priv = priv;
c->ix = ix;
c->cpu = 0;
-   c->pdev = &priv->mdev->pdev->dev;
c->ifp = priv->ifp;
c->mkey_be = cpu_to_be32(priv->mr.key);
c->num_tc = priv->num_tc;
___
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: r306254 - stable/10/sys/dev/mlx5/mlx5_en

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 08:35:56 2016
New Revision: 306254
URL: https://svnweb.freebsd.org/changeset/base/306254

Log:
  MFC r305877:
  mlx5en: Fix duplicate mbuf free-by-code.
  
  When mlx5e_sq_xmit() returns an error code and the mbuf pointer is set,
  we should not free the mbuf, because the caller will keep the mbuf in
  the drbr. Make sure the mbuf pointer is correctly set upon function
  exit.
  
  Sponsored by: Mellanox Technologies

Modified:
  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/mlx5_en_tx.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Fri Sep 23 08:35:11 2016
(r306253)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Fri Sep 23 08:35:56 2016
(r306254)
@@ -224,10 +224,8 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struc
/* 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)) {
-   m_freem(mb);
+   if (pi < (MLX5_SEND_WQE_MAX_WQEBBS - 1))
return (ENOMEM);
-   }
}
 
/* Setup local variables */
@@ -338,10 +336,8 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struc
mb, segs, &nsegs, BUS_DMA_NOWAIT);
}
/* Catch errors */
-   if (err != 0) {
+   if (err != 0)
goto tx_drop;
-   }
-   *mbp = mb;
 
for (x = 0; x != nsegs; x++) {
if (segs[x].ds_len == 0)
@@ -374,6 +370,7 @@ skip_dma:
bus_dmamap_sync(sq->dma_tag, sq->mbuf[pi].dma_map, 
BUS_DMASYNC_PREWRITE);
 
sq->stats.packets++;
+   *mbp = NULL;/* safety clear */
return (0);
 
 tx_drop:
___
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: r306255 - stable/11/sys/boot/kshim

2016-09-23 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Sep 23 08:41:18 2016
New Revision: 306255
URL: https://svnweb.freebsd.org/changeset/base/306255

Log:
  MFC r305804:
  Make the callout structure in the boot loader's kernel shim more
  similar to the kernel one.

Modified:
  stable/11/sys/boot/kshim/bsd_kernel.c
  stable/11/sys/boot/kshim/bsd_kernel.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/boot/kshim/bsd_kernel.c
==
--- stable/11/sys/boot/kshim/bsd_kernel.c   Fri Sep 23 08:35:56 2016
(r306254)
+++ stable/11/sys/boot/kshim/bsd_kernel.c   Fri Sep 23 08:41:18 2016
(r306255)
@@ -432,8 +432,8 @@ callout_callback(struct callout *c)
}
mtx_unlock(&mtx_callout);
 
-   if (c->func)
-   (c->func) (c->arg);
+   if (c->c_func != NULL)
+   (c->c_func) (c->c_arg);
 
if (!(c->flags & CALLOUT_RETURNUNLOCKED))
mtx_unlock(c->mtx);
@@ -487,8 +487,8 @@ callout_reset(struct callout *c, int to_
 {
callout_stop(c);
 
-   c->func = func;
-   c->arg = arg;
+   c->c_func = func;
+   c->c_arg = arg;
c->timeout = ticks + to_ticks;
 
mtx_lock(&mtx_callout);
@@ -507,8 +507,8 @@ callout_stop(struct callout *c)
}
mtx_unlock(&mtx_callout);
 
-   c->func = NULL;
-   c->arg = NULL;
+   c->c_func = NULL;
+   c->c_arg = NULL;
 }
 
 void

Modified: stable/11/sys/boot/kshim/bsd_kernel.h
==
--- stable/11/sys/boot/kshim/bsd_kernel.h   Fri Sep 23 08:35:56 2016
(r306254)
+++ stable/11/sys/boot/kshim/bsd_kernel.h   Fri Sep 23 08:41:18 2016
(r306255)
@@ -299,8 +299,8 @@ extern volatile int ticks;
 
 struct callout {
LIST_ENTRY(callout) entry;
-   callout_fn_t *func;
-   void   *arg;
+   callout_fn_t *c_func;
+   void   *c_arg;
struct mtx *mtx;
int flags;
int timeout;
___
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: r306257 - head/lib/libc/sys

2016-09-23 Thread Konstantin Belousov
Author: kib
Date: Fri Sep 23 09:26:40 2016
New Revision: 306257
URL: https://svnweb.freebsd.org/changeset/base/306257

Log:
  Document r306081, i.e. procctl(PROC_TRAPCAP) and sysctl kern.trap_enocap.
  
  Reviewed by:  cem
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D8003

Modified:
  head/lib/libc/sys/cap_enter.2
  head/lib/libc/sys/procctl.2

Modified: head/lib/libc/sys/cap_enter.2
==
--- head/lib/libc/sys/cap_enter.2   Fri Sep 23 09:20:42 2016
(r306256)
+++ head/lib/libc/sys/cap_enter.2   Fri Sep 23 09:26:40 2016
(r306257)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 10, 2016
+.Dd September 22, 2016
 .Dt CAP_ENTER 2
 .Os
 .Sh NAME
@@ -69,6 +69,34 @@ appropriately-crafted applications or ap
 .Fn cap_getmode
 returns a flag indicating whether or not the process is in a capability mode
 sandbox.
+.Sh RUN-TIME SETTINGS
+If the
+.Dv kern.trap_enocap
+sysctl MIB is set to non-zero value, then for any process executing in a
+capability mode sandbox, any syscall which results in either
+.Er ENOTCAPABLE
+or
+.Er ECAPMODE
+error, also generates the synchronous
+.Dv SIGTRAP
+signal to the thread on the syscall return.
+On the signal delivery, the
+.Va si_errno
+member of the
+.Fa siginfo
+signal handler parameter is set to the syscall error value,
+and the
+.Va si_code
+member is set to
+.Dv TRAP_CAP .
+.Pp
+See also the
+.Dv PROC_TRAPCAP_CTL
+and
+.Dv PROC_TRAPCAP_STATUS
+operations of the
+.Xr procctl 2
+function for similar per-process functionality.
 .Sh CAVEAT
 Creating effective process sandboxes is a tricky process that involves
 identifying the least possible rights required by the process and then
@@ -116,6 +144,8 @@ points outside the process's allocated a
 .Xr cap_fcntls_limit 2 ,
 .Xr cap_ioctls_limit 2 ,
 .Xr cap_rights_limit 2 ,
+.Xr procctl 2 ,
+.Xr sysctl 2 ,
 .Xr fexecve 2 ,
 .Xr cap_sandboxed 3 ,
 .Xr capsicum 4

Modified: head/lib/libc/sys/procctl.2
==
--- head/lib/libc/sys/procctl.2 Fri Sep 23 09:20:42 2016(r306256)
+++ head/lib/libc/sys/procctl.2 Fri Sep 23 09:26:40 2016(r306257)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 21, 2015
+.Dd September 22, 2016
 .Dt PROCCTL 2
 .Os
 .Sh NAME
@@ -71,7 +71,7 @@ The control request to perform is specif
 .Fa cmd
 argument.
 The following commands are supported:
-.Bl -tag -width "PROC_REAP_GETPIDS"
+.Bl -tag -width "Dv PROC_TRAPCAP_STATUS"
 .It Dv PROC_SPROTECT
 Set process protection state.
 This is used to mark a process as protected from being killed if the system
@@ -327,6 +327,63 @@ is set to 0.
 If a debugger is attached,
 .Fa data
 is set to the pid of the debugger process.
+.It Dv PROC_TRAPCAP_CTL
+Enable or disable, for the specified processes which are executing in a
+capability mode sandbox, the synchronous
+.Dv SIGTRAP
+signal on return from any syscall which gives either
+.Er ENOTCAPABLE
+or
+.Er ECAPMODE
+error.
+.Pp
+Possible values for the
+.Fa data
+argument are:
+.Bl -tag -width "Dv PROC_TRAPCAP_CTL_DISABLE"
+.It Dv PROC_TRAPCAP_CTL_ENABLE
+Enable the
+.Dv SIGTRAP
+signal delivery on capability mode access violations.
+The enabled mode is inherited by the children of the process,
+and is kept after
+.Xr fexecve 2
+calls.
+.It Dv PROC_TRAPCAP_CTL_DISABLE
+Disable the signal delivery on capability mode access violations.
+Note that the global sysctl
+.Dv kern.trap_enocap
+might still cause the signal to be delivered; see
+.Xr capsicum 4 .
+.El
+.Pp
+On signal delivery, the
+.Va si_errno
+member of the
+.Fa siginfo
+signal handler parameter is set to the syscall error value,
+and the
+.Va si_code
+member is set to
+.Dv TRAP_CAP .
+.Pp
+See
+.Xr capsicum 4
+for more information about the capability mode.
+.It Dv PROC_TRAPCAP_STATUS
+Returns the current status of signalling capability mode access
+violations for the specified process.
+The integer value pointed to by the
+.Fa data
+argument is set to the
+.Dv PROC_TRAPCAP_CTL_ENABLE
+value if the process control enables signal delivery, and to
+.Dv PROC_TRAPCAP_CTL_DISABLE
+otherwise.
+.Pp
+See the note about sysctl
+.Dv kern.trap_enocap
+above, which gives independent global control of signal delivery.
 .El
 .Sh NOTES
 Disabling tracing on a process should not be considered a security
@@ -420,14 +477,18 @@ The value of the integer
 .Fa data
 parameter for the
 .Dv PROC_TRACE_CTL
+or
+.Dv PROC_TRAPCAP_CTL
 request is invalid.
 .El
 .Sh SEE ALSO
 .Xr dtrace 1 ,
+.Xr cap_enter 2,
 .Xr kill 2 ,
 .Xr ktrace 2 ,
 .Xr ptrace 2 ,
 .Xr wait 2 ,
+.Xr capsicum 4 ,
 .Xr hwpmc 4 ,
 .Xr init 8
 .Sh HISTORY
___
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: r306260 - in head/sys: kern sys

2016-09-23 Thread Konstantin Belousov
Author: kib
Date: Fri Sep 23 12:32:20 2016
New Revision: 306260
URL: https://svnweb.freebsd.org/changeset/base/306260

Log:
  Add the foundation copyrights to procctl kernel sources.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/kern_procctl.c
  head/sys/sys/procctl.h

Modified: head/sys/kern/kern_procctl.c
==
--- head/sys/kern/kern_procctl.cFri Sep 23 12:13:06 2016
(r306259)
+++ head/sys/kern/kern_procctl.cFri Sep 23 12:32:20 2016
(r306260)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2014 John Baldwin
- * Copyright (c) 2014 The FreeBSD Foundation
+ * Copyright (c) 2014, 2016 The FreeBSD Foundation
  *
  * Portions of this software were developed by Konstantin Belousov
  * under sponsorship from the FreeBSD Foundation.

Modified: head/sys/sys/procctl.h
==
--- head/sys/sys/procctl.h  Fri Sep 23 12:13:06 2016(r306259)
+++ head/sys/sys/procctl.h  Fri Sep 23 12:32:20 2016(r306260)
@@ -1,8 +1,12 @@
 /*-
  * Copyright (c) 2013 Hudson River Trading LLC
+ * Copyright (c) 2014, 2016 The FreeBSD Foundation
  * Written by: John H. Baldwin 
  * All rights reserved.
  *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
___
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: r306261 - in head/usr.bin: . proccontrol

2016-09-23 Thread Konstantin Belousov
Author: kib
Date: Fri Sep 23 12:34:54 2016
New Revision: 306261
URL: https://svnweb.freebsd.org/changeset/base/306261

Log:
  Provide proccontrol(1), an utility to control processes behaviour, related
  to procctl(2).
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Added:
  head/usr.bin/proccontrol/
  head/usr.bin/proccontrol/Makefile   (contents, props changed)
  head/usr.bin/proccontrol/proccontrol.c   (contents, props changed)
Modified:
  head/usr.bin/Makefile

Modified: head/usr.bin/Makefile
==
--- head/usr.bin/Makefile   Fri Sep 23 12:32:20 2016(r306260)
+++ head/usr.bin/Makefile   Fri Sep 23 12:34:54 2016(r306261)
@@ -122,6 +122,7 @@ SUBDIR= alias \
pr \
printenv \
printf \
+   proccontrol \
procstat \
protect \
rctl \

Added: head/usr.bin/proccontrol/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/proccontrol/Makefile   Fri Sep 23 12:34:54 2016
(r306261)
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+PROG=   proccontrol
+WARNS?=6
+MK_MAN=no
+
+.include 

Added: head/usr.bin/proccontrol/proccontrol.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/proccontrol/proccontrol.c  Fri Sep 23 12:34:54 2016
(r306261)
@@ -0,0 +1,180 @@
+/*-
+ * Copyright (c) 2016 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Konstantin Belousov 
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+enum {
+   MODE_INVALID,
+   MODE_TRACE,
+   MODE_TRAPCAP,
+};
+
+static pid_t
+str2pid(const char *str)
+{
+   pid_t res;
+   char *tail;
+
+   res = strtol(str, &tail, 0);
+   if (*tail != '\0') {
+   warnx("non-numeric pid");
+   return (-1);
+   }
+   return (res);
+}
+
+static void __dead2
+usage(void)
+{
+
+   fprintf(stderr, "Usage: proccontrol -m (trace|trapcap) [-q] "
+   "[-s (enable|disable)] [-p pid | command]\n");
+   exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+   int arg, ch, error, mode;
+   pid_t pid;
+   bool enable, do_command, query;
+
+   mode = MODE_INVALID;
+   enable = true;
+   pid = -1;
+   query = false;
+   while ((ch = getopt(argc, argv, "m:qs:p:")) != -1) {
+   switch (ch) {
+   case 'm':
+   if (strcmp(optarg, "trace") == 0)
+   mode = MODE_TRACE;
+   else if (strcmp(optarg, "trapcap") == 0)
+   mode = MODE_TRAPCAP;
+   else
+   usage();
+   break;
+   case 's':
+   if (strcmp(optarg, "enable") == 0)
+   enable = true;
+   else if (strcmp(optarg, "disable") == 0)
+   enable = false;
+   else
+   usage();
+   break;
+   case 'p':
+   pid = str2pid(optarg);
+   break;
+   case 'q':
+   query = true;
+   break;
+   case '?':
+   default:
+

svn commit: r306262 - in head/sys/arm: allwinner altera/socfpga amlogic/aml8726 annapurna/alpine arm broadcom/bcm2835 freescale/imx freescale/vybrid include mv nvidia/tegra124 qemu rockchip samsung...

2016-09-23 Thread Andrew Turner
Author: andrew
Date: Fri Sep 23 12:38:05 2016
New Revision: 306262
URL: https://svnweb.freebsd.org/changeset/base/306262

Log:
  Remove bus_dma_get_range and bus_dma_get_range_nb on armv6. We only need
  this on a few earlier arm SoCs.
  
  Reviewed by:  manu (earlier version)
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm/allwinner/aw_machdep.c
  head/sys/arm/altera/socfpga/socfpga_machdep.c
  head/sys/arm/amlogic/aml8726/aml8726_machdep.c
  head/sys/arm/annapurna/alpine/alpine_machdep.c
  head/sys/arm/arm/busdma_machdep-v6.c
  head/sys/arm/arm/platform.c
  head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
  head/sys/arm/freescale/imx/imx_machdep.c
  head/sys/arm/freescale/vybrid/vf_machdep.c
  head/sys/arm/include/bus_dma.h
  head/sys/arm/mv/mv_machdep.c
  head/sys/arm/nvidia/tegra124/tegra124_machdep.c
  head/sys/arm/qemu/virt_machdep.c
  head/sys/arm/rockchip/rk30xx_machdep.c
  head/sys/arm/samsung/exynos/exynos5_machdep.c
  head/sys/arm/ti/ti_machdep.c
  head/sys/arm/versatile/versatile_machdep.c
  head/sys/arm/xilinx/zy7_machdep.c

Modified: head/sys/arm/allwinner/aw_machdep.c
==
--- head/sys/arm/allwinner/aw_machdep.c Fri Sep 23 12:34:54 2016
(r306261)
+++ head/sys/arm/allwinner/aw_machdep.c Fri Sep 23 12:38:05 2016
(r306262)
@@ -36,7 +36,6 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#define _ARM32_BUS_DMA_PRIVATE
 #include 
 #include 
 #include 
@@ -147,18 +146,6 @@ allwinner_devmap_init(platform_t plat)
return (0);
 }
 
-struct arm32_dma_range *
-bus_dma_get_range(void)
-{
-   return (NULL);
-}
-
-int
-bus_dma_get_range_nb(void)
-{
-   return (0);
-}
-
 void
 cpu_reset()
 {

Modified: head/sys/arm/altera/socfpga/socfpga_machdep.c
==
--- head/sys/arm/altera/socfpga/socfpga_machdep.c   Fri Sep 23 12:34:54 
2016(r306261)
+++ head/sys/arm/altera/socfpga/socfpga_machdep.c   Fri Sep 23 12:38:05 
2016(r306262)
@@ -34,7 +34,6 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#define_ARM32_BUS_DMA_PRIVATE
 #include 
 #include 
 #include 
@@ -100,17 +99,3 @@ platform_devmap_init(void)
 
return (0);
 }
-
-struct arm32_dma_range *
-bus_dma_get_range(void)
-{
-
-   return (NULL);
-}
-
-int
-bus_dma_get_range_nb(void)
-{
-
-   return (0);
-}

Modified: head/sys/arm/amlogic/aml8726/aml8726_machdep.c
==
--- head/sys/arm/amlogic/aml8726/aml8726_machdep.c  Fri Sep 23 12:34:54 
2016(r306261)
+++ head/sys/arm/amlogic/aml8726/aml8726_machdep.c  Fri Sep 23 12:38:05 
2016(r306262)
@@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$");
 
 #include "opt_platform.h"
 
-#define _ARM32_BUS_DMA_PRIVATE
 #include 
 #include 
 #include 
@@ -166,20 +165,6 @@ platform_devmap_init(void)
return (0);
 }
 
-struct arm32_dma_range *
-bus_dma_get_range(void)
-{
-
-   return (NULL);
-}
-
-int
-bus_dma_get_range_nb(void)
-{
-
-   return (0);
-}
-
 struct fdt_fixup_entry fdt_fixup_table[] = {
{ NULL, NULL }
 };

Modified: head/sys/arm/annapurna/alpine/alpine_machdep.c
==
--- head/sys/arm/annapurna/alpine/alpine_machdep.c  Fri Sep 23 12:34:54 
2016(r306261)
+++ head/sys/arm/annapurna/alpine/alpine_machdep.c  Fri Sep 23 12:38:05 
2016(r306262)
@@ -29,7 +29,6 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#define _ARM32_BUS_DMA_PRIVATE
 #include 
 #include 
 #include 
@@ -92,17 +91,3 @@ platform_devmap_init(void)
devmap_add_entry(al_devmap_pa, al_devmap_size);
return (0);
 }
-
-struct arm32_dma_range *
-bus_dma_get_range(void)
-{
-
-   return (NULL);
-}
-
-int
-bus_dma_get_range_nb(void)
-{
-
-   return (0);
-}

Modified: head/sys/arm/arm/busdma_machdep-v6.c
==
--- head/sys/arm/arm/busdma_machdep-v6.cFri Sep 23 12:34:54 2016
(r306261)
+++ head/sys/arm/arm/busdma_machdep-v6.cFri Sep 23 12:38:05 2016
(r306262)
@@ -33,7 +33,6 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#define _ARM32_BUS_DMA_PRIVATE
 #include 
 #include 
 #include 
@@ -95,14 +94,6 @@ struct bus_dma_tag {
bus_dma_lock_t  *lockfunc;
void*lockfuncarg;
struct bounce_zone  *bounce_zone;
-   /*
-* DMA range for this tag.  If the page doesn't fall within
-* one of these ranges, an error is returned.  The caller
-* may then decide what to do with the transfer.  If the
-* range pointer is NULL, it is ignored.
-*/
-   struct arm32_dma_range  *ranges;
-   int _nranges;
 };
 
 struct bounce_page {
@@ -407,22 +398,6 @@ must_bounce(bus_dma_tag_t dmat, bus_dmam
return (0);
 }
 
-static __inline struct arm32_

svn commit: r306263 - in head/sys/arm: allwinner arm broadcom/bcm2835 freescale/imx nvidia/tegra124 qemu ti

2016-09-23 Thread Andrew Turner
Author: andrew
Date: Fri Sep 23 13:08:15 2016
New Revision: 306263
URL: https://svnweb.freebsd.org/changeset/base/306263

Log:
  Move cpu_reset to be a platform method to allow multiple implementations.
  
  Reviewed by:  mmel
  Sponsored by: ABT Systems Ltd
  Differential Revision:https://reviews.freebsd.org/D8010

Modified:
  head/sys/arm/allwinner/aw_machdep.c
  head/sys/arm/arm/platform.c
  head/sys/arm/arm/platform_if.m
  head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
  head/sys/arm/freescale/imx/imx51_machdep.c
  head/sys/arm/freescale/imx/imx53_machdep.c
  head/sys/arm/freescale/imx/imx6_machdep.c
  head/sys/arm/nvidia/tegra124/tegra124_machdep.c
  head/sys/arm/qemu/virt_machdep.c
  head/sys/arm/ti/ti_machdep.c

Modified: head/sys/arm/allwinner/aw_machdep.c
==
--- head/sys/arm/allwinner/aw_machdep.c Fri Sep 23 12:38:05 2016
(r306262)
+++ head/sys/arm/allwinner/aw_machdep.c Fri Sep 23 13:08:15 2016
(r306263)
@@ -146,8 +146,8 @@ allwinner_devmap_init(platform_t plat)
return (0);
 }
 
-void
-cpu_reset()
+static void
+allwinner_cpu_reset(platform_t plat)
 {
aw_wdog_watchdog_reset();
printf("Reset failed!\n");
@@ -159,6 +159,7 @@ static platform_method_t a10_methods[] =
PLATFORMMETHOD(platform_attach, a10_attach),
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
+   PLATFORMMETHOD(platform_cpu_reset,  allwinner_cpu_reset),
 
PLATFORMMETHOD_END,
 };
@@ -170,6 +171,7 @@ static platform_method_t a13_methods[] =
PLATFORMMETHOD(platform_attach, a13_attach),
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
+   PLATFORMMETHOD(platform_cpu_reset,  allwinner_cpu_reset),
 
PLATFORMMETHOD_END,
 };
@@ -181,6 +183,7 @@ static platform_method_t a20_methods[] =
PLATFORMMETHOD(platform_attach, a20_attach),
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
+   PLATFORMMETHOD(platform_cpu_reset,  allwinner_cpu_reset),
 
 #ifdef SMP
PLATFORMMETHOD(platform_mp_start_ap,aw_mp_start_ap),
@@ -196,6 +199,7 @@ static platform_method_t a31_methods[] =
PLATFORMMETHOD(platform_attach, a31_attach),
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
+   PLATFORMMETHOD(platform_cpu_reset,  allwinner_cpu_reset),
 
 #ifdef SMP
PLATFORMMETHOD(platform_mp_start_ap,aw_mp_start_ap),
@@ -211,6 +215,7 @@ static platform_method_t a31s_methods[] 
PLATFORMMETHOD(platform_attach, a31s_attach),
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
+   PLATFORMMETHOD(platform_cpu_reset,  allwinner_cpu_reset),
 
 #ifdef SMP
PLATFORMMETHOD(platform_mp_start_ap,aw_mp_start_ap),
@@ -226,6 +231,7 @@ static platform_method_t a83t_methods[] 
PLATFORMMETHOD(platform_attach, a83t_attach),
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
+   PLATFORMMETHOD(platform_cpu_reset,  allwinner_cpu_reset),
 
 #ifdef SMP
PLATFORMMETHOD(platform_mp_start_ap,a83t_mp_start_ap),
@@ -241,6 +247,7 @@ static platform_method_t h3_methods[] = 
PLATFORMMETHOD(platform_attach, h3_attach),
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
+   PLATFORMMETHOD(platform_cpu_reset,  allwinner_cpu_reset),
 
 #ifdef SMP
PLATFORMMETHOD(platform_mp_start_ap,aw_mp_start_ap),

Modified: head/sys/arm/arm/platform.c
==
--- head/sys/arm/arm/platform.c Fri Sep 23 12:38:05 2016(r306262)
+++ head/sys/arm/arm/platform.c Fri Sep 23 13:08:15 2016(r306263)
@@ -188,6 +188,20 @@ platform_late_init(void)
PLATFORM_LATE_INIT(plat_obj);
 }
 
+void
+cpu_reset(void)
+{
+
+   PLATFORM_CPU_RESET(plat_obj);
+
+   printf("cpu_reset failed");
+
+   intr_disable();
+   while(1) {
+   cpu_sleep(0);
+   }
+}
+
 #ifdef MULTIDELAY
 static void
 platform_delay(int usec, void *arg __unused)

Modified: head/sys/arm/arm/platform_if.m
==
--- head/sys/arm/arm/platform_if.m  Fri Sep 23 12:38:05 2016
(r306262)
+++ head/sys/arm/arm/platform_if.m  Fri Sep 23 13:08:15 2016
(r306263)
@@ -133,3 +133,10 @@ METHOD void 

svn commit: r306264 - in head/sys/boot/efi/loader/arch: amd64 i386

2016-09-23 Thread Ed Maste
Author: emaste
Date: Fri Sep 23 13:18:59 2016
New Revision: 306264
URL: https://svnweb.freebsd.org/changeset/base/306264

Log:
  Use 32-bit value for .text padding, for linker portability
  
  GNU ld interprets the padding value as a variable-length byte string,
  while GNU gold and LLVM lld interpret it as a 32-bit value.

Modified:
  head/sys/boot/efi/loader/arch/amd64/ldscript.amd64
  head/sys/boot/efi/loader/arch/i386/ldscript.i386

Modified: head/sys/boot/efi/loader/arch/amd64/ldscript.amd64
==
--- head/sys/boot/efi/loader/arch/amd64/ldscript.amd64  Fri Sep 23 13:08:15 
2016(r306263)
+++ head/sys/boot/efi/loader/arch/amd64/ldscript.amd64  Fri Sep 23 13:18:59 
2016(r306264)
@@ -19,7 +19,7 @@ SECTIONS
 /* .gnu.warning sections are handled specially by elf32.em. */
 *(.gnu.warning)
 *(.plt)
-  } =0xCC
+  } =0x
   . = ALIGN(4096);
   .data: {
 *(.rodata .rodata.* .gnu.linkonce.r.*)

Modified: head/sys/boot/efi/loader/arch/i386/ldscript.i386
==
--- head/sys/boot/efi/loader/arch/i386/ldscript.i386Fri Sep 23 13:08:15 
2016(r306263)
+++ head/sys/boot/efi/loader/arch/i386/ldscript.i386Fri Sep 23 13:18:59 
2016(r306264)
@@ -14,7 +14,7 @@ SECTIONS
 /* .gnu.warning sections are handled specially by elf32.em. */
 *(.gnu.warning)
 *(.plt)
-  } =0xCC
+  } =0x
   . = ALIGN(4096);
   .data: {
 *(.rodata .rodata.* .gnu.linkonce.r.*)
___
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: r306265 - head/share/mk

2016-09-23 Thread Ed Maste
Author: emaste
Date: Fri Sep 23 13:21:29 2016
New Revision: 306265
URL: https://svnweb.freebsd.org/changeset/base/306265

Log:
  Force LLVM_LIBUNWIND off if we don't have a C++11 compiler
  
  Tested by:bde
  Differential Revision:https://reviews.freebsd.org/D7746

Modified:
  head/share/mk/src.opts.mk

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Fri Sep 23 13:18:59 2016(r306264)
+++ head/share/mk/src.opts.mk   Fri Sep 23 13:21:29 2016(r306265)
@@ -289,6 +289,10 @@ MK_${var}:=no
 # Force some options off if their dependencies are off.
 # Order is somewhat important.
 #
+.if !${COMPILER_FEATURES:Mc++11}
+MK_LLVM_LIBUNWIND:=no
+.endif
+
 .if ${MK_LIBPTHREAD} == "no"
 MK_LIBTHR:=no
 .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: r306266 - head/lib/libcompiler_rt

2016-09-23 Thread Ed Maste
Author: emaste
Date: Fri Sep 23 13:23:52 2016
New Revision: 306266
URL: https://svnweb.freebsd.org/changeset/base/306266

Log:
  libcompiler_rt: use ${SRCTOP} for the top of the FreeBSD tree

Modified:
  head/lib/libcompiler_rt/Makefile

Modified: head/lib/libcompiler_rt/Makefile
==
--- head/lib/libcompiler_rt/MakefileFri Sep 23 13:21:29 2016
(r306265)
+++ head/lib/libcompiler_rt/MakefileFri Sep 23 13:23:52 2016
(r306266)
@@ -8,7 +8,7 @@ NO_PIC=
 WARNS?=2
 
 CFLAGS+=${PICFLAG} -fvisibility=hidden -DVISIBILITY_HIDDEN
-CFLAGS+=-I${.CURDIR}/../../contrib/libcxxrt
+CFLAGS+=-I${SRCTOP}/contrib/libcxxrt
 
 .if ${MACHINE_CPUARCH} == "amd64"
 CRTARCH=x86_64
@@ -16,7 +16,7 @@ CRTARCH=x86_64
 CRTARCH=${MACHINE_CPUARCH}
 .endif
 
-CRTSRC=${.CURDIR}/../../contrib/compiler-rt/lib/builtins
+CRTSRC=${SRCTOP}/contrib/compiler-rt/lib/builtins
 
 .PATH: ${CRTSRC}/${CRTARCH} ${CRTSRC}
 
___
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: r306267 - in head/sys: arm/allwinner arm/altera/socfpga arm/amlogic/aml8726 arm/annapurna/alpine arm/at91 arm/broadcom/bcm2835 arm/freescale/imx arm/freescale/vybrid arm/lpc arm/nvidia/...

2016-09-23 Thread Andrew Turner
Author: andrew
Date: Fri Sep 23 14:11:23 2016
New Revision: 306267
URL: https://svnweb.freebsd.org/changeset/base/306267

Log:
  Restrict where we need to define fdt_fixup_table to just PowerPC and
  Marvell.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm/allwinner/a10_common.c
  head/sys/arm/altera/socfpga/socfpga_common.c
  head/sys/arm/amlogic/aml8726/aml8726_machdep.c
  head/sys/arm/annapurna/alpine/common.c
  head/sys/arm/at91/at91_common.c
  head/sys/arm/broadcom/bcm2835/bcm2835_common.c
  head/sys/arm/freescale/imx/imx6_machdep.c
  head/sys/arm/freescale/imx/imx_common.c
  head/sys/arm/freescale/vybrid/vf_common.c
  head/sys/arm/lpc/lpc_intc.c
  head/sys/arm/nvidia/tegra124/tegra124_machdep.c
  head/sys/arm/qemu/virt_common.c
  head/sys/arm/rockchip/rk30xx_common.c
  head/sys/arm/samsung/exynos/exynos5_common.c
  head/sys/arm/ti/ti_common.c
  head/sys/arm/versatile/versatile_common.c
  head/sys/arm/xilinx/zy7_machdep.c
  head/sys/dev/ofw/ofw_fdt.c

Modified: head/sys/arm/allwinner/a10_common.c
==
--- head/sys/arm/allwinner/a10_common.c Fri Sep 23 13:23:52 2016
(r306266)
+++ head/sys/arm/allwinner/a10_common.c Fri Sep 23 14:11:23 2016
(r306267)
@@ -38,10 +38,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-struct fdt_fixup_entry fdt_fixup_table[] = {
-   { NULL, NULL }
-};
-
 #ifndef INTRNG
 
 static int

Modified: head/sys/arm/altera/socfpga/socfpga_common.c
==
--- head/sys/arm/altera/socfpga/socfpga_common.cFri Sep 23 13:23:52 
2016(r306266)
+++ head/sys/arm/altera/socfpga/socfpga_common.cFri Sep 23 14:11:23 
2016(r306267)
@@ -70,10 +70,6 @@ end:
while (1);
 }
 
-struct fdt_fixup_entry fdt_fixup_table[] = {
-   { NULL, NULL }
-};
-
 #ifndef INTRNG
 static int
 fdt_pic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,

Modified: head/sys/arm/amlogic/aml8726/aml8726_machdep.c
==
--- head/sys/arm/amlogic/aml8726/aml8726_machdep.c  Fri Sep 23 13:23:52 
2016(r306266)
+++ head/sys/arm/amlogic/aml8726/aml8726_machdep.c  Fri Sep 23 14:11:23 
2016(r306267)
@@ -165,10 +165,6 @@ platform_devmap_init(void)
return (0);
 }
 
-struct fdt_fixup_entry fdt_fixup_table[] = {
-   { NULL, NULL }
-};
-
 #ifndef INTRNG
 #ifndef DEV_GIC
 static int

Modified: head/sys/arm/annapurna/alpine/common.c
==
--- head/sys/arm/annapurna/alpine/common.c  Fri Sep 23 13:23:52 2016
(r306266)
+++ head/sys/arm/annapurna/alpine/common.c  Fri Sep 23 14:11:23 2016
(r306267)
@@ -56,9 +56,6 @@ __FBSDID("$FreeBSD$");
 #define LOCK   0x0001
 
 extern bus_addr_t  al_devmap_pa;
-struct fdt_fixup_entry fdt_fixup_table[] = {
-   { NULL, NULL }
-};
 
 static int alpine_get_wdt_base(uint32_t *pbase, uint32_t *psize);
 static int alpine_pic_decode_fdt(uint32_t iparent, uint32_t *intr,

Modified: head/sys/arm/at91/at91_common.c
==
--- head/sys/arm/at91/at91_common.c Fri Sep 23 13:23:52 2016
(r306266)
+++ head/sys/arm/at91/at91_common.c Fri Sep 23 14:11:23 2016
(r306267)
@@ -49,10 +49,6 @@ __FBSDID("$FreeBSD$");
 
 extern const struct devmap_entry at91_devmap[];
 
-struct fdt_fixup_entry fdt_fixup_table[] = {
-   { NULL, NULL }
-};
-
 #ifndef INTRNG
 static int
 fdt_aic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_common.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_common.c  Fri Sep 23 13:23:52 
2016(r306266)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_common.c  Fri Sep 23 14:11:23 
2016(r306267)
@@ -46,10 +46,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-struct fdt_fixup_entry fdt_fixup_table[] = {
-   { NULL, NULL }
-};
-
 #ifndef INTRNG
 static int
 fdt_intc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,

Modified: head/sys/arm/freescale/imx/imx6_machdep.c
==
--- head/sys/arm/freescale/imx/imx6_machdep.c   Fri Sep 23 13:23:52 2016
(r306266)
+++ head/sys/arm/freescale/imx/imx6_machdep.c   Fri Sep 23 14:11:23 2016
(r306267)
@@ -52,10 +52,6 @@ __FBSDID("$FreeBSD$");
 
 #include "platform_if.h"
 
-struct fdt_fixup_entry fdt_fixup_table[] = {
-   { NULL, NULL }
-};
-
 static uint32_t gpio1_node;
 
 #ifndef INTRNG

Modified: head/sys/arm/freescale/imx/imx_common.c
==
--- head/sys/arm/freescale/imx/imx_common.c 

svn commit: r306268 - head/sys/arm/broadcom/bcm2835

2016-09-23 Thread Andrew Turner
Author: andrew
Date: Fri Sep 23 15:28:15 2016
New Revision: 306268
URL: https://svnweb.freebsd.org/changeset/base/306268

Log:
  Also implement platform_cpu_reset on bcm2836

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Fri Sep 23 14:11:23 
2016(r306267)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Fri Sep 23 15:28:15 
2016(r306268)
@@ -137,6 +137,7 @@ static platform_method_t bcm2836_methods
PLATFORMMETHOD(platform_devmap_init,bcm2836_devmap_init),
PLATFORMMETHOD(platform_lastaddr,   bcm2835_lastaddr),
PLATFORMMETHOD(platform_late_init,  bcm2835_late_init),
+   PLATFORMMETHOD(platform_cpu_reset,  bcm2835_cpu_reset),
 
PLATFORMMETHOD_END,
 };
___
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: r306272 - head/sys/sys

2016-09-23 Thread Mateusz Guzik
Author: mjg
Date: Fri Sep 23 16:47:12 2016
New Revision: 306272
URL: https://svnweb.freebsd.org/changeset/base/306272

Log:
  fd: hide fd_modified under CAPABILITIES
  
  It has no use without it and is now less error prone.

Modified:
  head/sys/sys/filedesc.h

Modified: head/sys/sys/filedesc.h
==
--- head/sys/sys/filedesc.h Fri Sep 23 16:22:03 2016(r306271)
+++ head/sys/sys/filedesc.h Fri Sep 23 16:47:12 2016(r306272)
@@ -229,12 +229,14 @@ fdeget_locked(struct filedesc *fdp, int 
return (fde);
 }
 
+#ifdef CAPABILITIES
 static __inline bool
 fd_modified(struct filedesc *fdp, int fd, seq_t seq)
 {
 
return (!seq_consistent(fd_seq(fdp->fd_files, fd), seq));
 }
+#endif
 
 /* cdir/rdir/jdir manipulation functions. */
 void   pwd_chdir(struct thread *td, struct vnode *vp);
___
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: r306273 - head/sys/dev/cxgbe

2016-09-23 Thread Navdeep Parhar
Author: np
Date: Fri Sep 23 17:24:06 2016
New Revision: 306273
URL: https://svnweb.freebsd.org/changeset/base/306273

Log:
  cxgbe(4): Fix netmap with T6, which doesn't encapsulate SGE_EGR_UPDATE
  message inside a FW_MSG.  The base NIC already deals with updates in
  either form.
  
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/t4_netmap.c

Modified: head/sys/dev/cxgbe/t4_netmap.c
==
--- head/sys/dev/cxgbe/t4_netmap.c  Fri Sep 23 16:47:12 2016
(r306272)
+++ head/sys/dev/cxgbe/t4_netmap.c  Fri Sep 23 17:24:06 2016
(r306273)
@@ -883,19 +883,23 @@ cxgbe_nm_detach(struct vi_info *vi)
netmap_detach(vi->ifp);
 }
 
+static inline const void *
+unwrap_nm_fw6_msg(const struct cpl_fw6_msg *cpl)
+{
+
+   MPASS(cpl->type == FW_TYPE_RSSCPL || cpl->type == FW6_TYPE_RSSCPL);
+
+   /* data[0] is RSS header */
+   return (&cpl->data[1]);
+}
+
 static void
-handle_nm_fw6_msg(struct adapter *sc, struct ifnet *ifp,
-const struct cpl_fw6_msg *cpl)
+handle_nm_sge_egr_update(struct adapter *sc, struct ifnet *ifp,
+const struct cpl_sge_egr_update *egr)
 {
-   const struct cpl_sge_egr_update *egr;
uint32_t oq;
struct sge_nm_txq *nm_txq;
 
-   if (cpl->type != FW_TYPE_RSSCPL && cpl->type != FW6_TYPE_RSSCPL)
-   panic("%s: FW_TYPE 0x%x on nm_rxq.", __func__, cpl->type);
-
-   /* data[0] is RSS header */
-   egr = (const void *)&cpl->data[1];
oq = be32toh(egr->opcode_qid);
MPASS(G_CPL_OPCODE(oq) == CPL_SGE_EGR_UPDATE);
nm_txq = (void *)sc->sge.eqmap[G_EGR_QID(oq) - sc->sge.eq_start];
@@ -914,6 +918,7 @@ t4_nm_intr(void *arg)
struct netmap_kring *kring = &na->rx_rings[nm_rxq->nid];
struct netmap_ring *ring = kring->ring;
struct iq_desc *d = &nm_rxq->iq_desc[nm_rxq->iq_cidx];
+   const void *cpl;
uint32_t lq;
u_int n = 0, work = 0;
uint8_t opcode;
@@ -926,6 +931,7 @@ t4_nm_intr(void *arg)
 
lq = be32toh(d->rsp.pldbuflen_qid);
opcode = d->rss.opcode;
+   cpl = &d->cpl[0];
 
switch (G_RSPD_TYPE(d->rsp.u.type_gen)) {
case X_RSPD_TYPE_FLBUF:
@@ -942,8 +948,10 @@ t4_nm_intr(void *arg)
switch (opcode) {
case CPL_FW4_MSG:
case CPL_FW6_MSG:
-   handle_nm_fw6_msg(sc, ifp,
-   (const void *)&d->cpl[0]);
+   cpl = unwrap_nm_fw6_msg(cpl);
+   /* fall through */
+   case CPL_SGE_EGR_UPDATE:
+   handle_nm_sge_egr_update(sc, ifp, cpl);
break;
case CPL_RX_PKT:
ring->slot[fl_cidx].len = G_RSPD_LEN(lq) -
___
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: r306274 - head/sys/dev/evdev

2016-09-23 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Sep 23 18:54:08 2016
New Revision: 306274
URL: https://svnweb.freebsd.org/changeset/base/306274

Log:
  Handle NULL argument in evdev_free
  
  Add check for evdev argument of evdev_free being NULL. This is valid
  value and should not cause crash. In this case evdev_free does nothing
  
  Submitted by: Vladimir Kondratiev 

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

Modified: head/sys/dev/evdev/evdev.c
==
--- head/sys/dev/evdev/evdev.c  Fri Sep 23 17:24:06 2016(r306273)
+++ head/sys/dev/evdev/evdev.c  Fri Sep 23 18:54:08 2016(r306274)
@@ -92,7 +92,8 @@ void
 evdev_free(struct evdev_dev *evdev)
 {
 
-   if (evdev->ev_cdev != NULL && evdev->ev_cdev->si_drv1 != NULL)
+   if (evdev != NULL && evdev->ev_cdev != NULL &&
+   evdev->ev_cdev->si_drv1 != NULL)
evdev_unregister(evdev);
 
free(evdev, M_EVDEV);
___
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: r306275 - head/sys/dev/usb/input

2016-09-23 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Sep 23 18:55:32 2016
New Revision: 306275
URL: https://svnweb.freebsd.org/changeset/base/306275

Log:
  Do not perform extra check for NULL, evdev_free can handle NULL value
  
  Submitted by: Vladimir Kondratiev 

Modified:
  head/sys/dev/usb/input/ukbd.c

Modified: head/sys/dev/usb/input/ukbd.c
==
--- head/sys/dev/usb/input/ukbd.c   Fri Sep 23 18:54:08 2016
(r306274)
+++ head/sys/dev/usb/input/ukbd.c   Fri Sep 23 18:55:32 2016
(r306275)
@@ -1432,8 +1432,7 @@ ukbd_detach(device_t dev)
 #endif
 
 #ifdef EVDEV
-   if (sc->sc_evdev != NULL)
-   evdev_free(sc->sc_evdev);
+   evdev_free(sc->sc_evdev);
 #endif
 
if (KBD_IS_CONFIGURED(&sc->sc_kbd)) {
___
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: r306276 - in head: sbin/mount_msdosfs sys/fs/msdosfs sys/sys

2016-09-23 Thread Alan Somers
Author: asomers
Date: Fri Sep 23 19:05:07 2016
New Revision: 306276
URL: https://svnweb.freebsd.org/changeset/base/306276

Log:
  Mount msdosfs with longnames support by default.
  
  The old behavior depended on the FAT version and on what files were in the
  root directory. "mount_msdosfs -o shortnames" is still supported.
  
  Reviewed by:  wblock, cem
  Discussed with:   trasz, adrian, imp
  MFC after:4 weeks
  X-MFC-Notes:  Don't MFC the removal of findwin95
  Differential Revision:https://reviews.freebsd.org/D8018

Modified:
  head/sbin/mount_msdosfs/mount_msdosfs.8
  head/sys/fs/msdosfs/denode.h
  head/sys/fs/msdosfs/msdosfs_lookup.c
  head/sys/fs/msdosfs/msdosfs_vfsops.c
  head/sys/sys/param.h

Modified: head/sbin/mount_msdosfs/mount_msdosfs.8
==
--- head/sbin/mount_msdosfs/mount_msdosfs.8 Fri Sep 23 18:55:32 2016
(r306275)
+++ head/sbin/mount_msdosfs/mount_msdosfs.8 Fri Sep 23 19:05:07 2016
(r306276)
@@ -142,15 +142,8 @@ If neither
 nor
 .Fl l
 are given,
-.Nm
-searches the root directory of the file system to
-be mounted for any existing Win'95 long filenames.
-If no such entries are found, but short DOS filenames are found,
-.Fl s
-is the default.
-Otherwise
 .Fl l
-is assumed.
+is the default.
 .It Fl 9
 Ignore the special Win'95 directory entries even
 if deleting or renaming a file.

Modified: head/sys/fs/msdosfs/denode.h
==
--- head/sys/fs/msdosfs/denode.hFri Sep 23 18:55:32 2016
(r306275)
+++ head/sys/fs/msdosfs/denode.hFri Sep 23 19:05:07 2016
(r306276)
@@ -265,7 +265,6 @@ int msdosfs_reclaim(struct vop_reclaim_a
  */
 int deget(struct msdosfsmount *, u_long, u_long, struct denode **);
 int uniqdosname(struct denode *, struct componentname *, u_char *);
-int findwin95(struct denode *);
 
 int readep(struct msdosfsmount *pmp, u_long dirclu, u_long dirofs,  struct buf 
**bpp, struct direntry **epp);
 int readde(struct denode *dep, struct buf **bpp, struct direntry **epp);

Modified: head/sys/fs/msdosfs/msdosfs_lookup.c
==
--- head/sys/fs/msdosfs/msdosfs_lookup.cFri Sep 23 18:55:32 2016
(r306275)
+++ head/sys/fs/msdosfs/msdosfs_lookup.cFri Sep 23 19:05:07 2016
(r306276)
@@ -1062,55 +1062,3 @@ uniqdosname(struct denode *dep, struct c
}
}
 }
-
-/*
- * Find any Win'95 long filename entry in directory dep
- */
-int
-findwin95(struct denode *dep)
-{
-   struct msdosfsmount *pmp = dep->de_pmp;
-   struct direntry *dentp;
-   int blsize, win95;
-   u_long cn;
-   daddr_t bn;
-   struct buf *bp;
-
-   win95 = 1;
-   /*
-* Read through the directory looking for Win'95 entries
-* Note: Error currently handled just as EOFXXX
-*/
-   for (cn = 0;; cn++) {
-   if (pcbmap(dep, cn, &bn, 0, &blsize))
-   return (win95);
-   if (bread(pmp->pm_devvp, bn, blsize, NOCRED, &bp)) {
-   brelse(bp);
-   return (win95);
-   }
-   for (dentp = (struct direntry *)bp->b_data;
-(char *)dentp < bp->b_data + blsize;
-dentp++) {
-   if (dentp->deName[0] == SLOT_EMPTY) {
-   /*
-* Last used entry and not found
-*/
-   brelse(bp);
-   return (win95);
-   }
-   if (dentp->deName[0] == SLOT_DELETED) {
-   /*
-* Ignore deleted files
-* Note: might be an indication of Win'95 
anywayXXX
-*/
-   continue;
-   }
-   if (dentp->deAttributes == ATTR_WIN95) {
-   brelse(bp);
-   return 1;
-   }
-   win95 = 0;
-   }
-   brelse(bp);
-   }
-}

Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c
==
--- head/sys/fs/msdosfs/msdosfs_vfsops.cFri Sep 23 18:55:32 2016
(r306275)
+++ head/sys/fs/msdosfs/msdosfs_vfsops.cFri Sep 23 19:05:07 2016
(r306276)
@@ -175,24 +175,8 @@ update_mp(struct mount *mp, struct threa
 
if (pmp->pm_flags & MSDOSFSMNT_NOWIN95)
pmp->pm_flags |= MSDOSFSMNT_SHORTNAME;
-   else if (!(pmp->pm_flags &
-   (MSDOSFSMNT_SHORTNAME | MSDOSFSMNT_LONGNAME))) {
-   struct vnode *rootvp;
-
-

Re: svn commit: r306272 - head/sys/sys

2016-09-23 Thread Andreas Tobler

On 23.09.16 18:47, Mateusz Guzik wrote:

Author: mjg
Date: Fri Sep 23 16:47:12 2016
New Revision: 306272
URL: https://svnweb.freebsd.org/changeset/base/306272

Log:
  fd: hide fd_modified under CAPABILITIES

  It has no use without it and is now less error prone.

Modified:
  head/sys/sys/filedesc.h

Modified: head/sys/sys/filedesc.h
==
--- head/sys/sys/filedesc.h Fri Sep 23 16:22:03 2016(r306271)
+++ head/sys/sys/filedesc.h Fri Sep 23 16:47:12 2016(r306272)
@@ -229,12 +229,14 @@ fdeget_locked(struct filedesc *fdp, int
return (fde);
 }

+#ifdef CAPABILITIES
 static __inline bool
 fd_modified(struct filedesc *fdp, int fd, seq_t seq)
 {

return (!seq_consistent(fd_seq(fdp->fd_files, fd), seq));
 }
+#endif

 /* cdir/rdir/jdir manipulation functions. */
 void   pwd_chdir(struct thread *td, struct vnode *vp);


I think this breaks kernel builds:

/usr/src/sys/modules/cloudabi/../../compat/cloudabi/cloudabi_fd.c:482:14: 
error: implicit declaration of function 'fd_modified' is invalid in C99 
[-Werror,-Wimplicit-function-declaration]

modified = fd_modified(fdp, uap->fd, seq);
   ^
1 error generated.
*** [cloudabi_fd.o] Error code 1

Andreas
___
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: r306277 - head/sys/dev/cxgbe

2016-09-23 Thread Navdeep Parhar
Author: np
Date: Fri Sep 23 20:03:28 2016
New Revision: 306277
URL: https://svnweb.freebsd.org/changeset/base/306277

Log:
  cxgbe(4): Make the location/length of all descriptor rings available in
  the sysctl MIB.

Modified:
  head/sys/dev/cxgbe/t4_sge.c

Modified: head/sys/dev/cxgbe/t4_sge.c
==
--- head/sys/dev/cxgbe/t4_sge.c Fri Sep 23 19:05:07 2016(r306276)
+++ head/sys/dev/cxgbe/t4_sge.c Fri Sep 23 20:03:28 2016(r306277)
@@ -177,8 +177,8 @@ static int free_ring(struct adapter *, b
 static int alloc_iq_fl(struct vi_info *, struct sge_iq *, struct sge_fl *,
 int, int);
 static int free_iq_fl(struct vi_info *, struct sge_iq *, struct sge_fl *);
-static void add_fl_sysctls(struct sysctl_ctx_list *, struct sysctl_oid *,
-struct sge_fl *);
+static void add_fl_sysctls(struct adapter *, struct sysctl_ctx_list *,
+struct sysctl_oid *, struct sge_fl *);
 static int alloc_fwq(struct adapter *);
 static int free_fwq(struct adapter *);
 static int alloc_mgmtq(struct adapter *);
@@ -2878,8 +2878,8 @@ free_iq_fl(struct vi_info *vi, struct sg
 }
 
 static void
-add_fl_sysctls(struct sysctl_ctx_list *ctx, struct sysctl_oid *oid,
-struct sge_fl *fl)
+add_fl_sysctls(struct adapter *sc, struct sysctl_ctx_list *ctx,
+struct sysctl_oid *oid, struct sge_fl *fl)
 {
struct sysctl_oid_list *children = SYSCTL_CHILDREN(oid);
 
@@ -2887,6 +2887,11 @@ add_fl_sysctls(struct sysctl_ctx_list *c
"freelist");
children = SYSCTL_CHILDREN(oid);
 
+   SYSCTL_ADD_UAUTO(ctx, children, OID_AUTO, "ba", CTLFLAG_RD,
+   &fl->ba, "bus address of descriptor ring");
+   SYSCTL_ADD_INT(ctx, children, OID_AUTO, "dmalen", CTLFLAG_RD, NULL,
+   fl->sidx * EQ_ESIZE + sc->params.sge.spg_len,
+   "desc ring size in bytes");
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id",
CTLTYPE_INT | CTLFLAG_RD, &fl->cntxt_id, 0, sysctl_uint16, "I",
"SGE context id of the freelist");
@@ -2942,6 +2947,10 @@ alloc_fwq(struct adapter *sc)
NULL, "firmware event queue");
children = SYSCTL_CHILDREN(oid);
 
+   SYSCTL_ADD_UAUTO(&sc->ctx, children, OID_AUTO, "ba", CTLFLAG_RD,
+   &fwq->ba, "bus address of descriptor ring");
+   SYSCTL_ADD_INT(&sc->ctx, children, OID_AUTO, "dmalen", CTLFLAG_RD, NULL,
+   fwq->qsize * IQ_ESIZE, "descriptor ring size in bytes");
SYSCTL_ADD_PROC(&sc->ctx, children, OID_AUTO, "abs_id",
CTLTYPE_INT | CTLFLAG_RD, &fwq->abs_id, 0, sysctl_uint16, "I",
"absolute id of the queue");
@@ -3053,6 +3062,10 @@ alloc_rxq(struct vi_info *vi, struct sge
NULL, "rx queue");
children = SYSCTL_CHILDREN(oid);
 
+   SYSCTL_ADD_UAUTO(&vi->ctx, children, OID_AUTO, "ba", CTLFLAG_RD,
+   &rxq->iq.ba, "bus address of descriptor ring");
+   SYSCTL_ADD_INT(&vi->ctx, children, OID_AUTO, "dmalen", CTLFLAG_RD, NULL,
+   rxq->iq.qsize * IQ_ESIZE, "descriptor ring size in bytes");
SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "abs_id",
CTLTYPE_INT | CTLFLAG_RD, &rxq->iq.abs_id, 0, sysctl_uint16, "I",
"absolute id of the queue");
@@ -3074,7 +3087,7 @@ alloc_rxq(struct vi_info *vi, struct sge
CTLFLAG_RD, &rxq->vlan_extraction,
"# of times hardware extracted 802.1Q tag");
 
-   add_fl_sysctls(&vi->ctx, oid, &rxq->fl);
+   add_fl_sysctls(sc, &vi->ctx, oid, &rxq->fl);
 
return (rc);
 }
@@ -3103,12 +3116,13 @@ static int
 alloc_ofld_rxq(struct vi_info *vi, struct sge_ofld_rxq *ofld_rxq,
 int intr_idx, int idx, struct sysctl_oid *oid)
 {
+   struct port_info *pi = vi->pi;
int rc;
struct sysctl_oid_list *children;
char name[16];
 
rc = alloc_iq_fl(vi, &ofld_rxq->iq, &ofld_rxq->fl, intr_idx,
-   vi->pi->rx_chan_map);
+   pi->rx_chan_map);
if (rc != 0)
return (rc);
 
@@ -3119,6 +3133,10 @@ alloc_ofld_rxq(struct vi_info *vi, struc
NULL, "rx queue");
children = SYSCTL_CHILDREN(oid);
 
+   SYSCTL_ADD_UAUTO(&vi->ctx, children, OID_AUTO, "ba", CTLFLAG_RD,
+   &ofld_rxq->iq.ba, "bus address of descriptor ring");
+   SYSCTL_ADD_INT(&vi->ctx, children, OID_AUTO, "dmalen", CTLFLAG_RD, NULL,
+   ofld_rxq->iq.qsize * IQ_ESIZE, "descriptor ring size in bytes");
SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "abs_id",
CTLTYPE_INT | CTLFLAG_RD, &ofld_rxq->iq.abs_id, 0, sysctl_uint16,
"I", "absolute id of the queue");
@@ -3129,7 +3147,7 @@ alloc_ofld_rxq(struct vi_info *vi, struc
CTLTYPE_INT | CTLFLAG_RD, &ofld_rxq->iq.cidx, 0, sysctl_uint16, "I",
"consumer index");
 
-   add_fl_sysctls(&vi->ctx, oid, &ofld_rxq->fl);
+   add_fl_sysctls(pi->adapter, &vi->ctx, oid, &ofld_rxq->fl);
 
return (rc);
 }
@@ -3550,6 +3568,11 @@ all

Re: svn commit: r306272 - head/sys/sys

2016-09-23 Thread Mateusz Guzik
On Fri, Sep 23, 2016 at 09:59:32PM +0200, Andreas Tobler wrote:
> On 23.09.16 18:47, Mateusz Guzik wrote:
> >Author: mjg
> >Date: Fri Sep 23 16:47:12 2016
> >New Revision: 306272
> >URL: https://svnweb.freebsd.org/changeset/base/306272
> >
> >Log:
> >  fd: hide fd_modified under CAPABILITIES
> >
> >  It has no use without it and is now less error prone.
> >
> >Modified:
> >  head/sys/sys/filedesc.h
> >
> >Modified: head/sys/sys/filedesc.h
> >==
> >--- head/sys/sys/filedesc.h  Fri Sep 23 16:22:03 2016(r306271)
> >+++ head/sys/sys/filedesc.h  Fri Sep 23 16:47:12 2016(r306272)
> >@@ -229,12 +229,14 @@ fdeget_locked(struct filedesc *fdp, int
> > return (fde);
> > }
> >
> >+#ifdef CAPABILITIES
> > static __inline bool
> > fd_modified(struct filedesc *fdp, int fd, seq_t seq)
> > {
> >
> > return (!seq_consistent(fd_seq(fdp->fd_files, fd), seq));
> > }
> >+#endif
> >
> > /* cdir/rdir/jdir manipulation functions. */
> > voidpwd_chdir(struct thread *td, struct vnode *vp);
> 
> I think this breaks kernel builds:
> 
> /usr/src/sys/modules/cloudabi/../../compat/cloudabi/cloudabi_fd.c:482:14:
> error: implicit declaration of function 'fd_modified' is invalid in
> C99 [-Werror,-Wimplicit-function-declaration]
> modified = fd_modified(fdp, uap->fd, seq);
>^
> 1 error generated.
> *** [cloudabi_fd.o] Error code 1
> 

Ye indeed, I hacked up a fix:
https://people.freebsd.org/~mjg/patches/cloudabi-fd_modified.diff

if ed@ does not respond soon acking the patch, I'll temporarily reviert
this change.

-- 
Mateusz Guzik 
___
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: r306272 - head/sys/sys

2016-09-23 Thread Andreas Tobler

On 23.09.16 22:03, Mateusz Guzik wrote:

On Fri, Sep 23, 2016 at 09:59:32PM +0200, Andreas Tobler wrote:

On 23.09.16 18:47, Mateusz Guzik wrote:

Author: mjg
Date: Fri Sep 23 16:47:12 2016
New Revision: 306272
URL: https://svnweb.freebsd.org/changeset/base/306272

Log:
 fd: hide fd_modified under CAPABILITIES

 It has no use without it and is now less error prone.

Modified:
 head/sys/sys/filedesc.h

Modified: head/sys/sys/filedesc.h
==
--- head/sys/sys/filedesc.h Fri Sep 23 16:22:03 2016(r306271)
+++ head/sys/sys/filedesc.h Fri Sep 23 16:47:12 2016(r306272)
@@ -229,12 +229,14 @@ fdeget_locked(struct filedesc *fdp, int
return (fde);
}

+#ifdef CAPABILITIES
static __inline bool
fd_modified(struct filedesc *fdp, int fd, seq_t seq)
{

return (!seq_consistent(fd_seq(fdp->fd_files, fd), seq));
}
+#endif

/* cdir/rdir/jdir manipulation functions. */
voidpwd_chdir(struct thread *td, struct vnode *vp);


I think this breaks kernel builds:

/usr/src/sys/modules/cloudabi/../../compat/cloudabi/cloudabi_fd.c:482:14:
error: implicit declaration of function 'fd_modified' is invalid in
C99 [-Werror,-Wimplicit-function-declaration]
modified = fd_modified(fdp, uap->fd, seq);
   ^
1 error generated.
*** [cloudabi_fd.o] Error code 1



Ye indeed, I hacked up a fix:
https://people.freebsd.org/~mjg/patches/cloudabi-fd_modified.diff

if ed@ does not respond soon acking the patch, I'll temporarily reviert
this change.



Thanks, I reverted locally to continue my work. So no hurry.

Andreas
___
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: r306279 - in head/sys/geom: bde concat gate journal linux_lvm mirror mountver raid3 shsec stripe vinum virstor

2016-09-23 Thread Alexander Motin
Author: mav
Date: Fri Sep 23 21:29:40 2016
New Revision: 306279
URL: https://svnweb.freebsd.org/changeset/base/306279

Log:
  Use g_wither_provider() where applicable.
  
  It is just a helper function combining G_PF_WITHER setting with
  g_orphan_provider().

Modified:
  head/sys/geom/bde/g_bde.c
  head/sys/geom/concat/g_concat.c
  head/sys/geom/gate/g_gate.c
  head/sys/geom/journal/g_journal.c
  head/sys/geom/linux_lvm/g_linux_lvm.c
  head/sys/geom/mirror/g_mirror.c
  head/sys/geom/mountver/g_mountver.c
  head/sys/geom/raid3/g_raid3.c
  head/sys/geom/shsec/g_shsec.c
  head/sys/geom/stripe/g_stripe.c
  head/sys/geom/vinum/geom_vinum_rm.c
  head/sys/geom/virstor/g_virstor.c

Modified: head/sys/geom/bde/g_bde.c
==
--- head/sys/geom/bde/g_bde.c   Fri Sep 23 20:20:50 2016(r306278)
+++ head/sys/geom/bde/g_bde.c   Fri Sep 23 21:29:40 2016(r306279)
@@ -85,7 +85,7 @@ g_bde_orphan(struct g_consumer *cp)
sc = gp->softc;
gp->flags |= G_GEOM_WITHER;
LIST_FOREACH(pp, &gp->provider, provider)
-   g_orphan_provider(pp, ENXIO);
+   g_wither_provider(pp, ENXIO);
bzero(sc, sizeof(struct g_bde_softc));  /* destroy evidence */
return;
 }

Modified: head/sys/geom/concat/g_concat.c
==
--- head/sys/geom/concat/g_concat.c Fri Sep 23 20:20:50 2016
(r306278)
+++ head/sys/geom/concat/g_concat.c Fri Sep 23 21:29:40 2016
(r306279)
@@ -129,10 +129,9 @@ g_concat_remove_disk(struct g_concat_dis
}
 
if (sc->sc_provider != NULL) {
-   sc->sc_provider->flags |= G_PF_WITHER;
G_CONCAT_DEBUG(0, "Device %s deactivated.",
sc->sc_provider->name);
-   g_orphan_provider(sc->sc_provider, ENXIO);
+   g_wither_provider(sc->sc_provider, ENXIO);
sc->sc_provider = NULL;
}
 

Modified: head/sys/geom/gate/g_gate.c
==
--- head/sys/geom/gate/g_gate.c Fri Sep 23 20:20:50 2016(r306278)
+++ head/sys/geom/gate/g_gate.c Fri Sep 23 21:29:40 2016(r306279)
@@ -109,8 +109,7 @@ g_gate_destroy(struct g_gate_softc *sc, 
wakeup(sc);
mtx_unlock(&sc->sc_queue_mtx);
gp = pp->geom;
-   pp->flags |= G_PF_WITHER;
-   g_orphan_provider(pp, ENXIO);
+   g_wither_provider(pp, ENXIO);
callout_drain(&sc->sc_callout);
bioq_init(&queue);
mtx_lock(&sc->sc_queue_mtx);

Modified: head/sys/geom/journal/g_journal.c
==
--- head/sys/geom/journal/g_journal.c   Fri Sep 23 20:20:50 2016
(r306278)
+++ head/sys/geom/journal/g_journal.c   Fri Sep 23 21:29:40 2016
(r306279)
@@ -2462,8 +2462,7 @@ g_journal_destroy(struct g_journal_softc
GJ_DEBUG(1, "Marking %s as clean.", sc->sc_name);
g_journal_metadata_update(sc);
g_topology_lock();
-   pp->flags |= G_PF_WITHER;
-   g_orphan_provider(pp, ENXIO);
+   g_wither_provider(pp, ENXIO);
} else {
g_topology_lock();
}

Modified: head/sys/geom/linux_lvm/g_linux_lvm.c
==
--- head/sys/geom/linux_lvm/g_linux_lvm.c   Fri Sep 23 20:20:50 2016
(r306278)
+++ head/sys/geom/linux_lvm/g_linux_lvm.c   Fri Sep 23 21:29:40 2016
(r306279)
@@ -333,7 +333,7 @@ g_llvm_remove_disk(struct g_llvm_vg *vg,
if (found) {
G_LLVM_DEBUG(0, "Device %s removed.",
lv->lv_gprov->name);
-   g_orphan_provider(lv->lv_gprov, ENXIO);
+   g_wither_provider(lv->lv_gprov, ENXIO);
lv->lv_gprov = NULL;
}
}

Modified: head/sys/geom/mirror/g_mirror.c
==
--- head/sys/geom/mirror/g_mirror.c Fri Sep 23 20:20:50 2016
(r306278)
+++ head/sys/geom/mirror/g_mirror.c Fri Sep 23 21:29:40 2016
(r306279)
@@ -2154,10 +2154,9 @@ g_mirror_destroy_provider(struct g_mirro
mtx_unlock(&sc->sc_queue_mtx);
G_MIRROR_DEBUG(0, "Device %s: provider %s destroyed.", sc->sc_name,
sc->sc_provider->name);
-   sc->sc_provider->flags |= G_PF_WITHER;
-   g_orphan_provider(sc->sc_provider, ENXIO);
-   g_topology_unlock();
+   g_wither_provider(sc->sc_provider, ENXIO);
sc->sc_provider = NULL;
+   g_topology_unlock();
LIST_FOREACH(disk, &sc->sc_disks, d_next) {
if (disk->d_state == G_MIRROR_DISK_STATE_SYNCHRONIZING)
g_mirror_sync_stop(disk, 1);

Modified: head/sys/geom/

Re: svn commit: r305353 - in head/sys/boot: i386 i386/boot0 i386/boot2 i386/btx/btx i386/btx/btxldr i386/cdboot i386/gptboot i386/gptzfsboot i386/mbr i386/pmbr i386/pxeldr i386/zfsboot pc98 pc98/boot0

2016-09-23 Thread Allan Jude
On 09/03/16 11:26 AM, Warner Losh wrote:
> Author: imp
> Date: Sat Sep  3 15:26:28 2016
> New Revision: 305353
> URL: https://svnweb.freebsd.org/changeset/base/305353
> 
> Log:
>   Don't use -N to set the OMAGIC with data and text writeable and data
>   not page aligned. To do this, use the ld script gnu ld installs on my
>   system.
>   
>   This is imperfect: LDFLAGS_BIN and LD_FLAGS_BIN describe different
>   things. The loader script could be better named and take into account
>   other architectures. And having two different mechanisms to do
>   basically the same thing needs study. However, it's blocking forward
>   progress on lld, so I'll work in parallel to sort these out.
>   
>   Differential Revision: https://reviews.freebsd.org/D7409
>   Reviewed by: emaste
> 

This breaks booting on my Lenovo laptop. The BTX client crashes and
dumps the registers.

Reverting this commit solved it.

Is there something I can do to help investigate this?

-- 
Allan Jude
___
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: r306280 - release/11.0.0

2016-09-23 Thread Glen Barber
Author: gjb
Date: Fri Sep 23 22:37:05 2016
New Revision: 306280
URL: https://svnweb.freebsd.org/changeset/base/306280

Log:
  Tag releng/11.0@r306211 as release/11.0.0.
  
  Approved by:  re (implicit)
  Sponsored by: The FreeBSD Foundation

Added:
  release/11.0.0/
 - copied from r306211, releng/11.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: r306281 - in head: targets/pseudo/userland usr.bin/proccontrol

2016-09-23 Thread Bryan Drewery
Author: bdrewery
Date: Fri Sep 23 22:46:19 2016
New Revision: 306281
URL: https://svnweb.freebsd.org/changeset/base/306281

Log:
  DIRDEPS_BUILD: Connect new directories.
  
  Sponsored by: Dell EMC Isilon

Added:
  head/usr.bin/proccontrol/Makefile.depend   (contents, props changed)
Modified:
  head/targets/pseudo/userland/Makefile.depend

Modified: head/targets/pseudo/userland/Makefile.depend
==
--- head/targets/pseudo/userland/Makefile.dependFri Sep 23 22:37:05 
2016(r306280)
+++ head/targets/pseudo/userland/Makefile.dependFri Sep 23 22:46:19 
2016(r306281)
@@ -325,6 +325,7 @@ DIRDEPS+= \
usr.bin/pr \
usr.bin/printenv \
usr.bin/printf \
+   usr.bin/proccontrol \
usr.bin/procstat \
usr.bin/protect \
usr.bin/quota \

Added: head/usr.bin/proccontrol/Makefile.depend
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/proccontrol/Makefile.dependFri Sep 23 22:46:19 2016
(r306281)
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+   gnu/lib/csu \
+   gnu/lib/libgcc \
+   include \
+   include/xlocale \
+   lib/${CSU_DIR} \
+   lib/libc \
+   lib/libcompiler_rt \
+
+
+.include 
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.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: r306282 - head/sys/compat/cloudabi

2016-09-23 Thread Mateusz Guzik
Author: mjg
Date: Fri Sep 23 23:08:23 2016
New Revision: 306282
URL: https://svnweb.freebsd.org/changeset/base/306282

Log:
  cloudabi: use fget_cap instead of hand-rolling capability read
  
  This has a side effect of unbreaking the build after r306272.
  
  Discussed with:   ed

Modified:
  head/sys/compat/cloudabi/cloudabi_fd.c

Modified: head/sys/compat/cloudabi/cloudabi_fd.c
==
--- head/sys/compat/cloudabi/cloudabi_fd.c  Fri Sep 23 22:46:19 2016
(r306281)
+++ head/sys/compat/cloudabi/cloudabi_fd.c  Fri Sep 23 23:08:23 2016
(r306282)
@@ -456,32 +456,19 @@ cloudabi_sys_fd_stat_get(struct thread *
 struct cloudabi_sys_fd_stat_get_args *uap)
 {
cloudabi_fdstat_t fsb = {};
-   struct filedesc *fdp;
struct file *fp;
-   seq_t seq;
cap_rights_t rights;
+   struct filecaps fcaps;
int error, oflags;
-   bool modified;
 
/* Obtain file descriptor properties. */
-   fdp = td->td_proc->p_fd;
-   do {
-   error = fget_unlocked(fdp, uap->fd, cap_rights_init(&rights),
-   &fp, &seq);
-   if (error != 0)
-   return (error);
-   if (fp->f_ops == &badfileops) {
-   fdrop(fp, td);
-   return (EBADF);
-   }
-
-   rights = *cap_rights(fdp, uap->fd);
-   oflags = OFLAGS(fp->f_flag);
-   fsb.fs_filetype = cloudabi_convert_filetype(fp);
-
-   modified = fd_modified(fdp, uap->fd, seq);
-   fdrop(fp, td);
-   } while (modified);
+   error = fget_cap(td, uap->fd, cap_rights_init(&rights), &fp,
+   &fcaps);
+   if (error != 0)
+   return (error);
+   oflags = OFLAGS(fp->f_flag);
+   fsb.fs_filetype = cloudabi_convert_filetype(fp);
+   fdrop(fp, td);
 
/* Convert file descriptor flags. */
if (oflags & O_APPEND)
@@ -492,8 +479,9 @@ cloudabi_sys_fd_stat_get(struct thread *
fsb.fs_flags |= CLOUDABI_FDFLAG_SYNC;
 
/* Convert capabilities to CloudABI rights. */
-   convert_capabilities(&rights, fsb.fs_filetype,
+   convert_capabilities(&fcaps.fc_rights, fsb.fs_filetype,
&fsb.fs_rights_base, &fsb.fs_rights_inheriting);
+   filecaps_free(&fcaps);
return (copyout(&fsb, (void *)uap->buf, sizeof(fsb)));
 }
 
___
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: r306272 - head/sys/sys

2016-09-23 Thread Mateusz Guzik
On Fri, Sep 23, 2016 at 10:38:05PM +0200, Andreas Tobler wrote:
> On 23.09.16 22:03, Mateusz Guzik wrote:
> >On Fri, Sep 23, 2016 at 09:59:32PM +0200, Andreas Tobler wrote:
> >>On 23.09.16 18:47, Mateusz Guzik wrote:
> >>>Author: mjg
> >>>Date: Fri Sep 23 16:47:12 2016
> >>>New Revision: 306272
> >>>URL: https://svnweb.freebsd.org/changeset/base/306272
> >>>
> >>>Log:
> >>> fd: hide fd_modified under CAPABILITIES
> >>>
> >>> It has no use without it and is now less error prone.
> >>>
> >>>Modified:
> >>> head/sys/sys/filedesc.h
> >>>
> >>>Modified: head/sys/sys/filedesc.h
> >>>==
> >>>--- head/sys/sys/filedesc.hFri Sep 23 16:22:03 2016
> >>>(r306271)
> >>>+++ head/sys/sys/filedesc.hFri Sep 23 16:47:12 2016
> >>>(r306272)
> >>>@@ -229,12 +229,14 @@ fdeget_locked(struct filedesc *fdp, int
> >>>   return (fde);
> >>>}
> >>>
> >>>+#ifdef CAPABILITIES
> >>>static __inline bool
> >>>fd_modified(struct filedesc *fdp, int fd, seq_t seq)
> >>>{
> >>>
> >>>   return (!seq_consistent(fd_seq(fdp->fd_files, fd), seq));
> >>>}
> >>>+#endif
> >>>
> >>>/* cdir/rdir/jdir manipulation functions. */
> >>>void   pwd_chdir(struct thread *td, struct vnode *vp);
> >>
> >>I think this breaks kernel builds:
> >>
> >>/usr/src/sys/modules/cloudabi/../../compat/cloudabi/cloudabi_fd.c:482:14:
> >>error: implicit declaration of function 'fd_modified' is invalid in
> >>C99 [-Werror,-Wimplicit-function-declaration]
> >>modified = fd_modified(fdp, uap->fd, seq);
> >>   ^
> >>1 error generated.
> >>*** [cloudabi_fd.o] Error code 1
> >>
> >
> >Ye indeed, I hacked up a fix:
> >https://people.freebsd.org/~mjg/patches/cloudabi-fd_modified.diff
> >
> >if ed@ does not respond soon acking the patch, I'll temporarily reviert
> >this change.
> >
> 
> Thanks, I reverted locally to continue my work. So no hurry.
> 

Fixed in r306282.

-- 
Mateusz Guzik 
___
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: r306284 - head/sys/dev/bxe

2016-09-23 Thread David C Somayajulu
Author: davidcs
Date: Fri Sep 23 23:18:54 2016
New Revision: 306284
URL: https://svnweb.freebsd.org/changeset/base/306284

Log:
  Fixes for issues under high workloads
  
  MFC after:5 days

Modified:
  head/sys/dev/bxe/bxe.c
  head/sys/dev/bxe/bxe.h
  head/sys/dev/bxe/bxe_stats.h

Modified: head/sys/dev/bxe/bxe.c
==
--- head/sys/dev/bxe/bxe.c  Fri Sep 23 23:11:58 2016(r306283)
+++ head/sys/dev/bxe/bxe.c  Fri Sep 23 23:18:54 2016(r306284)
@@ -27,7 +27,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#define BXE_DRIVER_VERSION "1.78.81"
+#define BXE_DRIVER_VERSION "1.78.89"
 
 #include "bxe.h"
 #include "ecore_sp.h"
@@ -489,7 +489,16 @@ static const struct {
 { STATS_OFFSET32(mbuf_alloc_tpa),
 4, STATS_FLAGS_FUNC, "mbuf_alloc_tpa"},
 { STATS_OFFSET32(tx_queue_full_return),
-4, STATS_FLAGS_FUNC, "tx_queue_full_return"}
+4, STATS_FLAGS_FUNC, "tx_queue_full_return"},
+{ STATS_OFFSET32(bxe_tx_mq_start_lock_failures),
+4, STATS_FLAGS_FUNC, "bxe_tx_mq_start_lock_failures"},
+{ STATS_OFFSET32(tx_request_link_down_failures),
+4, STATS_FLAGS_FUNC, "tx_request_link_down_failures"},
+{ STATS_OFFSET32(bd_avail_too_less_failures),
+4, STATS_FLAGS_FUNC, "bd_avail_too_less_failures"},
+{ STATS_OFFSET32(tx_mq_not_empty),
+4, STATS_FLAGS_FUNC, "tx_mq_not_empty"}
+
 };
 
 static const struct {
@@ -602,7 +611,15 @@ static const struct {
 { Q_STATS_OFFSET32(mbuf_alloc_tpa),
 4, "mbuf_alloc_tpa"},
 { Q_STATS_OFFSET32(tx_queue_full_return),
-4, "tx_queue_full_return"}
+4, "tx_queue_full_return"},
+{ Q_STATS_OFFSET32(bxe_tx_mq_start_lock_failures),
+4, "bxe_tx_mq_start_lock_failures"},
+{ Q_STATS_OFFSET32(tx_request_link_down_failures),
+4, "tx_request_link_down_failures"},
+{ Q_STATS_OFFSET32(bd_avail_too_less_failures),
+4, "bd_avail_too_less_failures"},
+{ Q_STATS_OFFSET32(tx_mq_not_empty),
+4, "tx_mq_not_empty"}
 };
 
 #define BXE_NUM_ETH_STATS   ARRAY_SIZE(bxe_eth_stats_arr)
@@ -5621,11 +5638,18 @@ bxe_tx_mq_start_locked(struct bxe_softc 
 return (EINVAL);
 }
 
+if (m != NULL) {
+rc = drbr_enqueue(ifp, tx_br, m);
+if (rc != 0) {
+fp->eth_q_stats.tx_soft_errors++;
+goto bxe_tx_mq_start_locked_exit;
+}
+}
+
 if (!sc->link_vars.link_up ||
 (if_getdrvflags(ifp) &
 (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) {
-if (m != NULL)
-rc = drbr_enqueue(ifp, tx_br, m);
+fp->eth_q_stats.tx_request_link_down_failures++;
 goto bxe_tx_mq_start_locked_exit;
 }
 
@@ -5635,24 +5659,22 @@ bxe_tx_mq_start_locked(struct bxe_softc 
 fp->eth_q_stats.tx_max_drbr_queue_depth = depth;
 }
 
-if (m == NULL) {
-/* no new work, check for pending frames */
-next = drbr_dequeue_drv(ifp, tx_br);
-} else if (drbr_needs_enqueue_drv(ifp, tx_br)) {
-/* have both new and pending work, maintain packet order */
-rc = drbr_enqueue(ifp, tx_br, m);
-if (rc != 0) {
-fp->eth_q_stats.tx_soft_errors++;
-goto bxe_tx_mq_start_locked_exit;
-}
-next = drbr_dequeue_drv(ifp, tx_br);
-} else {
-/* new work only and nothing pending */
-next = m;
-}
-
 /* keep adding entries while there are frames to send */
-while (next != NULL) {
+while ((next = drbr_peek(ifp, tx_br)) != NULL) {
+/* handle any completions if we're running low */
+tx_bd_avail = bxe_tx_avail(sc, fp);
+if (tx_bd_avail < BXE_TX_CLEANUP_THRESHOLD) {
+/* bxe_txeof will set IFF_DRV_OACTIVE appropriately */
+bxe_txeof(sc, fp);
+tx_bd_avail = bxe_tx_avail(sc, fp);
+if (tx_bd_avail < (BXE_TSO_MAX_SEGMENTS + 1)) {
+fp->eth_q_stats.bd_avail_too_less_failures++;
+m_freem(next);
+drbr_advance(ifp, tx_br);
+rc = ENOBUFS;
+break;
+}
+}
 
 /* the mbuf now belongs to us */
 fp->eth_q_stats.mbuf_alloc_tx++;
@@ -5667,12 +5689,12 @@ bxe_tx_mq_start_locked(struct bxe_softc 
 fp->eth_q_stats.tx_encap_failures++;
 if (next != NULL) {
 /* mark the TX queue as full and save the frame */
-if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0);
-/* XXX this may reorder the frame */
-rc = drbr_enqueue(ifp, tx_br, next);
+ifp->if_drv_flags |= IFF_DRV_OACTIVE;
+drbr_putback(ifp, tx_br, next);
 fp->eth_q_stats.mbuf_alloc_tx--;
 fp->eth_q_stats.tx_frames_deferred++;
-}
+

Re: svn commit: r306284 - head/sys/dev/bxe

2016-09-23 Thread hiren panchasara
On 09/23/16 at 11:18P, David C Somayajulu wrote:
> Author: davidcs
> Date: Fri Sep 23 23:18:54 2016
> New Revision: 306284
> URL: https://svnweb.freebsd.org/changeset/base/306284
> 
> Log:
>   Fixes for issues under high workloads

David,

It is really useful to have details about said issues in the commit-log.

Can you share them here, if possible? I'd suggest you add that to your
MFC commit(s).

>   
>   MFC after:5 days
> 
> Modified:
>   head/sys/dev/bxe/bxe.c
>   head/sys/dev/bxe/bxe.h
>   head/sys/dev/bxe/bxe_stats.h

Cheers,
Hiren


pgpdNvDcSMVz4.pgp
Description: PGP signature


svn commit: r306285 - head/sys/netinet6

2016-09-23 Thread Mark Johnston
Author: markj
Date: Sat Sep 24 01:14:25 2016
New Revision: 306285
URL: https://svnweb.freebsd.org/changeset/base/306285

Log:
  Rename ndpr_refcnt to ndpr_addrcnt.
  
  This field counts derived addresses and is not a true refcount for prefix
  objects, so the previous name was misleading.
  
  MFC after:1 week

Modified:
  head/sys/netinet6/in6.c
  head/sys/netinet6/nd6.c
  head/sys/netinet6/nd6.h
  head/sys/netinet6/nd6_rtr.c

Modified: head/sys/netinet6/in6.c
==
--- head/sys/netinet6/in6.c Fri Sep 23 23:18:54 2016(r306284)
+++ head/sys/netinet6/in6.c Sat Sep 24 01:14:25 2016(r306285)
@@ -630,7 +630,7 @@ in6_control(struct socket *so, u_long cm
/* relate the address to the prefix */
if (ia->ia6_ndpr == NULL) {
ia->ia6_ndpr = pr;
-   pr->ndpr_refcnt++;
+   pr->ndpr_addrcnt++;
 
/*
 * If this is the first autoconf address from the
@@ -638,7 +638,7 @@ in6_control(struct socket *so, u_long cm
 * (when required).
 */
if ((ia->ia6_flags & IN6_IFF_AUTOCONF) &&
-   V_ip6_use_tempaddr && pr->ndpr_refcnt == 1) {
+   V_ip6_use_tempaddr && pr->ndpr_addrcnt == 1) {
int e;
if ((e = in6_tmpifadd(ia, 1, 0)) != 0) {
log(LOG_NOTICE, "in6_control: failed "
@@ -690,11 +690,11 @@ aifaddr_out:
 * and the prefix management.  We do this, however, to provide
 * as much backward compatibility as possible in terms of
 * the ioctl operation.
-* Note that in6_purgeaddr() will decrement ndpr_refcnt.
+* Note that in6_purgeaddr() will decrement ndpr_addrcnt.
 */
pr = ia->ia6_ndpr;
in6_purgeaddr(&ia->ia_ifa);
-   if (pr && pr->ndpr_refcnt == 0)
+   if (pr && pr->ndpr_addrcnt == 0)
prelist_remove(pr);
EVENTHANDLER_INVOKE(ifaddr_event, ifp);
break;
@@ -1305,9 +1305,9 @@ in6_unlink_ifa(struct in6_ifaddr *ia, st
"in6_unlink_ifa: autoconf'ed address "
"%s has no prefix\n", ip6_sprintf(ip6buf, IA6_IN6(ia;
} else {
-   ia->ia6_ndpr->ndpr_refcnt--;
+   ia->ia6_ndpr->ndpr_addrcnt--;
/* Do not delete lles within prefix if refcont != 0 */
-   if (ia->ia6_ndpr->ndpr_refcnt == 0)
+   if (ia->ia6_ndpr->ndpr_addrcnt == 0)
remove_lle = 1;
ia->ia6_ndpr = NULL;
}

Modified: head/sys/netinet6/nd6.c
==
--- head/sys/netinet6/nd6.c Fri Sep 23 23:18:54 2016(r306284)
+++ head/sys/netinet6/nd6.c Sat Sep 24 01:14:25 2016(r306285)
@@ -1159,7 +1159,7 @@ nd6_purge(struct ifnet *ifp)
 * still be above zero. We therefore reset it to
 * make sure that the prefix really gets purged.
 */
-   pr->ndpr_refcnt = 0;
+   pr->ndpr_addrcnt = 0;
 
prelist_remove(pr);
}
@@ -2674,7 +2674,7 @@ nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS)
else
p.expire = maxexpire;
}
-   p.refcnt = pr->ndpr_refcnt;
+   p.refcnt = pr->ndpr_addrcnt;
p.flags = pr->ndpr_stateflags;
p.advrtrs = 0;
LIST_FOREACH(pfr, &pr->ndpr_advrtrs, pfr_entry)

Modified: head/sys/netinet6/nd6.h
==
--- head/sys/netinet6/nd6.h Fri Sep 23 23:18:54 2016(r306284)
+++ head/sys/netinet6/nd6.h Sat Sep 24 01:14:25 2016(r306285)
@@ -275,7 +275,7 @@ struct nd_prefix {
/* list of routers that advertise the prefix: */
LIST_HEAD(pr_rtrhead, nd_pfxrouter) ndpr_advrtrs;
u_char  ndpr_plen;
-   int ndpr_refcnt;/* reference couter from addresses */
+   int ndpr_addrcnt;   /* count of derived addresses */
 };
 
 #define ndpr_raf   ndpr_flags

Modified: head/sys/netinet6/nd6_rtr.c
==
--- head/sys/netinet6/nd6_rtr.c Fri Sep 23 23:18:54 2016(r306284)
+++ head/sys/netinet6/nd6_rtr.c Sat Sep 24 01:14:25 2016(r306285)
@@ -1053,7 +1053,7 @@ prelist_remove(struct nd_prefix *pr)
/* what should we do? */
}
 
-   if (pr->ndpr_refcnt > 0)
+   if (pr->ndpr_addrcnt > 

svn commit: r306286 - head/sys/dev/iwm

2016-09-23 Thread Adrian Chadd
Author: adrian
Date: Sat Sep 24 01:21:42 2016
New Revision: 306286
URL: https://svnweb.freebsd.org/changeset/base/306286

Log:
  [iwm] fix default antenna selection a bit; fix 5GHz rate control handling.
  
  * Don't do the antenna switching when setting up the rate table - we don't
take into account whether it's an active antenna or not (eg shared with BT.)
I'll look into this a bit more later.
  
  * The default antenna is still 1, I'll look into that a bit more later.
(So no, this doesn't fix it for Larry who needs ANT_B to be active, not
ANT_A.)
  
  * My changes to the rate control setup used the wrong method for finding
a suitable rate, which led to 1M CCK frames being queued for 11a operation.
This is .. sub-optimal.  Change the rate control lookup path to use
the global table instead of the per-node table, which won't be setup
until the node rate table is setup (which happens way too late in this
game.)
  
  Tested:
  
  * Intel 7260, 2G and 5G operation.

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Sat Sep 24 01:14:25 2016(r306285)
+++ head/sys/dev/iwm/if_iwm.c   Sat Sep 24 01:21:42 2016(r306286)
@@ -2672,6 +2672,15 @@ iwm_run_init_mvm_ucode(struct iwm_softc 
if (error != 0)
return error;
 
+   IWM_DPRINTF(sc, IWM_DEBUG_RESET,
+   "%s: phy_txant=0x%08x, nvm_valid_tx_ant=0x%02x, valid=0x%02x\n",
+   __func__,
+   ((sc->sc_fw_phy_config & IWM_FW_PHY_CFG_TX_CHAIN)
+ >> IWM_FW_PHY_CFG_TX_CHAIN_POS),
+   sc->sc_nvm.valid_tx_ant,
+   iwm_fw_valid_tx_ant(sc));
+
+
/* Send TX valid antennas before triggering calibrations */
if ((error = iwm_send_tx_ant_cfg(sc, iwm_fw_valid_tx_ant(sc))) != 0) {
device_printf(sc->sc_dev,
@@ -3187,11 +3196,34 @@ iwm_tx_rateidx_lookup(struct iwm_softc *
if (rate == r)
return (i);
}
+
+   IWM_DPRINTF(sc, IWM_DEBUG_XMIT | IWM_DEBUG_TXRATE,
+   "%s: couldn't find an entry for rate=%d\n",
+   __func__,
+   rate);
+
/* XXX Return the first */
/* XXX TODO: have it return the /lowest/ */
return (0);
 }
 
+static int
+iwm_tx_rateidx_global_lookup(struct iwm_softc *sc, uint8_t rate)
+{
+   int i;
+
+   for (i = 0; i < nitems(iwm_rates); i++) {
+   if (iwm_rates[i].rate == rate)
+   return (i);
+   }
+   /* XXX error? */
+   IWM_DPRINTF(sc, IWM_DEBUG_XMIT | IWM_DEBUG_TXRATE,
+   "%s: couldn't find an entry for rate=%d\n",
+   __func__,
+   rate);
+   return (0);
+}
+
 /*
  * Fill in the rate related information for a transmit command.
  */
@@ -3204,7 +3236,7 @@ iwm_tx_fill_cmd(struct iwm_softc *sc, st
const struct ieee80211_txparam *tp = ni->ni_txparms;
const struct iwm_rate *rinfo;
int type;
-   int ridx, rate_flags, i;
+   int ridx, rate_flags;
 
wh = mtod(m, struct ieee80211_frame *);
type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
@@ -3213,19 +3245,26 @@ iwm_tx_fill_cmd(struct iwm_softc *sc, st
tx->data_retry_limit = IWM_DEFAULT_TX_RETRY;
 
if (type == IEEE80211_FC0_TYPE_MGT) {
-   i = iwm_tx_rateidx_lookup(sc, in, tp->mgmtrate);
-   ridx = in->in_ridx[i];
+   ridx = iwm_tx_rateidx_global_lookup(sc, tp->mgmtrate);
+   IWM_DPRINTF(sc, IWM_DEBUG_TXRATE,
+   "%s: MGT (%d)\n", __func__, tp->mgmtrate);
} else if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
-   i = iwm_tx_rateidx_lookup(sc, in, tp->mcastrate);
-   ridx = in->in_ridx[i];
+   ridx = iwm_tx_rateidx_global_lookup(sc, tp->mcastrate);
+   IWM_DPRINTF(sc, IWM_DEBUG_TXRATE,
+   "%s: MCAST (%d)\n", __func__, tp->mcastrate);
} else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) {
-   i = iwm_tx_rateidx_lookup(sc, in, tp->ucastrate);
-   ridx = in->in_ridx[i];
+   ridx = iwm_tx_rateidx_global_lookup(sc, tp->ucastrate);
+   IWM_DPRINTF(sc, IWM_DEBUG_TXRATE,
+   "%s: FIXED_RATE (%d)\n", __func__, tp->ucastrate);
} else if (m->m_flags & M_EAPOL) {
-   i = iwm_tx_rateidx_lookup(sc, in, tp->mgmtrate);
-   ridx = in->in_ridx[i];
-   } else {
+   ridx = iwm_tx_rateidx_global_lookup(sc, tp->mgmtrate);
+   IWM_DPRINTF(sc, IWM_DEBUG_TXRATE,
+   "%s: EAPOL\n", __func__);
+   } else if (type == IEEE80211_FC0_TYPE_DATA) {
+   int i;
+
/* for data frames, use RS table */
+   IWM_DPRINTF(sc, IWM_DEBUG_TXRATE, "%s: DATA\n", __func__);
/* XXX pass pktlen */
(voi

svn commit: r306287 - in head/sys: dev/bhnd dev/bhnd/bcma dev/bhnd/cores/pmu dev/bhnd/cores/usb dev/bhnd/siba modules/bhnd/bcma modules/bhnd/siba

2016-09-23 Thread Landon J. Fuller
Author: landonf
Date: Sat Sep 24 04:08:16 2016
New Revision: 306287
URL: https://svnweb.freebsd.org/changeset/base/306287

Log:
  bhnd(4): Implement common API for IOST/IOCTL register access and core reset
  
  
  - Added bhnd(4) bus APIs for per-core ioctl/iost register access.
  - Updated reset/suspend bhnd(4) APIs for compatibility with ioctl/iost
changes.
  - Implemented core reset/suspend support for both bcma(4) and siba(4).
  - Implemented explicit release of all outstanding PMU requests at the bus
level when putting a core into reset.
  
  Approved by:adrian (mentor, implicit)
  Differential Revision:  https://reviews.freebsd.org/D8009

Deleted:
  head/sys/dev/bhnd/bhnd_core.h
Modified:
  head/sys/dev/bhnd/bcma/bcma.c
  head/sys/dev/bhnd/bcma/bcma_dmp.h
  head/sys/dev/bhnd/bcma/bcma_subr.c
  head/sys/dev/bhnd/bcma/bcmavar.h
  head/sys/dev/bhnd/bhnd.c
  head/sys/dev/bhnd/bhnd.h
  head/sys/dev/bhnd/bhnd_bus_if.m
  head/sys/dev/bhnd/bhndvar.h
  head/sys/dev/bhnd/cores/pmu/bhnd_pmu.c
  head/sys/dev/bhnd/cores/pmu/bhnd_pmu.h
  head/sys/dev/bhnd/cores/pmu/bhnd_pmu_private.h
  head/sys/dev/bhnd/cores/pmu/bhnd_pmu_subr.c
  head/sys/dev/bhnd/cores/usb/bhnd_usb.c
  head/sys/dev/bhnd/siba/siba.c
  head/sys/dev/bhnd/siba/siba_subr.c
  head/sys/dev/bhnd/siba/sibareg.h
  head/sys/dev/bhnd/siba/sibavar.h
  head/sys/modules/bhnd/bcma/Makefile
  head/sys/modules/bhnd/siba/Makefile

Modified: head/sys/dev/bhnd/bcma/bcma.c
==
--- head/sys/dev/bhnd/bcma/bcma.c   Sat Sep 24 01:21:42 2016
(r306286)
+++ head/sys/dev/bhnd/bcma/bcma.c   Sat Sep 24 04:08:16 2016
(r306287)
@@ -39,14 +39,14 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#include "bcmavar.h"
+#include 
 
 #include "bcma_dmp.h"
 
 #include "bcma_eromreg.h"
 #include "bcma_eromvar.h"
 
-#include 
+#include "bcmavar.h"
 
 /* RID used when allocating EROM table */
 #defineBCMA_EROM_RID   0
@@ -91,6 +91,44 @@ bcma_detach(device_t dev)
return (bhnd_generic_detach(dev));
 }
 
+static device_t
+bcma_add_child(device_t dev, u_int order, const char *name, int unit)
+{
+   struct bcma_devinfo *dinfo;
+   device_t child;
+
+   child = device_add_child_ordered(dev, order, name, unit);
+   if (child == NULL)
+   return (NULL);
+
+   if ((dinfo = bcma_alloc_dinfo(dev)) == NULL) {
+   device_delete_child(dev, child);
+   return (NULL);
+   }
+
+   device_set_ivars(child, dinfo);
+
+   return (child);
+}
+
+static void
+bcma_child_deleted(device_t dev, device_t child)
+{
+   struct bhnd_softc   *sc;
+   struct bcma_devinfo *dinfo;
+
+   sc = device_get_softc(dev);
+
+   /* Call required bhnd(4) implementation */
+   bhnd_generic_child_deleted(dev, child);
+
+   /* Free bcma device info */
+   if ((dinfo = device_get_ivars(child)) != NULL)
+   bcma_free_dinfo(dev, dinfo);
+
+   device_set_ivars(child, NULL);
+}
+
 static int
 bcma_read_ivar(device_t dev, device_t child, int index, uintptr_t *result)
 {
@@ -125,6 +163,9 @@ bcma_read_ivar(device_t dev, device_t ch
case BHND_IVAR_CORE_UNIT:
*result = ci->unit;
return (0);
+   case BHND_IVAR_PMU_INFO:
+   *result = (uintptr_t) dinfo->pmu_info;
+   return (0);
default:
return (ENOENT);
}
@@ -133,6 +174,10 @@ bcma_read_ivar(device_t dev, device_t ch
 static int
 bcma_write_ivar(device_t dev, device_t child, int index, uintptr_t value)
 {
+   struct bcma_devinfo *dinfo;
+
+   dinfo = device_get_ivars(child);
+
switch (index) {
case BHND_IVAR_VENDOR:
case BHND_IVAR_DEVICE:
@@ -143,6 +188,9 @@ bcma_write_ivar(device_t dev, device_t c
case BHND_IVAR_CORE_INDEX:
case BHND_IVAR_CORE_UNIT:
return (EINVAL);
+   case BHND_IVAR_PMU_INFO:
+   dinfo->pmu_info = (struct bhnd_core_pmu_info *) value;
+   return (0);
default:
return (ENOENT);
}
@@ -156,136 +204,262 @@ bcma_get_resource_list(device_t dev, dev
 }
 
 static int
-bcma_reset_core(device_t dev, device_t child, uint16_t flags)
+bcma_read_iost(device_t dev, device_t child, uint16_t *iost)
 {
-   struct bcma_devinfo *dinfo;
+   uint32_tvalue;
+   int error;
+
+   if ((error = bhnd_read_config(child, BCMA_DMP_IOSTATUS, &value, 4)))
+   return (error);
+
+   /* Return only the bottom 16 bits */
+   *iost = (value & BCMA_DMP_IOST_MASK);
+   return (0);
+}
+
+static int
+bcma_read_ioctl(device_t dev, device_t child, uint16_t *ioctl)
+{
+   uint32_tvalue;
+   int error;
+
+   if ((error = bhnd_read_config(child, BCMA_DMP_IOCTRL, &value, 4)))
+   return (error);
+
+   /* Return only the bottom 16 bits */
+   *

svn commit: r306288 - head/sys/dev/iicbus

2016-09-23 Thread Justin Hibbits
Author: jhibbits
Date: Sat Sep 24 05:27:12 2016
New Revision: 306288
URL: https://svnweb.freebsd.org/changeset/base/306288

Log:
  Fix ds1307 probing
  
  'compat' can never be NULL, because the compatible check loop ends when
  compat->ocd_str is NULL.  This causes ds1307 to attach to any unclaimed i2c
  device.

Modified:
  head/sys/dev/iicbus/ds1307.c

Modified: head/sys/dev/iicbus/ds1307.c
==
--- head/sys/dev/iicbus/ds1307.cSat Sep 24 04:08:16 2016
(r306287)
+++ head/sys/dev/iicbus/ds1307.cSat Sep 24 05:27:12 2016
(r306288)
@@ -274,7 +274,7 @@ ds1307_probe(device_t dev)
 
compat = ofw_bus_search_compatible(dev, ds1307_compat_data);
 
-   if (compat == NULL)
+   if (compat->ocd_str == NULL)
return (ENXIO);
 
device_set_desc(dev, (const char *)compat->ocd_data);
___
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"