svn commit: r317398 - vendor/less/v487

2017-04-24 Thread Xin LI
Author: delphij
Date: Tue Apr 25 03:43:06 2017
New Revision: 317398
URL: https://svnweb.freebsd.org/changeset/base/317398

Log:
  Tag less v487.

Added:
  vendor/less/v487/
 - copied from r317397, vendor/less/dist/
___
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: r317397 - vendor/less/dist

2017-04-24 Thread Xin LI
Author: delphij
Date: Tue Apr 25 03:42:16 2017
New Revision: 317397
URL: https://svnweb.freebsd.org/changeset/base/317397

Log:
  Vendor import of less 487.

Modified:
  vendor/less/dist/LICENSE
  vendor/less/dist/Makefile.aut
  vendor/less/dist/Makefile.wnm
  vendor/less/dist/NEWS
  vendor/less/dist/README
  vendor/less/dist/brac.c
  vendor/less/dist/ch.c
  vendor/less/dist/charset.c
  vendor/less/dist/charset.h
  vendor/less/dist/cmd.h
  vendor/less/dist/cmdbuf.c
  vendor/less/dist/command.c
  vendor/less/dist/compose.uni
  vendor/less/dist/configure
  vendor/less/dist/configure.ac
  vendor/less/dist/cvt.c
  vendor/less/dist/decode.c
  vendor/less/dist/defines.ds
  vendor/less/dist/defines.o2
  vendor/less/dist/defines.o9
  vendor/less/dist/defines.wn
  vendor/less/dist/edit.c
  vendor/less/dist/filename.c
  vendor/less/dist/forwback.c
  vendor/less/dist/funcs.h
  vendor/less/dist/help.c
  vendor/less/dist/ifile.c
  vendor/less/dist/input.c
  vendor/less/dist/jump.c
  vendor/less/dist/less.h
  vendor/less/dist/less.hlp
  vendor/less/dist/less.man
  vendor/less/dist/less.nro
  vendor/less/dist/lessecho.c
  vendor/less/dist/lessecho.man
  vendor/less/dist/lessecho.nro
  vendor/less/dist/lesskey.c
  vendor/less/dist/lesskey.h
  vendor/less/dist/lesskey.man
  vendor/less/dist/lesskey.nro
  vendor/less/dist/lglob.h
  vendor/less/dist/line.c
  vendor/less/dist/linenum.c
  vendor/less/dist/lsystem.c
  vendor/less/dist/main.c
  vendor/less/dist/mark.c
  vendor/less/dist/mkhelp.c
  vendor/less/dist/mkutable
  vendor/less/dist/optfunc.c
  vendor/less/dist/option.c
  vendor/less/dist/option.h
  vendor/less/dist/opttbl.c
  vendor/less/dist/os.c
  vendor/less/dist/output.c
  vendor/less/dist/pattern.c
  vendor/less/dist/pattern.h
  vendor/less/dist/pckeys.h
  vendor/less/dist/position.c
  vendor/less/dist/position.h
  vendor/less/dist/prompt.c
  vendor/less/dist/regexp.c
  vendor/less/dist/screen.c
  vendor/less/dist/scrsize.c
  vendor/less/dist/search.c
  vendor/less/dist/signal.c
  vendor/less/dist/tags.c
  vendor/less/dist/ttyin.c
  vendor/less/dist/ubin.uni
  vendor/less/dist/version.c
  vendor/less/dist/wide.uni

Modified: vendor/less/dist/LICENSE
==
--- vendor/less/dist/LICENSETue Apr 25 03:29:35 2017(r317396)
+++ vendor/less/dist/LICENSETue Apr 25 03:42:16 2017(r317397)
@@ -2,7 +2,7 @@
   
 
 Less
-Copyright (C) 1984-2015  Mark Nudelman
+Copyright (C) 1984-2016  Mark Nudelman
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions

Modified: vendor/less/dist/Makefile.aut
==
--- vendor/less/dist/Makefile.aut   Tue Apr 25 03:29:35 2017
(r317396)
+++ vendor/less/dist/Makefile.aut   Tue Apr 25 03:42:16 2017
(r317397)
@@ -111,7 +111,7 @@ compose.uni: unicode/UnicodeData.txt
 ubin.uni: unicode/UnicodeData.txt
./mkutable -f2 Cc Cf Cs Co Zl Zp -- unicode/UnicodeData.txt > $@
 wide.uni: unicode/EastAsianWidth.txt
-   ./mkutable -f1 W -- unicode/EastAsianWidth.txt > $@
+   ./mkutable -f1 W F -- unicode/EastAsianWidth.txt > $@
 
 distfiles: ${DISTFILES}
 

Modified: vendor/less/dist/Makefile.wnm
==
--- vendor/less/dist/Makefile.wnm   Tue Apr 25 03:29:35 2017
(r317396)
+++ vendor/less/dist/Makefile.wnm   Tue Apr 25 03:42:16 2017
(r317397)
@@ -20,7 +20,7 @@ LIBS = user32.lib
 
 # This rule allows us to supply the necessary -D options
 # in addition to whatever the user asks for.
-.c.obj:
+.c.obj::
$(CC) $(CFLAGS) $<
 
 OBJ = \
@@ -33,11 +33,8 @@ OBJ = \
 
 all: less.exe lesskey.exe
 
-# This is really horrible, but the command line is too long for 
-# MS-DOS if we try to link ${OBJ}.
 less.exe: $(OBJ)
-   -del lesskey.obj
-   $(LD) $(LDFLAGS) *.obj $(LIBS) /out:$@
+   $(LD) $(LDFLAGS) $** $(LIBS) /out:$@
 
 lesskey.exe: lesskey.obj version.obj
$(LD) $(LDFLAGS) lesskey.obj version.obj $(LIBS) /out:$@

Modified: vendor/less/dist/NEWS
==
--- vendor/less/dist/NEWS   Tue Apr 25 03:29:35 2017(r317396)
+++ vendor/less/dist/NEWS   Tue Apr 25 03:42:16 2017(r317397)
@@ -11,6 +11,26 @@
 
 ==
 
+   Major changes between "less" versions 481 and 487
+
+* New commands ESC-{ and ESC-} to shift to start/end of displayed lines.
+
+* Make search highlights work correctly when changing caselessness with -i.
+
+* New option -Da in Windows version to enable SGR mode.
+
+* Fix "nothing to search" error when top or bottom line on screen is empty.
+
+* Fix bug when terminal has no "cm" termcap entry.
+
+* Fix incorrect 

svn commit: r317396 - head/contrib/less

2017-04-24 Thread Xin LI
Author: delphij
Date: Tue Apr 25 03:29:35 2017
New Revision: 317396
URL: https://svnweb.freebsd.org/changeset/base/317396

Log:
  Note r317395 as merged.

Modified:
Directory Properties:
  head/contrib/less/   (props changed)
___
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: r317395 - vendor/less/dist

2017-04-24 Thread Xin LI
Author: delphij
Date: Tue Apr 25 03:28:38 2017
New Revision: 317395
URL: https://svnweb.freebsd.org/changeset/base/317395

Log:
  Apply r316339 to vendor area.

Modified:
  vendor/less/dist/brac.c
  vendor/less/dist/ch.c
  vendor/less/dist/charset.c
  vendor/less/dist/cmdbuf.c
  vendor/less/dist/command.c
  vendor/less/dist/cvt.c
  vendor/less/dist/decode.c
  vendor/less/dist/edit.c
  vendor/less/dist/filename.c
  vendor/less/dist/forwback.c
  vendor/less/dist/funcs.h
  vendor/less/dist/ifile.c
  vendor/less/dist/input.c
  vendor/less/dist/jump.c
  vendor/less/dist/less.h
  vendor/less/dist/lessecho.c
  vendor/less/dist/lesskey.c
  vendor/less/dist/line.c
  vendor/less/dist/linenum.c
  vendor/less/dist/lsystem.c
  vendor/less/dist/main.c
  vendor/less/dist/mark.c
  vendor/less/dist/mkhelp.c
  vendor/less/dist/optfunc.c
  vendor/less/dist/option.c
  vendor/less/dist/opttbl.c
  vendor/less/dist/os.c
  vendor/less/dist/output.c
  vendor/less/dist/pattern.c
  vendor/less/dist/position.c
  vendor/less/dist/prompt.c
  vendor/less/dist/regexp.c
  vendor/less/dist/screen.c
  vendor/less/dist/scrsize.c
  vendor/less/dist/search.c
  vendor/less/dist/signal.c
  vendor/less/dist/tags.c
  vendor/less/dist/ttyin.c

Modified: vendor/less/dist/brac.c
==
--- vendor/less/dist/brac.c Tue Apr 25 00:00:34 2017(r317394)
+++ vendor/less/dist/brac.c Tue Apr 25 03:28:38 2017(r317395)
@@ -24,18 +24,14 @@
  * "close bracket" are given.
  */
