svn commit: r362882 - svnadmin/conf

2020-07-01 Thread Alexander Motin
Author: mav
Date: Thu Jul  2 01:10:18 2020
New Revision: 362882
URL: https://svnweb.freebsd.org/changeset/base/362882

Log:
  Release Ryan Moeller (freqlabs) from mentorship.
  
  Approved by:  mmacy (co-mentor)

Modified:
  svnadmin/conf/mentors

Modified: svnadmin/conf/mentors
==
--- svnadmin/conf/mentors   Thu Jul  2 01:02:40 2020(r362881)
+++ svnadmin/conf/mentors   Thu Jul  2 01:10:18 2020(r362882)
@@ -13,7 +13,6 @@
 afedorov   vmaffione   Co-mentor: jhb
 anish  jhb
 brdallanjude   Co-mentor: bapt
-freqlabs   mav Co-mentor: mmacy
 gordon delphij Co-mentor: emaste
 jceel  trasz
 jkhrwatson
___
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: r362881 - stable/12/sys/dev/nvme

2020-07-01 Thread Alexander Motin
Author: mav
Date: Thu Jul  2 01:02:40 2020
New Revision: 362881
URL: https://svnweb.freebsd.org/changeset/base/362881

Log:
  MFC r362630: Fix few panics on NVMe's timing out initialization requests.

Modified:
  stable/12/sys/dev/nvme/nvme_ctrlr.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/nvme/nvme_ctrlr.c
==
--- stable/12/sys/dev/nvme/nvme_ctrlr.c Wed Jul  1 23:47:51 2020
(r362880)
+++ stable/12/sys/dev/nvme/nvme_ctrlr.c Thu Jul  2 01:02:40 2020
(r362881)
@@ -1020,11 +1020,20 @@ nvme_ctrlr_start(void *ctrlr_arg, bool resetting)
if (resetting)
nvme_qpair_reset(>adminq);
 
-   for (i = 0; i < ctrlr->num_io_queues; i++)
-   nvme_qpair_reset(>ioq[i]);
+   if (ctrlr->ioq != NULL) {
+   for (i = 0; i < ctrlr->num_io_queues; i++)
+   nvme_qpair_reset(>ioq[i]);
+   }
 
nvme_admin_qpair_enable(>adminq);
 
+   /*
+* If it was a reset on initialization command timeout, just
+* return here, letting initialization code fail gracefully.
+*/
+   if (resetting && !ctrlr->is_initialized)
+   return;
+
if (nvme_ctrlr_identify(ctrlr) != 0) {
nvme_ctrlr_fail(ctrlr);
return;
@@ -1079,7 +1088,6 @@ void
 nvme_ctrlr_start_config_hook(void *arg)
 {
struct nvme_controller *ctrlr = arg;
-   int status;
 
/*
 * Reset controller twice to ensure we do a transition from cc.en==1 to
@@ -1087,19 +1095,15 @@ nvme_ctrlr_start_config_hook(void *arg)
 * controller was left in when boot handed off to OS.  Linux doesn't do
 * this, however. If we adopt that policy, see also nvme_ctrlr_resume().
 */
-   status = nvme_ctrlr_hw_reset(ctrlr);
-   if (status != 0) {
+   if (nvme_ctrlr_hw_reset(ctrlr) != 0) {
+fail:
nvme_ctrlr_fail(ctrlr);
config_intrhook_disestablish(>config_hook);
return;
}
 
-   status = nvme_ctrlr_hw_reset(ctrlr);
-   if (status != 0) {
-   nvme_ctrlr_fail(ctrlr);
-   config_intrhook_disestablish(>config_hook);
-   return;
-   }
+   if (nvme_ctrlr_hw_reset(ctrlr) != 0)
+   goto fail;
 
nvme_qpair_reset(>adminq);
nvme_admin_qpair_enable(>adminq);
@@ -1108,7 +1112,7 @@ nvme_ctrlr_start_config_hook(void *arg)
nvme_ctrlr_construct_io_qpairs(ctrlr) == 0)
nvme_ctrlr_start(ctrlr, false);
else
-   nvme_ctrlr_fail(ctrlr);
+   goto fail;
 
nvme_sysctl_initialize_ctrlr(ctrlr);
config_intrhook_disestablish(>config_hook);
@@ -1418,10 +1422,12 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, dev
nvme_ctrlr_hmb_enable(ctrlr, false, false);
nvme_ctrlr_delete_qpairs(ctrlr);
}
+   nvme_ctrlr_hmb_free(ctrlr);
+   }
+   if (ctrlr->ioq != NULL) {
for (i = 0; i < ctrlr->num_io_queues; i++)
nvme_io_qpair_destroy(>ioq[i]);
free(ctrlr->ioq, M_NVME);
-   nvme_ctrlr_hmb_free(ctrlr);
}
nvme_admin_qpair_destroy(>adminq);
 
___
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: r362809 - head/contrib/mandoc

2020-07-01 Thread Alexey Dokuchaev
On Wed, Jul 01, 2020 at 05:01:00PM -0700, Rodney W. Grimes wrote:
> Thats good, but realize the page already contains history that
> reads like:
> 
> HISTORY
>  Part of the functionality of whatis was already provided by the former
>  manwhere utility in 1BSD. The apropos and whatis utilities first ap-
>  peared in 2BSD.  They were rewritten from scratch for OpenBSD 5.6.
> 
>  The -M option and the MANPATH variable first appeared in 4.3BSD; -m in
>  4.3BSD-Reno; -C in 4.4BSD Lite1; and -S and -s in OpenBSD 4.5 for apropos
>  and in OpenBSD 5.6 for whatis.  The options -acfhIKklOTWw appeared in
>  OpenBSD 5.7.
> 
> And further contains:
> 
> AUTHORS
>  Bill Joy wrote manwhere in 1977 and the original BSD apropos and whatis
>  in February 1979. The current version was written by Kristaps Dzonsons
>   and Ingo Schwarze .
> 
> So the history is rich and complete, do we really need to say when we
> incorporated this into FreeBSD from OpenBSD's mandoc in the manual page?

Ah, in this case, the only thing lacking from the current version is mention
of FreeBSD 11.1.  Sorry for not checking with that before writing my reply.
My main point, however, was that reverse chronological order looks strange.

./danfe
___
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: r362809 - head/contrib/mandoc

2020-07-01 Thread Rodney W. Grimes
> On Wed, Jul 01, 2020 at 11:28:47PM +0200, Gordon Bergling wrote:
> > On Wed, Jul 01, 2020 at 11:58:05AM -0600, Warner Losh wrote:
> > > On Wed, Jul 1, 2020 at 8:51 AM Rodney W. Grimes wrote:
> > > > ...
> > > > We often have "An ls command appeared in Version 1 AT UNIX."  Our 
> > > > source
> > > > code and man page is not from that, but that is the history of ls.
> > > >
> > > > This *could* be amended and *should* be amended to reflect that apropos,
> > > > and makewhatis got *updated* by a switch to the mandoc versions, but it
> > > > is misleading to say it was intergrated with the switch to mandoc as 
> > > > that
> > > > implies it did not exist before this action.
> > > 
> > > I tend to agree with Rod here. These appeared in X the first time, but
> > > noting they were replaced in version X with Y is the best way to address
> > > the current provenance of the code...
> > 
> > OK, I see your arguments. How about the following addition for HISTORY 
> > section,
> > 
> > The apropos utility was integrated into FreeBSD 11.1 as part of the
> > switch to mandoc. Before the switch to mandoc apropos was available since
> > FreeBSD 1.0.
> 
> It should be the other way around:
> 
>   "The apropos utility appeared in FreeBSD 1.0.  Since FreeBSD 11.1
>it is based on mandoc implementation."

Thats good, but realize the page already contains history that
reads like:

HISTORY
 Part of the functionality of whatis was already provided by the former
 manwhere utility in 1BSD. The apropos and whatis utilities first ap-
 peared in 2BSD.  They were rewritten from scratch for OpenBSD 5.6.

 The -M option and the MANPATH variable first appeared in 4.3BSD; -m in
 4.3BSD-Reno; -C in 4.4BSD Lite1; and -S and -s in OpenBSD 4.5 for apropos
 and in OpenBSD 5.6 for whatis.  The options -acfhIKklOTWw appeared in
 OpenBSD 5.7.

And further contains:

UTHORS
 Bill Joy wrote manwhere in 1977 and the original BSD apropos and whatis
 in February 1979. The current version was written by Kristaps Dzonsons
  and Ingo Schwarze .

So the history is rich and complete, do we really need to say when we
incorporated this into FreeBSD from OpenBSD's mandoc in the manual page?

> ./danfe
-- 
Rod Grimes rgri...@freebsd.org
___
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: r362880 - in stable/12/sys: modules/tcp/rack netinet netinet/tcp_stacks sys

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 23:47:51 2020
New Revision: 362880
URL: https://svnweb.freebsd.org/changeset/base/362880

Log:
  MFC r349893:
  
  This commit updates rack to what is basically being used at NF as
  well as sets in some of the groundwork for committing BBR. The
  hpts system is updated as well as some other needed utilities
  for the entrance of BBR. This is actually part 1 of 3 more
  needed commits which will finally complete with BBRv1 being
  added as a new tcp stack.
  
  Merge conflics were manually resolved.
  
  Sponsored by: Netflix, Inc.
  Differential Revision:https://reviews.freebsd.org/D20834

Added:
  stable/12/sys/netinet/tcp_stacks/rack_bbr_common.c
 - copied unchanged from r349893, 
head/sys/netinet/tcp_stacks/rack_bbr_common.c
Modified:
  stable/12/sys/modules/tcp/rack/Makefile
  stable/12/sys/netinet/in_pcb.h
  stable/12/sys/netinet/tcp.h
  stable/12/sys/netinet/tcp_hpts.c
  stable/12/sys/netinet/tcp_hpts.h
  stable/12/sys/netinet/tcp_log_buf.h
  stable/12/sys/netinet/tcp_stacks/rack.c
  stable/12/sys/netinet/tcp_stacks/rack_bbr_common.h
  stable/12/sys/netinet/tcp_var.h
  stable/12/sys/sys/mbuf.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/modules/tcp/rack/Makefile
==
--- stable/12/sys/modules/tcp/rack/Makefile Wed Jul  1 22:31:37 2020
(r362879)
+++ stable/12/sys/modules/tcp/rack/Makefile Wed Jul  1 23:47:51 2020
(r362880)
@@ -6,7 +6,7 @@
 
 STACKNAME= rack
 KMOD=  tcp_${STACKNAME}
-SRCS=  rack.c sack_filter.c
+SRCS=  rack.c sack_filter.c rack_bbr_common.c
 
 SRCS+= opt_inet.h opt_inet6.h opt_ipsec.h
 SRCS+= opt_tcpdebug.h

Modified: stable/12/sys/netinet/in_pcb.h
==
--- stable/12/sys/netinet/in_pcb.h  Wed Jul  1 22:31:37 2020
(r362879)
+++ stable/12/sys/netinet/in_pcb.h  Wed Jul  1 23:47:51 2020
(r362880)
@@ -759,7 +759,9 @@ int inp_so_options(const struct inpcb *inp);
 #defineINP_ORIGDSTADDR 0x0800 /* receive IP dst 
address/port */
 #define INP_CANNOT_DO_ECN  0x1000 /* The stack does not do ECN */
 #defineINP_REUSEPORT_LB0x2000 /* SO_REUSEPORT_LB option is 
set */
-
+#define INP_SUPPORTS_MBUFQ 0x4000 /* Supports the mbuf queue method of 
LRO */
+#define INP_MBUF_QUEUE_READY   0x8000 /* The transport is pacing, inputs 
can be queued */
+#define INP_DONT_SACK_QUEUE0x0001 /* If a sack arrives do not wake me 
*/
 /*
  * Flags passed to in_pcblookup*() functions.
  */

