svn commit: r313679 - in head/usr.bin/svn: . svn svnadmin svnbench svndumpfilter svnfsfs svnlook svnmucc svnrdump svnserve svnsync svnversion

2017-02-12 Thread Ngie Cooper
Author: ngie
Date: Sun Feb 12 08:36:47 2017
New Revision: 313679
URL: https://svnweb.freebsd.org/changeset/base/313679

Log:
  Use SRCTOP/OBJTOP relative paths where possible; use :H manipulation in lieu
  of ../ elsewhere
  
  This simplifies pathing in make/displayed output
  
  MFC after:1 week
  Sponsored by: Dell EMC Isilon

Modified:
  head/usr.bin/svn/Makefile.inc
  head/usr.bin/svn/svn/Makefile
  head/usr.bin/svn/svnadmin/Makefile
  head/usr.bin/svn/svnbench/Makefile
  head/usr.bin/svn/svndumpfilter/Makefile
  head/usr.bin/svn/svnfsfs/Makefile
  head/usr.bin/svn/svnlook/Makefile
  head/usr.bin/svn/svnmucc/Makefile
  head/usr.bin/svn/svnrdump/Makefile
  head/usr.bin/svn/svnserve/Makefile
  head/usr.bin/svn/svnsync/Makefile
  head/usr.bin/svn/svnversion/Makefile

Modified: head/usr.bin/svn/Makefile.inc
==
--- head/usr.bin/svn/Makefile.inc   Sun Feb 12 07:09:14 2017
(r313678)
+++ head/usr.bin/svn/Makefile.inc   Sun Feb 12 08:36:47 2017
(r313679)
@@ -12,33 +12,31 @@ PACKAGE=svn
 
 .if !defined(SVNDIR)
 
-SVNDIR=${.CURDIR}/../../../contrib/subversion/subversion
-APRU=  ${.CURDIR}/../../../contrib/apr-util
-APR=   ${.CURDIR}/../../../contrib/apr
+SVNDIR=${SRCTOP}/contrib/subversion/subversion
+APRU=  ${SRCTOP}/contrib/apr-util
+APR=   ${SRCTOP}/contrib/apr
 WARNS?=0   # definitely not warns friendly
 
-.if exists(${.CURDIR}/../../Makefile.inc)
-.include "${.CURDIR}/../../Makefile.inc"
-.endif
+.sinclude "${.CURDIR:H:H}/Makefile.inc"
 
-LIBAPRDIR= ${.OBJDIR}/../lib/libapr
-LIBAPR_UTILDIR=${.OBJDIR}/../lib/libapr_util
-LIBSERFDIR=${.OBJDIR}/../lib/libserf
-
-LIBSVN_CLIENTDIR=  ${.OBJDIR}/../lib/libsvn_client
-LIBSVN_DELTADIR=   ${.OBJDIR}/../lib/libsvn_delta
-LIBSVN_DIFFDIR=${.OBJDIR}/../lib/libsvn_diff
-LIBSVN_FSDIR=  ${.OBJDIR}/../lib/libsvn_fs
-LIBSVN_FS_FSDIR=   ${.OBJDIR}/../lib/libsvn_fs_fs
-LIBSVN_FS_UTILDIR= ${.OBJDIR}/../lib/libsvn_fs_util
-LIBSVN_FS_XDIR=${.OBJDIR}/../lib/libsvn_fs_x
-LIBSVN_RADIR=  ${.OBJDIR}/../lib/libsvn_ra
-LIBSVN_RA_LOCALDIR=${.OBJDIR}/../lib/libsvn_ra_local
-LIBSVN_RA_SVNDIR=  ${.OBJDIR}/../lib/libsvn_ra_svn
-LIBSVN_RA_SERFDIR= ${.OBJDIR}/../lib/libsvn_ra_serf
-LIBSVN_REPOSDIR=   ${.OBJDIR}/../lib/libsvn_repos
-LIBSVN_SUBRDIR=${.OBJDIR}/../lib/libsvn_subr
-LIBSVN_WCDIR=  ${.OBJDIR}/../lib/libsvn_wc
+LIBAPRDIR= ${.OBJDIR:H}/lib/libapr
+LIBAPR_UTILDIR=${.OBJDIR:H}/lib/libapr_util
+LIBSERFDIR=${.OBJDIR:H}/lib/libserf
+
+LIBSVN_CLIENTDIR=  ${.OBJDIR:H}/lib/libsvn_client
+LIBSVN_DELTADIR=   ${.OBJDIR:H}/lib/libsvn_delta
+LIBSVN_DIFFDIR=${.OBJDIR:H}/lib/libsvn_diff
+LIBSVN_FSDIR=  ${.OBJDIR:H}/lib/libsvn_fs
+LIBSVN_FS_FSDIR=   ${.OBJDIR:H}/lib/libsvn_fs_fs
+LIBSVN_FS_UTILDIR= ${.OBJDIR:H}/lib/libsvn_fs_util
+LIBSVN_FS_XDIR=${.OBJDIR:H}/lib/libsvn_fs_x
+LIBSVN_RADIR=  ${.OBJDIR:H}/lib/libsvn_ra
+LIBSVN_RA_LOCALDIR=${.OBJDIR:H}/lib/libsvn_ra_local
+LIBSVN_RA_SVNDIR=  ${.OBJDIR:H}/lib/libsvn_ra_svn
+LIBSVN_RA_SERFDIR= ${.OBJDIR:H}/lib/libsvn_ra_serf
+LIBSVN_REPOSDIR=   ${.OBJDIR:H}/lib/libsvn_repos
+LIBSVN_SUBRDIR=${.OBJDIR:H}/lib/libsvn_subr
+LIBSVN_WCDIR=  ${.OBJDIR:H}/lib/libsvn_wc
 
 LIBAPR=${LIBAPRDIR}/libapr.a
 LIBAPR_UTIL=   ${LIBAPR_UTILDIR}/libapr-util.a

