CVS commit: src/bin/sh

2018-12-11 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Dec 12 07:56:57 UTC 2018

Modified Files:
src/bin/sh: var.c

Log Message:
Fix a botch made in 1.70 (a bit over a week ago) where
var=foo; readonly var=new
now fails.

If var was already set, an attempt to make it readonly, and assign it
a new value at the same time, failed - the readonly flag was set too soon.

Pointed out by Martijn Dekker (thanks).

Also, while here, add a couple of comments.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/bin/sh/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/var.c
diff -u src/bin/sh/var.c:1.72 src/bin/sh/var.c:1.73
--- src/bin/sh/var.c:1.72	Tue Dec  4 14:03:30 2018
+++ src/bin/sh/var.c	Wed Dec 12 07:56:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.72 2018/12/04 14:03:30 kre Exp $	*/
+/*	$NetBSD: var.c,v 1.73 2018/12/12 07:56:57 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: var.c,v 1.72 2018/12/04 14:03:30 kre Exp $");
+__RCSID("$NetBSD: var.c,v 1.73 2018/12/12 07:56:57 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -879,13 +879,17 @@ exportcmd(int argc, char **argv)
 			if (nflg)
 vp->flags &= ~flag;
 			else if (flag && vp->flags) {
+/* note we go ahead and do any assignment */
 sh_warnx("%.*s: not available for export",
 len, name);
 res = 1;
 			} else {
-vp->flags |= flag;
 if (flag == VNOEXPORT)
 	vp->flags &= ~VEXPORT;
+
+/* if not NULL will be done in setvar below */
+if (p == NULL)
+	vp->flags |= flag;
 			}
 			if (p == NULL)
 continue;



CVS commit: src/doc

2018-12-11 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Dec 12 07:07:30 UTC 2018

Modified Files:
src/doc: CHANGES TODO.smpnet

Log Message:
Drop LMC-related entry from TODO.smpnet, and note removal of LMC.


To generate a diff of this commit:
cvs rdiff -u -r1.2461 -r1.2462 src/doc/CHANGES
cvs rdiff -u -r1.25 -r1.26 src/doc/TODO.smpnet

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2461 src/doc/CHANGES:1.2462
--- src/doc/CHANGES:1.2461	Sat Dec  8 22:38:06 2018
+++ src/doc/CHANGES	Wed Dec 12 07:07:30 2018
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2461 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2462 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -257,3 +257,5 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	atactl(8): Add support to automatically detect Micron/Crucial devices
 		and their vendor-specific SMART status values.  [mrg 20181205]
 	OpenSSL: Imported 1.1.1a. [christos 20181208]
+	kernel: Remove the lmc(4) driver, and its associated lmcconfig(8)
+		tool. [maxv 20181212]

Index: src/doc/TODO.smpnet
diff -u src/doc/TODO.smpnet:1.25 src/doc/TODO.smpnet:1.26
--- src/doc/TODO.smpnet:1.25	Sun Sep 23 13:48:16 2018
+++ src/doc/TODO.smpnet	Wed Dec 12 07:07:30 2018
@@ -1,4 +1,4 @@
-$NetBSD: TODO.smpnet,v 1.25 2018/09/23 13:48:16 maxv Exp $
+$NetBSD: TODO.smpnet,v 1.26 2018/12/12 07:07:30 maxv Exp $
 
 MP-safe components
 ==
@@ -115,7 +115,6 @@ Unfortunately some bpf_mtap on Rx are st
 This is the list of the functions that have such bpf_mtap:
 
  - sca_frame_process() @ sys/dev/ic/hd64570.c
- - rxintr_cleanup() @ sys/dev/pci/if_lmc.c
 
 Ideally we should make the functions run in softint somehow, but we don't have
 actual devices, no time (or interest/love) to work on the task, so instead we



CVS commit: src

2018-12-11 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Dec 12 07:04:06 UTC 2018

Modified Files:
src/distrib/sets/lists/base: mi rescue.mi
src/distrib/sets/lists/comp: mi
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/man: mi
src/share/man/man4: Makefile pci.4
src/sys/dev: DEVNAMES
src/sys/dev/pci: Makefile files.pci
src/usr.sbin: Makefile
Removed Files:
src/share/man/man4: lmc.4
src/sys/dev/pci: if_lmc.c if_lmc.h
src/usr.sbin/lmcconfig: Makefile lmcconfig.8 lmcconfig.c

Log Message:
Retire the LMC driver, and its associated lmcconfig tool. LMC has been
mentioned repeatedly as a non-MP-safe driver that is hard to maintain,
and no one is taking care of it.

LMC was removed from OpenBSD three years ago, and from FreeBSD a few
months ago.


To generate a diff of this commit:
cvs rdiff -u -r1.1193 -r1.1194 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.43 -r1.44 src/distrib/sets/lists/base/rescue.mi
cvs rdiff -u -r1.2240 -r1.2241 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.269 -r1.270 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.1630 -r1.1631 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.674 -r1.675 src/share/man/man4/Makefile
cvs rdiff -u -r1.22 -r0 src/share/man/man4/lmc.4
cvs rdiff -u -r1.98 -r1.99 src/share/man/man4/pci.4
cvs rdiff -u -r1.318 -r1.319 src/sys/dev/DEVNAMES
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pci/Makefile
cvs rdiff -u -r1.411 -r1.412 src/sys/dev/pci/files.pci
cvs rdiff -u -r1.68 -r0 src/sys/dev/pci/if_lmc.c
cvs rdiff -u -r1.26 -r0 src/sys/dev/pci/if_lmc.h
cvs rdiff -u -r1.279 -r1.280 src/usr.sbin/Makefile
cvs rdiff -u -r1.2 -r0 src/usr.sbin/lmcconfig/Makefile
cvs rdiff -u -r1.7 -r0 src/usr.sbin/lmcconfig/lmcconfig.8
cvs rdiff -u -r1.12 -r0 src/usr.sbin/lmcconfig/lmcconfig.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1193 src/distrib/sets/lists/base/mi:1.1194
--- src/distrib/sets/lists/base/mi:1.1193	Fri Nov  9 21:33:50 2018
+++ src/distrib/sets/lists/base/mi	Wed Dec 12 07:04:05 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1193 2018/11/09 21:33:50 abs Exp $
+# $NetBSD: mi,v 1.1194 2018/12/12 07:04:05 maxv Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -1762,7 +1762,7 @@
 ./usr/sbin/ldpd	base-router-bin
 ./usr/sbin/link	base-sysutil-bin
 ./usr/sbin/linkfarmbase-obsolete		obsolete
-./usr/sbin/lmcconfigbase-netutil-bin
+./usr/sbin/lmcconfigbase-obsolete		obsolete
 ./usr/sbin/lmtp	base-obsolete		obsolete
 ./usr/sbin/lockstatbase-sysutil-bin
 ./usr/sbin/lpc	base-lpr-bin

Index: src/distrib/sets/lists/base/rescue.mi
diff -u src/distrib/sets/lists/base/rescue.mi:1.43 src/distrib/sets/lists/base/rescue.mi:1.44
--- src/distrib/sets/lists/base/rescue.mi:1.43	Sun Sep 23 07:24:19 2018
+++ src/distrib/sets/lists/base/rescue.mi	Wed Dec 12 07:04:05 2018
@@ -1,4 +1,4 @@
-# $NetBSD: rescue.mi,v 1.43 2018/09/23 07:24:19 maxv Exp $
+# $NetBSD: rescue.mi,v 1.44 2018/12/12 07:04:05 maxv Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -67,7 +67,7 @@
 ./rescue/ldd	base-rescue-root
 ./rescue/less	base-rescue-root
 ./rescue/lfs_cleanerdbase-rescue-root
-./rescue/lmcconfigbase-rescue-root
+./rescue/lmcconfigbase-obsolete	obsolete
 ./rescue/lmcctl	base-obsolete	obsolete
 ./rescue/ln	base-rescue-root
 ./rescue/ls	base-rescue-root

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2240 src/distrib/sets/lists/comp/mi:1.2241
--- src/distrib/sets/lists/comp/mi:1.2240	Sat Dec  1 02:43:43 2018
+++ src/distrib/sets/lists/comp/mi	Wed Dec 12 07:04:05 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2240 2018/12/01 02:43:43 kamil Exp $
+#	$NetBSD: mi,v 1.2241 2018/12/12 07:04:05 maxv Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -643,7 +643,7 @@
 ./usr/include/dev/pci/if_fxpreg.h		comp-obsolete		obsolete
 ./usr/include/dev/pci/if_fxpvar.h		comp-obsolete		obsolete
 ./usr/include/dev/pci/if_levar.h		comp-obsolete		obsolete
-./usr/include/dev/pci/if_lmc.h			comp-c-include
+./usr/include/dev/pci/if_lmc.h			comp-obsolete		obsolete
 ./usr/include/dev/pci/if_lmc_types.h		comp-obsolete		obsolete
 ./usr/include/dev/pci/if_lmcioctl.h		comp-obsolete		obsolete
 ./usr/include/dev/pci/if_lmcvar.h		comp-obsolete		obsolete

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.269 src/distrib/sets/lists/debug/mi:1.270
--- src/distrib/sets/lists/debug/mi:1.269	Mon Oct  1 08:23:53 2018
+++ src/distrib/sets/lists/debug/mi	Wed Dec 12 07:04:05 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.269 2018/10/01 08:23:53 jmcneill Exp $
+# $NetBSD: mi,v 1.270 2018/12/12 07:04:05 maxv Exp $
 

CVS commit: src/external/bsd/file/lib

2018-12-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Dec 12 06:36:13 UTC 2018

Modified Files:
src/external/bsd/file/lib: Makefile

Log Message:
 Use DPSRCS for magic.h. OK'd by Christos.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/file/lib/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/file/lib/Makefile
diff -u src/external/bsd/file/lib/Makefile:1.10 src/external/bsd/file/lib/Makefile:1.11
--- src/external/bsd/file/lib/Makefile:1.10	Fri Oct 19 00:11:48 2018
+++ src/external/bsd/file/lib/Makefile	Wed Dec 12 06:36:13 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2018/10/19 00:11:48 christos Exp $
+#	$NetBSD: Makefile,v 1.11 2018/12/12 06:36:13 msaitoh Exp $
 #
 
 USE_FORT?= yes	# data driven bugs?
@@ -20,6 +20,7 @@ CPPFLAGS+=-I.
 SRCS=		magic.c apprentice.c softmagic.c ascmagic.c compress.c	\
 		is_json.c is_tar.c readelf.c print.c fsmagic.c apptype.c \
 		funcs.c cdf.c readcdf.c cdf_time.c encoding.c der.c buffer.c
+DPSRCS=		magic.h
 MAN=		libmagic.3
 MLINKS+=	libmagic.3 magic_open.3 \
 		libmagic.3 magic_close.3 \
@@ -41,5 +42,3 @@ magic.h:magic.h.in
 CLEANFILES+=	magic.h
 
 .include 
-
-${ALLOBJS}:	magic.h



CVS commit: src/sys/arch

2018-12-11 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Dec 12 06:29:37 UTC 2018

Modified Files:
src/sys/arch/amd64/conf: ALL GENERIC XEN3_DOM0
src/sys/arch/arc/conf: GENERIC
src/sys/arch/cats/conf: GENERIC INSTALL
src/sys/arch/cobalt/conf: GENERIC INSTALL
src/sys/arch/evbarm/conf: IXDP425 ZAO425
src/sys/arch/evbmips/conf: MALTA
src/sys/arch/evbppc/conf: PMPPC
src/sys/arch/hppa/conf: GENERIC
src/sys/arch/i386/conf: ALL GENERIC INSTALL_FLOPPY XEN3PAE_DOM0
src/sys/arch/iyonix/conf: GENERIC
src/sys/arch/macppc/conf: GENERIC
src/sys/arch/sgimips/conf: GENERIC32_IP3x
src/sys/arch/sparc64/conf: GENERIC