Modified: stable/12/sys/netinet/tcp.h
==
--- stable/12/sys/netinet/tcp.h Wed Jul  1 22:31:37 2020(r362879)
+++ stable/12/sys/netinet/tcp.h Wed Jul  1 23:47:51 2020(r362880)
@@ -202,9 +202,8 @@ struct tcphdr {
 #define TCP_RACK_TLP_THRESH   1063 /* RACK TLP theshold i.e. srtt+(srtt/N) */
 #define TCP_RACK_PKT_DELAY1064 /* RACK added ms i.e. rack-rtt + reord + N 
*/
 #define TCP_RACK_TLP_INC_VAR  1065 /* Does TLP include rtt variance in t-o */
-#define TCP_RACK_SESS_CWV 1066 /* Enable RFC7611 cwnd validation on sess */
 #define TCP_BBR_IWINTSO  1067 /* Initial TSO window for BBRs first 
sends */
-#define TCP_BBR_RECFORCE  1068 /* Enter recovery force out a segment 
disregard pacer */
+#define TCP_BBR_RECFORCE  1068 /* Enter recovery force out a segment 
disregard pacer no longer valid */
 #define TCP_BBR_STARTUP_PG1069 /* Startup pacing gain */
 #define TCP_BBR_DRAIN_PG  1070 /* Drain pacing gain */
 #define TCP_BBR_RWND_IS_APP   1071 /* Rwnd limited is considered app limited */
@@ -212,14 +211,18 @@ struct tcphdr {
 #define TCP_BBR_ONE_RETRAN1073 /* Is only one segment allowed out during 
retran */
 #define TCP_BBR_STARTUP_LOSS_EXIT 1074 /* Do we exit a loss during startup if 
not 20% incr */
 #define TCP_BBR_USE_LOWGAIN   1075 /* lower the gain in PROBE_BW enable */
-#define TCP_BBR_LOWGAIN_THRESH 1076 /* How many cycles do we stay in lowgain */
-#define TCP_BBR_LOWGAIN_HALF  1077 /* Do we halfstep lowgain down */
-#define TCP_BBR_LOWGAIN_FD1078 /* Do we force a drain when lowgain in 
place */
+#define TCP_BBR_LOWGAIN_THRESH 1076 /* Unused after 2.3 morphs to TSLIMITS >= 
2.3 */
+#define TCP_BBR_TSLIMITS 1076 /* Do we use experimental Timestamp limiting 
for our algo */
+#define TCP_BBR_LOWGAIN_HALF  1077 /* Unused after 2.3 */
+#define TCP_BBR_PACE_OH1077 /* Reused in 4.2 for pacing overhead 
setting */
+#define TCP_BBR_LOWGAIN_FD1078 /* Unused after 2.3 */
+#define TCP_BBR_HOLD_TARGET 1078   /* For 4.3 on */
 #define TCP_BBR_USEDEL_RATE   1079 /* Enable use of delivery rate for loss 
recovery */
 #define TCP_BBR_MIN_RTO   1080 /* Min RTO in milliseconds */
 #define TCP_BBR_MAX_RTO  1081 /* Max RTO in milliseconds */
 

Re: svn commit: r362809 - head/contrib/mandoc

2020-07-01 Thread Alexey Dokuchaev
On Wed, Jul 01, 2020 at 11:28:47PM +0200, Gordon Bergling wrote:
> On Wed, Jul 01, 2020 at 11:58:05AM -0600, Warner Losh wrote:
> > On Wed, Jul 1, 2020 at 8:51 AM Rodney W. Grimes wrote:
> > > ...
> > > We often have "An ls command appeared in Version 1 AT UNIX."  Our source
> > > code and man page is not from that, but that is the history of ls.
> > >
> > > This *could* be amended and *should* be amended to reflect that apropos,
> > > and makewhatis got *updated* by a switch to the mandoc versions, but it
> > > is misleading to say it was intergrated with the switch to mandoc as that
> > > implies it did not exist before this action.
> > 
> > I tend to agree with Rod here. These appeared in X the first time, but
> > noting they were replaced in version X with Y is the best way to address
> > the current provenance of the code...
> 
> OK, I see your arguments. How about the following addition for HISTORY 
> section,
> 
> The apropos utility was integrated into FreeBSD 11.1 as part of the
> switch to mandoc. Before the switch to mandoc apropos was available since
> FreeBSD 1.0.

It should be the other way around:

  "The apropos utility appeared in FreeBSD 1.0.  Since FreeBSD 11.1
   it is based on mandoc implementation."

./danfe
___
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: r362809 - head/contrib/mandoc

2020-07-01 Thread Rodney W. Grimes
> On Wed, Jul 01, 2020 at 11:58:05AM -0600, Warner Losh wrote:
> > On Wed, Jul 1, 2020 at 8:51 AM Rodney W. Grimes 
> > wrote:
> > 
> > > > On Tue, Jun 30, 2020 at 03:56:17PM -0700, Rodney W. Grimes wrote:
> > > > > [ Charset UTF-8 unsupported, converting... ]
> > > > > > Author: gbe (doc committer)
> > > > > > Date: Tue Jun 30 18:08:59 2020
> > > > > > New Revision: 362809
> > > > > > URL: https://svnweb.freebsd.org/changeset/base/362809
> > > > > >
> > > > > > Log:
> > > > > >   Mention FreeBSD in the HISTORY sections of apropos(1) and
> > > makewhatis(8).
> > > > > >
> > > > > >   PR: 223520, 223521
> > > > > >   Reviewed by:bcr (mentor)
> > > > > >   Approved by:bcr (mentor)
> > > > > >   Differential Revision:  https://reviews.freebsd.org/D25521
> > > > > >
> > > > > > Modified:
> > > > > >   head/contrib/mandoc/apropos.1
> > > > > >   head/contrib/mandoc/makewhatis.8
> > > > > >
> > > > > > Modified: head/contrib/mandoc/apropos.1
> > > > > >
> > > ==
> > > > > > --- head/contrib/mandoc/apropos.1 Tue Jun 30 17:21:28 2020
> > > (r362808)
> > > > > > +++ head/contrib/mandoc/apropos.1 Tue Jun 30 18:08:59 2020
> > > (r362809)
> > > > > > @@ -15,7 +15,7 @@
> > > > > >  .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
> > > ARISING OUT OF
> > > > > >  .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> > > > > >  .\"
> > > > > > -.Dd $Mdocdate: November 22 2018 $
> > > > > > +.Dd $Mdocdate: June 30 2020 $
> > > > > >  .Dt APROPOS 1
> > > > > >  .Os
> > > > > >  .Sh NAME
> > > > > > @@ -493,6 +493,12 @@ The options
> > > > > >  .Fl acfhIKklOTWw
> > > > > >  appeared in
> > > > > >  .Ox 5.7 .
> > > > > > +.Pp
> > > > > > +The
> > > > > > +.Nm
> > > > > > +utility was integrated into
> > > > > > +.Fx 11.1
> > > > > > +as part of the switch to mandoc.
> > > > >
> > > > > Huh?  FreeBSD has had apropos since 1.0 and my 5.4 system clearly has
> > > it:
> > > > > freebsd {110}% uname -a
> > > > > FreeBSD pdx.rh.CN85.dnsmgr.net 5.4-RELEASE-p8 FreeBSD 5.4-RELEASE-p8
> > > #1: Mon Jul  1 17:58:50 PDT 2019 
> > > r...@pdx.rh.cn85.dnsmgr.net:/usr/src/sys/i386/compile/PDXMXPIE
> > > i386
> > > > > pdx.rh.CN85.dnsmgr.net:freebsd {111}% which apropos
> > > > > /usr/bin/apropos
> > > > >
> > > > > And a man page for it too:
> > > > > APROPOS(1)  FreeBSD General Commands Manual
> > >  APROPOS(1)
> > > > >
> > > > > NAME
> > > > >  apropos, whatis -- search the whatis database
> > > > >
> > > > > SYNOPSIS
> > > > >  apropos keyword ...
> > > > >  whatis keyword ...
> > > > >
> > > > > DESCRIPTION
> > > > >  apropos searches a set of database files containing short
> > > descriptions of
> > > > >  system commands for keywords and displays the result on the
> > > standard out-
> > > > >  put.  whatis displays only complete word matches.
> > > > >
> > > > >  keyword really is an extended regular expression, please read
> > > grep(1)
> > > > >  manual page for more information about its format.
> > > > >
> > > > > DIAGNOSTICS
> > > > >  The apropos utility exits 0 on success, and 1 if no keyword
> > > matched.
> > > > >
> > > > > SEE ALSO
> > > > >  grep(1), makewhatis(1), man(1)
> > > > >
> > > > > FreeBSD 5.4January 15, 1991
> > > FreeBSD 5.4
> > > > >
> > > > > >  .Sh AUTHORS
> > > > > >  .An -nosplit
> > > > > >  .An Bill Joy
> > > > > >
> > > >
> > > > That is true, but the version of 'apropos' we have currently in base is
> > > based on mandoc,
> > > > which was imported around September 2018. Due to the nature of
> > > contributed code I
> > > > thought it would be best to document only the history when it was
> > > integrated into
> > > > FreeSBD. The same applies for 'makewhatis'.
> > >
> > > That is not what has been done in other places when code is
> > > changed/replaced,
> > > the HISTORY section is not specific to "FreeBSD's version" of this
> > > function.
> > >
> > > We often have "An ls command appeared in Version 1 AT UNIX."  Our source
> > > code and man page is not from that, but that is the history of ls.
> > >
> > > This *could* be amended and *should* be amended to reflect that apropos,
> > > and makewhatis got *updated* by a switch to the mandoc versions, but it
> > > is misleading to say it was intergrated with the switch to mandoc as that
> > > implies it did not exist before this action.
> > >
> > 
> > I tend to agree with Rod here. These appeared in X the first time, but
> > noting they were replaced in version X with Y is the best way to address
> > the current provenance of the code...
> > 
> > Warner
> 
> OK, I see your arguments. How about the following addition for HISTORY 
> section,
> 
> The apropos utility was integrated into FreeBSD 11.1 as part of the
> switch to mandoc. Before the switch to mandoc apropos was available since
> FreeBSD 1.0.

This still implies that it originated with the switch to 

svn commit: r362879 - stable/12/sys/netinet

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 22:31:37 2020
New Revision: 362879
URL: https://svnweb.freebsd.org/changeset/base/362879

Log:
  MFC r356796:
  Remove debug code not needed anymore.
  
  Submitted by: rscheff
  Reviewed by:  tuexen
  Differential Revision:https://reviews.freebsd.org/D23208

Modified:
  stable/12/sys/netinet/tcp_sack.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/tcp_sack.c
==
--- stable/12/sys/netinet/tcp_sack.cWed Jul  1 22:22:26 2020
(r362878)
+++ stable/12/sys/netinet/tcp_sack.cWed Jul  1 22:31:37 2020
(r362879)
@@ -165,11 +165,6 @@ tcp_update_dsack_list(struct tcpcb *tp, tcp_seq rcv_st
 
KASSERT(SEQ_LT(rcv_start, rcv_end), ("rcv_start < rcv_end"));
 
-   if (tp->t_inpcb->inp_socket->so_options & SO_DEBUG) {
-   log(LOG_DEBUG, "\nDSACK update: %d..%d, rcv_nxt: %u\n",
-   rcv_start, rcv_end, tp->rcv_nxt);
-   }
-
if (SEQ_LT(rcv_end, tp->rcv_nxt) ||
((rcv_end == tp->rcv_nxt) &&
 (tp->rcv_numsacks > 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: r362878 - in stable/12/sys: netinet netinet6

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 22:22:26 2020
New Revision: 362878
URL: https://svnweb.freebsd.org/changeset/base/362878

Log:
  MFC r356663:
  
  Fix race when accepting TCP connections.
  
  When expanding a SYN-cache entry to a socket/inp a two step approach was
  taken:
  1) The local address was filled in, then the inp was added to the hash
 table.
  2) The remote address was filled in and the inp was relocated in the
 hash table.
  Before the epoch changes, a write lock was held when this happens and
  the code looking up entries was holding a corresponding read lock.
  Since the read lock is gone away after the introduction of the
  epochs, the half populated inp was found during lookup.
  This resulted in processing TCP segments in the context of the wrong
  TCP connection.
  This patch changes the above procedure in a way that the inp is fully
  populated before inserted into the hash table.
  
  Thanks to Paul  for reporting the issue on the net@
  mailing list and for testing the patch!
  
  Reviewed by:  rrs@
  Sponsored by: Netflix, Inc.
  Differential Revision:https://reviews.freebsd.org/D22971

Modified:
  stable/12/sys/netinet/in_pcb.c
  stable/12/sys/netinet/in_pcb.h
  stable/12/sys/netinet/tcp_syncache.c
  stable/12/sys/netinet6/in6_pcb.c
  stable/12/sys/netinet6/in6_pcb.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/in_pcb.c
==
--- stable/12/sys/netinet/in_pcb.c  Wed Jul  1 22:00:35 2020
(r362877)
+++ stable/12/sys/netinet/in_pcb.c  Wed Jul  1 22:22:26 2020
(r362878)
@@ -1003,7 +1003,7 @@ in_pcbbind_setup(struct inpcb *inp, struct sockaddr *n
  */
 int
 in_pcbconnect_mbuf(struct inpcb *inp, struct sockaddr *nam,
-struct ucred *cred, struct mbuf *m)
+struct ucred *cred, struct mbuf *m, bool rehash)
 {
u_short lport, fport;
in_addr_t laddr, faddr;
@@ -1022,6 +1022,8 @@ in_pcbconnect_mbuf(struct inpcb *inp, struct sockaddr 
 
/* Do the initial binding of the local address if required. */
if (inp->inp_laddr.s_addr == INADDR_ANY && inp->inp_lport == 0) {
+   KASSERT(rehash == true,
+   ("Rehashing required for unbound inps"));
inp->inp_lport = lport;
inp->inp_laddr.s_addr = laddr;
if (in_pcbinshash(inp) != 0) {
@@ -1036,7 +1038,11 @@ in_pcbconnect_mbuf(struct inpcb *inp, struct sockaddr 
inp->inp_laddr.s_addr = laddr;
inp->inp_faddr.s_addr = faddr;
inp->inp_fport = fport;
-   in_pcbrehash_mbuf(inp, m);
+   if (rehash) {
+   in_pcbrehash_mbuf(inp, m);
+   } else {
+   in_pcbinshash_mbuf(inp, m);
+   }
 
if (anonport)
inp->inp_flags |= INP_ANONPORT;
@@ -1047,7 +1053,7 @@ int
 in_pcbconnect(struct inpcb *inp, struct sockaddr *nam, struct ucred *cred)
 {
 
-   return (in_pcbconnect_mbuf(inp, nam, cred, NULL));
+   return (in_pcbconnect_mbuf(inp, nam, cred, NULL, true));
 }
 
 /*
@@ -2543,7 +2549,7 @@ in_pcblookup_mbuf(struct inpcbinfo *pcbinfo, struct in
  * Insert PCB onto various hash lists.
  */
 static int
-in_pcbinshash_internal(struct inpcb *inp, int do_pcbgroup_update)
+in_pcbinshash_internal(struct inpcb *inp, struct mbuf *m)
 {
struct inpcbhead *pcbhash;
struct inpcbporthead *pcbporthash;
@@ -2609,35 +2615,27 @@ in_pcbinshash_internal(struct inpcb *inp, int do_pcbgr
CK_LIST_INSERT_HEAD(pcbhash, inp, inp_hash);
inp->inp_flags |= INP_INHASHLIST;
 #ifdef PCBGROUP
-   if (do_pcbgroup_update)
+   if (m != NULL) {
+   in_pcbgroup_update_mbuf(inp, m);
+   } else {
in_pcbgroup_update(inp);
+   }
 #endif
return (0);
 }
 
-/*
- * For now, there are two public interfaces to insert an inpcb into the hash
- * lists -- one that does update pcbgroups, and one that doesn't.  The latter
- * is used only in the TCP syncache, where in_pcbinshash is called before the
- * full 4-tuple is set for the inpcb, and we don't want to install in the
- * pcbgroup until later.
- *
- * XXXRW: This seems like a misfeature.  in_pcbinshash should always update
- * connection groups, and partially initialised inpcbs should not be exposed
- * to either reservation hash tables or pcbgroups.
- */
 int
 in_pcbinshash(struct inpcb *inp)
 {
 
-   return (in_pcbinshash_internal(inp, 1));
+   return (in_pcbinshash_internal(inp, NULL));
 }
 
 int
-in_pcbinshash_nopcbgroup(struct inpcb *inp)
+in_pcbinshash_mbuf(struct inpcb *inp, struct mbuf *m)
 {
 
-   return (in_pcbinshash_internal(inp, 0));
+   return (in_pcbinshash_internal(inp, m));
 }
 
 /*

Modified: stable/12/sys/netinet/in_pcb.h
==
--- stable/12/sys/netinet/in_pcb.h  Wed Jul  1 22:00:35 2020
(r362877)
+++ 

svn commit: r362877 - stable/12/sys/netinet

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 22:00:35 2020
New Revision: 362877
URL: https://svnweb.freebsd.org/changeset/base/362877

Log:
  MFC r356660:
  Fix division by zero issue.
  
  Thanks to Stas Denisov for reporting the issue for the userland stack
  and providing a fix.

Modified:
  stable/12/sys/netinet/sctp_cc_functions.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/sctp_cc_functions.c
==
--- stable/12/sys/netinet/sctp_cc_functions.c   Wed Jul  1 21:59:18 2020
(r362876)
+++ stable/12/sys/netinet/sctp_cc_functions.c   Wed Jul  1 22:00:35 2020
(r362877)
@@ -1876,7 +1876,7 @@ htcp_cong_time(struct htcp *ca)
 static inline uint32_t
 htcp_ccount(struct htcp *ca)
 {
-   return (htcp_cong_time(ca) / ca->minRTT);
+   return (ca->minRTT == 0 ? htcp_cong_time(ca) : htcp_cong_time(ca) / 
ca->minRTT);
 }
 
 static inline 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: r362876 - stable/12/sys/netinet

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 21:59:18 2020
New Revision: 362876
URL: https://svnweb.freebsd.org/changeset/base/362876

Log:
  MFC r356378:
  Don't mark the sendall iterator as being up if it could not be started.

Modified:
  stable/12/sys/netinet/sctp_output.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/sctp_output.c
==
--- stable/12/sys/netinet/sctp_output.c Wed Jul  1 21:57:40 2020
(r362875)
+++ stable/12/sys/netinet/sctp_output.c Wed Jul  1 21:59:18 2020
(r362876)
@@ -6932,7 +6932,7 @@ sctp_sendall(struct sctp_inpcb *inp, struct uio *uio, 
(void *)ca, 0,
sctp_sendall_completes, inp, 1);
if (ret) {
-   SCTP_PRINTF("Failed to initiate iterator for sendall\n");
+   inp->sctp_flags &= ~SCTP_PCB_FLAGS_SND_ITERATOR_UP;
SCTP_FREE(ca, SCTP_M_COPYAL);
SCTP_LTRACE_ERR_RET_PKT(m, inp, NULL, NULL, 
SCTP_FROM_SCTP_OUTPUT, EFAULT);
return (EFAULT);
___
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: r362875 - stable/12/sys/netinet

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 21:57:40 2020
New Revision: 362875
URL: https://svnweb.freebsd.org/changeset/base/362875

Log:
  MFC r356377:
  Return -1 consistently if an error occurs.

Modified:
  stable/12/sys/netinet/sctp_pcb.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/sctp_pcb.c
==
--- stable/12/sys/netinet/sctp_pcb.cWed Jul  1 21:56:20 2020
(r362874)
+++ stable/12/sys/netinet/sctp_pcb.cWed Jul  1 21:57:40 2020
(r362875)
@@ -7131,7 +7131,7 @@ sctp_initiate_iterator(inp_func inpf,
SCTP_M_ITER);
if (it == NULL) {
SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_PCB, 
ENOMEM);
-   return (ENOMEM);
+   return (-1);
}
memset(it, 0, sizeof(*it));
it->function_assoc = af;
___
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: r362874 - stable/12/sys/netinet

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 21:56:20 2020
New Revision: 362874
URL: https://svnweb.freebsd.org/changeset/base/362874

Log:
  MFC r356376:
  Ensure that we don't miss a trigger for kicking off the SCTP iterator.
  
  Reported by:  nwhitehorn

Modified:
  stable/12/sys/netinet/sctputil.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/sctputil.c
==
--- stable/12/sys/netinet/sctputil.cWed Jul  1 21:54:39 2020
(r362873)
+++ stable/12/sys/netinet/sctputil.cWed Jul  1 21:56:20 2020
(r362874)
@@ -1475,12 +1475,11 @@ no_stcb:
 void
 sctp_iterator_worker(void)
 {
-   struct sctp_iterator *it, *nit;
+   struct sctp_iterator *it;
 
/* This function is called with the WQ lock in place */
-
sctp_it_ctl.iterator_running = 1;
-   TAILQ_FOREACH_SAFE(it, _it_ctl.iteratorhead, sctp_nxt_itr, nit) {
+   while ((it = TAILQ_FIRST(_it_ctl.iteratorhead)) != NULL) {
/* now lets work on this one */
TAILQ_REMOVE(_it_ctl.iteratorhead, it, sctp_nxt_itr);
SCTP_IPI_ITERATOR_WQ_UNLOCK();
___
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: r362873 - in stable/12: share/man/man4 sys/netinet

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 21:54:39 2020
New Revision: 362873
URL: https://svnweb.freebsd.org/changeset/base/362873

Log:
  MFC r356357:
  
  Make the message size limit used for SCTP_SENDALL configurable via
  a sysctl variable instead of a compiled in constant.
  
  This is based on a patch provided by nwhitehorn.

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

Modified: stable/12/share/man/man4/sctp.4
==
--- stable/12/share/man/man4/sctp.4 Wed Jul  1 21:52:14 2020
(r362872)
+++ stable/12/share/man/man4/sctp.4 Wed Jul  1 21:54:39 2020
(r362873)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 10, 2018
+.Dd January 4, 2020
 .Dt SCTP 4
 .Os
 .Sh NAME
@@ -472,6 +472,8 @@ Enable SCTP blackholing.
 See
 .Xr blackhole 4
 for more details.
+.It Va sendall_limit
+Maximum message size (in bytes) that can be transmitted with SCTP_SENDALL 
flags set.
 .It Va buffer_splitting
 Enable send/receive buffer splitting.
 .It Va vtag_time_wait

Modified: stable/12/sys/netinet/sctp.h
==
--- stable/12/sys/netinet/sctp.hWed Jul  1 21:52:14 2020
(r362872)
+++ stable/12/sys/netinet/sctp.hWed Jul  1 21:54:39 2020
(r362873)
@@ -491,7 +491,6 @@ struct sctp_error_auth_invalid_hmac {
 * time */
 #define SCTP_SAT_NETWORK_BURST_INCR  2 /* how many times to multiply maxburst
 * in sat */
-#define SCTP_MAX_SENDALL_LIMIT 1024
 
 /* Data Chuck Specific Flags */
 #define SCTP_DATA_FRAG_MASK0x03

Modified: stable/12/sys/netinet/sctp_output.c
==
--- stable/12/sys/netinet/sctp_output.c Wed Jul  1 21:52:14 2020
(r362872)
+++ stable/12/sys/netinet/sctp_output.c Wed Jul  1 21:54:39 2020
(r362873)
@@ -6885,8 +6885,8 @@ sctp_sendall(struct sctp_inpcb *inp, struct uio *uio, 
/* There is another. */
return (EBUSY);
}
-   if (uio->uio_resid > SCTP_MAX_SENDALL_LIMIT) {
-   /* You must be less than the max! */
+   if (uio->uio_resid > SCTP_BASE_SYSCTL(sctp_sendall_limit)) {
+   /* You must not be larger than the limit! */
return (EMSGSIZE);
}
SCTP_MALLOC(ca, struct sctp_copy_all *, sizeof(struct sctp_copy_all),

Modified: stable/12/sys/netinet/sctp_sysctl.c
==
--- stable/12/sys/netinet/sctp_sysctl.c Wed Jul  1 21:52:14 2020
(r362872)
+++ stable/12/sys/netinet/sctp_sysctl.c Wed Jul  1 21:54:39 2020
(r362873)
@@ -119,6 +119,7 @@ sctp_init_sysctls()
SCTP_BASE_SYSCTL(sctp_steady_step) = SCTPCTL_RTTVAR_STEADYS_DEFAULT;
SCTP_BASE_SYSCTL(sctp_use_dccc_ecn) = SCTPCTL_RTTVAR_DCCCECN_DEFAULT;
SCTP_BASE_SYSCTL(sctp_blackhole) = SCTPCTL_BLACKHOLE_DEFAULT;
+   SCTP_BASE_SYSCTL(sctp_sendall_limit) = SCTPCTL_SENDALL_LIMIT_DEFAULT;
SCTP_BASE_SYSCTL(sctp_diag_info_code) = SCTPCTL_DIAG_INFO_CODE_DEFAULT;
 #if defined(SCTP_LOCAL_TRACE_BUF)
memset(_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log));
@@ -943,6 +944,7 @@ SCTP_UINT_SYSCTL(rttvar_eqret, sctp_rttvar_eqret, SCTP
 SCTP_UINT_SYSCTL(rttvar_steady_step, sctp_steady_step, SCTPCTL_RTTVAR_STEADYS)
 SCTP_UINT_SYSCTL(use_dcccecn, sctp_use_dccc_ecn, SCTPCTL_RTTVAR_DCCCECN)
 SCTP_UINT_SYSCTL(blackhole, sctp_blackhole, SCTPCTL_BLACKHOLE)
+SCTP_UINT_SYSCTL(sendall_limit, sctp_sendall_limit, SCTPCTL_SENDALL_LIMIT)
 SCTP_UINT_SYSCTL(diag_info_code, sctp_diag_info_code, SCTPCTL_DIAG_INFO_CODE)
 #ifdef SCTP_DEBUG
 SCTP_UINT_SYSCTL(debug, sctp_debug_on, SCTPCTL_DEBUG)

Modified: stable/12/sys/netinet/sctp_sysctl.h
==
--- stable/12/sys/netinet/sctp_sysctl.h Wed Jul  1 21:52:14 2020
(r362872)
+++ stable/12/sys/netinet/sctp_sysctl.h Wed Jul  1 21:54:39 2020
(r362873)
@@ -116,6 +116,7 @@ struct sctp_sysctl {
uint32_t sctp_buffer_splitting;
uint32_t sctp_initial_cwnd;
uint32_t sctp_blackhole;
+   uint32_t sctp_sendall_limit;
 #if defined(SCTP_DEBUG)
uint32_t sctp_debug_on;
 #endif
@@ -537,6 +538,12 @@ struct sctp_sysctl {
 #define SCTPCTL_BLACKHOLE_MIN  0
 #define SCTPCTL_BLACKHOLE_MAX  2
 #define SCTPCTL_BLACKHOLE_DEFAULT  SCTPCTL_BLACKHOLE_MIN
+
+/* sendall_limit: Maximum message with SCTP_SENDALL */
+#define SCTPCTL_SENDALL_LIMIT_DESC "Maximum size of a message send with 
SCTP_SENDALL"
+#define SCTPCTL_SENDALL_LIMIT_MIN  0
+#define SCTPCTL_SENDALL_LIMIT_MAX 

svn commit: r362872 - stable/12/sys/netinet

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 21:52:14 2020
New Revision: 362872
URL: https://svnweb.freebsd.org/changeset/base/362872

Log:
  MFC r356270:
  Improve input validation of the spp_pathmtu field in the
  SCTP_PEER_ADDR_PARAMS socket option. The code in the stack assumes
  sane values for the MTU.
  
  This issue was found by running an instance of syzkaller.
  
  MFC r356271:
  Remove empty line which was added in previous commit by accident.

Modified:
  stable/12/sys/netinet/sctp.h
  stable/12/sys/netinet/sctp_usrreq.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/sctp.h
==
--- stable/12/sys/netinet/sctp.hWed Jul  1 21:48:17 2020
(r362871)
+++ stable/12/sys/netinet/sctp.hWed Jul  1 21:52:14 2020
(r362872)
@@ -585,8 +585,10 @@ struct sctp_error_auth_invalid_hmac {
 #define SCTP_MOBILITY_PRIM_DELETED   0x0004
 
 
-#define SCTP_SMALLEST_PMTU 512 /* smallest pmtu allowed when disabling PMTU
-* discovery */
+/* Smallest PMTU allowed when disabling PMTU discovery */
+#define SCTP_SMALLEST_PMTU 512
+/* Largest PMTU allowed when disabling PMTU discovery */
+#define SCTP_LARGEST_PMTU  65536
 
 #undef SCTP_PACKED
 

Modified: stable/12/sys/netinet/sctp_usrreq.c
==
--- stable/12/sys/netinet/sctp_usrreq.c Wed Jul  1 21:48:17 2020
(r362871)
+++ stable/12/sys/netinet/sctp_usrreq.c Wed Jul  1 21:52:14 2020
(r362872)
@@ -5363,6 +5363,14 @@ sctp_setopt(struct socket *so, int optname, void *optv
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, 
SCTP_FROM_SCTP_USRREQ, EINVAL);
return (EINVAL);
}
+   if ((paddrp->spp_flags & SPP_PMTUD_DISABLE) &&
+   ((paddrp->spp_pathmtu < SCTP_SMALLEST_PMTU) ||
+   (paddrp->spp_pathmtu > SCTP_LARGEST_PMTU))) {
+   if (stcb)
+   SCTP_TCB_UNLOCK(stcb);
+   SCTP_LTRACE_ERR_RET(inp, NULL, NULL, 
SCTP_FROM_SCTP_USRREQ, EINVAL);
+   return (EINVAL);
+   }
 
if (stcb != NULL) {
/TCB SPECIFIC SET 
**/
@@ -5394,7 +5402,7 @@ sctp_setopt(struct socket *so, int optname, void *optv

sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net);
}
}
-   if ((paddrp->spp_flags & 
SPP_PMTUD_DISABLE) && (paddrp->spp_pathmtu >= SCTP_SMALLEST_PMTU)) {
+   if (paddrp->spp_flags & 
SPP_PMTUD_DISABLE) {
if 
(SCTP_OS_TIMER_PENDING(>pmtu_timer.timer)) {

sctp_timer_stop(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net,

SCTP_FROM_SCTP_USRREQ + SCTP_LOC_11);
@@ -5536,7 +5544,7 @@ sctp_setopt(struct socket *so, int optname, void *optv
}
sctp_stcb_feature_on(inp, stcb, 
SCTP_PCB_FLAGS_DONOT_HEARTBEAT);
}
-   if ((paddrp->spp_flags & 
SPP_PMTUD_DISABLE) && (paddrp->spp_pathmtu >= SCTP_SMALLEST_PMTU)) {
+   if (paddrp->spp_flags & 
SPP_PMTUD_DISABLE) {
TAILQ_FOREACH(net, 
>asoc.nets, sctp_next) {
if 
(SCTP_OS_TIMER_PENDING(>pmtu_timer.timer)) {

sctp_timer_stop(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net,
@@ -5635,9 +5643,7 @@ sctp_setopt(struct socket *so, int optname, void *optv
inp->sctp_ep.default_mtu = 0;
sctp_feature_off(inp, 
SCTP_PCB_FLAGS_DO_NOT_PMTUD);
} else if (paddrp->spp_flags & 
SPP_PMTUD_DISABLE) {
-   if (paddrp->spp_pathmtu >= 
SCTP_SMALLEST_PMTU) {
-   
inp->sctp_ep.default_mtu = paddrp->spp_pathmtu;
-   }
+   inp->sctp_ep.default_mtu = 
paddrp->spp_pathmtu;
sctp_feature_on(inp, 
SCTP_PCB_FLAGS_DO_NOT_PMTUD);
}

svn commit: r362871 - stable/12/sys/netinet

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 21:48:17 2020
New Revision: 362871
URL: https://svnweb.freebsd.org/changeset/base/362871

Log:
  MFC r355272:
  Make the TF_* flags easier readable by humans by adding leading zeroes
  to make them aligned.
  
  Submitted by: rscheff
  Reviewed by:  rgrimes, rrs, tuexen
  Differential Revision:https://reviews.freebsd.org/D22428

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

Modified: stable/12/sys/netinet/tcp_var.h
==
--- stable/12/sys/netinet/tcp_var.h Wed Jul  1 21:42:52 2020
(r362870)
+++ stable/12/sys/netinet/tcp_var.h Wed Jul  1 21:48:17 2020
(r362871)
@@ -306,32 +306,32 @@ TAILQ_HEAD(tcp_funchead, tcp_function);
 /*
  * Flags and utility macros for the t_flags field.
  */
-#defineTF_ACKNOW   0x01/* ack peer immediately */
-#defineTF_DELACK   0x02/* ack, but try to delay it */
-#defineTF_NODELAY  0x04/* don't delay packets to 
coalesce */
-#defineTF_NOOPT0x08/* don't use tcp options */
-#defineTF_SENTFIN  0x10/* have sent FIN */
-#defineTF_REQ_SCALE0x20/* have/will request window 
scaling */
-#defineTF_RCVD_SCALE   0x40/* other side has requested 
scaling */
-#defineTF_REQ_TSTMP0x80/* have/will request timestamps 
*/
-#defineTF_RCVD_TSTMP   0x000100/* a timestamp was received in 
SYN */
-#defineTF_SACK_PERMIT  0x000200/* other side said I could SACK 
*/
-#defineTF_NEEDSYN  0x000400/* send SYN (implicit state) */
-#defineTF_NEEDFIN  0x000800/* send FIN (implicit state) */
-#defineTF_NOPUSH   0x001000/* don't push */
-#defineTF_PREVVALID0x002000/* saved values for bad rxmit 
valid */
-#defineTF_MORETOCOME   0x01/* More data to be appended to 
sock */
-#defineTF_LQ_OVERFLOW  0x02/* listen queue overflow */
-#defineTF_LASTIDLE 0x04/* connection was previously 
idle */
-#defineTF_RXWIN0SENT   0x08/* sent a receiver win 0 in 
response */
-#defineTF_FASTRECOVERY 0x10/* in NewReno Fast Recovery */
-#defineTF_WASFRECOVERY 0x20/* was in NewReno Fast Recovery 
*/
-#defineTF_SIGNATURE0x40/* require MD5 digests 
(RFC2385) */
-#defineTF_FORCEDATA0x80/* force out a byte */
-#defineTF_TSO  0x100   /* TSO enabled on this 
connection */
-#defineTF_TOE  0x200   /* this connection is offloaded 
*/
-#defineTF_ECN_PERMIT   0x400   /* connection ECN-ready */
-#defineTF_ECN_SND_CWR  0x800   /* ECN CWR in queue */
+#defineTF_ACKNOW   0x0001  /* ack peer immediately */
+#defineTF_DELACK   0x0002  /* ack, but try to delay it */
+#defineTF_NODELAY  0x0004  /* don't delay packets to 
coalesce */
+#defineTF_NOOPT0x0008  /* don't use tcp options */
+#defineTF_SENTFIN  0x0010  /* have sent FIN */
+#defineTF_REQ_SCALE0x0020  /* have/will request window 
scaling */
+#defineTF_RCVD_SCALE   0x0040  /* other side has requested 
scaling */
+#defineTF_REQ_TSTMP0x0080  /* have/will request timestamps 
*/
+#defineTF_RCVD_TSTMP   0x0100  /* a timestamp was received in 
SYN */
+#defineTF_SACK_PERMIT  0x0200  /* other side said I could SACK 
*/
+#defineTF_NEEDSYN  0x0400  /* send SYN (implicit state) */
+#defineTF_NEEDFIN  0x0800  /* send FIN (implicit state) */
+#defineTF_NOPUSH   0x1000  /* don't push */
+#defineTF_PREVVALID0x2000  /* saved values for bad rxmit 
valid */
+#defineTF_MORETOCOME   0x0001  /* More data to be appended to 
sock */
+#defineTF_LQ_OVERFLOW  0x0002  /* listen queue overflow */
+#defineTF_LASTIDLE 0x0004  /* connection was previously 
idle */
+#defineTF_RXWIN0SENT   0x0008  /* sent a receiver win 0 in 
response */
+#defineTF_FASTRECOVERY 0x0010  /* in NewReno Fast Recovery */
+#defineTF_WASFRECOVERY 0x0020  /* was in NewReno Fast Recovery 
*/
+#defineTF_SIGNATURE0x0040  /* require MD5 digests 
(RFC2385) */
+#defineTF_FORCEDATA0x0080  /* force out a byte */
+#defineTF_TSO  0x0100  /* TSO enabled on this 
connection */
+#defineTF_TOE  0x0200  /* this connection is offloaded 
*/
+#defineTF_ECN_PERMIT   0x0400  

svn commit: r362870 - stable/12/sys/netinet

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 21:42:52 2020
New Revision: 362870
URL: https://svnweb.freebsd.org/changeset/base/362870

Log:
  MFC r356227:
  Add flags for upcoming patches related to improved ECN handling.
  No functional change.
  
  Submitted by: rscheff
  Reviewed by:  rgrimes, tuexen
  Differential Revision:https://reviews.freebsd.org/D22429

Modified:
  stable/12/sys/netinet/tcp.h
  stable/12/sys/netinet/tcp_syncache.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/tcp.h
==
--- stable/12/sys/netinet/tcp.h Wed Jul  1 21:40:27 2020(r362869)
+++ stable/12/sys/netinet/tcp.h Wed Jul  1 21:42:52 2020(r362870)
@@ -71,8 +71,9 @@ struct tcphdr {
 #defineTH_URG  0x20
 #defineTH_ECE  0x40
 #defineTH_CWR  0x80
+#defineTH_AE   0x100   /* maps into th_x2 */
 #defineTH_FLAGS
(TH_FIN|TH_SYN|TH_RST|TH_PUSH|TH_ACK|TH_URG|TH_ECE|TH_CWR)
-#definePRINT_TH_FLAGS  "\20\1FIN\2SYN\3RST\4PUSH\5ACK\6URG\7ECE\10CWR"
+#definePRINT_TH_FLAGS  
"\20\1FIN\2SYN\3RST\4PUSH\5ACK\6URG\7ECE\10CWR\11AE"
 
u_short th_win; /* window */
u_short th_sum; /* checksum */

Modified: stable/12/sys/netinet/tcp_syncache.h
==
--- stable/12/sys/netinet/tcp_syncache.hWed Jul  1 21:40:27 2020
(r362869)
+++ stable/12/sys/netinet/tcp_syncache.hWed Jul  1 21:42:52 2020
(r362870)
@@ -90,6 +90,10 @@ struct syncache {
 #define SCF_SIGNATURE  0x20/* send MD5 digests */
 #define SCF_SACK   0x80/* send SACK option */
 #define SCF_ECN0x100   /* send ECN setup 
packet */
+#define SCF_ACE_N  0x200   /* send ACE non-ECT setup */
+#define SCF_ACE_0  0x400   /* send ACE ECT0 setup */
+#define SCF_ACE_1  0x800   /* send ACE ECT1 setup */
+#define SCF_ACE_CE 0x1000  /* send ACE CE setup */
 
 struct syncache_head {
struct mtx  sch_mtx;
___
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: r362869 - stable/12/sys/netinet

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 21:40:27 2020
New Revision: 362869
URL: https://svnweb.freebsd.org/changeset/base/362869

Log:
  MFC r356226:
  Clear the flag indicating that the last received packet was marked CE also
  in the case where a packet not marked was received.
  
  Submitted by: rscheff
  Reviewed by:  rgrimes, tuexen
  Differential Revision:https://reviews.freebsd.org/D19143

Modified:
  stable/12/sys/netinet/tcp_input.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/tcp_input.c
==
--- stable/12/sys/netinet/tcp_input.c   Wed Jul  1 21:37:32 2020
(r362868)
+++ stable/12/sys/netinet/tcp_input.c   Wed Jul  1 21:40:27 2020
(r362869)
@@ -500,14 +500,15 @@ cc_ecnpkt_handler(struct tcpcb *tp, struct tcphdr *th,
if (CC_ALGO(tp)->ecnpkt_handler != NULL) {
switch (iptos & IPTOS_ECN_MASK) {
case IPTOS_ECN_CE:
-   tp->ccv->flags |= CCF_IPHDR_CE;
-   break;
+   tp->ccv->flags |= CCF_IPHDR_CE;
+   break;
case IPTOS_ECN_ECT0:
-   tp->ccv->flags &= ~CCF_IPHDR_CE;
-   break;
+   /* FALLTHROUGH */
case IPTOS_ECN_ECT1:
-   tp->ccv->flags &= ~CCF_IPHDR_CE;
-   break;
+   /* FALLTHROUGH */
+   case IPTOS_ECN_NOTECT:
+   tp->ccv->flags &= ~CCF_IPHDR_CE;
+   break;
}
 
if (th->th_flags & TH_CWR)
___
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: r362868 - stable/12/sys/netinet

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 21:37:32 2020
New Revision: 362868
URL: https://svnweb.freebsd.org/changeset/base/362868

Log:
  MFC r355931:
  Improve input validation for some parameters having a too small
  reported length.
  
  Thanks to Natalie Silvanovich from Google for finding one of these
  issues in the SCTP userland stack and reporting it.

Modified:
  stable/12/sys/netinet/sctp_auth.c
  stable/12/sys/netinet/sctp_pcb.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/sctp_auth.c
==
--- stable/12/sys/netinet/sctp_auth.c   Wed Jul  1 21:27:33 2020
(r362867)
+++ stable/12/sys/netinet/sctp_auth.c   Wed Jul  1 21:37:32 2020
(r362868)
@@ -1397,7 +1397,8 @@ sctp_auth_get_cookie_params(struct sctp_tcb *stcb, str
ptype = ntohs(phdr->param_type);
plen = ntohs(phdr->param_length);
 
-   if ((plen == 0) || (offset + plen > length))
+   if ((plen < sizeof(struct sctp_paramhdr)) ||
+   (offset + plen > length))
break;
 
if (ptype == SCTP_RANDOM) {

Modified: stable/12/sys/netinet/sctp_pcb.c
==
--- stable/12/sys/netinet/sctp_pcb.cWed Jul  1 21:27:33 2020
(r362867)
+++ stable/12/sys/netinet/sctp_pcb.cWed Jul  1 21:37:32 2020
(r362868)
@@ -6202,7 +6202,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, s
if (offset + plen > limit) {
break;
}
-   if (plen == 0) {
+   if (plen < sizeof(struct sctp_paramhdr)) {
break;
}
 #ifdef INET
@@ -6427,6 +6427,9 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, s
}
if (plen > sizeof(lstore)) {
return (-23);
+   }
+   if (plen < sizeof(struct sctp_asconf_addrv4_param)) {
+   return (-101);
}
phdr = sctp_get_next_param(m, offset,
(struct sctp_paramhdr *),
___
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: r362809 - head/contrib/mandoc

2020-07-01 Thread Gordon Bergling
On Wed, Jul 01, 2020 at 11:58:05AM -0600, Warner Losh wrote:
> On Wed, Jul 1, 2020 at 8:51 AM Rodney W. Grimes 
> wrote:
> 
> > > On Tue, Jun 30, 2020 at 03:56:17PM -0700, Rodney W. Grimes wrote:
> > > > [ Charset UTF-8 unsupported, converting... ]
> > > > > Author: gbe (doc committer)
> > > > > Date: Tue Jun 30 18:08:59 2020
> > > > > New Revision: 362809
> > > > > URL: https://svnweb.freebsd.org/changeset/base/362809
> > > > >
> > > > > Log:
> > > > >   Mention FreeBSD in the HISTORY sections of apropos(1) and
> > makewhatis(8).
> > > > >
> > > > >   PR: 223520, 223521
> > > > >   Reviewed by:bcr (mentor)
> > > > >   Approved by:bcr (mentor)
> > > > >   Differential Revision:  https://reviews.freebsd.org/D25521
> > > > >
> > > > > Modified:
> > > > >   head/contrib/mandoc/apropos.1
> > > > >   head/contrib/mandoc/makewhatis.8
> > > > >
> > > > > Modified: head/contrib/mandoc/apropos.1
> > > > >
> > ==
> > > > > --- head/contrib/mandoc/apropos.1 Tue Jun 30 17:21:28 2020
> > (r362808)
> > > > > +++ head/contrib/mandoc/apropos.1 Tue Jun 30 18:08:59 2020
> > (r362809)
> > > > > @@ -15,7 +15,7 @@
> > > > >  .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
> > ARISING OUT OF
> > > > >  .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> > > > >  .\"
> > > > > -.Dd $Mdocdate: November 22 2018 $
> > > > > +.Dd $Mdocdate: June 30 2020 $
> > > > >  .Dt APROPOS 1
> > > > >  .Os
> > > > >  .Sh NAME
> > > > > @@ -493,6 +493,12 @@ The options
> > > > >  .Fl acfhIKklOTWw
> > > > >  appeared in
> > > > >  .Ox 5.7 .
> > > > > +.Pp
> > > > > +The
> > > > > +.Nm
> > > > > +utility was integrated into
> > > > > +.Fx 11.1
> > > > > +as part of the switch to mandoc.
> > > >
> > > > Huh?  FreeBSD has had apropos since 1.0 and my 5.4 system clearly has
> > it:
> > > > freebsd {110}% uname -a
> > > > FreeBSD pdx.rh.CN85.dnsmgr.net 5.4-RELEASE-p8 FreeBSD 5.4-RELEASE-p8
> > #1: Mon Jul  1 17:58:50 PDT 2019 
> > r...@pdx.rh.cn85.dnsmgr.net:/usr/src/sys/i386/compile/PDXMXPIE
> > i386
> > > > pdx.rh.CN85.dnsmgr.net:freebsd {111}% which apropos
> > > > /usr/bin/apropos
> > > >
> > > > And a man page for it too:
> > > > APROPOS(1)  FreeBSD General Commands Manual
> >  APROPOS(1)
> > > >
> > > > NAME
> > > >  apropos, whatis -- search the whatis database
> > > >
> > > > SYNOPSIS
> > > >  apropos keyword ...
> > > >  whatis keyword ...
> > > >
> > > > DESCRIPTION
> > > >  apropos searches a set of database files containing short
> > descriptions of
> > > >  system commands for keywords and displays the result on the
> > standard out-
> > > >  put.  whatis displays only complete word matches.
> > > >
> > > >  keyword really is an extended regular expression, please read
> > grep(1)
> > > >  manual page for more information about its format.
> > > >
> > > > DIAGNOSTICS
> > > >  The apropos utility exits 0 on success, and 1 if no keyword
> > matched.
> > > >
> > > > SEE ALSO
> > > >  grep(1), makewhatis(1), man(1)
> > > >
> > > > FreeBSD 5.4January 15, 1991
> > FreeBSD 5.4
> > > >
> > > > >  .Sh AUTHORS
> > > > >  .An -nosplit
> > > > >  .An Bill Joy
> > > > >
> > >
> > > That is true, but the version of 'apropos' we have currently in base is
> > based on mandoc,
> > > which was imported around September 2018. Due to the nature of
> > contributed code I
> > > thought it would be best to document only the history when it was
> > integrated into
> > > FreeSBD. The same applies for 'makewhatis'.
> >
> > That is not what has been done in other places when code is
> > changed/replaced,
> > the HISTORY section is not specific to "FreeBSD's version" of this
> > function.
> >
> > We often have "An ls command appeared in Version 1 AT UNIX."  Our source
> > code and man page is not from that, but that is the history of ls.
> >
> > This *could* be amended and *should* be amended to reflect that apropos,
> > and makewhatis got *updated* by a switch to the mandoc versions, but it
> > is misleading to say it was intergrated with the switch to mandoc as that
> > implies it did not exist before this action.
> >
> 
> I tend to agree with Rod here. These appeared in X the first time, but
> noting they were replaced in version X with Y is the best way to address
> the current provenance of the code...
> 
> Warner

OK, I see your arguments. How about the following addition for HISTORY section,

The apropos utility was integrated into FreeBSD 11.1 as part of the
switch to mandoc. Before the switch to mandoc apropos was available since
FreeBSD 1.0.

Any suggestions on how to describe the history more precise are very welcome.

--Gordon

> > > > > Modified: head/contrib/mandoc/makewhatis.8
> > > > >
> > ==
> > > > > --- head/contrib/mandoc/makewhatis.8  Tue Jun 30 17:21:28 2020
> >   

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

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 20:45:26 2020
New Revision: 362864
URL: https://svnweb.freebsd.org/changeset/base/362864

Log:
  MFC r355268:
  Add a description for the TCP sysctl variable rfc6675_pipe.
  It was introduced by r290122, but no documentation was provided.
  This is taken from https://reviews.freebsd.org/D21798, since it
  is not related to the feature added there.
  
  Submitted by: rscheff

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

Modified: stable/12/share/man/man4/tcp.4
==
--- stable/12/share/man/man4/tcp.4  Wed Jul  1 20:41:23 2020
(r362863)
+++ stable/12/share/man/man4/tcp.4  Wed Jul  1 20:45:26 2020
(r362864)
@@ -34,7 +34,7 @@
 .\" From: @(#)tcp.48.1 (Berkeley) 6/5/93
 .\" $FreeBSD$
 .\"
-.Dd July 23, 2019
+.Dd December 1, 2019
 .Dt TCP 4
 .Os
 .Sh NAME
@@ -493,6 +493,9 @@ The value should be relative to the link capacity.
 Start with small values for lower-capacity links.
 Large bursts can cause buffer overruns and packet drops if routers have small
 buffers or the link is experiencing congestion.
+.It Va rfc6675_pipe
+Calculate the bytes in flight using the algorithm described in RFC 6675, and
+is also a prerequisite to enable Proportional Rate Reduction.
 .It Va rfc3042
 Enable the Limited Transmit algorithm as described in RFC 3042.
 It helps avoid timeouts on lossy links and also when the congestion window
___
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: r362863 - in stable/12/sys: dev/cxgbe/tom netinet

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 20:41:23 2020
New Revision: 362863
URL: https://svnweb.freebsd.org/changeset/base/362863

Log:
  MFC r355266:
  In order for the TCP Handshake to support ECN++, and further ECN-related
  improvements, the ECN bits need to be exposed to the TCP SYNcache.
  This change is a minimal modification to the function headers, without any
  functional change intended.
  
  Submitted by: rscheff
  Reviewed by:  rgrimes, rrs, tuexen
  Differential Revision:https://reviews.freebsd.org/D22436

Modified:
  stable/12/sys/dev/cxgbe/tom/t4_listen.c
  stable/12/sys/netinet/tcp_input.c
  stable/12/sys/netinet/tcp_syncache.c
  stable/12/sys/netinet/tcp_syncache.h
  stable/12/sys/netinet/toecore.c
  stable/12/sys/netinet/toecore.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/cxgbe/tom/t4_listen.c
==
--- stable/12/sys/dev/cxgbe/tom/t4_listen.c Wed Jul  1 20:38:56 2020
(r362862)
+++ stable/12/sys/dev/cxgbe/tom/t4_listen.c Wed Jul  1 20:41:23 2020
(r362863)
@@ -986,7 +986,7 @@ t4opt_to_tcpopt(const struct tcp_options *t4opt, struc
 
 static void
 pass_accept_req_to_protohdrs(struct adapter *sc, const struct mbuf *m,
-struct in_conninfo *inc, struct tcphdr *th)
+struct in_conninfo *inc, struct tcphdr *th, uint8_t *iptos)
 {
const struct cpl_pass_accept_req *cpl = mtod(m, const void *);
const struct ether_header *eh;
@@ -1003,6 +1003,21 @@ pass_accept_req_to_protohdrs(struct adapter *sc, const
tcp = (const void *)(l3hdr + G_IP_HDR_LEN(hlen));
}
 
+   /* extract TOS (DiffServ + ECN) byte for AccECN */
+   if (iptos) {
+   if (((struct ip *)l3hdr)->ip_v == IPVERSION) {
+   const struct ip *ip = (const void *)l3hdr;
+   *iptos = ip->ip_tos;
+   }
+#ifdef INET6
+   else
+   if (((struct ip *)l3hdr)->ip_v == (IPV6_VERSION >> 4)) {
+   const struct ip6_hdr *ip6 = (const void *)l3hdr;
+   *iptos = (ntohl(ip6->ip6_flow) >> 20) & 0xff;
+   }
+#endif /* INET */
+   }
+
if (inc) {
bzero(inc, sizeof(*inc));
inc->inc_fport = tcp->th_sport;
@@ -1148,6 +1163,7 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss
unsigned int opcode = G_CPL_OPCODE(be32toh(OPCODE_TID(cpl)));
 #endif
struct offload_settings settings;
+   uint8_t iptos;
 
KASSERT(opcode == CPL_PASS_ACCEPT_REQ,
("%s: unexpected opcode 0x%x", __func__, opcode));
@@ -1206,7 +1222,7 @@ found:
if (lctx->vnet != ifp->if_vnet)
REJECT_PASS_ACCEPT_REQ(true);
 
-   pass_accept_req_to_protohdrs(sc, m, , );
+   pass_accept_req_to_protohdrs(sc, m, , , );
if (inc.inc_flags & INC_ISIPV6) {
 
/* Don't offload if the ifcap isn't enabled */
@@ -1282,7 +1298,7 @@ found:
 * syncache_add.  Note that syncache_add releases the pcb lock.
 */
t4opt_to_tcpopt(>tcpopt, );
-   toe_syncache_add(, , , inp, tod, synqe);
+   toe_syncache_add(, , , inp, tod, synqe, iptos);
 
if (atomic_load_int(>ok_to_respond) > 0) {
uint64_t opt0;
@@ -1348,9 +1364,10 @@ synqe_to_protohdrs(struct adapter *sc, struct synq_ent
 struct tcphdr *th, struct tcpopt *to)
 {
uint16_t tcp_opt = be16toh(cpl->tcp_opt);
+   uint8_t iptos;
 
/* start off with the original SYN */
-   pass_accept_req_to_protohdrs(sc, synqe->syn, inc, th);
+   pass_accept_req_to_protohdrs(sc, synqe->syn, inc, th, );
 
/* modify parts to make it look like the ACK to our SYN|ACK */
th->th_flags = TH_ACK;

Modified: stable/12/sys/netinet/tcp_input.c
==
--- stable/12/sys/netinet/tcp_input.c   Wed Jul  1 20:38:56 2020
(r362862)
+++ stable/12/sys/netinet/tcp_input.c   Wed Jul  1 20:41:23 2020
(r362863)
@@ -1361,7 +1361,7 @@ tfo_socket_result:
 #endif
TCP_PROBE3(debug__input, tp, th, m);
tcp_dooptions(, optp, optlen, TO_SYN);
-   if (syncache_add(, , th, inp, , m, NULL, NULL))
+   if (syncache_add(, , th, inp, , m, NULL, NULL, iptos))
goto tfo_socket_result;
 
/*

Modified: stable/12/sys/netinet/tcp_syncache.c
==
--- stable/12/sys/netinet/tcp_syncache.cWed Jul  1 20:38:56 2020
(r362862)
+++ stable/12/sys/netinet/tcp_syncache.cWed Jul  1 20:41:23 2020
(r362863)
@@ -1306,7 +1306,7 @@ syncache_tfo_expand(struct syncache *sc, struct socket
 int
 syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
 struct inpcb *inp, struct socket 

svn commit: r362862 - stable/12/sys/netinet

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 20:38:56 2020
New Revision: 362862
URL: https://svnweb.freebsd.org/changeset/base/362862

Log:
  MFC r355265:
  When changing the MTU of an SCTP path, not only cancel all ongoing
  RTT measurements, but also scheldule new ones for the future.
  
  Submitted by: Julius Flohr
  Differential Revision:https://reviews.freebsd.org/D22547

Modified:
  stable/12/sys/netinet/sctp_usrreq.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/sctp_usrreq.c
==
--- stable/12/sys/netinet/sctp_usrreq.c Wed Jul  1 20:37:06 2020
(r362861)
+++ stable/12/sys/netinet/sctp_usrreq.c Wed Jul  1 20:38:56 2020
(r362862)
@@ -143,7 +143,10 @@ sctp_pathmtu_adjustment(struct sctp_tcb *stcb, uint16_
chk->rec.data.tsn);
}
/* Clear any time so NO RTT is being done */
-   chk->do_rtt = 0;
+   if (chk->do_rtt == 1) {
+   chk->do_rtt = 0;
+   chk->whoTo->rto_needed = 1;
+   }
}
}
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r362861 - stable/12/sys/netinet6

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 20:37:06 2020
New Revision: 362861
URL: https://svnweb.freebsd.org/changeset/base/362861

Log:
  MFC r355264:
  Update the hostcache also for PTB messages received for SCTP/IPv6.
  The corresponding code for SCTP/IPv4 was introduced in
  https://svnweb.freebsd.org/base?view=revision=317597
  
  Submitted by: Julius Flohr
  Differential Revision:https://reviews.freebsd.org/D22605

Modified:
  stable/12/sys/netinet6/sctp6_usrreq.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet6/sctp6_usrreq.c
==
--- stable/12/sys/netinet6/sctp6_usrreq.c   Wed Jul  1 20:32:51 2020
(r362860)
+++ stable/12/sys/netinet6/sctp6_usrreq.c   Wed Jul  1 20:37:06 2020
(r362861)
@@ -242,6 +242,11 @@ sctp6_notify(struct sctp_inpcb *inp,
}
if (net->mtu > next_mtu) {
net->mtu = next_mtu;
+   if (net->port) {
+   sctp_hc_set_mtu(>ro._l_addr, inp->fibnum, 
next_mtu + sizeof(struct udphdr));
+   } else {
+   sctp_hc_set_mtu(>ro._l_addr, inp->fibnum, 
next_mtu);
+   }
}
/* Update the association MTU */
if (stcb->asoc.smallest_mtu > next_mtu) {
___
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: r362860 - stable/12/sys/netinet

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 20:32:51 2020
New Revision: 362860
URL: https://svnweb.freebsd.org/changeset/base/362860

Log:
  MFC r355172:
  Really ignore the SCTP association identifier on 1-to-1 style sockets
  as requiresd by the socket API specification.
  Thanks to Inaki Baz Castillo, who found this bug running the userland
  stack with valgrind and reported the issue in
  https://github.com/sctplab/usrsctp/issues/408

Modified:
  stable/12/sys/netinet/sctp_usrreq.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/sctp_usrreq.c
==
--- stable/12/sys/netinet/sctp_usrreq.c Wed Jul  1 20:26:35 2020
(r362859)
+++ stable/12/sys/netinet/sctp_usrreq.c Wed Jul  1 20:32:51 2020
(r362860)
@@ -1675,7 +1675,8 @@ flags_out:
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
(inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
-   (av->assoc_id == SCTP_FUTURE_ASSOC)) {
+   ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) 
&&
+   (av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
if (inp->idata_supported) {
av->assoc_value = 1;
@@ -1705,7 +1706,8 @@ flags_out:
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
(inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
-   (av->assoc_id == SCTP_FUTURE_ASSOC)) {
+   ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) 
&&
+   (av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
av->assoc_value = inp->sctp_cmt_on_off;
SCTP_INP_RUNLOCK(inp);
@@ -1731,7 +1733,8 @@ flags_out:
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
(inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
-   (av->assoc_id == SCTP_FUTURE_ASSOC)) {
+   ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) 
&&
+   (av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
av->assoc_value = 
inp->sctp_ep.sctp_default_cc_module;
SCTP_INP_RUNLOCK(inp);
@@ -1776,7 +1779,8 @@ flags_out:
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
(inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
-   (av->assoc_id == SCTP_FUTURE_ASSOC)) {
+   ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) 
&&
+   (av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
av->assoc_value = 
inp->sctp_ep.sctp_default_ss_module;
SCTP_INP_RUNLOCK(inp);
@@ -1914,7 +1918,8 @@ flags_out:
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
(inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
-   (av->assoc_id == SCTP_FUTURE_ASSOC)) {
+   ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) 
&&
+   (av->assoc_id == SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
av->assoc_value = inp->sctp_context;
SCTP_INP_RUNLOCK(inp);
@@ -1990,7 +1995,8 @@ flags_out:
} else {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) 
||
(inp->sctp_flags & 
SCTP_PCB_FLAGS_IN_TCPPOOL) ||
-   (sack->sack_assoc_id == SCTP_FUTURE_ASSOC)) 
{
+   ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) 
&&
+   (sack->sack_assoc_id == 
SCTP_FUTURE_ASSOC))) {
SCTP_INP_RLOCK(inp);
sack->sack_delay = 
TICKS_TO_MSEC(inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_RECV]);
sack->sack_freq = 
inp->sctp_ep.sctp_sack_freq;
@@ -2037,7 +2043,8 @@ 

svn commit: r362859 - stable/12/sys/netinet

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 20:26:35 2020
New Revision: 362859
URL: https://svnweb.freebsd.org/changeset/base/362859

Log:
  MFC r355135: Plug two mbuf leaks during INIT-ACK handling.
  One leak happens when there is not enough memory to allocate the
  the resources for streams. The other leak happens if the are
  unknown parameters in the received INIT-ACK chunk which require
  reporting and the INIT-ACK requires sending an ABORT due to illegal
  parameter combinations.
  Hopefully this fixes
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19083

Modified:
  stable/12/sys/netinet/sctp_input.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/sctp_input.c
==
--- stable/12/sys/netinet/sctp_input.c  Wed Jul  1 20:09:34 2020
(r362858)
+++ stable/12/sys/netinet/sctp_input.c  Wed Jul  1 20:26:35 2020
(r362859)
@@ -495,6 +495,9 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int 
/* process the peer's parameters in the INIT-ACK */
retval = sctp_process_init((struct sctp_init_chunk *)cp, stcb);
if (retval < 0) {
+   if (op_err != NULL) {
+   sctp_m_freem(op_err);
+   }
return (retval);
}
initack_limit = offset + ntohs(cp->ch.chunk_length);
@@ -502,6 +505,9 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int 
if ((retval = sctp_load_addresses_from_init(stcb, m,
(offset + sizeof(struct sctp_init_chunk)), initack_limit,
src, dst, NULL, stcb->asoc.port))) {
+   if (op_err != NULL) {
+   sctp_m_freem(op_err);
+   }
op_err = 
sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code),
"Problem with address parameters");
SCTPDBG(SCTP_DEBUG_INPUT1,
___
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: r362858 - stable/12/sys/netinet/cc

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 20:09:34 2020
New Revision: 362858
URL: https://svnweb.freebsd.org/changeset/base/362858

Log:
  MFC r354774:
  Add boundary and overflow checks to the formulas used in the TCP CUBIC
  congestion control module.
  
  Submitted by: rscheff
  Reviewed by:  rgrimes
  Differential Revision:https://reviews.freebsd.org/D19118

Modified:
  stable/12/sys/netinet/cc/cc_cubic.c
  stable/12/sys/netinet/cc/cc_cubic.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/cc/cc_cubic.c
==
--- stable/12/sys/netinet/cc/cc_cubic.c Wed Jul  1 19:50:03 2020
(r362857)
+++ stable/12/sys/netinet/cc/cc_cubic.c Wed Jul  1 20:09:34 2020
(r362858)
@@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -144,7 +145,14 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type)
cubic_data->flags |= CUBICFLAG_IN_SLOWSTART;
newreno_cc_algo.ack_received(ccv, type);
} else {
-   ticks_since_cong = ticks - cubic_data->t_last_cong;
+   if ((ticks_since_cong =
+   ticks - cubic_data->t_last_cong) < 0) {
+   /*
+* dragging t_last_cong along
+*/
+   ticks_since_cong = INT_MAX;
+   cubic_data->t_last_cong = ticks - INT_MAX;
+   }
 
if (cubic_data->flags & (CUBICFLAG_IN_SLOWSTART |
 CUBICFLAG_IN_APPLIMIT)) {
@@ -170,12 +178,14 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type)
 
ccv->flags &= ~CCF_ABC_SENTAWND;
 
-   if (w_cubic_next < w_tf)
+   if (w_cubic_next < w_tf) {
/*
 * TCP-friendly region, follow tf
 * cwnd growth.
 */
-   CCV(ccv, snd_cwnd) = w_tf;
+   if (CCV(ccv, snd_cwnd) < w_tf)
+   CCV(ccv, snd_cwnd) = ulmin(w_tf, 
INT_MAX);
+   }
 
else if (CCV(ccv, snd_cwnd) < w_cubic_next) {
/*
@@ -183,12 +193,14 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type)
 * cwnd growth.
 */
if (V_tcp_do_rfc3465)
-   CCV(ccv, snd_cwnd) = w_cubic_next;
+   CCV(ccv, snd_cwnd) = ulmin(w_cubic_next,
+   INT_MAX);
else
-   CCV(ccv, snd_cwnd) += ((w_cubic_next -
+   CCV(ccv, snd_cwnd) += ulmax(1,
+   ((ulmin(w_cubic_next, INT_MAX) -
CCV(ccv, snd_cwnd)) *
CCV(ccv, t_maxseg)) /
-   CCV(ccv, snd_cwnd);
+   CCV(ccv, snd_cwnd));
}
 
/*

Modified: stable/12/sys/netinet/cc/cc_cubic.h
==
--- stable/12/sys/netinet/cc/cc_cubic.h Wed Jul  1 19:50:03 2020
(r362857)
+++ stable/12/sys/netinet/cc/cc_cubic.h Wed Jul  1 20:09:34 2020
(r362858)
@@ -41,6 +41,8 @@
 #ifndef _NETINET_CC_CUBIC_H_
 #define _NETINET_CC_CUBIC_H_
 
+#include 
+
 /* Number of bits of precision for fixed point math calcs. */
 #defineCUBIC_SHIFT 8
 
@@ -70,6 +72,12 @@
 /* Don't trust s_rtt until this many rtt samples have been taken. */
 #defineCUBIC_MIN_RTT_SAMPLES   8
 
+/*
+ * (2^21)^3 is long max. Dividing (2^63) by Cubic_C_factor
+ * and taking cube-root yields 448845 as the effective useful limit
+ */
+#defineCUBED_ROOT_MAX_ULONG448845
+
 /* Userland only bits. */
 #ifndef _KERNEL
 
@@ -172,8 +180,13 @@ cubic_cwnd(int ticks_since_cong, unsigned long wmax, u
/* K is in fixed point form with CUBIC_SHIFT worth of precision. */
 
/* t - K, with CUBIC_SHIFT worth of precision. */
-   cwnd = ((int64_t)(ticks_since_cong << CUBIC_SHIFT) - (K * hz)) / hz;
+   cwnd = (((int64_t)ticks_since_cong << CUBIC_SHIFT) - (K * hz)) / hz;
 
+   if (cwnd > CUBED_ROOT_MAX_ULONG)
+   return INT_MAX;
+   if (cwnd < -CUBED_ROOT_MAX_ULONG)
+   return 0;
+
/* (t - K)^3, with CUBIC_SHIFT^3 worth of precision. */

svn commit: r362857 - stable/12/sys/netinet/cc

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 19:50:03 2020
New Revision: 362857
URL: https://svnweb.freebsd.org/changeset/base/362857

Log:
  MFC r354773: Improve TCP CUBIC specific after idle reaction.
  The adjustments are inspired by the Linux stack, which has had a
  functionally equivalent implementation for more than a decade now.
  
  MFC r356224: Add curly braces missed in above change
  
  Submitted by:   rscheff
  Reviewed by:Cheng Cui
  Differential Revision:  https://reviews.freebsd.org/D18982

Modified:
  stable/12/sys/netinet/cc/cc_cubic.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/cc/cc_cubic.c
==
--- stable/12/sys/netinet/cc/cc_cubic.c Wed Jul  1 19:42:23 2020
(r362856)
+++ stable/12/sys/netinet/cc/cc_cubic.c Wed Jul  1 19:50:03 2020
(r362857)
@@ -199,8 +199,11 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type)
 * max_cwnd.
 */
if (((cubic_data->flags & CUBICFLAG_CONG_EVENT) == 0) &&
-   cubic_data->max_cwnd < CCV(ccv, snd_cwnd))
+   cubic_data->max_cwnd < CCV(ccv, snd_cwnd)) {
cubic_data->max_cwnd = CCV(ccv, snd_cwnd);
+   cubic_data->K = cubic_k(cubic_data->max_cwnd /
+   CCV(ccv, t_maxseg));
+   }
}
} else if (type == CC_ACK && !IN_RECOVERY(CCV(ccv, t_flags)) &&
!(ccv->flags & CCF_CWND_LIMITED)) {
@@ -219,6 +222,9 @@ cubic_after_idle(struct cc_var *ccv)
struct cubic *cubic_data;
 
cubic_data = ccv->cc_data;
+
+   cubic_data->max_cwnd = ulmax(cubic_data->max_cwnd, CCV(ccv, snd_cwnd));
+   cubic_data->K = cubic_k(cubic_data->max_cwnd / CCV(ccv, t_maxseg));
 
newreno_cc_algo.after_idle(ccv);
cubic_data->t_last_cong = ticks;
___
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: r362856 - stable/12/sys/dev/virtio/network

2020-07-01 Thread Vincenzo Maffione
Author: vmaffione
Date: Wed Jul  1 19:42:23 2020
New Revision: 362856
URL: https://svnweb.freebsd.org/changeset/base/362856

Log:
  MFC r362204
  
  if_vtnet: let vtnet_rx_vq_intr() and vtnet_rxq_tq_intr() share code
  
  Since the two functions are similar, introduce a common function
  (vtnet_rx_vq_process()) to share common code.
  This also improves locking, by ensuring vrxs_rescheduled is accessed
  under the RXQ lock, and taskqueue_enqueue() is not called under the
  lock (therefore avoiding a spurious duplicate lock warning).
  
  Reported by:jrtc27

Modified:
  stable/12/sys/dev/virtio/network/if_vtnet.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/virtio/network/if_vtnet.c
==
--- stable/12/sys/dev/virtio/network/if_vtnet.c Wed Jul  1 19:41:10 2020
(r362855)
+++ stable/12/sys/dev/virtio/network/if_vtnet.c Wed Jul  1 19:42:23 2020
(r362856)
@@ -127,6 +127,7 @@ static int  vtnet_rxq_merged_eof(struct vtnet_rxq *, st
 static voidvtnet_rxq_input(struct vtnet_rxq *, struct mbuf *,
struct virtio_net_hdr *);
 static int vtnet_rxq_eof(struct vtnet_rxq *);
+static voidvtnet_rx_vq_process(struct vtnet_rxq *rxq, int tries);
 static voidvtnet_rx_vq_intr(void *);
 static voidvtnet_rxq_tq_intr(void *, int);
 
@@ -1847,20 +1848,17 @@ vtnet_rxq_eof(struct vtnet_rxq *rxq)
 }
 
 static void
-vtnet_rx_vq_intr(void *xrxq)
+vtnet_rx_vq_process(struct vtnet_rxq *rxq, int tries)
 {
struct vtnet_softc *sc;
-   struct vtnet_rxq *rxq;
struct ifnet *ifp;
-   int tries, more;
+   int more;
 #ifdef DEV_NETMAP
int nmirq;
 #endif /* DEV_NETMAP */
 
-   rxq = xrxq;
sc = rxq->vtnrx_sc;
ifp = sc->vtnet_ifp;
-   tries = 0;
 
if (__predict_false(rxq->vtnrx_id >= sc->vtnet_act_vq_pairs)) {
/*
@@ -1908,58 +1906,32 @@ again:
 * This is an occasional condition or race (when !more),
 * so retry a few times before scheduling the taskqueue.
 */
-   if (tries++ < VTNET_INTR_DISABLE_RETRIES)
+   if (tries-- > 0)
goto again;
 
-   VTNET_RXQ_UNLOCK(rxq);
rxq->vtnrx_stats.vrxs_rescheduled++;
+   VTNET_RXQ_UNLOCK(rxq);
taskqueue_enqueue(rxq->vtnrx_tq, >vtnrx_intrtask);
} else
VTNET_RXQ_UNLOCK(rxq);
 }
 
 static void
-vtnet_rxq_tq_intr(void *xrxq, int pending)
+vtnet_rx_vq_intr(void *xrxq)
 {
-   struct vtnet_softc *sc;
struct vtnet_rxq *rxq;
-   struct ifnet *ifp;
-   int more;
-#ifdef DEV_NETMAP
-   int nmirq;
-#endif /* DEV_NETMAP */
 
rxq = xrxq;
-   sc = rxq->vtnrx_sc;
-   ifp = sc->vtnet_ifp;
+   vtnet_rx_vq_process(rxq, VTNET_INTR_DISABLE_RETRIES);
+}
 
-   VTNET_RXQ_LOCK(rxq);
+static void
+vtnet_rxq_tq_intr(void *xrxq, int pending)
+{
+   struct vtnet_rxq *rxq;
 
-#ifdef DEV_NETMAP
-   nmirq = netmap_rx_irq(ifp, rxq->vtnrx_id, );
-   if (nmirq != NM_IRQ_PASS) {
-   VTNET_RXQ_UNLOCK(rxq);
-   if (nmirq == NM_IRQ_RESCHED) {
-   taskqueue_enqueue(rxq->vtnrx_tq, >vtnrx_intrtask);
-   }
-   return;
-   }
-#endif /* DEV_NETMAP */
-
-   if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
-   VTNET_RXQ_UNLOCK(rxq);
-   return;
-   }
-
-   more = vtnet_rxq_eof(rxq);
-   if (more || vtnet_rxq_enable_intr(rxq) != 0) {
-   if (!more)
-   vtnet_rxq_disable_intr(rxq);
-   rxq->vtnrx_stats.vrxs_rescheduled++;
-   taskqueue_enqueue(rxq->vtnrx_tq, >vtnrx_intrtask);
-   }
-
-   VTNET_RXQ_UNLOCK(rxq);
+   rxq = xrxq;
+   vtnet_rx_vq_process(rxq, 0);
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 19:41:10 2020
New Revision: 362855
URL: https://svnweb.freebsd.org/changeset/base/362855

Log:
  MFC r353482: Add missing include which breaks builds without VIMAGE.

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

Modified: stable/12/sys/net/route.c
==
--- stable/12/sys/net/route.c   Wed Jul  1 19:23:15 2020(r362854)
+++ stable/12/sys/net/route.c   Wed Jul  1 19:41:10 2020(r362855)
@@ -52,6 +52,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r362854 - stable/12/sys/netinet/cc

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 19:23:15 2020
New Revision: 362854
URL: https://svnweb.freebsd.org/changeset/base/362854

Log:
  MFC r354772: Implement a TCP CUBIC-specific after idle reaction.
  This patch addresses a very common case of frequent application stalls,
  where TCP runs idle and looses the state of the network.
  
  Submitted by: rscheff
  Reviewed by:  Cheng Cui
  Differential Revision:https://reviews.freebsd.org/D18954

Modified:
  stable/12/sys/netinet/cc/cc_cubic.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/cc/cc_cubic.c
==
--- stable/12/sys/netinet/cc/cc_cubic.c Wed Jul  1 19:15:43 2020
(r362853)
+++ stable/12/sys/netinet/cc/cc_cubic.c Wed Jul  1 19:23:15 2020
(r362854)
@@ -78,6 +78,7 @@ static intcubic_mod_init(void);
 static voidcubic_post_recovery(struct cc_var *ccv);
 static voidcubic_record_rtt(struct cc_var *ccv);
 static voidcubic_ssthresh_update(struct cc_var *ccv);
+static voidcubic_after_idle(struct cc_var *ccv);
 
 struct cubic {
/* Cubic K in fixed point form with CUBIC_SHIFT worth of precision. */
@@ -115,6 +116,7 @@ struct cc_algo cubic_cc_algo = {
.conn_init = cubic_conn_init,
.mod_init = cubic_mod_init,
.post_recovery = cubic_post_recovery,
+   .after_idle = cubic_after_idle,
 };
 
 static void
@@ -206,7 +208,24 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type)
}
 }
 
+/*
+ * This is a Cubic specific implementation of after_idle.
+ *   - Reset cwnd by calling New Reno implementation of after_idle.
+ *   - Reset t_last_cong.
+ */
 static void
+cubic_after_idle(struct cc_var *ccv)
+{
+   struct cubic *cubic_data;
+
+   cubic_data = ccv->cc_data;
+
+   newreno_cc_algo.after_idle(ccv);
+   cubic_data->t_last_cong = ticks;
+}
+
+
+static void
 cubic_cb_destroy(struct cc_var *ccv)
 {
free(ccv->cc_data, M_CUBIC);
@@ -303,9 +322,6 @@ cubic_conn_init(struct cc_var *ccv)
 static int
 cubic_mod_init(void)
 {
-
-   cubic_cc_algo.after_idle = newreno_cc_algo.after_idle;
-
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: r362853 - in head/sys/riscv: include riscv

2020-07-01 Thread Kristof Provost
Author: kp
Date: Wed Jul  1 19:15:43 2020
New Revision: 362853
URL: https://svnweb.freebsd.org/changeset/base/362853

Log:
  riscv pmap: zero reserved pte bits in ppn
  
  The top 10 bits of a pte are reserved by specification[1] and are not part of
  the PPN.
  
  [1] 'Volume II: RISC-V Privileged Architectures V20190608-Priv-MSU-Ratified',
  '4.4.1 Addressing and Memory Protection', page 72: "The PTE format for Sv39 is
  shown in Figure 4.18. ... Bits 63–54 are reserved for future use and must be
  zeroed by software for forward compatibility."
  
  Submitted by: Nathaniel Filardo 
  Reviewed by:  kp, mhorne
  Differential Revision:https://reviews.freebsd.org/D25523

Modified:
  head/sys/riscv/include/pte.h
  head/sys/riscv/riscv/pmap.c

Modified: head/sys/riscv/include/pte.h
==
--- head/sys/riscv/include/pte.hWed Jul  1 19:12:47 2020
(r362852)
+++ head/sys/riscv/include/pte.hWed Jul  1 19:15:43 2020
(r362853)
@@ -83,6 +83,9 @@ typedef   uint64_tpn_t;   /* page 
number */
 #definePTE_PROMOTE (PTE_V | PTE_RWX | PTE_D | PTE_A | PTE_G | 
PTE_U | \
 PTE_SW_MANAGED | PTE_SW_WIRED)
 
+/* Bits 63 - 54 are reserved for future use. */
+#define PTE_HI_MASK0xFFC0ULL
+
 #definePTE_PPN0_S  10
 #definePTE_PPN1_S  19
 #definePTE_PPN2_S  28

Modified: head/sys/riscv/riscv/pmap.c
==
--- head/sys/riscv/riscv/pmap.c Wed Jul  1 19:12:47 2020(r362852)
+++ head/sys/riscv/riscv/pmap.c Wed Jul  1 19:15:43 2020(r362853)
@@ -339,7 +339,8 @@ pagezero(void *p)
 #definepmap_l2_index(va)   (((va) >> L2_SHIFT) & Ln_ADDR_MASK)
 #definepmap_l3_index(va)   (((va) >> L3_SHIFT) & Ln_ADDR_MASK)
 
-#definePTE_TO_PHYS(pte)((pte >> PTE_PPN0_S) * PAGE_SIZE)
+#definePTE_TO_PHYS(pte) \
+pte) & ~PTE_HI_MASK) >> PTE_PPN0_S) * PAGE_SIZE)
 
 static __inline pd_entry_t *
 pmap_l1(pmap_t pmap, vm_offset_t va)
___
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: r362852 - head/sys/riscv/riscv

2020-07-01 Thread Kristof Provost
Author: kp
Date: Wed Jul  1 19:12:47 2020
New Revision: 362852
URL: https://svnweb.freebsd.org/changeset/base/362852

Log:
  riscv locore.S: load constant prior to loop
  
  A very minor micro-optimization; t0 is not clobbered between the loop top and
  bottom and there appear to be no other branches to this label.
  
  Submitted by: Nathaniel Filardo 
  Reviewed by:  mhorne
  Differential Revision:https://reviews.freebsd.org/D25524

Modified:
  head/sys/riscv/riscv/locore.S

Modified: head/sys/riscv/riscv/locore.S
==
--- head/sys/riscv/riscv/locore.S   Wed Jul  1 19:11:02 2020
(r362851)
+++ head/sys/riscv/riscv/locore.S   Wed Jul  1 19:12:47 2020
(r362852)
@@ -139,8 +139,8 @@ pagetables:
li  t2, 512 /* Build 512 entries */
add t3, t4, t2
li  t5, 0
-1:
li  t0, (PTE_KERN | PTE_X)
+1:
sllit2, t4, PTE_PPN1_S  /* << PTE_PPN1_S */
or  t5, t0, t2
sd  t5, (s1)/* Store PTE entry to position */
___
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: r362851 - head/sys/riscv/riscv

2020-07-01 Thread Kristof Provost
Author: kp
Date: Wed Jul  1 19:11:02 2020
New Revision: 362851
URL: https://svnweb.freebsd.org/changeset/base/362851

Log:
  riscv: Log missing registers in dump_regs()
  
  If we panic we dump the registers for debugging. This is very useful, but it
  missed several registers (ra, sp, gp and tp).
  
  Log these as well. Especially the return address value is extremely useful.
  
  Sponsored by: Axiado

Modified:
  head/sys/riscv/riscv/trap.c

Modified: head/sys/riscv/riscv/trap.c
==
--- head/sys/riscv/riscv/trap.c Wed Jul  1 18:10:37 2020(r362850)
+++ head/sys/riscv/riscv/trap.c Wed Jul  1 19:11:02 2020(r362851)
@@ -147,6 +147,11 @@ dump_regs(struct trapframe *frame)
for (i = 0; i < n; i++)
printf("a[%d] == 0x%016lx\n", i, frame->tf_a[i]);
 
+   printf("ra == 0x%016lx\n", frame->tf_ra);
+   printf("sp == 0x%016lx\n", frame->tf_sp);
+   printf("gp == 0x%016lx\n", frame->tf_gp);
+   printf("tp == 0x%016lx\n", frame->tf_tp);
+
printf("sepc == 0x%016lx\n", frame->tf_sepc);
printf("sstatus == 0x%016lx\n", frame->tf_sstatus);
 }
___
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: r362850 - stable/12/sys/netinet

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 18:10:37 2020
New Revision: 362850
URL: https://svnweb.freebsd.org/changeset/base/362850

Log:
  MFC r353518: Separate out SCTP related dtrace code.
  
  This is based on work done by markj.

Modified:
  stable/12/sys/netinet/in_kdtrace.c
  stable/12/sys/netinet/in_kdtrace.h
  stable/12/sys/netinet/sctp_input.c
  stable/12/sys/netinet/sctp_kdtrace.c
  stable/12/sys/netinet/sctp_kdtrace.h
  stable/12/sys/netinet/sctp_output.c
  stable/12/sys/netinet/sctputil.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/in_kdtrace.c
==
--- stable/12/sys/netinet/in_kdtrace.c  Wed Jul  1 18:08:59 2020
(r362849)
+++ stable/12/sys/netinet/in_kdtrace.c  Wed Jul  1 18:10:37 2020
(r362850)
@@ -31,16 +31,11 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include "opt_sctp.h"
-
 #include 
 #include 
 #include 
 
 SDT_PROVIDER_DEFINE(ip);
-#ifdef SCTP
-SDT_PROVIDER_DEFINE(sctp);
-#endif
 SDT_PROVIDER_DEFINE(tcp);
 SDT_PROVIDER_DEFINE(udp);
 SDT_PROVIDER_DEFINE(udplite);
@@ -60,30 +55,6 @@ SDT_PROBE_DEFINE6_XLATE(ip, , , send,
 "struct ifnet *", "ifinfo_t *",
 "struct ip *", "ipv4info_t *",
 "struct ip6_hdr *", "ipv6info_t *");
-
-#ifdef SCTP
-SDT_PROBE_DEFINE5_XLATE(sctp, , , receive,
-"void *", "pktinfo_t *",
-"struct sctp_tcb *", "csinfo_t *",
-"struct mbuf *", "ipinfo_t *",
-"struct sctp_tcb *", "sctpsinfo_t *" ,
-"struct sctphdr *", "sctpinfo_t *");
-
-SDT_PROBE_DEFINE5_XLATE(sctp, , , send,
-"void *", "pktinfo_t *",
-"struct sctp_tcb *", "csinfo_t *",
-"uint8_t *", "ipinfo_t *",
-"struct sctp_tcb *", "sctpsinfo_t *" ,
-"struct sctphdr *", "sctpinfo_t *");
-
-SDT_PROBE_DEFINE6_XLATE(sctp, , , state__change,
-"void *", "void *",
-"struct sctp_tcb *", "csinfo_t *",
-"void *", "void *",
-"struct sctp_tcb *", "sctpsinfo_t *",
-"void *", "void *",
-"int", "sctplsinfo_t *");
-#endif
 
 SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__established,
 "void *", "pktinfo_t *",

Modified: stable/12/sys/netinet/in_kdtrace.h
==
--- stable/12/sys/netinet/in_kdtrace.h  Wed Jul  1 18:08:59 2020
(r362849)
+++ stable/12/sys/netinet/in_kdtrace.h  Wed Jul  1 18:10:37 2020
(r362850)
@@ -48,31 +48,14 @@
SDT_PROBE5(tcp, , , probe, arg0, arg1, arg2, arg3, arg4)
 #defineTCP_PROBE6(probe, arg0, arg1, arg2, arg3, arg4, arg5)   
\
SDT_PROBE6(tcp, , , probe, arg0, arg1, arg2, arg3, arg4, arg5)
-#defineSCTP_PROBE1(probe, arg0)
\
-   SDT_PROBE1(sctp, , , probe, arg0)
-#defineSCTP_PROBE2(probe, arg0, arg1)  
\
-   SDT_PROBE2(sctp, , , probe, arg0, arg1)
-#defineSCTP_PROBE3(probe, arg0, arg1, arg2)
\
-   SDT_PROBE3(sctp, , , probe, arg0, arg1, arg2)
-#defineSCTP_PROBE4(probe, arg0, arg1, arg2, arg3)  
\
-   SDT_PROBE4(sctp, , , probe, arg0, arg1, arg2, arg3)
-#defineSCTP_PROBE5(probe, arg0, arg1, arg2, arg3, arg4)
\
-   SDT_PROBE5(sctp, , , probe, arg0, arg1, arg2, arg3, arg4)
-#defineSCTP_PROBE6(probe, arg0, arg1, arg2, arg3, arg4, arg5)  
\
-   SDT_PROBE6(sctp, , , probe, arg0, arg1, arg2, arg3, arg4, arg5)
 
 SDT_PROVIDER_DECLARE(ip);
-SDT_PROVIDER_DECLARE(sctp);
 SDT_PROVIDER_DECLARE(tcp);
 SDT_PROVIDER_DECLARE(udp);
 SDT_PROVIDER_DECLARE(udplite);
 
 SDT_PROBE_DECLARE(ip, , , receive);
 SDT_PROBE_DECLARE(ip, , , send);
-
-SDT_PROBE_DECLARE(sctp, , , receive);
-SDT_PROBE_DECLARE(sctp, , , send);
-SDT_PROBE_DECLARE(sctp, , , state__change);
 
 SDT_PROBE_DECLARE(tcp, , , accept__established);
 SDT_PROBE_DECLARE(tcp, , , accept__refused);

Modified: stable/12/sys/netinet/sctp_input.c
==
--- stable/12/sys/netinet/sctp_input.c  Wed Jul  1 18:08:59 2020
(r362849)
+++ stable/12/sys/netinet/sctp_input.c  Wed Jul  1 18:10:37 2020
(r362850)
@@ -49,10 +49,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #if defined(INET) || defined(INET6)
 #include 
 #endif
-#include 
 #include 
 
 

Modified: stable/12/sys/netinet/sctp_kdtrace.c
==
--- stable/12/sys/netinet/sctp_kdtrace.cWed Jul  1 18:08:59 2020
(r362849)
+++ stable/12/sys/netinet/sctp_kdtrace.cWed Jul  1 18:10:37 2020
(r362850)
@@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-SDT_PROVIDER_DECLARE(sctp);
+SDT_PROVIDER_DEFINE(sctp);
 
 //
 /* Cwnd probe - tracks changes in the congestion window on a netp */
@@ -171,3 +171,29 @@ SDT_PROBE_DEFINE4(sctp, flightsize, 

svn commit: r362849 - stable/12/sys/netinet

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 18:08:59 2020
New Revision: 362849
URL: https://svnweb.freebsd.org/changeset/base/362849

Log:
  MFC r353488: Rename sctp_dtrace_declare.h to sctp_kdtrace.h

Added:
  stable/12/sys/netinet/sctp_kdtrace.h
 - copied unchanged from r353488, head/sys/netinet/sctp_kdtrace.h
Deleted:
  stable/12/sys/netinet/sctp_dtrace_declare.h
Modified:
  stable/12/sys/netinet/sctp_cc_functions.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/sctp_cc_functions.c
==
--- stable/12/sys/netinet/sctp_cc_functions.c   Wed Jul  1 18:03:38 2020
(r362848)
+++ stable/12/sys/netinet/sctp_cc_functions.c   Wed Jul  1 18:08:59 2020
(r362849)
@@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #define SHIFT_MPTCP_MULTI_N 40
 #define SHIFT_MPTCP_MULTI_Z 16

Copied: stable/12/sys/netinet/sctp_kdtrace.h (from r353488, 
head/sys/netinet/sctp_kdtrace.h)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/sys/netinet/sctp_kdtrace.hWed Jul  1 18:08:59 2020
(r362849, copy of r353488, head/sys/netinet/sctp_kdtrace.h)
@@ -0,0 +1,81 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved.
+ * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * a) Redistributions of source code must retain the above copyright notice,
+ *this list of conditions and the following disclaimer.
+ *
+ * b) 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.
+ *
+ * c) Neither the name of Cisco Systems, Inc. nor the names of its
+ *contributors may be used to endorse or promote products derived
+ *from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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$");
+
+#ifndef _NETINET_SCTP_DTRACE_DECLARE_H_
+#define _NETINET_SCTP_DTRACE_DECLARE_H_
+
+#include 
+#include 
+
+/* Declare the SCTP provider */
+SDT_PROVIDER_DECLARE(sctp);
+
+/* The probes we have so far: */
+
+/* One to track a net's cwnd */
+/* initial */
+SDT_PROBE_DECLARE(sctp, cwnd, net, init);
+/* update at a ack -- increase */
+SDT_PROBE_DECLARE(sctp, cwnd, net, ack);
+/* update at a fast retransmit -- decrease */
+SDT_PROBE_DECLARE(sctp, cwnd, net, fr);
+/* update at a time-out -- decrease */
+SDT_PROBE_DECLARE(sctp, cwnd, net, to);
+/* update at a burst-limit -- decrease */
+SDT_PROBE_DECLARE(sctp, cwnd, net, bl);
+/* update at a ECN -- decrease */
+SDT_PROBE_DECLARE(sctp, cwnd, net, ecn);
+/* update at a Packet-Drop -- decrease */
+SDT_PROBE_DECLARE(sctp, cwnd, net, pd);
+/* Rttvar probe declaration */
+SDT_PROBE_DECLARE(sctp, cwnd, net, rttvar);
+SDT_PROBE_DECLARE(sctp, cwnd, net, rttstep);
+
+/* One to track an associations rwnd */
+SDT_PROBE_DECLARE(sctp, rwnd, assoc, val);
+
+/* One to track a net's flight size */
+SDT_PROBE_DECLARE(sctp, flightsize, net, val);
+
+/* One to track an associations flight size */
+SDT_PROBE_DECLARE(sctp, flightsize, assoc, val);
+
+
+
+
+
+
+#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: r362848 - in stable/12/sys: net netinet sys

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 18:03:38 2020
New Revision: 362848
URL: https://svnweb.freebsd.org/changeset/base/362848

Log:
  MFC r353480: Use event handler in SCTP
  
  Use an event handler to notify the SCTP about IP address changes
  instead of calling an SCTP specific function from the IP code.
  This is a requirement of supporting SCTP as a kernel loadable module.
  This patch was developed by markj@, I tweaked a bit the SCTP related
  code.
  
  Submitted by: markj

Modified:
  stable/12/sys/net/route.c
  stable/12/sys/netinet/sctp_bsd_addr.c
  stable/12/sys/netinet/sctp_bsd_addr.h
  stable/12/sys/netinet/sctp_usrreq.c
  stable/12/sys/sys/eventhandler.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/net/route.c
==
--- stable/12/sys/net/route.c   Wed Jul  1 17:40:11 2020(r362847)
+++ stable/12/sys/net/route.c   Wed Jul  1 18:03:38 2020(r362848)
@@ -38,10 +38,9 @@
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
-#include "opt_route.h"
-#include "opt_sctp.h"
 #include "opt_mrouting.h"
 #include "opt_mpath.h"
+#include "opt_route.h"
 
 #include 
 #include 
@@ -90,13 +89,6 @@
 #defineRT_NUMFIBS  1
 #endif
 
-#if defined(INET) || defined(INET6)
-#ifdef SCTP
-extern void sctp_addr_change(struct ifaddr *ifa, int cmd);
-#endif /* SCTP */
-#endif
-
-
 /* This is read-only.. */
 u_int rt_numfibs = RT_NUMFIBS;
 SYSCTL_UINT(_net, OID_AUTO, fibs, CTLFLAG_RDTUN, _numfibs, 0, "");
@@ -140,6 +132,8 @@ VNET_DEFINE(int, rttrash);  /* routes not in table 
but
 VNET_DEFINE_STATIC(uma_zone_t, rtzone);/* Routing table UMA 
zone. */
 #defineV_rtzoneVNET(rtzone)
 
+EVENTHANDLER_LIST_DEFINE(rt_addrmsg);
+
 static int rtrequest1_fib_change(struct rib_head *, struct rt_addrinfo *,
 struct rtentry **, u_int);
 static void rt_setmetrics(const struct rt_addrinfo *, struct rtentry *);
@@ -2192,20 +2186,10 @@ rt_addrmsg(int cmd, struct ifaddr *ifa, int fibnum)
 
KASSERT(cmd == RTM_ADD || cmd == RTM_DELETE,
("unexpected cmd %d", cmd));
-   
KASSERT(fibnum == RT_ALL_FIBS || (fibnum >= 0 && fibnum < rt_numfibs),
("%s: fib out of range 0 <=%d<%d", __func__, fibnum, rt_numfibs));
 
-#if defined(INET) || defined(INET6)
-#ifdef SCTP
-   /*
-* notify the SCTP stack
-* this will only get called when an address is added/deleted
-* XXX pass the ifaddr struct instead if ifa->ifa_addr...
-*/
-   sctp_addr_change(ifa, cmd);
-#endif /* SCTP */
-#endif
+   EVENTHANDLER_DIRECT_INVOKE(rt_addrmsg, ifa, cmd);
return (rtsock_addrmsg(cmd, ifa, fibnum));
 }
 

Modified: stable/12/sys/netinet/sctp_bsd_addr.c
==
--- stable/12/sys/netinet/sctp_bsd_addr.c   Wed Jul  1 17:40:11 2020
(r362847)
+++ stable/12/sys/netinet/sctp_bsd_addr.c   Wed Jul  1 18:03:38 2020
(r362848)
@@ -357,6 +357,12 @@ sctp_addr_change(struct ifaddr *ifa, int cmd)
 }
 
 void
+sctp_addr_change_event_handler(void *arg __unused, struct ifaddr *ifa, int cmd)
+{
+   sctp_addr_change(ifa, cmd);
+}
+
+void
  sctp_add_or_del_interfaces(int (*pred) (struct ifnet *), int add){
struct ifnet *ifn;
struct ifaddr *ifa;

Modified: stable/12/sys/netinet/sctp_bsd_addr.h
==
--- stable/12/sys/netinet/sctp_bsd_addr.h   Wed Jul  1 17:40:11 2020
(r362847)
+++ stable/12/sys/netinet/sctp_bsd_addr.h   Wed Jul  1 18:03:38 2020
(r362848)
@@ -61,6 +61,8 @@ int sctp_copy_out_packet_log(uint8_t *target, int leng
 
 void sctp_addr_change(struct ifaddr *ifa, int cmd);
 
+void sctp_addr_change_event_handler(void *, struct ifaddr *, int);
+
 void sctp_add_or_del_interfaces(int (*pred) (struct ifnet *), int add);
 
 #endif

Modified: stable/12/sys/netinet/sctp_usrreq.c
==
--- stable/12/sys/netinet/sctp_usrreq.c Wed Jul  1 17:40:11 2020
(r362847)
+++ stable/12/sys/netinet/sctp_usrreq.c Wed Jul  1 18:03:38 2020
(r362848)
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 
 
@@ -89,6 +90,8 @@ sctp_init(void)
SCTP_BASE_VAR(packet_log_end) = 0;
memset(_BASE_VAR(packet_log_buffer), 0, SCTP_PACKET_LOG_SIZE);
 #endif
+   EVENTHANDLER_REGISTER(rt_addrmsg, sctp_addr_change_event_handler,
+   NULL, EVENTHANDLER_PRI_FIRST);
 }
 
 #ifdef VIMAGE

Modified: stable/12/sys/sys/eventhandler.h
==
--- stable/12/sys/sys/eventhandler.hWed Jul  1 17:40:11 2020
(r362847)
+++ stable/12/sys/sys/eventhandler.hWed Jul  1 18:03:38 2020
(r362848)
@@ -335,4 +335,9 @@ typedef void 

Re: svn commit: r362809 - head/contrib/mandoc

2020-07-01 Thread Warner Losh
On Wed, Jul 1, 2020 at 8:51 AM Rodney W. Grimes 
wrote:

> > On Tue, Jun 30, 2020 at 03:56:17PM -0700, Rodney W. Grimes wrote:
> > > [ Charset UTF-8 unsupported, converting... ]
> > > > Author: gbe (doc committer)
> > > > Date: Tue Jun 30 18:08:59 2020
> > > > New Revision: 362809
> > > > URL: https://svnweb.freebsd.org/changeset/base/362809
> > > >
> > > > Log:
> > > >   Mention FreeBSD in the HISTORY sections of apropos(1) and
> makewhatis(8).
> > > >
> > > >   PR: 223520, 223521
> > > >   Reviewed by:bcr (mentor)
> > > >   Approved by:bcr (mentor)
> > > >   Differential Revision:  https://reviews.freebsd.org/D25521
> > > >
> > > > Modified:
> > > >   head/contrib/mandoc/apropos.1
> > > >   head/contrib/mandoc/makewhatis.8
> > > >
> > > > Modified: head/contrib/mandoc/apropos.1
> > > >
> ==
> > > > --- head/contrib/mandoc/apropos.1 Tue Jun 30 17:21:28 2020
> (r362808)
> > > > +++ head/contrib/mandoc/apropos.1 Tue Jun 30 18:08:59 2020
> (r362809)
> > > > @@ -15,7 +15,7 @@
> > > >  .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
> ARISING OUT OF
> > > >  .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> > > >  .\"
> > > > -.Dd $Mdocdate: November 22 2018 $
> > > > +.Dd $Mdocdate: June 30 2020 $
> > > >  .Dt APROPOS 1
> > > >  .Os
> > > >  .Sh NAME
> > > > @@ -493,6 +493,12 @@ The options
> > > >  .Fl acfhIKklOTWw
> > > >  appeared in
> > > >  .Ox 5.7 .
> > > > +.Pp
> > > > +The
> > > > +.Nm
> > > > +utility was integrated into
> > > > +.Fx 11.1
> > > > +as part of the switch to mandoc.
> > >
> > > Huh?  FreeBSD has had apropos since 1.0 and my 5.4 system clearly has
> it:
> > > freebsd {110}% uname -a
> > > FreeBSD pdx.rh.CN85.dnsmgr.net 5.4-RELEASE-p8 FreeBSD 5.4-RELEASE-p8
> #1: Mon Jul  1 17:58:50 PDT 2019 
> r...@pdx.rh.cn85.dnsmgr.net:/usr/src/sys/i386/compile/PDXMXPIE
> i386
> > > pdx.rh.CN85.dnsmgr.net:freebsd {111}% which apropos
> > > /usr/bin/apropos
> > >
> > > And a man page for it too:
> > > APROPOS(1)  FreeBSD General Commands Manual
>  APROPOS(1)
> > >
> > > NAME
> > >  apropos, whatis -- search the whatis database
> > >
> > > SYNOPSIS
> > >  apropos keyword ...
> > >  whatis keyword ...
> > >
> > > DESCRIPTION
> > >  apropos searches a set of database files containing short
> descriptions of
> > >  system commands for keywords and displays the result on the
> standard out-
> > >  put.  whatis displays only complete word matches.
> > >
> > >  keyword really is an extended regular expression, please read
> grep(1)
> > >  manual page for more information about its format.
> > >
> > > DIAGNOSTICS
> > >  The apropos utility exits 0 on success, and 1 if no keyword
> matched.
> > >
> > > SEE ALSO
> > >  grep(1), makewhatis(1), man(1)
> > >
> > > FreeBSD 5.4January 15, 1991
> FreeBSD 5.4
> > >
> > > >  .Sh AUTHORS
> > > >  .An -nosplit
> > > >  .An Bill Joy
> > > >
> >
> > That is true, but the version of 'apropos' we have currently in base is
> based on mandoc,
> > which was imported around September 2018. Due to the nature of
> contributed code I
> > thought it would be best to document only the history when it was
> integrated into
> > FreeSBD. The same applies for 'makewhatis'.
>
> That is not what has been done in other places when code is
> changed/replaced,
> the HISTORY section is not specific to "FreeBSD's version" of this
> function.
>
> We often have "An ls command appeared in Version 1 AT UNIX."  Our source
> code and man page is not from that, but that is the history of ls.
>
> This *could* be amended and *should* be amended to reflect that apropos,
> and makewhatis got *updated* by a switch to the mandoc versions, but it
> is misleading to say it was intergrated with the switch to mandoc as that
> implies it did not exist before this action.
>

I tend to agree with Rod here. These appeared in X the first time, but
noting they were replaced in version X with Y is the best way to address
the current provenance of the code...

Warner


> >
> > > > Modified: head/contrib/mandoc/makewhatis.8
> > > >
> ==
> > > > --- head/contrib/mandoc/makewhatis.8  Tue Jun 30 17:21:28 2020
>   (r362808)
> > > > +++ head/contrib/mandoc/makewhatis.8  Tue Jun 30 18:08:59 2020
>   (r362809)
> > > > @@ -15,7 +15,7 @@
> > > >  .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
> ARISING OUT OF
> > > >  .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> > > >  .\"
> > > > -.Dd $Mdocdate: May 17 2017 $
> > > > +.Dd $Mdocdate: June 30 2020 $
> > > >  .Dt MAKEWHATIS 8
> > > >  .Os
> > > >  .Sh NAME
> > > > @@ -211,6 +211,12 @@ and the options
> > > >  .Fl aCDnQT
> > > >  in
> > > >  .Ox 5.6 .
> > > > +.Pp
> > > > +The
> > > > +.Nm
> > > > +utility was integrated into
> > > > +.Fx 11.1
> > > > +as part of 

svn commit: r362847 - in stable/12/sys: netinet netinet6

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 17:40:11 2020
New Revision: 362847
URL: https://svnweb.freebsd.org/changeset/base/362847

Log:
  MFC r350588: SCTP related cleanup
  
  Improve consistency. No functional change.

Modified:
  stable/12/sys/netinet/sctp_asconf.c
  stable/12/sys/netinet/sctp_os_bsd.h
  stable/12/sys/netinet/sctp_pcb.c
  stable/12/sys/netinet/sctp_usrreq.c
  stable/12/sys/netinet6/sctp6_usrreq.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/sctp_asconf.c
==
--- stable/12/sys/netinet/sctp_asconf.c Wed Jul  1 17:17:06 2020
(r362846)
+++ stable/12/sys/netinet/sctp_asconf.c Wed Jul  1 17:40:11 2020
(r362847)
@@ -1982,7 +1982,7 @@ sctp_addr_mgmt_assoc(struct sctp_inpcb *inp, struct sc
 
/* invalid if we are a v6 only endpoint */
if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) &&
-   SCTP_IPV6_V6ONLY(>ip_inp.inp))
+   SCTP_IPV6_V6ONLY(inp))
return;
 
sin = >address.sin;
@@ -2055,9 +2055,8 @@ sctp_asconf_iterator_ep(struct sctp_inpcb *inp, void *
case AF_INET:
{
/* invalid if we are a v6 only endpoint */
-
if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) 
&&
-   SCTP_IPV6_V6ONLY(>ip_inp.inp)) {
+   SCTP_IPV6_V6ONLY(inp)) {
cnt_invalid++;
if (asc->cnt == cnt_invalid)
return (1);
@@ -2172,7 +2171,7 @@ sctp_asconf_iterator_stcb(struct sctp_inpcb *inp, stru
 
/* invalid if we are a v6 only endpoint */
if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) 
&&
-   SCTP_IPV6_V6ONLY(>ip_inp.inp))
+   SCTP_IPV6_V6ONLY(inp))
continue;
 
sin = >address.sin;
@@ -2189,7 +2188,7 @@ sctp_asconf_iterator_stcb(struct sctp_inpcb *inp, stru
continue;
}
if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) 
&&
-   SCTP_IPV6_V6ONLY(>ip_inp.inp)) {
+   SCTP_IPV6_V6ONLY(inp)) {
cnt_invalid++;
if (asc->cnt == cnt_invalid)
return;

Modified: stable/12/sys/netinet/sctp_os_bsd.h
==
--- stable/12/sys/netinet/sctp_os_bsd.h Wed Jul  1 17:17:06 2020
(r362846)
+++ stable/12/sys/netinet/sctp_os_bsd.h Wed Jul  1 17:40:11 2020
(r362847)
@@ -365,10 +365,10 @@ typedef struct callout sctp_os_timer_t;
  */
 
 /* get the v6 hop limit */
-#define SCTP_GET_HLIM(inp, ro) in6_selecthlim((struct inpcb 
*)>ip_inp.inp, (ro ? (ro->ro_rt ? (ro->ro_rt->rt_ifp) : (NULL)) : (NULL)));
+#define SCTP_GET_HLIM(inp, ro) in6_selecthlim(>ip_inp.inp, (ro ? 
(ro->ro_rt ? (ro->ro_rt->rt_ifp) : (NULL)) : (NULL)));
 
 /* is the endpoint v6only? */
-#define SCTP_IPV6_V6ONLY(inp)  (((struct inpcb *)inp)->inp_flags & 
IN6P_IPV6_V6ONLY)
+#define SCTP_IPV6_V6ONLY(sctp_inpcb)   ((sctp_inpcb)->ip_inp.inp.inp_flags & 
IN6P_IPV6_V6ONLY)
 /* is the socket non-blocking? */
 #define SCTP_SO_IS_NBIO(so)((so)->so_state & SS_NBIO)
 #define SCTP_SET_SO_NBIO(so)   ((so)->so_state |= SS_NBIO)

Modified: stable/12/sys/netinet/sctp_pcb.c
==
--- stable/12/sys/netinet/sctp_pcb.cWed Jul  1 17:17:06 2020
(r362846)
+++ stable/12/sys/netinet/sctp_pcb.cWed Jul  1 17:40:11 2020
(r362847)
@@ -2844,7 +2844,7 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *ad
struct sockaddr_in *sin;
 
/* IPV6_V6ONLY socket? */
-   if (SCTP_IPV6_V6ONLY(ip_inp)) {
+   if (SCTP_IPV6_V6ONLY(inp)) {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, 
SCTP_FROM_SCTP_PCB, EINVAL);
return (EINVAL);
}
@@ -3642,8 +3642,9 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate,
 
 
 #ifdef INET6
-   if (ip_pcb->inp_vflag & INP_IPV6)
-   ip6_freepcbopts(((struct inpcb *)inp)->in6p_outputopts);
+   if (ip_pcb->inp_vflag & INP_IPV6) {
+   ip6_freepcbopts(ip_pcb->in6p_outputopts);
+   }
 #endif /* INET6 */
   

svn commit: r362846 - head/sys/netinet/tcp_stacks

2020-07-01 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul  1 17:17:06 2020
New Revision: 362846
URL: https://svnweb.freebsd.org/changeset/base/362846

Log:
  Fix the cleanup handling in a error path for TCP BBR.
  
  Reported by:  syzbot+df7899c55c4cc52f5...@syzkaller.appspotmail.com
  Reviewed by:  rscheff
  Sponsored by: Netflix, Inc.
  Differential Revision:https://reviews.freebsd.org/D25486

Modified:
  head/sys/netinet/tcp_stacks/bbr.c

Modified: head/sys/netinet/tcp_stacks/bbr.c
==
--- head/sys/netinet/tcp_stacks/bbr.c   Wed Jul  1 16:57:57 2020
(r362845)
+++ head/sys/netinet/tcp_stacks/bbr.c   Wed Jul  1 17:17:06 2020
(r362846)
@@ -13381,6 +13381,8 @@ send:
 */
BBR_STAT_INC(bbr_offset_drop);
tcp_set_inp_to_drop(inp, EFAULT);
+   SOCKBUF_UNLOCK(sb);
+   (void)m_free(m);
return (0);
}
len = rsm->r_end - rsm->r_start;
___
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: r362845 - in head/sys/arm64: arm64 include

2020-07-01 Thread Andrew Turner
Author: andrew
Date: Wed Jul  1 16:57:57 2020
New Revision: 362845
URL: https://svnweb.freebsd.org/changeset/base/362845

Log:
  Read the CPU 0 arm64 ID registers early in initarm
  
  We also update the kernel view early in the boot. This will allow the
  use of the common kernel view in ifunc resolvers.
  
  Sponsored by: Innovate UK

Modified:
  head/sys/arm64/arm64/identcpu.c
  head/sys/arm64/arm64/machdep.c
  head/sys/arm64/arm64/mp_machdep.c
  head/sys/arm64/include/cpu.h

Modified: head/sys/arm64/arm64/identcpu.c
==
--- head/sys/arm64/arm64/identcpu.c Wed Jul  1 16:37:08 2020
(r362844)
+++ head/sys/arm64/arm64/identcpu.c Wed Jul  1 16:57:57 2020
(r362845)
@@ -992,7 +992,7 @@ update_lower_register(uint64_t val, uint64_t new_val, 
return (val);
 }
 
-static void
+void
 update_special_regs(u_int cpu)
 {
struct mrs_field *fields;
@@ -1072,7 +1072,8 @@ identify_cpu_sysinit(void *dummy __unused)
elf_hwcap = hwcap;
else
elf_hwcap &= hwcap;
-   update_special_regs(cpu);
+   if (cpu != 0)
+   update_special_regs(cpu);
 
if (CTR_DIC_VAL(cpu_desc[cpu].ctr) == 0)
dic = false;
@@ -1457,23 +1458,15 @@ identify_cache(uint64_t ctr)
 }
 
 void
-identify_cpu(void)
+identify_cpu(u_int cpu)
 {
u_int midr;
u_int impl_id;
u_int part_id;
-   u_int cpu;
size_t i;
const struct cpu_parts *cpu_partsp = NULL;
 
-   cpu = PCPU_GET(cpuid);
midr = get_midr();
-
-   /*
-* Store midr to pcpu to allow fast reading
-* from EL0, EL1 and assembly code.
-*/
-   PCPU_SET(midr, midr);
 
impl_id = CPU_IMPL(midr);
for (i = 0; i < nitems(cpu_implementers); i++) {

Modified: head/sys/arm64/arm64/machdep.c
==
--- head/sys/arm64/arm64/machdep.c  Wed Jul  1 16:37:08 2020
(r362844)
+++ head/sys/arm64/arm64/machdep.c  Wed Jul  1 16:57:57 2020
(r362845)
@@ -172,7 +172,6 @@ cpu_startup(void *dummy)
 {
 
undef_init();
-   identify_cpu();
install_cpu_errata();
 
vm_ksubmap_init();
@@ -1138,6 +1137,9 @@ initarm(struct arm64_bootparams *abp)
if (kmdp == NULL)
kmdp = preload_search_by_type("elf64 kernel");
 
+   identify_cpu(0);
+   update_special_regs(0);
+
link_elf_ireloc(kmdp);
try_load_dtb(kmdp);
 
@@ -1181,6 +1183,7 @@ initarm(struct arm64_bootparams *abp)
"msr tpidr_el1, %0" :: "r"(pcpup));
 
PCPU_SET(curthread, );
+   PCPU_SET(midr, get_midr());
 
/* Do basic tuning, hz etc */
init_param1();

Modified: head/sys/arm64/arm64/mp_machdep.c
==
--- head/sys/arm64/arm64/mp_machdep.c   Wed Jul  1 16:37:08 2020
(r362844)
+++ head/sys/arm64/arm64/mp_machdep.c   Wed Jul  1 16:57:57 2020
(r362845)
@@ -220,7 +220,7 @@ init_secondary(uint64_t cpu)
 * We need this before signalling the CPU is ready to
 * let the boot CPU use the results.
 */
-   identify_cpu();
+   identify_cpu(cpu);
 
/* Ensure the stores in identify_cpu have completed */
atomic_thread_fence_acq_rel();
@@ -229,6 +229,8 @@ init_secondary(uint64_t cpu)
atomic_add_int(_started, 1);
while (!atomic_load_int(_ready))
__asm __volatile("wfe");
+
+   pcpup->pc_midr = get_midr();
 
/* Initialize curthread */
KASSERT(PCPU_GET(idlethread) != NULL, ("no idle thread"));

Modified: head/sys/arm64/include/cpu.h
==
--- head/sys/arm64/include/cpu.hWed Jul  1 16:37:08 2020
(r362844)
+++ head/sys/arm64/include/cpu.hWed Jul  1 16:57:57 2020
(r362845)
@@ -167,11 +167,12 @@ void  cpu_halt(void) __dead2;
 void   cpu_reset(void) __dead2;
 void   fork_trampoline(void);
 void   identify_cache(uint64_t);
-void   identify_cpu(void);
+void   identify_cpu(u_int);
 void   install_cpu_errata(void);
 void   swi_vm(void *v);
 
 /* Functions to read the sanitised view of the special registers */
+void   update_special_regs(u_int);
 bool   extract_user_id_field(u_int, u_int, uint8_t *);
 bool   get_kernel_reg(u_int, uint64_t *);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r362844 - in stable/11: contrib/file contrib/file/doc contrib/file/magic contrib/file/magic/Magdir contrib/file/src lib/libmagic

2020-07-01 Thread Xin LI
Author: delphij
Date: Wed Jul  1 16:37:08 2020
New Revision: 362844
URL: https://svnweb.freebsd.org/changeset/base/362844

Log:
  MFC r362258, r362279: file 5.39
  
  Relnotes: yes

Added:
  stable/11/contrib/file/libmagic.pc.in
 - copied unchanged from r362258, head/contrib/file/libmagic.pc.in
  stable/11/contrib/file/magic/Magdir/asf
 - copied unchanged from r362258, head/contrib/file/magic/Magdir/asf
  stable/11/contrib/file/magic/Magdir/dif
 - copied unchanged from r362258, head/contrib/file/magic/Magdir/dif
  stable/11/contrib/file/magic/Magdir/sylk
 - copied unchanged from r362258, head/contrib/file/magic/Magdir/sylk
  stable/11/contrib/file/magic/Magdir/unisig
 - copied unchanged from r362258, head/contrib/file/magic/Magdir/unisig
  stable/11/contrib/file/magic/Magdir/usd
 - copied unchanged from r362258, head/contrib/file/magic/Magdir/usd
  stable/11/contrib/file/magic/Magdir/web
 - copied unchanged from r362258, head/contrib/file/magic/Magdir/web
Modified:
  stable/11/contrib/file/ChangeLog
  stable/11/contrib/file/Makefile.am
  stable/11/contrib/file/Makefile.in
  stable/11/contrib/file/configure
  stable/11/contrib/file/configure.ac
  stable/11/contrib/file/doc/file.man
  stable/11/contrib/file/doc/magic.man
  stable/11/contrib/file/magic/Magdir/animation
  stable/11/contrib/file/magic/Magdir/archive
  stable/11/contrib/file/magic/Magdir/cad
  stable/11/contrib/file/magic/Magdir/commands
  stable/11/contrib/file/magic/Magdir/compress
  stable/11/contrib/file/magic/Magdir/console
  stable/11/contrib/file/magic/Magdir/database
  stable/11/contrib/file/magic/Magdir/der
  stable/11/contrib/file/magic/Magdir/elf
  stable/11/contrib/file/magic/Magdir/filesystems
  stable/11/contrib/file/magic/Magdir/games
  stable/11/contrib/file/magic/Magdir/gnu
  stable/11/contrib/file/magic/Magdir/images
  stable/11/contrib/file/magic/Magdir/intel
  stable/11/contrib/file/magic/Magdir/kicad
  stable/11/contrib/file/magic/Magdir/linux
  stable/11/contrib/file/magic/Magdir/msdos
  stable/11/contrib/file/magic/Magdir/ole2compounddocs
  stable/11/contrib/file/magic/Magdir/parix
  stable/11/contrib/file/magic/Magdir/pascal
  stable/11/contrib/file/magic/Magdir/pdf
  stable/11/contrib/file/magic/Magdir/pgp
  stable/11/contrib/file/magic/Magdir/python
  stable/11/contrib/file/magic/Magdir/riff
  stable/11/contrib/file/magic/Magdir/rst
  stable/11/contrib/file/magic/Magdir/rtf
  stable/11/contrib/file/magic/Magdir/sgml
  stable/11/contrib/file/magic/Magdir/sniffer
  stable/11/contrib/file/magic/Magdir/ssh
  stable/11/contrib/file/magic/Magdir/ti-8x
  stable/11/contrib/file/magic/Magdir/tplink
  stable/11/contrib/file/magic/Magdir/troff
  stable/11/contrib/file/magic/Magdir/virtual
  stable/11/contrib/file/magic/Magdir/windows
  stable/11/contrib/file/magic/Magdir/wordprocessors
  stable/11/contrib/file/magic/Magdir/zip
  stable/11/contrib/file/magic/Makefile.am
  stable/11/contrib/file/magic/Makefile.in
  stable/11/contrib/file/src/apprentice.c
  stable/11/contrib/file/src/ascmagic.c
  stable/11/contrib/file/src/buffer.c
  stable/11/contrib/file/src/compress.c
  stable/11/contrib/file/src/der.c
  stable/11/contrib/file/src/file.c
  stable/11/contrib/file/src/file.h
  stable/11/contrib/file/src/file_opts.h
  stable/11/contrib/file/src/funcs.c
  stable/11/contrib/file/src/is_json.c
  stable/11/contrib/file/src/magic.c
  stable/11/contrib/file/src/print.c
  stable/11/contrib/file/src/readelf.c
  stable/11/contrib/file/src/seccomp.c
  stable/11/contrib/file/src/softmagic.c
  stable/11/lib/libmagic/Makefile
  stable/11/lib/libmagic/config.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/file/ChangeLog
==
--- stable/11/contrib/file/ChangeLogWed Jul  1 16:33:32 2020
(r362843)
+++ stable/11/contrib/file/ChangeLogWed Jul  1 16:37:08 2020
(r362844)
@@ -1,3 +1,83 @@
+2020-06-14  20:02  Christos Zoulas 
+
+   * release 5.39
+
+2020-06-07  20:00  Christos Zoulas 
+
+   * Remove unused subtype_mime (Steve Grubb)
+   * Remove unused check in okstat (Steve Grubb)
+   * Fix mime-type in elf binaries by making sure $x is set
+   * Fix indirect negative offsets broken by OFFNEGATIVE
+   * Fix GUID equality check
+   * PR/165: Handle empty array and strings in JSON
+   * PR/162: Add --exclude-quiet
+
+2020-06-06  15:33  Christos Zoulas 
+
+   * Fix memory leak in ascmagic (Steve Grubb)
+
+2020-06-04  00:21  Christos Zoulas 
+
+   * Fix string comparison length with ignore whitespace
+
+2020-05-31  00:11  Christos Zoulas 
+
+   * Fix mingwin 64 compilation
+
+2020-05-30  23:56  Christos Zoulas 
+
+   * PR/159: whitelist getpid needed for file_pipe2file()
+
+2020-05-09  18:57  Christos Zoulas 
+
+   * Indicate negative offsets with a flag OFFNEGATIVE
+ so that -0 works.
+   * Introduce "offset" magic type that can be 

svn commit: r362843 - head/usr.bin/printf

2020-07-01 Thread Fernando Apesteguía
Author: fernape (ports committer)
Date: Wed Jul  1 16:33:32 2020
New Revision: 362843
URL: https://svnweb.freebsd.org/changeset/base/362843

Log:
  printf(1): Add EXAMPLES section
  
   * Small addition with four simple examples
   * While here, remove three obsolete .Tn macros
  
  Approved by:  manpages (gbe)
  Differential Revision:https://reviews.freebsd.org/D25462

Modified:
  head/usr.bin/printf/printf.1

Modified: head/usr.bin/printf/printf.1
==
--- head/usr.bin/printf/printf.1Wed Jul  1 16:18:35 2020
(r362842)
+++ head/usr.bin/printf/printf.1Wed Jul  1 16:33:32 2020
(r362843)
@@ -31,7 +31,7 @@
 .\"@(#)printf.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd July 29, 2019
+.Dd July 1, 2020
 .Dt PRINTF 1
 .Os
 .Sh NAME
@@ -316,12 +316,48 @@ Consult the
 manual page.
 .Sh EXIT STATUS
 .Ex -std
+.Sh EXAMPLES
+Print the string
+.Qq hello :
+.Bd -literal -offset indent
+$ printf "%s\en" hello
+hello
+.Ed
+.Pp
+Same as above, but notice that the format string is not quoted and hence we
+do not get the expected behavior:
+.Bd -literal -offset indent
+$ printf %s\en hello
+hellon$
+.Ed
+.Pp
+Print arguments forcing sign only for the first argument:
+.Bd -literal -offset indent
+$ printf "%+d\en%d\en%d\en" 1 -2 13
++1
+-2
+13
+.Ed
+.Pp
+Same as above, but the single format string will be applied to the three
+arguments:
+.Bd -literal -offset indent
+$ printf "%+d\en" 1 -2 13
++1
+-2
++13
+.Ed
+.Pp
+Print number using only two digits after the decimal point:
+.Bd -literal -offset indent
+$ printf "%.2f\en" 31.7456
+31.75
+.Ed
 .Sh COMPATIBILITY
 The traditional
 .Bx
 behavior of converting arguments of numeric formats not beginning
-with a digit to the
-.Tn ASCII
+with a digit to the ASCII
 code of the first character is not supported.
 .Sh SEE ALSO
 .Xr builtin 1 ,
@@ -343,8 +379,7 @@ It is modeled
 after the standard library function,
 .Xr printf 3 .
 .Sh CAVEATS
-.Tn ANSI
-hexadecimal character constants were deliberately not provided.
+ANSI hexadecimal character constants were deliberately not provided.
 .Pp
 Trying to print a dash ("-") as the first character causes
 .Nm
@@ -364,10 +399,8 @@ and
 formats with a precision
 may not operate as expected.
 .Sh BUGS
-Since the floating point numbers are translated from
-.Tn ASCII
-to floating-point and
-then back again, floating-point precision may be lost.
+Since the floating point numbers are translated from ASCII
+to floating-point and then back again, floating-point precision may be lost.
 (By default, the number is translated to an IEEE-754 double-precision
 value before being printed.
 The
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r362842 - in stable/12: contrib/file contrib/file/doc contrib/file/magic contrib/file/magic/Magdir contrib/file/src lib/libmagic

2020-07-01 Thread Xin LI
Author: delphij
Date: Wed Jul  1 16:18:35 2020
New Revision: 362842
URL: https://svnweb.freebsd.org/changeset/base/362842

Log:
  MFC r362258, r362279: file 5.39
  
  Relnotes: yes

Added:
  stable/12/contrib/file/libmagic.pc.in
 - copied unchanged from r362258, head/contrib/file/libmagic.pc.in
  stable/12/contrib/file/magic/Magdir/asf
 - copied unchanged from r362258, head/contrib/file/magic/Magdir/asf
  stable/12/contrib/file/magic/Magdir/dif
 - copied unchanged from r362258, head/contrib/file/magic/Magdir/dif
  stable/12/contrib/file/magic/Magdir/sylk
 - copied unchanged from r362258, head/contrib/file/magic/Magdir/sylk
  stable/12/contrib/file/magic/Magdir/unisig
 - copied unchanged from r362258, head/contrib/file/magic/Magdir/unisig
  stable/12/contrib/file/magic/Magdir/usd
 - copied unchanged from r362258, head/contrib/file/magic/Magdir/usd
  stable/12/contrib/file/magic/Magdir/web
 - copied unchanged from r362258, head/contrib/file/magic/Magdir/web
Modified:
  stable/12/contrib/file/ChangeLog
  stable/12/contrib/file/Makefile.am
  stable/12/contrib/file/Makefile.in
  stable/12/contrib/file/configure
  stable/12/contrib/file/configure.ac
  stable/12/contrib/file/doc/file.man
  stable/12/contrib/file/doc/magic.man
  stable/12/contrib/file/magic/Magdir/animation
  stable/12/contrib/file/magic/Magdir/archive
  stable/12/contrib/file/magic/Magdir/cad
  stable/12/contrib/file/magic/Magdir/commands
  stable/12/contrib/file/magic/Magdir/compress
  stable/12/contrib/file/magic/Magdir/console
  stable/12/contrib/file/magic/Magdir/database
  stable/12/contrib/file/magic/Magdir/der
  stable/12/contrib/file/magic/Magdir/elf
  stable/12/contrib/file/magic/Magdir/filesystems
  stable/12/contrib/file/magic/Magdir/games
  stable/12/contrib/file/magic/Magdir/gnu
  stable/12/contrib/file/magic/Magdir/images
  stable/12/contrib/file/magic/Magdir/intel
  stable/12/contrib/file/magic/Magdir/kicad
  stable/12/contrib/file/magic/Magdir/linux
  stable/12/contrib/file/magic/Magdir/msdos
  stable/12/contrib/file/magic/Magdir/ole2compounddocs
  stable/12/contrib/file/magic/Magdir/parix
  stable/12/contrib/file/magic/Magdir/pascal
  stable/12/contrib/file/magic/Magdir/pdf
  stable/12/contrib/file/magic/Magdir/pgp
  stable/12/contrib/file/magic/Magdir/python
  stable/12/contrib/file/magic/Magdir/riff
  stable/12/contrib/file/magic/Magdir/rst
  stable/12/contrib/file/magic/Magdir/rtf
  stable/12/contrib/file/magic/Magdir/sgml
  stable/12/contrib/file/magic/Magdir/sniffer
  stable/12/contrib/file/magic/Magdir/ssh
  stable/12/contrib/file/magic/Magdir/ti-8x
  stable/12/contrib/file/magic/Magdir/tplink
  stable/12/contrib/file/magic/Magdir/troff
  stable/12/contrib/file/magic/Magdir/virtual
  stable/12/contrib/file/magic/Magdir/windows
  stable/12/contrib/file/magic/Magdir/wordprocessors
  stable/12/contrib/file/magic/Magdir/zip
  stable/12/contrib/file/magic/Makefile.am
  stable/12/contrib/file/magic/Makefile.in
  stable/12/contrib/file/src/apprentice.c
  stable/12/contrib/file/src/ascmagic.c
  stable/12/contrib/file/src/buffer.c
  stable/12/contrib/file/src/compress.c
  stable/12/contrib/file/src/der.c
  stable/12/contrib/file/src/file.c
  stable/12/contrib/file/src/file.h
  stable/12/contrib/file/src/file_opts.h
  stable/12/contrib/file/src/funcs.c
  stable/12/contrib/file/src/is_json.c
  stable/12/contrib/file/src/magic.c
  stable/12/contrib/file/src/print.c
  stable/12/contrib/file/src/readelf.c
  stable/12/contrib/file/src/seccomp.c
  stable/12/contrib/file/src/softmagic.c
  stable/12/lib/libmagic/Makefile
  stable/12/lib/libmagic/config.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/contrib/file/ChangeLog
==
--- stable/12/contrib/file/ChangeLogWed Jul  1 16:17:51 2020
(r362841)
+++ stable/12/contrib/file/ChangeLogWed Jul  1 16:18:35 2020
(r362842)
@@ -1,3 +1,83 @@
+2020-06-14  20:02  Christos Zoulas 
+
+   * release 5.39
+
+2020-06-07  20:00  Christos Zoulas 
+
+   * Remove unused subtype_mime (Steve Grubb)
+   * Remove unused check in okstat (Steve Grubb)
+   * Fix mime-type in elf binaries by making sure $x is set
+   * Fix indirect negative offsets broken by OFFNEGATIVE
+   * Fix GUID equality check
+   * PR/165: Handle empty array and strings in JSON
+   * PR/162: Add --exclude-quiet
+
+2020-06-06  15:33  Christos Zoulas 
+
+   * Fix memory leak in ascmagic (Steve Grubb)
+
+2020-06-04  00:21  Christos Zoulas 
+
+   * Fix string comparison length with ignore whitespace
+
+2020-05-31  00:11  Christos Zoulas 
+
+   * Fix mingwin 64 compilation
+
+2020-05-30  23:56  Christos Zoulas 
+
+   * PR/159: whitelist getpid needed for file_pipe2file()
+
+2020-05-09  18:57  Christos Zoulas 
+
+   * Indicate negative offsets with a flag OFFNEGATIVE
+ so that -0 works.
+   * Introduce "offset" magic type that can be 

svn commit: r362841 - head/sys/arm64/include

2020-07-01 Thread Andrew Turner
Author: andrew
Date: Wed Jul  1 16:17:51 2020
New Revision: 362841
URL: https://svnweb.freebsd.org/changeset/base/362841

Log:
  Move ID reading signatures to a better header
  
  The functions to read the common user and kernel ID registers should be
  in cpu.h rather than undefined.h as they are related to CPU details and
  used by undefined instruction handlers.
  
  Sponsored by: Innovate UK

Modified:
  head/sys/arm64/include/cpu.h
  head/sys/arm64/include/undefined.h

Modified: head/sys/arm64/include/cpu.h
==
--- head/sys/arm64/include/cpu.hWed Jul  1 15:42:48 2020
(r362840)
+++ head/sys/arm64/include/cpu.hWed Jul  1 16:17:51 2020
(r362841)
@@ -171,6 +171,10 @@ void   identify_cpu(void);
 void   install_cpu_errata(void);
 void   swi_vm(void *v);
 
+/* Functions to read the sanitised view of the special registers */
+bool   extract_user_id_field(u_int, u_int, uint8_t *);
+bool   get_kernel_reg(u_int, uint64_t *);
+
 #defineCPU_AFFINITY(cpu)   __cpu_affinity[(cpu)]
 #defineCPU_CURRENT_SOCKET  \
 (CPU_AFF2(CPU_AFFINITY(PCPU_GET(cpuid

Modified: head/sys/arm64/include/undefined.h
==
--- head/sys/arm64/include/undefined.h  Wed Jul  1 15:42:48 2020
(r362840)
+++ head/sys/arm64/include/undefined.h  Wed Jul  1 16:17:51 2020
(r362841)
@@ -63,10 +63,6 @@ void *install_undef_handler(bool, undef_handler_t);
 void remove_undef_handler(void *);
 int undef_insn(u_int, struct trapframe *);
 
-/* Functions to read the sanitised view of the special registers */
-bool extract_user_id_field(u_int, u_int, uint8_t *);
-bool get_kernel_reg(u_int, uint64_t *);
-
 #endif /* _KERNEL */
 
 #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: r362840 - head/sys/netinet

2020-07-01 Thread Mark Johnston
Author: markj
Date: Wed Jul  1 15:42:48 2020
New Revision: 362840
URL: https://svnweb.freebsd.org/changeset/base/362840

Log:
  Fix a possible next-hop refcount leak when handling IPSec traffic.
  
  It may be possible to fix this by deferring the lookup, but let's
  keep the initial change simple to make MFCs easier.
  
  PR:   246951
  Reviewed by:  melifaro
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D25519

Modified:
  head/sys/netinet/ip_input.c

Modified: head/sys/netinet/ip_input.c
==
--- head/sys/netinet/ip_input.c Wed Jul  1 15:30:27 2020(r362839)
+++ head/sys/netinet/ip_input.c Wed Jul  1 15:42:48 2020(r362840)
@@ -1028,6 +1028,7 @@ ip_forward(struct mbuf *m, int srcrt)
if (IPSEC_ENABLED(ipv4)) {
if ((error = IPSEC_FORWARD(ipv4, m)) != 0) {
/* mbuf consumed by IPsec */
+   RO_NHFREE();
m_freem(mcopy);
if (error != EINPROGRESS)
IPSTAT_INC(ips_cantforward);
___
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: r362839 - head/share/misc

2020-07-01 Thread Muhammad Moinur Rahman
Author: bofh (ports committer)
Date: Wed Jul  1 15:30:27 2020
New Revision: 362839
URL: https://svnweb.freebsd.org/changeset/base/362839

Log:
  Update with the members of the 11th core team, core.xi
  - Update the core-secretary role.
  - Update the comment to mention that the sorting is done based on FreeBSD
login name
  
  Reported by:  bofh (with core-secretary@ hat on)
  Reviewed by:  bcr
  Approved by:  bcr
  Differential Revision:https://reviews.freebsd.org/D25526

Modified:
  head/share/misc/organization.dot

Modified: head/share/misc/organization.dot
==
--- head/share/misc/organization.dotWed Jul  1 15:27:34 2020
(r362838)
+++ head/share/misc/organization.dotWed Jul  1 15:30:27 2020
(r362839)
@@ -23,10 +23,10 @@ _devel [label="FreeBSD Developers"]
 _admin [label="FreeBSD Infrastructure Administrators"]
 _misc [label="Miscellaneous Hats"]
 
-# Development teams go here alphabetically sorted
+# Development teams go here alphabetically sorted by FreeBSD login name
 
-core [label="Core Team\nc...@freebsd.org\nallanjude, bcr, brooks,\nimp, hrs, 
jeff,\njhb, kmoore, seanc"]
-coresecretary [label="Core Team Secretary\ncore-secret...@freebsd.org\njrm"]
+core [label="Core Team\nc...@freebsd.org\nbapt, emaste, gnn,\nimp, hrs, 
kevans,\nmarkj, scottl, seanc"]
+coresecretary [label="Core Team Secretary\ncore-secret...@freebsd.org\nbofh"]
 doccommitters [label="Doc/www Committers\ndoc-committ...@freebsd.org"]
 doceng [label="Documentation Engineering Team\ndoc...@freebsd.org\nbcr, gabor, 
gjb, hrs,\nblackend, ryusuke, wblock"]
 portscommitters [label="Ports Committers\nports-committ...@freebsd.org"]
___
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: r362838 - stable/12/sys/kern

2020-07-01 Thread Mark Johnston
Author: markj
Date: Wed Jul  1 15:27:34 2020
New Revision: 362838
URL: https://svnweb.freebsd.org/changeset/base/362838

Log:
  MFC r362789 (by gallatin):
  Fix a panic when unloading firmware

Modified:
  stable/12/sys/kern/subr_firmware.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/subr_firmware.c
==
--- stable/12/sys/kern/subr_firmware.c  Wed Jul  1 15:17:45 2020
(r362837)
+++ stable/12/sys/kern/subr_firmware.c  Wed Jul  1 15:27:34 2020
(r362838)
@@ -394,14 +394,12 @@ EVENTHANDLER_DEFINE(mountroot, firmware_mountroot, NUL
 static void
 unloadentry(void *unused1, int unused2)
 {
-   struct priv_fw *fp, *tmp;
+   struct priv_fw *fp;
int err;
-   bool changed;
 
mtx_lock(_mtx);
-   changed = false;
 restart:
-   LIST_FOREACH_SAFE(fp, _table, link, tmp) {
+   LIST_FOREACH(fp, _table, link) {
if (fp->file == NULL || fp->refcnt != 0 ||
(fp->flags & FW_UNLOAD) == 0)
continue;
@@ -412,7 +410,6 @@ restart:
 * 2. clear FW_UNLOAD so we don't try this entry again.
 * 3. release the lock while trying to unload the module.
 */
-   changed = true;
fp->flags &= ~FW_UNLOAD;/* do not try again */
 
/*
@@ -422,9 +419,11 @@ restart:
mtx_unlock(_mtx);
err = linker_release_module(NULL, NULL, fp->file);
mtx_lock(_mtx);
-   }
-   if (changed) {
-   changed = false;
+
+   /*
+* When we dropped the lock, another thread could have
+* removed an element, so we must restart the scan.
+*/
goto restart;
}
mtx_unlock(_mtx);
___
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: r362837 - head/sys/arm64/arm64

2020-07-01 Thread Andrew Turner
Author: andrew
Date: Wed Jul  1 15:17:45 2020
New Revision: 362837
URL: https://svnweb.freebsd.org/changeset/base/362837

Log:
  Read the arm64 ID registers earlier in the boot process.
  
  Also move parsing the registers to just after the secondary CPUs have
  started. This means the kernel register view from all CPUs is available
  after the CPU SYSINITs have finished, e.g. for use by ifunc resolvers.
  
  Sponsored by: Innovate UK
  Differential Revision:https://reviews.freebsd.org/D25505

Modified:
  head/sys/arm64/arm64/identcpu.c
  head/sys/arm64/arm64/mp_machdep.c

Modified: head/sys/arm64/arm64/identcpu.c
==
--- head/sys/arm64/arm64/identcpu.c Wed Jul  1 15:02:56 2020
(r362836)
+++ head/sys/arm64/arm64/identcpu.c Wed Jul  1 15:17:45 2020
(r362837)
@@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-static int ident_lock;
 static void print_cpu_features(u_int cpu);
 static u_long parse_cpu_features_hwcap(u_int cpu);
 
@@ -67,6 +66,8 @@ static int allow_idc = 1;
 SYSCTL_INT(_machdep_cache, OID_AUTO, allow_idc, CTLFLAG_RDTUN, _idc, 0,
 "Allow optimizations based on the IDC cache bit");
 
+static void check_cpu_regs(u_int cpu);
+
 /*
  * The default implementation of I-cache sync assumes we have an
  * aliasing cache until we know otherwise.
@@ -1063,8 +1064,9 @@ identify_cpu_sysinit(void *dummy __unused)
 
dic = (allow_dic != 0);
idc = (allow_idc != 0);
+
CPU_FOREACH(cpu) {
-   print_cpu_features(cpu);
+   check_cpu_regs(cpu);
hwcap = parse_cpu_features_hwcap(cpu);
if (elf_hwcap == 0)
elf_hwcap = hwcap;
@@ -1096,8 +1098,18 @@ identify_cpu_sysinit(void *dummy __unused)
 
install_undef_handler(true, user_mrs_handler);
 }
-SYSINIT(identify_cpu, SI_SUB_SMP, SI_ORDER_ANY, identify_cpu_sysinit, NULL);
+SYSINIT(identify_cpu, SI_SUB_CPU, SI_ORDER_ANY, identify_cpu_sysinit, NULL);
 
+static void
+cpu_features_sysinit(void *dummy __unused)
+{
+   u_int cpu;
+
+   CPU_FOREACH(cpu)
+   print_cpu_features(cpu);
+}
+SYSINIT(cpu_features, SI_SUB_SMP, SI_ORDER_ANY, cpu_features_sysinit, NULL);
+
 static u_long
 parse_cpu_features_hwcap(u_int cpu)
 {
@@ -1468,7 +1480,8 @@ identify_cpu(void)
if (impl_id == cpu_implementers[i].impl_id ||
cpu_implementers[i].impl_id == 0) {
cpu_desc[cpu].cpu_impl = impl_id;
-   cpu_desc[cpu].cpu_impl_name = 
cpu_implementers[i].impl_name;
+   cpu_desc[cpu].cpu_impl_name =
+   cpu_implementers[i].impl_name;
cpu_partsp = cpu_implementers[i].cpu_parts;
break;
}
@@ -1505,77 +1518,68 @@ identify_cpu(void)
cpu_desc[cpu].id_aa64mmfr2 = READ_SPECIALREG(id_aa64mmfr2_el1);
cpu_desc[cpu].id_aa64pfr0 = READ_SPECIALREG(id_aa64pfr0_el1);
cpu_desc[cpu].id_aa64pfr1 = READ_SPECIALREG(id_aa64pfr1_el1);
+}
 
-   if (cpu != 0) {
-   /*
-* This code must run on one cpu at a time, but we are
-* not scheduling on the current core so implement a
-* simple spinlock.
-*/
-   while (atomic_cmpset_acq_int(_lock, 0, 1) == 0)
-   __asm __volatile("wfe" ::: "memory");
+static void
+check_cpu_regs(u_int cpu)
+{
 
-   switch (cpu_aff_levels) {
-   case 0:
-   if (CPU_AFF0(cpu_desc[cpu].mpidr) !=
-   CPU_AFF0(cpu_desc[0].mpidr))
-   cpu_aff_levels = 1;
-   /* FALLTHROUGH */
-   case 1:
-   if (CPU_AFF1(cpu_desc[cpu].mpidr) !=
-   CPU_AFF1(cpu_desc[0].mpidr))
-   cpu_aff_levels = 2;
-   /* FALLTHROUGH */
-   case 2:
-   if (CPU_AFF2(cpu_desc[cpu].mpidr) !=
-   CPU_AFF2(cpu_desc[0].mpidr))
-   cpu_aff_levels = 3;
-   /* FALLTHROUGH */
-   case 3:
-   if (CPU_AFF3(cpu_desc[cpu].mpidr) !=
-   CPU_AFF3(cpu_desc[0].mpidr))
-   cpu_aff_levels = 4;
-   break;
-   }
+   switch (cpu_aff_levels) {
+   case 0:
+   if (CPU_AFF0(cpu_desc[cpu].mpidr) !=
+   CPU_AFF0(cpu_desc[0].mpidr))
+   cpu_aff_levels = 1;
+   /* FALLTHROUGH */
+   case 1:
+   if (CPU_AFF1(cpu_desc[cpu].mpidr) !=
+   CPU_AFF1(cpu_desc[0].mpidr))
+   cpu_aff_levels = 2;
+   /* FALLTHROUGH */
+   case 2:
+   if 

svn commit: r362836 - stable/12/sys/netpfil/ipfw

2020-07-01 Thread Mark Johnston
Author: markj
Date: Wed Jul  1 15:02:56 2020
New Revision: 362836
URL: https://svnweb.freebsd.org/changeset/base/362836

Log:
  MFC r362585:
  ipfw(4): make O_IPVER/ipversion match IPv4 or 6, not just IPv4.

Modified:
  stable/12/sys/netpfil/ipfw/ip_fw2.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netpfil/ipfw/ip_fw2.c
==
--- stable/12/sys/netpfil/ipfw/ip_fw2.c Wed Jul  1 15:00:03 2020
(r362835)
+++ stable/12/sys/netpfil/ipfw/ip_fw2.c Wed Jul  1 15:02:56 2020
(r362836)
@@ -2187,7 +2187,7 @@ do {  \
break;
 
case O_IPVER:
-   match = (is_ipv4 &&
+   match = ((is_ipv4 || is_ipv6) &&
cmd->arg1 == ip->ip_v);
break;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r362835 - stable/12/sbin/ipfw

2020-07-01 Thread Mark Johnston
Author: markj
Date: Wed Jul  1 15:00:03 2020
New Revision: 362835
URL: https://svnweb.freebsd.org/changeset/base/362835

Log:
  MFC r362582:
  ipfw(8): In fill_ip6(), use a single statement for both "me" and "me6".

Modified:
  stable/12/sbin/ipfw/ipv6.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/ipfw/ipv6.c
==
--- stable/12/sbin/ipfw/ipv6.c  Wed Jul  1 12:07:28 2020(r362834)
+++ stable/12/sbin/ipfw/ipv6.c  Wed Jul  1 15:00:03 2020(r362835)
@@ -342,13 +342,8 @@ fill_ip6(ipfw_insn_ip6 *cmd, char *av, int cblen, stru
if (strcmp(av, "any") == 0)
return (1);
 
-
-   if (strcmp(av, "me") == 0) {/* Set the data for "me" opt*/
-   cmd->o.len |= F_INSN_SIZE(ipfw_insn);
-   return (1);
-   }
-
-   if (strcmp(av, "me6") == 0) {   /* Set the data for "me" opt*/
+   /* Set the data for "me" opt */
+   if (strcmp(av, "me") == 0 || strcmp(av, "me6") == 0) {
cmd->o.len |= F_INSN_SIZE(ipfw_insn);
return (1);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r362809 - head/contrib/mandoc

2020-07-01 Thread Rodney W. Grimes
> On Tue, Jun 30, 2020 at 03:56:17PM -0700, Rodney W. Grimes wrote:
> > [ Charset UTF-8 unsupported, converting... ]
> > > Author: gbe (doc committer)
> > > Date: Tue Jun 30 18:08:59 2020
> > > New Revision: 362809
> > > URL: https://svnweb.freebsd.org/changeset/base/362809
> > > 
> > > Log:
> > >   Mention FreeBSD in the HISTORY sections of apropos(1) and makewhatis(8).
> > >   
> > >   PR: 223520, 223521
> > >   Reviewed by:bcr (mentor)
> > >   Approved by:bcr (mentor)
> > >   Differential Revision:  https://reviews.freebsd.org/D25521
> > > 
> > > Modified:
> > >   head/contrib/mandoc/apropos.1
> > >   head/contrib/mandoc/makewhatis.8
> > > 
> > > Modified: head/contrib/mandoc/apropos.1
> > > ==
> > > --- head/contrib/mandoc/apropos.1 Tue Jun 30 17:21:28 2020
> > > (r362808)
> > > +++ head/contrib/mandoc/apropos.1 Tue Jun 30 18:08:59 2020
> > > (r362809)
> > > @@ -15,7 +15,7 @@
> > >  .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 
> > > OF
> > >  .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> > >  .\"
> > > -.Dd $Mdocdate: November 22 2018 $
> > > +.Dd $Mdocdate: June 30 2020 $
> > >  .Dt APROPOS 1
> > >  .Os
> > >  .Sh NAME
> > > @@ -493,6 +493,12 @@ The options
> > >  .Fl acfhIKklOTWw
> > >  appeared in
> > >  .Ox 5.7 .
> > > +.Pp
> > > +The
> > > +.Nm
> > > +utility was integrated into
> > > +.Fx 11.1
> > > +as part of the switch to mandoc.
> > 
> > Huh?  FreeBSD has had apropos since 1.0 and my 5.4 system clearly has it:
> > freebsd {110}% uname -a
> > FreeBSD pdx.rh.CN85.dnsmgr.net 5.4-RELEASE-p8 FreeBSD 5.4-RELEASE-p8 #1: 
> > Mon Jul  1 17:58:50 PDT 2019 
> > r...@pdx.rh.cn85.dnsmgr.net:/usr/src/sys/i386/compile/PDXMXPIE  i386
> > pdx.rh.CN85.dnsmgr.net:freebsd {111}% which apropos
> > /usr/bin/apropos
> > 
> > And a man page for it too:
> > APROPOS(1)  FreeBSD General Commands Manual 
> > APROPOS(1)
> > 
> > NAME
> >  apropos, whatis -- search the whatis database
> > 
> > SYNOPSIS
> >  apropos keyword ...
> >  whatis keyword ...
> > 
> > DESCRIPTION
> >  apropos searches a set of database files containing short descriptions 
> > of
> >  system commands for keywords and displays the result on the standard 
> > out-
> >  put.  whatis displays only complete word matches.
> > 
> >  keyword really is an extended regular expression, please read grep(1)
> >  manual page for more information about its format.
> > 
> > DIAGNOSTICS
> >  The apropos utility exits 0 on success, and 1 if no keyword matched.
> > 
> > SEE ALSO
> >  grep(1), makewhatis(1), man(1)
> > 
> > FreeBSD 5.4January 15, 1991FreeBSD 
> > 5.4
> > 
> > >  .Sh AUTHORS
> > >  .An -nosplit
> > >  .An Bill Joy
> > > 
> 
> That is true, but the version of 'apropos' we have currently in base is based 
> on mandoc,
> which was imported around September 2018. Due to the nature of contributed 
> code I 
> thought it would be best to document only the history when it was integrated 
> into
> FreeSBD. The same applies for 'makewhatis'.

That is not what has been done in other places when code is changed/replaced,
the HISTORY section is not specific to "FreeBSD's version" of this function.

We often have "An ls command appeared in Version 1 AT UNIX."  Our source
code and man page is not from that, but that is the history of ls.

This *could* be amended and *should* be amended to reflect that apropos,
and makewhatis got *updated* by a switch to the mandoc versions, but it
is misleading to say it was intergrated with the switch to mandoc as that
implies it did not exist before this action.

> 
> > > Modified: head/contrib/mandoc/makewhatis.8
> > > ==
> > > --- head/contrib/mandoc/makewhatis.8  Tue Jun 30 17:21:28 2020
> > > (r362808)
> > > +++ head/contrib/mandoc/makewhatis.8  Tue Jun 30 18:08:59 2020
> > > (r362809)
> > > @@ -15,7 +15,7 @@
> > >  .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 
> > > OF
> > >  .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> > >  .\"
> > > -.Dd $Mdocdate: May 17 2017 $
> > > +.Dd $Mdocdate: June 30 2020 $
> > >  .Dt MAKEWHATIS 8
> > >  .Os
> > >  .Sh NAME
> > > @@ -211,6 +211,12 @@ and the options
> > >  .Fl aCDnQT
> > >  in
> > >  .Ox 5.6 .
> > > +.Pp
> > > +The
> > > +.Nm
> > > +utility was integrated into
> > > +.Fx 11.1
> > > +as part of the switch to mandoc.
> > 
> > Ditto
> > 
> > >  .Sh AUTHORS
> > >  .An -nosplit
> > >  .An Bill Joy
> 
> --Gordon
> 

-- 
Rod Grimes rgri...@freebsd.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to 

Re: svn commit: r362736 - head/sys/arm64/rockchip

2020-07-01 Thread Peter Jeremy
On 2020-Jul-01 18:57:47 +1000, Peter Jeremy  wrote:
>On 2020-Jun-28 21:11:10 +, Oleksandr Tymoshenko  wrote:
>>Log:
>>  Configure rx_delay/tx_delay values for RK3399/RK3328 GMAC
>>  
>>  For 1000Mb mode to work reliably TX/RX delays need to be configured
>>  between the TX/RX clock and the respective signals on the PHY
>>  to compensate for differing trace lengths on the PCB.
>
>This breaks (at least) diskless booting on my Rock64.

I've studied the RK3328 TRM[1] and the RK3328 code following r362736
matches[2] the GRF_MAC_CON0/1 documentation on p201-203 (though p574
says the delay line is configured via GRF_SOC_CON3 - which doesn't
match the documentation on GRF_SOC_CON3 on p175-177).  That suggests
that the delay values in the FDT are incorrect.  Unfortunately, the
TRM doesn't include any details on how to configure the delay values
so it's difficult to adjust the numbers in the FDT.

One possible explanation I have is that there are (at least) 2
different Rock64 variants.  Later versions have increased the RGMII
bus voltage to improve GigE reliability.  I initially had problems
with GigE reliability and mod'd my Rock64[3] to use the higher RGMII
bus voltage - which made it rock solid at GigE.  It's possible that
different variants need different delay values, due to different track
skew or different driver behaviour at different bus voltages.

[1] Rockchip_RK3328TRM_V1.1-Part1-20170321.pdf
[2] There's one typo: RK3328_GRF_MAC_CON0_TX_MASK instead of
RK3328_GRF_MAC_CON0_RX_MASK but the values are the same).
[3] Move 1 resistor to change a pull-up to a pull-down

-- 
Peter Jeremy


signature.asc
Description: PGP signature


svn commit: r362834 - head/sys/kern

2020-07-01 Thread Andrew Turner
Author: andrew
Date: Wed Jul  1 12:07:28 2020
New Revision: 362834
URL: https://svnweb.freebsd.org/changeset/base/362834

Log:
  Simplify the flow when getting/setting an isrc
  
  Rather than unlocking and returning we can just perform the needed action
  only when the interrupt source is valid and reuse the unlock in both the
  valid irq and invalid irq cases.
  
  Sponsored by: Innovate UK

Modified:
  head/sys/kern/subr_intr.c

Modified: head/sys/kern/subr_intr.c
==
--- head/sys/kern/subr_intr.c   Wed Jul  1 10:37:08 2020(r362833)
+++ head/sys/kern/subr_intr.c   Wed Jul  1 12:07:28 2020(r362834)
@@ -1517,13 +1517,12 @@ intr_map_get_isrc(u_int res_id)
 {
struct intr_irqsrc *isrc;
 
+   isrc = NULL;
mtx_lock(_map_lock);
-   if ((res_id >= irq_map_count) || (irq_map[res_id] == NULL)) {
-   mtx_unlock(_map_lock);
-   return (NULL);
-   }
-   isrc = irq_map[res_id]->isrc;
+   if (res_id < irq_map_count && irq_map[res_id] != NULL)
+   isrc = irq_map[res_id]->isrc;
mtx_unlock(_map_lock);
+
return (isrc);
 }
 
@@ -1532,11 +1531,8 @@ intr_map_set_isrc(u_int res_id, struct intr_irqsrc *is
 {
 
mtx_lock(_map_lock);
-   if ((res_id >= irq_map_count) || (irq_map[res_id] == NULL)) {
-   mtx_unlock(_map_lock);
-   return;
-   }
-   irq_map[res_id]->isrc = isrc;
+   if (res_id < irq_map_count && irq_map[res_id] != NULL)
+   irq_map[res_id]->isrc = isrc;
mtx_unlock(_map_lock);
 }
 
___
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: r362829 - head/sys/compat/linuxkpi/common/src

2020-07-01 Thread Konstantin Belousov
On Wed, Jul 01, 2020 at 12:56:12PM +0200, Hans Petter Selasky wrote:
> On 2020-07-01 12:30, Konstantin Belousov wrote:
> > I see no point in repeating the same pfind/tdfind calls, better to convert
> > them to pget(), and have this code in one intended place.
> 
> I wonder if we can convert all cases in linux_current.c to use pget(). Could
> you have a look too?

Other uses in linux_current.c are not suitable for pget().  In case
linux_pid_task()/linux_get_pid_task() were passed a tid instead of pid,
current code returns lkpi_task for the specified thread.  In other words,
if using pget(), we would need to find the thread after the call, which
makes no sense.

On the other hand, there are at least two aspects that can be improved.
First, the functions are too similar to require separating body.  Second,
distinction between pid and tid is static and if we are passed pid, it
makes no sense to call tdfind() on it.

https://reviews.freebsd.org/D25534
___
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: r362829 - head/sys/compat/linuxkpi/common/src

2020-07-01 Thread Hans Petter Selasky

On 2020-07-01 12:30, Konstantin Belousov wrote:

I see no point in repeating the same pfind/tdfind calls, better to convert
them to pget(), and have this code in one intended place.


I wonder if we can convert all cases in linux_current.c to use pget(). 
Could you have a look too?


--HPS
___
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: r362833 - head/sys/compat/linux

2020-07-01 Thread Edward Tomasz Napierala
Author: trasz
Date: Wed Jul  1 10:37:08 2020
New Revision: 362833
URL: https://svnweb.freebsd.org/changeset/base/362833

Log:
  Rework linux accept(2).  This makes the code flow easier to follow,
  and fixes a bug where calling accept(2) could result in closing fd 0.
  
  Note that the code still contains a number of problems: it makes
  assumptions about l_sockaddr_in being the same as sockaddr_in,
  the EFAULT-related code looks like it doesn't work at all, and the
  socket type check is racy.  Those will be addressed later on;
  I'm trying to work in small steps to avoid breaking one thing while
  fixing another.
  
  It fixes Redis, among other things.
  
  Reviewed by:  kib
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D25461

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

Modified: head/sys/compat/linux/linux_socket.c
==
--- head/sys/compat/linux/linux_socket.cWed Jul  1 09:35:33 2020
(r362832)
+++ head/sys/compat/linux/linux_socket.cWed Jul  1 10:37:08 2020
(r362833)
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -611,17 +612,19 @@ linux_accept_common(struct thread *td, int s, l_uintpt
 {
struct l_sockaddr *lsa;
struct sockaddr *sa;
-   struct file *fp;
+   struct file *fp, *fp1;
int bflags, len;
struct socket *so;
int error, error1;
 
bflags = 0;
+   fp = NULL;
+   sa = NULL;
+
error = linux_set_socket_flags(flags, );
if (error != 0)
return (error);
 
-   sa = NULL;
if (PTRIN(addr) == NULL) {
len = 0;
error = kern_accept4(td, s, NULL, NULL, bflags, NULL);
@@ -632,48 +635,54 @@ linux_accept_common(struct thread *td, int s, l_uintpt
if (len < 0)
return (EINVAL);
error = kern_accept4(td, s, , , bflags, );
-   if (error == 0)
-   fdrop(fp, td);
}
 
+   /*
+* Translate errno values into ones used by Linux.
+*/
if (error != 0) {
/*
 * XXX. This is wrong, different sockaddr structures
 * have different sizes.
 */
-   if (error == EFAULT && namelen != sizeof(struct sockaddr_in))
-   {
-   error = EINVAL;
-   goto out;
-   }
-   if (error == EINVAL) {
-   error1 = getsock_cap(td, s, _accept_rights, , 
NULL, NULL);
+   switch (error) {
+   case EFAULT:
+   if (namelen != sizeof(struct sockaddr_in))
+   error = EINVAL;
+   break;
+   case EINVAL:
+   error1 = getsock_cap(td, s, _accept_rights, , 
NULL, NULL);
if (error1 != 0) {
error = error1;
-   goto out;
+   break;
}
-   so = fp->f_data;
+   so = fp1->f_data;
if (so->so_type == SOCK_DGRAM)
error = EOPNOTSUPP;
-   fdrop(fp, td);
+   fdrop(fp1, td);
+   break;
}
-   goto out;
+   return (error);
}
 
-   if (len != 0 && error == 0) {
+   if (len != 0) {
error = bsd_to_linux_sockaddr(sa, , len);
if (error == 0)
error = copyout(lsa, PTRIN(addr), len);
free(lsa, M_SONAME);
-   }
 
-   free(sa, M_SONAME);
+   /*
+* XXX: We should also copyout the len, shouldn't we?
+*/
 
-out:
-   if (error != 0) {
-   (void)kern_close(td, td->td_retval[0]);
-   td->td_retval[0] = 0;
+   if (error != 0) {
+   fdclose(td, fp, td->td_retval[0]);
+   td->td_retval[0] = 0;
+   }
}
+   if (fp != NULL)
+   fdrop(fp, td);
+   free(sa, M_SONAME);
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"


Re: svn commit: r362829 - head/sys/compat/linuxkpi/common/src

2020-07-01 Thread Konstantin Belousov
On Wed, Jul 01, 2020 at 11:35:21AM +0200, Hans Petter Selasky wrote:
> On 2020-07-01 11:21, Konstantin Belousov wrote:
> > It should be expressed as pget(pid, 0); instead of duplicating.
> 
> Hi,
> 
> Currently the LinuxKPI style is to use tdfind() and pfind(). If you look at
> linux_current.c you see multiple uses of the exact same syntax.
> 
> Quickly looking at the pget() implementation, I see it doesn't expand to
> exactly tdfind() and pfind(). pget() uses pfind_tid() which looks overkill
> compared to tdfind(). tdfind() uses a hash-table lookup, while pfind_tid()
> doesn't  I'm confused.

It is trivial to change pget() to use tdfind(),
https://reviews.freebsd.org/D25532

I see no point in repeating the same pfind/tdfind calls, better to convert
them to pget(), and have this code in one intended place.




the sam
___
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: r362829 - head/sys/compat/linuxkpi/common/src

2020-07-01 Thread Hans Petter Selasky

On 2020-07-01 11:21, Konstantin Belousov wrote:

It should be expressed as pget(pid, 0); instead of duplicating.


Hi,

Currently the LinuxKPI style is to use tdfind() and pfind(). If you look 
at linux_current.c you see multiple uses of the exact same syntax.


Quickly looking at the pget() implementation, I see it doesn't expand to 
exactly tdfind() and pfind(). pget() uses pfind_tid() which looks 
overkill compared to tdfind(). tdfind() uses a hash-table lookup, while 
pfind_tid() doesn't  I'm confused.


--HPS


___
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: r362832 - stable/12/sys/netinet/cc

2020-07-01 Thread Richard Scheffenegger
Author: rscheff
Date: Wed Jul  1 09:35:33 2020
New Revision: 362832
URL: https://svnweb.freebsd.org/changeset/base/362832

Log:
  MFC r362006: Prevent TCP Cubic to abruptly increase cwnd after app-limited
  
  Cubic calculates the new cwnd based on absolute time
  elapsed since the start of an epoch. A cubic epoch is
  started on congestion events, or once the congestion
  avoidance phase is started, after slow-start has
  completed.
  
  When a sender is application limited for an extended
  amount of time and subsequently a larger volume of data
  becomes ready for sending, Cubic recalculates cwnd
  with a lingering cubic epoch. This recalculation
  of the cwnd can induce a massive increase in cwnd,
  causing a burst of data to be sent at line rate by
  the sender.
  
  This adds a flag to reset the cubic epoch once a
  session transitions from app-limited to cwnd-limited
  to prevent the above effect.
  
  Reviewed by:  chengc_netapp.com, tuexen (mentor)
  Approved by:  tuexen (mentor), rgrimes (mentor)
  MFC after:3 weeks
  Sponsored by: NetApp, Inc.
  Differential Revision:https://reviews.freebsd.org/D25065

Modified:
  stable/12/sys/netinet/cc/cc_cubic.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/cc/cc_cubic.c
==
--- stable/12/sys/netinet/cc/cc_cubic.c Wed Jul  1 09:32:17 2020
(r362831)
+++ stable/12/sys/netinet/cc/cc_cubic.c Wed Jul  1 09:35:33 2020
(r362832)
@@ -92,6 +92,7 @@ struct cubic {
uint32_tflags;
 #define CUBICFLAG_CONG_EVENT   0x0001  /* congestion experienced */
 #define CUBICFLAG_IN_SLOWSTART 0x0002  /* in slow start */
+#define CUBICFLAG_IN_APPLIMIT  0x0004  /* application limited */
/* Minimum observed rtt in ticks. */
int min_rtt_ticks;
/* Mean observed rtt between congestion epochs. */
@@ -143,8 +144,10 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type)
} else {
ticks_since_cong = ticks - cubic_data->t_last_cong;
 
-   if (cubic_data->flags & CUBICFLAG_IN_SLOWSTART) {
-   cubic_data->flags &= ~CUBICFLAG_IN_SLOWSTART;
+   if (cubic_data->flags & (CUBICFLAG_IN_SLOWSTART |
+CUBICFLAG_IN_APPLIMIT)) {
+   cubic_data->flags &= ~(CUBICFLAG_IN_SLOWSTART |
+  CUBICFLAG_IN_APPLIMIT);
cubic_data->t_last_cong = ticks;
cubic_data->K = 0;
}
@@ -197,6 +200,9 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type)
cubic_data->max_cwnd < CCV(ccv, snd_cwnd))
cubic_data->max_cwnd = CCV(ccv, snd_cwnd);
}
+   } else if (type == CC_ACK && !IN_RECOVERY(CCV(ccv, t_flags)) &&
+   !(ccv->flags & CCF_CWND_LIMITED)) {
+   cubic_data->flags |= CUBICFLAG_IN_APPLIMIT;
}
 }
 
___
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: r362831 - stable/12/sys/netinet/cc

2020-07-01 Thread Richard Scheffenegger
Author: rscheff
Date: Wed Jul  1 09:32:17 2020
New Revision: 362831
URL: https://svnweb.freebsd.org/changeset/base/362831

Log:
  MFC r361987: Prevent TCP Cubic to abruptly increase cwnd after slow-start
  
  Introducing flags to track the initial Wmax dragging and exit
  from slow-start in TCP Cubic. This prevents sudden jumps in the
  caluclated cwnd by cubic, especially when the flow is application
  limited during slow start (cwnd can not grow as fast as expected).
  The downside is that cubic may remain slightly longer in the
  concave region before starting the convex region beyond Wmax again.
  
  Reviewed by:  chengc_netapp.com, tuexen (mentor)
  Approved by:  tuexen (mentor), rgrimes (mentor, blanket)
  MFC after:3 weeks
  Sponsored by: NetApp, Inc.
  Differential Revision:https://reviews.freebsd.org/D23655

Modified:
  stable/12/sys/netinet/cc/cc_cubic.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/cc/cc_cubic.c
==
--- stable/12/sys/netinet/cc/cc_cubic.c Wed Jul  1 09:28:00 2020
(r362830)
+++ stable/12/sys/netinet/cc/cc_cubic.c Wed Jul  1 09:32:17 2020
(r362831)
@@ -88,8 +88,10 @@ struct cubic {
unsigned long   max_cwnd;
/* cwnd at the previous congestion event. */
unsigned long   prev_max_cwnd;
-   /* Number of congestion events. */
-   uint32_tnum_cong_events;
+   /* various flags */
+   uint32_tflags;
+#define CUBICFLAG_CONG_EVENT   0x0001  /* congestion experienced */
+#define CUBICFLAG_IN_SLOWSTART 0x0002  /* in slow start */
/* Minimum observed rtt in ticks. */
int min_rtt_ticks;
/* Mean observed rtt between congestion epochs. */
@@ -135,11 +137,17 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type)
(V_tcp_do_rfc3465 && ccv->flags & CCF_ABC_SENTAWND))) {
 /* Use the logic in NewReno ack_received() for slow start. */
if (CCV(ccv, snd_cwnd) <= CCV(ccv, snd_ssthresh) ||
-   cubic_data->min_rtt_ticks == TCPTV_SRTTBASE)
+   cubic_data->min_rtt_ticks == TCPTV_SRTTBASE) {
+   cubic_data->flags |= CUBICFLAG_IN_SLOWSTART;
newreno_cc_algo.ack_received(ccv, type);
-   else {
+   } else {
ticks_since_cong = ticks - cubic_data->t_last_cong;
 
+   if (cubic_data->flags & CUBICFLAG_IN_SLOWSTART) {
+   cubic_data->flags &= ~CUBICFLAG_IN_SLOWSTART;
+   cubic_data->t_last_cong = ticks;
+   cubic_data->K = 0;
+   }
/*
 * The mean RTT is used to best reflect the equations in
 * the I-D. Using min_rtt in the tf_cwnd calculation
@@ -185,7 +193,7 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type)
 * keep updating our current estimate of the
 * max_cwnd.
 */
-   if (cubic_data->num_cong_events == 0 &&
+   if (((cubic_data->flags & CUBICFLAG_CONG_EVENT) == 0) &&
cubic_data->max_cwnd < CCV(ccv, snd_cwnd))
cubic_data->max_cwnd = CCV(ccv, snd_cwnd);
}
@@ -233,9 +241,10 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type)
if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) {
if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) {
cubic_ssthresh_update(ccv);
-   cubic_data->num_cong_events++;
+   cubic_data->flags |= CUBICFLAG_CONG_EVENT;
cubic_data->prev_max_cwnd = 
cubic_data->max_cwnd;
cubic_data->max_cwnd = CCV(ccv, snd_cwnd);
+   cubic_data->K = cubic_k(cubic_data->max_cwnd / 
CCV(ccv, t_maxseg));
}
ENTER_RECOVERY(CCV(ccv, t_flags));
}
@@ -244,10 +253,11 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type)
case CC_ECN:
if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) {
cubic_ssthresh_update(ccv);
-   cubic_data->num_cong_events++;
+   cubic_data->flags |= CUBICFLAG_CONG_EVENT;
cubic_data->prev_max_cwnd = cubic_data->max_cwnd;
cubic_data->max_cwnd = CCV(ccv, snd_cwnd);
cubic_data->t_last_cong = ticks;
+   cubic_data->K = cubic_k(cubic_data->max_cwnd / CCV(ccv, 
t_maxseg));
CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);

svn commit: r362830 - stable/12/bin/dd

2020-07-01 Thread Richard Scheffenegger
Author: rscheff
Date: Wed Jul  1 09:28:00 2020
New Revision: 362830
URL: https://svnweb.freebsd.org/changeset/base/362830

Log:
  MFC r361806: Add O_DIRECT flag to DD for cache bypass
  
  FreeBSD DD utility has not had support for the O_DIRECT flag, which
  is useful to bypass local caching, e.g. for unconditionally issuing
  NFS IO requests during testing.
  
  Reviewed by:  rgrimes (mentor)
  Approved by:  rgrimes (blanket)
  MFC after:3 weeks
  Sponsored by: NetApp, Inc.
  Differential Revision:https://reviews.freebsd.org/D25066

Modified:
  stable/12/bin/dd/args.c
  stable/12/bin/dd/dd.1
  stable/12/bin/dd/dd.c
  stable/12/bin/dd/dd.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/bin/dd/args.c
==
--- stable/12/bin/dd/args.c Wed Jul  1 08:23:57 2020(r362829)
+++ stable/12/bin/dd/args.c Wed Jul  1 09:28:00 2020(r362830)
@@ -266,6 +266,7 @@ static const struct iflag {
const char *name;
uint64_t set, noset;
 } ilist[] = {
+   { "direct", C_IDIRECT,  0 },
{ "fullblock",  C_IFULLBLOCK,   C_SYNC },
 };
 
@@ -410,6 +411,7 @@ static const struct oflag {
const char *name;
uint64_t set;
 } olist[] = {
+   { "direct", C_ODIRECT },
{ "fsync",  C_OFSYNC },
{ "sync",   C_OFSYNC },
 };

Modified: stable/12/bin/dd/dd.1
==
--- stable/12/bin/dd/dd.1   Wed Jul  1 08:23:57 2020(r362829)
+++ stable/12/bin/dd/dd.1   Wed Jul  1 09:28:00 2020(r362830)
@@ -32,7 +32,7 @@
 .\" @(#)dd.1   8.2 (Berkeley) 1/13/94
 .\" $FreeBSD$
 .\"
-.Dd March 26, 2019
+.Dd June 4, 2020
 .Dt DD 1
 .Os
 .Sh NAME
@@ -117,6 +117,8 @@ limits the number of times
 is called on the input rather than the number of blocks copied in full.
 May not be combined with
 .Cm conv=sync .
+.It Cm direct
+Set the O_DIRECT flag on the input file to make reads bypass any local caching.
 .El
 .It Cm iseek Ns = Ns Ar n
 Seek on the input file
@@ -143,7 +145,7 @@ the output file is truncated at that point.
 Where
 .Cm value
 is one of the symbols from the following list.
-.Bl -tag -width "fsync"
+.Bl -tag -width "direct"
 .It Cm fsync
 Set the O_FSYNC flag on the output file to make writes synchronous.
 .It Cm sync
@@ -151,6 +153,8 @@ Set the O_SYNC flag on the output file to make writes 
 This is synonymous with the
 .Cm fsync
 value.
+.It Cm direct
+Set the O_DIRECT flag on the output file to make writes bypass any local 
caching.
 .El
 .It Cm oseek Ns = Ns Ar n
 Seek on the output file

Modified: stable/12/bin/dd/dd.c
==
--- stable/12/bin/dd/dd.c   Wed Jul  1 08:23:57 2020(r362829)
+++ stable/12/bin/dd/dd.c   Wed Jul  1 09:28:00 2020(r362830)
@@ -143,7 +143,7 @@ static void
 setup(void)
 {
u_int cnt;
-   int oflags;
+   int iflags, oflags;
cap_rights_t rights;
unsigned long cmds[] = { FIODTYPE, MTIOCTOP };
 
@@ -151,7 +151,10 @@ setup(void)
in.name = "stdin";
in.fd = STDIN_FILENO;
} else {
-   in.fd = open(in.name, O_RDONLY, 0);
+   iflags = 0;
+   if (ddflags & C_IDIRECT)
+   iflags |= O_DIRECT;
+   in.fd = open(in.name, O_RDONLY | iflags, 0);
if (in.fd == -1)
err(1, "%s", in.name);
}
@@ -186,6 +189,8 @@ setup(void)
oflags |= O_TRUNC;
if (ddflags & C_OFSYNC)
oflags |= O_FSYNC;
+   if (ddflags & C_ODIRECT)
+   oflags |= O_DIRECT;
out.fd = open(out.name, O_RDWR | oflags, DEFFILEMODE);
/*
 * May not have read access, so try again with write only.

Modified: stable/12/bin/dd/dd.h
==
--- stable/12/bin/dd/dd.h   Wed Jul  1 08:23:57 2020(r362829)
+++ stable/12/bin/dd/dd.h   Wed Jul  1 09:28:00 2020(r362830)
@@ -105,6 +105,8 @@ typedef struct {
 #defineC_FDATASYNC 0x0001ULL
 #defineC_OFSYNC0x0002ULL
 #defineC_IFULLBLOCK0x0004ULL
+#defineC_IDIRECT   0x0008ULL
+#defineC_ODIRECT   0x0010ULL
 
 #defineC_PARITY(C_PAREVEN | C_PARODD | C_PARNONE | C_PARSET)
 
___
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: r362829 - head/sys/compat/linuxkpi/common/src

2020-07-01 Thread Konstantin Belousov
On Wed, Jul 01, 2020 at 08:23:57AM +, Hans Petter Selasky wrote:
> Author: hselasky
> Date: Wed Jul  1 08:23:57 2020
> New Revision: 362829
> URL: https://svnweb.freebsd.org/changeset/base/362829
> 
> Log:
>   The "pid" field in the LinuxKPI task struct is typically set to the thread 
> ID
>   and not the process ID. Make sure the linux_task_exiting() function uses 
> tdfind()
>   to lookup the BSD procedure structure pointer by the "pid" field, and only
>   fallback to pfind() when no match is found! This makes linux_task_exiting()
>   in line with the rest of the code.
>   
>   Differential Revision: https://reviews.freebsd.org/D25509
>   Submitted by:   Greg V 
>   MFC after:  1 week
>   Sponsored by:   Mellanox Technologies
> 
> Modified:
>   head/sys/compat/linuxkpi/common/src/linux_current.c
> 
> Modified: head/sys/compat/linuxkpi/common/src/linux_current.c
> ==
> --- head/sys/compat/linuxkpi/common/src/linux_current.c   Wed Jul  1 
> 05:59:08 2020(r362828)
> +++ head/sys/compat/linuxkpi/common/src/linux_current.c   Wed Jul  1 
> 08:23:57 2020(r362829)
> @@ -219,11 +219,21 @@ linux_get_pid_task(pid_t pid)
>  bool
>  linux_task_exiting(struct task_struct *task)
>  {
> + struct thread *td;
>   struct proc *p;
>   bool ret;
>  
>   ret = false;
> - p = pfind(task->pid);
> +
> + /* try to find corresponding thread */
> + td = tdfind(task->pid, -1);
> + if (td != NULL) {
> + p = td->td_proc;
> + } else {
> + /* try to find corresponding procedure */
> + p = pfind(task->pid);
> + }
> +
>   if (p != NULL) {
>   if ((p->p_flag & P_WEXIT) != 0)
>   ret = true;
It should be expressed as pget(pid, 0); instead of duplicating.
___
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: r362815 - head/sys/net80211

2020-07-01 Thread Bjoern A. Zeeb

On 1 Jul 2020, at 0:23, Adrian Chadd wrote:


Author: adrian
Date: Wed Jul  1 00:23:49 2020
New Revision: 362815
URL: https://svnweb.freebsd.org/changeset/base/362815

Log:
  [net80211] Migrate HT/legacy protection mode and preamble 
calculation to per-VAP flags


can you please put these changes into Phabricator with adequate time to 
get the reviewed in the future?



/bz
___
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: r362736 - head/sys/arm64/rockchip

2020-07-01 Thread Peter Jeremy
On 2020-Jun-28 21:11:10 +, Oleksandr Tymoshenko  wrote:
>Log:
>  Configure rx_delay/tx_delay values for RK3399/RK3328 GMAC
>  
>  For 1000Mb mode to work reliably TX/RX delays need to be configured
>  between the TX/RX clock and the respective signals on the PHY
>  to compensate for differing trace lengths on the PCB.

This breaks (at least) diskless booting on my Rock64.

During boot, I normally see:
regulator: shutting down unused regulators
uhub1: 1 port with 1 removable, self powered
uhub0: 2 ports with 2 removable, self powered
uhub2: 1 port with 1 removable, self powered
uhub3: 1 port with 1 removable, self powered
dwc0: link state changed to DOWN
NFS ROOT: 192.168.12.200:/tank/rock64
dwc0: link state changed to UP
Warning: no time-of-day clock registered, system time will not be set accurately
Warning: no time-of-day clock registered, system time will not be set accurately
start_init: trying /sbin/init

With r362736, I see:
setting RK3328 RX/TX delays:  24/36
...
regulator: shutting down unused regulators
uhub0: 1 port with 1 removable, self powered
uhub3: 2 ports with 2 removable, self powered
uhub2: 1 port with 1 removable, self powered
uhub1: 1 port with 1 removable, self powered
dwc0: link state changed to DOWN
NFS ROOT: 192.168.12.200:/tank/rock64
dwc0: link state changed to UP
dwc0: link state changed to DOWN
dwc0: link state changed to UP
[Nothing further until I push the reset button]

The system doesn't respond to pings so I suspect the network is dead.
Normally, it runs 1000baseT .

-- 
Peter Jeremy


signature.asc
Description: PGP signature


svn commit: r362829 - head/sys/compat/linuxkpi/common/src

2020-07-01 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jul  1 08:23:57 2020
New Revision: 362829
URL: https://svnweb.freebsd.org/changeset/base/362829

Log:
  The "pid" field in the LinuxKPI task struct is typically set to the thread ID
  and not the process ID. Make sure the linux_task_exiting() function uses 
tdfind()
  to lookup the BSD procedure structure pointer by the "pid" field, and only
  fallback to pfind() when no match is found! This makes linux_task_exiting()
  in line with the rest of the code.
  
  Differential Revision: https://reviews.freebsd.org/D25509
  Submitted by: Greg V 
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/src/linux_current.c

Modified: head/sys/compat/linuxkpi/common/src/linux_current.c
==
--- head/sys/compat/linuxkpi/common/src/linux_current.c Wed Jul  1 05:59:08 
2020(r362828)
+++ head/sys/compat/linuxkpi/common/src/linux_current.c Wed Jul  1 08:23:57 
2020(r362829)
@@ -219,11 +219,21 @@ linux_get_pid_task(pid_t pid)
 bool
 linux_task_exiting(struct task_struct *task)
 {
+   struct thread *td;
struct proc *p;
bool ret;
 
ret = false;
-   p = pfind(task->pid);
+
+   /* try to find corresponding thread */
+   td = tdfind(task->pid, -1);
+   if (td != NULL) {
+   p = td->td_proc;
+   } else {
+   /* try to find corresponding procedure */
+   p = pfind(task->pid);
+   }
+
if (p != NULL) {
if ((p->p_flag & P_WEXIT) != 0)
ret = true;
___
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: r362809 - head/contrib/mandoc

2020-07-01 Thread Gordon Bergling
On Tue, Jun 30, 2020 at 03:56:17PM -0700, Rodney W. Grimes wrote:
> [ Charset UTF-8 unsupported, converting... ]
> > Author: gbe (doc committer)
> > Date: Tue Jun 30 18:08:59 2020
> > New Revision: 362809
> > URL: https://svnweb.freebsd.org/changeset/base/362809
> > 
> > Log:
> >   Mention FreeBSD in the HISTORY sections of apropos(1) and makewhatis(8).
> >   
> >   PR:   223520, 223521
> >   Reviewed by:  bcr (mentor)
> >   Approved by:  bcr (mentor)
> >   Differential Revision:https://reviews.freebsd.org/D25521
> > 
> > Modified:
> >   head/contrib/mandoc/apropos.1
> >   head/contrib/mandoc/makewhatis.8
> > 
> > Modified: head/contrib/mandoc/apropos.1
> > ==
> > --- head/contrib/mandoc/apropos.1   Tue Jun 30 17:21:28 2020
> > (r362808)
> > +++ head/contrib/mandoc/apropos.1   Tue Jun 30 18:08:59 2020
> > (r362809)
> > @@ -15,7 +15,7 @@
> >  .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
> >  .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> >  .\"
> > -.Dd $Mdocdate: November 22 2018 $
> > +.Dd $Mdocdate: June 30 2020 $
> >  .Dt APROPOS 1
> >  .Os
> >  .Sh NAME
> > @@ -493,6 +493,12 @@ The options
> >  .Fl acfhIKklOTWw
> >  appeared in
> >  .Ox 5.7 .
> > +.Pp
> > +The
> > +.Nm
> > +utility was integrated into
> > +.Fx 11.1
> > +as part of the switch to mandoc.
> 
> Huh?  FreeBSD has had apropos since 1.0 and my 5.4 system clearly has it:
> freebsd {110}% uname -a
> FreeBSD pdx.rh.CN85.dnsmgr.net 5.4-RELEASE-p8 FreeBSD 5.4-RELEASE-p8 #1: Mon 
> Jul  1 17:58:50 PDT 2019 
> r...@pdx.rh.cn85.dnsmgr.net:/usr/src/sys/i386/compile/PDXMXPIE  i386
> pdx.rh.CN85.dnsmgr.net:freebsd {111}% which apropos
> /usr/bin/apropos
> 
> And a man page for it too:
> APROPOS(1)  FreeBSD General Commands Manual APROPOS(1)
> 
> NAME
>  apropos, whatis -- search the whatis database
> 
> SYNOPSIS
>  apropos keyword ...
>  whatis keyword ...
> 
> DESCRIPTION
>  apropos searches a set of database files containing short descriptions of
>  system commands for keywords and displays the result on the standard out-
>  put.  whatis displays only complete word matches.
> 
>  keyword really is an extended regular expression, please read grep(1)
>  manual page for more information about its format.
> 
> DIAGNOSTICS
>  The apropos utility exits 0 on success, and 1 if no keyword matched.
> 
> SEE ALSO
>  grep(1), makewhatis(1), man(1)
> 
> FreeBSD 5.4January 15, 1991FreeBSD 5.4
> 
> >  .Sh AUTHORS
> >  .An -nosplit
> >  .An Bill Joy
> > 

That is true, but the version of 'apropos' we have currently in base is based 
on mandoc,
which was imported around September 2018. Due to the nature of contributed code 
I 
thought it would be best to document only the history when it was integrated 
into
FreeSBD. The same applies for 'makewhatis'.

> > Modified: head/contrib/mandoc/makewhatis.8
> > ==
> > --- head/contrib/mandoc/makewhatis.8Tue Jun 30 17:21:28 2020
> > (r362808)
> > +++ head/contrib/mandoc/makewhatis.8Tue Jun 30 18:08:59 2020
> > (r362809)
> > @@ -15,7 +15,7 @@
> >  .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
> >  .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> >  .\"
> > -.Dd $Mdocdate: May 17 2017 $
> > +.Dd $Mdocdate: June 30 2020 $
> >  .Dt MAKEWHATIS 8
> >  .Os
> >  .Sh NAME
> > @@ -211,6 +211,12 @@ and the options
> >  .Fl aCDnQT
> >  in
> >  .Ox 5.6 .
> > +.Pp
> > +The
> > +.Nm
> > +utility was integrated into
> > +.Fx 11.1
> > +as part of the switch to mandoc.
> 
> Ditto
> 
> >  .Sh AUTHORS
> >  .An -nosplit
> >  .An Bill Joy

--Gordon
___
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: r362681 - in head: contrib/bc contrib/bc/gen contrib/bc/include contrib/bc/locales contrib/bc/manuals contrib/bc/src contrib/bc/src/bc contrib/bc/src/dc contrib/bc/src/history contrib/

2020-07-01 Thread Dimitry Andric
On 1 Jul 2020, at 00:03, Stefan Eßer  wrote:
> 
> Am 30.06.20 um 23:29 schrieb Dimitry Andric:
...
>> This is because you are supposed to commit stuff to ^/base/vendor/xxx
>> first, then svn cp it to ^/head/contrib/xxx, at least from Subversion
>> 1.8 onwards. The 'cp' action establishes the ancestral relation.
> 
> Yes, I thought so - the problem I want to fix is the premature import
> to /contrib and I had been hoping that it was possible to use the
> --record-only merge to edit the merge history (as suggested by John
> Baldwin and Ed Maste).

I have never been able to find a way to 'force' the ancestral relation
after the fact. Subversion does not seem to expose this as a
user-manipulable property. The --record-only option does what it says,
i.e. not actually merging but only updating the svn:mergeinfo property,
but it will still only work on ancestrally related objects.


> I want to upgrade to the next release and I'm wondering whether it
> would be possible to just svn copy that new version over from the
> vendor directory to the contrib directory. The import to the vendor
> area and the contrib directory have very similar commit messages and
> thus there would be no loss of commit history.

If you don't have many (or no) customizations, then indeed it will be
fairly easy. In one commit, you can svn rm the old version, and svn cp
the new version from the vendor area. Subversion will later show the
directory to have been "Replaced". There are lots of examples of this
in the tree, and I would hope the Git converter can handle it, or there
will be much more trouble. :)

-Dimitry



signature.asc
Description: Message signed with OpenPGP


svn commit: r362828 - head/sys/kern

2020-07-01 Thread Mateusz Guzik
Author: mjg
Date: Wed Jul  1 05:59:08 2020
New Revision: 362828
URL: https://svnweb.freebsd.org/changeset/base/362828

Log:
  cache: lockless forward lookup with smr
  
  This eliminates the need to take bucket locks in the common case.
  
  Concurrent lookup utilizng the same vnodes is still bottlenecked on 
referencing
  and locking path components, this will be taken care of separately.
  
  Reviewed by:  kib
  Tested by:pho
  Differential Revision:https://reviews.freebsd.org/D23913

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Wed Jul  1 05:56:29 2020(r362827)
+++ head/sys/kern/vfs_cache.c   Wed Jul  1 05:59:08 2020(r362828)
@@ -56,11 +56,13 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #ifdef KTRACE
 #include 
 #endif
@@ -104,7 +106,7 @@ SDT_PROBE_DEFINE2(vfs, namecache, shrink_negative, don
  */
 
 struct namecache {
-   LIST_ENTRY(namecache) nc_hash;  /* hash chain */
+   CK_LIST_ENTRY(namecache) nc_hash;/* hash chain */
LIST_ENTRY(namecache) nc_src;   /* source vnode list */
TAILQ_ENTRY(namecache) nc_dst;  /* destination vnode list */
struct  vnode *nc_dvp;  /* vnode of parent of name */
@@ -143,7 +145,26 @@ struct namecache_ts {
 #defineNCF_DVDROP  0x10
 #defineNCF_NEGATIVE0x20
 #defineNCF_HOTNEGATIVE 0x40
+#define NCF_INVALID0x80
 
+static bool
+cache_ncp_invalid(struct namecache *ncp)
+{
+
+   atomic_thread_fence_acq();
+   return ((ncp->nc_flag & NCF_INVALID) != 0);
+}
+
+static void
+cache_ncp_invalidate(struct namecache *ncp)
+{
+
+   atomic_thread_fence_rel();
+   KASSERT((ncp->nc_flag & NCF_INVALID) == 0,
+   ("%s: entry %p already invalid", __func__, ncp));
+   ncp->nc_flag |= NCF_INVALID;
+}
+
 /*
  * Name caching works as follows:
  *
@@ -192,12 +213,14 @@ structnamecache_ts {
  * the first node, locking everything in order and revalidating the state.
  */
 
+VFS_SMR_DECLARE;
+
 /*
  * Structures associated with name caching.
  */
 #define NCHHASH(hash) \
([(hash) & nchash])
-static __read_mostly LIST_HEAD(nchashhead, namecache) *nchashtbl;/* Hash Table 
*/
+static __read_mostly CK_LIST_HEAD(nchashhead, namecache) *nchashtbl;/* Hash 
Table */
 static u_long __read_mostlynchash; /* size of hash table */
 SYSCTL_ULONG(_debug, OID_AUTO, nchash, CTLFLAG_RD, , 0,
 "Size of namecache hash table");
@@ -275,15 +298,15 @@ cache_alloc(int len, int ts)
 
if (__predict_false(ts)) {
if (len <= CACHE_PATH_CUTOFF)
-   ncp_ts = uma_zalloc(cache_zone_small_ts, M_WAITOK);
+   ncp_ts = uma_zalloc_smr(cache_zone_small_ts, M_WAITOK);
else
-   ncp_ts = uma_zalloc(cache_zone_large_ts, M_WAITOK);
+   ncp_ts = uma_zalloc_smr(cache_zone_large_ts, M_WAITOK);
ncp = _ts->nc_nc;
} else {
if (len <= CACHE_PATH_CUTOFF)
-   ncp = uma_zalloc(cache_zone_small, M_WAITOK);
+   ncp = uma_zalloc_smr(cache_zone_small, M_WAITOK);
else
-   ncp = uma_zalloc(cache_zone_large, M_WAITOK);
+   ncp = uma_zalloc_smr(cache_zone_large, M_WAITOK);
}
return (ncp);
 }
@@ -300,14 +323,14 @@ cache_free(struct namecache *ncp)
if (__predict_false(ncp->nc_flag & NCF_TS)) {
ncp_ts = __containerof(ncp, struct namecache_ts, nc_nc);
if (ncp->nc_nlen <= CACHE_PATH_CUTOFF)
-   uma_zfree(cache_zone_small_ts, ncp_ts);
+   uma_zfree_smr(cache_zone_small_ts, ncp_ts);
else
-   uma_zfree(cache_zone_large_ts, ncp_ts);
+   uma_zfree_smr(cache_zone_large_ts, ncp_ts);
} else {
if (ncp->nc_nlen <= CACHE_PATH_CUTOFF)
-   uma_zfree(cache_zone_small, ncp);
+   uma_zfree_smr(cache_zone_small, ncp);
else
-   uma_zfree(cache_zone_large, ncp);
+   uma_zfree_smr(cache_zone_large, ncp);
}
 }
 
@@ -606,7 +629,7 @@ retry:
}
/* Scan hash tables counting entries */
for (ncpp = nchashtbl, i = 0; i < n_nchash; ncpp++, i++)
-   LIST_FOREACH(ncp, ncpp, nc_hash)
+   CK_LIST_FOREACH(ncp, ncpp, nc_hash)
cntbuf[i]++;
cache_unlock_all_buckets();
for (error = 0, i = 0; i < n_nchash; i++)
@@ -639,7 +662,7 @@ sysctl_debug_hashstat_nchash(SYSCTL_HANDLER_ARGS)
/* Scan hash tables for applicable entries */
for (ncpp = nchashtbl; n_nchash > 0; n_nchash--, ncpp++) {