Modified: head/usr.bin/svn/svn/Makefile
==
--- head/usr.bin/svn/svn/Makefile   Sun Feb 12 07:09:14 2017
(r313678)
+++ head/usr.bin/svn/svn/Makefile   Sun Feb 12 08:36:47 2017
(r313679)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 
-.include "${.CURDIR}/../Makefile.inc"
+.include "${.CURDIR:H}/Makefile.inc"
 
 .PATH: ${SVNDIR}/svn
 
@@ -17,11 +17,11 @@ SRCS=   add-cmd.c auth-cmd.c blame-cmd.c c
resolved-cmd.c revert-cmd.c status-cmd.c similarity.c status.c \
svn.c switch-cmd.c unlock-cmd.c update-cmd.c upgrade-cmd.c util.c
 
-CFLAGS+=-I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR}/.. \
-   -I${.CURDIR}/../lib/libapr \
+CFLAGS+=-I${SVNDIR}/include -I${SVNDIR} -I${.CURDIR:H} \
+   -I${.CURDIR:H}/lib/libapr \
-I${APR}/include/arch/unix \
-I${APR}/include \
-   -I${.CURDIR}/../lib/libapr_util \
+   -I${.CURDIR:H}/lib/libapr_util \
-I${APRU}/include/private \
-I${APRU}/include
 

Modified: head/usr.bin/svn/svnadmin/Makefile
==
--- head/usr.bin/svn/svnadmin/Makefile  Sun Feb 12 07:09:14 2017
(r313678)
+++ head/usr.bin/svn/svnadmin/Makefile  Sun Feb 12 08:36:47 2017
(r313679)
@@ -2,7 +2,7 @@

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

2017-02-12 Thread Mateusz Guzik
Author: mjg
Date: Sun Feb 12 09:49:44 2017
New Revision: 313683
URL: https://svnweb.freebsd.org/changeset/base/313683

Log:
  lockmgr: implement fast path
  
  The main lockmgr routine takes 8 arguments which makes it impossible to
  tail-call it by the intermediate vop_stdlock/unlock routines.
  
  The routine itself starts with an if-forest and reads from the lock itself
  several times.
  
  This slows things down both single- and multi-threaded. With the patch
  single-threaded fstats go 4% up and multithreaded up to ~27%.
  
  Note that there is still a lot of room for improvement.
  
  Reviewed by:  kib
  Tested by:pho

Modified:
  head/sys/kern/kern_lock.c
  head/sys/kern/vfs_default.c
  head/sys/sys/lockmgr.h