Log Message:
Remove references to "lmc" in the kernel configurations.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.511 -r1.512 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.159 -r1.160 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.191 -r1.192 src/sys/arch/arc/conf/GENERIC
cvs rdiff -u -r1.169 -r1.170 src/sys/arch/cats/conf/GENERIC
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/cats/conf/INSTALL
cvs rdiff -u -r1.160 -r1.161 src/sys/arch/cobalt/conf/GENERIC
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/cobalt/conf/INSTALL
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/evbarm/conf/IXDP425
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/evbarm/conf/ZAO425
cvs rdiff -u -r1.91 -r1.92 src/sys/arch/evbmips/conf/MALTA
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/evbppc/conf/PMPPC
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/hppa/conf/GENERIC
cvs rdiff -u -r1.458 -r1.459 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.1196 -r1.1197 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/i386/conf/INSTALL_FLOPPY
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/conf/XEN3PAE_DOM0
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/iyonix/conf/GENERIC
cvs rdiff -u -r1.349 -r1.350 src/sys/arch/macppc/conf/GENERIC
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/sgimips/conf/GENERIC32_IP3x
cvs rdiff -u -r1.210 -r1.211 src/sys/arch/sparc64/conf/GENERIC

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.109 src/sys/arch/amd64/conf/ALL:1.110
--- src/sys/arch/amd64/conf/ALL:1.109	Sun Dec  9 11:52:11 2018
+++ src/sys/arch/amd64/conf/ALL	Wed Dec 12 06:29:36 2018
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.109 2018/12/09 11:52:11 jdolecek Exp $
+# $NetBSD: ALL,v 1.110 2018/12/12 06:29:36 maxv Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.109 $"
+#ident		"ALL-$Revision: 1.110 $"
 
 maxusers	64		# estimated number of users
 
@@ -973,7 +973,6 @@ jme*	at pci? dev ? function ?	# JMicron 
 hme*	at pci? dev ? function ?	# Sun Microelectronics STP2002-STQ
 le*	at pci? dev ? function ?	# PCnet-PCI Ethernet
 lii*	at pci? dev ? function ?	# Atheros L2 Fast-Ethernet
-lmc*	at pci? dev ? function ?	# Lan Media Corp SSI/HSSI/DS3
 malo*	at pci? dev ? function ?	# Marvell Libertas Wireless
 mskc*	at pci? dev ? function ?	# Marvell Yukon 2 Gigabit Ethernet
 msk*	at mskc?			# Marvell Yukon 2 Gigabit Ethernet

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.511 src/sys/arch/amd64/conf/GENERIC:1.512
--- src/sys/arch/amd64/conf/GENERIC:1.511	Tue Dec 11 16:52:49 2018
+++ src/sys/arch/amd64/conf/GENERIC	Wed Dec 12 06:29:36 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.511 2018/12/11 16:52:49 maya Exp $
+# $NetBSD: GENERIC,v 1.512 2018/12/12 06:29:36 maxv Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.511 $"
+#ident		"GENERIC-$Revision: 1.512 $"
 
 maxusers	64		# estimated number of users
 
@@ -797,7 +797,6 @@ jme*	at pci? dev ? function ?	# JMicron 
 hme*	at pci? dev ? function ?	# Sun Microelectronics STP2002-STQ
 le*	at pci? dev ? function ?	# PCnet-PCI Ethernet
 lii*	at pci? dev ? function ?	# Atheros L2 Fast-Ethernet
-lmc*	at pci? dev ? function ?	# Lan Media Corp SSI/HSSI/DS3
 malo*	at pci? dev ? function ?	# Marvell Libertas Wireless
 mskc*	at pci? dev ? function ?	# Marvell Yukon 2 Gigabit Ethernet
 msk*	at mskc?			# Marvell Yukon 2 Gigabit Ethernet

Index: src/sys/arch/amd64/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.159 src/sys/arch/amd64/conf/XEN3_DOM0:1.160
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.159	Sat Nov 24 18:23:29 2018
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Wed Dec 12 06:29:36 2018
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.159 2018/11/24 18:23:29 bouyer Exp $
+# $NetBSD: XEN3_DOM0,v 1.160 2018/12/12 06:29:36 maxv Exp $
 
 include 	"arch/amd64/conf/std.xen"
 

CVS commit: src/share/man/man4

2018-12-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Dec 12 02:26:40 UTC 2018

Modified Files:
src/share/man/man4: shmif.4

Log Message:
Document capability of TX/RX offload and environment variable
RUMP_SHMIF_CAPENABLE. Bump date.

part of PR kern/53562


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/share/man/man4/shmif.4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man4/shmif.4
diff -u src/share/man/man4/shmif.4:1.4 src/share/man/man4/shmif.4:1.5
--- src/share/man/man4/shmif.4:1.4	Mon Oct 19 14:33:11 2015
+++ src/share/man/man4/shmif.4	Wed Dec 12 02:26:40 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: shmif.4,v 1.4 2015/10/19 14:33:11 pooka Exp $
+.\"	$NetBSD: shmif.4,v 1.5 2018/12/12 02:26:40 rin Exp $
 .\"
 .\" Copyright (c) 2010 Antti Kantee
 .\" All rights reserved.
@@ -23,7 +23,7 @@
 .\" INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd November 17, 2010
+.Dd December 12, 2018
 .Dt SHMIF 4
 .Os
 .Sh NAME
@@ -90,6 +90,30 @@ Destroying an
 interface is possible only via
 .Xr ifconfig 8
 .Em destroy .
+.Pp
+An
+.Nm
+interface emulates TX/RX offload options in software.
+They are specified by
+.Xr ifconfig 8 .
+Alternatively, its
+.Em if_capenable
+flag is directly specified by
+environment variable
+.Ev RUMP_SHMIF_CAPENABLE ,
+for example:
+.Bl -tag -width 0xf
+.It Ar 0x7ff80
+for all TX/RX offload
+.It Ar 0x6aa80
+for all TX offload
+.It Ar 0x15500
+for all RX offload
+.El
+.Pp
+See
+.Pa /usr/include/net/if.h
+for more details.
 .Sh SEE ALSO
 .Xr rump 3 ,
 .Xr virt 4 ,



CVS commit: src/sys

2018-12-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Dec 12 01:53:52 UTC 2018

Modified Files:
src/sys/netinet: ip_output.c
src/sys/netinet6: ip6_output.c

Log Message:
Simplify logic in ip{,6}_output().

Now, we have M_CSUM_TSOv[46] bit in ifp->if_csum_flags_tx when
TSO[46] is enabled for the interface. So we can simply check
whether TSO[46] is required in a packet but missing in the
interface by (sw_csum & M_CSUM_TSOv[46]).

Note that this is a very rare case where TSO[46] is suddenly
turned off during a packet passing b/w TCP and IP.

part of PR kern/53562
OK msaitoh


To generate a diff of this commit:
cvs rdiff -u -r1.307 -r1.308 src/sys/netinet/ip_output.c
cvs rdiff -u -r1.213 -r1.214 src/sys/netinet6/ip6_output.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet/ip_output.c
diff -u src/sys/netinet/ip_output.c:1.307 src/sys/netinet/ip_output.c:1.308
--- src/sys/netinet/ip_output.c:1.307	Wed Jul 11 05:25:45 2018
+++ src/sys/netinet/ip_output.c	Wed Dec 12 01:53:52 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_output.c,v 1.307 2018/07/11 05:25:45 maxv Exp $	*/
+/*	$NetBSD: ip_output.c,v 1.308 2018/12/12 01:53:52 rin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.307 2018/07/11 05:25:45 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.308 2018/12/12 01:53:52 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -715,13 +715,14 @@ sendit:
 		}
 
 		sa = (m->m_flags & M_MCAST) ? sintocsa(rdst) : sintocsa(dst);
-		if (__predict_true(
-		(m->m_pkthdr.csum_flags & M_CSUM_TSOv4) == 0 ||
-		(ifp->if_capenable & IFCAP_TSOv4) != 0)) {
-			error = ip_if_output(ifp, m, sa, rt);
-		} else {
+		if (__predict_false(sw_csum & M_CSUM_TSOv4)) {
+			/*
+			 * TSO4 is required by a packet, but disabled for
+			 * the interface.
+			 */
 			error = ip_tso_output(ifp, m, sa, rt);
-		}
+		} else
+			error = ip_if_output(ifp, m, sa, rt);
 		goto done;
 	}
 

Index: src/sys/netinet6/ip6_output.c
diff -u src/sys/netinet6/ip6_output.c:1.213 src/sys/netinet6/ip6_output.c:1.214
--- src/sys/netinet6/ip6_output.c:1.213	Thu Nov 29 10:02:52 2018
+++ src/sys/netinet6/ip6_output.c	Wed Dec 12 01:53:52 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_output.c,v 1.213 2018/11/29 10:02:52 ozaki-r Exp $	*/
+/*	$NetBSD: ip6_output.c,v 1.214 2018/12/12 01:53:52 rin Exp $	*/
 /*	$KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.213 2018/11/29 10:02:52 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.214 2018/12/12 01:53:52 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -843,12 +843,14 @@ ip6_output(
 		}
 
 		KASSERT(dst != NULL);
-		if (__predict_true(!tso ||
-		(ifp->if_capenable & IFCAP_TSOv6) != 0)) {
-			error = ip6_if_output(ifp, origifp, m, dst, rt);
-		} else {
+		if (__predict_false(sw_csum & M_CSUM_TSOv6)) {
+			/*
+			 * TSO6 is required by a packet, but disabled for
+			 * the interface.
+			 */
 			error = ip6_tso_output(ifp, origifp, m, dst, rt);
-		}
+		} else
+			error = ip6_if_output(ifp, origifp, m, dst, rt);
 		goto done;
 	}
 



CVS commit: src/sys/rump/net/lib/libshmif

2018-12-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Dec 12 01:51:32 UTC 2018

Modified Files:
src/sys/rump/net/lib/libshmif: if_shmem.c

Log Message:
Add TX/RX offload capabilities to shmif(4). They are emulated in
software by ether_sw_offload_[tr]x().

For rump kernels, if_capabilities for shmemif(4) can be specified
by environmental variable RUMP_SHMIF_CAPENABLE:

 setenv RUMP_SHMIF_CAPENABLE 0x7ff80 (all offload)
 setenv RUMP_SHMIF_CAPENABLE 0x6aa80 (all TX)
 setenv RUMP_SHMIF_CAPENABLE 0x15500 (all RX)