public void
-match_brac(obrac, cbrac, forwdir, n)
-   register int obrac;
-   register int cbrac;
-   int forwdir;
-   int n;
+match_brac(int obrac, int cbrac, int forwdir, int n)
 {
-   register int c;
-   register int nest;
+   int c;
+   int nest;
POSITION pos;
-   int (*chget)();
+   int (*chget)(void);
 
-   extern int ch_forw_get(), ch_back_get();
+   extern int ch_forw_get(void), ch_back_get(void);
 
/*
 * Seek to the line containing the open bracket.

Modified: vendor/less/dist/ch.c
==
--- vendor/less/dist/ch.c   Tue Apr 25 00:00:34 2017(r317394)
+++ vendor/less/dist/ch.c   Tue Apr 25 03:28:38 2017(r317395)
@@ -144,13 +144,13 @@ static int ch_addbuf();
  * Get the character pointed to by the read pointer.
  */
int
-ch_get()
+ch_get(void)
 {
-   register struct buf *bp;
-   register struct bufnode *bn;
-   register int n;
-   register int slept;
-   register int h;
+   struct buf *bp;
+   struct bufnode *bn;
+   int n;
+   int slept;
+   int h;
POSITION pos;
POSITION len;
 
@@ -378,8 +378,7 @@ ch_get()
  * a single char onto an input file descriptor.
  */
public void
-ch_ungetchar(c)
-   int c;
+ch_ungetchar(int c)
 {
if (c != -1 && ch_ungotchar != -1)
error("ch_ungetchar overrun", NULL_PARG);
@@ -392,7 +391,7 @@ ch_ungetchar(c)
  * If we haven't read all of standard input into it, do that now.
  */
public void
-end_logfile()
+end_logfile(void)
 {
static int tried = FALSE;
 
@@ -417,10 +416,10 @@ end_logfile()
  * Write all the existing buffered data to the log file.
  */
public void
-sync_logfile()
+sync_logfile(void)
 {
-   register struct buf *bp;
-   register struct bufnode *bn;
+   struct buf *bp;
+   struct bufnode *bn;
int warned = FALSE;
BLOCKNUM block;
BLOCKNUM nblocks;
@@ -454,12 +453,11 @@ sync_logfile()
  * Determine if a specific block is currently in one of the buffers.
  */
static int
-buffered(block)
-   BLOCKNUM block;
+buffered(BLOCKNUM block)
 {
-   register struct buf *bp;
-   register struct bufnode *bn;
-   register int h;
+   struct buf *bp;
+   struct bufnode *bn;
+   int h;
 
h = BUFHASH(block);
FOR_BUFS_IN_CHAIN(h, bn)
@@ -476,8 +474,7 @@ buffered(block)
  * Return 0 if successful, non-zero if can't seek there.
  */
public int
-ch_seek(pos)
-   register POSITION pos;
+ch_seek(POSITION pos)
 {
BLOCKNUM new_block;
POSITION len;
@@ -515,7 +512,7 @@ ch_seek(pos)
  * Seek to the end of the file.
  */
public int
-ch_end_seek()
+ch_end_seek(void)
 {
POSITION len;
 
@@ -542,10 +539,10 @@ ch_end_seek()
  * Seek to the last position in the file that is currently buffered.
  */
public int
-ch_end_buffer_seek()
+ch_end_buffer_seek(void)
 {
-   register struct buf *bp;
-   register struct bufnode *bn;
+   struct buf *bp;
+   struct bufnode *bn;
POSITION buf_pos;
POSITION end_pos;
 
@@ -570,10 +567,10 @@ ch_end_buffer_seek()
  * beginning of the pipe is no longer buffered.
  */
public int
-ch_beg_seek()
+ch_beg_seek(void)
 {
-   register struct bufnode *bn;
-   register struct bufnode 

Re: svn commit: r317383 - in head: . etc/mtree include lib/libc/net rescue/rescue sbin sbin/atm sbin/atm/atmconfig share/man/man4 sys/boot/forth sys/conf sys/dev/en sys/dev/fatm sys/dev/hatm sys/dev/p

2017-04-24 Thread Ngie Cooper
On Mon, Apr 24, 2017 at 5:21 PM, Rodney W. Grimes
 wrote:

...

> Ignore me I see you got it on your change to Updating.

`Relnotes: yes` and adding UPDATING entries are complementary
IMHO. UPDATING is meant more for those who upgrade via src (might
contain workarounds, etc), whereas `Relnotes: yes` targets release
notes, which can be used by those doing a binary or src based upgrade.
Thanks for catching this!
-Ngie
___
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: r317383 - in head: . etc/mtree include lib/libc/net rescue/rescue sbin sbin/atm sbin/atm/atmconfig share/man/man4 sys/boot/forth sys/conf sys/dev/en sys/dev/fatm sys/dev/hatm sys/dev/p

2017-04-24 Thread Rodney W. Grimes
> -- Start of PGP signed section.
> > On Mon, Apr 24, 2017 at 09:21:50PM +, Brooks Davis wrote:
> > > Author: brooks
> > > Date: Mon Apr 24 21:21:49 2017
> > > New Revision: 317383
> > > URL: https://svnweb.freebsd.org/changeset/base/317383
> > > 
> > > Log:
> > >   Remove the NATM framework including the en(4), fatm(4), hatm(4), and
> > >   patm(4) devices.
> > >   
> > >   Maintaining an address family and framework has real costs when we make
> > >   infrastructure improvements.  In the case of NATM we support no devices
> > >   manufactured in the last 20 years and some will not even work in modern
> > >   motherboards (some newer devices that patm(4) could be updated to
> > >   support apparently exist, but we do not currently have support).
> > >   
> > >   With this change, support remains for some netgraph modules that don't
> > >   require NATM support code. It is unclear if all these should remain,
> > >   though ng_atmllc certainly stands alone.
> > >   
> > >   Note well: FreeBSD 11 supports NATM and will continue to do so until at
> > >   least September 30, 2021.  Improvements to the code in FreeBSD 11 are
> > >   certainly welcome.
> > >   
> > >   Reviewed by:philip
> > >   Approved by:harti
> > 
> > Should have included:
> > 
> > Differential revision:  https://reviews.freebsd.org/D9883
> 
> Should have further included:
> Release Notes: yes

Ignore me I see you got it on your change to Updating.

-- 
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: r317394 - stable/11/sys/fs/fuse

2017-04-24 Thread Mark Johnston
Author: markj
Date: Tue Apr 25 00:00:34 2017
New Revision: 317394
URL: https://svnweb.freebsd.org/changeset/base/317394

Log:
  MFC r317273 (by cem):
  fuse: Implement FOPEN_KEEP_CACHE flag

Modified:
  stable/11/sys/fs/fuse/fuse_node.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/fuse/fuse_node.c
==
--- stable/11/sys/fs/fuse/fuse_node.c   Mon Apr 24 23:47:12 2017
(r317393)
+++ stable/11/sys/fs/fuse/fuse_node.c   Tue Apr 25 00:00:34 2017
(r317394)
@@ -272,8 +272,6 @@ fuse_vnode_open(struct vnode *vp, int32_
/*
 * Funcation is called for every vnode open.
 * Merge fuse_open_flags it may be 0
-*
-* XXXIP: Handle FOPEN_KEEP_CACHE
 */
/*
 * Ideally speaking, direct io should be enabled on
@@ -293,6 +291,8 @@ fuse_vnode_open(struct vnode *vp, int32_
VTOFUD(vp)->flag |= FN_DIRECTIO;
fuse_io_invalbuf(vp, td);
} else {
+   if ((fuse_open_flags & FOPEN_KEEP_CACHE) == 0)
+   fuse_io_invalbuf(vp, td);
VTOFUD(vp)->flag &= ~FN_DIRECTIO;
}
 
___
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: r317393 - in stable/11/sys/fs: nfs nfsclient

2017-04-24 Thread Rick Macklem
Author: rmacklem
Date: Mon Apr 24 23:47:12 2017
New Revision: 317393
URL: https://svnweb.freebsd.org/changeset/base/317393

Log:
  MFC: r310491
  Fix NFSv4.1 client recovery from NFS4ERR_BAD_SESSION errors.
  
  For most NFSv4.1 servers, a NFS4ERR_BAD_SESSION error is a rare failure
  that indicates that the server has lost session/open/lock state.
  However, recent testing by cperciva@ against the AmazonEFS server found
  several problems with client recovery from this due to it generating this
  failure frequently.
  Briefly, the problems fixed are:
  - If all session slots were in use at the time of the failure, some processes
would continue to loop waiting for a slot on the old session forever.
  - If an RPC that doesn't use open/lock state failed with NFS4ERR_BAD_SESSION,
it would fail the RPC/syscall instead of initiating recovery and then
looping to retry the RPC.
  - If a successful reply to an RPC for an old session wasn't processed
until after a new session was created for a NFS4ERR_BAD_SESSION error,
it would erroneously update the new session and corrupt it.
  - The use of the first element of the session list in the nfs mount
structure (which is always the current metadata session) was slightly
racey. With changes for the above problems it became more racey, so all
uses of this head pointer was wrapped with a NFSLOCKMNT()/NFSUNLOCKMNT().
  - Although the kernel malloc() usually allocates more bytes than requested
and, as such, this wouldn't have caused problems, the allocation of a
session structure was 1 byte smaller than it should have been.
(Null termination byte for the string not included in byte count.)
  
  There are probably still problems with a pNFS data server that fails
  with NFS4ERR_BAD_SESSION, but I have no server that does this to test
  against (the AmazonEFS server doesn't do pNFS), so I can't fix these yet.
  
  Although this patch is fairly large, it should only affect the handling
  of NFS4ERR_BAD_SESSION error replies from an NFSv4.1 server.
  Thanks go to cperciva@ for the extension testing he did to help isolate/fix
  these problems.

Modified:
  stable/11/sys/fs/nfs/nfs.h
  stable/11/sys/fs/nfs/nfs_commonkrpc.c
  stable/11/sys/fs/nfs/nfs_commonport.c
  stable/11/sys/fs/nfs/nfs_commonsubs.c
  stable/11/sys/fs/nfs/nfsclstate.h
  stable/11/sys/fs/nfsclient/nfs_clcomsubs.c
  stable/11/sys/fs/nfsclient/nfs_clport.c
  stable/11/sys/fs/nfsclient/nfs_clrpcops.c
  stable/11/sys/fs/nfsclient/nfs_clstate.c
  stable/11/sys/fs/nfsclient/nfs_clvfsops.c
  stable/11/sys/fs/nfsclient/nfsmount.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/nfs/nfs.h
==
--- stable/11/sys/fs/nfs/nfs.h  Mon Apr 24 22:44:59 2017(r317392)
+++ stable/11/sys/fs/nfs/nfs.h  Mon Apr 24 23:47:12 2017(r317393)
@@ -601,6 +601,7 @@ struct nfsrv_descript {
uint8_t nd_sessionid[NFSX_V4SESSIONID]; /* Session id */
uint32_tnd_slotid;  /* Slotid for this RPC */
SVCXPRT *nd_xprt;   /* Server RPC handle */
+   uint32_t*nd_sequence;   /* Sequence Op. ptr */
 };
 
 #definend_princlen nd_gssnamelen
@@ -636,6 +637,7 @@ struct nfsrv_descript {
 #defineND_HASSEQUENCE  0x0400
 #defineND_CACHETHIS0x0800
 #defineND_LASTOP   0x1000
+#defineND_LOOPBADSESS  0x2000
 
 /*
  * ND_GSS should be the "or" of all GSS type authentications.
@@ -649,6 +651,7 @@ struct nfsv4_opflag {
int modifyfs;
int lktype;
int needsseq;
+   int loopbadsess;
 };
 
 /*

Modified: stable/11/sys/fs/nfs/nfs_commonkrpc.c
==
--- stable/11/sys/fs/nfs/nfs_commonkrpc.c   Mon Apr 24 22:44:59 2017
(r317392)
+++ stable/11/sys/fs/nfs/nfs_commonkrpc.c   Mon Apr 24 23:47:12 2017
(r317393)
@@ -89,6 +89,7 @@ uint32_t  nfscl_nfs4_done_probes[NFSV41_N
 NFSSTATESPINLOCK;
 NFSREQSPINLOCK;
 NFSDLOCKMUTEX;
+NFSCLSTATEMUTEX;
 extern struct nfsstatsv1 nfsstatsv1;
 extern struct nfsreqhead nfsd_reqq;
 extern int nfscl_ticks;
@@ -473,13 +474,13 @@ int
 newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp,
 struct nfsclient *clp, struct nfssockreq *nrp, vnode_t vp,
 struct thread *td, struct ucred *cred, u_int32_t prog, u_int32_t vers,
-u_char *retsum, int toplevel, u_int64_t *xidp, struct nfsclsession *sep)
+u_char *retsum, int toplevel, u_int64_t *xidp, struct nfsclsession *dssep)
 {
-   u_int32_t retseq, retval, *tl;
+   uint32_t retseq, retval, slotseq, *tl;
time_t waituntil;
int i = 0, j = 0, opcnt, set_sigset = 0, slot;
int trycnt, error = 0, usegssname = 0, secflavour = AUTH_SYS;
-   int freeslot, timeo;
+

Re: svn commit: r317383 - in head: . etc/mtree include lib/libc/net rescue/rescue sbin sbin/atm sbin/atm/atmconfig share/man/man4 sys/boot/forth sys/conf sys/dev/en sys/dev/fatm sys/dev/hatm sys/dev/p

2017-04-24 Thread Rodney W. Grimes
-- Start of PGP signed section.
> On Mon, Apr 24, 2017 at 09:21:50PM +, Brooks Davis wrote:
> > Author: brooks
> > Date: Mon Apr 24 21:21:49 2017
> > New Revision: 317383
> > URL: https://svnweb.freebsd.org/changeset/base/317383
> > 
> > Log:
> >   Remove the NATM framework including the en(4), fatm(4), hatm(4), and
> >   patm(4) devices.
> >   
> >   Maintaining an address family and framework has real costs when we make
> >   infrastructure improvements.  In the case of NATM we support no devices
> >   manufactured in the last 20 years and some will not even work in modern
> >   motherboards (some newer devices that patm(4) could be updated to
> >   support apparently exist, but we do not currently have support).
> >   
> >   With this change, support remains for some netgraph modules that don't
> >   require NATM support code. It is unclear if all these should remain,
> >   though ng_atmllc certainly stands alone.
> >   
> >   Note well: FreeBSD 11 supports NATM and will continue to do so until at
> >   least September 30, 2021.  Improvements to the code in FreeBSD 11 are
> >   certainly welcome.
> >   
> >   Reviewed by:  philip
> >   Approved by:  harti
> 
> Should have included:
> 
> Differential revision:https://reviews.freebsd.org/D9883

Should have further included:
Release Notes: yes

-- 
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: r317392 - stable/10/lib/libc/gen

2017-04-24 Thread Brooks Davis
Author: brooks
Date: Mon Apr 24 22:44:59 2017
New Revision: 317392
URL: https://svnweb.freebsd.org/changeset/base/317392

Log:
  MFC r316768:
  
  Fix an out-of-bounds write when a zero-length buffer is passed.
  
  Found with ttyname_test and CHERI bounds checking.
  
  Reviewed by:  emaste
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL

Modified:
  stable/10/lib/libc/gen/ttyname.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/gen/ttyname.c
==
--- stable/10/lib/libc/gen/ttyname.cMon Apr 24 22:37:54 2017
(r317391)
+++ stable/10/lib/libc/gen/ttyname.cMon Apr 24 22:44:59 2017
(r317392)
@@ -61,6 +61,10 @@ ttyname_r(int fd, char *buf, size_t len)
 {
size_t used;
 
+   /* Don't write off the end of a zero-length buffer. */
+   if (len < 1)
+   return (ERANGE);
+
*buf = '\0';
 
/* Must be a terminal. */
___
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: r317391 - stable/11/lib/libc/gen

2017-04-24 Thread Brooks Davis
Author: brooks
Date: Mon Apr 24 22:37:54 2017
New Revision: 317391
URL: https://svnweb.freebsd.org/changeset/base/317391

Log:
  MFC r316768:
  
  Fix an out-of-bounds write when a zero-length buffer is passed.
  
  Found with ttyname_test and CHERI bounds checking.
  
  Reviewed by:  emaste
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL

Modified:
  stable/11/lib/libc/gen/ttyname.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/gen/ttyname.c
==
--- stable/11/lib/libc/gen/ttyname.cMon Apr 24 22:35:00 2017
(r317390)
+++ stable/11/lib/libc/gen/ttyname.cMon Apr 24 22:37:54 2017
(r317391)
@@ -61,6 +61,10 @@ ttyname_r(int fd, char *buf, size_t len)
 {
size_t used;
 
+   /* Don't write off the end of a zero-length buffer. */
+   if (len < 1)
+   return (ERANGE);
+
*buf = '\0';
 
/* Must be a terminal. */
___
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: r317390 - head/sys/netinet

2017-04-24 Thread Navdeep Parhar
Author: np
Date: Mon Apr 24 22:35:00 2017
New Revision: 317390
URL: https://svnweb.freebsd.org/changeset/base/317390

Log:
  Flush the LRO ctrl as soon as lro_mbufs fills up.  There is no need to
  wait for the next enqueue from the driver.
  
  Reviewed by:  gnn@, hselasky@, gallatin@
  MFC after:1 week
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D10432

Modified:
  head/sys/netinet/tcp_lro.c

Modified: head/sys/netinet/tcp_lro.c
==
--- head/sys/netinet/tcp_lro.c  Mon Apr 24 22:31:56 2017(r317389)
+++ head/sys/netinet/tcp_lro.c  Mon Apr 24 22:35:00 2017(r317390)
@@ -959,10 +959,6 @@ tcp_lro_queue_mbuf(struct lro_ctrl *lc, 
return;
}
 
-   /* check if array is full */
-   if (__predict_false(lc->lro_mbuf_count == lc->lro_mbuf_max))
-   tcp_lro_flush_all(lc);
-
/* create sequence number */
lc->lro_mbuf_data[lc->lro_mbuf_count].seq =
(((uint64_t)M_HASHTYPE_GET(mb)) << 56) |
@@ -970,7 +966,11 @@ tcp_lro_queue_mbuf(struct lro_ctrl *lc, 
((uint64_t)lc->lro_mbuf_count);
 
/* enter mbuf */
-   lc->lro_mbuf_data[lc->lro_mbuf_count++].mb = mb;
+   lc->lro_mbuf_data[lc->lro_mbuf_count].mb = mb;
+
+   /* flush if array is full */
+   if (__predict_false(++lc->lro_mbuf_count == lc->lro_mbuf_max))
+   tcp_lro_flush_all(lc);
 }
 
 /* end */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317389 - head/sys/netinet

2017-04-24 Thread Navdeep Parhar
Author: np
Date: Mon Apr 24 22:31:56 2017
New Revision: 317389
URL: https://svnweb.freebsd.org/changeset/base/317389

Log:
  Frames that are not considered for LRO should not be counted in LRO 
statistics.
  
  Reviewed by:  gnn@, hselasky@, gallatin@
  MFC after:1 week
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D10430

Modified:
  head/sys/netinet/tcp_lro.c

Modified: head/sys/netinet/tcp_lro.c
==
--- head/sys/netinet/tcp_lro.c  Mon Apr 24 21:55:59 2017(r317388)
+++ head/sys/netinet/tcp_lro.c  Mon Apr 24 22:31:56 2017(r317389)
@@ -953,8 +953,6 @@ tcp_lro_queue_mbuf(struct lro_ctrl *lc, 
/* check if packet is not LRO capable */
if (__predict_false(mb->m_pkthdr.csum_flags == 0 ||
(lc->ifp->if_capenable & IFCAP_LRO) == 0)) {
-   lc->lro_flushed++;
-   lc->lro_queued++;
 
/* input packet to network layer */
(*lc->ifp->if_input) (lc->ifp, mb);
___
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: r317388 - head/usr.sbin/ntp/sntp

2017-04-24 Thread Brooks Davis
Author: brooks
Date: Mon Apr 24 21:55:59 2017
New Revision: 317388
URL: https://svnweb.freebsd.org/changeset/base/317388

Log:
  Use the approved syntax to build no man pages.
  
  MFC after:1 week
  Sponsored by: DARPA, AFRL

Modified:
  head/usr.sbin/ntp/sntp/Makefile

Modified: head/usr.sbin/ntp/sntp/Makefile
==
--- head/usr.sbin/ntp/sntp/Makefile Mon Apr 24 21:41:04 2017
(r317387)
+++ head/usr.sbin/ntp/sntp/Makefile Mon Apr 24 21:55:59 2017
(r317388)
@@ -5,7 +5,7 @@
 .PATH: ${SRCTOP}/contrib/ntp/sntp
 
 PROG=  sntp
-MK_MAN=no
+MAN=
 SRCS=  crypto.c kod_management.c log.c main.c networking.c \
sntp-opts.c sntp.c utilities.c
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317387 - stable/10/lib/libutil

2017-04-24 Thread Brooks Davis
Author: brooks
Date: Mon Apr 24 21:41:04 2017
New Revision: 317387
URL: https://svnweb.freebsd.org/changeset/base/317387

Log:
  MFC r316766:
  
  Correct an out of bounds read with HN_AUTOSCALE and very large numbers.
  
  The maximum scale is 6 (K, M, G, T, P, E) (B is 0).
  
  Overly large explict scales were checked correctly, but for sufficently
  large numbers HN_AUTOSCALE would get to 7 resulting in an out of bounds
  read.
  
  Found with humanize_number_test and CHERI bounds checking.
  
  Reviewed by:  emaste
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL

Modified:
  stable/10/lib/libutil/humanize_number.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libutil/humanize_number.c
==
--- stable/10/lib/libutil/humanize_number.c Mon Apr 24 21:35:02 2017
(r317386)
+++ stable/10/lib/libutil/humanize_number.c Mon Apr 24 21:41:04 2017
(r317387)
@@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-static const int maxscale = 7;
+static const int maxscale = 6;
 
 int
 humanize_number(char *buf, size_t len, int64_t quotient,
@@ -64,7 +64,7 @@ humanize_number(char *buf, size_t len, i
return (-1);
if (scale < 0)
return (-1);
-   else if (scale >= maxscale &&
+   else if (scale > maxscale &&
((scale & ~(HN_AUTOSCALE|HN_GETSCALE)) != 0))
return (-1);
if ((flags & HN_DIVISOR_1000) && (flags & HN_IEC_PREFIXES))
___
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: r317386 - stable/11/lib/libutil

2017-04-24 Thread Brooks Davis
Author: brooks
Date: Mon Apr 24 21:35:02 2017
New Revision: 317386
URL: https://svnweb.freebsd.org/changeset/base/317386

Log:
  MFC r316766:
  
  Correct an out of bounds read with HN_AUTOSCALE and very large numbers.
  
  The maximum scale is 6 (K, M, G, T, P, E) (B is 0).
  
  Overly large explict scales were checked correctly, but for sufficently
  large numbers HN_AUTOSCALE would get to 7 resulting in an out of bounds
  read.
  
  Found with humanize_number_test and CHERI bounds checking.
  
  Reviewed by:  emaste
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL

Modified:
  stable/11/lib/libutil/humanize_number.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libutil/humanize_number.c
==
--- stable/11/lib/libutil/humanize_number.c Mon Apr 24 21:31:27 2017
(r317385)
+++ stable/11/lib/libutil/humanize_number.c Mon Apr 24 21:35:02 2017
(r317386)
@@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-static const int maxscale = 7;
+static const int maxscale = 6;
 
 int
 humanize_number(char *buf, size_t len, int64_t quotient,
@@ -64,7 +64,7 @@ humanize_number(char *buf, size_t len, i
return (-1);
if (scale < 0)
return (-1);
-   else if (scale >= maxscale &&
+   else if (scale > maxscale &&
((scale & ~(HN_AUTOSCALE|HN_GETSCALE)) != 0))
return (-1);
if ((flags & HN_DIVISOR_1000) && (flags & HN_IEC_PREFIXES))
___
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: r317385 - head/usr.bin/getaddrinfo

2017-04-24 Thread Brooks Davis
Author: brooks
Date: Mon Apr 24 21:31:27 2017
New Revision: 317385
URL: https://svnweb.freebsd.org/changeset/base/317385

Log:
  Clean up Makefile.
  
  Prefer SRCTOP vs .CURDIR relative paths.
  
  Find libnetbsd using LIBADD infrastructure rather than manual hackery.
  
  Reviewed by:  ngie, bapt
  Obtained from:CheriBSD
  MFC after:1 week
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D10461

Modified:
  head/usr.bin/getaddrinfo/Makefile

Modified: head/usr.bin/getaddrinfo/Makefile
==
--- head/usr.bin/getaddrinfo/Makefile   Mon Apr 24 21:27:37 2017
(r317384)
+++ head/usr.bin/getaddrinfo/Makefile   Mon Apr 24 21:31:27 2017
(r317385)
@@ -3,19 +3,15 @@
 .include 
 
 PROG=  getaddrinfo
+SRCS=  getaddrinfo.c tables.h
 
-CFLAGS+=   -I${.CURDIR}/../../lib/libnetbsd
-LIBNETBSDDIR=  ${.OBJDIR}/../../lib/libnetbsd
-LIBNETBSD= ${LIBNETBSDDIR}/libnetbsd.a
-DPADD+=${LIBNETBSD}
-LDADD+=${LIBNETBSD}
+CFLAGS+=   -I${SRCTOP}/lib/libnetbsd
 
-LIBADD+=   util
+LIBADD+=   netbsd util
 
-SYS_SOCKET_H?= ${.CURDIR}/../../sys/sys/socket.h
+SYS_SOCKET_H?= ${SRCTOP}/sys/sys/socket.h
 
-CFLAGS+=   -I.
-DPSRCS+=   tables.h
+CFLAGS+=   -I${.OBJDIR}
 CLEANFILES+=   tables.h
 tables.h: tables.awk ${SYS_SOCKET_H}
LC_ALL=C awk -f ${.ALLSRC} > ${.TARGET}
___
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: r317384 - head

2017-04-24 Thread Brooks Davis
Author: brooks
Date: Mon Apr 24 21:27:37 2017
New Revision: 317384
URL: https://svnweb.freebsd.org/changeset/base/317384

Log:
  Document the removal of NATM.
  
  Relnotes: yes

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Mon Apr 24 21:21:49 2017(r317383)
+++ head/UPDATING   Mon Apr 24 21:27:37 2017(r317384)
@@ -51,6 +51,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12
 
 ** SPECIAL WARNING: **
 
+20170424:
+   The NATM framework including the en(4), fatm(4), hatm(4), and
+   patm(4) devices has been removed.  Consumers should plan a
+   migration before the end-of-life date for FreeBSD 11.
+
 20170420:
GNU diff has been replaced by a BSD licensed diff. Some features of GNU
diff has not been implemented, if those are needed a newer version of
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r317383 - in head: . etc/mtree include lib/libc/net rescue/rescue sbin sbin/atm sbin/atm/atmconfig share/man/man4 sys/boot/forth sys/conf sys/dev/en sys/dev/fatm sys/dev/hatm sys/dev/p

2017-04-24 Thread Brooks Davis
On Mon, Apr 24, 2017 at 09:21:50PM +, Brooks Davis wrote:
> Author: brooks
> Date: Mon Apr 24 21:21:49 2017
> New Revision: 317383
> URL: https://svnweb.freebsd.org/changeset/base/317383
> 
> Log:
>   Remove the NATM framework including the en(4), fatm(4), hatm(4), and
>   patm(4) devices.
>   
>   Maintaining an address family and framework has real costs when we make
>   infrastructure improvements.  In the case of NATM we support no devices
>   manufactured in the last 20 years and some will not even work in modern
>   motherboards (some newer devices that patm(4) could be updated to
>   support apparently exist, but we do not currently have support).
>   
>   With this change, support remains for some netgraph modules that don't
>   require NATM support code. It is unclear if all these should remain,
>   though ng_atmllc certainly stands alone.
>   
>   Note well: FreeBSD 11 supports NATM and will continue to do so until at
>   least September 30, 2021.  Improvements to the code in FreeBSD 11 are
>   certainly welcome.
>   
>   Reviewed by:philip
>   Approved by:harti

Should have included:

Differential revision:  https://reviews.freebsd.org/D9883

-- Brooks


signature.asc
Description: PGP signature


svn commit: r317383 - in head: . etc/mtree include lib/libc/net rescue/rescue sbin sbin/atm sbin/atm/atmconfig share/man/man4 sys/boot/forth sys/conf sys/dev/en sys/dev/fatm sys/dev/hatm sys/dev/pa...

2017-04-24 Thread Brooks Davis
Author: brooks
Date: Mon Apr 24 21:21:49 2017
New Revision: 317383
URL: https://svnweb.freebsd.org/changeset/base/317383

Log:
  Remove the NATM framework including the en(4), fatm(4), hatm(4), and
  patm(4) devices.
  
  Maintaining an address family and framework has real costs when we make
  infrastructure improvements.  In the case of NATM we support no devices
  manufactured in the last 20 years and some will not even work in modern
  motherboards (some newer devices that patm(4) could be updated to
  support apparently exist, but we do not currently have support).
  
  With this change, support remains for some netgraph modules that don't
  require NATM support code. It is unclear if all these should remain,
  though ng_atmllc certainly stands alone.
  
  Note well: FreeBSD 11 supports NATM and will continue to do so until at
  least September 30, 2021.  Improvements to the code in FreeBSD 11 are
  certainly welcome.
  
  Reviewed by:  philip
  Approved by:  harti

Deleted:
  head/sbin/atm/Makefile
  head/sbin/atm/Makefile.inc
  head/sbin/atm/atmconfig/Makefile
  head/sbin/atm/atmconfig/Makefile.depend
  head/sbin/atm/atmconfig/atm_oid.list
  head/sbin/atm/atmconfig/atmconfig.8
  head/sbin/atm/atmconfig/atmconfig.h
  head/sbin/atm/atmconfig/atmconfig.help
  head/sbin/atm/atmconfig/atmconfig_device.c
  head/sbin/atm/atmconfig/atmconfig_device.h
  head/sbin/atm/atmconfig/atmconfig_device.help
  head/sbin/atm/atmconfig/diag.c
  head/sbin/atm/atmconfig/diag.h
  head/sbin/atm/atmconfig/main.c
  head/sbin/atm/atmconfig/natm.c
  head/sbin/atm/atmconfig/private.h
  head/share/man/man4/en.4
  head/share/man/man4/fatm.4
  head/share/man/man4/hatm.4
  head/share/man/man4/natm.4
  head/share/man/man4/natmip.4
  head/share/man/man4/ng_atm.4
  head/share/man/man4/patm.4
  head/share/man/man4/utopia.4
  head/sys/dev/en/if_en_pci.c
  head/sys/dev/en/midway.c
  head/sys/dev/en/midwayreg.h
  head/sys/dev/en/midwayvar.h
  head/sys/dev/fatm/firmware.h
  head/sys/dev/fatm/if_fatm.c
  head/sys/dev/fatm/if_fatm_rate.h
  head/sys/dev/fatm/if_fatmreg.h
  head/sys/dev/fatm/if_fatmvar.h
  head/sys/dev/hatm/if_hatm.c
  head/sys/dev/hatm/if_hatm_intr.c
  head/sys/dev/hatm/if_hatm_ioctl.c
  head/sys/dev/hatm/if_hatm_rx.c
  head/sys/dev/hatm/if_hatm_tx.c
  head/sys/dev/hatm/if_hatmconf.h
  head/sys/dev/hatm/if_hatmreg.h
  head/sys/dev/hatm/if_hatmvar.h
  head/sys/dev/patm/genrtab/Makefile
  head/sys/dev/patm/genrtab/genrtab.c
  head/sys/dev/patm/idt77252reg.h
  head/sys/dev/patm/if_patm.c
  head/sys/dev/patm/if_patm_attach.c
  head/sys/dev/patm/if_patm_intr.c
  head/sys/dev/patm/if_patm_ioctl.c
  head/sys/dev/patm/if_patm_rtables.c
  head/sys/dev/patm/if_patm_rx.c
  head/sys/dev/patm/if_patm_tx.c
  head/sys/dev/patm/if_patmvar.h
  head/sys/dev/utopia/idtphy.c
  head/sys/dev/utopia/idtphy.h
  head/sys/dev/utopia/suni.c
  head/sys/dev/utopia/suni.h
  head/sys/dev/utopia/utopia.c
  head/sys/dev/utopia/utopia.h
  head/sys/dev/utopia/utopia_priv.h
  head/sys/modules/en/Makefile
  head/sys/modules/fatm/Makefile
  head/sys/modules/hatm/Makefile
  head/sys/modules/netgraph/atm/atm/Makefile
  head/sys/modules/patm/Makefile
  head/sys/modules/utopia/Makefile
  head/sys/net/if_atm.h
  head/sys/net/if_atmsubr.c
  head/sys/netgraph/atm/ng_atm.c
  head/sys/netgraph/atm/ng_atm.h
  head/sys/netinet/if_atm.c
  head/sys/netinet/if_atm.h
  head/sys/netnatm/natm.c
  head/sys/netnatm/natm.h
  head/sys/netnatm/natm_pcb.c
  head/sys/netnatm/natm_proto.c
  head/usr.sbin/bsnmpd/modules/snmp_atm/BEGEMOT-ATM-FREEBSD-MIB.txt
  head/usr.sbin/bsnmpd/modules/snmp_atm/Makefile
  head/usr.sbin/bsnmpd/modules/snmp_atm/Makefile.depend
  head/usr.sbin/bsnmpd/modules/snmp_atm/atm_freebsd.def
  head/usr.sbin/bsnmpd/modules/snmp_atm/atm_sys.c
  head/usr.sbin/ppp/atm.c
  head/usr.sbin/ppp/atm.h
Modified:
  head/ObsoleteFiles.inc
  head/etc/mtree/BSD.usr.dist
  head/include/Makefile
  head/lib/libc/net/getnameinfo.c
  head/rescue/rescue/Makefile
  head/sbin/Makefile
  head/share/man/man4/Makefile
  head/sys/boot/forth/loader.conf
  head/sys/conf/NOTES
  head/sys/conf/config.mk
  head/sys/conf/files
  head/sys/conf/options
  head/sys/modules/Makefile
  head/sys/modules/netgraph/atm/Makefile
  head/sys/net/netisr.h
  head/sys/netgraph/ng_atmllc.c
  head/sys/sys/param.h
  head/usr.sbin/bsnmpd/modules/Makefile
  head/usr.sbin/ppp/Makefile
  head/usr.sbin/ppp/physical.c

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Mon Apr 24 20:46:19 2017(r317382)
+++ head/ObsoleteFiles.inc  Mon Apr 24 21:21:49 2017(r317383)
@@ -38,6 +38,44 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20170424: NATM support removed
+OLD_FILES+=rescue/atmconfig
+OLD_FILES+=sbin/atmconfig
+OLD_FILES+=usr/include/bsnmp/snmp_atm.h
+OLD_FILES+=usr/include/dev/utopia/idtphy.h
+OLD_FILES+=usr/include/dev/utopia/suni.h
+OLD_FILES+=usr/include/dev/utopia/utopia.h
+OLD_FILES+=usr/include/dev

svn commit: r317382 - head/sys/fs/nfsserver

2017-04-24 Thread Rick Macklem
Author: rmacklem
Date: Mon Apr 24 20:46:19 2017
New Revision: 317382
URL: https://svnweb.freebsd.org/changeset/base/317382

Log:
  Allow use of a write open stateid for reading in the NFSv4 server.
  
  The NFSv4 RFCs give a server the option of allowing the use of an open
  stateid for write access to be used for a Read operation.
  This patch enables this by default and adds a sysctl to disable it,
  for anyone who does not want this capability.
  Allowing this is particularily useful for a pNFS Data Server (DS), since
  they are not permitted to allow the use of special stateids.
  Discovered during recent testing of the pNFS server under development.
  
  MFC after:2 weeks

Modified:
  head/sys/fs/nfsserver/nfs_nfsdstate.c

Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c
==
--- head/sys/fs/nfsserver/nfs_nfsdstate.c   Mon Apr 24 20:34:56 2017
(r317381)
+++ head/sys/fs/nfsserver/nfs_nfsdstate.c   Mon Apr 24 20:46:19 2017
(r317382)
@@ -75,6 +75,11 @@ SYSCTL_INT(_vfs_nfsd, OID_AUTO, writedel
 _writedelegifpos, 0,
 "Issue a write delegation for read opens if possible");
 
+static int nfsrv_allowreadforwriteopen = 1;
+SYSCTL_INT(_vfs_nfsd, OID_AUTO, allowreadforwriteopen, CTLFLAG_RW,
+_allowreadforwriteopen, 0,
+"Allow Reads to be done with Write Access StateIDs");
+
 /*
  * Hash lists for nfs V4.
  */
@@ -1872,7 +1877,8 @@ tryagain:
   mystp->ls_flags & NFSLCK_ACCESSBITS)) ||
((new_stp->ls_flags & (NFSLCK_CHECK|NFSLCK_READACCESS)) ==
  (NFSLCK_CHECK | NFSLCK_READACCESS) &&
-!(mystp->ls_flags & NFSLCK_READACCESS)) ||
+!(mystp->ls_flags & NFSLCK_READACCESS) &&
+nfsrv_allowreadforwriteopen == 0) ||
((new_stp->ls_flags & (NFSLCK_CHECK|NFSLCK_WRITEACCESS)) ==
  (NFSLCK_CHECK | NFSLCK_WRITEACCESS) &&
 !(mystp->ls_flags & NFSLCK_WRITEACCESS))) {
___
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: r317381 - head/usr.bin/diff

2017-04-24 Thread Dimitry Andric
Author: dim
Date: Mon Apr 24 20:34:56 2017
New Revision: 317381
URL: https://svnweb.freebsd.org/changeset/base/317381

Log:
  Fix the following warning from gcc 4.2 in usr.bin/diff:
  
  usr.bin/diff/diffreg.c: In function 'change':
  usr.bin/diff/diffreg.c:1085: warning: 'i' may be used uninitialized in this 
function
  
  This version of gcc is not smart enough to see that 'i' cannot actually
  be used unitialized.  However, the variable is confusingly re-used, so
  it is better to give it another name, and clearly initialize it before
  attempting to use it.
  
  Reviewed by:  bapt
  Differential Revision: https://reviews.freebsd.org/D10484

Modified:
  head/usr.bin/diff/diffreg.c

Modified: head/usr.bin/diff/diffreg.c
==
--- head/usr.bin/diff/diffreg.c Mon Apr 24 18:35:25 2017(r317380)
+++ head/usr.bin/diff/diffreg.c Mon Apr 24 20:34:56 2017(r317381)
@@ -1082,7 +1082,7 @@ change(char *file1, FILE *f1, char *file
 {
static size_t max_context = 64;
long curpos;
-   int i, nc;
+   int i, nc, f;
const char *walk;
 
 restart:
@@ -1214,9 +1214,10 @@ proceed:
if (a <= b && c <= d && diff_format == D_NORMAL)
diff_output("---\n");
}
+   f = 0;
if (diff_format != D_GFORMAT)
-   i = fetch(ixnew, c, d, f2, diff_format == D_NORMAL ? '>' : 
'\0', 0, *pflags);
-   if (i != 0 && diff_format == D_EDIT) {
+   f = fetch(ixnew, c, d, f2, diff_format == D_NORMAL ? '>' : 
'\0', 0, *pflags);
+   if (f != 0 && diff_format == D_EDIT) {
/*
 * A non-zero return value for D_EDIT indicates that the
 * last line printed was a bare dot (".") that has been
@@ -1225,10 +1226,10 @@ proceed:
 * back and restart where we left off.
 */
diff_output(".\n");
-   diff_output("%ds/.//\n", a + i - 1);
-   b = a + i - 1;
+   diff_output("%ds/.//\n", a + f - 1);
+   b = a + f - 1;
a = b + 1;
-   c += i;
+   c += f;
goto restart;
}
if ((diff_format == D_EDIT || diff_format == D_REVERSE) && c <= d)
___
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: r317380 - in head/sys: dev/bhnd dev/bhnd/bcma dev/bhnd/siba mips/broadcom

2017-04-24 Thread Landon J. Fuller
Author: landonf
Date: Mon Apr 24 18:35:25 2017
New Revision: 317380
URL: https://svnweb.freebsd.org/changeset/base/317380

Log:
  Add support for dumping bcma/siba EROM tables to the console via a new
  BHND_EROM_DUMP() method.
  
  Dump the EROM tables to the coneole on mips/broadcom devices if bootverbose
  is enabled; this functionality is primarily useful when debugging SoC EROM
  parsing and device matching issues during early boot.
  
  Reviewed by:  mizhka
  Approved by:  adrian (mentor)
  Sponsored by: Plausible Labs
  Differential Revision:https://reviews.freebsd.org/D10122

Modified:
  head/sys/dev/bhnd/bcma/bcma_erom.c
  head/sys/dev/bhnd/bhnd_erom.h
  head/sys/dev/bhnd/bhnd_erom_if.m
  head/sys/dev/bhnd/siba/siba_erom.c
  head/sys/mips/broadcom/bcm_machdep.c

Modified: head/sys/dev/bhnd/bcma/bcma_erom.c
==
--- head/sys/dev/bhnd/bcma/bcma_erom.c  Mon Apr 24 18:09:52 2017
(r317379)
+++ head/sys/dev/bhnd/bcma/bcma_erom.c  Mon Apr 24 18:35:25 2017
(r317380)
@@ -1367,6 +1367,157 @@ failed:
return error;
 }
 
+static int
+bcma_erom_dump(bhnd_erom_t *erom)
+{
+   struct bcma_erom*sc;
+   uint32_tentry;
+   int error;
+
+   sc = (struct bcma_erom *)erom;
+
+   bcma_erom_reset(sc);
+
+   while (!(error = bcma_erom_read32(sc, ))) {
+   /* Handle EOF */
+   if (entry == BCMA_EROM_TABLE_EOF) {
+   EROM_LOG(sc, "EOF\n");
+   return (0);
+   }
+
+   /* Invalid entry */
+   if (!BCMA_EROM_GET_ATTR(entry, ENTRY_ISVALID)) {
+   EROM_LOG(sc, "invalid EROM entry %#x\n", entry);
+   return (EINVAL);
+   }
+
+   switch (BCMA_EROM_GET_ATTR(entry, ENTRY_TYPE)) {
+   case BCMA_EROM_ENTRY_TYPE_CORE: {
+   /* CoreDescA */
+   EROM_LOG(sc, "coreA (0x%x)\n", entry);
+   EROM_LOG(sc, "\tdesigner:\t0x%x\n",
+   BCMA_EROM_GET_ATTR(entry, COREA_DESIGNER));
+   EROM_LOG(sc, "\tid:\t\t0x%x\n",
+   BCMA_EROM_GET_ATTR(entry, COREA_ID));
+   EROM_LOG(sc, "\tclass:\t\t0x%x\n",
+   BCMA_EROM_GET_ATTR(entry, COREA_CLASS));
+
+   /* CoreDescB */
+   if ((error = bcma_erom_read32(sc, ))) {
+   EROM_LOG(sc, "error reading CoreDescB: %d\n",
+   error);
+   return (error);
+   }
+
+   if (!BCMA_EROM_ENTRY_IS(entry, CORE)) {
+   EROM_LOG(sc, "invalid core descriptor; found "
+   "unexpected entry %#x (type=%s)\n",
+   entry, bcma_erom_entry_type_name(entry));
+   return (EINVAL);
+   }
+
+   EROM_LOG(sc, "coreB (0x%x)\n", entry);
+   EROM_LOG(sc, "\trev:\t0x%x\n",
+   BCMA_EROM_GET_ATTR(entry, COREB_REV));
+   EROM_LOG(sc, "\tnummp:\t0x%x\n",
+   BCMA_EROM_GET_ATTR(entry, COREB_NUM_MP));
+   EROM_LOG(sc, "\tnumdp:\t0x%x\n",
+   BCMA_EROM_GET_ATTR(entry, COREB_NUM_DP));
+   EROM_LOG(sc, "\tnumwmp:\t0x%x\n",
+   BCMA_EROM_GET_ATTR(entry, COREB_NUM_WMP));
+   EROM_LOG(sc, "\tnumwsp:\t0x%x\n",
+   BCMA_EROM_GET_ATTR(entry, COREB_NUM_WMP));
+
+   break;
+   }
+   case BCMA_EROM_ENTRY_TYPE_MPORT:
+   EROM_LOG(sc, "\tmport 0x%x\n", entry);
+   EROM_LOG(sc, "\t\tport:\t0x%x\n",
+   BCMA_EROM_GET_ATTR(entry, MPORT_NUM));
+   EROM_LOG(sc, "\t\tid:\t\t0x%x\n",
+   BCMA_EROM_GET_ATTR(entry, MPORT_ID));
+   break;
+
+   case BCMA_EROM_ENTRY_TYPE_REGION: {
+   booladdr64;
+   uint8_t size_type;
+
+   addr64 = (BCMA_EROM_GET_ATTR(entry, REGION_64BIT) != 0);
+   size_type = BCMA_EROM_GET_ATTR(entry, REGION_SIZE);
+
+   EROM_LOG(sc, "\tregion 0x%x:\n", entry);
+   EROM_LOG(sc, "\t\t%s:\t0x%x\n",
+   addr64 ? "baselo" : "base",
+   BCMA_EROM_GET_ATTR(entry, REGION_BASE));
+   EROM_LOG(sc, "\t\tport:\t0x%x\n",
+   BCMA_EROM_GET_ATTR(entry, REGION_PORT));
+   EROM_LOG(sc, "\t\ttype:\t0x%x\n",
+  

svn commit: r317379 - head/sys/dev/bhnd/nvram

2017-04-24 Thread Landon J. Fuller
Author: landonf
Date: Mon Apr 24 18:09:52 2017
New Revision: 317379
URL: https://svnweb.freebsd.org/changeset/base/317379

Log:
  Drop unused/unnecessary return statement.
  
  Reported by:  Coverity
  CID:  1373118
  Approved by:  adrian (mentor, implicit)

Modified:
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c Mon Apr 24 16:52:26 
2017(r317378)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c Mon Apr 24 18:09:52 
2017(r317379)
@@ -1256,7 +1256,6 @@ bhnd_nvram_sprom_read_var(struct bhnd_sp
/* Provide value wrapper */
return (bhnd_nvram_val_init(val, var->fmt, inp, ilen, var->type,
BHND_NVRAM_VAL_BORROW_DATA));
-   return (error);
 }
 
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317378 - head/usr.bin/sed

2017-04-24 Thread Benedict Reuschling
Author: bcr (doc committer)
Date: Mon Apr 24 16:52:26 2017
New Revision: 317378
URL: https://svnweb.freebsd.org/changeset/base/317378

Log:
  Fix the last example to really replace all occurrences of the search string
  in the file by adding the global (g) option at the end.  Without it, only the
  first match is replaced, subsequent ones are ignored.  The intention of the
  example is to demonstrate something else, but adding the g matches the example
  to what the description says.
  
  Discussed with:   brd (on IRC)
  MFC after:1 week

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

Modified: head/usr.bin/sed/sed.1
==
--- head/usr.bin/sed/sed.1  Mon Apr 24 16:49:30 2017(r317377)
+++ head/usr.bin/sed/sed.1  Mon Apr 24 16:52:26 2017(r317378)
@@ -614,7 +614,7 @@ in the file
 .Pa test.txt ,
 without creating a backup of the file:
 .Bd -literal -offset indent
-sed -i '' -e 's/foo/bar/' test.txt
+sed -i '' -e 's/foo/bar/g' test.txt
 .Ed
 .Sh SEE ALSO
 .Xr awk 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: r317377 - stable/11/usr.sbin/acpi/acpidump

2017-04-24 Thread Andrew Turner
Author: andrew
Date: Mon Apr 24 16:49:30 2017
New Revision: 317377
URL: https://svnweb.freebsd.org/changeset/base/317377

Log:
  MFC r302788, r303026, r305471
  
  r302788:
  Fix the type used to hold the value returned from getopt. On arm64 char is
  unsigned so will never be -1.
  
  r303026:
  Add missing flags from acpidump. These are defined in the header, but not
  printed. The HW_REDUCED flag is useful as it should be set on arm64 to
  comply with the ARM Server Base Boot Requirements.
  
  r305471:
  Teach acpidump how to parse ACPI 5.1 tables found on the development
  ThunderX units in the netperf cluster.

Modified:
  stable/11/usr.sbin/acpi/acpidump/acpi.c
  stable/11/usr.sbin/acpi/acpidump/acpidump.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/acpi/acpidump/acpi.c
==
--- stable/11/usr.sbin/acpi/acpidump/acpi.c Mon Apr 24 16:37:25 2017
(r317376)
+++ stable/11/usr.sbin/acpi/acpidump/acpi.c Mon Apr 24 16:49:30 2017
(r317377)
@@ -356,6 +356,23 @@ acpi_print_mps_flags(uint16_t flags)
 }
 
 static void
+acpi_print_gicc_flags(uint32_t flags)
+{
+
+   printf("\tFlags={Performance intr=");
+   if (flags & ACPI_MADT_PERFORMANCE_IRQ_MODE)
+   printf("edge");
+   else
+   printf("level");
+   printf(", VGIC intr=");
+   if (flags & ACPI_MADT_VGIC_IRQ_MODE)
+   printf("edge");
+   else
+   printf("level");
+   printf("}\n");
+}
+
+static void
 acpi_print_intr(uint32_t intr, uint16_t mps_flags)
 {
 
@@ -375,7 +392,12 @@ static const char *apic_types[] = { "Loc
"NMI", "Local APIC NMI",
"Local APIC Override", "IO SAPIC",
"Local SAPIC", "Platform Interrupt",
-   "Local X2APIC", "Local X2APIC NMI" };
+   "Local X2APIC", "Local X2APIC NMI",
+   "GIC CPU Interface Structure",
+   "GIC Distributor Structure",
+   "GICv2m MSI Frame",
+   "GIC Redistributor Structure",
+   "GIC ITS Structure" };
 static const char *platform_int_types[] = { "0 (unknown)", "PMI", "INIT",
"Corrected Platform Error" };
 
@@ -393,6 +415,10 @@ acpi_print_madt(ACPI_SUBTABLE_HEADER *mp
ACPI_MADT_INTERRUPT_SOURCE *isrc;
ACPI_MADT_LOCAL_X2APIC *x2apic;
ACPI_MADT_LOCAL_X2APIC_NMI *x2apic_nmi;
+   ACPI_MADT_GENERIC_INTERRUPT *gicc;
+   ACPI_MADT_GENERIC_DISTRIBUTOR *gicd;
+   ACPI_MADT_GENERIC_REDISTRIBUTOR *gicr;
+   ACPI_MADT_GENERIC_TRANSLATOR *gict;
 
if (mp->Type < nitems(apic_types))
printf("\tType=%s\n", apic_types[mp->Type]);
@@ -463,6 +489,41 @@ acpi_print_madt(ACPI_SUBTABLE_HEADER *mp
acpi_print_cpu_uid(x2apic_nmi->Uid, NULL);
acpi_print_local_nmi(x2apic_nmi->Lint, x2apic_nmi->IntiFlags);
break;
+   case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
+   gicc = (ACPI_MADT_GENERIC_INTERRUPT *)mp;
+   acpi_print_cpu_uid(gicc->Uid, NULL);
+   printf("\tCPU INTERFACE=%x\n", gicc->CpuInterfaceNumber);
+   acpi_print_gicc_flags(gicc->Flags);
+   printf("\tParking Protocol Version=%x\n", gicc->ParkingVersion);
+   printf("\tPERF INTR=%d\n", gicc->PerformanceInterrupt);
+   printf("\tParked ADDR=%016jx\n",
+   (uintmax_t)gicc->ParkedAddress);
+   printf("\tBase ADDR=%016jx\n", (uintmax_t)gicc->BaseAddress);
+   printf("\tGICV=%016jx\n", (uintmax_t)gicc->GicvBaseAddress);
+   printf("\tGICH=%016jx\n", (uintmax_t)gicc->GichBaseAddress);
+   printf("\tVGIC INTR=%d\n", gicc->VgicInterrupt);
+   printf("\tGICR ADDR=%016jx\n",
+   (uintmax_t)gicc->GicrBaseAddress);
+   printf("\tMPIDR=%jx\n", (uintmax_t)gicc->ArmMpidr);
+   printf("\tEfficency Class=%d\n", (u_int)gicc->EfficiencyClass);
+   break;
+   case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
+   gicd = (ACPI_MADT_GENERIC_DISTRIBUTOR *)mp;
+   printf("\tGIC ID=%d\n", (u_int)gicd->GicId);
+   printf("\tBase ADDR=%016jx\n", (uintmax_t)gicd->BaseAddress);
+   printf("\tVector Base=%d\n", gicd->GlobalIrqBase);
+   printf("\tGIC VERSION=%d\n", (u_int)gicd->Version);
+   break;
+   case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR:
+   gicr = (ACPI_MADT_GENERIC_REDISTRIBUTOR *)mp;
+   printf("\tBase ADDR=%016jx\n", (uintmax_t)gicr->BaseAddress);
+   printf("\tLength=%08x\n", gicr->Length);
+   

svn commit: r317376 - head/release/scripts

2017-04-24 Thread Ed Maste
Author: emaste
Date: Mon Apr 24 16:37:25 2017
New Revision: 317376
URL: https://svnweb.freebsd.org/changeset/base/317376

Log:
  Add sysutils/tmux to the DVD package set
  
  The zsh + tmux combination is commonly wanted.
  
  Approved by:  gjb
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/scripts/pkg-stage.sh

Modified: head/release/scripts/pkg-stage.sh
==
--- head/release/scripts/pkg-stage.sh   Mon Apr 24 16:31:28 2017
(r317375)
+++ head/release/scripts/pkg-stage.sh   Mon Apr 24 16:37:25 2017
(r317376)
@@ -24,6 +24,7 @@ shells/bash
 shells/zsh
 security/sudo
 sysutils/screen
+sysutils/tmux
 www/firefox
 www/links
 x11-drivers/xf86-video-vmware
___
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: r317375 - in stable/10: cddl/lib/libdtrace sys/netinet

2017-04-24 Thread Steven Hartland
Author: smh
Date: Mon Apr 24 16:31:28 2017
New Revision: 317375
URL: https://svnweb.freebsd.org/changeset/base/317375

Log:
  Partial MFC r316676 and the required r313045
  
  MFC r316676:
  
  Use estimated RTT for receive buffer auto resizing instead of timestamps.
  This is a partial MFC as stable/10 doesn't include the TCP stack
  modularisation.
  
  MFC r313045:
  
  Add an mbuf to ipinfo_t translator to finish cleanup of mbuf passing to TCP
  probes. This is a partial MFC (missing debug__output & debug__drop changes)
  due to the massive amount of additional dtrace changes that would be
  required for a full MFC.
  
  Relnotes: Yes
  Sponsored by: Multiplay

Modified:
  stable/10/cddl/lib/libdtrace/ip.d
  stable/10/sys/netinet/in_kdtrace.c
  stable/10/sys/netinet/in_kdtrace.h
  stable/10/sys/netinet/tcp_input.c
  stable/10/sys/netinet/tcp_output.c
  stable/10/sys/netinet/tcp_var.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/lib/libdtrace/ip.d
==
--- stable/10/cddl/lib/libdtrace/ip.d   Mon Apr 24 16:07:30 2017
(r317374)
+++ stable/10/cddl/lib/libdtrace/ip.d   Mon Apr 24 16:31:28 2017
(r317375)
@@ -240,6 +240,24 @@ translator ipinfo_t < uint8_t *p > {
 #pragma D binding "1.0" IFF_LOOPBACK
 inline int IFF_LOOPBACK =  0x8;
 
+#pragma D binding "1.13" translator
+translator ipinfo_t < struct mbuf *m > {
+   ip_ver =m == NULL ? 0 : ((struct ip *)m->m_data)->ip_v;
+   ip_plength =m == NULL ? 0 :
+   ((struct ip *)m->m_data)->ip_v == 4 ?
+   ntohs(((struct ip *)m->m_data)->ip_len) - 
+   (((struct ip *)m->m_data)->ip_hl << 2):
+   ntohs(((struct ip6_hdr 
*)m->m_data)->ip6_ctlun.ip6_un1.ip6_un1_plen);
+   ip_saddr =  m == NULL ? 0 :
+   ((struct ip *)m->m_data)->ip_v == 4 ?
+   inet_ntoa(&((struct ip *)m->m_data)->ip_src.s_addr) :
+   inet_ntoa6(&((struct ip6_hdr *)m->m_data)->ip6_src);
+   ip_daddr =  m == NULL ? 0 :
+   ((struct ip *)m->m_data)->ip_v == 4 ?
+   inet_ntoa(&((struct ip *)m->m_data)->ip_dst.s_addr) :
+   inet_ntoa6(&((struct ip6_hdr *)m->m_data)->ip6_dst);
+};
+
 #pragma D binding "1.0" translator
 translator ifinfo_t < struct ifnet *p > {
if_name =   p->if_xname;

Modified: stable/10/sys/netinet/in_kdtrace.c
==
--- stable/10/sys/netinet/in_kdtrace.c  Mon Apr 24 16:07:30 2017
(r317374)
+++ stable/10/sys/netinet/in_kdtrace.c  Mon Apr 24 16:31:28 2017
(r317375)
@@ -58,28 +58,28 @@ SDT_PROBE_DEFINE6_XLATE(ip, , , send,
 SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__established,
 "void *", "pktinfo_t *",
 "struct tcpcb *", "csinfo_t *",
-"uint8_t *", "ipinfo_t *",
+"struct mbuf *", "ipinfo_t *",
 "struct tcpcb *", "tcpsinfo_t *" ,
 "struct tcphdr *", "tcpinfoh_t *");
 
 SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__refused,
 "void *", "pktinfo_t *",
 "struct tcpcb *", "csinfo_t *",
-"uint8_t *", "ipinfo_t *",
+"struct mbuf *", "ipinfo_t *",
 "struct tcpcb *", "tcpsinfo_t *" ,
 "struct tcphdr *", "tcpinfo_t *");
 
 SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__established,
 "void *", "pktinfo_t *",
 "struct tcpcb *", "csinfo_t *",
-"uint8_t *", "ipinfo_t *",
+"struct mbuf *", "ipinfo_t *",
 "struct tcpcb *", "tcpsinfo_t *" ,
 "struct tcphdr *", "tcpinfoh_t *");
 
 SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__refused,
 "void *", "pktinfo_t *",
 "struct tcpcb *", "csinfo_t *",
-"uint8_t *", "ipinfo_t *",
+"struct mbuf *", "ipinfo_t *",
 "struct tcpcb *", "tcpsinfo_t *" ,
 "struct tcphdr *", "tcpinfoh_t *");
 
@@ -93,7 +93,7 @@ SDT_PROBE_DEFINE5_XLATE(tcp, , , connect
 SDT_PROBE_DEFINE5_XLATE(tcp, , , receive,
 "void *", "pktinfo_t *",
 "struct tcpcb *", "csinfo_t *",
-"uint8_t *", "ipinfo_t *",
+"struct mbuf *", "ipinfo_t *",
 "struct tcpcb *", "tcpsinfo_t *" ,
 "struct tcphdr *", "tcpinfoh_t *");
 
@@ -112,6 +112,14 @@ SDT_PROBE_DEFINE6_XLATE(tcp, , , state__
 "void *", "void *",
 "int", "tcplsinfo_t *");
 
+SDT_PROBE_DEFINE6_XLATE(tcp, , , receive__autoresize,
+"void *", "void *",
+"struct tcpcb *", "csinfo_t *",
+"struct mbuf *", "ipinfo_t *",
+"struct tcpcb *", "tcpsinfo_t *" ,
+"struct tcphdr *", "tcpinfoh_t *",
+"int", "int");
+
 SDT_PROBE_DEFINE5_XLATE(udp, , , receive,
 "void *", "pktinfo_t *",
 "struct inpcb *", "csinfo_t *",

Modified: stable/10/sys/netinet/in_kdtrace.h
==
--- stable/10/sys/netinet/in_kdtrace.h  Mon Apr 24 16:07:30 2017
(r317374)
+++ stable/10/sys/netinet/in_kdtrace.h  Mon Apr 24 16:31:28 2017
(r317375)
@@ -52,6 +52,7 @@ SDT_PROBE_DECLARE(tcp, , , connect__requ
 

svn commit: r317374 - stable/11/sbin/camcontrol

2017-04-24 Thread Alan Somers
Author: asomers
Date: Mon Apr 24 16:07:30 2017
New Revision: 317374
URL: https://svnweb.freebsd.org/changeset/base/317374

Log:
  MFC r312558:
  
  Misc Coverity fixes in camcontrol(8)
  
  CID 1229913   Fix output of "camcontrol persist -i report_capabilities".
The reported Persistent Reservation Types were wrong in all
cases.
  CID 1356029   Annotate the code so Coverity will know that this is a false
positive.
  CID 1366830   Fix a memory leak in "camcontrol timestamp -s"
  CID 1366832   Fix a segfault that could be caused by bad drive firmware
  
  Also, fix the man page entry for the "camcontrol epc state" command to match
  what the code does.
  
  Reviewed by:  ken, wblock
  MFC after:4 weeks
  Sponsored by: Spectra Logic Corp
  Differential Revision:https://reviews.freebsd.org/D9239

Modified:
  stable/11/sbin/camcontrol/camcontrol.8
  stable/11/sbin/camcontrol/epc.c
  stable/11/sbin/camcontrol/persist.c
  stable/11/sbin/camcontrol/timestamp.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/camcontrol/camcontrol.8
==
--- stable/11/sbin/camcontrol/camcontrol.8  Mon Apr 24 15:29:17 2017
(r317373)
+++ stable/11/sbin/camcontrol/camcontrol.8  Mon Apr 24 16:07:30 2017
(r317374)
@@ -2385,6 +2385,20 @@ this power condition will be affected.
 .It state
 Enable or disable a particular power condition.
 .Bl -tag -width 7n
+.It Fl e
+Enable the power condition.
+One of 
+.Fl e
+or
+.Fl d
+is required.
+.It Fl d
+Disable the power condition.
+One of
+.Fl d
+or
+.Fl e
+is required.
 .It Fl p Ar cond
 Specify the power condition: Idle_a, Idle_b, Idle_c, Standby_y, Standby_z.
 This argument is required.

Modified: stable/11/sbin/camcontrol/epc.c
==
--- stable/11/sbin/camcontrol/epc.c Mon Apr 24 15:29:17 2017
(r317373)
+++ stable/11/sbin/camcontrol/epc.c Mon Apr 24 16:07:30 2017
(r317374)
@@ -783,6 +783,7 @@ epc(struct cam_device *device, int argc,
warnx("Must specify a timer value (-T time)");
error = 1;
}
+   /* FALLTHROUGH */
case ATA_SF_EPC_SET_STATE:
if (enable == -1) {
warnx("Must specify enable (-e) or disable (-d)");

Modified: stable/11/sbin/camcontrol/persist.c
==
--- stable/11/sbin/camcontrol/persist.c Mon Apr 24 15:29:17 2017
(r317373)
+++ stable/11/sbin/camcontrol/persist.c Mon Apr 24 16:07:30 2017
(r317374)
@@ -241,9 +241,11 @@ persist_print_cap(struct scsi_per_res_ca
 {
uint32_t length;
int check_type_mask = 0;
+   uint32_t type_mask;
 
length = scsi_2btoul(cap->length);
length = MIN(length, valid_len);
+   type_mask = scsi_2btoul(cap->type_mask);
 
if (length < __offsetof(struct scsi_per_res_cap, type_mask)) {
fprintf(stdout, "Insufficient data (%u bytes) to report "
@@ -345,20 +347,20 @@ persist_print_cap(struct scsi_per_res_ca
fprintf(stdout, "Supported Persistent Reservation Types:\n");
fprintf(stdout, "Write Exclusive - All Registrants "
"(WR_EX_AR): %d\n",
-   (cap->type_mask[0] & SPRI_TM_WR_EX_AR)? 1 : 0);
+   (type_mask & SPRI_TM_WR_EX_AR)? 1 : 0);
fprintf(stdout, "Exclusive Access - Registrants Only "
"(EX_AC_RO): %d\n",
-   (cap->type_mask[0] & SPRI_TM_EX_AC_RO) ? 1 : 0);
+   (type_mask & SPRI_TM_EX_AC_RO) ? 1 : 0);
fprintf(stdout, "Write Exclusive - Registrants Only "
"(WR_EX_RO): %d\n",
-   (cap->type_mask[0] & SPRI_TM_WR_EX_RO)? 1 : 0);
+   (type_mask & SPRI_TM_WR_EX_RO)? 1 : 0);
fprintf(stdout, "Exclusive Access (EX_AC): %d\n",
-   (cap->type_mask[0] & SPRI_TM_EX_AC) ? 1 : 0);
+   (type_mask & SPRI_TM_EX_AC) ? 1 : 0);
fprintf(stdout, "Write Exclusive (WR_EX): %d\n",
-   (cap->type_mask[0] & SPRI_TM_WR_EX) ? 1 : 0);
+   (type_mask & SPRI_TM_WR_EX) ? 1 : 0);
fprintf(stdout, "Exclusive Access - All Registrants "
"(EX_AC_AR): %d\n",
-   (cap->type_mask[1] & SPRI_TM_EX_AC_AR) ? 1 : 0);
+   (type_mask & SPRI_TM_EX_AC_AR) ? 1 : 0);
} else {
fprintf(stdout, "Persistent Reservation Type Mask is NOT "
"valid\n");

Modified: stable/11/sbin/camcontrol/timestamp.c

svn commit: r317373 - in stable/11: etc/defaults etc/periodic/daily share/man/man5 usr.sbin/periodic

2017-04-24 Thread Alan Somers
Author: asomers
Date: Mon Apr 24 15:29:17 2017
New Revision: 317373
URL: https://svnweb.freebsd.org/changeset/base/317373

Log:
  MFC r316342, r316358
  
  r316342:
  Consolidate random sleeps in periodic scripts
  
  Multiple periodic scripts sleep for a random amount of time in order to
  mitigate the thundering herd problem. This is bad, because the sum of
  multiple uniformly distributed random variables approaches a normal
  distribution, so the problem isn't mitigated as effectively as it would be
  with a single sleep.
  
  This change creates a single configurable anticongestion sleep. periodic
  will only sleep if at least one script requires it, and it will never sleep
  more than once per invocation. It also won't sleep if periodic was run
  interactively, fixing an unrelated longstanding bug.
  
  PR:   217055
  PR:   210188
  Reviewed by:  cy
  MFC after:3 weeks
  Differential Revision:https://reviews.freebsd.org/D10211
  
  r316358:
  Fix man page typo from r316342
  
  Reported by:  rgrimes
  MFC after:20 days
  X-MFC-With:   316342

Modified:
  stable/11/etc/defaults/periodic.conf
  stable/11/etc/periodic/daily/480.leapfile-ntpd
  stable/11/share/man/man5/periodic.conf.5
  stable/11/usr.sbin/periodic/periodic.sh
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/etc/defaults/periodic.conf
==
--- stable/11/etc/defaults/periodic.confMon Apr 24 14:56:41 2017
(r317372)
+++ stable/11/etc/defaults/periodic.confMon Apr 24 15:29:17 2017
(r317373)
@@ -22,6 +22,8 @@ periodic_conf_files="/etc/periodic.conf 
 # periodic script dirs
 local_periodic="/usr/local/etc/periodic"
 
+# Max time to sleep to avoid causing congestion on download servers
+anticongestion_sleeptime=3600
 
 # Daily options
 
@@ -136,8 +138,6 @@ daily_status_mail_rejects_shorten="NO"  
 
 # 480.leapfile-ntpd
 daily_ntpd_leapfile_enable="YES"   # Fetch NTP leapfile
-daily_ntpd_avoid_congestion="YES"  # Avoid congesting
-   # leapfile sources
 
 # 480.status-ntpd
 daily_status_ntpd_enable="NO"  # Check NTP status
@@ -307,6 +307,18 @@ security_status_tcpwrap_period="daily"
 if [ -z "${source_periodic_confs_defined}" ]; then
 source_periodic_confs_defined=yes
 
+   # Sleep for a random amount of time in order to mitigate the thundering
+   # herd problem of multiple hosts running periodic simultaneously.
+   # Will not sleep when used interactively.
+   # Will sleep at most once per invocation of periodic
+   anticongestion() {
+   [ -n "$PERIODIC_IS_INTERACTIVE" ] && return
+   if [ -f "$PERIODIC_ANTICONGESTION_FILE" ]; then
+   rm -f $PERIODIC_ANTICONGESTION_FILE
+   sleep `jot -r 1 0 ${anticongestion_sleeptime}`
+   fi
+   }
+
# Compatibility with old daily variable names.
# They can be removed in stable/11.
security_daily_compat_var() {

Modified: stable/11/etc/periodic/daily/480.leapfile-ntpd
==
--- stable/11/etc/periodic/daily/480.leapfile-ntpd  Mon Apr 24 14:56:41 
2017(r317372)
+++ stable/11/etc/periodic/daily/480.leapfile-ntpd  Mon Apr 24 15:29:17 
2017(r317373)
@@ -13,16 +13,9 @@ fi
 
 case "$daily_ntpd_leapfile_enable" in
 [Yy][Ee][Ss])
-   case "$daily_ntpd_avoid_congestion" in
-   [Yy][Ee][Ss])
-   # Avoid dogpiling
-   (sleep $(jot -r 1 0 3600); service ntpd onefetch) &
-   ;;
-   *)
-   service ntpd onefetch
-   ;;
-   esac
-   ;;
+anticongestion
+service ntpd onefetch
+;;
 esac
 
 exit $rc

Modified: stable/11/share/man/man5/periodic.conf.5
==
--- stable/11/share/man/man5/periodic.conf.5Mon Apr 24 14:56:41 2017
(r317372)
+++ stable/11/share/man/man5/periodic.conf.5Mon Apr 24 15:29:17 2017
(r317373)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 26, 2015
+.Dd March 31, 2017
 .Dt PERIODIC.CONF 5
 .Os
 .Sh NAME
@@ -133,6 +133,10 @@ respectively.
 Refer to the
 .Xr periodic 8
 manual page for how script return codes are interpreted.
+.It Va anticongestion_sleeptime
+.Pq Vt int
+The maximum number of seconds to randomly sleep in order to smooth bursty loads
+on a shared resource, such as a download mirror.
 .El
 .Pp
 The following variables are used by the standard scripts that reside in

Modified: stable/11/usr.sbin/periodic/periodic.sh
==
--- stable/11/usr.sbin/periodic/periodic.sh Mon Apr 24 14:56:41 2017
(r317372)
+++ 

svn commit: r317372 - head/lib/libc/gen

2017-04-24 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Apr 24 14:56:41 2017
New Revision: 317372
URL: https://svnweb.freebsd.org/changeset/base/317372

Log:
  scandir(3): promote arraysz to size_t to match numitems.
  
  The internal array size goes through a loop and is compared with numitems
  which at its limits makes can be unreachably higher than arraysz.
  Prevent an hypothetical overflow by matching the types.
  
  MFC after:1 week

Modified:
  head/lib/libc/gen/scandir.c

Modified: head/lib/libc/gen/scandir.c
==
--- head/lib/libc/gen/scandir.c Mon Apr 24 14:51:53 2017(r317371)
+++ head/lib/libc/gen/scandir.c Mon Apr 24 14:56:41 2017(r317372)
@@ -82,8 +82,7 @@ scandir(const char *dirname, struct dire
 #endif
 {
struct dirent *d, *p, **names = NULL;
-   size_t numitems;
-   long arraysz;
+   size_t arraysz, numitems;
DIR *dirp;
 
if ((dirp = opendir(dirname)) == NULL)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317371 - head/contrib/elftoolchain/elfcopy

2017-04-24 Thread Ed Maste
Author: emaste
Date: Mon Apr 24 14:51:53 2017
New Revision: 317371
URL: https://svnweb.freebsd.org/changeset/base/317371

Log:
  elfcopy: allow empty symbol list files
  
  Reported by:  bz
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D10441

Modified:
  head/contrib/elftoolchain/elfcopy/main.c

Modified: head/contrib/elftoolchain/elfcopy/main.c
==
--- head/contrib/elftoolchain/elfcopy/main.cMon Apr 24 12:52:42 2017
(r317370)
+++ head/contrib/elftoolchain/elfcopy/main.cMon Apr 24 14:51:53 2017
(r317371)
@@ -1285,8 +1285,9 @@ parse_symlist_file(struct elfcopy *ecp, 
err(EXIT_FAILURE, "can not open %s", fn);
if ((data = malloc(sb.st_size + 1)) == NULL)
err(EXIT_FAILURE, "malloc failed");
-   if (fread(data, 1, sb.st_size, fp) == 0 || ferror(fp))
-   err(EXIT_FAILURE, "fread failed");
+   if (sb.st_size > 0)
+   if (fread(data, sb.st_size, 1, fp) != 1)
+   err(EXIT_FAILURE, "fread failed");
fclose(fp);
data[sb.st_size] = '\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: r317370 - head/sys/cam/ctl

2017-04-24 Thread Alexander Motin
Author: mav
Date: Mon Apr 24 12:52:42 2017
New Revision: 317370
URL: https://svnweb.freebsd.org/changeset/base/317370

Log:
  Change ctl_free_lun() locking.
  
  This fixes potential callout_drain() sleep under non-sleepable lock.
  
  PR:   218167
  MFC after:2 weeks

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

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Mon Apr 24 12:44:04 2017(r317369)
+++ head/sys/cam/ctl/ctl.c  Mon Apr 24 12:52:42 2017(r317370)
@@ -4731,18 +4731,20 @@ ctl_free_lun(struct ctl_lun *lun)
struct ctl_lun *nlun;
int i;
 
-   mtx_assert(>ctl_lock, MA_OWNED);
+   KASSERT(TAILQ_EMPTY(>ooa_queue),
+   ("Freeing a LUN %p with outstanding I/O!\n", lun));
 
+   mtx_lock(>ctl_lock);
STAILQ_REMOVE(>lun_list, lun, ctl_lun, links);
-
ctl_clear_mask(softc->ctl_lun_mask, lun->lun);
-
softc->ctl_luns[lun->lun] = NULL;
-
-   if (!TAILQ_EMPTY(>ooa_queue))
-   panic("Freeing a LUN %p with outstanding I/O!!\n", lun);
-
softc->num_luns--;
+   STAILQ_FOREACH(nlun, >lun_list, links) {
+   mtx_lock(>lun_lock);
+   ctl_est_ua_all(nlun, -1, CTL_UA_LUN_CHANGE);
+   mtx_unlock(>lun_lock);
+   }
+   mtx_unlock(>ctl_lock);
 
/*
 * Tell the backend to free resources, if this LUN has a backend.
@@ -4752,7 +4754,6 @@ ctl_free_lun(struct ctl_lun *lun)
 
lun->ie_reportcnt = UINT32_MAX;
callout_drain(>ie_callout);
-
ctl_tpc_lun_shutdown(lun);
mtx_destroy(>lun_lock);
free(lun->lun_devid, M_CTL);
@@ -4765,12 +4766,6 @@ ctl_free_lun(struct ctl_lun *lun)
if (lun->flags & CTL_LUN_MALLOCED)
free(lun, M_CTL);
 
-   STAILQ_FOREACH(nlun, >lun_list, links) {
-   mtx_lock(>lun_lock);
-   ctl_est_ua_all(nlun, -1, CTL_UA_LUN_CHANGE);
-   mtx_unlock(>lun_lock);
-   }
-
return (0);
 }
 
@@ -5027,9 +5022,7 @@ ctl_invalidate_lun(struct ctl_be_lun *be
 */
if (TAILQ_EMPTY(>ooa_queue)) {
mtx_unlock(>lun_lock);
-   mtx_lock(>ctl_lock);
ctl_free_lun(lun);
-   mtx_unlock(>ctl_lock);
} else
mtx_unlock(>lun_lock);
 
@@ -13068,9 +13061,7 @@ ctl_process_done(union ctl_io *io)
if ((lun->flags & CTL_LUN_INVALID)
 && TAILQ_EMPTY(>ooa_queue)) {
mtx_unlock(>lun_lock);
-   mtx_lock(>ctl_lock);
ctl_free_lun(lun);
-   mtx_unlock(>ctl_lock);
} else
mtx_unlock(>lun_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"


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

2017-04-24 Thread Alexander Motin
Author: mav
Date: Mon Apr 24 12:44:04 2017
New Revision: 317369
URL: https://svnweb.freebsd.org/changeset/base/317369

Log:
  Slightly compact the code.
  
  MFC after:2 weeks

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

Modified: head/sys/cam/ctl/ctl_backend_block.c
==
--- head/sys/cam/ctl/ctl_backend_block.cMon Apr 24 11:34:02 2017
(r317368)
+++ head/sys/cam/ctl/ctl_backend_block.cMon Apr 24 12:44:04 2017
(r317369)
@@ -2650,11 +2650,8 @@ bailout_error:
 static void
 ctl_be_block_lun_shutdown(void *be_lun)
 {
-   struct ctl_be_block_lun *lun;
-   struct ctl_be_block_softc *softc;
-
-   lun = (struct ctl_be_block_lun *)be_lun;
-   softc = lun->softc;
+   struct ctl_be_block_lun *lun = be_lun;
+   struct ctl_be_block_softc *softc = lun->softc;
 
mtx_lock(>lock);
lun->flags |= CTL_BE_BLOCK_LUN_UNCONFIGURED;

Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c
==
--- head/sys/cam/ctl/ctl_backend_ramdisk.c  Mon Apr 24 11:34:02 2017
(r317368)
+++ head/sys/cam/ctl/ctl_backend_ramdisk.c  Mon Apr 24 12:44:04 2017
(r317369)
@@ -1287,13 +1287,8 @@ bailout_error:
 static void
 ctl_backend_ramdisk_lun_shutdown(void *be_lun)
 {
-   struct ctl_be_ramdisk_lun *lun;
-   struct ctl_be_ramdisk_softc *softc;
-   int do_free;
-
-   lun = (struct ctl_be_ramdisk_lun *)be_lun;
-   softc = lun->softc;
-   do_free = 0;
+   struct ctl_be_ramdisk_lun *lun = be_lun;
+   struct ctl_be_ramdisk_softc *softc = lun->softc;
 
mtx_lock(>lock);
lun->flags |= CTL_BE_RAMDISK_LUN_UNCONFIGURED;
@@ -1303,12 +1298,9 @@ ctl_backend_ramdisk_lun_shutdown(void *b
STAILQ_REMOVE(>lun_list, lun, ctl_be_ramdisk_lun,
  links);
softc->num_luns--;
-   do_free = 1;
+   free(be_lun, M_RAMDISK);
}
mtx_unlock(>lock);
-
-   if (do_free != 0)
-   free(be_lun, M_RAMDISK);
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317368 - in stable/11/sys/netinet: . tcp_stacks

2017-04-24 Thread Steven Hartland
Author: smh
Date: Mon Apr 24 11:34:02 2017
New Revision: 317368
URL: https://svnweb.freebsd.org/changeset/base/317368

Log:
  MFC r316676:
  
  Use estimated RTT for receive buffer auto resizing instead of timestamps
  
  Relnotes: Yes
  Sponsored by: Multiplay

Modified:
  stable/11/sys/netinet/in_kdtrace.c
  stable/11/sys/netinet/in_kdtrace.h
  stable/11/sys/netinet/tcp_input.c
  stable/11/sys/netinet/tcp_output.c
  stable/11/sys/netinet/tcp_stacks/fastpath.c
  stable/11/sys/netinet/tcp_var.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/in_kdtrace.c
==
--- stable/11/sys/netinet/in_kdtrace.c  Mon Apr 24 11:22:06 2017
(r317367)
+++ stable/11/sys/netinet/in_kdtrace.c  Mon Apr 24 11:34:02 2017
(r317368)
@@ -132,6 +132,14 @@ SDT_PROBE_DEFINE6_XLATE(tcp, , , state__
 "void *", "void *",
 "int", "tcplsinfo_t *");
 
+SDT_PROBE_DEFINE6_XLATE(tcp, , , receive__autoresize,
+"void *", "void *",
+"struct tcpcb *", "csinfo_t *",
+"struct mbuf *", "ipinfo_t *",
+"struct tcpcb *", "tcpsinfo_t *" ,
+"struct tcphdr *", "tcpinfoh_t *",
+"int", "int");
+
 SDT_PROBE_DEFINE5_XLATE(udp, , , receive,
 "void *", "pktinfo_t *",
 "struct inpcb *", "csinfo_t *",

Modified: stable/11/sys/netinet/in_kdtrace.h
==
--- stable/11/sys/netinet/in_kdtrace.h  Mon Apr 24 11:22:06 2017
(r317367)
+++ stable/11/sys/netinet/in_kdtrace.h  Mon Apr 24 11:34:02 2017
(r317368)
@@ -65,6 +65,7 @@ SDT_PROBE_DECLARE(tcp, , , debug__input)
 SDT_PROBE_DECLARE(tcp, , , debug__output);
 SDT_PROBE_DECLARE(tcp, , , debug__user);
 SDT_PROBE_DECLARE(tcp, , , debug__drop);
+SDT_PROBE_DECLARE(tcp, , , receive__autoresize);
 
 SDT_PROBE_DECLARE(udp, , , receive);
 SDT_PROBE_DECLARE(udp, , , send);

Modified: stable/11/sys/netinet/tcp_input.c
==
--- stable/11/sys/netinet/tcp_input.c   Mon Apr 24 11:22:06 2017
(r317367)
+++ stable/11/sys/netinet/tcp_input.c   Mon Apr 24 11:34:02 2017
(r317368)
@@ -1473,6 +1473,68 @@ drop:
return (IPPROTO_DONE);
 }
 
+/*
+ * Automatic sizing of receive socket buffer.  Often the send
+ * buffer size is not optimally adjusted to the actual network
+ * conditions at hand (delay bandwidth product).  Setting the
+ * buffer size too small limits throughput on links with high
+ * bandwidth and high delay (eg. trans-continental/oceanic links).
+ *
+ * On the receive side the socket buffer memory is only rarely
+ * used to any significant extent.  This allows us to be much
+ * more aggressive in scaling the receive socket buffer.  For
+ * the case that the buffer space is actually used to a large
+ * extent and we run out of kernel memory we can simply drop
+ * the new segments; TCP on the sender will just retransmit it
+ * later.  Setting the buffer size too big may only consume too
+ * much kernel memory if the application doesn't read() from
+ * the socket or packet loss or reordering makes use of the
+ * reassembly queue.
+ *
+ * The criteria to step up the receive buffer one notch are:
+ *  1. Application has not set receive buffer size with
+ * SO_RCVBUF. Setting SO_RCVBUF clears SB_AUTOSIZE.
+ *  2. the number of bytes received during the time it takes
+ * one timestamp to be reflected back to us (the RTT);
+ *  3. received bytes per RTT is within seven eighth of the
+ * current socket buffer size;
+ *  4. receive buffer size has not hit maximal automatic size;
+ *
+ * This algorithm does one step per RTT at most and only if
+ * we receive a bulk stream w/o packet losses or reorderings.
+ * Shrinking the buffer during idle times is not necessary as
+ * it doesn't consume any memory when idle.
+ *
+ * TODO: Only step up if the application is actually serving
+ * the buffer to better manage the socket buffer resources.
+ */
+int
+tcp_autorcvbuf(struct mbuf *m, struct tcphdr *th, struct socket *so,
+struct tcpcb *tp, int tlen)
+{
+   int newsize = 0;
+
+   if (V_tcp_do_autorcvbuf && (so->so_rcv.sb_flags & SB_AUTOSIZE) &&
+   tp->t_srtt != 0 && tp->rfbuf_ts != 0 &&
+   TCP_TS_TO_TICKS(tcp_ts_getticks() - tp->rfbuf_ts) >
+   (tp->t_srtt >> TCP_RTT_SHIFT)) {
+   if (tp->rfbuf_cnt > (so->so_rcv.sb_hiwat / 8 * 7) &&
+   so->so_rcv.sb_hiwat < V_tcp_autorcvbuf_max) {
+   newsize = min(so->so_rcv.sb_hiwat +
+   V_tcp_autorcvbuf_inc, V_tcp_autorcvbuf_max);
+   }
+   TCP_PROBE6(receive__autoresize, NULL, tp, m, tp, th, newsize);
+
+   /* Start over with next RTT. */
+   tp->rfbuf_ts = 0;
+   tp->rfbuf_cnt = 0;
+   } else {
+   tp->rfbuf_cnt += tlen;  /* add up */
+   }
+
+   return 

svn commit: r317367 - stable/10/sys/dev/isp

2017-04-24 Thread Alexander Motin
Author: mav
Date: Mon Apr 24 11:22:06 2017
New Revision: 317367
URL: https://svnweb.freebsd.org/changeset/base/317367

Log:
  MFC r315913: Add brackets to fix incorrect macro expansion.

Modified:
  stable/10/sys/dev/isp/ispmbox.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/isp/ispmbox.h
==
--- stable/10/sys/dev/isp/ispmbox.h Mon Apr 24 11:21:32 2017
(r317366)
+++ stable/10/sys/dev/isp/ispmbox.h Mon Apr 24 11:22:06 2017
(r317367)
@@ -1207,7 +1207,7 @@ typedef struct {
 #defineICB2400_VPINFO_OFF  0x80/* offset from start of ICB */
 #defineICB2400_VPINFO_PORT_OFF(chan)   \
 (ICB2400_VPINFO_OFF +  \
- sizeof (isp_icb_2400_vpinfo_t) + (chan * ICB2400_VPOPT_WRITE_SIZE))
+ sizeof (isp_icb_2400_vpinfo_t) + ((chan) * ICB2400_VPOPT_WRITE_SIZE))
 
 #defineICB2400_VPGOPT_FCA  0x01/* Assume Clean Address 
bit in FLOGI ACC set (works only in static configurations) */
 #defineICB2400_VPGOPT_MID_DISABLE  0x02/* when set, connection 
mode2 will work with NPIV-capable switched */
___
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: r317366 - stable/10/sys/dev/isp

2017-04-24 Thread Alexander Motin
Author: mav
Date: Mon Apr 24 11:21:32 2017
New Revision: 317366
URL: https://svnweb.freebsd.org/changeset/base/317366

Log:
  MFC r315908: Unify initiator and target DMA setup and command sending.
  
  The code is so alike that it is pointless to keep it separate.

Modified:
  stable/10/sys/dev/isp/isp_freebsd.c
  stable/10/sys/dev/isp/isp_freebsd.h
  stable/10/sys/dev/isp/isp_library.c
  stable/10/sys/dev/isp/isp_library.h
  stable/10/sys/dev/isp/isp_pci.c
  stable/10/sys/dev/isp/isp_sbus.c
  stable/10/sys/dev/isp/ispvar.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/isp/isp_freebsd.c
==
--- stable/10/sys/dev/isp/isp_freebsd.c Mon Apr 24 11:20:55 2017
(r317365)
+++ stable/10/sys/dev/isp/isp_freebsd.c Mon Apr 24 11:21:32 2017
(r317366)
@@ -1372,10 +1372,7 @@ isp_target_start_ctio(ispsoftc_t *isp, u
} else {
ct2_entry_t *cto = (ct2_entry_t *) local;
 
-   if (isp->isp_osinfo.sixtyfourbit)
-   cto->ct_header.rqs_entry_type = RQSTYPE_CTIO3;
-   else
-   cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2;
+   cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2;
cto->ct_header.rqs_entry_count = 1;
cto->ct_header.rqs_seqno |= ATPD_SEQ_NOTIFY_CAM;
ATPD_SET_SEQNO(cto, atp);
@@ -1468,14 +1465,8 @@ isp_target_start_ctio(ispsoftc_t *isp, u
isp_prt(isp, ISP_LOGTDEBUG0, "%s: ests 
base %p vaddr %p ecmd_dma %jx addr %jx len %u", __func__, 
isp->isp_osinfo.ecmd_base, atp->ests,
(uintmax_t) 
isp->isp_osinfo.ecmd_dma, (uintmax_t)addr, MIN_FCP_RESPONSE_SIZE + 
sense_length);
cto->rsp.m2.ct_datalen = 
MIN_FCP_RESPONSE_SIZE + sense_length;
-   if (cto->ct_header.rqs_entry_type == 
RQSTYPE_CTIO3) {
-   
cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base = DMA_LO32(addr);
-   
cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi = DMA_HI32(addr);
-   
cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count = MIN_FCP_RESPONSE_SIZE + 
sense_length;
-   } else {
-   
cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base = DMA_LO32(addr);
-   
cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count = MIN_FCP_RESPONSE_SIZE + 
sense_length;
-   }
+   
cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base = DMA_LO32(addr);
+   
cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count = MIN_FCP_RESPONSE_SIZE + 
sense_length;
}
if (sense_length) {
isp_prt(isp, ISP_LOGTDEBUG0, "%s: 
CTIO2[0x%x] seq %u nc %d CDB0=%x sstatus=0x%x flags=0x%x resid=%d sense: %x 
%x/%x/%x", __func__,
@@ -3467,7 +3458,7 @@ isp_action(struct cam_sim *sim, union cc
cpi->max_lun = ISP_MAX_LUNS(isp) == 0 ?
255 : ISP_MAX_LUNS(isp) - 1;
cpi->bus_id = cam_sim_bus(sim);
-   if (isp->isp_osinfo.sixtyfourbit)
+   if (sizeof (bus_size_t) > 4)
cpi->maxio = (ISP_NSEG64_MAX - 1) * PAGE_SIZE;
else
cpi->maxio = (ISP_NSEG_MAX - 1) * PAGE_SIZE;

Modified: stable/10/sys/dev/isp/isp_freebsd.h
==
--- stable/10/sys/dev/isp/isp_freebsd.h Mon Apr 24 11:20:55 2017
(r317365)
+++ stable/10/sys/dev/isp/isp_freebsd.h Mon Apr 24 11:21:32 2017
(r317366)
@@ -293,7 +293,6 @@ struct isposinfo {
struct isp_pcmd *   pcmd_pool;
struct isp_pcmd *   pcmd_free;
 
-   int sixtyfourbit;   /* sixtyfour bit platform */
int mbox_sleeping;
int mbox_sleep_ok;
int mboxbsy;
@@ -505,6 +504,13 @@ default:   
\
 d->ds_base = DMA_LO32(e->ds_addr); \
 d->ds_count = e->ds_len;   \
 }
+#if (BUS_SPACE_MAXADDR > UINT32_MAX)
+#define XS_NEED_DMA64_SEG(s, n)\
+   (((bus_dma_segment_t *)s)[n].ds_addr +  \
+   ((bus_dma_segment_t *)s)[n].ds_len > UINT32_MAX)
+#else
+#define XS_NEED_DMA64_SEG(s, n)(0)
+#endif
 #defineXS_ISP(ccb) 
cam_sim_softc(xpt_path_sim((ccb)->ccb_h.path))
 #defineXS_CHANNEL(ccb)

svn commit: r317365 - stable/10/sys/dev/isp

2017-04-24 Thread Alexander Motin
Author: mav
Date: Mon Apr 24 11:20:55 2017
New Revision: 317365
URL: https://svnweb.freebsd.org/changeset/base/317365

Log:
  MFC r315870: isp field in struct isp_pcmd is also unused.

Modified:
  stable/10/sys/dev/isp/isp_freebsd.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/isp/isp_freebsd.h
==
--- stable/10/sys/dev/isp/isp_freebsd.h Mon Apr 24 11:20:21 2017
(r317364)
+++ stable/10/sys/dev/isp/isp_freebsd.h Mon Apr 24 11:20:55 2017
(r317365)
@@ -173,7 +173,6 @@ typedef struct tstate {
 struct isp_pcmd {
struct isp_pcmd *   next;
bus_dmamap_tdmap;   /* dma map for this command */
-   struct ispsoftc *   isp;/* containing isp */
struct callout  wdog;   /* watchdog timer */
uint32_tdatalen;/* data length for this command 
(target mode only) */
 };
___
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: r317364 - stable/10/sys/dev/isp

2017-04-24 Thread Alexander Motin
Author: mav
Date: Mon Apr 24 11:20:21 2017
New Revision: 317364
URL: https://svnweb.freebsd.org/changeset/base/317364

Log:
  MFC r315869: Remove write-only crn field from struct isp_pcmd.

Modified:
  stable/10/sys/dev/isp/isp_freebsd.c
  stable/10/sys/dev/isp/isp_freebsd.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/isp/isp_freebsd.c
==
--- stable/10/sys/dev/isp/isp_freebsd.c Mon Apr 24 11:19:47 2017
(r317363)
+++ stable/10/sys/dev/isp/isp_freebsd.c Mon Apr 24 11:20:21 2017
(r317364)
@@ -731,7 +731,6 @@ isp_free_pcmd(ispsoftc_t *isp, union ccb
if (ISP_PCMD(ccb)) {
 #ifdef ISP_TARGET_MODE
PISP_PCMD(ccb)->datalen = 0;
-   PISP_PCMD(ccb)->crn = 0;
 #endif
PISP_PCMD(ccb)->next = isp->isp_osinfo.pcmd_free;
isp->isp_osinfo.pcmd_free = ISP_PCMD(ccb);
@@ -4207,7 +4206,6 @@ isp_fcp_next_crn(ispsoftc_t *isp, uint8_
}
if (nxp->crnseed == 0)
nxp->crnseed = 1;
-   PISP_PCMD(cmd)->crn = nxp->crnseed;
*crnp = nxp->crnseed++;
return (0);
 }

Modified: stable/10/sys/dev/isp/isp_freebsd.h
==
--- stable/10/sys/dev/isp/isp_freebsd.h Mon Apr 24 11:19:47 2017
(r317363)
+++ stable/10/sys/dev/isp/isp_freebsd.h Mon Apr 24 11:20:21 2017
(r317364)
@@ -176,7 +176,6 @@ struct isp_pcmd {
struct ispsoftc *   isp;/* containing isp */
struct callout  wdog;   /* watchdog timer */
uint32_tdatalen;/* data length for this command 
(target mode only) */
-   uint8_t crn;/* command reference number */
 };
 #defineISP_PCMD(ccb)   (ccb)->ccb_h.spriv_ptr1
 #definePISP_PCMD(ccb)  ((struct isp_pcmd *)ISP_PCMD(ccb))
___
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: r317363 - stable/10/sys/dev/isp

2017-04-24 Thread Alexander Motin
Author: mav
Date: Mon Apr 24 11:19:47 2017
New Revision: 317363
URL: https://svnweb.freebsd.org/changeset/base/317363

Log:
  MFC r315708: Cleanup response queue processing.

Modified:
  stable/10/sys/dev/isp/isp.c
  stable/10/sys/dev/isp/isp_freebsd.c
  stable/10/sys/dev/isp/isp_freebsd.h
  stable/10/sys/dev/isp/ispvar.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/isp/isp.c
==
--- stable/10/sys/dev/isp/isp.c Mon Apr 24 11:12:03 2017(r317362)
+++ stable/10/sys/dev/isp/isp.c Mon Apr 24 11:19:47 2017(r317363)
@@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$");
 /*
  * Local static data
  */
-static const char notresp[] = "Not RESPONSE in RESPONSE Queue (type 0x%x) @ 
idx %d (next %d) nlooked %d";
+static const char notresp[] = "Unknown IOCB in RESPONSE Queue (type 0x%x) @ 
idx %d (next %d)";
 static const char bun[] = "bad underrun (count %d, resid %d, status %s)";
 static const char lipd[] = "Chan %d LIP destroyed %d active commands";
 static const char sacq[] = "unable to acquire scratch area";
@@ -98,8 +98,8 @@ static const uint8_t alpa_map[] = {
 static void isp_parse_async(ispsoftc_t *, uint16_t);
 static void isp_parse_async_fc(ispsoftc_t *, uint16_t);
 static int isp_handle_other_response(ispsoftc_t *, int, isphdr_t *, uint32_t 
*);
-static void isp_parse_status(ispsoftc_t *, ispstatusreq_t *, XS_T *, long *);
-static void isp_parse_status_24xx(ispsoftc_t *, isp24xx_statusreq_t *, XS_T *, 
long *);
+static void isp_parse_status(ispsoftc_t *, ispstatusreq_t *, XS_T *, uint32_t 
*);
+static void isp_parse_status_24xx(ispsoftc_t *, isp24xx_statusreq_t *, XS_T *, 
uint32_t *);
 static void isp_fastpost_complete(ispsoftc_t *, uint32_t);
 static void isp_scsi_init(ispsoftc_t *);
 static void isp_scsi_channel_init(ispsoftc_t *, int);
@@ -4971,21 +4971,18 @@ isp_intr_mbox(ispsoftc_t *isp, uint16_t 
MBOX_NOTIFY_COMPLETE(isp);
 }
 
-/*
- * Limit our stack depth by sticking with the max likely number
- * of completions on a request queue at any one time.
- */
-#ifndefMAX_REQUESTQ_COMPLETIONS
-#defineMAX_REQUESTQ_COMPLETIONS32
-#endif
-
 void
 isp_intr_respq(ispsoftc_t *isp)
 {
-   XS_T *complist[MAX_REQUESTQ_COMPLETIONS], *xs;
-   uint32_t iptr, optr, junk;
-   int i, nlooked = 0, ndone = 0, continuations_expected = 0;
-   int etype, last_etype = 0;
+   XS_T *xs, *cont_xs;
+   uint8_t qe[QENTRY_LEN];
+   ispstatusreq_t *sp = (ispstatusreq_t *)qe;
+   isp24xx_statusreq_t *sp2 = (isp24xx_statusreq_t *)qe;
+   isphdr_t *hp;
+   uint8_t *resp, *snsp;
+   int buddaboom, completion_status, cont = 0, etype, i;
+   int req_status_flags, req_state_flags, scsi_status;
+   uint32_t iptr, junk, cptr, optr, rlen, slen, sptr, totslen, resid;
 
/*
 * We can't be getting this now.
@@ -5007,38 +5004,30 @@ isp_intr_respq(ispsoftc_t *isp)
 
optr = isp->isp_resodx;
while (optr != iptr) {
-   uint8_t qe[QENTRY_LEN];
-   ispstatusreq_t *sp = (ispstatusreq_t *) qe;
-   isphdr_t *hp;
-   int buddaboom, scsi_status, completion_status;
-   int req_status_flags, req_state_flags;
-   uint8_t *snsp, *resp;
-   uint32_t rlen, slen, totslen;
-   long resid;
-   uint16_t oop;
-
-   hp = (isphdr_t *) ISP_QUEUE_ENTRY(isp->isp_result, optr);
-   oop = optr;
+   sptr = cptr = optr;
+   hp = (isphdr_t *) ISP_QUEUE_ENTRY(isp->isp_result, cptr);
optr = ISP_NXT_QENTRY(optr, RESULT_QUEUE_LEN(isp));
-   nlooked++;
- read_again:
-   buddaboom = req_status_flags = req_state_flags = 0;
-   resid = 0L;
 
/*
 * Synchronize our view of this response queue entry.
 */
-   MEMORYBARRIER(isp, SYNC_RESULT, oop, QENTRY_LEN, -1);
+   MEMORYBARRIER(isp, SYNC_RESULT, cptr, QENTRY_LEN, -1);
if (isp->isp_dblev & ISP_LOGDEBUG1)
-   isp_print_qentry(isp, "Response Queue Entry", oop, hp);
+   isp_print_qentry(isp, "Response Queue Entry", cptr, hp);
isp_get_hdr(isp, hp, >req_header);
etype = sp->req_header.rqs_entry_type;
 
+   /* We expected Status Continuation, but got different IOCB. */
+   if (cont > 0 && etype != RQSTYPE_STATUS_CONT) {
+   cont = 0;
+   isp_done(cont_xs);
+   }
+
if (IS_24XX(isp) && etype == RQSTYPE_RESPONSE) {
-   isp24xx_statusreq_t *sp2 = (isp24xx_statusreq_t *)qe;
isp_get_24xx_response(isp, (isp24xx_statusreq_t *)hp, 
sp2);
scsi_status = sp2->req_scsi_status;

svn commit: r317362 - stable/11/sys/dev/isp

2017-04-24 Thread Alexander Motin
Author: mav
Date: Mon Apr 24 11:12:03 2017
New Revision: 317362
URL: https://svnweb.freebsd.org/changeset/base/317362

Log:
  MFC r315913: Add brackets to fix incorrect macro expansion.

Modified:
  stable/11/sys/dev/isp/ispmbox.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/isp/ispmbox.h
==
--- stable/11/sys/dev/isp/ispmbox.h Mon Apr 24 11:06:10 2017
(r317361)
+++ stable/11/sys/dev/isp/ispmbox.h Mon Apr 24 11:12:03 2017
(r317362)
@@ -1207,7 +1207,7 @@ typedef struct {
 #defineICB2400_VPINFO_OFF  0x80/* offset from start of ICB */
 #defineICB2400_VPINFO_PORT_OFF(chan)   \
 (ICB2400_VPINFO_OFF +  \
- sizeof (isp_icb_2400_vpinfo_t) + (chan * ICB2400_VPOPT_WRITE_SIZE))
+ sizeof (isp_icb_2400_vpinfo_t) + ((chan) * ICB2400_VPOPT_WRITE_SIZE))
 
 #defineICB2400_VPGOPT_FCA  0x01/* Assume Clean Address 
bit in FLOGI ACC set (works only in static configurations) */
 #defineICB2400_VPGOPT_MID_DISABLE  0x02/* when set, connection 
mode2 will work with NPIV-capable switched */
___
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: r317361 - in head/sys: arm64/arm64 conf dev/psci

2017-04-24 Thread Andrew Turner
Author: andrew
Date: Mon Apr 24 11:06:10 2017
New Revision: 317361
URL: https://svnweb.freebsd.org/changeset/base/317361

Log:
  Call the PSCI reset from cpu_reset on arm64. When rebooting from DDB the
  kernel calls this directly so the event handler is not called, meaning
  the computer fails to reboot.
  
  Tested by:cognet
  MFC after:1 week
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm64/arm64/vm_machdep.c
  head/sys/conf/options.arm64
  head/sys/dev/psci/psci.c
  head/sys/dev/psci/psci.h

Modified: head/sys/arm64/arm64/vm_machdep.c
==
--- head/sys/arm64/arm64/vm_machdep.c   Mon Apr 24 10:21:13 2017
(r317360)
+++ head/sys/arm64/arm64/vm_machdep.c   Mon Apr 24 11:06:10 2017
(r317361)
@@ -25,6 +25,8 @@
  *
  */
 
+#include "opt_platform.h"
+
 #include 
 __FBSDID("$FreeBSD$");
 
@@ -52,6 +54,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
+#ifdef DEV_PSCI
+#include 
+#endif
+
 /*
  * Finish a fork operation, with process p2 nearly set up.
  * Copy and update the pcb, set up the stack so that the child
@@ -113,7 +119,11 @@ void
 cpu_reset(void)
 {
 
-   printf("cpu_reset");
+#ifdef DEV_PSCI
+   psci_reset();
+#endif
+
+   printf("cpu_reset failed");
while(1)
__asm volatile("wfi" ::: "memory");
 }

Modified: head/sys/conf/options.arm64
==
--- head/sys/conf/options.arm64 Mon Apr 24 10:21:13 2017(r317360)
+++ head/sys/conf/options.arm64 Mon Apr 24 11:06:10 2017(r317361)
@@ -7,6 +7,8 @@ SOCDEV_VA   opt_global.h
 THUNDERX_PASS_1_1_ERRATA   opt_global.h
 VFPopt_global.h
 
+DEV_PSCI   opt_platform.h
+
 # SoC Support
 SOC_ALLWINNER_A64  opt_soc.h
 SOC_BRCM_BCM2837   opt_soc.h

Modified: head/sys/dev/psci/psci.c
==
--- head/sys/dev/psci/psci.cMon Apr 24 10:21:13 2017(r317360)
+++ head/sys/dev/psci/psci.cMon Apr 24 11:06:10 2017(r317361)
@@ -412,6 +412,13 @@ psci_shutdown(void *xsc, int howto)
/* System reset and off do not return. */
 }
 
+void
+psci_reset(void)
+{
+
+   psci_shutdown(NULL, 0);
+}
+
 #ifdef FDT
 /* Only support PSCI 0.1 on FDT */
 static int

Modified: head/sys/dev/psci/psci.h
==
--- head/sys/dev/psci/psci.hMon Apr 24 10:21:13 2017(r317360)
+++ head/sys/dev/psci/psci.hMon Apr 24 11:06:10 2017(r317361)
@@ -36,7 +36,7 @@ typedef int (*psci_callfn_t)(register_t,
 
 extern int psci_present;
 
-void   psci_system_reset(void);
+void   psci_reset(void);
 intpsci_cpu_on(unsigned long, unsigned long, unsigned long);
 intpsci_hvc_despatch(register_t, register_t, register_t, register_t);
 intpsci_smc_despatch(register_t, register_t, register_t, register_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: r317360 - stable/11/sys/dev/isp

2017-04-24 Thread Alexander Motin
Author: mav
Date: Mon Apr 24 10:21:13 2017
New Revision: 317360
URL: https://svnweb.freebsd.org/changeset/base/317360

Log:
  MFC r315908: Unify initiator and target DMA setup and command sending.
  
  The code is so alike that it is pointless to keep it separate.

Modified:
  stable/11/sys/dev/isp/isp_freebsd.c
  stable/11/sys/dev/isp/isp_freebsd.h
  stable/11/sys/dev/isp/isp_library.c
  stable/11/sys/dev/isp/isp_library.h
  stable/11/sys/dev/isp/isp_pci.c
  stable/11/sys/dev/isp/isp_sbus.c
  stable/11/sys/dev/isp/ispvar.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/isp/isp_freebsd.c
==
--- stable/11/sys/dev/isp/isp_freebsd.c Mon Apr 24 10:20:36 2017
(r317359)
+++ stable/11/sys/dev/isp/isp_freebsd.c Mon Apr 24 10:21:13 2017
(r317360)
@@ -1372,10 +1372,7 @@ isp_target_start_ctio(ispsoftc_t *isp, u
} else {
ct2_entry_t *cto = (ct2_entry_t *) local;
 
-   if (isp->isp_osinfo.sixtyfourbit)
-   cto->ct_header.rqs_entry_type = RQSTYPE_CTIO3;
-   else
-   cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2;
+   cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2;
cto->ct_header.rqs_entry_count = 1;
cto->ct_header.rqs_seqno |= ATPD_SEQ_NOTIFY_CAM;
ATPD_SET_SEQNO(cto, atp);
@@ -1468,14 +1465,8 @@ isp_target_start_ctio(ispsoftc_t *isp, u
isp_prt(isp, ISP_LOGTDEBUG0, "%s: ests 
base %p vaddr %p ecmd_dma %jx addr %jx len %u", __func__, 
isp->isp_osinfo.ecmd_base, atp->ests,
(uintmax_t) 
isp->isp_osinfo.ecmd_dma, (uintmax_t)addr, MIN_FCP_RESPONSE_SIZE + 
sense_length);
cto->rsp.m2.ct_datalen = 
MIN_FCP_RESPONSE_SIZE + sense_length;
-   if (cto->ct_header.rqs_entry_type == 
RQSTYPE_CTIO3) {
-   
cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base = DMA_LO32(addr);
-   
cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi = DMA_HI32(addr);
-   
cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count = MIN_FCP_RESPONSE_SIZE + 
sense_length;
-   } else {
-   
cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base = DMA_LO32(addr);
-   
cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count = MIN_FCP_RESPONSE_SIZE + 
sense_length;
-   }
+   
cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base = DMA_LO32(addr);
+   
cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count = MIN_FCP_RESPONSE_SIZE + 
sense_length;
}
if (sense_length) {
isp_prt(isp, ISP_LOGTDEBUG0, "%s: 
CTIO2[0x%x] seq %u nc %d CDB0=%x sstatus=0x%x flags=0x%x resid=%d sense: %x 
%x/%x/%x", __func__,
@@ -3468,7 +3459,7 @@ isp_action(struct cam_sim *sim, union cc
cpi->max_lun = ISP_MAX_LUNS(isp) == 0 ?
255 : ISP_MAX_LUNS(isp) - 1;
cpi->bus_id = cam_sim_bus(sim);
-   if (isp->isp_osinfo.sixtyfourbit)
+   if (sizeof (bus_size_t) > 4)
cpi->maxio = (ISP_NSEG64_MAX - 1) * PAGE_SIZE;
else
cpi->maxio = (ISP_NSEG_MAX - 1) * PAGE_SIZE;

Modified: stable/11/sys/dev/isp/isp_freebsd.h
==
--- stable/11/sys/dev/isp/isp_freebsd.h Mon Apr 24 10:20:36 2017
(r317359)
+++ stable/11/sys/dev/isp/isp_freebsd.h Mon Apr 24 10:21:13 2017
(r317360)
@@ -293,7 +293,6 @@ struct isposinfo {
struct isp_pcmd *   pcmd_pool;
struct isp_pcmd *   pcmd_free;
 
-   int sixtyfourbit;   /* sixtyfour bit platform */
int mbox_sleeping;
int mbox_sleep_ok;
int mboxbsy;
@@ -505,6 +504,13 @@ default:   
\
 d->ds_base = DMA_LO32(e->ds_addr); \
 d->ds_count = e->ds_len;   \
 }
+#if (BUS_SPACE_MAXADDR > UINT32_MAX)
+#define XS_NEED_DMA64_SEG(s, n)\
+   (((bus_dma_segment_t *)s)[n].ds_addr +  \
+   ((bus_dma_segment_t *)s)[n].ds_len > UINT32_MAX)
+#else
+#define XS_NEED_DMA64_SEG(s, n)(0)
+#endif
 #defineXS_ISP(ccb) 
cam_sim_softc(xpt_path_sim((ccb)->ccb_h.path))
 #defineXS_CHANNEL(ccb)

svn commit: r317359 - stable/11/sys/dev/isp

2017-04-24 Thread Alexander Motin
Author: mav
Date: Mon Apr 24 10:20:36 2017
New Revision: 317359
URL: https://svnweb.freebsd.org/changeset/base/317359

Log:
  MFC r315870: isp field in struct isp_pcmd is also unused.

Modified:
  stable/11/sys/dev/isp/isp_freebsd.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/isp/isp_freebsd.h
==
--- stable/11/sys/dev/isp/isp_freebsd.h Mon Apr 24 10:19:59 2017
(r317358)
+++ stable/11/sys/dev/isp/isp_freebsd.h Mon Apr 24 10:20:36 2017
(r317359)
@@ -173,7 +173,6 @@ typedef struct tstate {
 struct isp_pcmd {
struct isp_pcmd *   next;
bus_dmamap_tdmap;   /* dma map for this command */
-   struct ispsoftc *   isp;/* containing isp */
struct callout  wdog;   /* watchdog timer */
uint32_tdatalen;/* data length for this command 
(target mode only) */
 };
___
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: r317358 - stable/11/sys/dev/isp

2017-04-24 Thread Alexander Motin
Author: mav
Date: Mon Apr 24 10:19:59 2017
New Revision: 317358
URL: https://svnweb.freebsd.org/changeset/base/317358

Log:
  MFC r315869: Remove write-only crn field from struct isp_pcmd.

Modified:
  stable/11/sys/dev/isp/isp_freebsd.c
  stable/11/sys/dev/isp/isp_freebsd.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/isp/isp_freebsd.c
==
--- stable/11/sys/dev/isp/isp_freebsd.c Mon Apr 24 10:19:26 2017
(r317357)
+++ stable/11/sys/dev/isp/isp_freebsd.c Mon Apr 24 10:19:59 2017
(r317358)
@@ -731,7 +731,6 @@ isp_free_pcmd(ispsoftc_t *isp, union ccb
if (ISP_PCMD(ccb)) {
 #ifdef ISP_TARGET_MODE
PISP_PCMD(ccb)->datalen = 0;
-   PISP_PCMD(ccb)->crn = 0;
 #endif
PISP_PCMD(ccb)->next = isp->isp_osinfo.pcmd_free;
isp->isp_osinfo.pcmd_free = ISP_PCMD(ccb);
@@ -4208,7 +4207,6 @@ isp_fcp_next_crn(ispsoftc_t *isp, uint8_
}
if (nxp->crnseed == 0)
nxp->crnseed = 1;
-   PISP_PCMD(cmd)->crn = nxp->crnseed;
*crnp = nxp->crnseed++;
return (0);
 }

Modified: stable/11/sys/dev/isp/isp_freebsd.h
==
--- stable/11/sys/dev/isp/isp_freebsd.h Mon Apr 24 10:19:26 2017
(r317357)
+++ stable/11/sys/dev/isp/isp_freebsd.h Mon Apr 24 10:19:59 2017
(r317358)
@@ -176,7 +176,6 @@ struct isp_pcmd {
struct ispsoftc *   isp;/* containing isp */
struct callout  wdog;   /* watchdog timer */
uint32_tdatalen;/* data length for this command 
(target mode only) */
-   uint8_t crn;/* command reference number */
 };
 #defineISP_PCMD(ccb)   (ccb)->ccb_h.spriv_ptr1
 #definePISP_PCMD(ccb)  ((struct isp_pcmd *)ISP_PCMD(ccb))
___
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: r317357 - stable/11/sys/dev/isp

2017-04-24 Thread Alexander Motin
Author: mav
Date: Mon Apr 24 10:19:26 2017
New Revision: 317357
URL: https://svnweb.freebsd.org/changeset/base/317357

Log:
  MFC r315708: Cleanup response queue processing.

Modified:
  stable/11/sys/dev/isp/isp.c
  stable/11/sys/dev/isp/isp_freebsd.c
  stable/11/sys/dev/isp/isp_freebsd.h
  stable/11/sys/dev/isp/ispvar.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/isp/isp.c
==
--- stable/11/sys/dev/isp/isp.c Mon Apr 24 10:16:12 2017(r317356)
+++ stable/11/sys/dev/isp/isp.c Mon Apr 24 10:19:26 2017(r317357)
@@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$");
 /*
  * Local static data
  */
-static const char notresp[] = "Not RESPONSE in RESPONSE Queue (type 0x%x) @ 
idx %d (next %d) nlooked %d";
+static const char notresp[] = "Unknown IOCB in RESPONSE Queue (type 0x%x) @ 
idx %d (next %d)";
 static const char bun[] = "bad underrun (count %d, resid %d, status %s)";
 static const char lipd[] = "Chan %d LIP destroyed %d active commands";
 static const char sacq[] = "unable to acquire scratch area";
@@ -98,8 +98,8 @@ static const uint8_t alpa_map[] = {
 static void isp_parse_async(ispsoftc_t *, uint16_t);
 static void isp_parse_async_fc(ispsoftc_t *, uint16_t);
 static int isp_handle_other_response(ispsoftc_t *, int, isphdr_t *, uint32_t 
*);
-static void isp_parse_status(ispsoftc_t *, ispstatusreq_t *, XS_T *, long *);
-static void isp_parse_status_24xx(ispsoftc_t *, isp24xx_statusreq_t *, XS_T *, 
long *);
+static void isp_parse_status(ispsoftc_t *, ispstatusreq_t *, XS_T *, uint32_t 
*);
+static void isp_parse_status_24xx(ispsoftc_t *, isp24xx_statusreq_t *, XS_T *, 
uint32_t *);
 static void isp_fastpost_complete(ispsoftc_t *, uint32_t);
 static void isp_scsi_init(ispsoftc_t *);
 static void isp_scsi_channel_init(ispsoftc_t *, int);
@@ -4971,21 +4971,18 @@ isp_intr_mbox(ispsoftc_t *isp, uint16_t 
MBOX_NOTIFY_COMPLETE(isp);
 }
 
-/*
- * Limit our stack depth by sticking with the max likely number
- * of completions on a request queue at any one time.
- */
-#ifndefMAX_REQUESTQ_COMPLETIONS
-#defineMAX_REQUESTQ_COMPLETIONS32
-#endif
-
 void
 isp_intr_respq(ispsoftc_t *isp)
 {
-   XS_T *complist[MAX_REQUESTQ_COMPLETIONS], *xs;
-   uint32_t iptr, optr, junk;
-   int i, nlooked = 0, ndone = 0, continuations_expected = 0;
-   int etype, last_etype = 0;
+   XS_T *xs, *cont_xs;
+   uint8_t qe[QENTRY_LEN];
+   ispstatusreq_t *sp = (ispstatusreq_t *)qe;
+   isp24xx_statusreq_t *sp2 = (isp24xx_statusreq_t *)qe;
+   isphdr_t *hp;
+   uint8_t *resp, *snsp;
+   int buddaboom, completion_status, cont = 0, etype, i;
+   int req_status_flags, req_state_flags, scsi_status;
+   uint32_t iptr, junk, cptr, optr, rlen, slen, sptr, totslen, resid;
 
/*
 * We can't be getting this now.
@@ -5007,38 +5004,30 @@ isp_intr_respq(ispsoftc_t *isp)
 
optr = isp->isp_resodx;
while (optr != iptr) {
-   uint8_t qe[QENTRY_LEN];
-   ispstatusreq_t *sp = (ispstatusreq_t *) qe;
-   isphdr_t *hp;
-   int buddaboom, scsi_status, completion_status;
-   int req_status_flags, req_state_flags;
-   uint8_t *snsp, *resp;
-   uint32_t rlen, slen, totslen;
-   long resid;
-   uint16_t oop;
-
-   hp = (isphdr_t *) ISP_QUEUE_ENTRY(isp->isp_result, optr);
-   oop = optr;
+   sptr = cptr = optr;
+   hp = (isphdr_t *) ISP_QUEUE_ENTRY(isp->isp_result, cptr);
optr = ISP_NXT_QENTRY(optr, RESULT_QUEUE_LEN(isp));
-   nlooked++;
- read_again:
-   buddaboom = req_status_flags = req_state_flags = 0;
-   resid = 0L;
 
/*
 * Synchronize our view of this response queue entry.
 */
-   MEMORYBARRIER(isp, SYNC_RESULT, oop, QENTRY_LEN, -1);
+   MEMORYBARRIER(isp, SYNC_RESULT, cptr, QENTRY_LEN, -1);
if (isp->isp_dblev & ISP_LOGDEBUG1)
-   isp_print_qentry(isp, "Response Queue Entry", oop, hp);
+   isp_print_qentry(isp, "Response Queue Entry", cptr, hp);
isp_get_hdr(isp, hp, >req_header);
etype = sp->req_header.rqs_entry_type;
 
+   /* We expected Status Continuation, but got different IOCB. */
+   if (cont > 0 && etype != RQSTYPE_STATUS_CONT) {
+   cont = 0;
+   isp_done(cont_xs);
+   }
+
if (IS_24XX(isp) && etype == RQSTYPE_RESPONSE) {
-   isp24xx_statusreq_t *sp2 = (isp24xx_statusreq_t *)qe;
isp_get_24xx_response(isp, (isp24xx_statusreq_t *)hp, 
sp2);
scsi_status = sp2->req_scsi_status;

svn commit: r317356 - head/sys/dev/isp

2017-04-24 Thread Alexander Motin
Author: mav
Date: Mon Apr 24 10:16:12 2017
New Revision: 317356
URL: https://svnweb.freebsd.org/changeset/base/317356

Log:
  Switch isp_reset to scratchpad not requiring ISP_MBOXDMASETUP.
  
  MFC after:1 week

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

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Mon Apr 24 08:44:51 2017(r317355)
+++ head/sys/dev/isp/isp.c  Mon Apr 24 10:16:12 2017(r317356)
@@ -1012,7 +1012,7 @@ isp_reset(ispsoftc_t *isp, int do_load_d
 
fwt = isp->isp_fwattr;
if (IS_24XX(isp)) {
-   buf = FCPARAM(isp, 0)->isp_scratch;
+   buf = FCPARAM(isp, 0)->isp_scanscratch;
ISP_SNPRINTF(buf, ISP_FC_SCRLEN, "Attributes:");
if (fwt & ISP2400_FW_ATTR_CLASS2) {
fwt ^=ISP2400_FW_ATTR_CLASS2;
@@ -1101,7 +1101,7 @@ isp_reset(ispsoftc_t *isp, int do_load_d
}
isp_prt(isp, ISP_LOGCONFIG, "%s", buf);
} else if (IS_FC(isp)) {
-   buf = FCPARAM(isp, 0)->isp_scratch;
+   buf = FCPARAM(isp, 0)->isp_scanscratch;
ISP_SNPRINTF(buf, ISP_FC_SCRLEN, "Attributes:");
if (fwt & ISP_FW_ATTR_TMODE) {
fwt ^=ISP_FW_ATTR_TMODE;
___
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: r317355 - head/sys/dev/cxgbe/cxgbei

2017-04-24 Thread Alexander Motin
Author: mav
Date: Mon Apr 24 08:44:51 2017
New Revision: 317355
URL: https://svnweb.freebsd.org/changeset/base/317355

Log:
  Use proper alignment constant for uma_zcreate().
  
  Previous code panicked on KASSERT with INVARIANTS enabled.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c

Modified: head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
==
--- head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c  Mon Apr 24 07:52:44 2017
(r317354)
+++ head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c  Mon Apr 24 08:44:51 2017
(r317355)
@@ -1070,7 +1070,7 @@ icl_cxgbei_mod_load(void)
 */
prsv_zone = uma_zcreate("Pagepod reservations",
sizeof(struct ppod_reservation), NULL, NULL, NULL, NULL,
-   CACHE_LINE_SIZE, 0);
+   UMA_ALIGN_CACHE, 0);
 
refcount_init(_cxgbei_ncons, 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: r317354 - stable/11/sys/arm64/arm64

2017-04-24 Thread Konstantin Belousov
Author: kib
Date: Mon Apr 24 07:52:44 2017
New Revision: 317354
URL: https://svnweb.freebsd.org/changeset/base/317354

Log:
  MFC r316679:
  Do not lose dirty bits for removing PROT_WRITE on arm64.

Modified:
  stable/11/sys/arm64/arm64/pmap.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm64/arm64/pmap.c
==
--- stable/11/sys/arm64/arm64/pmap.cMon Apr 24 07:52:27 2017
(r317353)
+++ stable/11/sys/arm64/arm64/pmap.cMon Apr 24 07:52:44 2017
(r317354)
@@ -2481,6 +2481,11 @@ pmap_protect(pmap_t pmap, vm_offset_t sv
sva += L3_SIZE) {
l3 = pmap_load(l3p);
if (pmap_l3_valid(l3)) {
+   if ((l3 & ATTR_SW_MANAGED) &&
+   pmap_page_dirty(l3)) {
+   vm_page_dirty(PHYS_TO_VM_PAGE(l3 &
+   ~ATTR_MASK));
+   }
pmap_set(l3p, ATTR_AP(ATTR_AP_RO));
PTE_SYNC(l3p);
/* XXX: Use pmap_invalidate_range */
___
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: r317353 - head/sys/dev/hyperv/netvsc

2017-04-24 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Apr 24 07:52:27 2017
New Revision: 317353
URL: https://svnweb.freebsd.org/changeset/base/317353

Log:
  hyperv/hn: Use channel0, i.e. TX ring0, for TCP SYN/SYN|ACK.
  
  Hyper-V hot channel effect:
  Operation latency on hot channel is only _half_ of the operation
  latency on cold channels.
  
  This commit takes the advantage of the above Hyper-V host channel
  effect, and can reduce more than 75% latency and more than 50%
  latency stdev, i.e. lower and more stable/predictable latency,
  for various types of web server workloads.
  
  MFC after:3 days
  Sponsored by: Microsoft

Modified:
  head/sys/dev/hyperv/netvsc/if_hn.c

Modified: head/sys/dev/hyperv/netvsc/if_hn.c
==
--- head/sys/dev/hyperv/netvsc/if_hn.c  Mon Apr 24 06:33:08 2017
(r317352)
+++ head/sys/dev/hyperv/netvsc/if_hn.c  Mon Apr 24 07:52:27 2017
(r317353)
@@ -622,6 +622,16 @@ hn_chim_free(struct hn_softc *sc, uint32
 }
 
 #if defined(INET6) || defined(INET)
+
+#define PULLUP_HDR(m, len) \
+do {   \
+   if (__predict_false((m)->m_len < (len))) {  \
+   (m) = m_pullup((m), (len)); \
+   if ((m) == NULL)\
+   return (NULL);  \
+   }   \
+} while (0)
+
 /*
  * NOTE: If this function failed, the m_head would be freed.
  */
@@ -634,15 +644,6 @@ hn_tso_fixup(struct mbuf *m_head)
 
KASSERT(M_WRITABLE(m_head), ("TSO mbuf not writable"));
 
-#define PULLUP_HDR(m, len) \
-do {   \
-   if (__predict_false((m)->m_len < (len))) {  \
-   (m) = m_pullup((m), (len)); \
-   if ((m) == NULL)\
-   return (NULL);  \
-   }   \
-} while (0)
-
PULLUP_HDR(m_head, sizeof(*evl));
evl = mtod(m_head, struct ether_vlan_header *);
if (evl->evl_encap_proto == ntohs(ETHERTYPE_VLAN))
@@ -691,8 +692,65 @@ do {   
\
 #endif
return (m_head);
 
-#undef PULLUP_HDR
 }
+
+/*
+ * NOTE: If this function failed, the m_head would be freed.
+ */
+static __inline struct mbuf *
+hn_check_tcpsyn(struct mbuf *m_head, int *tcpsyn)
+{
+   const struct ether_vlan_header *evl;
+   const struct tcphdr *th;
+   int ehlen;
+
+   *tcpsyn = 0;
+
+   PULLUP_HDR(m_head, sizeof(*evl));
+   evl = mtod(m_head, const struct ether_vlan_header *);
+   if (evl->evl_encap_proto == ntohs(ETHERTYPE_VLAN))
+   ehlen = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN;
+   else
+   ehlen = ETHER_HDR_LEN;
+
+#ifdef INET
+   if (m_head->m_pkthdr.csum_flags & CSUM_IP_TCP) {
+   const struct ip *ip;
+   int iphlen;
+
+   PULLUP_HDR(m_head, ehlen + sizeof(*ip));
+   ip = mtodo(m_head, ehlen);
+   iphlen = ip->ip_hl << 2;
+
+   PULLUP_HDR(m_head, ehlen + iphlen + sizeof(*th));
+   th = mtodo(m_head, ehlen + iphlen);
+   if (th->th_flags & TH_SYN)
+   *tcpsyn = 1;
+   }
+#endif
+#if defined(INET6) && defined(INET)
+   else
+#endif
+#ifdef INET6
+   {
+   const struct ip6_hdr *ip6;
+
+   PULLUP_HDR(m_head, ehlen + sizeof(*ip6));
+   ip6 = mtodo(m_head, ehlen);
+   if (ip6->ip6_nxt != IPPROTO_TCP)
+   return (m_head);
+
+   PULLUP_HDR(m_head, ehlen + sizeof(*ip6) + sizeof(*th));
+   th = mtodo(m_head, ehlen + sizeof(*ip6));
+   if (th->th_flags & TH_SYN)
+   *tcpsyn = 1;
+   }
+#endif
+   return (m_head);
+}
+
+#undef PULLUP_HDR
+
 #endif /* INET6 || INET */
 
 static int
@@ -4369,7 +4427,29 @@ hn_transmit(struct ifnet *ifp, struct mb
idx = bid % sc->hn_tx_ring_inuse;
else
 #endif
-   idx = m->m_pkthdr.flowid % sc->hn_tx_ring_inuse;
+   {
+#if defined(INET6) || defined(INET)
+   int tcpsyn = 0;
+
+   if (m->m_pkthdr.len < 128 &&
+   (m->m_pkthdr.csum_flags &
+(CSUM_IP_TCP | CSUM_IP6_TCP)) &&
+   (m->m_pkthdr.csum_flags & CSUM_TSO) == 0) {
+   m = hn_check_tcpsyn(m, );
+   if (__predict_false(m == NULL)) {
+   if_inc_counter(ifp,
+   IFCOUNTER_OERRORS, 1);
+   return (EIO);
+   }
+   

svn commit: r317352 - stable/10/usr.sbin/ctld

2017-04-24 Thread Alexander Motin
Author: mav
Date: Mon Apr 24 06:33:08 2017
New Revision: 317352
URL: https://svnweb.freebsd.org/changeset/base/317352

Log:
  MFC r316677: Do not register in CTL portal groups without portals.
  
  From config synthax point of view such portal groups are not incorrect,
  but they are useless since can not receive any connection.  And since
  CTL port resource is very limited, it is good to save it.

Modified:
  stable/10/usr.sbin/ctld/ctld.c
  stable/10/usr.sbin/ctld/ctld.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/ctld/ctld.c
==
--- stable/10/usr.sbin/ctld/ctld.c  Mon Apr 24 06:32:35 2017
(r317351)
+++ stable/10/usr.sbin/ctld/ctld.c  Mon Apr 24 06:33:08 2017
(r317352)
@@ -1219,7 +1219,6 @@ port_new(struct conf *conf, struct targe
port->p_target = target;
TAILQ_INSERT_TAIL(>pg_ports, port, p_pgs);
port->p_portal_group = pg;
-   port->p_foreign = pg->pg_foreign;
return (port);
 }
 
@@ -1292,6 +1291,19 @@ port_delete(struct port *port)
free(port);
 }
 
+int
+port_is_dummy(struct port *port)
+{
+
+   if (port->p_portal_group) {
+   if (port->p_portal_group->pg_foreign)
+   return (1);
+   if (TAILQ_EMPTY(>p_portal_group->pg_portals))
+   return (1);
+   }
+   return (0);
+}
+
 struct target *
 target_new(struct conf *conf, const char *name)
 {
@@ -1867,10 +1879,10 @@ conf_apply(struct conf *oldconf, struct 
 * and missing in the new one.
 */
TAILQ_FOREACH_SAFE(oldport, >conf_ports, p_next, tmpport) {
-   if (oldport->p_foreign)
+   if (port_is_dummy(oldport))
continue;
newport = port_find(newconf, oldport->p_name);
-   if (newport != NULL && !newport->p_foreign)
+   if (newport != NULL && !port_is_dummy(newport))
continue;
log_debugx("removing port \"%s\"", oldport->p_name);
error = kernel_port_remove(oldport);
@@ -1990,11 +2002,11 @@ conf_apply(struct conf *oldconf, struct 
 * Now add new ports or modify existing ones.
 */
TAILQ_FOREACH(newport, >conf_ports, p_next) {
-   if (newport->p_foreign)
+   if (port_is_dummy(newport))
continue;
oldport = port_find(oldconf, newport->p_name);
 
-   if (oldport == NULL || oldport->p_foreign) {
+   if (oldport == NULL || port_is_dummy(oldport)) {
log_debugx("adding port \"%s\"", newport->p_name);
error = kernel_port_add(newport);
} else {

Modified: stable/10/usr.sbin/ctld/ctld.h
==
--- stable/10/usr.sbin/ctld/ctld.h  Mon Apr 24 06:32:35 2017
(r317351)
+++ stable/10/usr.sbin/ctld/ctld.h  Mon Apr 24 06:33:08 2017
(r317352)
@@ -149,7 +149,6 @@ struct port {
struct portal_group *p_portal_group;
struct pport*p_pport;
struct target   *p_target;
-   int p_foreign;
 
uint32_tp_ctl_port;
 };
@@ -363,6 +362,7 @@ struct port *port_find(const struct con
 struct port*port_find_in_pg(const struct portal_group *pg,
const char *target);
 void   port_delete(struct port *port);
+intport_is_dummy(struct port *port);
 
 struct target  *target_new(struct conf *conf, const char *name);
 void   target_delete(struct target *target);
___
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: r317351 - stable/11/usr.sbin/ctld

2017-04-24 Thread Alexander Motin
Author: mav
Date: Mon Apr 24 06:32:35 2017
New Revision: 317351
URL: https://svnweb.freebsd.org/changeset/base/317351

Log:
  MFC r316677: Do not register in CTL portal groups without portals.
  
  From config synthax point of view such portal groups are not incorrect,
  but they are useless since can not receive any connection.  And since
  CTL port resource is very limited, it is good to save it.

Modified:
  stable/11/usr.sbin/ctld/ctld.c
  stable/11/usr.sbin/ctld/ctld.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/ctld/ctld.c
==
--- stable/11/usr.sbin/ctld/ctld.c  Sun Apr 23 23:09:02 2017
(r317350)
+++ stable/11/usr.sbin/ctld/ctld.c  Mon Apr 24 06:32:35 2017
(r317351)
@@ -1237,7 +1237,6 @@ port_new(struct conf *conf, struct targe
port->p_target = target;
TAILQ_INSERT_TAIL(>pg_ports, port, p_pgs);
port->p_portal_group = pg;
-   port->p_foreign = pg->pg_foreign;
return (port);
 }
 
@@ -1310,6 +1309,19 @@ port_delete(struct port *port)
free(port);
 }
 
+int
+port_is_dummy(struct port *port)
+{
+
+   if (port->p_portal_group) {
+   if (port->p_portal_group->pg_foreign)
+   return (1);
+   if (TAILQ_EMPTY(>p_portal_group->pg_portals))
+   return (1);
+   }
+   return (0);
+}
+
 struct target *
 target_new(struct conf *conf, const char *name)
 {
@@ -1885,10 +1897,10 @@ conf_apply(struct conf *oldconf, struct 
 * and missing in the new one.
 */
TAILQ_FOREACH_SAFE(oldport, >conf_ports, p_next, tmpport) {
-   if (oldport->p_foreign)
+   if (port_is_dummy(oldport))
continue;
newport = port_find(newconf, oldport->p_name);
-   if (newport != NULL && !newport->p_foreign)
+   if (newport != NULL && !port_is_dummy(newport))
continue;
log_debugx("removing port \"%s\"", oldport->p_name);
error = kernel_port_remove(oldport);
@@ -2008,11 +2020,11 @@ conf_apply(struct conf *oldconf, struct 
 * Now add new ports or modify existing ones.
 */
TAILQ_FOREACH(newport, >conf_ports, p_next) {
-   if (newport->p_foreign)
+   if (port_is_dummy(newport))
continue;
oldport = port_find(oldconf, newport->p_name);
 
-   if (oldport == NULL || oldport->p_foreign) {
+   if (oldport == NULL || port_is_dummy(oldport)) {
log_debugx("adding port \"%s\"", newport->p_name);
error = kernel_port_add(newport);
} else {

Modified: stable/11/usr.sbin/ctld/ctld.h
==
--- stable/11/usr.sbin/ctld/ctld.h  Sun Apr 23 23:09:02 2017
(r317350)
+++ stable/11/usr.sbin/ctld/ctld.h  Mon Apr 24 06:32:35 2017
(r317351)
@@ -151,7 +151,6 @@ struct port {
struct portal_group *p_portal_group;
struct pport*p_pport;
struct target   *p_target;
-   int p_foreign;
 
uint32_tp_ctl_port;
 };
@@ -371,6 +370,7 @@ struct port *port_find(const struct con
 struct port*port_find_in_pg(const struct portal_group *pg,
const char *target);
 void   port_delete(struct port *port);
+intport_is_dummy(struct port *port);
 
 struct target  *target_new(struct conf *conf, const char *name);
 void   target_delete(struct target *target);
___
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"