svn commit: r344739 - head/usr.sbin/syslogd

2019-03-03 Thread Hiroki Sato
Author: hrs
Date: Sun Mar  3 05:30:15 2019
New Revision: 344739
URL: https://svnweb.freebsd.org/changeset/base/344739

Log:
  Use struct addrinfo instead of struct sockaddr_storage
  to store peer addresses.

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

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Sun Mar  3 03:42:51 2019
(r344738)
+++ head/usr.sbin/syslogd/syslogd.c Sun Mar  3 05:30:15 2019
(r344739)
@@ -187,7 +187,10 @@ struct peer {
 static STAILQ_HEAD(, peer) pqueue = STAILQ_HEAD_INITIALIZER(pqueue);
 
 struct socklist {
-   struct sockaddr_storage sl_ss;
+   struct addrinfo sl_ai;
+#definesl_sa   sl_ai.ai_addr
+#definesl_salensl_ai.ai_addrlen
+#definesl_family   sl_ai.ai_family
int sl_socket;
struct peer *sl_peer;
int (*sl_recv)(struct socklist *);
@@ -377,7 +380,7 @@ struct iovlist;
 static int allowaddr(char *);
 static int addfile(struct filed *);
 static int addpeer(struct peer *);
-static int addsock(struct sockaddr *, socklen_t, struct socklist *);
+static int addsock(struct addrinfo *, struct socklist *);
 static struct filed *cfline(const char *, const char *, const char *);
 static const char *cvthname(struct sockaddr *);
 static voiddeadq_enter(pid_t, const char *);
@@ -426,9 +429,9 @@ close_filed(struct filed *f)
 
switch (f->f_type) {
case F_FORW:
-   if (f->f_un.f_forw.f_addr) {
-   freeaddrinfo(f->f_un.f_forw.f_addr);
-   f->f_un.f_forw.f_addr = NULL;
+   if (f->fu_forw_addr != NULL) {
+   freeaddrinfo(f->fu_forw_addr);
+   f->fu_forw_addr = NULL;
}
/* FALLTHROUGH */
 
@@ -474,16 +477,23 @@ addpeer(struct peer *pe0)
 }
 
 static int
-addsock(struct sockaddr *sa, socklen_t sa_len, struct socklist *sl0)
+addsock(struct addrinfo *ai, struct socklist *sl0)
 {
struct socklist *sl;
 
-   sl = calloc(1, sizeof(*sl));
+   /* Copy *ai->ai_addr to the tail of struct socklist if any. */
+   sl = calloc(1, sizeof(*sl) + ((ai != NULL) ? ai->ai_addrlen : 0));
if (sl == NULL)
err(1, "malloc failed");
*sl = *sl0;
-   if (sa != NULL && sa_len > 0)
-   memcpy(&sl->sl_ss, sa, sa_len);
+   if (ai != NULL) {
+   memcpy(&sl->sl_ai, ai, sizeof(*ai));
+   if (ai->ai_addrlen > 0) {
+   memcpy((sl + 1), ai->ai_addr, ai->ai_addrlen);
+   sl->sl_sa = (struct sockaddr *)(sl + 1);
+   } else
+   sl->sl_sa = NULL;
+   }
STAILQ_INSERT_TAIL(&shead, sl, next);
 
return (0);
@@ -665,7 +675,7 @@ main(int argc, char *argv[])
if (s < 0) {
err(1, "cannot open a pipe for signals");
} else {
-   addsock(NULL, 0, &(struct socklist){
+   addsock(NULL, &(struct socklist){
.sl_socket = sigpipe[0],
.sl_recv = socklist_recv_signal
});
@@ -676,7 +686,7 @@ main(int argc, char *argv[])
if (s < 0) {
dprintf("can't open %s (%d)\n", _PATH_KLOG, errno);
} else {
-   addsock(NULL, 0, &(struct socklist){
+   addsock(NULL, &(struct socklist){
.sl_socket = s,
.sl_recv = socklist_recv_file,
});
@@ -848,7 +858,7 @@ socklist_recv_sock(struct socklist *sl)
}
/* Received valid data. */
line[len] = '\0';
-   if (sl->sl_ss.ss_family == AF_LOCAL)
+   if (sl->sl_sa != NULL && sl->sl_family == AF_LOCAL)
hname = LocalHostName;
else {
hname = cvthname(sa);
@@ -1643,7 +1653,7 @@ fprintlog_write(struct filed *f, struct iovlist *il, i
case F_FORW:
/* Truncate messages to RFC 5426 recommended size. */
dprintf(" %s", f->fu_forw_hname);
-   switch (f->fu_forw_addr->ai_addr->sa_family) {
+   switch (f->fu_forw_addr->ai_family) {
 #ifdef INET
case AF_INET:
dprintf(":%d\n",
@@ -1670,10 +1680,12 @@ fprintlog_write(struct filed *f, struct iovlist *il, i
msghdr.msg_iov = il->iov;
msghdr.msg_iovlen = il->iovcnt;
STAILQ_FOREACH(sl, &shead, next) {
-   if (sl->sl_ss.ss_family == AF_LOCAL ||
-   sl->sl_ss.ss_family == AF_UNSPEC ||
-   sl->sl_socket < 0)
+   if (sl->sl_socket < 0)
continue;
+  

svn commit: r344736 - head/sys/dev/nvme

2019-03-03 Thread Warner Losh
Author: imp
Date: Sun Mar  3 03:36:33 2019
New Revision: 344736
URL: https://svnweb.freebsd.org/changeset/base/344736

Log:
  Add ABORTED_BY_REQUEST to the list of things we look at DNR bit and tell why 
to comment (code already does this)

Modified:
  head/sys/dev/nvme/nvme_qpair.c

Modified: head/sys/dev/nvme/nvme_qpair.c
==
--- head/sys/dev/nvme/nvme_qpair.c  Sun Mar  3 03:09:43 2019
(r344735)
+++ head/sys/dev/nvme/nvme_qpair.c  Sun Mar  3 03:36:33 2019
(r344736)
@@ -331,7 +331,8 @@ nvme_completion_is_retry(const struct nvme_completion 
 * TODO: spec is not clear how commands that are aborted due
 *  to TLER will be marked.  So for now, it seems
 *  NAMESPACE_NOT_READY is the only case where we should
-*  look at the DNR bit.
+*  look at the DNR bit. Requests failed with ABORTED_BY_REQUEST
+*  set the DNR bit correctly since the driver controls that.
 */
switch (sct) {
case NVME_SCT_GENERIC:
___
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: r344740 - in head: usr.bin/netstat usr.sbin/syslogd

2019-03-03 Thread Bjoern A. Zeeb
Author: bz
Date: Sun Mar  3 10:00:26 2019
New Revision: 344740
URL: https://svnweb.freebsd.org/changeset/base/344740

Log:
  Fix compilation of world with WITHOUT_{INET,INET6}_SUPPORT or both set.
  
  Buildworld failed when both WITHOUT_INET6_SUPPORT and INET equivalent were 
set.
  Fix netstat and syslogd by applying appropriate #ifdef INET/INET6 to make 
world
  compile again.
  
  Reviewed by:  ngie, hrs, ume
  Welcomed by:  Michael Dexter (D17040)
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D19418

Modified:
  head/usr.bin/netstat/inet.c
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.bin/netstat/inet.c
==
--- head/usr.bin/netstat/inet.c Sun Mar  3 05:30:15 2019(r344739)
+++ head/usr.bin/netstat/inet.c Sun Mar  3 10:00:26 2019(r344740)
@@ -85,8 +85,10 @@ __FBSDID("$FreeBSD$");
 #include "netstat.h"
 #include "nl_defs.h"
 
-void   inetprint(const char *, struct in_addr *, int, const char *, int,
+#ifdef INET
+static void inetprint(const char *, struct in_addr *, int, const char *, int,
 const int);
+#endif
 #ifdef INET6
 static int udp_done, tcp_done, sdp_done;
 #endif /* INET6 */
@@ -390,6 +392,7 @@ protopr(u_long off, const char *name, int af1, int pro
so->so_rcv.sb_cc, so->so_snd.sb_cc);
}
if (numeric_port) {
+#ifdef INET
if (inp->inp_vflag & INP_IPV4) {
inetprint("local", &inp->inp_laddr,
(int)inp->inp_lport, name, 1, af1);
@@ -397,8 +400,12 @@ protopr(u_long off, const char *name, int af1, int pro
inetprint("remote", &inp->inp_faddr,
(int)inp->inp_fport, name, 1, af1);
}
+#endif
+#if defined(INET) && defined(INET6)
+   else
+#endif
 #ifdef INET6
-   else if (inp->inp_vflag & INP_IPV6) {
+   if (inp->inp_vflag & INP_IPV6) {
inet6print("local", &inp->in6p_laddr,
(int)inp->inp_lport, name, 1);
if (!Lflag)
@@ -407,6 +414,7 @@ protopr(u_long off, const char *name, int af1, int pro
} /* else nothing printed now */
 #endif /* INET6 */
} else if (inp->inp_flags & INP_ANONPORT) {
+#ifdef INET
if (inp->inp_vflag & INP_IPV4) {
inetprint("local", &inp->inp_laddr,
(int)inp->inp_lport, name, 1, af1);
@@ -414,8 +422,12 @@ protopr(u_long off, const char *name, int af1, int pro
inetprint("remote", &inp->inp_faddr,
(int)inp->inp_fport, name, 0, af1);
}
+#endif
+#if defined(INET) && defined(INET6)
+   else
+#endif
 #ifdef INET6
-   else if (inp->inp_vflag & INP_IPV6) {
+   if (inp->inp_vflag & INP_IPV6) {
inet6print("local", &inp->in6p_laddr,
(int)inp->inp_lport, name, 1);
if (!Lflag)
@@ -424,6 +436,7 @@ protopr(u_long off, const char *name, int af1, int pro
} /* else nothing printed now */
 #endif /* INET6 */
} else {
+#ifdef INET
if (inp->inp_vflag & INP_IPV4) {
inetprint("local", &inp->inp_laddr,
(int)inp->inp_lport, name, 0, af1);
@@ -433,8 +446,12 @@ protopr(u_long off, const char *name, int af1, int pro
inp->inp_lport != inp->inp_fport,
af1);
}
+#endif
+#if defined(INET) && defined(INET6)
+   else
+#endif
 #ifdef INET6
-   else if (inp->inp_vflag & INP_IPV6) {
+   if (inp->inp_vflag & INP_IPV6) {
inet6print("local", &inp->in6p_laddr,
(int)inp->inp_lport, name, 0);
if (!Lflag)
@@ -1314,10 +1331,11 @@ pim_stats(u_long off __unused, const char *name, int a
xo_close_container(name);
 }
 
+#ifdef INET
 /*
  * Pretty print an Internet address (net address + port).
  */
-void
+static void
 inetprint(const char *container, struct in_addr *in, int port,
 const char *proto, int num_port, const int af1)
 {
@@ -1404,3 +1422,4 @@ inetname(struct in_addr *inp)
}
return (line);
 }
+#endif

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/s

svn commit: r344742 - head/sys/netinet

2019-03-03 Thread Michael Tuexen
Author: tuexen
Date: Sun Mar  3 19:55:06 2019
New Revision: 344742
URL: https://svnweb.freebsd.org/changeset/base/344742

Log:
  Allocate an assocition id and register the stcb with holding the lock.
  This avoids a race where stcbs can be found, which are not completely
  initialized.
  
  This was found by running syzkaller.
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_pcb.c

Modified: head/sys/netinet/sctp_pcb.c
==
--- head/sys/netinet/sctp_pcb.c Sun Mar  3 18:57:48 2019(r344741)
+++ head/sys/netinet/sctp_pcb.c Sun Mar  3 19:55:06 2019(r344742)
@@ -4157,11 +4157,9 @@ sctp_aloc_a_assoc_id(struct sctp_inpcb *inp, struct sc
struct sctpasochead *head;
struct sctp_tcb *lstcb;
 
-   SCTP_INP_WLOCK(inp);
 try_again:
if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) {
/* TSNH */
-   SCTP_INP_WUNLOCK(inp);
return (0);
}
/*
@@ -4180,8 +4178,7 @@ try_again:
head = &inp->sctp_asocidhash[SCTP_PCBHASH_ASOC(id, 
inp->hashasocidmark)];
LIST_INSERT_HEAD(head, stcb, sctp_tcbasocidhash);
stcb->asoc.in_asocid_hash = 1;
-   SCTP_INP_WUNLOCK(inp);
-   return id;
+   return (id);
 }
 
 /*
@@ -4344,7 +4341,6 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockadd
memset(stcb, 0, sizeof(*stcb));
asoc = &stcb->asoc;
 
-   asoc->assoc_id = sctp_aloc_a_assoc_id(inp, stcb);
SCTP_TCB_LOCK_INIT(stcb);
SCTP_TCB_SEND_LOCK_INIT(stcb);
stcb->rport = rport;
@@ -4355,7 +4351,6 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockadd
/* failed */
SCTP_TCB_LOCK_DESTROY(stcb);
SCTP_TCB_SEND_LOCK_DESTROY(stcb);
-   LIST_REMOVE(stcb, sctp_tcbasocidhash);
SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_asoc), stcb);
SCTP_DECR_ASOC_COUNT();
*error = err;
@@ -4368,7 +4363,6 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockadd
/* inpcb freed while alloc going on */
SCTP_TCB_LOCK_DESTROY(stcb);
SCTP_TCB_SEND_LOCK_DESTROY(stcb);
-   LIST_REMOVE(stcb, sctp_tcbasocidhash);
SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_asoc), stcb);
SCTP_INP_WUNLOCK(inp);
SCTP_INP_INFO_WUNLOCK();
@@ -4379,6 +4373,7 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockadd
}
SCTP_TCB_LOCK(stcb);
 
+   asoc->assoc_id = sctp_aloc_a_assoc_id(inp, stcb);
/* now that my_vtag is set, add it to the hash */
head = 
&SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag, 
SCTP_BASE_INFO(hashasocmark))];
/* put it in the bucket in the vtag hash of assoc's for the system */
___
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: r344741 - head/sys/kern

2019-03-03 Thread Gleb Smirnoff
Author: glebius
Date: Sun Mar  3 18:57:48 2019
New Revision: 344741
URL: https://svnweb.freebsd.org/changeset/base/344741

Log:
  Remove bogus assert that I added in r319722. It is a legitimate case
  to call soabort() on a newborn socket created by sonewconn() in case
  if further setup of PCB failed. Code in sofree() handles such socket
  correctly.
  
  Submitted by: jtl, rrs
  MFC after:3 weeks

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==
--- head/sys/kern/uipc_socket.c Sun Mar  3 10:00:26 2019(r344740)
+++ head/sys/kern/uipc_socket.c Sun Mar  3 18:57:48 2019(r344741)
@@ -1174,7 +1174,6 @@ soabort(struct socket *so)
KASSERT(so->so_count == 0, ("soabort: so_count"));
KASSERT((so->so_state & SS_PROTOREF) == 0, ("soabort: SS_PROTOREF"));
KASSERT(so->so_state & SS_NOFDREF, ("soabort: !SS_NOFDREF"));
-   KASSERT(so->so_qstate == SQ_NONE, ("soabort: !SQ_NONE"));
VNET_SO_ASSERT(so);
 
if (so->so_proto->pr_usrreqs->pru_abort != NULL)
___
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: r344701 - head/sbin/camcontrol

2019-03-03 Thread Ian Lepore
On Sun, 2019-03-03 at 12:20 -0800, Enji Cooper wrote:
> > On Mar 3, 2019, at 11:12, Steven Hartland 
> > wrote:
> > 
> > Not really much more to say that isn't explained by that and the
> > code.
> > 
> > Sure I could have used a different sentence structure for the body
> > but it wouldn't add anything IMO, thoughts?
> 
> Why the previous sector size was wrong isn’t clear from the
> commit message. Why switch from a sizeof to 0?
> Cheers!
> -Enji
> 

The commit message said it was "incorrect / unused". While a bit terse,
it does communicate that the old value was incorrect (by being there at
all) because the value is unused (so zero more clearly expresses that).

It's not completely a joke that most English-speaking software
engineers have English as a second language. :)

-- Ian


___
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: r344701 - head/sbin/camcontrol

2019-03-03 Thread Warner Losh
On Sun, Mar 3, 2019, 1:29 PM Ian Lepore  wrote:

> On Sun, 2019-03-03 at 12:20 -0800, Enji Cooper wrote:
> > > On Mar 3, 2019, at 11:12, Steven Hartland 
> > > wrote:
> > >
> > > Not really much more to say that isn't explained by that and the
> > > code.
> > >
> > > Sure I could have used a different sentence structure for the body
> > > but it wouldn't add anything IMO, thoughts?
> >
> > Why the previous sector size was wrong isn’t clear from the
> > commit message. Why switch from a sizeof to 0?
> > Cheers!
> > -Enji
> >
>
> The commit message said it was "incorrect / unused". While a bit terse,
> it does communicate that the old value was incorrect (by being there at
> all) because the value is unused (so zero more clearly expresses that).
>

Correct. The standard also encourages that for future proofing the code.
Though in this case this opcode is so old, there is almost zero chance it
will change.

Warner

It's not completely a joke that most English-speaking software
> engineers have English as a second language. :)
>
> -- Ian
>
>
>
>
___
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: r344701 - head/sbin/camcontrol

2019-03-03 Thread Enji Cooper

> On Mar 3, 2019, at 11:12, Steven Hartland  wrote:
> 
> Not really much more to say that isn't explained by that and the code.
> 
> Sure I could have used a different sentence structure for the body but it 
> wouldn't add anything IMO, thoughts?

Why the previous sector size was wrong isn’t clear from the commit message. 
Why switch from a sizeof to 0?
Cheers!
-Enji
___
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: r344701 - head/sbin/camcontrol

2019-03-03 Thread Steven Hartland

Not really much more to say that isn't explained by that and the code.

Sure I could have used a different sentence structure for the body but 
it wouldn't add anything IMO, thoughts?


On 02/03/2019 10:49, Alexey Dokuchaev wrote:

On Fri, Mar 01, 2019 at 02:39:15PM +, Steven Hartland wrote:

New Revision: 344701
URL: https://svnweb.freebsd.org/changeset/base/344701

Log:
   Fix incorrect / unused sector_count for identify requests
   
   Fix incorrect / unused sector_count for identify requests from camcontrol.
   
   Submitted by:	Alexey Dokuchaev

Thanks, although commit message is a bit scarce.  Also, for some reason,
it consists of two nearly identical lines -- unnoticed copy paste error?

./danfe


___
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: r344701 - head/sbin/camcontrol

2019-03-03 Thread Cy Schubert
In message <06d7e6402ad6f673b15873a9d99c9382f21e64b9.ca...@freebsd.org>
, Ian Le
pore writes:
> On Sun, 2019-03-03 at 12:20 -0800, Enji Cooper wrote:
> > > On Mar 3, 2019, at 11:12, Steven Hartland 
> > > wrote:
> > > 
> > > Not really much more to say that isn't explained by that and the
> > > code.
> > > 
> > > Sure I could have used a different sentence structure for the body
> > > but it wouldn't add anything IMO, thoughts?
> > 
> > Why the previous sector size was wrong isn’t clear from the
> > commit message. Why switch from a sizeof to 0?
> > Cheers!
> > -Enji
> > 
>
> The commit message said it was "incorrect / unused". While a bit terse,
> it does communicate that the old value was incorrect (by being there at
> all) because the value is unused (so zero more clearly expresses that).
>
> It's not completely a joke that most English-speaking software
> engineers have English as a second language. :)

This is one of those profound quotes that should be in fortune(1).


-- 
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"


svn commit: r344743 - head/sys/cam/ctl

2019-03-03 Thread Alexander Motin
Author: mav
Date: Mon Mar  4 00:49:07 2019
New Revision: 344743
URL: https://svnweb.freebsd.org/changeset/base/344743

Log:
  Reduce CTL threads priority to about PUSER.
  
  Since in most configurations CTL serves as network service, we found
  that this change improves local system interactivity under heavy load.
  Priority of main threads is set slightly higher then worker taskqueues
  to make them quickly sort incoming requests not creating bottlenecks,
  while plenty of worker taskqueues should be less sensitive to latency.
  
  MFC after:1 week
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl_backend_block.c
  head/sys/cam/ctl/ctl_backend_ramdisk.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Sun Mar  3 19:55:06 2019(r344742)
+++ head/sys/cam/ctl/ctl.c  Mon Mar  4 00:49:07 2019(r344743)
@@ -66,6 +66,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -13191,6 +13193,9 @@ ctl_work_thread(void *arg)
int retval;
 
CTL_DEBUG_PRINT(("ctl_work_thread starting\n"));
+   thread_lock(curthread);
+   sched_prio(curthread, PUSER - 1);
+   thread_unlock(curthread);
 
while (!softc->shutdown) {
/*
@@ -13240,7 +13245,7 @@ ctl_work_thread(void *arg)
}
 
/* Sleep until we have something to do. */
-   mtx_sleep(thr, &thr->queue_lock, PDROP | PRIBIO, "-", 0);
+   mtx_sleep(thr, &thr->queue_lock, PDROP, "-", 0);
}
thr->thread = NULL;
kthread_exit();
@@ -13253,6 +13258,9 @@ ctl_lun_thread(void *arg)
struct ctl_be_lun *be_lun;
 
CTL_DEBUG_PRINT(("ctl_lun_thread starting\n"));
+   thread_lock(curthread);
+   sched_prio(curthread, PUSER - 1);
+   thread_unlock(curthread);
 
while (!softc->shutdown) {
mtx_lock(&softc->ctl_lock);
@@ -13266,7 +13274,7 @@ ctl_lun_thread(void *arg)
 
/* Sleep until we have something to do. */
mtx_sleep(&softc->pending_lun_queue, &softc->ctl_lock,
-   PDROP | PRIBIO, "-", 0);
+   PDROP, "-", 0);
}
softc->lun_thread = NULL;
kthread_exit();
@@ -13284,6 +13292,9 @@ ctl_thresh_thread(void *arg)
int i, e, set;
 
CTL_DEBUG_PRINT(("ctl_thresh_thread starting\n"));
+   thread_lock(curthread);
+   sched_prio(curthread, PUSER - 1);
+   thread_unlock(curthread);
 
while (!softc->shutdown) {
mtx_lock(&softc->ctl_lock);
@@ -13371,7 +13382,7 @@ ctl_thresh_thread(void *arg)
}
}
mtx_sleep(&softc->thresh_thread, &softc->ctl_lock,
-   PDROP | PRIBIO, "-", CTL_LBP_PERIOD * hz);
+   PDROP, "-", CTL_LBP_PERIOD * hz);
}
softc->thresh_thread = NULL;
kthread_exit();

Modified: head/sys/cam/ctl/ctl_backend_block.c
==
--- head/sys/cam/ctl/ctl_backend_block.cSun Mar  3 19:55:06 2019
(r344742)
+++ head/sys/cam/ctl/ctl_backend_block.cMon Mar  4 00:49:07 2019
(r344743)
@@ -2381,7 +2381,7 @@ ctl_be_block_create(struct ctl_be_block_softc *softc, 
 */
retval = taskqueue_start_threads(&be_lun->io_taskqueue,
 /*num threads*/num_threads,
-/*priority*/PWAIT,
+/*priority*/PUSER,
 /*thread name*/
 "%s taskq", be_lun->lunname);
 

Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c
==
--- head/sys/cam/ctl/ctl_backend_ramdisk.c  Sun Mar  3 19:55:06 2019
(r344742)
+++ head/sys/cam/ctl/ctl_backend_ramdisk.c  Mon Mar  4 00:49:07 2019
(r344743)
@@ -1149,7 +1149,7 @@ ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc
 
retval = taskqueue_start_threads(&be_lun->io_taskqueue,
 /*num threads*/1,
-/*priority*/PWAIT,
+/*priority*/PUSER,
 /*thread name*/
 "%s taskq", be_lun->lunname);
if (retval != 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"


svn commit: r344744 - head/sys/dev/rtwn/rtl8192c

2019-03-03 Thread Andriy Voskoboinyk
Author: avos
Date: Mon Mar  4 01:54:28 2019
New Revision: 344744
URL: https://svnweb.freebsd.org/changeset/base/344744

Log:
  rtwn_usb(4): fix LED blinking for RTL8192CU during scanning
  
  Tested with RTL8188CUS, STA mode.
  
  MFC after:5 days

Modified:
  head/sys/dev/rtwn/rtl8192c/r92c_init.c

Modified: head/sys/dev/rtwn/rtl8192c/r92c_init.c
==
--- head/sys/dev/rtwn/rtl8192c/r92c_init.c  Mon Mar  4 00:49:07 2019
(r344743)
+++ head/sys/dev/rtwn/rtl8192c/r92c_init.c  Mon Mar  4 01:54:28 2019
(r344744)
@@ -322,6 +322,7 @@ r92c_init_antsel(struct rtwn_softc *sc)
rtwn_bb_setbits(sc, R92C_FPGA0_RFPARAM(0), 0, 0x2000);
reg = rtwn_bb_read(sc, R92C_FPGA0_RFIFACEOE(0));
sc->sc_ant = MS(reg, R92C_FPGA0_RFIFACEOE0_ANT);/* XXX */
+   rtwn_setbits_1(sc, R92C_LEDCFG2, 0x80, 0);
 }
 
 void
___
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: r344745 - in head/sys/dev/rtwn/rtl8192c: . usb

2019-03-03 Thread Andriy Voskoboinyk
Author: avos
Date: Mon Mar  4 03:02:14 2019
New Revision: 344745
URL: https://svnweb.freebsd.org/changeset/base/344745

Log:
  rtwn_usb(4): fix Tx instability with RTL8192CU chipsets
  
  - Fix data frames transmission via POWER_STATUS register setup -
  it seems to be set by MACID_CONFIG firmware command, which was broken*
  in r290439 and later disabled in r307529.
  
  We can re-enable it later if / when firmware rate adaptation will be
  ready; however, this step will be required anyway - for firmware-less
  builds.
  
  - Force RTS / CTS protection frame rate to CCK1 (this rate works fine
  without any additional setup; no better workaround is known yet).
  
  The problem was not observed on the channel 1 or with CCK1 rate enforced
  ('ifconfig wlan0 ucastrate 1' for 11 b/g; not possible for 11n networks
  due to ifconfig(8) bug).
  
  * I'm not sure if it works before r290439 because - AFAIR - I never seen
  firmware rate adaptation working for 10-STABLE urtwn(4)
  (It needs EN_BCN bit set and RSSI updates at least).
  
  Tested with RTL8188CUS in STA mode
  (in regular mode and with disabled MRR - DARFRC*8 is set to 0)
  
  PR:   233949
  MFC after:2 weeks

Modified:
  head/sys/dev/rtwn/rtl8192c/r92c_reg.h
  head/sys/dev/rtwn/rtl8192c/r92c_tx.c
  head/sys/dev/rtwn/rtl8192c/usb/r92cu_init.c

Modified: head/sys/dev/rtwn/rtl8192c/r92c_reg.h
==
--- head/sys/dev/rtwn/rtl8192c/r92c_reg.h   Mon Mar  4 01:54:28 2019
(r344744)
+++ head/sys/dev/rtwn/rtl8192c/r92c_reg.h   Mon Mar  4 03:02:14 2019
(r344745)
@@ -148,6 +148,7 @@
 #define R92C_RD_RESP_PKT_TH0x463
 #define R92C_INIRTS_RATE_SEL   0x480
 #define R92C_INIDATA_RATE_SEL(macid)   (0x484 + (macid))
+#define R92C_POWER_STATUS  0x4a4
 #define R92C_QUEUE_CTRL0x4c6
 #define R92C_MAX_AGGR_NUM  0x4ca
 #define R92C_BAR_MODE_CTRL 0x4cc

Modified: head/sys/dev/rtwn/rtl8192c/r92c_tx.c
==
--- head/sys/dev/rtwn/rtl8192c/r92c_tx.cMon Mar  4 01:54:28 2019
(r344744)
+++ head/sys/dev/rtwn/rtl8192c/r92c_tx.cMon Mar  4 03:02:14 2019
(r344745)
@@ -211,6 +211,12 @@ r92c_tx_setup_macid(void *buf, int id)
struct r92c_tx_desc *txd = (struct r92c_tx_desc *)buf;
 
txd->txdw1 |= htole32(SM(R92C_TXDW1_MACID, id));
+
+   /* XXX does not belong here */
+   /* XXX temporary (I hope) */
+   /* Force CCK1 for RTS / CTS frames (driver bug) */
+   txd->txdw4 &= ~htole32(SM(R92C_TXDW4_RTSRATE, R92C_TXDW4_RTSRATE_M));
+   txd->txdw4 &= ~htole32(R92C_TXDW4_RTS_SHORT);
 }
 
 void

Modified: head/sys/dev/rtwn/rtl8192c/usb/r92cu_init.c
==
--- head/sys/dev/rtwn/rtl8192c/usb/r92cu_init.c Mon Mar  4 01:54:28 2019
(r344744)
+++ head/sys/dev/rtwn/rtl8192c/usb/r92cu_init.c Mon Mar  4 03:02:14 2019
(r344745)
@@ -357,6 +357,8 @@ void
 r92cu_post_init(struct rtwn_softc *sc)
 {
 
+   rtwn_write_4(sc, R92C_POWER_STATUS, 0x5);
+
/* Perform LO and IQ calibrations. */
r92c_iq_calib(sc);
/* Perform LC calibration. */
___
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: r344748 - head/sbin/ifconfig

2019-03-03 Thread Andriy Voskoboinyk
Author: avos
Date: Mon Mar  4 03:47:06 2019
New Revision: 344748
URL: https://svnweb.freebsd.org/changeset/base/344748

Log:
  Allow to build ifconfig(8) without wireless support
  
  The change removes SIOC[GS]IEEE80211 handling from ifconfig(8)
  if WITHOUT_WIRELESS_SUPPORT=yes is set in src.conf(5).
  
  Reviewed by:  bz
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D19289

Modified:
  head/sbin/ifconfig/Makefile

Modified: head/sbin/ifconfig/Makefile
==
--- head/sbin/ifconfig/Makefile Mon Mar  4 03:38:43 2019(r344747)
+++ head/sbin/ifconfig/Makefile Mon Mar  4 03:47:06 2019(r344748)
@@ -39,8 +39,10 @@ SRCS+=   ifipsec.c   # IPsec VTI
 SRCS+= sfp.c   # SFP/SFP+ information
 LIBADD+=   m
 
+.if ${MK_WIRELESS_SUPPORT} != "no"
 SRCS+= ifieee80211.c   # SIOC[GS]IEEE80211 support
 LIBADD+=   80211
+.endif
 
 SRCS+= carp.c  # SIOC[GS]VH support
 SRCS+= ifgroup.c   # ...
___
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: r344749 - head/sys/dev/ath/ath_hal

2019-03-03 Thread Adrian Chadd
Author: adrian
Date: Mon Mar  4 06:42:06 2019
New Revision: 344749
URL: https://svnweb.freebsd.org/changeset/base/344749

Log:
  [ath_hal] add extra ANI fields for the AR9300 HAL.
  
  I'm trying to debug why reception upstairs here is so terrible and it
  turns out ANI is buggy.  (Which is no surprise, ANI is always buggy.)
  
  Tested:
  
  * Carambola2 (AR9331), STA/AP modes

Modified:
  head/sys/dev/ath/ath_hal/ah.h

Modified: head/sys/dev/ath/ath_hal/ah.h
==
--- head/sys/dev/ath/ath_hal/ah.h   Mon Mar  4 03:47:06 2019
(r344748)
+++ head/sys/dev/ath/ath_hal/ah.h   Mon Mar  4 06:42:06 2019
(r344749)
@@ -893,11 +893,13 @@ typedef struct {
 } HAL_ANI_STATS;
 
 typedef struct {
-   uint8_t noiseImmunityLevel;
+   uint8_t noiseImmunityLevel; /* OFDM */
+   uint8_t cckNoiseImmunityLevel;
uint8_t spurImmunityLevel;
uint8_t firstepLevel;
uint8_t ofdmWeakSigDetectOff;
uint8_t cckWeakSigThreshold;
+   uint8_t mrcCckOff;
uint32_tlistenTime;
 
/* NB: intentionally ordered so data exported to user space is first */
___
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: r344750 - head/sys/contrib/dev/ath/ath_hal/ar9300

2019-03-03 Thread Adrian Chadd
Author: adrian
Date: Mon Mar  4 06:43:00 2019
New Revision: 344750
URL: https://svnweb.freebsd.org/changeset/base/344750

Log:
  [ath_hal_ar9300] Add the extra ANI configuration fields for the AR93xx HAL.
  
  Tested:
  
  * Carambola2 (Ar9331), STA/AP modes

Modified:
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c   Mon Mar  4 
06:42:06 2019(r344749)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c   Mon Mar  4 
06:43:00 2019(r344750)
@@ -1263,15 +1263,13 @@ ar9300_get_diag_state(struct ath_hal *ah, int request,
 if (ani == AH_NULL)
 return AH_FALSE;
 /* Convert ar9300 HAL to FreeBSD HAL ANI state */
-/* XXX TODO: add all of these to the HAL ANI state structure */
 bzero(&ahp->ext_ani_state, sizeof(ahp->ext_ani_state));
-/* XXX should this be OFDM or CCK noise immunity level? */
 ahp->ext_ani_state.noiseImmunityLevel = ani->ofdm_noise_immunity_level;
 ahp->ext_ani_state.spurImmunityLevel = ani->spur_immunity_level;
 ahp->ext_ani_state.firstepLevel = ani->firstep_level;
 ahp->ext_ani_state.ofdmWeakSigDetectOff = 
ani->ofdm_weak_sig_detect_off;
-/* mrc_cck_off */
-/* cck_noise_immunity_level */
+ahp->ext_ani_state.mrcCckOff = ani->mrc_cck_off;
+ahp->ext_ani_state.cckNoiseImmunityLevel = 
ani->cck_noise_immunity_level;
 
 ahp->ext_ani_state.listenTime = ani->listen_time;
 
___
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: r344748 - head/sbin/ifconfig

2019-03-03 Thread Rodney W. Grimes
> Author: avos
> Date: Mon Mar  4 03:47:06 2019
> New Revision: 344748
> URL: https://svnweb.freebsd.org/changeset/base/344748
> 
> Log:
>   Allow to build ifconfig(8) without wireless support
>   
>   The change removes SIOC[GS]IEEE80211 handling from ifconfig(8)
>   if WITHOUT_WIRELESS_SUPPORT=yes is set in src.conf(5).
>   
>   Reviewed by:bz
>   MFC after:  1 week
>   Differential Revision:  https://reviews.freebsd.org/D19289

Thank you, this should help dexter@ with the build option survey
stuff that phk@ wrote he has been running.

> Modified:
>   head/sbin/ifconfig/Makefile
> 
> Modified: head/sbin/ifconfig/Makefile
> ==
> --- head/sbin/ifconfig/Makefile   Mon Mar  4 03:38:43 2019
> (r344747)
> +++ head/sbin/ifconfig/Makefile   Mon Mar  4 03:47:06 2019
> (r344748)
> @@ -39,8 +39,10 @@ SRCS+= ifipsec.c   # IPsec VTI
>  SRCS+=   sfp.c   # SFP/SFP+ information
>  LIBADD+= m
>  
> +.if ${MK_WIRELESS_SUPPORT} != "no"
>  SRCS+=   ifieee80211.c   # SIOC[GS]IEEE80211 support
>  LIBADD+= 80211
> +.endif
>  
>  SRCS+=   carp.c  # SIOC[GS]VH support
>  SRCS+=   ifgroup.c   # ...
> 
> 

-- 
Rod Grimes rgri...@freebsd.org
___
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"