part of PR kern/53562
OK msaitoh


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/rump/net/lib/libshmif/if_shmem.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/rump/net/lib/libshmif/if_shmem.c
diff -u src/sys/rump/net/lib/libshmif/if_shmem.c:1.75 src/sys/rump/net/lib/libshmif/if_shmem.c:1.76
--- src/sys/rump/net/lib/libshmif/if_shmem.c:1.75	Tue Jun 26 06:48:03 2018
+++ src/sys/rump/net/lib/libshmif/if_shmem.c	Wed Dec 12 01:51:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_shmem.c,v 1.75 2018/06/26 06:48:03 msaitoh Exp $	*/
+/*	$NetBSD: if_shmem.c,v 1.76 2018/12/12 01:51:32 rin Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.75 2018/06/26 06:48:03 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.76 2018/12/12 01:51:32 rin Exp $");
 
 #include 
 #include 
@@ -43,6 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -76,6 +77,7 @@ struct if_clone shmif_cloner =
 static int	shmif_init(struct ifnet *);
 static int	shmif_ioctl(struct ifnet *, u_long, void *);
 static void	shmif_start(struct ifnet *);
+static void	shmif_snd(struct ifnet *, struct mbuf *);
 static void	shmif_stop(struct ifnet *, int);
 
 #include "shmifvar.h"
@@ -183,6 +185,12 @@ allocif(int unit, struct shmif_sc **scp)
 	ifp->if_stop = shmif_stop;
 	ifp->if_mtu = ETHERMTU;
 	ifp->if_dlt = DLT_EN10MB;
+	ifp->if_capabilities = IFCAP_TSOv4 | IFCAP_TSOv6 |
+	IFCAP_CSUM_IPv4_Rx	| IFCAP_CSUM_IPv4_Tx |
+	IFCAP_CSUM_TCPv4_Rx	| IFCAP_CSUM_TCPv4_Tx |
+	IFCAP_CSUM_UDPv4_Rx	| IFCAP_CSUM_UDPv4_Tx |
+	IFCAP_CSUM_TCPv6_Rx	| IFCAP_CSUM_TCPv6_Tx |
+	IFCAP_CSUM_UDPv6_Rx	| IFCAP_CSUM_UDPv6_Tx;
 
 	mutex_init(>sc_mtx, MUTEX_DEFAULT, IPL_NONE);
 	cv_init(>sc_cv, "shmifcv");
@@ -197,6 +205,16 @@ allocif(int unit, struct shmif_sc **scp)
 
 		return error;
 	}
+#if 1
+	char buf[256];
+
+	if (rumpuser_getparam("RUMP_SHMIF_CAPENABLE", buf, sizeof(buf)) == 0) {
+		uint64_t capen = strtoul(buf, NULL, 0);
+
+		ifp->if_capenable = capen & ifp->if_capabilities;
+	}
+#endif
+
 	ether_ifattach(ifp, enaddr);
 	if_register(ifp);
 
@@ -527,70 +545,33 @@ shmif_ioctl(struct ifnet *ifp, u_long cm
 	return rv;
 }
 
-/* send everything in-context since it's just a matter of mem-to-mem copy */
 static void
 shmif_start(struct ifnet *ifp)
 {
 	struct shmif_sc *sc = ifp->if_softc;
-	struct shmif_mem *busmem = sc->sc_busmem;
-	struct mbuf *m, *m0;
-	uint32_t dataoff;
-	uint32_t pktsize, pktwrote;
+	struct mbuf *m, *n;
 	bool wrote = false;
-	bool wrap;
 
 	ifp->if_flags |= IFF_OACTIVE;
 
 	for (;;) {
-		struct shmif_pkthdr sp;
-		struct timeval tv;
-
-		IF_DEQUEUE(>if_snd, m0);
-		if (m0 == NULL) {
+		IF_DEQUEUE(>if_snd, m);
+		if (m == NULL)
 			break;
-		}
 
-		pktsize = 0;
-		for (m = m0; m != NULL; m = m->m_next) {
-			pktsize += m->m_len;
+		m = ether_sw_offload_tx(ifp, m);
+		if (m == NULL) {
+			ifp->if_oerrors++;
+			break;
 		}
-		KASSERT(pktsize <= ETHERMTU + ETHER_HDR_LEN);
-
-		getmicrouptime();
-		sp.sp_len = pktsize;
-		sp.sp_sec = tv.tv_sec;
-		sp.sp_usec = tv.tv_usec;
-		sp.sp_sender = sc->sc_uuid;
 
-		bpf_mtap(ifp, m0, BPF_D_OUT);
-
-		shmif_lockbus(busmem);
-		KASSERT(busmem->shm_magic == SHMIF_MAGIC);
-		busmem->shm_last = shmif_nextpktoff(busmem, busmem->shm_last);
-
-		wrap = false;
-		dataoff = shmif_buswrite(busmem,
-		busmem->shm_last, , sizeof(sp), );
-		pktwrote = 0;
-		for (m = m0; m != NULL; m = m->m_next) {
-			pktwrote += m->m_len;
-			dataoff = shmif_buswrite(busmem, dataoff,
-			mtod(m, void *), m->m_len, );
-		}
-		KASSERT(pktwrote == pktsize);
-		if (wrap) {
-			busmem->shm_gen++;
-			DPRINTF(("bus generation now %" PRIu64 "\n",
-			busmem->shm_gen));
-		}
-		shmif_unlockbus(busmem);
+		do {
+			n = m->m_nextpkt;
+			shmif_snd(ifp, m);
+			m = n;
+		} while (m != NULL);
 
-		m_freem(m0);
 		wrote = true;
-		ifp->if_opackets++;
-
-		DPRINTF(("shmif_start: send %d bytes at off %d\n",
-		pktsize, busmem->shm_last));
 	}
 
 	ifp->if_flags &= ~IFF_OACTIVE;
@@ -601,6 +582,60 @@ shmif_start(struct ifnet *ifp)
 	}
 }
 