Modified: head/sys/kern/kern_lock.c
==
--- head/sys/kern/kern_lock.c   Sun Feb 12 09:27:34 2017(r313682)
+++ head/sys/kern/kern_lock.c   Sun Feb 12 09:49:44 2017(r313683)
@@ -168,6 +168,72 @@ SYSCTL_UINT(_debug_lockmgr, OID_AUTO, re
 SYSCTL_UINT(_debug_lockmgr, OID_AUTO, loops, CTLFLAG_RW, &alk_loops, 0, "");
 #endif
 
+static bool __always_inline lockmgr_slock_try(struct lock *lk, uintptr_t *xp,
+int flags);
+static bool __always_inline lockmgr_sunlock_try(struct lock *lk, uintptr_t x);
+
+static void
+lockmgr_note_shared_acquire(struct lock *lk, int contested,
+uint64_t waittime, const char *file, int line, int flags)
+{
+
+   lock_profile_obtain_lock_success(&lk->lock_object, contested, waittime,
+   file, line);
+   LOCK_LOG_LOCK("SLOCK", &lk->lock_object, 0, 0, file, line);
+   WITNESS_LOCK(&lk->lock_object, LK_TRYWIT(flags), file, line);
+   TD_LOCKS_INC(curthread);
+   TD_SLOCKS_INC(curthread);
+   STACK_SAVE(lk);
+}
+
+static void
+lockmgr_note_shared_release(struct lock *lk, const char *file, int line)
+{
+
+   lock_profile_release_lock(&lk->lock_object);
+   WITNESS_UNLOCK(&lk->lock_object, 0, file, line);
+   LOCK_LOG_LOCK("SUNLOCK", &lk->lock_object, 0, 0, file, line);
+   TD_LOCKS_DEC(curthread);
+   TD_SLOCKS_DEC(curthread);
+}
+
+static void
+lockmgr_note_exclusive_acquire(struct lock *lk, int contested,
+uint64_t waittime, const char *file, int line, int flags)
+{
+
+   lock_profile_obtain_lock_success(&lk->lock_object, contested, waittime,
+   file, line);
+   LOCK_LOG_LOCK("XLOCK", &lk->lock_object, 0, lk->lk_recurse, file, line);
+   WITNESS_LOCK(&lk->lock_object, LOP_EXCLUSIVE | LK_TRYWIT(flags), file,
+   line);
+   TD_LOCKS_INC(curthread);
+   STACK_SAVE(lk);
+}
+
+static void
+lockmgr_note_exclusive_release(struct lock *lk, const char *file, int line)
+{
+
+   lock_profile_release_lock(&lk->lock_object);
+   LOCK_LOG_LOCK("XUNLOCK", &lk->lock_object, 0, lk->lk_recurse, file,
+   line);
+   WITNESS_UNLOCK(&lk->lock_object, LOP_EXCLUSIVE, file, line);
+   TD_LOCKS_DEC(curthread);
+}
+
+static void
+lockmgr_note_exclusive_upgrade(struct lock *lk, const char *file, int line,
+int flags)
+{
+
+   LOCK_LOG_LOCK("XUPGRADE", &lk->lock_object, 0, 0, file,
+   line);
+   WITNESS_UPGRADE(&lk->lock_object, LOP_EXCLUSIVE |
+   LK_TRYWIT(flags), file, line);
+   TD_SLOCKS_DEC(curthread);
+}
+
 static __inline struct thread *
 lockmgr_xholder(const struct lock *lk)
 {
@@ -234,35 +300,11 @@ wakeupshlk(struct lock *lk, const char *
u_int realexslp;
int queue, wakeup_swapper;
 
-   WITNESS_UNLOCK(&lk->lock_object, 0, file, line);
-   LOCK_LOG_LOCK("SUNLOCK", &lk->lock_object, 0, 0, file, line);
-
wakeup_swapper = 0;
for (;;) {
x = lk->lk_lock;
-
-   /*
-* If there is more than one shared lock held, just drop one
-* and return.
-*/
-   if (LK_SHARERS(x) > 1) {
-   if (atomic_cmpset_rel_ptr(&lk->lk_lock, x,
-   x - LK_ONE_SHARER))
-   break;
-   continue;
-   }
-
-   /*
-* If there are not waiters on the exclusive queue, drop the
-* lock quickly.
-*/
-   if ((x & LK_ALL_WAITERS) == 0) {
-   MPASS((x & ~LK_EXCLUSIVE_SPINNERS) ==
-   LK_SHARERS_LOCK(1));
-   if (atomic_cmpset_rel_ptr(&lk->lk_lock, x, LK_UNLOCKED))
-   break;
-   continue;
-   }
+   if (lockmgr_sunlock_try(lk, x))
+   break;
 
/*
 * We should have a sharer with waiters, so enter the hard
@@ -332,9 +374,7 @@ wakeupshlk(struct lock *lk, const char *
break;
}
 
-   lock_profile_release_lock(&lk->lock_object);
-   TD_LOCKS_DEC(curthread);
-   TD_SLOCKS_DEC(curthrea

Re: svn commit: r313675 - in head/sys: netinet netinet6

2017-02-12 Thread Glen Barber
On Sun, Feb 12, 2017 at 06:56:33AM +, Ermal Luçi wrote:
> Author: eri
> Date: Sun Feb 12 06:56:33 2017
> New Revision: 313675
> URL: https://svnweb.freebsd.org/changeset/base/313675
> 
> Log:
>   Committed without approval from mentor.
>   
>   Reported by:gnn
> 

What exactly does this mean?

Glen



signature.asc
Description: PGP signature


svn commit: r313684 - head/sys/compat/linux

2017-02-12 Thread Dmitry Chagin
Author: dchagin
Date: Sun Feb 12 15:22:50 2017
New Revision: 313684
URL: https://svnweb.freebsd.org/changeset/base/313684

Log:
  Fix r313284.
  
  Members of the syscall argument structures are padded to a word size. So,
  for COMPAT_LINUX32 we should convert user supplied system call arguments
  which is 32-bit in that case to the array of register_t.
  
  Reported by:  Oleg V. Nauman
  MFC after:1 week

Modified:
  head/sys/compat/linux/linux_socket.c

Modified: head/sys/compat/linux/linux_socket.c
==
--- head/sys/compat/linux/linux_socket.cSun Feb 12 09:49:44 2017
(r313683)
+++ head/sys/compat/linux/linux_socket.cSun Feb 12 15:22:50 2017
(r313684)
@@ -1683,39 +1683,45 @@ linux_getsockopt(struct thread *td, stru
 #if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
 
 /* Argument list sizes for linux_socketcall */
-
-#define LINUX_AL(x) ((x) * sizeof(l_ulong))
-
-static const unsigned char lxs_args[] = {
-   LINUX_AL(0) /* unused*/,LINUX_AL(3) /* socket */,
-   LINUX_AL(3) /* bind */, LINUX_AL(3) /* connect */,
-   LINUX_AL(2) /* listen */,   LINUX_AL(3) /* accept */,
-   LINUX_AL(3) /* getsockname */,  LINUX_AL(3) /* getpeername */,
-   LINUX_AL(4) /* socketpair */,   LINUX_AL(4) /* send */,
-   LINUX_AL(4) /* recv */, LINUX_AL(6) /* sendto */,
-   LINUX_AL(6) /* recvfrom */, LINUX_AL(2) /* shutdown */,
-   LINUX_AL(5) /* setsockopt */,   LINUX_AL(5) /* getsockopt */,
-   LINUX_AL(3) /* sendmsg */,  LINUX_AL(3) /* recvmsg */,
-   LINUX_AL(4) /* accept4 */,  LINUX_AL(5) /* recvmmsg */,
-   LINUX_AL(4) /* sendmmsg */
+static const unsigned char lxs_args_cnt[] = {
+   0 /* unused*/,  3 /* socket */,
+   3 /* bind */,   3 /* connect */,
+   2 /* listen */, 3 /* accept */,
+   3 /* getsockname */,3 /* getpeername */,
+   4 /* socketpair */, 4 /* send */,
+   4 /* recv */,   6 /* sendto */,
+   6 /* recvfrom */,   2 /* shutdown */,
+   5 /* setsockopt */, 5 /* getsockopt */,
+   3 /* sendmsg */,3 /* recvmsg */,
+   4 /* accept4 */,5 /* recvmmsg */,
+   4 /* sendmmsg */
 };
-
-#defineLINUX_AL_SIZE   (nitems(lxs_args) - 1)
+#defineLINUX_ARGS_CNT  (nitems(lxs_args_cnt) - 1)
+#defineLINUX_ARG_SIZE(x)   (lxs_args_cnt[x] * sizeof(l_ulong))
 
 int
 linux_socketcall(struct thread *td, struct linux_socketcall_args *args)
 {
l_ulong a[6];
+#if defined(__amd64__) && defined(COMPAT_LINUX32)
+   register_t l_args[6];
+#endif
void *arg;
int error;
 
-   if (args->what < LINUX_SOCKET || args->what > LINUX_AL_SIZE)
+   if (args->what < LINUX_SOCKET || args->what > LINUX_ARGS_CNT)
return (EINVAL);
-   error = copyin(PTRIN(args->args), a, lxs_args[args->what]);
-   if (error)
+   error = copyin(PTRIN(args->args), a, LINUX_ARG_SIZE(args->what));
+   if (error != 0)
return (error);
 
+#if defined(__amd64__) && defined(COMPAT_LINUX32)
+   for (int i = 0; i < lxs_args_cnt[args->what]; ++i)
+   l_args[i] = a[i];
+   arg = l_args;
+#else
arg = a;
+#endif
switch (args->what) {
case LINUX_SOCKET:
return (linux_socket(td, arg));
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r313675 - in head/sys: netinet netinet6

2017-02-12 Thread George Neville-Neil


On 12 Feb 2017, at 6:10, Glen Barber wrote:

> On Sun, Feb 12, 2017 at 06:56:33AM +, Ermal Luçi wrote:
>> Author: eri
>> Date: Sun Feb 12 06:56:33 2017
>> New Revision: 313675
>> URL: https://svnweb.freebsd.org/changeset/base/313675
>>
>> Log:
>>   Committed without approval from mentor.
>>
>>   Reported by:   gnn
>>
>
> What exactly does this mean?
>

Ermal took the Acceptance on reviews.freebsd.org by Adrian as an implicit "go 
ahead" to commit to the tree.  The issue is that he's still under mentorship, 
by me, and had not gotten an approval or had an Approved by: line.  I asked him 
to revert the change himself.

We're working out a few more issues in the review now.

Best,
George


signature.asc
Description: OpenPGP digital signature


Re: svn commit: r313675 - in head/sys: netinet netinet6

2017-02-12 Thread Cy Schubert
In message <201702120656.v1c6uxp1008...@repo.freebsd.org>, 
=?UTF-8?Q?Ermal_Lu=c
3=a7i?= writes:
> Author: eri
> Date: Sun Feb 12 06:56:33 2017
> New Revision: 313675
> URL: https://svnweb.freebsd.org/changeset/base/313675
> 
> Log:
>   Committed without approval from mentor.

This commit log message is objectionable and totally inappropriate. 
Revision numbers please?

Providing the revision numbers after the fact doesn't completely address my 
objection to the incompleteness of this commit log message because the 
commit log is now incomplete for all posterity. The revision numbers are 
missing from the commit log and anyone going through the history of the 
affected sources (I do that a lot) has no clue, except to try to piece 
together what was backed out and search for replies to commit email to 
provide a complete picture of what was done. Vital information is missing 
from the commit log. Searching for answers to these questions is time 
consuming and incomplete documentation is inconsiderate and disrespectful 
of those who follow on figure out what and why.

Looking up mentor/mentee relationships, one can safely assume that your 
mentor requested the backout. This too should have been documented in the 
commit log message, e.g. "(mentor)".

At the very least revision numbers should be documented in a follow up 
eamil.


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

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





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


Re: svn commit: r313675 - in head/sys: netinet netinet6

2017-02-12 Thread Cy Schubert
In message <53d3a92c-6c64-4c0c-a5e6-b659bfa13...@neville-neil.com>, "George 
Nev
ille-Neil" writes:
> This is an OpenPGP/MIME signed message (RFC 3156 and 4880).
> 
> --=_MailMate_399D2B93-4FB8-4736-9FAB-586EA5CE5549_=
> Content-Type: text/plain; charset=utf-8; markup=markdown
> Content-Transfer-Encoding: quoted-printable
> 
> 
> 
> On 12 Feb 2017, at 6:10, Glen Barber wrote:
> 
> > On Sun, Feb 12, 2017 at 06:56:33AM +, Ermal Lu=C3=A7i wrote:
> >> Author: eri
> >> Date: Sun Feb 12 06:56:33 2017
> >> New Revision: 313675
> >> URL: https://svnweb.freebsd.org/changeset/base/313675
> >>
> >> Log:
> >>   Committed without approval from mentor.
> >>
> >>   Reported by: gnn
> >>
> >
> > What exactly does this mean?
> >
> 
> Ermal took the Acceptance on reviews.freebsd.org by Adrian as an implicit=
>  "go ahead" to commit to the tree.  The issue is that he's still under me=
> ntorship, by me, and had not gotten an approval or had an Approved by: li=
> ne.  I asked him to revert the change himself.
> 
> We're working out a few more issues in the review now.

I didn't read this when I hit send on my email. Hopefully nobody takes 
offense. I was upset and still am.

I still think that the revision numbers of any backout should have been 
documented in the commit log.

Something we could do, as is expected by re@ for commits during a freeze, 
is metees also let their mentors know of what the contents of commit log 
messages will be. I think commit log messages discussing the what, why and 
rationale are as important as the code itself.


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

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


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


Re: svn commit: r313675 - in head/sys: netinet netinet6

2017-02-12 Thread Glen Barber
On Sun, Feb 12, 2017 at 08:24:26AM -0800, Cy Schubert wrote:
> In message <53d3a92c-6c64-4c0c-a5e6-b659bfa13...@neville-neil.com>, "George 
> Neville-Neil" writes:
> > This is an OpenPGP/MIME signed message (RFC 3156 and 4880).
> > On 12 Feb 2017, at 6:10, Glen Barber wrote:
> > > On Sun, Feb 12, 2017 at 06:56:33AM +, Ermal Lu=C3=A7i wrote:
> > >> Author: eri
> > >> Date: Sun Feb 12 06:56:33 2017
> > >> New Revision: 313675
> > >> URL: https://svnweb.freebsd.org/changeset/base/313675
> > >>
> > >> Log:
> > >>   Committed without approval from mentor.
> > >>
> > >>   Reported by:   gnn
> > >>
> > >
> > > What exactly does this mean?
> > >
> > 
> > Ermal took the Acceptance on reviews.freebsd.org by Adrian as an implicit
> >  "go ahead" to commit to the tree.  The issue is that he's still under
> > mentorship, by me, and had not gotten an approval or had an Approved by:
> > line.  I asked him to revert the change himself.
> > 
> > We're working out a few more issues in the review now.
> 
> I didn't read this when I hit send on my email. Hopefully nobody takes 
> offense. I was upset and still am.
> 
> I still think that the revision numbers of any backout should have been 
> documented in the commit log.
> 

I absolutely agree, and was the key meaning behind my "what exactly does
this mean?" reply.  The commit log, as-is, provides nothing useful to
the reader.

> Something we could do, as is expected by re@ for commits during a freeze, 
> is metees also let their mentors know of what the contents of commit log 
> messages will be. I think commit log messages discussing the what, why and 
> rationale are as important as the code itself.
> 

I thought this was standard practice.  But if not, I would agree that
both code changes and the commit log should be both approved by the
mentor.

Just my $0.02 USD.

Glen



signature.asc
Description: PGP signature


svn commit: r313686 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2017-02-12 Thread Andriy Gapon
Author: avg
Date: Sun Feb 12 19:40:59 2017
New Revision: 313686
URL: https://svnweb.freebsd.org/changeset/base/313686

Log:
  check remaining space in zfs implementations of vptocnp
  
  PR:   216939
  Submitted by: Iouri V. Ivliev 
  MFC after:1 week

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cSun Feb 
12 18:52:01 2017(r313685)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cSun Feb 
12 19:40:59 2017(r313686)
@@ -1604,16 +1604,21 @@ zfsctl_snapshot_vptocnp(struct vop_vptoc
}
if (sep == NULL) {
mutex_exit(&sdp->sd_lock);
-   error = ENOENT;
+   error = SET_ERROR(ENOENT);
} else {
size_t len;
 
len = strlen(sep->se_name);
-   *ap->a_buflen -= len;
-   bcopy(sep->se_name, ap->a_buf + *ap->a_buflen, len);
-   mutex_exit(&sdp->sd_lock);
-   vref(dvp);
-   *ap->a_vpp = dvp;
+   if (*ap->a_buflen < len) {
+   mutex_exit(&sdp->sd_lock);
+   error = SET_ERROR(ENOMEM);
+   } else {
+   *ap->a_buflen -= len;
+   bcopy(sep->se_name, ap->a_buf + *ap->a_buflen, len);
+   mutex_exit(&sdp->sd_lock);
+   vref(dvp);
+   *ap->a_vpp = dvp;
+   }
}
VN_RELE(dvp);
 

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Feb 
12 18:52:01 2017(r313685)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Feb 
12 19:40:59 2017(r313686)
@@ -5939,6 +5939,10 @@ zfs_vptocnp(struct vop_vptocnp_args *ap)
error = zfs_znode_parent_and_name(zp, &dzp, name);
if (error == 0) {
len = strlen(name);
+   if (*ap->a_buflen < len)
+   error = SET_ERROR(ENOMEM);
+   }
+   if (error == 0) {
*ap->a_buflen -= len;
bcopy(name, ap->a_buf + *ap->a_buflen, len);
*ap->a_vpp = ZTOV(dzp);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r313687 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2017-02-12 Thread Andriy Gapon
Author: avg
Date: Sun Feb 12 19:45:30 2017
New Revision: 313687
URL: https://svnweb.freebsd.org/changeset/base/313687

Log:
  remove l2_padding_needed statistic from zfs arc
  
  It became obsolete when the Compressed ARC support was committed.
  
  MFC after:1 week

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Sun Feb 12 
19:40:59 2017(r313686)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Sun Feb 12 
19:45:30 2017(r313687)
@@ -711,7 +711,6 @@ typedef struct arc_stats {
kstat_named_t arcstat_l2_size;
kstat_named_t arcstat_l2_asize;
kstat_named_t arcstat_l2_hdr_size;
-   kstat_named_t arcstat_l2_padding_needed;
kstat_named_t arcstat_l2_write_trylock_fail;
kstat_named_t arcstat_l2_write_passed_headroom;
kstat_named_t arcstat_l2_write_spa_mismatch;
@@ -809,7 +808,6 @@ static arc_stats_t arc_stats = {
{ "l2_size",KSTAT_DATA_UINT64 },
{ "l2_asize",   KSTAT_DATA_UINT64 },
{ "l2_hdr_size",KSTAT_DATA_UINT64 },
-   { "l2_padding_needed",  KSTAT_DATA_UINT64 },
{ "l2_write_trylock_fail",  KSTAT_DATA_UINT64 },
{ "l2_write_passed_headroom",   KSTAT_DATA_UINT64 },
{ "l2_write_spa_mismatch",  KSTAT_DATA_UINT64 },
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r313688 - head/sys/kern

2017-02-12 Thread Konstantin Belousov
Author: kib
Date: Sun Feb 12 20:54:31 2017
New Revision: 313688
URL: https://svnweb.freebsd.org/changeset/base/313688

Log:
  Switch copyout_map() to use vm_mmap_object() instead of vm_mmap().
  
  This is both a microoptimization and a move of the consumer to more
  commonly used vm function.
  
  Suggested and reviewed by:alc
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/kern/subr_uio.c

Modified: head/sys/kern/subr_uio.c
==
--- head/sys/kern/subr_uio.cSun Feb 12 19:45:30 2017(r313687)
+++ head/sys/kern/subr_uio.cSun Feb 12 20:54:31 2017(r313688)
@@ -468,10 +468,11 @@ copyout_map(struct thread *td, vm_offset
 
/* round size up to page boundary */
size = (vm_size_t)round_page(sz);
-
-   error = vm_mmap(&vms->vm_map, addr, size, VM_PROT_READ | VM_PROT_WRITE,
-   VM_PROT_ALL, MAP_PRIVATE | MAP_ANON, OBJT_DEFAULT, NULL, 0);
-
+   if (size == 0)
+   return (EINVAL);
+   error = vm_mmap_object(&vms->vm_map, addr, size, VM_PROT_READ |
+   VM_PROT_WRITE, VM_PROT_ALL, MAP_PRIVATE | MAP_ANON, NULL, 0,
+   FALSE, td);
return (error);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r313690 - in head: lib/libc/sys sys/kern sys/vm

2017-02-12 Thread Konstantin Belousov
Author: kib
Date: Sun Feb 12 21:05:44 2017
New Revision: 313690
URL: https://svnweb.freebsd.org/changeset/base/313690

Log:
  Consistently handle negative or wrapping offsets in the mmap(2) syscalls.
  
  For regular files and posix shared memory, POSIX requires that
  [offset, offset + size) range is legitimate.  At the maping time,
  check that offset is not negative.  Allowing negative offsets might
  expose the data that filesystem put into vm_object for internal use,
  esp. due to OFF_TO_IDX() signess treatment.  Fault handler verifies
  that the mapped range is valid, assuming that mmap(2) checked that
  arithmetic gives no undefined results.
  
  For device mappings, leave the semantic of negative offsets to the
  driver.  Correct object page index calculation to not erronously
  propagate sign.
  
  In either case, disallow overflow of offset + size.
  
  Update mmap(2) man page to explain the requirement of the range
  validity, and behaviour when the range becomes invalid after mapping.
  
  Reported and tested by:   royger (previous version)
  Reviewed by:  alc
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/lib/libc/sys/mmap.2
  head/sys/kern/uipc_shm.c
  head/sys/kern/vfs_vnops.c
  head/sys/vm/device_pager.c
  head/sys/vm/sg_pager.c
  head/sys/vm/vm_object.h

Modified: head/lib/libc/sys/mmap.2
==
--- head/lib/libc/sys/mmap.2Sun Feb 12 21:00:12 2017(r313689)
+++ head/lib/libc/sys/mmap.2Sun Feb 12 21:05:44 2017(r313690)
@@ -28,7 +28,7 @@
 .\"@(#)mmap.2  8.4 (Berkeley) 5/11/95
 .\" $FreeBSD$
 .\"
-.Dd November 25, 2016
+.Dd February 4, 2017
 .Dt MMAP 2
 .Os
 .Sh NAME
@@ -53,11 +53,37 @@ starting at byte offset
 .Fa offset .
 If
 .Fa len
-is not a multiple of the pagesize, the mapped region may extend past the
+is not a multiple of the page size, the mapped region may extend past the
 specified range.
 Any such extension beyond the end of the mapped object will be zero-filled.
 .Pp
 If
+.Fa fd
+references a regular file or a shared memory object, the range of
+bytes starting at
+.Fa offset
+and continuing for
+.Fa len
+bytes must be legitimate for the possible (not necessarily
+current) offsets in the object.
+In particular, the
+.Fa offset
+value cannot be negative.
+If the object is truncated and the process later accesses a pages that
+is wholly within the truncated region, the access is aborted and a
+.Dv SIGBUS
+signal is delivered to the process.
+.Pp
+If
+.Fa fd
+references a device file, the interpretation of the
+.Fa offset
+value is device specific and defined by the device driver.
+The virtual memory subsystem does not impose any restrictitions on the
+.Fa offset
+value in this case, passing it unchanged to the driver.
+.Pp
+If
 .Fa addr
 is non-zero, it is used as a hint to the system.
 (As a convenience to the system, the actual address of the region may differ
@@ -157,7 +183,7 @@ If
 .Dv MAP_FIXED
 is specified,
 .Fa addr
-must be a multiple of the pagesize.
+must be a multiple of the page size.
 If
 .Dv MAP_EXCL
 is not specified, a successful
@@ -361,6 +387,12 @@ The
 argument
 is not a valid open file descriptor.
 .It Bq Er EINVAL
+An invalid (negative) value was passed in the
+.Fa offset
+argument, when
+.Fa fd
+referenced a regular file or shared memory.
+.It Bq Er EINVAL
 An invalid value was passed in the
 .Fa prot
 argument.

Modified: head/sys/kern/uipc_shm.c
==
--- head/sys/kern/uipc_shm.cSun Feb 12 21:00:12 2017(r313689)
+++ head/sys/kern/uipc_shm.cSun Feb 12 21:05:44 2017(r313690)
@@ -891,20 +891,20 @@ shm_mmap(struct file *fp, vm_map_t map, 
return (EACCES);
maxprot &= cap_maxprot;
 
+   /* See comment in vn_mmap(). */
+   if (
+#ifdef _LP64
+   objsize > OFF_MAX ||
+#endif
+   foff < 0 || foff > OFF_MAX - objsize)
+   return (EINVAL);
+
 #ifdef MAC
error = mac_posixshm_check_mmap(td->td_ucred, shmfd, prot, flags);
if (error != 0)
return (error);
 #endif

-   /*
-* XXXRW: This validation is probably insufficient, and subject to
-* sign errors.  It should be fixed.
-*/
-   if (foff >= shmfd->shm_size ||
-   foff + objsize > round_page(shmfd->shm_size))
-   return (EINVAL);
-
mtx_lock(&shm_timestamp_lock);
vfs_timestamp(&shmfd->shm_atime);
mtx_unlock(&shm_timestamp_lock);

Modified: head/sys/kern/vfs_vnops.c
==
--- head/sys/kern/vfs_vnops.c   Sun Feb 12 21:00:12 2017(r313689)
+++ head/sys/kern/vfs_vnops.c   Sun Feb 12 21:05:44 2017(r313690)
@@ -2455,6 +2455,24 @@ vn_mmap(struct file *fp, vm_map_t map, v
}
maxprot &= cap_maxprot;
 
+   /*
+* F

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

2017-02-12 Thread Sean Bruno
Author: sbruno
Date: Sun Feb 12 23:06:41 2017
New Revision: 313691
URL: https://svnweb.freebsd.org/changeset/base/313691

Log:
  Only trigger em_local_timer on queue index 0.  This was causing continuous
  em_local_timer() executions during normal operation and was very likely
  to cause a lock up on igb(4) devices.
  
  Submitted by: Matt Macy (mm...@nextbsd.org)
  Reported by:  jtl
  Reviewed by:  gallatin
  Sponsored by: Limelight Networks & Netflix

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

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Sun Feb 12 21:05:44 2017(r313690)
+++ head/sys/dev/e1000/if_em.c  Sun Feb 12 23:06:41 2017(r313691)
@@ -1625,6 +1625,11 @@ em_if_timer(if_ctx_t ctx, uint16_t qid)
int i;
int trigger = 0; 
 
+   if (qid != 0) {
+   /* XXX all this stuff is per-adapter */
+   return;
+   }
+
em_if_update_admin_status(ctx); 
em_update_stats_counters(adapter);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r313692 - head/sys/compat/freebsd32

2017-02-12 Thread Konstantin Belousov
Author: kib
Date: Mon Feb 13 00:39:43 2017
New Revision: 313692
URL: https://svnweb.freebsd.org/changeset/base/313692

Log:
  Style: wrap long line.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

Modified:
  head/sys/compat/freebsd32/freebsd32_misc.c

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==
--- head/sys/compat/freebsd32/freebsd32_misc.c  Sun Feb 12 23:06:41 2017
(r313691)
+++ head/sys/compat/freebsd32/freebsd32_misc.c  Mon Feb 13 00:39:43 2017
(r313692)
@@ -477,7 +477,8 @@ freebsd32_mmap(struct thread *td, struct
 
 #ifdef COMPAT_FREEBSD6
 int
-freebsd6_freebsd32_mmap(struct thread *td, struct freebsd6_freebsd32_mmap_args 
*uap)
+freebsd6_freebsd32_mmap(struct thread *td,
+struct freebsd6_freebsd32_mmap_args *uap)
 {
struct freebsd32_mmap_args ap;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r313693 - head/sys/vm

2017-02-12 Thread Konstantin Belousov
Author: kib
Date: Mon Feb 13 00:40:55 2017
New Revision: 313693
URL: https://svnweb.freebsd.org/changeset/base/313693

Log:
  Remove MPSAFE and ARGUSED annotations, ANSI-fy syscall handlers.
  
  Discussed with:   alc
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/vm/vm_mmap.c

Modified: head/sys/vm/vm_mmap.c
==
--- head/sys/vm/vm_mmap.c   Mon Feb 13 00:39:43 2017(r313692)
+++ head/sys/vm/vm_mmap.c   Mon Feb 13 00:40:55 2017(r313693)
@@ -107,14 +107,8 @@ struct sbrk_args {
 };
 #endif
 
-/*
- * MPSAFE
- */
-/* ARGSUSED */
 int
-sys_sbrk(td, uap)
-   struct thread *td;
-   struct sbrk_args *uap;
+sys_sbrk(struct thread *td, struct sbrk_args *uap)
 {
/* Not yet implemented */
return (EOPNOTSUPP);
@@ -126,14 +120,8 @@ struct sstk_args {
 };
 #endif
 
-/*
- * MPSAFE
- */
-/* ARGSUSED */
 int
-sys_sstk(td, uap)
-   struct thread *td;
-   struct sstk_args *uap;
+sys_sstk(struct thread *td, struct sstk_args *uap)
 {
/* Not yet implemented */
return (EOPNOTSUPP);
@@ -147,11 +135,9 @@ struct getpagesize_args {
 #endif
 
 int
-ogetpagesize(td, uap)
-   struct thread *td;
-   struct getpagesize_args *uap;
+ogetpagesize(struct thread *td, struct getpagesize_args *uap)
 {
-   /* MP SAFE */
+
td->td_retval[0] = PAGE_SIZE;
return (0);
 }
@@ -183,9 +169,6 @@ struct mmap_args {
 };
 #endif
 
-/*
- * MPSAFE
- */
 int
 sys_mmap(struct thread *td, struct mmap_args *uap)
 {
@@ -448,9 +431,6 @@ struct msync_args {
int flags;
 };
 #endif
-/*
- * MPSAFE
- */
 int
 sys_msync(struct thread *td, struct msync_args *uap)
 {
@@ -503,9 +483,6 @@ struct munmap_args {
size_t len;
 };
 #endif
-/*
- * MPSAFE
- */
 int
 sys_munmap(struct thread *td, struct munmap_args *uap)
 {
@@ -588,9 +565,6 @@ struct mprotect_args {
int prot;
 };
 #endif
-/*
- * MPSAFE
- */
 int
 sys_mprotect(struct thread *td, struct mprotect_args *uap)
 {
@@ -632,13 +606,8 @@ struct minherit_args {
int inherit;
 };
 #endif
-/*
- * MPSAFE
- */
 int
-sys_minherit(td, uap)
-   struct thread *td;
-   struct minherit_args *uap;
+sys_minherit(struct thread *td, struct minherit_args *uap)
 {
vm_offset_t addr;
vm_size_t size, pageoff;
@@ -673,13 +642,8 @@ struct madvise_args {
 };
 #endif
 
-/*
- * MPSAFE
- */
 int
-sys_madvise(td, uap)
-   struct thread *td;
-   struct madvise_args *uap;
+sys_madvise(struct thread *td, struct madvise_args *uap)
 {
 
return (kern_vm_madvise(td, (vm_offset_t)uap->addr, uap->len,
@@ -738,13 +702,8 @@ struct mincore_args {
 };
 #endif
 
-/*
- * MPSAFE
- */
 int
-sys_mincore(td, uap)
-   struct thread *td;
-   struct mincore_args *uap;
+sys_mincore(struct thread *td, struct mincore_args *uap)
 {
vm_offset_t addr, first_addr;
vm_offset_t end, cend;
@@ -994,13 +953,8 @@ struct mlock_args {
size_t len;
 };
 #endif
-/*
- * MPSAFE
- */
 int
-sys_mlock(td, uap)
-   struct thread *td;
-   struct mlock_args *uap;
+sys_mlock(struct thread *td, struct mlock_args *uap)
 {
 
return (vm_mlock(td->td_proc, td->td_ucred, uap->addr, uap->len));
@@ -1066,13 +1020,8 @@ struct mlockall_args {
 };
 #endif
 
-/*
- * MPSAFE
- */
 int
-sys_mlockall(td, uap)
-   struct thread *td;
-   struct mlockall_args *uap;
+sys_mlockall(struct thread *td, struct mlockall_args *uap)
 {
vm_map_t map;
int error;
@@ -1143,13 +1092,8 @@ struct munlockall_args {
 };
 #endif
 
-/*
- * MPSAFE
- */
 int
-sys_munlockall(td, uap)
-   struct thread *td;
-   struct munlockall_args *uap;
+sys_munlockall(struct thread *td, struct munlockall_args *uap)
 {
vm_map_t map;
int error;
@@ -1184,9 +1128,6 @@ struct munlock_args {
size_t len;
 };
 #endif
-/*
- * MPSAFE
- */
 int
 sys_munlock(struct thread *td, struct munlock_args *uap)
 {
@@ -1340,8 +1281,6 @@ done:
 /*
  * vm_mmap_cdev()
  *
- * MPSAFE
- *
  * Helper function for vm_mmap.  Perform sanity check specific for mmap
  * operations on cdevs.
  */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r313694 - head/sys/dev/iwi

2017-02-12 Thread Andriy Voskoboinyk
Author: avos
Date: Mon Feb 13 02:15:56 2017
New Revision: 313694
URL: https://svnweb.freebsd.org/changeset/base/313694

Log:
  iwi: add 12-14 2GHz channels into channel list.
  
  Return full channel list via iwi_getradiocaps() method
  (ieee80211_init_channels() was replaced with iwi_getradiocaps()
  to be consistent with other drivers).
  
  PR:   216923
  Submitted and tested by:  d...@ukrhub.net (original patch)
  MFC after:5 days

Modified:
  head/sys/dev/iwi/if_iwi.c

Modified: head/sys/dev/iwi/if_iwi.c
==
--- head/sys/dev/iwi/if_iwi.c   Mon Feb 13 00:40:55 2017(r313693)
+++ head/sys/dev/iwi/if_iwi.c   Mon Feb 13 02:15:56 2017(r313694)
@@ -130,6 +130,15 @@ static const struct iwi_ident iwi_ident_
{ 0, 0, NULL }
 };
 
+static const uint8_t def_chan_2ghz[] =
+   { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
+static const uint8_t def_chan_5ghz_band1[] =
+   { 36, 40, 44, 48, 52, 56, 60, 64 };
+static const uint8_t def_chan_5ghz_band2[] =
+   { 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 };
+static const uint8_t def_chan_5ghz_band3[] =
+   { 149, 153, 157, 161, 165 };
+
 static struct ieee80211vap *iwi_vap_create(struct ieee80211com *,
const char [IFNAMSIZ], int, enum ieee80211_opmode, int,
const uint8_t [IEEE80211_ADDR_LEN],
@@ -204,6 +213,9 @@ static void iwi_radio_off(void *, int);
 static voidiwi_sysctlattach(struct iwi_softc *);
 static voidiwi_led_event(struct iwi_softc *, int);
 static voidiwi_ledattach(struct iwi_softc *);
+static voidiwi_collect_bands(struct ieee80211com *, uint8_t [], size_t);
+static voidiwi_getradiocaps(struct ieee80211com *, int, int *,
+   struct ieee80211_channel []);
 
 static int iwi_probe(device_t);
 static int iwi_attach(device_t);
@@ -271,7 +283,6 @@ iwi_attach(device_t dev)
struct iwi_softc *sc = device_get_softc(dev);
struct ieee80211com *ic = &sc->sc_ic;
uint16_t val;
-   uint8_t bands[IEEE80211_MODE_BYTES];
int i, error;
 
sc->sc_dev = dev;
@@ -374,12 +385,8 @@ iwi_attach(device_t dev)
ic->ic_macaddr[4] = val & 0xff;
ic->ic_macaddr[5] = val >> 8;
 
-   memset(bands, 0, sizeof(bands));
-   setbit(bands, IEEE80211_MODE_11B);
-   setbit(bands, IEEE80211_MODE_11G);
-   if (pci_get_device(dev) >= 0x4223) 
-   setbit(bands, IEEE80211_MODE_11A);
-   ieee80211_init_channels(ic, NULL, bands);
+   iwi_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans,
+   ic->ic_channels);
 
ieee80211_ifattach(ic);
/* override default methods */
@@ -399,6 +406,7 @@ iwi_attach(device_t dev)
ic->ic_ioctl = iwi_ioctl;
ic->ic_transmit = iwi_transmit;
ic->ic_parent = iwi_parent;
+   ic->ic_getradiocaps = iwi_getradiocaps;
 
ieee80211_radiotap_attach(ic,
&sc->sc_txtap.wt_ihdr, sizeof(sc->sc_txtap),
@@ -3569,3 +3577,40 @@ iwi_scan_end(struct ieee80211com *ic)
iwi_cmd(sc, IWI_CMD_ABORT_SCAN, NULL, 0);
IWI_UNLOCK(sc);
 }
+
+static void
+iwi_collect_bands(struct ieee80211com *ic, uint8_t bands[], size_t bands_sz)
+{
+   struct iwi_softc *sc = ic->ic_softc;
+   device_t dev = sc->sc_dev;
+
+   memset(bands, 0, bands_sz);
+   setbit(bands, IEEE80211_MODE_11B);
+   setbit(bands, IEEE80211_MODE_11G);
+   if (pci_get_device(dev) >= 0x4223)
+   setbit(bands, IEEE80211_MODE_11A);
+}
+
+static void
+iwi_getradiocaps(struct ieee80211com *ic,
+int maxchans, int *nchans, struct ieee80211_channel chans[])
+{
+   uint8_t bands[IEEE80211_MODE_BYTES];
+
+   iwi_collect_bands(ic, bands, sizeof(bands));
+   *nchans = 0;
+   if (isset(bands, IEEE80211_MODE_11B) || isset(bands, 
IEEE80211_MODE_11G))
+   ieee80211_add_channel_list_2ghz(chans, maxchans, nchans,
+   def_chan_2ghz, nitems(def_chan_2ghz), bands, 0);
+   if (isset(bands, IEEE80211_MODE_11A)) {
+   ieee80211_add_channel_list_5ghz(chans, maxchans, nchans,
+   def_chan_5ghz_band1, nitems(def_chan_5ghz_band1),
+   bands, 0);
+   ieee80211_add_channel_list_5ghz(chans, maxchans, nchans,
+   def_chan_5ghz_band2, nitems(def_chan_5ghz_band2),
+   bands, 0);
+   ieee80211_add_channel_list_5ghz(chans, maxchans, nchans,
+   def_chan_5ghz_band3, nitems(def_chan_5ghz_band3),
+   bands, 0);
+   }
+}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"