+/* send everything in-context since it's just a matter of mem-to-mem copy */
+static void
+shmif_snd(struct ifnet *ifp, struct mbuf *m0)
+{
+	struct shmif_sc *sc = ifp->if_softc;
+	struct 

CVS commit: src/sys

2018-12-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Dec 12 01:46:47 UTC 2018

Modified Files:
src/sys/net: if.c if_bridge.c if_bridgevar.h
src/sys/rump/librump/rumpnet: net_stub.c

Log Message:
PR kern/53562

Handle TX offload in software when a packet is sent via
bridge_output(). We can send it as is in the following
exceptional cases:

For unicast:

(1) When the destination interface is the same as source.

(2) When the destination supports all TX offload options
specified in a packet.

For multicast/broadcast:

(3) When all the members of the bridge support the specified
TX offload options.

For (3), add sc_csum_flags_tx flag to bridge softc, which is
logical AND b/w capabilities of TX offload options in member
interface (ifp->if_csum_flags_tx). The flag is updated when a
member is (i) added to or (ii) removed from a bridge, or (iii)
if_csum_flags_tx flag of a member interface is manipulated via
ifconfig(8).

Turn on M_CSUM_TSOv[46] bit in ifp->if_csum_flags_tx flag when
TSO[46] is enabled for that interface.

OK msaitoh thorpej


To generate a diff of this commit:
cvs rdiff -u -r1.441 -r1.442 src/sys/net/if.c
cvs rdiff -u -r1.160 -r1.161 src/sys/net/if_bridge.c
cvs rdiff -u -r1.32 -r1.33 src/sys/net/if_bridgevar.h
cvs rdiff -u -r1.36 -r1.37 src/sys/rump/librump/rumpnet/net_stub.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.441 src/sys/net/if.c:1.442
--- src/sys/net/if.c:1.441	Thu Nov 15 10:23:56 2018
+++ src/sys/net/if.c	Wed Dec 12 01:46:47 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.441 2018/11/15 10:23:56 maxv Exp $	*/
+/*	$NetBSD: if.c,v 1.442 2018/12/12 01:46:47 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.441 2018/11/15 10:23:56 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.442 2018/12/12 01:46:47 rin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -149,6 +149,11 @@ __KERNEL_RCSID(0, "$NetBSD: if.c,v 1.441
 #include "fddi.h"
 #include "token.h"
 
+#include "bridge.h"
+#if NBRIDGE > 0
+#include 
+#endif
+
 #include "carp.h"
 #if NCARP > 0
 #include 
@@ -2909,40 +2914,41 @@ ifioctl_common(struct ifnet *ifp, u_long
 		/* Pre-compute the checksum flags mask. */
 		ifp->if_csum_flags_tx = 0;
 		ifp->if_csum_flags_rx = 0;
-		if (ifp->if_capenable & IFCAP_CSUM_IPv4_Tx) {
+		if (ifp->if_capenable & IFCAP_CSUM_IPv4_Tx)
 			ifp->if_csum_flags_tx |= M_CSUM_IPv4;
-		}
-		if (ifp->if_capenable & IFCAP_CSUM_IPv4_Rx) {
+		if (ifp->if_capenable & IFCAP_CSUM_IPv4_Rx)
 			ifp->if_csum_flags_rx |= M_CSUM_IPv4;
-		}
 
-		if (ifp->if_capenable & IFCAP_CSUM_TCPv4_Tx) {
+		if (ifp->if_capenable & IFCAP_CSUM_TCPv4_Tx)
 			ifp->if_csum_flags_tx |= M_CSUM_TCPv4;
-		}
-		if (ifp->if_capenable & IFCAP_CSUM_TCPv4_Rx) {
+		if (ifp->if_capenable & IFCAP_CSUM_TCPv4_Rx)
 			ifp->if_csum_flags_rx |= M_CSUM_TCPv4;
-		}
 
-		if (ifp->if_capenable & IFCAP_CSUM_UDPv4_Tx) {
+		if (ifp->if_capenable & IFCAP_CSUM_UDPv4_Tx)
 			ifp->if_csum_flags_tx |= M_CSUM_UDPv4;
-		}
-		if (ifp->if_capenable & IFCAP_CSUM_UDPv4_Rx) {
+		if (ifp->if_capenable & IFCAP_CSUM_UDPv4_Rx)
 			ifp->if_csum_flags_rx |= M_CSUM_UDPv4;
-		}
 
-		if (ifp->if_capenable & IFCAP_CSUM_TCPv6_Tx) {
+		if (ifp->if_capenable & IFCAP_CSUM_TCPv6_Tx)
 			ifp->if_csum_flags_tx |= M_CSUM_TCPv6;
-		}
-		if (ifp->if_capenable & IFCAP_CSUM_TCPv6_Rx) {
+		if (ifp->if_capenable & IFCAP_CSUM_TCPv6_Rx)
 			ifp->if_csum_flags_rx |= M_CSUM_TCPv6;
-		}
 
-		if (ifp->if_capenable & IFCAP_CSUM_UDPv6_Tx) {
+		if (ifp->if_capenable & IFCAP_CSUM_UDPv6_Tx)
 			ifp->if_csum_flags_tx |= M_CSUM_UDPv6;
-		}
-		if (ifp->if_capenable & IFCAP_CSUM_UDPv6_Rx) {
+		if (ifp->if_capenable & IFCAP_CSUM_UDPv6_Rx)
 			ifp->if_csum_flags_rx |= M_CSUM_UDPv6;
-		}
+
+		if (ifp->if_capenable & IFCAP_TSOv4)
+			ifp->if_csum_flags_tx |= M_CSUM_TSOv4;
+		if (ifp->if_capenable & IFCAP_TSOv6)
+			ifp->if_csum_flags_tx |= M_CSUM_TSOv6;
+
+#if NBRIDGE > 0
+		if (ifp->if_bridge != NULL)
+			bridge_calc_csum_flags(ifp->if_bridge);
+#endif
+
 		if (ifp->if_flags & IFF_UP)
 			return ENETRESET;
 		return 0;

Index: src/sys/net/if_bridge.c
diff -u src/sys/net/if_bridge.c:1.160 src/sys/net/if_bridge.c:1.161
--- src/sys/net/if_bridge.c:1.160	Fri Nov  9 06:44:31 2018
+++ src/sys/net/if_bridge.c	Wed Dec 12 01:46:47 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.160 2018/11/09 06:44:31 ozaki-r Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.161 2018/12/12 01:46:47 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.160 2018/11/09 06:44:31 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.161 2018/12/12 01:46:47 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -112,6 +112,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_bridge.c,
 
 

CVS commit: src/sys

2018-12-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Dec 12 01:40:21 UTC 2018

Modified Files:
src/sys/net: files.net
src/sys/netinet: in_offload.c in_offload.h
src/sys/netinet6: in6_offload.c in6_offload.h
src/sys/rump/net/lib/libnet: Makefile
Added Files:
src/sys/net: ether_sw_offload.c ether_sw_offload.h

Log Message:
PR kern/53562

Add ether_sw_offload_[tr]x: handle TX/RX offload options in software.
Since this violates separation b/w L2 and L3/L4, new files are added
rather than having the routines in sys/net/if_ethersubr.c.

OK msaitoh thorpej


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/net/ether_sw_offload.c \
src/sys/net/ether_sw_offload.h
cvs rdiff -u -r1.19 -r1.20 src/sys/net/files.net
cvs rdiff -u -r1.12 -r1.13 src/sys/netinet/in_offload.c
cvs rdiff -u -r1.11 -r1.12 src/sys/netinet/in_offload.h
cvs rdiff -u -r1.11 -r1.12 src/sys/netinet6/in6_offload.c
cvs rdiff -u -r1.9 -r1.10 src/sys/netinet6/in6_offload.h
cvs rdiff -u -r1.30 -r1.31 src/sys/rump/net/lib/libnet/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/files.net
diff -u src/sys/net/files.net:1.19 src/sys/net/files.net:1.20
--- src/sys/net/files.net:1.19	Sun Sep 23 09:21:03 2018
+++ src/sys/net/files.net	Wed Dec 12 01:40:20 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.net,v 1.19 2018/09/23 09:21:03 maxv Exp $
+#	$NetBSD: files.net,v 1.20 2018/12/12 01:40:20 rin Exp $
 
 # XXX CLEANUP
 define	net
@@ -7,6 +7,7 @@ file	net/bpf_filter.c		bpf_filter
 file	net/bpf_stub.c			net
 file	net/bsd-comp.c			ppp & ppp_bsdcomp
 file	net/dl_print.c
+file	net/ether_sw_offload.c		bridge
 file	net/if.c			net
 file	net/if_arcsubr.c		arcnet			needs-flag
 file	net/if_bridge.c			bridge			needs-flag

Index: src/sys/netinet/in_offload.c
diff -u src/sys/netinet/in_offload.c:1.12 src/sys/netinet/in_offload.c:1.13
--- src/sys/netinet/in_offload.c:1.12	Wed Sep 19 07:54:11 2018
+++ src/sys/netinet/in_offload.c	Wed Dec 12 01:40:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_offload.c,v 1.12 2018/09/19 07:54:11 rin Exp $	*/
+/*	$NetBSD: in_offload.c,v 1.13 2018/12/12 01:40:20 rin Exp $	*/
 
 /*
  * Copyright (c)2005, 2006 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in_offload.c,v 1.12 2018/09/19 07:54:11 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_offload.c,v 1.13 2018/12/12 01:40:20 rin Exp $");
 
 #include 
 #include 
@@ -43,22 +43,23 @@ __KERNEL_RCSID(0, "$NetBSD: in_offload.c
 
 /*
  * Handle M_CSUM_TSOv4 in software. Split the TCP payload in chunks of
- * size MSS, and send them.
+ * size MSS, and return mbuf chain consists of them.
  */
-static int
-tcp4_segment(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *sa,
-struct rtentry *rt)
+struct mbuf *
+tcp4_segment(struct mbuf *m, int off)
 {
 	int mss;
 	int iphlen, thlen;
 	int hlen, len;
 	struct ip *ip;
 	struct tcphdr *th;
-	uint16_t ipid;
+	uint16_t ipid, phsum;
 	uint32_t tcpseq;
 	struct mbuf *hdr = NULL;
-	struct mbuf *t;
-	int error = 0;
+	struct mbuf *m0 = NULL;
+	struct mbuf *prev = NULL;
+	struct mbuf *n, *t;
+	int nsegs;
 
 	KASSERT((m->m_flags & M_PKTHDR) != 0);
 	KASSERT((m->m_pkthdr.csum_flags & M_CSUM_TSOv4) != 0);
@@ -66,107 +67,129 @@ tcp4_segment(struct ifnet *ifp, struct m
 	m->m_pkthdr.csum_flags = 0;
 
 	len = m->m_pkthdr.len;
-	KASSERT(len >= sizeof(*ip) + sizeof(*th));
+	KASSERT(len >= off + sizeof(*ip) + sizeof(*th));
 
-	if (m->m_len < sizeof(*ip)) {
-		m = m_pullup(m, sizeof(*ip));
-		if (m == NULL) {
-			error = ENOMEM;
+	hlen = off + sizeof(*ip);
+	if (m->m_len < hlen) {
+		m = m_pullup(m, hlen);
+		if (m == NULL)
 			goto quit;
-		}
 	}
-	ip = mtod(m, struct ip *);
+	ip = (void *)(mtod(m, char *) + off);
 	iphlen = ip->ip_hl * 4;
 	KASSERT(ip->ip_v == IPVERSION);
 	KASSERT(iphlen >= sizeof(*ip));
 	KASSERT(ip->ip_p == IPPROTO_TCP);
 	ipid = ntohs(ip->ip_id);
 
-	hlen = iphlen + sizeof(*th);
+	hlen = off + iphlen + sizeof(*th);
 	if (m->m_len < hlen) {
 		m = m_pullup(m, hlen);
-		if (m == NULL) {
-			error = ENOMEM;
+		if (m == NULL)
 			goto quit;
-		}
 	}
-	th = (void *)(mtod(m, char *) + iphlen);
+	th = (void *)(mtod(m, char *) + off + iphlen);
 	tcpseq = ntohl(th->th_seq);
 	thlen = th->th_off * 4;
-	hlen = iphlen + thlen;
+	hlen = off + iphlen + thlen;
 
 	mss = m->m_pkthdr.segsz;
 	KASSERT(mss != 0);
 	KASSERT(len > hlen);
 
 	t = m_split(m, hlen, M_NOWAIT);
-	if (t == NULL) {
-		error = ENOMEM;
+	if (t == NULL)
 		goto quit;
-	}
 	hdr = m;
 	m = t;
+
 	len -= hlen;
 	KASSERT(len % mss == 0);
-	while (len > 0) {
-		struct mbuf *n;
 
-		n = m_dup(hdr, 0, hlen, M_NOWAIT);
-		if (n == NULL) {
-			error = ENOMEM;
-			goto quit;
-		}
+	ip = (void *)(mtod(hdr, char *) + off);
+	ip->ip_len = htons(iphlen + thlen + mss);
+	phsum = in_cksum_phdr(ip->ip_src.s_addr, ip->ip_dst.s_addr,
+	htons((uint16_t)(thlen + mss) + IPPROTO_TCP));
+
+	for (nsegs = len / mss; nsegs 

CVS commit: src/sys/rump

2018-12-11 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Wed Dec 12 00:48:44 UTC 2018

Modified Files:
src/sys/rump/dev/lib/libnetsmb: netsmb_user.c
src/sys/rump/dev/lib/libpci: rumpdev_bus_dma.c rumpdev_bus_space.c
src/sys/rump/dev/lib/libscsipi: scsipi_component.c
src/sys/rump/dev/lib/libucom: ucom_at_usb.c
src/sys/rump/dev/lib/libugenhc: ugenhc_user.c
src/sys/rump/dev/lib/libulpt: ulpt_at_usb.c
src/sys/rump/dev/lib/libumass: umass_component.c
src/sys/rump/dev/lib/libwscons: wscons_component.c
src/sys/rump/kern/lib/libsys_cygwin: rump_cygwin_compat.c
sys_cygwin_component.c
src/sys/rump/kern/lib/libsys_linux: linux_rump.c sys_linux_component.c
src/sys/rump/kern/lib/libsys_sunos: rump_sunos_compat.c
sys_sunos_component.c
src/sys/rump/librump/rumpkern/arch/generic: rump_generic_directmap.c
src/sys/rump/net/lib/libpppoe: pppoe_component.c
src/sys/rump/net/lib/libshmif: shmif_user.c
src/sys/rump/net/lib/libsockin: sockin_user.c
src/sys/rump/net/lib/libvirtif: virtif_user.c

Log Message:
Add missing RCSIDs.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/rump/dev/lib/libnetsmb/netsmb_user.c
cvs rdiff -u -r1.6 -r1.7 src/sys/rump/dev/lib/libpci/rumpdev_bus_dma.c
cvs rdiff -u -r1.8 -r1.9 src/sys/rump/dev/lib/libpci/rumpdev_bus_space.c
cvs rdiff -u -r1.2 -r1.3 src/sys/rump/dev/lib/libscsipi/scsipi_component.c
cvs rdiff -u -r1.8 -r1.9 src/sys/rump/dev/lib/libucom/ucom_at_usb.c
cvs rdiff -u -r1.1 -r1.2 src/sys/rump/dev/lib/libugenhc/ugenhc_user.c
cvs rdiff -u -r1.6 -r1.7 src/sys/rump/dev/lib/libulpt/ulpt_at_usb.c
cvs rdiff -u -r1.2 -r1.3 src/sys/rump/dev/lib/libumass/umass_component.c
cvs rdiff -u -r1.2 -r1.3 src/sys/rump/dev/lib/libwscons/wscons_component.c
cvs rdiff -u -r1.1 -r1.2 \
src/sys/rump/kern/lib/libsys_cygwin/rump_cygwin_compat.c
cvs rdiff -u -r1.3 -r1.4 \
src/sys/rump/kern/lib/libsys_cygwin/sys_cygwin_component.c
cvs rdiff -u -r1.2 -r1.3 src/sys/rump/kern/lib/libsys_linux/linux_rump.c
cvs rdiff -u -r1.4 -r1.5 \
src/sys/rump/kern/lib/libsys_linux/sys_linux_component.c
cvs rdiff -u -r1.2 -r1.3 \
src/sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c
cvs rdiff -u -r1.3 -r1.4 \
src/sys/rump/kern/lib/libsys_sunos/sys_sunos_component.c
cvs rdiff -u -r1.1 -r1.2 \
src/sys/rump/librump/rumpkern/arch/generic/rump_generic_directmap.c
cvs rdiff -u -r1.1 -r1.2 src/sys/rump/net/lib/libpppoe/pppoe_component.c
cvs rdiff -u -r1.2 -r1.3 src/sys/rump/net/lib/libshmif/shmif_user.c
cvs rdiff -u -r1.1 -r1.2 src/sys/rump/net/lib/libsockin/sockin_user.c
cvs rdiff -u -r1.3 -r1.4 src/sys/rump/net/lib/libvirtif/virtif_user.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/rump/dev/lib/libnetsmb/netsmb_user.c
diff -u src/sys/rump/dev/lib/libnetsmb/netsmb_user.c:1.3 src/sys/rump/dev/lib/libnetsmb/netsmb_user.c:1.4
--- src/sys/rump/dev/lib/libnetsmb/netsmb_user.c:1.3	Sun Nov 16 15:31:12 2014
+++ src/sys/rump/dev/lib/libnetsmb/netsmb_user.c	Wed Dec 12 00:48:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: netsmb_user.c,v 1.3 2014/11/16 15:31:12 nakayama Exp $	*/
+/*	$NetBSD: netsmb_user.c,v 1.4 2018/12/12 00:48:43 alnsn Exp $	*/
 
 /*
  * Copyright (c) 2014 Takeshi Nakayama.
@@ -24,6 +24,10 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: netsmb_user.c,v 1.4 2018/12/12 00:48:43 alnsn Exp $");
+
 #ifndef _KERNEL
 #include 
 #include 

Index: src/sys/rump/dev/lib/libpci/rumpdev_bus_dma.c
diff -u src/sys/rump/dev/lib/libpci/rumpdev_bus_dma.c:1.6 src/sys/rump/dev/lib/libpci/rumpdev_bus_dma.c:1.7
--- src/sys/rump/dev/lib/libpci/rumpdev_bus_dma.c:1.6	Fri Apr 27 08:51:26 2018
+++ src/sys/rump/dev/lib/libpci/rumpdev_bus_dma.c	Wed Dec 12 00:48:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpdev_bus_dma.c,v 1.6 2018/04/27 08:51:26 maxv Exp $	*/
+/*	$NetBSD: rumpdev_bus_dma.c,v 1.7 2018/12/12 00:48:43 alnsn Exp $	*/
 
 /*-
  * Copyright (c) 2013 Antti Kantee
@@ -67,6 +67,9 @@
  *	NetBSD: bus_dma.c,v 1.46 2012/02/01 09:54:03 matt Exp
  */
 
+#include 
+__KERNEL_RCSID(0, "$NetBSD: rumpdev_bus_dma.c,v 1.7 2018/12/12 00:48:43 alnsn Exp $");
+
 #include 
 #include 
 #include 

Index: src/sys/rump/dev/lib/libpci/rumpdev_bus_space.c
diff -u src/sys/rump/dev/lib/libpci/rumpdev_bus_space.c:1.8 src/sys/rump/dev/lib/libpci/rumpdev_bus_space.c:1.9
--- src/sys/rump/dev/lib/libpci/rumpdev_bus_space.c:1.8	Thu Jul  7 06:55:43 2016
+++ src/sys/rump/dev/lib/libpci/rumpdev_bus_space.c	Wed Dec 12 00:48:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpdev_bus_space.c,v 1.8 2016/07/07 06:55:43 msaitoh Exp $	*/
+/*	$NetBSD: rumpdev_bus_space.c,v 1.9 2018/12/12 00:48:43 alnsn Exp $	*/
 
 /*-
  * Copyright (c) 2013 Antti Kantee.  All Rights Reserved.
@@ -26,6 

CVS commit: src/sys/dev/ata

2018-12-11 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Dec 11 23:06:30 UTC 2018

Modified Files:
src/sys/dev/ata: ata.c

Log Message:
in atabus_detach(), shutdown the channel thread only after all the
children successfully detach; this is especially important for
atapibus, which needs the thread to execute commands

fixes hang on poweroff with root on ATAPI cd(4), reported by Christoph Badura


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.147 src/sys/dev/ata/ata.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ata/ata.c
diff -u src/sys/dev/ata/ata.c:1.146 src/sys/dev/ata/ata.c:1.147
--- src/sys/dev/ata/ata.c:1.146	Mon Nov 12 18:51:01 2018
+++ src/sys/dev/ata/ata.c	Tue Dec 11 23:06:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata.c,v 1.146 2018/11/12 18:51:01 jdolecek Exp $	*/
+/*	$NetBSD: ata.c,v 1.147 2018/12/11 23:06:30 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.146 2018/11/12 18:51:01 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.147 2018/12/11 23:06:30 jdolecek Exp $");
 
 #include "opt_ata.h"
 
@@ -630,15 +630,6 @@ atabus_detach(device_t self, int flags)
 	device_t dev = NULL;
 	int i, error = 0;
 
-	/* Shutdown the channel. */
-	ata_channel_lock(chp);
-	chp->ch_flags |= ATACH_SHUTDOWN;
-	while (chp->ch_thread != NULL) {
-		cv_signal(>ch_thr_idle);
-		cv_wait(>ch_thr_idle, >ch_lock);
-	}
-	ata_channel_unlock(chp);
-
 	/*
 	 * Detach atapibus and its children.
 	 */
@@ -673,6 +664,16 @@ atabus_detach(device_t self, int flags)
 			KASSERT(chp->ch_drive[i].drive_type == 0);
 		}
 	}
+
+	/* Shutdown the channel. */
+	ata_channel_lock(chp);
+	chp->ch_flags |= ATACH_SHUTDOWN;
+	while (chp->ch_thread != NULL) {
+		cv_signal(>ch_thr_idle);
+		cv_wait(>ch_thr_idle, >ch_lock);
+	}
+	ata_channel_unlock(chp);
+
 	atabus_free_drives(chp);
 
  out:



CVS commit: src/lib/libkvm

2018-12-11 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Tue Dec 11 23:02:19 UTC 2018

Modified Files:
src/lib/libkvm: kvm_getloadavg.3

Log Message:
Reword post mortem description. It tries to get the tree averages if it can.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/libkvm/kvm_getloadavg.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libkvm/kvm_getloadavg.3
diff -u src/lib/libkvm/kvm_getloadavg.3:1.12 src/lib/libkvm/kvm_getloadavg.3:1.13
--- src/lib/libkvm/kvm_getloadavg.3:1.12	Tue Dec 11 02:29:11 2018
+++ src/lib/libkvm/kvm_getloadavg.3	Tue Dec 11 23:02:19 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kvm_getloadavg.3,v 1.12 2018/12/11 02:29:11 sevan Exp $
+.\"	$NetBSD: kvm_getloadavg.3,v 1.13 2018/12/11 23:02:19 sevan Exp $
 .\"
 .\" Copyright (c) 1992, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -58,8 +58,8 @@ On a live system, the load average is ob
 .Xr getloadavg 3 .
 If performing post mortem on a kernel core file,
 .Nm
-obtains the system load average at the time of death from the core file
-directly.
+is able to extract the system load averages at the time of death from the core
+file directly.
 .Sh RETURN VALUES
 If the load average was unobtainable, \-1 is returned; otherwise,
 the number of samples actually retrieved is returned.



CVS commit: src/sys/dev/marvell

2018-12-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec 11 19:40:54 UTC 2018

Modified Files:
src/sys/dev/marvell: com_mv.c

Log Message:
Remove stray ; to fix the build


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/marvell/com_mv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/com_mv.c
diff -u src/sys/dev/marvell/com_mv.c:1.10 src/sys/dev/marvell/com_mv.c:1.11
--- src/sys/dev/marvell/com_mv.c:1.10	Tue Dec 11 06:34:00 2018
+++ src/sys/dev/marvell/com_mv.c	Tue Dec 11 19:40:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: com_mv.c,v 1.10 2018/12/11 06:34:00 thorpej Exp $	*/
+/*	$NetBSD: com_mv.c,v 1.11 2018/12/11 19:40:54 martin Exp $	*/
 /*
  * Copyright (c) 2007, 2010 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: com_mv.c,v 1.10 2018/12/11 06:34:00 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com_mv.c,v 1.11 2018/12/11 19:40:54 martin Exp $");
 
 #include 
 #include 
@@ -55,7 +55,7 @@ CFATTACH_DECL_NEW(mvuart_mbus, sizeof(st
 
 static void
 mvuart_init_regs(struct com_regs *regs, bus_space_tag_t tag,
-		 bus_space_handle_t hdl, bus_addr_t addr);
+		 bus_space_handle_t hdl, bus_addr_t addr)
 {
 
 	com_init_regs_stride(regs, tag, hdl, addr, 2);



CVS commit: src/sys/arch/arm/include

2018-12-11 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Tue Dec 11 19:38:42 UTC 2018

Modified Files:
src/sys/arch/arm/include: cpufunc.h

Log Message:
Don't exclude code from rump kernel build.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/arm/include/cpufunc.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/include/cpufunc.h
diff -u src/sys/arch/arm/include/cpufunc.h:1.81 src/sys/arch/arm/include/cpufunc.h:1.82
--- src/sys/arch/arm/include/cpufunc.h:1.81	Sat Oct 20 06:35:34 2018
+++ src/sys/arch/arm/include/cpufunc.h	Tue Dec 11 19:38:42 2018
@@ -46,8 +46,6 @@
 
 #ifdef _KERNEL
 
-#if !defined(_RUMPKERNEL)
-
 #include 
 
 #include 
@@ -415,8 +413,6 @@ extern struct arm_cache_info arm_scache;
 
 extern uint32_t cpu_ttb;
 
-#endif	/* _GUMP */
-
 #endif	/* _KERNEL */
 
 #if defined(_KERNEL) || defined(_KMEMUSER)



CVS commit: src/sys/arch/aarch64/aarch64

2018-12-11 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Tue Dec 11 18:11:33 UTC 2018

Modified Files:
src/sys/arch/aarch64/aarch64: cpuswitch.S

Log Message:
need to save/restore also x1. x1 is in-use as ipl.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/aarch64/aarch64/cpuswitch.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/aarch64/aarch64/cpuswitch.S
diff -u src/sys/arch/aarch64/aarch64/cpuswitch.S:1.7 src/sys/arch/aarch64/aarch64/cpuswitch.S:1.8
--- src/sys/arch/aarch64/aarch64/cpuswitch.S:1.7	Fri Dec  7 18:27:03 2018
+++ src/sys/arch/aarch64/aarch64/cpuswitch.S	Tue Dec 11 18:11:33 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuswitch.S,v 1.7 2018/12/07 18:27:03 ryo Exp $ */
+/* $NetBSD: cpuswitch.S,v 1.8 2018/12/11 18:11:33 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 #include "opt_ddb.h"
 #include "opt_kasan.h"
 
-RCSID("$NetBSD: cpuswitch.S,v 1.7 2018/12/07 18:27:03 ryo Exp $")
+RCSID("$NetBSD: cpuswitch.S,v 1.8 2018/12/11 18:11:33 ryo Exp $")
 
 /*
  * At IPL_SCHED:
@@ -145,9 +145,9 @@ ENTRY_NP(cpu_switchto_softint)
 
 #ifdef KASAN
 	/* clear the new stack */
-	stp	x0, xzr, [sp, #-16]!
+	stp	x0, x1, [sp, #-16]!
 	bl	_C_LABEL(kasan_softint)
-	ldp	x0, xzr, [sp], #16
+	ldp	x0, x1, [sp], #16
 #endif
 
 	/* onto new stack */



CVS commit: src/sys/arch

2018-12-11 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Dec 11 16:52:49 UTC 2018

Modified Files:
src/sys/arch/amd64/conf: GENERIC INSTALL
src/sys/arch/i386/conf: GENERIC INSTALL

Log Message:
revert previous, nouveau apparently works for some people.


To generate a diff of this commit:
cvs rdiff -u -r1.510 -r1.511 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/amd64/conf/INSTALL
cvs rdiff -u -r1.1195 -r1.1196 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.334 -r1.335 src/sys/arch/i386/conf/INSTALL

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.510 src/sys/arch/amd64/conf/GENERIC:1.511
--- src/sys/arch/amd64/conf/GENERIC:1.510	Tue Dec 11 11:00:18 2018
+++ src/sys/arch/amd64/conf/GENERIC	Tue Dec 11 16:52:49 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.510 2018/12/11 11:00:18 maya Exp $
+# $NetBSD: GENERIC,v 1.511 2018/12/11 16:52:49 maya Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.510 $"
+#ident		"GENERIC-$Revision: 1.511 $"
 
 maxusers	64		# estimated number of users
 
@@ -434,8 +434,8 @@ intelfb*	at intelfbbus?
 radeon* 	at pci? dev ? function ?
 radeondrmkmsfb* at radeonfbbus?
 
-#nouveau*	at pci? dev ? function ?
-#nouveaufb*	at nouveaufbbus?
+nouveau*	at pci? dev ? function ?
+nouveaufb*	at nouveaufbbus?
 
 # DRMUMS drivers
 #viadrmums*	at drm?

Index: src/sys/arch/amd64/conf/INSTALL
diff -u src/sys/arch/amd64/conf/INSTALL:1.93 src/sys/arch/amd64/conf/INSTALL:1.94
--- src/sys/arch/amd64/conf/INSTALL:1.93	Tue Dec 11 14:04:15 2018
+++ src/sys/arch/amd64/conf/INSTALL	Tue Dec 11 16:52:49 2018
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.93 2018/12/11 14:04:15 maya Exp $
+# $NetBSD: INSTALL,v 1.94 2018/12/11 16:52:49 maya Exp $
 #
 #	INSTALL - Installation kernel.
 #
@@ -8,7 +8,7 @@
 include	"arch/amd64/conf/GENERIC"
 
 options 	CONSDEVNAME="\"com\"",CONADDR=0x2f8,CONSPEED=115200
-#ident 		"INSTALL-$Revision: 1.93 $"
+#ident 		"INSTALL-$Revision: 1.94 $"
 
 no options	MEMORY_DISK_DYNAMIC
 options 	MEMORY_DISK_IS_ROOT	# force root on memory disk
@@ -19,4 +19,4 @@ options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	#
 # DRMKMS driver
 no i915drmkms* at pci?
 no radeon* at pci?
-#no nouveau*	   at pci?
+no nouveau*	   at pci?

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1195 src/sys/arch/i386/conf/GENERIC:1.1196
--- src/sys/arch/i386/conf/GENERIC:1.1195	Tue Dec 11 11:00:18 2018
+++ src/sys/arch/i386/conf/GENERIC	Tue Dec 11 16:52:49 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1195 2018/12/11 11:00:18 maya Exp $
+# $NetBSD: GENERIC,v 1.1196 2018/12/11 16:52:49 maya Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1195 $"
+#ident		"GENERIC-$Revision: 1.1196 $"
 
 maxusers	64		# estimated number of users
 
@@ -559,8 +559,8 @@ intelfb*	at intelfbbus?
 radeon* 	at pci? dev ? function ?
 radeondrmkmsfb* at radeonfbbus?
 
-#nouveau*	at pci? dev ? function ?
-#nouveaufb*	at nouveaufbbus?
+nouveau*	at pci? dev ? function ?
+nouveaufb*	at nouveaufbbus?
 
 # DRMUMS drivers
 #viadrmums*	at drm?

Index: src/sys/arch/i386/conf/INSTALL
diff -u src/sys/arch/i386/conf/INSTALL:1.334 src/sys/arch/i386/conf/INSTALL:1.335
--- src/sys/arch/i386/conf/INSTALL:1.334	Tue Dec 11 14:04:15 2018
+++ src/sys/arch/i386/conf/INSTALL	Tue Dec 11 16:52:49 2018
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.334 2018/12/11 14:04:15 maya Exp $
+# $NetBSD: INSTALL,v 1.335 2018/12/11 16:52:49 maya Exp $
 #
 #	INSTALL - Installation kernel.
 #
@@ -7,7 +7,7 @@
 
 include	"arch/i386/conf/MONOLITHIC"
 
-#ident 		"INSTALL-$Revision: 1.334 $"
+#ident 		"INSTALL-$Revision: 1.335 $"
 
 no options	MEMORY_DISK_DYNAMIC
 options 	MEMORY_DISK_IS_ROOT	# force root on memory disk
@@ -18,7 +18,7 @@ options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	#
 # DRMKMS driver
 no i915drmkms* at pci?
 no radeon* at pci?
-#no nouveau*	   at pci?
+no nouveau*	   at pci?
 
 # pre-PCI graphics drivers, not enabled in GENERIC
 vga0		at isa?



CVS commit: src/sys/dev/usb

2018-12-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec 11 16:45:49 UTC 2018

Modified Files:
src/sys/dev/usb: if_mue.c

Log Message:
Avoid signed/unsigned comparision (if_mtu is uint64_t)


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/usb/if_mue.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/if_mue.c
diff -u src/sys/dev/usb/if_mue.c:1.22 src/sys/dev/usb/if_mue.c:1.23
--- src/sys/dev/usb/if_mue.c:1.22	Tue Dec 11 13:35:02 2018
+++ src/sys/dev/usb/if_mue.c	Tue Dec 11 16:45:49 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mue.c,v 1.22 2018/12/11 13:35:02 rin Exp $	*/
+/*	$NetBSD: if_mue.c,v 1.23 2018/12/11 16:45:49 martin Exp $	*/
 /*	$OpenBSD: if_mue.c,v 1.3 2018/08/04 16:42:46 jsg Exp $	*/
 
 /*
@@ -20,7 +20,7 @@
 /* Driver for Microchip LAN7500/LAN7800 chipsets. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.22 2018/12/11 13:35:02 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.23 2018/12/11 16:45:49 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1218,7 +1218,8 @@ mue_encap(struct mue_softc *sc, struct m
 		  M_CSUM_TCPv6 | M_CSUM_UDPv6);
 
 	len = m->m_pkthdr.len;
-	if (__predict_false((!tso && len > MUE_FRAME_LEN(ifp->if_mtu)) ||
+	if (__predict_false((!tso && 
+(unsigned)len > MUE_FRAME_LEN(ifp->if_mtu)) ||
 			( tso && len > MUE_TSO_FRAME_LEN))) {
 		MUE_PRINTF(sc, "packet length %d\n too long", len);
 		return EINVAL;



CVS commit: src/sys/dev/usb

2018-12-11 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Dec 11 14:49:27 UTC 2018

Modified Files:
src/sys/dev/usb: ucom.c

Log Message:
restore error reporting in ucomparam() lost in 1.115


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/dev/usb/ucom.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/ucom.c
diff -u src/sys/dev/usb/ucom.c:1.120 src/sys/dev/usb/ucom.c:1.121
--- src/sys/dev/usb/ucom.c:1.120	Sun Jan 21 13:57:12 2018
+++ src/sys/dev/usb/ucom.c	Tue Dec 11 14:49:27 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ucom.c,v 1.120 2018/01/21 13:57:12 skrll Exp $	*/
+/*	$NetBSD: ucom.c,v 1.121 2018/12/11 14:49:27 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.120 2018/01/21 13:57:12 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.121 2018/12/11 14:49:27 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1250,7 +1250,7 @@ out:
 
 	mutex_exit(>sc_lock);
 
-	return 0;
+	return error;
 }
 
 static int



CVS commit: src/sys/netinet

2018-12-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Dec 11 14:38:46 UTC 2018

Modified Files:
src/sys/netinet: sctp_pcb.c

Log Message:
PR/53775: Havard Eidnes: bind(2) may inaccurately return EADDRNOTAVAIL,
it should return EADDRINUSE.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/netinet/sctp_pcb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet/sctp_pcb.c
diff -u src/sys/netinet/sctp_pcb.c:1.17 src/sys/netinet/sctp_pcb.c:1.18
--- src/sys/netinet/sctp_pcb.c:1.17	Mon Sep  3 12:29:36 2018
+++ src/sys/netinet/sctp_pcb.c	Tue Dec 11 09:38:45 2018
@@ -1,5 +1,5 @@
 /* $KAME: sctp_pcb.c,v 1.39 2005/06/16 18:29:25 jinmei Exp $ */
-/* $NetBSD: sctp_pcb.c,v 1.17 2018/09/03 16:29:36 riastradh Exp $ */
+/* $NetBSD: sctp_pcb.c,v 1.18 2018/12/11 14:38:45 christos Exp $ */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
@@ -33,7 +33,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sctp_pcb.c,v 1.17 2018/09/03 16:29:36 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sctp_pcb.c,v 1.18 2018/12/11 14:38:45 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1763,7 +1763,7 @@ sctp_inpcb_bind(struct socket *so, struc
 
 			/* unlock info */
 			SCTP_INP_INFO_WUNLOCK();
-			return (EADDRNOTAVAIL);
+			return EADDRINUSE;
 		}
 		SCTP_INP_WLOCK(inp);
 		if (bindall) {
@@ -1773,7 +1773,7 @@ sctp_inpcb_bind(struct socket *so, struc
 SCTP_INP_DECR_REF(inp);
 SCTP_INP_WUNLOCK(inp);
 SCTP_INP_INFO_WUNLOCK();
-return (EADDRNOTAVAIL);
+return EADDRINUSE;
 			}
 		}
 	} else {



CVS commit: src/sys/arch

2018-12-11 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Dec 11 14:04:15 UTC 2018

Modified Files:
src/sys/arch/amd64/conf: INSTALL
src/sys/arch/i386/conf: INSTALL

Log Message:
comment out nouveau related lines in INSTALL kernels too


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/amd64/conf/INSTALL
cvs rdiff -u -r1.333 -r1.334 src/sys/arch/i386/conf/INSTALL

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/conf/INSTALL
diff -u src/sys/arch/amd64/conf/INSTALL:1.92 src/sys/arch/amd64/conf/INSTALL:1.93
--- src/sys/arch/amd64/conf/INSTALL:1.92	Mon Dec 25 06:38:59 2017
+++ src/sys/arch/amd64/conf/INSTALL	Tue Dec 11 14:04:15 2018
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.92 2017/12/25 06:38:59 rin Exp $
+# $NetBSD: INSTALL,v 1.93 2018/12/11 14:04:15 maya Exp $
 #
 #	INSTALL - Installation kernel.
 #
@@ -8,7 +8,7 @@
 include	"arch/amd64/conf/GENERIC"
 
 options 	CONSDEVNAME="\"com\"",CONADDR=0x2f8,CONSPEED=115200
-#ident 		"INSTALL-$Revision: 1.92 $"
+#ident 		"INSTALL-$Revision: 1.93 $"
 
 no options	MEMORY_DISK_DYNAMIC
 options 	MEMORY_DISK_IS_ROOT	# force root on memory disk
@@ -19,4 +19,4 @@ options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	#
 # DRMKMS driver
 no i915drmkms* at pci?
 no radeon* at pci?
-no nouveau*	   at pci?
+#no nouveau*	   at pci?

Index: src/sys/arch/i386/conf/INSTALL
diff -u src/sys/arch/i386/conf/INSTALL:1.333 src/sys/arch/i386/conf/INSTALL:1.334
--- src/sys/arch/i386/conf/INSTALL:1.333	Mon Dec 25 06:39:00 2017
+++ src/sys/arch/i386/conf/INSTALL	Tue Dec 11 14:04:15 2018
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.333 2017/12/25 06:39:00 rin Exp $
+# $NetBSD: INSTALL,v 1.334 2018/12/11 14:04:15 maya Exp $
 #
 #	INSTALL - Installation kernel.
 #
@@ -7,7 +7,7 @@
 
 include	"arch/i386/conf/MONOLITHIC"
 
-#ident 		"INSTALL-$Revision: 1.333 $"
+#ident 		"INSTALL-$Revision: 1.334 $"
 
 no options	MEMORY_DISK_DYNAMIC
 options 	MEMORY_DISK_IS_ROOT	# force root on memory disk
@@ -18,7 +18,7 @@ options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	#
 # DRMKMS driver
 no i915drmkms* at pci?
 no radeon* at pci?
-no nouveau*	   at pci?
+#no nouveau*	   at pci?
 
 # pre-PCI graphics drivers, not enabled in GENERIC
 vga0		at isa?



CVS commit: src/sys/dev/usb

2018-12-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Dec 11 13:35:03 UTC 2018

Modified Files:
src/sys/dev/usb: if_mue.c if_muereg.h

Log Message:
Determine the frame size as a function of MTU.

XXX Jumbo frame is not yet supported.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/usb/if_mue.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/usb/if_muereg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/if_mue.c
diff -u src/sys/dev/usb/if_mue.c:1.21 src/sys/dev/usb/if_mue.c:1.22
--- src/sys/dev/usb/if_mue.c:1.21	Tue Dec 11 09:05:50 2018
+++ src/sys/dev/usb/if_mue.c	Tue Dec 11 13:35:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mue.c,v 1.21 2018/12/11 09:05:50 rin Exp $	*/
+/*	$NetBSD: if_mue.c,v 1.22 2018/12/11 13:35:02 rin Exp $	*/
 /*	$OpenBSD: if_mue.c,v 1.3 2018/08/04 16:42:46 jsg Exp $	*/
 
 /*
@@ -20,7 +20,7 @@
 /* Driver for Microchip LAN7500/LAN7800 chipsets. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.21 2018/12/11 09:05:50 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.22 2018/12/11 13:35:02 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -150,6 +150,7 @@ static void	mue_tx_offload(struct mue_so
 
 static void	mue_setmulti(struct mue_softc *);
 static void	mue_sethwcsum(struct mue_softc *);
+static void	mue_setmtu(struct mue_softc *);
 
 static void	mue_rxeof(struct usbd_xfer *, void *, usbd_status);
 static void	mue_txeof(struct usbd_xfer *, void *, usbd_status);
@@ -772,14 +773,6 @@ mue_chip_init(struct mue_softc *sc)
 	MUE_SETBIT(sc, (sc->mue_flags & LAN7500) ?
 	MUE_7500_FCT_TX_CTL : MUE_7800_FCT_TX_CTL, MUE_FCT_TX_CTL_EN);
 
-	/* Set the maximum frame size. */
-	MUE_CLRBIT(sc, MUE_MAC_RX, MUE_MAC_RX_RXEN);
-	val = mue_csr_read(sc, MUE_MAC_RX);
-	val &= ~MUE_MAC_RX_MAX_SIZE_MASK;
-	val |= MUE_MAC_RX_MAX_LEN(ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN);
-	mue_csr_write(sc, MUE_MAC_RX, val);
-	MUE_SETBIT(sc, MUE_MAC_RX, MUE_MAC_RX_RXEN);
-
 	MUE_SETBIT(sc, (sc->mue_flags & LAN7500) ?
 	MUE_7500_FCT_RX_CTL : MUE_7800_FCT_RX_CTL, MUE_FCT_RX_CTL_EN);
 
@@ -1014,6 +1007,9 @@ mue_attach(device_t parent, device_t sel
 	IFCAP_CSUM_UDPv6_Tx | IFCAP_CSUM_UDPv6_Rx;
 
 	sc->mue_ec.ec_capabilities = ETHERCAP_VLAN_MTU;
+#if 0 /* XXX not yet */
+	sc->mue_ec.ec_capabilities = ETHERCAP_VLAN_MTU | ETHERCAP_JUMBO_MTU;
+#endif
 
 	/* Initialize MII/media info. */
 	mii = GET_MII(sc);
@@ -1222,8 +1218,8 @@ mue_encap(struct mue_softc *sc, struct m
 		  M_CSUM_TCPv6 | M_CSUM_UDPv6);
 
 	len = m->m_pkthdr.len;
-	if (__predict_false((!tso && len > MUE_MAX_TX_LEN) ||
-			( tso && len > MUE_MAX_TSO_LEN))) {
+	if (__predict_false((!tso && len > MUE_FRAME_LEN(ifp->if_mtu)) ||
+			( tso && len > MUE_TSO_FRAME_LEN))) {
 		MUE_PRINTF(sc, "packet length %d\n too long", len);
 		return EINVAL;
 	}
@@ -1419,6 +1415,20 @@ mue_sethwcsum(struct mue_softc *sc)
 	mue_csr_write(sc, reg, val);
 }
 
+static void
+mue_setmtu(struct mue_softc *sc)
+{
+	struct ifnet *ifp = GET_IFP(sc);
+	uint32_t val;
+
+	/* Set the maximum frame size. */
+	MUE_CLRBIT(sc, MUE_MAC_RX, MUE_MAC_RX_RXEN);
+	val = mue_csr_read(sc, MUE_MAC_RX);
+	val &= ~MUE_MAC_RX_MAX_SIZE_MASK;
+	val |= MUE_MAC_RX_MAX_LEN(MUE_FRAME_LEN(ifp->if_mtu));
+	mue_csr_write(sc, MUE_MAC_RX, val);
+	MUE_SETBIT(sc, MUE_MAC_RX, MUE_MAC_RX_RXEN);
+}
 
 static void
 mue_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status status)
@@ -1488,7 +1498,7 @@ mue_rxeof(struct usbd_xfer *xfer, void *
 			pktlen -= 2;
 
 		if (__predict_false(pktlen < ETHER_HDR_LEN + ETHER_CRC_LEN ||
-		pktlen > MCLBYTES - ETHER_ALIGN ||
+		pktlen > MCLBYTES - ETHER_ALIGN || /* XXX */
 		pktlen + sizeof(*hdrp) > totlen)) {
 			MUE_PRINTF(sc, "invalid packet length %d\n", pktlen);
 			ifp->if_ierrors++;
@@ -1621,6 +1631,9 @@ mue_init(struct ifnet *ifp)
 	/* TCP/UDP checksum offload engines. */
 	mue_sethwcsum(sc);
 
+	/* Set MTU. */
+	mue_setmtu(sc);
+
 	if (mue_open_pipes(sc)) {
 		splx(s);
 		return EIO;
@@ -1661,7 +1674,7 @@ mue_ioctl(struct ifnet *ifp, u_long cmd,
 
 	s = splnet();
 
-	switch(cmd) {
+	switch (cmd) {
 	case SIOCSIFFLAGS:
 		if ((error = ifioctl_common(ifp, cmd, data)) != 0)
 			break;
@@ -1690,10 +1703,20 @@ mue_ioctl(struct ifnet *ifp, u_long cmd,
 		if ((error = ether_ioctl(ifp, cmd, data)) != ENETRESET)
 			break;
 		error = 0;
-		if (cmd == SIOCSIFCAP)
-			mue_sethwcsum(sc);
-		if (cmd == SIOCADDMULTI || cmd == SIOCDELMULTI)
+		switch (cmd) {
+		case SIOCADDMULTI:
+		case SIOCDELMULTI:
 			mue_setmulti(sc);
+			break;
+		case SIOCSIFCAP:
+			mue_sethwcsum(sc);
+			break;
+		case SIOCSIFMTU:
+			mue_setmtu(sc);
+			break;
+		default:
+			break;
+		}
 		break;
 	}
 	splx(s);

Index: src/sys/dev/usb/if_muereg.h
diff -u src/sys/dev/usb/if_muereg.h:1.3 src/sys/dev/usb/if_muereg.h:1.4
--- src/sys/dev/usb/if_muereg.h:1.3	Sun Sep 16 01:23:09 2018
+++ src/sys/dev/usb/if_muereg.h	Tue Dec 11 13:35:02 2018
@@ -1,4 

CVS commit: src/bin/sh

2018-12-11 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Dec 11 13:31:20 UTC 2018

Modified Files:
src/bin/sh: main.c parser.c parser.h sh.1

Log Message:
PR standards/42829

Implement parameter and arithmetic expansion of $ENV
before using it as the name of a file from which to
read startup commands for the shell.   This continues
to happen for all interactive shells, and non-interactive
shells for which the posix option is not set (-o posix).

On any actual error, or if an attempt is made to use
command substitution, then the value of ENV is used
unchanged as the file name.

The expansion complies with POSIX XCU 2.5.3, though that
only requires parameter expansion - arithmetic expansion
is an extension (but for us, it is much easier to do, than
not to do, and it allows some weird stuff, if you're so
inclined)   Note that there is no ~ expansion (use $HOME).


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/bin/sh/main.c
cvs rdiff -u -r1.158 -r1.159 src/bin/sh/parser.c
cvs rdiff -u -r1.26 -r1.27 src/bin/sh/parser.h
cvs rdiff -u -r1.211 -r1.212 src/bin/sh/sh.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/main.c
diff -u src/bin/sh/main.c:1.78 src/bin/sh/main.c:1.79
--- src/bin/sh/main.c:1.78	Mon Dec  3 06:43:19 2018
+++ src/bin/sh/main.c	Tue Dec 11 13:31:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.78 2018/12/03 06:43:19 kre Exp $	*/
+/*	$NetBSD: main.c,v 1.79 2018/12/11 13:31:20 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.7 (Berkeley) 7/19/95";
 #else
-__RCSID("$NetBSD: main.c,v 1.78 2018/12/03 06:43:19 kre Exp $");
+__RCSID("$NetBSD: main.c,v 1.79 2018/12/11 13:31:20 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -202,20 +202,24 @@ main(int argc, char **argv)
 	if (argv[0] && argv[0][0] == '-') {
 		state = 1;
 		read_profile("/etc/profile");
-state1:
+ state1:
 		state = 2;
 		read_profile(".profile");
 	}
-state2:
+ state2:
 	state = 3;
 	if ((iflag || !posix) &&
 	getuid() == geteuid() && getgid() == getegid()) {
+		struct stackmark env_smark;
+
+		setstackmark(_smark);
 		if ((shinit = lookupvar("ENV")) != NULL && *shinit != '\0') {
 			state = 3;
-			read_profile(shinit);
+			read_profile(expandenv(shinit));
 		}
+		popstackmark(_smark);
 	}
-state3:
+ state3:
 	state = 4;
 	line_number = 1;	/* undo anything from profile files */
 
@@ -238,7 +242,7 @@ state3:
 		evalstring(minusc, sflag ? 0 : EV_EXIT);
 
 	if (sflag || minusc == NULL) {
-state4:	/* XXX ??? - why isn't this before the "if" statement */
+ state4:	/* XXX ??? - why isn't this before the "if" statement */
 		cmdloop(1);
 	}
 #if PROFILE
@@ -326,6 +330,9 @@ read_profile(const char *name)
 	int xflag_set = 0;
 	int vflag_set = 0;
 
+	if (*name == '\0')
+		return;
+
 	INTOFF;
 	if ((fd = open(name, O_RDONLY)) >= 0)
 		setinputfd(fd, 1);

Index: src/bin/sh/parser.c
diff -u src/bin/sh/parser.c:1.158 src/bin/sh/parser.c:1.159
--- src/bin/sh/parser.c:1.158	Sun Dec  9 17:33:38 2018
+++ src/bin/sh/parser.c	Tue Dec 11 13:31:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: parser.c,v 1.158 2018/12/09 17:33:38 christos Exp $	*/
+/*	$NetBSD: parser.c,v 1.159 2018/12/11 13:31:20 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)parser.c	8.7 (Berkeley) 5/16/95";
 #else
-__RCSID("$NetBSD: parser.c,v 1.158 2018/12/09 17:33:38 christos Exp $");
+__RCSID("$NetBSD: parser.c,v 1.159 2018/12/11 13:31:20 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -2447,7 +2447,7 @@ getprompt(void *unused)
  * behaviour.
  */
 static const char *
-expandonstack(char *ps, int lineno)
+expandonstack(char *ps, int cmdsub, int lineno)
 {
 	union node n;
 	struct jmploc jmploc;
@@ -2465,9 +2465,13 @@ expandonstack(char *ps, int lineno)
 		setinputstring(ps, 1, lineno);
 
 		readtoken1(pgetc(), DQSYNTAX, 1);
-		if (backquotelist != NULL && !promptcmds)
-			result = "-o promptcmds not set: ";
-		else {
+		if (backquotelist != NULL) {
+			if (!cmdsub) 
+result = ps;
+			else if (!promptcmds)
+result = "-o promptcmds not set: ";
+		}
+		if (result == NULL) {
 			n.narg.type = NARG;
 			n.narg.next = NULL;
 			n.narg.text = wordtext;
@@ -2518,7 +2522,7 @@ expandstr(char *ps, int lineno)
 	 */
 	(void) stalloc(stackblocksize());
 
-	result = expandonstack(ps, lineno);
+	result = expandonstack(ps, 1, lineno);
 
 	if (__predict_true(result == stackblock())) {
 		size_t len = strlen(result) + 1;
@@ -2566,3 +2570,17 @@ expandstr(char *ps, int lineno)
 
 	return result;
 }
+
+/*
+ * and a simpler version, which does no $( ) expansions, for
+ * use during shell startup when we know we are not parsing,
+ * and so the stack is not in use - we can do what we like,
+ * and do not need to clean up (that's handled externally).
+ *
+ * Simply return the result, even if it is on the stack
+ */

CVS commit: src/sys/arch

2018-12-11 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Dec 11 11:00:18 UTC 2018

Modified Files:
src/sys/arch/amd64/conf: GENERIC
src/sys/arch/i386/conf: GENERIC

Log Message:
disable nouveau. it hasn't been functional since the import of new drmkms
code.


To generate a diff of this commit:
cvs rdiff -u -r1.509 -r1.510 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.1194 -r1.1195 src/sys/arch/i386/conf/GENERIC

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.509 src/sys/arch/amd64/conf/GENERIC:1.510
--- src/sys/arch/amd64/conf/GENERIC:1.509	Sun Dec  2 21:00:13 2018
+++ src/sys/arch/amd64/conf/GENERIC	Tue Dec 11 11:00:18 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.509 2018/12/02 21:00:13 maxv Exp $
+# $NetBSD: GENERIC,v 1.510 2018/12/11 11:00:18 maya Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.509 $"
+#ident		"GENERIC-$Revision: 1.510 $"
 
 maxusers	64		# estimated number of users
 
@@ -434,8 +434,8 @@ intelfb*	at intelfbbus?
 radeon* 	at pci? dev ? function ?
 radeondrmkmsfb* at radeonfbbus?
 
-nouveau*	at pci? dev ? function ?
-nouveaufb*	at nouveaufbbus?
+#nouveau*	at pci? dev ? function ?
+#nouveaufb*	at nouveaufbbus?
 
 # DRMUMS drivers
 #viadrmums*	at drm?

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1194 src/sys/arch/i386/conf/GENERIC:1.1195
--- src/sys/arch/i386/conf/GENERIC:1.1194	Sat Nov 24 18:23:29 2018
+++ src/sys/arch/i386/conf/GENERIC	Tue Dec 11 11:00:18 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1194 2018/11/24 18:23:29 bouyer Exp $
+# $NetBSD: GENERIC,v 1.1195 2018/12/11 11:00:18 maya Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1194 $"
+#ident		"GENERIC-$Revision: 1.1195 $"
 
 maxusers	64		# estimated number of users
 
@@ -559,8 +559,8 @@ intelfb*	at intelfbbus?
 radeon* 	at pci? dev ? function ?
 radeondrmkmsfb* at radeonfbbus?
 
-nouveau*	at pci? dev ? function ?
-nouveaufb*	at nouveaufbbus?
+#nouveau*	at pci? dev ? function ?
+#nouveaufb*	at nouveaufbbus?
 
 # DRMUMS drivers
 #viadrmums*	at drm?



CVS commit: src/sys/dev/usb

2018-12-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Dec 11 09:05:50 UTC 2018

Modified Files:
src/sys/dev/usb: if_mue.c

Log Message:
Stop assigning random MAC address when it cannot be obtained from H/W.
It was intended only for debugging.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/usb/if_mue.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/if_mue.c
diff -u src/sys/dev/usb/if_mue.c:1.20 src/sys/dev/usb/if_mue.c:1.21
--- src/sys/dev/usb/if_mue.c:1.20	Tue Dec 11 08:16:57 2018
+++ src/sys/dev/usb/if_mue.c	Tue Dec 11 09:05:50 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mue.c,v 1.20 2018/12/11 08:16:57 rin Exp $	*/
+/*	$NetBSD: if_mue.c,v 1.21 2018/12/11 09:05:50 rin Exp $	*/
 /*	$OpenBSD: if_mue.c,v 1.3 2018/08/04 16:42:46 jsg Exp $	*/
 
 /*
@@ -20,7 +20,7 @@
 /* Driver for Microchip LAN7500/LAN7800 chipsets. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.20 2018/12/11 08:16:57 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.21 2018/12/11 09:05:50 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -28,7 +28,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1
 #endif
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -924,7 +923,6 @@ mue_attach(device_t parent, device_t sel
 		return;
 	}
 
-	mutex_init(>mue_mii_lock, MUTEX_DEFAULT, IPL_NONE);
 	usb_init_task(>mue_tick_task, mue_tick_task, sc, 0);
 	usb_init_task(>mue_stop_task, (void (*)(void *))mue_stop, sc, 0);
 
@@ -987,10 +985,9 @@ mue_attach(device_t parent, device_t sel
 		aprint_normal_dev(self, "LAN7800\n");
 
 	if (mue_get_macaddr(sc, dict)) {
-		aprint_error_dev(self, "Ethernet address assigned randomly\n");
-		cprng_fast(sc->mue_enaddr, ETHER_ADDR_LEN);
-		sc->mue_enaddr[0] &= ~0x01;	/* unicast */
-		sc->mue_enaddr[0] |= 0x02;	/* locally administered */
+		aprint_error_dev(self, "failed to read MAC address\n");
+		splx(s);
+		return;
 	}
 
 	aprint_normal_dev(self, "Ethernet address %s\n",
@@ -1047,6 +1044,8 @@ mue_attach(device_t parent, device_t sel
 
 	splx(s);
 
+	mutex_init(>mue_mii_lock, MUTEX_DEFAULT, IPL_NONE);
+
 	usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->mue_udev, sc->mue_dev);
 }
 



CVS commit: src/sys/dev/usb

2018-12-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Dec 11 08:16:57 UTC 2018

Modified Files:
src/sys/dev/usb: if_mue.c if_muevar.h

Log Message:
Support checksum offloading for mue(4) by Robert Swindells
and adjusted by myself.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/usb/if_mue.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/usb/if_muevar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/if_mue.c
diff -u src/sys/dev/usb/if_mue.c:1.19 src/sys/dev/usb/if_mue.c:1.20
--- src/sys/dev/usb/if_mue.c:1.19	Tue Dec  4 01:35:15 2018
+++ src/sys/dev/usb/if_mue.c	Tue Dec 11 08:16:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mue.c,v 1.19 2018/12/04 01:35:15 rin Exp $	*/
+/*	$NetBSD: if_mue.c,v 1.20 2018/12/11 08:16:57 rin Exp $	*/
 /*	$OpenBSD: if_mue.c,v 1.3 2018/08/04 16:42:46 jsg Exp $	*/
 
 /*
@@ -20,7 +20,7 @@
 /* Driver for Microchip LAN7500/LAN7800 chipsets. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.19 2018/12/04 01:35:15 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.20 2018/12/11 08:16:57 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1009,7 +1009,12 @@ mue_attach(device_t parent, device_t sel
 
 	IFQ_SET_READY(>if_snd);
 
-	ifp->if_capabilities = IFCAP_TSOv4 | IFCAP_TSOv6;
+	ifp->if_capabilities = IFCAP_TSOv4 | IFCAP_TSOv6 |
+	IFCAP_CSUM_IPv4_Tx | IFCAP_CSUM_IPv4_Rx |  
+	IFCAP_CSUM_TCPv4_Tx | IFCAP_CSUM_TCPv4_Rx |
+	IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UDPv4_Rx |
+	IFCAP_CSUM_TCPv6_Tx | IFCAP_CSUM_TCPv6_Rx |
+	IFCAP_CSUM_UDPv6_Tx | IFCAP_CSUM_UDPv6_Rx;
 
 	sc->mue_ec.ec_capabilities = ETHERCAP_VLAN_MTU;
 
@@ -1208,10 +1213,14 @@ mue_encap(struct mue_softc *sc, struct m
 	usbd_status err;
 	struct mue_txbuf_hdr hdr;
 	uint32_t tx_cmd_a, tx_cmd_b;
-	int len;
-	bool tso;
+	int csum, len;
+	bool tso, ipe, tpe;
 
-	tso = m->m_pkthdr.csum_flags & (M_CSUM_TSOv4 | M_CSUM_TSOv6);
+	csum = m->m_pkthdr.csum_flags;
+	tso = csum & (M_CSUM_TSOv4 | M_CSUM_TSOv6);
+	ipe = csum & M_CSUM_IPv4;
+	tpe = csum & (M_CSUM_TCPv4 | M_CSUM_UDPv4 |
+		  M_CSUM_TCPv6 | M_CSUM_UDPv6);
 
 	len = m->m_pkthdr.len;
 	if (__predict_false((!tso && len > MUE_MAX_TX_LEN) ||
@@ -1234,8 +1243,13 @@ mue_encap(struct mue_softc *sc, struct m
 		tx_cmd_b <<= MUE_TX_CMD_B_MSS_SHIFT;
 		KASSERT((tx_cmd_b & ~MUE_TX_CMD_B_MSS_MASK) == 0);
 		mue_tx_offload(sc, m);
-	} else
+	} else {
+		if (ipe)
+			tx_cmd_a |= MUE_TX_CMD_A_IPE;
+		if (tpe)
+			tx_cmd_a |= MUE_TX_CMD_A_TPE;
 		tx_cmd_b = 0;
+	}
 
 	hdr.tx_cmd_a = htole32(tx_cmd_a);
 	hdr.tx_cmd_b = htole32(tx_cmd_b);
@@ -1418,7 +1432,9 @@ mue_rxeof(struct usbd_xfer *xfer, void *
 	uint32_t rx_cmd_a, totlen;
 	uint16_t pktlen;
 	int s;
+	int csum;
 	char *buf = c->mue_buf;
+	bool v6;
 
 	if (__predict_false(sc->mue_dying)) {
 		DPRINTF(sc, "dying\n");
@@ -1457,15 +1473,17 @@ mue_rxeof(struct usbd_xfer *xfer, void *
 		hdrp = (struct mue_rxbuf_hdr *)buf;
 		rx_cmd_a = le32toh(hdrp->rx_cmd_a);
 
-		if (__predict_false(rx_cmd_a & MUE_RX_CMD_A_RED)) {
+		if (__predict_false(rx_cmd_a & MUE_RX_CMD_A_ERRORS)) {
+			/*
+			 * We cannot use MUE_RX_CMD_A_RED bit here;
+			 * it is turned on in the cases of L3/L4
+			 * checksum errors which we handle below.
+			 */
 			MUE_PRINTF(sc, "rx_cmd_a: 0x%x\n", rx_cmd_a);
 			ifp->if_ierrors++;
 			goto done;
 		}
 
-		/* XXX not yet */
-		KASSERT((rx_cmd_a & MUE_RX_CMD_A_ICSM) == 0);
-
 		pktlen = (uint16_t)(rx_cmd_a & MUE_RX_CMD_A_LEN_MASK);
 		if (sc->mue_flags & LAN7500)
 			pktlen -= 2;
@@ -1488,6 +1506,36 @@ mue_rxeof(struct usbd_xfer *xfer, void *
 		m_set_rcvif(m, ifp);
 		m->m_pkthdr.len = m->m_len = pktlen;
 		m->m_flags |= M_HASFCS;
+
+		if (__predict_false(rx_cmd_a & MUE_RX_CMD_A_ICSM)) {
+			csum = 0;
+		} else {
+			v6 = rx_cmd_a & MUE_RX_CMD_A_IPV;
+			switch (rx_cmd_a & MUE_RX_CMD_A_PID) {
+			case MUE_RX_CMD_A_PID_TCP:
+csum = v6 ?
+M_CSUM_TCPv6 : M_CSUM_IPv4 | M_CSUM_TCPv4;
+break;
+			case MUE_RX_CMD_A_PID_UDP:
+csum = v6 ?
+M_CSUM_UDPv6 : M_CSUM_IPv4 | M_CSUM_UDPv4;
+break;
+			case MUE_RX_CMD_A_PID_IP:
+csum = v6 ? 0 : M_CSUM_IPv4;
+break;
+			default:
+csum = 0;
+break;
+			}
+			csum &= ifp->if_csum_flags_rx;
+			if (__predict_false((csum & M_CSUM_IPv4) &&
+			(rx_cmd_a & MUE_RX_CMD_A_ICE)))
+csum |= M_CSUM_IPv4_BAD;
+			if (__predict_false((csum & ~M_CSUM_IPv4) &&
+			(rx_cmd_a & MUE_RX_CMD_A_TCE)))
+csum |= M_CSUM_TCP_UDP_BAD;
+		}
+		m->m_pkthdr.csum_flags = csum;
 		memcpy(mtod(m, char *), buf + sizeof(*hdrp), pktlen);
 
 		/* Attention: sizeof(hdr) = 10 */
@@ -1643,6 +1691,8 @@ mue_ioctl(struct ifnet *ifp, u_long cmd,
 		if ((error = ether_ioctl(ifp, cmd, data)) != ENETRESET)
 			break;
 		error = 0;
+		if (cmd == SIOCSIFCAP)
+			mue_sethwcsum(sc);
 		if (cmd == SIOCADDMULTI || cmd == SIOCDELMULTI)
 			mue_setmulti(sc);
 		break;

Index: src/sys/dev/usb/if_muevar.h
diff -u